@paradigma-inc/flywheel 0.1.111 → 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 +79 -13
- 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/getting-started/flywheel-tutorial-overview.md +1 -1
- 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/how-can-i-get-an-authorized-client_id-for-the-oauth-flow.md +12 -4
- package/skills/flywheel/setting-up-flywheel/installation-overview.md +2 -6
- package/skills/flywheel/setting-up-flywheel/other-hosts-installation.md +53 -26
- 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 +83 -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/_browser-handoff.js +36 -14
- package/src/runtime/vendor/flywheel-cli-dist/commands/_browser-handoff.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/_open-url.js +15 -6
- package/src/runtime/vendor/flywheel-cli-dist/commands/_open-url.js.map +1 -1
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-create.js +256 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-create.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-delete.js +11 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-delete.js.map +1 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-login.js +84 -0
- package/src/runtime/vendor/flywheel-cli-dist/commands/admin-test-users-login.js.map +1 -0
- 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 +239 -263
- 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 +237 -66
- 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 -302
- 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 +252 -254
- 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 -21
- 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/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,278 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { existsSync, lstatSync, mkdirSync } from "node:fs";
|
|
3
|
+
import { DatabaseSync } from "node:sqlite";
|
|
4
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
5
|
+
import { close, fstat, fsync, listDirectory, mkdirAt, openDirectoryAt, renameExchangeAt, renameNoReplaceAt, renameReplaceAt, rmdirAt, statAt, unlinkAt, } from "../../fs/native.js";
|
|
6
|
+
import { replaceClientIdAtVersion, validateRepositoryAtVersion } from "../migration/steps.js";
|
|
7
|
+
import { reachableObjectDigestsIn } from "../gc.js";
|
|
8
|
+
import { RepositoryBackupError, extractArchive, verifyArchive } from "./archive.js";
|
|
9
|
+
import { RetainedPrivateDirectory } from "./retained-directory.js";
|
|
10
|
+
const DIRECTORY_TYPE = 0o040000;
|
|
11
|
+
const FILE_TYPE_MASK = 0o170000;
|
|
12
|
+
const PRIVATE_DIRECTORY_MODE = 0o700;
|
|
13
|
+
function restoreError(code, cause) {
|
|
14
|
+
return new RepositoryBackupError(code, cause === undefined ? undefined : { cause });
|
|
15
|
+
}
|
|
16
|
+
function sameIdentity(left, right) {
|
|
17
|
+
return left.dev === right.dev && left.ino === right.ino;
|
|
18
|
+
}
|
|
19
|
+
function isDirectory(stat) {
|
|
20
|
+
return (stat.mode & FILE_TYPE_MASK) === DIRECTORY_TYPE;
|
|
21
|
+
}
|
|
22
|
+
function relativePath(value, fallback) {
|
|
23
|
+
const path = value ?? fallback;
|
|
24
|
+
if (path.length === 0 || path.startsWith("/") || path.split("/").some(part => part === "." || part === ".." || part.length === 0)) {
|
|
25
|
+
throw restoreError("repository_restore_target_invalid");
|
|
26
|
+
}
|
|
27
|
+
return path;
|
|
28
|
+
}
|
|
29
|
+
function targetIdentity(parentFd, targetName) {
|
|
30
|
+
try {
|
|
31
|
+
const entry = statAt(parentFd, targetName);
|
|
32
|
+
if (!isDirectory(entry))
|
|
33
|
+
throw restoreError("repository_restore_target_invalid");
|
|
34
|
+
let targetFd = -1;
|
|
35
|
+
try {
|
|
36
|
+
targetFd = openDirectoryAt(parentFd, targetName);
|
|
37
|
+
if (!sameIdentity(fstat(targetFd), entry) || listDirectory(targetFd).length !== 0) {
|
|
38
|
+
throw restoreError("repository_restore_target_not_empty");
|
|
39
|
+
}
|
|
40
|
+
return entry;
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
if (targetFd >= 0)
|
|
44
|
+
close(targetFd);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
if (typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")
|
|
49
|
+
return undefined;
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function sameManifestObjects(manifest, digests) {
|
|
54
|
+
return JSON.stringify(manifest.objects.map(entry => entry.digest).sort()) === JSON.stringify([...digests].sort());
|
|
55
|
+
}
|
|
56
|
+
function reachableObjectDigests(databasePath, repositoryId) {
|
|
57
|
+
let database;
|
|
58
|
+
try {
|
|
59
|
+
database = new DatabaseSync(databasePath, { allowExtension: false, defensive: true, readOnly: true });
|
|
60
|
+
return reachableObjectDigestsIn(database, repositoryId).map(digest => digest.slice("sha256:".length));
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
throw restoreError("repository_restore_database_invalid", error);
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
database?.close();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function validateExtractedDatabase(path, manifest) {
|
|
70
|
+
try {
|
|
71
|
+
validateRepositoryAtVersion(path, manifest.repositoryId, manifest.repositoryUserVersion);
|
|
72
|
+
if (!sameManifestObjects(manifest, reachableObjectDigests(path, manifest.repositoryId))) {
|
|
73
|
+
throw restoreError("repository_restore_database_invalid");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
if (error instanceof RepositoryBackupError)
|
|
78
|
+
throw error;
|
|
79
|
+
throw restoreError("repository_restore_database_invalid", error);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function openDirectoryAtOrCreate(parentFd, name) {
|
|
83
|
+
try {
|
|
84
|
+
mkdirAt(parentFd, name, PRIVATE_DIRECTORY_MODE);
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
if (!(typeof error === "object" && error !== null && "code" in error && error.code === "EEXIST"))
|
|
88
|
+
throw error;
|
|
89
|
+
}
|
|
90
|
+
const directory = openDirectoryAt(parentFd, name);
|
|
91
|
+
if (!isDirectory(fstat(directory))) {
|
|
92
|
+
close(directory);
|
|
93
|
+
throw restoreError("repository_restore_target_invalid");
|
|
94
|
+
}
|
|
95
|
+
return directory;
|
|
96
|
+
}
|
|
97
|
+
function moveIntoLayout(staging, sourceName, destination) {
|
|
98
|
+
const parts = destination.split("/");
|
|
99
|
+
if (parts.length === 1 && parts[0] === sourceName)
|
|
100
|
+
return;
|
|
101
|
+
const directories = [];
|
|
102
|
+
let parentFd = staging.fd;
|
|
103
|
+
try {
|
|
104
|
+
for (const name of parts.slice(0, -1)) {
|
|
105
|
+
parentFd = openDirectoryAtOrCreate(parentFd, name);
|
|
106
|
+
directories.push(parentFd);
|
|
107
|
+
}
|
|
108
|
+
renameReplaceAt(staging.fd, sourceName, parentFd, parts.at(-1));
|
|
109
|
+
for (let index = directories.length - 1; index >= 0; index -= 1)
|
|
110
|
+
fsync(directories[index]);
|
|
111
|
+
}
|
|
112
|
+
finally {
|
|
113
|
+
for (let index = directories.length - 1; index >= 0; index -= 1)
|
|
114
|
+
close(directories[index]);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function closeDirectory(fd) {
|
|
118
|
+
if (fd >= 0)
|
|
119
|
+
close(fd);
|
|
120
|
+
}
|
|
121
|
+
/** Restores a verified archive without acquiring the outer bootstrap or writer lock. */
|
|
122
|
+
export async function restoreRepositoryArchive(archivePath, targetPath, options = {}) {
|
|
123
|
+
const archive = resolve(archivePath);
|
|
124
|
+
const target = resolve(targetPath);
|
|
125
|
+
const databaseRelativePath = relativePath(options.databaseRelativePath, "db.sqlite");
|
|
126
|
+
const objectsRelativePath = relativePath(options.objectsRelativePath, "objects");
|
|
127
|
+
if (!existsSync(archive) || lstatSync(archive).isSymbolicLink())
|
|
128
|
+
throw restoreError("repository_restore_archive_invalid");
|
|
129
|
+
if (existsSync(target) && (!lstatSync(target).isDirectory() || lstatSync(target).isSymbolicLink())) {
|
|
130
|
+
throw restoreError("repository_restore_target_invalid");
|
|
131
|
+
}
|
|
132
|
+
try {
|
|
133
|
+
mkdirSync(dirname(target), { recursive: true, mode: PRIVATE_DIRECTORY_MODE });
|
|
134
|
+
if (lstatSync(dirname(target)).isSymbolicLink())
|
|
135
|
+
throw restoreError("repository_restore_target_invalid");
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
if (error instanceof RepositoryBackupError)
|
|
139
|
+
throw error;
|
|
140
|
+
throw restoreError("repository_restore_target_invalid", error);
|
|
141
|
+
}
|
|
142
|
+
const manifest = await verifyArchive(archive);
|
|
143
|
+
if (options.expectedRepositoryId !== undefined && manifest.repositoryId !== options.expectedRepositoryId) {
|
|
144
|
+
throw restoreError("repository_restore_repository_mismatch");
|
|
145
|
+
}
|
|
146
|
+
const staging = RetainedPrivateDirectory.create(dirname(target), ".flywheel-restore-");
|
|
147
|
+
try {
|
|
148
|
+
const targetName = basename(target);
|
|
149
|
+
const previousTarget = targetIdentity(staging.parentFd, targetName);
|
|
150
|
+
await extractArchive(archive, staging.path, manifest);
|
|
151
|
+
const databasePath = join(staging.path, "db.sqlite");
|
|
152
|
+
validateExtractedDatabase(databasePath, manifest);
|
|
153
|
+
const clientId = randomUUID();
|
|
154
|
+
replaceClientIdAtVersion(databasePath, manifest.repositoryId, clientId, manifest.repositoryUserVersion);
|
|
155
|
+
moveIntoLayout(staging, "db.sqlite", databaseRelativePath);
|
|
156
|
+
moveIntoLayout(staging, "objects", objectsRelativePath);
|
|
157
|
+
await options.prepareExtractedRepository?.(staging.path);
|
|
158
|
+
fsync(staging.fd);
|
|
159
|
+
staging.assertCurrent("repository_restore_staging_replaced");
|
|
160
|
+
const current = targetIdentity(staging.parentFd, targetName);
|
|
161
|
+
if (current === undefined && previousTarget !== undefined || current !== undefined && previousTarget === undefined ||
|
|
162
|
+
current !== undefined && previousTarget !== undefined && !sameIdentity(current, previousTarget)) {
|
|
163
|
+
throw restoreError("repository_restore_target_replaced");
|
|
164
|
+
}
|
|
165
|
+
if (previousTarget === undefined) {
|
|
166
|
+
renameNoReplaceAt(staging.parentFd, staging.name, staging.parentFd, targetName);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
renameExchangeAt(staging.parentFd, staging.name, staging.parentFd, targetName);
|
|
170
|
+
const oldTarget = statAt(staging.parentFd, staging.name);
|
|
171
|
+
if (!sameIdentity(oldTarget, previousTarget))
|
|
172
|
+
throw restoreError("repository_restore_target_replaced");
|
|
173
|
+
try {
|
|
174
|
+
rmdirAt(staging.parentFd, staging.name);
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
try {
|
|
178
|
+
if (!sameIdentity(statAt(staging.parentFd, staging.name), previousTarget))
|
|
179
|
+
throw restoreError("repository_restore_target_replaced");
|
|
180
|
+
renameExchangeAt(staging.parentFd, staging.name, staging.parentFd, targetName);
|
|
181
|
+
if (!sameIdentity(statAt(staging.parentFd, targetName), previousTarget))
|
|
182
|
+
throw restoreError("repository_restore_rollback_failed");
|
|
183
|
+
if (!sameIdentity(statAt(staging.parentFd, staging.name), fstat(staging.fd)))
|
|
184
|
+
throw restoreError("repository_restore_rollback_failed");
|
|
185
|
+
}
|
|
186
|
+
catch (rollbackError) {
|
|
187
|
+
throw restoreError("repository_restore_rollback_failed", rollbackError);
|
|
188
|
+
}
|
|
189
|
+
if (typeof error === "object" && error !== null && "code" in error && (error.code === "EEXIST" || error.code === "ENOTEMPTY")) {
|
|
190
|
+
throw restoreError("repository_restore_target_not_empty", error);
|
|
191
|
+
}
|
|
192
|
+
throw restoreError("repository_restore_activation_failed", error);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
fsync(staging.parentFd);
|
|
196
|
+
staging.assertParentCurrent("repository_restore_target_parent_replaced");
|
|
197
|
+
staging.transfer();
|
|
198
|
+
return { path: target, repositoryId: manifest.repositoryId, clientId };
|
|
199
|
+
}
|
|
200
|
+
finally {
|
|
201
|
+
staging.finish();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
export async function restoreRepositoryForMigration(archivePath, state, options) {
|
|
205
|
+
const manifest = await verifyArchive(archivePath);
|
|
206
|
+
if (manifest.repositoryId !== options.expectedRepositoryId)
|
|
207
|
+
throw restoreError("repository_restore_repository_mismatch");
|
|
208
|
+
const staging = RetainedPrivateDirectory.create(state.statePath, ".flywheel-migration-restore-");
|
|
209
|
+
try {
|
|
210
|
+
await extractArchive(archivePath, staging.path, manifest);
|
|
211
|
+
staging.assertCurrent("repository_restore_staging_replaced");
|
|
212
|
+
options.validateSnapshot(join(staging.path, "db.sqlite"), options.expectedRepositoryId);
|
|
213
|
+
state.assertValid();
|
|
214
|
+
for (const suffix of ["-wal", "-shm"]) {
|
|
215
|
+
try {
|
|
216
|
+
unlinkAt(state.stateFd, `db.sqlite${suffix}`);
|
|
217
|
+
}
|
|
218
|
+
catch (error) {
|
|
219
|
+
if (!(typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT"))
|
|
220
|
+
throw error;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
let rollbackFd = -1;
|
|
224
|
+
let movedDatabase = false;
|
|
225
|
+
let movedObjects = false;
|
|
226
|
+
let installedDatabase = false;
|
|
227
|
+
let installedObjects = false;
|
|
228
|
+
try {
|
|
229
|
+
mkdirAt(staging.fd, "rollback", PRIVATE_DIRECTORY_MODE);
|
|
230
|
+
rollbackFd = openDirectoryAt(staging.fd, "rollback");
|
|
231
|
+
renameReplaceAt(state.stateFd, "db.sqlite", rollbackFd, "db.sqlite");
|
|
232
|
+
movedDatabase = true;
|
|
233
|
+
try {
|
|
234
|
+
renameReplaceAt(state.stateFd, "objects", rollbackFd, "objects");
|
|
235
|
+
movedObjects = true;
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
if (!(typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT"))
|
|
239
|
+
throw error;
|
|
240
|
+
}
|
|
241
|
+
renameReplaceAt(staging.fd, "db.sqlite", state.stateFd, "db.sqlite");
|
|
242
|
+
installedDatabase = true;
|
|
243
|
+
renameReplaceAt(staging.fd, "objects", state.stateFd, "objects");
|
|
244
|
+
installedObjects = true;
|
|
245
|
+
fsync(state.stateFd);
|
|
246
|
+
options.validateSnapshot(join(state.statePath, "db.sqlite"), options.expectedRepositoryId);
|
|
247
|
+
state.assertValid();
|
|
248
|
+
}
|
|
249
|
+
catch (error) {
|
|
250
|
+
try {
|
|
251
|
+
if (installedObjects)
|
|
252
|
+
renameReplaceAt(state.stateFd, "objects", staging.fd, "failed-objects");
|
|
253
|
+
if (installedDatabase)
|
|
254
|
+
renameReplaceAt(state.stateFd, "db.sqlite", staging.fd, "failed-db.sqlite");
|
|
255
|
+
if (movedDatabase)
|
|
256
|
+
renameReplaceAt(rollbackFd, "db.sqlite", state.stateFd, "db.sqlite");
|
|
257
|
+
if (movedObjects)
|
|
258
|
+
renameReplaceAt(rollbackFd, "objects", state.stateFd, "objects");
|
|
259
|
+
if (movedDatabase)
|
|
260
|
+
fsync(state.stateFd);
|
|
261
|
+
if (movedDatabase)
|
|
262
|
+
options.validateSnapshot(join(state.statePath, "db.sqlite"), options.expectedRepositoryId);
|
|
263
|
+
state.assertValid();
|
|
264
|
+
}
|
|
265
|
+
catch (rollbackError) {
|
|
266
|
+
throw restoreError("repository_restore_rollback_failed", rollbackError);
|
|
267
|
+
}
|
|
268
|
+
throw restoreError("repository_restore_activation_failed", error);
|
|
269
|
+
}
|
|
270
|
+
finally {
|
|
271
|
+
closeDirectory(rollbackFd);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
finally {
|
|
275
|
+
staging.finish();
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
//# sourceMappingURL=restore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restore.js","sourceRoot":"","sources":["../../../../src/local/store/backup/restore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE7D,OAAO,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,a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node:path";
|
|
3
|
+
import { close, fstat, fsync, listDirectory, mkdirAt, openDirectory, openDirectoryAt, rmdirAt, statAt, unlinkAt, } from "../../fs/native.js";
|
|
4
|
+
import { RepositoryBackupError } from "./archive.js";
|
|
5
|
+
const DIRECTORY_TYPE = 0o040000;
|
|
6
|
+
const FILE_TYPE_MASK = 0o170000;
|
|
7
|
+
const PRIVATE_DIRECTORY_MODE = 0o700;
|
|
8
|
+
function sameIdentity(left, right) {
|
|
9
|
+
return left.dev === right.dev && left.ino === right.ino;
|
|
10
|
+
}
|
|
11
|
+
function isDirectory(stat) {
|
|
12
|
+
return (stat.mode & FILE_TYPE_MASK) === DIRECTORY_TYPE;
|
|
13
|
+
}
|
|
14
|
+
function backupError(code, cause) {
|
|
15
|
+
return new RepositoryBackupError(code, cause === undefined ? undefined : { cause });
|
|
16
|
+
}
|
|
17
|
+
/** A private directory pinned to the parent and child directory entries that created it. */
|
|
18
|
+
export class RetainedPrivateDirectory {
|
|
19
|
+
parentPath;
|
|
20
|
+
path;
|
|
21
|
+
parentFd;
|
|
22
|
+
fd;
|
|
23
|
+
name;
|
|
24
|
+
#parentIdentity;
|
|
25
|
+
#identity;
|
|
26
|
+
#transferred = false;
|
|
27
|
+
constructor(parentPath, parentFd, name, fd) {
|
|
28
|
+
this.parentPath = parentPath;
|
|
29
|
+
this.parentFd = parentFd;
|
|
30
|
+
this.name = name;
|
|
31
|
+
this.fd = fd;
|
|
32
|
+
this.path = `${parentPath}/${name}`;
|
|
33
|
+
this.#parentIdentity = fstat(parentFd);
|
|
34
|
+
this.#identity = fstat(fd);
|
|
35
|
+
this.assertCurrent("repository_backup_staging_replaced");
|
|
36
|
+
}
|
|
37
|
+
static create(parentPath, prefix) {
|
|
38
|
+
const absoluteParent = resolve(parentPath);
|
|
39
|
+
let parentFd = -1;
|
|
40
|
+
let directoryFd = -1;
|
|
41
|
+
try {
|
|
42
|
+
parentFd = openDirectory(absoluteParent);
|
|
43
|
+
for (let attempt = 0; attempt < 16; attempt += 1) {
|
|
44
|
+
const name = `${prefix}${randomUUID().replaceAll("-", "")}`;
|
|
45
|
+
try {
|
|
46
|
+
mkdirAt(parentFd, name, PRIVATE_DIRECTORY_MODE);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
if (typeof error === "object" && error !== null && "code" in error && error.code === "EEXIST")
|
|
50
|
+
continue;
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
directoryFd = openDirectoryAt(parentFd, name);
|
|
55
|
+
return new RetainedPrivateDirectory(absoluteParent, parentFd, name, directoryFd);
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
if (directoryFd >= 0)
|
|
59
|
+
close(directoryFd);
|
|
60
|
+
directoryFd = -1;
|
|
61
|
+
try {
|
|
62
|
+
rmdirAt(parentFd, name);
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
// The original retained-directory failure is more useful to callers.
|
|
66
|
+
}
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
throw backupError("repository_backup_staging_name_collision");
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
if (directoryFd >= 0)
|
|
74
|
+
close(directoryFd);
|
|
75
|
+
if (parentFd >= 0)
|
|
76
|
+
close(parentFd);
|
|
77
|
+
if (error instanceof RepositoryBackupError)
|
|
78
|
+
throw error;
|
|
79
|
+
throw backupError("repository_backup_location_unsupported", error);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
assertCurrent(errorCode) {
|
|
83
|
+
try {
|
|
84
|
+
this.assertParentCurrent(errorCode);
|
|
85
|
+
this.#assertRetainedIdentity(errorCode);
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
if (error instanceof RepositoryBackupError)
|
|
89
|
+
throw error;
|
|
90
|
+
throw backupError(errorCode, error);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
#assertRetainedIdentity(errorCode) {
|
|
94
|
+
const entry = statAt(this.parentFd, this.name);
|
|
95
|
+
const opened = fstat(this.fd);
|
|
96
|
+
if (!sameIdentity(fstat(this.parentFd), this.#parentIdentity) ||
|
|
97
|
+
!isDirectory(entry) || !sameIdentity(entry, this.#identity) ||
|
|
98
|
+
!isDirectory(opened) || !sameIdentity(opened, this.#identity)) {
|
|
99
|
+
throw backupError(errorCode);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
assertParentCurrent(errorCode) {
|
|
103
|
+
let currentParentFd = -1;
|
|
104
|
+
try {
|
|
105
|
+
currentParentFd = openDirectory(this.parentPath);
|
|
106
|
+
const current = fstat(currentParentFd);
|
|
107
|
+
if (!isDirectory(current) || !sameIdentity(current, this.#parentIdentity) ||
|
|
108
|
+
!sameIdentity(fstat(this.parentFd), this.#parentIdentity)) {
|
|
109
|
+
throw backupError(errorCode);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
if (error instanceof RepositoryBackupError)
|
|
114
|
+
throw error;
|
|
115
|
+
throw backupError(errorCode, error);
|
|
116
|
+
}
|
|
117
|
+
finally {
|
|
118
|
+
if (currentParentFd >= 0)
|
|
119
|
+
close(currentParentFd);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
transfer() {
|
|
123
|
+
this.#transferred = true;
|
|
124
|
+
}
|
|
125
|
+
#removeContents(directoryFd) {
|
|
126
|
+
for (const name of listDirectory(directoryFd)) {
|
|
127
|
+
this.#assertRetainedIdentity("repository_backup_staging_replaced");
|
|
128
|
+
const entry = statAt(directoryFd, name);
|
|
129
|
+
if (!isDirectory(entry)) {
|
|
130
|
+
unlinkAt(directoryFd, name);
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
const childFd = openDirectoryAt(directoryFd, name);
|
|
134
|
+
try {
|
|
135
|
+
if (!sameIdentity(entry, fstat(childFd)))
|
|
136
|
+
throw backupError("repository_backup_staging_replaced");
|
|
137
|
+
this.#removeContents(childFd);
|
|
138
|
+
if (!sameIdentity(entry, statAt(directoryFd, name)))
|
|
139
|
+
throw backupError("repository_backup_staging_replaced");
|
|
140
|
+
rmdirAt(directoryFd, name);
|
|
141
|
+
}
|
|
142
|
+
finally {
|
|
143
|
+
close(childFd);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
finish() {
|
|
148
|
+
let failure;
|
|
149
|
+
if (!this.#transferred) {
|
|
150
|
+
try {
|
|
151
|
+
this.assertParentCurrent("repository_backup_location_replaced");
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
failure = error;
|
|
155
|
+
}
|
|
156
|
+
try {
|
|
157
|
+
this.#assertRetainedIdentity("repository_backup_staging_replaced");
|
|
158
|
+
this.#removeContents(this.fd);
|
|
159
|
+
this.#assertRetainedIdentity("repository_backup_staging_replaced");
|
|
160
|
+
rmdirAt(this.parentFd, this.name);
|
|
161
|
+
fsync(this.parentFd);
|
|
162
|
+
this.assertParentCurrent("repository_backup_location_replaced");
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
if (!(typeof error === "object" && error !== null && "code" in error && error.code === "ENOENT")) {
|
|
166
|
+
failure ??= error;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
try {
|
|
171
|
+
close(this.fd);
|
|
172
|
+
}
|
|
173
|
+
catch (error) {
|
|
174
|
+
failure ??= error;
|
|
175
|
+
}
|
|
176
|
+
try {
|
|
177
|
+
close(this.parentFd);
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
failure ??= error;
|
|
181
|
+
}
|
|
182
|
+
if (failure !== undefined)
|
|
183
|
+
throw failure;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
export function destinationName(path) {
|
|
187
|
+
const name = basename(path);
|
|
188
|
+
if (name.length === 0 || name === "." || name === "..")
|
|
189
|
+
throw backupError("repository_backup_location_unsupported");
|
|
190
|
+
return name;
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=retained-directory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retained-directory.js","sourceRoot":"","sources":["../../../../src/local/store/backup/retained-directory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,aAAa,EACb,OAAO,EACP,aAAa,EACb,eAAe,EACf,OAAO,EACP,MAAM,EAEN,QAAQ,GACT,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,MAAM,cAAc,GAAG,QAAQ,CAAC;AAChC,MAAM,cAAc,GAAG,QAAQ,CAAC;AAChC,MAAM,sBAAsB,GAAG,KAAK,CAAC;AAErC,SAAS,YAAY,CAAC,IAAoB,EAAE,KAAqB;IAC/D,OAAO,IAAI,CAAC,GAAG,KAAK,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,KAAK,KAAK,CAAC,GAAG,CAAC;AAC1D,CAAC;AAED,SAAS,WAAW,CAAC,IAAoB;IACvC,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC,KAAK,cAAc,CAAC;AACzD,CAAC;AAED,SAAS,WAAW,CAAC,IAAY,EAAE,KAAe;IAChD,OAAO,IAAI,qBAAqB,CAAC,IAAI,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AACtF,CAAC;AAED,4FAA4F;AAC5F,MAAM,OAAO,wBAAwB;IAC1B,UAAU,CAAS;IACnB,IAAI,CAAS;IACb,QAAQ,CAAS;IACjB,EAAE,CAAS;IACX,IAAI,CAAS;IACb,eAAe,CAAiB;IAChC,SAAS,CAAiB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d,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { RepositoryCommit } from "../domain/models/commits.js";
|
|
2
|
+
import { isDigest } from "../domain/models/constants.js";
|
|
3
|
+
import { canonicalBytes, parseRepositoryJson } from "../domain/models/encoding.js";
|
|
4
|
+
import { RepositoryContractError } from "../domain/errors.js";
|
|
5
|
+
import { LatestValueWrite } from "./contract.js";
|
|
6
|
+
import { RepositoryStoreError } from "./sqlite/errors.js";
|
|
7
|
+
import { getRow, runSql } from "./sqlite/rows.js";
|
|
8
|
+
export function workspaceHeadIn(database, repositoryId) {
|
|
9
|
+
const row = getRow(database.prepare("SELECT workspace_head_commit_id FROM repository_heads WHERE repository_id = ?"), repositoryId);
|
|
10
|
+
if (row === undefined || row.workspace_head_commit_id === null)
|
|
11
|
+
return null;
|
|
12
|
+
if (!isDigest(row.workspace_head_commit_id))
|
|
13
|
+
throw new RepositoryStoreError("repository workspace is corrupt");
|
|
14
|
+
return row.workspace_head_commit_id;
|
|
15
|
+
}
|
|
16
|
+
function storedCommit(commitId, raw) {
|
|
17
|
+
if (!isDigest(commitId) || !(raw instanceof Uint8Array))
|
|
18
|
+
throw new RepositoryStoreError("stored commit is corrupt");
|
|
19
|
+
try {
|
|
20
|
+
return RepositoryCommit.fromCanonicalBytes(commitId, raw);
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
if (!(error instanceof RepositoryContractError))
|
|
24
|
+
throw error;
|
|
25
|
+
throw new RepositoryStoreError("stored commit is corrupt", { cause: error });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export function loadCommitByOperationId(database, repositoryId, operationId) {
|
|
29
|
+
const row = getRow(database.prepare("SELECT commits.commit_id, commits.canonical_bytes FROM repository_operations AS operations " +
|
|
30
|
+
"JOIN repository_commits AS commits ON commits.repository_id = operations.repository_id " +
|
|
31
|
+
"AND commits.commit_id = operations.commit_id WHERE operations.repository_id = ? AND operations.operation_id = ?"), repositoryId, operationId);
|
|
32
|
+
if (row === undefined)
|
|
33
|
+
return null;
|
|
34
|
+
const commit = storedCommit(row.commit_id, row.canonical_bytes);
|
|
35
|
+
if (commit.repositoryId !== repositoryId || !commit.operations.some(operation => operation.operationId === operationId)) {
|
|
36
|
+
throw new RepositoryStoreError("stored operation identity is corrupt");
|
|
37
|
+
}
|
|
38
|
+
return commit;
|
|
39
|
+
}
|
|
40
|
+
export function listCommitsIn(database, repositoryId, atHead, afterCommitId, limit) {
|
|
41
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > 256)
|
|
42
|
+
throw new RepositoryStoreError("commit page limit is unsafe");
|
|
43
|
+
if (afterCommitId !== null && !isDigest(afterCommitId))
|
|
44
|
+
throw new RepositoryStoreError("commit continuation is invalid");
|
|
45
|
+
if (atHead !== workspaceHeadIn(database, repositoryId))
|
|
46
|
+
throw new RepositoryStoreError("repository snapshot changed");
|
|
47
|
+
let current = atHead;
|
|
48
|
+
let afterReached = afterCommitId === null;
|
|
49
|
+
const seen = new Set();
|
|
50
|
+
const commits = [];
|
|
51
|
+
while (current !== null) {
|
|
52
|
+
if (seen.has(current))
|
|
53
|
+
throw new RepositoryStoreError("stored commit history is cyclic");
|
|
54
|
+
seen.add(current);
|
|
55
|
+
const row = getRow(database.prepare("SELECT canonical_bytes FROM repository_commits WHERE repository_id = ? AND commit_id = ?"), repositoryId, current);
|
|
56
|
+
if (row === undefined)
|
|
57
|
+
throw new RepositoryStoreError("stored commit parent is missing or cross-repository");
|
|
58
|
+
const commit = storedCommit(current, row.canonical_bytes);
|
|
59
|
+
if (commit.repositoryId !== repositoryId)
|
|
60
|
+
throw new RepositoryStoreError("stored commit is cross-repository");
|
|
61
|
+
if (afterReached) {
|
|
62
|
+
if (commits.length === limit)
|
|
63
|
+
return { commits, nextCommitId: commits[commits.length - 1].commitId };
|
|
64
|
+
commits.push(commit);
|
|
65
|
+
}
|
|
66
|
+
else if (commit.commitId === afterCommitId)
|
|
67
|
+
afterReached = true;
|
|
68
|
+
current = commit.parentCommitId;
|
|
69
|
+
}
|
|
70
|
+
if (!afterReached)
|
|
71
|
+
throw new RepositoryStoreError("commit continuation is outside reachable history");
|
|
72
|
+
return { commits, nextCommitId: null };
|
|
73
|
+
}
|
|
74
|
+
export function commitLatestValues(raw) {
|
|
75
|
+
try {
|
|
76
|
+
if (!(raw instanceof Uint8Array))
|
|
77
|
+
throw new TypeError("latest-value group must be bytes");
|
|
78
|
+
const decoded = parseRepositoryJson(new TextDecoder("utf-8", { fatal: true }).decode(raw));
|
|
79
|
+
if (!Array.isArray(decoded))
|
|
80
|
+
throw new TypeError("latest-value group must be an array");
|
|
81
|
+
const writes = decoded.map(LatestValueWrite.fromMapping);
|
|
82
|
+
if (!canonicalBytes(decoded).equals(raw))
|
|
83
|
+
throw new Error("latest-value group must be canonical");
|
|
84
|
+
return writes;
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
// The persisted group is an external boundary; reject invalid UTF-8, JSON, fields, or digests together.
|
|
88
|
+
throw new RepositoryStoreError("repository commit latest values are corrupt", { cause: error });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
export function canonicalLatestGroup(rawWrites) {
|
|
92
|
+
try {
|
|
93
|
+
return canonicalBytes(rawWrites.map(raw => LatestValueWrite.fromCanonicalBytes(raw).toMapping()));
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
throw new RepositoryStoreError("repository sync latest values are invalid", { cause: error });
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
export function persistCommit(database, commit, latestValueWrites, receivedAt) {
|
|
100
|
+
runSql(database.prepare(`
|
|
101
|
+
INSERT INTO repository_commits (
|
|
102
|
+
repository_id, commit_id, canonical_bytes, latest_values_bytes, committed_at
|
|
103
|
+
) VALUES (?, ?, ?, ?, ?)
|
|
104
|
+
`), commit.repositoryId, commit.commitId, commit.canonicalBytes, canonicalLatestGroup(latestValueWrites), receivedAt);
|
|
105
|
+
if (commit.parentCommitId !== null) {
|
|
106
|
+
runSql(database.prepare("INSERT INTO repository_commit_parents VALUES (?, ?, ?, 0)"), commit.repositoryId, commit.commitId, commit.parentCommitId);
|
|
107
|
+
}
|
|
108
|
+
for (const [position, operation] of commit.operations.entries()) {
|
|
109
|
+
if (operation.repositoryId !== commit.repositoryId)
|
|
110
|
+
throw new RepositoryStoreError("cross-repository operation");
|
|
111
|
+
runSql(database.prepare("INSERT INTO repository_operations VALUES (?, ?, ?, ?, ?)"), commit.repositoryId, commit.commitId, operation.operationId, position, operation.canonicalBytes);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=commits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commits.js","sourceRoot":"","sources":["../../../src/local/store/commits.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAmB,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,UAAU,eAAe,CAAC,QAAsB,EAAE,YAAoB;IAC1E,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,+EAA+E,CAAC,EAAE,YAAY,CAAC,CAAC;IACpI,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,CAAC,wBAAwB,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAC5E,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,wBAAwB,CAAC;QAAE,MAAM,IAAI,oBAAoB,CAAC,iCAAiC,CA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