@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,345 @@
1
+ import { RepositoryContractError } from "../errors.js";
2
+ import { integerValue, isDigest, isRecord, isUuid, MAX_REPOSITORY_VALUE_BYTES, NODE_FIELDS, OPERATION_FIELDS, validateDigestList, exceedsCharacters, } from "./constants.js";
3
+ import { canonicalBytes, valueDigest } from "./encoding.js";
4
+ import { validateHistoryTag, validateTagDefinition } from "./tags.js";
5
+ const HISTORY_FIELDS = ["prior_holder", "expected_history_next_index", "history_entry_id", "history_index", "history_tag"];
6
+ const NODE_FIELD_NAMES = NODE_FIELDS;
7
+ const BASELINE_COUNT_FIELDS = ["chunk_count", "structural_row_count", "latest_value_digest_count", "lineage_relation_count", "artifact_reference_count", "object_availability_record_count"];
8
+ function requireUuid(value, name, nullable = false) {
9
+ if (!(nullable && value[name] === null) && !isUuid(value[name])) {
10
+ throw new RepositoryContractError(`${name} must be a UUIDv4`);
11
+ }
12
+ }
13
+ function requireDigest(value, name) {
14
+ if (!isDigest(value[name]))
15
+ throw new RepositoryContractError(`${name} must be a canonical digest`);
16
+ }
17
+ function requireNonempty(value, name) {
18
+ if (typeof value[name] !== "string" || !value[name]) {
19
+ throw new RepositoryContractError(`${name} must be a nonempty string`);
20
+ }
21
+ }
22
+ function metadataError(value, name) {
23
+ if (!isRecord(value) || Object.keys(value).some((key) => key !== "source" && key !== "intent")) {
24
+ return `${name} has invalid fields`;
25
+ }
26
+ if (value.source !== undefined && value.source !== null &&
27
+ (typeof value.source !== "string" || !["cli", "browser", "migration", "mcp"].includes(value.source))) {
28
+ return `${name} has an invalid source`;
29
+ }
30
+ if (value.intent !== undefined && value.intent !== null &&
31
+ (typeof value.intent !== "string" || exceedsCharacters(value.intent, 4096))) {
32
+ return `${name} has an invalid intent`;
33
+ }
34
+ return undefined;
35
+ }
36
+ function requireMetadata(value, name) {
37
+ const error = metadataError(value[name], name);
38
+ if (error)
39
+ throw new RepositoryContractError(error);
40
+ }
41
+ function validateNodeCreate(value) {
42
+ if (!isUuid(value.node_id))
43
+ throw new RepositoryContractError("node_id must be a UUIDv4");
44
+ const initial = value.initial_values;
45
+ const digests = value.initial_field_digests;
46
+ if (!isRecord(initial) || Object.keys(initial).length !== NODE_FIELDS.length ||
47
+ !NODE_FIELDS.every((field) => Object.hasOwn(initial, field)) ||
48
+ Object.values(initial).some((item) => item !== null &&
49
+ (typeof item !== "string" || exceedsCharacters(item, MAX_REPOSITORY_VALUE_BYTES)))) {
50
+ throw new RepositoryContractError("node.create.v1 requires all initial values");
51
+ }
52
+ if (!isRecord(digests) || Object.keys(digests).length !== NODE_FIELDS.length ||
53
+ !NODE_FIELDS.every((field) => Object.hasOwn(digests, field))) {
54
+ throw new RepositoryContractError("node.create.v1 requires all initial field digests");
55
+ }
56
+ if (!Object.values(digests).every(isDigest)) {
57
+ throw new RepositoryContractError("node.create.v1 field digests must be canonical");
58
+ }
59
+ // The preceding closed-field and value checks establish this scalar record.
60
+ const values = initial;
61
+ if (Object.values(values).some((item) => item !== null && Buffer.byteLength(item, "utf8") > MAX_REPOSITORY_VALUE_BYTES)) {
62
+ throw new RepositoryContractError("node.create.v1 initial value exceeds the byte limit");
63
+ }
64
+ if (Object.entries(values).some(([field, item]) => digests[field] !== valueDigest(item))) {
65
+ throw new RepositoryContractError("node.create.v1 requires matching value digests");
66
+ }
67
+ const references = value.initial_reference_digests;
68
+ if (!Array.isArray(references) || !references.every(isDigest) || new Set(references).size !== references.length) {
69
+ throw new RepositoryContractError("node.create.v1 reference digests must be canonical");
70
+ }
71
+ }
72
+ function validateNode(type, value) {
73
+ switch (type) {
74
+ case "node.create.v1":
75
+ validateNodeCreate(value);
76
+ return;
77
+ case "node.field.set.v1":
78
+ if (!isUuid(value.node_id))
79
+ throw new RepositoryContractError("node.field.set.v1 requires a UUIDv4 node_id");
80
+ if (typeof value.field !== "string" || !NODE_FIELD_NAMES.includes(value.field)) {
81
+ throw new RepositoryContractError("node.field.set.v1 has an invalid field");
82
+ }
83
+ requireDigest(value, "expected_digest");
84
+ requireDigest(value, "new_digest");
85
+ if (metadataError(value.change_metadata, "change_metadata")) {
86
+ throw new RepositoryContractError("node.field.set.v1 has invalid change metadata");
87
+ }
88
+ return;
89
+ case "node.tombstone.v1":
90
+ case "node.restore.v1":
91
+ if (!isUuid(value.node_id))
92
+ throw new RepositoryContractError("node lifecycle operation requires a UUIDv4 node_id");
93
+ if (value.expected_lifecycle !== (type === "node.tombstone.v1" ? "live" : "tombstoned")) {
94
+ throw new RepositoryContractError("node lifecycle operation has an invalid expected lifecycle");
95
+ }
96
+ if (!isDigest(value.relation_reference_digest)) {
97
+ throw new RepositoryContractError("node lifecycle operation requires a canonical relation digest");
98
+ }
99
+ return;
100
+ case "node.purge.v1": {
101
+ if (!isUuid(value.node_id) || !isUuid(value.confirmation_node_id)) {
102
+ throw new RepositoryContractError("node.purge.v1 requires UUIDv4 node identifiers");
103
+ }
104
+ if (!isDigest(value.expected_head))
105
+ throw new RepositoryContractError("node.purge.v1 requires a canonical expected head");
106
+ const count = value.live_dependency_count;
107
+ if (count === false)
108
+ return;
109
+ if (count === 0 || count === 0n) {
110
+ value.live_dependency_count = 0n;
111
+ return;
112
+ }
113
+ if (JSON.isRawJSON(count) && /[.eE]/.test(count.rawJSON) && Number(count.rawJSON) === 0) {
114
+ value.live_dependency_count = JSON.rawJSON(Object.is(Number(count.rawJSON), -0) ? "-0.0" : "0.0");
115
+ return;
116
+ }
117
+ throw new RepositoryContractError("node.purge.v1 requires zero live dependencies");
118
+ }
119
+ default:
120
+ validateExtension(type, value);
121
+ }
122
+ }
123
+ function validateAssignment(value) {
124
+ requireUuid(value, "scope_node_id");
125
+ requireUuid(value, "node_id");
126
+ requireUuid(value, "new_holder");
127
+ requireNonempty(value, "tag_id");
128
+ requireMetadata(value, "relation_metadata");
129
+ const present = HISTORY_FIELDS.filter((field) => Object.hasOwn(value, field));
130
+ switch (value.assignment_mode) {
131
+ case "initial":
132
+ if (value.expected_holder !== null || present.length !== 0) {
133
+ throw new RepositoryContractError("initial assignment has invalid holder history");
134
+ }
135
+ return;
136
+ case "same_holder":
137
+ requireUuid(value, "expected_holder");
138
+ if (present.length !== 0)
139
+ throw new RepositoryContractError("same-holder assignment has invalid history");
140
+ return;
141
+ case "tracked_replacement": {
142
+ if (present.length !== HISTORY_FIELDS.length)
143
+ throw new RepositoryContractError("tracked assignment requires complete history");
144
+ requireUuid(value, "expected_holder");
145
+ requireUuid(value, "prior_holder");
146
+ const error = "tracked assignment history is invalid";
147
+ value.expected_history_next_index = integerValue(value.expected_history_next_index, 1n, error);
148
+ value.history_index = integerValue(value.history_index, 1n, error);
149
+ const entry = value.history_entry_id;
150
+ if (typeof entry !== "string" || entry.length !== 79 || !/^history:sha256:[0-9a-f]{64}$/.test(entry)) {
151
+ throw new RepositoryContractError(error);
152
+ }
153
+ value.history_tag = validateHistoryTag(value.history_tag);
154
+ return;
155
+ }
156
+ default:
157
+ throw new RepositoryContractError("node.tag.assign.v1 has an invalid mode");
158
+ }
159
+ }
160
+ function validateOwner(owner) {
161
+ if (!isRecord(owner) || Object.keys(owner).length !== 2 ||
162
+ !Object.hasOwn(owner, "owner_type") || !Object.hasOwn(owner, "owner_id") ||
163
+ (owner.owner_type !== "node" && owner.owner_type !== "edge") || !isUuid(owner.owner_id)) {
164
+ throw new RepositoryContractError("artifact owner must be a node or edge UUIDv4");
165
+ }
166
+ }
167
+ function validateExtension(type, value) {
168
+ switch (type) {
169
+ case "tag.define.v1":
170
+ case "tag.update.v1":
171
+ case "tag.retire.v1":
172
+ requireUuid(value, "scope_node_id");
173
+ requireNonempty(value, "tag_id");
174
+ if (type === "tag.define.v1") {
175
+ if (value.expected_tag_state !== "absent")
176
+ throw new RepositoryContractError("tag.define.v1 requires an absent tag");
177
+ }
178
+ else {
179
+ requireDigest(value, "expected_definition_digest");
180
+ value.previous_definition = validateTagDefinition(value.previous_definition);
181
+ }
182
+ if (type !== "tag.retire.v1")
183
+ value.definition = validateTagDefinition(value.definition);
184
+ return;
185
+ case "node.tag.assign.v1":
186
+ validateAssignment(value);
187
+ return;
188
+ case "node.tag.remove.v1":
189
+ requireUuid(value, "scope_node_id");
190
+ requireUuid(value, "node_id");
191
+ requireUuid(value, "expected_holder");
192
+ requireNonempty(value, "tag_id");
193
+ requireMetadata(value, "relation_metadata");
194
+ return;
195
+ case "lineage.add.v1":
196
+ case "lineage.remove.v1":
197
+ case "containment.remove.v1":
198
+ case "edge.remove.v1": {
199
+ const names = type.startsWith("lineage.") ? ["parent_node_id", "child_node_id"]
200
+ : type === "containment.remove.v1" ? ["containment_id", "child_node_id"] : ["edge_id"];
201
+ for (const name of names)
202
+ requireUuid(value, name);
203
+ if (value.expected_relation_state !== (type === "lineage.add.v1" ? "absent" : "present")) {
204
+ throw new RepositoryContractError(`${type} has an invalid relation state`);
205
+ }
206
+ if (!type.startsWith("lineage."))
207
+ requireDigest(value, "relation_digest");
208
+ return;
209
+ }
210
+ case "containment.assign.v1":
211
+ for (const name of ["containment_id", "container_node_id", "child_node_id"])
212
+ requireUuid(value, name);
213
+ if (value.expected_relation_state !== "absent")
214
+ throw new RepositoryContractError("containment.assign.v1 requires an absent relation");
215
+ requireDigest(value, "relation_digest");
216
+ if (value.ordinal !== null)
217
+ value.ordinal = integerValue(value.ordinal, 0n, "ordinal must be a nonnegative integer or null");
218
+ requireUuid(value, "source_artifact_id", true);
219
+ return;
220
+ case "edge.add.v1":
221
+ for (const name of ["edge_id", "graph_node_id", "source_node_id", "target_node_id"])
222
+ requireUuid(value, name);
223
+ if (value.expected_relation_state !== "absent")
224
+ throw new RepositoryContractError("edge.add.v1 requires an absent relation");
225
+ requireDigest(value, "relation_digest");
226
+ requireDigest(value, "content_digest");
227
+ validateDigestList(value.artifact_reference_digests, true);
228
+ return;
229
+ case "edge.field.set.v1":
230
+ requireUuid(value, "edge_id");
231
+ if (value.field !== "content")
232
+ throw new RepositoryContractError("edge.field.set.v1 has an invalid field");
233
+ requireDigest(value, "expected_digest");
234
+ requireDigest(value, "new_digest");
235
+ requireMetadata(value, "change_metadata");
236
+ return;
237
+ case "artifact.attach.v1":
238
+ case "artifact.attach.v2":
239
+ case "artifact.detach.v1":
240
+ case "artifact.metadata.set.v1":
241
+ case "artifact.content.set.v1":
242
+ case "artifact.properties.set.v1":
243
+ requireUuid(value, "artifact_id");
244
+ if (type !== "artifact.content.set.v1" && type !== "artifact.properties.set.v1")
245
+ validateOwner(value.owner);
246
+ if (type === "artifact.attach.v1" || type === "artifact.attach.v2") {
247
+ if (value.expected_reference_state !== "absent")
248
+ throw new RepositoryContractError(`${type} requires an absent reference`);
249
+ value.order = integerValue(value.order, 0n, "artifact order must be nonnegative");
250
+ requireDigest(value, "object_digest");
251
+ requireDigest(value, type === "artifact.attach.v1" ? "metadata_digest" : "properties_digest");
252
+ requireMetadata(value, "reference_metadata");
253
+ }
254
+ else if (type === "artifact.detach.v1") {
255
+ if (value.expected_reference_state !== "present")
256
+ throw new RepositoryContractError("artifact.detach.v1 requires a present reference");
257
+ requireDigest(value, "object_digest");
258
+ requireDigest(value, "reference_digest");
259
+ }
260
+ else if (type === "artifact.metadata.set.v1") {
261
+ if (typeof value.field !== "string" || !["name", "media_type", "notes", "tags"].includes(value.field)) {
262
+ throw new RepositoryContractError("artifact.metadata.set.v1 has an invalid field");
263
+ }
264
+ requireDigest(value, "expected_digest");
265
+ requireDigest(value, "new_digest");
266
+ requireMetadata(value, "change_metadata");
267
+ }
268
+ else if (type === "artifact.content.set.v1") {
269
+ requireDigest(value, "expected_object_digest");
270
+ requireDigest(value, "object_digest");
271
+ requireDigest(value, "expected_reference_digest");
272
+ requireMetadata(value, "change_metadata");
273
+ }
274
+ else {
275
+ requireDigest(value, "expected_digest");
276
+ requireDigest(value, "new_digest");
277
+ requireDigest(value, "expected_reference_digest");
278
+ requireMetadata(value, "change_metadata");
279
+ }
280
+ return;
281
+ case "imported_baseline.v1": {
282
+ requireUuid(value, "migration_attempt_id");
283
+ if (value.expected_history_state !== "empty")
284
+ throw new RepositoryContractError("imported baseline requires an empty history");
285
+ for (const name of ["membership_manifest_digest", "roles_manifest_digest", "aggregate_digest"])
286
+ requireDigest(value, name);
287
+ validateDigestList(value.chunk_digests, false);
288
+ if (value.chunk_digests.length === 0)
289
+ throw new RepositoryContractError("imported baseline requires at least one chunk");
290
+ const counts = value.counts;
291
+ if (!isRecord(counts) || Object.keys(counts).length !== BASELINE_COUNT_FIELDS.length ||
292
+ !BASELINE_COUNT_FIELDS.every((field) => Object.hasOwn(counts, field))) {
293
+ throw new RepositoryContractError("baseline counts have unknown or missing fields");
294
+ }
295
+ const normalized = {};
296
+ for (const [name, count] of Object.entries(counts)) {
297
+ normalized[name] = integerValue(count, name === "chunk_count" ? 1n : 0n, "baseline counts must be nonnegative integers");
298
+ }
299
+ value.counts = normalized;
300
+ return;
301
+ }
302
+ default:
303
+ throw new RepositoryContractError("unknown repository operation version");
304
+ }
305
+ }
306
+ export class RepositoryOperation {
307
+ type;
308
+ operationId;
309
+ repositoryId;
310
+ payload;
311
+ constructor(type, operationId, repositoryId, payload) {
312
+ this.type = type;
313
+ this.operationId = operationId;
314
+ this.repositoryId = repositoryId;
315
+ this.payload = payload;
316
+ }
317
+ static fromMapping(value) {
318
+ if (!isRecord(value) || typeof value.type !== "string" || !Object.hasOwn(OPERATION_FIELDS, value.type)) {
319
+ throw new RepositoryContractError("unknown repository operation version");
320
+ }
321
+ // Object.hasOwn verifies the closed operation-type key before this narrowing.
322
+ const type = value.type;
323
+ const fields = OPERATION_FIELDS[type];
324
+ const required = type === "node.tag.assign.v1" ? fields.filter((field) => !HISTORY_FIELDS.includes(field)) : fields;
325
+ if (Object.keys(value).some((field) => !fields.includes(field)) || !required.every((field) => Object.hasOwn(value, field))) {
326
+ throw new RepositoryContractError("repository operation has unknown or missing fields");
327
+ }
328
+ const operationId = value.operation_id;
329
+ const repositoryId = value.repository_id;
330
+ if (!isUuid(operationId))
331
+ throw new RepositoryContractError("operation_id must be a UUIDv4");
332
+ if (!isUuid(repositoryId))
333
+ throw new RepositoryContractError("repository_id must be a UUIDv4");
334
+ const payload = { ...value };
335
+ validateNode(type, payload);
336
+ return new RepositoryOperation(type, operationId, repositoryId, payload);
337
+ }
338
+ get canonicalBytes() {
339
+ return canonicalBytes(this.payload);
340
+ }
341
+ toMapping() {
342
+ return { ...this.payload };
343
+ }
344
+ }
345
+ //# sourceMappingURL=operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../../src/local/domain/models/operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EACL,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,0BAA0B,EACpE,WAAW,EAAE,gBAAgB,EAAsB,kBAAkB,EACrE,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,eAA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AK,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QACpH,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;YAC3H,MAAM,IAAI,uBAAuB,CAAC,oDAAoD,CAAC,CAAC;QAC1F,CAAC;QACD,MAAM,WAAW,GAAG,KAAK,CAAC,YAAY,CAAC;QACvC,MAAM,YAAY,GAAG,KAAK,CAAC,aAAa,CAAC;QACzC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;YAAE,MAAM,IAAI,uBAAuB,CAAC,+BAA+B,CAAC,CAAC;QAC7F,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;YAAE,MAAM,IAAI,uBAAuB,CAAC,gCAAgC,CAAC,CAAC;QAC/F,MAAM,OAAO,GAAG,EAAE,GAAG,KAAK,EAAE,CAAC;QAC7B,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC5B,OAAO,IAAI,mBAAmB,CAAC,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;IAC3E,CAAC;IAED,IAAI,cAAc;QAChB,OAAO,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED,SAAS;QACP,OAAO,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;CACF"}
@@ -0,0 +1,57 @@
1
+ import { RepositoryContractError } from "../errors.js";
2
+ import { integerValue, isRecord, TAG_DEFINITION_FIELDS, validateTimestamp } from "./constants.js";
3
+ export function validateTagDefinition(value) {
4
+ if (!isRecord(value) || Object.keys(value).length !== TAG_DEFINITION_FIELDS.length ||
5
+ !TAG_DEFINITION_FIELDS.every((field) => Object.hasOwn(value, field))) {
6
+ throw new RepositoryContractError("tag definition has unknown or missing fields");
7
+ }
8
+ if (typeof value.name !== "string" || !value.name) {
9
+ throw new RepositoryContractError("tag definition requires a name");
10
+ }
11
+ for (const field of ["bg_color", "text_color"]) {
12
+ const color = value[field];
13
+ if (typeof color !== "string" || color.length !== 7 || !/^#[0-9a-fA-F]{6}$/.test(color)) {
14
+ throw new RepositoryContractError("tag definition colors are invalid");
15
+ }
16
+ }
17
+ if (typeof value.one_only !== "boolean" || typeof value.track_history !== "boolean") {
18
+ throw new RepositoryContractError("tag definition flags are invalid");
19
+ }
20
+ if (value.track_history && !value.one_only) {
21
+ throw new RepositoryContractError("tracked tags must be one-only");
22
+ }
23
+ let nameLength = 0;
24
+ for (let index = 0; index < value.name.length; index += value.name.codePointAt(index) > 0xffff ? 2 : 1)
25
+ nameLength++;
26
+ if (nameLength > 256)
27
+ throw new RepositoryContractError("tag definition name is too long");
28
+ const historyOf = value.history_of_tag_id;
29
+ if (historyOf !== null && (typeof historyOf !== "string" || !historyOf)) {
30
+ throw new RepositoryContractError("tag definition history tag is invalid");
31
+ }
32
+ const historyIndex = value.history_index === null ? null : integerValue(value.history_index, 1n, "tag definition history index is invalid");
33
+ const nextIndex = integerValue(value.history_next_index, 1n, "tag definition next history index is invalid");
34
+ return { ...value, history_index: historyIndex, history_next_index: nextIndex };
35
+ }
36
+ export function validateHistoryTag(value) {
37
+ if (!isRecord(value) || Object.keys(value).length !== TAG_DEFINITION_FIELDS.length + 2 ||
38
+ ![...TAG_DEFINITION_FIELDS, "created_at", "updated_at"].every((field) => Object.hasOwn(value, field))) {
39
+ throw new RepositoryContractError("history tag has unknown or missing fields");
40
+ }
41
+ if (value.one_only !== false || value.track_history !== false) {
42
+ throw new RepositoryContractError("history tag flags are invalid");
43
+ }
44
+ const next = value.history_next_index;
45
+ if (!(next === 1 || next === 1n || next === true || (JSON.isRawJSON(next) && Number(next.rawJSON) === 1))) {
46
+ throw new RepositoryContractError("history tag next index is invalid");
47
+ }
48
+ const definition = {};
49
+ for (const field of TAG_DEFINITION_FIELDS)
50
+ definition[field] = value[field];
51
+ const normalized = validateTagDefinition(definition);
52
+ for (const field of ["created_at", "updated_at"]) {
53
+ validateTimestamp(value[field], "history tag timestamps are invalid");
54
+ }
55
+ return { ...value, ...normalized };
56
+ }
57
+ //# sourceMappingURL=tags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tags.js","sourceRoot":"","sources":["../../../../src/local/domain/models/tags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAElG,MAAM,UAAU,qBAAqB,CAAC,KAAc;IAClD,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,KAAK,qBAAqB,CAAC,MAAM;QAChF,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;QACvE,MAAM,IAAI,uBAAuB,CAAC,8CAA8C,CAAC,CAAC;IACpF,CAAC;IACD,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QAClD,MAAM,IAAI,uBAAuB,CAAC,gCAAgC,CAAC,CAAC;IACtE,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,EAAE,CAAC;QAC/C,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAC3B,IAAI,OAAO,KAAK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K,CAAC,CAAC;IAC5E,MAAM,UAAU,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;IACrD,KAAK,MAAM,KAAK,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,EAAE,CAAC;QACjD,iBAAiB,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,oCAAoC,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,EAAE,GAAG,KAAK,EAAE,GAAG,UAAU,EAAE,CAAC;AACrC,CAAC"}
@@ -0,0 +1,149 @@
1
+ import { createHash } from "node:crypto";
2
+ import { parseRebaseContext, RepositoryRebaseError, serializeRebaseContext } from "./context.js";
3
+ import { keysConflict, operationKey } from "./keys.js";
4
+ import { canonicalBytes, compareCodePoints, parseRepositoryJson } from "../models/encoding.js";
5
+ import { isRecord } from "../models/constants.js";
6
+ function keyId(key) {
7
+ return canonicalBytes(key).toString("hex");
8
+ }
9
+ function compareKeys(left, right) {
10
+ const end = Math.min(left.length, right.length);
11
+ for (let index = 0; index < end; index += 1) {
12
+ const compared = compareCodePoints(left[index], right[index]);
13
+ if (compared !== 0)
14
+ return compared;
15
+ }
16
+ return left.length - right.length;
17
+ }
18
+ function operationsByKey(commits) {
19
+ const result = new Map();
20
+ for (const commit of commits) {
21
+ for (const operation of commit.operations) {
22
+ const key = operationKey(operation);
23
+ const id = keyId(key);
24
+ const current = result.get(id);
25
+ if (current)
26
+ current.operations.push(operation);
27
+ else
28
+ result.set(id, { key, operations: [operation] });
29
+ }
30
+ }
31
+ return result;
32
+ }
33
+ function deterministicConflictId(rebaseId, key) {
34
+ const raw = createHash("sha256")
35
+ .update("flywheel.rebase-conflict.v1\0")
36
+ .update(Buffer.from(rebaseId.replaceAll("-", ""), "hex"))
37
+ .update(canonicalBytes(key))
38
+ .digest()
39
+ .subarray(0, 16);
40
+ raw[6] = (raw[6] & 0x0f) | 0x40;
41
+ raw[8] = (raw[8] & 0x3f) | 0x80;
42
+ const hex = raw.toString("hex");
43
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
44
+ }
45
+ function conflictMapping(conflict) {
46
+ let payload;
47
+ try {
48
+ payload = parseRepositoryJson(new TextDecoder("utf-8", { fatal: true }).decode(conflict.canonicalBytes));
49
+ }
50
+ catch (error) {
51
+ throw new RepositoryRebaseError("repository conflict is corrupt", { cause: error });
52
+ }
53
+ if (!isRecord(payload) || !canonicalBytes(payload).equals(Buffer.from(conflict.canonicalBytes)) ||
54
+ payload.schema !== "flywheel.repository.conflict.v1" ||
55
+ payload.conflict_id !== conflict.conflictId || payload.rebase_id !== conflict.rebaseId ||
56
+ !Array.isArray(payload.key)) {
57
+ throw new RepositoryRebaseError("repository conflict is corrupt");
58
+ }
59
+ return payload;
60
+ }
61
+ function conflictKey(payload) {
62
+ return payload.key.map(String);
63
+ }
64
+ export function buildConflicts(input) {
65
+ const localByKey = operationsByKey(input.localCommitsNewestFirst);
66
+ const remoteByKey = operationsByKey(input.remoteCommits);
67
+ const conflicting = [...localByKey.values()]
68
+ .filter(({ key }) => [...remoteByKey.values()].some((remote) => keysConflict(key, remote.key)))
69
+ .sort((left, right) => compareKeys(left.key, right.key));
70
+ const context = serializeRebaseContext(input.context);
71
+ return conflicting.map(({ key, operations }, index) => {
72
+ const remoteOperations = [...remoteByKey.values()]
73
+ .filter((remote) => keysConflict(key, remote.key))
74
+ .flatMap((remote) => remote.operations);
75
+ const conflictId = deterministicConflictId(input.rebaseId, key);
76
+ const payload = {
77
+ conflict_id: conflictId,
78
+ context: index === 0 ? context : null,
79
+ key,
80
+ local_operations: operations.map((operation) => operation.toMapping()),
81
+ rebase_id: input.rebaseId,
82
+ remote_operations: remoteOperations.map((operation) => operation.toMapping()),
83
+ resolution: null,
84
+ schema: "flywheel.repository.conflict.v1",
85
+ };
86
+ return {
87
+ repositoryId: input.repositoryId,
88
+ conflictId,
89
+ rebaseId: input.rebaseId,
90
+ state: "open",
91
+ canonicalBytes: canonicalBytes(payload),
92
+ };
93
+ });
94
+ }
95
+ export function resolveConflictBytes(conflict, strategy, manualValue) {
96
+ const payload = conflictMapping(conflict);
97
+ if (strategy !== "local" && strategy !== "remote" && strategy !== "manual") {
98
+ throw new RepositoryRebaseError("repository conflict strategy is invalid");
99
+ }
100
+ if (strategy === "manual") {
101
+ if (typeof manualValue !== "string" || conflictKey(payload)[0] !== "node-field") {
102
+ throw new RepositoryRebaseError("manual conflict value is invalid");
103
+ }
104
+ }
105
+ else if (manualValue !== null) {
106
+ throw new RepositoryRebaseError("manual conflict value is invalid");
107
+ }
108
+ return canonicalBytes({ ...payload, resolution: { manual_value: manualValue, strategy } });
109
+ }
110
+ export function conflictContext(conflicts) {
111
+ for (const conflict of conflicts) {
112
+ const payload = conflictMapping(conflict);
113
+ if (isRecord(payload.context))
114
+ return parseRebaseContext(conflict.repositoryId, payload.context);
115
+ }
116
+ throw new RepositoryRebaseError("repository rebase context is missing");
117
+ }
118
+ export function conflictResolutionByKey(conflicts) {
119
+ const result = new Map();
120
+ for (const conflict of conflicts) {
121
+ const payload = conflictMapping(conflict);
122
+ const resolution = payload.resolution;
123
+ if (conflict.state !== "resolved" || !isRecord(resolution)) {
124
+ throw new RepositoryRebaseError("repository conflicts are unresolved");
125
+ }
126
+ const strategy = resolution.strategy;
127
+ const manualValue = resolution.manual_value;
128
+ if ((strategy !== "local" && strategy !== "remote" && strategy !== "manual") ||
129
+ (manualValue !== null && typeof manualValue !== "string")) {
130
+ throw new RepositoryRebaseError("repository conflict resolution is invalid");
131
+ }
132
+ let remoteDigest = null;
133
+ if (Array.isArray(payload.remote_operations)) {
134
+ for (const operation of [...payload.remote_operations].reverse()) {
135
+ if (isRecord(operation) && typeof operation.new_digest === "string") {
136
+ remoteDigest = operation.new_digest;
137
+ break;
138
+ }
139
+ }
140
+ }
141
+ result.set(conflictKey(payload), [strategy, manualValue, remoteDigest]);
142
+ }
143
+ return result;
144
+ }
145
+ export function resolutionDigest(conflicts) {
146
+ const bytes = canonicalBytes(conflicts.map((conflict) => Buffer.from(conflict.canonicalBytes).toString("hex")));
147
+ return `sha256:${createHash("sha256").update("flywheel.rebase-resolutions.v1\0").update(bytes).digest("hex")}`;
148
+ }
149
+ //# sourceMappingURL=conflicts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conflicts.js","sourceRoot":"","sources":["../../../../src/local/domain/rebase/conflicts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAEjG,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC/F,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAuBlD,SAAS,KAAK,CAAC,GAAiB;IAC9B,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,WAAW,CAAC,IAAkB,EAAE,KAAmB;IAC1D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAChD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,GAAG,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QAC5C,MAAM,QAAQ,GAAG,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9D,IAAI,QAAQ,KAAK,CAAC;YAAE,OAAO,QAAQ,CAAC;IACtC,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;AACpC,CAAC;AAED,SAAS,eAAe,CAAC,OAAoC;IAC3D,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