@paradigma-inc/flywheel 0.1.115 → 0.1.135
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 +323 -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 +134 -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,207 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { RepositoryContractError } from "../errors.js";
|
|
3
|
+
import { foldArtifactPropertiesOperation, legacyArtifactMetadata } from "../models/artifact-properties.js";
|
|
4
|
+
import { RepositoryOperation } from "../models/operations.js";
|
|
5
|
+
import { valueDigest } from "../models/encoding.js";
|
|
6
|
+
import { LatestValueWrite } from "../../store/contract.js";
|
|
7
|
+
import { inverseMapping } from "./inverses.js";
|
|
8
|
+
const LATEST_ONLY = {
|
|
9
|
+
"node.field.set.v1": true,
|
|
10
|
+
"edge.field.set.v1": true,
|
|
11
|
+
"artifact.metadata.set.v1": true,
|
|
12
|
+
};
|
|
13
|
+
const EMPTY_ARTIFACT_PROPERTIES = new Map();
|
|
14
|
+
export class RepositoryRevertError extends Error {
|
|
15
|
+
name = "RepositoryRevertError";
|
|
16
|
+
}
|
|
17
|
+
function latestFieldIdentifier(operation) {
|
|
18
|
+
const payload = operation.payload;
|
|
19
|
+
switch (operation.type) {
|
|
20
|
+
case "node.field.set.v1":
|
|
21
|
+
return `node:${String(payload.node_id)}:${String(payload.field)}`;
|
|
22
|
+
case "edge.field.set.v1":
|
|
23
|
+
return `edge:${String(payload.edge_id)}:${String(payload.field)}`;
|
|
24
|
+
case "artifact.metadata.set.v1":
|
|
25
|
+
return `artifact:${String(payload.artifact_id)}:${String(payload.field)}`;
|
|
26
|
+
default:
|
|
27
|
+
throw new RepositoryRevertError("repository_revert_unsupported_operation");
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function inverseOperationId(requestOperationId, position) {
|
|
31
|
+
let normalized = requestOperationId.toLowerCase();
|
|
32
|
+
if (normalized.startsWith("urn:uuid:"))
|
|
33
|
+
normalized = normalized.slice("urn:uuid:".length);
|
|
34
|
+
normalized = normalized.replace(/[{}-]/g, "");
|
|
35
|
+
if (!/^[0-9a-f]{32}$/.test(normalized)) {
|
|
36
|
+
throw new RepositoryRevertError("repository operation identifier is invalid");
|
|
37
|
+
}
|
|
38
|
+
const raw = createHash("sha256")
|
|
39
|
+
.update("flywheel.revert-operation.v1\0")
|
|
40
|
+
.update(Buffer.from(normalized, "hex"))
|
|
41
|
+
.update(Buffer.from([(position >>> 24) & 0xff, (position >>> 16) & 0xff, (position >>> 8) & 0xff, position & 0xff]))
|
|
42
|
+
.digest()
|
|
43
|
+
.subarray(0, 16);
|
|
44
|
+
raw[6] = (raw[6] & 0x0f) | 0x40;
|
|
45
|
+
raw[8] = (raw[8] & 0x3f) | 0x80;
|
|
46
|
+
const hex = raw.toString("hex");
|
|
47
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
48
|
+
}
|
|
49
|
+
function collectLegacyMetadata(target, operation) {
|
|
50
|
+
if (operation.type !== "artifact.metadata.set.v1")
|
|
51
|
+
return;
|
|
52
|
+
const artifactId = operation.payload.artifact_id;
|
|
53
|
+
const field = operation.payload.field;
|
|
54
|
+
if (typeof artifactId !== "string" || typeof field !== "string") {
|
|
55
|
+
throw new RepositoryRevertError("repository_revert_retained_payload_missing");
|
|
56
|
+
}
|
|
57
|
+
const fields = target.get(artifactId) ?? new Map();
|
|
58
|
+
if (!target.has(artifactId))
|
|
59
|
+
target.set(artifactId, fields);
|
|
60
|
+
if (!fields.has(field))
|
|
61
|
+
fields.set(field, operation);
|
|
62
|
+
}
|
|
63
|
+
function retainLegacyMetadata(properties, currentProperties, metadataOperations) {
|
|
64
|
+
if (metadataOperations.size === 0)
|
|
65
|
+
return properties;
|
|
66
|
+
const currentMetadata = legacyArtifactMetadata(currentProperties);
|
|
67
|
+
let retained = properties;
|
|
68
|
+
for (const [field, operation] of metadataOperations) {
|
|
69
|
+
if (!Object.hasOwn(currentMetadata, field)) {
|
|
70
|
+
throw new RepositoryRevertError("repository_revert_retained_payload_missing");
|
|
71
|
+
}
|
|
72
|
+
const write = LatestValueWrite.fromMapping({
|
|
73
|
+
owner_type: "artifact",
|
|
74
|
+
owner_id: operation.payload.artifact_id,
|
|
75
|
+
field,
|
|
76
|
+
value: currentMetadata[field],
|
|
77
|
+
value_digest: valueDigest(currentMetadata[field]),
|
|
78
|
+
});
|
|
79
|
+
const folded = foldArtifactPropertiesOperation(retained, operation, new Map([[field, write]]));
|
|
80
|
+
if (folded === undefined)
|
|
81
|
+
throw new RepositoryRevertError("repository_revert_retained_payload_missing");
|
|
82
|
+
retained = folded;
|
|
83
|
+
}
|
|
84
|
+
return retained;
|
|
85
|
+
}
|
|
86
|
+
function propertyInverseValue(operation, current, prior, laterMetadata, pendingMetadata, laterProperties) {
|
|
87
|
+
const artifactId = operation.payload.artifact_id;
|
|
88
|
+
if (typeof artifactId !== "string" || laterProperties.has(artifactId))
|
|
89
|
+
return undefined;
|
|
90
|
+
const currentProperties = current.get(artifactId);
|
|
91
|
+
const properties = prior.get(operation.operationId);
|
|
92
|
+
if (currentProperties === undefined || properties === undefined)
|
|
93
|
+
return undefined;
|
|
94
|
+
return retainLegacyMetadata(properties, currentProperties, new Map([...(laterMetadata.get(artifactId) ?? []), ...(pendingMetadata.get(artifactId) ?? [])]));
|
|
95
|
+
}
|
|
96
|
+
export function buildRevertPlan(target, reachableHistory, requestOperationId, authoredAt, currentArtifactProperties = EMPTY_ARTIFACT_PROPERTIES, priorArtifactProperties = EMPTY_ARTIFACT_PROPERTIES) {
|
|
97
|
+
if (target.operations.some((operation) => operation.type === "imported_baseline.v1")) {
|
|
98
|
+
throw new RepositoryRevertError("repository_revert_baseline");
|
|
99
|
+
}
|
|
100
|
+
if (target.operations.some((operation) => operation.type === "node.purge.v1")) {
|
|
101
|
+
throw new RepositoryRevertError("repository_revert_contains_purge");
|
|
102
|
+
}
|
|
103
|
+
if (target.operations.some((operation) => operation.type === "edge.remove.v1")) {
|
|
104
|
+
throw new RepositoryRevertError("repository_revert_unsupported_operation");
|
|
105
|
+
}
|
|
106
|
+
const skippedLatestFields = target.operations
|
|
107
|
+
.filter((operation) => operation.type in LATEST_ONLY)
|
|
108
|
+
.map(latestFieldIdentifier);
|
|
109
|
+
const targetIndex = reachableHistory.findIndex((commit) => commit.commitId === target.commitId);
|
|
110
|
+
if (targetIndex < 0)
|
|
111
|
+
throw new RepositoryRevertError("repository_local_history_changed");
|
|
112
|
+
const historicalOperationIds = new Set(reachableHistory.flatMap((commit) => commit.operations.map((operation) => operation.operationId)));
|
|
113
|
+
const laterMetadata = new Map();
|
|
114
|
+
const laterProperties = new Set();
|
|
115
|
+
for (const commit of reachableHistory.slice(0, targetIndex)) {
|
|
116
|
+
for (const operation of commit.operations) {
|
|
117
|
+
collectLegacyMetadata(laterMetadata, operation);
|
|
118
|
+
if (operation.type === "artifact.properties.set.v1" && typeof operation.payload.artifact_id === "string") {
|
|
119
|
+
laterProperties.add(operation.payload.artifact_id);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const composedArtifactProperties = new Map();
|
|
124
|
+
const compositionProperties = {
|
|
125
|
+
get: (artifactId) => composedArtifactProperties.get(artifactId) ?? currentArtifactProperties.get(artifactId),
|
|
126
|
+
};
|
|
127
|
+
const compositionPendingMetadata = new Map();
|
|
128
|
+
for (let targetPosition = target.operations.length - 1; targetPosition >= 0; targetPosition--) {
|
|
129
|
+
const operation = target.operations[targetPosition];
|
|
130
|
+
if (operation.type in LATEST_ONLY) {
|
|
131
|
+
collectLegacyMetadata(compositionPendingMetadata, operation);
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if (operation.type !== "artifact.properties.set.v1")
|
|
135
|
+
continue;
|
|
136
|
+
const artifactId = operation.payload.artifact_id;
|
|
137
|
+
const properties = propertyInverseValue(operation, compositionProperties, priorArtifactProperties, laterMetadata, compositionPendingMetadata, laterProperties);
|
|
138
|
+
if (typeof artifactId === "string" && properties !== undefined) {
|
|
139
|
+
composedArtifactProperties.set(artifactId, properties);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
const revertedPropertiesByOperation = new Map();
|
|
143
|
+
for (const operation of target.operations) {
|
|
144
|
+
if (operation.type !== "artifact.properties.set.v1")
|
|
145
|
+
continue;
|
|
146
|
+
const artifactId = operation.payload.artifact_id;
|
|
147
|
+
if (typeof artifactId !== "string")
|
|
148
|
+
continue;
|
|
149
|
+
const properties = composedArtifactProperties.get(artifactId);
|
|
150
|
+
if (properties !== undefined)
|
|
151
|
+
revertedPropertiesByOperation.set(operation.operationId, properties);
|
|
152
|
+
}
|
|
153
|
+
const operations = [];
|
|
154
|
+
const latestValues = [];
|
|
155
|
+
const revertedArtifactProperties = new Map();
|
|
156
|
+
const inverseArtifactProperties = {
|
|
157
|
+
get: (artifactId) => revertedArtifactProperties.get(artifactId) ?? currentArtifactProperties.get(artifactId),
|
|
158
|
+
};
|
|
159
|
+
for (let targetPosition = target.operations.length - 1; targetPosition >= 0; targetPosition--) {
|
|
160
|
+
const operation = target.operations[targetPosition];
|
|
161
|
+
if (operation.type in LATEST_ONLY)
|
|
162
|
+
continue;
|
|
163
|
+
try {
|
|
164
|
+
const operationId = inverseOperationId(requestOperationId, operations.length);
|
|
165
|
+
const inverse = RepositoryOperation.fromMapping(inverseMapping(operation, operationId, {
|
|
166
|
+
target,
|
|
167
|
+
targetPosition,
|
|
168
|
+
history: reachableHistory,
|
|
169
|
+
targetIndex,
|
|
170
|
+
authoredAt,
|
|
171
|
+
currentArtifactProperties: inverseArtifactProperties,
|
|
172
|
+
revertedArtifactProperties: revertedPropertiesByOperation,
|
|
173
|
+
}));
|
|
174
|
+
if (historicalOperationIds.has(operationId)) {
|
|
175
|
+
throw new RepositoryRevertError("repository_local_history_changed");
|
|
176
|
+
}
|
|
177
|
+
operations.push(inverse);
|
|
178
|
+
if (operation.type === "artifact.properties.set.v1") {
|
|
179
|
+
const artifactId = operation.payload.artifact_id;
|
|
180
|
+
const properties = revertedPropertiesByOperation.get(operation.operationId) ??
|
|
181
|
+
priorArtifactProperties.get(operation.operationId);
|
|
182
|
+
if (typeof artifactId !== "string" || properties === undefined) {
|
|
183
|
+
throw new RepositoryRevertError("repository_revert_retained_payload_missing");
|
|
184
|
+
}
|
|
185
|
+
latestValues.push(LatestValueWrite.fromMapping({
|
|
186
|
+
owner_type: "artifact",
|
|
187
|
+
owner_id: artifactId,
|
|
188
|
+
field: "properties",
|
|
189
|
+
value: properties,
|
|
190
|
+
value_digest: valueDigest(properties),
|
|
191
|
+
}));
|
|
192
|
+
revertedArtifactProperties.set(artifactId, properties);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
if (error instanceof RepositoryContractError) {
|
|
197
|
+
throw new RepositoryRevertError("repository_revert_unsupported_operation");
|
|
198
|
+
}
|
|
199
|
+
throw error;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
if (operations.length === 0) {
|
|
203
|
+
throw new RepositoryRevertError("repository_revert_no_reversible_operations");
|
|
204
|
+
}
|
|
205
|
+
return { operations, latestValues, skippedLatestFields };
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../../../src/local/domain/revert/plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,u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C,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC;oBAC7C,UAAU,EAAE,UAAU;oBACtB,QAAQ,EAAE,UAAU;oBACpB,KAAK,EAAE,YAAY;oBACnB,KAAK,EAAE,UAAU;oBACjB,YAAY,EAAE,WAAW,CAAC,UAAU,CAAC;iBACtC,CAAC,CAAC,CAAC;gBACJ,0BAA0B,CAAC,GAAG,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;YACzD,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,uBAAuB,EAAE,CAAC;gBAC7C,MAAM,IAAI,qBAAqB,CAAC,yCAAyC,CAAC,CAAC;YAC7E,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IACD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,qBAAqB,CAAC,4CAA4C,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,mBAAmB,EAAE,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { RepositoryRevertError } from "./plan.js";
|
|
3
|
+
import { canonicalBytes } from "../models/encoding.js";
|
|
4
|
+
function historyTagId(scopeNodeId, tagId, index) {
|
|
5
|
+
const digest = createHash("sha256")
|
|
6
|
+
.update("flywheel.tag-history.v1\0")
|
|
7
|
+
.update(canonicalBytes([scopeNodeId, tagId, index]))
|
|
8
|
+
.digest("hex");
|
|
9
|
+
return `history:sha256:${digest}`;
|
|
10
|
+
}
|
|
11
|
+
function currentHistoryNextIndex(targetOperation, history) {
|
|
12
|
+
const targetNextIndex = targetOperation.payload.expected_history_next_index;
|
|
13
|
+
if ((typeof targetNextIndex !== "bigint" &&
|
|
14
|
+
(typeof targetNextIndex !== "number" || !Number.isSafeInteger(targetNextIndex))) ||
|
|
15
|
+
typeof targetNextIndex === "boolean") {
|
|
16
|
+
throw new RepositoryRevertError("repository_revert_unsupported_operation");
|
|
17
|
+
}
|
|
18
|
+
const scopeNodeId = targetOperation.payload.scope_node_id;
|
|
19
|
+
const tagId = targetOperation.payload.tag_id;
|
|
20
|
+
let result = typeof targetNextIndex === "bigint" ? targetNextIndex + 1n : targetNextIndex + 1;
|
|
21
|
+
for (const operations of history) {
|
|
22
|
+
for (const operation of operations) {
|
|
23
|
+
if (operation.type !== "node.tag.assign.v1" ||
|
|
24
|
+
operation.payload.assignment_mode !== "tracked_replacement" ||
|
|
25
|
+
operation.payload.scope_node_id !== scopeNodeId || operation.payload.tag_id !== tagId) {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
const index = operation.payload.expected_history_next_index;
|
|
29
|
+
if (typeof index === "bigint") {
|
|
30
|
+
const candidate = index + 1n;
|
|
31
|
+
if (BigInt(result) < candidate)
|
|
32
|
+
result = candidate;
|
|
33
|
+
}
|
|
34
|
+
else if (typeof index === "number" && Number.isSafeInteger(index)) {
|
|
35
|
+
const candidate = index + 1;
|
|
36
|
+
if (BigInt(result) < BigInt(candidate))
|
|
37
|
+
result = candidate;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
export function inverseTagAssignment(operation, inverseOperationId, context, baseMapping, copyPayload) {
|
|
44
|
+
const payload = operation.payload;
|
|
45
|
+
if (payload.assignment_mode === "initial") {
|
|
46
|
+
return {
|
|
47
|
+
...baseMapping(operation, inverseOperationId, "node.tag.remove.v1"),
|
|
48
|
+
scope_node_id: payload.scope_node_id,
|
|
49
|
+
node_id: payload.node_id,
|
|
50
|
+
tag_id: payload.tag_id,
|
|
51
|
+
expected_holder: payload.new_holder,
|
|
52
|
+
relation_metadata: payload.relation_metadata,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
if (payload.assignment_mode === "same_holder") {
|
|
56
|
+
return {
|
|
57
|
+
...baseMapping(operation, inverseOperationId, "node.tag.assign.v1"),
|
|
58
|
+
...copyPayload(operation, [
|
|
59
|
+
"scope_node_id", "node_id", "tag_id", "expected_holder", "new_holder", "assignment_mode", "relation_metadata",
|
|
60
|
+
]),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
if (payload.assignment_mode !== "tracked_replacement") {
|
|
64
|
+
throw new RepositoryRevertError("repository_revert_unsupported_operation");
|
|
65
|
+
}
|
|
66
|
+
const historyTag = payload.history_tag;
|
|
67
|
+
if (historyTag === null || typeof historyTag !== "object" || Array.isArray(historyTag) || JSON.isRawJSON(historyTag)) {
|
|
68
|
+
throw new RepositoryRevertError("repository_revert_unsupported_operation");
|
|
69
|
+
}
|
|
70
|
+
const historyTagMapping = historyTag;
|
|
71
|
+
const suffix = ` (history ${String(payload.history_index)})`;
|
|
72
|
+
const name = historyTagMapping.name;
|
|
73
|
+
if (typeof name !== "string" || !name.endsWith(suffix)) {
|
|
74
|
+
throw new RepositoryRevertError("repository_revert_unsupported_operation");
|
|
75
|
+
}
|
|
76
|
+
const nextIndex = currentHistoryNextIndex(operation, context.history.slice(0, context.targetIndex).map((commit) => commit.operations));
|
|
77
|
+
const scopeNodeId = payload.scope_node_id;
|
|
78
|
+
const tagId = payload.tag_id;
|
|
79
|
+
return {
|
|
80
|
+
...baseMapping(operation, inverseOperationId, "node.tag.assign.v1"),
|
|
81
|
+
scope_node_id: scopeNodeId,
|
|
82
|
+
node_id: payload.prior_holder,
|
|
83
|
+
tag_id: tagId,
|
|
84
|
+
expected_holder: payload.new_holder,
|
|
85
|
+
new_holder: payload.prior_holder,
|
|
86
|
+
assignment_mode: "tracked_replacement",
|
|
87
|
+
prior_holder: payload.new_holder,
|
|
88
|
+
expected_history_next_index: nextIndex,
|
|
89
|
+
history_entry_id: historyTagId(scopeNodeId, tagId, nextIndex),
|
|
90
|
+
history_index: nextIndex,
|
|
91
|
+
history_tag: {
|
|
92
|
+
name: `${name.slice(0, -suffix.length)} (history ${String(nextIndex)})`,
|
|
93
|
+
bg_color: historyTagMapping.bg_color,
|
|
94
|
+
text_color: historyTagMapping.text_color,
|
|
95
|
+
one_only: false,
|
|
96
|
+
track_history: false,
|
|
97
|
+
history_of_tag_id: tagId,
|
|
98
|
+
history_index: nextIndex,
|
|
99
|
+
history_next_index: 1,
|
|
100
|
+
created_at: context.authoredAt,
|
|
101
|
+
updated_at: context.authoredAt,
|
|
102
|
+
},
|
|
103
|
+
relation_metadata: {
|
|
104
|
+
source: "cli",
|
|
105
|
+
intent: `revert:${operation.operationId}`,
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=tag-inverses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag-inverses.js","sourceRoot":"","sources":["../../../../src/local/domain/revert/tag-inverses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAUvD,SAAS,YAAY,CAAC,WAAoB,EAAE,KAAc,EAAE,KAAsB;IAChF,MAAM,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC;SAChC,MAAM,CAAC,2BAA2B,CAAC;SACnC,MAAM,CAAC,cAAc,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;SACnD,MAAM,CAAC,KAAK,CAAC,CAAC;IACjB,OAAO,kBAAkB,MAAM,EAAE,CAAC;AACpC,CAAC;AAED,SAAS,uBAAuB,CAC9B,eAAoC,EACpC,OAAoD;IAEpD,MAAM,eAAe,GAAG,eAAe,CAAC,OAAO,CAAC,2BAA2B,CAAC;IAC5E,IAAI,CAAC,OAAO,eAAe,KAAK,QAAQ;QACtC,CAAC,OAAO,eAAe,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,aAAa,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C,UAAU,EAAE,iBAAiB,CAAC,UAAU;YACxC,QAAQ,EAAE,KAAK;YACf,aAAa,EAAE,KAAK;YACpB,iBAAiB,EAAE,KAAK;YACxB,aAAa,EAAE,SAAS;YACxB,kBAAkB,EAAE,CAAC;YACrB,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,UAAU,EAAE,OAAO,CAAC,UAAU;SAC/B;QACD,iBAAiB,EAAE;YACjB,MAAM,EAAE,KAAK;YACb,MAAM,EAAE,UAAU,SAAS,CAAC,WAAW,EAAE;SAC1C;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { RepositoryServiceError } from "../errors.js";
|
|
2
|
+
import { validateOrdinaryOperationBatch, RepositoryInvariantError } from "../invariants.js";
|
|
3
|
+
import { RepositoryCommit } from "../models/commits.js";
|
|
4
|
+
import { MAX_COMMIT_METADATA_BYTES } from "../models/constants.js";
|
|
5
|
+
import { artifactDigests, latestStateDigests, latestValueWrites } from "./writes.js";
|
|
6
|
+
function commitTimestamp(clock) {
|
|
7
|
+
const value = clock();
|
|
8
|
+
if (!(value instanceof Date) || Number.isNaN(value.valueOf())) {
|
|
9
|
+
throw new RepositoryServiceError("clock must return an aware datetime");
|
|
10
|
+
}
|
|
11
|
+
return value.toISOString().replace(/\.(\d{3})Z$/, ".$1000Z");
|
|
12
|
+
}
|
|
13
|
+
export async function commitStaged(store, repositoryId, clientId, expectedHead, stagingDigest, message, clock = () => new Date()) {
|
|
14
|
+
const workspace = await store.loadWorkspace(repositoryId);
|
|
15
|
+
if (workspace.localHeadCommitId !== expectedHead)
|
|
16
|
+
throw new RepositoryServiceError("repository head is stale");
|
|
17
|
+
if (workspace.staging.digest !== stagingDigest || workspace.staging.operations.length === 0) {
|
|
18
|
+
throw new RepositoryServiceError("staging digest is stale or empty");
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
validateOrdinaryOperationBatch(workspace.staging.operations, expectedHead);
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
if (error instanceof RepositoryInvariantError)
|
|
25
|
+
throw new RepositoryServiceError(error.message, { cause: error });
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
28
|
+
const commit = RepositoryCommit.create({
|
|
29
|
+
repositoryId,
|
|
30
|
+
operations: workspace.staging.operations,
|
|
31
|
+
parentCommitId: expectedHead,
|
|
32
|
+
authorKind: "client",
|
|
33
|
+
authorId: clientId,
|
|
34
|
+
authoredAt: commitTimestamp(clock),
|
|
35
|
+
message,
|
|
36
|
+
latestStateDigests: latestStateDigests(workspace.staging.operations),
|
|
37
|
+
artifactDigests: artifactDigests(workspace.staging.operations),
|
|
38
|
+
});
|
|
39
|
+
const writes = latestValueWrites(workspace.staging.operations, workspace.staging.latestValues);
|
|
40
|
+
const metadataBytes = commit.canonicalBytes.byteLength + writes.reduce((total, write) => total + write.byteLength, 0);
|
|
41
|
+
if (metadataBytes > MAX_COMMIT_METADATA_BYTES) {
|
|
42
|
+
throw new RepositoryServiceError("repository commit metadata exceeds limit");
|
|
43
|
+
}
|
|
44
|
+
const result = await store.applyAtomic({
|
|
45
|
+
repositoryId,
|
|
46
|
+
expectedHead,
|
|
47
|
+
canonicalCommits: [commit],
|
|
48
|
+
latestValueWrites: writes,
|
|
49
|
+
clearStaging: true,
|
|
50
|
+
localWorkspaceHead: commit.commitId,
|
|
51
|
+
syncState: null,
|
|
52
|
+
resultingHead: commit.commitId,
|
|
53
|
+
});
|
|
54
|
+
return {
|
|
55
|
+
commitId: commit.commitId,
|
|
56
|
+
head: result.head,
|
|
57
|
+
operationCount: commit.operations.length,
|
|
58
|
+
metadataBytes,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=commit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commit.js","sourceRoot":"","sources":["../../../../src/local/domain/service/commit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM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QACnC,SAAS,EAAE,IAAI;QACf,aAAa,EAAE,MAAM,CAAC,QAAQ;KAC/B,CAAC,CAAC;IACH,OAAO;QACL,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,cAAc,EAAE,MAAM,CAAC,UAAU,CAAC,MAAM;QACxC,aAAa;KACd,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { RepositoryServiceError } from "../errors.js";
|
|
2
|
+
import { isDigest } from "../models/constants.js";
|
|
3
|
+
/** A snapshot admitted only by the backup-verification boundary. */
|
|
4
|
+
export class VerifiedRepositorySnapshot {
|
|
5
|
+
snapshot;
|
|
6
|
+
#verified = true;
|
|
7
|
+
constructor(snapshot) {
|
|
8
|
+
this.snapshot = snapshot;
|
|
9
|
+
}
|
|
10
|
+
static fromVerifiedBackup(snapshot, sourceArchiveDigest) {
|
|
11
|
+
if (!isDigest(sourceArchiveDigest)) {
|
|
12
|
+
throw new RepositoryServiceError("verified snapshot archive digest is invalid");
|
|
13
|
+
}
|
|
14
|
+
return new VerifiedRepositorySnapshot(snapshot);
|
|
15
|
+
}
|
|
16
|
+
get repositoryId() {
|
|
17
|
+
return this.snapshot.repositoryId;
|
|
18
|
+
}
|
|
19
|
+
get headCommitId() {
|
|
20
|
+
return this.snapshot.headCommitId;
|
|
21
|
+
}
|
|
22
|
+
get verified() {
|
|
23
|
+
return this.#verified;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export async function rebuildProjections(store, repositoryId, expectedHead, authoritativeSnapshot) {
|
|
27
|
+
if (!(authoritativeSnapshot instanceof VerifiedRepositorySnapshot) || !authoritativeSnapshot.verified) {
|
|
28
|
+
throw new RepositoryServiceError("repository snapshot authority is invalid");
|
|
29
|
+
}
|
|
30
|
+
if (authoritativeSnapshot.repositoryId !== repositoryId || authoritativeSnapshot.headCommitId !== expectedHead) {
|
|
31
|
+
throw new RepositoryServiceError("repository snapshot identity is invalid");
|
|
32
|
+
}
|
|
33
|
+
return store.replaceProjection(repositoryId, expectedHead, authoritativeSnapshot.snapshot);
|
|
34
|
+
}
|
|
35
|
+
export async function validateSnapshot(store, repositoryId, atHead, snapshot) {
|
|
36
|
+
if (snapshot.repositoryId !== repositoryId || snapshot.headCommitId !== atHead) {
|
|
37
|
+
throw new RepositoryServiceError("repository snapshot identity is invalid");
|
|
38
|
+
}
|
|
39
|
+
const authoritative = await store.loadSnapshot(repositoryId, atHead);
|
|
40
|
+
return {
|
|
41
|
+
repositoryId,
|
|
42
|
+
headCommitId: atHead,
|
|
43
|
+
valid: Buffer.from(authoritative.canonicalBytes).equals(snapshot.canonicalBytes),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=projection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projection.js","sourceRoot":"","sources":["../../../../src/local/domain/service/projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAIlD,oEAAoE;AACpE,MAAM,OAAO,0BAA0B;IAI1B;IAHF,SAAS,GAAG,IAAI,CAAC;IAE1B,YACW,QAA4B;QAA5B,aAAQ,GAAR,QAAQ,CAAoB;IACnC,CAAC;IAEL,MAAM,CAAC,kBAAkB,CAAC,QAA4B,EAAE,mBAA2B;QACjF,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,sBAAsB,CAAC,6CAA6C,CAAC,CAAC;QAClF,CAAC;QACD,OAAO,IAAI,0BAA0B,CAAC,QAAQ,CAAC,CAAC;IAClD,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC;IACpC,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC;I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