@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,179 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { isUuid } from "./constants.js";
|
|
3
|
+
import { canonicalBytes, compareCodePoints, parseRepositoryJson } from "./encoding.js";
|
|
4
|
+
const PROPERTY_FIELDS = ["name", "media_type", "artifact_type", "note", "metadata", "created_at", "content_format"];
|
|
5
|
+
const TEXT_FIELDS = ["name", "media_type", "artifact_type", "note", "created_at"];
|
|
6
|
+
const LEGACY_FIELDS = ["name", "media_type", "notes", "tags"];
|
|
7
|
+
const JSON_NUMBER = /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$/;
|
|
8
|
+
function invalid(message) {
|
|
9
|
+
throw new Error(message);
|
|
10
|
+
}
|
|
11
|
+
function validateJson(value) {
|
|
12
|
+
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
13
|
+
return;
|
|
14
|
+
if (typeof value === "number") {
|
|
15
|
+
if (!Number.isFinite(value))
|
|
16
|
+
invalid("artifact metadata must contain JSON values");
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (typeof value === "bigint")
|
|
20
|
+
return;
|
|
21
|
+
if (JSON.isRawJSON(value) && JSON_NUMBER.test(value.rawJSON))
|
|
22
|
+
return;
|
|
23
|
+
if (Array.isArray(value)) {
|
|
24
|
+
for (const item of value)
|
|
25
|
+
validateJson(item);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (value !== null && typeof value === "object") {
|
|
29
|
+
for (const item of Object.values(value))
|
|
30
|
+
validateJson(item);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
invalid("artifact metadata must contain JSON values");
|
|
34
|
+
}
|
|
35
|
+
export function artifactPropertiesJson(properties) {
|
|
36
|
+
const fields = Object.keys(properties);
|
|
37
|
+
if (fields.length !== PROPERTY_FIELDS.length || !PROPERTY_FIELDS.every(field => Object.hasOwn(properties, field))) {
|
|
38
|
+
invalid("artifact properties have invalid fields");
|
|
39
|
+
}
|
|
40
|
+
if (TEXT_FIELDS.some(field => properties[field] !== null && typeof properties[field] !== "string")) {
|
|
41
|
+
invalid("artifact properties have invalid text values");
|
|
42
|
+
}
|
|
43
|
+
if (properties.content_format !== "raw" && properties.content_format !== "json-payload" && properties.content_format !== "legacy-record") {
|
|
44
|
+
invalid("artifact content format is invalid");
|
|
45
|
+
}
|
|
46
|
+
const metadata = properties.metadata;
|
|
47
|
+
if (metadata === null || typeof metadata !== "object" || Array.isArray(metadata) || JSON.isRawJSON(metadata)) {
|
|
48
|
+
invalid("artifact metadata must be a JSON object");
|
|
49
|
+
}
|
|
50
|
+
validateJson(metadata);
|
|
51
|
+
return canonicalBytes(properties).toString("utf8");
|
|
52
|
+
}
|
|
53
|
+
export function parseArtifactProperties(value) {
|
|
54
|
+
let parsed;
|
|
55
|
+
try {
|
|
56
|
+
parsed = parseRepositoryJson(value);
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
throw new Error("artifact properties are not canonical", { cause: error });
|
|
60
|
+
}
|
|
61
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed) || JSON.isRawJSON(parsed)) {
|
|
62
|
+
invalid("artifact properties are not canonical");
|
|
63
|
+
}
|
|
64
|
+
let canonical;
|
|
65
|
+
try {
|
|
66
|
+
canonical = artifactPropertiesJson(parsed);
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
throw new Error("artifact properties are not canonical", { cause: error });
|
|
70
|
+
}
|
|
71
|
+
if (canonical !== value)
|
|
72
|
+
invalid("artifact properties are not canonical");
|
|
73
|
+
return parsed;
|
|
74
|
+
}
|
|
75
|
+
export function legacyArtifactProperties(metadata, contentFormat = "raw") {
|
|
76
|
+
if (LEGACY_FIELDS.some(field => metadata[field] !== undefined && metadata[field] !== null && typeof metadata[field] !== "string")) {
|
|
77
|
+
invalid("historical artifact metadata is invalid");
|
|
78
|
+
}
|
|
79
|
+
return artifactPropertiesJson({
|
|
80
|
+
name: metadata.name ?? null,
|
|
81
|
+
media_type: metadata.media_type ?? null,
|
|
82
|
+
artifact_type: metadata.media_type || "file",
|
|
83
|
+
note: null,
|
|
84
|
+
metadata: {
|
|
85
|
+
media_type: metadata.media_type ?? null,
|
|
86
|
+
notes: metadata.notes ?? null,
|
|
87
|
+
tags: metadata.tags ?? null,
|
|
88
|
+
},
|
|
89
|
+
created_at: null,
|
|
90
|
+
content_format: contentFormat,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
export function legacyArtifactMetadata(properties) {
|
|
94
|
+
const parsed = parseArtifactProperties(properties);
|
|
95
|
+
const values = {
|
|
96
|
+
name: parsed.name,
|
|
97
|
+
media_type: parsed.media_type,
|
|
98
|
+
notes: parsed.metadata.notes ?? null,
|
|
99
|
+
tags: parsed.metadata.tags ?? null,
|
|
100
|
+
};
|
|
101
|
+
if (Object.values(values).some(value => value !== null && typeof value !== "string")) {
|
|
102
|
+
invalid("artifact properties cannot represent historical metadata");
|
|
103
|
+
}
|
|
104
|
+
return values;
|
|
105
|
+
}
|
|
106
|
+
function latestValue(latestValues, artifactId, field) {
|
|
107
|
+
for (const write of latestValues.values()) {
|
|
108
|
+
if (write.ownerType === "artifact" && write.ownerId === artifactId && write.field === field)
|
|
109
|
+
return write.value;
|
|
110
|
+
}
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
113
|
+
export function foldArtifactPropertiesOperation(properties, operation, latestValues) {
|
|
114
|
+
if (operation.type !== "artifact.attach.v1" && operation.type !== "artifact.attach.v2" &&
|
|
115
|
+
operation.type !== "artifact.metadata.set.v1" && operation.type !== "artifact.properties.set.v1")
|
|
116
|
+
return properties;
|
|
117
|
+
const artifactId = operation.payload.artifact_id;
|
|
118
|
+
if (typeof artifactId !== "string")
|
|
119
|
+
invalid("artifact operation identifier is invalid");
|
|
120
|
+
if (operation.type === "artifact.attach.v1") {
|
|
121
|
+
if (properties !== undefined)
|
|
122
|
+
return properties;
|
|
123
|
+
return legacyArtifactProperties({
|
|
124
|
+
name: latestValue(latestValues, artifactId, "name") ?? null,
|
|
125
|
+
media_type: latestValue(latestValues, artifactId, "media_type") ?? null,
|
|
126
|
+
notes: latestValue(latestValues, artifactId, "notes") ?? null,
|
|
127
|
+
tags: latestValue(latestValues, artifactId, "tags") ?? null,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
if (operation.type === "artifact.attach.v2" || operation.type === "artifact.properties.set.v1") {
|
|
131
|
+
const value = latestValue(latestValues, artifactId, "properties");
|
|
132
|
+
if (value === undefined || value === null) {
|
|
133
|
+
if (operation.type === "artifact.attach.v2" && properties !== undefined)
|
|
134
|
+
return properties;
|
|
135
|
+
invalid("artifact properties latest value is missing");
|
|
136
|
+
}
|
|
137
|
+
parseArtifactProperties(value);
|
|
138
|
+
return value;
|
|
139
|
+
}
|
|
140
|
+
if (properties === undefined)
|
|
141
|
+
invalid("artifact properties are missing");
|
|
142
|
+
const field = operation.payload.field;
|
|
143
|
+
if (typeof field !== "string" || !LEGACY_FIELDS.includes(field)) {
|
|
144
|
+
invalid("artifact metadata field is invalid");
|
|
145
|
+
}
|
|
146
|
+
const value = latestValue(latestValues, artifactId, field);
|
|
147
|
+
if (value === undefined)
|
|
148
|
+
invalid("artifact metadata latest value is missing");
|
|
149
|
+
const current = parseArtifactProperties(properties);
|
|
150
|
+
const replacement = { ...current, metadata: { ...current.metadata } };
|
|
151
|
+
if (field === "name")
|
|
152
|
+
replacement.name = value;
|
|
153
|
+
else if (field === "media_type") {
|
|
154
|
+
replacement.media_type = value;
|
|
155
|
+
replacement.metadata.media_type = value;
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
replacement.metadata[field] = value;
|
|
159
|
+
}
|
|
160
|
+
return artifactPropertiesJson(replacement);
|
|
161
|
+
}
|
|
162
|
+
export function artifactReferenceSetDigest(entries) {
|
|
163
|
+
const seen = new Set();
|
|
164
|
+
const rows = entries.map(entry => {
|
|
165
|
+
if ((entry.owner_type !== "node" && entry.owner_type !== "edge") || !isUuid(entry.owner_id) ||
|
|
166
|
+
(typeof entry.order !== "bigint" && (!Number.isSafeInteger(entry.order) || entry.order < 0)) ||
|
|
167
|
+
(typeof entry.order === "bigint" && entry.order < 0n)) {
|
|
168
|
+
invalid("artifact reference is invalid");
|
|
169
|
+
}
|
|
170
|
+
const key = `${entry.owner_type}\u0000${entry.owner_id}`;
|
|
171
|
+
if (seen.has(key))
|
|
172
|
+
invalid("artifact reference owner is duplicated");
|
|
173
|
+
seen.add(key);
|
|
174
|
+
return { owner_type: entry.owner_type, owner_id: entry.owner_id, order: entry.order };
|
|
175
|
+
});
|
|
176
|
+
rows.sort((left, right) => compareCodePoints(left.owner_type, right.owner_type) || compareCodePoints(left.owner_id, right.owner_id));
|
|
177
|
+
return `sha256:${createHash("sha256").update(canonicalBytes(rows)).digest("hex")}`;
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=artifact-properties.js.map
|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C,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IACrI,OAAO,UAAU,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AACrF,CAAC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { RepositoryContractError } from "../errors.js";
|
|
3
|
+
import { exceedsCharacters, isDigest, isRecord, isUuid, MAX_COMMIT_METADATA_BYTES, validateTimestamp } from "./constants.js";
|
|
4
|
+
import { canonicalBytes, parseRepositoryJson } from "./encoding.js";
|
|
5
|
+
import { RepositoryOperation } from "./operations.js";
|
|
6
|
+
const COMMIT_FIELDS = ["format", "schema_version", "repository_id", "parent_commit_id", "author", "authored_at", "message", "intent", "operations", "latest_state_digests", "artifact_digests", "rebased_from"];
|
|
7
|
+
function validateText(value, name) {
|
|
8
|
+
if (value === null)
|
|
9
|
+
return;
|
|
10
|
+
if (typeof value !== "string" || exceedsCharacters(value, 4096)) {
|
|
11
|
+
throw new RepositoryContractError(`commit ${name} must be a string or null`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
// Python rehydration materializes tuple(value) before calling the constructor.
|
|
15
|
+
function digestSequence(value) {
|
|
16
|
+
if (Array.isArray(value))
|
|
17
|
+
return value;
|
|
18
|
+
if (typeof value === "string")
|
|
19
|
+
return Array.from(value);
|
|
20
|
+
if (isRecord(value))
|
|
21
|
+
return Object.keys(value);
|
|
22
|
+
throw new TypeError("commit digest sequence is not iterable");
|
|
23
|
+
}
|
|
24
|
+
export class RepositoryCommit {
|
|
25
|
+
repositoryId;
|
|
26
|
+
commitId;
|
|
27
|
+
canonicalBytes;
|
|
28
|
+
operations;
|
|
29
|
+
parentCommitId;
|
|
30
|
+
authorKind;
|
|
31
|
+
authorId;
|
|
32
|
+
authoredAt;
|
|
33
|
+
message;
|
|
34
|
+
intent;
|
|
35
|
+
latestStateDigests;
|
|
36
|
+
artifactDigests;
|
|
37
|
+
rebasedFrom;
|
|
38
|
+
constructor(repositoryId, commitId, canonicalBytes, operations, parentCommitId, authorKind, authorId, authoredAt, message, intent, latestStateDigests, artifactDigests, rebasedFrom) {
|
|
39
|
+
this.repositoryId = repositoryId;
|
|
40
|
+
this.commitId = commitId;
|
|
41
|
+
this.canonicalBytes = canonicalBytes;
|
|
42
|
+
this.operations = operations;
|
|
43
|
+
this.parentCommitId = parentCommitId;
|
|
44
|
+
this.authorKind = authorKind;
|
|
45
|
+
this.authorId = authorId;
|
|
46
|
+
this.authoredAt = authoredAt;
|
|
47
|
+
this.message = message;
|
|
48
|
+
this.intent = intent;
|
|
49
|
+
this.latestStateDigests = latestStateDigests;
|
|
50
|
+
this.artifactDigests = artifactDigests;
|
|
51
|
+
this.rebasedFrom = rebasedFrom;
|
|
52
|
+
}
|
|
53
|
+
get expectedHead() { return this.parentCommitId; }
|
|
54
|
+
get metadataBytes() { return this.canonicalBytes.length; }
|
|
55
|
+
static create(input) {
|
|
56
|
+
const { repositoryId, operations, authorKind, authorId, authoredAt, parentCommitId = null, message = null, intent = null, latestStateDigests = [], artifactDigests = [], rebasedFrom = null } = input;
|
|
57
|
+
if (!isUuid(repositoryId))
|
|
58
|
+
throw new RepositoryContractError("commit repository_id must be a UUIDv4");
|
|
59
|
+
if (operations.length < 1 || operations.length > 10_000 ||
|
|
60
|
+
operations.some((operation) => operation.repositoryId !== repositoryId)) {
|
|
61
|
+
throw new RepositoryContractError("commit operations must belong to one repository");
|
|
62
|
+
}
|
|
63
|
+
if (authorKind !== "client" && authorKind !== "principal")
|
|
64
|
+
throw new RepositoryContractError("commit author kind is invalid");
|
|
65
|
+
if (!isUuid(authorId))
|
|
66
|
+
throw new RepositoryContractError("commit author id must be a UUIDv4");
|
|
67
|
+
if (parentCommitId !== null && !isDigest(parentCommitId))
|
|
68
|
+
throw new RepositoryContractError("commit parent must be a canonical digest");
|
|
69
|
+
if (rebasedFrom !== null && !isDigest(rebasedFrom))
|
|
70
|
+
throw new RepositoryContractError("commit rebased_from must be a canonical digest");
|
|
71
|
+
validateText(message, "message");
|
|
72
|
+
validateText(intent, "intent");
|
|
73
|
+
validateTimestamp(authoredAt, "commit timestamp must be timezone-aware UTC");
|
|
74
|
+
for (const [digests, name] of [[latestStateDigests, "latest_state_digests"], [artifactDigests, "artifact_digests"]]) {
|
|
75
|
+
if (!Array.isArray(digests) || !digests.every(isDigest)) {
|
|
76
|
+
throw new RepositoryContractError(`commit ${name} must contain canonical digests`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const bytes = canonicalBytes({
|
|
80
|
+
format: "flywheel.commit.v1", schema_version: 1,
|
|
81
|
+
repository_id: repositoryId, parent_commit_id: parentCommitId,
|
|
82
|
+
author: { kind: authorKind, id: authorId }, authored_at: authoredAt,
|
|
83
|
+
message, intent, operations: operations.map((operation) => operation.toMapping()),
|
|
84
|
+
latest_state_digests: latestStateDigests, artifact_digests: artifactDigests,
|
|
85
|
+
rebased_from: rebasedFrom,
|
|
86
|
+
});
|
|
87
|
+
if (bytes.length > MAX_COMMIT_METADATA_BYTES)
|
|
88
|
+
throw new RepositoryContractError("commit canonical metadata exceeds limit");
|
|
89
|
+
const commitId = `sha256:${createHash("sha256").update("flywheel.commit.v1\0").update(bytes).digest("hex")}`;
|
|
90
|
+
return new RepositoryCommit(repositoryId, commitId, bytes, [...operations], parentCommitId, authorKind, authorId, authoredAt, message, intent, [...latestStateDigests], [...artifactDigests], rebasedFrom);
|
|
91
|
+
}
|
|
92
|
+
static fromCanonicalBytes(commitId, bytes) {
|
|
93
|
+
if (!isDigest(commitId))
|
|
94
|
+
throw new RepositoryContractError("commit_id must be a canonical digest");
|
|
95
|
+
if (!(bytes instanceof Uint8Array))
|
|
96
|
+
throw new RepositoryContractError("commit canonical bytes must be bytes");
|
|
97
|
+
let payload;
|
|
98
|
+
try {
|
|
99
|
+
payload = parseRepositoryJson(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
|
|
100
|
+
}
|
|
101
|
+
catch (error) {
|
|
102
|
+
if (!(error instanceof SyntaxError || error instanceof TypeError))
|
|
103
|
+
throw error;
|
|
104
|
+
throw new RepositoryContractError("commit canonical bytes are malformed", { cause: error });
|
|
105
|
+
}
|
|
106
|
+
if (!isRecord(payload) || Object.keys(payload).length !== COMMIT_FIELDS.length ||
|
|
107
|
+
!COMMIT_FIELDS.every((key) => Object.hasOwn(payload, key))) {
|
|
108
|
+
throw new RepositoryContractError("commit body has unknown or missing fields");
|
|
109
|
+
}
|
|
110
|
+
const version = payload.schema_version;
|
|
111
|
+
if (payload.format !== "flywheel.commit.v1" || !(version === 1 || version === 1n || version === true ||
|
|
112
|
+
(JSON.isRawJSON(version) && Number(version.rawJSON) === 1))) {
|
|
113
|
+
throw new RepositoryContractError("commit body has an unsupported version");
|
|
114
|
+
}
|
|
115
|
+
const author = payload.author;
|
|
116
|
+
if (!isRecord(author) || Object.keys(author).length !== 2 ||
|
|
117
|
+
!Object.hasOwn(author, "kind") || !Object.hasOwn(author, "id") ||
|
|
118
|
+
(author.kind !== "client" && author.kind !== "principal") || typeof author.id !== "string") {
|
|
119
|
+
throw new RepositoryContractError("commit author is invalid");
|
|
120
|
+
}
|
|
121
|
+
const timestamp = payload.authored_at;
|
|
122
|
+
if (typeof timestamp !== "string" || !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{6}Z$/.test(timestamp)) {
|
|
123
|
+
throw new RepositoryContractError("commit timestamp must be UTC microsecond precision");
|
|
124
|
+
}
|
|
125
|
+
validateTimestamp(timestamp, "commit timestamp is invalid");
|
|
126
|
+
if (!Array.isArray(payload.operations))
|
|
127
|
+
throw new RepositoryContractError("commit operations must be an ordered list");
|
|
128
|
+
let result;
|
|
129
|
+
try {
|
|
130
|
+
// create validates these untrusted fields in the original constructor order.
|
|
131
|
+
result = RepositoryCommit.create({
|
|
132
|
+
repositoryId: payload.repository_id,
|
|
133
|
+
operations: payload.operations.map(RepositoryOperation.fromMapping),
|
|
134
|
+
parentCommitId: payload.parent_commit_id,
|
|
135
|
+
authorKind: author.kind, authorId: author.id, authoredAt: timestamp,
|
|
136
|
+
message: payload.message, intent: payload.intent,
|
|
137
|
+
latestStateDigests: digestSequence(payload.latest_state_digests),
|
|
138
|
+
artifactDigests: digestSequence(payload.artifact_digests), rebasedFrom: payload.rebased_from,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
catch (error) {
|
|
142
|
+
if (!(error instanceof TypeError || error instanceof RepositoryContractError))
|
|
143
|
+
throw error;
|
|
144
|
+
throw new RepositoryContractError("commit body violates the v1 contract", { cause: error });
|
|
145
|
+
}
|
|
146
|
+
if (!result.canonicalBytes.equals(bytes) || result.commitId !== commitId) {
|
|
147
|
+
throw new RepositoryContractError("commit digest does not match canonical bytes");
|
|
148
|
+
}
|
|
149
|
+
return result;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=commits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commits.js","sourceRoot":"","sources":["../../../../src/local/domain/models/commits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC7H,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEtD,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,gBAAgB,EAAE,eAAe,EAAE,kBAAkB,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY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D,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { RepositoryContractError } from "../errors.js";
|
|
2
|
+
export const MAX_REPOSITORY_VALUE_BYTES = 1_048_576;
|
|
3
|
+
export const MAX_COMMIT_METADATA_BYTES = 16 * 1024 * 1024;
|
|
4
|
+
export function exceedsCharacters(value, limit) {
|
|
5
|
+
let count = 0;
|
|
6
|
+
for (let index = 0; index < value.length; index += value.codePointAt(index) > 0xffff ? 2 : 1) {
|
|
7
|
+
if (++count > limit)
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
export const OPERATION_FIELDS = {
|
|
13
|
+
"node.create.v1": ["initial_field_digests", "initial_reference_digests", "initial_values", "node_id", "operation_id", "repository_id", "type"],
|
|
14
|
+
"node.field.set.v1": ["change_metadata", "expected_digest", "field", "new_digest", "node_id", "operation_id", "repository_id", "type"],
|
|
15
|
+
"node.tombstone.v1": ["expected_lifecycle", "node_id", "operation_id", "relation_reference_digest", "repository_id", "type"],
|
|
16
|
+
"node.restore.v1": ["expected_lifecycle", "node_id", "operation_id", "relation_reference_digest", "repository_id", "type"],
|
|
17
|
+
"node.purge.v1": ["confirmation_node_id", "expected_head", "live_dependency_count", "node_id", "operation_id", "repository_id", "type"],
|
|
18
|
+
"tag.define.v1": ["definition", "expected_tag_state", "operation_id", "repository_id", "scope_node_id", "tag_id", "type"],
|
|
19
|
+
"tag.update.v1": ["definition", "expected_definition_digest", "operation_id", "previous_definition", "repository_id", "scope_node_id", "tag_id", "type"],
|
|
20
|
+
"tag.retire.v1": ["expected_definition_digest", "operation_id", "previous_definition", "repository_id", "scope_node_id", "tag_id", "type"],
|
|
21
|
+
"node.tag.assign.v1": ["assignment_mode", "expected_history_next_index", "expected_holder", "history_entry_id", "history_index", "history_tag", "new_holder", "node_id", "operation_id", "prior_holder", "relation_metadata", "repository_id", "scope_node_id", "tag_id", "type"],
|
|
22
|
+
"node.tag.remove.v1": ["expected_holder", "node_id", "operation_id", "relation_metadata", "repository_id", "scope_node_id", "tag_id", "type"],
|
|
23
|
+
"lineage.add.v1": ["child_node_id", "expected_relation_state", "operation_id", "parent_node_id", "repository_id", "type"],
|
|
24
|
+
"lineage.remove.v1": ["child_node_id", "expected_relation_state", "operation_id", "parent_node_id", "repository_id", "type"],
|
|
25
|
+
"containment.assign.v1": ["child_node_id", "container_node_id", "containment_id", "expected_relation_state", "operation_id", "ordinal", "relation_digest", "repository_id", "source_artifact_id", "type"],
|
|
26
|
+
"containment.remove.v1": ["child_node_id", "containment_id", "expected_relation_state", "operation_id", "relation_digest", "repository_id", "type"],
|
|
27
|
+
"edge.add.v1": ["artifact_reference_digests", "content_digest", "edge_id", "expected_relation_state", "graph_node_id", "operation_id", "relation_digest", "repository_id", "source_node_id", "target_node_id", "type"],
|
|
28
|
+
"edge.field.set.v1": ["change_metadata", "edge_id", "expected_digest", "field", "new_digest", "operation_id", "repository_id", "type"],
|
|
29
|
+
"edge.remove.v1": ["edge_id", "expected_relation_state", "operation_id", "relation_digest", "repository_id", "type"],
|
|
30
|
+
"artifact.attach.v1": ["artifact_id", "expected_reference_state", "metadata_digest", "object_digest", "operation_id", "order", "owner", "reference_metadata", "repository_id", "type"],
|
|
31
|
+
"artifact.attach.v2": ["artifact_id", "expected_reference_state", "object_digest", "operation_id", "order", "owner", "properties_digest", "reference_metadata", "repository_id", "type"],
|
|
32
|
+
"artifact.content.set.v1": ["artifact_id", "change_metadata", "expected_object_digest", "expected_reference_digest", "object_digest", "operation_id", "repository_id", "type"],
|
|
33
|
+
"artifact.properties.set.v1": ["artifact_id", "change_metadata", "expected_digest", "expected_reference_digest", "new_digest", "operation_id", "repository_id", "type"],
|
|
34
|
+
"artifact.detach.v1": ["artifact_id", "expected_reference_state", "object_digest", "operation_id", "owner", "reference_digest", "repository_id", "type"],
|
|
35
|
+
"artifact.metadata.set.v1": ["artifact_id", "change_metadata", "expected_digest", "field", "new_digest", "operation_id", "owner", "repository_id", "type"],
|
|
36
|
+
"imported_baseline.v1": ["aggregate_digest", "chunk_digests", "counts", "expected_history_state", "membership_manifest_digest", "migration_attempt_id", "operation_id", "repository_id", "roles_manifest_digest", "type"],
|
|
37
|
+
};
|
|
38
|
+
export const NODE_FIELDS = ["content", "external_transcript_ref", "origin_host", "slug_name", "summary", "title"];
|
|
39
|
+
export const TAG_DEFINITION_FIELDS = ["bg_color", "history_index", "history_next_index", "history_of_tag_id", "name", "one_only", "text_color", "track_history"];
|
|
40
|
+
export function isRecord(value) {
|
|
41
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) && !JSON.isRawJSON(value);
|
|
42
|
+
}
|
|
43
|
+
export function isUuid(value) {
|
|
44
|
+
return typeof value === "string" && value.length === 36 &&
|
|
45
|
+
/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.test(value);
|
|
46
|
+
}
|
|
47
|
+
export function isDigest(value) {
|
|
48
|
+
return typeof value === "string" && value.length === 71 && /^sha256:[0-9a-f]{64}$/.test(value);
|
|
49
|
+
}
|
|
50
|
+
export function integerValue(value, minimum, message) {
|
|
51
|
+
if ((typeof value !== "bigint" && (typeof value !== "number" || !Number.isSafeInteger(value))) ||
|
|
52
|
+
BigInt(value) < minimum)
|
|
53
|
+
throw new RepositoryContractError(message);
|
|
54
|
+
return BigInt(value);
|
|
55
|
+
}
|
|
56
|
+
export function validateTimestamp(value, message) {
|
|
57
|
+
if (typeof value !== "string" || value.length !== 27 ||
|
|
58
|
+
!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{6}Z$/.test(value) || value.startsWith("0000")) {
|
|
59
|
+
throw new RepositoryContractError(message);
|
|
60
|
+
}
|
|
61
|
+
const parsed = new Date(value);
|
|
62
|
+
if (!Number.isFinite(parsed.getTime()) || parsed.toISOString().slice(0, 23) !== value.slice(0, 23)) {
|
|
63
|
+
throw new RepositoryContractError(message);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export function validateDigestList(value, unique) {
|
|
67
|
+
if (!Array.isArray(value) || !value.every(isDigest) || (unique && new Set(value).size !== value.length)) {
|
|
68
|
+
throw new RepositoryContractError("digest list must contain canonical digests");
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/local/domain/models/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEvD,MAAM,CAAC,MAAM,0BAA0B,GAAG,SAAS,CAAC;AACpD,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAE1D,MAAM,UAAU,iBAAiB,CAAC,KAAa,EAAE,KAAa;IAC5D,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,IAAI,KAAK,CAAC,WAAW,CAAC,KAAK,CAAE,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9F,IAAI,EAAE,KAAK,GAAG,KAAK;YAAE,OAAO,IAAI,CAAC;IACnC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,gBAAgB,EAAE,CAAC,uBAAuB,EAAE,2BAA2B,EAAE,gBAAgB,EAAE,SAAS,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,CAAC;IAC9I,mBAAmB,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,CAAC;IACtI,mBAAmB,EAAE,CAAC,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CAAC,IAAI,KAAK,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QACxG,MAAM,IAAI,uBAAuB,CAAC,4CAA4C,CAAC,CAAC;IAClF,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
const INTEGER_TOKEN = /^-?(?:0|[1-9][0-9]*)$/;
|
|
3
|
+
/** Decode repository numbers before JavaScript's floating-point rounding loses them. */
|
|
4
|
+
export function parseRepositoryJson(text) {
|
|
5
|
+
return JSON.parse(text, (_key, value, context) => {
|
|
6
|
+
if (typeof value !== "number")
|
|
7
|
+
return value;
|
|
8
|
+
if (!context)
|
|
9
|
+
throw new TypeError("repository JSON requires parser source context");
|
|
10
|
+
const source = context.source;
|
|
11
|
+
if (!INTEGER_TOKEN.test(source))
|
|
12
|
+
return JSON.rawJSON(source);
|
|
13
|
+
return Number.isSafeInteger(value) ? value : BigInt(source);
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
export function repositoryJsonReplacer(_key, value) {
|
|
17
|
+
return typeof value === "bigint" ? JSON.rawJSON(value.toString()) : value;
|
|
18
|
+
}
|
|
19
|
+
/** Opt-in wire serialization; ordinary CLI JSON behavior is deliberately unchanged. */
|
|
20
|
+
export function stringifyRepositoryJson(value) {
|
|
21
|
+
const result = JSON.stringify(value, repositoryJsonReplacer);
|
|
22
|
+
if (result === undefined)
|
|
23
|
+
throw new TypeError("repository JSON value is not serializable");
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
export function compareCodePoints(left, right) {
|
|
27
|
+
let a = 0;
|
|
28
|
+
let b = 0;
|
|
29
|
+
while (a < left.length && b < right.length) {
|
|
30
|
+
const x = left.codePointAt(a);
|
|
31
|
+
const y = right.codePointAt(b);
|
|
32
|
+
if (x !== y)
|
|
33
|
+
return x - y;
|
|
34
|
+
a += x > 0xffff ? 2 : 1;
|
|
35
|
+
b += y > 0xffff ? 2 : 1;
|
|
36
|
+
}
|
|
37
|
+
return left.length - a - (right.length - b);
|
|
38
|
+
}
|
|
39
|
+
function quote(value) {
|
|
40
|
+
if (!value.isWellFormed())
|
|
41
|
+
throw new TypeError("repository string is not valid UTF-8");
|
|
42
|
+
return JSON.stringify(value);
|
|
43
|
+
}
|
|
44
|
+
function canonicalJson(value) {
|
|
45
|
+
if (value === null)
|
|
46
|
+
return "null";
|
|
47
|
+
if (JSON.isRawJSON(value))
|
|
48
|
+
return value.rawJSON;
|
|
49
|
+
switch (typeof value) {
|
|
50
|
+
case "string": return quote(value);
|
|
51
|
+
case "boolean": return value ? "true" : "false";
|
|
52
|
+
case "bigint": return value.toString();
|
|
53
|
+
case "number":
|
|
54
|
+
if (!Number.isSafeInteger(value)) {
|
|
55
|
+
throw new TypeError("repository integer must be decoded losslessly");
|
|
56
|
+
}
|
|
57
|
+
return String(value);
|
|
58
|
+
case "object":
|
|
59
|
+
if (Array.isArray(value))
|
|
60
|
+
return `[${value.map(canonicalJson).join(",")}]`;
|
|
61
|
+
// Build the text directly: JSON.stringify reorders integer-looking object keys.
|
|
62
|
+
return `{${Object.keys(value).sort(compareCodePoints).map((key) => `${quote(key)}:${canonicalJson(value[key])}`).join(",")}}`;
|
|
63
|
+
default:
|
|
64
|
+
throw new TypeError("unsupported repository JSON value");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export function canonicalBytes(value) {
|
|
68
|
+
return Buffer.from(canonicalJson(value), "utf8");
|
|
69
|
+
}
|
|
70
|
+
export function valueDigest(value) {
|
|
71
|
+
return `sha256:${createHash("sha256").update(canonicalBytes(value)).digest("hex")}`;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=encoding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encoding.js","sourceRoot":"","sources":["../../../../src/local/domain/models/encoding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAUzC,MAAM,aAAa,GAAG,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aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;gBACjC,MAAM,IAAI,SAAS,CAAC,+CAA+C,CAAC,CAAC;YACvE,CAAC;YACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;QACvB,KAAK,QAAQ;YACX,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;gBAAE,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;YAC3E,gFAAgF;YAChF,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAChE,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,aAAa,CAAE,KAAiC,CAAC,GAAG,CAAC,CAAC,EAAE,CAC1E,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;QACjB;YACE,MAAM,IAAI,SAAS,CAAC,mCAAmC,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,OAAO,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAoB;IAC9C,OAAO,UAAU,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AACtF,CAAC"}
|
package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/imported-artifact-properties.js
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { RepositoryContractError } from "../errors.js";
|
|
3
|
+
import { artifactPropertiesJson, parseArtifactProperties } from "./artifact-properties.js";
|
|
4
|
+
import { isDigest, isRecord } from "./constants.js";
|
|
5
|
+
import { canonicalBytes, parseRepositoryJson } from "./encoding.js";
|
|
6
|
+
const SOURCE_FIELDS = ["access_policy", "artifacts", "format", "lineage", "nodes", "repository_id", "tag_history"];
|
|
7
|
+
const SOURCE_ARTIFACT_V1_FIELDS = ["artifact", "artifact_id", "artifact_order", "node_id"];
|
|
8
|
+
const SOURCE_ARTIFACT_V2_FIELDS = [...SOURCE_ARTIFACT_V1_FIELDS, "object_digest", "properties"];
|
|
9
|
+
function invalid(message, cause) {
|
|
10
|
+
throw new RepositoryContractError(message, cause === undefined ? undefined : { cause });
|
|
11
|
+
}
|
|
12
|
+
function exactFields(value, fields) {
|
|
13
|
+
return Object.keys(value).length === fields.length && fields.every(field => Object.hasOwn(value, field));
|
|
14
|
+
}
|
|
15
|
+
function sourceArtifactProperties(record) {
|
|
16
|
+
const metadata = record.metadata === undefined ? {} : record.metadata;
|
|
17
|
+
if (!isRecord(metadata))
|
|
18
|
+
invalid("imported artifact record is invalid");
|
|
19
|
+
try {
|
|
20
|
+
return artifactPropertiesJson({
|
|
21
|
+
name: record.title === null || record.title === "" || record.title === undefined ? metadata.name ?? null : record.title,
|
|
22
|
+
media_type: record.media_type === null || record.media_type === "" || record.media_type === undefined ? metadata.media_type ?? null : record.media_type,
|
|
23
|
+
artifact_type: record.artifact_type ?? null,
|
|
24
|
+
note: record.note ?? null,
|
|
25
|
+
metadata,
|
|
26
|
+
created_at: record.created_at ?? null,
|
|
27
|
+
content_format: "legacy-record",
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
invalid("imported artifact record is invalid", error);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** Authenticates the complete immutable artifact inventory carried by an imported baseline aggregate. */
|
|
35
|
+
export function parseImportedArtifactProperties(repositoryId, aggregateDigest, raw) {
|
|
36
|
+
if (!isDigest(aggregateDigest) || `sha256:${createHash("sha256").update(raw).digest("hex")}` !== aggregateDigest) {
|
|
37
|
+
invalid("imported artifact aggregate digest is invalid");
|
|
38
|
+
}
|
|
39
|
+
let source;
|
|
40
|
+
try {
|
|
41
|
+
source = parseRepositoryJson(new TextDecoder("utf-8", { fatal: true }).decode(raw));
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
invalid("imported artifact aggregate is invalid", error);
|
|
45
|
+
}
|
|
46
|
+
if (!isRecord(source) || !canonicalBytes(source).equals(raw) || source.repository_id !== repositoryId ||
|
|
47
|
+
!exactFields(source, SOURCE_FIELDS) ||
|
|
48
|
+
(source.format !== "flywheel.repository.legacy-source.v1" && source.format !== "flywheel.repository.legacy-source.v2") ||
|
|
49
|
+
!isRecord(source.access_policy) || !exactFields(source.access_policy, ["visibility", "link_write"]) ||
|
|
50
|
+
typeof source.access_policy.visibility !== "string" || typeof source.access_policy.link_write !== "boolean" ||
|
|
51
|
+
!Array.isArray(source.artifacts) || !Array.isArray(source.lineage) || !Array.isArray(source.nodes) || !Array.isArray(source.tag_history)) {
|
|
52
|
+
invalid("imported artifact aggregate is invalid");
|
|
53
|
+
}
|
|
54
|
+
const properties = new Map();
|
|
55
|
+
for (const row of source.artifacts) {
|
|
56
|
+
if (!isRecord(row) || !exactFields(row, source.format === "flywheel.repository.legacy-source.v1"
|
|
57
|
+
? SOURCE_ARTIFACT_V1_FIELDS : SOURCE_ARTIFACT_V2_FIELDS) || typeof row.artifact_id !== "string" || row.artifact_id.length === 0 ||
|
|
58
|
+
typeof row.node_id !== "string" || typeof row.artifact_order !== "number" || !Number.isSafeInteger(row.artifact_order) ||
|
|
59
|
+
row.artifact_order < 0 || !isRecord(row.artifact)) {
|
|
60
|
+
invalid("imported artifact aggregate is invalid");
|
|
61
|
+
}
|
|
62
|
+
if (properties.has(row.artifact_id))
|
|
63
|
+
invalid("imported artifact aggregate is invalid");
|
|
64
|
+
if (source.format === "flywheel.repository.legacy-source.v2") {
|
|
65
|
+
if (!isDigest(row.object_digest) || typeof row.properties !== "string")
|
|
66
|
+
invalid("imported artifact aggregate is invalid");
|
|
67
|
+
try {
|
|
68
|
+
parseArtifactProperties(row.properties);
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
invalid("imported artifact aggregate is invalid", error);
|
|
72
|
+
}
|
|
73
|
+
properties.set(row.artifact_id, { properties: row.properties, objectDigest: row.object_digest });
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
const objectDigest = `sha256:${createHash("sha256").update(canonicalBytes(row.artifact)).digest("hex")}`;
|
|
77
|
+
properties.set(row.artifact_id, { properties: sourceArtifactProperties(row.artifact), objectDigest });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return properties;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=imported-artifact-properties.js.map
|
package/src/runtime/vendor/flywheel-cli-dist/local/domain/models/imported-artifact-properties.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"imported-artifact-properties.js","sourceRoot":"","sources":["../../../../src/local/domain/models/imported-artifact-properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAC3F,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAOpE,MAAM,aAAa,GAAG,CAAC,eAAe,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC;AACnH,MAAM,yBAAyB,GAAG,CAAC,UAAU,EAAE,aAAa,EAAE,gBAAgB,EAAE,SAAS,CAAC,CAAC;AAC3F,MAAM,yBAAyB,GAAG,CAAC,GAAG,yBAAyB,EAAE,eAAe,EAAE,YAAY,CAAC,CAAC;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