@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,93 @@
1
+ import { finalizeFile } from '../../../export/package.fileMap.js';
2
+ import { exportFileMapZipUint8Array } from '../../../export/package.zip.js';
3
+ import { summarizePortableFindings } from '../findings.js';
4
+ import { inspectPortableToolingBootstrap } from './toolingBootstrap.js';
5
+ import { qualifyDirectWorkspaceForArchive, indexWorkspaceTargetDeclarations } from './materialClosure.archiveV2.workspace.js';
6
+ import { renderRecipientV2Pointer } from './recipientV2.artifacts.js';
7
+ import { RECIPIENT_V2_READ_PATH, RECIPIENT_V2_FORMAT_ID } from './recipientV2.topology.js';
8
+ import { recipientV2WorkspaceEntryCurrentRead } from './recipientV2.entryContract.js';
9
+ import { recipientV2TransportFacts } from './recipientV2.transportManifest.js';
10
+ import { buildRecipientV2BootstrapCarrier, recipientV2ParentAuthority } from './recipientV2.topology.workspaces.js';
11
+ import { safeToken, finding } from './recipientV2.topology.materials.js';
12
+ import { RECIPIENT_V2_PACKAGE_V1_ROOT_PATH, RECIPIENT_V2_PACKAGE_V1_SCHEMA_ID, RECIPIENT_V2_PACKAGE_V1_SCHEMA_TARGET } from './recipientV2.packageV1.constants.js';
13
+ import { renderHandoffPackageV1, WORKSPACE_PACKAGE_ROLE } from './recipientV2.packageV1.contract.js';
14
+ import { exactFile, workspaceSchemaTarget, deepFreeze } from './recipientV2.packageV1.shared.js';
15
+ import { inspectRecipientFacingV2Topology, roundTripRecipientFacingV2Topology } from './recipientV2.inspect.js';
16
+
17
+ export function manufactureRecipientRelativeWorkspacePackage(input = {}) {
18
+ const findings = [];
19
+ const targetByWorkspace = indexWorkspaceTargetDeclarations(input.workspaceTargets || []);
20
+ const workspaces = [...(input.workspaceMaterializations || [])].sort((a, b) => String(a.id || '').localeCompare(String(b.id || '')));
21
+ const plans = [];
22
+ for (const [index, raw] of workspaces.entries()) {
23
+ const id = String(raw.id || '').trim();
24
+ const wrapper = Object.freeze({ ...raw, materialization: String(raw.state || ''), qualification: 'qualified', correlationStatus: 'qualified' });
25
+ const qualified = qualifyDirectWorkspaceForArchive(wrapper, raw, targetByWorkspace.get(id) || [], []);
26
+ findings.push(...(qualified.findings || []));
27
+ if (qualified.status !== 'qualified' || !qualified.target) continue;
28
+ const prefix = `001-${index + 3}`;
29
+ const slug = safeToken(id);
30
+ const archiveData = exportFileMapZipUint8Array((qualified.entries || []).map((entry) => ({ path: entry.path, data: entry.data })), 'portable.workspace-carrier.workspace-archive.path.invalid');
31
+ const workspacePath = `${prefix}-${slug}.workspace.md`;
32
+ const archivePath = `${prefix}-${slug}.workspace.zip`;
33
+ const workspaceFile = exactFile(workspacePath, qualified.target.data, 'recipient-v2-package-v1-exact-workspace-artifact', 'text/markdown');
34
+ const archiveFile = exactFile(archivePath, archiveData, 'recipient-v2-package-v1-complete-workspace-snapshot', 'application/zip');
35
+ plans.push(Object.freeze({ id, raw, qualified, workspaceFile, archiveFile, projection: Object.freeze({ workspaceId: id, workspacePath, archivePath, sourceWorkspaceTargetInnerPath: qualified.target.path, sourceWorkspaceTargetSha256: workspaceFile.sha256, archiveSha256: archiveFile.sha256, archiveBytes: archiveFile.bytes, coverage: 'complete' }) }));
36
+ }
37
+ if (!plans.length || findings.some((item) => item.severity === 'error')) return blocked(findings);
38
+ const createdAt = String(input.createdAt || '1970-01-01 00:00:00');
39
+ const bootstrapSource = (input.additionalTransportFiles || []).filter((file) => String(file.path || '').startsWith('tiinex.bootstrap/'));
40
+ const packageFile = finalizeFile({
41
+ path: RECIPIENT_V2_PACKAGE_V1_ROOT_PATH,
42
+ kind: 'tiinex-handoff-package-artifact',
43
+ logicalKind: 'recipient-v2-package-v1-root',
44
+ mediaType: 'text/markdown',
45
+ content: renderHandoffPackageV1({ createdAt, packageRole: WORKSPACE_PACKAGE_ROLE, workspaces: plans.map((plan) => plan.projection), carrierLineage: input.carrierLineage || {}, carrierProfile: input.carrierProfile || null, startPath: RECIPIENT_V2_READ_PATH, bootstrapPath: bootstrapSource.length ? '001-2-bootstrap.trace.md' : '' })
46
+ });
47
+ const packageParent = recipientV2ParentAuthority(packageFile, RECIPIENT_V2_PACKAGE_V1_SCHEMA_ID, RECIPIENT_V2_PACKAGE_V1_SCHEMA_TARGET, createdAt);
48
+ const files = [packageFile, ...plans.flatMap((plan) => [plan.workspaceFile, plan.archiveFile])];
49
+ let bootstrap = null;
50
+ if (bootstrapSource.length) {
51
+ bootstrap = buildRecipientV2BootstrapCarrier(bootstrapSource, createdAt, findings, packageParent);
52
+ if (bootstrap) files.push(bootstrap.artifact, bootstrap.payload);
53
+ }
54
+ const readFacts = recipientV2TransportFacts('recovery-orientation', {
55
+ format: 'tiinex-recipient-facing-handoff-package-v1',
56
+ packageRole: WORKSPACE_PACKAGE_ROLE,
57
+ packageRootPath: RECIPIENT_V2_PACKAGE_V1_ROOT_PATH,
58
+ entryArtifactPath: RECIPIENT_V2_READ_PATH,
59
+ artifactSurface: 'tiinex.handoff.package.v1-plus-exact-complete-workspace-snapshots',
60
+ routeAuthority: 'none', routeSelectionAuthority: 'none', siblingRouteInference: false,
61
+ carrierLineage: input.carrierLineage || null, pathParentProjection: true, pathAuthority: false
62
+ });
63
+ const readFile = finalizeFile({
64
+ path: RECIPIENT_V2_READ_PATH, kind: 'handoff-recovery-pointer', logicalKind: 'recipient-v2-package-v1-workspace-recovery-orientation', mediaType: 'text/markdown', transportFacts: readFacts,
65
+ content: renderRecipientV2Pointer({ createdAt, parent: packageParent, role: 'recovery-orientation', title: 'READ BEFORE PROCEEDING — Tiinex Workspace Carrier', summary: 'Qualified recovery/orientation Pointer for the pointerless package-v1 Workspace carrier.', prose: 'Read this Start artifact first and qualify the declared Tooling bootstrap. This carrier intentionally exposes no Handoff route or Continue-from Pointer; do not infer semantic Handoff state from Workspace carriage.', currentRead: [...recipientV2WorkspaceEntryCurrentRead(), { label: 'Package Artifact', value: `[Workspace Package](${RECIPIENT_V2_PACKAGE_V1_ROOT_PATH})` }, { label: 'Carrier Dimension', value: `\`${String(input.carrierLineage?.dimension || '001')}\`` }], destinations: [{ label: 'Workspace Package contract', target: RECIPIENT_V2_PACKAGE_V1_ROOT_PATH }, ...(bootstrap ? [{ label: 'Portable Tooling bootstrap', target: bootstrap.projection.artifactPath }] : []), ...plans.map((plan) => ({ label: `Workspace ${plan.id}`, target: plan.projection.workspacePath }))], facts: readFacts })
66
+ });
67
+ files.push(readFile);
68
+ const sortedFiles = Object.freeze([...files].sort((a, b) => String(a.path || '').localeCompare(String(b.path || ''))));
69
+ const bundle = deepFreeze({ status: 'ready', files: sortedFiles, handoffClosure: null, transportFormat: RECIPIENT_V2_FORMAT_ID, boundary: 'Pointerless recipient-facing Workspace carrier. Exact carried Workspace source bytes retain authority; carrier placement creates no Handoff semantics.' });
70
+ const inspection = inspectRecipientFacingV2Topology(bundle);
71
+ const roundtrip = input.verifyRoundtrip === false ? null : roundTripRecipientFacingV2Topology(bundle, inspection);
72
+ const toolingBootstrapInspection = inspection.bootstrapInspection || inspectPortableToolingBootstrap({ files: bootstrapSource });
73
+ const allFindings = [...findings, ...(inspection.findings || []), ...(roundtrip?.findings || [])];
74
+ const ready = inspection.status === 'valid' && (!roundtrip || roundtrip.status === 'passed') && toolingBootstrapInspection.status === 'valid' && !allFindings.some((item) => item.severity === 'error');
75
+ const carrierProjection = inspection.carrierProjection || workspaceProjection(plans, input.carrierLineage || {});
76
+ return deepFreeze({
77
+ schema: 'tiinex.portable.handoff-manufacturing.v2', status: ready ? 'ready' : 'blocked', executable: ready, transportExecutable: ready,
78
+ verification: Object.freeze({ baselineManufacture: 'ready', manufacturePath: 'direct-qualified-workspace-to-pointerless-package-v1', packageInspection: inspection.status, closureInspection: 'not-applicable', carrierInspection: inspection.status, selectedHandoffConformance: 'not-applicable', pointerEntrypointInspection: 'not-applicable', coldConsumerEntrypointInspection: inspection.status, companionInspection: 'not-applicable', roundtrip: roundtrip?.status || 'not-requested', toolingBootstrap: toolingBootstrapInspection.status }),
79
+ plan: Object.freeze({ status: ready ? 'ready' : 'blocked', requiredClosureReady: true, semanticHandoffStatus: 'not-declared', workspaceMaterializations: Object.freeze(workspaces), requirements: Object.freeze({ required: Object.freeze([]), reference: Object.freeze([]) }) }),
80
+ bundle, inspection, carrierProjection, roundtrip, toolingBootstrapInspection, toolingBootstrap: input.toolingBootstrap || null, carrierLineage: input.carrierLineage || carrierProjection.lineage || null, manufacturingEvidence: input.manufacturingEvidence || null,
81
+ findings: Object.freeze(allFindings), findingSummary: summarizePortableFindings(allFindings), operationBoundary: Object.freeze({ sourceMutation: false, remoteWrite: false, handoffSemantics: false }),
82
+ boundary: 'Canonical pointerless Workspace-carrier manufacture only. No route, Handoff, Role, current-work, transfer, participation, acceptance, completion, or publication authority is created.'
83
+ });
84
+ }
85
+
86
+ function workspaceProjection(plans, lineage) {
87
+ const workspaces = plans.map((plan) => Object.freeze({ id: plan.id, title: String(plan.raw.title || plan.id), slug: safeToken(plan.id), qualification: 'qualified' }));
88
+ return deepFreeze({ schema: 'tiinex.portable.handoff-carrier-projection.v1', version: 1, status: 'ready', mode: 'workspace', lineage, workspaces: Object.freeze(workspaces), workspace: workspaces[0] || Object.freeze({ id: '', title: '', slug: '', qualification: 'unresolved' }), selection: Object.freeze({ policy: 'none', qualifiedRouteCount: 0, implicitRouteId: '', packageRole: WORKSPACE_PACKAGE_ROLE }), routes: Object.freeze([]), authority: Object.freeze({ semanticAuthority: 'none', filenameAuthority: false, dimensionalParentAuthority: false, routeSelectionAuthority: 'none' }), findings: Object.freeze([]) });
89
+ }
90
+ function blocked(findings = []) {
91
+ const all = findings.length ? findings : [finding('error', 'portable.workspace-carrier.manufacture.blocked', 'Pointerless Workspace carrier manufacture failed closed.')];
92
+ return deepFreeze({ schema: 'tiinex.portable.handoff-manufacturing.v2', status: 'blocked', executable: false, transportExecutable: false, verification: Object.freeze({ manufacturePath: 'direct-qualified-workspace-to-pointerless-package-v1' }), plan: Object.freeze({ status: 'blocked', workspaceMaterializations: Object.freeze([]), requirements: Object.freeze({ required: Object.freeze([]), reference: Object.freeze([]) }) }), bundle: null, inspection: null, carrierProjection: Object.freeze({ schema: 'tiinex.portable.handoff-carrier-projection.v1', status: 'blocked', mode: 'workspace', workspaces: Object.freeze([]), routes: Object.freeze([]), findings: Object.freeze(all) }), findings: Object.freeze(all), findingSummary: summarizePortableFindings(all), boundary: 'Failed closed before emitting pointerless Workspace carrier bytes.' });
93
+ }
@@ -0,0 +1,142 @@
1
+ import { inspectRecipientFacingV2Topology } from './recipientV2.inspect.js';
2
+ import { parseWorkspaceEntrypoints, normalizeRepositoryIdentity } from './workspaceSourceIdentity.js';
3
+
4
+ export const PORTABLE_WORKSPACE_LANDING_PLAN_SCHEMA_ID = 'tiinex.portable.workspace-landing-plan.v1';
5
+
6
+ export function projectPortableWorkspaceLandingPlan(input = {}) {
7
+ const inspection = inspectRecipientFacingV2Topology(input.bundle || input.package || input);
8
+ const findings = [];
9
+ if (String(inspection.status || '') !== 'valid') {
10
+ findings.push(finding('error', 'portable.workspace-landing.package-unqualified', 'Workspace landing planning requires one independently qualified recipient Handoff package.'));
11
+ return result('blocked', inspection, [], findings, input);
12
+ }
13
+ const repositories = normalizeRepositories(input.repositories || []);
14
+ const selections = normalizeSelections(input.selections || {});
15
+ const requestedIds = new Set([...(input.workspaceIds || input.selectedWorkspaceIds || [])].map(normalizeId).filter(Boolean));
16
+ const providerById = new Map((inspection.workspaceByteProvider?.workspaces || []).map((provider) => [normalizeId(provider.id), provider]));
17
+ const plans = [];
18
+ for (const workspace of inspection.workspaces || []) {
19
+ const id = normalizeId(workspace.workspaceId);
20
+ if (requestedIds.size && !requestedIds.has(id)) continue;
21
+ plans.push(planWorkspace({ workspace, provider: providerById.get(id), repositories, selectionId: selections[id] || '', explicit: requestedIds.size > 0 }, findings));
22
+ }
23
+ if (requestedIds.size) {
24
+ for (const id of requestedIds) if (!plans.some((item) => item.workspaceId === id)) findings.push(finding('error', 'portable.workspace-landing.workspace-unresolved', 'An explicitly requested Workspace is not present in the qualified carrier.', { workspaceId: id }));
25
+ }
26
+ const affected = plans.filter((item) => item.state === 'ready');
27
+ const blocking = findings.some((item) => item.severity === 'error');
28
+ if (!affected.length) findings.push(finding('error', 'portable.workspace-landing.no-qualified-targets', 'No qualified local repository target is ready for landing.'));
29
+ return result(blocking || !affected.length ? 'blocked' : 'ready', inspection, plans, findings, input);
30
+ }
31
+
32
+ function planWorkspace({ workspace = {}, provider = null, repositories = [], selectionId = '', explicit = false } = {}, findings = []) {
33
+ const workspaceId = normalizeId(workspace.workspaceId);
34
+ const base = {
35
+ workspaceId,
36
+ title: String(workspace.title || workspaceId),
37
+ coverage: String(workspace.coverage || ''),
38
+ archivePackagePath: String(workspace.workspaceArchivePath || provider?.archive?.packagePath || ''),
39
+ archiveBytes: Number(provider?.archive?.bytes || 0),
40
+ archiveSha256: String(provider?.archive?.digest?.value || ''),
41
+ workspaceArtifactInnerPath: String(workspace.sourceWorkspaceTargetInnerPath || '')
42
+ };
43
+ if (!provider || provider.state !== 'qualified' || provider.mode !== 'archive') {
44
+ if (explicit) findings.push(finding('error', 'portable.workspace-landing.workspace-provider-unqualified', 'Requested Workspace lacks a qualified archive byte provider.', { workspaceId }));
45
+ return freeze({ ...base, state: 'unavailable', source: null, repository: null, reasons: ['workspace-provider-unqualified'] });
46
+ }
47
+ const target = (provider.entries || []).find((entry) => String(entry.path || '') === base.workspaceArtifactInnerPath);
48
+ if (!target?.data) {
49
+ if (explicit) findings.push(finding('error', 'portable.workspace-landing.workspace-target-unavailable', 'Requested Workspace durable source artifact bytes are unavailable.', { workspaceId }));
50
+ return freeze({ ...base, state: 'unavailable', source: null, repository: null, reasons: ['workspace-target-unavailable'] });
51
+ }
52
+ let markdown = '';
53
+ try { markdown = new TextDecoder('utf-8', { fatal: true }).decode(byteView(target.data)); }
54
+ catch {
55
+ findings.push(finding('error', 'portable.workspace-landing.workspace-target-nontext', 'Qualified Workspace target could not be decoded as UTF-8 Markdown.', { workspaceId }));
56
+ return freeze({ ...base, state: 'unavailable', source: null, repository: null, reasons: ['workspace-target-nontext'] });
57
+ }
58
+ const sources = parseWorkspaceEntrypoints(markdown);
59
+ const repoSources = sources.filter((source) => normalizeRepositoryIdentity(source.repository));
60
+ const sourceIdentities = [...new Set(repoSources.map((source) => normalizeRepositoryIdentity(source.repository)))];
61
+ if (sourceIdentities.length !== 1) {
62
+ if (explicit) findings.push(finding('error', sourceIdentities.length ? 'portable.workspace-landing.workspace-repository-ambiguous' : 'portable.workspace-landing.workspace-repository-missing', 'Requested Workspace must expose exactly one explicit repository identity before it can target a local Git repository.', { workspaceId, count: sourceIdentities.length }));
63
+ return freeze({ ...base, state: 'not-targetable', source: repoSources[0] || null, repository: null, reasons: [sourceIdentities.length ? 'workspace-repository-ambiguous' : 'workspace-repository-missing'] });
64
+ }
65
+ const source = repoSources.find((item) => normalizeRepositoryIdentity(item.repository) === sourceIdentities[0]) || repoSources[0];
66
+ const matches = repositories.filter((repo) => repo.repositoryIdentity === sourceIdentities[0]);
67
+ let selected = selectionId ? repositories.find((repo) => repo.id === selectionId) || null : matches.length === 1 ? matches[0] : null;
68
+ if (selectionId && (!selected || selected.repositoryIdentity !== sourceIdentities[0])) {
69
+ findings.push(finding('error', 'portable.workspace-landing.selection-identity-mismatch', 'Explicit local repository selection does not match the qualified Workspace repository identity.', { workspaceId, selectionId, repository: source.repository }));
70
+ selected = null;
71
+ }
72
+ if (!selected) {
73
+ if (matches.length > 1) findings.push(finding('error', 'portable.workspace-landing.local-repository-ambiguous', 'Multiple local repositories match the same qualified Workspace repository identity; explicit selection is required.', { workspaceId, repository: source.repository, count: matches.length }));
74
+ else if (explicit || selectionId) findings.push(finding('error', 'portable.workspace-landing.local-repository-unmatched', 'Requested Workspace has no matching local Git repository.', { workspaceId, repository: source.repository }));
75
+ return freeze({ ...base, state: matches.length > 1 ? 'ambiguous' : 'unmatched', source, repository: null, candidateRepositoryIds: matches.map((item) => item.id), reasons: [matches.length > 1 ? 'local-repository-ambiguous' : 'local-repository-unmatched'] });
76
+ }
77
+ const reasons = [];
78
+ if (selected.clean !== true) {
79
+ reasons.push(selected.clean === false ? 'dirty-worktree' : 'clean-state-unresolved');
80
+ findings.push(finding('error', selected.clean === false ? 'portable.workspace-landing.local-repository-dirty' : 'portable.workspace-landing.local-repository-clean-state-unresolved', 'Landing requires a clean target worktree except ignored local material.', { workspaceId, repositoryId: selected.id }));
81
+ }
82
+ const declaredRef = String(source.ref || '').trim();
83
+ const branch = String(selected.branch || '').trim();
84
+ if (declaredRef && branch && declaredRef !== branch) {
85
+ reasons.push('ref-branch-mismatch');
86
+ findings.push(finding('error', 'portable.workspace-landing.ref-branch-mismatch', 'Local repository branch differs from the qualified Workspace source ref safety constraint.', { workspaceId, repositoryId: selected.id, declaredRef, branch }));
87
+ }
88
+ return freeze({
89
+ ...base,
90
+ state: reasons.length ? 'blocked' : 'ready',
91
+ source,
92
+ repository: freeze({ id: selected.id, root: selected.root, repository: selected.repository, repositoryIdentity: selected.repositoryIdentity, branch, clean: selected.clean }),
93
+ reasons
94
+ });
95
+ }
96
+
97
+ function result(status, inspection, workspaces, findings, input) {
98
+ const affected = workspaces.filter((item) => item.state === 'ready');
99
+ const untouched = workspaces.filter((item) => item.state !== 'ready');
100
+ return freeze({
101
+ schema: PORTABLE_WORKSPACE_LANDING_PLAN_SCHEMA_ID,
102
+ status,
103
+ packageQualification: String(inspection.status || 'invalid'),
104
+ selectionMode: (input.workspaceIds || input.selectedWorkspaceIds || []).length ? 'explicit-workspace-set' : 'qualified-repository-match-discovery',
105
+ workspaces: freeze(workspaces),
106
+ affected: freeze(affected),
107
+ unaffected: freeze(untouched),
108
+ confirmation: freeze({
109
+ required: affected.length > 0,
110
+ repositoryCount: affected.length,
111
+ repositoryRoots: freeze(affected.map((item) => String(item.repository?.root || '')).filter(Boolean)),
112
+ statement: affected.length ? `Replace qualified non-ignored Workspace source in ${affected.length} local Git repositor${affected.length === 1 ? 'y' : 'ies'}; preserve .git and unrelated ignored local material; do not commit or push.` : '',
113
+ authority: 'explicit-human-host-confirmation-only'
114
+ }),
115
+ operationBoundary: freeze({ sourceMutation: false, remoteWrite: false, commit: false, push: false, acceptance: false }),
116
+ findings: freeze(findings),
117
+ boundary: 'Planning-only projection from one qualified Handoff package plus explicit local Git repository facts. Repository/ref matching is an operational safety constraint, not semantic authority. The plan does not extract, write, commit, push, accept, or complete any Workspace.'
118
+ });
119
+ }
120
+
121
+ function normalizeRepositories(value = []) {
122
+ const list = Array.isArray(value) ? value : value?.repositories || [];
123
+ return freeze(list.map((item, index) => {
124
+ const repository = String(item?.repository || item?.remote || item?.remoteUrl || '').trim();
125
+ return freeze({
126
+ id: String(item?.id || `repo-${index + 1}`),
127
+ root: String(item?.root || item?.path || ''),
128
+ repository,
129
+ repositoryIdentity: normalizeRepositoryIdentity(repository),
130
+ branch: String(item?.branch || ''),
131
+ clean: item?.clean === true ? true : item?.clean === false ? false : null
132
+ });
133
+ }));
134
+ }
135
+ function normalizeSelections(value = {}) {
136
+ const source = value?.selections && typeof value.selections === 'object' ? value.selections : value;
137
+ return Object.fromEntries(Object.entries(source || {}).map(([key, selected]) => [normalizeId(key), String(selected || '')]).filter(([key, selected]) => key && selected));
138
+ }
139
+ function normalizeId(value = '') { return String(value || '').trim().toLowerCase().replace(/[^a-z0-9._-]+/g, '-').replace(/^-+|-+$/g, ''); }
140
+ function byteView(value) { if (value instanceof Uint8Array) return value; if (ArrayBuffer.isView(value)) return new Uint8Array(value.buffer, value.byteOffset, value.byteLength); if (value instanceof ArrayBuffer) return new Uint8Array(value); throw new Error('portable.workspace-landing.bytes-unavailable'); }
141
+ function finding(severity, code, message, context = {}) { return freeze({ severity, code, message, context: freeze({ ...context }) }); }
142
+ function freeze(value) { if (Array.isArray(value)) return Object.freeze(value.map((item) => freeze(item))); if (!value || typeof value !== 'object' || Object.isFrozen(value)) return value; return Object.freeze(Object.fromEntries(Object.entries(value).map(([key, item]) => [key, freeze(item)]))); }
@@ -0,0 +1,105 @@
1
+ import { parseArtifactMarkdown } from '../../../artifacts/artifact.parse.js';
2
+ import { auditPortableRecord } from '../audit/audit.capability.js';
3
+ import { normalizeRepositoryIdentity, parseWorkspaceEntrypoints } from './workspaceSourceIdentity.js';
4
+ import { sha256Hex, utf8Bytes } from '../../../export/package.bytes.js';
5
+
6
+ export const PORTABLE_WORKSPACE_PACKAGE_SOURCES_SCHEMA_ID = 'tiinex.portable.workspace-package-sources.v1';
7
+
8
+ export function projectQualifiedWorkspacePackageSources(input = {}) {
9
+ const records = normalizeRecords(input);
10
+ const findings = [];
11
+ const candidates = [];
12
+ const repositories = normalizeRepositories(input.repositories || input.localRepositories || []);
13
+ for (const record of records) {
14
+ let parsed;
15
+ try { parsed = parseArtifactMarkdown(record.markdown); } catch { continue; }
16
+ if (String(parsed.envelope?.current?.schema?.id || '') !== 'tiinex.workspace.v1') continue;
17
+ const audit = auditPortableRecord({ ...record, title: parsed.title || '', schemaId: 'tiinex.workspace.v1', currentSchemaId: 'tiinex.workspace.v1', parent: parsed.envelope?.parent || null });
18
+ if (audit.status !== 'readable' || audit.qualification?.exact !== true || (audit.findings || []).some((item) => item.severity === 'error')) {
19
+ findings.push(finding('warning', 'portable.workspace-package-source.unqualified', 'A local Workspace artifact was ignored because exact shared audit did not qualify it.', { path: record.path }));
20
+ continue;
21
+ }
22
+ const entrypoints = parseWorkspaceEntrypoints(record.markdown);
23
+ const repositorySources = entrypoints.filter((item) => normalizeRepositoryIdentity(item.repository));
24
+ const localDirectorySources = entrypoints.filter((item) => String(item.sourceKind || '').trim().toLowerCase() === 'local-directory' && !normalizeRepositoryIdentity(item.repository));
25
+ const identities = [...new Set(repositorySources.map((item) => normalizeRepositoryIdentity(item.repository)).filter(Boolean))];
26
+ let source = null;
27
+ let repositoryIdentity = '';
28
+ let localMatches = [];
29
+ if (identities.length === 1) {
30
+ repositoryIdentity = identities[0];
31
+ source = repositorySources.find((item) => normalizeRepositoryIdentity(item.repository) === repositoryIdentity) || repositorySources[0];
32
+ localMatches = repositories.filter((item) => item.repositoryIdentity === repositoryIdentity);
33
+ if (repositories.length && localMatches.length !== 1) {
34
+ findings.push(finding('warning', localMatches.length ? 'portable.workspace-package-source.local-repository-ambiguous' : 'portable.workspace-package-source.local-repository-unmatched', 'A qualified Workspace package source was not exposed because explicit local Git facts did not produce exactly one repository-identity match.', { path: record.path, repositoryIdentity, matchCount: localMatches.length }));
35
+ continue;
36
+ }
37
+ } else if (identities.length > 1) {
38
+ findings.push(finding('warning', 'portable.workspace-package-source.repository-ambiguous', 'A qualified Workspace package source must not expose multiple repository identities for one package snapshot.', { path: record.path, count: identities.length }));
39
+ continue;
40
+ } else if (localDirectorySources.length === 1) {
41
+ source = localDirectorySources[0];
42
+ localMatches = repositories.length === 1 ? repositories : [];
43
+ } else {
44
+ findings.push(finding('warning', localDirectorySources.length ? 'portable.workspace-package-source.local-directory-ambiguous' : 'portable.workspace-package-source.source-missing', 'A qualified Workspace package source must expose exactly one repository-backed snapshot or one explicit local-directory snapshot.', { path: record.path, repositoryCount: identities.length, localDirectoryCount: localDirectorySources.length }));
45
+ continue;
46
+ }
47
+ const workspaceTargetPath = norm(record.path || record.id || '');
48
+ candidates.push({
49
+ baseWorkspaceId: semanticWorkspaceArtifactId(workspaceTargetPath),
50
+ workspaceTargetPath,
51
+ title: String(parsed.title || ''),
52
+ qualification: 'qualified-exact',
53
+ repository: String(source?.repository || ''),
54
+ repositoryIdentity,
55
+ ref: String(source?.ref || ''),
56
+ rootPath: String(source?.rootPath || '.'),
57
+ sourceKind: String(source?.sourceKind || ''),
58
+ localRepository: localMatches.length === 1 ? localMatches[0] : null
59
+ });
60
+ }
61
+ const qualifiedCandidates = disambiguateWorkspaceIds(candidates);
62
+ return freeze({
63
+ schema: PORTABLE_WORKSPACE_PACKAGE_SOURCES_SCHEMA_ID,
64
+ status: 'ready',
65
+ candidates: qualifiedCandidates,
66
+ findings,
67
+ operationBoundary: { sourceMutation: false, remoteWrite: false, manufacture: false },
68
+ boundary: 'Projects exact qualified local Workspace artifacts into package-builder source candidates. A Workspace may declare one repository-backed snapshot or one explicit local-directory snapshot; workspaceId remains a stable package-local label derived from the qualified Workspace artifact identity, independently of any physical repository identity. Host Git facts are operational context only and create no semantic Workspace authority.'
69
+ });
70
+ }
71
+
72
+ function normalizeRepositories(value = []) {
73
+ return (Array.isArray(value) ? value : []).map((item) => freeze({
74
+ id: String(item?.id || item?.root || ''),
75
+ root: String(item?.root || ''),
76
+ repository: String(item?.repository || ''),
77
+ repositoryIdentity: normalizeRepositoryIdentity(item?.repository || item?.repositoryIdentity || ''),
78
+ branch: String(item?.branch || ''),
79
+ clean: item?.clean === true
80
+ })).filter((item) => item.repositoryIdentity);
81
+ }
82
+ function semanticWorkspaceArtifactId(workspaceTargetPath = '') {
83
+ const basename = norm(workspaceTargetPath).split('/').filter(Boolean).at(-1) || 'workspace.workspace.md';
84
+ const raw = basename.replace(/\.workspace\.md$/i, '').replace(/^tiinex-/i, '') || 'workspace';
85
+ const token = raw.toLowerCase().replace(/[^a-z0-9._-]+/g, '-').replace(/^-+|-+$/g, '');
86
+ return token || 'workspace';
87
+ }
88
+ function disambiguateWorkspaceIds(candidates = []) {
89
+ const counts = new Map();
90
+ for (const candidate of candidates) counts.set(candidate.baseWorkspaceId, (counts.get(candidate.baseWorkspaceId) || 0) + 1);
91
+ return candidates.map((candidate) => {
92
+ const collided = (counts.get(candidate.baseWorkspaceId) || 0) > 1;
93
+ const suffix = collided ? sha256Hex(utf8Bytes(candidate.workspaceTargetPath)).slice(0, 8) : '';
94
+ const workspaceId = collided ? `${candidate.baseWorkspaceId}--${suffix}` : candidate.baseWorkspaceId;
95
+ const { baseWorkspaceId, ...rest } = candidate;
96
+ return freeze({ workspaceId, ...rest });
97
+ });
98
+ }
99
+ function normalizeRecords(input = {}) {
100
+ if (Array.isArray(input.records)) return input.records;
101
+ return (Array.isArray(input.files) ? input.files : []).filter((item) => typeof item?.content === 'string').map((item) => ({ id: String(item.path || ''), path: String(item.path || ''), markdown: String(item.content || ''), sourceMode: item.sourceMode || '' }));
102
+ }
103
+ function norm(value = '') { return String(value || '').replace(/\\/g, '/').replace(/^\.\//, '').replace(/^\/+|\/+$/g, ''); }
104
+ function finding(severity, code, message, context = {}) { return freeze({ severity, code, message, context }); }
105
+ function freeze(value) { if (Array.isArray(value)) return Object.freeze(value.map(freeze)); if (!value || typeof value !== 'object' || Object.isFrozen(value)) return value; return Object.freeze(Object.fromEntries(Object.entries(value).map(([key, item]) => [key, freeze(item)]))); }
@@ -0,0 +1,10 @@
1
+ export const SHARED_ROUTE_REQUIRED_CONTEXT_BOUNDARY = 'Shared-route recipient grounding proof only. Every Required Context item must resolve to exact carried package bytes; Reference Context is intentionally excluded from this blocking projection.';
2
+
3
+ export function parseWorkspaceQualifiedReference(value = '') {
4
+ const match = String(value || '').trim().match(/^([a-zA-Z0-9._-]+)::(.+)$/);
5
+ if (!match) return null;
6
+ const raw = String(match[2] || '').split('#')[0].split('?')[0].replace(/\\/g, '/');
7
+ if (!raw || raw.startsWith('/') || raw.split('/').some((part) => part === '..')) return null;
8
+ const path = raw.split('/').filter((part) => part && part !== '.').join('/');
9
+ return path ? Object.freeze({ workspaceId: match[1], path }) : null;
10
+ }
@@ -0,0 +1,52 @@
1
+ export function parseWorkspaceEntrypoints(markdown = '') {
2
+ const body = section(markdown, 'Workspace Entrypoints');
3
+ if (!body) return Object.freeze([]);
4
+ const chunks = body.split(/(?=^###\s+)/m).map((item) => item.trim()).filter(Boolean);
5
+ const out = [];
6
+ for (const chunk of chunks) {
7
+ const heading = chunk.match(/^###\s+(.+)$/m)?.[1]?.trim() || '';
8
+ const sourceKind = field(chunk, 'Source Kind');
9
+ const repository = field(chunk, 'Repository');
10
+ const ref = field(chunk, 'Ref');
11
+ const rootPath = field(chunk, 'Root Path');
12
+ if (!heading && !sourceKind && !repository && !ref && !rootPath) continue;
13
+ out.push(Object.freeze({
14
+ label: heading,
15
+ sourceKind,
16
+ repository,
17
+ ref,
18
+ rootPath,
19
+ remoteState: 'not-checked',
20
+ basis: 'qualified-durable-workspace-entrypoint'
21
+ }));
22
+ }
23
+ return Object.freeze(out);
24
+ }
25
+
26
+ export function normalizeRepositoryIdentity(value = '') {
27
+ let text = String(value || '').trim().replace(/\\/g, '/');
28
+ if (!text) return '';
29
+ text = text.replace(/^git\+/, '').replace(/\.git$/i, '').replace(/\/+$/, '');
30
+ const scp = text.match(/^[^@\s]+@[^:\s]+:(.+)$/);
31
+ if (scp) text = scp[1];
32
+ else {
33
+ try {
34
+ const url = new URL(text);
35
+ text = url.pathname.replace(/^\/+/, '');
36
+ } catch {
37
+ text = text.replace(/^https?:\/\/[^/]+\//i, '').replace(/^ssh:\/\/[^/]+\//i, '');
38
+ }
39
+ }
40
+ return text.replace(/^\/+/, '').replace(/\.git$/i, '').toLowerCase();
41
+ }
42
+
43
+ function section(markdown = '', heading = '') {
44
+ const escaped = escapeRe(heading);
45
+ return String(markdown || '').match(new RegExp(`(?:^|\\n)##\\s+${escaped}\\s*\\r?\\n([\\s\\S]*?)(?=\\n##\\s+|\\n#\\s+Continuity Integrity|$)`, 'i'))?.[1]?.trim() || '';
46
+ }
47
+ function field(markdown = '', label = '') {
48
+ const escaped = escapeRe(label);
49
+ return strip(String(markdown || '').match(new RegExp(`^\\s*-\\s+${escaped}:\\s*(.+)$`, 'mi'))?.[1] || '');
50
+ }
51
+ function strip(value = '') { return String(value || '').replace(/^\[([^\]]+)\]\([^)]+\)$/, '$1').replace(/[`*_]/g, '').trim(); }
52
+ function escapeRe(value = '') { return String(value || '').replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); }
@@ -0,0 +1,134 @@
1
+ import { validatedC14nV2PrimarySelfDigest } from '../../../integrity/integrity.c14nV2.js';
2
+ import { qualifyTiinexRouteArtifact } from './routeArtifactConformance.js';
3
+
4
+ export const HANDOFF_WORKSPACE_TARGET_CONFORMANCE_SCHEMA_ID = 'tiinex.portable.handoff-workspace-target-conformance.v1';
5
+
6
+ export function qualifyHandoffWorkspaceTarget(input = {}) {
7
+ const targetPath = normalizeInnerPath(input.targetPath || input.path || '');
8
+ const markdown = decodeUtf8(input.targetData || input.data || new Uint8Array());
9
+ if (!targetPath || !markdown) return blockedTarget(targetPath, ['workspace-target-artifact-unreadable']);
10
+ let conformance;
11
+ try {
12
+ conformance = qualifyTiinexRouteArtifact({
13
+ markdown,
14
+ expectedSchemaId: 'tiinex.workspace.v1',
15
+ requireExactContract: true,
16
+ resolveParent: ({ parent, targetEntry }) => resolveWorkspaceParent({ entries: input.entries || [], parentCandidates: input.parentCandidates || input.recoveryEntries || [], targetPath, parent, targetEntry })
17
+ });
18
+ } catch (error) {
19
+ return blockedTarget(targetPath, ['workspace-target-artifact-conformance-error'], String(error?.message || error || 'workspace-target-artifact-conformance-error'));
20
+ }
21
+ const reasons = conformanceReasons(conformance);
22
+ const selfIntegrity = Object.freeze({
23
+ state: String(conformance.selfIntegrity?.state || ''),
24
+ value: String(conformance.selfIntegrity?.computedValue || conformance.selfIntegrity?.declaredValue || '')
25
+ });
26
+ return deepFreeze({
27
+ schema: HANDOFF_WORKSPACE_TARGET_CONFORMANCE_SCHEMA_ID,
28
+ state: reasons.length ? 'blocked' : 'qualified',
29
+ targetPath,
30
+ selfIntegrity,
31
+ conformance,
32
+ reasons: Object.freeze(reasons),
33
+ boundary: 'Exact Workspace artifact bytes must qualify through the existing Root/registered-schema/self-integrity/Parent-target authority. Workspace filename, package placement, and matching stored descriptor state cannot create qualification.'
34
+ });
35
+ }
36
+
37
+ function conformanceReasons(conformance = {}) {
38
+ const reasons = [];
39
+ if (String(conformance.observedSchemaId || '') !== 'tiinex.workspace.v1') reasons.push('workspace-target-schema-unqualified');
40
+ const selfState = String(conformance.selfIntegrity?.state || '');
41
+ if (selfState !== 'verified') reasons.push(selfState === 'mismatch' ? 'workspace-target-self-integrity-mismatch' : 'workspace-target-self-integrity-unverified');
42
+ if (conformance.parentContinuity?.parentDeclared && String(conformance.parentContinuity?.state || '') !== 'qualified') reasons.push('workspace-target-parent-continuity-unqualified');
43
+ if (String(conformance.status || '') !== 'qualified') reasons.push('workspace-target-artifact-conformance-unqualified');
44
+ return [...new Set(reasons)];
45
+ }
46
+
47
+ function resolveWorkspaceParent({ entries = [], parentCandidates = [], targetPath = '', parent = {}, targetEntry = {} } = {}) {
48
+ const indexed = indexEntries(entries);
49
+ const recoveryIndexed = indexEntries(parentCandidates);
50
+ const localCandidates = new Map();
51
+ for (const reference of parentLocalReferences(parent)) {
52
+ const resolvedPath = resolveRelativeReference(targetPath, reference);
53
+ if (!resolvedPath) continue;
54
+ const entry = indexed.get(resolvedPath);
55
+ const markdown = entry ? decodeUtf8(entry.data) : '';
56
+ if (!entry || !markdown) continue;
57
+ localCandidates.set(resolvedPath, Object.freeze({ state: 'qualified', markdown, basis: 'workspace-parent-local-reference', workspaceRelativePath: resolvedPath, sha256: String(entry.sha256 || '') }));
58
+ }
59
+ if (localCandidates.size === 1) return [...localCandidates.values()][0];
60
+ if (localCandidates.size > 1) return Object.freeze({ state: 'ambiguous', reason: 'multiple-parent-local-reference-candidates' });
61
+
62
+ const expectedDigest = String(targetEntry?.value || '').trim();
63
+ if (!expectedDigest) return Object.freeze({ state: 'unavailable', reason: 'parent-target-digest-missing' });
64
+ const digestCandidates = new Map();
65
+ for (const [candidateSet, basis] of [[indexed, 'workspace-parent-target-digest-candidate'], [recoveryIndexed, 'detached-parent-target-digest-candidate']]) {
66
+ for (const entry of candidateSet.values()) {
67
+ const markdown = decodeUtf8(entry.data);
68
+ if (!markdown) continue;
69
+ const self = validatedC14nV2PrimarySelfDigest(markdown);
70
+ if (self.state !== 'verified' || self.value !== expectedDigest) continue;
71
+ const key = `${entry.path}\u0000${entry.sha256 || ''}`;
72
+ digestCandidates.set(key, Object.freeze({ state: 'qualified', markdown, basis, workspaceRelativePath: entry.path, sha256: String(entry.sha256 || '') }));
73
+ }
74
+ }
75
+ if (digestCandidates.size === 1) return [...digestCandidates.values()][0];
76
+ if (digestCandidates.size > 1) return Object.freeze({ state: 'ambiguous', reason: 'multiple-parent-target-digest-candidates' });
77
+ return Object.freeze({ state: 'unavailable', reason: 'parent-representation-not-carried' });
78
+ }
79
+
80
+ function indexEntries(entries = []) {
81
+ const out = new Map();
82
+ for (const raw of entries) {
83
+ const entryPath = normalizeInnerPath(raw?.path || raw?.innerPath || '');
84
+ if (!entryPath || out.has(entryPath)) continue;
85
+ out.set(entryPath, Object.freeze({ ...raw, path: entryPath }));
86
+ }
87
+ return out;
88
+ }
89
+
90
+ function parentLocalReferences(parent = {}) {
91
+ const out = [];
92
+ if (parent.trace && !isExternalReference(parent.trace)) out.push(String(parent.trace));
93
+ for (const entry of parent.originEntries || []) {
94
+ if (String(entry?.label || '').trim() === 'relative' && entry?.target && !isExternalReference(entry.target)) out.push(String(entry.target));
95
+ }
96
+ return [...new Set(out)];
97
+ }
98
+
99
+ function resolveRelativeReference(fromPath = '', reference = '') {
100
+ const base = normalizeInnerPath(fromPath);
101
+ if (!base || !reference || isExternalReference(reference)) return '';
102
+ let clean;
103
+ try { clean = decodeURIComponent(String(reference).split('#')[0].split('?')[0]); } catch { return ''; }
104
+ if (!clean || clean.startsWith('/') || clean.startsWith('\\') || /^[A-Za-z]:[\\/]/.test(clean)) return '';
105
+ const parts = base.split('/').slice(0, -1);
106
+ for (const part of clean.replace(/\\/g, '/').split('/')) {
107
+ if (!part || part === '.') continue;
108
+ if (part === '..') { if (!parts.length) return ''; parts.pop(); continue; }
109
+ if (/^[\u0000-\u001f]+$/.test(part)) return '';
110
+ parts.push(part);
111
+ }
112
+ return normalizeInnerPath(parts.join('/'));
113
+ }
114
+
115
+ function normalizeInnerPath(value = '') {
116
+ const raw = String(value || '');
117
+ if (!raw || raw.includes('\u0000') || /[\u0000-\u001f]/.test(raw)) return '';
118
+ const slashed = raw.replace(/\\/g, '/');
119
+ if (slashed.startsWith('/') || slashed.startsWith('//') || /^[A-Za-z]:\//.test(slashed)) return '';
120
+ const parts = [];
121
+ for (const part of slashed.split('/')) {
122
+ if (!part || part === '.') continue;
123
+ if (part === '..') return '';
124
+ parts.push(part);
125
+ }
126
+ return parts.join('/');
127
+ }
128
+
129
+ function blockedTarget(targetPath = '', reasons = [], error = '') {
130
+ return deepFreeze({ schema: HANDOFF_WORKSPACE_TARGET_CONFORMANCE_SCHEMA_ID, state: 'blocked', targetPath, selfIntegrity: Object.freeze({ state: '', value: '' }), conformance: null, reasons: Object.freeze(reasons), error, boundary: 'Workspace target qualification failed closed before semantic binding.' });
131
+ }
132
+ function isExternalReference(value = '') { return /^[a-z][a-z0-9+.-]*:/i.test(String(value || '')) || String(value || '').startsWith('//'); }
133
+ function decodeUtf8(data) { try { return new TextDecoder('utf-8', { fatal: true }).decode(data); } catch { return ''; } }
134
+ 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); }