niceeval 0.13.2 → 0.13.3
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/dist/agents/bub.cjs +4 -4
- package/dist/agents/bub.cjs.map +1 -1
- package/dist/agents/bub.d.cts +2 -2
- package/dist/agents/bub.d.mts +2 -2
- package/dist/agents/bub.d.ts +2 -2
- package/dist/agents/claude-code-native.cjs +213 -0
- package/dist/agents/claude-code-native.cjs.map +1 -0
- package/dist/agents/claude-code-native.d.cts +5 -0
- package/dist/agents/claude-code-native.d.mts +5 -0
- package/dist/agents/claude-code-native.d.ts +5 -0
- package/dist/agents/claude-code-native.js +6 -0
- package/dist/agents/claude-code-native.js.map +1 -0
- package/dist/agents/claude-code.cjs +26 -80
- package/dist/agents/claude-code.cjs.map +1 -1
- package/dist/agents/codex-app-server.cjs +314 -0
- package/dist/agents/codex-app-server.cjs.map +1 -0
- package/dist/agents/codex-app-server.d.cts +9 -0
- package/dist/agents/codex-app-server.d.mts +9 -0
- package/dist/agents/codex-app-server.d.ts +9 -0
- package/dist/agents/codex-app-server.js +6 -0
- package/dist/agents/codex-app-server.js.map +1 -0
- package/dist/agents/codex.cjs +19 -68
- package/dist/agents/codex.cjs.map +1 -1
- package/dist/agents/codex.d.cts +3 -3
- package/dist/agents/codex.d.mts +3 -3
- package/dist/agents/codex.d.ts +3 -3
- package/dist/agents/index.cjs +3 -1
- package/dist/agents/index.cjs.map +1 -1
- package/dist/agents/index.d.cts +1 -0
- package/dist/agents/index.d.mts +1 -0
- package/dist/agents/index.d.ts +1 -0
- package/dist/agents/index.js +84 -82
- package/dist/agents/index.mjs +84 -82
- package/dist/agents/managed-jsonl.cjs +207 -0
- package/dist/agents/managed-jsonl.cjs.map +1 -0
- package/dist/agents/managed-jsonl.d.cts +39 -0
- package/dist/agents/managed-jsonl.d.mts +39 -0
- package/dist/agents/managed-jsonl.d.ts +39 -0
- package/dist/agents/managed-jsonl.js +6 -0
- package/dist/agents/managed-jsonl.js.map +1 -0
- package/dist/agents/managed-process.cjs +31 -0
- package/dist/agents/managed-process.cjs.map +1 -0
- package/dist/agents/managed-process.d.cts +3 -0
- package/dist/agents/managed-process.d.mts +3 -0
- package/dist/agents/managed-process.d.ts +3 -0
- package/dist/agents/managed-process.js +6 -0
- package/dist/agents/managed-process.js.map +1 -0
- package/dist/agents/omp.cjs +18 -1
- package/dist/agents/omp.cjs.map +1 -1
- package/dist/agents/sdk-streams.cjs +11 -4
- package/dist/agents/sdk-streams.cjs.map +1 -1
- package/dist/agents/types.cjs.map +1 -1
- package/dist/agents/types.d.cts +8 -0
- package/dist/agents/types.d.mts +8 -0
- package/dist/agents/types.d.ts +8 -0
- package/dist/analysis/bindings.cjs +74 -19
- package/dist/analysis/bindings.cjs.map +1 -1
- package/dist/analysis/bindings.d.cts +534 -156
- package/dist/analysis/bindings.d.mts +534 -156
- package/dist/analysis/bindings.d.ts +534 -156
- package/dist/analysis/domain-view.cjs.map +1 -1
- package/dist/analysis/domain-view.d.cts +137 -8
- package/dist/analysis/domain-view.d.mts +137 -8
- package/dist/analysis/domain-view.d.ts +137 -8
- 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/assertions/api.cjs.map +1 -1
- package/dist/assertions/api.d.cts +62 -0
- package/dist/assertions/api.d.mts +62 -0
- package/dist/assertions/api.d.ts +62 -0
- package/dist/assertions/judge.cjs +56 -5
- package/dist/assertions/judge.cjs.map +1 -1
- package/dist/assertions/match.cjs +66 -42
- package/dist/assertions/match.cjs.map +1 -1
- package/dist/assertions/match.d.cts +13 -0
- package/dist/assertions/match.d.mts +13 -0
- package/dist/assertions/match.d.ts +13 -0
- package/dist/assertions/record/attachment.cjs +104 -33
- package/dist/assertions/record/attachment.cjs.map +1 -1
- package/dist/assertions/record/attachment.d.cts +294 -57
- package/dist/assertions/record/attachment.d.mts +294 -57
- package/dist/assertions/record/attachment.d.ts +294 -57
- package/dist/assertions/record/codec.cjs +91 -17
- package/dist/assertions/record/codec.cjs.map +1 -1
- package/dist/assertions/record/codec.d.cts +280 -52
- package/dist/assertions/record/codec.d.mts +280 -52
- package/dist/assertions/record/codec.d.ts +280 -52
- package/dist/assertions/record/index.js +2 -0
- package/dist/assertions/record/model.cjs +16 -0
- package/dist/assertions/record/model.cjs.map +1 -1
- package/dist/assertions/record/model.d.cts +120 -13
- package/dist/assertions/record/model.d.mts +120 -13
- package/dist/assertions/record/model.d.ts +120 -13
- package/dist/assertions/record/model.js +2 -0
- package/dist/assertions/record/producer.cjs +70 -50
- package/dist/assertions/record/producer.cjs.map +1 -1
- package/dist/assertions/record/producer.d.cts +8 -7
- package/dist/assertions/record/producer.d.mts +8 -7
- package/dist/assertions/record/producer.d.ts +8 -7
- package/dist/assertions/runtime.cjs +49 -7
- package/dist/assertions/runtime.cjs.map +1 -1
- package/dist/cli/application.cjs +40 -0
- package/dist/cli/application.cjs.map +1 -0
- package/dist/cli/application.d.cts +129 -0
- package/dist/cli/application.d.mts +129 -0
- package/dist/cli/application.d.ts +129 -0
- package/dist/cli/application.js +24 -0
- package/dist/cli/application.js.map +1 -0
- package/dist/cli/bootstrap.cjs +10 -4
- package/dist/cli/bootstrap.cjs.map +1 -1
- package/dist/cli/node-application.cjs +123 -0
- package/dist/cli/node-application.cjs.map +1 -0
- package/dist/cli/node-application.d.cts +14 -0
- package/dist/cli/node-application.d.mts +14 -0
- package/dist/cli/node-application.d.ts +14 -0
- package/dist/cli/node-application.js +26 -0
- package/dist/cli/node-application.js.map +1 -0
- package/dist/cli/program.cjs +2807 -0
- package/dist/cli/program.cjs.map +1 -0
- package/dist/cli/program.d.cts +352 -0
- package/dist/cli/program.d.mts +352 -0
- package/dist/cli/program.d.ts +352 -0
- package/dist/cli/program.js +36 -0
- package/dist/cli/program.js.map +1 -0
- package/dist/cli/project-configuration.cjs +134 -0
- package/dist/cli/project-configuration.cjs.map +1 -0
- package/dist/cli/project-configuration.d.cts +64 -0
- package/dist/cli/project-configuration.d.mts +64 -0
- package/dist/cli/project-configuration.d.ts +64 -0
- package/dist/cli/project-configuration.js +22 -0
- package/dist/cli/project-configuration.js.map +1 -0
- package/dist/cli/record.cjs +20 -4
- package/dist/cli/record.cjs.map +1 -1
- package/dist/cli/record.d.cts +3 -3
- package/dist/cli/record.d.mts +3 -3
- package/dist/cli/record.d.ts +3 -3
- package/dist/cli.cjs +19 -3130
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.cts +2 -148
- package/dist/cli.d.mts +2 -148
- package/dist/cli.d.ts +2 -148
- package/dist/cli.js +22 -30
- package/dist/context/assert-first.cjs +21 -15
- package/dist/context/assert-first.cjs.map +1 -1
- package/dist/context/assert-first.d.cts +1 -0
- package/dist/context/assert-first.d.mts +1 -0
- package/dist/context/assert-first.d.ts +1 -0
- package/dist/context/attempt-resources.cjs +13 -0
- package/dist/context/attempt-resources.cjs.map +1 -0
- package/dist/context/attempt-resources.d.cts +3 -0
- package/dist/context/attempt-resources.d.mts +3 -0
- package/dist/context/attempt-resources.d.ts +3 -0
- package/dist/context/attempt-resources.js +8 -0
- package/dist/context/attempt-resources.js.map +1 -0
- package/dist/context/session.cjs +4 -3
- package/dist/context/session.cjs.map +1 -1
- package/dist/context/session.d.cts +1 -0
- package/dist/context/session.d.mts +1 -0
- package/dist/context/session.d.ts +1 -0
- package/dist/eval/record/verdict.cjs +3 -2
- package/dist/eval/record/verdict.cjs.map +1 -1
- package/dist/experiment/host/index.cjs +1 -6
- package/dist/experiment/host/index.cjs.map +1 -1
- package/dist/experiment/host/index.d.cts +1 -0
- package/dist/experiment/host/index.d.mts +1 -0
- package/dist/experiment/host/index.d.ts +1 -0
- package/dist/load-config.cjs +13 -4
- package/dist/load-config.cjs.map +1 -1
- package/dist/load-config.d.cts +4 -3
- package/dist/load-config.d.mts +4 -3
- package/dist/load-config.d.ts +4 -3
- package/dist/load-config.js +4 -2
- package/dist/o11y/parsers/codex.cjs +29 -7
- package/dist/o11y/parsers/codex.cjs.map +1 -1
- package/dist/record/codec/core.d.cts +0 -2
- package/dist/record/codec/core.d.mts +0 -2
- package/dist/record/codec/core.d.ts +0 -2
- package/dist/record/codec/identifiers.cjs +2 -3
- package/dist/record/codec/identifiers.cjs.map +1 -1
- package/dist/record/codec/identifiers.d.cts +1 -2
- package/dist/record/codec/identifiers.d.mts +1 -2
- package/dist/record/codec/identifiers.d.ts +1 -2
- package/dist/record/codec/identifiers.js +10 -12
- package/dist/record/codec/index.js +42 -44
- package/dist/record/definition/attachment.cjs +1 -0
- package/dist/record/definition/attachment.cjs.map +1 -1
- package/dist/record/definition/attachment.d.cts +14 -0
- package/dist/record/definition/attachment.d.mts +14 -0
- package/dist/record/definition/attachment.d.ts +14 -0
- package/dist/record/family/assertions-v1.cjs +104 -0
- package/dist/record/family/assertions-v1.cjs.map +1 -0
- package/dist/record/family/assertions-v1.d.cts +2 -0
- package/dist/record/family/assertions-v1.d.mts +2 -0
- package/dist/record/family/assertions-v1.d.ts +2 -0
- package/dist/record/family/assertions-v1.js +6 -0
- package/dist/record/family/assertions-v1.js.map +1 -0
- package/dist/record/family/assertions.cjs +16 -5
- package/dist/record/family/assertions.cjs.map +1 -1
- package/dist/record/family/assertions.d.cts +510 -56
- package/dist/record/family/assertions.d.mts +510 -56
- package/dist/record/family/assertions.d.ts +510 -56
- package/dist/record/family/assertions.js +14 -10
- package/dist/record/family/catalog.cjs +17 -1
- package/dist/record/family/catalog.cjs.map +1 -1
- package/dist/record/family/catalog.d.cts +1292 -104
- package/dist/record/family/catalog.d.mts +1292 -104
- package/dist/record/family/catalog.d.ts +1292 -104
- package/dist/record/family/catalog.js +22 -20
- package/dist/record/family/index.js +144 -138
- package/dist/record/family/observability-v1.cjs +5 -0
- package/dist/record/family/observability-v1.cjs.map +1 -1
- package/dist/record/family/observability.cjs +1 -1
- package/dist/record/family/observability.cjs.map +1 -1
- package/dist/record/host/runtime.cjs +323 -173
- 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 +9 -7
- package/dist/record/host/types.d.mts +9 -7
- package/dist/record/host/types.d.ts +9 -7
- package/dist/record/model/core.cjs.map +1 -1
- package/dist/record/model/core.d.cts +1 -2
- package/dist/record/model/core.d.mts +1 -2
- package/dist/record/model/core.d.ts +1 -2
- package/dist/record/model/definition.cjs +1 -2
- package/dist/record/model/definition.cjs.map +1 -1
- package/dist/record/model/definition.d.cts +1 -7
- package/dist/record/model/definition.d.mts +1 -7
- package/dist/record/model/definition.d.ts +1 -7
- package/dist/record/model/identifiers.cjs +2 -3
- package/dist/record/model/identifiers.cjs.map +1 -1
- package/dist/record/model/identifiers.d.cts +1 -3
- package/dist/record/model/identifiers.d.mts +1 -3
- package/dist/record/model/identifiers.d.ts +1 -3
- package/dist/record/model/identifiers.js +36 -38
- package/dist/record/model/index.js +60 -62
- package/dist/record/platform/node.cjs +17 -7
- package/dist/record/platform/node.cjs.map +1 -1
- package/dist/record/platform/services.cjs.map +1 -1
- package/dist/record/platform/services.d.cts +8 -3
- package/dist/record/platform/services.d.mts +8 -3
- package/dist/record/platform/services.d.ts +8 -3
- package/dist/record/reader/format.cjs +16 -65
- package/dist/record/reader/format.cjs.map +1 -1
- package/dist/record/reader/format.d.cts +5 -9
- package/dist/record/reader/format.d.mts +5 -9
- package/dist/record/reader/format.d.ts +5 -9
- package/dist/record/reader/index.js +10 -8
- package/dist/record/reader/runtime.cjs +63 -32
- package/dist/record/reader/runtime.cjs.map +1 -1
- package/dist/record/reader/runtime.d.cts +40 -4
- package/dist/record/reader/runtime.d.mts +40 -4
- package/dist/record/reader/runtime.d.ts +40 -4
- package/dist/record/reader/runtime.js +6 -4
- package/dist/report/assets/enhance.js +5 -5
- package/dist/report/assets/styles.css +190 -24
- package/dist/report/built-in/result-components.cjs +8 -5
- package/dist/report/built-in/result-components.cjs.map +1 -1
- package/dist/report/built-in/standard.cjs +3 -0
- package/dist/report/built-in/standard.cjs.map +1 -1
- package/dist/report/built-in/standard.d.cts +2 -0
- package/dist/report/built-in/standard.d.mts +2 -0
- package/dist/report/built-in/standard.d.ts +2 -0
- package/dist/report/client-dist/app.js +53 -0
- package/dist/report/components/attempt-detail/compute.cjs +108 -231
- package/dist/report/components/attempt-detail/compute.cjs.map +1 -1
- package/dist/report/components/attempt-detail/compute.d.cts +11 -45
- package/dist/report/components/attempt-detail/compute.d.mts +11 -45
- package/dist/report/components/attempt-detail/compute.d.ts +11 -45
- package/dist/report/components/attempt-detail/compute.js +2 -4
- package/dist/report/components/attempt-detail/content.cjs +4 -4
- package/dist/report/components/attempt-detail/content.cjs.map +1 -1
- package/dist/report/components/attempt-detail/validate.cjs +47 -4
- package/dist/report/components/attempt-detail/validate.cjs.map +1 -1
- package/dist/report/components/entity-lists/compute.cjs +9 -15
- package/dist/report/components/entity-lists/compute.cjs.map +1 -1
- package/dist/report/components/entity-lists/content.cjs +53 -40
- package/dist/report/components/entity-lists/content.cjs.map +1 -1
- package/dist/report/components/entity-lists/index.cjs +1 -3
- package/dist/report/components/entity-lists/index.cjs.map +1 -1
- package/dist/report/components/experiment-detail/compute.cjs +4 -6
- package/dist/report/components/experiment-detail/compute.cjs.map +1 -1
- package/dist/report/components/summaries/index.cjs +5 -1
- package/dist/report/components/summaries/index.cjs.map +1 -1
- package/dist/report/definition/cell.cjs +14 -7
- package/dist/report/definition/cell.cjs.map +1 -1
- package/dist/report/definition/cell.d.cts +4 -0
- package/dist/report/definition/cell.d.mts +4 -0
- package/dist/report/definition/cell.d.ts +4 -0
- package/dist/report/definition/primitives/assertion-evidence.cjs +96 -0
- package/dist/report/definition/primitives/assertion-evidence.cjs.map +1 -0
- package/dist/report/definition/primitives/assertion-evidence.d.cts +11 -0
- package/dist/report/definition/primitives/assertion-evidence.d.mts +11 -0
- package/dist/report/definition/primitives/assertion-evidence.d.ts +11 -0
- package/dist/report/definition/primitives/assertion-evidence.js +6 -0
- package/dist/report/definition/primitives/assertion-evidence.js.map +1 -0
- package/dist/report/definition/primitives/conversation.cjs +7 -0
- package/dist/report/definition/primitives/conversation.cjs.map +1 -1
- package/dist/report/definition/primitives/conversation.d.cts +2 -0
- package/dist/report/definition/primitives/conversation.d.mts +2 -0
- package/dist/report/definition/primitives/conversation.d.ts +2 -0
- package/dist/report/definition/primitives/turn-trace.cjs +53 -3
- package/dist/report/definition/primitives/turn-trace.cjs.map +1 -1
- package/dist/report/definition/primitives.cjs +14 -1
- package/dist/report/definition/primitives.cjs.map +1 -1
- package/dist/report/definition/report.cjs +16 -8
- package/dist/report/definition/report.cjs.map +1 -1
- package/dist/report/definition/report.d.cts +6 -0
- package/dist/report/definition/report.d.mts +6 -0
- package/dist/report/definition/report.d.ts +6 -0
- package/dist/report/definition/table-text.cjs +12 -3
- package/dist/report/definition/table-text.cjs.map +1 -1
- package/dist/report/definition/table-text.d.cts +6 -1
- package/dist/report/definition/table-text.d.mts +6 -1
- package/dist/report/definition/table-text.d.ts +6 -1
- package/dist/report/execution/model.cjs +6 -14
- package/dist/report/execution/model.cjs.map +1 -1
- package/dist/report/execution/model.d.cts +5 -10
- package/dist/report/execution/model.d.mts +5 -10
- package/dist/report/execution/model.d.ts +5 -10
- package/dist/report/execution/model.js +6 -6
- package/dist/report/execution/paths.cjs +0 -11
- package/dist/report/execution/paths.cjs.map +1 -1
- package/dist/report/execution/paths.d.cts +0 -1
- package/dist/report/execution/paths.d.mts +0 -1
- package/dist/report/execution/paths.d.ts +0 -1
- package/dist/report/execution/paths.js +6 -8
- package/dist/report/host/execute.cjs +13 -22
- package/dist/report/host/execute.cjs.map +1 -1
- package/dist/report/host/execute.d.cts +1 -4
- package/dist/report/host/execute.d.mts +1 -4
- package/dist/report/host/execute.d.ts +1 -4
- package/dist/report/host/from-record.cjs +3 -0
- package/dist/report/host/from-record.cjs.map +1 -1
- package/dist/report/host/from-record.d.cts +4 -1
- package/dist/report/host/from-record.d.mts +4 -1
- package/dist/report/host/from-record.d.ts +4 -1
- package/dist/report/host/site-assets.cjs +1 -2
- package/dist/report/host/site-assets.cjs.map +1 -1
- package/dist/report/host/site-assets.d.cts +0 -1
- package/dist/report/host/site-assets.d.mts +0 -1
- package/dist/report/host/site-assets.d.ts +0 -1
- package/dist/report/host/site-assets.js +2 -4
- package/dist/report/host/static.cjs +71 -346
- package/dist/report/host/static.cjs.map +1 -1
- package/dist/report/host/static.d.cts +1 -3
- package/dist/report/host/static.d.mts +1 -3
- package/dist/report/host/static.d.ts +1 -3
- package/dist/report/host/static.js +2 -2
- package/dist/report/host/view-session.cjs.map +1 -1
- package/dist/report/host/view-session.d.cts +1 -1
- package/dist/report/host/view-session.d.mts +1 -1
- package/dist/report/host/view-session.d.ts +1 -1
- package/dist/report/model/locale.cjs +1 -1
- package/dist/report/model/locale.cjs.map +1 -1
- package/dist/report/model/locale.d.cts +1 -1
- package/dist/report/model/locale.d.mts +1 -1
- package/dist/report/model/locale.d.ts +1 -1
- package/dist/report/model/pricing.cjs +2 -2
- package/dist/report/model/pricing.cjs.map +1 -1
- package/dist/report/react/enhance.js +5 -5
- package/dist/report/react/styles.css +190 -24
- package/dist/runner/adoption.cjs +4 -7
- package/dist/runner/adoption.cjs.map +1 -1
- package/dist/runner/attempt-resources.cjs +60 -0
- package/dist/runner/attempt-resources.cjs.map +1 -0
- package/dist/runner/attempt-resources.d.cts +13 -0
- package/dist/runner/attempt-resources.d.mts +13 -0
- package/dist/runner/attempt-resources.d.ts +13 -0
- package/dist/runner/attempt-resources.js +6 -0
- package/dist/runner/attempt-resources.js.map +1 -0
- package/dist/runner/attempt.cjs +37 -3
- package/dist/runner/attempt.cjs.map +1 -1
- package/dist/runner/feedback/failure.cjs +77 -2
- package/dist/runner/feedback/failure.cjs.map +1 -1
- package/dist/runner/feedback/failure.d.cts +2 -1
- package/dist/runner/feedback/failure.d.mts +2 -1
- package/dist/runner/feedback/failure.d.ts +2 -1
- package/dist/runner/project-current.cjs +2 -13
- package/dist/runner/project-current.cjs.map +1 -1
- package/dist/runner/project-current.d.cts +4 -2
- package/dist/runner/project-current.d.mts +4 -2
- package/dist/runner/project-current.d.ts +4 -2
- package/dist/runner/reporters/braintrust.cjs +7 -7
- package/dist/runner/reporters/braintrust.cjs.map +1 -1
- package/dist/runner/reuse-readback.cjs +3 -4
- package/dist/runner/reuse-readback.cjs.map +1 -1
- package/dist/runner/run.cjs +5 -2
- package/dist/runner/run.cjs.map +1 -1
- package/dist/sandbox/backend.cjs +32 -2
- package/dist/sandbox/backend.cjs.map +1 -1
- package/dist/sandbox/backend.d.cts +12 -1
- package/dist/sandbox/backend.d.mts +12 -1
- package/dist/sandbox/backend.d.ts +12 -1
- package/dist/sandbox/backend.js +28 -22
- package/dist/sandbox/docker.cjs +140 -0
- package/dist/sandbox/docker.cjs.map +1 -1
- package/dist/sandbox/docker.d.cts +3 -1
- package/dist/sandbox/docker.d.mts +3 -1
- package/dist/sandbox/docker.d.ts +3 -1
- package/dist/sandbox/e2b.cjs +42 -0
- package/dist/sandbox/e2b.cjs.map +1 -1
- package/dist/sandbox/e2b.d.cts +2 -0
- package/dist/sandbox/e2b.d.mts +2 -0
- package/dist/sandbox/e2b.d.ts +2 -0
- package/dist/sandbox/local.cjs +64 -0
- package/dist/sandbox/local.cjs.map +1 -1
- package/dist/sandbox/local.d.cts +3 -1
- package/dist/sandbox/local.d.mts +3 -1
- package/dist/sandbox/local.d.ts +3 -1
- package/dist/sandbox/managed-process.cjs +49 -0
- package/dist/sandbox/managed-process.cjs.map +1 -0
- package/dist/sandbox/managed-process.d.cts +11 -0
- package/dist/sandbox/managed-process.d.mts +11 -0
- package/dist/sandbox/managed-process.d.ts +11 -0
- package/dist/sandbox/managed-process.js +6 -0
- package/dist/sandbox/managed-process.js.map +1 -0
- package/dist/sandbox/types.cjs.map +1 -1
- package/dist/sandbox/types.d.cts +24 -0
- package/dist/sandbox/types.d.mts +24 -0
- package/dist/sandbox/types.d.ts +24 -0
- package/dist/sandbox/vercel.cjs +1 -0
- package/dist/sandbox/vercel.cjs.map +1 -1
- package/dist/sandbox/vercel.d.cts +1 -0
- package/dist/sandbox/vercel.d.mts +1 -0
- package/dist/sandbox/vercel.d.ts +1 -0
- package/dist/view/server.cjs +2 -37
- package/dist/view/server.cjs.map +1 -1
- package/dist/view/server.d.cts +0 -3
- package/dist/view/server.d.mts +0 -3
- package/dist/view/server.d.ts +0 -3
- package/docs-site/zh/reference/builtin-agents.mdx +7 -7
- package/docs-site/zh/reference/official-adapters.mdx +4 -4
- package/docs-site/zh/reference/report-components.mdx +2 -2
- package/docs-site/zh/tutorials/configuration.mdx +2 -2
- package/docs-site/zh/tutorials/deploy-report-site.mdx +24 -2
- package/docs-site/zh/tutorials/publish-report.mdx +4 -4
- package/docs-site/zh/tutorials/sandbox-agent.mdx +5 -5
- package/docs-site/zh/tutorials/theming.mdx +2 -2
- package/package.json +4 -6
- package/dist/record/migration/index.cjs +0 -5
- package/dist/record/migration/index.cjs.map +0 -1
- package/dist/record/migration/index.d.cts +0 -11
- package/dist/record/migration/index.d.mts +0 -11
- package/dist/record/migration/index.d.ts +0 -11
- package/dist/record/migration/index.js +0 -6
- package/dist/record/migration/index.js.map +0 -1
- package/dist/report/host/site-runtime.cjs +0 -92
- package/dist/report/host/site-runtime.cjs.map +0 -1
- package/dist/report/host/site-runtime.d.cts +0 -9
- package/dist/report/host/site-runtime.d.mts +0 -9
- package/dist/report/host/site-runtime.d.ts +0 -9
- package/dist/report/host/site-runtime.js +0 -10
- package/dist/report/host/site-runtime.js.map +0 -1
- package/dist/view/client-dist/app.css +0 -2
- package/dist/view/client-dist/app.js +0 -49
- package/dist/view/data.cjs +0 -3
- package/dist/view/data.cjs.map +0 -1
- package/dist/view/data.d.cts +0 -9
- package/dist/view/data.d.mts +0 -9
- package/dist/view/data.d.ts +0 -9
- package/dist/view/data.js +0 -4
- package/dist/view/data.js.map +0 -1
- package/dist/view/index.cjs +0 -24
- package/dist/view/index.cjs.map +0 -1
- package/dist/view/index.d.cts +0 -9
- package/dist/view/index.d.mts +0 -9
- package/dist/view/index.d.ts +0 -9
- package/dist/view/index.js +0 -28
- package/dist/view/index.js.map +0 -1
- package/dist/view/report-view-cache.cjs +0 -200
- package/dist/view/report-view-cache.cjs.map +0 -1
- package/dist/view/report-view-cache.d.cts +0 -67
- package/dist/view/report-view-cache.d.mts +0 -67
- package/dist/view/report-view-cache.d.ts +0 -67
- package/dist/view/report-view-cache.js +0 -8
- package/dist/view/report-view-cache.js.map +0 -1
- package/dist/view/shared/types.cjs +0 -3
- package/dist/view/shared/types.cjs.map +0 -1
- package/dist/view/shared/types.d.cts +0 -51
- package/dist/view/shared/types.d.mts +0 -51
- package/dist/view/shared/types.d.ts +0 -51
- package/dist/view/shared/types.js +0 -4
- package/dist/view/shared/types.js.map +0 -1
- package/dist/view/site.cjs +0 -32
- package/dist/view/site.cjs.map +0 -1
- package/dist/view/site.d.cts +0 -24
- package/dist/view/site.d.mts +0 -24
- package/dist/view/site.d.ts +0 -24
- package/dist/view/site.js +0 -8
- package/dist/view/site.js.map +0 -1
- package/dist/view/styles.css +0 -170
- package/dist/view/template.html +0 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.js","sourceRoot":"","sources":["services.ts"],"names":[],"mappings":";;;AAWA,gDAEC;AAbD,mCAAiD;AAWjD,SAAgB,kBAAkB,CAAC,IAAgB,EAAE,GAAG,QAA2B;IAC/E,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;AAC3E,CAAC;
|
|
1
|
+
{"version":3,"file":"services.js","sourceRoot":"","sources":["services.ts"],"names":[],"mappings":";;;AAWA,gDAEC;AAbD,mCAAiD;AAWjD,SAAgB,kBAAkB,CAAC,IAAgB,EAAE,GAAG,QAA2B;IAC/E,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;AAC3E,CAAC;AAiFD,MAAa,gBAAiB,SAAQ,gBAAO,CAAC,GAAG,CAAC,mCAAmC,CAAC,EAA6C;CAClI;AADD,4CACC;AAKD,MAAa,aAAc,SAAQ,gBAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,EAAuC;CACtH;AADD,sCACC;AAyBD,MAAa,SAAU,SAAQ,gBAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,EAA+B;CACtG;AADD,8BACC","sourcesContent":["import { Context, Effect, Stream } from \"effect\";\nimport type { RecordFileSystemError, RecordGitError, RecordPathKind, } from \"./errors.ts\";\nimport type { RecordRoot } from \"./root.ts\";\n/**\n * A portable root-relative path request. It is not a capability: every live\n * platform operation validates these data again, including forged JS objects.\n */\nexport interface RecordPortablePath {\n readonly root: RecordRoot;\n readonly segments: readonly string[];\n}\nexport function recordPortablePath(root: RecordRoot, ...segments: readonly string[]): RecordPortablePath {\n return Object.freeze({ root, segments: Object.freeze([...segments]) });\n}\nexport interface RecordDirectoryEntry {\n readonly name: string;\n readonly kind: Exclude<RecordPathKind, \"missing\">;\n}\nexport interface RecordListDirectoryInput {\n readonly directory: RecordPortablePath;\n readonly maximumEntries: number;\n}\nexport interface RecordReadFileInput {\n readonly file: RecordPortablePath;\n readonly maximumBytes: number;\n}\nexport interface RecordReadFileStreamInput extends RecordReadFileInput {\n readonly chunkBytes?: number;\n}\nexport type RecordFileWriteMode = \"exclusive\" | \"replace\" | \"replace-no-follow\";\nexport interface RecordWriteFileInput {\n readonly file: RecordPortablePath;\n readonly bytes: Uint8Array;\n readonly maximumBytes: number;\n readonly mode: RecordFileWriteMode;\n}\nexport interface RecordWriteFileStreamInput<E, R> {\n readonly file: RecordPortablePath;\n readonly stream: Stream.Stream<Uint8Array, E, R>;\n readonly maximumBytes: number;\n readonly mode: RecordFileWriteMode;\n}\nexport type RecordIncompleteRunDelete = {\n readonly state: \"deleted\";\n} | {\n readonly state: \"missing\";\n} | {\n readonly state: \"skipped-complete\";\n};\n/**\n * Portable Record file operations only. Lock files and other live operation\n * state are intentionally owned by the separate lease services below.\n */\nexport interface RecordFileSystemService {\n readonly pathKind: (path: RecordPortablePath) => Effect.Effect<RecordPathKind, RecordFileSystemError>;\n readonly ensureDirectory: (directory: RecordPortablePath) => Effect.Effect<void, RecordFileSystemError>;\n readonly createDirectory: (directory: RecordPortablePath) => Effect.Effect<void, RecordFileSystemError>;\n readonly listDirectory: (input: RecordListDirectoryInput) => Effect.Effect<readonly RecordDirectoryEntry[], RecordFileSystemError>;\n readonly readFile: (input: RecordReadFileInput) => Effect.Effect<Uint8Array | undefined, RecordFileSystemError>;\n readonly readFileStream: (input: RecordReadFileStreamInput) => Stream.Stream<Uint8Array, RecordFileSystemError>;\n readonly writeFile: (input: RecordWriteFileInput) => Effect.Effect<void, RecordFileSystemError>;\n readonly writeFileStream: <E, R>(input: RecordWriteFileStreamInput<E, R>) => Effect.Effect<void, RecordFileSystemError | E, R>;\n readonly syncDirectory: (directory: RecordPortablePath) => Effect.Effect<void, RecordFileSystemError>;\n /** Maintenance-only exact portable file removal; missing is idempotent success. */\n readonly removeFile: (file: RecordPortablePath) => Effect.Effect<void, RecordFileSystemError>;\n /** Creates `runs/<RunId>` without publishing it. */\n readonly createRunDirectory: (input: {\n readonly root: RecordRoot;\n readonly runId: string;\n }) => Effect.Effect<void, RecordFileSystemError>;\n /** The only platform operation that creates `runs/<RunId>/complete`. */\n readonly createCompleteMarker: (input: {\n readonly root: RecordRoot;\n readonly runId: string;\n }) => Effect.Effect<void, RecordFileSystemError>;\n /** True only for the zero-byte regular file created by `createCompleteMarker`. */\n readonly isCompleteMarker: (input: {\n readonly root: RecordRoot;\n readonly runId: string;\n }) => Effect.Effect<boolean, RecordFileSystemError>;\n readonly migrationSentinelPresent: (root: RecordRoot) => Effect.Effect<boolean, RecordFileSystemError>;\n readonly createMigrationSentinel: (root: RecordRoot, restoreCommit: string, expectedRelativePaths: readonly string[]) => Effect.Effect<void, RecordFileSystemError>;\n /** Returns the exact physical plan recorded by a current migration sentinel. */\n readonly readMigrationSentinel: (root: RecordRoot) => Effect.Effect<{\n readonly restoreCommit: string;\n readonly expectedRelativePaths: readonly string[];\n } | undefined, RecordFileSystemError>;\n readonly removeMigrationSentinel: (root: RecordRoot) => Effect.Effect<void, RecordFileSystemError>;\n /** The caller already owns the exclusive maintenance lease before deletion. */\n readonly deleteIncompleteRun: (input: {\n readonly root: RecordRoot;\n readonly runId: string;\n }) => Effect.Effect<RecordIncompleteRunDelete, RecordFileSystemError>;\n}\nexport class RecordFileSystem extends Context.Tag(\"@niceeval/record/RecordFileSystem\")<RecordFileSystem, RecordFileSystemService>() {\n}\n/** Entropy is a writer-only capability, not a reader requirement. */\nexport interface RecordEntropyService {\n readonly uuid: Effect.Effect<string>;\n}\nexport class RecordEntropy extends Context.Tag(\"@niceeval/record/RecordEntropy\")<RecordEntropy, RecordEntropyService>() {\n}\n/**\n * A migration asks whether local Git can restore the current portable root;\n * absence of proof is data for the CLI confirmation flow, not an implicit OK.\n */\nexport type RecordBackupState = {\n readonly state: \"git-restore-point\";\n readonly commit: string;\n} | {\n readonly state: \"not-git-worktree\";\n} | {\n readonly state: \"root-outside-worktree\";\n} | {\n readonly state: \"portable-root-dirty\";\n readonly entries: readonly string[];\n};\nexport interface RecordGitService {\n readonly inspectBackupState: (root: RecordRoot) => Effect.Effect<RecordBackupState, RecordGitError>;\n /** Proves HEAD is unchanged and every dirty path is an expected migration write. */\n readonly recoveryChangesAreExpected: (input: {\n readonly root: RecordRoot;\n readonly restoreCommit: string;\n readonly expectedPaths: readonly RecordPortablePath[];\n }) => Effect.Effect<boolean, RecordGitError | RecordFileSystemError>;\n}\nexport class RecordGit extends Context.Tag(\"@niceeval/record/RecordGit\")<RecordGit, RecordGitService>() {\n}\n"]}
|
|
@@ -59,6 +59,8 @@ export interface RecordFileSystemService {
|
|
|
59
59
|
readonly writeFile: (input: RecordWriteFileInput) => Effect.Effect<void, RecordFileSystemError>;
|
|
60
60
|
readonly writeFileStream: <E, R>(input: RecordWriteFileStreamInput<E, R>) => Effect.Effect<void, RecordFileSystemError | E, R>;
|
|
61
61
|
readonly syncDirectory: (directory: RecordPortablePath) => Effect.Effect<void, RecordFileSystemError>;
|
|
62
|
+
/** Maintenance-only exact portable file removal; missing is idempotent success. */
|
|
63
|
+
readonly removeFile: (file: RecordPortablePath) => Effect.Effect<void, RecordFileSystemError>;
|
|
62
64
|
/** Creates `runs/<RunId>` without publishing it. */
|
|
63
65
|
readonly createRunDirectory: (input: {
|
|
64
66
|
readonly root: RecordRoot;
|
|
@@ -75,9 +77,12 @@ export interface RecordFileSystemService {
|
|
|
75
77
|
readonly runId: string;
|
|
76
78
|
}) => Effect.Effect<boolean, RecordFileSystemError>;
|
|
77
79
|
readonly migrationSentinelPresent: (root: RecordRoot) => Effect.Effect<boolean, RecordFileSystemError>;
|
|
78
|
-
readonly createMigrationSentinel: (root: RecordRoot, restoreCommit: string) => Effect.Effect<void, RecordFileSystemError>;
|
|
79
|
-
/** Returns the
|
|
80
|
-
readonly
|
|
80
|
+
readonly createMigrationSentinel: (root: RecordRoot, restoreCommit: string, expectedRelativePaths: readonly string[]) => Effect.Effect<void, RecordFileSystemError>;
|
|
81
|
+
/** Returns the exact physical plan recorded by a current migration sentinel. */
|
|
82
|
+
readonly readMigrationSentinel: (root: RecordRoot) => Effect.Effect<{
|
|
83
|
+
readonly restoreCommit: string;
|
|
84
|
+
readonly expectedRelativePaths: readonly string[];
|
|
85
|
+
} | undefined, RecordFileSystemError>;
|
|
81
86
|
readonly removeMigrationSentinel: (root: RecordRoot) => Effect.Effect<void, RecordFileSystemError>;
|
|
82
87
|
/** The caller already owns the exclusive maintenance lease before deletion. */
|
|
83
88
|
readonly deleteIncompleteRun: (input: {
|
|
@@ -59,6 +59,8 @@ export interface RecordFileSystemService {
|
|
|
59
59
|
readonly writeFile: (input: RecordWriteFileInput) => Effect.Effect<void, RecordFileSystemError>;
|
|
60
60
|
readonly writeFileStream: <E, R>(input: RecordWriteFileStreamInput<E, R>) => Effect.Effect<void, RecordFileSystemError | E, R>;
|
|
61
61
|
readonly syncDirectory: (directory: RecordPortablePath) => Effect.Effect<void, RecordFileSystemError>;
|
|
62
|
+
/** Maintenance-only exact portable file removal; missing is idempotent success. */
|
|
63
|
+
readonly removeFile: (file: RecordPortablePath) => Effect.Effect<void, RecordFileSystemError>;
|
|
62
64
|
/** Creates `runs/<RunId>` without publishing it. */
|
|
63
65
|
readonly createRunDirectory: (input: {
|
|
64
66
|
readonly root: RecordRoot;
|
|
@@ -75,9 +77,12 @@ export interface RecordFileSystemService {
|
|
|
75
77
|
readonly runId: string;
|
|
76
78
|
}) => Effect.Effect<boolean, RecordFileSystemError>;
|
|
77
79
|
readonly migrationSentinelPresent: (root: RecordRoot) => Effect.Effect<boolean, RecordFileSystemError>;
|
|
78
|
-
readonly createMigrationSentinel: (root: RecordRoot, restoreCommit: string) => Effect.Effect<void, RecordFileSystemError>;
|
|
79
|
-
/** Returns the
|
|
80
|
-
readonly
|
|
80
|
+
readonly createMigrationSentinel: (root: RecordRoot, restoreCommit: string, expectedRelativePaths: readonly string[]) => Effect.Effect<void, RecordFileSystemError>;
|
|
81
|
+
/** Returns the exact physical plan recorded by a current migration sentinel. */
|
|
82
|
+
readonly readMigrationSentinel: (root: RecordRoot) => Effect.Effect<{
|
|
83
|
+
readonly restoreCommit: string;
|
|
84
|
+
readonly expectedRelativePaths: readonly string[];
|
|
85
|
+
} | undefined, RecordFileSystemError>;
|
|
81
86
|
readonly removeMigrationSentinel: (root: RecordRoot) => Effect.Effect<void, RecordFileSystemError>;
|
|
82
87
|
/** The caller already owns the exclusive maintenance lease before deletion. */
|
|
83
88
|
readonly deleteIncompleteRun: (input: {
|
|
@@ -59,6 +59,8 @@ export interface RecordFileSystemService {
|
|
|
59
59
|
readonly writeFile: (input: RecordWriteFileInput) => Effect.Effect<void, RecordFileSystemError>;
|
|
60
60
|
readonly writeFileStream: <E, R>(input: RecordWriteFileStreamInput<E, R>) => Effect.Effect<void, RecordFileSystemError | E, R>;
|
|
61
61
|
readonly syncDirectory: (directory: RecordPortablePath) => Effect.Effect<void, RecordFileSystemError>;
|
|
62
|
+
/** Maintenance-only exact portable file removal; missing is idempotent success. */
|
|
63
|
+
readonly removeFile: (file: RecordPortablePath) => Effect.Effect<void, RecordFileSystemError>;
|
|
62
64
|
/** Creates `runs/<RunId>` without publishing it. */
|
|
63
65
|
readonly createRunDirectory: (input: {
|
|
64
66
|
readonly root: RecordRoot;
|
|
@@ -75,9 +77,12 @@ export interface RecordFileSystemService {
|
|
|
75
77
|
readonly runId: string;
|
|
76
78
|
}) => Effect.Effect<boolean, RecordFileSystemError>;
|
|
77
79
|
readonly migrationSentinelPresent: (root: RecordRoot) => Effect.Effect<boolean, RecordFileSystemError>;
|
|
78
|
-
readonly createMigrationSentinel: (root: RecordRoot, restoreCommit: string) => Effect.Effect<void, RecordFileSystemError>;
|
|
79
|
-
/** Returns the
|
|
80
|
-
readonly
|
|
80
|
+
readonly createMigrationSentinel: (root: RecordRoot, restoreCommit: string, expectedRelativePaths: readonly string[]) => Effect.Effect<void, RecordFileSystemError>;
|
|
81
|
+
/** Returns the exact physical plan recorded by a current migration sentinel. */
|
|
82
|
+
readonly readMigrationSentinel: (root: RecordRoot) => Effect.Effect<{
|
|
83
|
+
readonly restoreCommit: string;
|
|
84
|
+
readonly expectedRelativePaths: readonly string[];
|
|
85
|
+
} | undefined, RecordFileSystemError>;
|
|
81
86
|
readonly removeMigrationSentinel: (root: RecordRoot) => Effect.Effect<void, RecordFileSystemError>;
|
|
82
87
|
/** The caller already owns the exclusive maintenance lease before deletion. */
|
|
83
88
|
readonly deleteIncompleteRun: (input: {
|
|
@@ -5,8 +5,7 @@ exports.readCurrentRecordFormat = readCurrentRecordFormat;
|
|
|
5
5
|
exports.readRecordFormatForMaintenance = readRecordFormatForMaintenance;
|
|
6
6
|
const effect_1 = require("effect");
|
|
7
7
|
const core_ts_1 = require("../codec/core.cjs");
|
|
8
|
-
const identifiers_ts_1 = require("../
|
|
9
|
-
const identifiers_ts_2 = require("../model/identifiers.cjs");
|
|
8
|
+
const identifiers_ts_1 = require("../model/identifiers.cjs");
|
|
10
9
|
const services_ts_1 = require("../platform/services.cjs");
|
|
11
10
|
const errors_ts_1 = require("./errors.cjs");
|
|
12
11
|
/** `record.json` contains only root identity, so its read has a hard small cap. */
|
|
@@ -32,64 +31,34 @@ function formatOf(value) {
|
|
|
32
31
|
? descriptor.value
|
|
33
32
|
: undefined;
|
|
34
33
|
}
|
|
35
|
-
function schemaVersionOf(value) {
|
|
36
|
-
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
37
|
-
return undefined;
|
|
38
|
-
const descriptor = Object.getOwnPropertyDescriptor(value, "schemaVersion");
|
|
39
|
-
return descriptor !== undefined && "value" in descriptor &&
|
|
40
|
-
Number.isSafeInteger(descriptor.value) && descriptor.value > 0
|
|
41
|
-
? descriptor.value
|
|
42
|
-
: undefined;
|
|
43
|
-
}
|
|
44
34
|
function classifyRecordDocument(value) {
|
|
45
35
|
const format = formatOf(value);
|
|
46
36
|
if (format === undefined)
|
|
47
37
|
return effect_1.Either.left(bootstrapInvalid("record-document-invalid"));
|
|
48
|
-
if (format !==
|
|
38
|
+
if (format !== identifiers_ts_1.RECORD_FORMAT) {
|
|
49
39
|
return effect_1.Either.left(new errors_ts_1.RecordFormatUnsupported({ code: "record-format-unsupported", format }));
|
|
50
40
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
return effect_1.Either.left(new errors_ts_1.RecordMigrationRequired({
|
|
54
|
-
code: "record-migration-required",
|
|
55
|
-
source: `${identifiers_ts_2.RECORD_FORMAT}@1`,
|
|
56
|
-
target: `${identifiers_ts_2.RECORD_FORMAT}@${identifiers_ts_2.RECORD_SCHEMA_VERSION}`,
|
|
57
|
-
command: "niceeval migrate",
|
|
58
|
-
}));
|
|
41
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
42
|
+
return effect_1.Either.left(bootstrapInvalid("record-document-invalid"));
|
|
59
43
|
}
|
|
60
|
-
|
|
61
|
-
|
|
44
|
+
const record = value;
|
|
45
|
+
const projected = {};
|
|
46
|
+
for (const key of Object.keys(record)) {
|
|
47
|
+
if (key !== "schemaVersion")
|
|
48
|
+
projected[key] = record[key];
|
|
62
49
|
}
|
|
63
|
-
const decoded = (0, core_ts_1.decodeRecordDocument)(
|
|
50
|
+
const decoded = (0, core_ts_1.decodeRecordDocument)(projected);
|
|
64
51
|
return effect_1.Either.isLeft(decoded)
|
|
65
52
|
? effect_1.Either.left(bootstrapInvalid("record-document-invalid"))
|
|
66
53
|
: effect_1.Either.right(Object.freeze({ document: decoded.right }));
|
|
67
54
|
}
|
|
68
|
-
function legacyRecordDocument(value) {
|
|
69
|
-
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
70
|
-
return undefined;
|
|
71
|
-
const record = value;
|
|
72
|
-
if (Object.keys(record).length !== 3 ||
|
|
73
|
-
record.format !== identifiers_ts_2.RECORD_FORMAT ||
|
|
74
|
-
record.schemaVersion !== 1)
|
|
75
|
-
return undefined;
|
|
76
|
-
const recordId = effect_1.Schema.decodeUnknownEither(identifiers_ts_1.RecordIdSchema, core_ts_1.RecordExactParseOptions)(record.recordId);
|
|
77
|
-
return effect_1.Either.isLeft(recordId) ? undefined : Object.freeze({
|
|
78
|
-
format: identifiers_ts_2.RECORD_FORMAT,
|
|
79
|
-
schemaVersion: identifiers_ts_2.RECORD_SCHEMA_VERSION,
|
|
80
|
-
recordId: recordId.right,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
55
|
function readFormatBytes(fileSystem, root) {
|
|
84
56
|
return fileSystem.readFile({
|
|
85
57
|
file: (0, services_ts_1.recordPortablePath)(root, "record.json"),
|
|
86
58
|
maximumBytes: exports.RECORD_FORMAT_DOCUMENT_MAXIMUM_BYTES,
|
|
87
59
|
}).pipe(effect_1.Effect.catchTag("RecordResourceLimitExceeded", () => effect_1.Effect.fail(bootstrapInvalid("record-format-document-limit-exceeded"))));
|
|
88
60
|
}
|
|
89
|
-
/**
|
|
90
|
-
* Reads only the bounded exact-current root header. The one published
|
|
91
|
-
* predecessor is reported as migration-required but is never decoded as current.
|
|
92
|
-
*/
|
|
61
|
+
/** Reads the bounded versionless root after dropping the reserved boundary-noise key. */
|
|
93
62
|
function readCurrentRecordFormat(fileSystem, root) {
|
|
94
63
|
return effect_1.Effect.gen(function* () {
|
|
95
64
|
const bytes = yield* readFormatBytes(fileSystem, root);
|
|
@@ -104,7 +73,7 @@ function readCurrentRecordFormat(fileSystem, root) {
|
|
|
104
73
|
return classified.right;
|
|
105
74
|
});
|
|
106
75
|
}
|
|
107
|
-
/** Maintenance
|
|
76
|
+
/** Maintenance uses the same versionless root boundary as ordinary readers. */
|
|
108
77
|
function readRecordFormatForMaintenance(fileSystem, root) {
|
|
109
78
|
return effect_1.Effect.gen(function* () {
|
|
110
79
|
const bytes = yield* readFormatBytes(fileSystem, root);
|
|
@@ -113,28 +82,10 @@ function readRecordFormatForMaintenance(fileSystem, root) {
|
|
|
113
82
|
const parsed = parseRecordJson(bytes);
|
|
114
83
|
if (effect_1.Either.isLeft(parsed))
|
|
115
84
|
return yield* effect_1.Effect.fail(parsed.left);
|
|
116
|
-
const
|
|
117
|
-
if (
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
return yield* effect_1.Effect.fail(bootstrapInvalid("record-document-invalid"));
|
|
121
|
-
return Object.freeze({
|
|
122
|
-
document: decoded.right,
|
|
123
|
-
sourceSchemaVersion: identifiers_ts_2.RECORD_SCHEMA_VERSION,
|
|
124
|
-
sourceBytes: bytes,
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
if (version === 1) {
|
|
128
|
-
const document = legacyRecordDocument(parsed.right);
|
|
129
|
-
if (document === undefined)
|
|
130
|
-
return yield* effect_1.Effect.fail(bootstrapInvalid("record-document-invalid"));
|
|
131
|
-
return Object.freeze({ document, sourceSchemaVersion: 1, sourceBytes: bytes });
|
|
132
|
-
}
|
|
133
|
-
const format = formatOf(parsed.right);
|
|
134
|
-
return yield* effect_1.Effect.fail(new errors_ts_1.RecordFormatUnsupported({
|
|
135
|
-
code: "record-format-unsupported",
|
|
136
|
-
format: format ?? "unknown",
|
|
137
|
-
}));
|
|
85
|
+
const classified = classifyRecordDocument(parsed.right);
|
|
86
|
+
if (effect_1.Either.isLeft(classified))
|
|
87
|
+
return yield* effect_1.Effect.fail(classified.left);
|
|
88
|
+
return Object.freeze({ ...classified.right, sourceBytes: bytes });
|
|
138
89
|
});
|
|
139
90
|
}
|
|
140
91
|
//# sourceMappingURL=format.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.js","sourceRoot":"","sources":["format.ts"],"names":[],"mappings":";;;AAiGA,0DAaC;AAED,wEA+BC;AA/ID,mCAAgD;AAChD,8CAAiF;AACjF,4DAAyD;AAEzD,4DAA+E;AAE/E,yDAA4F;AAE5F,2CAAwG;AACxG,mFAAmF;AACtE,QAAA,oCAAoC,GAAG,EAAE,GAAG,IAAI,CAAC;AAQ9D,SAAS,gBAAgB,CAAC,MAA2E;IACjG,OAAO,IAAI,kCAAsB,CAAC,EAAE,IAAI,EAAE,0BAA0B,EAAE,MAAM,EAAE,CAAC,CAAC;AACpF,CAAC;AACD,SAAS,eAAe,CAAC,KAAiB;IACtC,IAAI,CAAC;QACD,MAAM,IAAI,GAAG,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACrE,OAAO,eAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAY,CAAC,CAAC;IACrD,CAAC;IACD,MAAM,CAAC;QACH,OAAO,eAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,yBAAyB,CAAC,CAAC,CAAC;IACpE,CAAC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1C,WAAW,EAAE,KAAK;aACrB,CAAC,CAAC;QACP,CAAC;QACD,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC;YAChB,MAAM,QAAQ,GAAG,oBAAoB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACpD,IAAI,QAAQ,KAAK,SAAS;gBACtB,OAAO,KAAK,CAAC,CAAC,eAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,yBAAyB,CAAC,CAAC,CAAC;YAC3E,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,mBAAmB,EAAE,CAAU,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;QAC5F,CAAC;QACD,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACtC,OAAO,KAAK,CAAC,CAAC,eAAM,CAAC,IAAI,CAAC,IAAI,mCAAuB,CAAC;YAClD,IAAI,EAAE,2BAA2B;YACjC,MAAM,EAAE,MAAM,IAAI,SAAS;SAC9B,CAAC,CAAC,CAAC;IACR,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { Effect, Either, Schema } from \"effect\";\nimport { decodeRecordDocument, RecordExactParseOptions } from \"../codec/core.ts\";\nimport { RecordIdSchema } from \"../codec/identifiers.ts\";\nimport type { RecordDocument } from \"../model/core.ts\";\nimport { RECORD_FORMAT, RECORD_SCHEMA_VERSION } from \"../model/identifiers.ts\";\nimport type { RecordFileSystemError } from \"../platform/errors.ts\";\nimport { recordPortablePath, type RecordFileSystemService, } from \"../platform/services.ts\";\nimport type { RecordRoot } from \"../platform/root.ts\";\nimport { RecordBootstrapInvalid, RecordFormatUnsupported, RecordMigrationRequired, } from \"./errors.ts\";\n/** `record.json` contains only root identity, so its read has a hard small cap. */\nexport const RECORD_FORMAT_DOCUMENT_MAXIMUM_BYTES = 64 * 1024;\nexport interface CurrentRecordFormatRead {\n readonly document: RecordDocument;\n}\nexport interface MaintenanceRecordFormatRead extends CurrentRecordFormatRead {\n readonly sourceSchemaVersion: 1 | typeof RECORD_SCHEMA_VERSION;\n readonly sourceBytes: Uint8Array;\n}\nfunction bootstrapInvalid(reason: \"record-document-invalid\" | \"record-format-document-limit-exceeded\"): RecordBootstrapInvalid {\n return new RecordBootstrapInvalid({ code: \"record-bootstrap-invalid\", reason });\n}\nfunction parseRecordJson(bytes: Uint8Array): Either.Either<unknown, RecordBootstrapInvalid> {\n try {\n const text = new TextDecoder(\"utf-8\", { fatal: true }).decode(bytes);\n return Either.right(JSON.parse(text) as unknown);\n }\n catch {\n return Either.left(bootstrapInvalid(\"record-document-invalid\"));\n }\n}\nfunction formatOf(value: unknown): string | undefined {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return undefined;\n }\n const descriptor = Object.getOwnPropertyDescriptor(value, \"format\");\n return descriptor !== undefined && \"value\" in descriptor && typeof descriptor.value === \"string\"\n ? descriptor.value\n : undefined;\n}\nfunction schemaVersionOf(value: unknown): number | undefined {\n if (typeof value !== \"object\" || value === null || Array.isArray(value))\n return undefined;\n const descriptor = Object.getOwnPropertyDescriptor(value, \"schemaVersion\");\n return descriptor !== undefined && \"value\" in descriptor &&\n Number.isSafeInteger(descriptor.value) && descriptor.value > 0\n ? descriptor.value\n : undefined;\n}\nfunction classifyRecordDocument(value: unknown): Either.Either<CurrentRecordFormatRead, RecordBootstrapInvalid | RecordFormatUnsupported | RecordMigrationRequired> {\n const format = formatOf(value);\n if (format === undefined)\n return Either.left(bootstrapInvalid(\"record-document-invalid\"));\n if (format !== RECORD_FORMAT) {\n return Either.left(new RecordFormatUnsupported({ code: \"record-format-unsupported\", format }));\n }\n const schemaVersion = schemaVersionOf(value);\n if (schemaVersion === 1) {\n return Either.left(new RecordMigrationRequired({\n code: \"record-migration-required\",\n source: `${RECORD_FORMAT}@1`,\n target: `${RECORD_FORMAT}@${RECORD_SCHEMA_VERSION}`,\n command: \"niceeval migrate\",\n }));\n }\n if (schemaVersion !== RECORD_SCHEMA_VERSION) {\n return Either.left(new RecordFormatUnsupported({ code: \"record-format-unsupported\", format }));\n }\n const decoded = decodeRecordDocument(value);\n return Either.isLeft(decoded)\n ? Either.left(bootstrapInvalid(\"record-document-invalid\"))\n : Either.right(Object.freeze({ document: decoded.right }));\n}\nfunction legacyRecordDocument(value: unknown): RecordDocument | undefined {\n if (typeof value !== \"object\" || value === null || Array.isArray(value))\n return undefined;\n const record = value as Record<string, unknown>;\n if (Object.keys(record).length !== 3 ||\n record.format !== RECORD_FORMAT ||\n record.schemaVersion !== 1)\n return undefined;\n const recordId = Schema.decodeUnknownEither(RecordIdSchema, RecordExactParseOptions)(record.recordId);\n return Either.isLeft(recordId) ? undefined : Object.freeze({\n format: RECORD_FORMAT as RecordDocument[\"format\"],\n schemaVersion: RECORD_SCHEMA_VERSION,\n recordId: recordId.right,\n });\n}\nfunction readFormatBytes(fileSystem: RecordFileSystemService, root: RecordRoot) {\n return fileSystem.readFile({\n file: recordPortablePath(root, \"record.json\"),\n maximumBytes: RECORD_FORMAT_DOCUMENT_MAXIMUM_BYTES,\n }).pipe(Effect.catchTag(\"RecordResourceLimitExceeded\", () => Effect.fail(bootstrapInvalid(\"record-format-document-limit-exceeded\"))));\n}\n/**\n * Reads only the bounded exact-current root header. The one published\n * predecessor is reported as migration-required but is never decoded as current.\n */\nexport function readCurrentRecordFormat(fileSystem: RecordFileSystemService, root: RecordRoot): Effect.Effect<CurrentRecordFormatRead, RecordFileSystemError | RecordBootstrapInvalid | RecordFormatUnsupported | RecordMigrationRequired> {\n return Effect.gen(function* () {\n const bytes = yield* readFormatBytes(fileSystem, root);\n if (bytes === undefined)\n return yield* Effect.fail(bootstrapInvalid(\"record-document-invalid\"));\n const parsed = parseRecordJson(bytes);\n if (Either.isLeft(parsed))\n return yield* Effect.fail(parsed.left);\n const classified = classifyRecordDocument(parsed.right);\n if (Either.isLeft(classified))\n return yield* Effect.fail(classified.left);\n return classified.right;\n });\n}\n/** Maintenance-only exact recognition of the one published root predecessor. */\nexport function readRecordFormatForMaintenance(fileSystem: RecordFileSystemService, root: RecordRoot): Effect.Effect<MaintenanceRecordFormatRead, RecordFileSystemError | RecordBootstrapInvalid | RecordFormatUnsupported> {\n return Effect.gen(function* () {\n const bytes = yield* readFormatBytes(fileSystem, root);\n if (bytes === undefined)\n return yield* Effect.fail(bootstrapInvalid(\"record-document-invalid\"));\n const parsed = parseRecordJson(bytes);\n if (Either.isLeft(parsed))\n return yield* Effect.fail(parsed.left);\n const version = schemaVersionOf(parsed.right);\n if (version === RECORD_SCHEMA_VERSION) {\n const decoded = decodeRecordDocument(parsed.right);\n if (Either.isLeft(decoded))\n return yield* Effect.fail(bootstrapInvalid(\"record-document-invalid\"));\n return Object.freeze({\n document: decoded.right,\n sourceSchemaVersion: RECORD_SCHEMA_VERSION,\n sourceBytes: bytes,\n });\n }\n if (version === 1) {\n const document = legacyRecordDocument(parsed.right);\n if (document === undefined)\n return yield* Effect.fail(bootstrapInvalid(\"record-document-invalid\"));\n return Object.freeze({ document, sourceSchemaVersion: 1 as const, sourceBytes: bytes });\n }\n const format = formatOf(parsed.right);\n return yield* Effect.fail(new RecordFormatUnsupported({\n code: \"record-format-unsupported\",\n format: format ?? \"unknown\",\n }));\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["format.ts"],"names":[],"mappings":";;;AAkEA,0DAaC;AAED,wEAaC;AA9FD,mCAAwC;AACxC,8CAAwD;AAExD,4DAAwD;AAExD,yDAA4F;AAE5F,2CAA+E;AAC/E,mFAAmF;AACtE,QAAA,oCAAoC,GAAG,EAAE,GAAG,IAAI,CAAC;AAQ9D,SAAS,gBAAgB,CAAC,MAA2E;IACjG,OAAO,IAAI,kCAAsB,CAAC,EAAE,IAAI,EAAE,0BAA0B,EAAE,MAAM,EAAE,CAAC,CAAC;AACpF,CAAC;AACD,SAAS,eAAe,CAAC,KAAiB;IACtC,IAAI,CAAC;QACD,MAAM,IAAI,GAAG,IAAI,WAAW,CAAC,OAAO,EAAE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,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC/C,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,UAAU,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { Effect, Either } from \"effect\";\nimport { decodeRecordDocument } from \"../codec/core.ts\";\nimport type { RecordDocument } from \"../model/core.ts\";\nimport { RECORD_FORMAT } from \"../model/identifiers.ts\";\nimport type { RecordFileSystemError } from \"../platform/errors.ts\";\nimport { recordPortablePath, type RecordFileSystemService, } from \"../platform/services.ts\";\nimport type { RecordRoot } from \"../platform/root.ts\";\nimport { RecordBootstrapInvalid, RecordFormatUnsupported, } from \"./errors.ts\";\n/** `record.json` contains only root identity, so its read has a hard small cap. */\nexport const RECORD_FORMAT_DOCUMENT_MAXIMUM_BYTES = 64 * 1024;\nexport interface CurrentRecordFormatRead {\n readonly document: RecordDocument;\n}\nexport interface MaintenanceRecordFormatRead extends CurrentRecordFormatRead {\n /** Identity/stale precondition only; maintenance never rewrites this file. */\n readonly sourceBytes: Uint8Array;\n}\nfunction bootstrapInvalid(reason: \"record-document-invalid\" | \"record-format-document-limit-exceeded\"): RecordBootstrapInvalid {\n return new RecordBootstrapInvalid({ code: \"record-bootstrap-invalid\", reason });\n}\nfunction parseRecordJson(bytes: Uint8Array): Either.Either<unknown, RecordBootstrapInvalid> {\n try {\n const text = new TextDecoder(\"utf-8\", { fatal: true }).decode(bytes);\n return Either.right(JSON.parse(text) as unknown);\n }\n catch {\n return Either.left(bootstrapInvalid(\"record-document-invalid\"));\n }\n}\nfunction formatOf(value: unknown): string | undefined {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return undefined;\n }\n const descriptor = Object.getOwnPropertyDescriptor(value, \"format\");\n return descriptor !== undefined && \"value\" in descriptor && typeof descriptor.value === \"string\"\n ? descriptor.value\n : undefined;\n}\nfunction classifyRecordDocument(value: unknown): Either.Either<CurrentRecordFormatRead, RecordBootstrapInvalid | RecordFormatUnsupported> {\n const format = formatOf(value);\n if (format === undefined)\n return Either.left(bootstrapInvalid(\"record-document-invalid\"));\n if (format !== RECORD_FORMAT) {\n return Either.left(new RecordFormatUnsupported({ code: \"record-format-unsupported\", format }));\n }\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return Either.left(bootstrapInvalid(\"record-document-invalid\"));\n }\n const record = value as Record<string, unknown>;\n const projected: Record<string, unknown> = {};\n for (const key of Object.keys(record)) {\n if (key !== \"schemaVersion\")\n projected[key] = record[key];\n }\n const decoded = decodeRecordDocument(projected);\n return Either.isLeft(decoded)\n ? Either.left(bootstrapInvalid(\"record-document-invalid\"))\n : Either.right(Object.freeze({ document: decoded.right }));\n}\nfunction readFormatBytes(fileSystem: RecordFileSystemService, root: RecordRoot) {\n return fileSystem.readFile({\n file: recordPortablePath(root, \"record.json\"),\n maximumBytes: RECORD_FORMAT_DOCUMENT_MAXIMUM_BYTES,\n }).pipe(Effect.catchTag(\"RecordResourceLimitExceeded\", () => Effect.fail(bootstrapInvalid(\"record-format-document-limit-exceeded\"))));\n}\n/** Reads the bounded versionless root after dropping the reserved boundary-noise key. */\nexport function readCurrentRecordFormat(fileSystem: RecordFileSystemService, root: RecordRoot): Effect.Effect<CurrentRecordFormatRead, RecordFileSystemError | RecordBootstrapInvalid | RecordFormatUnsupported> {\n return Effect.gen(function* () {\n const bytes = yield* readFormatBytes(fileSystem, root);\n if (bytes === undefined)\n return yield* Effect.fail(bootstrapInvalid(\"record-document-invalid\"));\n const parsed = parseRecordJson(bytes);\n if (Either.isLeft(parsed))\n return yield* Effect.fail(parsed.left);\n const classified = classifyRecordDocument(parsed.right);\n if (Either.isLeft(classified))\n return yield* Effect.fail(classified.left);\n return classified.right;\n });\n}\n/** Maintenance uses the same versionless root boundary as ordinary readers. */\nexport function readRecordFormatForMaintenance(fileSystem: RecordFileSystemService, root: RecordRoot): Effect.Effect<MaintenanceRecordFormatRead, RecordFileSystemError | RecordBootstrapInvalid | RecordFormatUnsupported> {\n return Effect.gen(function* () {\n const bytes = yield* readFormatBytes(fileSystem, root);\n if (bytes === undefined)\n return yield* Effect.fail(bootstrapInvalid(\"record-document-invalid\"));\n const parsed = parseRecordJson(bytes);\n if (Either.isLeft(parsed))\n return yield* Effect.fail(parsed.left);\n const classified = classifyRecordDocument(parsed.right);\n if (Either.isLeft(classified))\n return yield* Effect.fail(classified.left);\n return Object.freeze({ ...classified.right, sourceBytes: bytes });\n });\n}\n"]}
|
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import type { RecordDocument } from "../model/core.cjs";
|
|
3
|
-
import { RECORD_SCHEMA_VERSION } from "../model/identifiers.cjs";
|
|
4
3
|
import type { RecordFileSystemError } from "../platform/errors.cjs";
|
|
5
4
|
import { type RecordFileSystemService } from "../platform/services.cjs";
|
|
6
5
|
import type { RecordRoot } from "../platform/root.cjs";
|
|
7
|
-
import { RecordBootstrapInvalid, RecordFormatUnsupported
|
|
6
|
+
import { RecordBootstrapInvalid, RecordFormatUnsupported } from "./errors.cjs";
|
|
8
7
|
/** `record.json` contains only root identity, so its read has a hard small cap. */
|
|
9
8
|
export declare const RECORD_FORMAT_DOCUMENT_MAXIMUM_BYTES: number;
|
|
10
9
|
export interface CurrentRecordFormatRead {
|
|
11
10
|
readonly document: RecordDocument;
|
|
12
11
|
}
|
|
13
12
|
export interface MaintenanceRecordFormatRead extends CurrentRecordFormatRead {
|
|
14
|
-
|
|
13
|
+
/** Identity/stale precondition only; maintenance never rewrites this file. */
|
|
15
14
|
readonly sourceBytes: Uint8Array;
|
|
16
15
|
}
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*/
|
|
21
|
-
export declare function readCurrentRecordFormat(fileSystem: RecordFileSystemService, root: RecordRoot): Effect.Effect<CurrentRecordFormatRead, RecordFileSystemError | RecordBootstrapInvalid | RecordFormatUnsupported | RecordMigrationRequired>;
|
|
22
|
-
/** Maintenance-only exact recognition of the one published root predecessor. */
|
|
16
|
+
/** Reads the bounded versionless root after dropping the reserved boundary-noise key. */
|
|
17
|
+
export declare function readCurrentRecordFormat(fileSystem: RecordFileSystemService, root: RecordRoot): Effect.Effect<CurrentRecordFormatRead, RecordFileSystemError | RecordBootstrapInvalid | RecordFormatUnsupported>;
|
|
18
|
+
/** Maintenance uses the same versionless root boundary as ordinary readers. */
|
|
23
19
|
export declare function readRecordFormatForMaintenance(fileSystem: RecordFileSystemService, root: RecordRoot): Effect.Effect<MaintenanceRecordFormatRead, RecordFileSystemError | RecordBootstrapInvalid | RecordFormatUnsupported>;
|
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import type { RecordDocument } from "../model/core.mjs";
|
|
3
|
-
import { RECORD_SCHEMA_VERSION } from "../model/identifiers.mjs";
|
|
4
3
|
import type { RecordFileSystemError } from "../platform/errors.mjs";
|
|
5
4
|
import { type RecordFileSystemService } from "../platform/services.mjs";
|
|
6
5
|
import type { RecordRoot } from "../platform/root.mjs";
|
|
7
|
-
import { RecordBootstrapInvalid, RecordFormatUnsupported
|
|
6
|
+
import { RecordBootstrapInvalid, RecordFormatUnsupported } from "./errors.mjs";
|
|
8
7
|
/** `record.json` contains only root identity, so its read has a hard small cap. */
|
|
9
8
|
export declare const RECORD_FORMAT_DOCUMENT_MAXIMUM_BYTES: number;
|
|
10
9
|
export interface CurrentRecordFormatRead {
|
|
11
10
|
readonly document: RecordDocument;
|
|
12
11
|
}
|
|
13
12
|
export interface MaintenanceRecordFormatRead extends CurrentRecordFormatRead {
|
|
14
|
-
|
|
13
|
+
/** Identity/stale precondition only; maintenance never rewrites this file. */
|
|
15
14
|
readonly sourceBytes: Uint8Array;
|
|
16
15
|
}
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*/
|
|
21
|
-
export declare function readCurrentRecordFormat(fileSystem: RecordFileSystemService, root: RecordRoot): Effect.Effect<CurrentRecordFormatRead, RecordFileSystemError | RecordBootstrapInvalid | RecordFormatUnsupported | RecordMigrationRequired>;
|
|
22
|
-
/** Maintenance-only exact recognition of the one published root predecessor. */
|
|
16
|
+
/** Reads the bounded versionless root after dropping the reserved boundary-noise key. */
|
|
17
|
+
export declare function readCurrentRecordFormat(fileSystem: RecordFileSystemService, root: RecordRoot): Effect.Effect<CurrentRecordFormatRead, RecordFileSystemError | RecordBootstrapInvalid | RecordFormatUnsupported>;
|
|
18
|
+
/** Maintenance uses the same versionless root boundary as ordinary readers. */
|
|
23
19
|
export declare function readRecordFormatForMaintenance(fileSystem: RecordFileSystemService, root: RecordRoot): Effect.Effect<MaintenanceRecordFormatRead, RecordFileSystemError | RecordBootstrapInvalid | RecordFormatUnsupported>;
|
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import type { RecordDocument } from "../model/core.js";
|
|
3
|
-
import { RECORD_SCHEMA_VERSION } from "../model/identifiers.js";
|
|
4
3
|
import type { RecordFileSystemError } from "../platform/errors.js";
|
|
5
4
|
import { type RecordFileSystemService } from "../platform/services.js";
|
|
6
5
|
import type { RecordRoot } from "../platform/root.js";
|
|
7
|
-
import { RecordBootstrapInvalid, RecordFormatUnsupported
|
|
6
|
+
import { RecordBootstrapInvalid, RecordFormatUnsupported } from "./errors.js";
|
|
8
7
|
/** `record.json` contains only root identity, so its read has a hard small cap. */
|
|
9
8
|
export declare const RECORD_FORMAT_DOCUMENT_MAXIMUM_BYTES: number;
|
|
10
9
|
export interface CurrentRecordFormatRead {
|
|
11
10
|
readonly document: RecordDocument;
|
|
12
11
|
}
|
|
13
12
|
export interface MaintenanceRecordFormatRead extends CurrentRecordFormatRead {
|
|
14
|
-
|
|
13
|
+
/** Identity/stale precondition only; maintenance never rewrites this file. */
|
|
15
14
|
readonly sourceBytes: Uint8Array;
|
|
16
15
|
}
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*/
|
|
21
|
-
export declare function readCurrentRecordFormat(fileSystem: RecordFileSystemService, root: RecordRoot): Effect.Effect<CurrentRecordFormatRead, RecordFileSystemError | RecordBootstrapInvalid | RecordFormatUnsupported | RecordMigrationRequired>;
|
|
22
|
-
/** Maintenance-only exact recognition of the one published root predecessor. */
|
|
16
|
+
/** Reads the bounded versionless root after dropping the reserved boundary-noise key. */
|
|
17
|
+
export declare function readCurrentRecordFormat(fileSystem: RecordFileSystemService, root: RecordRoot): Effect.Effect<CurrentRecordFormatRead, RecordFileSystemError | RecordBootstrapInvalid | RecordFormatUnsupported>;
|
|
18
|
+
/** Maintenance uses the same versionless root boundary as ordinary readers. */
|
|
23
19
|
export declare function readRecordFormatForMaintenance(fileSystem: RecordFileSystemService, root: RecordRoot): Effect.Effect<MaintenanceRecordFormatRead, RecordFileSystemError | RecordBootstrapInvalid | RecordFormatUnsupported>;
|
|
@@ -37,12 +37,14 @@ const __niceevalExport16 = __niceevalCanonical["RecordReaderClosed"];
|
|
|
37
37
|
export { __niceevalExport16 as RecordReaderClosed };
|
|
38
38
|
const __niceevalExport17 = __niceevalCanonical["frozenRecordAttemptBrand"];
|
|
39
39
|
export { __niceevalExport17 as frozenRecordAttemptBrand };
|
|
40
|
-
const __niceevalExport18 = __niceevalCanonical["
|
|
41
|
-
export { __niceevalExport18 as
|
|
42
|
-
const __niceevalExport19 = __niceevalCanonical["
|
|
43
|
-
export { __niceevalExport19 as
|
|
44
|
-
const __niceevalExport20 = __niceevalCanonical["
|
|
45
|
-
export { __niceevalExport20 as
|
|
46
|
-
const __niceevalExport21 = __niceevalCanonical["
|
|
47
|
-
export { __niceevalExport21 as
|
|
40
|
+
const __niceevalExport18 = __niceevalCanonical["inspectFixedRecordAttachmentEnvelope"];
|
|
41
|
+
export { __niceevalExport18 as inspectFixedRecordAttachmentEnvelope };
|
|
42
|
+
const __niceevalExport19 = __niceevalCanonical["readCurrentRecordFormat"];
|
|
43
|
+
export { __niceevalExport19 as readCurrentRecordFormat };
|
|
44
|
+
const __niceevalExport20 = __niceevalCanonical["readFixedRecordAttachment"];
|
|
45
|
+
export { __niceevalExport20 as readFixedRecordAttachment };
|
|
46
|
+
const __niceevalExport21 = __niceevalCanonical["readRecordFormatForMaintenance"];
|
|
47
|
+
export { __niceevalExport21 as readRecordFormatForMaintenance };
|
|
48
|
+
const __niceevalExport22 = __niceevalCanonical["validateFixedRecordAttachmentMigrationSource"];
|
|
49
|
+
export { __niceevalExport22 as validateFixedRecordAttachmentMigrationSource };
|
|
48
50
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RECORD_DURABLE_BLOB_REF_KEY = exports.RECORD_READER_MAXIMUM_ATTACHMENT_DOCUMENT_BYTES = exports.RECORD_READER_MAXIMUM_ATTACHMENT_TOTAL_BYTES = exports.RECORD_READER_MAXIMUM_ATTACHMENT_BLOB_BYTES = exports.RECORD_READER_MAXIMUM_ATTACHMENT_BLOB_ENTRIES = void 0;
|
|
4
|
+
exports.inspectFixedRecordAttachmentEnvelope = inspectFixedRecordAttachmentEnvelope;
|
|
4
5
|
exports.readFixedRecordAttachment = readFixedRecordAttachment;
|
|
5
6
|
exports.validateFixedRecordAttachmentMigrationSource = validateFixedRecordAttachmentMigrationSource;
|
|
6
7
|
const effect_1 = require("effect");
|
|
@@ -22,6 +23,12 @@ function attachmentInvalid(path) {
|
|
|
22
23
|
throw new Error("Attachment invalid state requires one issue");
|
|
23
24
|
return Object.freeze({ state: "invalid", issues });
|
|
24
25
|
}
|
|
26
|
+
function attachmentEnvelopeInvalid(path) {
|
|
27
|
+
const issues = (0, record_errors_ts_1.nonEmptyRecordIssues)([(0, record_errors_ts_1.recordIssue)("record-schema-invalid", path)]);
|
|
28
|
+
if (issues === undefined)
|
|
29
|
+
throw new Error("Attachment invalid state requires one issue");
|
|
30
|
+
return Object.freeze({ state: "invalid", issues });
|
|
31
|
+
}
|
|
25
32
|
function attachmentPath(root, location, family, ...segments) {
|
|
26
33
|
return location.owner === "run"
|
|
27
34
|
? (0, services_ts_1.recordPortablePath)(root, "runs", location.runId, "attachments", family, ...segments)
|
|
@@ -117,31 +124,23 @@ function hasReachableAdjacentMigration(descriptor, fromSchemaVersion) {
|
|
|
117
124
|
}
|
|
118
125
|
return true;
|
|
119
126
|
}
|
|
120
|
-
/**
|
|
121
|
-
|
|
122
|
-
* intentionally neither enumerated nor decoded, so future independent
|
|
123
|
-
* families remain preserved and ignored by the normal graph.
|
|
124
|
-
*/
|
|
125
|
-
function readFixedRecordAttachment(input) {
|
|
127
|
+
/** Open-session gate: inspect only directory identity and exact envelope/version. */
|
|
128
|
+
function inspectFixedRecordAttachmentEnvelope(input) {
|
|
126
129
|
return effect_1.Effect.gen(function* () {
|
|
127
130
|
const directory = attachmentPath(input.root, input.location, input.descriptor.family);
|
|
128
131
|
const kind = yield* input.fileSystem.pathKind(directory);
|
|
129
132
|
if (kind === "missing")
|
|
130
133
|
return Object.freeze({ state: "unavailable" });
|
|
131
134
|
if (kind !== "directory")
|
|
132
|
-
return
|
|
135
|
+
return attachmentEnvelopeInvalid(["attachment"]);
|
|
133
136
|
const envelopeDocument = yield* readJson(input.fileSystem, attachmentPath(input.root, input.location, input.descriptor.family, "attachment.json"));
|
|
134
137
|
if (envelopeDocument.state !== "available")
|
|
135
|
-
return
|
|
138
|
+
return attachmentEnvelopeInvalid(["attachment.json"]);
|
|
136
139
|
const envelope = (0, core_ts_1.decodeRecordAttachmentEnvelope)(envelopeDocument.value);
|
|
137
140
|
if (effect_1.Either.isLeft(envelope))
|
|
138
|
-
return
|
|
139
|
-
// We reached a directory for one known fixed family. Its envelope must
|
|
140
|
-
// declare that same family; treating a swapped envelope as an unknown
|
|
141
|
-
// sibling would let a corrupted known directory masquerade as tolerated
|
|
142
|
-
// future data.
|
|
141
|
+
return attachmentEnvelopeInvalid(["attachment.json"]);
|
|
143
142
|
if (envelope.right.family !== input.descriptor.family) {
|
|
144
|
-
return
|
|
143
|
+
return attachmentEnvelopeInvalid(["attachment.json", "family"]);
|
|
145
144
|
}
|
|
146
145
|
if (envelope.right.schemaVersion < input.descriptor.schemaVersion &&
|
|
147
146
|
hasReachableAdjacentMigration(input.descriptor, envelope.right.schemaVersion)) {
|
|
@@ -153,17 +152,25 @@ function readFixedRecordAttachment(input) {
|
|
|
153
152
|
command: "niceeval migrate",
|
|
154
153
|
});
|
|
155
154
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
// migration; all other non-current versions remain local unsupported
|
|
160
|
-
// data, rather than being misclassified as corrupt bytes.
|
|
161
|
-
return Object.freeze({
|
|
155
|
+
return envelope.right.schemaVersion === input.descriptor.schemaVersion
|
|
156
|
+
? Object.freeze({ state: "current" })
|
|
157
|
+
: Object.freeze({
|
|
162
158
|
state: "unsupported",
|
|
163
159
|
family: input.descriptor.family,
|
|
164
160
|
schemaVersion: envelope.right.schemaVersion,
|
|
165
161
|
});
|
|
166
|
-
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Reads precisely one known static family. Unknown sibling directories are
|
|
166
|
+
* intentionally neither enumerated nor decoded, so future independent
|
|
167
|
+
* families remain preserved and ignored by the normal graph.
|
|
168
|
+
*/
|
|
169
|
+
function readFixedRecordAttachment(input) {
|
|
170
|
+
return effect_1.Effect.gen(function* () {
|
|
171
|
+
const envelope = yield* inspectFixedRecordAttachmentEnvelope(input);
|
|
172
|
+
if (envelope.state !== "current")
|
|
173
|
+
return envelope;
|
|
167
174
|
const payloadDocument = yield* readJson(input.fileSystem, attachmentPath(input.root, input.location, input.descriptor.family, "payload.json"));
|
|
168
175
|
if (payloadDocument.state !== "available")
|
|
169
176
|
return attachmentInvalid(["payload.json"]);
|
|
@@ -204,9 +211,10 @@ function readFixedRecordAttachment(input) {
|
|
|
204
211
|
}
|
|
205
212
|
/**
|
|
206
213
|
* Maintenance-only validation of one exact historical attachment before its
|
|
207
|
-
* envelope advances. The
|
|
208
|
-
*
|
|
209
|
-
* proves
|
|
214
|
+
* envelope advances. The historical decoder proves the old shape, the pure
|
|
215
|
+
* adjacent migration constructs the current payload, and the current
|
|
216
|
+
* descriptor proves its exact shape and blob closure. Physical rewrite policy
|
|
217
|
+
* remains host-owned metadata; `rewritePayload` is only its consistency check.
|
|
210
218
|
*/
|
|
211
219
|
function validateFixedRecordAttachmentMigrationSource(input) {
|
|
212
220
|
return effect_1.Effect.gen(function* () {
|
|
@@ -239,18 +247,13 @@ function validateFixedRecordAttachmentMigrationSource(input) {
|
|
|
239
247
|
[...hydrated.refsByKey.keys()].some((key) => !entriesByKey.has(key))) {
|
|
240
248
|
return false;
|
|
241
249
|
}
|
|
242
|
-
let
|
|
250
|
+
let historical;
|
|
243
251
|
try {
|
|
244
|
-
|
|
252
|
+
historical = input.decodeHistorical(hydrated.value);
|
|
245
253
|
}
|
|
246
254
|
catch {
|
|
247
255
|
return false;
|
|
248
256
|
}
|
|
249
|
-
if (effect_1.Either.isLeft(input.descriptor.write.decodePayload(migrated)))
|
|
250
|
-
return false;
|
|
251
|
-
const payload = input.descriptor.write.decodePayload(hydrated.value);
|
|
252
|
-
if (effect_1.Either.isLeft(payload))
|
|
253
|
-
return false;
|
|
254
257
|
let totalBytes = 0;
|
|
255
258
|
const materialized = [];
|
|
256
259
|
for (const [key, ref] of hydrated.refsByKey) {
|
|
@@ -262,7 +265,35 @@ function validateFixedRecordAttachmentMigrationSource(input) {
|
|
|
262
265
|
return false;
|
|
263
266
|
materialized.push(Object.freeze({ ref, bytes }));
|
|
264
267
|
}
|
|
265
|
-
|
|
268
|
+
if (input.verifyHistorical !== undefined && !input.verifyHistorical(historical, materialized)) {
|
|
269
|
+
return false;
|
|
270
|
+
}
|
|
271
|
+
let migrated;
|
|
272
|
+
try {
|
|
273
|
+
migrated = input.migrate(historical);
|
|
274
|
+
}
|
|
275
|
+
catch {
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
const payload = input.descriptor.write.decodePayload(migrated);
|
|
279
|
+
if (effect_1.Either.isLeft(payload))
|
|
280
|
+
return false;
|
|
281
|
+
const currentRefs = new Set(input.descriptor.write.refs(payload.right));
|
|
282
|
+
const currentMaterialized = materialized.filter((blob) => currentRefs.has(blob.ref));
|
|
283
|
+
if (effect_1.Either.isLeft((0, internal_ts_1.makeFixedRecordAttachmentValueFromDecoded)(input.descriptor.write, payload.right, currentMaterialized)))
|
|
284
|
+
return false;
|
|
285
|
+
const bytesByRef = new Map(materialized.map((blob) => [blob.ref, blob.bytes]));
|
|
286
|
+
const removedBlobs = [...hydrated.refsByKey]
|
|
287
|
+
.filter(([, ref]) => !currentRefs.has(ref))
|
|
288
|
+
.map(([key, ref]) => Object.freeze({ key, bytes: bytesByRef.get(ref) }));
|
|
289
|
+
return Object.freeze({
|
|
290
|
+
payload: payload.right,
|
|
291
|
+
blobKeys: new Map([...hydrated.refsByKey]
|
|
292
|
+
.filter(([, ref]) => currentRefs.has(ref))
|
|
293
|
+
.map(([key, ref]) => [ref, key])),
|
|
294
|
+
removedBlobs: Object.freeze(removedBlobs),
|
|
295
|
+
rewritePayload: migrated !== historical,
|
|
296
|
+
});
|
|
266
297
|
});
|
|
267
298
|
}
|
|
268
299
|
//# sourceMappingURL=runtime.cjs.map
|