@paradigma-inc/flywheel 0.1.115 → 0.1.134

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 (623) hide show
  1. package/README.md +67 -10
  2. package/package.json +14 -6
  3. package/skills/flywheel/SKILL.md +9 -6
  4. package/skills/flywheel/example-workflows/organizing-exploring-and-iterating-on-a-research-topic.md +38 -46
  5. package/skills/flywheel/example-workflows/reproducing-papers-on-a-budget.md +34 -36
  6. package/skills/flywheel/getting-started/flywheel-quickstart.md +2 -5
  7. package/skills/flywheel/references/INTERFACES.md +2 -2
  8. package/skills/flywheel/references/experiment-design-protocol.md +32 -25
  9. package/skills/flywheel/references/flywheel-cli-tool-map.md +120 -76
  10. package/skills/flywheel/references/flywheel-mcp-tool-map.md +42 -32
  11. package/skills/flywheel/setting-up-flywheel/claude-code-cli-installation.md +1 -1
  12. package/skills/flywheel/setting-up-flywheel/codex-cli-installation.md +1 -1
  13. package/skills/flywheel/setting-up-flywheel/installation-overview.md +2 -6
  14. package/skills/flywheel/setting-up-flywheel/other-hosts-installation.md +45 -25
  15. package/skills/flywheel/setting-up-flywheel/updating-flywheel-mcp.md +34 -11
  16. package/skills/flywheel-auto/SKILL.md +40 -23
  17. package/skills/flywheel-auto/evals/evals.json +1 -1
  18. package/skills/flywheel-auto/references/INTERFACES.md +2 -2
  19. package/skills/flywheel-auto/references/experiment-design-protocol.md +31 -23
  20. package/skills/flywheel-auto/references/flywheel-cli-tool-map.md +172 -127
  21. package/skills/flywheel-auto/references/flywheel-mcp-tool-map.md +22 -24
  22. package/skills/flywheel-lookahead/SKILL.md +47 -28
  23. package/skills/flywheel-lookahead/agents/openai.yaml +1 -1
  24. package/skills/flywheel-lookahead/evals/evals.json +6 -6
  25. package/skills/flywheel-lookahead/references/INTERFACES.md +2 -2
  26. package/skills/flywheel-lookahead/references/flywheel-cli-tool-map.md +172 -127
  27. package/skills/flywheel-lookahead/references/flywheel-mcp-tool-map.md +22 -24
  28. package/skills/flywheel-prove/SKILL.md +2 -2
  29. package/skills/flywheel-prove/references/workflow.md +21 -2
  30. package/skills/flywheel-reproduce/SKILL.md +39 -19
  31. package/skills/flywheel-reproduce/evals/evals.json +1 -1
  32. package/skills/flywheel-reproduce/references/INTERFACES.md +2 -2
  33. package/skills/flywheel-reproduce/references/experiment-design-protocol.md +31 -23
  34. package/skills/flywheel-reproduce/references/flywheel-cli-tool-map.md +172 -127
  35. package/skills/flywheel-reproduce/references/flywheel-mcp-tool-map.md +22 -24
  36. package/skills/flywheel-to-graph/SKILL.md +37 -17
  37. package/skills/flywheel-to-graph/references/INTERFACES.md +2 -2
  38. package/skills/flywheel-to-graph/references/flywheel-cli-tool-map.md +172 -127
  39. package/skills/flywheel-to-graph/references/flywheel-mcp-tool-map.md +22 -24
  40. package/skills/flywheel-tree/references/workflow.md +6 -37
  41. package/src/cli.mjs +1145 -1141
  42. package/src/mcp-writer.mjs +413 -435
  43. package/src/public-command-metadata.mjs +28 -5
  44. package/src/runtime/delegate.mjs +2 -19
  45. package/src/runtime/required-runtime-commands.json +80 -28
  46. package/src/runtime/runtime-config.mjs +39 -60
  47. package/src/runtime/vendor/flywheel-cli-dist/auth/credentials.js +330 -0
  48. package/src/runtime/vendor/flywheel-cli-dist/auth/credentials.js.map +1 -0
  49. package/src/runtime/vendor/flywheel-cli-dist/auth/login.js +90 -139
  50. package/src/runtime/vendor/flywheel-cli-dist/auth/login.js.map +1 -1
  51. package/src/runtime/vendor/flywheel-cli-dist/auth/profiles.js +1 -1
  52. package/src/runtime/vendor/flywheel-cli-dist/auth/profiles.js.map +1 -1
  53. package/src/runtime/vendor/flywheel-cli-dist/auth/secure-write.js +116 -0
  54. package/src/runtime/vendor/flywheel-cli-dist/auth/secure-write.js.map +1 -0
  55. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-create.js +248 -1
  56. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-create.js.map +1 -1
  57. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-login.js +65 -1
  58. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-login.js.map +1 -1
  59. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-revoke-api-key.js +17 -0
  60. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-revoke-api-key.js.map +1 -0
  61. package/src/runtime/vendor/flywheel-cli-dist/commands/aliases.js +3 -7
  62. package/src/runtime/vendor/flywheel-cli-dist/commands/aliases.js.map +1 -1
  63. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-credentials-clear.js +12 -0
  64. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-credentials-clear.js.map +1 -0
  65. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-credentials-set.js +29 -0
  66. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-credentials-set.js.map +1 -0
  67. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-login.js +12 -0
  68. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-login.js.map +1 -1
  69. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-status.js +46 -10
  70. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-status.js.map +1 -1
  71. package/src/runtime/vendor/flywheel-cli-dist/commands/env.js +17 -40
  72. package/src/runtime/vendor/flywheel-cli-dist/commands/env.js.map +1 -1
  73. package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation-resources.js +305 -0
  74. package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation-resources.js.map +1 -0
  75. package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation-support.js +72 -0
  76. package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation-support.js.map +1 -0
  77. package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation.js +286 -0
  78. package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation.js.map +1 -0
  79. package/src/runtime/vendor/flywheel-cli-dist/commands/help-metadata.js +30 -5
  80. package/src/runtime/vendor/flywheel-cli-dist/commands/help-metadata.js.map +1 -1
  81. package/src/runtime/vendor/flywheel-cli-dist/commands/help.js +27 -12
  82. package/src/runtime/vendor/flywheel-cli-dist/commands/help.js.map +1 -1
  83. package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-commit-replay.js +284 -0
  84. package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-commit-replay.js.map +1 -0
  85. package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-graph.js +169 -0
  86. package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-graph.js.map +1 -0
  87. package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-lineage-list.js +13 -0
  88. package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-lineage-list.js.map +1 -0
  89. package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-repository-snapshot.js +227 -0
  90. package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-repository-snapshot.js.map +1 -0
  91. package/src/runtime/vendor/flywheel-cli-dist/commands/index.js +21 -51
  92. package/src/runtime/vendor/flywheel-cli-dist/commands/index.js.map +1 -1
  93. package/src/runtime/vendor/flywheel-cli-dist/commands/node-create-schema.js +25 -0
  94. package/src/runtime/vendor/flywheel-cli-dist/commands/node-create-schema.js.map +1 -0
  95. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-list.js +11 -9
  96. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-list.js.map +1 -1
  97. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-set.js +38 -45
  98. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-set.js.map +1 -1
  99. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-show.js +14 -17
  100. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-show.js.map +1 -1
  101. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-unset.js +13 -8
  102. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-unset.js.map +1 -1
  103. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/admin.js +34 -3
  104. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/admin.js.map +1 -1
  105. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/auth.js +9 -9
  106. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/auth.js.map +1 -1
  107. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/hosted.js +76 -0
  108. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/hosted.js.map +1 -0
  109. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/lifecycle.js +4 -138
  110. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/lifecycle.js.map +1 -1
  111. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/profile.js +8 -13
  112. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/profile.js.map +1 -1
  113. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/repository.js +362 -0
  114. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/repository.js.map +1 -0
  115. package/src/runtime/vendor/flywheel-cli-dist/commands/registry.js +45 -183
  116. package/src/runtime/vendor/flywheel-cli-dist/commands/registry.js.map +1 -1
  117. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-edit.js +47 -0
  118. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-edit.js.map +1 -0
  119. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-operation.js +181 -0
  120. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-operation.js.map +1 -0
  121. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-output.js +163 -0
  122. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-output.js.map +1 -0
  123. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-projection.js +79 -0
  124. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-projection.js.map +1 -0
  125. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-selection.js +80 -0
  126. package/src/runtime/vendor/flywheel-cli-dist/commands/repository-selection.js.map +1 -0
  127. package/src/runtime/vendor/flywheel-cli-dist/commands/retired-command-names.js +78 -0
  128. package/src/runtime/vendor/flywheel-cli-dist/commands/retired-command-names.js.map +1 -0
  129. package/src/runtime/vendor/flywheel-cli-dist/commands/types.js.map +1 -1
  130. package/src/runtime/vendor/flywheel-cli-dist/commands/usage-spec.js +3 -2
  131. package/src/runtime/vendor/flywheel-cli-dist/commands/usage-spec.js.map +1 -1
  132. package/src/runtime/vendor/flywheel-cli-dist/config/index.js +5 -0
  133. package/src/runtime/vendor/flywheel-cli-dist/config/index.js.map +1 -0
  134. package/src/runtime/vendor/flywheel-cli-dist/config/io.js +139 -0
  135. package/src/runtime/vendor/flywheel-cli-dist/config/io.js.map +1 -0
  136. package/src/runtime/vendor/flywheel-cli-dist/config/migration.js +299 -0
  137. package/src/runtime/vendor/flywheel-cli-dist/config/migration.js.map +1 -0
  138. package/src/runtime/vendor/flywheel-cli-dist/config/model.js +214 -0
  139. package/src/runtime/vendor/flywheel-cli-dist/config/model.js.map +1 -0
  140. package/src/runtime/vendor/flywheel-cli-dist/config/path.js +30 -0
  141. package/src/runtime/vendor/flywheel-cli-dist/config/path.js.map +1 -0
  142. package/src/runtime/vendor/flywheel-cli-dist/credential-output.js +29 -0
  143. package/src/runtime/vendor/flywheel-cli-dist/credential-output.js.map +1 -0
  144. package/src/runtime/vendor/flywheel-cli-dist/errors.js +1 -16
  145. package/src/runtime/vendor/flywheel-cli-dist/errors.js.map +1 -1
  146. package/src/runtime/vendor/flywheel-cli-dist/generatedProductTelemetryContract.js +3 -3
  147. package/src/runtime/vendor/flywheel-cli-dist/generatedProductTelemetryContract.js.map +1 -1
  148. package/src/runtime/vendor/flywheel-cli-dist/grammar/globals.js +19 -9
  149. package/src/runtime/vendor/flywheel-cli-dist/grammar/globals.js.map +1 -1
  150. package/src/runtime/vendor/flywheel-cli-dist/grammar/parse.js +33 -4
  151. package/src/runtime/vendor/flywheel-cli-dist/grammar/parse.js.map +1 -1
  152. package/src/runtime/vendor/flywheel-cli-dist/http/client.js +322 -304
  153. package/src/runtime/vendor/flywheel-cli-dist/http/client.js.map +1 -1
  154. package/src/runtime/vendor/flywheel-cli-dist/http/debug.js +1 -21
  155. package/src/runtime/vendor/flywheel-cli-dist/http/debug.js.map +1 -1
  156. package/src/runtime/vendor/flywheel-cli-dist/http/retry.js +1 -0
  157. package/src/runtime/vendor/flywheel-cli-dist/http/retry.js.map +1 -1
  158. package/src/runtime/vendor/flywheel-cli-dist/local/adapter.js +244 -0
  159. package/src/runtime/vendor/flywheel-cli-dist/local/adapter.js.map +1 -0
  160. package/src/runtime/vendor/flywheel-cli-dist/local/domain/errors.js +7 -0
  161. package/src/runtime/vendor/flywheel-cli-dist/local/domain/errors.js.map +1 -0
  162. package/src/runtime/vendor/flywheel-cli-dist/local/domain/history.js +35 -0
  163. package/src/runtime/vendor/flywheel-cli-dist/local/domain/history.js.map +1 -0
  164. package/src/runtime/vendor/flywheel-cli-dist/local/domain/invariants.js +42 -0
  165. package/src/runtime/vendor/flywheel-cli-dist/local/domain/invariants.js.map +1 -0
  166. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/artifact-properties.js +179 -0
  167. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/artifact-properties.js.map +1 -0
  168. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/commits.js +152 -0
  169. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/commits.js.map +1 -0
  170. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/constants.js +71 -0
  171. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/constants.js.map +1 -0
  172. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/encoding.js +73 -0
  173. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/encoding.js.map +1 -0
  174. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/imported-artifact-properties.js +82 -0
  175. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/imported-artifact-properties.js.map +1 -0
  176. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/operations.js +345 -0
  177. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/operations.js.map +1 -0
  178. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/tags.js +57 -0
  179. package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/tags.js.map +1 -0
  180. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/conflicts.js +149 -0
  181. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/conflicts.js.map +1 -0
  182. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/context.js +115 -0
  183. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/context.js.map +1 -0
  184. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/keys.js +44 -0
  185. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/keys.js.map +1 -0
  186. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/pull.js +159 -0
  187. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/pull.js.map +1 -0
  188. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/replay.js +346 -0
  189. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/replay.js.map +1 -0
  190. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/resolve.js +37 -0
  191. package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/resolve.js.map +1 -0
  192. package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/inverses.js +203 -0
  193. package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/inverses.js.map +1 -0
  194. package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/plan.js +207 -0
  195. package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/plan.js.map +1 -0
  196. package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/tag-inverses.js +109 -0
  197. package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/tag-inverses.js.map +1 -0
  198. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/commit.js +61 -0
  199. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/commit.js.map +1 -0
  200. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/projection.js +46 -0
  201. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/projection.js.map +1 -0
  202. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/revert.js +203 -0
  203. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/revert.js.map +1 -0
  204. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/staging.js +44 -0
  205. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/staging.js.map +1 -0
  206. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/writes.js +188 -0
  207. package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/writes.js.map +1 -0
  208. package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync/cursors.js +54 -0
  209. package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync/cursors.js.map +1 -0
  210. package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync/local-pull.js +25 -0
  211. package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync/local-pull.js.map +1 -0
  212. package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync-models.js +2 -0
  213. package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync-models.js.map +1 -0
  214. package/src/runtime/vendor/flywheel-cli-dist/local/fs/native.js +7 -0
  215. package/src/runtime/vendor/flywheel-cli-dist/local/fs/native.js.map +1 -0
  216. package/src/runtime/vendor/flywheel-cli-dist/local/fs/state.js +129 -0
  217. package/src/runtime/vendor/flywheel-cli-dist/local/fs/state.js.map +1 -0
  218. package/src/runtime/vendor/flywheel-cli-dist/local/fs/writer-lock.js +277 -0
  219. package/src/runtime/vendor/flywheel-cli-dist/local/fs/writer-lock.js.map +1 -0
  220. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/bootstrap.js +183 -0
  221. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/bootstrap.js.map +1 -0
  222. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/context.js +2 -0
  223. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/context.js.map +1 -0
  224. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/dispatch.js +121 -0
  225. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/dispatch.js.map +1 -0
  226. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/doctor.js +16 -0
  227. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/doctor.js.map +1 -0
  228. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/identity.js +72 -0
  229. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/identity.js.map +1 -0
  230. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/conflicts.js +59 -0
  231. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/conflicts.js.map +1 -0
  232. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/core.js +125 -0
  233. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/core.js.map +1 -0
  234. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/history.js +129 -0
  235. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/history.js.map +1 -0
  236. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/index.js +31 -0
  237. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/index.js.map +1 -0
  238. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/maintenance.js +49 -0
  239. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/maintenance.js.map +1 -0
  240. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/projections.js +30 -0
  241. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/projections.js.map +1 -0
  242. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/shared.js +12 -0
  243. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/shared.js.map +1 -0
  244. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/platform.js +18 -0
  245. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/platform.js.map +1 -0
  246. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/projection.js +125 -0
  247. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/projection.js.map +1 -0
  248. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/clone.js +37 -0
  249. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/clone.js.map +1 -0
  250. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/pull.js +44 -0
  251. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/pull.js.map +1 -0
  252. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/purge.js +58 -0
  253. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/purge.js.map +1 -0
  254. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/push.js +118 -0
  255. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/push.js.map +1 -0
  256. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/transport.js +277 -0
  257. package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/transport.js.map +1 -0
  258. package/src/runtime/vendor/flywheel-cli-dist/local/store/apply.js +132 -0
  259. package/src/runtime/vendor/flywheel-cli-dist/local/store/apply.js.map +1 -0
  260. package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/archive.js +372 -0
  261. package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/archive.js.map +1 -0
  262. package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/backup.js +210 -0
  263. package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/backup.js.map +1 -0
  264. package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/restore.js +278 -0
  265. package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/restore.js.map +1 -0
  266. package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/retained-directory.js +192 -0
  267. package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/retained-directory.js.map +1 -0
  268. package/src/runtime/vendor/flywheel-cli-dist/local/store/commits.js +114 -0
  269. package/src/runtime/vendor/flywheel-cli-dist/local/store/commits.js.map +1 -0
  270. package/src/runtime/vendor/flywheel-cli-dist/local/store/contract.js +65 -0
  271. package/src/runtime/vendor/flywheel-cli-dist/local/store/contract.js.map +1 -0
  272. package/src/runtime/vendor/flywheel-cli-dist/local/store/diagnostics-worker.js +145 -0
  273. package/src/runtime/vendor/flywheel-cli-dist/local/store/diagnostics-worker.js.map +1 -0
  274. package/src/runtime/vendor/flywheel-cli-dist/local/store/diagnostics.js +218 -0
  275. package/src/runtime/vendor/flywheel-cli-dist/local/store/diagnostics.js.map +1 -0
  276. package/src/runtime/vendor/flywheel-cli-dist/local/store/gc.js +71 -0
  277. package/src/runtime/vendor/flywheel-cli-dist/local/store/gc.js.map +1 -0
  278. package/src/runtime/vendor/flywheel-cli-dist/local/store/history-validation.js +298 -0
  279. package/src/runtime/vendor/flywheel-cli-dist/local/store/history-validation.js.map +1 -0
  280. package/src/runtime/vendor/flywheel-cli-dist/local/store/latest-values.js +121 -0
  281. package/src/runtime/vendor/flywheel-cli-dist/local/store/latest-values.js.map +1 -0
  282. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrate.js +69 -0
  283. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrate.js.map +1 -0
  284. package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/provenance.js +49 -0
  285. package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/provenance.js.map +1 -0
  286. package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/steps.js +424 -0
  287. package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/steps.js.map +1 -0
  288. package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/versions.js +10 -0
  289. package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/versions.js.map +1 -0
  290. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations/001_initial.sql +319 -0
  291. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations/002_staged_latest_values.sql +8 -0
  292. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations/003_remove_cli_editing_lease.sql +21 -0
  293. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations/004_hosted_association.sql +7 -0
  294. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations/005_artifact_properties.sql +68 -0
  295. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations.js +12 -0
  296. package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations.js.map +1 -0
  297. package/src/runtime/vendor/flywheel-cli-dist/local/store/objects.js +410 -0
  298. package/src/runtime/vendor/flywheel-cli-dist/local/store/objects.js.map +1 -0
  299. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/apply.js +77 -0
  300. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/apply.js.map +1 -0
  301. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/artifacts.js +240 -0
  302. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/artifacts.js.map +1 -0
  303. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/nodes.js +127 -0
  304. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/nodes.js.map +1 -0
  305. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/relations.js +107 -0
  306. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/relations.js.map +1 -0
  307. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/rules.js +80 -0
  308. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/rules.js.map +1 -0
  309. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/tags.js +219 -0
  310. package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/tags.js.map +1 -0
  311. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/hosted.js +164 -0
  312. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/hosted.js.map +1 -0
  313. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/read.js +20 -0
  314. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/read.js.map +1 -0
  315. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/replace.js +41 -0
  316. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/replace.js.map +1 -0
  317. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/schema.js +22 -0
  318. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/schema.js.map +1 -0
  319. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/validate.js +188 -0
  320. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/validate.js.map +1 -0
  321. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot.js +5 -0
  322. package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot.js.map +1 -0
  323. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/connection.js +214 -0
  324. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/connection.js.map +1 -0
  325. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/errors.js +4 -0
  326. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/errors.js.map +1 -0
  327. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/rows.js +44 -0
  328. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/rows.js.map +1 -0
  329. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/schema.js +38 -0
  330. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/schema.js.map +1 -0
  331. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/store.js +284 -0
  332. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/store.js.map +1 -0
  333. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/verify.js +133 -0
  334. package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/verify.js.map +1 -0
  335. package/src/runtime/vendor/flywheel-cli-dist/local/store/sync-commits.js +98 -0
  336. package/src/runtime/vendor/flywheel-cli-dist/local/store/sync-commits.js.map +1 -0
  337. package/src/runtime/vendor/flywheel-cli-dist/local/store/sync.js +161 -0
  338. package/src/runtime/vendor/flywheel-cli-dist/local/store/sync.js.map +1 -0
  339. package/src/runtime/vendor/flywheel-cli-dist/local/store/workspace-state.js +97 -0
  340. package/src/runtime/vendor/flywheel-cli-dist/local/store/workspace-state.js.map +1 -0
  341. package/src/runtime/vendor/flywheel-cli-dist/local/store/workspace.js +69 -0
  342. package/src/runtime/vendor/flywheel-cli-dist/local/store/workspace.js.map +1 -0
  343. package/src/runtime/vendor/flywheel-cli-dist/main.js +651 -376
  344. package/src/runtime/vendor/flywheel-cli-dist/main.js.map +1 -1
  345. package/src/runtime/vendor/flywheel-cli-dist/output/format.js +18 -11
  346. package/src/runtime/vendor/flywheel-cli-dist/output/format.js.map +1 -1
  347. package/src/runtime/vendor/flywheel-cli-dist/prebuilds/darwin-arm64/node.napi.node +0 -0
  348. package/src/runtime/vendor/flywheel-cli-dist/prebuilds/darwin-x64/node.napi.node +0 -0
  349. package/src/runtime/vendor/flywheel-cli-dist/prebuilds/linux-arm64/node.napi.glibc.node +0 -0
  350. package/src/runtime/vendor/flywheel-cli-dist/prebuilds/linux-arm64/node.napi.musl.node +0 -0
  351. package/src/runtime/vendor/flywheel-cli-dist/prebuilds/linux-x64/node.napi.glibc.node +0 -0
  352. package/src/runtime/vendor/flywheel-cli-dist/prebuilds/linux-x64/node.napi.musl.node +0 -0
  353. package/src/runtime/vendor/manifest.json +246 -257
  354. package/src/setup/command.mjs +5 -0
  355. package/src/setup/io/patchers/json.mjs +1 -1
  356. package/src/setup/io/patchers/toml.mjs +3 -1
  357. package/src/setup/io/patchers/yaml.mjs +1 -1
  358. package/src/setup/modes/cli.mjs +76 -7
  359. package/src/setup/modes/mcp-command.mjs +802 -793
  360. package/src/setup/modes/mcp.mjs +7 -3
  361. package/src/setup/shared/prior-mode-detect.mjs +18 -21
  362. package/src/setup/test-seams.mjs +25 -0
  363. package/src/setup-auth.mjs +76 -10
  364. package/src/toml-lines.mjs +52 -0
  365. package/src/unified-cli.mjs +31 -16
  366. package/skills/flywheel-llm-proof-paper/scripts/__pycache__/check_paper.cpython-312.pyc +0 -0
  367. package/src/runtime/vendor/flywheel-cli-dist/auth/active-key-id.d.ts +0 -1
  368. package/src/runtime/vendor/flywheel-cli-dist/auth/baseurl.d.ts +0 -35
  369. package/src/runtime/vendor/flywheel-cli-dist/auth/config.d.ts +0 -34
  370. package/src/runtime/vendor/flywheel-cli-dist/auth/config.js +0 -92
  371. package/src/runtime/vendor/flywheel-cli-dist/auth/config.js.map +0 -1
  372. package/src/runtime/vendor/flywheel-cli-dist/auth/fingerprint.d.ts +0 -5
  373. package/src/runtime/vendor/flywheel-cli-dist/auth/keychain.d.ts +0 -4
  374. package/src/runtime/vendor/flywheel-cli-dist/auth/keychain.js +0 -31
  375. package/src/runtime/vendor/flywheel-cli-dist/auth/keychain.js.map +0 -1
  376. package/src/runtime/vendor/flywheel-cli-dist/auth/login.d.ts +0 -24
  377. package/src/runtime/vendor/flywheel-cli-dist/auth/profile.d.ts +0 -15
  378. package/src/runtime/vendor/flywheel-cli-dist/auth/profile.js +0 -150
  379. package/src/runtime/vendor/flywheel-cli-dist/auth/profile.js.map +0 -1
  380. package/src/runtime/vendor/flywheel-cli-dist/auth/profiles.d.ts +0 -27
  381. package/src/runtime/vendor/flywheel-cli-dist/commands/_admin-auth.d.ts +0 -27
  382. package/src/runtime/vendor/flywheel-cli-dist/commands/_artifacts-upload-helpers.d.ts +0 -32
  383. package/src/runtime/vendor/flywheel-cli-dist/commands/_artifacts-upload-helpers.js +0 -213
  384. package/src/runtime/vendor/flywheel-cli-dist/commands/_artifacts-upload-helpers.js.map +0 -1
  385. package/src/runtime/vendor/flywheel-cli-dist/commands/_browser-handoff.d.ts +0 -35
  386. package/src/runtime/vendor/flywheel-cli-dist/commands/_open-url.d.ts +0 -2
  387. package/src/runtime/vendor/flywheel-cli-dist/commands/_secret-param.d.ts +0 -7
  388. package/src/runtime/vendor/flywheel-cli-dist/commands/_stream-file-out.d.ts +0 -39
  389. package/src/runtime/vendor/flywheel-cli-dist/commands/_stream-writer.d.ts +0 -34
  390. package/src/runtime/vendor/flywheel-cli-dist/commands/_wait-polling.d.ts +0 -50
  391. package/src/runtime/vendor/flywheel-cli-dist/commands/account-detach.d.ts +0 -2
  392. package/src/runtime/vendor/flywheel-cli-dist/commands/account-emails-add.d.ts +0 -2
  393. package/src/runtime/vendor/flywheel-cli-dist/commands/account-emails-remove.d.ts +0 -2
  394. package/src/runtime/vendor/flywheel-cli-dist/commands/account-emails-set-primary.d.ts +0 -2
  395. package/src/runtime/vendor/flywheel-cli-dist/commands/account-get.d.ts +0 -2
  396. package/src/runtime/vendor/flywheel-cli-dist/commands/account-merge-preview.d.ts +0 -2
  397. package/src/runtime/vendor/flywheel-cli-dist/commands/account-merge-proof.d.ts +0 -2
  398. package/src/runtime/vendor/flywheel-cli-dist/commands/account-merge.d.ts +0 -2
  399. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-compute-policy-get.d.ts +0 -2
  400. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-compute-policy-set.d.ts +0 -2
  401. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-graphs-export-stream.d.ts +0 -2
  402. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-graphs-export.d.ts +0 -2
  403. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-graphs-list.d.ts +0 -4
  404. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-nodes-audit-list.d.ts +0 -2
  405. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-create.d.ts +0 -2
  406. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-delete.d.ts +0 -2
  407. package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-login.d.ts +0 -2
  408. package/src/runtime/vendor/flywheel-cli-dist/commands/aliases.d.ts +0 -13
  409. package/src/runtime/vendor/flywheel-cli-dist/commands/api-keys-create.d.ts +0 -2
  410. package/src/runtime/vendor/flywheel-cli-dist/commands/api-keys-delete.d.ts +0 -2
  411. package/src/runtime/vendor/flywheel-cli-dist/commands/api-keys-list.d.ts +0 -18
  412. package/src/runtime/vendor/flywheel-cli-dist/commands/api-keys-rotate.d.ts +0 -2
  413. package/src/runtime/vendor/flywheel-cli-dist/commands/approval-sessions-expire.d.ts +0 -2
  414. package/src/runtime/vendor/flywheel-cli-dist/commands/approval-sessions-heartbeat.d.ts +0 -2
  415. package/src/runtime/vendor/flywheel-cli-dist/commands/approval-sessions-list.d.ts +0 -2
  416. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete-bulk.d.ts +0 -2
  417. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete-bulk.js +0 -22
  418. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete-bulk.js.map +0 -1
  419. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete.d.ts +0 -2
  420. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete.js +0 -8
  421. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete.js.map +0 -1
  422. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-get.d.ts +0 -2
  423. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-list.d.ts +0 -2
  424. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-note-set.d.ts +0 -2
  425. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-note-set.js +0 -9
  426. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-note-set.js.map +0 -1
  427. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-finalize.d.ts +0 -2
  428. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-finalize.js +0 -7
  429. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-finalize.js.map +0 -1
  430. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-prepare.d.ts +0 -2
  431. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-prepare.js +0 -15
  432. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-prepare.js.map +0 -1
  433. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload.d.ts +0 -2
  434. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload.js +0 -5
  435. package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload.js.map +0 -1
  436. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-clear.d.ts +0 -2
  437. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-clear.js +0 -8
  438. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-clear.js.map +0 -1
  439. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-set.d.ts +0 -2
  440. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-set.js +0 -30
  441. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-set.js.map +0 -1
  442. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-login.d.ts +0 -2
  443. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-mode.d.ts +0 -4
  444. package/src/runtime/vendor/flywheel-cli-dist/commands/auth-status.d.ts +0 -2
  445. package/src/runtime/vendor/flywheel-cli-dist/commands/blobs-get.d.ts +0 -2
  446. package/src/runtime/vendor/flywheel-cli-dist/commands/campaign-budgets-create.d.ts +0 -2
  447. package/src/runtime/vendor/flywheel-cli-dist/commands/campaign-budgets-list.d.ts +0 -1
  448. package/src/runtime/vendor/flywheel-cli-dist/commands/campaign-budgets-revoke.d.ts +0 -1
  449. package/src/runtime/vendor/flywheel-cli-dist/commands/campaign-budgets-update.d.ts +0 -2
  450. package/src/runtime/vendor/flywheel-cli-dist/commands/campaign-snapshot.d.ts +0 -1
  451. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-acquire.d.ts +0 -2
  452. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-budgets.d.ts +0 -2
  453. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-connection.d.ts +0 -2
  454. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-funding.d.ts +0 -2
  455. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-grants-list.d.ts +0 -2
  456. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-grants-request-approval.d.ts +0 -2
  457. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-options.d.ts +0 -2
  458. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-release-all.d.ts +0 -2
  459. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-release.d.ts +0 -2
  460. package/src/runtime/vendor/flywheel-cli-dist/commands/compute-status.d.ts +0 -2
  461. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-balance.d.ts +0 -1
  462. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-billing-portal.d.ts +0 -2
  463. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-purchase.d.ts +0 -2
  464. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-referral-claim.d.ts +0 -2
  465. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-referral.d.ts +0 -1
  466. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-subscribe.d.ts +0 -2
  467. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-subscription.d.ts +0 -1
  468. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-transactions.d.ts +0 -2
  469. package/src/runtime/vendor/flywheel-cli-dist/commands/credits-usage.d.ts +0 -2
  470. package/src/runtime/vendor/flywheel-cli-dist/commands/destructive-confirmation.d.ts +0 -2
  471. package/src/runtime/vendor/flywheel-cli-dist/commands/enums.d.ts +0 -22
  472. package/src/runtime/vendor/flywheel-cli-dist/commands/env.d.ts +0 -8
  473. package/src/runtime/vendor/flywheel-cli-dist/commands/executions-launch.d.ts +0 -2
  474. package/src/runtime/vendor/flywheel-cli-dist/commands/executions-list.d.ts +0 -1
  475. package/src/runtime/vendor/flywheel-cli-dist/commands/executions-terminate.d.ts +0 -2
  476. package/src/runtime/vendor/flywheel-cli-dist/commands/export-history.d.ts +0 -2
  477. package/src/runtime/vendor/flywheel-cli-dist/commands/export-subgraph.d.ts +0 -2
  478. package/src/runtime/vendor/flywheel-cli-dist/commands/export-summary-pdf.d.ts +0 -2
  479. package/src/runtime/vendor/flywheel-cli-dist/commands/export-summary-render-pdf.d.ts +0 -2
  480. package/src/runtime/vendor/flywheel-cli-dist/commands/export-summary-stream.d.ts +0 -2
  481. package/src/runtime/vendor/flywheel-cli-dist/commands/export-summary.d.ts +0 -2
  482. package/src/runtime/vendor/flywheel-cli-dist/commands/feedback-create.d.ts +0 -2
  483. package/src/runtime/vendor/flywheel-cli-dist/commands/files-list.d.ts +0 -2
  484. package/src/runtime/vendor/flywheel-cli-dist/commands/github-disconnect.d.ts +0 -1
  485. package/src/runtime/vendor/flywheel-cli-dist/commands/github-link.d.ts +0 -2
  486. package/src/runtime/vendor/flywheel-cli-dist/commands/github-refresh-repos.d.ts +0 -1
  487. package/src/runtime/vendor/flywheel-cli-dist/commands/github-status.d.ts +0 -1
  488. package/src/runtime/vendor/flywheel-cli-dist/commands/graph-get.d.ts +0 -2
  489. package/src/runtime/vendor/flywheel-cli-dist/commands/handler-factory.d.ts +0 -22
  490. package/src/runtime/vendor/flywheel-cli-dist/commands/help-format.d.ts +0 -31
  491. package/src/runtime/vendor/flywheel-cli-dist/commands/help-metadata.d.ts +0 -36
  492. package/src/runtime/vendor/flywheel-cli-dist/commands/help.d.ts +0 -17
  493. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-create.d.ts +0 -2
  494. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-delete.d.ts +0 -1
  495. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-list.d.ts +0 -2
  496. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-runs-list.d.ts +0 -2
  497. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-secrets-create.d.ts +0 -2
  498. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-secrets-delete.d.ts +0 -1
  499. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-secrets-list.d.ts +0 -1
  500. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-secrets-update.d.ts +0 -2
  501. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-set-enabled.d.ts +0 -2
  502. package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-update.d.ts +0 -2
  503. package/src/runtime/vendor/flywheel-cli-dist/commands/import-subgraph.d.ts +0 -2
  504. package/src/runtime/vendor/flywheel-cli-dist/commands/index.d.ts +0 -23
  505. package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-huggingface-remove.d.ts +0 -1
  506. package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-huggingface-set.d.ts +0 -2
  507. package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-status.d.ts +0 -1
  508. package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-wandb-remove.d.ts +0 -1
  509. package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-wandb-set.d.ts +0 -2
  510. package/src/runtime/vendor/flywheel-cli-dist/commands/machines-list.d.ts +0 -1
  511. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-add-parent.d.ts +0 -2
  512. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-add-parent.js +0 -15
  513. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-add-parent.js.map +0 -1
  514. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-branch.d.ts +0 -2
  515. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-branch.js +0 -10
  516. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-branch.js.map +0 -1
  517. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-children.d.ts +0 -2
  518. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-children.js +0 -8
  519. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-children.js.map +0 -1
  520. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit-new.d.ts +0 -2
  521. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit-new.js +0 -6
  522. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit-new.js.map +0 -1
  523. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit.d.ts +0 -2
  524. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit.js +0 -7
  525. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit.js.map +0 -1
  526. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-create.d.ts +0 -2
  527. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-create.js +0 -6
  528. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-create.js.map +0 -1
  529. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete-bulk.d.ts +0 -2
  530. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete-bulk.js +0 -16
  531. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete-bulk.js.map +0 -1
  532. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete.d.ts +0 -2
  533. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete.js +0 -11
  534. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete.js.map +0 -1
  535. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-files.d.ts +0 -1
  536. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-get.d.ts +0 -2
  537. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-list.d.ts +0 -2
  538. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-merge.d.ts +0 -2
  539. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-merge.js +0 -33
  540. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-merge.js.map +0 -1
  541. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-parents.d.ts +0 -2
  542. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-parents.js +0 -8
  543. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-parents.js.map +0 -1
  544. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-remove-parent.d.ts +0 -2
  545. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-remove-parent.js +0 -15
  546. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-remove-parent.js.map +0 -1
  547. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-render-ancestry.d.ts +0 -2
  548. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-render-summary.d.ts +0 -2
  549. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-render-tree.d.ts +0 -2
  550. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-resolve-slug.d.ts +0 -2
  551. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-sharing-get.d.ts +0 -1
  552. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-sharing-set-bulk.d.ts +0 -2
  553. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-sharing-set.d.ts +0 -2
  554. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-sharing-summaries.d.ts +0 -2
  555. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-stage-lease-acquire.d.ts +0 -2
  556. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-stage-lease-heartbeat.d.ts +0 -2
  557. package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-stage-lease-release.d.ts +0 -2
  558. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-list.d.ts +0 -2
  559. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-set.d.ts +0 -2
  560. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-show.d.ts +0 -2
  561. package/src/runtime/vendor/flywheel-cli-dist/commands/profile-unset.d.ts +0 -2
  562. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/account.d.ts +0 -2
  563. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/admin.d.ts +0 -8
  564. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/api-keys.d.ts +0 -2
  565. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/approval.d.ts +0 -2
  566. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/artifacts.d.ts +0 -2
  567. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/artifacts.js +0 -140
  568. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/artifacts.js.map +0 -1
  569. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/auth.d.ts +0 -2
  570. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/budgets.d.ts +0 -2
  571. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/compute.d.ts +0 -2
  572. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/credits.d.ts +0 -2
  573. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/env.d.ts +0 -2
  574. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/executions.d.ts +0 -2
  575. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/export.d.ts +0 -2
  576. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/github.d.ts +0 -2
  577. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/graph.d.ts +0 -2
  578. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/hooks.d.ts +0 -2
  579. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/integrations.d.ts +0 -2
  580. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/lifecycle.d.ts +0 -2
  581. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/profile.d.ts +0 -2
  582. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/resources.d.ts +0 -2
  583. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/sharing.d.ts +0 -2
  584. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/tagging.d.ts +0 -2
  585. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/tagging.js +0 -98
  586. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/tagging.js.map +0 -1
  587. package/src/runtime/vendor/flywheel-cli-dist/commands/registry/updates.d.ts +0 -2
  588. package/src/runtime/vendor/flywheel-cli-dist/commands/registry.d.ts +0 -27
  589. package/src/runtime/vendor/flywheel-cli-dist/commands/remote-artifacts-refresh.d.ts +0 -2
  590. package/src/runtime/vendor/flywheel-cli-dist/commands/remote-artifacts-resolve.d.ts +0 -2
  591. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-assign.d.ts +0 -2
  592. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-assign.js +0 -25
  593. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-assign.js.map +0 -1
  594. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-create.d.ts +0 -2
  595. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-create.js +0 -25
  596. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-create.js.map +0 -1
  597. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-delete.d.ts +0 -2
  598. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-delete.js +0 -11
  599. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-delete.js.map +0 -1
  600. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-update.d.ts +0 -2
  601. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-update.js +0 -28
  602. package/src/runtime/vendor/flywheel-cli-dist/commands/tags-update.js.map +0 -1
  603. package/src/runtime/vendor/flywheel-cli-dist/commands/types.d.ts +0 -30
  604. package/src/runtime/vendor/flywheel-cli-dist/commands/updates-hide-all-active.d.ts +0 -1
  605. package/src/runtime/vendor/flywheel-cli-dist/commands/updates-hide.d.ts +0 -2
  606. package/src/runtime/vendor/flywheel-cli-dist/commands/updates-list.d.ts +0 -2
  607. package/src/runtime/vendor/flywheel-cli-dist/commands/usage-spec.d.ts +0 -6
  608. package/src/runtime/vendor/flywheel-cli-dist/commands/utils.d.ts +0 -11
  609. package/src/runtime/vendor/flywheel-cli-dist/errors.d.ts +0 -86
  610. package/src/runtime/vendor/flywheel-cli-dist/exit-codes.d.ts +0 -8
  611. package/src/runtime/vendor/flywheel-cli-dist/generatedFeedbackContract.d.ts +0 -41
  612. package/src/runtime/vendor/flywheel-cli-dist/generatedProductTelemetryContract.d.ts +0 -13
  613. package/src/runtime/vendor/flywheel-cli-dist/grammar/globals.d.ts +0 -26
  614. package/src/runtime/vendor/flywheel-cli-dist/grammar/parse.d.ts +0 -17
  615. package/src/runtime/vendor/flywheel-cli-dist/http/client.d.ts +0 -91
  616. package/src/runtime/vendor/flywheel-cli-dist/http/debug.d.ts +0 -5
  617. package/src/runtime/vendor/flywheel-cli-dist/http/poll.d.ts +0 -18
  618. package/src/runtime/vendor/flywheel-cli-dist/http/retry.d.ts +0 -30
  619. package/src/runtime/vendor/flywheel-cli-dist/main.d.ts +0 -33
  620. package/src/runtime/vendor/flywheel-cli-dist/output/format.d.ts +0 -9
  621. package/src/runtime/vendor/flywheel-cli-dist/runtime-entry.d.ts +0 -1
  622. package/src/runtime/vendor/flywheel-cli-dist/version.d.ts +0 -3
  623. package/src/secure-write.mjs +0 -43
@@ -0,0 +1,219 @@
1
+ import { createHash } from "node:crypto";
2
+ import { canonicalBytes } from "../../domain/models/encoding.js";
3
+ import { RepositoryStoreError } from "../sqlite/errors.js";
4
+ import { allRows, boundedInteger, getRow, runSql } from "../sqlite/rows.js";
5
+ import { assertLiveNodes } from "./rules.js";
6
+ const DEFINITION_FIELDS = ["name", "bg_color", "text_color", "one_only", "track_history", "history_of_tag_id", "history_index", "history_next_index"];
7
+ function stringValue(value) {
8
+ return typeof value === "string" ? value : undefined;
9
+ }
10
+ function sameInteger(value, expected) {
11
+ return (typeof value === "bigint" || (typeof value === "number" && Number.isSafeInteger(value))) && BigInt(value) === expected;
12
+ }
13
+ function definition(value) {
14
+ if (!value || typeof value !== "object" || Array.isArray(value))
15
+ return undefined;
16
+ const candidate = value;
17
+ if (Object.keys(candidate).length !== DEFINITION_FIELDS.length || !DEFINITION_FIELDS.every((field) => Object.hasOwn(candidate, field)))
18
+ return undefined;
19
+ return candidate;
20
+ }
21
+ function projectionDigest(value) {
22
+ return `sha256:${createHash("sha256").update(canonicalBytes(value)).digest("hex")}`;
23
+ }
24
+ function definitionFromRow(row) {
25
+ return {
26
+ name: row.name,
27
+ bg_color: row.bg_color,
28
+ text_color: row.text_color,
29
+ one_only: row.one_only === 1,
30
+ track_history: row.track_history === 1,
31
+ history_of_tag_id: row.history_of_tag_id,
32
+ history_index: row.history_index,
33
+ history_next_index: row.history_next_index,
34
+ };
35
+ }
36
+ function sameDefinition(left, right) {
37
+ return canonicalBytes(left).equals(canonicalBytes(right));
38
+ }
39
+ function assertInitialHistory(definitionValue) {
40
+ if (definitionValue.history_of_tag_id !== null || definitionValue.history_index !== null || definitionValue.history_next_index !== 1n) {
41
+ throw new RepositoryStoreError("tag history state is service-controlled");
42
+ }
43
+ }
44
+ function assertPreservedHistory(existing, next) {
45
+ if (existing.history_of_tag_id !== null || existing.history_index !== null ||
46
+ next.history_of_tag_id !== existing.history_of_tag_id || next.history_index !== existing.history_index ||
47
+ next.history_next_index !== existing.history_next_index) {
48
+ throw new RepositoryStoreError("tag history state is service-controlled");
49
+ }
50
+ }
51
+ function insertDefinition(database, repositoryId, scopeNodeId, tagId, definitionValue, state, commitId) {
52
+ try {
53
+ runSql(database.prepare("INSERT INTO repository_tag_definitions VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"), repositoryId, scopeNodeId, tagId, definitionValue.name, definitionValue.bg_color, definitionValue.text_color, definitionValue.one_only, definitionValue.track_history, definitionValue.history_of_tag_id, definitionValue.history_index, definitionValue.history_next_index, state, commitId);
54
+ }
55
+ catch (error) {
56
+ throw new RepositoryStoreError("tag definition projection precondition failed", { cause: error });
57
+ }
58
+ }
59
+ export function applyTag(database, commit, operation) {
60
+ const scopeNodeId = stringValue(operation.payload.scope_node_id);
61
+ const tagId = stringValue(operation.payload.tag_id);
62
+ if (!scopeNodeId || !tagId)
63
+ throw new RepositoryStoreError("invalid tag projection payload");
64
+ if (operation.type !== "tag.retire.v1")
65
+ assertLiveNodes(database, commit.repositoryId, [scopeNodeId]);
66
+ const row = getRow(database.prepare(`SELECT name, bg_color, text_color, one_only, track_history, history_of_tag_id, history_index, history_next_index, state
67
+ FROM repository_tag_definitions WHERE repository_id = ? AND scope_node_id = ? AND tag_id = ?`, { readBigInts: true }), commit.repositoryId, scopeNodeId, tagId);
68
+ if (row) {
69
+ row.one_only = boundedInteger(row.one_only, 0, 1);
70
+ row.track_history = boundedInteger(row.track_history, 0, 1);
71
+ }
72
+ if (operation.type === "tag.define.v1") {
73
+ const next = definition(operation.payload.definition);
74
+ if (!next)
75
+ throw new RepositoryStoreError("tag definition projection precondition failed");
76
+ if (!row) {
77
+ assertInitialHistory(next);
78
+ insertDefinition(database, commit.repositoryId, scopeNodeId, tagId, next, "active", commit.commitId);
79
+ return;
80
+ }
81
+ if (row.state !== "retired" || !sameDefinition(next, definitionFromRow(row))) {
82
+ throw new RepositoryStoreError("tag definition projection precondition failed");
83
+ }
84
+ runSql(database.prepare(`UPDATE repository_tag_definitions SET state = 'active', updated_by_commit_id = ?
85
+ WHERE repository_id = ? AND scope_node_id = ? AND tag_id = ?`), commit.commitId, commit.repositoryId, scopeNodeId, tagId);
86
+ return;
87
+ }
88
+ if (!row || row.state !== "active")
89
+ throw new RepositoryStoreError("tag definition projection precondition failed");
90
+ const existing = definitionFromRow(row);
91
+ const expected = stringValue(operation.payload.expected_definition_digest);
92
+ const previous = definition(operation.payload.previous_definition);
93
+ if (!expected || !previous || !sameDefinition(previous, existing) || expected !== projectionDigest(existing)) {
94
+ throw new RepositoryStoreError("tag definition digest precondition failed");
95
+ }
96
+ if (operation.type === "tag.retire.v1") {
97
+ runSql(database.prepare(`UPDATE repository_tag_definitions SET state = 'retired', updated_by_commit_id = ?
98
+ WHERE repository_id = ? AND scope_node_id = ? AND tag_id = ?`), commit.commitId, commit.repositoryId, scopeNodeId, tagId);
99
+ return;
100
+ }
101
+ const next = definition(operation.payload.definition);
102
+ if (!next)
103
+ throw new RepositoryStoreError("invalid tag definition");
104
+ assertPreservedHistory(existing, next);
105
+ if (runSql(database.prepare(`UPDATE repository_tag_definitions
106
+ SET name = ?, bg_color = ?, text_color = ?, one_only = ?, track_history = ?,
107
+ history_of_tag_id = ?, history_index = ?, history_next_index = ?, updated_by_commit_id = ?
108
+ WHERE repository_id = ? AND scope_node_id = ? AND tag_id = ? AND state = 'active'`), next.name, next.bg_color, next.text_color, next.one_only, next.track_history, next.history_of_tag_id, next.history_index, next.history_next_index, commit.commitId, commit.repositoryId, scopeNodeId, tagId).changes !== 1)
109
+ throw new RepositoryStoreError("tag definition projection precondition failed");
110
+ }
111
+ function insertAssignment(database, commit, scopeNodeId, tagId, nodeId) {
112
+ runSql(database.prepare("INSERT INTO repository_tag_assignments VALUES (?, ?, ?, ?, ?)"), commit.repositoryId, scopeNodeId, tagId, nodeId, commit.commitId);
113
+ }
114
+ function historyTagId(scopeNodeId, tagId, index) {
115
+ return `history:sha256:${createHash("sha256").update("flywheel.tag-history.v1\0").update(canonicalBytes([scopeNodeId, tagId, index])).digest("hex")}`;
116
+ }
117
+ function replaceTrackedAssignment(database, commit, operation, scopeNodeId, tagId, nodeId, holder, nextIndex, base) {
118
+ if (!holder || holder === nodeId)
119
+ throw new RepositoryStoreError("tracked tag has no holder");
120
+ if (operation.payload.prior_holder !== holder || !sameInteger(operation.payload.expected_history_next_index, nextIndex) || !sameInteger(operation.payload.history_index, nextIndex)) {
121
+ throw new RepositoryStoreError("tag history projection precondition failed");
122
+ }
123
+ const historyId = stringValue(operation.payload.history_entry_id);
124
+ const history = operation.payload.history_tag;
125
+ if (!historyId || !history || typeof history !== "object" || Array.isArray(history))
126
+ throw new RepositoryStoreError("invalid tag history projection");
127
+ const tag = history;
128
+ if (historyId !== historyTagId(scopeNodeId, tagId, nextIndex) ||
129
+ tag.name !== `${base.name} (history ${nextIndex})` || tag.bg_color !== base.bg_color || tag.text_color !== base.text_color ||
130
+ tag.one_only !== false || tag.track_history !== false || tag.history_of_tag_id !== tagId || !sameInteger(tag.history_index, nextIndex) ||
131
+ !sameInteger(tag.history_next_index, 1n) || tag.created_at !== tag.updated_at) {
132
+ throw new RepositoryStoreError("tag history projection precondition failed");
133
+ }
134
+ const metadata = operation.payload.relation_metadata;
135
+ const intent = metadata && typeof metadata === "object" && !Array.isArray(metadata) ? metadata.intent : undefined;
136
+ if (typeof intent === "string" && intent.startsWith("revert:")) {
137
+ const reverted = intent.slice("revert:".length);
138
+ if (!/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(reverted)) {
139
+ throw new RepositoryStoreError("tag revert audit reference is invalid");
140
+ }
141
+ if (runSql(database.prepare(`UPDATE repository_tag_history SET reverted_by_operation_id = ?
142
+ WHERE repository_id = ? AND scope_node_id = ? AND base_tag_id = ? AND history_index = ?
143
+ AND previous_node_id = ? AND superseded_by_node_id = ? AND reverted_by_operation_id IS NULL`), operation.operationId, commit.repositoryId, scopeNodeId, tagId, nextIndex - 1n, nodeId, holder).changes !== 1)
144
+ throw new RepositoryStoreError("tag revert audit projection precondition failed");
145
+ }
146
+ const definitionValue = {
147
+ name: tag.name, bg_color: tag.bg_color, text_color: tag.text_color, one_only: tag.one_only, track_history: tag.track_history,
148
+ history_of_tag_id: tag.history_of_tag_id, history_index: tag.history_index, history_next_index: tag.history_next_index,
149
+ };
150
+ insertDefinition(database, commit.repositoryId, scopeNodeId, historyId, definitionValue, "active", commit.commitId);
151
+ runSql(database.prepare("INSERT INTO repository_tag_history VALUES (?, ?, ?, ?, ?, ?, ?, ?, NULL)"), commit.repositoryId, scopeNodeId, tagId, nextIndex, historyId, holder, nodeId, tag.updated_at);
152
+ runSql(database.prepare("DELETE FROM repository_tag_assignments WHERE repository_id = ? AND scope_node_id = ? AND tag_id = ? AND node_id = ?"), commit.repositoryId, scopeNodeId, tagId, holder);
153
+ insertAssignment(database, commit, scopeNodeId, tagId, nodeId);
154
+ runSql(database.prepare(`UPDATE repository_tag_definitions SET history_next_index = ?, updated_by_commit_id = ?
155
+ WHERE repository_id = ? AND scope_node_id = ? AND tag_id = ?`), nextIndex + 1n, commit.commitId, commit.repositoryId, scopeNodeId, tagId);
156
+ }
157
+ export function applyTagAssignment(database, commit, operation) {
158
+ const scopeNodeId = stringValue(operation.payload.scope_node_id);
159
+ const nodeId = stringValue(operation.payload.node_id);
160
+ const tagId = stringValue(operation.payload.tag_id);
161
+ if (!scopeNodeId || !nodeId || !tagId)
162
+ throw new RepositoryStoreError("invalid tag assignment projection payload");
163
+ const tag = getRow(database.prepare(`SELECT name, bg_color, text_color, one_only, track_history, history_next_index, state
164
+ FROM repository_tag_definitions WHERE repository_id = ? AND scope_node_id = ? AND tag_id = ?`, { readBigInts: true }), commit.repositoryId, scopeNodeId, tagId);
165
+ if (!tag)
166
+ throw new RepositoryStoreError("tag assignment requires an active tag");
167
+ tag.one_only = boundedInteger(tag.one_only, 0, 1);
168
+ tag.track_history = boundedInteger(tag.track_history, 0, 1);
169
+ if (operation.type === "node.tag.remove.v1") {
170
+ if (operation.payload.expected_holder !== nodeId)
171
+ throw new RepositoryStoreError("tag holder projection precondition failed");
172
+ if (runSql(database.prepare("DELETE FROM repository_tag_assignments WHERE repository_id = ? AND scope_node_id = ? AND tag_id = ? AND node_id = ?"), commit.repositoryId, scopeNodeId, tagId, nodeId).changes !== 1)
173
+ throw new RepositoryStoreError("tag assignment projection precondition failed");
174
+ return;
175
+ }
176
+ if (tag.state !== "active")
177
+ throw new RepositoryStoreError("tag assignment requires an active tag");
178
+ assertLiveNodes(database, commit.repositoryId, [scopeNodeId, nodeId]);
179
+ const expectedHolder = operation.payload.expected_holder;
180
+ const mode = operation.payload.assignment_mode;
181
+ if (operation.payload.new_holder !== nodeId || (mode !== "initial" && mode !== "same_holder" && mode !== "tracked_replacement")) {
182
+ throw new RepositoryStoreError("invalid tag assignment");
183
+ }
184
+ const holders = allRows(database.prepare("SELECT node_id FROM repository_tag_assignments WHERE repository_id = ? AND scope_node_id = ? AND tag_id = ? ORDER BY node_id"), commit.repositoryId, scopeNodeId, tagId).map((row) => row.node_id).filter((value) => typeof value === "string");
185
+ const oneOnly = tag.one_only === 1;
186
+ if (oneOnly) {
187
+ if (holders.length > 1)
188
+ throw new RepositoryStoreError("one-only tag has multiple holders");
189
+ const holder = holders.length === 0 ? null : holders[0];
190
+ if (holder !== expectedHolder)
191
+ throw new RepositoryStoreError("tag holder projection precondition failed");
192
+ if (mode === "initial") {
193
+ if (holder)
194
+ throw new RepositoryStoreError("tag initial holder already exists");
195
+ insertAssignment(database, commit, scopeNodeId, tagId, nodeId);
196
+ return;
197
+ }
198
+ if (mode === "same_holder") {
199
+ if (holder !== nodeId)
200
+ throw new RepositoryStoreError("tag same-holder projection precondition failed");
201
+ return;
202
+ }
203
+ if (tag.track_history !== 1 || typeof tag.history_next_index !== "bigint")
204
+ throw new RepositoryStoreError("tag replacement requires tracked history");
205
+ replaceTrackedAssignment(database, commit, operation, scopeNodeId, tagId, nodeId, holder, tag.history_next_index, tag);
206
+ return;
207
+ }
208
+ if (mode === "tracked_replacement")
209
+ throw new RepositoryStoreError("untracked tag cannot replace a holder");
210
+ if (mode === "same_holder") {
211
+ if (expectedHolder !== nodeId || !holders.includes(nodeId))
212
+ throw new RepositoryStoreError("tag same-holder projection precondition failed");
213
+ return;
214
+ }
215
+ if (expectedHolder !== null || holders.includes(nodeId))
216
+ throw new RepositoryStoreError("tag assignment projection precondition failed");
217
+ insertAssignment(database, commit, scopeNodeId, tagId, nodeId);
218
+ }
219
+ //# sourceMappingURL=tags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tags.js","sourceRoot":"","sources":["../../../../src/local/store/projection/tags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAG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AAC;QAAE,MAAM,IAAI,oBAAoB,CAAC,+CAA+C,CAAC,CAAC;IACzI,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAChE,CAAC"}
@@ -0,0 +1,164 @@
1
+ import { createHash } from "node:crypto";
2
+ import { legacyArtifactProperties, parseArtifactProperties } from "../../domain/models/artifact-properties.js";
3
+ import { isDigest, isRecord } from "../../domain/models/constants.js";
4
+ import { canonicalBytes, parseRepositoryJson, valueDigest } from "../../domain/models/encoding.js";
5
+ import { RepositoryStoreError } from "../sqlite/errors.js";
6
+ import { validateSnapshotTables } from "./validate.js";
7
+ const HOSTED_SNAPSHOT_FIELDS = {
8
+ artifact_references: true,
9
+ artifacts: true,
10
+ containments: true,
11
+ format: true,
12
+ lineage: true,
13
+ nodes: true,
14
+ object_availability: true,
15
+ repository_id: true,
16
+ semantic_edges: true,
17
+ tag_assignments: true,
18
+ tag_definitions: true,
19
+ tag_history: true,
20
+ };
21
+ const LEGACY_ARTIFACT_COLUMNS = [
22
+ "artifact_id", "object_digest", "name", "media_type", "notes", "tags", "metadata_digest",
23
+ "name_digest", "media_type_digest", "notes_digest", "tags_digest", "created_by_commit_id",
24
+ ];
25
+ const CURRENT_ARTIFACT_COLUMNS = ["artifact_id", "object_digest", "properties", "properties_digest", "created_by_commit_id"];
26
+ function invalid(message) {
27
+ throw new RepositoryStoreError(message);
28
+ }
29
+ function sqliteScalar(value) {
30
+ if (typeof value === "boolean")
31
+ return value ? 1 : 0;
32
+ if (isRecord(value) || Array.isArray(value))
33
+ return canonicalBytes(value).toString("utf8");
34
+ if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "bigint")
35
+ return value;
36
+ invalid("repository transfer snapshot row is incomplete");
37
+ }
38
+ function rows(payload, name) {
39
+ const value = payload[name];
40
+ if (!Array.isArray(value) || !value.every(isRecord))
41
+ invalid("repository transfer snapshot rows are invalid");
42
+ return value;
43
+ }
44
+ function required(row, columns) {
45
+ if (columns.some((column) => !(column in row)))
46
+ invalid("repository transfer snapshot row is incomplete");
47
+ }
48
+ function localRows(source, repositoryId, columns, include = () => true) {
49
+ return source.flatMap((row) => {
50
+ if (!include(row))
51
+ return [];
52
+ required(row, columns);
53
+ return [[repositoryId, ...columns.map((column) => sqliteScalar(row[column]))]];
54
+ });
55
+ }
56
+ function legacyMetadataDigest(row) {
57
+ const metadata = Object.fromEntries(["name", "media_type", "notes", "tags"].map(field => [field, row[field]]));
58
+ return `sha256:${createHash("sha256").update(canonicalBytes(metadata)).digest("hex")}`;
59
+ }
60
+ function convertV1Artifacts(source) {
61
+ return source.map(row => {
62
+ required(row, LEGACY_ARTIFACT_COLUMNS);
63
+ if (!isDigest(row.object_digest) || !isDigest(row.metadata_digest) ||
64
+ ["name", "media_type", "notes", "tags"].some(field => (row[field] !== null && typeof row[field] !== "string") || row[`${field}_digest`] !== valueDigest(row[field])) ||
65
+ row.metadata_digest !== legacyMetadataDigest(row)) {
66
+ invalid("repository transfer snapshot row is incomplete");
67
+ }
68
+ const properties = legacyArtifactProperties({
69
+ name: row.name,
70
+ media_type: row.media_type,
71
+ notes: row.notes,
72
+ tags: row.tags,
73
+ });
74
+ return {
75
+ artifact_id: row.artifact_id,
76
+ object_digest: row.object_digest,
77
+ properties,
78
+ properties_digest: valueDigest(properties),
79
+ created_by_commit_id: row.created_by_commit_id,
80
+ };
81
+ });
82
+ }
83
+ function currentArtifacts(source) {
84
+ return source.map(row => {
85
+ required(row, CURRENT_ARTIFACT_COLUMNS);
86
+ if (!isDigest(row.object_digest) || typeof row.properties !== "string" || !isDigest(row.properties_digest)) {
87
+ invalid("repository transfer snapshot row is incomplete");
88
+ }
89
+ try {
90
+ parseArtifactProperties(row.properties);
91
+ }
92
+ catch {
93
+ invalid("repository transfer snapshot row is incomplete");
94
+ }
95
+ if (row.properties_digest !== valueDigest(row.properties))
96
+ invalid("repository transfer snapshot row is incomplete");
97
+ return row;
98
+ });
99
+ }
100
+ function parse(raw, repositoryId) {
101
+ let payload;
102
+ try {
103
+ payload = parseRepositoryJson(new TextDecoder("utf-8", { fatal: true }).decode(raw));
104
+ }
105
+ catch (error) {
106
+ if (!(error instanceof TypeError || error instanceof SyntaxError))
107
+ throw error;
108
+ invalid("repository transfer snapshot is malformed");
109
+ }
110
+ if (!isRecord(payload) || Object.keys(payload).length !== Object.keys(HOSTED_SNAPSHOT_FIELDS).length ||
111
+ Object.keys(payload).some((field) => !(field in HOSTED_SNAPSHOT_FIELDS)) ||
112
+ (payload.format !== "flywheel.repository.projection.v1" && payload.format !== "flywheel.repository.projection.v2") ||
113
+ payload.repository_id !== repositoryId || !canonicalBytes(payload).equals(raw)) {
114
+ invalid("repository transfer snapshot is invalid");
115
+ }
116
+ for (const name of Object.keys(HOSTED_SNAPSHOT_FIELDS)) {
117
+ if (name !== "format" && name !== "repository_id")
118
+ rows(payload, name);
119
+ }
120
+ return payload;
121
+ }
122
+ /** Converts an exact hosted v1/v2 projection into validated local schema-5 rows. */
123
+ export function hostedSnapshotToLocalTables(raw, repositoryId) {
124
+ const payload = parse(raw, repositoryId);
125
+ const nodes = rows(payload, "nodes");
126
+ const artifacts = payload.format === "flywheel.repository.projection.v1"
127
+ ? convertV1Artifacts(rows(payload, "artifacts"))
128
+ : currentArtifacts(rows(payload, "artifacts"));
129
+ const tables = {
130
+ repository_nodes: localRows(nodes, repositoryId, ["node_id", "lifecycle_state", "created_by_commit_id", "lifecycle_commit_id"]),
131
+ repository_node_latest_values: localRows(nodes, repositoryId, [
132
+ "node_id", "title", "slug_name", "summary", "content", "origin_host", "external_transcript_ref",
133
+ "title_digest", "slug_name_digest", "summary_digest", "content_digest", "origin_host_digest",
134
+ "external_transcript_ref_digest", "updated_by_commit_id",
135
+ ], (row) => row.updated_by_commit_id !== null && row.updated_by_commit_id !== undefined),
136
+ repository_tag_definitions: localRows(rows(payload, "tag_definitions"), repositoryId, [
137
+ "scope_node_id", "tag_id", "name", "bg_color", "text_color", "one_only", "track_history",
138
+ "history_of_tag_id", "history_index", "history_next_index", "state", "updated_by_commit_id",
139
+ ]),
140
+ repository_tag_assignments: localRows(rows(payload, "tag_assignments"), repositoryId, ["scope_node_id", "tag_id", "node_id", "assigned_by_commit_id"]),
141
+ repository_tag_history: localRows(rows(payload, "tag_history"), repositoryId, [
142
+ "scope_node_id", "base_tag_id", "history_index", "history_tag_id", "previous_node_id", "superseded_by_node_id",
143
+ "superseded_at", "reverted_by_operation_id",
144
+ ]),
145
+ repository_artifacts: localRows(artifacts, repositoryId, CURRENT_ARTIFACT_COLUMNS),
146
+ repository_lineage: localRows(rows(payload, "lineage"), repositoryId, ["parent_node_id", "child_node_id", "at_commit_id"]),
147
+ repository_containments: localRows(rows(payload, "containments"), repositoryId, [
148
+ "containment_id", "container_node_id", "child_node_id", "relation_digest", "ordinal", "source_artifact_id", "at_commit_id",
149
+ ]),
150
+ repository_semantic_edges: localRows(rows(payload, "semantic_edges"), repositoryId, [
151
+ "edge_id", "graph_node_id", "source_node_id", "target_node_id", "relation_digest", "content", "content_digest",
152
+ "created_by_commit_id", "updated_by_commit_id",
153
+ ]),
154
+ repository_artifact_references: localRows(rows(payload, "artifact_references"), repositoryId, [
155
+ "artifact_id", "owner_kind", "owner_id", "node_owner_id", "edge_owner_id", "reference_order", "attached_by_commit_id",
156
+ ]),
157
+ repository_object_availability: rows(payload, "object_availability").map((row) => {
158
+ required(row, ["digest", "availability"]);
159
+ return [repositoryId, sqliteScalar(row.digest), "remote_only"];
160
+ }),
161
+ };
162
+ return validateSnapshotTables(repositoryId, tables);
163
+ }
164
+ //# sourceMappingURL=hosted.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hosted.js","sourceRoot":"","sources":["../../../../src/local/store/snapshot/hosted.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,4CAA4C,CAAC;AAC/G,OAAO,EA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UNBOUNDED_INTEGER_COLUMNS, } from "./schema.js";
4
+ import { canonicalSnapshotBytes } from "./validate.js";
5
+ export function snapshotTablesFromConnection(database, repositoryId) {
6
+ const tables = {};
7
+ for (const [name, columns, primaryKeyColumns] of SNAPSHOT_TABLES) {
8
+ const rows = allRows(database.prepare(`SELECT ${columns.join(", ")} FROM ${name} WHERE repository_id = ? ORDER BY ${primaryKeyColumns.join(", ")}`, { readBigInts: columns.some((column) => column in SNAPSHOT_UNBOUNDED_INTEGER_COLUMNS) }), repositoryId);
9
+ tables[name] = rows.map((row) => columns.map((column) => column in SNAPSHOT_BOOLEAN_COLUMNS ? boundedInteger(row[column], 0, 1) : row[column]));
10
+ }
11
+ return tables;
12
+ }
13
+ export function snapshotBytesFromConnection(database, repositoryId) {
14
+ const head = getRow(database.prepare("SELECT workspace_head_commit_id FROM repository_heads WHERE repository_id = ?"), repositoryId);
15
+ if (!head || (head.workspace_head_commit_id !== null && typeof head.workspace_head_commit_id !== "string")) {
16
+ throw new RepositoryStoreError("repository head is missing");
17
+ }
18
+ return canonicalSnapshotBytes(repositoryId, head.workspace_head_commit_id, snapshotTablesFromConnection(database, repositoryId));
19
+ }
20
+ //# sourceMappingURL=read.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read.js","sourceRoot":"","sources":["../../../../src/local/store/snapshot/read.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EACL,wBAAwB,EACxB,eAAe,EACf,kCAAkC,GAEnC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEvD,MAAM,UAAU,4BAA4B,CAAC,QAAsB,EAAE,YAAoB;IACvF,MAAM,MAAM,GAAG,EAAoB,CAAC;IACpC,KAAK,MAAM,CAAC,IAAI,EAAE,OAA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ertAllSemanticEdgesValid, } from "../projection/rules.js";
2
+ import { RepositoryStoreError } from "../sqlite/errors.js";
3
+ import { allRows, runSql } from "../sqlite/rows.js";
4
+ import { SNAPSHOT_DELETE_ORDER, SNAPSHOT_TABLES } from "./schema.js";
5
+ import { validateSnapshotTables } from "./validate.js";
6
+ export function assertProjectionInvariants(database, repositoryId) {
7
+ for (const row of allRows(database.prepare("SELECT parent_node_id, child_node_id FROM repository_lineage WHERE repository_id = ?"), repositoryId)) {
8
+ assertAcyclicRelation(database, repositoryId, row.parent_node_id, row.child_node_id, "repository_lineage");
9
+ }
10
+ for (const row of allRows(database.prepare("SELECT container_node_id, child_node_id FROM repository_containments WHERE repository_id = ?"), repositoryId)) {
11
+ assertAcyclicRelation(database, repositoryId, row.container_node_id, row.child_node_id, "repository_containments");
12
+ }
13
+ assertAllSemanticEdgesValid(database, repositoryId);
14
+ }
15
+ /** The caller owns the enclosing transaction and must roll it back on failure. */
16
+ export function replaceSnapshotTables(database, repositoryId, rawTables) {
17
+ const tables = validateSnapshotTables(repositoryId, rawTables);
18
+ try {
19
+ for (const name of SNAPSHOT_DELETE_ORDER) {
20
+ runSql(database.prepare(`DELETE FROM ${name} WHERE repository_id = ?`), repositoryId);
21
+ }
22
+ for (const [name, columns] of SNAPSHOT_TABLES) {
23
+ const rows = tables[name];
24
+ if (rows.length === 0)
25
+ continue;
26
+ const statement = `INSERT INTO ${name} (${columns.join(", ")}) VALUES (${columns.map(() => "?").join(", ")})`;
27
+ for (const row of rows)
28
+ runSql(database.prepare(statement), ...row);
29
+ }
30
+ assertProjectionInvariants(database, repositoryId);
31
+ if (allRows(database.prepare("PRAGMA foreign_key_check")).length > 0) {
32
+ throw new RepositoryStoreError("snapshot foreign-key validation failed");
33
+ }
34
+ }
35
+ catch (error) {
36
+ if (error instanceof RepositoryStoreError)
37
+ throw error;
38
+ throw new RepositoryStoreError("snapshot projection replacement failed");
39
+ }
40
+ }
41
+ //# sourceMappingURL=replace.js.map
@@ -0,0 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AAC,OAAO,CAAC,eAAe,IAAI,0BAA0B,CAAC,EAAE,YAAY,CAAC,CAAC;QACxF,CAAC;QACD,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,eAAe,EAAE,CAAC;YAC9C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;YAC1B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;gBAAE,SAAS;YAChC,MAAM,SAAS,GAAG,eAAe,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;YAC9G,KAAK,MAAM,GAAG,IAAI,IAAI;gBAAE,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC;QACtE,CAAC;QACD,0BAA0B,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QACnD,IAAI,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrE,MAAM,IAAI,oBAAoB,CAAC,wCAAwC,CAAC,CAAC;QAC3E,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,oBAAoB;YAAE,MAAM,KAAK,CAAC;QACvD,MAAM,IAAI,oBAAoB,CAAC,wCAAwC,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC"}
@@ -0,0 +1,22 @@
1
+ export const SNAPSHOT_TABLES = [
2
+ ["repository_nodes", ["repository_id", "node_id", "lifecycle_state", "created_by_commit_id", "lifecycle_commit_id"], ["repository_id", "node_id"]],
3
+ ["repository_node_latest_values", ["repository_id", "node_id", "title", "slug_name", "summary", "content", "origin_host", "external_transcript_ref", "title_digest", "slug_name_digest", "summary_digest", "content_digest", "origin_host_digest", "external_transcript_ref_digest", "updated_by_commit_id"], ["repository_id", "node_id"]],
4
+ ["repository_tag_definitions", ["repository_id", "scope_node_id", "tag_id", "name", "bg_color", "text_color", "one_only", "track_history", "history_of_tag_id", "history_index", "history_next_index", "state", "updated_by_commit_id"], ["repository_id", "scope_node_id", "tag_id"]],
5
+ ["repository_tag_assignments", ["repository_id", "scope_node_id", "tag_id", "node_id", "assigned_by_commit_id"], ["repository_id", "scope_node_id", "tag_id", "node_id"]],
6
+ ["repository_tag_history", ["repository_id", "scope_node_id", "base_tag_id", "history_index", "history_tag_id", "previous_node_id", "superseded_by_node_id", "superseded_at", "reverted_by_operation_id"], ["repository_id", "scope_node_id", "base_tag_id", "history_index"]],
7
+ ["repository_artifacts", ["repository_id", "artifact_id", "object_digest", "properties", "properties_digest", "created_by_commit_id"], ["repository_id", "artifact_id"]],
8
+ ["repository_lineage", ["repository_id", "parent_node_id", "child_node_id", "created_by_commit_id"], ["repository_id", "parent_node_id", "child_node_id"]],
9
+ ["repository_containments", ["repository_id", "containment_id", "container_node_id", "child_node_id", "relation_digest", "ordinal", "source_artifact_id", "created_by_commit_id"], ["repository_id", "containment_id"]],
10
+ ["repository_semantic_edges", ["repository_id", "edge_id", "graph_node_id", "source_node_id", "target_node_id", "relation_digest", "content", "content_digest", "created_by_commit_id", "updated_by_commit_id"], ["repository_id", "edge_id"]],
11
+ ["repository_artifact_references", ["repository_id", "artifact_id", "owner_kind", "owner_id", "node_owner_id", "edge_owner_id", "reference_order", "attached_by_commit_id"], ["repository_id", "artifact_id", "owner_kind", "owner_id"]],
12
+ ["repository_object_availability", ["repository_id", "digest", "availability"], ["repository_id", "digest"]],
13
+ ];
14
+ export const SNAPSHOT_BOOLEAN_COLUMNS = { one_only: true, track_history: true };
15
+ export const SNAPSHOT_UNBOUNDED_INTEGER_COLUMNS = {
16
+ history_index: true,
17
+ history_next_index: true,
18
+ reference_order: true,
19
+ ordinal: true,
20
+ };
21
+ export const SNAPSHOT_DELETE_ORDER = SNAPSHOT_TABLES.map(([name]) => name).reverse();
22
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/local/store/snapshot/schema.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,CAAC,kBAAkB,EAAE,CAAC,eAAe,EAAE,SAAS,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,qBAAqB,CAAC,EAAE,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;IAClJ,CAAC,+BAA+B,EAAE,CAAC,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,yBAAyB,EAAE,cAAc,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,gCAAgC,EAAE,sBAAsB,CAAC,EAAE,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;IAC3U,CAAC,4BAA4B,EAAE,CAAC,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,mBAAmB,EAAE,eAAe,EAAE,oBAAoB,EAAE,OAAO,EAAE,sBAAsB,CAAC,EAAE,CAAC,eAAe,EAAE,eAAe,EAAE,QAAQ,CAAC,CAAC;IACtR,CAAC,4BAA4B,EAAE,CAAC,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,SAAS,EAAE,uBAAuB,CAAC,EAAE,CAAC,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IACzK,CAAC,wBAAwB,EAAE,CAAC,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,eAAe,EAAE,0BAA0B,CAAC,EAAE,CAAC,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,CAAC,CAA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