@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.
- package/README.md +67 -10
- package/package.json +14 -6
- package/skills/flywheel/SKILL.md +9 -6
- package/skills/flywheel/example-workflows/organizing-exploring-and-iterating-on-a-research-topic.md +38 -46
- package/skills/flywheel/example-workflows/reproducing-papers-on-a-budget.md +34 -36
- package/skills/flywheel/getting-started/flywheel-quickstart.md +2 -5
- package/skills/flywheel/references/INTERFACES.md +2 -2
- package/skills/flywheel/references/experiment-design-protocol.md +32 -25
- package/skills/flywheel/references/flywheel-cli-tool-map.md +120 -76
- package/skills/flywheel/references/flywheel-mcp-tool-map.md +42 -32
- package/skills/flywheel/setting-up-flywheel/claude-code-cli-installation.md +1 -1
- package/skills/flywheel/setting-up-flywheel/codex-cli-installation.md +1 -1
- package/skills/flywheel/setting-up-flywheel/installation-overview.md +2 -6
- package/skills/flywheel/setting-up-flywheel/other-hosts-installation.md +45 -25
- package/skills/flywheel/setting-up-flywheel/updating-flywheel-mcp.md +34 -11
- package/skills/flywheel-auto/SKILL.md +40 -23
- package/skills/flywheel-auto/evals/evals.json +1 -1
- package/skills/flywheel-auto/references/INTERFACES.md +2 -2
- package/skills/flywheel-auto/references/experiment-design-protocol.md +31 -23
- package/skills/flywheel-auto/references/flywheel-cli-tool-map.md +172 -127
- package/skills/flywheel-auto/references/flywheel-mcp-tool-map.md +22 -24
- package/skills/flywheel-lookahead/SKILL.md +47 -28
- package/skills/flywheel-lookahead/agents/openai.yaml +1 -1
- package/skills/flywheel-lookahead/evals/evals.json +6 -6
- package/skills/flywheel-lookahead/references/INTERFACES.md +2 -2
- package/skills/flywheel-lookahead/references/flywheel-cli-tool-map.md +172 -127
- package/skills/flywheel-lookahead/references/flywheel-mcp-tool-map.md +22 -24
- package/skills/flywheel-prove/SKILL.md +2 -2
- package/skills/flywheel-prove/references/workflow.md +21 -2
- package/skills/flywheel-reproduce/SKILL.md +39 -19
- package/skills/flywheel-reproduce/evals/evals.json +1 -1
- package/skills/flywheel-reproduce/references/INTERFACES.md +2 -2
- package/skills/flywheel-reproduce/references/experiment-design-protocol.md +31 -23
- package/skills/flywheel-reproduce/references/flywheel-cli-tool-map.md +172 -127
- package/skills/flywheel-reproduce/references/flywheel-mcp-tool-map.md +22 -24
- package/skills/flywheel-to-graph/SKILL.md +37 -17
- package/skills/flywheel-to-graph/references/INTERFACES.md +2 -2
- package/skills/flywheel-to-graph/references/flywheel-cli-tool-map.md +172 -127
- package/skills/flywheel-to-graph/references/flywheel-mcp-tool-map.md +22 -24
- package/skills/flywheel-tree/references/workflow.md +6 -37
- package/src/cli.mjs +1145 -1141
- package/src/mcp-writer.mjs +413 -435
- package/src/public-command-metadata.mjs +28 -5
- package/src/runtime/delegate.mjs +2 -19
- package/src/runtime/required-runtime-commands.json +80 -28
- package/src/runtime/runtime-config.mjs +39 -60
- package/src/runtime/vendor/flywheel-cli-dist/auth/credentials.js +330 -0
- package/src/runtime/vendor/flywheel-cli-dist/auth/credentials.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/auth/login.js +90 -139
- package/src/runtime/vendor/flywheel-cli-dist/auth/login.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/auth/profiles.js +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/auth/profiles.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/auth/secure-write.js +116 -0
- package/src/runtime/vendor/flywheel-cli-dist/auth/secure-write.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-create.js +248 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-create.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-login.js +65 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-login.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-revoke-api-key.js +17 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-revoke-api-key.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/aliases.js +3 -7
- package/src/runtime/vendor/flywheel-cli-dist/commands/aliases.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-credentials-clear.js +12 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-credentials-clear.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-credentials-set.js +29 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-credentials-set.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-login.js +12 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-login.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-status.js +46 -10
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-status.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/env.js +17 -40
- package/src/runtime/vendor/flywheel-cli-dist/commands/env.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation-resources.js +305 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation-resources.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation-support.js +72 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation-support.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation.js +286 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/graph-operation.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/help-metadata.js +30 -5
- package/src/runtime/vendor/flywheel-cli-dist/commands/help-metadata.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/help.js +27 -12
- package/src/runtime/vendor/flywheel-cli-dist/commands/help.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-commit-replay.js +284 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-commit-replay.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-graph.js +169 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-graph.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-lineage-list.js +13 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-lineage-list.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-repository-snapshot.js +227 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/hosted-repository-snapshot.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/index.js +21 -51
- package/src/runtime/vendor/flywheel-cli-dist/commands/index.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/node-create-schema.js +25 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/node-create-schema.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-list.js +11 -9
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-list.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-set.js +38 -45
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-set.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-show.js +14 -17
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-show.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-unset.js +13 -8
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-unset.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/admin.js +34 -3
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/admin.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/auth.js +9 -9
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/auth.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/hosted.js +76 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/hosted.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/lifecycle.js +4 -138
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/lifecycle.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/profile.js +8 -13
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/profile.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/repository.js +362 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/repository.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry.js +45 -183
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/repository-edit.js +47 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/repository-edit.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/repository-operation.js +181 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/repository-operation.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/repository-output.js +163 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/repository-output.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/repository-projection.js +79 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/repository-projection.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/repository-selection.js +80 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/repository-selection.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/retired-command-names.js +78 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/retired-command-names.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/types.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/usage-spec.js +3 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/usage-spec.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/config/index.js +5 -0
- package/src/runtime/vendor/flywheel-cli-dist/config/index.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/config/io.js +139 -0
- package/src/runtime/vendor/flywheel-cli-dist/config/io.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/config/migration.js +299 -0
- package/src/runtime/vendor/flywheel-cli-dist/config/migration.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/config/model.js +214 -0
- package/src/runtime/vendor/flywheel-cli-dist/config/model.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/config/path.js +30 -0
- package/src/runtime/vendor/flywheel-cli-dist/config/path.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/credential-output.js +29 -0
- package/src/runtime/vendor/flywheel-cli-dist/credential-output.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/errors.js +1 -16
- package/src/runtime/vendor/flywheel-cli-dist/errors.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/generatedProductTelemetryContract.js +3 -3
- package/src/runtime/vendor/flywheel-cli-dist/generatedProductTelemetryContract.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/grammar/globals.js +19 -9
- package/src/runtime/vendor/flywheel-cli-dist/grammar/globals.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/grammar/parse.js +33 -4
- package/src/runtime/vendor/flywheel-cli-dist/grammar/parse.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/http/client.js +322 -304
- package/src/runtime/vendor/flywheel-cli-dist/http/client.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/http/debug.js +1 -21
- package/src/runtime/vendor/flywheel-cli-dist/http/debug.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/http/retry.js +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/http/retry.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/local/adapter.js +244 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/adapter.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/errors.js +7 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/errors.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/history.js +35 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/history.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/invariants.js +42 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/invariants.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/artifact-properties.js +179 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/artifact-properties.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/commits.js +152 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/commits.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/constants.js +71 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/constants.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/encoding.js +73 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/encoding.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/imported-artifact-properties.js +82 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/imported-artifact-properties.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/operations.js +345 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/operations.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/tags.js +57 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/tags.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/conflicts.js +149 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/conflicts.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/context.js +115 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/context.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/keys.js +44 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/keys.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/pull.js +159 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/pull.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/replay.js +346 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/replay.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/resolve.js +37 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/rebase/resolve.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/inverses.js +203 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/inverses.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/plan.js +207 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/plan.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/tag-inverses.js +109 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/revert/tag-inverses.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/commit.js +61 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/commit.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/projection.js +46 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/projection.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/revert.js +203 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/revert.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/staging.js +44 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/staging.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/writes.js +188 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/service/writes.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync/cursors.js +54 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync/cursors.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync/local-pull.js +25 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync/local-pull.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync-models.js +2 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/domain/sync-models.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/fs/native.js +7 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/fs/native.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/fs/state.js +129 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/fs/state.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/fs/writer-lock.js +277 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/fs/writer-lock.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/bootstrap.js +183 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/bootstrap.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/context.js +2 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/context.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/dispatch.js +121 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/dispatch.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/doctor.js +16 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/doctor.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/identity.js +72 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/identity.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/conflicts.js +59 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/conflicts.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/core.js +125 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/core.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/history.js +129 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/history.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/index.js +31 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/index.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/maintenance.js +49 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/maintenance.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/projections.js +30 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/projections.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/shared.js +12 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/operations/shared.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/platform.js +18 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/platform.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/projection.js +125 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/projection.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/clone.js +37 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/clone.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/pull.js +44 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/pull.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/purge.js +58 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/purge.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/push.js +118 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/push.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/transport.js +277 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/runtime/remote/transport.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/apply.js +132 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/apply.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/archive.js +372 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/archive.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/backup.js +210 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/backup.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/restore.js +278 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/restore.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/retained-directory.js +192 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/backup/retained-directory.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/commits.js +114 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/commits.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/contract.js +65 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/contract.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/diagnostics-worker.js +145 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/diagnostics-worker.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/diagnostics.js +218 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/diagnostics.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/gc.js +71 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/gc.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/history-validation.js +298 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/history-validation.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/latest-values.js +121 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/latest-values.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migrate.js +69 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migrate.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/provenance.js +49 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/provenance.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/steps.js +424 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/steps.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/versions.js +10 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migration/versions.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations/001_initial.sql +319 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations/002_staged_latest_values.sql +8 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations/003_remove_cli_editing_lease.sql +21 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations/004_hosted_association.sql +7 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations/005_artifact_properties.sql +68 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations.js +12 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/migrations.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/objects.js +410 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/objects.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/apply.js +77 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/apply.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/artifacts.js +240 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/artifacts.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/nodes.js +127 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/nodes.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/relations.js +107 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/relations.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/rules.js +80 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/rules.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/tags.js +219 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/projection/tags.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/hosted.js +164 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/hosted.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/read.js +20 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/read.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/replace.js +41 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/replace.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/schema.js +22 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/schema.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/validate.js +188 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot/validate.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot.js +5 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/snapshot.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/connection.js +214 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/connection.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/errors.js +4 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/errors.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/rows.js +44 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/rows.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/schema.js +38 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/schema.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/store.js +284 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/store.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/verify.js +133 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sqlite/verify.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sync-commits.js +98 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sync-commits.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sync.js +161 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/sync.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/workspace-state.js +97 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/workspace-state.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/workspace.js +69 -0
- package/src/runtime/vendor/flywheel-cli-dist/local/store/workspace.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/main.js +651 -376
- package/src/runtime/vendor/flywheel-cli-dist/main.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/output/format.js +18 -11
- package/src/runtime/vendor/flywheel-cli-dist/output/format.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/prebuilds/darwin-arm64/node.napi.node +0 -0
- package/src/runtime/vendor/flywheel-cli-dist/prebuilds/darwin-x64/node.napi.node +0 -0
- package/src/runtime/vendor/flywheel-cli-dist/prebuilds/linux-arm64/node.napi.glibc.node +0 -0
- package/src/runtime/vendor/flywheel-cli-dist/prebuilds/linux-arm64/node.napi.musl.node +0 -0
- package/src/runtime/vendor/flywheel-cli-dist/prebuilds/linux-x64/node.napi.glibc.node +0 -0
- package/src/runtime/vendor/flywheel-cli-dist/prebuilds/linux-x64/node.napi.musl.node +0 -0
- package/src/runtime/vendor/manifest.json +246 -257
- package/src/setup/command.mjs +5 -0
- package/src/setup/io/patchers/json.mjs +1 -1
- package/src/setup/io/patchers/toml.mjs +3 -1
- package/src/setup/io/patchers/yaml.mjs +1 -1
- package/src/setup/modes/cli.mjs +76 -7
- package/src/setup/modes/mcp-command.mjs +802 -793
- package/src/setup/modes/mcp.mjs +7 -3
- package/src/setup/shared/prior-mode-detect.mjs +18 -21
- package/src/setup/test-seams.mjs +25 -0
- package/src/setup-auth.mjs +76 -10
- package/src/toml-lines.mjs +52 -0
- package/src/unified-cli.mjs +31 -16
- package/skills/flywheel-llm-proof-paper/scripts/__pycache__/check_paper.cpython-312.pyc +0 -0
- package/src/runtime/vendor/flywheel-cli-dist/auth/active-key-id.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/auth/baseurl.d.ts +0 -35
- package/src/runtime/vendor/flywheel-cli-dist/auth/config.d.ts +0 -34
- package/src/runtime/vendor/flywheel-cli-dist/auth/config.js +0 -92
- package/src/runtime/vendor/flywheel-cli-dist/auth/config.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/auth/fingerprint.d.ts +0 -5
- package/src/runtime/vendor/flywheel-cli-dist/auth/keychain.d.ts +0 -4
- package/src/runtime/vendor/flywheel-cli-dist/auth/keychain.js +0 -31
- package/src/runtime/vendor/flywheel-cli-dist/auth/keychain.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/auth/login.d.ts +0 -24
- package/src/runtime/vendor/flywheel-cli-dist/auth/profile.d.ts +0 -15
- package/src/runtime/vendor/flywheel-cli-dist/auth/profile.js +0 -150
- package/src/runtime/vendor/flywheel-cli-dist/auth/profile.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/auth/profiles.d.ts +0 -27
- package/src/runtime/vendor/flywheel-cli-dist/commands/_admin-auth.d.ts +0 -27
- package/src/runtime/vendor/flywheel-cli-dist/commands/_artifacts-upload-helpers.d.ts +0 -32
- package/src/runtime/vendor/flywheel-cli-dist/commands/_artifacts-upload-helpers.js +0 -213
- package/src/runtime/vendor/flywheel-cli-dist/commands/_artifacts-upload-helpers.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/_browser-handoff.d.ts +0 -35
- package/src/runtime/vendor/flywheel-cli-dist/commands/_open-url.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/_secret-param.d.ts +0 -7
- package/src/runtime/vendor/flywheel-cli-dist/commands/_stream-file-out.d.ts +0 -39
- package/src/runtime/vendor/flywheel-cli-dist/commands/_stream-writer.d.ts +0 -34
- package/src/runtime/vendor/flywheel-cli-dist/commands/_wait-polling.d.ts +0 -50
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-detach.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-emails-add.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-emails-remove.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-emails-set-primary.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-get.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-merge-preview.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-merge-proof.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/account-merge.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-compute-policy-get.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-compute-policy-set.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-graphs-export-stream.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-graphs-export.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-graphs-list.d.ts +0 -4
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-nodes-audit-list.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-create.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-delete.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-login.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/aliases.d.ts +0 -13
- package/src/runtime/vendor/flywheel-cli-dist/commands/api-keys-create.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/api-keys-delete.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/api-keys-list.d.ts +0 -18
- package/src/runtime/vendor/flywheel-cli-dist/commands/api-keys-rotate.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/approval-sessions-expire.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/approval-sessions-heartbeat.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/approval-sessions-list.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete-bulk.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete-bulk.js +0 -22
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete-bulk.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete.js +0 -8
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-delete.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-get.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-list.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-note-set.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-note-set.js +0 -9
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-note-set.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-finalize.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-finalize.js +0 -7
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-finalize.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-prepare.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-prepare.js +0 -15
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload-prepare.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload.js +0 -5
- package/src/runtime/vendor/flywheel-cli-dist/commands/artifacts-upload.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-clear.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-clear.js +0 -8
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-clear.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-set.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-set.js +0 -30
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-keychain-set.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-login.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-mode.d.ts +0 -4
- package/src/runtime/vendor/flywheel-cli-dist/commands/auth-status.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/blobs-get.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/campaign-budgets-create.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/campaign-budgets-list.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/campaign-budgets-revoke.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/campaign-budgets-update.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/campaign-snapshot.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-acquire.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-budgets.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-connection.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-funding.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-grants-list.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-grants-request-approval.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-options.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-release-all.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-release.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/compute-status.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/credits-balance.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/credits-billing-portal.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/credits-purchase.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/credits-referral-claim.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/credits-referral.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/credits-subscribe.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/credits-subscription.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/credits-transactions.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/credits-usage.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/destructive-confirmation.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/enums.d.ts +0 -22
- package/src/runtime/vendor/flywheel-cli-dist/commands/env.d.ts +0 -8
- package/src/runtime/vendor/flywheel-cli-dist/commands/executions-launch.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/executions-list.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/executions-terminate.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/export-history.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/export-subgraph.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/export-summary-pdf.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/export-summary-render-pdf.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/export-summary-stream.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/export-summary.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/feedback-create.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/files-list.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/github-disconnect.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/github-link.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/github-refresh-repos.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/github-status.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/graph-get.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/handler-factory.d.ts +0 -22
- package/src/runtime/vendor/flywheel-cli-dist/commands/help-format.d.ts +0 -31
- package/src/runtime/vendor/flywheel-cli-dist/commands/help-metadata.d.ts +0 -36
- package/src/runtime/vendor/flywheel-cli-dist/commands/help.d.ts +0 -17
- package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-create.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-delete.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-list.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-runs-list.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-secrets-create.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-secrets-delete.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-secrets-list.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-secrets-update.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-set-enabled.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/hooks-update.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/import-subgraph.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/index.d.ts +0 -23
- package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-huggingface-remove.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-huggingface-set.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-status.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-wandb-remove.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/integrations-wandb-set.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/machines-list.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-add-parent.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-add-parent.js +0 -15
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-add-parent.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-branch.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-branch.js +0 -10
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-branch.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-children.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-children.js +0 -8
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-children.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit-new.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit-new.js +0 -6
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit-new.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit.js +0 -7
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-commit.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-create.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-create.js +0 -6
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-create.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete-bulk.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete-bulk.js +0 -16
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete-bulk.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete.js +0 -11
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-delete.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-files.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-get.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-list.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-merge.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-merge.js +0 -33
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-merge.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-parents.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-parents.js +0 -8
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-parents.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-remove-parent.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-remove-parent.js +0 -15
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-remove-parent.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-render-ancestry.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-render-summary.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-render-tree.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-resolve-slug.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-sharing-get.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-sharing-set-bulk.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-sharing-set.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-sharing-summaries.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-stage-lease-acquire.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-stage-lease-heartbeat.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/nodes-stage-lease-release.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-list.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-set.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-show.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/profile-unset.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/account.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/admin.d.ts +0 -8
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/api-keys.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/approval.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/artifacts.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/artifacts.js +0 -140
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/artifacts.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/auth.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/budgets.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/compute.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/credits.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/env.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/executions.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/export.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/github.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/graph.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/hooks.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/integrations.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/lifecycle.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/profile.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/resources.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/sharing.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/tagging.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/tagging.js +0 -98
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/tagging.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry/updates.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/registry.d.ts +0 -27
- package/src/runtime/vendor/flywheel-cli-dist/commands/remote-artifacts-refresh.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/remote-artifacts-resolve.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/tags-assign.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/tags-assign.js +0 -25
- package/src/runtime/vendor/flywheel-cli-dist/commands/tags-assign.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/tags-create.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/tags-create.js +0 -25
- package/src/runtime/vendor/flywheel-cli-dist/commands/tags-create.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/tags-delete.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/tags-delete.js +0 -11
- package/src/runtime/vendor/flywheel-cli-dist/commands/tags-delete.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/tags-update.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/tags-update.js +0 -28
- package/src/runtime/vendor/flywheel-cli-dist/commands/tags-update.js.map +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/types.d.ts +0 -30
- package/src/runtime/vendor/flywheel-cli-dist/commands/updates-hide-all-active.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/updates-hide.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/updates-list.d.ts +0 -2
- package/src/runtime/vendor/flywheel-cli-dist/commands/usage-spec.d.ts +0 -6
- package/src/runtime/vendor/flywheel-cli-dist/commands/utils.d.ts +0 -11
- package/src/runtime/vendor/flywheel-cli-dist/errors.d.ts +0 -86
- package/src/runtime/vendor/flywheel-cli-dist/exit-codes.d.ts +0 -8
- package/src/runtime/vendor/flywheel-cli-dist/generatedFeedbackContract.d.ts +0 -41
- package/src/runtime/vendor/flywheel-cli-dist/generatedProductTelemetryContract.d.ts +0 -13
- package/src/runtime/vendor/flywheel-cli-dist/grammar/globals.d.ts +0 -26
- package/src/runtime/vendor/flywheel-cli-dist/grammar/parse.d.ts +0 -17
- package/src/runtime/vendor/flywheel-cli-dist/http/client.d.ts +0 -91
- package/src/runtime/vendor/flywheel-cli-dist/http/debug.d.ts +0 -5
- package/src/runtime/vendor/flywheel-cli-dist/http/poll.d.ts +0 -18
- package/src/runtime/vendor/flywheel-cli-dist/http/retry.d.ts +0 -30
- package/src/runtime/vendor/flywheel-cli-dist/main.d.ts +0 -33
- package/src/runtime/vendor/flywheel-cli-dist/output/format.d.ts +0 -9
- package/src/runtime/vendor/flywheel-cli-dist/runtime-entry.d.ts +0 -1
- package/src/runtime/vendor/flywheel-cli-dist/version.d.ts +0 -3
- 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,EAA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7I,OAAO;IACR,CAAC;IACD,IAAI,cAAc,KAAK,IAAI,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC;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,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/rows.js";
|
|
3
|
+
import { SNAPSHOT_BOOLEAN_COLUMNS, SNAPSHOT_TABLES, SNAPSHOT_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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oB,CAAC,4BAA4B,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,sBAAsB,CAC3B,YAAY,EACZ,IAAI,CAAC,wBAAwB,EAC7B,4BAA4B,CAAC,QAAQ,EAAE,YAAY,CAAC,CACrD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { assertAcyclicRelation, assertAllSemanticEdgesValid, } 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 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replace.js","sourceRoot":"","sources":["../../../../src/local/store/snapshot/replace.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,2BAA2B,GAC5B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAuB,MAAM,aAAa,CAAC;AAC1F,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEvD,MAAM,UAAU,0BAA0B,CAAC,QAAsB,EAAE,YAAoB;IACrF,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,sFAAsF,CAAC,EAAE,YAAY,CAAE,EAAE,CAAC;QACnJ,qBAAqB,CACnB,QAAQ,EACR,YAAY,EACZ,GAAG,CAAC,cAAwB,EAC5B,GAAG,CAAC,aAAuB,EAC3B,oBAAoB,CACrB,CAAC;IACJ,CAAC;IACD,KAAK,MAAM,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,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,gC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