niceeval 0.16.2 → 0.17.0
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/cli/bootstrap.cjs +7 -1
- package/dist/cli/bootstrap.cjs.map +1 -1
- package/dist/cli/project-configuration.cjs +8 -11
- package/dist/cli/project-configuration.cjs.map +1 -1
- package/dist/expect/index.cjs.map +1 -1
- package/dist/expect/index.d.cts +1 -0
- package/dist/expect/index.d.mts +1 -0
- package/dist/expect/index.d.ts +1 -0
- package/dist/experiment/host/cli/contribution.cjs +6 -11
- package/dist/experiment/host/cli/contribution.cjs.map +1 -1
- package/dist/experiment/host/cli/contribution.d.cts +0 -16
- package/dist/experiment/host/cli/contribution.d.mts +0 -16
- package/dist/experiment/host/cli/contribution.d.ts +0 -16
- package/dist/experiment/host/operations.cjs +3 -3
- package/dist/experiment/host/operations.cjs.map +1 -1
- package/dist/experiment/host/types.cjs.map +1 -1
- package/dist/experiment/host/types.d.cts +0 -4
- package/dist/experiment/host/types.d.mts +0 -4
- package/dist/experiment/host/types.d.ts +0 -4
- package/dist/fresh-import.cjs +2 -2
- package/dist/fresh-import.cjs.map +1 -1
- package/dist/fresh-import.d.cts +3 -3
- package/dist/fresh-import.d.mts +3 -3
- package/dist/fresh-import.d.ts +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/inspection/codec.cjs.map +1 -1
- package/dist/inspection/codec.d.cts +1 -1
- package/dist/inspection/codec.d.mts +1 -1
- package/dist/inspection/codec.d.ts +1 -1
- package/dist/inspection/facts.cjs +66 -9
- package/dist/inspection/facts.cjs.map +1 -1
- package/dist/inspection/facts.d.cts +4 -0
- package/dist/inspection/facts.d.mts +4 -0
- package/dist/inspection/facts.d.ts +4 -0
- package/dist/inspection/facts.js +4 -2
- package/dist/inspection/index.cjs +1 -3
- package/dist/inspection/index.cjs.map +1 -1
- package/dist/inspection/index.d.cts +1 -1
- package/dist/inspection/index.d.mts +1 -1
- package/dist/inspection/index.d.ts +1 -1
- package/dist/inspection/index.js +44 -48
- package/dist/inspection/limits.cjs +3 -1
- package/dist/inspection/limits.cjs.map +1 -1
- package/dist/inspection/limits.d.cts +2 -0
- package/dist/inspection/limits.d.mts +2 -0
- package/dist/inspection/limits.d.ts +2 -0
- package/dist/inspection/limits.js +6 -4
- package/dist/inspection/project-source.cjs +4 -1
- package/dist/inspection/project-source.cjs.map +1 -1
- package/dist/inspection/protocol.cjs +10 -18
- package/dist/inspection/protocol.cjs.map +1 -1
- package/dist/inspection/protocol.d.cts +111 -173
- package/dist/inspection/protocol.d.mts +111 -173
- package/dist/inspection/protocol.d.ts +111 -173
- package/dist/inspection/public.mjs +73 -109
- package/dist/inspection/results.cjs +12 -48
- package/dist/inspection/results.cjs.map +1 -1
- package/dist/inspection/results.d.cts +124 -122
- package/dist/inspection/results.d.mts +124 -122
- package/dist/inspection/results.d.ts +124 -122
- package/dist/inspection/results.js +16 -20
- package/dist/inspection/select.cjs +80 -117
- package/dist/inspection/select.cjs.map +1 -1
- package/dist/inspection/source.cjs +14 -15
- package/dist/inspection/source.cjs.map +1 -1
- package/dist/inspection/source.d.cts +6 -3
- package/dist/inspection/source.d.mts +6 -3
- package/dist/inspection/source.d.ts +6 -3
- package/dist/inspection/trace.cjs +1 -1
- package/dist/inspection/trace.cjs.map +1 -1
- package/dist/load-config.cjs +17 -11
- package/dist/load-config.cjs.map +1 -1
- package/dist/load-config.d.cts +3 -2
- package/dist/load-config.d.mts +3 -2
- package/dist/load-config.d.ts +3 -2
- package/dist/o11y/adapter-usage-projection.cjs +5 -1
- package/dist/o11y/adapter-usage-projection.cjs.map +1 -1
- package/dist/o11y/adapter-usage-projection.d.cts +109 -1
- package/dist/o11y/adapter-usage-projection.d.mts +109 -1
- package/dist/o11y/adapter-usage-projection.d.ts +109 -1
- package/dist/o11y/cache-read.cjs +113 -0
- package/dist/o11y/cache-read.cjs.map +1 -0
- package/dist/o11y/cache-read.d.cts +80 -0
- package/dist/o11y/cache-read.d.mts +80 -0
- package/dist/o11y/cache-read.d.ts +80 -0
- package/dist/o11y/cache-read.js +8 -0
- package/dist/o11y/cache-read.js.map +1 -0
- package/dist/o11y/eval-usage.cjs +4 -1
- package/dist/o11y/eval-usage.cjs.map +1 -1
- package/dist/o11y/eval-usage.d.cts +4 -1
- package/dist/o11y/eval-usage.d.mts +4 -1
- package/dist/o11y/eval-usage.d.ts +4 -1
- package/dist/record/host/sqlite-host.cjs +188 -53
- package/dist/record/host/sqlite-host.cjs.map +1 -1
- package/dist/record/host/sqlite-host.d.cts +37 -1
- package/dist/record/host/sqlite-host.d.mts +37 -1
- package/dist/record/host/sqlite-host.d.ts +37 -1
- package/dist/record/host/sqlite-host.js +16 -8
- package/dist/record/maintenance/runtime.cjs +3 -3
- package/dist/record/maintenance/runtime.cjs.map +1 -1
- package/dist/record/sqlite/admission-repository.cjs +18 -18
- package/dist/record/sqlite/admission-repository.cjs.map +1 -1
- package/dist/record/sqlite/case-repository.cjs +6 -6
- package/dist/record/sqlite/case-repository.cjs.map +1 -1
- package/dist/record/sqlite/coordination-repository.cjs +25 -25
- package/dist/record/sqlite/coordination-repository.cjs.map +1 -1
- package/dist/record/sqlite/current-schema.cjs +115 -111
- package/dist/record/sqlite/current-schema.cjs.map +1 -1
- package/dist/record/sqlite/current-schema.d.cts +3 -3
- package/dist/record/sqlite/current-schema.d.mts +3 -3
- package/dist/record/sqlite/current-schema.d.ts +3 -3
- package/dist/record/sqlite/database.cjs +56 -53
- package/dist/record/sqlite/database.cjs.map +1 -1
- package/dist/record/sqlite/index.cjs +3 -1
- package/dist/record/sqlite/index.cjs.map +1 -1
- package/dist/record/sqlite/index.d.cts +5 -2
- package/dist/record/sqlite/index.d.mts +5 -2
- package/dist/record/sqlite/index.d.ts +5 -2
- package/dist/record/sqlite/legacy-schema-018.cjs +443 -0
- package/dist/record/sqlite/legacy-schema-018.cjs.map +1 -0
- package/dist/record/sqlite/legacy-schema-018.d.cts +6 -0
- package/dist/record/sqlite/legacy-schema-018.d.mts +6 -0
- package/dist/record/sqlite/legacy-schema-018.d.ts +6 -0
- package/dist/record/sqlite/legacy-schema-018.js +6 -0
- package/dist/record/sqlite/legacy-schema-018.js.map +1 -0
- package/dist/record/sqlite/migration.cjs +105 -46
- package/dist/record/sqlite/migration.cjs.map +1 -1
- package/dist/record/sqlite/migration.d.cts +2 -1
- package/dist/record/sqlite/migration.d.mts +2 -1
- package/dist/record/sqlite/migration.d.ts +2 -1
- package/dist/record/sqlite/portable-capture.cjs +13 -13
- package/dist/record/sqlite/portable-capture.cjs.map +1 -1
- package/dist/record/sqlite/registry-repository.cjs +22 -22
- package/dist/record/sqlite/registry-repository.cjs.map +1 -1
- package/dist/record/sqlite/schema.cjs +10 -2
- package/dist/record/sqlite/schema.cjs.map +1 -1
- package/dist/record/sqlite/schema.d.cts +4 -1
- package/dist/record/sqlite/schema.d.mts +4 -1
- package/dist/record/sqlite/schema.d.ts +4 -1
- package/dist/record/sqlite/schema.js +20 -14
- package/dist/record/sqlite/storage-worker.cjs +1 -1
- package/dist/record/sqlite/storage-worker.cjs.map +1 -1
- package/dist/record/sqlite/storage.cjs +316 -232
- package/dist/record/sqlite/storage.cjs.map +1 -1
- package/dist/record/sqlite/storage.d.cts +10 -2
- package/dist/record/sqlite/storage.d.mts +10 -2
- package/dist/record/sqlite/storage.d.ts +10 -2
- package/dist/record/sqlite/storage.js +54 -50
- package/dist/record/sqlite/types.cjs +1 -1
- package/dist/record/sqlite/types.cjs.map +1 -1
- package/dist/record/sqlite/types.d.cts +13 -1
- package/dist/record/sqlite/types.d.mts +13 -1
- package/dist/record/sqlite/types.d.ts +13 -1
- package/dist/run/cli/contribution.cjs +17 -12
- package/dist/run/cli/contribution.cjs.map +1 -1
- package/dist/run/host/lifecycle-adapter.cjs +1 -1
- package/dist/run/host/lifecycle-adapter.cjs.map +1 -1
- package/dist/run/storage/owner-identity.cjs +78 -16
- package/dist/run/storage/owner-identity.cjs.map +1 -1
- package/dist/run/storage/owner-identity.d.cts +2 -1
- package/dist/run/storage/owner-identity.d.mts +2 -1
- package/dist/run/storage/owner-identity.d.ts +2 -1
- package/dist/run/storage/sqlite.cjs +55 -55
- package/dist/run/storage/sqlite.cjs.map +1 -1
- package/dist/runner/accept.cjs +12 -42
- package/dist/runner/accept.cjs.map +1 -1
- package/dist/runner/accept.d.cts +2 -3
- package/dist/runner/accept.d.mts +2 -3
- package/dist/runner/accept.d.ts +2 -3
- package/dist/runner/adapter-usage.cjs +2 -2
- package/dist/runner/adapter-usage.cjs.map +1 -1
- package/dist/runner/adoption.cjs +14 -26
- package/dist/runner/adoption.cjs.map +1 -1
- package/dist/runner/adoption.d.cts +5 -13
- package/dist/runner/adoption.d.mts +5 -13
- package/dist/runner/adoption.d.ts +5 -13
- package/dist/runner/adoption.js +2 -4
- package/dist/runner/record.cjs +24 -18
- package/dist/runner/record.cjs.map +1 -1
- package/dist/runner/rename-experiment.cjs +5 -7
- package/dist/runner/rename-experiment.cjs.map +1 -1
- package/dist/runner/reuse-plan.cjs +37 -18
- package/dist/runner/reuse-plan.cjs.map +1 -1
- package/dist/runner/reuse-plan.d.cts +4 -1
- package/dist/runner/reuse-plan.d.mts +4 -1
- package/dist/runner/reuse-plan.d.ts +4 -1
- package/dist/runner/setup-prefix-plan.cjs +17 -12
- package/dist/runner/setup-prefix-plan.cjs.map +1 -1
- package/dist/runner/setup-prefix-plan.d.cts +0 -2
- package/dist/runner/setup-prefix-plan.d.mts +0 -2
- package/dist/runner/setup-prefix-plan.d.ts +0 -2
- package/dist/runner/setup-prefix-plan.js +8 -12
- package/dist/sandbox/backend.cjs +10 -1
- package/dist/sandbox/backend.cjs.map +1 -1
- package/dist/sandbox/backend.d.cts +16 -8
- package/dist/sandbox/backend.d.mts +16 -8
- package/dist/sandbox/backend.d.ts +16 -8
- package/dist/sandbox/backend.js +28 -26
- package/dist/sandbox/docker.cjs +7 -1
- package/dist/sandbox/docker.cjs.map +1 -1
- package/dist/sandbox/e2b-cache-repository.cjs +13 -3
- package/dist/sandbox/e2b-cache-repository.cjs.map +1 -1
- package/dist/sandbox/e2b-cache-repository.d.cts +3 -0
- package/dist/sandbox/e2b-cache-repository.d.mts +3 -0
- package/dist/sandbox/e2b-cache-repository.d.ts +3 -0
- package/dist/sandbox/e2b-cache-repository.js +16 -12
- package/dist/sandbox/e2b.cjs +2 -2
- package/dist/sandbox/e2b.cjs.map +1 -1
- package/dist/sandbox/incus/materialize.cjs +1 -1
- package/dist/sandbox/incus/materialize.cjs.map +1 -1
- package/dist/show/contribution.cjs +3 -3
- package/dist/show/contribution.cjs.map +1 -1
- package/dist/show/model.cjs +14 -13
- package/dist/show/model.cjs.map +1 -1
- package/dist/show/model.d.cts +7 -7
- package/dist/show/model.d.mts +7 -7
- package/dist/show/model.d.ts +7 -7
- package/dist/show/render.cjs +14 -0
- package/dist/show/render.cjs.map +1 -1
- package/dist/user-database/storage-worker.cjs +13 -3
- package/dist/user-database/storage-worker.cjs.map +1 -1
- package/dist/view/app-dist/.vite/manifest.json +2 -2
- package/dist/view/app-dist/assets/{index-CmVoXbwG.js → index-B3ijZRph.js} +17 -17
- package/dist/view/app-dist/assets/{quality-cost-scatter-BuLISaH4.js → quality-cost-scatter-B--DfJ9s.js} +1 -1
- package/dist/view/app-dist/index.html +1 -1
- package/dist/view/application-runtime.cjs +8 -0
- package/dist/view/application-runtime.cjs.map +1 -0
- package/dist/view/application-runtime.d.cts +9 -0
- package/dist/view/application-runtime.d.mts +9 -0
- package/dist/view/application-runtime.d.ts +9 -0
- package/dist/view/application-runtime.js +6 -0
- package/dist/view/application-runtime.js.map +1 -0
- package/dist/view/cli/contribution.cjs +5 -2
- package/dist/view/cli/contribution.cjs.map +1 -1
- package/dist/view/cli/contribution.d.cts +2 -1
- package/dist/view/cli/contribution.d.mts +2 -1
- package/dist/view/cli/contribution.d.ts +2 -1
- package/dist/view/function-runtime.mjs +1019 -456
- package/dist/view/http-protocol.d.cts +1 -9
- package/dist/view/http-protocol.d.mts +1 -9
- package/dist/view/http-protocol.d.ts +1 -9
- package/dist/view/inspection-host.cjs +39 -30
- package/dist/view/inspection-host.cjs.map +1 -1
- package/dist/view/inspection-host.d.cts +7545 -2
- package/dist/view/inspection-host.d.mts +7545 -2
- package/dist/view/inspection-host.d.ts +7545 -2
- package/dist/view/server.cjs +8 -5
- package/dist/view/server.cjs.map +1 -1
- package/dist/view/server.d.cts +4 -2
- package/dist/view/server.d.mts +4 -2
- package/dist/view/server.d.ts +4 -2
- package/docs-site/zh/reference/cli.mdx +1 -2
- package/docs-site/zh/tutorials/control-run-cost.mdx +22 -0
- package/docs-site/zh/tutorials/niceeval-taste-application.mdx +21 -0
- package/package.json +1 -1
package/dist/cli/bootstrap.cjs
CHANGED
|
@@ -23,6 +23,7 @@ const index_ts_1 = require("../record/index.cjs");
|
|
|
23
23
|
const cache_live_ts_1 = require("../docker/cache-live.cjs");
|
|
24
24
|
const node_ts_1 = require("../project/node.cjs");
|
|
25
25
|
const browser_ts_1 = require("../view/browser.cjs");
|
|
26
|
+
const application_runtime_ts_1 = require("../view/application-runtime.cjs");
|
|
26
27
|
const index_ts_2 = require("../error-assistance/index.cjs");
|
|
27
28
|
let signalOwnership = "root";
|
|
28
29
|
const invocationInterruption = new AbortController();
|
|
@@ -77,7 +78,12 @@ const featureCommands = (0, contribution_ts_1.composeCliCommands)([
|
|
|
77
78
|
contribution_ts_10.stateCliCommand,
|
|
78
79
|
contribution_ts_11.projectInitCliCommand,
|
|
79
80
|
]);
|
|
80
|
-
const application = effect_1.Effect.scoped((
|
|
81
|
+
const application = effect_1.Effect.scoped(effect_1.Effect.gen(function* () {
|
|
82
|
+
// Capture this application's services once. HTTP callbacks share its runtime;
|
|
83
|
+
// the root Scope interrupts and drains every remaining callback fiber.
|
|
84
|
+
const run = yield* effect_1.FiberSet.makeRuntimePromise();
|
|
85
|
+
return yield* (0, program_ts_1.cliProgram)(featureCommands).pipe(effect_1.Effect.provideService(application_runtime_ts_1.ViewApplicationRuntime, { run }));
|
|
86
|
+
})).pipe(
|
|
81
87
|
// Application bootstrap is the sole provider of concrete Node services.
|
|
82
88
|
// Command and library modules retain their real requirements for callers.
|
|
83
89
|
effect_1.Effect.provide(index_ts_1.NodeRecordLive),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["bootstrap.ts"],"names":[],"mappings":";;AAAA,2EAA2E;AAC3E,wEAAwE;AACxE,mCAAoD;AAEpD,6CAA4D;AAC5D,uDAA6E;AAC7E,mEAAiE;AACjE,oEAAmE;AACnE,iEAAoE;AACpE,4EAAoF;AACpF,oEAA2G;AAC3G,uEAA8E;AAC9E,6DAAyD;AACzD,iEAA6D;AAC7D,gEAA2D;AAC3D,mEAA+D;AAC/D,qEAAuE;AACvE,qDAAuI;AACvI,+DAA4D;AAC5D,yEAA6I;AAC7I,iDAAoD;AAKpD,2DAAwE;AACxE,gDAAqD;AAErD,mDAAsE;AACtE,2DAAqE;AAarE,IAAI,eAAe,GAAoB,MAAM,CAAC;AAC9C,MAAM,sBAAsB,GAAG,IAAI,eAAe,EAAE,CAAC;AACrD,IAAI,KAAoD,CAAC;AACzD,MAAM,YAAY,GAA2B;IACzC,gBAAgB,EAAE,sBAAsB,CAAC,MAAM;IAC/C,qBAAqB,EAAE,GAAG,EAAE;QACxB,IAAI,eAAe,KAAK,MAAM,EAAE,CAAC;YAC7B,eAAe,GAAG,mBAAmB,CAAC;YACtC,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,yEAAyE;QACzE,6EAA6E;QAC7E,OAAO,eAAe,KAAK,kBAAkB,CAAC;IAClD,CAAC;IACD,gBAAgB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;CACjD,CAAC;AACF,MAAM,uBAAuB,GAAG,cAAK,CAAC,OAAO,CAAC,gCAAe,EAAE,YAAY,CAAC,CAAC;AAC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pH,wEAAwE;AACxE,6DAA6D;AAC7D,KAAK,GAAG,eAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;AACpC,2EAA2E;AAC3E,6EAA6E;AAC7E,MAAM,sBAAsB,GAAG,GAAS,EAAE;IACtC,IAAI,eAAe,KAAK,kBAAkB,IAAI,KAAK,KAAK,SAAS;QAC7D,OAAO;IACX,KAAK,CAAC,eAAe,EAAE,CAAC;AAC5B,CAAC,CAAC;AACF,sBAAsB,EAAE,CAAC;AACzB,KAAK,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE;IACvB,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IAC9C,OAAO,CAAC,cAAc,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAC/C,IAAI,aAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACvB,wEAAwE;QACxE,wEAAwE;QACxE,uEAAuE;QACvE,OAAO,CAAC,QAAQ,GAAG,cAAK,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACrE,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["// The one application runtime boundary. Library and command modules return\n// Effect values; this file is the only place NiceEval starts a runtime.\nimport { Cause, Effect, Exit, Layer } from \"effect\";\nimport type * as Scope from \"effect/Scope\";\nimport { cliProgram, renderCliFailure } from \"./program.ts\";\nimport { composeCliCommands, type CliFeatureError } from \"./contribution.ts\";\nimport { dockerCliCommand } from \"../docker/cli/contribution.ts\";\nimport { sandboxCliCommand } from \"../sandbox/cli/contribution.ts\";\nimport { evalCatalogCliCommand } from \"../eval/cli/contribution.ts\";\nimport { experimentCliContributions } from \"../experiment/host/cli/contribution.ts\";\nimport { ExperimentCliTerminal, NodeExperimentCliTerminalLive, } from \"../experiment/host/cli/terminal.ts\";\nimport { inspectionQueryCliCommand } from \"../inspection/cli/contribution.ts\";\nimport { showCliCommand } from \"../show/contribution.ts\";\nimport { viewCliCommand } from \"../view/cli/contribution.ts\";\nimport { runCliCommand } from \"../run/cli/contribution.ts\";\nimport { stateCliCommand } from \"../state/cli/contribution.ts\";\nimport { projectInitCliCommand } from \"../project/cli/contribution.ts\";\nimport { CliArguments, CliInterruption, CliInvocationFacts, CliOutput, CliPath, type CliInterruptionService, } from \"./application.ts\";\nimport { NodeCliPlatformLive } from \"./node-application.ts\";\nimport { ConfigModuleLoaderLive, ProjectConfiguration, ProjectConfigurationLayer, ProjectCredentialsLive } from \"./project-configuration.ts\";\nimport { NodeRecordLive } from \"../record/index.ts\";\nimport { RecordCoordination } from \"../coordination/record-leases.ts\";\nimport { RecordEntropy, RecordFileSystem } from \"../record/platform/services.ts\";\nimport { ProjectStateDatabase } from \"../record/sqlite/project-state-database.ts\";\nimport { DockerCacheAdministration } from \"../docker/cache-administration.ts\";\nimport { DockerCacheAdministrationLive } from \"../docker/cache-live.ts\";\nimport { NodeProjectLive } from \"../project/node.ts\";\nimport { ProjectFileSystem, ProjectManifestFacts, ProjectProcessFacts } from \"../project/services.ts\";\nimport { NodeViewBrowserLive, ViewBrowser } from \"../view/browser.ts\";\nimport { summarizeUnknownError } from \"../error-assistance/index.ts\";\n// There is exactly one synchronous ownership state for the first signal. Node\n// invokes both signal handlers and Effect continuations serially, so the CLI's\n// hand-off cannot race a SIGINT into an unowned interval:\n//\n// root -> root-interrupted (interrupt the application fiber)\n// root -> graceful-dispatch (CLI is about to call runEvals)\n// graceful-dispatch -> graceful-aborted (abort only the Invocation signal)\n//\n// Graceful ownership is deliberately one-way. Returning it after `runEvals`\n// would create a second boundary where a first signal could miss both the\n// durable closure and root interruption.\ntype SignalOwnership = \"root\" | \"root-interrupted\" | \"graceful-dispatch\" | \"graceful-aborted\";\nlet signalOwnership: SignalOwnership = \"root\";\nconst invocationInterruption = new AbortController();\nlet fiber: ReturnType<typeof Effect.runFork> | undefined;\nconst interruption: CliInterruptionService = {\n invocationSignal: invocationInterruption.signal,\n enterGracefulDispatch: () => {\n if (signalOwnership === \"root\") {\n signalOwnership = \"graceful-dispatch\";\n return true;\n }\n // A root-owned first signal has already scheduled root interruption. Let\n // the CLI preserve that Cause rather than start an Invocation underneath it.\n return signalOwnership !== \"root-interrupted\";\n },\n requestInterrupt: () => process.emit(\"SIGINT\"),\n};\nconst NodeCliInterruptionLive = Layer.succeed(CliInterruption, interruption);\n// This is the only Node composition edge. The application layer itself keeps\n// its two capability requirements visible and portable.\nconst NodeCliApplicationLive = ProjectConfigurationLayer.pipe(Layer.provide(ProjectCredentialsLive), Layer.provide(ConfigModuleLoaderLive));\nconst onInterrupt = (signal: NodeJS.Signals): void => {\n if (signalOwnership === \"root\") {\n signalOwnership = \"root-interrupted\";\n fiber?.interruptUnsafe();\n return;\n }\n if (signalOwnership === \"graceful-dispatch\") {\n signalOwnership = \"graceful-aborted\";\n invocationInterruption.abort();\n return;\n }\n // Keep this listener through the first-signal drain: libuv may already have\n // captured a second signal before the first handler runs. On escalation,\n // remove it and re-raise that exact OS signal so default forced termination\n // cannot become a queued no-op.\n process.removeListener(\"SIGINT\", onInterrupt);\n process.removeListener(\"SIGTERM\", onInterrupt);\n process.kill(process.pid, signal);\n};\nprocess.on(\"SIGINT\", onInterrupt);\nprocess.on(\"SIGTERM\", onInterrupt);\ntype CliFeatureRequirements = DockerCacheAdministration | CliArguments | CliInterruption | CliInvocationFacts | CliOutput | CliPath | ExperimentCliTerminal | ProjectConfiguration | RecordCoordination | RecordEntropy | RecordFileSystem | ProjectStateDatabase | ProjectFileSystem | ProjectManifestFacts | ProjectProcessFacts | ViewBrowser | Scope.Scope;\nconst featureCommands = composeCliCommands<CliFeatureRequirements, CliFeatureError>([\n ...experimentCliContributions,\n evalCatalogCliCommand,\n inspectionQueryCliCommand,\n showCliCommand,\n runCliCommand,\n viewCliCommand,\n sandboxCliCommand,\n dockerCliCommand,\n stateCliCommand,\n projectInitCliCommand,\n]);\nconst application = Effect.scoped(cliProgram(featureCommands)).pipe(\n// Application bootstrap is the sole provider of concrete Node services.\n// Command and library modules retain their real requirements for callers.\nEffect.provide(NodeRecordLive), \n// This is a lazy service value: ordinary commands and help do not probe Docker.\nEffect.provide(DockerCacheAdministrationLive), Effect.provide(NodeProjectLive), Effect.provide(NodeViewBrowserLive), Effect.provide(NodeExperimentCliTerminalLive), Effect.provide(NodeCliInterruptionLive), Effect.provide(NodeCliApplicationLive), Effect.provide(NodeCliPlatformLive), \n// Typed CLI failures are expected, user-actionable outcomes. They become an\n// ordinary process status after their message has been written once.\nEffect.catch((failure) => Effect.sync(() => {\n process.stderr.write(renderCliFailure(failure));\n return failure.exitCode;\n})), \n// A normal nonzero command result must flush through Node naturally; do not\n// use process.exit and skip Scope finalizers or piped stdout.\nEffect.tap((exitCode) => Effect.sync(() => {\n process.exitCode = exitCode;\n})), Effect.asVoid, \n// Defects remain defects and interruption remains interruption. Suppress\n// platform's generic logger so the CLI keeps its existing user-facing form.\nEffect.tapCause((cause) => Cause.hasInterruptsOnly(cause)\n ? Effect.void\n : Effect.sync(() => process.stderr.write(`niceeval error:\\n${summarizeUnknownError(Cause.squash(cause))}\\n`))));\n// Effect v4 keeps Node alive while live fibers await callbacks, so this\n// boundary does not install a second process-liveness timer.\nfiber = Effect.runFork(application);\n// A signal cannot normally interleave with this synchronous bootstrap, but\n// retaining the state makes that startup edge explicit and lossless as well.\nconst interruptRootIfPending = (): void => {\n if (signalOwnership !== \"root-interrupted\" || fiber === undefined)\n return;\n fiber.interruptUnsafe();\n};\ninterruptRootIfPending();\nfiber.addObserver((exit) => {\n process.removeListener(\"SIGINT\", onInterrupt);\n process.removeListener(\"SIGTERM\", onInterrupt);\n if (Exit.isFailure(exit)) {\n // Scope finalizers have settled before an observer sees the Exit. Typed\n // CLI failures already became a successful numeric result above; only a\n // real unhandled interruption receives 130, and defects remain exit 2.\n process.exitCode = Cause.hasInterruptsOnly(exit.cause) ? 130 : 2;\n }\n});\n"]}
|
|
1
|
+
{"version":3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CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACpH,wEAAwE;AACxE,6DAA6D;AAC7D,KAAK,GAAG,eAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;AACpC,2EAA2E;AAC3E,6EAA6E;AAC7E,MAAM,sBAAsB,GAAG,GAAS,EAAE;IACtC,IAAI,eAAe,KAAK,kBAAkB,IAAI,KAAK,KAAK,SAAS;QAC7D,OAAO;IACX,KAAK,CAAC,eAAe,EAAE,CAAC;AAC5B,CAAC,CAAC;AACF,sBAAsB,EAAE,CAAC;AACzB,KAAK,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE;IACvB,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IAC9C,OAAO,CAAC,cAAc,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAC/C,IAAI,aAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACvB,wEAAwE;QACxE,wEAAwE;QACxE,uEAAuE;QACvE,OAAO,CAAC,QAAQ,GAAG,cAAK,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACrE,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["// The one application runtime boundary. Library and command modules return\n// Effect values; this file is the only place NiceEval starts a runtime.\nimport { Cause, Effect, Exit, FiberSet, Layer } from \"effect\";\nimport type * as Scope from \"effect/Scope\";\nimport { cliProgram, renderCliFailure } from \"./program.ts\";\nimport { composeCliCommands, type CliFeatureError } from \"./contribution.ts\";\nimport { dockerCliCommand } from \"../docker/cli/contribution.ts\";\nimport { sandboxCliCommand } from \"../sandbox/cli/contribution.ts\";\nimport { evalCatalogCliCommand } from \"../eval/cli/contribution.ts\";\nimport { experimentCliContributions } from \"../experiment/host/cli/contribution.ts\";\nimport { ExperimentCliTerminal, NodeExperimentCliTerminalLive, } from \"../experiment/host/cli/terminal.ts\";\nimport { inspectionQueryCliCommand } from \"../inspection/cli/contribution.ts\";\nimport { showCliCommand } from \"../show/contribution.ts\";\nimport { viewCliCommand } from \"../view/cli/contribution.ts\";\nimport { runCliCommand } from \"../run/cli/contribution.ts\";\nimport { stateCliCommand } from \"../state/cli/contribution.ts\";\nimport { projectInitCliCommand } from \"../project/cli/contribution.ts\";\nimport { CliArguments, CliInterruption, CliInvocationFacts, CliOutput, CliPath, type CliInterruptionService, } from \"./application.ts\";\nimport { NodeCliPlatformLive } from \"./node-application.ts\";\nimport { ConfigModuleLoaderLive, ProjectConfiguration, ProjectConfigurationLayer, ProjectCredentialsLive } from \"./project-configuration.ts\";\nimport { NodeRecordLive } from \"../record/index.ts\";\nimport { RecordCoordination } from \"../coordination/record-leases.ts\";\nimport { RecordEntropy, RecordFileSystem } from \"../record/platform/services.ts\";\nimport { ProjectStateDatabase } from \"../record/sqlite/project-state-database.ts\";\nimport { DockerCacheAdministration } from \"../docker/cache-administration.ts\";\nimport { DockerCacheAdministrationLive } from \"../docker/cache-live.ts\";\nimport { NodeProjectLive } from \"../project/node.ts\";\nimport { ProjectFileSystem, ProjectManifestFacts, ProjectProcessFacts } from \"../project/services.ts\";\nimport { NodeViewBrowserLive, ViewBrowser } from \"../view/browser.ts\";\nimport { ViewApplicationRuntime } from \"../view/application-runtime.ts\";\nimport { summarizeUnknownError } from \"../error-assistance/index.ts\";\n// There is exactly one synchronous ownership state for the first signal. Node\n// invokes both signal handlers and Effect continuations serially, so the CLI's\n// hand-off cannot race a SIGINT into an unowned interval:\n//\n// root -> root-interrupted (interrupt the application fiber)\n// root -> graceful-dispatch (CLI is about to call runEvals)\n// graceful-dispatch -> graceful-aborted (abort only the Invocation signal)\n//\n// Graceful ownership is deliberately one-way. Returning it after `runEvals`\n// would create a second boundary where a first signal could miss both the\n// durable closure and root interruption.\ntype SignalOwnership = \"root\" | \"root-interrupted\" | \"graceful-dispatch\" | \"graceful-aborted\";\nlet signalOwnership: SignalOwnership = \"root\";\nconst invocationInterruption = new AbortController();\nlet fiber: ReturnType<typeof Effect.runFork> | undefined;\nconst interruption: CliInterruptionService = {\n invocationSignal: invocationInterruption.signal,\n enterGracefulDispatch: () => {\n if (signalOwnership === \"root\") {\n signalOwnership = \"graceful-dispatch\";\n return true;\n }\n // A root-owned first signal has already scheduled root interruption. Let\n // the CLI preserve that Cause rather than start an Invocation underneath it.\n return signalOwnership !== \"root-interrupted\";\n },\n requestInterrupt: () => process.emit(\"SIGINT\"),\n};\nconst NodeCliInterruptionLive = Layer.succeed(CliInterruption, interruption);\n// This is the only Node composition edge. The application layer itself keeps\n// its two capability requirements visible and portable.\nconst NodeCliApplicationLive = ProjectConfigurationLayer.pipe(Layer.provide(ProjectCredentialsLive), Layer.provide(ConfigModuleLoaderLive));\nconst onInterrupt = (signal: NodeJS.Signals): void => {\n if (signalOwnership === \"root\") {\n signalOwnership = \"root-interrupted\";\n fiber?.interruptUnsafe();\n return;\n }\n if (signalOwnership === \"graceful-dispatch\") {\n signalOwnership = \"graceful-aborted\";\n invocationInterruption.abort();\n return;\n }\n // Keep this listener through the first-signal drain: libuv may already have\n // captured a second signal before the first handler runs. On escalation,\n // remove it and re-raise that exact OS signal so default forced termination\n // cannot become a queued no-op.\n process.removeListener(\"SIGINT\", onInterrupt);\n process.removeListener(\"SIGTERM\", onInterrupt);\n process.kill(process.pid, signal);\n};\nprocess.on(\"SIGINT\", onInterrupt);\nprocess.on(\"SIGTERM\", onInterrupt);\ntype CliFeatureRequirements = DockerCacheAdministration | CliArguments | CliInterruption | CliInvocationFacts | CliOutput | CliPath | ExperimentCliTerminal | ProjectConfiguration | RecordCoordination | RecordEntropy | RecordFileSystem | ProjectStateDatabase | ProjectFileSystem | ProjectManifestFacts | ProjectProcessFacts | ViewBrowser | ViewApplicationRuntime | Scope.Scope;\nconst featureCommands = composeCliCommands<CliFeatureRequirements, CliFeatureError>([\n ...experimentCliContributions,\n evalCatalogCliCommand,\n inspectionQueryCliCommand,\n showCliCommand,\n runCliCommand,\n viewCliCommand,\n sandboxCliCommand,\n dockerCliCommand,\n stateCliCommand,\n projectInitCliCommand,\n]);\nconst application = Effect.scoped(Effect.gen(function* () {\n // Capture this application's services once. HTTP callbacks share its runtime;\n // the root Scope interrupts and drains every remaining callback fiber.\n const run = yield* FiberSet.makeRuntimePromise();\n return yield* cliProgram(featureCommands).pipe(Effect.provideService(ViewApplicationRuntime, { run }));\n})).pipe(\n// Application bootstrap is the sole provider of concrete Node services.\n// Command and library modules retain their real requirements for callers.\nEffect.provide(NodeRecordLive), \n// This is a lazy service value: ordinary commands and help do not probe Docker.\nEffect.provide(DockerCacheAdministrationLive), Effect.provide(NodeProjectLive), Effect.provide(NodeViewBrowserLive), Effect.provide(NodeExperimentCliTerminalLive), Effect.provide(NodeCliInterruptionLive), Effect.provide(NodeCliApplicationLive), Effect.provide(NodeCliPlatformLive), \n// Typed CLI failures are expected, user-actionable outcomes. They become an\n// ordinary process status after their message has been written once.\nEffect.catch((failure) => Effect.sync(() => {\n process.stderr.write(renderCliFailure(failure));\n return failure.exitCode;\n})), \n// A normal nonzero command result must flush through Node naturally; do not\n// use process.exit and skip Scope finalizers or piped stdout.\nEffect.tap((exitCode) => Effect.sync(() => {\n process.exitCode = exitCode;\n})), Effect.asVoid, \n// Defects remain defects and interruption remains interruption. Suppress\n// platform's generic logger so the CLI keeps its existing user-facing form.\nEffect.tapCause((cause) => Cause.hasInterruptsOnly(cause)\n ? Effect.void\n : Effect.sync(() => process.stderr.write(`niceeval error:\\n${summarizeUnknownError(Cause.squash(cause))}\\n`))));\n// Effect v4 keeps Node alive while live fibers await callbacks, so this\n// boundary does not install a second process-liveness timer.\nfiber = Effect.runFork(application);\n// A signal cannot normally interleave with this synchronous bootstrap, but\n// retaining the state makes that startup edge explicit and lossless as well.\nconst interruptRootIfPending = (): void => {\n if (signalOwnership !== \"root-interrupted\" || fiber === undefined)\n return;\n fiber.interruptUnsafe();\n};\ninterruptRootIfPending();\nfiber.addObserver((exit) => {\n process.removeListener(\"SIGINT\", onInterrupt);\n process.removeListener(\"SIGTERM\", onInterrupt);\n if (Exit.isFailure(exit)) {\n // Scope finalizers have settled before an observer sees the Exit. Typed\n // CLI failures already became a successful numeric result above; only a\n // real unhandled interruption receives 130, and defects remain exit 2.\n process.exitCode = Cause.hasInterruptsOnly(exit.cause) ? 130 : 2;\n }\n});\n"]}
|
|
@@ -105,17 +105,14 @@ exports.ConfigModuleLoader = ConfigModuleLoader;
|
|
|
105
105
|
exports.ConfigModuleLoaderLive = effect_1.Layer.effect(ConfigModuleLoader, effect_1.Effect.gen(function* () {
|
|
106
106
|
let canonical;
|
|
107
107
|
const mutex = yield* effect_1.Semaphore.make(1);
|
|
108
|
-
const load = (operation, inputCwd) => mutex.withPermits(1)(effect_1.Effect.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
},
|
|
117
|
-
catch: (cause) => new ConfigModuleLoadError({ cwd: normalizedCwd(inputCwd), operation, cause }),
|
|
118
|
-
}));
|
|
108
|
+
const load = (operation, inputCwd) => mutex.withPermits(1)(effect_1.Effect.gen(function* () {
|
|
109
|
+
const cwd = normalizedCwd(inputCwd);
|
|
110
|
+
if (operation === "loadOnce" && canonical?.cwd === cwd)
|
|
111
|
+
return canonical.config;
|
|
112
|
+
const config = yield* (operation === "rebuild" ? (0, load_config_ts_1.rebuildConfigModule)(cwd) : (0, load_config_ts_1.loadConfigModuleOnce)(cwd));
|
|
113
|
+
canonical = { cwd, config };
|
|
114
|
+
return config;
|
|
115
|
+
}).pipe(effect_1.Effect.mapError((cause) => new ConfigModuleLoadError({ cwd: normalizedCwd(inputCwd), operation, cause }))));
|
|
119
116
|
return { loadOnce: (cwd) => load("loadOnce", cwd), rebuild: (cwd) => load("rebuild", cwd) };
|
|
120
117
|
}));
|
|
121
118
|
class ProjectConfiguration extends effect_1.Context.Service()("niceeval/cli/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AmC,CAAC;CAClJ;AADD,oDACC;AACD,gFAAgF;AACnE,QAAA,yBAAyB,GAAG,cAAK,CAAC,MAAM,CAAC,oBAAoB,EAAE,eAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC5F,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,kBAAkB,CAAC;IAC9C,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,kBAAkB,CAAC;IACzC,OAAO;QACH,OAAO,EAAE,WAAW,CAAC,OAAO;QAC5B,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,eAAM,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;QAClF,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,eAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;KACjD,CAAC;AAC5C,CAAC,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Node capabilities used by an application host while observing a project.\n * They intentionally do not model a general filesystem: credentials delivery\n * and trusted config-module loading are the two distinct capabilities here.\n */\nimport { Context, Data, Deferred, Effect, Layer, Semaphore } from \"effect\";\nimport { existsSync } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport { join, resolve } from \"node:path\";\nimport { loadConfigModuleOnce, rebuildConfigModule } from \"../load-config.ts\";\nimport type { Config } from \"../runner/types.ts\";\nexport class ProjectCredentialsError extends Data.TaggedError(\"ProjectCredentialsError\")<{\n readonly cwd: string;\n readonly operation: \"read-dotenv\";\n readonly cause: unknown;\n}> {\n}\nexport class ProjectCredentialsConflict extends Data.TaggedError(\"ProjectCredentialsConflict\")<{\n readonly preparedCwd: string;\n readonly requestedCwd: string;\n}> {\n}\nexport type ProjectCredentialsFailure = ProjectCredentialsError | ProjectCredentialsConflict;\nexport interface ProjectCredentialsService {\n /** Deliver missing credential variables from this project's .env exactly once. */\n readonly prepare: (cwd: string) => Effect.Effect<void, ProjectCredentialsFailure>;\n}\nexport class ProjectCredentials extends Context.Service<ProjectCredentials, ProjectCredentialsService>()(\"niceeval/cli/ProjectCredentials\") {\n}\ntype CredentialState = {\n readonly _tag: \"idle\";\n} | {\n readonly _tag: \"preparing\";\n readonly cwd: string;\n readonly done: Deferred.Deferred<void, ProjectCredentialsError>;\n} | {\n readonly _tag: \"prepared\";\n readonly cwd: string;\n};\nfunction normalizedCwd(cwd: string): string {\n return resolve(cwd);\n}\nfunction applyMissingEnvironment(raw: string): void {\n for (const line of raw.split(\"\\n\")) {\n const entry = line.trim();\n if (entry.length === 0 || entry.startsWith(\"#\"))\n continue;\n const equals = entry.indexOf(\"=\");\n if (equals < 0)\n continue;\n const key = entry.slice(0, equals).trim();\n if (key.length === 0 || process.env[key] !== undefined)\n continue;\n let value = entry.slice(equals + 1).trim();\n if ((value.startsWith('\"') && value.endsWith('\"')) || (value.startsWith(\"'\") && value.endsWith(\"'\"))) {\n value = value.slice(1, -1);\n }\n process.env[key] = value;\n }\n}\n/** One Layer-owned state machine; failed preparation deliberately returns to idle. */\nexport const ProjectCredentialsLive = Layer.effect(ProjectCredentials, Effect.gen(function* () {\n let state: CredentialState = { _tag: \"idle\" };\n const mutex = yield* Semaphore.make(1);\n const prepare = (inputCwd: string): Effect.Effect<void, ProjectCredentialsFailure> => Effect.suspend(() => {\n const cwd = normalizedCwd(inputCwd);\n return Effect.gen(function* () {\n const fresh = yield* Deferred.make<void, ProjectCredentialsError>();\n // This is the complete atomic decision. No waiting or Node I/O occurs\n // while the semaphore is held, so completion can always re-enter it.\n const decision = yield* mutex.withPermits(1)(Effect.sync(() => {\n if (state._tag === \"prepared\") {\n return state.cwd === cwd\n ? { _tag: \"ready\" as const }\n : { _tag: \"conflict\" as const, preparedCwd: state.cwd };\n }\n if (state._tag === \"preparing\") {\n return state.cwd === cwd\n ? { _tag: \"await\" as const, done: state.done }\n : { _tag: \"conflict\" as const, preparedCwd: state.cwd };\n }\n state = { _tag: \"preparing\", cwd, done: fresh };\n return { _tag: \"start\" as const, done: fresh };\n }));\n if (decision._tag === \"ready\")\n return;\n if (decision._tag === \"conflict\") {\n return yield* Effect.fail(new ProjectCredentialsConflict({\n preparedCwd: decision.preparedCwd,\n requestedCwd: cwd,\n }));\n }\n if (decision._tag === \"start\") {\n // Daemon ownership makes an interrupted initiating caller harmless:\n // it still settles the shared Deferred and restores idle on failure.\n yield* Effect.forkDetach(Effect.tryPromise({\n try: async () => {\n const path = join(cwd, \".env\");\n if (existsSync(path))\n applyMissingEnvironment(await readFile(path, \"utf8\"));\n },\n catch: (cause) => new ProjectCredentialsError({ cwd, operation: \"read-dotenv\", cause }),\n }).pipe(Effect.exit, Effect.flatMap((exit) => mutex.withPermits(1)(Effect.gen(function* () {\n if (state._tag === \"preparing\" && state.done === decision.done) {\n state = exit._tag === \"Success\" ? { _tag: \"prepared\", cwd } : { _tag: \"idle\" };\n }\n yield* Deferred.done(decision.done, exit);\n })))));\n }\n return yield* Deferred.await(decision.done);\n });\n });\n return { prepare } satisfies ProjectCredentialsService;\n}));\nexport class ConfigModuleLoadError extends Data.TaggedError(\"ConfigModuleLoadError\")<{\n readonly cwd: string;\n readonly operation: \"loadOnce\" | \"rebuild\";\n readonly cause: unknown;\n}> {\n}\nexport interface ConfigModuleLoaderService {\n readonly loadOnce: (cwd: string) => Effect.Effect<Config, ConfigModuleLoadError>;\n readonly rebuild: (cwd: string) => Effect.Effect<Config, ConfigModuleLoadError>;\n}\nexport class ConfigModuleLoader extends Context.Service<ConfigModuleLoader, ConfigModuleLoaderService>()(\"niceeval/cli/ConfigModuleLoader\") {\n}\n/** Serial module loader. A failed rebuild never hands out a previous Config. */\nexport const ConfigModuleLoaderLive = Layer.effect(ConfigModuleLoader, Effect.gen(function* () {\n let canonical: {\n cwd: string;\n config: Config;\n } | undefined;\n const mutex = yield* Semaphore.make(1);\n const load = (operation: \"loadOnce\" | \"rebuild\", inputCwd: string) => mutex.withPermits(1)(Effect.tryPromise({\n try: async () => {\n const cwd = normalizedCwd(inputCwd);\n if (operation === \"loadOnce\" && canonical?.cwd === cwd)\n return canonical.config;\n const config = await (operation === \"rebuild\" ? rebuildConfigModule(cwd) : loadConfigModuleOnce(cwd));\n canonical = { cwd, config };\n return config;\n },\n catch: (cause) => new ConfigModuleLoadError({ cwd: normalizedCwd(inputCwd), operation, cause }),\n }));\n return { loadOnce: (cwd) => load(\"loadOnce\", cwd), rebuild: (cwd) => load(\"rebuild\", cwd) } satisfies ConfigModuleLoaderService;\n}));\n/** The sole CLI application facade fixes the required credentials → config order. */\nexport interface ProjectConfigurationService {\n readonly prepare: (cwd: string) => Effect.Effect<void, ProjectCredentialsFailure>;\n readonly load: (cwd: string) => Effect.Effect<Config, ProjectCredentialsFailure | ConfigModuleLoadError>;\n readonly rebuild: (cwd: string) => Effect.Effect<Config, ProjectCredentialsFailure | ConfigModuleLoadError>;\n}\nexport class ProjectConfiguration extends Context.Service<ProjectConfiguration, ProjectConfigurationService>()(\"niceeval/cli/ProjectConfiguration\") {\n}\n/** Application composition only: callers must provide concrete capabilities. */\nexport const ProjectConfigurationLayer = Layer.effect(ProjectConfiguration, Effect.gen(function* () {\n const credentials = yield* ProjectCredentials;\n const loader = yield* ConfigModuleLoader;\n return {\n prepare: credentials.prepare,\n load: (cwd) => credentials.prepare(cwd).pipe(Effect.andThen(loader.loadOnce(cwd))),\n rebuild: (cwd) => credentials.prepare(cwd).pipe(Effect.andThen(loader.rebuild(cwd))),\n } satisfies ProjectConfigurationService;\n}));\n"]}
|
|
1
|
+
{"version":3,"file":"project-configuration.js","sourceRoot":"","sources":["project-configuration.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,mCAA2E;AAC3E,qCAAqC;AACrC,+CAA4C;AAC5C,yCAA0C;AAC1C,sDAA8E;AAE9E,MAAa,uBAAwB,SAAQ,a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AM,MAAM,GAAG,KAAK,CAAC,CAAC,kBAAkB,CAAC;IACzC,OAAO;QACH,OAAO,EAAE,WAAW,CAAC,OAAO;QAC5B,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,eAAM,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;QAClF,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,eAAM,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;KACjD,CAAC;AAC5C,CAAC,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Node capabilities used by an application host while observing a project.\n * They intentionally do not model a general filesystem: credentials delivery\n * and trusted config-module loading are the two distinct capabilities here.\n */\nimport { Context, Data, Deferred, Effect, Layer, Semaphore } from \"effect\";\nimport { existsSync } from \"node:fs\";\nimport { readFile } from \"node:fs/promises\";\nimport { join, resolve } from \"node:path\";\nimport { loadConfigModuleOnce, rebuildConfigModule } from \"../load-config.ts\";\nimport type { Config } from \"../runner/types.ts\";\nexport class ProjectCredentialsError extends Data.TaggedError(\"ProjectCredentialsError\")<{\n readonly cwd: string;\n readonly operation: \"read-dotenv\";\n readonly cause: unknown;\n}> {\n}\nexport class ProjectCredentialsConflict extends Data.TaggedError(\"ProjectCredentialsConflict\")<{\n readonly preparedCwd: string;\n readonly requestedCwd: string;\n}> {\n}\nexport type ProjectCredentialsFailure = ProjectCredentialsError | ProjectCredentialsConflict;\nexport interface ProjectCredentialsService {\n /** Deliver missing credential variables from this project's .env exactly once. */\n readonly prepare: (cwd: string) => Effect.Effect<void, ProjectCredentialsFailure>;\n}\nexport class ProjectCredentials extends Context.Service<ProjectCredentials, ProjectCredentialsService>()(\"niceeval/cli/ProjectCredentials\") {\n}\ntype CredentialState = {\n readonly _tag: \"idle\";\n} | {\n readonly _tag: \"preparing\";\n readonly cwd: string;\n readonly done: Deferred.Deferred<void, ProjectCredentialsError>;\n} | {\n readonly _tag: \"prepared\";\n readonly cwd: string;\n};\nfunction normalizedCwd(cwd: string): string {\n return resolve(cwd);\n}\nfunction applyMissingEnvironment(raw: string): void {\n for (const line of raw.split(\"\\n\")) {\n const entry = line.trim();\n if (entry.length === 0 || entry.startsWith(\"#\"))\n continue;\n const equals = entry.indexOf(\"=\");\n if (equals < 0)\n continue;\n const key = entry.slice(0, equals).trim();\n if (key.length === 0 || process.env[key] !== undefined)\n continue;\n let value = entry.slice(equals + 1).trim();\n if ((value.startsWith('\"') && value.endsWith('\"')) || (value.startsWith(\"'\") && value.endsWith(\"'\"))) {\n value = value.slice(1, -1);\n }\n process.env[key] = value;\n }\n}\n/** One Layer-owned state machine; failed preparation deliberately returns to idle. */\nexport const ProjectCredentialsLive = Layer.effect(ProjectCredentials, Effect.gen(function* () {\n let state: CredentialState = { _tag: \"idle\" };\n const mutex = yield* Semaphore.make(1);\n const prepare = (inputCwd: string): Effect.Effect<void, ProjectCredentialsFailure> => Effect.suspend(() => {\n const cwd = normalizedCwd(inputCwd);\n return Effect.gen(function* () {\n const fresh = yield* Deferred.make<void, ProjectCredentialsError>();\n // This is the complete atomic decision. No waiting or Node I/O occurs\n // while the semaphore is held, so completion can always re-enter it.\n const decision = yield* mutex.withPermits(1)(Effect.sync(() => {\n if (state._tag === \"prepared\") {\n return state.cwd === cwd\n ? { _tag: \"ready\" as const }\n : { _tag: \"conflict\" as const, preparedCwd: state.cwd };\n }\n if (state._tag === \"preparing\") {\n return state.cwd === cwd\n ? { _tag: \"await\" as const, done: state.done }\n : { _tag: \"conflict\" as const, preparedCwd: state.cwd };\n }\n state = { _tag: \"preparing\", cwd, done: fresh };\n return { _tag: \"start\" as const, done: fresh };\n }));\n if (decision._tag === \"ready\")\n return;\n if (decision._tag === \"conflict\") {\n return yield* Effect.fail(new ProjectCredentialsConflict({\n preparedCwd: decision.preparedCwd,\n requestedCwd: cwd,\n }));\n }\n if (decision._tag === \"start\") {\n // Daemon ownership makes an interrupted initiating caller harmless:\n // it still settles the shared Deferred and restores idle on failure.\n yield* Effect.forkDetach(Effect.tryPromise({\n try: async () => {\n const path = join(cwd, \".env\");\n if (existsSync(path))\n applyMissingEnvironment(await readFile(path, \"utf8\"));\n },\n catch: (cause) => new ProjectCredentialsError({ cwd, operation: \"read-dotenv\", cause }),\n }).pipe(Effect.exit, Effect.flatMap((exit) => mutex.withPermits(1)(Effect.gen(function* () {\n if (state._tag === \"preparing\" && state.done === decision.done) {\n state = exit._tag === \"Success\" ? { _tag: \"prepared\", cwd } : { _tag: \"idle\" };\n }\n yield* Deferred.done(decision.done, exit);\n })))));\n }\n return yield* Deferred.await(decision.done);\n });\n });\n return { prepare } satisfies ProjectCredentialsService;\n}));\nexport class ConfigModuleLoadError extends Data.TaggedError(\"ConfigModuleLoadError\")<{\n readonly cwd: string;\n readonly operation: \"loadOnce\" | \"rebuild\";\n readonly cause: unknown;\n}> {\n}\nexport interface ConfigModuleLoaderService {\n readonly loadOnce: (cwd: string) => Effect.Effect<Config, ConfigModuleLoadError>;\n readonly rebuild: (cwd: string) => Effect.Effect<Config, ConfigModuleLoadError>;\n}\nexport class ConfigModuleLoader extends Context.Service<ConfigModuleLoader, ConfigModuleLoaderService>()(\"niceeval/cli/ConfigModuleLoader\") {\n}\n/** Serial module loader. A failed rebuild never hands out a previous Config. */\nexport const ConfigModuleLoaderLive = Layer.effect(ConfigModuleLoader, Effect.gen(function* () {\n let canonical: {\n cwd: string;\n config: Config;\n } | undefined;\n const mutex = yield* Semaphore.make(1);\n const load = (operation: \"loadOnce\" | \"rebuild\", inputCwd: string) => mutex.withPermits(1)(Effect.gen(function* () {\n const cwd = normalizedCwd(inputCwd);\n if (operation === \"loadOnce\" && canonical?.cwd === cwd)\n return canonical.config;\n const config = yield* (operation === \"rebuild\" ? rebuildConfigModule(cwd) : loadConfigModuleOnce(cwd));\n canonical = { cwd, config };\n return config;\n }).pipe(Effect.mapError((cause) => new ConfigModuleLoadError({ cwd: normalizedCwd(inputCwd), operation, cause }))));\n return { loadOnce: (cwd) => load(\"loadOnce\", cwd), rebuild: (cwd) => load(\"rebuild\", cwd) } satisfies ConfigModuleLoaderService;\n}));\n/** The sole CLI application facade fixes the required credentials → config order. */\nexport interface ProjectConfigurationService {\n readonly prepare: (cwd: string) => Effect.Effect<void, ProjectCredentialsFailure>;\n readonly load: (cwd: string) => Effect.Effect<Config, ProjectCredentialsFailure | ConfigModuleLoadError>;\n readonly rebuild: (cwd: string) => Effect.Effect<Config, ProjectCredentialsFailure | ConfigModuleLoadError>;\n}\nexport class ProjectConfiguration extends Context.Service<ProjectConfiguration, ProjectConfigurationService>()(\"niceeval/cli/ProjectConfiguration\") {\n}\n/** Application composition only: callers must provide concrete capabilities. */\nexport const ProjectConfigurationLayer = Layer.effect(ProjectConfiguration, Effect.gen(function* () {\n const credentials = yield* ProjectCredentials;\n const loader = yield* ConfigModuleLoader;\n return {\n prepare: credentials.prepare,\n load: (cwd) => credentials.prepare(cwd).pipe(Effect.andThen(loader.loadOnce(cwd))),\n rebuild: (cwd) => credentials.prepare(cwd).pipe(Effect.andThen(loader.rebuild(cwd))),\n } satisfies ProjectConfigurationService;\n}));\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,8EAA8E;AAC9E,mDAAqD;AAA5C,uGAAA,WAAW,OAAA;AAEpB,mDAAwY;AAA/X,+FAAA,GAAG,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,kGAAA,MAAM,OAAA;AAAE,wGAAA,YAAY,OAAA;AAAE,4GAAA,gBAAgB,OAAA;AAAE,sGAAA,UAAU,OAAA;AAAE,4GAAA,gBAAgB,OAAA;AAAE,4GAAA,gBAAgB,OAAA;AAAE,kGAAA,MAAM,OAAA;AAAE,sGAAA,UAAU,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAAE,uGAAA,WAAW,OAAA;AAAE,uGAAA,WAAW,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAAE,uGAAA,WAAW,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,kGAAA,MAAM,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,uGAAA,WAAW,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAAE,+FAAA,GAAG,OAAA;AAAE,8FAAA,EAAE,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,6GAAA,iBAAiB,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,sGAAA,UAAU,OAAA;AAAE,qGAAA,SAAS,OAAA;AAEtW,mEAAoH;AAA3G,8GAAA,UAAU,OAAA;AAAE,gHAAA,YAAY,OAAA;AAAE,wHAAA,oBAAoB,OAAA;AAAE,sHAAA,kBAAkB,OAAA;AAE3E,mEAAyF;AAAhF,uHAAA,mBAAmB,OAAA;AAAE,sHAAA,kBAAkB,OAAA","sourcesContent":["// niceeval/expect:只导出纯 Match factories。Fact、verdict 与 score use 由 context 负责。\nexport { defineJudge } from \"../assertions/judge.ts\";\nexport type { JudgeAnchor, JudgeDefinition, JudgeOptions } from \"../assertions/judge.ts\";\nexport { and, atLeast, atMost, commandMatch, commandSucceeded, countWhere, defineScoreMatch, defineValueMatch, equals, eventMatch, excludes, filterWhere, greaterThan, includes, includesUrl, inOrder, isDefined, isFalse, isTrue, jsonMatch, hasSections, lessThan, matches, mapEach, mapValue, not, or, pattern, referencesAnyPath, satisfies, similarity, toolMatch, } from \"../assertions/match.ts\";\nexport type { BooleanMatch, CollectionMatch, CollectionValue, CommandMatchOptions, EventMatch, EventOccurrenceMatch, EventOccurrenceQuantifiers, EventOccurrenceView, EventSequenceMatch, EventUpperBoundOccurrenceMatch, EventOptionsByType, LogicalCommandOccurrence, ManagedToolCalls, ManagedEventOccurrences, Match, MatchDomain, NumericComparisonMatch, TextMatchOptions, ToolMatch, ToolOccurrenceMatch, ToolSequenceMatch, ToolUpperBoundOccurrenceMatch, ToolMatchOptions, ToolOccurrenceQuantifiers, ToolOccurrenceView, ToolStatus, ValueMatch, ManagedScoreMatchOptions, ScoreMatch, ScoreMatchContext, ScoreMatchLlmFailure, ScoreMatchResult, ScoreMatchAnchor, } from \"../assertions/match.ts\";\nexport { factuality, faithfulness, instructionFollowing, pairwisePreference } from \"../assertions/judge-presets.ts\";\nexport type { JudgePresetOptions, FactualityMaterial, FaithfulnessMaterial, InstructionFollowingMaterial, PairwisePreferenceMaterial } from \"../assertions/judge-presets.ts\";\nexport { defineMaterialMatch, defineContextMatch } from \"../assertions/context-match.ts\";\nexport type { MaterialMatch, ContextBooleanMatch, ContextScoreMatch, MatchContext, ReadonlyMaterial, MatchFact, MaterialCollection, MaterialItem, MaterialCaptureBudget, FactCaptureBudget } from \"../assertions/context-match.ts\";\nexport type { NumericMaterial } from \"../assertions/match.ts\";\nexport type { EvalUsage } from \"../o11y/eval-usage.ts\";\nexport type { AgentMatchContext } from \"../context/assert-first.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,8EAA8E;AAC9E,mDAAqD;AAA5C,uGAAA,WAAW,OAAA;AAEpB,mDAAwY;AAA/X,+FAAA,GAAG,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,kGAAA,MAAM,OAAA;AAAE,wGAAA,YAAY,OAAA;AAAE,4GAAA,gBAAgB,OAAA;AAAE,sGAAA,UAAU,OAAA;AAAE,4GAAA,gBAAgB,OAAA;AAAE,4GAAA,gBAAgB,OAAA;AAAE,kGAAA,MAAM,OAAA;AAAE,sGAAA,UAAU,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAAE,uGAAA,WAAW,OAAA;AAAE,uGAAA,WAAW,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAAE,uGAAA,WAAW,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,kGAAA,MAAM,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,uGAAA,WAAW,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAAE,+FAAA,GAAG,OAAA;AAAE,8FAAA,EAAE,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,6GAAA,iBAAiB,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,sGAAA,UAAU,OAAA;AAAE,qGAAA,SAAS,OAAA;AAEtW,mEAAoH;AAA3G,8GAAA,UAAU,OAAA;AAAE,gHAAA,YAAY,OAAA;AAAE,wHAAA,oBAAoB,OAAA;AAAE,sHAAA,kBAAkB,OAAA;AAE3E,mEAAyF;AAAhF,uHAAA,mBAAmB,OAAA;AAAE,sHAAA,kBAAkB,OAAA","sourcesContent":["// niceeval/expect:只导出纯 Match factories。Fact、verdict 与 score use 由 context 负责。\nexport { defineJudge } from \"../assertions/judge.ts\";\nexport type { JudgeAnchor, JudgeDefinition, JudgeOptions } from \"../assertions/judge.ts\";\nexport { and, atLeast, atMost, commandMatch, commandSucceeded, countWhere, defineScoreMatch, defineValueMatch, equals, eventMatch, excludes, filterWhere, greaterThan, includes, includesUrl, inOrder, isDefined, isFalse, isTrue, jsonMatch, hasSections, lessThan, matches, mapEach, mapValue, not, or, pattern, referencesAnyPath, satisfies, similarity, toolMatch, } from \"../assertions/match.ts\";\nexport type { BooleanMatch, CollectionMatch, CollectionValue, CommandMatchOptions, EventMatch, EventOccurrenceMatch, EventOccurrenceQuantifiers, EventOccurrenceView, EventSequenceMatch, EventUpperBoundOccurrenceMatch, EventOptionsByType, LogicalCommandOccurrence, ManagedToolCalls, ManagedEventOccurrences, Match, MatchDomain, NumericComparisonMatch, TextMatchOptions, ToolMatch, ToolOccurrenceMatch, ToolSequenceMatch, ToolUpperBoundOccurrenceMatch, ToolMatchOptions, ToolOccurrenceQuantifiers, ToolOccurrenceView, ToolStatus, ValueMatch, ManagedScoreMatchOptions, ScoreMatch, ScoreMatchContext, ScoreMatchLlmFailure, ScoreMatchResult, ScoreMatchAnchor, } from \"../assertions/match.ts\";\nexport { factuality, faithfulness, instructionFollowing, pairwisePreference } from \"../assertions/judge-presets.ts\";\nexport type { JudgePresetOptions, FactualityMaterial, FaithfulnessMaterial, InstructionFollowingMaterial, PairwisePreferenceMaterial } from \"../assertions/judge-presets.ts\";\nexport { defineMaterialMatch, defineContextMatch } from \"../assertions/context-match.ts\";\nexport type { MaterialMatch, ContextBooleanMatch, ContextScoreMatch, MatchContext, ReadonlyMaterial, MatchFact, MaterialCollection, MaterialItem, MaterialCaptureBudget, FactCaptureBudget } from \"../assertions/context-match.ts\";\nexport type { NumericMaterial } from \"../assertions/match.ts\";\nexport type { EvalUsage } from \"../o11y/eval-usage.ts\";\nexport type { CacheReadReport, CacheReadSummary } from \"../o11y/cache-read.ts\";\nexport type { AgentMatchContext } from \"../context/assert-first.ts\";\n"]}
|
package/dist/expect/index.d.cts
CHANGED
|
@@ -8,4 +8,5 @@ export { defineMaterialMatch, defineContextMatch } from "../assertions/context-m
|
|
|
8
8
|
export type { MaterialMatch, ContextBooleanMatch, ContextScoreMatch, MatchContext, ReadonlyMaterial, MatchFact, MaterialCollection, MaterialItem, MaterialCaptureBudget, FactCaptureBudget } from "../assertions/context-match.cjs";
|
|
9
9
|
export type { NumericMaterial } from "../assertions/match.cjs";
|
|
10
10
|
export type { EvalUsage } from "../o11y/eval-usage.cjs";
|
|
11
|
+
export type { CacheReadReport, CacheReadSummary } from "../o11y/cache-read.cjs";
|
|
11
12
|
export type { AgentMatchContext } from "../context/assert-first.cjs";
|
package/dist/expect/index.d.mts
CHANGED
|
@@ -8,4 +8,5 @@ export { defineMaterialMatch, defineContextMatch } from "../assertions/context-m
|
|
|
8
8
|
export type { MaterialMatch, ContextBooleanMatch, ContextScoreMatch, MatchContext, ReadonlyMaterial, MatchFact, MaterialCollection, MaterialItem, MaterialCaptureBudget, FactCaptureBudget } from "../assertions/context-match.mjs";
|
|
9
9
|
export type { NumericMaterial } from "../assertions/match.mjs";
|
|
10
10
|
export type { EvalUsage } from "../o11y/eval-usage.mjs";
|
|
11
|
+
export type { CacheReadReport, CacheReadSummary } from "../o11y/cache-read.mjs";
|
|
11
12
|
export type { AgentMatchContext } from "../context/assert-first.mjs";
|
package/dist/expect/index.d.ts
CHANGED
|
@@ -8,4 +8,5 @@ export { defineMaterialMatch, defineContextMatch } from "../assertions/context-m
|
|
|
8
8
|
export type { MaterialMatch, ContextBooleanMatch, ContextScoreMatch, MatchContext, ReadonlyMaterial, MatchFact, MaterialCollection, MaterialItem, MaterialCaptureBudget, FactCaptureBudget } from "../assertions/context-match.js";
|
|
9
9
|
export type { NumericMaterial } from "../assertions/match.js";
|
|
10
10
|
export type { EvalUsage } from "../o11y/eval-usage.js";
|
|
11
|
+
export type { CacheReadReport, CacheReadSummary } from "../o11y/cache-read.js";
|
|
11
12
|
export type { AgentMatchContext } from "../context/assert-first.js";
|
|
@@ -42,7 +42,7 @@ exports.EXP_NORMAL_CLI_OPTIONS = Object.freeze({
|
|
|
42
42
|
"max-concurrency": option("string", "Limit concurrent Attempt execution."),
|
|
43
43
|
"max-build-concurrency": option("string", "Limit concurrent Sandbox build preparation."),
|
|
44
44
|
"max-setup-prefix-concurrency": option("string", "Limit concurrent Sandbox setup-prefix preparation."),
|
|
45
|
-
"sandbox-setup-cache": option("string", "
|
|
45
|
+
"sandbox-setup-cache": option("string", "Use or bypass the Sandbox setup cache."),
|
|
46
46
|
timeout: option("string", "Set the per-Attempt timeout in milliseconds."),
|
|
47
47
|
budget: option("string", "Set the Invocation budget in USD."),
|
|
48
48
|
tag: option("string", "Select only Evals with this tag."),
|
|
@@ -53,7 +53,6 @@ exports.EXP_NORMAL_CLI_OPTIONS = Object.freeze({
|
|
|
53
53
|
"keep-sandbox": optionalTier("Keep failed or all finished Sandboxes.", "failed", ["failed", "all"]),
|
|
54
54
|
"early-exit": option("boolean", "Stop remaining attempts after a passing result."),
|
|
55
55
|
"no-early-exit": option("boolean", "Force all configured attempts to run."),
|
|
56
|
-
record: option("string", "Use this Record root."),
|
|
57
56
|
help: HELP_OPTION,
|
|
58
57
|
});
|
|
59
58
|
exports.EXP_LIST_CLI_OPTIONS = Object.freeze({
|
|
@@ -83,7 +82,6 @@ exports.DEBUG_CLI_OPTIONS = Object.freeze({
|
|
|
83
82
|
exports.ACCEPT_CLI_OPTIONS = Object.freeze({
|
|
84
83
|
run: option("string", "Accept every member of one exact source Run.", true),
|
|
85
84
|
dry: option("boolean", "Preview acceptance without publishing a Run."),
|
|
86
|
-
record: option("string", "Use this Record root."),
|
|
87
85
|
help: HELP_OPTION,
|
|
88
86
|
});
|
|
89
87
|
exports.SESSION_CLI_OPTIONS = Object.freeze({
|
|
@@ -132,7 +130,6 @@ Run options:
|
|
|
132
130
|
--dry plan without creating an Invocation
|
|
133
131
|
--json write machine output or the Invocation event stream
|
|
134
132
|
--junit <path> write a required JUnit report
|
|
135
|
-
--record <root> use this Record root
|
|
136
133
|
|
|
137
134
|
Recovery options:
|
|
138
135
|
--teardown run only explicit Experiment teardown recovery
|
|
@@ -150,13 +147,12 @@ Options:
|
|
|
150
147
|
-h, --help show this help
|
|
151
148
|
`;
|
|
152
149
|
const ACCEPT_HELP = `Accept exact historical Attempt locators:
|
|
153
|
-
niceeval accept @<locator>...
|
|
154
|
-
niceeval accept --run <exact-run-id> [--dry]
|
|
150
|
+
niceeval accept @<locator>...
|
|
151
|
+
niceeval accept --run <exact-run-id> [--dry]
|
|
155
152
|
|
|
156
153
|
Options:
|
|
157
154
|
--run <run-id> accept one exact source Run
|
|
158
155
|
--dry preview a whole-Run acceptance without writing
|
|
159
|
-
--record <root> use this Record root
|
|
160
156
|
-h, --help show this help
|
|
161
157
|
`;
|
|
162
158
|
const SESSION_HELP = `Inspect project-local ephemeral Invocation status:
|
|
@@ -651,7 +647,6 @@ Run \`niceeval exp <path> --dry\` to preview a plan.
|
|
|
651
647
|
config,
|
|
652
648
|
...selection(input.positionals, Array.isArray(input.values.experiment) ? input.values.experiment : undefined),
|
|
653
649
|
...(typeof input.values.tag === "string" ? { tag: input.values.tag } : {}),
|
|
654
|
-
...(typeof input.values.record === "string" ? { recordRoot: input.values.record } : {}),
|
|
655
650
|
overrides: overrides(input.values),
|
|
656
651
|
preview: input.values.dry === true,
|
|
657
652
|
}).pipe(effect_1.Effect.mapError((cause) => failure("plan invocation", cause)));
|
|
@@ -796,17 +791,17 @@ const acceptCommand = Object.freeze({
|
|
|
796
791
|
const { invocation, config } = yield* factsAndConfig();
|
|
797
792
|
if (sourceRunId !== undefined) {
|
|
798
793
|
if (input.values.dry === true) {
|
|
799
|
-
const plan = yield* runtime_ts_1.rawExperimentHost.acceptRun.plan({ cwd: invocation.cwd, config, runId: sourceRunId
|
|
794
|
+
const plan = yield* runtime_ts_1.rawExperimentHost.acceptRun.plan({ cwd: invocation.cwd, config, runId: sourceRunId }).pipe(effect_1.Effect.mapError((cause) => failure("accept", cause, 1, `error: could not accept result: ${cause.message}
|
|
800
795
|
`)));
|
|
801
796
|
yield* write("stdout", acceptRunPlanText(plan));
|
|
802
797
|
return 0;
|
|
803
798
|
}
|
|
804
|
-
const accepted = yield* runtime_ts_1.rawExperimentHost.acceptRun.apply({ cwd: invocation.cwd, config, runId: sourceRunId
|
|
799
|
+
const accepted = yield* runtime_ts_1.rawExperimentHost.acceptRun.apply({ cwd: invocation.cwd, config, runId: sourceRunId }).pipe(effect_1.Effect.mapError((cause) => failure("accept", cause, 1, `error: could not accept result: ${cause.message}
|
|
805
800
|
`)));
|
|
806
801
|
yield* write("stdout", acceptedRunText(sourceRunId, accepted));
|
|
807
802
|
return 0;
|
|
808
803
|
}
|
|
809
|
-
const result = yield* runtime_ts_1.rawExperimentHost.accept({ cwd: invocation.cwd, config, locators: Object.freeze(input.positionals)
|
|
804
|
+
const result = yield* runtime_ts_1.rawExperimentHost.accept({ cwd: invocation.cwd, config, locators: Object.freeze(input.positionals) }).pipe(effect_1.Effect.mapError((cause) => failure("accept", cause, 1, `error: could not accept result: ${cause.message}
|
|
810
805
|
`)));
|
|
811
806
|
yield* write("stdout", acceptText(result));
|
|
812
807
|
return 0;
|