@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,9 @@
1
+ import binding from './tiinex.schema.module.v1.schema.json' with { type: 'json' };
2
+ import projection from './tiinex.schema.module.v1.schema.runtime.json' with { type: 'json' };
3
+ import { defineBundledSchemaSource } from '../../schema.source.js';
4
+
5
+ export const schemaSource = defineBundledSchemaSource(binding, projection, Object.freeze({
6
+ bundledPath: 'src/schemas/schema/module/tiinex.schema.module.v1.schema.md',
7
+ sourceLabel: 'Viewer schema registry',
8
+ assetUrl: new URL('./tiinex.schema.module.v1.schema.md', import.meta.url).href
9
+ }));
@@ -0,0 +1,4 @@
1
+ {
2
+ "label": "Schema Module",
3
+ "summary": "Capability bundle around schema interpretation, viewing, validation, forms, and fallback behavior."
4
+ }
@@ -0,0 +1 @@
1
+ export const moduleTransitions = Object.freeze([{ id: 'inspect', label: 'Inspect', sideEffect: 'none' }]);
@@ -0,0 +1 @@
1
+ export function moduleValidate(artifact) { return [{ severity: 'info', code: 'tiinex.schema.module.v1.validation.scaffold', message: 'Initial schema validation scaffold; authoritative contract parsing comes next.' }]; }
@@ -0,0 +1,104 @@
1
+ export const SCHEMA_FACTORY_DESCRIPTOR_SCHEMA_ID = 'tiinex.schema.factory.descriptor.v1';
2
+
3
+ export function buildSchemaFactoryDescriptor(module = {}, capabilities = {}) {
4
+ const sourceQualification = typeof module?.schemaSource?.qualify === 'function' ? module.schemaSource.qualify() : null;
5
+ const compiled = sourceQualification?.state === 'qualified' ? sourceQualification.compiledContract : null;
6
+ const validation = compiled?.validationContract || null;
7
+ const creation = compiled?.creation || null;
8
+ const ordinaryGroups = validation?.validation?.ordinaryGroups || [];
9
+ const constraints = validation?.constraints || [];
10
+ const sections = ordinaryGroups.map((group) => Object.freeze({
11
+ group: String(group?.group || ''),
12
+ heading: String(group?.target?.heading || ''),
13
+ title: String(group?.target?.title || group?.group || ''),
14
+ requiredness: String(group?.target?.requiredness || ''),
15
+ qualification: String(group?.qualification || group?.target?.qualification || 'unresolved'),
16
+ requiredFields: Object.freeze([...(group?.requiredFields || [])]),
17
+ optionalFields: Object.freeze([...(group?.optionalFields || [])]),
18
+ contributors: Object.freeze((group?.contributors || []).map((item) => deepFreezeJson(item))),
19
+ fieldConstraints: Object.freeze(constraints.filter((item) => String(item?.targetGroup || item?.sourceGroup || '') === String(group?.group || '')).map((item) => deepFreezeJson(item)))
20
+ }));
21
+ const declarations = (validation?.declarations || []).map((contract) => Object.freeze({
22
+ group: String(contract?.group || ''),
23
+ targetHeadings: Object.freeze([...(contract?.targetHeadings || [])]),
24
+ entryShape: Object.freeze([...(contract?.entryShape || [])]),
25
+ requiredFields: Object.freeze([...(contract?.requiredFields || [])]),
26
+ optionalFields: Object.freeze([...(contract?.optionalFields || [])]),
27
+ allowLiteralNone: Boolean(contract?.allowLiteralNone),
28
+ fieldConstraints: Object.freeze(constraints.filter((item) => String(item?.targetGroup || item?.sourceGroup || '') === String(contract?.group || '')).map((item) => deepFreezeJson(item)))
29
+ }));
30
+ const requiredShape = creation?.requiredShape || [];
31
+ return Object.freeze({
32
+ schema: SCHEMA_FACTORY_DESCRIPTOR_SCHEMA_ID,
33
+ schemaId: String(module?.id || compiled?.schemaId || ''),
34
+ label: String(module?.label || module?.id || ''),
35
+ kind: String(module?.kind || ''),
36
+ role: String(module?.role || ''),
37
+ source: Object.freeze({
38
+ state: String(sourceQualification?.state || 'unavailable'),
39
+ checksum: String(sourceQualification?.checksum || ''),
40
+ path: String(sourceQualification?.authority?.path || ''),
41
+ repository: String(sourceQualification?.authority?.repository || ''),
42
+ commit: String(sourceQualification?.authority?.commit || '')
43
+ }),
44
+ inheritance: Object.freeze({
45
+ parentSchemaId: String(module?.parentSchemaId || ''),
46
+ lineage: Object.freeze([...(validation?.lineage || [])]),
47
+ qualification: deepFreezeJson(validation?.lineageQualification || { state: 'unavailable', complete: false, findings: ['Compiled validation lineage unavailable.'] }),
48
+ resolution: deepFreezeJson(validation?.inheritanceResolution || { schema: 'tiinex.portable.schema-inheritance-resolution.v1', state: 'not-declared', applications: [], findings: [] })
49
+ }),
50
+ sections: Object.freeze(sections),
51
+ declarations: Object.freeze(declarations),
52
+ fieldShapes: Object.freeze((validation?.validation?.fieldShapes || []).map((item) => deepFreezeJson(item))),
53
+ machineShapes: deepFreezeJson(validation?.machineShapes || { schema: '', definitions: [], active: [], findings: [] }),
54
+ creation: Object.freeze({
55
+ authorityState: String(capabilities?.generation?.authority?.state || (creation ? 'qualified' : 'unavailable')),
56
+ requiredInputs: Object.freeze([...(creation?.requiredInputs || [])]),
57
+ optionalInputs: Object.freeze([...(creation?.optionalInputs || [])]),
58
+ inputBindings: Object.freeze((creation?.inputBindings || []).map((item) => deepFreezeJson(item))),
59
+ supplementalRequiredFields: Object.freeze((creation?.supplementalRequiredFields || []).map((item) => deepFreezeJson(item))),
60
+ representationSections: Object.freeze([...(creation?.representationSections || [])]),
61
+ requiredShape: Object.freeze(requiredShape.map((item) => deepFreezeJson(item))),
62
+ residualRequiredShape: Object.freeze(requiredShape.filter((item) => String(item?.primitive?.kind || 'residual') === 'residual').map((item) => deepFreezeJson(item)))
63
+ }),
64
+ generation: Object.freeze({
65
+ authorityState: String(capabilities?.generation?.authority?.state || (creation ? 'qualified' : 'unavailable')),
66
+ implementationState: String(capabilities?.generation?.implementation?.state || 'unavailable'),
67
+ ready: Boolean(capabilities?.generation?.ready),
68
+ boundary: 'Artifact Creation Contract + generic renderer qualification only; this does not authorize an invocable lifecycle transition.'
69
+ }),
70
+ invocation: Object.freeze({
71
+ create: Object.freeze({
72
+ state: capabilities?.actions?.create?.status === 'implemented' ? 'qualified' : 'unavailable',
73
+ authority: 'canonical-transition-definition',
74
+ applicability: capabilities?.actions?.create?.status === 'implemented' ? 'explicitly-qualified' : 'not-qualified',
75
+ boundary: 'Invocable Create is independent from generation authority and must not be inferred from Artifact Creation Contract presence.'
76
+ })
77
+ }),
78
+ capabilities: deepFreezeJson(capabilities),
79
+ transitionParticipation: Object.freeze({
80
+ authority: 'canonical-transition-definition',
81
+ companionMetadataPresent: Boolean(module?.transitions && (typeof module.transitions === 'function' || Object.keys(module.transitions || {}).length)),
82
+ applicability: 'not-inferred-from-schema-module'
83
+ }),
84
+ relationAndCompanionNeeds: Object.freeze({
85
+ relationMetadataPresent: Boolean(module?.relations),
86
+ findingsCompanionPresent: Boolean(module?.findings),
87
+ i18nCompanionPresent: Boolean(module?.i18n),
88
+ presenterPresent: typeof module?.present === 'function',
89
+ policy: 'presence-only-no-semantic-inference'
90
+ }),
91
+ findings: Object.freeze([
92
+ ...(sourceQualification?.findings || []).map((item) => typeof item === 'string' ? item : String(item?.message || item?.code || item)),
93
+ ...(validation?.lineageQualification?.findings || []).map(String)
94
+ ])
95
+ });
96
+ }
97
+
98
+ function deepFreezeJson(value) {
99
+ if (!value || typeof value !== 'object') return value;
100
+ if (Array.isArray(value)) return Object.freeze(value.map(deepFreezeJson));
101
+ const out = {};
102
+ for (const [key, item] of Object.entries(value)) out[key] = deepFreezeJson(item);
103
+ return Object.freeze(out);
104
+ }
@@ -0,0 +1,131 @@
1
+ export const EXACT_GITHUB_SCHEMA_SOURCE_TARGET_SCHEMA_ID = 'tiinex.site.exact-github-schema-source-target.v1';
2
+ export const GITHUB_SCHEMA_SOURCE_PROVIDER_QUALIFICATION_SCHEMA_ID = 'tiinex.site.github-schema-source-provider-qualification.v1';
3
+
4
+ export function canonicalGithubSchemaSourceTargets(sourceAuthority = null) {
5
+ const sourceInputFindings = exactGithubSchemaSourceInputFindings(sourceAuthority);
6
+ const qualified = exactGithubSchemaSourceIdentity(sourceAuthority);
7
+ if (!qualified) return Object.freeze({
8
+ schema: EXACT_GITHUB_SCHEMA_SOURCE_TARGET_SCHEMA_ID,
9
+ state: 'unavailable',
10
+ repository: '',
11
+ commit: '',
12
+ path: '',
13
+ blobUrl: '',
14
+ rawUrl: '',
15
+ targets: Object.freeze([]),
16
+ findings: Object.freeze(sourceInputFindings.length ? sourceInputFindings : ['Exact GitHub schema-source repository, commit, and path authority is unavailable.'])
17
+ });
18
+ const { blobUrl, rawUrl } = canonicalTargetsForTuple(qualified);
19
+ const commit = qualified.commit;
20
+ return Object.freeze({
21
+ schema: EXACT_GITHUB_SCHEMA_SOURCE_TARGET_SCHEMA_ID,
22
+ state: 'qualified',
23
+ repository: qualified.repository,
24
+ commit,
25
+ path: qualified.path,
26
+ blobUrl,
27
+ rawUrl,
28
+ targets: Object.freeze([blobUrl, rawUrl]),
29
+ findings: Object.freeze([])
30
+ });
31
+ }
32
+
33
+ export function qualifyExactGithubSchemaSourceTarget(candidate = '', sourceAuthority = null) {
34
+ const canonical = canonicalGithubSchemaSourceTargets(sourceAuthority);
35
+ const raw = String(candidate ?? '');
36
+ const target = raw === raw.trim() ? raw : '';
37
+ const index = canonical.state === 'qualified' ? canonical.targets.indexOf(target) : -1;
38
+ const qualified = index >= 0;
39
+ return Object.freeze({
40
+ schema: EXACT_GITHUB_SCHEMA_SOURCE_TARGET_SCHEMA_ID,
41
+ state: qualified ? 'qualified' : 'unavailable',
42
+ target: qualified ? canonical.targets[index] : '',
43
+ surface: qualified ? (index === 0 ? 'github-blob' : 'github-raw') : '',
44
+ canonical,
45
+ findings: Object.freeze([
46
+ ...(raw && raw !== raw.trim() ? ['Exact schema-source target must not contain outer whitespace.'] : []),
47
+ ...(canonical.state !== 'qualified' ? canonical.findings : []),
48
+ ...(canonical.state === 'qualified' && !qualified ? ['Candidate is not an exact canonical GitHub schema-source target.'] : [])
49
+ ])
50
+ });
51
+ }
52
+
53
+ export function qualifyGithubSchemaSourceProvider(binding = {}, sourceAuthority = null) {
54
+ const tuple = exactGithubSchemaSourceTuple(sourceAuthority);
55
+ if (!tuple) {
56
+ const sourceInputFindings = exactGithubSchemaSourceInputFindings(sourceAuthority);
57
+ return Object.freeze({ schema: GITHUB_SCHEMA_SOURCE_PROVIDER_QUALIFICATION_SCHEMA_ID, state: 'unavailable', provider: '', evidenceTarget: '', findings: Object.freeze(sourceInputFindings.length ? sourceInputFindings : ['Exact schema-source tuple is unavailable.']) });
58
+ }
59
+ const canonical = canonicalTargetsForTuple(tuple);
60
+ const declaredTargets = [binding?.permalink, binding?.rawUrl, binding?.exactReferenceTarget].map((item) => String(item ?? '')).filter(Boolean);
61
+ const evidenceTarget = declaredTargets.find((item) => canonical.targets.includes(item)) || '';
62
+ return Object.freeze({
63
+ schema: GITHUB_SCHEMA_SOURCE_PROVIDER_QUALIFICATION_SCHEMA_ID,
64
+ state: evidenceTarget ? 'qualified' : 'unavailable',
65
+ provider: evidenceTarget ? 'github' : '',
66
+ evidenceTarget,
67
+ repository: tuple.repository,
68
+ commit: tuple.commit,
69
+ path: tuple.path,
70
+ findings: Object.freeze(evidenceTarget ? [] : ['No explicit exact canonical GitHub source target qualifies this schema-source tuple as GitHub-backed.'])
71
+ });
72
+ }
73
+
74
+ function canonicalTargetsForTuple(qualified = {}) {
75
+ const path = (qualified.pathSegments || []).map(encodeExactGithubPathSegment).join('/');
76
+ const blobUrl = `https://github.com/${qualified.owner}/${qualified.repo}/blob/${qualified.commit}/${path}`;
77
+ const rawUrl = `https://raw.githubusercontent.com/${qualified.owner}/${qualified.repo}/${qualified.commit}/${path}`;
78
+ return Object.freeze({ blobUrl, rawUrl, targets: Object.freeze([blobUrl, rawUrl]) });
79
+ }
80
+
81
+ function exactGithubSchemaSourceIdentity(sourceAuthority = null) {
82
+ if (String(sourceAuthority?.provider || '').trim().toLowerCase() !== 'github') return null;
83
+ return exactGithubSchemaSourceTuple(sourceAuthority);
84
+ }
85
+
86
+ function exactGithubSchemaSourceTuple(sourceAuthority = null) {
87
+ const repository = String(sourceAuthority?.repository || '').trim();
88
+ const commit = String(sourceAuthority?.commit || '').trim();
89
+ const path = String(sourceAuthority?.path || '');
90
+ const repoParts = repository.split('/');
91
+ if (repoParts.length !== 2 || repoParts.some((part) => !/^[A-Za-z0-9_.-]+$/.test(part) || part === '.' || part === '..')) return null;
92
+ if (!/^[0-9a-f]{40}$/i.test(commit)) return null;
93
+ if (!path || !isWellFormedUnicodeScalarString(path) || path !== path.trim() || path.startsWith('/') || path.endsWith('/') || path.includes('\\') || /[\0\r\n?#]/.test(path)) return null;
94
+ const pathSegments = path.split('/');
95
+ if (!pathSegments.length || pathSegments.some((segment) => !segment || segment === '.' || segment === '..')) return null;
96
+ return Object.freeze({
97
+ repository: `${repoParts[0]}/${repoParts[1]}`,
98
+ owner: repoParts[0],
99
+ repo: repoParts[1],
100
+ commit: commit.toLowerCase(),
101
+ path,
102
+ pathSegments: Object.freeze(pathSegments)
103
+ });
104
+ }
105
+
106
+ function encodeExactGithubPathSegment(segment = '') {
107
+ const text = String(segment);
108
+ if (!isWellFormedUnicodeScalarString(text)) return '';
109
+ return encodeURIComponent(text).replace(/[!'()*]/g, (character) => `%${character.charCodeAt(0).toString(16).toUpperCase()}`);
110
+ }
111
+
112
+ function exactGithubSchemaSourceInputFindings(sourceAuthority = null) {
113
+ const path = String(sourceAuthority?.path || '');
114
+ if (path && !isWellFormedUnicodeScalarString(path)) return ['Exact GitHub schema-source path contains an unpaired UTF-16 surrogate and is not representable as a canonical URL target.'];
115
+ return [];
116
+ }
117
+
118
+ function isWellFormedUnicodeScalarString(value = '') {
119
+ const text = String(value);
120
+ for (let index = 0; index < text.length; index += 1) {
121
+ const unit = text.charCodeAt(index);
122
+ if (unit >= 0xD800 && unit <= 0xDBFF) {
123
+ const next = text.charCodeAt(index + 1);
124
+ if (!(next >= 0xDC00 && next <= 0xDFFF)) return false;
125
+ index += 1;
126
+ continue;
127
+ }
128
+ if (unit >= 0xDC00 && unit <= 0xDFFF) return false;
129
+ }
130
+ return true;
131
+ }
@@ -0,0 +1,10 @@
1
+ import { parseArtifactMarkdown } from '../artifacts/artifact.parse.js';
2
+
3
+ export function schemaIdForRecord(record = {}, options = {}) {
4
+ const explicit = String(record?.schemaId || record?.currentSchemaId || record?.rootFallback?.currentSchemaId || '').trim();
5
+ if (explicit) return explicit;
6
+ const markdown = String(options.markdown ?? record?.markdown ?? '');
7
+ if (!markdown.trim()) return '';
8
+ try { return String(parseArtifactMarkdown(markdown).envelope?.current?.schema?.id || '').trim(); }
9
+ catch (_) { return ''; }
10
+ }
@@ -0,0 +1,133 @@
1
+ import { canonicalGithubSchemaSourceTargets } from './schema.githubSourceTarget.js';
2
+
3
+ export const SCHEMA_REFERENCE_AUTHORITY_SCHEMA_ID = 'tiinex.site.schema-reference-authority.v1';
4
+ export const SCHEMA_REFERENCE_MATERIAL_COHERENCE_SCHEMA_ID = 'tiinex.site.schema-reference-material-coherence.v1';
5
+
6
+ export function schemaReferenceAuthorityFromBinding(schemaId = '', binding = {}, sourceAuthority = null, sourceQualification = null) {
7
+ const id = String(schemaId || binding?.schemaId || '').trim();
8
+ const localUnpublished = String(binding?.publicationState || '').toLowerCase().includes('unpublished');
9
+ const exactSourceTargets = localUnpublished
10
+ ? Object.freeze({ state: 'unavailable', targets: Object.freeze([]), findings: Object.freeze(['Binding is explicitly unpublished; remote source targets are not creation reference authority.']) })
11
+ : canonicalGithubSchemaSourceTargets(sourceAuthority);
12
+ const exactTargets = exactSourceTargets.state === 'qualified' ? [...exactSourceTargets.targets] : [];
13
+ const semanticMaterialIdentity = normalizeMaterialIdentity(sourceQualification?.materialIdentity || {});
14
+ const sourceQualified = sourceQualification?.state === 'qualified' && semanticMaterialIdentity.state === 'qualified';
15
+ const materialBoundTarget = Boolean(exactTargets.length && sourceQualified && sourceQualification?.bindingMaterialCoherence?.state === 'qualified');
16
+ const preferredTarget = exactTargets[0] || '';
17
+ return Object.freeze({
18
+ schema: SCHEMA_REFERENCE_AUTHORITY_SCHEMA_ID,
19
+ schemaId: id,
20
+ exactTargets: Object.freeze(exactTargets),
21
+ semanticSourceTargets: Object.freeze(exactTargets),
22
+ materialBoundTarget,
23
+ preferredTarget,
24
+ targetAuthority: exactTargets.length ? 'exact-source-target' : 'schema-id-only',
25
+ resolutionState: materialBoundTarget ? 'qualified' : exactTargets.length ? 'unresolved' : 'unavailable',
26
+ resolutionEvidence: Object.freeze(materialBoundTarget ? resolvedMaterialEvidence(preferredTarget, semanticMaterialIdentity) : {}),
27
+ semanticMaterialIdentity,
28
+ exactSourceTargets
29
+ });
30
+ }
31
+
32
+ export function qualifySchemaReferenceMaterialCoherence(authority = {}) {
33
+ const semantic = normalizeMaterialIdentity(authority?.semanticMaterialIdentity || {});
34
+ const target = String(authority?.preferredTarget || authority?.target || '').trim();
35
+ const directSourceTarget = authority?.materialBoundTarget === true;
36
+ const schemaIdOnly = !target && String(authority?.targetAuthority || '') === 'schema-id-only';
37
+ const resolutionEvidence = normalizeResolutionEvidence(authority?.resolutionEvidence || authority?.evidence || {}, target);
38
+ const evidence = resolutionEvidence.materialIdentity;
39
+ const findings = [];
40
+ if (semantic.state !== 'qualified') findings.push('Qualified semantic schema material identity is unavailable.');
41
+ let match = false;
42
+ let mode = 'unavailable';
43
+ if (semantic.state === 'qualified' && schemaIdOnly) {
44
+ match = true;
45
+ mode = 'schema-id-only-semantic-material';
46
+ } else if (semantic.state === 'qualified' && directSourceTarget) {
47
+ match = true;
48
+ mode = 'declared-source-target';
49
+ } else if (semantic.state === 'qualified' && resolutionEvidence.state === 'qualified' && evidence.state === 'qualified') {
50
+ match = materialIdentitiesMatch(semantic, evidence);
51
+ mode = match ? 'resolved-byte-equivalent-material' : 'resolved-material-mismatch';
52
+ if (!match) findings.push('Resolved schema-reference material does not match the semantic schema material used for exact creation.');
53
+ } else if (semantic.state === 'qualified') {
54
+ findings.push('Resolved schema-reference material identity is unavailable or not target-qualified; exact creation cannot bind the declared reference to the semantic schema material.');
55
+ }
56
+ if (!schemaIdOnly && authority?.resolutionState !== 'qualified') findings.push(`Declared schema reference resolver state is ${authority?.resolutionState || 'unavailable'}; exact creation requires qualified resolution.`);
57
+ return Object.freeze({ schema: SCHEMA_REFERENCE_MATERIAL_COHERENCE_SCHEMA_ID, state: findings.length || !match ? 'unavailable' : 'qualified', mode, target, semanticMaterialIdentity: semantic, resolverEvidence: resolutionEvidence, resolvedMaterialIdentity: evidence, findings: Object.freeze(findings) });
58
+ }
59
+
60
+ function normalizeMaterialIdentity(value = {}) {
61
+ const sha256 = String(value?.sha256 || value?.checksum || '').trim().toLowerCase();
62
+ const sourceBlobSha = String(value?.sourceBlobSha || value?.gitBlobSha || value?.blobSha || '').trim().toLowerCase();
63
+ const bytes = Number(value?.bytes || value?.byteLength || 0);
64
+ const schemaId = String(value?.schemaId || '').trim();
65
+ const qualified = value?.state === 'qualified' && Boolean(sha256 || sourceBlobSha);
66
+ return Object.freeze({ schema: String(value?.schema || 'tiinex.site.schema-material-identity.v1'), state: qualified ? 'qualified' : 'unavailable', schemaId, sha256, sourceBlobSha, bytes: Number.isFinite(bytes) && bytes > 0 ? bytes : 0, sourceRepository: String(value?.sourceRepository || ''), sourceCommit: String(value?.sourceCommit || ''), sourcePath: String(value?.sourcePath || '') });
67
+ }
68
+
69
+ function normalizeResolutionEvidence(value = {}, target = '') {
70
+ const declaredTarget = String(value?.target || value?.resolvedTarget || '').trim();
71
+ const state = String(value?.state || value?.qualification || '').trim();
72
+ const materialIdentity = normalizeResolvedMaterialIdentity(value?.materialIdentity || value?.material || {});
73
+ const qualified = state === 'qualified' && declaredTarget && declaredTarget === String(target || '').trim() && materialIdentity.state === 'qualified';
74
+ return Object.freeze({ state: qualified ? 'qualified' : 'unavailable', target: declaredTarget, materialIdentity, evidenceKind: String(value?.kind || value?.evidenceKind || '') });
75
+ }
76
+
77
+ function normalizeResolvedMaterialIdentity(value = {}) {
78
+ const sha256 = String(value?.sha256 || value?.checksum || value?.materialSha256 || '').trim().toLowerCase();
79
+ const sourceBlobSha = String(value?.sourceBlobSha || value?.gitBlobSha || value?.blobSha || '').trim().toLowerCase();
80
+ const bytes = Number(value?.bytes || value?.byteLength || 0);
81
+ return Object.freeze({ schema: 'tiinex.site.schema-material-identity.v1', state: sha256 || sourceBlobSha ? 'qualified' : 'unavailable', schemaId: String(value?.schemaId || ''), sha256, sourceBlobSha, bytes: Number.isFinite(bytes) && bytes > 0 ? bytes : 0, sourceRepository: String(value?.sourceRepository || value?.repository || ''), sourceCommit: String(value?.sourceCommit || value?.commit || ''), sourcePath: String(value?.sourcePath || value?.path || '') });
82
+ }
83
+
84
+ function resolvedMaterialEvidence(target = '', identity = {}) {
85
+ return Object.freeze({ state: 'qualified', target: String(target || ''), materialIdentity: Object.freeze({ state: 'qualified', sha256: String(identity?.sha256 || ''), gitBlobSha: String(identity?.sourceBlobSha || ''), bytes: Number(identity?.bytes || 0), sourceRepository: String(identity?.sourceRepository || ''), sourceCommit: String(identity?.sourceCommit || ''), sourcePath: String(identity?.sourcePath || '') }) });
86
+ }
87
+
88
+ function materialIdentitiesMatch(semantic = {}, resolved = {}) {
89
+ const cryptographic = [];
90
+ if (semantic.sha256 && resolved.sha256) cryptographic.push(semantic.sha256 === resolved.sha256);
91
+ if (semantic.sourceBlobSha && resolved.sourceBlobSha) cryptographic.push(semantic.sourceBlobSha === resolved.sourceBlobSha);
92
+ if (!cryptographic.length || cryptographic.some((match) => !match)) return false;
93
+ if (semantic.bytes && resolved.bytes && semantic.bytes !== resolved.bytes) return false;
94
+ return true;
95
+ }
96
+
97
+ export function parseSchemaReferenceValue(value = '') {
98
+ const raw = String(value ?? '');
99
+ if (!raw) return Object.freeze({ raw: '', form: 'empty', schemaId: '', target: '' });
100
+ const link = raw.match(/^\[([^\]]+)\]\(([^)]+)\)$/);
101
+ if (link) return Object.freeze({ raw, form: 'markdown-link', schemaId: link[1], target: link[2] });
102
+ return Object.freeze({ raw, form: 'plain-schema-id', schemaId: raw, target: '' });
103
+ }
104
+
105
+ export function renderSchemaReference(authority = {}) {
106
+ const schemaId = String(authority?.schemaId || '').trim();
107
+ if (!schemaId) throw new Error('schema-reference-id-missing');
108
+ const target = String(authority?.preferredTarget || '').trim();
109
+ return target ? `[${schemaId}](${target})` : schemaId;
110
+ }
111
+
112
+ export function qualifySchemaReferenceValue(value = '', authority = {}) {
113
+ const observed = parseSchemaReferenceValue(value);
114
+ const expectedSchemaId = String(authority?.schemaId || '').trim();
115
+ const exactTargets = new Set([...(authority?.exactTargets || [])].map((item) => String(item ?? '')).filter(Boolean));
116
+ const findings = [];
117
+ if (!expectedSchemaId) findings.push('Expected schema identifier authority is unavailable.');
118
+ if (observed.schemaId !== expectedSchemaId) findings.push(`Schema identifier must be exactly ${expectedSchemaId}; observed ${observed.schemaId || '(empty)'}.`);
119
+ let targetState = 'not-present';
120
+ if (observed.form === 'markdown-link') {
121
+ targetState = exactTargets.has(observed.target) ? 'qualified' : 'unqualified';
122
+ if (targetState !== 'qualified') findings.push(`Schema reference target is not qualified for ${expectedSchemaId}: ${observed.target || '(empty)'}.`);
123
+ }
124
+ if (observed.form === 'empty') findings.push('Schema reference value is empty.');
125
+ return Object.freeze({
126
+ state: findings.length ? 'unavailable' : 'qualified',
127
+ schemaIdState: observed.schemaId === expectedSchemaId && expectedSchemaId ? 'qualified' : 'unavailable',
128
+ targetState,
129
+ observed,
130
+ authority,
131
+ findings: Object.freeze(findings)
132
+ });
133
+ }
@@ -0,0 +1,239 @@
1
+ import { sha256Hex, utf8Bytes } from '../export/package.bytes.js';
2
+ import { qualifyGithubSchemaSourceProvider } from './schema.githubSourceTarget.js';
3
+
4
+ export const BUNDLED_SCHEMA_SOURCE_SCHEMA_ID = 'tiinex.site.bundled-schema-source.v1';
5
+ export const SCHEMA_RUNTIME_PROJECTION_SCHEMA_ID = 'tiinex.site.schema-runtime-projection.v1';
6
+ export const SCHEMA_MATERIAL_IDENTITY_SCHEMA_ID = 'tiinex.site.schema-material-identity.v1';
7
+
8
+ export function defineBundledSchemaSource(binding = {}, projection = {}, options = {}) {
9
+ const schemaId = String(binding?.schemaId || '').trim();
10
+ const expectedChecksum = String(binding?.checksum?.value || binding?.checksum || '').trim();
11
+ const baseAuthority = Object.freeze({
12
+ repository: String(binding?.sourceRepository || '').trim(),
13
+ commit: String(binding?.sourceCommit || '').trim(),
14
+ path: String(binding?.sourcePath || '').trim(),
15
+ blobSha: String(binding?.sourceBlobSha || '').trim(),
16
+ checksum: expectedChecksum
17
+ });
18
+ const providerQualification = qualifyGithubSchemaSourceProvider(binding, baseAuthority);
19
+ const authority = Object.freeze({
20
+ ...baseAuthority,
21
+ provider: providerQualification.state === 'qualified' ? providerQualification.provider : '',
22
+ providerQualification
23
+ });
24
+ const runtimeProjection = normalizeRuntimeProjection(projection);
25
+ let cached = null;
26
+ function qualify() {
27
+ if (cached) return cached;
28
+ const projectionExact = Boolean(
29
+ runtimeProjection.schema === SCHEMA_RUNTIME_PROJECTION_SCHEMA_ID
30
+ && schemaId
31
+ && expectedChecksum
32
+ && runtimeProjection.schemaId === schemaId
33
+ && runtimeProjection.sourceChecksum === expectedChecksum
34
+ && runtimeProjection.bindingChecksum === expectedChecksum
35
+ );
36
+ const bindingBlobSha = String(binding?.sourceBlobSha || '').trim().toLowerCase();
37
+ const loadedBlobSha = String(runtimeProjection.sourceBlobSha || '').trim().toLowerCase();
38
+ const snapshotCompleteness = String(binding?.snapshotCompleteness || '').trim();
39
+ const bindingMaterialCoherence = Object.freeze({
40
+ state: projectionExact && snapshotCompleteness === 'exact-canonical-docs-snapshot' && bindingBlobSha && bindingBlobSha === loadedBlobSha ? 'qualified' : 'unavailable',
41
+ bindingBlobSha,
42
+ loadedBlobSha,
43
+ snapshotCompleteness,
44
+ findings: Object.freeze([
45
+ ...(bindingBlobSha && loadedBlobSha && bindingBlobSha !== loadedBlobSha ? ['Binding sourceBlobSha does not match the Git-blob identity computed from the loaded schema bytes.'] : []),
46
+ ...(snapshotCompleteness !== 'exact-canonical-docs-snapshot' ? [`Binding snapshotCompleteness is ${snapshotCompleteness || 'unavailable'}; the external source target is not independently qualified as an exact canonical snapshot.`] : []),
47
+ ...(!bindingBlobSha ? ['Binding does not declare a sourceBlobSha that can be checked against the loaded schema bytes.'] : []),
48
+ ...(!loadedBlobSha ? ['Loaded schema Git-blob identity is unavailable from the runtime projection.'] : [])
49
+ ])
50
+ });
51
+ const validationContract = projectionExact && runtimeProjection.validationContract?.schemaId === schemaId && runtimeProjection.validationContract?.lineageQualification?.state === 'valid'
52
+ ? runtimeProjection.validationContract
53
+ : null;
54
+ const compiledContract = projectionExact ? Object.freeze({
55
+ schemaId,
56
+ validationContract,
57
+ creation: Object.freeze({
58
+ groups: Object.freeze((runtimeProjection.creation.groupNames || []).map((name) => Object.freeze({ name }))),
59
+ requiredInputs: runtimeProjection.creation.requiredInputs,
60
+ optionalInputs: runtimeProjection.creation.optionalInputs,
61
+ requiredSections: runtimeProjection.creation.requiredSections,
62
+ toolingConfigurationFields: runtimeProjection.creation.toolingConfigurationFields,
63
+ inputBindings: runtimeProjection.creation.inputBindings,
64
+ supplementalRequiredFields: runtimeProjection.creation.supplementalRequiredFields,
65
+ representationSections: deriveCreationRepresentationSections(runtimeProjection.creation.inputBindings, validationContract),
66
+ requiredShape: runtimeProjection.creation.requiredShape
67
+ })
68
+ }) : null;
69
+ const materialIdentity = Object.freeze({
70
+ schema: SCHEMA_MATERIAL_IDENTITY_SCHEMA_ID,
71
+ state: projectionExact ? 'qualified' : 'unavailable',
72
+ schemaId,
73
+ sha256: String(runtimeProjection.sourceChecksum || ''),
74
+ bytes: Number(runtimeProjection.sourceBytes || 0),
75
+ sourceRepository: String(authority.repository || ''),
76
+ sourceCommit: String(authority.commit || ''),
77
+ sourcePath: String(authority.path || ''),
78
+ sourceBlobSha: loadedBlobSha
79
+ });
80
+ cached = Object.freeze({
81
+ state: projectionExact ? 'qualified' : 'unavailable',
82
+ schemaId,
83
+ checksum: runtimeProjection.sourceChecksum || '',
84
+ expectedChecksum,
85
+ authority,
86
+ bindingMaterialCoherence,
87
+ materialIdentity,
88
+ compiledContract,
89
+ projection: runtimeProjection,
90
+ findings: Object.freeze([
91
+ ...(runtimeProjection.schema !== SCHEMA_RUNTIME_PROJECTION_SCHEMA_ID ? ['Schema runtime projection type is invalid.'] : []),
92
+ ...(runtimeProjection.schemaId !== schemaId ? ['Schema runtime projection identity does not match binding.'] : []),
93
+ ...(runtimeProjection.sourceChecksum !== expectedChecksum ? ['Schema runtime projection source checksum does not match binding.'] : []),
94
+ ...(runtimeProjection.bindingChecksum !== expectedChecksum ? ['Schema runtime projection binding checksum does not match binding.'] : []),
95
+ ...(runtimeProjection.validationContract && runtimeProjection.validationContract?.schemaId !== schemaId ? ['Schema runtime validation projection identity does not match binding.'] : []),
96
+ ...(runtimeProjection.validationContract && runtimeProjection.validationContract?.lineageQualification?.state !== 'valid' ? ['Schema runtime validation projection lineage is not exact/valid.'] : [])
97
+ ])
98
+ });
99
+ return cached;
100
+ }
101
+ return Object.freeze({
102
+ schema: BUNDLED_SCHEMA_SOURCE_SCHEMA_ID,
103
+ status: schemaId && expectedChecksum && runtimeProjection.schemaId ? 'bundled' : 'unavailable',
104
+ readable: Boolean(schemaId && options.assetUrl),
105
+ schemaId,
106
+ markdown: '',
107
+ bundledPath: String(options.bundledPath || binding?.sourcePath || '').trim(),
108
+ sourceLabel: String(options.sourceLabel || 'Viewer schema registry').trim(),
109
+ assetUrl: String(options.assetUrl || '').trim(),
110
+ expectedChecksum,
111
+ authority,
112
+ runtimeProjection,
113
+ qualify
114
+ });
115
+ }
116
+
117
+ export function qualifyBundledSchemaSource(source = null) {
118
+ return typeof source?.qualify === 'function'
119
+ ? source.qualify()
120
+ : Object.freeze({ state: 'unavailable', schemaId: String(source?.schemaId || ''), compiledContract: null, findings: Object.freeze(['Schema source qualification owner is unavailable.']) });
121
+ }
122
+
123
+ export function qualifyBundledSchemaReadableText(source = null, markdown = '') {
124
+ const sourceQualification = qualifyBundledSchemaSource(source);
125
+ const text = String(markdown ?? '');
126
+ const checksum = text ? sha256Hex(utf8Bytes(text)) : '';
127
+ const exact = Boolean(
128
+ sourceQualification.state === 'qualified'
129
+ && text
130
+ && checksum === String(source?.expectedChecksum || '')
131
+ && checksum === String(sourceQualification.checksum || '')
132
+ );
133
+ return Object.freeze({
134
+ state: exact ? 'qualified' : 'unavailable',
135
+ schemaId: String(source?.schemaId || ''),
136
+ checksum,
137
+ expectedChecksum: String(source?.expectedChecksum || ''),
138
+ authority: source?.authority || null,
139
+ markdown: exact ? text : '',
140
+ sourceQualification,
141
+ findings: Object.freeze([
142
+ ...(!text ? ['Bundled schema readable source is empty.'] : []),
143
+ ...(text && checksum !== String(source?.expectedChecksum || '') ? ['Bundled schema readable source checksum does not match binding.'] : [])
144
+ ])
145
+ });
146
+ }
147
+
148
+ export function qualifiedCreationAuthorityFromSchemaSource(module = {}) {
149
+ const source = module?.schemaSource || null;
150
+ const binding = module?.binding || {};
151
+ const schemaId = String(module?.id || '').trim();
152
+ const qualification = qualifyBundledSchemaSource(source);
153
+ const compiled = qualification?.compiledContract || null;
154
+ const exact = Boolean(
155
+ qualification?.state === 'qualified'
156
+ && schemaId
157
+ && String(qualification.schemaId || '') === schemaId
158
+ && String(binding.schemaId || '') === schemaId
159
+ && String(qualification.checksum || '')
160
+ && String(qualification.checksum || '') === String(binding.checksum?.value || binding.checksum || '')
161
+ && String(qualification.authority?.path || '') === String(binding.sourcePath || '')
162
+ && String(qualification.authority?.commit || '') === String(binding.sourceCommit || '')
163
+ && String(compiled?.schemaId || '') === schemaId
164
+ );
165
+ const creationGroups = exact && Array.isArray(compiled?.creation?.groups) ? compiled.creation.groups : [];
166
+ const declared = creationGroups.length > 0;
167
+ return Object.freeze({
168
+ state: exact && declared ? 'qualified' : 'unavailable',
169
+ schemaId,
170
+ contractSection: 'Artifact Creation Contract',
171
+ sourceStatus: qualification?.state || 'unavailable',
172
+ checksum: String(qualification?.checksum || ''),
173
+ sourcePath: String(qualification?.authority?.path || ''),
174
+ sourceRepository: String(qualification?.authority?.repository || ''),
175
+ sourceCommit: String(qualification?.authority?.commit || ''),
176
+ compiledContract: exact ? compiled : null,
177
+ contractDeclared: declared
178
+ });
179
+ }
180
+
181
+
182
+ function deriveCreationRepresentationSections(inputBindings = [], validationContract = null) {
183
+ void validationContract;
184
+ const ordered = [];
185
+ for (const item of inputBindings || []) {
186
+ const name = String(item?.section || '').trim();
187
+ if (name && !ordered.includes(name)) ordered.push(name);
188
+ }
189
+ return Object.freeze(ordered);
190
+ }
191
+
192
+ function normalizeRuntimeProjection(value = {}) {
193
+ const creation = value?.creation || {};
194
+ return Object.freeze({
195
+ schema: String(value?.schema || ''),
196
+ generator: String(value?.generator || ''),
197
+ schemaId: String(value?.schemaId || '').trim(),
198
+ sourceChecksum: String(value?.sourceChecksum || '').trim(),
199
+ sourceBlobSha: String(value?.sourceBlobSha || '').trim(),
200
+ sourceBytes: Number(value?.sourceBytes || 0),
201
+ bindingChecksum: String(value?.bindingChecksum || '').trim(),
202
+ validationContract: freezeRuntimeValidationContract(value?.validationContract || {}),
203
+ creation: Object.freeze({
204
+ declared: Boolean(creation?.declared),
205
+ groupNames: Object.freeze([...(creation?.groupNames || [])].map((item) => String(item || '')).filter(Boolean)),
206
+ requiredInputs: Object.freeze([...(creation?.requiredInputs || [])].map((item) => String(item || '')).filter(Boolean)),
207
+ optionalInputs: Object.freeze([...(creation?.optionalInputs || [])].map((item) => String(item || '')).filter(Boolean)),
208
+ requiredSections: Object.freeze([...(creation?.requiredSections || [])].map((item) => String(item || '')).filter(Boolean)),
209
+ toolingConfigurationFields: Object.freeze([...(creation?.toolingConfigurationFields || [])].map((item) => String(item || '')).filter(Boolean)),
210
+ inputBindings: Object.freeze([...(creation?.inputBindings || [])].map((item) => deepFreezeJson(item)).filter((item) => String(item?.input || '').trim())),
211
+ supplementalRequiredFields: Object.freeze([...(creation?.supplementalRequiredFields || [])].map((item) => deepFreezeJson(item)).filter((item) => String(item?.field || '').trim())),
212
+ requiredShape: Object.freeze([...(creation?.requiredShape || [])].map((item) => Object.freeze({ id: String(item?.id || ''), sourceSchemaId: String(item?.sourceSchemaId || ''), group: String(item?.group || ''), category: String(item?.category || ''), line: Number(item?.line || 0), sourceText: String(item?.sourceText || ''), primitive: Object.freeze({ kind: String(item?.primitive?.kind || 'residual'), input: String(item?.primitive?.input || ''), section: String(item?.primitive?.section || ''), position: String(item?.primitive?.position || '') }) })).filter((item) => item.id))
213
+ })
214
+ });
215
+ }
216
+
217
+
218
+ function freezeRuntimeValidationContract(value = {}) {
219
+ return deepFreezeJson({
220
+ schema: String(value?.schema || ''),
221
+ schemaId: String(value?.schemaId || '').trim(),
222
+ lineage: Array.isArray(value?.lineage) ? value.lineage : [],
223
+ lineageQualification: value?.lineageQualification || {},
224
+ lineageAuthority: Array.isArray(value?.lineageAuthority) ? value.lineageAuthority : [],
225
+ inheritanceResolution: value?.inheritanceResolution || {},
226
+ validation: value?.validation || {},
227
+ declarations: Array.isArray(value?.declarations) ? value.declarations : [],
228
+ constraints: Array.isArray(value?.constraints) ? value.constraints : [],
229
+ machineShapes: value?.machineShapes || {}
230
+ });
231
+ }
232
+
233
+ function deepFreezeJson(value) {
234
+ if (!value || typeof value !== 'object') return value;
235
+ if (Array.isArray(value)) return Object.freeze(value.map(deepFreezeJson));
236
+ const out = {};
237
+ for (const [key, item] of Object.entries(value)) out[key] = deepFreezeJson(item);
238
+ return Object.freeze(out);
239
+ }