niceeval 0.16.3-canary.99 → 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
|
@@ -3,6 +3,7 @@ import { type AttemptLocator } from "../attempt-locator.js";
|
|
|
3
3
|
import { type DurationLimit, type EqualityToken } from "../eval/record/eligibility.js";
|
|
4
4
|
import { type ComparisonProvenance } from "../eval/record/membership-provenance.js";
|
|
5
5
|
import { type VerdictState } from "../eval/record/verdict.js";
|
|
6
|
+
import { type PlanningExactReference } from "../record/host/sqlite-host.js";
|
|
6
7
|
import type { RecordReadSession, SelectedAttemptRef } from "../record/host/types.js";
|
|
7
8
|
import type { AttemptOutcome, RecordSlotIdentity } from "../record/model/core.js";
|
|
8
9
|
import { type RunContext } from "../record/model/run-context.js";
|
|
@@ -50,6 +51,7 @@ interface ParsedExplicitAttemptLocator {
|
|
|
50
51
|
readonly locator: AttemptLocator;
|
|
51
52
|
}
|
|
52
53
|
export interface ResolvedAdoptionAttempt {
|
|
54
|
+
readonly reference: PlanningExactReference;
|
|
53
55
|
readonly originContext: RunContext;
|
|
54
56
|
readonly locator: ExplicitAttemptLocator;
|
|
55
57
|
readonly attempt: SelectedAttemptRef;
|
|
@@ -114,10 +116,9 @@ export interface ExplicitAdoptionRunReceipt {
|
|
|
114
116
|
export type ExplicitAdoptionCommitError = RecordWriteError | RecordReaderOpenError | RunStorageError;
|
|
115
117
|
/** Strict v1 parser accepts only the current canonical short locator. */
|
|
116
118
|
export declare function parseExplicitAttemptLocator(value: string): Effect.Effect<ParsedExplicitAttemptLocator, ExplicitAdoptionError>;
|
|
117
|
-
/**
|
|
119
|
+
/** Adoption writes only to the discovered project's canonical Record. */
|
|
118
120
|
export declare function adoptionRecordRoot(input: {
|
|
119
121
|
readonly cwd: string;
|
|
120
|
-
readonly recordRoot?: string;
|
|
121
122
|
}): Effect.Effect<RecordRoot, RecordRootConstructionError>;
|
|
122
123
|
/** Discovery is rerun for both read preflight and the write-session frozen view. */
|
|
123
124
|
export declare function loadAdoptionProject(input: AdoptionProjectInput): Effect.Effect<AdoptionProject, ExplicitAdoptionError>;
|
|
@@ -171,8 +172,8 @@ export declare function buildExplicitAdoptionRunPlan(input: {
|
|
|
171
172
|
readonly target: CurrentAdoptionTarget;
|
|
172
173
|
readonly members: readonly ExplicitAdoptionMember[];
|
|
173
174
|
}): Effect.Effect<ExplicitAdoptionRunPlan, ExplicitAdoptionError>;
|
|
174
|
-
/** Writes
|
|
175
|
-
export declare function commitExplicitAdoptionRunPlans(
|
|
175
|
+
/** Writes detached plans; publication identity is rechecked by the binding transaction. */
|
|
176
|
+
export declare function commitExplicitAdoptionRunPlans(root: RecordRoot, invocationId: string, plans: readonly ExplicitAdoptionRunPlan[]): Effect.Effect<ExplicitAdoptionRunReceipt[], RunStorageError, import("../coordination/record-leases.js").RecordCoordination | import("../record/platform/services.js").RecordEntropy | import("../record/sqlite/project-state-database.js").ProjectStateDatabase>;
|
|
176
177
|
/** A fresh in-memory invocation identity never enters Record Core. */
|
|
177
178
|
export declare function createExplicitAdoptionInvocationId(mint?: () => string): Effect.Effect<string>;
|
|
178
179
|
export declare function adoptionStartedAt(input?: () => string | number): Effect.Effect<UtcMillis, ExplicitAdoptionError>;
|
|
@@ -181,15 +182,6 @@ export declare function withAdoptionReader<A, E, R>(input: {
|
|
|
181
182
|
readonly root: RecordRoot;
|
|
182
183
|
readonly use: (reader: RecordReadSession) => Effect.Effect<A, E, R>;
|
|
183
184
|
}): Effect.Effect<A, RecordReaderOpenError | E, import("../record/sqlite/project-state-database.js").ProjectStateDatabase | Exclude<R, import("effect/Scope").Scope>>;
|
|
184
|
-
/**
|
|
185
|
-
* One Scope keeps the Host reader live while reference Runs are created, so
|
|
186
|
-
* SelectedAttemptRefs remain valid through seal. Discovery still happens
|
|
187
|
-
* before this Scope opens, so the first preflight writes nothing.
|
|
188
|
-
*/
|
|
189
|
-
export declare function withAdoptionCommitScope<A, E, R>(input: {
|
|
190
|
-
readonly root: RecordRoot;
|
|
191
|
-
readonly use: (reader: RecordReadSession) => Effect.Effect<A, E, R>;
|
|
192
|
-
}): Effect.Effect<A, RecordReaderOpenError | E, import("../record/sqlite/project-state-database.js").ProjectStateDatabase | Exclude<R, import("effect/Scope").Scope>>;
|
|
193
185
|
export interface RenameSourceRun {
|
|
194
186
|
readonly runId: RunId;
|
|
195
187
|
readonly experimentId: ExperimentId;
|
package/dist/runner/adoption.js
CHANGED
|
@@ -39,8 +39,6 @@ const __niceevalExport17 = __niceevalCanonical["resolveExactAdoptionSourceRun"];
|
|
|
39
39
|
export { __niceevalExport17 as resolveExactAdoptionSourceRun };
|
|
40
40
|
const __niceevalExport18 = __niceevalCanonical["resolveExplicitAttemptLocator"];
|
|
41
41
|
export { __niceevalExport18 as resolveExplicitAttemptLocator };
|
|
42
|
-
const __niceevalExport19 = __niceevalCanonical["
|
|
43
|
-
export { __niceevalExport19 as
|
|
44
|
-
const __niceevalExport20 = __niceevalCanonical["withAdoptionReader"];
|
|
45
|
-
export { __niceevalExport20 as withAdoptionReader };
|
|
42
|
+
const __niceevalExport19 = __niceevalCanonical["withAdoptionReader"];
|
|
43
|
+
export { __niceevalExport19 as withAdoptionReader };
|
|
46
44
|
//# sourceMappingURL=adoption.js.map
|
package/dist/runner/record.cjs
CHANGED
|
@@ -79,11 +79,15 @@ function withRunnerCurrentReusePreview(input) {
|
|
|
79
79
|
readReadbacks: () => effect_1.Effect.succeed(Object.freeze([])),
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
|
-
const
|
|
83
|
-
|
|
82
|
+
const { reusePlan, readbacks } = yield* effect_1.Effect.scoped(effect_1.Effect.gen(function* () {
|
|
83
|
+
const reader = yield* runtime_ts_1.recordHost.openRead({ root: input.recordRoot });
|
|
84
|
+
const reusePlan = yield* (0, reuse_plan_ts_1.planProjectTargetReuse)({ reader, target, policy: input.reuse.policy });
|
|
85
|
+
const readbacks = yield* (0, reuse_readback_ts_1.readCurrentExecutionReusePlanReadbacks)({ reader, plan: reusePlan }).pipe(effect_1.Effect.mapError((cause) => ({ code: "runner-session-open-failed", cause })));
|
|
86
|
+
return { reusePlan, readbacks };
|
|
87
|
+
}));
|
|
84
88
|
return yield* input.use({
|
|
85
89
|
reusePlan,
|
|
86
|
-
readReadbacks: () =>
|
|
90
|
+
readReadbacks: () => effect_1.Effect.succeed(readbacks),
|
|
87
91
|
});
|
|
88
92
|
}));
|
|
89
93
|
}
|
|
@@ -177,7 +181,6 @@ function openRunnerRecordCoordinator(input) {
|
|
|
177
181
|
})),
|
|
178
182
|
}).pipe(effect_1.Effect.mapError((cause) => ({ code: "runner-session-open-failed", cause })));
|
|
179
183
|
}
|
|
180
|
-
const reader = yield* runtime_ts_1.recordHost.openRead({ root: input.recordRoot });
|
|
181
184
|
const byRun = new Map();
|
|
182
185
|
const byRecordRunId = new Map();
|
|
183
186
|
const runIdsByExperiment = new Map();
|
|
@@ -206,7 +209,12 @@ function openRunnerRecordCoordinator(input) {
|
|
|
206
209
|
invocationId,
|
|
207
210
|
runs: Object.freeze(targetRuns),
|
|
208
211
|
});
|
|
209
|
-
const reusePlan = yield*
|
|
212
|
+
const { reusePlan, carriedResults } = yield* effect_1.Effect.scoped(effect_1.Effect.gen(function* () {
|
|
213
|
+
const reader = yield* runtime_ts_1.recordHost.openRead({ root: input.recordRoot });
|
|
214
|
+
const reusePlan = yield* (0, reuse_plan_ts_1.planProjectTargetReuse)({ reader, target, policy: input.reuse.policy });
|
|
215
|
+
const carriedResults = yield* (0, reuse_readback_ts_1.readCurrentExecutionReusePlanResults)({ reader, plan: reusePlan }).pipe(effect_1.Effect.mapError((cause) => ({ code: "runner-session-open-failed", cause })));
|
|
216
|
+
return { reusePlan, carriedResults };
|
|
217
|
+
}));
|
|
210
218
|
const carriedAttemptsByKey = new Map();
|
|
211
219
|
for (const slot of reusePlan.slots) {
|
|
212
220
|
const recordRun = byRecordRunId.get(slot.runId);
|
|
@@ -214,17 +222,17 @@ function openRunnerRecordCoordinator(input) {
|
|
|
214
222
|
return yield* effect_1.Effect.fail(membershipStateInvalid(slot.slotId));
|
|
215
223
|
recordRun.planSlots.set(slot.slotId, slot);
|
|
216
224
|
if (slot.state === "reuse") {
|
|
217
|
-
yield* recordRun.session
|
|
225
|
+
yield* (0, sqlite_host_ts_1.stagePlanningReference)(recordRun.session, {
|
|
218
226
|
slotId: slot.slotId,
|
|
219
227
|
action: "carried",
|
|
220
|
-
|
|
228
|
+
reference: slot.source.reference,
|
|
221
229
|
});
|
|
222
230
|
yield* (0, index_ts_2.bindAttemptReference)(rootPath, {
|
|
223
231
|
runId: String(recordRun.session.runId),
|
|
224
232
|
writerGeneration: recordRun.writerGeneration,
|
|
225
233
|
slotId: String(slot.slotId),
|
|
226
234
|
action: "carried",
|
|
227
|
-
publicationIdentity: slot.source.
|
|
235
|
+
publicationIdentity: slot.source.reference.publicationIdentity,
|
|
228
236
|
deadlineEpochMs: Date.now() + 30000,
|
|
229
237
|
}).pipe(effect_1.Effect.mapError((cause) => ({ code: "runner-session-open-failed", cause })));
|
|
230
238
|
const entry = recordRun.slots.get((0, planning_ts_1.runnerRecordSlotKey)(slot.evalId, slot.attempt));
|
|
@@ -271,26 +279,24 @@ function openRunnerRecordCoordinator(input) {
|
|
|
271
279
|
|| current.plan.state !== "gap"
|
|
272
280
|
|| current.recordRun.gapActions.get(current.slotId) !== "pending")
|
|
273
281
|
return false;
|
|
274
|
-
const
|
|
275
|
-
|
|
276
|
-
reader: freshReader,
|
|
277
|
-
|
|
278
|
-
policy: input.reuse.policy,
|
|
279
|
-
});
|
|
282
|
+
const refreshed = yield* effect_1.Effect.scoped(effect_1.Effect.gen(function* () {
|
|
283
|
+
const freshReader = yield* runtime_ts_1.recordHost.openRead({ root: input.recordRoot });
|
|
284
|
+
return yield* (0, reuse_plan_ts_1.planProjectTargetReuse)({ reader: freshReader, target, policy: input.reuse.policy });
|
|
285
|
+
}));
|
|
280
286
|
const replacement = refreshed.slots.find((slot) => slot.runId === current.recordRun.target.runId && slot.slotId === current.slotId);
|
|
281
287
|
if (replacement?.state !== "reuse")
|
|
282
288
|
return false;
|
|
283
|
-
yield* current.recordRun.session
|
|
289
|
+
yield* (0, sqlite_host_ts_1.stagePlanningReference)(current.recordRun.session, {
|
|
284
290
|
slotId: current.slotId,
|
|
285
291
|
action: "carried",
|
|
286
|
-
|
|
292
|
+
reference: replacement.source.reference,
|
|
287
293
|
});
|
|
288
294
|
yield* (0, index_ts_2.bindAttemptReference)(rootPath, {
|
|
289
295
|
runId: String(current.recordRun.session.runId),
|
|
290
296
|
writerGeneration: current.recordRun.writerGeneration,
|
|
291
297
|
slotId: String(current.slotId),
|
|
292
298
|
action: "carried",
|
|
293
|
-
publicationIdentity: replacement.source.
|
|
299
|
+
publicationIdentity: replacement.source.reference.publicationIdentity,
|
|
294
300
|
deadlineEpochMs: Date.now() + 30000,
|
|
295
301
|
}).pipe(effect_1.Effect.mapError(() => publishStateInvalid(current.recordRun.session.runId)));
|
|
296
302
|
current.recordRun.planSlots.set(current.slotId, replacement);
|
|
@@ -496,7 +502,7 @@ function openRunnerRecordCoordinator(input) {
|
|
|
496
502
|
};
|
|
497
503
|
return Object.freeze({
|
|
498
504
|
reusePlan,
|
|
499
|
-
readCarriedResults: () =>
|
|
505
|
+
readCarriedResults: () => effect_1.Effect.succeed(carriedResults),
|
|
500
506
|
runIdsByExperiment: new Map(runIdsByExperiment),
|
|
501
507
|
publicationCutoff: () => (0, index_ts_2.currentPublicationCutoff)(rootPath),
|
|
502
508
|
carriedAttemptsByKey: new Map([...carriedAttemptsByKey].map(([key, attempts]) => [key, new Set(attempts)])),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"record.js","sourceRoot":"","sources":["record.ts"],"names":[],"mappings":";;;AAyIA,sEAiDC;AAiCD,kEA4hBC;AAvvBD,qDAAuD;AACvD,6CAAyC;AACzC,qCAAqC;AACrC,mCAAgF;AAChF,8DAAkF;AAGlF,4DAAwE;AACxE,0DAAuD;AACvD,kEAA0G;AAI1G,wDAA8E;AAC9E,qDAAoE;AACpE,4DAAiE;AACjE,wDAA6D;AAI7D,sDAA4M;AAC5M,qDAA4C;AAC5C,mDAA0M;AAC1M,2DAAwN;AACxN,6DAA0I;AAC1I,4DAAgR;AAChR,yDAA2D;AAC3D,qEAAkG;AAClG,6EAAmH;AACnH,mFAAkG;AAClG,sDAA6R;AAG7R,+EAA0E;AAE1E,oDAAoP;AAA3O,uHAAA,wBAAwB,OAAA;AAyBjC,SAAS,2BAA2B,CAAC,MAAkB;IACnD,MAAM,OAAO,GAAG,IAAA,uDAAyB,EAAC,MAAM,CAAC,CAAC;IAClD,OAAO,MAAM,CAAC,MAAM,CAAC;QACjB,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC3C,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,UAAmB,EAAE,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;SAC1F,CAAC;QACF,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC7B,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC;gBACrB,IAAI,EAAE,WAAoB;gBAC1B,SAAS,EAAE,OAAO,CAAC,SAAS;g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ClB,CAAC,CAAC,CAAC;gBACH,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;oBACpB,oEAAoE;oBACpE,6DAA6D;oBAC7D,OAAO,KAAK,CAAC,CAAC,eAAM,CAAC,OAAO,CAAC,eAAe,EAAE,UAAU,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC,CAAC;gBAClF,CAAC;gBACD,oEAAoE;gBACpE,qEAAqE;gBACrE,+DAA+D;gBAC/D,MAAM,QAAQ,GAAwB,EAAE,CAAC;gBACzC,KAAK,MAAM,SAAS,IAAI,eAAe,EAAE,CAAC;oBACtC,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,eAAM,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;oBACvD,IAAI,aAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;wBACvB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;oBAC9B,CAAC;yBACI,CAAC;wBACF,MAAM,OAAO,GAAG,cAAK,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;wBAClD,IAAI,eAAM,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;4BACzB,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;wBAC1C,CAAC;6BACI,CAAC;4BACF,WAAW,CAAC,mBAAmB,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC;wBACzE,CAAC;oBACL,CAAC;gBACL,CAAC;gBACD,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACnC,CAAC,CAAC;SACL,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { judgeUsageForResult } from \"./judge-usage.ts\";\nimport { createHash } from \"node:crypto\";\nimport { existsSync } from \"node:fs\";\nimport { Cause, Effect, Result, Exit, Option, Semaphore, Stream } from \"effect\";\nimport { encodeAttemptLocator, type AttemptLocator } from \"../attempt-locator.ts\";\nimport type { SealedAttemptAssertions } from \"../assertions/api.ts\";\nimport type { AssertionsProducerError } from \"../assertions/record/producer.ts\";\nimport { NiceEvalRecordAttachments } from \"../record/family/catalog.ts\";\nimport { recordHost } from \"../record/host/runtime.ts\";\nimport { discardAttemptWriteSession, writerGenerationForRunSession } from \"../record/host/sqlite-host.ts\";\nimport type { AttemptWriteSession, RecordSealReceipt, RunWriteSession, } from \"../record/host/types.ts\";\nimport type { RunId, SlotId, } from \"../record/model/identifiers.ts\";\nimport type { AssertionEntryId } from \"../assertions/identity.ts\";\nimport { recordRootPaths, type RecordRoot } from \"../record/platform/root.ts\";\nimport { attemptPublicationClosure } from \"../record/codec/core.ts\";\nimport { RecordRootInvalid } from \"../record/platform/errors.ts\";\nimport { recordSqlitePath } from \"../record/sqlite/index.ts\";\nimport type { ProjectStateDatabase } from \"../record/sqlite/project-state-database.ts\";\nimport type { RecordReaderOpenError, RecordReaderReadError, } from \"../record/reader/errors.ts\";\nimport type { RecordWriteError } from \"../record/writer/types.ts\";\nimport { bindAttemptReference, closeRunResource, currentPublicationCutoff, publishOriginAttempt, createRunWriterGeneration, type PublicationCutoff, type RunAbsenceReason, } from \"../run/storage/index.ts\";\nimport { cacheKey } from \"./fingerprint.ts\";\nimport { planProjectTargetReuse, planProjectTargetReuseWithoutSources, type ExecutionReusePlan, type ExecutionReusePlanSlot, type ProjectTargetReusePlanInvalid, type TargetRun, } from \"./reuse-plan.ts\";\nimport { readCurrentExecutionReusePlanReadbacks, readCurrentExecutionReusePlanResults, type CurrentReusedAttemptReadback, type CurrentReuseReadback, type CurrentReuseReadbackPlanInvalid, } from \"./reuse-readback.ts\";\nimport { createRunnerTurnContextsAttachment, createRunnerSourceWritePlan, type RunnerSourceProducerInvalid, } from \"./source-producer.ts\";\nimport { createAttemptArtifactsAttachment, createAttemptFileChangesAttachment, createAttemptObservabilityAttachments, createRunArtifactsAttachment, createRunnerAssertionsAttachment, createRunObservabilityAttachments, recordAttemptOutcome, } from \"./record/attachments.ts\";\nimport { adapterUsageForResult } from \"./adapter-usage.ts\";\nimport { adapterAttachmentsForResult, releaseAdapterAttachments } from \"./adapter-attachments.ts\";\nimport { adapterExecutionTracesForResult, validateExecutionTracePublication, } from \"./adapter-execution-trace.ts\";\nimport { executionTracesRecordCollection } from \"../record/family/execution-traces/definition.ts\";\nimport { planRunnerRecordRun, previewRunnerRunId, runnerRecordSlotKey, runnerRecordUtcMillis, targetForRunnerRecordRun, type PlannedRunnerRecordRun, type RunnerRecordReuseInput, type RunnerRecordTargetIdentityInvalid, type RunnerRecordTargetInputMissing, } from \"./record/planning.ts\";\nimport type { AgentRun, Attempt, DiscoveredEval, EvalResult, } from \"./types.ts\";\nimport type { AttemptCostAttachment } from \"../record/family/attempt-cost/definition.ts\";\nimport { getPricingEstimateReceipt } from \"./pricing-estimate-receipt.ts\";\nimport type { SessionTracker } from \"./session.ts\";\nexport { prepareRunnerRecordReuse, type RunnerRecordReuseInput, type RunnerRecordReusePreparationInput, type RunnerRecordReuseSlotInput, type RunnerRecordTargetIdentityInvalid, type RunnerRecordTargetInputMissing, } from \"./record/planning.ts\";\ntype GapActionState = \"pending\" | \"reserved\" | \"executed\" | \"not-dispatched\" | \"interrupted\";\ninterface ActiveRunnerRecordAttempt {\n readonly attempt: Attempt;\n readonly session: AttemptWriteSession;\n readonly public: RunnerRecordAttempt;\n sealed?: SealedAttemptAssertions;\n result?: EvalResult;\n assertionEntryIds?: readonly AssertionEntryId[];\n completed: boolean;\n}\ninterface RunnerRecordRun extends PlannedRunnerRecordRun {\n readonly session: RunWriteSession;\n readonly target: TargetRun;\n readonly attempts: Map<SlotId, ActiveRunnerRecordAttempt>;\n readonly planSlots: Map<SlotId, ExecutionReusePlanSlot>;\n readonly gapActions: Map<SlotId, GapActionState>;\n readonly writerGeneration: string;\n}\nexport interface RunnerRecordAttempt {\n readonly slotId: SlotId;\n readonly attemptId: import(\"../record/model/identifiers.ts\").AttemptId;\n readonly locator: AttemptLocator;\n}\nexport type RecordAttemptLocator = AttemptLocator;\nfunction createAttemptCostAttachment(result: EvalResult): AttemptCostAttachment {\n const receipt = getPricingEstimateReceipt(result);\n return Object.freeze({\n ...(result.usage?.costUSD === undefined ? {} : {\n observed: Object.freeze({ kind: \"observed\" as const, amountUSD: result.usage.costUSD }),\n }),\n ...(receipt === undefined ? {} : {\n estimated: Object.freeze({\n kind: \"estimated\" as const,\n amountUSD: receipt.amountUSD,\n model: receipt.model,\n priceSource: receipt.priceSource,\n charges: receipt.charges,\n }),\n }),\n });\n}\nexport interface RunnerRecordAttemptInvalid {\n readonly code: \"runner-record-attempt-invalid\";\n}\nexport interface RunnerRecordUnsealedAttempt {\n readonly code: \"runner-record-attempt-unsealed\";\n readonly slotId: SlotId;\n}\nexport interface RunnerRecordMembershipStateInvalid {\n readonly code: \"runner-record-membership-state-invalid\";\n readonly slotId: SlotId;\n}\nexport interface RunnerRecordAttemptPublicationFailed {\n readonly code: \"runner-record-attempt-publication-failed\";\n readonly locator: AttemptLocator;\n readonly cause: unknown;\n readonly message: string;\n}\n/** A seal return without its durable marker is never a publish receipt. */\nexport interface RunnerRecordPublishStateInvalid {\n readonly code: \"runner-record-publish-state-invalid\";\n readonly runId: RunId;\n}\nexport interface RunnerRecordAssertionsInvalid {\n readonly code: \"runner-record-assertions-invalid\";\n readonly issue: AssertionsProducerError;\n}\nexport interface RunnerRecordObservabilityInvalid {\n readonly code: \"runner-record-observability-invalid\";\n readonly owner: \"attempt\" | \"run\";\n readonly stage: \"capture\" | \"attachment\";\n}\nexport interface RunnerRecordSourcesInvalid {\n readonly code: \"runner-record-sources-invalid\";\n readonly issue: RunnerSourceProducerInvalid;\n}\nexport interface RunnerRecordArtifactsInvalid {\n readonly code: \"runner-record-artifacts-invalid\";\n readonly owner: \"attempt\" | \"run\";\n readonly reason: \"trace-serialization-failed\" | \"attachment-closure-invalid\";\n}\nexport type RunnerRecordWriteError = RecordWriteError | RunnerRecordAttemptInvalid | RunnerRecordUnsealedAttempt | RunnerRecordMembershipStateInvalid | RunnerRecordAttemptPublicationFailed | RunnerRecordPublishStateInvalid | RunnerRecordTargetIdentityInvalid | RunnerRecordAssertionsInvalid | RunnerRecordObservabilityInvalid | RunnerRecordSourcesInvalid | RunnerRecordArtifactsInvalid;\nexport type RunnerRecordOpenError = RecordReaderOpenError | RecordWriteError | RecordReaderReadError | ProjectTargetReusePlanInvalid | RunnerRecordTargetInputMissing | RunnerRecordTargetIdentityInvalid | RunnerRecordMembershipStateInvalid | RunnerSessionOpenFailed;\nexport interface RunnerSessionOpenFailed {\n readonly code: \"runner-session-open-failed\";\n readonly cause: unknown;\n}\nexport interface RunnerRecordCoordinator {\n readonly reusePlan: ExecutionReusePlan;\n readonly readCarriedResults: () => Effect.Effect<readonly CurrentReusedAttemptReadback[], RecordReaderReadError | CurrentReuseReadbackPlanInvalid>;\n readonly runIdsByExperiment: ReadonlyMap<string, string>;\n readonly publicationCutoff: () => Effect.Effect<PublicationCutoff, unknown, ProjectStateDatabase>;\n readonly carriedAttemptsByKey: ReadonlyMap<string, ReadonlySet<number>>;\n readonly adoptLatePublishedAttempt: (attempt: Attempt) => Effect.Effect<boolean, RecordReaderOpenError | RecordReaderReadError | ProjectTargetReusePlanInvalid | RunnerRecordWriteError, import(\"effect\").Scope.Scope | import(\"../coordination/record-leases.ts\").RecordCoordination | ProjectStateDatabase>;\n readonly reserveAttempt: (attempt: Attempt) => Effect.Effect<RunnerRecordAttempt, RunnerRecordWriteError, ProjectStateDatabase>;\n readonly noteSealedOrMarkIncomplete: (attempt: Attempt, sealed: SealedAttemptAssertions) => Effect.Effect<void, never>;\n readonly completeAttemptOrMarkIncomplete: (attempt: Attempt, result: EvalResult) => Effect.Effect<RunnerRecordAttempt | undefined, never, ProjectStateDatabase>;\n readonly markNotDispatched: (attempt: Attempt) => void;\n readonly publish: (completedAt: number, mode: \"normal\" | \"interrupted\") => Effect.Effect<readonly RecordSealReceipt[], RunnerRecordWriteError, ProjectStateDatabase>;\n}\n/** Current preview preserves the read Scope and never creates a Run row. */\nexport function withRunnerCurrentReusePreview<A, E, R>(input: {\n readonly recordRoot: RecordRoot;\n readonly startedAt: number;\n readonly evals: readonly DiscoveredEval[];\n readonly runs: readonly AgentRun[];\n readonly reuse: RunnerRecordReuseInput;\n readonly use: (preview: {\n readonly reusePlan: ExecutionReusePlan;\n readonly readReadbacks: () => Effect.Effect<readonly CurrentReuseReadback[], RecordReaderReadError | CurrentReuseReadbackPlanInvalid>;\n }) => Effect.Effect<A, E, R>;\n}): Effect.Effect<A, E | RunnerRecordOpenError, R | import(\"effect\").Scope.Scope | import(\"../coordination/record-leases.ts\").RecordCoordination | ProjectStateDatabase> {\n return Effect.scoped(Effect.gen(function* () {\n const startedAt = runnerRecordUtcMillis(input.startedAt);\n if (Result.isFailure(startedAt))\n return yield* Effect.fail(startedAt.failure);\n const planned = yield* Effect.forEach(input.runs, (run) => planRunnerRecordRun({\n run,\n evals: input.evals,\n reuse: input.reuse,\n }), { concurrency: 1 });\n const previewRuns: TargetRun[] = [];\n for (const plan of planned) {\n const runId = previewRunnerRunId(plan.run);\n if (Result.isFailure(runId))\n return yield* Effect.fail(runId.failure);\n previewRuns.push(targetForRunnerRecordRun({ planned: plan, runId: runId.success, startedAt: startedAt.success }));\n }\n const target = Object.freeze({\n invocationId: `preview-${createHash(\"sha256\").update(String(input.startedAt), \"utf8\").digest(\"hex\")}`,\n runs: Object.freeze(previewRuns),\n });\n const rootPath = recordRootPaths(input.recordRoot)?.portableRoot;\n if (rootPath === undefined)\n return yield* Effect.fail(new RecordRootInvalid({ code: \"record-root-invalid\" }));\n const recordDatabase = recordSqlitePath(rootPath);\n if (!existsSync(recordDatabase)) {\n const reusePlan = yield* planProjectTargetReuseWithoutSources({ target, policy: input.reuse.policy });\n return yield* input.use({\n reusePlan,\n readReadbacks: () => Effect.succeed(Object.freeze([])),\n });\n }\n const reader = yield* recordHost.openRead({ root: input.recordRoot });\n const reusePlan = yield* planProjectTargetReuse({ reader, target, policy: input.reuse.policy });\n return yield* input.use({\n reusePlan,\n readReadbacks: () => readCurrentExecutionReusePlanReadbacks({ reader, plan: reusePlan }),\n });\n }));\n}\nfunction attemptInvalid(): RunnerRecordAttemptInvalid {\n return Object.freeze({ code: \"runner-record-attempt-invalid\" as const });\n}\nfunction unsealedAttempt(slotId: SlotId): RunnerRecordUnsealedAttempt {\n return Object.freeze({ code: \"runner-record-attempt-unsealed\" as const, slotId });\n}\nfunction membershipStateInvalid(slotId: SlotId): RunnerRecordMembershipStateInvalid {\n return Object.freeze({ code: \"runner-record-membership-state-invalid\" as const, slotId });\n}\nfunction attemptPublicationFailed(locator: AttemptLocator, cause: unknown): RunnerRecordAttemptPublicationFailed {\n const detail = cause instanceof Error\n ? cause.message\n : typeof cause === \"object\" && cause !== null && typeof Reflect.get(cause, \"message\") === \"string\"\n ? String(Reflect.get(cause, \"message\"))\n : typeof cause === \"object\" && cause !== null && typeof Reflect.get(cause, \"code\") === \"string\"\n ? String(Reflect.get(cause, \"code\"))\n : String(cause);\n return Object.freeze({\n code: \"runner-record-attempt-publication-failed\" as const,\n locator,\n cause,\n message: `Attempt publication failed for ${locator}: ${detail}`,\n });\n}\nfunction publishStateInvalid(runId: RunId): RunnerRecordPublishStateInvalid {\n return Object.freeze({ code: \"runner-record-publish-state-invalid\" as const, runId });\n}\n/**\n * Opens one new per-Experiment Run session, selects only sealed historical\n * Runs, and writes carry references before dispatch. No global Record writer\n * lock or superseded draft/attachment contract participates in this boundary.\n */\nexport function openRunnerRecordCoordinator(input: {\n readonly recordRoot: RecordRoot;\n readonly startedAt: number;\n readonly evals: readonly DiscoveredEval[];\n readonly runs: readonly AgentRun[];\n readonly reuse: RunnerRecordReuseInput;\n readonly session?: SessionTracker;\n}): Effect.Effect<RunnerRecordCoordinator, RunnerRecordOpenError, import(\"effect\").Scope.Scope | import(\"../record/platform/services.ts\").RecordEntropy | import(\"../coordination/record-leases.ts\").RecordCoordination | ProjectStateDatabase> {\n return Effect.gen(function* () {\n const rootPath = recordRootPaths(input.recordRoot)?.portableRoot;\n if (rootPath === undefined)\n return yield* Effect.fail(new RecordRootInvalid({ code: \"record-root-invalid\" }));\n const seenExperiments = new Set<string>();\n for (const run of input.runs) {\n if (seenExperiments.has(run.experimentId)) {\n return yield* Effect.fail({\n code: \"runner-record-target-identity-invalid\" as const,\n kind: \"invocation\" as const,\n value: `duplicate experimentId ${JSON.stringify(run.experimentId)}`,\n });\n }\n seenExperiments.add(run.experimentId);\n }\n const startedAt = runnerRecordUtcMillis(input.startedAt);\n if (Result.isFailure(startedAt))\n return yield* Effect.fail(startedAt.failure);\n const planned = yield* Effect.forEach(input.runs, (run) => planRunnerRecordRun({\n run,\n evals: input.evals,\n reuse: input.reuse,\n }), { concurrency: 1 });\n const invocationId = input.session?.sessionId ?? createHash(\"sha256\")\n .update(`${input.startedAt}\\u0000${planned.map((entry) => entry.run.experimentId).join(\"\\u0000\")}`, \"utf8\")\n .digest(\"hex\");\n const openedRuns = yield* Effect.forEach(planned, (plan) => recordHost.createRun({\n root: input.recordRoot,\n experimentId: plan.experimentId,\n context: plan.context,\n startedAt: startedAt.success,\n expectedSlots: plan.expectedSlots,\n writerGeneration: createRunWriterGeneration(`${invocationId}:${plan.experimentId}`),\n }).pipe(Effect.map((session) => {\n const writerGeneration = writerGenerationForRunSession(session);\n if (writerGeneration === undefined)\n throw new Error(\"Run writer generation is unavailable\");\n return Object.freeze({ plan, session, writerGeneration });\n })), { concurrency: 1 });\n if (input.session !== undefined) {\n const startedAtIso = new Date(input.startedAt).toISOString();\n yield* input.session.start({\n runIds: new Map(openedRuns.map(({ plan, session }) => [plan.experimentId, String(session.runId)])),\n agentRuns: input.runs,\n startedAt: startedAtIso,\n invocationRuns: openedRuns.map(({ plan, session, writerGeneration }) => ({\n runId: String(session.runId),\n experimentId: plan.experimentId,\n writerGeneration,\n startedAt: startedAtIso,\n expectedSlots: plan.expectedSlots.map((slot) => ({\n slotId: String(slot.slotId), evalId: String(slot.evalId), attemptOrdinal: slot.attemptOrdinal,\n executionIdentityDigest: String(slot.executionIdentityDigest),\n })),\n })),\n }).pipe(Effect.mapError((cause): RunnerSessionOpenFailed => ({ code: \"runner-session-open-failed\", cause })));\n }\n const reader = yield* recordHost.openRead({ root: input.recordRoot });\n const byRun = new Map<AgentRun, RunnerRecordRun>();\n const byRecordRunId = new Map<RunId, RunnerRecordRun>();\n const runIdsByExperiment = new Map<string, string>();\n const targetRuns: TargetRun[] = [];\n for (const { plan, session, writerGeneration } of openedRuns) {\n const target = targetForRunnerRecordRun({\n planned: plan,\n runId: session.runId,\n startedAt: startedAt.success,\n });\n const recordRun: RunnerRecordRun = {\n ...plan,\n session,\n target,\n attempts: new Map(),\n planSlots: new Map(),\n gapActions: new Map(),\n writerGeneration,\n };\n byRun.set(plan.run, recordRun);\n byRecordRunId.set(session.runId, recordRun);\n runIdsByExperiment.set(plan.run.experimentId, session.runId);\n targetRuns.push(target);\n }\n const target = Object.freeze({\n invocationId,\n runs: Object.freeze(targetRuns),\n });\n const reusePlan = yield* planProjectTargetReuse({ reader, target, policy: input.reuse.policy });\n const carriedAttemptsByKey = new Map<string, Set<number>>();\n for (const slot of reusePlan.slots) {\n const recordRun = byRecordRunId.get(slot.runId);\n if (recordRun === undefined)\n return yield* Effect.fail(membershipStateInvalid(slot.slotId));\n recordRun.planSlots.set(slot.slotId, slot);\n if (slot.state === \"reuse\") {\n yield* recordRun.session.referenceAttempt({\n slotId: slot.slotId,\n action: \"carried\",\n attempt: slot.source.attempt,\n });\n yield* bindAttemptReference(rootPath, {\n runId: String(recordRun.session.runId),\n writerGeneration: recordRun.writerGeneration,\n slotId: String(slot.slotId),\n action: \"carried\",\n publicationIdentity: slot.source.attempt.publicationIdentity,\n deadlineEpochMs: Date.now() + 30000,\n }).pipe(Effect.mapError((cause): RunnerSessionOpenFailed => ({ code: \"runner-session-open-failed\", cause })));\n const entry = recordRun.slots.get(runnerRecordSlotKey(slot.evalId, slot.attempt));\n if (entry === undefined)\n return yield* Effect.fail(membershipStateInvalid(slot.slotId));\n const key = cacheKey(recordRun.run, entry.evalDef.id);\n const carried = carriedAttemptsByKey.get(key) ?? new Set<number>();\n carried.add(entry.attempt);\n carriedAttemptsByKey.set(key, carried);\n }\n else {\n recordRun.gapActions.set(slot.slotId, \"pending\");\n }\n }\n if (input.session !== undefined) {\n yield* input.session.applyCarriedAttempts(input.runs, carriedAttemptsByKey).pipe(Effect.mapError((cause): RunnerSessionOpenFailed => ({ code: \"runner-session-open-failed\", cause })));\n }\n let invocationWriteFailure: RunnerRecordWriteError | undefined;\n const writeFailuresByRun = new Map<RunnerRecordRun, RunnerRecordWriteError>();\n const noteFailure = (error: RunnerRecordWriteError, recordRun?: RunnerRecordRun): void => {\n if (recordRun === undefined) {\n if (invocationWriteFailure === undefined)\n invocationWriteFailure = error;\n return;\n }\n if (!writeFailuresByRun.has(recordRun))\n writeFailuresByRun.set(recordRun, error);\n };\n const lock = yield* Semaphore.make(1);\n const runForAttempt = (attempt: Attempt): RunnerRecordRun | undefined => byRun.get(attempt.run);\n const targetForAttempt = (attempt: Attempt): {\n readonly recordRun: RunnerRecordRun;\n readonly slotId: SlotId;\n readonly plan: ExecutionReusePlanSlot;\n } | undefined => {\n const recordRun = runForAttempt(attempt);\n if (recordRun === undefined)\n return undefined;\n const entry = recordRun.slots.get(runnerRecordSlotKey(attempt.evalDef.id, attempt.attempt));\n if (entry === undefined)\n return undefined;\n const plan = recordRun.planSlots.get(entry.slot.slotId);\n return plan === undefined ? undefined : { recordRun, slotId: entry.slot.slotId, plan };\n };\n const adoptLatePublishedAttempt = (attempt: Attempt) => lock.withPermits(1)(Effect.gen(function* () {\n const current = targetForAttempt(attempt);\n if (current === undefined\n || current.plan.state !== \"gap\"\n || current.recordRun.gapActions.get(current.slotId) !== \"pending\")\n return false;\n const freshReader = yield* recordHost.openRead({ root: input.recordRoot });\n const refreshed = yield* planProjectTargetReuse({\n reader: freshReader,\n target,\n policy: input.reuse.policy,\n });\n const replacement = refreshed.slots.find((slot) => slot.runId === current.recordRun.target.runId && slot.slotId === current.slotId);\n if (replacement?.state !== \"reuse\")\n return false;\n yield* current.recordRun.session.referenceAttempt({\n slotId: current.slotId,\n action: \"carried\",\n attempt: replacement.source.attempt,\n });\n yield* bindAttemptReference(rootPath, {\n runId: String(current.recordRun.session.runId),\n writerGeneration: current.recordRun.writerGeneration,\n slotId: String(current.slotId),\n action: \"carried\",\n publicationIdentity: replacement.source.attempt.publicationIdentity,\n deadlineEpochMs: Date.now() + 30000,\n }).pipe(Effect.mapError(() => publishStateInvalid(current.recordRun.session.runId)));\n current.recordRun.planSlots.set(current.slotId, replacement);\n current.recordRun.gapActions.delete(current.slotId);\n return true;\n }));\n const reserveAttempt = (attempt: Attempt): Effect.Effect<RunnerRecordAttempt, RunnerRecordWriteError, ProjectStateDatabase> => {\n const targetSlot = targetForAttempt(attempt);\n return lock.withPermits(1)(Effect.gen(function* () {\n if (targetSlot === undefined\n || targetSlot.plan.state !== \"gap\"\n || targetSlot.recordRun.gapActions.get(targetSlot.slotId) !== \"pending\") {\n return yield* Effect.fail(attemptInvalid());\n }\n const session = yield* targetSlot.recordRun.session.createAttempt({ slotId: targetSlot.slotId });\n const publicAttempt = Object.freeze({\n slotId: targetSlot.slotId,\n attemptId: session.attemptId,\n locator: encodeAttemptLocator(session.attemptId),\n });\n targetSlot.recordRun.attempts.set(targetSlot.slotId, {\n attempt,\n session,\n public: publicAttempt,\n completed: false,\n });\n targetSlot.recordRun.gapActions.set(targetSlot.slotId, \"reserved\");\n return publicAttempt;\n })).pipe(Effect.tapError((error) => Effect.sync(() => noteFailure(error, targetSlot?.recordRun ?? runForAttempt(attempt)))));\n };\n const noteSealedOrMarkIncomplete = (attempt: Attempt, sealed: SealedAttemptAssertions): Effect.Effect<void, never> => Effect.sync(() => {\n const targetSlot = targetForAttempt(attempt);\n const active = targetSlot === undefined\n ? undefined\n : targetSlot.recordRun.attempts.get(targetSlot.slotId);\n if (targetSlot === undefined\n || targetSlot.plan.state !== \"gap\"\n || targetSlot.recordRun.gapActions.get(targetSlot.slotId) !== \"reserved\"\n || active === undefined\n || active.attempt !== attempt\n || active.sealed !== undefined) {\n noteFailure(attemptInvalid(), targetSlot?.recordRun ?? runForAttempt(attempt));\n return;\n }\n active.sealed = sealed;\n });\n const completeAttempt = (attempt: Attempt, result: EvalResult): Effect.Effect<RunnerRecordAttempt, RunnerRecordWriteError, ProjectStateDatabase> => Effect.suspend<RunnerRecordAttempt, RunnerRecordWriteError, ProjectStateDatabase>(() => {\n const targetSlot = targetForAttempt(attempt);\n const active = targetSlot === undefined\n ? undefined\n : targetSlot.recordRun.attempts.get(targetSlot.slotId);\n if (targetSlot === undefined\n || targetSlot.plan.state !== \"gap\"\n || targetSlot.recordRun.gapActions.get(targetSlot.slotId) !== \"reserved\"\n || active === undefined\n || active.attempt !== attempt\n || active.completed) {\n return Effect.fail(attemptInvalid());\n }\n const assertions = active.sealed === undefined\n ? undefined\n : createRunnerAssertionsAttachment(active.sealed);\n if (assertions !== undefined && Result.isFailure(assertions))\n return Effect.fail(assertions.failure);\n if (active.sealed === undefined || assertions === undefined || Result.isFailure(assertions)) {\n return Effect.fail(membershipStateInvalid(targetSlot.slotId));\n }\n return Effect.gen(function* () {\n const sourcePlan = createRunnerSourceWritePlan([Object.freeze({\n slotId: targetSlot.slotId,\n result,\n assertionEntryIds: assertions.success.entryIds,\n })]);\n if (Result.isFailure(sourcePlan)) {\n return yield* Effect.fail(Object.freeze({\n code: \"runner-record-sources-invalid\" as const,\n issue: sourcePlan.failure,\n }));\n }\n const closedAssertions = createRunnerAssertionsAttachment(active.sealed!, {\n entryIds: assertions.success.entryIds,\n sourceSites: sourcePlan.success.sourceSitesBySlot.get(targetSlot.slotId),\n });\n if (Result.isFailure(closedAssertions))\n return yield* Effect.fail(closedAssertions.failure);\n yield* active.session.records.write(NiceEvalRecordAttachments.assertions, closedAssertions.success.attachment);\n yield* active.session.records.write(NiceEvalRecordAttachments.attemptCost, createAttemptCostAttachment(result));\n const sourceReceipts = yield* createAttemptObservabilityAttachments({ result, sealed: active.sealed! });\n if (sourceReceipts.agentTurns !== undefined) {\n yield* active.session.records.write(NiceEvalRecordAttachments.agentTurns, sourceReceipts.agentTurns);\n }\n if (sourceReceipts.sandboxCommands !== undefined) {\n yield* active.session.records.write(NiceEvalRecordAttachments.sandboxCommands, sourceReceipts.sandboxCommands);\n }\n yield* active.session.records.write(NiceEvalRecordAttachments.runnerActivities.attempt, sourceReceipts.runnerActivities);\n yield* active.session.records.write(NiceEvalRecordAttachments.runnerDiagnostics.attempt, sourceReceipts.runnerDiagnostics);\n const turnContexts = createRunnerTurnContextsAttachment({ result, sourcePlan: sourcePlan.success });\n if (Result.isFailure(turnContexts)) {\n return yield* Effect.fail(Object.freeze({\n code: \"runner-record-sources-invalid\" as const,\n issue: turnContexts.failure,\n }));\n }\n if (turnContexts.success !== undefined) {\n yield* active.session.records.write(NiceEvalRecordAttachments.turnContexts, turnContexts.success);\n }\n const fileChanges = createAttemptFileChangesAttachment(result);\n if (fileChanges !== undefined) {\n yield* active.session.records.write(NiceEvalRecordAttachments.fileChanges, fileChanges);\n }\n const attachmentSnapshot = adapterAttachmentsForResult(result);\n const artifacts = createAttemptArtifactsAttachment(result, attachmentSnapshot);\n const judgeUsage = judgeUsageForResult(result, closedAssertions.success.entryIds);\n if (judgeUsage !== undefined)\n yield* active.session.records.write(NiceEvalRecordAttachments.judgeUsage, judgeUsage);\n const adapterUsage = adapterUsageForResult(result);\n const executionTraces = adapterExecutionTracesForResult(result);\n if (adapterUsage !== undefined) {\n yield* active.session.records.write(NiceEvalRecordAttachments.adapterUsage, adapterUsage);\n }\n if (artifacts !== undefined) {\n yield* active.session.records.write(NiceEvalRecordAttachments.artifacts.attempt, artifacts);\n }\n if (executionTraces !== undefined && executionTraces.traces.length > 0) {\n validateExecutionTracePublication(executionTraces, attachmentSnapshot?.artifacts ?? []);\n yield* active.session.records.appendAll(executionTracesRecordCollection, Stream.fromIterable(executionTraces.traces.flatMap((trace) => trace.records)));\n yield* active.session.records.close(executionTracesRecordCollection, executionTraces.failure === undefined\n ? { state: \"complete\" }\n : {\n state: \"partial\",\n limitations: [{ code: \"capture-failed\", stage: \"adapter\" }],\n });\n }\n yield* active.session.complete(recordAttemptOutcome(result));\n const closureBytes = new TextEncoder().encode(JSON.stringify(attemptPublicationClosure(Object.freeze({\n runId: String(targetSlot.recordRun.session.runId),\n experimentId: targetSlot.recordRun.experimentId,\n context: targetSlot.recordRun.context,\n startedAt: targetSlot.recordRun.target.startedAt,\n completedAt: Date.now(),\n expectedSlots: targetSlot.recordRun.expectedSlots,\n }))));\n yield* publishOriginAttempt(rootPath, {\n runId: String(targetSlot.recordRun.session.runId),\n writerGeneration: targetSlot.recordRun.writerGeneration,\n slotId: String(targetSlot.slotId),\n attemptId: String(active.public.attemptId),\n attemptLocator: String(active.public.locator),\n closureBytes,\n closureDigest: createHash(\"sha256\").update(closureBytes).digest(\"hex\"),\n deadlineEpochMs: Date.now() + 30000,\n }).pipe(Effect.mapError((cause) => attemptPublicationFailed(active.public.locator, cause)));\n active.result = result;\n active.assertionEntryIds = assertions.success.entryIds;\n active.completed = true;\n targetSlot.recordRun.gapActions.set(targetSlot.slotId, \"executed\");\n return active.public;\n });\n });\n const attachRunFacts = (recordRun: RunnerRecordRun, mode: \"normal\" | \"interrupted\"): Effect.Effect<void, RunnerRecordWriteError> => Effect.gen(function* () {\n const writeRecord = (effect: Effect.Effect<void, RecordWriteError, never>): Effect.Effect<void, RecordWriteError, never> => effect;\n const origins = [] as {\n readonly slotId: SlotId;\n readonly active: ActiveRunnerRecordAttempt;\n readonly result: EvalResult;\n readonly sealed: SealedAttemptAssertions;\n readonly assertionEntryIds: readonly AssertionEntryId[];\n }[];\n for (const [slotId, state] of recordRun.gapActions) {\n if (state !== \"executed\")\n continue;\n const active = recordRun.attempts.get(slotId);\n if (active === undefined)\n return yield* Effect.fail(membershipStateInvalid(slotId));\n const result = active.result;\n const sealed = active?.sealed;\n const assertionEntryIds = active?.assertionEntryIds;\n if (result === undefined || sealed === undefined || assertionEntryIds === undefined)\n continue;\n origins.push(Object.freeze({ slotId, active, result, sealed, assertionEntryIds }));\n }\n const sources = createRunnerSourceWritePlan(origins.map(({ slotId, result, assertionEntryIds }) => Object.freeze({\n slotId,\n result,\n assertionEntryIds,\n })));\n if (Result.isFailure(sources)) {\n return yield* Effect.fail(Object.freeze({\n code: \"runner-record-sources-invalid\" as const,\n issue: sources.failure,\n }));\n }\n yield* writeRecord(recordRun.session.records.write(NiceEvalRecordAttachments.sources, sources.success.sources));\n const sourceReceipts = yield* createRunObservabilityAttachments(recordRun.run);\n if (sourceReceipts.runnerActivities !== undefined) {\n yield* writeRecord(recordRun.session.records.write(NiceEvalRecordAttachments.runnerActivities.run, sourceReceipts.runnerActivities));\n }\n if (sourceReceipts.runnerDiagnostics !== undefined) {\n yield* writeRecord(recordRun.session.records.write(NiceEvalRecordAttachments.runnerDiagnostics.run, sourceReceipts.runnerDiagnostics));\n }\n yield* writeRecord(recordRun.session.records.write(NiceEvalRecordAttachments.artifacts.run, createRunArtifactsAttachment()));\n });\n const pendingGap = (recordRun: RunnerRecordRun): SlotId | undefined => {\n for (const [slotId, state] of recordRun.gapActions) {\n if (state === \"pending\")\n return slotId;\n }\n return undefined;\n };\n return Object.freeze({\n reusePlan,\n readCarriedResults: () => readCurrentExecutionReusePlanResults({ reader, plan: reusePlan }),\n runIdsByExperiment: new Map(runIdsByExperiment),\n publicationCutoff: () => currentPublicationCutoff(rootPath),\n carriedAttemptsByKey: new Map([...carriedAttemptsByKey].map(([key, attempts]) => [key, new Set(attempts)] as const)),\n adoptLatePublishedAttempt,\n reserveAttempt,\n noteSealedOrMarkIncomplete,\n completeAttemptOrMarkIncomplete: (attempt: Attempt, result: EvalResult) => completeAttempt(attempt, result).pipe(Effect.catch((error) => Effect.sync(() => {\n const target = targetForAttempt(attempt);\n const active = target === undefined ? undefined : target.recordRun.attempts.get(target.slotId);\n noteFailure(error.code === \"runner-record-assertions-invalid\" ||\n error.code === \"runner-record-attempt-publication-failed\" ||\n active === undefined\n ? error\n : attemptPublicationFailed(active.public.locator, error), target?.recordRun ?? runForAttempt(attempt));\n return undefined;\n })), Effect.ensuring(Effect.promise(() => releaseAdapterAttachments(result)))),\n markNotDispatched: (attempt: Attempt) => {\n const targetSlot = targetForAttempt(attempt);\n if (targetSlot !== undefined\n && targetSlot.plan.state === \"gap\"\n && targetSlot.recordRun.gapActions.get(targetSlot.slotId) === \"pending\") {\n targetSlot.recordRun.gapActions.set(targetSlot.slotId, \"not-dispatched\");\n }\n },\n publish: (completedAt: number, mode: \"normal\" | \"interrupted\") => Effect.gen(function* () {\n const recordRuns = [...byRun.values()];\n if (invocationWriteFailure !== undefined)\n return yield* Effect.fail(invocationWriteFailure);\n if (mode === \"normal\") {\n // A normal finish remains invocation-strict: a failure which can be\n // attributed to one Run still fails the call rather than allowing a\n // partial receipt to disguise it as ordinary completion.\n for (const recordRun of recordRuns) {\n const failure = writeFailuresByRun.get(recordRun);\n if (failure !== undefined)\n return yield* Effect.fail(failure);\n }\n }\n const completion = runnerRecordUtcMillis(completedAt);\n if (Result.isFailure(completion))\n return yield* Effect.fail(completion.failure);\n // A controlled interruption closes every reserved Attempt as\n // `interrupted` and every never-started gap as an interrupted terminal\n // Member. Only a Run-local writer failure remains non-publishable.\n // Abrupt process loss still has no opportunity to create `complete`.\n const incompleteRuns = mode === \"interrupted\"\n ? new Set(recordRuns.filter((recordRun) => writeFailuresByRun.has(recordRun)))\n : new Set<RunnerRecordRun>();\n if (mode === \"normal\") {\n // Normal completion is deliberately invocation-strict. A pending\n // gap means the scheduler failed to account for a Slot; a reserved\n // or otherwise unsettled Attempt is likewise not publishable.\n for (const recordRun of recordRuns) {\n const unsettledSlot = [...recordRun.gapActions.keys()].find((slotId) => {\n const active = recordRun.attempts.get(slotId);\n return recordRun.gapActions.get(slotId) === \"reserved\"\n || (active !== undefined && !active.completed);\n });\n if (unsettledSlot !== undefined)\n return yield* Effect.fail(unsealedAttempt(unsettledSlot));\n const unaccountedSlot = pendingGap(recordRun);\n if (unaccountedSlot !== undefined)\n return yield* Effect.fail(unsealedAttempt(unaccountedSlot));\n }\n }\n else {\n for (const recordRun of recordRuns) {\n if (incompleteRuns.has(recordRun))\n continue;\n for (const [slotId, state] of recordRun.gapActions) {\n if (state === \"pending\")\n recordRun.gapActions.set(slotId, \"interrupted\");\n if (state === \"reserved\") {\n const active = recordRun.attempts.get(slotId);\n if (active === undefined)\n return yield* Effect.fail(membershipStateInvalid(slotId));\n yield* discardAttemptWriteSession(active.session);\n recordRun.attempts.delete(slotId);\n recordRun.gapActions.set(slotId, \"interrupted\");\n }\n }\n }\n }\n const publishableRuns = recordRuns.filter((recordRun) => !incompleteRuns.has(recordRun));\n const publishOne = (recordRun: RunnerRecordRun): Effect.Effect<RecordSealReceipt, RunnerRecordWriteError, ProjectStateDatabase> => Effect.gen(function* () {\n yield* attachRunFacts(recordRun, mode);\n for (const [slotId, state] of recordRun.gapActions) {\n if (state === \"not-dispatched\" || state === \"interrupted\") {\n const absenceReason: RunAbsenceReason = mode === \"interrupted\"\n ? \"interrupted-before-publication\"\n : state === \"not-dispatched\"\n ? \"early-exit-satisfied\"\n : \"dispatch-failed\";\n yield* recordRun.session.recordTerminalMember({ slotId, action: state, absenceReason });\n }\n }\n const sealed = yield* recordRun.session.seal({ completedAt: completion.success });\n const absences = [...recordRun.gapActions].flatMap(([slotId, state]) => {\n if (state === \"executed\" && recordRun.attempts.get(slotId)?.completed === true)\n return [];\n const reason: RunAbsenceReason = mode === \"interrupted\"\n ? \"interrupted-before-publication\"\n : state === \"not-dispatched\"\n ? \"early-exit-satisfied\"\n : \"dispatch-failed\";\n return [{ slotId: String(slotId), reason }];\n });\n yield* closeRunResource(rootPath, {\n runId: String(recordRun.session.runId),\n writerGeneration: recordRun.writerGeneration,\n state: mode === \"interrupted\" ? \"interrupted\" : \"completed\",\n completedAt: new Date(completedAt).toISOString(),\n absences,\n deadlineEpochMs: Date.now() + 30000,\n }).pipe(Effect.mapError(() => publishStateInvalid(recordRun.session.runId)));\n return sealed;\n });\n if (mode === \"normal\") {\n // Normal completion remains typed and strict: the first Run failure\n // is an invocation failure, never a partial success receipt.\n return yield* Effect.forEach(publishableRuns, publishOne, { concurrency: 1 });\n }\n // SIGINT is different: each clean sibling receives its own complete\n // attempt. We deliberately observe an Exit per Run so one Attachment\n // or seal error cannot short-circuit subsequent safe siblings.\n const receipts: RecordSealReceipt[] = [];\n for (const recordRun of publishableRuns) {\n const exit = yield* Effect.exit(publishOne(recordRun));\n if (Exit.isSuccess(exit)) {\n receipts.push(exit.value);\n }\n else {\n const failure = Cause.findErrorOption(exit.cause);\n if (Option.isSome(failure)) {\n noteFailure(failure.value, recordRun);\n }\n else {\n noteFailure(publishStateInvalid(recordRun.session.runId), recordRun);\n }\n }\n }\n return Object.freeze(receipts);\n }),\n });\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"record.js","sourceRoot":"","sources":["record.ts"],"names":[],"mappings":";;;AAyIA,sEAqDC;AAiCD,kEA8hBC;AA7vBD,qDAAuD;AACvD,6CAAyC;AACzC,qCAAqC;AACrC,mCAAgF;AAChF,8DAAkF;AAGlF,4DAAwE;AACxE,0DAAuD;AACvD,kEAAkI;AAIlI,wDAA8E;AAC9E,qDAAoE;AACpE,4DAAiE;AACjE,wDAA6D;AAI7D,sDAA4M;AAC5M,qDAA4C;AAC5C,mDAA0M;AAC1M,2DAAwN;AACxN,6DAA0I;AAC1I,4DAAgR;AAChR,yDAA2D;AAC3D,qEAAkG;AAClG,6EAAmH;AACnH,mFAAkG;AAClG,sDAA6R;AAG7R,+EAA0E;AAE1E,oDAAoP;AAA3O,uHAAA,wBAAwB,OAAA;AAyBjC,SAAS,2BAA2B,CAAC,MAAkB;IACnD,MAAM,OAAO,GAAG,IAAA,uDAAyB,EAAC,MAAM,CAAC,CAAC;IAClD,OAAO,M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AAC,QAAQ,CAAC,CAAC;YACnC,CAAC,CAAC;SACL,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { judgeUsageForResult } from \"./judge-usage.ts\";\nimport { createHash } from \"node:crypto\";\nimport { existsSync } from \"node:fs\";\nimport { Cause, Effect, Result, Exit, Option, Semaphore, Stream } from \"effect\";\nimport { encodeAttemptLocator, type AttemptLocator } from \"../attempt-locator.ts\";\nimport type { SealedAttemptAssertions } from \"../assertions/api.ts\";\nimport type { AssertionsProducerError } from \"../assertions/record/producer.ts\";\nimport { NiceEvalRecordAttachments } from \"../record/family/catalog.ts\";\nimport { recordHost } from \"../record/host/runtime.ts\";\nimport { discardAttemptWriteSession, stagePlanningReference, writerGenerationForRunSession } from \"../record/host/sqlite-host.ts\";\nimport type { AttemptWriteSession, RecordSealReceipt, RunWriteSession, } from \"../record/host/types.ts\";\nimport type { RunId, SlotId, } from \"../record/model/identifiers.ts\";\nimport type { AssertionEntryId } from \"../assertions/identity.ts\";\nimport { recordRootPaths, type RecordRoot } from \"../record/platform/root.ts\";\nimport { attemptPublicationClosure } from \"../record/codec/core.ts\";\nimport { RecordRootInvalid } from \"../record/platform/errors.ts\";\nimport { recordSqlitePath } from \"../record/sqlite/index.ts\";\nimport type { ProjectStateDatabase } from \"../record/sqlite/project-state-database.ts\";\nimport type { RecordReaderOpenError, RecordReaderReadError, } from \"../record/reader/errors.ts\";\nimport type { RecordWriteError } from \"../record/writer/types.ts\";\nimport { bindAttemptReference, closeRunResource, currentPublicationCutoff, publishOriginAttempt, createRunWriterGeneration, type PublicationCutoff, type RunAbsenceReason, } from \"../run/storage/index.ts\";\nimport { cacheKey } from \"./fingerprint.ts\";\nimport { planProjectTargetReuse, planProjectTargetReuseWithoutSources, type ExecutionReusePlan, type ExecutionReusePlanSlot, type ProjectTargetReusePlanInvalid, type TargetRun, } from \"./reuse-plan.ts\";\nimport { readCurrentExecutionReusePlanReadbacks, readCurrentExecutionReusePlanResults, type CurrentReusedAttemptReadback, type CurrentReuseReadback, type CurrentReuseReadbackPlanInvalid, } from \"./reuse-readback.ts\";\nimport { createRunnerTurnContextsAttachment, createRunnerSourceWritePlan, type RunnerSourceProducerInvalid, } from \"./source-producer.ts\";\nimport { createAttemptArtifactsAttachment, createAttemptFileChangesAttachment, createAttemptObservabilityAttachments, createRunArtifactsAttachment, createRunnerAssertionsAttachment, createRunObservabilityAttachments, recordAttemptOutcome, } from \"./record/attachments.ts\";\nimport { adapterUsageForResult } from \"./adapter-usage.ts\";\nimport { adapterAttachmentsForResult, releaseAdapterAttachments } from \"./adapter-attachments.ts\";\nimport { adapterExecutionTracesForResult, validateExecutionTracePublication, } from \"./adapter-execution-trace.ts\";\nimport { executionTracesRecordCollection } from \"../record/family/execution-traces/definition.ts\";\nimport { planRunnerRecordRun, previewRunnerRunId, runnerRecordSlotKey, runnerRecordUtcMillis, targetForRunnerRecordRun, type PlannedRunnerRecordRun, type RunnerRecordReuseInput, type RunnerRecordTargetIdentityInvalid, type RunnerRecordTargetInputMissing, } from \"./record/planning.ts\";\nimport type { AgentRun, Attempt, DiscoveredEval, EvalResult, } from \"./types.ts\";\nimport type { AttemptCostAttachment } from \"../record/family/attempt-cost/definition.ts\";\nimport { getPricingEstimateReceipt } from \"./pricing-estimate-receipt.ts\";\nimport type { SessionTracker } from \"./session.ts\";\nexport { prepareRunnerRecordReuse, type RunnerRecordReuseInput, type RunnerRecordReusePreparationInput, type RunnerRecordReuseSlotInput, type RunnerRecordTargetIdentityInvalid, type RunnerRecordTargetInputMissing, } from \"./record/planning.ts\";\ntype GapActionState = \"pending\" | \"reserved\" | \"executed\" | \"not-dispatched\" | \"interrupted\";\ninterface ActiveRunnerRecordAttempt {\n readonly attempt: Attempt;\n readonly session: AttemptWriteSession;\n readonly public: RunnerRecordAttempt;\n sealed?: SealedAttemptAssertions;\n result?: EvalResult;\n assertionEntryIds?: readonly AssertionEntryId[];\n completed: boolean;\n}\ninterface RunnerRecordRun extends PlannedRunnerRecordRun {\n readonly session: RunWriteSession;\n readonly target: TargetRun;\n readonly attempts: Map<SlotId, ActiveRunnerRecordAttempt>;\n readonly planSlots: Map<SlotId, ExecutionReusePlanSlot>;\n readonly gapActions: Map<SlotId, GapActionState>;\n readonly writerGeneration: string;\n}\nexport interface RunnerRecordAttempt {\n readonly slotId: SlotId;\n readonly attemptId: import(\"../record/model/identifiers.ts\").AttemptId;\n readonly locator: AttemptLocator;\n}\nexport type RecordAttemptLocator = AttemptLocator;\nfunction createAttemptCostAttachment(result: EvalResult): AttemptCostAttachment {\n const receipt = getPricingEstimateReceipt(result);\n return Object.freeze({\n ...(result.usage?.costUSD === undefined ? {} : {\n observed: Object.freeze({ kind: \"observed\" as const, amountUSD: result.usage.costUSD }),\n }),\n ...(receipt === undefined ? {} : {\n estimated: Object.freeze({\n kind: \"estimated\" as const,\n amountUSD: receipt.amountUSD,\n model: receipt.model,\n priceSource: receipt.priceSource,\n charges: receipt.charges,\n }),\n }),\n });\n}\nexport interface RunnerRecordAttemptInvalid {\n readonly code: \"runner-record-attempt-invalid\";\n}\nexport interface RunnerRecordUnsealedAttempt {\n readonly code: \"runner-record-attempt-unsealed\";\n readonly slotId: SlotId;\n}\nexport interface RunnerRecordMembershipStateInvalid {\n readonly code: \"runner-record-membership-state-invalid\";\n readonly slotId: SlotId;\n}\nexport interface RunnerRecordAttemptPublicationFailed {\n readonly code: \"runner-record-attempt-publication-failed\";\n readonly locator: AttemptLocator;\n readonly cause: unknown;\n readonly message: string;\n}\n/** A seal return without its durable marker is never a publish receipt. */\nexport interface RunnerRecordPublishStateInvalid {\n readonly code: \"runner-record-publish-state-invalid\";\n readonly runId: RunId;\n}\nexport interface RunnerRecordAssertionsInvalid {\n readonly code: \"runner-record-assertions-invalid\";\n readonly issue: AssertionsProducerError;\n}\nexport interface RunnerRecordObservabilityInvalid {\n readonly code: \"runner-record-observability-invalid\";\n readonly owner: \"attempt\" | \"run\";\n readonly stage: \"capture\" | \"attachment\";\n}\nexport interface RunnerRecordSourcesInvalid {\n readonly code: \"runner-record-sources-invalid\";\n readonly issue: RunnerSourceProducerInvalid;\n}\nexport interface RunnerRecordArtifactsInvalid {\n readonly code: \"runner-record-artifacts-invalid\";\n readonly owner: \"attempt\" | \"run\";\n readonly reason: \"trace-serialization-failed\" | \"attachment-closure-invalid\";\n}\nexport type RunnerRecordWriteError = RecordWriteError | RunnerRecordAttemptInvalid | RunnerRecordUnsealedAttempt | RunnerRecordMembershipStateInvalid | RunnerRecordAttemptPublicationFailed | RunnerRecordPublishStateInvalid | RunnerRecordTargetIdentityInvalid | RunnerRecordAssertionsInvalid | RunnerRecordObservabilityInvalid | RunnerRecordSourcesInvalid | RunnerRecordArtifactsInvalid;\nexport type RunnerRecordOpenError = RecordReaderOpenError | RecordWriteError | RecordReaderReadError | ProjectTargetReusePlanInvalid | RunnerRecordTargetInputMissing | RunnerRecordTargetIdentityInvalid | RunnerRecordMembershipStateInvalid | RunnerSessionOpenFailed;\nexport interface RunnerSessionOpenFailed {\n readonly code: \"runner-session-open-failed\";\n readonly cause: unknown;\n}\nexport interface RunnerRecordCoordinator {\n readonly reusePlan: ExecutionReusePlan;\n readonly readCarriedResults: () => Effect.Effect<readonly CurrentReusedAttemptReadback[], RecordReaderReadError | CurrentReuseReadbackPlanInvalid>;\n readonly runIdsByExperiment: ReadonlyMap<string, string>;\n readonly publicationCutoff: () => Effect.Effect<PublicationCutoff, unknown, ProjectStateDatabase>;\n readonly carriedAttemptsByKey: ReadonlyMap<string, ReadonlySet<number>>;\n readonly adoptLatePublishedAttempt: (attempt: Attempt) => Effect.Effect<boolean, RecordReaderOpenError | RecordReaderReadError | ProjectTargetReusePlanInvalid | RunnerRecordWriteError, import(\"effect\").Scope.Scope | import(\"../coordination/record-leases.ts\").RecordCoordination | ProjectStateDatabase>;\n readonly reserveAttempt: (attempt: Attempt) => Effect.Effect<RunnerRecordAttempt, RunnerRecordWriteError, ProjectStateDatabase>;\n readonly noteSealedOrMarkIncomplete: (attempt: Attempt, sealed: SealedAttemptAssertions) => Effect.Effect<void, never>;\n readonly completeAttemptOrMarkIncomplete: (attempt: Attempt, result: EvalResult) => Effect.Effect<RunnerRecordAttempt | undefined, never, ProjectStateDatabase>;\n readonly markNotDispatched: (attempt: Attempt) => void;\n readonly publish: (completedAt: number, mode: \"normal\" | \"interrupted\") => Effect.Effect<readonly RecordSealReceipt[], RunnerRecordWriteError, ProjectStateDatabase>;\n}\n/** Current preview preserves the read Scope and never creates a Run row. */\nexport function withRunnerCurrentReusePreview<A, E, R>(input: {\n readonly recordRoot: RecordRoot;\n readonly startedAt: number;\n readonly evals: readonly DiscoveredEval[];\n readonly runs: readonly AgentRun[];\n readonly reuse: RunnerRecordReuseInput;\n readonly use: (preview: {\n readonly reusePlan: ExecutionReusePlan;\n readonly readReadbacks: () => Effect.Effect<readonly CurrentReuseReadback[], RecordReaderReadError | CurrentReuseReadbackPlanInvalid>;\n }) => Effect.Effect<A, E, R>;\n}): Effect.Effect<A, E | RunnerRecordOpenError, R | import(\"effect\").Scope.Scope | import(\"../coordination/record-leases.ts\").RecordCoordination | ProjectStateDatabase> {\n return Effect.scoped(Effect.gen(function* () {\n const startedAt = runnerRecordUtcMillis(input.startedAt);\n if (Result.isFailure(startedAt))\n return yield* Effect.fail(startedAt.failure);\n const planned = yield* Effect.forEach(input.runs, (run) => planRunnerRecordRun({\n run,\n evals: input.evals,\n reuse: input.reuse,\n }), { concurrency: 1 });\n const previewRuns: TargetRun[] = [];\n for (const plan of planned) {\n const runId = previewRunnerRunId(plan.run);\n if (Result.isFailure(runId))\n return yield* Effect.fail(runId.failure);\n previewRuns.push(targetForRunnerRecordRun({ planned: plan, runId: runId.success, startedAt: startedAt.success }));\n }\n const target = Object.freeze({\n invocationId: `preview-${createHash(\"sha256\").update(String(input.startedAt), \"utf8\").digest(\"hex\")}`,\n runs: Object.freeze(previewRuns),\n });\n const rootPath = recordRootPaths(input.recordRoot)?.portableRoot;\n if (rootPath === undefined)\n return yield* Effect.fail(new RecordRootInvalid({ code: \"record-root-invalid\" }));\n const recordDatabase = recordSqlitePath(rootPath);\n if (!existsSync(recordDatabase)) {\n const reusePlan = yield* planProjectTargetReuseWithoutSources({ target, policy: input.reuse.policy });\n return yield* input.use({\n reusePlan,\n readReadbacks: () => Effect.succeed(Object.freeze([])),\n });\n }\n const { reusePlan, readbacks } = yield* Effect.scoped(Effect.gen(function* () {\n const reader = yield* recordHost.openRead({ root: input.recordRoot });\n const reusePlan = yield* planProjectTargetReuse({ reader, target, policy: input.reuse.policy });\n const readbacks = yield* readCurrentExecutionReusePlanReadbacks({ reader, plan: reusePlan }).pipe(Effect.mapError((cause): RunnerSessionOpenFailed => ({ code: \"runner-session-open-failed\", cause })));\n return { reusePlan, readbacks };\n }));\n return yield* input.use({\n reusePlan,\n readReadbacks: () => Effect.succeed(readbacks),\n });\n }));\n}\nfunction attemptInvalid(): RunnerRecordAttemptInvalid {\n return Object.freeze({ code: \"runner-record-attempt-invalid\" as const });\n}\nfunction unsealedAttempt(slotId: SlotId): RunnerRecordUnsealedAttempt {\n return Object.freeze({ code: \"runner-record-attempt-unsealed\" as const, slotId });\n}\nfunction membershipStateInvalid(slotId: SlotId): RunnerRecordMembershipStateInvalid {\n return Object.freeze({ code: \"runner-record-membership-state-invalid\" as const, slotId });\n}\nfunction attemptPublicationFailed(locator: AttemptLocator, cause: unknown): RunnerRecordAttemptPublicationFailed {\n const detail = cause instanceof Error\n ? cause.message\n : typeof cause === \"object\" && cause !== null && typeof Reflect.get(cause, \"message\") === \"string\"\n ? String(Reflect.get(cause, \"message\"))\n : typeof cause === \"object\" && cause !== null && typeof Reflect.get(cause, \"code\") === \"string\"\n ? String(Reflect.get(cause, \"code\"))\n : String(cause);\n return Object.freeze({\n code: \"runner-record-attempt-publication-failed\" as const,\n locator,\n cause,\n message: `Attempt publication failed for ${locator}: ${detail}`,\n });\n}\nfunction publishStateInvalid(runId: RunId): RunnerRecordPublishStateInvalid {\n return Object.freeze({ code: \"runner-record-publish-state-invalid\" as const, runId });\n}\n/**\n * Opens one new per-Experiment Run session, selects only sealed historical\n * Runs, and writes carry references before dispatch. No global Record writer\n * lock or superseded draft/attachment contract participates in this boundary.\n */\nexport function openRunnerRecordCoordinator(input: {\n readonly recordRoot: RecordRoot;\n readonly startedAt: number;\n readonly evals: readonly DiscoveredEval[];\n readonly runs: readonly AgentRun[];\n readonly reuse: RunnerRecordReuseInput;\n readonly session?: SessionTracker;\n}): Effect.Effect<RunnerRecordCoordinator, RunnerRecordOpenError, import(\"effect\").Scope.Scope | import(\"../record/platform/services.ts\").RecordEntropy | import(\"../coordination/record-leases.ts\").RecordCoordination | ProjectStateDatabase> {\n return Effect.gen(function* () {\n const rootPath = recordRootPaths(input.recordRoot)?.portableRoot;\n if (rootPath === undefined)\n return yield* Effect.fail(new RecordRootInvalid({ code: \"record-root-invalid\" }));\n const seenExperiments = new Set<string>();\n for (const run of input.runs) {\n if (seenExperiments.has(run.experimentId)) {\n return yield* Effect.fail({\n code: \"runner-record-target-identity-invalid\" as const,\n kind: \"invocation\" as const,\n value: `duplicate experimentId ${JSON.stringify(run.experimentId)}`,\n });\n }\n seenExperiments.add(run.experimentId);\n }\n const startedAt = runnerRecordUtcMillis(input.startedAt);\n if (Result.isFailure(startedAt))\n return yield* Effect.fail(startedAt.failure);\n const planned = yield* Effect.forEach(input.runs, (run) => planRunnerRecordRun({\n run,\n evals: input.evals,\n reuse: input.reuse,\n }), { concurrency: 1 });\n const invocationId = input.session?.sessionId ?? createHash(\"sha256\")\n .update(`${input.startedAt}\\u0000${planned.map((entry) => entry.run.experimentId).join(\"\\u0000\")}`, \"utf8\")\n .digest(\"hex\");\n const openedRuns = yield* Effect.forEach(planned, (plan) => recordHost.createRun({\n root: input.recordRoot,\n experimentId: plan.experimentId,\n context: plan.context,\n startedAt: startedAt.success,\n expectedSlots: plan.expectedSlots,\n writerGeneration: createRunWriterGeneration(`${invocationId}:${plan.experimentId}`),\n }).pipe(Effect.map((session) => {\n const writerGeneration = writerGenerationForRunSession(session);\n if (writerGeneration === undefined)\n throw new Error(\"Run writer generation is unavailable\");\n return Object.freeze({ plan, session, writerGeneration });\n })), { concurrency: 1 });\n if (input.session !== undefined) {\n const startedAtIso = new Date(input.startedAt).toISOString();\n yield* input.session.start({\n runIds: new Map(openedRuns.map(({ plan, session }) => [plan.experimentId, String(session.runId)])),\n agentRuns: input.runs,\n startedAt: startedAtIso,\n invocationRuns: openedRuns.map(({ plan, session, writerGeneration }) => ({\n runId: String(session.runId),\n experimentId: plan.experimentId,\n writerGeneration,\n startedAt: startedAtIso,\n expectedSlots: plan.expectedSlots.map((slot) => ({\n slotId: String(slot.slotId), evalId: String(slot.evalId), attemptOrdinal: slot.attemptOrdinal,\n executionIdentityDigest: String(slot.executionIdentityDigest),\n })),\n })),\n }).pipe(Effect.mapError((cause): RunnerSessionOpenFailed => ({ code: \"runner-session-open-failed\", cause })));\n }\n const byRun = new Map<AgentRun, RunnerRecordRun>();\n const byRecordRunId = new Map<RunId, RunnerRecordRun>();\n const runIdsByExperiment = new Map<string, string>();\n const targetRuns: TargetRun[] = [];\n for (const { plan, session, writerGeneration } of openedRuns) {\n const target = targetForRunnerRecordRun({\n planned: plan,\n runId: session.runId,\n startedAt: startedAt.success,\n });\n const recordRun: RunnerRecordRun = {\n ...plan,\n session,\n target,\n attempts: new Map(),\n planSlots: new Map(),\n gapActions: new Map(),\n writerGeneration,\n };\n byRun.set(plan.run, recordRun);\n byRecordRunId.set(session.runId, recordRun);\n runIdsByExperiment.set(plan.run.experimentId, session.runId);\n targetRuns.push(target);\n }\n const target = Object.freeze({\n invocationId,\n runs: Object.freeze(targetRuns),\n });\n const { reusePlan, carriedResults } = yield* Effect.scoped(Effect.gen(function* () {\n const reader = yield* recordHost.openRead({ root: input.recordRoot });\n const reusePlan = yield* planProjectTargetReuse({ reader, target, policy: input.reuse.policy });\n const carriedResults = yield* readCurrentExecutionReusePlanResults({ reader, plan: reusePlan }).pipe(Effect.mapError((cause): RunnerSessionOpenFailed => ({ code: \"runner-session-open-failed\", cause })));\n return { reusePlan, carriedResults };\n }));\n const carriedAttemptsByKey = new Map<string, Set<number>>();\n for (const slot of reusePlan.slots) {\n const recordRun = byRecordRunId.get(slot.runId);\n if (recordRun === undefined)\n return yield* Effect.fail(membershipStateInvalid(slot.slotId));\n recordRun.planSlots.set(slot.slotId, slot);\n if (slot.state === \"reuse\") {\n yield* stagePlanningReference(recordRun.session, {\n slotId: slot.slotId,\n action: \"carried\",\n reference: slot.source.reference,\n });\n yield* bindAttemptReference(rootPath, {\n runId: String(recordRun.session.runId),\n writerGeneration: recordRun.writerGeneration,\n slotId: String(slot.slotId),\n action: \"carried\",\n publicationIdentity: slot.source.reference.publicationIdentity,\n deadlineEpochMs: Date.now() + 30000,\n }).pipe(Effect.mapError((cause): RunnerSessionOpenFailed => ({ code: \"runner-session-open-failed\", cause })));\n const entry = recordRun.slots.get(runnerRecordSlotKey(slot.evalId, slot.attempt));\n if (entry === undefined)\n return yield* Effect.fail(membershipStateInvalid(slot.slotId));\n const key = cacheKey(recordRun.run, entry.evalDef.id);\n const carried = carriedAttemptsByKey.get(key) ?? new Set<number>();\n carried.add(entry.attempt);\n carriedAttemptsByKey.set(key, carried);\n }\n else {\n recordRun.gapActions.set(slot.slotId, \"pending\");\n }\n }\n if (input.session !== undefined) {\n yield* input.session.applyCarriedAttempts(input.runs, carriedAttemptsByKey).pipe(Effect.mapError((cause): RunnerSessionOpenFailed => ({ code: \"runner-session-open-failed\", cause })));\n }\n let invocationWriteFailure: RunnerRecordWriteError | undefined;\n const writeFailuresByRun = new Map<RunnerRecordRun, RunnerRecordWriteError>();\n const noteFailure = (error: RunnerRecordWriteError, recordRun?: RunnerRecordRun): void => {\n if (recordRun === undefined) {\n if (invocationWriteFailure === undefined)\n invocationWriteFailure = error;\n return;\n }\n if (!writeFailuresByRun.has(recordRun))\n writeFailuresByRun.set(recordRun, error);\n };\n const lock = yield* Semaphore.make(1);\n const runForAttempt = (attempt: Attempt): RunnerRecordRun | undefined => byRun.get(attempt.run);\n const targetForAttempt = (attempt: Attempt): {\n readonly recordRun: RunnerRecordRun;\n readonly slotId: SlotId;\n readonly plan: ExecutionReusePlanSlot;\n } | undefined => {\n const recordRun = runForAttempt(attempt);\n if (recordRun === undefined)\n return undefined;\n const entry = recordRun.slots.get(runnerRecordSlotKey(attempt.evalDef.id, attempt.attempt));\n if (entry === undefined)\n return undefined;\n const plan = recordRun.planSlots.get(entry.slot.slotId);\n return plan === undefined ? undefined : { recordRun, slotId: entry.slot.slotId, plan };\n };\n const adoptLatePublishedAttempt = (attempt: Attempt) => lock.withPermits(1)(Effect.gen(function* () {\n const current = targetForAttempt(attempt);\n if (current === undefined\n || current.plan.state !== \"gap\"\n || current.recordRun.gapActions.get(current.slotId) !== \"pending\")\n return false;\n const refreshed = yield* Effect.scoped(Effect.gen(function* () {\n const freshReader = yield* recordHost.openRead({ root: input.recordRoot });\n return yield* planProjectTargetReuse({ reader: freshReader, target, policy: input.reuse.policy });\n }));\n const replacement = refreshed.slots.find((slot) => slot.runId === current.recordRun.target.runId && slot.slotId === current.slotId);\n if (replacement?.state !== \"reuse\")\n return false;\n yield* stagePlanningReference(current.recordRun.session, {\n slotId: current.slotId,\n action: \"carried\",\n reference: replacement.source.reference,\n });\n yield* bindAttemptReference(rootPath, {\n runId: String(current.recordRun.session.runId),\n writerGeneration: current.recordRun.writerGeneration,\n slotId: String(current.slotId),\n action: \"carried\",\n publicationIdentity: replacement.source.reference.publicationIdentity,\n deadlineEpochMs: Date.now() + 30000,\n }).pipe(Effect.mapError(() => publishStateInvalid(current.recordRun.session.runId)));\n current.recordRun.planSlots.set(current.slotId, replacement);\n current.recordRun.gapActions.delete(current.slotId);\n return true;\n }));\n const reserveAttempt = (attempt: Attempt): Effect.Effect<RunnerRecordAttempt, RunnerRecordWriteError, ProjectStateDatabase> => {\n const targetSlot = targetForAttempt(attempt);\n return lock.withPermits(1)(Effect.gen(function* () {\n if (targetSlot === undefined\n || targetSlot.plan.state !== \"gap\"\n || targetSlot.recordRun.gapActions.get(targetSlot.slotId) !== \"pending\") {\n return yield* Effect.fail(attemptInvalid());\n }\n const session = yield* targetSlot.recordRun.session.createAttempt({ slotId: targetSlot.slotId });\n const publicAttempt = Object.freeze({\n slotId: targetSlot.slotId,\n attemptId: session.attemptId,\n locator: encodeAttemptLocator(session.attemptId),\n });\n targetSlot.recordRun.attempts.set(targetSlot.slotId, {\n attempt,\n session,\n public: publicAttempt,\n completed: false,\n });\n targetSlot.recordRun.gapActions.set(targetSlot.slotId, \"reserved\");\n return publicAttempt;\n })).pipe(Effect.tapError((error) => Effect.sync(() => noteFailure(error, targetSlot?.recordRun ?? runForAttempt(attempt)))));\n };\n const noteSealedOrMarkIncomplete = (attempt: Attempt, sealed: SealedAttemptAssertions): Effect.Effect<void, never> => Effect.sync(() => {\n const targetSlot = targetForAttempt(attempt);\n const active = targetSlot === undefined\n ? undefined\n : targetSlot.recordRun.attempts.get(targetSlot.slotId);\n if (targetSlot === undefined\n || targetSlot.plan.state !== \"gap\"\n || targetSlot.recordRun.gapActions.get(targetSlot.slotId) !== \"reserved\"\n || active === undefined\n || active.attempt !== attempt\n || active.sealed !== undefined) {\n noteFailure(attemptInvalid(), targetSlot?.recordRun ?? runForAttempt(attempt));\n return;\n }\n active.sealed = sealed;\n });\n const completeAttempt = (attempt: Attempt, result: EvalResult): Effect.Effect<RunnerRecordAttempt, RunnerRecordWriteError, ProjectStateDatabase> => Effect.suspend<RunnerRecordAttempt, RunnerRecordWriteError, ProjectStateDatabase>(() => {\n const targetSlot = targetForAttempt(attempt);\n const active = targetSlot === undefined\n ? undefined\n : targetSlot.recordRun.attempts.get(targetSlot.slotId);\n if (targetSlot === undefined\n || targetSlot.plan.state !== \"gap\"\n || targetSlot.recordRun.gapActions.get(targetSlot.slotId) !== \"reserved\"\n || active === undefined\n || active.attempt !== attempt\n || active.completed) {\n return Effect.fail(attemptInvalid());\n }\n const assertions = active.sealed === undefined\n ? undefined\n : createRunnerAssertionsAttachment(active.sealed);\n if (assertions !== undefined && Result.isFailure(assertions))\n return Effect.fail(assertions.failure);\n if (active.sealed === undefined || assertions === undefined || Result.isFailure(assertions)) {\n return Effect.fail(membershipStateInvalid(targetSlot.slotId));\n }\n return Effect.gen(function* () {\n const sourcePlan = createRunnerSourceWritePlan([Object.freeze({\n slotId: targetSlot.slotId,\n result,\n assertionEntryIds: assertions.success.entryIds,\n })]);\n if (Result.isFailure(sourcePlan)) {\n return yield* Effect.fail(Object.freeze({\n code: \"runner-record-sources-invalid\" as const,\n issue: sourcePlan.failure,\n }));\n }\n const closedAssertions = createRunnerAssertionsAttachment(active.sealed!, {\n entryIds: assertions.success.entryIds,\n sourceSites: sourcePlan.success.sourceSitesBySlot.get(targetSlot.slotId),\n });\n if (Result.isFailure(closedAssertions))\n return yield* Effect.fail(closedAssertions.failure);\n yield* active.session.records.write(NiceEvalRecordAttachments.assertions, closedAssertions.success.attachment);\n yield* active.session.records.write(NiceEvalRecordAttachments.attemptCost, createAttemptCostAttachment(result));\n const sourceReceipts = yield* createAttemptObservabilityAttachments({ result, sealed: active.sealed! });\n if (sourceReceipts.agentTurns !== undefined) {\n yield* active.session.records.write(NiceEvalRecordAttachments.agentTurns, sourceReceipts.agentTurns);\n }\n if (sourceReceipts.sandboxCommands !== undefined) {\n yield* active.session.records.write(NiceEvalRecordAttachments.sandboxCommands, sourceReceipts.sandboxCommands);\n }\n yield* active.session.records.write(NiceEvalRecordAttachments.runnerActivities.attempt, sourceReceipts.runnerActivities);\n yield* active.session.records.write(NiceEvalRecordAttachments.runnerDiagnostics.attempt, sourceReceipts.runnerDiagnostics);\n const turnContexts = createRunnerTurnContextsAttachment({ result, sourcePlan: sourcePlan.success });\n if (Result.isFailure(turnContexts)) {\n return yield* Effect.fail(Object.freeze({\n code: \"runner-record-sources-invalid\" as const,\n issue: turnContexts.failure,\n }));\n }\n if (turnContexts.success !== undefined) {\n yield* active.session.records.write(NiceEvalRecordAttachments.turnContexts, turnContexts.success);\n }\n const fileChanges = createAttemptFileChangesAttachment(result);\n if (fileChanges !== undefined) {\n yield* active.session.records.write(NiceEvalRecordAttachments.fileChanges, fileChanges);\n }\n const attachmentSnapshot = adapterAttachmentsForResult(result);\n const artifacts = createAttemptArtifactsAttachment(result, attachmentSnapshot);\n const judgeUsage = judgeUsageForResult(result, closedAssertions.success.entryIds);\n if (judgeUsage !== undefined)\n yield* active.session.records.write(NiceEvalRecordAttachments.judgeUsage, judgeUsage);\n const adapterUsage = adapterUsageForResult(result);\n const executionTraces = adapterExecutionTracesForResult(result);\n if (adapterUsage !== undefined) {\n yield* active.session.records.write(NiceEvalRecordAttachments.adapterUsage, adapterUsage);\n }\n if (artifacts !== undefined) {\n yield* active.session.records.write(NiceEvalRecordAttachments.artifacts.attempt, artifacts);\n }\n if (executionTraces !== undefined && executionTraces.traces.length > 0) {\n validateExecutionTracePublication(executionTraces, attachmentSnapshot?.artifacts ?? []);\n yield* active.session.records.appendAll(executionTracesRecordCollection, Stream.fromIterable(executionTraces.traces.flatMap((trace) => trace.records)));\n yield* active.session.records.close(executionTracesRecordCollection, executionTraces.failure === undefined\n ? { state: \"complete\" }\n : {\n state: \"partial\",\n limitations: [{ code: \"capture-failed\", stage: \"adapter\" }],\n });\n }\n yield* active.session.complete(recordAttemptOutcome(result));\n const closureBytes = new TextEncoder().encode(JSON.stringify(attemptPublicationClosure(Object.freeze({\n runId: String(targetSlot.recordRun.session.runId),\n experimentId: targetSlot.recordRun.experimentId,\n context: targetSlot.recordRun.context,\n startedAt: targetSlot.recordRun.target.startedAt,\n completedAt: Date.now(),\n expectedSlots: targetSlot.recordRun.expectedSlots,\n }))));\n yield* publishOriginAttempt(rootPath, {\n runId: String(targetSlot.recordRun.session.runId),\n writerGeneration: targetSlot.recordRun.writerGeneration,\n slotId: String(targetSlot.slotId),\n attemptId: String(active.public.attemptId),\n attemptLocator: String(active.public.locator),\n closureBytes,\n closureDigest: createHash(\"sha256\").update(closureBytes).digest(\"hex\"),\n deadlineEpochMs: Date.now() + 30000,\n }).pipe(Effect.mapError((cause) => attemptPublicationFailed(active.public.locator, cause)));\n active.result = result;\n active.assertionEntryIds = assertions.success.entryIds;\n active.completed = true;\n targetSlot.recordRun.gapActions.set(targetSlot.slotId, \"executed\");\n return active.public;\n });\n });\n const attachRunFacts = (recordRun: RunnerRecordRun, mode: \"normal\" | \"interrupted\"): Effect.Effect<void, RunnerRecordWriteError> => Effect.gen(function* () {\n const writeRecord = (effect: Effect.Effect<void, RecordWriteError, never>): Effect.Effect<void, RecordWriteError, never> => effect;\n const origins = [] as {\n readonly slotId: SlotId;\n readonly active: ActiveRunnerRecordAttempt;\n readonly result: EvalResult;\n readonly sealed: SealedAttemptAssertions;\n readonly assertionEntryIds: readonly AssertionEntryId[];\n }[];\n for (const [slotId, state] of recordRun.gapActions) {\n if (state !== \"executed\")\n continue;\n const active = recordRun.attempts.get(slotId);\n if (active === undefined)\n return yield* Effect.fail(membershipStateInvalid(slotId));\n const result = active.result;\n const sealed = active?.sealed;\n const assertionEntryIds = active?.assertionEntryIds;\n if (result === undefined || sealed === undefined || assertionEntryIds === undefined)\n continue;\n origins.push(Object.freeze({ slotId, active, result, sealed, assertionEntryIds }));\n }\n const sources = createRunnerSourceWritePlan(origins.map(({ slotId, result, assertionEntryIds }) => Object.freeze({\n slotId,\n result,\n assertionEntryIds,\n })));\n if (Result.isFailure(sources)) {\n return yield* Effect.fail(Object.freeze({\n code: \"runner-record-sources-invalid\" as const,\n issue: sources.failure,\n }));\n }\n yield* writeRecord(recordRun.session.records.write(NiceEvalRecordAttachments.sources, sources.success.sources));\n const sourceReceipts = yield* createRunObservabilityAttachments(recordRun.run);\n if (sourceReceipts.runnerActivities !== undefined) {\n yield* writeRecord(recordRun.session.records.write(NiceEvalRecordAttachments.runnerActivities.run, sourceReceipts.runnerActivities));\n }\n if (sourceReceipts.runnerDiagnostics !== undefined) {\n yield* writeRecord(recordRun.session.records.write(NiceEvalRecordAttachments.runnerDiagnostics.run, sourceReceipts.runnerDiagnostics));\n }\n yield* writeRecord(recordRun.session.records.write(NiceEvalRecordAttachments.artifacts.run, createRunArtifactsAttachment()));\n });\n const pendingGap = (recordRun: RunnerRecordRun): SlotId | undefined => {\n for (const [slotId, state] of recordRun.gapActions) {\n if (state === \"pending\")\n return slotId;\n }\n return undefined;\n };\n return Object.freeze({\n reusePlan,\n readCarriedResults: () => Effect.succeed(carriedResults),\n runIdsByExperiment: new Map(runIdsByExperiment),\n publicationCutoff: () => currentPublicationCutoff(rootPath),\n carriedAttemptsByKey: new Map([...carriedAttemptsByKey].map(([key, attempts]) => [key, new Set(attempts)] as const)),\n adoptLatePublishedAttempt,\n reserveAttempt,\n noteSealedOrMarkIncomplete,\n completeAttemptOrMarkIncomplete: (attempt: Attempt, result: EvalResult) => completeAttempt(attempt, result).pipe(Effect.catch((error) => Effect.sync(() => {\n const target = targetForAttempt(attempt);\n const active = target === undefined ? undefined : target.recordRun.attempts.get(target.slotId);\n noteFailure(error.code === \"runner-record-assertions-invalid\" ||\n error.code === \"runner-record-attempt-publication-failed\" ||\n active === undefined\n ? error\n : attemptPublicationFailed(active.public.locator, error), target?.recordRun ?? runForAttempt(attempt));\n return undefined;\n })), Effect.ensuring(Effect.promise(() => releaseAdapterAttachments(result)))),\n markNotDispatched: (attempt: Attempt) => {\n const targetSlot = targetForAttempt(attempt);\n if (targetSlot !== undefined\n && targetSlot.plan.state === \"gap\"\n && targetSlot.recordRun.gapActions.get(targetSlot.slotId) === \"pending\") {\n targetSlot.recordRun.gapActions.set(targetSlot.slotId, \"not-dispatched\");\n }\n },\n publish: (completedAt: number, mode: \"normal\" | \"interrupted\") => Effect.gen(function* () {\n const recordRuns = [...byRun.values()];\n if (invocationWriteFailure !== undefined)\n return yield* Effect.fail(invocationWriteFailure);\n if (mode === \"normal\") {\n // A normal finish remains invocation-strict: a failure which can be\n // attributed to one Run still fails the call rather than allowing a\n // partial receipt to disguise it as ordinary completion.\n for (const recordRun of recordRuns) {\n const failure = writeFailuresByRun.get(recordRun);\n if (failure !== undefined)\n return yield* Effect.fail(failure);\n }\n }\n const completion = runnerRecordUtcMillis(completedAt);\n if (Result.isFailure(completion))\n return yield* Effect.fail(completion.failure);\n // A controlled interruption closes every reserved Attempt as\n // `interrupted` and every never-started gap as an interrupted terminal\n // Member. Only a Run-local writer failure remains non-publishable.\n // Abrupt process loss still has no opportunity to create `complete`.\n const incompleteRuns = mode === \"interrupted\"\n ? new Set(recordRuns.filter((recordRun) => writeFailuresByRun.has(recordRun)))\n : new Set<RunnerRecordRun>();\n if (mode === \"normal\") {\n // Normal completion is deliberately invocation-strict. A pending\n // gap means the scheduler failed to account for a Slot; a reserved\n // or otherwise unsettled Attempt is likewise not publishable.\n for (const recordRun of recordRuns) {\n const unsettledSlot = [...recordRun.gapActions.keys()].find((slotId) => {\n const active = recordRun.attempts.get(slotId);\n return recordRun.gapActions.get(slotId) === \"reserved\"\n || (active !== undefined && !active.completed);\n });\n if (unsettledSlot !== undefined)\n return yield* Effect.fail(unsealedAttempt(unsettledSlot));\n const unaccountedSlot = pendingGap(recordRun);\n if (unaccountedSlot !== undefined)\n return yield* Effect.fail(unsealedAttempt(unaccountedSlot));\n }\n }\n else {\n for (const recordRun of recordRuns) {\n if (incompleteRuns.has(recordRun))\n continue;\n for (const [slotId, state] of recordRun.gapActions) {\n if (state === \"pending\")\n recordRun.gapActions.set(slotId, \"interrupted\");\n if (state === \"reserved\") {\n const active = recordRun.attempts.get(slotId);\n if (active === undefined)\n return yield* Effect.fail(membershipStateInvalid(slotId));\n yield* discardAttemptWriteSession(active.session);\n recordRun.attempts.delete(slotId);\n recordRun.gapActions.set(slotId, \"interrupted\");\n }\n }\n }\n }\n const publishableRuns = recordRuns.filter((recordRun) => !incompleteRuns.has(recordRun));\n const publishOne = (recordRun: RunnerRecordRun): Effect.Effect<RecordSealReceipt, RunnerRecordWriteError, ProjectStateDatabase> => Effect.gen(function* () {\n yield* attachRunFacts(recordRun, mode);\n for (const [slotId, state] of recordRun.gapActions) {\n if (state === \"not-dispatched\" || state === \"interrupted\") {\n const absenceReason: RunAbsenceReason = mode === \"interrupted\"\n ? \"interrupted-before-publication\"\n : state === \"not-dispatched\"\n ? \"early-exit-satisfied\"\n : \"dispatch-failed\";\n yield* recordRun.session.recordTerminalMember({ slotId, action: state, absenceReason });\n }\n }\n const sealed = yield* recordRun.session.seal({ completedAt: completion.success });\n const absences = [...recordRun.gapActions].flatMap(([slotId, state]) => {\n if (state === \"executed\" && recordRun.attempts.get(slotId)?.completed === true)\n return [];\n const reason: RunAbsenceReason = mode === \"interrupted\"\n ? \"interrupted-before-publication\"\n : state === \"not-dispatched\"\n ? \"early-exit-satisfied\"\n : \"dispatch-failed\";\n return [{ slotId: String(slotId), reason }];\n });\n yield* closeRunResource(rootPath, {\n runId: String(recordRun.session.runId),\n writerGeneration: recordRun.writerGeneration,\n state: mode === \"interrupted\" ? \"interrupted\" : \"completed\",\n completedAt: new Date(completedAt).toISOString(),\n absences,\n deadlineEpochMs: Date.now() + 30000,\n }).pipe(Effect.mapError(() => publishStateInvalid(recordRun.session.runId)));\n return sealed;\n });\n if (mode === \"normal\") {\n // Normal completion remains typed and strict: the first Run failure\n // is an invocation failure, never a partial success receipt.\n return yield* Effect.forEach(publishableRuns, publishOne, { concurrency: 1 });\n }\n // SIGINT is different: each clean sibling receives its own complete\n // attempt. We deliberately observe an Exit per Run so one Attachment\n // or seal error cannot short-circuit subsequent safe siblings.\n const receipts: RecordSealReceipt[] = [];\n for (const recordRun of publishableRuns) {\n const exit = yield* Effect.exit(publishOne(recordRun));\n if (Exit.isSuccess(exit)) {\n receipts.push(exit.value);\n }\n else {\n const failure = Cause.findErrorOption(exit.cause);\n if (Option.isSome(failure)) {\n noteFailure(failure.value, recordRun);\n }\n else {\n noteFailure(publishStateInvalid(recordRun.session.runId), recordRun);\n }\n }\n }\n return Object.freeze(receipts);\n }),\n });\n });\n}\n"]}
|
|
@@ -157,13 +157,11 @@ function renameExperiment(input) {
|
|
|
157
157
|
const root = yield* (0, adoption_ts_1.adoptionRecordRoot)({ cwd: input.cwd });
|
|
158
158
|
const startedAt = yield* (0, adoption_ts_1.adoptionStartedAt)(input.now);
|
|
159
159
|
const project = yield* (0, adoption_ts_1.loadAdoptionProject)(projectInput(input));
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
oldId: preflight.source.sourceRun.experimentId, newId: input.newId, preflight, receipt });
|
|
166
|
-
}) });
|
|
160
|
+
const preflight = yield* (0, adoption_ts_1.withAdoptionReader)({ root, use: (reader) => prepare(input, reader, project, startedAt) });
|
|
161
|
+
const invocationId = yield* (0, adoption_ts_1.createExplicitAdoptionInvocationId)();
|
|
162
|
+
const receipt = yield* (0, adoption_ts_1.commitExplicitAdoptionRunPlans)(root, invocationId, [preflight.plan]);
|
|
163
|
+
return yield* renamedReceipt({ invocationId, sourceRunId: input.sourceRunId,
|
|
164
|
+
oldId: preflight.source.sourceRun.experimentId, newId: input.newId, preflight, receipt });
|
|
167
165
|
});
|
|
168
166
|
}
|
|
169
167
|
//# sourceMappingURL=rename-experiment.cjs.map
|