@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.
Files changed (517) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +31 -0
  3. package/README.md +45 -0
  4. package/package.json +176 -0
  5. package/src/actions/record.actions.js +312 -0
  6. package/src/adapters/adapter.contracts.js +143 -0
  7. package/src/adapters/archive/archive.adapter.js +502 -0
  8. package/src/adapters/archive/archive.portableChangeset.js +141 -0
  9. package/src/adapters/archive/archive.transport.js +124 -0
  10. package/src/artifacts/artifact.localDraft.js +27 -0
  11. package/src/artifacts/artifact.normalize.js +28 -0
  12. package/src/artifacts/artifact.parse.js +207 -0
  13. package/src/artifacts/artifact.record.js +83 -0
  14. package/src/audit/audit.run.js +103 -0
  15. package/src/audit/audit.summary.js +7 -0
  16. package/src/diagnostics/sourceBoundary.report.js +112 -0
  17. package/src/export/package.apply.js +349 -0
  18. package/src/export/package.builder.js +366 -0
  19. package/src/export/package.bytes.js +164 -0
  20. package/src/export/package.controlIntegrity.js +42 -0
  21. package/src/export/package.controlTopology.js +97 -0
  22. package/src/export/package.fileMap.js +174 -0
  23. package/src/export/package.manifest.js +401 -0
  24. package/src/export/package.preflight.js +204 -0
  25. package/src/export/package.sourceReference.js +81 -0
  26. package/src/export/package.workspaceContext.js +144 -0
  27. package/src/export/package.zip.js +128 -0
  28. package/src/export/tree.bundle.js +278 -0
  29. package/src/governance/governance.boundary.js +196 -0
  30. package/src/integrity/integrity.c14nV2.js +190 -0
  31. package/src/integrity/integrity.methodReference.js +73 -0
  32. package/src/integrity/integrity.validate.js +56 -0
  33. package/src/lineage/lineage.candidateResolution.js +46 -0
  34. package/src/lineage/lineage.githubIssueComment.js +106 -0
  35. package/src/lineage/lineage.githubIssueLocal.js +196 -0
  36. package/src/lineage/lineage.githubIssueTarget.js +89 -0
  37. package/src/lineage/lineage.integrity.js +133 -0
  38. package/src/lineage/lineage.materialPreference.js +26 -0
  39. package/src/lineage/lineage.model.js +63 -0
  40. package/src/lineage/lineage.parentAuthority.js +5 -0
  41. package/src/lineage/lineage.parentBinding.js +104 -0
  42. package/src/lineage/lineage.pathBasis.js +47 -0
  43. package/src/lineage/lineage.resolve.js +388 -0
  44. package/src/lineage/lineage.sourceScope.js +74 -0
  45. package/src/lineage/lineage.targetKeys.js +80 -0
  46. package/src/lineage/lineage.traverse.js +132 -0
  47. package/src/public/applicationProjection.js +236 -0
  48. package/src/public/companionResources.js +246 -0
  49. package/src/public/index.js +16 -0
  50. package/src/public/node.js +2 -0
  51. package/src/public/schemaAncestry.js +26 -0
  52. package/src/publication/publication.contract.js +196 -0
  53. package/src/publication/publication.preflight.js +159 -0
  54. package/src/publication/publication.targetContract.js +241 -0
  55. package/src/reingest/reingest.plan.js +162 -0
  56. package/src/release/plan.mjs +28 -0
  57. package/src/release/policy.mjs +100 -0
  58. package/src/release/run.mjs +74 -0
  59. package/src/schemas/capability.registry.js +226 -0
  60. package/src/schemas/companion.js +245 -0
  61. package/src/schemas/contracts.js +6 -0
  62. package/src/schemas/coordination/handoff/tiinex.handoff.v1.schema.js +14 -0
  63. package/src/schemas/coordination/handoff/tiinex.handoff.v1.schema.json +23 -0
  64. package/src/schemas/coordination/handoff/tiinex.handoff.v1.schema.runtime.json +4283 -0
  65. package/src/schemas/coordination/handoff/tiinex.handoff.v1.schema.source.js +9 -0
  66. package/src/schemas/coordination/project/tiinex.project.v1.schema.js +26 -0
  67. package/src/schemas/coordination/project/tiinex.project.v1.schema.json +23 -0
  68. package/src/schemas/coordination/project/tiinex.project.v1.schema.runtime.json +1985 -0
  69. package/src/schemas/coordination/project/tiinex.project.v1.schema.source.js +9 -0
  70. package/src/schemas/core/decision/tiinex.decision.v1.schema.js +14 -0
  71. package/src/schemas/core/decision/tiinex.decision.v1.schema.json +24 -0
  72. package/src/schemas/core/decision/tiinex.decision.v1.schema.runtime.json +1700 -0
  73. package/src/schemas/core/decision/tiinex.decision.v1.schema.source.js +9 -0
  74. package/src/schemas/core/evidence/tiinex.evidence.v1.capabilities.js +14 -0
  75. package/src/schemas/core/evidence/tiinex.evidence.v1.en.i18n.json +6 -0
  76. package/src/schemas/core/evidence/tiinex.evidence.v1.findings.js +9 -0
  77. package/src/schemas/core/evidence/tiinex.evidence.v1.presenter.js +1 -0
  78. package/src/schemas/core/evidence/tiinex.evidence.v1.schema.js +32 -0
  79. package/src/schemas/core/evidence/tiinex.evidence.v1.schema.json +24 -0
  80. package/src/schemas/core/evidence/tiinex.evidence.v1.schema.runtime.json +2184 -0
  81. package/src/schemas/core/evidence/tiinex.evidence.v1.schema.source.js +9 -0
  82. package/src/schemas/core/evidence/tiinex.evidence.v1.sv.i18n.json +6 -0
  83. package/src/schemas/core/evidence/tiinex.evidence.v1.transitions.js +1 -0
  84. package/src/schemas/core/evidence/tiinex.evidence.v1.validate.js +10 -0
  85. package/src/schemas/core/feedback/tiinex.feedback.v1.schema.js +14 -0
  86. package/src/schemas/core/feedback/tiinex.feedback.v1.schema.json +23 -0
  87. package/src/schemas/core/feedback/tiinex.feedback.v1.schema.runtime.json +1773 -0
  88. package/src/schemas/core/feedback/tiinex.feedback.v1.schema.source.js +9 -0
  89. package/src/schemas/core/interpretation/tiinex.interpretation.v1.capabilities.js +11 -0
  90. package/src/schemas/core/interpretation/tiinex.interpretation.v1.contract.js +40 -0
  91. package/src/schemas/core/interpretation/tiinex.interpretation.v1.en.i18n.json +9 -0
  92. package/src/schemas/core/interpretation/tiinex.interpretation.v1.findings.js +12 -0
  93. package/src/schemas/core/interpretation/tiinex.interpretation.v1.localMaterialization.js +89 -0
  94. package/src/schemas/core/interpretation/tiinex.interpretation.v1.presenter.js +8 -0
  95. package/src/schemas/core/interpretation/tiinex.interpretation.v1.schema.js +34 -0
  96. package/src/schemas/core/interpretation/tiinex.interpretation.v1.schema.json +23 -0
  97. package/src/schemas/core/interpretation/tiinex.interpretation.v1.schema.runtime.json +2029 -0
  98. package/src/schemas/core/interpretation/tiinex.interpretation.v1.schema.source.js +9 -0
  99. package/src/schemas/core/interpretation/tiinex.interpretation.v1.sv.i18n.json +9 -0
  100. package/src/schemas/core/interpretation/tiinex.interpretation.v1.transitions.js +1 -0
  101. package/src/schemas/core/interpretation/tiinex.interpretation.v1.validate.js +25 -0
  102. package/src/schemas/core/preservation/tiinex.preservation.v1.capabilities.js +14 -0
  103. package/src/schemas/core/preservation/tiinex.preservation.v1.en.i18n.json +6 -0
  104. package/src/schemas/core/preservation/tiinex.preservation.v1.findings.js +9 -0
  105. package/src/schemas/core/preservation/tiinex.preservation.v1.presenter.js +1 -0
  106. package/src/schemas/core/preservation/tiinex.preservation.v1.schema.js +31 -0
  107. package/src/schemas/core/preservation/tiinex.preservation.v1.schema.json +23 -0
  108. package/src/schemas/core/preservation/tiinex.preservation.v1.schema.runtime.json +2033 -0
  109. package/src/schemas/core/preservation/tiinex.preservation.v1.schema.source.js +9 -0
  110. package/src/schemas/core/preservation/tiinex.preservation.v1.sv.i18n.json +6 -0
  111. package/src/schemas/core/preservation/tiinex.preservation.v1.transitions.js +1 -0
  112. package/src/schemas/core/preservation/tiinex.preservation.v1.validate.js +10 -0
  113. package/src/schemas/core/relation/tiinex.relation.v1.capabilities.js +7 -0
  114. package/src/schemas/core/relation/tiinex.relation.v1.contract.js +3 -0
  115. package/src/schemas/core/relation/tiinex.relation.v1.en.i18n.json +4 -0
  116. package/src/schemas/core/relation/tiinex.relation.v1.findings.js +9 -0
  117. package/src/schemas/core/relation/tiinex.relation.v1.localMaterialization.js +153 -0
  118. package/src/schemas/core/relation/tiinex.relation.v1.presenter.js +3 -0
  119. package/src/schemas/core/relation/tiinex.relation.v1.schema.js +20 -0
  120. package/src/schemas/core/relation/tiinex.relation.v1.schema.json +23 -0
  121. package/src/schemas/core/relation/tiinex.relation.v1.schema.runtime.json +1668 -0
  122. package/src/schemas/core/relation/tiinex.relation.v1.schema.source.js +9 -0
  123. package/src/schemas/core/relation/tiinex.relation.v1.sv.i18n.json +4 -0
  124. package/src/schemas/core/relation/tiinex.relation.v1.transitions.js +1 -0
  125. package/src/schemas/core/relation/tiinex.relation.v1.validate.js +36 -0
  126. package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.capabilities.js +14 -0
  127. package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.contract.js +57 -0
  128. package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.en.i18n.json +4 -0
  129. package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.findings.js +13 -0
  130. package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.presenter.js +3 -0
  131. package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.schema.js +20 -0
  132. package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.schema.json +24 -0
  133. package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.schema.runtime.json +3315 -0
  134. package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.schema.source.js +9 -0
  135. package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.sv.i18n.json +4 -0
  136. package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.transitions.js +1 -0
  137. package/src/schemas/core/relation/workspace/representation/tiinex.workspace.representation.v1.validate.js +78 -0
  138. package/src/schemas/core/signal/tiinex.signal.v1.schema.js +14 -0
  139. package/src/schemas/core/signal/tiinex.signal.v1.schema.json +23 -0
  140. package/src/schemas/core/signal/tiinex.signal.v1.schema.runtime.json +1733 -0
  141. package/src/schemas/core/signal/tiinex.signal.v1.schema.source.js +9 -0
  142. package/src/schemas/core/task/tiinex.task.v1.capabilities.js +11 -0
  143. package/src/schemas/core/task/tiinex.task.v1.contract.js +3 -0
  144. package/src/schemas/core/task/tiinex.task.v1.en.i18n.json +15 -0
  145. package/src/schemas/core/task/tiinex.task.v1.findings.js +18 -0
  146. package/src/schemas/core/task/tiinex.task.v1.localMaterialization.js +148 -0
  147. package/src/schemas/core/task/tiinex.task.v1.presenter.js +8 -0
  148. package/src/schemas/core/task/tiinex.task.v1.schema.js +35 -0
  149. package/src/schemas/core/task/tiinex.task.v1.schema.json +23 -0
  150. package/src/schemas/core/task/tiinex.task.v1.schema.runtime.json +1708 -0
  151. package/src/schemas/core/task/tiinex.task.v1.schema.source.js +9 -0
  152. package/src/schemas/core/task/tiinex.task.v1.sv.i18n.json +15 -0
  153. package/src/schemas/core/task/tiinex.task.v1.transitions.js +3 -0
  154. package/src/schemas/core/task/tiinex.task.v1.validate.js +41 -0
  155. package/src/schemas/core/topic/tiinex.topic.v1.capabilities.js +14 -0
  156. package/src/schemas/core/topic/tiinex.topic.v1.creation.js +46 -0
  157. package/src/schemas/core/topic/tiinex.topic.v1.en.i18n.json +8 -0
  158. package/src/schemas/core/topic/tiinex.topic.v1.findings.js +11 -0
  159. package/src/schemas/core/topic/tiinex.topic.v1.localMaterialization.js +135 -0
  160. package/src/schemas/core/topic/tiinex.topic.v1.presenter.js +1 -0
  161. package/src/schemas/core/topic/tiinex.topic.v1.schema.js +34 -0
  162. package/src/schemas/core/topic/tiinex.topic.v1.schema.json +23 -0
  163. package/src/schemas/core/topic/tiinex.topic.v1.schema.runtime.json +1699 -0
  164. package/src/schemas/core/topic/tiinex.topic.v1.schema.source.js +9 -0
  165. package/src/schemas/core/topic/tiinex.topic.v1.sv.i18n.json +8 -0
  166. package/src/schemas/core/topic/tiinex.topic.v1.transitions.js +31 -0
  167. package/src/schemas/core/topic/tiinex.topic.v1.validate.js +11 -0
  168. package/src/schemas/creation.capability.js +289 -0
  169. package/src/schemas/creation.contracts.js +334 -0
  170. package/src/schemas/creation.executionSnapshot.js +79 -0
  171. package/src/schemas/creation.factoryQualification.js +73 -0
  172. package/src/schemas/creation.renderer.js +244 -0
  173. package/src/schemas/creation.representation.js +279 -0
  174. package/src/schemas/creation.rootMetadata.js +6 -0
  175. package/src/schemas/creation.schemaReferences.js +65 -0
  176. package/src/schemas/discovery/finding/tiinex.discovery.finding.v1.schema.js +14 -0
  177. package/src/schemas/discovery/finding/tiinex.discovery.finding.v1.schema.json +23 -0
  178. package/src/schemas/discovery/finding/tiinex.discovery.finding.v1.schema.runtime.json +1873 -0
  179. package/src/schemas/discovery/finding/tiinex.discovery.finding.v1.schema.source.js +9 -0
  180. package/src/schemas/discovery/tiinex.discovery.v1.schema.js +14 -0
  181. package/src/schemas/discovery/tiinex.discovery.v1.schema.json +23 -0
  182. package/src/schemas/discovery/tiinex.discovery.v1.schema.runtime.json +1839 -0
  183. package/src/schemas/discovery/tiinex.discovery.v1.schema.source.js +9 -0
  184. package/src/schemas/generic.artifact.module.js +25 -0
  185. package/src/schemas/party/organization/tiinex.party.organization.v1.schema.js +26 -0
  186. package/src/schemas/party/organization/tiinex.party.organization.v1.schema.json +23 -0
  187. package/src/schemas/party/organization/tiinex.party.organization.v1.schema.runtime.json +2249 -0
  188. package/src/schemas/party/organization/tiinex.party.organization.v1.schema.source.js +9 -0
  189. package/src/schemas/party/role/tiinex.party.role.v1.schema.js +26 -0
  190. package/src/schemas/party/role/tiinex.party.role.v1.schema.json +24 -0
  191. package/src/schemas/party/role/tiinex.party.role.v1.schema.runtime.json +2091 -0
  192. package/src/schemas/party/role/tiinex.party.role.v1.schema.source.js +9 -0
  193. package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.capabilities.js +14 -0
  194. package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.en.i18n.json +4 -0
  195. package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.findings.js +1 -0
  196. package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.presenter.js +1 -0
  197. package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.schema.js +29 -0
  198. package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.schema.json +21 -0
  199. package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.schema.runtime.json +2180 -0
  200. package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.schema.source.js +9 -0
  201. package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.sv.i18n.json +4 -0
  202. package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.transitions.js +1 -0
  203. package/src/schemas/presentation/surface/tiinex.presentation.surface.v1.validate.js +1 -0
  204. package/src/schemas/reduction/tiinex.reduction.v1.schema.js +26 -0
  205. package/src/schemas/reduction/tiinex.reduction.v1.schema.json +23 -0
  206. package/src/schemas/reduction/tiinex.reduction.v1.schema.runtime.json +1733 -0
  207. package/src/schemas/reduction/tiinex.reduction.v1.schema.source.js +9 -0
  208. package/src/schemas/reference.shapes.js +33 -0
  209. package/src/schemas/registry.js +36 -0
  210. package/src/schemas/resolver.js +13 -0
  211. package/src/schemas/schema/module/tiinex.schema.module.v1.capabilities.js +14 -0
  212. package/src/schemas/schema/module/tiinex.schema.module.v1.en.i18n.json +4 -0
  213. package/src/schemas/schema/module/tiinex.schema.module.v1.findings.js +1 -0
  214. package/src/schemas/schema/module/tiinex.schema.module.v1.presenter.js +1 -0
  215. package/src/schemas/schema/module/tiinex.schema.module.v1.schema.js +29 -0
  216. package/src/schemas/schema/module/tiinex.schema.module.v1.schema.json +21 -0
  217. package/src/schemas/schema/module/tiinex.schema.module.v1.schema.runtime.json +2093 -0
  218. package/src/schemas/schema/module/tiinex.schema.module.v1.schema.source.js +9 -0
  219. package/src/schemas/schema/module/tiinex.schema.module.v1.sv.i18n.json +4 -0
  220. package/src/schemas/schema/module/tiinex.schema.module.v1.transitions.js +1 -0
  221. package/src/schemas/schema/module/tiinex.schema.module.v1.validate.js +1 -0
  222. package/src/schemas/schema.factory.descriptor.js +104 -0
  223. package/src/schemas/schema.githubSourceTarget.js +131 -0
  224. package/src/schemas/schema.identity.js +10 -0
  225. package/src/schemas/schema.reference.js +133 -0
  226. package/src/schemas/schema.source.js +239 -0
  227. package/src/schemas/tiinex.root.v1.capabilities.js +14 -0
  228. package/src/schemas/tiinex.root.v1.classify.js +55 -0
  229. package/src/schemas/tiinex.root.v1.en.i18n.json +24 -0
  230. package/src/schemas/tiinex.root.v1.fallback.js +84 -0
  231. package/src/schemas/tiinex.root.v1.findings.js +19 -0
  232. package/src/schemas/tiinex.root.v1.presenter.js +5 -0
  233. package/src/schemas/tiinex.root.v1.schema.js +29 -0
  234. package/src/schemas/tiinex.root.v1.schema.json +24 -0
  235. package/src/schemas/tiinex.root.v1.schema.runtime.json +1574 -0
  236. package/src/schemas/tiinex.root.v1.schema.source.js +9 -0
  237. package/src/schemas/tiinex.root.v1.sv.i18n.json +24 -0
  238. package/src/schemas/tiinex.root.v1.transitions.js +1 -0
  239. package/src/schemas/tiinex.root.v1.validate.js +36 -0
  240. package/src/schemas/validation/finding/tiinex.validation.finding.v1.schema.js +14 -0
  241. package/src/schemas/validation/finding/tiinex.validation.finding.v1.schema.json +23 -0
  242. package/src/schemas/validation/finding/tiinex.validation.finding.v1.schema.runtime.json +2027 -0
  243. package/src/schemas/validation/finding/tiinex.validation.finding.v1.schema.source.js +9 -0
  244. package/src/schemas/validation/method/tiinex.validation.method.v1.schema.js +14 -0
  245. package/src/schemas/validation/method/tiinex.validation.method.v1.schema.json +23 -0
  246. package/src/schemas/validation/method/tiinex.validation.method.v1.schema.runtime.json +1848 -0
  247. package/src/schemas/validation/method/tiinex.validation.method.v1.schema.source.js +9 -0
  248. package/src/schemas/validation/report/tiinex.validation.report.v1.schema.js +14 -0
  249. package/src/schemas/validation/report/tiinex.validation.report.v1.schema.json +23 -0
  250. package/src/schemas/validation/report/tiinex.validation.report.v1.schema.runtime.json +2015 -0
  251. package/src/schemas/validation/report/tiinex.validation.report.v1.schema.source.js +9 -0
  252. package/src/schemas/workspace/tiinex.workspace.v1.capabilities.js +12 -0
  253. package/src/schemas/workspace/tiinex.workspace.v1.en.i18n.json +7 -0
  254. package/src/schemas/workspace/tiinex.workspace.v1.findings.js +5 -0
  255. package/src/schemas/workspace/tiinex.workspace.v1.presenter.js +27 -0
  256. package/src/schemas/workspace/tiinex.workspace.v1.schema.js +30 -0
  257. package/src/schemas/workspace/tiinex.workspace.v1.schema.json +23 -0
  258. package/src/schemas/workspace/tiinex.workspace.v1.schema.runtime.json +1596 -0
  259. package/src/schemas/workspace/tiinex.workspace.v1.schema.source.js +9 -0
  260. package/src/schemas/workspace/tiinex.workspace.v1.sv.i18n.json +7 -0
  261. package/src/schemas/workspace/tiinex.workspace.v1.transitions.js +10 -0
  262. package/src/schemas/workspace/tiinex.workspace.v1.validate.js +10 -0
  263. package/src/sources/github/github.issueTarget.js +127 -0
  264. package/src/sources/origin.references.js +249 -0
  265. package/src/sources/source.explicitTargets.js +49 -0
  266. package/src/sources/transport.levels.js +107 -0
  267. package/src/tooling/portable/adapters/cli/cli.cold-start-input.js +34 -0
  268. package/src/tooling/portable/adapters/cli/cli.command-input.js +455 -0
  269. package/src/tooling/portable/adapters/cli/cli.common-author.js +249 -0
  270. package/src/tooling/portable/adapters/cli/cli.common-output.js +330 -0
  271. package/src/tooling/portable/adapters/cli/cli.editor-assistance.js +13 -0
  272. package/src/tooling/portable/adapters/cli/cli.ground-materialize.js +96 -0
  273. package/src/tooling/portable/adapters/cli/cli.ground-recovery.js +99 -0
  274. package/src/tooling/portable/adapters/cli/cli.handoff-manufacture.js +345 -0
  275. package/src/tooling/portable/adapters/cli/cli.handoff-sibling-allocation.js +31 -0
  276. package/src/tooling/portable/adapters/cli/cli.help.js +80 -0
  277. package/src/tooling/portable/adapters/cli/cli.land.js +13 -0
  278. package/src/tooling/portable/adapters/cli/cli.local-output.js +72 -0
  279. package/src/tooling/portable/adapters/cli/cli.material-policy.js +6 -0
  280. package/src/tooling/portable/adapters/cli/cli.operator-bridge.js +18 -0
  281. package/src/tooling/portable/adapters/cli/cli.reduction-input.js +14 -0
  282. package/src/tooling/portable/adapters/cli/cli.run.js +434 -0
  283. package/src/tooling/portable/adapters/llm/llm.entrypoint.js +34 -0
  284. package/src/tooling/portable/adapters/node/checkpoint.verify.js +267 -0
  285. package/src/tooling/portable/adapters/node/handoff.manufacture.bootstrap.js +109 -0
  286. package/src/tooling/portable/adapters/node/handoff.manufacture.enumeration.js +94 -0
  287. package/src/tooling/portable/adapters/node/handoff.manufacture.js +193 -0
  288. package/src/tooling/portable/adapters/node/handoff.manufacture.multiRoot.js +49 -0
  289. package/src/tooling/portable/adapters/node/handoff.manufacture.packageParent.js +130 -0
  290. package/src/tooling/portable/adapters/node/handoff.manufacture.requirements.js +353 -0
  291. package/src/tooling/portable/adapters/node/handoff.manufacture.scope.js +147 -0
  292. package/src/tooling/portable/adapters/node/workspaceCarrier.manufacture.js +62 -0
  293. package/src/tooling/portable/assets/asset.operations.js +170 -0
  294. package/src/tooling/portable/audit/audit.capability.js +119 -0
  295. package/src/tooling/portable/bootstrap/artifact.result.selfverify.mjs +109 -0
  296. package/src/tooling/portable/bootstrap/bootstrap.case.mjs +43 -0
  297. package/src/tooling/portable/bootstrap/tiinex.llm.bootstrap.md +814 -0
  298. package/src/tooling/portable/bootstrap/tiinex.llm.bootstrap.pointer.json +25 -0
  299. package/src/tooling/portable/checkpoint/portable.checkpoint.js +89 -0
  300. package/src/tooling/portable/conformance/checkpoint.qualification.js +271 -0
  301. package/src/tooling/portable/draft/draft.create.js +389 -0
  302. package/src/tooling/portable/draft/draft.crud.js +175 -0
  303. package/src/tooling/portable/draft/draft.exact.js +173 -0
  304. package/src/tooling/portable/draft/draft.operations.js +265 -0
  305. package/src/tooling/portable/draft/draft.qualification.js +45 -0
  306. package/src/tooling/portable/draft/draft.set.js +193 -0
  307. package/src/tooling/portable/draft/draft.validation-context.js +7 -0
  308. package/src/tooling/portable/editor/authoring.parent.js +37 -0
  309. package/src/tooling/portable/editor/editor.assistance.js +221 -0
  310. package/src/tooling/portable/editor/staged.validation.js +96 -0
  311. package/src/tooling/portable/engine.facade.js +468 -0
  312. package/src/tooling/portable/findings.js +92 -0
  313. package/src/tooling/portable/grounding/grounding.capsule.js +128 -0
  314. package/src/tooling/portable/grounding/grounding.continuity.js +283 -0
  315. package/src/tooling/portable/grounding/grounding.participantAuthority.js +20 -0
  316. package/src/tooling/portable/grounding/grounding.planningContext.js +34 -0
  317. package/src/tooling/portable/grounding/grounding.readiness.authority.js +17 -0
  318. package/src/tooling/portable/grounding/grounding.readiness.js +316 -0
  319. package/src/tooling/portable/grounding/grounding.readiness.support.js +245 -0
  320. package/src/tooling/portable/grounding/grounding.sourceEvidence.js +71 -0
  321. package/src/tooling/portable/grounding/grounding.workContext.js +72 -0
  322. package/src/tooling/portable/grounding/grounding.workProvenance.js +153 -0
  323. package/src/tooling/portable/handoff/carrierLineage.js +214 -0
  324. package/src/tooling/portable/handoff/carrierProfile.js +54 -0
  325. package/src/tooling/portable/handoff/carrierProjection.js +193 -0
  326. package/src/tooling/portable/handoff/carrierProjection.routeQualification.js +228 -0
  327. package/src/tooling/portable/handoff/carrierProjection.shared.js +7 -0
  328. package/src/tooling/portable/handoff/carrierProjection.workspaces.js +54 -0
  329. package/src/tooling/portable/handoff/coldConsumerEntrypoint.js +185 -0
  330. package/src/tooling/portable/handoff/coldStartQualification.contract.js +184 -0
  331. package/src/tooling/portable/handoff/coldStartQualification.grounding.js +392 -0
  332. package/src/tooling/portable/handoff/coldStartQualification.js +22 -0
  333. package/src/tooling/portable/handoff/coldStartQualification.materials.js +364 -0
  334. package/src/tooling/portable/handoff/coldStartQualification.observation.js +220 -0
  335. package/src/tooling/portable/handoff/coldStartQualification.run.js +81 -0
  336. package/src/tooling/portable/handoff/coldStartQualification.shared.js +57 -0
  337. package/src/tooling/portable/handoff/coldStartRolePointers.js +39 -0
  338. package/src/tooling/portable/handoff/contextAudit.js +247 -0
  339. package/src/tooling/portable/handoff/contracts/tiinex.handoff.package.v1.schema.md +409 -0
  340. package/src/tooling/portable/handoff/handoffAuthoringPlan.js +35 -0
  341. package/src/tooling/portable/handoff/handoffEndpointProjection.js +61 -0
  342. package/src/tooling/portable/handoff/handoffLeafProjection.js +91 -0
  343. package/src/tooling/portable/handoff/humanOutputPresentation.js +21 -0
  344. package/src/tooling/portable/handoff/manufacture.js +84 -0
  345. package/src/tooling/portable/handoff/materialClosure.archiveV2.binding.js +72 -0
  346. package/src/tooling/portable/handoff/materialClosure.archiveV2.direct.js +160 -0
  347. package/src/tooling/portable/handoff/materialClosure.archiveV2.indexes.js +36 -0
  348. package/src/tooling/portable/handoff/materialClosure.archiveV2.js +247 -0
  349. package/src/tooling/portable/handoff/materialClosure.archiveV2.projectionProvider.js +44 -0
  350. package/src/tooling/portable/handoff/materialClosure.archiveV2.workspace.js +226 -0
  351. package/src/tooling/portable/handoff/materialClosure.descriptor.js +169 -0
  352. package/src/tooling/portable/handoff/materialClosure.inputBinding.js +372 -0
  353. package/src/tooling/portable/handoff/materialClosure.inputBinding.support.js +62 -0
  354. package/src/tooling/portable/handoff/materialClosure.materialized.js +143 -0
  355. package/src/tooling/portable/handoff/materialClosure.materials.js +116 -0
  356. package/src/tooling/portable/handoff/materialClosure.package.js +181 -0
  357. package/src/tooling/portable/handoff/materialClosure.plan.js +204 -0
  358. package/src/tooling/portable/handoff/materialClosure.readiness.js +36 -0
  359. package/src/tooling/portable/handoff/materialClosure.requirements.js +137 -0
  360. package/src/tooling/portable/handoff/operatorContextProjection.js +105 -0
  361. package/src/tooling/portable/handoff/pointerEntrypoint.js +138 -0
  362. package/src/tooling/portable/handoff/qualifiedHandoffFixture.js +34 -0
  363. package/src/tooling/portable/handoff/recipientV2.artifactFirst.build.js +321 -0
  364. package/src/tooling/portable/handoff/recipientV2.artifactFirst.closure.js +126 -0
  365. package/src/tooling/portable/handoff/recipientV2.artifactFirst.inspect.js +194 -0
  366. package/src/tooling/portable/handoff/recipientV2.artifactFirst.materials.js +207 -0
  367. package/src/tooling/portable/handoff/recipientV2.artifactFirst.projection.js +69 -0
  368. package/src/tooling/portable/handoff/recipientV2.artifactFirst.roles.js +166 -0
  369. package/src/tooling/portable/handoff/recipientV2.artifactFirst.routes.js +113 -0
  370. package/src/tooling/portable/handoff/recipientV2.artifactFirst.shared.js +87 -0
  371. package/src/tooling/portable/handoff/recipientV2.artifactFirst.workspaces.js +160 -0
  372. package/src/tooling/portable/handoff/recipientV2.artifactFirstPhase1.js +44 -0
  373. package/src/tooling/portable/handoff/recipientV2.artifactInspection.js +55 -0
  374. package/src/tooling/portable/handoff/recipientV2.artifacts.js +174 -0
  375. package/src/tooling/portable/handoff/recipientV2.coldProjection.js +24 -0
  376. package/src/tooling/portable/handoff/recipientV2.delivery.js +48 -0
  377. package/src/tooling/portable/handoff/recipientV2.endpointRolePointers.js +179 -0
  378. package/src/tooling/portable/handoff/recipientV2.entryContract.js +28 -0
  379. package/src/tooling/portable/handoff/recipientV2.humanOutput.js +78 -0
  380. package/src/tooling/portable/handoff/recipientV2.inspect.helpers.js +218 -0
  381. package/src/tooling/portable/handoff/recipientV2.inspect.js +194 -0
  382. package/src/tooling/portable/handoff/recipientV2.inspect.pathToken.js +9 -0
  383. package/src/tooling/portable/handoff/recipientV2.inspect.projection.js +58 -0
  384. package/src/tooling/portable/handoff/recipientV2.inspect.workspaces.js +177 -0
  385. package/src/tooling/portable/handoff/recipientV2.lineage.js +142 -0
  386. package/src/tooling/portable/handoff/recipientV2.packageV1.build.js +147 -0
  387. package/src/tooling/portable/handoff/recipientV2.packageV1.constants.js +4 -0
  388. package/src/tooling/portable/handoff/recipientV2.packageV1.contract.js +101 -0
  389. package/src/tooling/portable/handoff/recipientV2.packageV1.inspect.helpers.js +126 -0
  390. package/src/tooling/portable/handoff/recipientV2.packageV1.inspect.js +185 -0
  391. package/src/tooling/portable/handoff/recipientV2.packageV1.js +12 -0
  392. package/src/tooling/portable/handoff/recipientV2.packageV1.shared.js +24 -0
  393. package/src/tooling/portable/handoff/recipientV2.packageV1.workspaceProjection.js +22 -0
  394. package/src/tooling/portable/handoff/recipientV2.pointer.js +40 -0
  395. package/src/tooling/portable/handoff/recipientV2.routeSelection.js +16 -0
  396. package/src/tooling/portable/handoff/recipientV2.topology.helpers.js +20 -0
  397. package/src/tooling/portable/handoff/recipientV2.topology.js +320 -0
  398. package/src/tooling/portable/handoff/recipientV2.topology.materials.js +70 -0
  399. package/src/tooling/portable/handoff/recipientV2.topology.workspaces.js +193 -0
  400. package/src/tooling/portable/handoff/recipientV2.transportManifest.js +123 -0
  401. package/src/tooling/portable/handoff/recipientV2.workspaceRepresentation.js +163 -0
  402. package/src/tooling/portable/handoff/routeArtifactConformance.js +130 -0
  403. package/src/tooling/portable/handoff/toolingBootstrap.js +67 -0
  404. package/src/tooling/portable/handoff/transportCompanion.js +175 -0
  405. package/src/tooling/portable/handoff/workspaceByteProvider.archive.js +95 -0
  406. package/src/tooling/portable/handoff/workspaceByteProvider.js +271 -0
  407. package/src/tooling/portable/handoff/workspaceCarrier.manufacture.js +93 -0
  408. package/src/tooling/portable/handoff/workspaceLandingPlan.js +142 -0
  409. package/src/tooling/portable/handoff/workspacePackageSources.js +105 -0
  410. package/src/tooling/portable/handoff/workspaceQualifiedReference.js +10 -0
  411. package/src/tooling/portable/handoff/workspaceSourceIdentity.js +52 -0
  412. package/src/tooling/portable/handoff/workspaceTargetConformance.js +134 -0
  413. package/src/tooling/portable/host/host.capabilities.js +181 -0
  414. package/src/tooling/portable/host/tool.bindings.js +357 -0
  415. package/src/tooling/portable/host/tool.receiptNormalization.js +141 -0
  416. package/src/tooling/portable/index.js +52 -0
  417. package/src/tooling/portable/input/node.input.js +184 -0
  418. package/src/tooling/portable/input/portable.input.js +249 -0
  419. package/src/tooling/portable/lifecycle/lifecycle.action.js +11 -0
  420. package/src/tooling/portable/lifecycle/lifecycle.material.js +173 -0
  421. package/src/tooling/portable/lifecycle/lifecycle.operations.js +34 -0
  422. package/src/tooling/portable/lifecycle/lifecycle.readiness.js +247 -0
  423. package/src/tooling/portable/lineage/lineage.integrity.apply.audit.js +22 -0
  424. package/src/tooling/portable/lineage/lineage.integrity.apply.evidence.js +36 -0
  425. package/src/tooling/portable/lineage/lineage.integrity.apply.js +306 -0
  426. package/src/tooling/portable/lineage/lineage.integrity.apply.structure.js +178 -0
  427. package/src/tooling/portable/lineage/lineage.integrity.plan.js +377 -0
  428. package/src/tooling/portable/lineage/lineage.integrity.projection.human.js +82 -0
  429. package/src/tooling/portable/lineage/lineage.integrity.projection.js +349 -0
  430. package/src/tooling/portable/lineage/lineage.operations.js +32 -0
  431. package/src/tooling/portable/lineage/lineage.print.js +398 -0
  432. package/src/tooling/portable/lineage/lineage.print.render.js +88 -0
  433. package/src/tooling/portable/lineage/lineage.print.utils.js +58 -0
  434. package/src/tooling/portable/lineage/lineage.publicationProviderReceipts.js +141 -0
  435. package/src/tooling/portable/lineage/lineage.publicationQualification.js +183 -0
  436. package/src/tooling/portable/lineage/lineage.search.js +301 -0
  437. package/src/tooling/portable/live/live.artifact.js +192 -0
  438. package/src/tooling/portable/live/live.export.js +107 -0
  439. package/src/tooling/portable/live/live.lineage.closure.js +71 -0
  440. package/src/tooling/portable/live/live.lineage.js +338 -0
  441. package/src/tooling/portable/live/live.protocol.js +181 -0
  442. package/src/tooling/portable/materialization/durable.materialize.js +162 -0
  443. package/src/tooling/portable/materialization/epistemic.plan.js +239 -0
  444. package/src/tooling/portable/materialization/loaded.parent.js +54 -0
  445. package/src/tooling/portable/materialization/materialization.facade.js +30 -0
  446. package/src/tooling/portable/operation.catalog.js +393 -0
  447. package/src/tooling/portable/operation.catalog.package.js +183 -0
  448. package/src/tooling/portable/operation.result.js +25 -0
  449. package/src/tooling/portable/orchestration/task.prepare.js +191 -0
  450. package/src/tooling/portable/output/artifact.result.package.js +308 -0
  451. package/src/tooling/portable/output/deterministic.zip.js +88 -0
  452. package/src/tooling/portable/output/node.artifact-set.js +223 -0
  453. package/src/tooling/portable/output/node.draft.js +41 -0
  454. package/src/tooling/portable/output/node.zip.js +39 -0
  455. package/src/tooling/portable/output/recipientV2.zip.js +59 -0
  456. package/src/tooling/portable/overview/blockingCue.js +16 -0
  457. package/src/tooling/portable/overview/operatingOverview.js +413 -0
  458. package/src/tooling/portable/package/generation.binding.js +314 -0
  459. package/src/tooling/portable/package/generation.binding.projection.js +128 -0
  460. package/src/tooling/portable/package/material.graph.js +236 -0
  461. package/src/tooling/portable/package/runtime.package.js +321 -0
  462. package/src/tooling/portable/package/schema.transition.companion.js +196 -0
  463. package/src/tooling/portable/package/semantic.package.graph.js +272 -0
  464. package/src/tooling/portable/package/semantic.package.js +203 -0
  465. package/src/tooling/portable/package/semantic.package.schema-resolution.js +158 -0
  466. package/src/tooling/portable/package/semantic.package.transition-registry.js +189 -0
  467. package/src/tooling/portable/package/semantic.package.types.js +18 -0
  468. package/src/tooling/portable/providers/schema.bootstrap.provenance.js +10 -0
  469. package/src/tooling/portable/providers/schema.provider.qualification.js +52 -0
  470. package/src/tooling/portable/providers/schema.providers.js +458 -0
  471. package/src/tooling/portable/publication/runtime.publication.js +53 -0
  472. package/src/tooling/portable/qualification.js +150 -0
  473. package/src/tooling/portable/reduction/reduction.composition.js +229 -0
  474. package/src/tooling/portable/reduction/reduction.eligibility.helpers.js +258 -0
  475. package/src/tooling/portable/reduction/reduction.eligibility.js +191 -0
  476. package/src/tooling/portable/reduction/reduction.operations.js +30 -0
  477. package/src/tooling/portable/reduction/reduction.preflight.js +85 -0
  478. package/src/tooling/portable/reduction/reduction.shared.js +173 -0
  479. package/src/tooling/portable/schema/bootstrap/canonical.pack.js +24 -0
  480. package/src/tooling/portable/schema/bootstrap/docs-3988951208eb9a8926e84ab42625d4b42fa00c2d/party/role/tiinex.party.role.v1.schema.md +289 -0
  481. package/src/tooling/portable/schema/bootstrap/docs-3988951208eb9a8926e84ab42625d4b42fa00c2d/validation/report/tiinex.validation.report.v1.schema.md +300 -0
  482. package/src/tooling/portable/schema/bootstrap/qualified-local-root/tiinex.root.v1.runtime-projection.json +48 -0
  483. package/src/tooling/portable/schema/bootstrap/qualified-local-root/tiinex.root.v1.schema.md +865 -0
  484. package/src/tooling/portable/schema/contract.compile.js +406 -0
  485. package/src/tooling/portable/schema/contract.compile.utils.js +9 -0
  486. package/src/tooling/portable/schema/contract.constraints.js +117 -0
  487. package/src/tooling/portable/schema/contract.envelope.validate.js +177 -0
  488. package/src/tooling/portable/schema/contract.field-domain.compile.js +399 -0
  489. package/src/tooling/portable/schema/contract.field-domain.js +247 -0
  490. package/src/tooling/portable/schema/contract.field-shape.compile.js +34 -0
  491. package/src/tooling/portable/schema/contract.inheritance.inline.js +103 -0
  492. package/src/tooling/portable/schema/contract.inheritance.js +210 -0
  493. package/src/tooling/portable/schema/contract.inheritance.record.js +76 -0
  494. package/src/tooling/portable/schema/contract.machine-shape.js +309 -0
  495. package/src/tooling/portable/schema/contract.project.js +81 -0
  496. package/src/tooling/portable/schema/contract.semantic-resolution.js +82 -0
  497. package/src/tooling/portable/schema/contract.validate.js +0 -0
  498. package/src/tooling/portable/schema/lexical.shape.v1.js +338 -0
  499. package/src/tooling/portable/schema/llm.companion.js +108 -0
  500. package/src/tooling/portable/schema/named.declarations.js +162 -0
  501. package/src/tooling/portable/schema/ordinary.contract.js +193 -0
  502. package/src/tooling/portable/schema/ordinary.fields.js +205 -0
  503. package/src/tooling/portable/schema/qualifiedLocalRoot.projection.js +70 -0
  504. package/src/tooling/portable/schema/qualifiedLocalRoot.runtime.js +170 -0
  505. package/src/tooling/portable/schema/schema.contract.js +465 -0
  506. package/src/tooling/portable/schema/schema.guide.js +326 -0
  507. package/src/tooling/portable/schema/schema.snapshot.js +119 -0
  508. package/src/tooling/portable/session/portable.session.js +145 -0
  509. package/src/tooling/portable/transfer/transfer.plan.js +102 -0
  510. package/src/transitions/record.transitions.js +484 -0
  511. package/src/transitions/transition.validate.js +129 -0
  512. package/src/validation/findings.js +76 -0
  513. package/src/validation/validateArtifact.js +216 -0
  514. package/src/workspaces/workspace.entrypointCapability.js +44 -0
  515. package/src/workspaces/workspace.materialRole.js +242 -0
  516. package/src/workspaces/workspace.recordPaths.js +426 -0
  517. 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); }