niceeval 0.13.3 → 0.13.4-canary.39
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/INDEX.md +5 -5
- package/dist/agents/index.cjs +2 -2
- package/dist/agents/index.cjs.map +1 -1
- package/dist/agents/project.json +6 -0
- package/dist/agents/streaming.cjs.map +1 -1
- package/dist/agents/types.cjs.map +1 -1
- package/dist/agents/types.d.cts +1 -1
- package/dist/agents/types.d.mts +1 -1
- package/dist/agents/types.d.ts +1 -1
- package/dist/analysis/bindings.d.cts +8 -8
- package/dist/analysis/bindings.d.mts +8 -8
- package/dist/analysis/bindings.d.ts +8 -8
- package/dist/analysis/contracts.cjs.map +1 -1
- package/dist/analysis/contracts.d.cts +8 -19
- package/dist/analysis/contracts.d.mts +8 -19
- package/dist/analysis/contracts.d.ts +8 -19
- package/dist/analysis/experiment-groups.cjs +7 -14
- package/dist/analysis/experiment-groups.cjs.map +1 -1
- package/dist/analysis/index.cjs.map +1 -1
- package/dist/analysis/index.d.cts +1 -1
- package/dist/analysis/index.d.mts +1 -1
- package/dist/analysis/index.d.ts +1 -1
- package/dist/cli/application.cjs +4 -13
- package/dist/cli/application.cjs.map +1 -1
- package/dist/cli/application.d.cts +62 -59
- package/dist/cli/application.d.mts +62 -59
- package/dist/cli/application.d.ts +62 -59
- package/dist/cli/application.js +6 -12
- package/dist/cli/bootstrap.cjs +28 -2
- package/dist/cli/bootstrap.cjs.map +1 -1
- package/dist/cli/contribution.cjs +185 -0
- package/dist/cli/contribution.cjs.map +1 -0
- package/dist/cli/contribution.d.cts +55 -0
- package/dist/cli/contribution.d.mts +55 -0
- package/dist/cli/contribution.d.ts +55 -0
- package/dist/cli/contribution.js +20 -0
- package/dist/cli/contribution.js.map +1 -0
- package/dist/cli/node-application.cjs +119 -87
- package/dist/cli/node-application.cjs.map +1 -1
- package/dist/cli/node-application.d.cts +2 -8
- package/dist/cli/node-application.d.mts +2 -8
- package/dist/cli/node-application.d.ts +2 -8
- package/dist/cli/node-application.js +12 -22
- package/dist/cli/program.cjs +87 -2756
- package/dist/cli/program.cjs.map +1 -1
- package/dist/cli/program.d.cts +11 -332
- package/dist/cli/program.d.mts +11 -332
- package/dist/cli/program.d.ts +11 -332
- package/dist/cli/program.js +4 -28
- package/dist/cli.cjs +0 -3
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.cts +0 -1
- package/dist/cli.d.mts +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +6 -14
- package/dist/define.cjs +1 -1
- package/dist/define.cjs.map +1 -1
- package/dist/docker/cache-administration.cjs +8 -0
- package/dist/docker/cache-administration.cjs.map +1 -0
- package/dist/docker/cache-administration.d.cts +33 -0
- package/dist/docker/cache-administration.d.mts +33 -0
- package/dist/docker/cache-administration.d.ts +33 -0
- package/dist/docker/cache-administration.js +6 -0
- package/dist/docker/cache-administration.js.map +1 -0
- package/dist/docker/cache-live.cjs +27 -0
- package/dist/docker/cache-live.cjs.map +1 -0
- package/dist/docker/cache-live.d.cts +3 -0
- package/dist/docker/cache-live.d.mts +3 -0
- package/dist/docker/cache-live.d.ts +3 -0
- package/dist/docker/cache-live.js +6 -0
- package/dist/docker/cache-live.js.map +1 -0
- package/dist/docker/cli/contribution.cjs +223 -0
- package/dist/docker/cli/contribution.cjs.map +1 -0
- package/dist/docker/cli/contribution.d.cts +48 -0
- package/dist/docker/cli/contribution.d.mts +48 -0
- package/dist/docker/cli/contribution.d.ts +48 -0
- package/dist/docker/cli/contribution.js +8 -0
- package/dist/docker/cli/contribution.js.map +1 -0
- package/dist/eval/cli/contribution.cjs +62 -0
- package/dist/eval/cli/contribution.cjs.map +1 -0
- package/dist/eval/cli/contribution.d.cts +21 -0
- package/dist/eval/cli/contribution.d.mts +21 -0
- package/dist/eval/cli/contribution.d.ts +21 -0
- package/dist/eval/cli/contribution.js +8 -0
- package/dist/eval/cli/contribution.js.map +1 -0
- package/dist/eval/host/index.cjs +23 -0
- package/dist/eval/host/index.cjs.map +1 -0
- package/dist/eval/host/index.d.cts +27 -0
- package/dist/eval/host/index.d.mts +27 -0
- package/dist/eval/host/index.d.ts +27 -0
- package/dist/eval/host/index.js +8 -0
- package/dist/eval/host/index.js.map +1 -0
- package/dist/eval/host/index.mjs +8 -0
- package/dist/eval/host/index.mjs.map +1 -0
- package/dist/experiment/host/cli/contribution.cjs +835 -0
- package/dist/experiment/host/cli/contribution.cjs.map +1 -0
- package/dist/experiment/host/cli/contribution.d.cts +329 -0
- package/dist/experiment/host/cli/contribution.d.mts +329 -0
- package/dist/experiment/host/cli/contribution.d.ts +329 -0
- package/dist/experiment/host/cli/contribution.js +22 -0
- package/dist/experiment/host/cli/contribution.js.map +1 -0
- package/dist/experiment/host/cli/index.cjs +9 -0
- package/dist/experiment/host/cli/index.cjs.map +1 -0
- package/dist/experiment/host/cli/index.d.cts +2 -0
- package/dist/experiment/host/cli/index.d.mts +2 -0
- package/dist/experiment/host/cli/index.d.ts +2 -0
- package/dist/experiment/host/cli/index.js +10 -0
- package/dist/experiment/host/cli/index.js.map +1 -0
- package/dist/experiment/host/cli/terminal.cjs +15 -0
- package/dist/experiment/host/cli/terminal.cjs.map +1 -0
- package/dist/experiment/host/cli/terminal.d.cts +14 -0
- package/dist/experiment/host/cli/terminal.d.mts +14 -0
- package/dist/experiment/host/cli/terminal.d.ts +14 -0
- package/dist/experiment/host/cli/terminal.js +8 -0
- package/dist/experiment/host/cli/terminal.js.map +1 -0
- package/dist/experiment/host/index.cjs +35 -58
- package/dist/experiment/host/index.cjs.map +1 -1
- package/dist/experiment/host/index.d.cts +5 -79
- package/dist/experiment/host/index.d.mts +5 -79
- package/dist/experiment/host/index.d.ts +5 -79
- package/dist/experiment/host/index.js +4 -2
- package/dist/experiment/host/index.mjs +4 -2
- package/dist/experiment/host/operations.cjs +678 -0
- package/dist/experiment/host/operations.cjs.map +1 -0
- package/dist/experiment/host/operations.d.cts +19 -0
- package/dist/experiment/host/operations.d.mts +19 -0
- package/dist/experiment/host/operations.d.ts +19 -0
- package/dist/experiment/host/operations.js +24 -0
- package/dist/experiment/host/operations.js.map +1 -0
- package/dist/experiment/host/presentation.cjs +81 -0
- package/dist/experiment/host/presentation.cjs.map +1 -0
- package/dist/experiment/host/presentation.d.cts +9 -0
- package/dist/experiment/host/presentation.d.mts +9 -0
- package/dist/experiment/host/presentation.d.ts +9 -0
- package/dist/experiment/host/presentation.js +8 -0
- package/dist/experiment/host/presentation.js.map +1 -0
- package/dist/experiment/host/teardown.cjs +394 -0
- package/dist/experiment/host/teardown.cjs.map +1 -0
- package/dist/experiment/host/teardown.d.cts +5 -0
- package/dist/experiment/host/teardown.d.mts +5 -0
- package/dist/experiment/host/teardown.d.ts +5 -0
- package/dist/experiment/host/teardown.js +8 -0
- package/dist/experiment/host/teardown.js.map +1 -0
- package/dist/experiment/host/types.cjs +9 -0
- package/dist/experiment/host/types.cjs.map +1 -0
- package/dist/experiment/host/types.d.cts +423 -0
- package/dist/experiment/host/types.d.mts +423 -0
- package/dist/experiment/host/types.d.ts +423 -0
- package/dist/experiment/host/types.js +6 -0
- package/dist/experiment/host/types.js.map +1 -0
- package/dist/i18n/en.cjs +8 -50
- package/dist/i18n/en.cjs.map +1 -1
- package/dist/i18n/en.d.cts +2 -6
- package/dist/i18n/en.d.mts +2 -6
- package/dist/i18n/en.d.ts +2 -6
- package/dist/o11y/project.json +6 -0
- package/dist/project/cli/contribution.cjs +66 -0
- package/dist/project/cli/contribution.cjs.map +1 -0
- package/dist/project/cli/contribution.d.cts +17 -0
- package/dist/project/cli/contribution.d.mts +17 -0
- package/dist/project/cli/contribution.d.ts +17 -0
- package/dist/project/cli/contribution.js +8 -0
- package/dist/project/cli/contribution.js.map +1 -0
- package/dist/project/cli/index.cjs +7 -0
- package/dist/project/cli/index.cjs.map +1 -0
- package/dist/project/cli/index.d.cts +1 -0
- package/dist/project/cli/index.d.mts +1 -0
- package/dist/project/cli/index.d.ts +1 -0
- package/dist/project/cli/index.js +8 -0
- package/dist/project/cli/index.js.map +1 -0
- package/dist/project/host/index.cjs +11 -0
- package/dist/project/host/index.cjs.map +1 -0
- package/dist/project/host/index.d.cts +4 -0
- package/dist/project/host/index.d.mts +4 -0
- package/dist/project/host/index.d.ts +4 -0
- package/dist/project/host/index.js +14 -0
- package/dist/project/host/index.js.map +1 -0
- package/dist/project/host/index.mjs +14 -0
- package/dist/project/host/index.mjs.map +1 -0
- package/dist/project/host.cjs +59 -0
- package/dist/project/host.cjs.map +1 -0
- package/dist/project/host.d.cts +17 -0
- package/dist/project/host.d.mts +17 -0
- package/dist/project/host.d.ts +17 -0
- package/dist/project/host.js +6 -0
- package/dist/project/host.js.map +1 -0
- package/dist/project/index.cjs +11 -0
- package/dist/project/index.cjs.map +1 -0
- package/dist/project/index.d.cts +4 -0
- package/dist/project/index.d.mts +4 -0
- package/dist/project/index.d.ts +4 -0
- package/dist/project/index.js +14 -0
- package/dist/project/index.js.map +1 -0
- package/dist/project/node.cjs +91 -0
- package/dist/project/node.cjs.map +1 -0
- package/dist/project/node.d.cts +6 -0
- package/dist/project/node.d.mts +6 -0
- package/dist/project/node.d.ts +6 -0
- package/dist/project/node.js +12 -0
- package/dist/project/node.js.map +1 -0
- package/dist/project/services.cjs +17 -0
- package/dist/project/services.cjs.map +1 -0
- package/dist/project/services.d.cts +47 -0
- package/dist/project/services.d.mts +47 -0
- package/dist/project/services.d.ts +47 -0
- package/dist/project/services.js +12 -0
- package/dist/project/services.js.map +1 -0
- package/dist/project/templates.cjs +28 -0
- package/dist/project/templates.cjs.map +1 -0
- package/dist/project/templates.d.cts +4 -0
- package/dist/project/templates.d.mts +4 -0
- package/dist/project/templates.d.ts +4 -0
- package/dist/project/templates.js +12 -0
- package/dist/project/templates.js.map +1 -0
- package/dist/project.json +6 -0
- package/dist/record/family/catalog.d.cts +10 -10
- package/dist/record/family/catalog.d.mts +10 -10
- package/dist/record/family/catalog.d.ts +10 -10
- package/dist/record/family/file-changes.d.cts +8 -8
- package/dist/record/family/file-changes.d.mts +8 -8
- package/dist/record/family/file-changes.d.ts +8 -8
- package/dist/record/host/cli/contribution.cjs +206 -0
- package/dist/record/host/cli/contribution.cjs.map +1 -0
- package/dist/record/host/cli/contribution.d.cts +32 -0
- package/dist/record/host/cli/contribution.d.mts +32 -0
- package/dist/record/host/cli/contribution.d.ts +32 -0
- package/dist/record/host/cli/contribution.js +10 -0
- package/dist/record/host/cli/contribution.js.map +1 -0
- package/dist/record/host/cli/index.cjs +8 -0
- package/dist/record/host/cli/index.cjs.map +1 -0
- package/dist/record/host/cli/index.d.cts +1 -0
- package/dist/record/host/cli/index.d.mts +1 -0
- package/dist/record/host/cli/index.d.ts +1 -0
- package/dist/record/host/cli/index.js +10 -0
- package/dist/record/host/cli/index.js.map +1 -0
- package/dist/record/host/cli/presentation.cjs +122 -0
- package/dist/record/host/cli/presentation.cjs.map +1 -0
- package/dist/record/host/cli/presentation.d.cts +7 -0
- package/dist/record/host/cli/presentation.d.mts +7 -0
- package/dist/record/host/cli/presentation.d.ts +7 -0
- package/dist/record/host/cli/presentation.js +12 -0
- package/dist/record/host/cli/presentation.js.map +1 -0
- package/dist/record/host/index.cjs.map +1 -1
- package/dist/record/host/index.d.cts +1 -1
- package/dist/record/host/index.d.mts +1 -1
- package/dist/record/host/index.d.ts +1 -1
- package/dist/record/host/runtime.cjs +184 -1
- package/dist/record/host/runtime.cjs.map +1 -1
- package/dist/record/host/types.cjs.map +1 -1
- package/dist/record/host/types.d.cts +120 -0
- package/dist/record/host/types.d.mts +120 -0
- package/dist/record/host/types.d.ts +120 -0
- package/dist/record/project.json +6 -0
- package/dist/report/assets/styles.css +80 -0
- package/dist/report/cli/contribution.cjs +325 -0
- package/dist/report/cli/contribution.cjs.map +1 -0
- package/dist/report/cli/contribution.d.cts +143 -0
- package/dist/report/cli/contribution.d.mts +143 -0
- package/dist/report/cli/contribution.d.ts +143 -0
- package/dist/report/cli/contribution.js +12 -0
- package/dist/report/cli/contribution.js.map +1 -0
- package/dist/report/client-dist/app.js +9 -9
- package/dist/report/components/attempt-detail/content.cjs +1 -1
- package/dist/report/components/attempt-detail/content.cjs.map +1 -1
- package/dist/report/components/entity-lists/compute.cjs +5 -0
- package/dist/report/components/entity-lists/compute.cjs.map +1 -1
- package/dist/report/components/entity-lists/compute.d.cts +2 -0
- package/dist/report/components/entity-lists/compute.d.mts +2 -0
- package/dist/report/components/entity-lists/compute.d.ts +2 -0
- package/dist/report/components/entity-lists/content.cjs +35 -12
- package/dist/report/components/entity-lists/content.cjs.map +1 -1
- package/dist/report/components/entity-lists/index.cjs +0 -3
- package/dist/report/components/entity-lists/index.cjs.map +1 -1
- package/dist/report/components/summaries/index.cjs +2 -4
- package/dist/report/components/summaries/index.cjs.map +1 -1
- package/dist/report/definition/cell.cjs +7 -2
- package/dist/report/definition/cell.cjs.map +1 -1
- package/dist/report/definition/cell.d.cts +2 -0
- package/dist/report/definition/cell.d.mts +2 -0
- package/dist/report/definition/cell.d.ts +2 -0
- package/dist/report/definition/primitives/assertion-evidence.cjs +190 -4
- package/dist/report/definition/primitives/assertion-evidence.cjs.map +1 -1
- package/dist/report/definition/primitives/assertion-evidence.d.cts +4 -0
- package/dist/report/definition/primitives/assertion-evidence.d.mts +4 -0
- package/dist/report/definition/primitives/assertion-evidence.d.ts +4 -0
- package/dist/report/execution/machine.cjs +2 -3
- package/dist/report/execution/machine.cjs.map +1 -1
- package/dist/report/execution/machine.d.cts +11 -8
- package/dist/report/execution/machine.d.mts +11 -8
- package/dist/report/execution/machine.d.ts +11 -8
- package/dist/report/host/from-record.cjs +13 -8
- package/dist/report/host/from-record.cjs.map +1 -1
- package/dist/report/host/index.cjs +5 -1
- package/dist/report/host/index.cjs.map +1 -1
- package/dist/report/host/index.d.cts +1 -0
- package/dist/report/host/index.d.mts +1 -0
- package/dist/report/host/index.d.ts +1 -0
- package/dist/report/host/index.js +8 -2
- package/dist/report/host/index.mjs +8 -2
- package/dist/report/host/machine.cjs +23 -22
- package/dist/report/host/machine.cjs.map +1 -1
- package/dist/report/host/machine.d.cts +1 -1
- package/dist/report/host/machine.d.mts +1 -1
- package/dist/report/host/machine.d.ts +1 -1
- package/dist/report/host/node/loader.cjs +4 -2
- package/dist/report/host/node/loader.cjs.map +1 -1
- package/dist/report/host/node/loader.d.cts +3 -1
- package/dist/report/host/node/loader.d.mts +3 -1
- package/dist/report/host/node/loader.d.ts +3 -1
- package/dist/report/host/node.cjs +44 -9
- package/dist/report/host/node.cjs.map +1 -1
- package/dist/report/host/node.d.cts +13 -3
- package/dist/report/host/node.d.mts +13 -3
- package/dist/report/host/node.d.ts +13 -3
- package/dist/report/host/node.js +44 -32
- package/dist/report/host/operations.cjs +14 -0
- package/dist/report/host/operations.cjs.map +1 -0
- package/dist/report/host/operations.d.cts +39 -0
- package/dist/report/host/operations.d.mts +39 -0
- package/dist/report/host/operations.d.ts +39 -0
- package/dist/report/host/operations.js +10 -0
- package/dist/report/host/operations.js.map +1 -0
- package/dist/report/model/chart/plot.cjs +1 -1
- package/dist/report/model/chart/plot.cjs.map +1 -1
- package/dist/report/model/locale.cjs +4 -0
- package/dist/report/model/locale.cjs.map +1 -1
- package/dist/report/model/locale.d.cts +3 -1
- package/dist/report/model/locale.d.mts +3 -1
- package/dist/report/model/locale.d.ts +3 -1
- package/dist/report/react/styles.css +80 -0
- package/dist/runner/build-preparation.cjs +5 -5
- package/dist/runner/build-preparation.cjs.map +1 -1
- package/dist/runner/build-preparation.d.cts +2 -3
- package/dist/runner/build-preparation.d.mts +2 -3
- package/dist/runner/build-preparation.d.ts +2 -3
- package/dist/runner/feedback/coordinator.cjs +18 -15
- package/dist/runner/feedback/coordinator.cjs.map +1 -1
- package/dist/runner/feedback/coordinator.d.cts +6 -0
- package/dist/runner/feedback/coordinator.d.mts +6 -0
- package/dist/runner/feedback/coordinator.d.ts +6 -0
- package/dist/runner/ledger.cjs +3 -13
- package/dist/runner/ledger.cjs.map +1 -1
- package/dist/runner/ledger.d.cts +1 -3
- package/dist/runner/ledger.d.mts +1 -3
- package/dist/runner/ledger.d.ts +1 -3
- package/dist/runner/run.cjs +63 -18
- package/dist/runner/run.cjs.map +1 -1
- package/dist/runner/session.cjs +10 -0
- package/dist/runner/session.cjs.map +1 -1
- package/dist/runner/session.d.cts +25 -0
- package/dist/runner/session.d.mts +25 -0
- package/dist/runner/session.d.ts +25 -0
- package/dist/runner/types.cjs.map +1 -1
- package/dist/runner/types.d.cts +1 -2
- package/dist/runner/types.d.mts +1 -2
- package/dist/runner/types.d.ts +1 -2
- package/dist/sandbox/build-coordinator.cjs +38 -19
- package/dist/sandbox/build-coordinator.cjs.map +1 -1
- package/dist/sandbox/build-coordinator.d.cts +47 -7
- package/dist/sandbox/build-coordinator.d.mts +47 -7
- package/dist/sandbox/build-coordinator.d.ts +47 -7
- package/dist/sandbox/build-coordinator.js +8 -4
- package/dist/sandbox/cli/contribution.cjs +128 -0
- package/dist/sandbox/cli/contribution.cjs.map +1 -0
- package/dist/sandbox/cli/contribution.d.cts +71 -0
- package/dist/sandbox/cli/contribution.d.mts +71 -0
- package/dist/sandbox/cli/contribution.d.ts +71 -0
- package/dist/sandbox/cli/contribution.js +8 -0
- package/dist/sandbox/cli/contribution.js.map +1 -0
- package/dist/sandbox/cli-commands.cjs +14 -21
- package/dist/sandbox/cli-commands.cjs.map +1 -1
- package/dist/sandbox/cli-commands.d.cts +12 -8
- package/dist/sandbox/cli-commands.d.mts +12 -8
- package/dist/sandbox/cli-commands.d.ts +12 -8
- package/dist/sandbox/compose.cjs +22 -2
- package/dist/sandbox/compose.cjs.map +1 -1
- package/dist/sandbox/compose.d.cts +1 -1
- package/dist/sandbox/compose.d.mts +1 -1
- package/dist/sandbox/compose.d.ts +1 -1
- package/dist/sandbox/docker-profile/cli.cjs +13 -9
- package/dist/sandbox/docker-profile/cli.cjs.map +1 -1
- package/dist/sandbox/docker-profile/cli.d.cts +2 -0
- package/dist/sandbox/docker-profile/cli.d.mts +2 -0
- package/dist/sandbox/docker-profile/cli.d.ts +2 -0
- package/dist/sandbox/docker-profile/runtime.cjs +68 -7
- package/dist/sandbox/docker-profile/runtime.cjs.map +1 -1
- package/dist/sandbox/docker-profile/runtime.d.cts +19 -1
- package/dist/sandbox/docker-profile/runtime.d.mts +19 -1
- package/dist/sandbox/docker-profile/runtime.d.ts +19 -1
- package/dist/sandbox/docker-profile/runtime.js +10 -8
- package/dist/sandbox/docker-profile/schema.cjs +68 -19
- package/dist/sandbox/docker-profile/schema.cjs.map +1 -1
- package/dist/sandbox/docker-profile/schema.d.cts +23 -9
- package/dist/sandbox/docker-profile/schema.d.mts +23 -9
- package/dist/sandbox/docker-profile/schema.d.ts +23 -9
- package/dist/sandbox/docker-task-build-cache.cjs +532 -0
- package/dist/sandbox/docker-task-build-cache.cjs.map +1 -0
- package/dist/sandbox/docker-task-build-cache.d.cts +68 -0
- package/dist/sandbox/docker-task-build-cache.d.mts +68 -0
- package/dist/sandbox/docker-task-build-cache.d.ts +68 -0
- package/dist/sandbox/docker-task-build-cache.js +20 -0
- package/dist/sandbox/docker-task-build-cache.js.map +1 -0
- package/dist/sandbox/docker.cjs +50 -0
- package/dist/sandbox/docker.cjs.map +1 -1
- package/dist/sandbox/docker.d.cts +15 -0
- package/dist/sandbox/docker.d.mts +15 -0
- package/dist/sandbox/docker.d.ts +15 -0
- package/dist/sandbox/dockerfile-build.cjs +55 -5
- package/dist/sandbox/dockerfile-build.cjs.map +1 -1
- package/dist/sandbox/dockerfile-build.d.cts +2 -2
- package/dist/sandbox/dockerfile-build.d.mts +2 -2
- package/dist/sandbox/dockerfile-build.d.ts +2 -2
- package/dist/sandbox/index.cjs +5 -3
- package/dist/sandbox/index.cjs.map +1 -1
- package/dist/sandbox/index.d.cts +4 -3
- package/dist/sandbox/index.d.mts +4 -3
- package/dist/sandbox/index.d.ts +4 -3
- package/dist/sandbox/index.js +16 -14
- package/dist/sandbox/index.mjs +16 -14
- package/dist/sandbox/keep.cjs +1 -3
- package/dist/sandbox/keep.cjs.map +1 -1
- package/dist/sandbox/layer.cjs +70 -79
- package/dist/sandbox/layer.cjs.map +1 -1
- package/dist/sandbox/layer.d.cts +6 -12
- package/dist/sandbox/layer.d.mts +6 -12
- package/dist/sandbox/layer.d.ts +6 -12
- package/dist/sandbox/layer.js +16 -18
- package/dist/sandbox/ledger-paths.cjs +4 -18
- package/dist/sandbox/ledger-paths.cjs.map +1 -1
- package/dist/sandbox/ledger-paths.d.cts +3 -13
- package/dist/sandbox/ledger-paths.d.mts +3 -13
- package/dist/sandbox/ledger-paths.d.ts +3 -13
- package/dist/sandbox/ledger-paths.js +4 -8
- package/dist/sandbox/registry.cjs +1 -1
- package/dist/sandbox/registry.cjs.map +1 -1
- package/dist/sandbox/runtime.cjs +27 -37
- package/dist/sandbox/runtime.cjs.map +1 -1
- package/dist/sandbox/runtime.d.cts +1 -2
- package/dist/sandbox/runtime.d.mts +1 -2
- package/dist/sandbox/runtime.d.ts +1 -2
- package/dist/sandbox/runtime.js +6 -8
- package/dist/sandbox/types.cjs.map +1 -1
- package/dist/sandbox/types.d.cts +3 -3
- package/dist/sandbox/types.d.mts +3 -3
- package/dist/sandbox/types.d.ts +3 -3
- package/dist/sources/project.json +6 -0
- package/dist/vendor/remark/remark-gfm.cjs +72 -72
- package/dist/vendor/remark/remark-gfm.cjs.map +1 -1
- package/dist/vendor/remark/remark-parse.cjs +54 -54
- package/dist/vendor/remark/remark-parse.cjs.map +1 -1
- package/dist/vendor/remark/remark.cjs +125 -125
- package/dist/vendor/remark/remark.cjs.map +2 -2
- package/docs-site/zh/README.md +1 -1
- package/docs-site/zh/explanation/assert.mdx +4 -0
- package/docs-site/zh/explanation/judge.mdx +40 -9
- package/docs-site/zh/reference/cli.mdx +67 -43
- package/docs-site/zh/reference/define-agent.mdx +2 -2
- package/docs-site/zh/reference/report-components.mdx +4 -3
- package/docs-site/zh/troubleshooting/debug-sandbox.mdx +6 -0
- package/docs-site/zh/troubleshooting/debugging.mdx +28 -1
- package/docs-site/zh/tutorials/agent-feedback-loop.mdx +4 -2
- package/docs-site/zh/tutorials/concurrency.mdx +2 -2
- package/docs-site/zh/tutorials/custom-reports.mdx +175 -9
- package/docs-site/zh/tutorials/docker-in-docker.mdx +52 -7
- package/docs-site/zh/tutorials/eval-groups.mdx +1 -2
- package/docs-site/zh/tutorials/evaluation-kinds.mdx +39 -6
- package/docs-site/zh/tutorials/nixos-managed-dind.mdx +14 -5
- package/docs-site/zh/tutorials/sandbox-providers.mdx +1 -28
- package/docs-site/zh/tutorials/sandbox-reuse.mdx +1 -1
- package/docs-site/zh/tutorials/viewing-results.mdx +2 -0
- package/package.json +24 -19
- package/README.md +0 -176
- package/README.zh.md +0 -176
- package/dist/cli/record.cjs +0 -246
- package/dist/cli/record.cjs.map +0 -1
- package/dist/cli/record.d.cts +0 -40
- package/dist/cli/record.d.mts +0 -40
- package/dist/cli/record.d.ts +0 -40
- package/dist/cli/record.js +0 -10
- package/dist/cli/record.js.map +0 -1
- package/dist/sandbox/local.cjs +0 -361
- package/dist/sandbox/local.cjs.map +0 -1
- package/dist/sandbox/local.d.cts +0 -80
- package/dist/sandbox/local.d.mts +0 -80
- package/dist/sandbox/local.d.ts +0 -80
- package/dist/sandbox/local.js +0 -6
- package/dist/sandbox/local.js.map +0 -1
package/README.md
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
# NiceEval
|
|
4
|
-
|
|
5
|
-
**Progressive, agent-native evals tool for AI agents, with excellent DX**
|
|
6
|
-
|
|
7
|
-
[](tsconfig.json)
|
|
8
|
-
[](package.json)
|
|
9
|
-
[](docs/README.md)
|
|
10
|
-
[](https://discord.gg/yTMdZjFFJ)
|
|
11
|
-
|
|
12
|
-
[中文](README.zh.md) | [Deutsch](assets/README.de.md) | [Español](assets/README.es.md) | [français](assets/README.fr.md) | [日本語](assets/README.ja.md) | [한국어](assets/README.ko.md) | [Português](assets/README.pt.md) | [Русский](assets/README.ru.md)
|
|
13
|
-
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
NiceEval is an agent eval tool that helps teams measure, evaluate, and improve AI in production. With NiceEval, teams can compare models, iterate on agents, catch regressions, and keep improving their AI applications using real user data.
|
|
17
|
-
|
|
18
|
-
NiceEval is local-first at its core: your evals run in your own environment. When your team needs to share evals or track regressions, you can push a Report to platforms like BrainTrust, or export a custom report.
|
|
19
|
-
|
|
20
|
-
## Why NiceEval when DeepEval, LangFuse, and BrainTrust already exist
|
|
21
|
-
|
|
22
|
-
NiceEval is an Agent-Native eval tool. The Dataset / golden pattern of building an Input and an Expected Output doesn't fit real agent evaluation.
|
|
23
|
-
Agents today need to be evaluated at a finer grain — multi-turn conversations, multi-agent collaboration, tool calls, skill loading — and NiceEval does this better.
|
|
24
|
-
|
|
25
|
-
It also coexists with LangFuse and BrainTrust: use them for tracing, or upload eval results to both.
|
|
26
|
-
|
|
27
|
-
## Architecture
|
|
28
|
-
|
|
29
|
-
NiceEval supports two integration modes, depending on whether the agent under test needs an isolated sandbox filesystem.
|
|
30
|
-
|
|
31
|
-
**Mode 1: Sandbox (Docker, E2B) — run coding agents like Codex and Claude Code that need a sandbox**
|
|
32
|
-
|
|
33
|
-
```text
|
|
34
|
-
evals/*.eval.ts
|
|
35
|
-
│
|
|
36
|
-
▼
|
|
37
|
-
┌────────────┐
|
|
38
|
-
│ NiceEval │
|
|
39
|
-
└────────────┘
|
|
40
|
-
│
|
|
41
|
-
│ Agent adapter (official)
|
|
42
|
-
▼
|
|
43
|
-
┌────────────────────────────────┐
|
|
44
|
-
│ Docker Sandbox │
|
|
45
|
-
│ ┌────────────────────────┐ │
|
|
46
|
-
│ │ Codex / Claude Code │ │
|
|
47
|
-
│ │ apps needing isolation │ │
|
|
48
|
-
│ └────────────────────────┘ │
|
|
49
|
-
└────────────────────────────────┘
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
**Mode 2: Direct — connect straight to your own AI Agent**
|
|
53
|
-
|
|
54
|
-
```text
|
|
55
|
-
evals/*.eval.ts
|
|
56
|
-
│
|
|
57
|
-
▼
|
|
58
|
-
┌────────────┐
|
|
59
|
-
│ NiceEval │
|
|
60
|
-
└────────────┘
|
|
61
|
-
│
|
|
62
|
-
│ Agent adapter (official, or your own implementation)
|
|
63
|
-
▼
|
|
64
|
-
┌──────────────────────────┐
|
|
65
|
-
│ your own AI Agent │
|
|
66
|
-
│ (AI SDK·LangGraph·Pi) │
|
|
67
|
-
└──────────────────────────┘
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
- **NiceEval core** owns discovery, scheduling, assertions, reporting, and artifacts.
|
|
71
|
-
- **Agent adapters** are the open boundary: you decide how to call the system under test.
|
|
72
|
-
- Coding agents that need filesystem isolation run inside the **Docker Sandbox**; your own AI agent can connect directly, without Docker.
|
|
73
|
-
|
|
74
|
-
## Core concepts at a glance
|
|
75
|
-
|
|
76
|
-
| Concept | In one line |
|
|
77
|
-
|---|---|
|
|
78
|
-
| Eval | A test case: written in `evals/*.eval.ts`, describing what to check. |
|
|
79
|
-
| Experiment | A checked-in run configuration: which Adapter, which model, which flags. |
|
|
80
|
-
| Adapter | The layer that connects to the system under test: implement one `send`, get back a standard event stream. |
|
|
81
|
-
| Sandbox | Only needed for coding agents that require an isolated workspace; a direct web agent doesn't need one. |
|
|
82
|
-
| Tier | Three levels of Adapter integration effort: Tier 1 wires up `send` only, Tier 2 adds OTel for a call waterfall, Tier 3 makes invasive changes for feature A/B testing. |
|
|
83
|
-
|
|
84
|
-
See the full glossary in the [architecture overview](https://niceeval.com/docs/concepts/overview).
|
|
85
|
-
|
|
86
|
-
## Example
|
|
87
|
-
|
|
88
|
-
```ts
|
|
89
|
-
// evals/eval-tool-call.eval.ts
|
|
90
|
-
import { defineEval } from "niceeval";
|
|
91
|
-
import { includes, jsonMatch, pattern, toolMatch } from "niceeval/expect";
|
|
92
|
-
|
|
93
|
-
export default defineEval({
|
|
94
|
-
judge: true,
|
|
95
|
-
description: "Verify the agent calls the weather tool and answers from its result",
|
|
96
|
-
|
|
97
|
-
async test(t) {
|
|
98
|
-
const turn = await t.send("What's the weather in Beijing today?");
|
|
99
|
-
turn.succeeded();
|
|
100
|
-
|
|
101
|
-
await t.group("calls get_weather with the right city", () => {
|
|
102
|
-
turn.calledTool(toolMatch("get_weather", { input: jsonMatch({ city: "Beijing" }) }));
|
|
103
|
-
t.check(turn.message, pattern(/°C|sunny|cloudy|rain/));
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
const second = await t.send("What about Shanghai tomorrow?");
|
|
107
|
-
t.check(second.message, includes("Shanghai"));
|
|
108
|
-
|
|
109
|
-
turn.judge.autoevals
|
|
110
|
-
.closedQA("Does the reply use the tool's weather data instead of making up a temperature?")
|
|
111
|
-
.gate(0.7);
|
|
112
|
-
},
|
|
113
|
-
});
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
```ts
|
|
117
|
-
// experiments/local.ts
|
|
118
|
-
import { defineExperiment } from "niceeval";
|
|
119
|
-
import { webAgent } from "./adapter"; // your agent adapter, pointed at the system under test
|
|
120
|
-
|
|
121
|
-
export default defineExperiment({
|
|
122
|
-
agent: webAgent({ baseUrl: "http://127.0.0.1:5188" }),
|
|
123
|
-
model: "gpt-5.5"
|
|
124
|
-
});
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
```sh
|
|
128
|
-
pnpm exec niceeval exp local eval-tool-call // run only eval-tool-call under the local experiment
|
|
129
|
-
pnpm exec niceeval view // view eval results
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
## Quick Start
|
|
133
|
-
|
|
134
|
-
```text
|
|
135
|
-
READ https://niceeval.com/INIT.md and set up niceeval for this repo: install it, integrate it with this project, and run the first eval end to end.
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
Start from the scenario that matches what you need to evaluate:
|
|
139
|
-
|
|
140
|
-
- [Claude Code / Codex plugin eval](https://niceeval.com/docs/example/claude-code-codex-plugin)
|
|
141
|
-
- [Claude Code / Codex skill eval](https://niceeval.com/docs/example/claude-code-codex-skill)
|
|
142
|
-
- [AI Agent application eval](https://niceeval.com/docs/example/ai-agent-application)
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
## Roadmap
|
|
146
|
-
Official Adapters
|
|
147
|
-
- [ ] Agent Software
|
|
148
|
-
- [x] Claude Code
|
|
149
|
-
- [x] Codex
|
|
150
|
-
- [x] Bub
|
|
151
|
-
- [x] OpenCode
|
|
152
|
-
- [x] Hermes Agent
|
|
153
|
-
- [x] OpenClaw
|
|
154
|
-
- [ ] Alma
|
|
155
|
-
- [ ] ...
|
|
156
|
-
|
|
157
|
-
- [ ] Agent Frameworks
|
|
158
|
-
- [x] AI SDK
|
|
159
|
-
- [x] Claude SDK
|
|
160
|
-
- [x] Codex SDK
|
|
161
|
-
- [x] Pi Agent SDK
|
|
162
|
-
- [ ] LangGraph
|
|
163
|
-
- [ ] vm0
|
|
164
|
-
- [ ] Cursor Agent SDK
|
|
165
|
-
|
|
166
|
-
## Documentation
|
|
167
|
-
|
|
168
|
-
- [Quickstart](https://niceeval.com/docs/quickstart)
|
|
169
|
-
|
|
170
|
-
# Acknowledgements
|
|
171
|
-
This project was inspired by — or had its code learned by AI from — the projects below:
|
|
172
|
-
- [eve](https://eve.dev): the main DX and API inspiration
|
|
173
|
-
- [agent eval](https://github.com/vercel-labs/agent-eval)
|
|
174
|
-
- [ponytail](https://github.com/DietrichGebert/ponytail)
|
|
175
|
-
|
|
176
|
-
Thanks to [Linux.do](https://linux.do/) for their support and feedback during the project's early development.
|
package/README.zh.md
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
|
|
3
|
-
# NiceEval
|
|
4
|
-
|
|
5
|
-
**渐进式、Agent Native、DX优秀的 AI agent evals 工具**
|
|
6
|
-
|
|
7
|
-
[](tsconfig.json)
|
|
8
|
-
[](package.json)
|
|
9
|
-
[](docs/README.md)
|
|
10
|
-
[](https://discord.gg/yTMdZjFFJ)
|
|
11
|
-
|
|
12
|
-
[English](README.md) | [Deutsch](assets/README.de.md) | [Español](assets/README.es.md) | [français](assets/README.fr.md) | [日本語](assets/README.ja.md) | [한국어](assets/README.ko.md) | [Português](assets/README.pt.md) | [Русский](assets/README.ru.md)
|
|
13
|
-
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
NiceEval 是一个 Agent 评估工具,帮助团队衡量、评估并改进生产环境中的 AI。借助 NiceEval,团队可以比较模型、迭代 Agent、发现回归问题,并利用真实用户数据持续改进 AI 应用。
|
|
17
|
-
|
|
18
|
-
NiceEval 以本地优先为核心:你的评估在你自己的环境中运行。当你的团队需要分享评估、回归跟踪时,可以通过 Report 上报到 BrainTrust 等平台,或者自定义的报告导出。
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
## 为什么有了 DeepEval、LangFuse、BrainTrust 还需要 NiceEval
|
|
22
|
-
NiceEval 是一个 Agent-Native 的评估工具。Dataset / golden 那一套「构建 Input 与 Expected Output」的模式,并不适合真实的 Agent 评估。
|
|
23
|
-
现在 Agent 需要在多轮对话、多 agent 协作、工具调用、Skill 加载等细粒度场景下进行评估,NiceEval 能做得更好。
|
|
24
|
-
|
|
25
|
-
同时,NiceEval 也能与 LangFuse、BrainTrust 共存:可以用它们做 tracing,或者把评估结果上传到两者。
|
|
26
|
-
|
|
27
|
-
## 架构
|
|
28
|
-
|
|
29
|
-
NiceEval 支持两种接入方式,取决于被测 agent 是否需要隔离的沙箱文件系统。
|
|
30
|
-
|
|
31
|
-
**模式一:Sandbox(Docker、E2B)—— 跑 Codex、Claude Code 等需要 sandbox 的 coding agent**
|
|
32
|
-
|
|
33
|
-
```text
|
|
34
|
-
evals/*.eval.ts
|
|
35
|
-
│
|
|
36
|
-
▼
|
|
37
|
-
┌─────────────────────┐
|
|
38
|
-
│ NiceEval │
|
|
39
|
-
└─────────────────────┘
|
|
40
|
-
│
|
|
41
|
-
│ Agent 适配器(官方)
|
|
42
|
-
▼
|
|
43
|
-
┌──────────────────────────────┐
|
|
44
|
-
│ Docker Sandbox │
|
|
45
|
-
│ ┌────────────────────────┐ │
|
|
46
|
-
│ │ Codex / Claude Code │ │
|
|
47
|
-
│ │ 需要隔离文件系统的应用 │ │
|
|
48
|
-
│ └────────────────────────┘ │
|
|
49
|
-
└──────────────────────────────┘
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
**模式二:直连 —— 直接连接你自己的 AI Agent**
|
|
53
|
-
|
|
54
|
-
```text
|
|
55
|
-
evals/*.eval.ts
|
|
56
|
-
│
|
|
57
|
-
▼
|
|
58
|
-
┌─────────────────────┐
|
|
59
|
-
│ NiceEval │
|
|
60
|
-
└─────────────────────┘
|
|
61
|
-
│
|
|
62
|
-
│ Agent 适配器(官方,或者自己实现)
|
|
63
|
-
▼
|
|
64
|
-
┌──────────────────────────────┐
|
|
65
|
-
│ 你自己的 AI Agent │
|
|
66
|
-
│ (AI SDK·LangGraph·Pi ) │
|
|
67
|
-
└──────────────────────────────┘
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
- **NiceEval 核心** 负责发现 eval、调度运行、打分、生成报告与 artifacts。
|
|
71
|
-
- **Agent 适配器** 是开放的边界:你来决定如何调用被测系统。
|
|
72
|
-
- 需要文件系统隔离的 coding agent 走 **Docker Sandbox**;自有的 AI Agent 可以直连,无需 Docker。
|
|
73
|
-
|
|
74
|
-
## 核心概念一览
|
|
75
|
-
|
|
76
|
-
| 概念 | 一句话 |
|
|
77
|
-
|---|---|
|
|
78
|
-
| Eval | 一个测试用例:写在 `evals/*.eval.ts` 里,描述测什么。 |
|
|
79
|
-
| Experiment | 可签入的运行配置:决定连哪个 Adapter、什么 model、什么 flags。 |
|
|
80
|
-
| Adapter | 连接被测系统的适配层:实现一个 `send`,把返回翻译成标准事件流。 |
|
|
81
|
-
| Sandbox | 需要隔离工作区的 coding agent 才用得到;直连 Web Agent 不需要。 |
|
|
82
|
-
| Tier | 接入 Adapter 的三档投入:Tier 1 只接 send,Tier 2 加 OTel 换调用瀑布图,Tier 3 侵入改造做 feature A/B。 |
|
|
83
|
-
|
|
84
|
-
完整术语表见[架构概览](https://niceeval.com/docs/zh/explanation/overview)。
|
|
85
|
-
|
|
86
|
-
## 示例
|
|
87
|
-
|
|
88
|
-
```ts
|
|
89
|
-
// evals/eval-tool-call.eval.ts
|
|
90
|
-
import { defineEval } from "niceeval";
|
|
91
|
-
import { includes, jsonMatch, pattern, toolMatch } from "niceeval/expect";
|
|
92
|
-
|
|
93
|
-
export default defineEval({
|
|
94
|
-
judge: true,
|
|
95
|
-
description: "测试 agent 在实时天气问题中正确调用工具并基于结果作答的能力",
|
|
96
|
-
|
|
97
|
-
async test(t) {
|
|
98
|
-
const turn = await t.send("北京今天天气怎么样?");
|
|
99
|
-
turn.succeeded();
|
|
100
|
-
|
|
101
|
-
await t.group("调用 get_weather 且城市正确", () => {
|
|
102
|
-
turn.calledTool(toolMatch("get_weather", { input: jsonMatch({ city: "北京" }) }));
|
|
103
|
-
t.check(turn.message, pattern(/°C|气温|天气|晴|多云|雨/));
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
const second = await t.send("上海明天天气怎么样?");
|
|
107
|
-
t.check(second.message, includes("上海"));
|
|
108
|
-
|
|
109
|
-
turn.judge.autoevals
|
|
110
|
-
.closedQA("助手是否基于工具返回的天气数据作答,而不是凭空编造温度?")
|
|
111
|
-
.gate(0.7);
|
|
112
|
-
},
|
|
113
|
-
});
|
|
114
|
-
```
|
|
115
|
-
|
|
116
|
-
```ts
|
|
117
|
-
// experiments/local.ts
|
|
118
|
-
import { defineExperiment } from "niceeval";
|
|
119
|
-
import { webAgent } from "./adapter"; // 你自己写的 agent adapter,接被测 web agent
|
|
120
|
-
|
|
121
|
-
export default defineExperiment({
|
|
122
|
-
agent: webAgent({ baseUrl: "http://127.0.0.1:5188" }),
|
|
123
|
-
model: "gpt-5.5"
|
|
124
|
-
});
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
```sh
|
|
128
|
-
pnpm exec niceeval exp local eval-tool-call // 用 local experiment 只跑 eval-tool-call
|
|
129
|
-
pnpm exec niceeval view // 查看评估结果
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
## 快速开始
|
|
133
|
-
|
|
134
|
-
```text
|
|
135
|
-
READ https://niceeval.com/INIT.md and set up niceeval for this repo: install it, integrate it with this project, and run the first eval end to end.
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
从你的场景开始:
|
|
139
|
-
|
|
140
|
-
- [浏览可运行示例](https://niceeval.com/docs/zh/examples)
|
|
141
|
-
- [评估 Coding Agent 扩展](https://niceeval.com/docs/zh/examples/coding-agent-extensions)
|
|
142
|
-
- [自写 Adapter 评估 AI Agent 应用](https://niceeval.com/docs/zh/examples/ai-agent-application)
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
## Roadmap
|
|
146
|
-
官方适配器
|
|
147
|
-
- [ ] Agent 软件
|
|
148
|
-
- [x] Claude Code
|
|
149
|
-
- [x] Codex
|
|
150
|
-
- [x] Bub
|
|
151
|
-
- [x] OpenCode
|
|
152
|
-
- [x] Hermes Agent
|
|
153
|
-
- [x] OpenClaw
|
|
154
|
-
- [ ] Alma
|
|
155
|
-
- [ ] ...
|
|
156
|
-
|
|
157
|
-
- [ ] Agent 框架
|
|
158
|
-
- [x] AI SDK
|
|
159
|
-
- [x] Claude SDK
|
|
160
|
-
- [x] Codex SDK
|
|
161
|
-
- [x] Pi Agent SDK
|
|
162
|
-
- [ ] LangGraph
|
|
163
|
-
- [ ] vm0
|
|
164
|
-
- [ ] Cursor Agent SDK
|
|
165
|
-
|
|
166
|
-
## 文档
|
|
167
|
-
|
|
168
|
-
- [快速开始](https://www.niceeval.com/docs/zh/tutorials/quickstart)
|
|
169
|
-
|
|
170
|
-
# 感谢
|
|
171
|
-
该项目受下面项目所启发或者是由AI从下面项目中学习代码所写
|
|
172
|
-
- [eve](https://eve.dev): 主要的 DX 与 API 受 Eve 所启发
|
|
173
|
-
- [agent eval](https://github.com/vercel-labs/agent-eval)
|
|
174
|
-
- [ponytail](https://github.com/DietrichGebert/ponytail)
|
|
175
|
-
|
|
176
|
-
感谢 [Linux.do](https://linux.do/) 在项目早期开发期间给予的支持与反馈。
|
package/dist/cli/record.cjs
DELETED
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NodeRecordCliLive = void 0;
|
|
4
|
-
exports.ensureAutomaticRecordMigration = ensureAutomaticRecordMigration;
|
|
5
|
-
exports.runRecordCliCommand = runRecordCliCommand;
|
|
6
|
-
const node_path_1 = require("node:path");
|
|
7
|
-
const effect_1 = require("effect");
|
|
8
|
-
const index_ts_1 = require("../record/index.cjs");
|
|
9
|
-
const index_ts_2 = require("../record/host/index.cjs");
|
|
10
|
-
const errors_ts_1 = require("../record/reader/errors.cjs");
|
|
11
|
-
const services_ts_1 = require("../record/platform/services.cjs");
|
|
12
|
-
function output(input) {
|
|
13
|
-
return Object.freeze({
|
|
14
|
-
exitCode: input.exitCode,
|
|
15
|
-
stdout: input.stdout ?? "",
|
|
16
|
-
stderr: input.stderr ?? "",
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
exports.NodeRecordCliLive = index_ts_1.NodeRecordLive;
|
|
20
|
-
/**
|
|
21
|
-
* Preflight for ordinary CLI entry points. Every Scope is closed before the
|
|
22
|
-
* next lease kind is acquired: read check -> exclusive maintenance -> caller's
|
|
23
|
-
* fresh ordinary open.
|
|
24
|
-
*/
|
|
25
|
-
function ensureAutomaticRecordMigration(input) {
|
|
26
|
-
const root = (0, index_ts_1.makeRecordRoot)((0, node_path_1.resolve)(input.cwd, input.record ?? ".niceeval/record"));
|
|
27
|
-
if (effect_1.Either.isLeft(root))
|
|
28
|
-
return effect_1.Effect.fail(root.left);
|
|
29
|
-
return effect_1.Effect.gen(function* () {
|
|
30
|
-
const fileSystem = yield* services_ts_1.RecordFileSystem;
|
|
31
|
-
if ((yield* fileSystem.pathKind((0, services_ts_1.recordPortablePath)(root.right, "record.json"))) === "missing") {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
const checked = yield* effect_1.Effect.either(effect_1.Effect.scoped(index_ts_2.recordHost.current.openRead({ root: root.right })));
|
|
35
|
-
if (effect_1.Either.isRight(checked))
|
|
36
|
-
return null;
|
|
37
|
-
if (!(checked.left instanceof errors_ts_1.RecordMigrationRequired))
|
|
38
|
-
return yield* effect_1.Effect.fail(checked.left);
|
|
39
|
-
return yield* effect_1.Effect.scoped(effect_1.Effect.gen(function* () {
|
|
40
|
-
const session = yield* index_ts_2.recordHost.maintenance.open({ root: root.right });
|
|
41
|
-
const plan = yield* session.planMigrate();
|
|
42
|
-
if (plan.state !== "migration-required") {
|
|
43
|
-
return yield* effect_1.Effect.fail(checked.left);
|
|
44
|
-
}
|
|
45
|
-
if (plan.backup.state !== "git-restore-point") {
|
|
46
|
-
return yield* effect_1.Effect.fail(new errors_ts_1.RecordAutoMigrationGitSaveRequired({
|
|
47
|
-
code: "record-auto-migration-git-save-required",
|
|
48
|
-
}));
|
|
49
|
-
}
|
|
50
|
-
const receipt = yield* session.applyMigrate(plan).pipe(effect_1.Effect.catchTag("RecordMigrationGitRestoreRequired", () => effect_1.Effect.fail(new errors_ts_1.RecordAutoMigrationGitSaveRequired({
|
|
51
|
-
code: "record-auto-migration-git-save-required",
|
|
52
|
-
}))));
|
|
53
|
-
return Object.freeze({
|
|
54
|
-
restoreCommit: plan.backup.commit,
|
|
55
|
-
attachments: receipt.state === "migrated" ? receipt.attachments : Object.freeze([]),
|
|
56
|
-
});
|
|
57
|
-
}));
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
function resolveRecordRoot(input) {
|
|
61
|
-
const root = (0, index_ts_1.makeRecordRoot)((0, node_path_1.resolve)(input.cwd, input.record ?? ".niceeval/record"));
|
|
62
|
-
return effect_1.Either.isLeft(root)
|
|
63
|
-
? effect_1.Either.left(output({
|
|
64
|
-
exitCode: 1,
|
|
65
|
-
stderr: `${root.left.code}\n`,
|
|
66
|
-
}))
|
|
67
|
-
: effect_1.Either.right(root.right);
|
|
68
|
-
}
|
|
69
|
-
function recordErrorCode(error) {
|
|
70
|
-
if (typeof error !== "object" || error === null)
|
|
71
|
-
return "record-command-failed";
|
|
72
|
-
const candidate = Reflect.get(error, "code");
|
|
73
|
-
return typeof candidate === "string" ? candidate : "record-command-failed";
|
|
74
|
-
}
|
|
75
|
-
function recordErrorNextStep(code) {
|
|
76
|
-
switch (code) {
|
|
77
|
-
case "record-migration-required":
|
|
78
|
-
return "Run: niceeval migrate";
|
|
79
|
-
case "record-migration-interrupted":
|
|
80
|
-
return "Restore the complete Record from the recorded Git commit; do not rerun migrate on mixed bytes.";
|
|
81
|
-
case "record-migration-recovery-required":
|
|
82
|
-
return "Restore the complete Record from Git before retrying migration.";
|
|
83
|
-
case "record-migration-plan-stale":
|
|
84
|
-
return "Review the new migration plan and rerun migrate.";
|
|
85
|
-
case "record-migration-git-restore-required":
|
|
86
|
-
return "Commit, restore, or otherwise obtain a clean Git restore point for this Record before migrating.";
|
|
87
|
-
case "record-migration-invalid":
|
|
88
|
-
return "Restore the Record from Git before retrying migration.";
|
|
89
|
-
case "record-format-unsupported":
|
|
90
|
-
return "Install a NiceEval version that supports this Record format.";
|
|
91
|
-
case "record-maintenance-busy":
|
|
92
|
-
case "record-writer-busy":
|
|
93
|
-
return "Close the Record command holding the lock, then retry.";
|
|
94
|
-
default:
|
|
95
|
-
return undefined;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
function shellQuote(value) {
|
|
99
|
-
return `'${value.replaceAll("'", `'"'"'`)}'`;
|
|
100
|
-
}
|
|
101
|
-
function recoveryCommands(restoreCommit, recordPath) {
|
|
102
|
-
const root = shellQuote(recordPath);
|
|
103
|
-
const commit = shellQuote(restoreCommit);
|
|
104
|
-
const sentinel = shellQuote((0, node_path_1.resolve)(recordPath, "migration.in-progress"));
|
|
105
|
-
return [
|
|
106
|
-
`Restore command: git -C ${root} restore --source=${commit} --staged --worktree -- .`,
|
|
107
|
-
`Verify command: git -C ${root} diff --quiet ${commit} -- . && git -C ${root} diff --cached --quiet ${commit} -- .`,
|
|
108
|
-
`Clear sentinel after verification: rm -f -- ${sentinel}`,
|
|
109
|
-
].join("\n") + "\n";
|
|
110
|
-
}
|
|
111
|
-
function interruptedRecovery(error, recordPath) {
|
|
112
|
-
if (typeof error !== "object" || error === null || recordPath === undefined)
|
|
113
|
-
return "";
|
|
114
|
-
const restoreCommit = Reflect.get(error, "restoreCommit");
|
|
115
|
-
return Reflect.get(error, "restoreSafe") === true &&
|
|
116
|
-
typeof restoreCommit === "string" && /^[0-9a-f]{40,64}$/.test(restoreCommit)
|
|
117
|
-
? recoveryCommands(restoreCommit, recordPath)
|
|
118
|
-
: "";
|
|
119
|
-
}
|
|
120
|
-
function recordErrorOutput(error, stdout = "", recordPath) {
|
|
121
|
-
const code = recordErrorCode(error);
|
|
122
|
-
const automaticRestoreUnsafe = (code === "record-migration-interrupted" || code === "record-migration-recovery-required") &&
|
|
123
|
-
(typeof error !== "object" || error === null || Reflect.get(error, "restoreSafe") !== true);
|
|
124
|
-
const next = automaticRestoreUnsafe
|
|
125
|
-
? "Inspect and preserve concurrent Record edits before choosing a manual recovery; no automatic Git restore command is safe."
|
|
126
|
-
: recordErrorNextStep(code);
|
|
127
|
-
const causeCode = typeof error === "object" && error !== null &&
|
|
128
|
-
typeof Reflect.get(error, "causeCode") === "string"
|
|
129
|
-
? String(Reflect.get(error, "causeCode"))
|
|
130
|
-
: undefined;
|
|
131
|
-
return output({
|
|
132
|
-
exitCode: 1,
|
|
133
|
-
stdout,
|
|
134
|
-
stderr: `${code}\n${next === undefined ? "" : `${next}\n`}${causeCode === undefined ? "" : `Cause: ${causeCode}\n`}${code === "record-migration-interrupted" || code === "record-migration-recovery-required"
|
|
135
|
-
? interruptedRecovery(error, recordPath)
|
|
136
|
-
: ""}`,
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
function cleanCommand(input) {
|
|
140
|
-
return effect_1.Effect.gen(function* () {
|
|
141
|
-
const incomplete = yield* (0, index_ts_1.inspectIncompleteRuns)({ root: input.root });
|
|
142
|
-
if (incomplete.length === 0) {
|
|
143
|
-
return output({
|
|
144
|
-
exitCode: 0,
|
|
145
|
-
stdout: "No incomplete Runs found.\n",
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
const listed = incomplete.map((entry) => ` ${entry.runId}`).join("\n");
|
|
149
|
-
if (!input.yes) {
|
|
150
|
-
return output({
|
|
151
|
-
exitCode: 1,
|
|
152
|
-
stdout: `Incomplete Runs:\n${listed}\n`,
|
|
153
|
-
stderr: "record-clean-confirmation-required\nReview the listed Runs and rerun with --yes.\n",
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
const cleaned = yield* effect_1.Effect.either((0, index_ts_1.cleanIncompleteRuns)({
|
|
157
|
-
root: input.root,
|
|
158
|
-
runIds: incomplete.map((entry) => entry.runId),
|
|
159
|
-
}));
|
|
160
|
-
if (effect_1.Either.isLeft(cleaned)) {
|
|
161
|
-
return recordErrorOutput(cleaned.left, `Incomplete Runs:\n${listed}\n`);
|
|
162
|
-
}
|
|
163
|
-
const lines = ["Cleaned incomplete Runs:"];
|
|
164
|
-
if (cleaned.right.deleted.length === 0)
|
|
165
|
-
lines.push(" deleted: none");
|
|
166
|
-
else
|
|
167
|
-
lines.push(...cleaned.right.deleted.map((runId) => ` deleted: ${runId}`));
|
|
168
|
-
if (cleaned.right.skipped.length > 0) {
|
|
169
|
-
lines.push(...cleaned.right.skipped.map((runId) => ` skipped complete: ${runId}`));
|
|
170
|
-
}
|
|
171
|
-
return output({ exitCode: 0, stdout: `${lines.join("\n")}\n` });
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
function migrateCommand(input) {
|
|
175
|
-
return effect_1.Effect.scoped(effect_1.Effect.gen(function* () {
|
|
176
|
-
const session = yield* index_ts_2.recordHost.maintenance.open({ root: input.root });
|
|
177
|
-
const plan = yield* session.planMigrate();
|
|
178
|
-
const impactText = plan.state !== "migration-required"
|
|
179
|
-
? ""
|
|
180
|
-
: [...new Map(plan.attachments.map((attachment) => {
|
|
181
|
-
const key = `${attachment.family}@${attachment.fromSchemaVersion}->${attachment.toSchemaVersion}`;
|
|
182
|
-
return [key, attachment];
|
|
183
|
-
})).values()].map((attachment) => {
|
|
184
|
-
const retention = attachment.retention;
|
|
185
|
-
const lines = [
|
|
186
|
-
`impact ${attachment.family}@${attachment.fromSchemaVersion}->${attachment.toSchemaVersion}:`,
|
|
187
|
-
` retained facts: ${retention.retainedFacts.length === 0 ? "none" : retention.retainedFacts.join(", ")}`,
|
|
188
|
-
` dropped facts: ${retention.droppedFacts.length === 0 ? "none" : retention.droppedFacts.join(", ")}`,
|
|
189
|
-
];
|
|
190
|
-
if (retention.rerunRecommendation !== null) {
|
|
191
|
-
lines.push(` rerun recommendation: ${retention.rerunRecommendation}`);
|
|
192
|
-
}
|
|
193
|
-
return lines.join("\n");
|
|
194
|
-
}).join("\n");
|
|
195
|
-
const planText = plan.state === "already-current"
|
|
196
|
-
? `Record migration plan: already-current\nformat: ${plan.format}\n`
|
|
197
|
-
: plan.state === "unsupported-format"
|
|
198
|
-
? `Record migration plan: unsupported-format\nformat: ${plan.format}\n`
|
|
199
|
-
: `Record migration plan: migration-required\nformat: ${plan.format}\nattachments: ${plan.attachments.length}\n${impactText === "" ? "" : `${impactText}\n`}backup: ${plan.backup.state}${plan.backup.state === "git-restore-point" ? `\nrestore commit: ${plan.backup.commit}` : ""}\n`;
|
|
200
|
-
if (plan.state === "unsupported-format") {
|
|
201
|
-
return output({
|
|
202
|
-
exitCode: 1,
|
|
203
|
-
stdout: planText,
|
|
204
|
-
stderr: "record-format-unsupported\nInstall a NiceEval version that supports this Record format.\n",
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
if (plan.state === "migration-required" && plan.backup.state !== "git-restore-point") {
|
|
208
|
-
return output({
|
|
209
|
-
exitCode: 1,
|
|
210
|
-
stdout: planText,
|
|
211
|
-
stderr: "record-migration-git-restore-required\nA clean Git restore point is required; --yes cannot bypass this preflight.\n",
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
if (plan.state === "migration-required" && !input.yes) {
|
|
215
|
-
return output({
|
|
216
|
-
exitCode: 1,
|
|
217
|
-
stdout: planText,
|
|
218
|
-
stderr: "record-migration-confirmation-required\nReview the migration plan and rerun with --yes.\n",
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
const migrated = yield* effect_1.Effect.either(session.applyMigrate(plan));
|
|
222
|
-
if (effect_1.Either.isLeft(migrated)) {
|
|
223
|
-
return recordErrorOutput(migrated.left, planText, input.recordPath);
|
|
224
|
-
}
|
|
225
|
-
const receipt = migrated.right;
|
|
226
|
-
return output({
|
|
227
|
-
exitCode: 0,
|
|
228
|
-
stdout: `${planText}Record migration ${receipt.state}.\n`,
|
|
229
|
-
});
|
|
230
|
-
}));
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Effect-native command handling for the Record maintenance surface. The
|
|
234
|
-
* CLI owns the one Promise adaptation at its actual process boundary.
|
|
235
|
-
*/
|
|
236
|
-
function runRecordCliCommand(input) {
|
|
237
|
-
const root = resolveRecordRoot(input);
|
|
238
|
-
if (effect_1.Either.isLeft(root))
|
|
239
|
-
return effect_1.Effect.succeed(root.left);
|
|
240
|
-
if (input.command === "clean") {
|
|
241
|
-
return cleanCommand({ root: root.right, yes: input.yes }).pipe(effect_1.Effect.provide(exports.NodeRecordCliLive), effect_1.Effect.catchAll((error) => effect_1.Effect.succeed(recordErrorOutput(error))));
|
|
242
|
-
}
|
|
243
|
-
const recordPath = (0, node_path_1.resolve)(input.cwd, input.record ?? ".niceeval/record");
|
|
244
|
-
return migrateCommand({ root: root.right, recordPath, yes: input.yes }).pipe(effect_1.Effect.provide(exports.NodeRecordCliLive), effect_1.Effect.catchAll((error) => effect_1.Effect.succeed(recordErrorOutput(error, "", recordPath))));
|
|
245
|
-
}
|
|
246
|
-
//# sourceMappingURL=record.cjs.map
|
package/dist/cli/record.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"record.js","sourceRoot":"","sources":["record.ts"],"names":[],"mappings":";;;AA0CA,wEAqCC;AAwLD,kDASC;AAhRD,yCAAoC;AACpC,mCAA+C;AAC/C,iDAAkI;AAClI,sDAAqD;AAErD,0DAA0G;AAC1G,gEAAsF;AAetF,SAAS,MAAM,CAAC,KAIf;IACG,OAAO,MAAM,CAAC,MAAM,CAAC;QACjB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,EAAE;QAC1B,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,EAAE;KAC7B,CAAC,CAAC;AACP,CAAC;AACY,QAAA,iBAAiB,GAAG,yBAAc,CAAC;AAKhD;;;;GAIG;AACH,SAAgB,8BAA8B,CAAC,KAG9C;IACG,MAAM,IAAI,GAAG,IAAA,yBAAc,EAAC,IAAA,mBAAO,EAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,IAAI,kBAAkB,CAAC,CAAC,CAAC;IACpF,IAAI,eAAM,CAAC,MAAM,CAAC,IAAI,CAAC;QACnB,OAAO,eAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClC,OAAO,eAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QACvB,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,8BAAgB,CAAC;QAC3C,IAAI,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAA,gCAAkB,EAAC,IAAI,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE,CAAC;YAC5F,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,eAAM,CAAC,MAAM,CAAC,eAAM,CAAC,MAAM,CAAC,qBAAU,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U,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1M,CAAC","sourcesContent":["import { resolve } from \"node:path\";\nimport { Either, Effect, Layer } from \"effect\";\nimport { cleanIncompleteRuns, inspectIncompleteRuns, makeRecordRoot, NodeRecordLive, type RecordRoot, } from \"../record/index.ts\";\nimport { recordHost } from \"../record/host/index.ts\";\nimport type { RecordAttachmentMigrationTarget } from \"../record/host/types.ts\";\nimport { RecordAutoMigrationGitSaveRequired, RecordMigrationRequired, } from \"../record/reader/errors.ts\";\nimport { RecordFileSystem, recordPortablePath } from \"../record/platform/services.ts\";\nexport type RecordCliCommand = \"clean\" | \"migrate\";\nexport interface RunRecordCliCommandInput {\n readonly command: RecordCliCommand;\n readonly cwd: string;\n /** An actual Record root, never a `.niceeval` parent directory. */\n readonly record?: string;\n readonly yes: boolean;\n}\n/** The outer CLI owns process streams and exit; this value is its pure receipt. */\nexport interface RecordCliCommandOutput {\n readonly exitCode: 0 | 1;\n readonly stdout: string;\n readonly stderr: string;\n}\nfunction output(input: {\n readonly exitCode: 0 | 1;\n readonly stdout?: string;\n readonly stderr?: string;\n}): RecordCliCommandOutput {\n return Object.freeze({\n exitCode: input.exitCode,\n stdout: input.stdout ?? \"\",\n stderr: input.stderr ?? \"\",\n });\n}\nexport const NodeRecordCliLive = NodeRecordLive;\nexport interface AutomaticRecordMigrationReceipt {\n readonly restoreCommit: string;\n readonly attachments: readonly RecordAttachmentMigrationTarget[];\n}\n/**\n * Preflight for ordinary CLI entry points. Every Scope is closed before the\n * next lease kind is acquired: read check -> exclusive maintenance -> caller's\n * fresh ordinary open.\n */\nexport function ensureAutomaticRecordMigration(input: {\n readonly cwd: string;\n readonly record?: string;\n}) {\n const root = makeRecordRoot(resolve(input.cwd, input.record ?? \".niceeval/record\"));\n if (Either.isLeft(root))\n return Effect.fail(root.left);\n return Effect.gen(function* () {\n const fileSystem = yield* RecordFileSystem;\n if ((yield* fileSystem.pathKind(recordPortablePath(root.right, \"record.json\"))) === \"missing\") {\n return null;\n }\n const checked = yield* Effect.either(Effect.scoped(recordHost.current.openRead({ root: root.right })));\n if (Either.isRight(checked))\n return null;\n if (!(checked.left instanceof RecordMigrationRequired))\n return yield* Effect.fail(checked.left);\n return yield* Effect.scoped(Effect.gen(function* () {\n const session = yield* recordHost.maintenance.open({ root: root.right });\n const plan = yield* session.planMigrate();\n if (plan.state !== \"migration-required\") {\n return yield* Effect.fail(checked.left);\n }\n if (plan.backup.state !== \"git-restore-point\") {\n return yield* Effect.fail(new RecordAutoMigrationGitSaveRequired({\n code: \"record-auto-migration-git-save-required\",\n }));\n }\n const receipt = yield* session.applyMigrate(plan).pipe(Effect.catchTag(\"RecordMigrationGitRestoreRequired\", () => Effect.fail(new RecordAutoMigrationGitSaveRequired({\n code: \"record-auto-migration-git-save-required\",\n }))));\n return Object.freeze({\n restoreCommit: plan.backup.commit,\n attachments: receipt.state === \"migrated\" ? receipt.attachments : Object.freeze([]),\n });\n }));\n });\n}\nfunction resolveRecordRoot(input: RunRecordCliCommandInput): Either.Either<RecordRoot, RecordCliCommandOutput> {\n const root = makeRecordRoot(resolve(input.cwd, input.record ?? \".niceeval/record\"));\n return Either.isLeft(root)\n ? Either.left(output({\n exitCode: 1,\n stderr: `${root.left.code}\\n`,\n }))\n : Either.right(root.right);\n}\nfunction recordErrorCode(error: unknown): string {\n if (typeof error !== \"object\" || error === null)\n return \"record-command-failed\";\n const candidate = Reflect.get(error, \"code\");\n return typeof candidate === \"string\" ? candidate : \"record-command-failed\";\n}\nfunction recordErrorNextStep(code: string): string | undefined {\n switch (code) {\n case \"record-migration-required\":\n return \"Run: niceeval migrate\";\n case \"record-migration-interrupted\":\n return \"Restore the complete Record from the recorded Git commit; do not rerun migrate on mixed bytes.\";\n case \"record-migration-recovery-required\":\n return \"Restore the complete Record from Git before retrying migration.\";\n case \"record-migration-plan-stale\":\n return \"Review the new migration plan and rerun migrate.\";\n case \"record-migration-git-restore-required\":\n return \"Commit, restore, or otherwise obtain a clean Git restore point for this Record before migrating.\";\n case \"record-migration-invalid\":\n return \"Restore the Record from Git before retrying migration.\";\n case \"record-format-unsupported\":\n return \"Install a NiceEval version that supports this Record format.\";\n case \"record-maintenance-busy\":\n case \"record-writer-busy\":\n return \"Close the Record command holding the lock, then retry.\";\n default:\n return undefined;\n }\n}\nfunction shellQuote(value: string): string {\n return `'${value.replaceAll(\"'\", `'\"'\"'`)}'`;\n}\nfunction recoveryCommands(restoreCommit: string, recordPath: string): string {\n const root = shellQuote(recordPath);\n const commit = shellQuote(restoreCommit);\n const sentinel = shellQuote(resolve(recordPath, \"migration.in-progress\"));\n return [\n `Restore command: git -C ${root} restore --source=${commit} --staged --worktree -- .`,\n `Verify command: git -C ${root} diff --quiet ${commit} -- . && git -C ${root} diff --cached --quiet ${commit} -- .`,\n `Clear sentinel after verification: rm -f -- ${sentinel}`,\n ].join(\"\\n\") + \"\\n\";\n}\nfunction interruptedRecovery(error: unknown, recordPath: string | undefined): string {\n if (typeof error !== \"object\" || error === null || recordPath === undefined)\n return \"\";\n const restoreCommit = Reflect.get(error, \"restoreCommit\");\n return Reflect.get(error, \"restoreSafe\") === true &&\n typeof restoreCommit === \"string\" && /^[0-9a-f]{40,64}$/.test(restoreCommit)\n ? recoveryCommands(restoreCommit, recordPath)\n : \"\";\n}\nfunction recordErrorOutput(error: unknown, stdout = \"\", recordPath?: string): RecordCliCommandOutput {\n const code = recordErrorCode(error);\n const automaticRestoreUnsafe = (code === \"record-migration-interrupted\" || code === \"record-migration-recovery-required\") &&\n (typeof error !== \"object\" || error === null || Reflect.get(error, \"restoreSafe\") !== true);\n const next = automaticRestoreUnsafe\n ? \"Inspect and preserve concurrent Record edits before choosing a manual recovery; no automatic Git restore command is safe.\"\n : recordErrorNextStep(code);\n const causeCode = typeof error === \"object\" && error !== null &&\n typeof Reflect.get(error, \"causeCode\") === \"string\"\n ? String(Reflect.get(error, \"causeCode\"))\n : undefined;\n return output({\n exitCode: 1,\n stdout,\n stderr: `${code}\\n${next === undefined ? \"\" : `${next}\\n`}${causeCode === undefined ? \"\" : `Cause: ${causeCode}\\n`}${code === \"record-migration-interrupted\" || code === \"record-migration-recovery-required\"\n ? interruptedRecovery(error, recordPath)\n : \"\"}`,\n });\n}\nfunction cleanCommand(input: {\n readonly root: RecordRoot;\n readonly yes: boolean;\n}) {\n return Effect.gen(function* () {\n const incomplete = yield* inspectIncompleteRuns({ root: input.root });\n if (incomplete.length === 0) {\n return output({\n exitCode: 0,\n stdout: \"No incomplete Runs found.\\n\",\n });\n }\n const listed = incomplete.map((entry) => ` ${entry.runId}`).join(\"\\n\");\n if (!input.yes) {\n return output({\n exitCode: 1,\n stdout: `Incomplete Runs:\\n${listed}\\n`,\n stderr: \"record-clean-confirmation-required\\nReview the listed Runs and rerun with --yes.\\n\",\n });\n }\n const cleaned = yield* Effect.either(cleanIncompleteRuns({\n root: input.root,\n runIds: incomplete.map((entry) => entry.runId),\n }));\n if (Either.isLeft(cleaned)) {\n return recordErrorOutput(cleaned.left, `Incomplete Runs:\\n${listed}\\n`);\n }\n const lines = [\"Cleaned incomplete Runs:\"];\n if (cleaned.right.deleted.length === 0)\n lines.push(\" deleted: none\");\n else\n lines.push(...cleaned.right.deleted.map((runId) => ` deleted: ${runId}`));\n if (cleaned.right.skipped.length > 0) {\n lines.push(...cleaned.right.skipped.map((runId) => ` skipped complete: ${runId}`));\n }\n return output({ exitCode: 0, stdout: `${lines.join(\"\\n\")}\\n` });\n });\n}\nfunction migrateCommand(input: {\n readonly root: RecordRoot;\n readonly recordPath: string;\n readonly yes: boolean;\n}) {\n return Effect.scoped(Effect.gen(function* () {\n const session = yield* recordHost.maintenance.open({ root: input.root });\n const plan = yield* session.planMigrate();\n const impactText = plan.state !== \"migration-required\"\n ? \"\"\n : [...new Map(plan.attachments.map((attachment) => {\n const key = `${attachment.family}@${attachment.fromSchemaVersion}->${attachment.toSchemaVersion}`;\n return [key, attachment] as const;\n })).values()].map((attachment) => {\n const retention = attachment.retention;\n const lines = [\n `impact ${attachment.family}@${attachment.fromSchemaVersion}->${attachment.toSchemaVersion}:`,\n ` retained facts: ${retention.retainedFacts.length === 0 ? \"none\" : retention.retainedFacts.join(\", \")}`,\n ` dropped facts: ${retention.droppedFacts.length === 0 ? \"none\" : retention.droppedFacts.join(\", \")}`,\n ];\n if (retention.rerunRecommendation !== null) {\n lines.push(` rerun recommendation: ${retention.rerunRecommendation}`);\n }\n return lines.join(\"\\n\");\n }).join(\"\\n\");\n const planText = plan.state === \"already-current\"\n ? `Record migration plan: already-current\\nformat: ${plan.format}\\n`\n : plan.state === \"unsupported-format\"\n ? `Record migration plan: unsupported-format\\nformat: ${plan.format}\\n`\n : `Record migration plan: migration-required\\nformat: ${plan.format}\\nattachments: ${plan.attachments.length}\\n${impactText === \"\" ? \"\" : `${impactText}\\n`}backup: ${plan.backup.state}${plan.backup.state === \"git-restore-point\" ? `\\nrestore commit: ${plan.backup.commit}` : \"\"}\\n`;\n if (plan.state === \"unsupported-format\") {\n return output({\n exitCode: 1,\n stdout: planText,\n stderr: \"record-format-unsupported\\nInstall a NiceEval version that supports this Record format.\\n\",\n });\n }\n if (plan.state === \"migration-required\" && plan.backup.state !== \"git-restore-point\") {\n return output({\n exitCode: 1,\n stdout: planText,\n stderr: \"record-migration-git-restore-required\\nA clean Git restore point is required; --yes cannot bypass this preflight.\\n\",\n });\n }\n if (plan.state === \"migration-required\" && !input.yes) {\n return output({\n exitCode: 1,\n stdout: planText,\n stderr: \"record-migration-confirmation-required\\nReview the migration plan and rerun with --yes.\\n\",\n });\n }\n const migrated = yield* Effect.either(session.applyMigrate(plan));\n if (Either.isLeft(migrated)) {\n return recordErrorOutput(migrated.left, planText, input.recordPath);\n }\n const receipt = migrated.right;\n return output({\n exitCode: 0,\n stdout: `${planText}Record migration ${receipt.state}.\\n`,\n });\n }));\n}\n/**\n * Effect-native command handling for the Record maintenance surface. The\n * CLI owns the one Promise adaptation at its actual process boundary.\n */\nexport function runRecordCliCommand(input: RunRecordCliCommandInput): Effect.Effect<RecordCliCommandOutput> {\n const root = resolveRecordRoot(input);\n if (Either.isLeft(root))\n return Effect.succeed(root.left);\n if (input.command === \"clean\") {\n return cleanCommand({ root: root.right, yes: input.yes }).pipe(Effect.provide(NodeRecordCliLive), Effect.catchAll((error) => Effect.succeed(recordErrorOutput(error))));\n }\n const recordPath = resolve(input.cwd, input.record ?? \".niceeval/record\");\n return migrateCommand({ root: root.right, recordPath, yes: input.yes }).pipe(Effect.provide(NodeRecordCliLive), Effect.catchAll((error) => Effect.succeed(recordErrorOutput(error, \"\", recordPath))));\n}\n"]}
|