niceeval 0.13.4-canary.48 → 0.14.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/INDEX.md +3 -3
- package/dist/experiment/host/operations.cjs +58 -0
- package/dist/experiment/host/operations.cjs.map +1 -1
- package/dist/inspection/overview.cjs +20 -9
- package/dist/inspection/overview.cjs.map +1 -1
- package/dist/inspection/overview.d.cts +5 -0
- package/dist/inspection/overview.d.mts +5 -0
- package/dist/inspection/overview.d.ts +5 -0
- package/dist/inspection/protocol.d.cts +238 -0
- package/dist/inspection/protocol.d.mts +238 -0
- package/dist/inspection/protocol.d.ts +238 -0
- package/dist/inspection/public.mjs +43 -19
- package/dist/inspection/results.cjs +11 -10
- package/dist/inspection/results.cjs.map +1 -1
- package/dist/inspection/results.d.cts +34 -0
- package/dist/inspection/results.d.mts +34 -0
- package/dist/inspection/results.d.ts +34 -0
- package/dist/record/attachment/protocol.cjs +10 -5
- package/dist/record/attachment/protocol.cjs.map +1 -1
- package/dist/record/attachment/protocol.d.cts +4 -0
- package/dist/record/attachment/protocol.d.mts +4 -0
- package/dist/record/attachment/protocol.d.ts +4 -0
- package/dist/record/family/source-receipt/index.cjs +16 -3
- package/dist/record/family/source-receipt/index.cjs.map +1 -1
- package/dist/record/family/source-receipt/index.d.cts +1 -0
- package/dist/record/family/source-receipt/index.d.mts +1 -0
- package/dist/record/family/source-receipt/index.d.ts +1 -0
- package/dist/record/family/source-receipt/index.js +2 -0
- package/dist/record/host/sqlite-host.cjs +3 -0
- package/dist/record/host/sqlite-host.cjs.map +1 -1
- package/dist/record/host/types.cjs.map +1 -1
- package/dist/record/host/types.d.cts +3 -1
- package/dist/record/host/types.d.mts +3 -1
- package/dist/record/host/types.d.ts +3 -1
- package/dist/record/sqlite/storage.cjs +11 -8
- package/dist/record/sqlite/storage.cjs.map +1 -1
- package/dist/record/writer/current-attachment.cjs +18 -13
- package/dist/record/writer/current-attachment.cjs.map +1 -1
- package/dist/record/writer/errors.cjs +6 -1
- package/dist/record/writer/errors.cjs.map +1 -1
- package/dist/record/writer/errors.d.cts +7 -1
- package/dist/record/writer/errors.d.mts +7 -1
- package/dist/record/writer/errors.d.ts +7 -1
- package/dist/runner/adoption.cjs +1 -1
- package/dist/runner/adoption.cjs.map +1 -1
- package/dist/runner/reuse-plan.cjs +1 -1
- package/dist/runner/reuse-plan.cjs.map +1 -1
- package/dist/runner/source-receipts/support.cjs +2 -1
- package/dist/runner/source-receipts/support.cjs.map +1 -1
- package/dist/runner/source-receipts/support.d.cts +1 -1
- package/dist/runner/source-receipts/support.d.mts +1 -1
- package/dist/runner/source-receipts/support.d.ts +1 -1
- package/dist/show/contribution.cjs +11 -2
- package/dist/show/contribution.cjs.map +1 -1
- package/dist/show/contribution.d.cts +7 -0
- package/dist/show/contribution.d.mts +7 -0
- package/dist/show/contribution.d.ts +7 -0
- package/dist/show/model.cjs +1 -0
- package/dist/show/model.cjs.map +1 -1
- package/dist/show/model.d.cts +2 -0
- package/dist/show/model.d.mts +2 -0
- package/dist/show/model.d.ts +2 -0
- package/dist/show/render.cjs +149 -81
- package/dist/show/render.cjs.map +1 -1
- package/dist/show/render.d.cts +3 -1
- package/dist/show/render.d.mts +3 -1
- package/dist/show/render.d.ts +3 -1
- package/dist/view/app-dist/.vite/manifest.json +18 -18
- package/dist/view/app-dist/assets/{AttemptDialog-DKEWcS7m.js → AttemptDialog-76dX1VQq.js} +1 -1
- package/dist/view/app-dist/assets/{AttemptRoute-DUs5kic4.js → AttemptRoute-DRHVh2JA.js} +1 -1
- package/dist/view/app-dist/assets/{ResultsPage-VlExJ6F0.js → ResultsPage-9CSI8dvZ.js} +2 -2
- package/dist/view/app-dist/assets/{RunPage-B9Bagswz.js → RunPage-BUF0REv7.js} +1 -1
- package/dist/view/app-dist/assets/{TableContentView-ZL9elUsA.js → TableContentView-_Sbg5wDr.js} +1 -1
- package/dist/view/app-dist/assets/index-BGr_6pGY.js +19 -0
- package/dist/view/app-dist/assets/{quality-cost-scatter-BqIAORD4.js → quality-cost-scatter-B5wDa_F1.js} +1 -1
- package/dist/view/app-dist/assets/useSuspenseQuery-D3W8Uy33.js +1 -0
- package/dist/view/app-dist/index.html +1 -1
- package/dist/view/function-runtime.mjs +68 -29
- package/docs-site/zh/examples/ai-agent-application.mdx +1 -1
- package/docs-site/zh/examples/index.mdx +1 -3
- package/docs-site/zh/explanation/evals.mdx +1 -1
- package/docs-site/zh/explanation/experiment.mdx +3 -1
- package/docs-site/zh/explanation/overview.mdx +6 -4
- package/docs-site/zh/explanation/record.mdx +9 -5
- package/docs-site/zh/explanation/runner.mdx +3 -3
- package/docs-site/zh/index.mdx +4 -8
- package/docs-site/zh/introduction.mdx +2 -2
- package/docs-site/zh/reference/cli.mdx +8 -7
- package/docs-site/zh/troubleshooting/debug-sandbox.mdx +5 -5
- package/docs-site/zh/troubleshooting/debugging.mdx +8 -8
- package/docs-site/zh/troubleshooting/recover-after-kill.mdx +35 -55
- package/docs-site/zh/tutorials/accept-results.mdx +4 -4
- package/docs-site/zh/tutorials/agent-onboarding.mdx +2 -2
- package/docs-site/zh/tutorials/authoring.mdx +1 -1
- package/docs-site/zh/tutorials/compare-runs.mdx +3 -3
- package/docs-site/zh/tutorials/concurrency.mdx +6 -6
- package/docs-site/zh/tutorials/connect-your-agent.mdx +2 -2
- package/docs-site/zh/tutorials/docker-in-docker.mdx +1 -1
- package/docs-site/zh/tutorials/experiments.mdx +1 -1
- package/docs-site/zh/tutorials/install-custom-sandbox-agent.mdx +1 -1
- package/docs-site/zh/tutorials/quickstart.mdx +2 -2
- package/docs-site/zh/tutorials/reporters.mdx +3 -3
- package/docs-site/zh/tutorials/sandbox-agent.mdx +2 -2
- package/docs-site/zh/tutorials/sandbox-reuse.mdx +3 -3
- package/docs-site/zh/tutorials/viewing-results.mdx +10 -11
- package/package.json +1 -1
- package/dist/view/app-dist/assets/index-C1E4NkG0.js +0 -19
- package/dist/view/app-dist/assets/useSuspenseQuery-BlFuYKyI.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":";;;AAea,QAAA,mBAAmB,GAAkB,MAAM,CAAC,iCAAiC,CAAC,CAAC;AAC/E,QAAA,uBAAuB,GAAkB,MAAM,CAAC,qCAAqC,CAAC,CAAC;AACvF,QAAA,qBAAqB,GAAkB,MAAM,CAAC,mCAAmC,CAAC,CAAC;AACnF,QAAA,oBAAoB,GAAkB,MAAM,CAAC,kCAAkC,CAAC,CAAC;AACjF,QAAA,wBAAwB,GAAkB,MAAM,CAAC,sCAAsC,CAAC,CAAC","sourcesContent":["import type { Effect, Schema, Stream } from \"effect\";\nimport type { ProjectStateDatabase } from \"../sqlite/project-state-database.ts\";\nimport type { RecordAttachmentCatalog, RecordAttachmentDefinition, } from \"../attachment/index.ts\";\nimport type { RecordContentHandle, RecordTextContentHandle, } from \"../attachment/content.ts\";\nimport type { AttachedContentError, AttachedContentRequirements, RecordAttachmentSessionBuilder, } from \"../writer/current-attachment.ts\";\nimport type { AttemptDocument, MemberDocument, RecordAttachmentOwner, RecordSlotIdentity, RunDocument, } from \"../model/core.ts\";\nimport type { RunContext } from \"../model/run-context.ts\";\nimport type { AttemptId, ExperimentId, RunId, SlotId, UtcMillis, } from \"../model/identifiers.ts\";\nimport type { RecordRoot } from \"../platform/root.ts\";\nimport type { RunAbsenceReason } from \"../../run/protocol.ts\";\nimport type { RecordAttachmentRead as ModelRecordAttachmentRead, RecordCoreRead, RecordWarning, } from \"../model/read-state.ts\";\nimport type { RecordMaintenanceError, RecordMaintenanceOpenError, RecordCompletenessError, RecordReaderOpenError, RecordReaderReadError, } from \"../reader/errors.ts\";\nimport type { RecordWriteError } from \"../writer/types.ts\";\nimport type { RecordFileSystemError } from \"../platform/errors.ts\";\nimport type { AnyRecordDefinition, AttemptRecordAppendCommand, AttemptRecordAppendReceipt, AttemptRecordCollectionLimitation, AttemptRecordCollectionDefinition, RecordDefinitionValue, RecordWriteCommand, } from \"../authoring.ts\";\nexport const selectedRunRefBrand: unique symbol = Symbol(\"@niceeval/record/SelectedRunRef\");\nexport const selectedAttemptRefBrand: unique symbol = Symbol(\"@niceeval/record/SelectedAttemptRef\");\nexport const selectedOwnerRefBrand: unique symbol = Symbol(\"@niceeval/record/SelectedOwnerRef\");\nexport const runWriteSessionBrand: unique symbol = Symbol(\"@niceeval/record/RunWriteSession\");\nexport const attemptWriteSessionBrand: unique symbol = Symbol(\"@niceeval/record/AttemptWriteSession\");\ntype AnyDefinition<Owner extends RecordAttachmentOwner = RecordAttachmentOwner> = RecordAttachmentDefinition<Owner, string, Schema.Top>;\ntype DefinitionValue<Definition extends AnyDefinition> = Schema.Schema.Type<Definition[\"schema\"]>;\n/** Nominal ref issued only by one live RecordReadSession. */\nexport interface SelectedRunRef {\n readonly runId: RunId;\n readonly [selectedRunRefBrand]: () => void;\n}\n/** Nominal exact reference to one immutable origin Attempt. */\nexport interface SelectedAttemptRef {\n readonly originRunId: RunId;\n readonly attemptId: AttemptId;\n /** Complete durable identity required before this Attempt can be referenced. */\n readonly publicationIdentity?: {\n readonly originRunId: string;\n readonly attemptId: string;\n readonly revision: number;\n };\n readonly [selectedAttemptRefBrand]: () => void;\n}\n/** Owner handle for a later catalog-authorized Attachment read. */\nexport interface SelectedOwnerRef<out Owner extends \"run\" | \"attempt\" = \"run\" | \"attempt\"> {\n readonly [selectedOwnerRefBrand]: () => void;\n /** Nominal type witness only; the actual owner identity stays Host-private. */\n readonly __owner?: () => Owner;\n}\n/**\n * The Host exposes current Attachment states without importing maintenance.\n * A reachable older revision is migration-required. Any other well-formed,\n * non-current revision remains unsupported data; malformed envelopes and\n * closures are invalid, never a reader-wide failure.\n */\nexport interface RecordAttachmentContentReader {\n /** Exact persisted byte length without loading Content bytes. */\n readonly byteLength: (handle: RecordContentHandle) => Effect.Effect<number, RecordReaderReadError>;\n readonly bytes: (handle: RecordContentHandle) => Effect.Effect<Uint8Array, RecordReaderReadError>;\n readonly text: (handle: RecordTextContentHandle) => Effect.Effect<string, RecordReaderReadError>;\n readonly stream: (handle: RecordContentHandle) => Stream.Stream<Uint8Array, RecordReaderReadError>;\n}\nexport type RecordAttachmentRead<Payload> = Exclude<ModelRecordAttachmentRead<Payload>, {\n readonly state: \"available\";\n}> | {\n readonly state: \"available\";\n /** Direct business fields from the current owner value definition. */\n readonly value: Payload;\n /** Scope-owned logical content consumption; it exposes no path or pointer. */\n readonly content: RecordAttachmentContentReader;\n};\ntype AttemptRecordCollectionRead<Payload> = Exclude<RecordAttachmentRead<Payload>, {\n readonly state: \"available\";\n}> | {\n readonly state: \"available\";\n readonly value: Payload;\n};\nexport type RecordSelectionProblem = {\n readonly code: \"incomplete-run\";\n readonly runId: RunId;\n} | {\n readonly code: \"record-core-invalid\";\n readonly runId: RunId;\n} | {\n readonly code: \"selection-run-missing\";\n readonly runId: RunId;\n};\nexport interface RecordSelectionRequest {\n /** Omitted means every Run whose complete marker existed during this scan. */\n readonly runIds?: readonly RunId[];\n}\n/**\n * Closed Run facts verified by scanSelection. They retain the denominator\n * frame if a later member read becomes unavailable; they are not a durable\n * schema and contain no owner capability.\n */\nexport interface SelectedRunFacts {\n readonly run: SelectedRunRef;\n readonly experimentId: ExperimentId;\n readonly startedAt: UtcMillis;\n readonly completedAt: UtcMillis;\n readonly expectedSlots: readonly RecordSlotIdentity[];\n}\n/** A closed candidate set with only selected minimal Core; never Attachment payloads. */\nexport interface RecordSelection {\n readonly runRefs: readonly SelectedRunRef[];\n readonly runFacts: readonly SelectedRunFacts[];\n readonly expectedSlots: readonly {\n readonly run: SelectedRunRef;\n /** Closed at scan time from the selected Run, not stored in RecordSlotIdentity. */\n readonly experimentId: ExperimentId;\n readonly slot: RecordSlotIdentity;\n }[];\n readonly problems: readonly RecordSelectionProblem[];\n readonly warnings: readonly RecordWarning[];\n}\nexport interface ReadableRun {\n readonly ref: SelectedRunRef;\n readonly owner: SelectedOwnerRef<\"run\">;\n readonly document: RunDocument;\n readonly members: readonly {\n readonly document: MemberDocument;\n readonly attempt: SelectedAttemptRef | null;\n }[];\n}\nexport interface ReadableAttempt {\n readonly ref: SelectedAttemptRef;\n readonly owner: SelectedOwnerRef<\"attempt\">;\n readonly document: AttemptDocument;\n /**\n * Verified while resolving the exact nominal Attempt reference. It is the\n * only origin Run Core projection Sample may use. In particular, a carried\n * or accepted member must retain this origin's execution facts rather than\n * substituting the selected target Run.\n */\n readonly origin: {\n readonly owner: SelectedOwnerRef<\"run\">;\n readonly runId: RunId;\n readonly experimentId: ExperimentId;\n readonly startedAt: UtcMillis;\n readonly context: RunContext;\n };\n}\nexport interface RecordReadSession {\n readonly selectRuns: (request?: RecordSelectionRequest) => Effect.Effect<RecordSelection, RecordReaderReadError>;\n readonly readRun: (ref: SelectedRunRef) => Effect.Effect<RecordCoreRead<ReadableRun>, RecordReaderReadError>;\n readonly readAttempt: (ref: SelectedAttemptRef) => Effect.Effect<RecordCoreRead<ReadableAttempt>, RecordReaderReadError>;\n readonly read: {\n <Definition extends AttemptRecordCollectionDefinition<string, Schema.Top>>(owner: SelectedOwnerRef<\"attempt\">, definition: Definition): Effect.Effect<AttemptRecordCollectionRead<Schema.Schema.Type<Definition[\"schema\"]>>, RecordReaderReadError>;\n <Owner extends \"run\" | \"attempt\", Definition extends AnyRecordDefinition<Owner>>(owner: SelectedOwnerRef<Owner>, definition: Definition): Effect.Effect<RecordAttachmentRead<RecordDefinitionValue<Definition>>, RecordReaderReadError>;\n <Owner extends \"run\" | \"attempt\", Definition extends AnyDefinition<Owner>>(owner: SelectedOwnerRef<Owner>, definition: Definition): Effect.Effect<RecordAttachmentRead<DefinitionValue<Definition>>, RecordReaderReadError>;\n };\n readonly openCollection: <Definition extends AttemptRecordCollectionDefinition<string, Schema.Top>>(owner: SelectedOwnerRef<\"attempt\">, definition: Definition) => Effect.Effect<Exclude<AttemptRecordCollectionRead<Schema.Schema.Type<Definition[\"schema\"]>>, {\n readonly state: \"available\";\n }> | {\n readonly state: \"available\";\n readonly collection: Schema.Schema.Type<Definition[\"schema\"]>[\"collection\"];\n readonly logicalIdentity: string;\n readonly logicalSealIdentity: string;\n readonly count: number;\n readonly digest: string;\n readonly items: Stream.Stream<Schema.Schema.Type<Definition[\"item\"]>, RecordReaderReadError>;\n }, RecordReaderReadError>;\n readonly requireComplete: (selection: RecordSelection) => Effect.Effect<RecordCompleteView, RecordCompletenessError>;\n}\n/** Complete only for this session's frozen selection and immutable catalog. */\nexport interface RecordCompleteView {\n readonly selection: RecordSelection;\n readonly attachments: RecordAttachmentCatalog;\n}\nexport interface CreateRunRequest {\n readonly root: RecordRoot;\n readonly experimentId: ExperimentId;\n /** Required historical interpretation facts, written once into `run.json`. */\n readonly context: RunContext;\n readonly startedAt: UtcMillis;\n readonly expectedSlots: readonly RecordSlotIdentity[];\n /** Host-private exact process identity used for crash recovery fencing. */\n readonly writerGeneration?: string;\n}\nexport interface CreateReferenceRunRequest extends CreateRunRequest {\n}\nexport interface RunCompletion {\n readonly completedAt: UtcMillis;\n}\nexport interface RecordSealReceipt {\n readonly runId: RunId;\n readonly state: \"sealed\";\n}\nexport interface AttemptWriteSession {\n readonly attemptId: AttemptId;\n readonly slotId: SlotId;\n readonly [attemptWriteSessionBrand]: () => void;\n readonly complete: (outcome: AttemptDocument[\"outcome\"]) => Effect.Effect<void, RecordWriteError>;\n readonly attach: OwnerAttachmentWriter<\"attempt\">;\n readonly record: AttemptRecordWriter;\n readonly records: AttemptRecordsWriter;\n}\nexport interface OwnerRecordsWriter<Owner extends \"run\" | \"attempt\"> {\n readonly write: {\n <Definition extends AnyRecordDefinition<Owner>>(definition: Definition, value: RecordDefinitionValue<Definition> | ((build: RecordAttachmentSessionBuilder) => RecordDefinitionValue<Definition>)): Effect.Effect<void, RecordWriteError | AttachedContentError<RecordDefinitionValue<Definition>>, AttachedContentRequirements<RecordDefinitionValue<Definition>>>;\n <Definition extends AnyDefinition<Owner>, Value extends DefinitionValue<Definition>>(definition: Definition, value: Value | ((build: RecordAttachmentSessionBuilder) => Value)): Effect.Effect<void, RecordWriteError | AttachedContentError<Value>, AttachedContentRequirements<Value>>;\n };\n}\nexport interface AttemptRecordsWriter extends OwnerRecordsWriter<\"attempt\"> {\n readonly append: <Definition extends AttemptRecordCollectionDefinition<string, Schema.Top>>(definition: Definition, item: Schema.Schema.Type<Definition[\"item\"]>) => Effect.Effect<AttemptRecordAppendReceipt, RecordWriteError>;\n readonly appendAll: <Definition extends AttemptRecordCollectionDefinition<string, Schema.Top>, Error, Requirements>(definition: Definition, items: Stream.Stream<Schema.Schema.Type<Definition[\"item\"]>, Error, Requirements>) => Effect.Effect<void, RecordWriteError | Error, Requirements>;\n readonly close: <Definition extends AttemptRecordCollectionDefinition<string, Schema.Top>>(definition: Definition, completion: {\n readonly state: \"complete\";\n } | {\n readonly state: \"partial\";\n readonly limitations: readonly [\n AttemptRecordCollectionLimitation,\n ...AttemptRecordCollectionLimitation[]\n ];\n }) => Effect.Effect<void, RecordWriteError>;\n}\nexport interface OwnerRecordWriter<Owner extends \"run\" | \"attempt\"> {\n readonly write: <Value, Error, Requirements>(command: RecordWriteCommand<Owner, Value, Error, Requirements>) => Effect.Effect<void, RecordWriteError | Error, Requirements>;\n}\nexport interface AttemptRecordWriter extends OwnerRecordWriter<\"attempt\"> {\n readonly start: (definition: AttemptRecordCollectionDefinition<string, Schema.Top>) => Effect.Effect<void, RecordWriteError>;\n readonly append: <Item>(command: AttemptRecordAppendCommand<Item>) => Effect.Effect<AttemptRecordAppendReceipt, RecordWriteError>;\n}\nexport interface OwnerAttachmentWriter<Owner extends \"run\" | \"attempt\"> {\n <Definition extends AnyDefinition<Owner>, Value extends DefinitionValue<Definition>>(definition: Definition, value: Value | ((build: RecordAttachmentSessionBuilder) => Value)): Effect.Effect<void, RecordWriteError | AttachedContentError<Value>, AttachedContentRequirements<Value>>;\n}\n/** One session owns exactly one freshly exclusive RunId directory. */\nexport interface RunWriteSession {\n readonly runId: RunId;\n readonly [runWriteSessionBrand]: () => void;\n readonly createAttempt: (input: {\n readonly slotId: SlotId;\n }) => Effect.Effect<AttemptWriteSession, RecordWriteError>;\n readonly referenceAttempt: (input: {\n readonly slotId: SlotId;\n readonly action: \"carried\" | \"accepted\";\n readonly attempt: SelectedAttemptRef;\n }) => Effect.Effect<void, RecordWriteError>;\n /**\n * Explicit adoption / rename: occupy one current target Slot with an already\n * selected origin Attempt. The target Slot identity may differ from the\n * origin Attempt. This is not a generic Attachment writer.\n */\n readonly recordAcceptedMembership: (input: {\n readonly slotId: SlotId;\n readonly attempt: SelectedAttemptRef;\n }) => Effect.Effect<void, RecordWriteError>;\n readonly recordTerminalMember: (input: {\n readonly slotId: SlotId;\n readonly action: \"not-dispatched\" | \"interrupted\";\n readonly absenceReason: RunAbsenceReason;\n }) => Effect.Effect<void, RecordWriteError>;\n readonly attach: OwnerAttachmentWriter<\"run\">;\n readonly record: OwnerRecordWriter<\"run\">;\n readonly records: OwnerRecordsWriter<\"run\">;\n readonly seal: (completion: RunCompletion) => Effect.Effect<RecordSealReceipt, RecordWriteError>;\n}\n/** A Run created solely from already-selected, sealed Attempts. */\nexport interface ReferenceRunWriteSession {\n readonly runId: RunId;\n readonly [runWriteSessionBrand]: () => void;\n readonly referenceAttempt: RunWriteSession[\"referenceAttempt\"];\n readonly recordAcceptedMembership: RunWriteSession[\"recordAcceptedMembership\"];\n readonly recordTerminalMember: RunWriteSession[\"recordTerminalMember\"];\n readonly attach: RunWriteSession[\"attach\"];\n readonly record: RunWriteSession[\"record\"];\n readonly records: RunWriteSession[\"records\"];\n readonly seal: RunWriteSession[\"seal\"];\n}\nexport type RecordFormatInspection = {\n readonly state: \"already-current\";\n readonly format: \"niceeval.record.attachments\";\n} | {\n readonly state: \"migration-required\";\n readonly format: \"niceeval.record.attachments\";\n} | {\n readonly state: \"unsupported-format\";\n readonly format: string;\n};\nexport interface RecordAttachmentMigrationTarget {\n readonly family: string;\n readonly owner: \"attempt\" | \"run\";\n readonly runId: RunId;\n readonly attemptId?: AttemptId;\n readonly fromRevision: number;\n readonly toRevision: number;\n readonly retention: {\n readonly retainedFacts: readonly string[];\n readonly droppedFacts: readonly string[];\n readonly rerunRecommendation: string | null;\n };\n}\nexport type RecordMigrationPlan = {\n readonly state: \"already-current\";\n readonly format: \"niceeval.record.attachments\";\n} | {\n readonly state: \"migration-required\";\n readonly format: \"niceeval.record.attachments\";\n readonly sourceFormat: \"niceeval.record.attachments\" | \"niceeval.record.source-receipts\";\n readonly attachments: readonly RecordAttachmentMigrationTarget[];\n readonly pendingSeals: readonly RunId[];\n readonly resumedSteps: number;\n} | {\n readonly state: \"unsupported-format\";\n readonly format: string;\n};\nexport type RecordMigrationReceipt = {\n readonly state: \"already-current\";\n readonly format: \"niceeval.record.attachments\";\n} | {\n readonly state: \"migrated\";\n readonly format: \"niceeval.record.attachments\";\n readonly attachments: readonly RecordAttachmentMigrationTarget[];\n readonly committed: number;\n readonly skipped: number;\n readonly failed: number;\n readonly rebuiltSeals: readonly RunId[];\n};\n/** Closed, presentation-neutral plan for explicit incomplete-Run cleanup. */\nexport type RecordCleanOperationPlan = {\n readonly _tag: \"RecordCleanAlreadyClean\";\n} | {\n readonly _tag: \"RecordCleanConfirmationRequired\";\n readonly runIds: readonly RunId[];\n};\nexport interface RecordCleanOperationReceipt {\n readonly _tag: \"RecordCleanApplied\";\n readonly deleted: readonly RunId[];\n readonly skipped: readonly RunId[];\n}\n/**\n * A migration plan is safe to carry outside the maintenance Scope. The ready\n * branch remains nominally backed by the exact source-byte plan held by this\n * Host process; callers cannot manufacture an applicable plan from JSON.\n */\nexport type RecordMigrateOperationPlan = {\n readonly _tag: \"RecordMigrationAlreadyCurrent\";\n readonly format: \"niceeval.record.attachments\";\n} | {\n readonly _tag: \"RecordMigrationUnsupported\";\n readonly format: string;\n} | RecordMigrateReadyPlan;\nexport interface RecordMigrateReadyPlan {\n readonly _tag: \"RecordMigrationReady\";\n readonly format: \"niceeval.record.attachments\";\n readonly sourceFormat: \"niceeval.record.attachments\" | \"niceeval.record.source-receipts\";\n readonly attachments: readonly RecordAttachmentMigrationTarget[];\n readonly pendingSeals: readonly RunId[];\n readonly resumedSteps: number;\n}\nexport type RecordMigrateOperationReceipt = {\n readonly _tag: \"RecordMigrationAlreadyCurrent\";\n readonly format: \"niceeval.record.attachments\";\n} | {\n readonly _tag: \"RecordMigrationApplied\";\n readonly format: \"niceeval.record.attachments\";\n readonly attachments: readonly RecordAttachmentMigrationTarget[];\n readonly committed: number;\n readonly skipped: number;\n readonly failed: number;\n readonly rebuiltSeals: readonly RunId[];\n};\n/** Exhaustive failure vocabulary consumed by Record-owned CLI presentation. */\nexport type RecordMaintenanceOperationFailure = {\n readonly _tag: \"RecordMaintenanceBusy\";\n readonly code: \"record-maintenance-busy\";\n} | {\n readonly _tag: \"RecordMigrationPlanStale\";\n readonly code: \"record-migration-plan-stale\";\n} | {\n readonly _tag: \"RecordMigrationInvalid\";\n readonly code: \"record-migration-invalid\";\n readonly family: string;\n} | {\n readonly _tag: \"RecordFormatUnsupported\";\n readonly code: \"record-format-unsupported\";\n} | {\n readonly _tag: \"RecordMigrationRequired\";\n readonly code: \"record-migration-required\";\n} | {\n readonly _tag: \"RecordMaintenanceOperationFailed\";\n readonly code: string;\n};\nexport interface RecordMaintenanceSession {\n readonly inspect: () => Effect.Effect<RecordFormatInspection, RecordMaintenanceError>;\n readonly planMigrate: () => Effect.Effect<RecordMigrationPlan, RecordMaintenanceError>;\n readonly applyMigrate: (plan: RecordMigrationPlan) => Effect.Effect<RecordMigrationReceipt, RecordMaintenanceError>;\n}\nexport interface RecordHostSDK {\n readonly openRead: RecordHostSDK[\"current\"][\"openRead\"];\n readonly createRun: (request: CreateRunRequest | {\n readonly root: RecordRoot;\n readonly core: Omit<CreateRunRequest, \"root\">;\n }) => ReturnType<RecordHostSDK[\"current\"][\"createRun\"]>;\n readonly createReferenceRun: (request: CreateReferenceRunRequest | {\n readonly root: RecordRoot;\n readonly core: Omit<CreateReferenceRunRequest, \"root\">;\n }) => ReturnType<RecordHostSDK[\"current\"][\"createReferenceRun\"]>;\n readonly current: {\n readonly openRead: (input: {\n readonly root: RecordRoot;\n }) => Effect.Effect<RecordReadSession, RecordReaderOpenError, import(\"effect\").Scope.Scope | ProjectStateDatabase>;\n readonly createRun: (request: CreateRunRequest) => Effect.Effect<RunWriteSession, RecordReaderOpenError | RecordWriteError, import(\"effect\").Scope.Scope | import(\"../platform/services.ts\").RecordEntropy | import(\"../../coordination/record-leases.ts\").RecordCoordination | ProjectStateDatabase>;\n readonly createReferenceRun: (request: CreateReferenceRunRequest) => Effect.Effect<ReferenceRunWriteSession, RecordReaderOpenError | RecordWriteError, import(\"effect\").Scope.Scope | import(\"../platform/services.ts\").RecordEntropy | import(\"../../coordination/record-leases.ts\").RecordCoordination | ProjectStateDatabase>;\n };\n readonly maintenance: {\n readonly planClean: (input: {\n readonly root: RecordRoot;\n }) => Effect.Effect<RecordCleanOperationPlan, RecordMaintenanceOperationFailure, import(\"../../coordination/record-leases.ts\").RecordCoordination>;\n readonly applyClean: (input: {\n readonly root: RecordRoot;\n readonly plan: Extract<RecordCleanOperationPlan, {\n readonly _tag: \"RecordCleanConfirmationRequired\";\n }>;\n }) => Effect.Effect<RecordCleanOperationReceipt, RecordMaintenanceOperationFailure, import(\"../../coordination/record-leases.ts\").RecordCoordination>;\n readonly planMigrate: (input: {\n readonly root: RecordRoot;\n }) => Effect.Effect<RecordMigrateOperationPlan, RecordMaintenanceOperationFailure, import(\"../../coordination/record-leases.ts\").RecordCoordination>;\n readonly applyMigrate: (input: {\n readonly root: RecordRoot;\n readonly plan: RecordMigrateReadyPlan;\n }) => Effect.Effect<RecordMigrateOperationReceipt, RecordMaintenanceOperationFailure, import(\"../../coordination/record-leases.ts\").RecordCoordination>;\n readonly open: (input: {\n readonly root: RecordRoot;\n }) => Effect.Effect<RecordMaintenanceSession, RecordMaintenanceOpenError, import(\"effect\").Scope.Scope | import(\"../../coordination/record-leases.ts\").RecordCoordination>;\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":";;;AAea,QAAA,mBAAmB,GAAkB,MAAM,CAAC,iCAAiC,CAAC,CAAC;AAC/E,QAAA,uBAAuB,GAAkB,MAAM,CAAC,qCAAqC,CAAC,CAAC;AACvF,QAAA,qBAAqB,GAAkB,MAAM,CAAC,mCAAmC,CAAC,CAAC;AACnF,QAAA,oBAAoB,GAAkB,MAAM,CAAC,kCAAkC,CAAC,CAAC;AACjF,QAAA,wBAAwB,GAAkB,MAAM,CAAC,sCAAsC,CAAC,CAAC","sourcesContent":["import type { Effect, Schema, Stream } from \"effect\";\nimport type { ProjectStateDatabase } from \"../sqlite/project-state-database.ts\";\nimport type { RecordAttachmentCatalog, RecordAttachmentDefinition, } from \"../attachment/index.ts\";\nimport type { RecordContentHandle, RecordTextContentHandle, } from \"../attachment/content.ts\";\nimport type { AttachedContentError, AttachedContentRequirements, RecordAttachmentSessionBuilder, } from \"../writer/current-attachment.ts\";\nimport type { AttemptDocument, MemberDocument, RecordAttachmentOwner, RecordSlotIdentity, RunDocument, } from \"../model/core.ts\";\nimport type { RunContext } from \"../model/run-context.ts\";\nimport type { AttemptId, ExperimentId, RunId, SlotId, UtcMillis, } from \"../model/identifiers.ts\";\nimport type { RecordRoot } from \"../platform/root.ts\";\nimport type { RunAbsenceReason } from \"../../run/protocol.ts\";\nimport type { RecordAttachmentRead as ModelRecordAttachmentRead, RecordCoreRead, RecordWarning, } from \"../model/read-state.ts\";\nimport type { RecordMaintenanceError, RecordMaintenanceOpenError, RecordCompletenessError, RecordReaderOpenError, RecordReaderReadError, } from \"../reader/errors.ts\";\nimport type { RecordWriteError } from \"../writer/types.ts\";\nimport type { RecordFileSystemError } from \"../platform/errors.ts\";\nimport type { AnyRecordDefinition, AttemptRecordAppendCommand, AttemptRecordAppendReceipt, AttemptRecordCollectionLimitation, AttemptRecordCollectionDefinition, RecordDefinitionValue, RecordWriteCommand, } from \"../authoring.ts\";\nexport const selectedRunRefBrand: unique symbol = Symbol(\"@niceeval/record/SelectedRunRef\");\nexport const selectedAttemptRefBrand: unique symbol = Symbol(\"@niceeval/record/SelectedAttemptRef\");\nexport const selectedOwnerRefBrand: unique symbol = Symbol(\"@niceeval/record/SelectedOwnerRef\");\nexport const runWriteSessionBrand: unique symbol = Symbol(\"@niceeval/record/RunWriteSession\");\nexport const attemptWriteSessionBrand: unique symbol = Symbol(\"@niceeval/record/AttemptWriteSession\");\ntype AnyDefinition<Owner extends RecordAttachmentOwner = RecordAttachmentOwner> = RecordAttachmentDefinition<Owner, string, Schema.Top>;\ntype DefinitionValue<Definition extends AnyDefinition> = Schema.Schema.Type<Definition[\"schema\"]>;\n/** Nominal ref issued only by one live RecordReadSession. */\nexport interface SelectedRunRef {\n readonly runId: RunId;\n readonly [selectedRunRefBrand]: () => void;\n}\n/** Nominal exact reference to one immutable origin Attempt. */\nexport interface SelectedAttemptRef {\n readonly originRunId: RunId;\n readonly attemptId: AttemptId;\n /** Complete durable identity required before this Attempt can be referenced. */\n readonly publicationIdentity?: {\n readonly originRunId: string;\n readonly attemptId: string;\n readonly revision: number;\n };\n readonly [selectedAttemptRefBrand]: () => void;\n}\n/** Owner handle for a later catalog-authorized Attachment read. */\nexport interface SelectedOwnerRef<out Owner extends \"run\" | \"attempt\" = \"run\" | \"attempt\"> {\n readonly [selectedOwnerRefBrand]: () => void;\n /** Nominal type witness only; the actual owner identity stays Host-private. */\n readonly __owner?: () => Owner;\n}\n/**\n * The Host exposes current Attachment states without importing maintenance.\n * A reachable older revision is migration-required. Any other well-formed,\n * non-current revision remains unsupported data; malformed envelopes and\n * closures are invalid, never a reader-wide failure.\n */\nexport interface RecordAttachmentContentReader {\n /** Exact persisted byte length without loading Content bytes. */\n readonly byteLength: (handle: RecordContentHandle) => Effect.Effect<number, RecordReaderReadError>;\n readonly bytes: (handle: RecordContentHandle) => Effect.Effect<Uint8Array, RecordReaderReadError>;\n readonly text: (handle: RecordTextContentHandle) => Effect.Effect<string, RecordReaderReadError>;\n readonly stream: (handle: RecordContentHandle) => Stream.Stream<Uint8Array, RecordReaderReadError>;\n}\nexport type RecordAttachmentRead<Payload> = Exclude<ModelRecordAttachmentRead<Payload>, {\n readonly state: \"available\";\n}> | {\n readonly state: \"available\";\n /** Direct business fields from the current owner value definition. */\n readonly value: Payload;\n /** Scope-owned logical content consumption; it exposes no path or pointer. */\n readonly content: RecordAttachmentContentReader;\n};\ntype AttemptRecordCollectionRead<Payload> = Exclude<RecordAttachmentRead<Payload>, {\n readonly state: \"available\";\n}> | {\n readonly state: \"available\";\n readonly value: Payload;\n};\nexport type RecordSelectionProblem = {\n readonly code: \"incomplete-run\";\n readonly runId: RunId;\n} | {\n readonly code: \"record-core-invalid\";\n readonly runId: RunId;\n} | {\n readonly code: \"selection-run-missing\";\n readonly runId: RunId;\n};\nexport interface RecordSelectionRequest {\n /** Omitted means every terminal Run eligible for reuse during this scan. */\n readonly runIds?: readonly RunId[];\n /** Explicit locator resolution may include immutable publications from an active origin Run. */\n readonly includePublishedActive?: boolean;\n}\n/**\n * Closed Run facts verified by scanSelection. They retain the denominator\n * frame if a later member read becomes unavailable; they are not a durable\n * schema and contain no owner capability.\n */\nexport interface SelectedRunFacts {\n readonly run: SelectedRunRef;\n readonly experimentId: ExperimentId;\n readonly startedAt: UtcMillis;\n readonly completedAt: UtcMillis;\n readonly expectedSlots: readonly RecordSlotIdentity[];\n}\n/** A closed candidate set with only selected minimal Core; never Attachment payloads. */\nexport interface RecordSelection {\n readonly runRefs: readonly SelectedRunRef[];\n readonly runFacts: readonly SelectedRunFacts[];\n readonly expectedSlots: readonly {\n readonly run: SelectedRunRef;\n /** Closed at scan time from the selected Run, not stored in RecordSlotIdentity. */\n readonly experimentId: ExperimentId;\n readonly slot: RecordSlotIdentity;\n }[];\n readonly problems: readonly RecordSelectionProblem[];\n readonly warnings: readonly RecordWarning[];\n}\nexport interface ReadableRun {\n readonly ref: SelectedRunRef;\n readonly owner: SelectedOwnerRef<\"run\">;\n readonly document: RunDocument;\n readonly members: readonly {\n readonly document: MemberDocument;\n readonly attempt: SelectedAttemptRef | null;\n }[];\n}\nexport interface ReadableAttempt {\n readonly ref: SelectedAttemptRef;\n readonly owner: SelectedOwnerRef<\"attempt\">;\n readonly document: AttemptDocument;\n /**\n * Verified while resolving the exact nominal Attempt reference. It is the\n * only origin Run Core projection Sample may use. In particular, a carried\n * or accepted member must retain this origin's execution facts rather than\n * substituting the selected target Run.\n */\n readonly origin: {\n readonly owner: SelectedOwnerRef<\"run\">;\n readonly runId: RunId;\n readonly experimentId: ExperimentId;\n readonly startedAt: UtcMillis;\n readonly context: RunContext;\n };\n}\nexport interface RecordReadSession {\n readonly selectRuns: (request?: RecordSelectionRequest) => Effect.Effect<RecordSelection, RecordReaderReadError>;\n readonly readRun: (ref: SelectedRunRef) => Effect.Effect<RecordCoreRead<ReadableRun>, RecordReaderReadError>;\n readonly readAttempt: (ref: SelectedAttemptRef) => Effect.Effect<RecordCoreRead<ReadableAttempt>, RecordReaderReadError>;\n readonly read: {\n <Definition extends AttemptRecordCollectionDefinition<string, Schema.Top>>(owner: SelectedOwnerRef<\"attempt\">, definition: Definition): Effect.Effect<AttemptRecordCollectionRead<Schema.Schema.Type<Definition[\"schema\"]>>, RecordReaderReadError>;\n <Owner extends \"run\" | \"attempt\", Definition extends AnyRecordDefinition<Owner>>(owner: SelectedOwnerRef<Owner>, definition: Definition): Effect.Effect<RecordAttachmentRead<RecordDefinitionValue<Definition>>, RecordReaderReadError>;\n <Owner extends \"run\" | \"attempt\", Definition extends AnyDefinition<Owner>>(owner: SelectedOwnerRef<Owner>, definition: Definition): Effect.Effect<RecordAttachmentRead<DefinitionValue<Definition>>, RecordReaderReadError>;\n };\n readonly openCollection: <Definition extends AttemptRecordCollectionDefinition<string, Schema.Top>>(owner: SelectedOwnerRef<\"attempt\">, definition: Definition) => Effect.Effect<Exclude<AttemptRecordCollectionRead<Schema.Schema.Type<Definition[\"schema\"]>>, {\n readonly state: \"available\";\n }> | {\n readonly state: \"available\";\n readonly collection: Schema.Schema.Type<Definition[\"schema\"]>[\"collection\"];\n readonly logicalIdentity: string;\n readonly logicalSealIdentity: string;\n readonly count: number;\n readonly digest: string;\n readonly items: Stream.Stream<Schema.Schema.Type<Definition[\"item\"]>, RecordReaderReadError>;\n }, RecordReaderReadError>;\n readonly requireComplete: (selection: RecordSelection) => Effect.Effect<RecordCompleteView, RecordCompletenessError>;\n}\n/** Complete only for this session's frozen selection and immutable catalog. */\nexport interface RecordCompleteView {\n readonly selection: RecordSelection;\n readonly attachments: RecordAttachmentCatalog;\n}\nexport interface CreateRunRequest {\n readonly root: RecordRoot;\n readonly experimentId: ExperimentId;\n /** Required historical interpretation facts, written once into `run.json`. */\n readonly context: RunContext;\n readonly startedAt: UtcMillis;\n readonly expectedSlots: readonly RecordSlotIdentity[];\n /** Host-private exact process identity used for crash recovery fencing. */\n readonly writerGeneration?: string;\n}\nexport interface CreateReferenceRunRequest extends CreateRunRequest {\n}\nexport interface RunCompletion {\n readonly completedAt: UtcMillis;\n}\nexport interface RecordSealReceipt {\n readonly runId: RunId;\n readonly state: \"sealed\";\n}\nexport interface AttemptWriteSession {\n readonly attemptId: AttemptId;\n readonly slotId: SlotId;\n readonly [attemptWriteSessionBrand]: () => void;\n readonly complete: (outcome: AttemptDocument[\"outcome\"]) => Effect.Effect<void, RecordWriteError>;\n readonly attach: OwnerAttachmentWriter<\"attempt\">;\n readonly record: AttemptRecordWriter;\n readonly records: AttemptRecordsWriter;\n}\nexport interface OwnerRecordsWriter<Owner extends \"run\" | \"attempt\"> {\n readonly write: {\n <Definition extends AnyRecordDefinition<Owner>>(definition: Definition, value: RecordDefinitionValue<Definition> | ((build: RecordAttachmentSessionBuilder) => RecordDefinitionValue<Definition>)): Effect.Effect<void, RecordWriteError | AttachedContentError<RecordDefinitionValue<Definition>>, AttachedContentRequirements<RecordDefinitionValue<Definition>>>;\n <Definition extends AnyDefinition<Owner>, Value extends DefinitionValue<Definition>>(definition: Definition, value: Value | ((build: RecordAttachmentSessionBuilder) => Value)): Effect.Effect<void, RecordWriteError | AttachedContentError<Value>, AttachedContentRequirements<Value>>;\n };\n}\nexport interface AttemptRecordsWriter extends OwnerRecordsWriter<\"attempt\"> {\n readonly append: <Definition extends AttemptRecordCollectionDefinition<string, Schema.Top>>(definition: Definition, item: Schema.Schema.Type<Definition[\"item\"]>) => Effect.Effect<AttemptRecordAppendReceipt, RecordWriteError>;\n readonly appendAll: <Definition extends AttemptRecordCollectionDefinition<string, Schema.Top>, Error, Requirements>(definition: Definition, items: Stream.Stream<Schema.Schema.Type<Definition[\"item\"]>, Error, Requirements>) => Effect.Effect<void, RecordWriteError | Error, Requirements>;\n readonly close: <Definition extends AttemptRecordCollectionDefinition<string, Schema.Top>>(definition: Definition, completion: {\n readonly state: \"complete\";\n } | {\n readonly state: \"partial\";\n readonly limitations: readonly [\n AttemptRecordCollectionLimitation,\n ...AttemptRecordCollectionLimitation[]\n ];\n }) => Effect.Effect<void, RecordWriteError>;\n}\nexport interface OwnerRecordWriter<Owner extends \"run\" | \"attempt\"> {\n readonly write: <Value, Error, Requirements>(command: RecordWriteCommand<Owner, Value, Error, Requirements>) => Effect.Effect<void, RecordWriteError | Error, Requirements>;\n}\nexport interface AttemptRecordWriter extends OwnerRecordWriter<\"attempt\"> {\n readonly start: (definition: AttemptRecordCollectionDefinition<string, Schema.Top>) => Effect.Effect<void, RecordWriteError>;\n readonly append: <Item>(command: AttemptRecordAppendCommand<Item>) => Effect.Effect<AttemptRecordAppendReceipt, RecordWriteError>;\n}\nexport interface OwnerAttachmentWriter<Owner extends \"run\" | \"attempt\"> {\n <Definition extends AnyDefinition<Owner>, Value extends DefinitionValue<Definition>>(definition: Definition, value: Value | ((build: RecordAttachmentSessionBuilder) => Value)): Effect.Effect<void, RecordWriteError | AttachedContentError<Value>, AttachedContentRequirements<Value>>;\n}\n/** One session owns exactly one freshly exclusive RunId directory. */\nexport interface RunWriteSession {\n readonly runId: RunId;\n readonly [runWriteSessionBrand]: () => void;\n readonly createAttempt: (input: {\n readonly slotId: SlotId;\n }) => Effect.Effect<AttemptWriteSession, RecordWriteError>;\n readonly referenceAttempt: (input: {\n readonly slotId: SlotId;\n readonly action: \"carried\" | \"accepted\";\n readonly attempt: SelectedAttemptRef;\n }) => Effect.Effect<void, RecordWriteError>;\n /**\n * Explicit adoption / rename: occupy one current target Slot with an already\n * selected origin Attempt. The target Slot identity may differ from the\n * origin Attempt. This is not a generic Attachment writer.\n */\n readonly recordAcceptedMembership: (input: {\n readonly slotId: SlotId;\n readonly attempt: SelectedAttemptRef;\n }) => Effect.Effect<void, RecordWriteError>;\n readonly recordTerminalMember: (input: {\n readonly slotId: SlotId;\n readonly action: \"not-dispatched\" | \"interrupted\";\n readonly absenceReason: RunAbsenceReason;\n }) => Effect.Effect<void, RecordWriteError>;\n readonly attach: OwnerAttachmentWriter<\"run\">;\n readonly record: OwnerRecordWriter<\"run\">;\n readonly records: OwnerRecordsWriter<\"run\">;\n readonly seal: (completion: RunCompletion) => Effect.Effect<RecordSealReceipt, RecordWriteError>;\n}\n/** A Run created solely from already-selected, sealed Attempts. */\nexport interface ReferenceRunWriteSession {\n readonly runId: RunId;\n readonly [runWriteSessionBrand]: () => void;\n readonly referenceAttempt: RunWriteSession[\"referenceAttempt\"];\n readonly recordAcceptedMembership: RunWriteSession[\"recordAcceptedMembership\"];\n readonly recordTerminalMember: RunWriteSession[\"recordTerminalMember\"];\n readonly attach: RunWriteSession[\"attach\"];\n readonly record: RunWriteSession[\"record\"];\n readonly records: RunWriteSession[\"records\"];\n readonly seal: RunWriteSession[\"seal\"];\n}\nexport type RecordFormatInspection = {\n readonly state: \"already-current\";\n readonly format: \"niceeval.record.attachments\";\n} | {\n readonly state: \"migration-required\";\n readonly format: \"niceeval.record.attachments\";\n} | {\n readonly state: \"unsupported-format\";\n readonly format: string;\n};\nexport interface RecordAttachmentMigrationTarget {\n readonly family: string;\n readonly owner: \"attempt\" | \"run\";\n readonly runId: RunId;\n readonly attemptId?: AttemptId;\n readonly fromRevision: number;\n readonly toRevision: number;\n readonly retention: {\n readonly retainedFacts: readonly string[];\n readonly droppedFacts: readonly string[];\n readonly rerunRecommendation: string | null;\n };\n}\nexport type RecordMigrationPlan = {\n readonly state: \"already-current\";\n readonly format: \"niceeval.record.attachments\";\n} | {\n readonly state: \"migration-required\";\n readonly format: \"niceeval.record.attachments\";\n readonly sourceFormat: \"niceeval.record.attachments\" | \"niceeval.record.source-receipts\";\n readonly attachments: readonly RecordAttachmentMigrationTarget[];\n readonly pendingSeals: readonly RunId[];\n readonly resumedSteps: number;\n} | {\n readonly state: \"unsupported-format\";\n readonly format: string;\n};\nexport type RecordMigrationReceipt = {\n readonly state: \"already-current\";\n readonly format: \"niceeval.record.attachments\";\n} | {\n readonly state: \"migrated\";\n readonly format: \"niceeval.record.attachments\";\n readonly attachments: readonly RecordAttachmentMigrationTarget[];\n readonly committed: number;\n readonly skipped: number;\n readonly failed: number;\n readonly rebuiltSeals: readonly RunId[];\n};\n/** Closed, presentation-neutral plan for explicit incomplete-Run cleanup. */\nexport type RecordCleanOperationPlan = {\n readonly _tag: \"RecordCleanAlreadyClean\";\n} | {\n readonly _tag: \"RecordCleanConfirmationRequired\";\n readonly runIds: readonly RunId[];\n};\nexport interface RecordCleanOperationReceipt {\n readonly _tag: \"RecordCleanApplied\";\n readonly deleted: readonly RunId[];\n readonly skipped: readonly RunId[];\n}\n/**\n * A migration plan is safe to carry outside the maintenance Scope. The ready\n * branch remains nominally backed by the exact source-byte plan held by this\n * Host process; callers cannot manufacture an applicable plan from JSON.\n */\nexport type RecordMigrateOperationPlan = {\n readonly _tag: \"RecordMigrationAlreadyCurrent\";\n readonly format: \"niceeval.record.attachments\";\n} | {\n readonly _tag: \"RecordMigrationUnsupported\";\n readonly format: string;\n} | RecordMigrateReadyPlan;\nexport interface RecordMigrateReadyPlan {\n readonly _tag: \"RecordMigrationReady\";\n readonly format: \"niceeval.record.attachments\";\n readonly sourceFormat: \"niceeval.record.attachments\" | \"niceeval.record.source-receipts\";\n readonly attachments: readonly RecordAttachmentMigrationTarget[];\n readonly pendingSeals: readonly RunId[];\n readonly resumedSteps: number;\n}\nexport type RecordMigrateOperationReceipt = {\n readonly _tag: \"RecordMigrationAlreadyCurrent\";\n readonly format: \"niceeval.record.attachments\";\n} | {\n readonly _tag: \"RecordMigrationApplied\";\n readonly format: \"niceeval.record.attachments\";\n readonly attachments: readonly RecordAttachmentMigrationTarget[];\n readonly committed: number;\n readonly skipped: number;\n readonly failed: number;\n readonly rebuiltSeals: readonly RunId[];\n};\n/** Exhaustive failure vocabulary consumed by Record-owned CLI presentation. */\nexport type RecordMaintenanceOperationFailure = {\n readonly _tag: \"RecordMaintenanceBusy\";\n readonly code: \"record-maintenance-busy\";\n} | {\n readonly _tag: \"RecordMigrationPlanStale\";\n readonly code: \"record-migration-plan-stale\";\n} | {\n readonly _tag: \"RecordMigrationInvalid\";\n readonly code: \"record-migration-invalid\";\n readonly family: string;\n} | {\n readonly _tag: \"RecordFormatUnsupported\";\n readonly code: \"record-format-unsupported\";\n} | {\n readonly _tag: \"RecordMigrationRequired\";\n readonly code: \"record-migration-required\";\n} | {\n readonly _tag: \"RecordMaintenanceOperationFailed\";\n readonly code: string;\n};\nexport interface RecordMaintenanceSession {\n readonly inspect: () => Effect.Effect<RecordFormatInspection, RecordMaintenanceError>;\n readonly planMigrate: () => Effect.Effect<RecordMigrationPlan, RecordMaintenanceError>;\n readonly applyMigrate: (plan: RecordMigrationPlan) => Effect.Effect<RecordMigrationReceipt, RecordMaintenanceError>;\n}\nexport interface RecordHostSDK {\n readonly openRead: RecordHostSDK[\"current\"][\"openRead\"];\n readonly createRun: (request: CreateRunRequest | {\n readonly root: RecordRoot;\n readonly core: Omit<CreateRunRequest, \"root\">;\n }) => ReturnType<RecordHostSDK[\"current\"][\"createRun\"]>;\n readonly createReferenceRun: (request: CreateReferenceRunRequest | {\n readonly root: RecordRoot;\n readonly core: Omit<CreateReferenceRunRequest, \"root\">;\n }) => ReturnType<RecordHostSDK[\"current\"][\"createReferenceRun\"]>;\n readonly current: {\n readonly openRead: (input: {\n readonly root: RecordRoot;\n }) => Effect.Effect<RecordReadSession, RecordReaderOpenError, import(\"effect\").Scope.Scope | ProjectStateDatabase>;\n readonly createRun: (request: CreateRunRequest) => Effect.Effect<RunWriteSession, RecordReaderOpenError | RecordWriteError, import(\"effect\").Scope.Scope | import(\"../platform/services.ts\").RecordEntropy | import(\"../../coordination/record-leases.ts\").RecordCoordination | ProjectStateDatabase>;\n readonly createReferenceRun: (request: CreateReferenceRunRequest) => Effect.Effect<ReferenceRunWriteSession, RecordReaderOpenError | RecordWriteError, import(\"effect\").Scope.Scope | import(\"../platform/services.ts\").RecordEntropy | import(\"../../coordination/record-leases.ts\").RecordCoordination | ProjectStateDatabase>;\n };\n readonly maintenance: {\n readonly planClean: (input: {\n readonly root: RecordRoot;\n }) => Effect.Effect<RecordCleanOperationPlan, RecordMaintenanceOperationFailure, import(\"../../coordination/record-leases.ts\").RecordCoordination>;\n readonly applyClean: (input: {\n readonly root: RecordRoot;\n readonly plan: Extract<RecordCleanOperationPlan, {\n readonly _tag: \"RecordCleanConfirmationRequired\";\n }>;\n }) => Effect.Effect<RecordCleanOperationReceipt, RecordMaintenanceOperationFailure, import(\"../../coordination/record-leases.ts\").RecordCoordination>;\n readonly planMigrate: (input: {\n readonly root: RecordRoot;\n }) => Effect.Effect<RecordMigrateOperationPlan, RecordMaintenanceOperationFailure, import(\"../../coordination/record-leases.ts\").RecordCoordination>;\n readonly applyMigrate: (input: {\n readonly root: RecordRoot;\n readonly plan: RecordMigrateReadyPlan;\n }) => Effect.Effect<RecordMigrateOperationReceipt, RecordMaintenanceOperationFailure, import(\"../../coordination/record-leases.ts\").RecordCoordination>;\n readonly open: (input: {\n readonly root: RecordRoot;\n }) => Effect.Effect<RecordMaintenanceSession, RecordMaintenanceOpenError, import(\"effect\").Scope.Scope | import(\"../../coordination/record-leases.ts\").RecordCoordination>;\n };\n}\n"]}
|
|
@@ -81,8 +81,10 @@ export type RecordSelectionProblem = {
|
|
|
81
81
|
readonly runId: RunId;
|
|
82
82
|
};
|
|
83
83
|
export interface RecordSelectionRequest {
|
|
84
|
-
/** Omitted means every Run
|
|
84
|
+
/** Omitted means every terminal Run eligible for reuse during this scan. */
|
|
85
85
|
readonly runIds?: readonly RunId[];
|
|
86
|
+
/** Explicit locator resolution may include immutable publications from an active origin Run. */
|
|
87
|
+
readonly includePublishedActive?: boolean;
|
|
86
88
|
}
|
|
87
89
|
/**
|
|
88
90
|
* Closed Run facts verified by scanSelection. They retain the denominator
|
|
@@ -81,8 +81,10 @@ export type RecordSelectionProblem = {
|
|
|
81
81
|
readonly runId: RunId;
|
|
82
82
|
};
|
|
83
83
|
export interface RecordSelectionRequest {
|
|
84
|
-
/** Omitted means every Run
|
|
84
|
+
/** Omitted means every terminal Run eligible for reuse during this scan. */
|
|
85
85
|
readonly runIds?: readonly RunId[];
|
|
86
|
+
/** Explicit locator resolution may include immutable publications from an active origin Run. */
|
|
87
|
+
readonly includePublishedActive?: boolean;
|
|
86
88
|
}
|
|
87
89
|
/**
|
|
88
90
|
* Closed Run facts verified by scanSelection. They retain the denominator
|
|
@@ -81,8 +81,10 @@ export type RecordSelectionProblem = {
|
|
|
81
81
|
readonly runId: RunId;
|
|
82
82
|
};
|
|
83
83
|
export interface RecordSelectionRequest {
|
|
84
|
-
/** Omitted means every Run
|
|
84
|
+
/** Omitted means every terminal Run eligible for reuse during this scan. */
|
|
85
85
|
readonly runIds?: readonly RunId[];
|
|
86
|
+
/** Explicit locator resolution may include immutable publications from an active origin Run. */
|
|
87
|
+
readonly includePublishedActive?: boolean;
|
|
86
88
|
}
|
|
87
89
|
/**
|
|
88
90
|
* Closed Run facts verified by scanSelection. They retain the denominator
|
|
@@ -1439,12 +1439,9 @@ function verifyRunPayloadClosures(connection, runId, verifyPayloadBytes = true)
|
|
|
1439
1439
|
}
|
|
1440
1440
|
}
|
|
1441
1441
|
function readSealedRunSummary(connection, runId) {
|
|
1442
|
-
const sealed = (0, database_ts_1.recordStatement)(connection, "SELECT 1 FROM runs WHERE run_id=? AND status='sealed'").get(runId);
|
|
1443
|
-
if (sealed === undefined)
|
|
1444
|
-
return undefined;
|
|
1445
1442
|
const published = readPublishedSealedRun(connection, runId);
|
|
1446
1443
|
if (published === undefined) {
|
|
1447
|
-
|
|
1444
|
+
return undefined;
|
|
1448
1445
|
}
|
|
1449
1446
|
return published.summary;
|
|
1450
1447
|
}
|
|
@@ -1452,7 +1449,8 @@ function listSealedRunSummaries(connection, afterRunId = "", pageSize = 100) {
|
|
|
1452
1449
|
if (!Number.isSafeInteger(pageSize) || pageSize < 1 || pageSize > 256) {
|
|
1453
1450
|
throw (0, errors_ts_1.sqliteError)("record-resource-limit-exceeded", "list-sealed-runs", "page size must be between 1 and 256");
|
|
1454
1451
|
}
|
|
1455
|
-
const runIds = rows(connection, `SELECT run_id FROM runs WHERE status='sealed'
|
|
1452
|
+
const runIds = rows(connection, `SELECT run_id FROM runs WHERE run_id>? AND (status='sealed' OR EXISTS
|
|
1453
|
+
(SELECT 1 FROM attempt_publications p WHERE p.origin_run_id=runs.run_id)) ORDER BY run_id LIMIT ?`, afterRunId, pageSize);
|
|
1456
1454
|
return Object.freeze(runIds.map((row) => {
|
|
1457
1455
|
const summary = readSealedRunSummary(connection, text(row, "run_id"));
|
|
1458
1456
|
if (summary === undefined)
|
|
@@ -1472,8 +1470,12 @@ function readSealedRunSummaryPage(connection, afterRunId = "", pageSize = 100, e
|
|
|
1472
1470
|
const cutoffHash = (0, node_crypto_1.createHash)("sha256");
|
|
1473
1471
|
cutoffHash.update("[");
|
|
1474
1472
|
let runCount = 0;
|
|
1475
|
-
const inventory = (0, database_ts_1.recordStatement)(connection, `SELECT run_id,
|
|
1476
|
-
|
|
1473
|
+
const inventory = (0, database_ts_1.recordStatement)(connection, `SELECT run_id,
|
|
1474
|
+
coalesce(logical_seal_identity,'published:' || (SELECT max(p.published_revision) FROM attempt_publications p
|
|
1475
|
+
WHERE p.origin_run_id=runs.run_id)) logical_seal_identity
|
|
1476
|
+
FROM runs WHERE status='sealed' OR EXISTS
|
|
1477
|
+
(SELECT 1 FROM attempt_publications p WHERE p.origin_run_id=runs.run_id)
|
|
1478
|
+
ORDER BY run_id`).iterate();
|
|
1477
1479
|
for (const row of inventory) {
|
|
1478
1480
|
if (runCount >= types_ts_1.RECORD_SQLITE_MAX_VALIDATION_RUNS) {
|
|
1479
1481
|
throw (0, errors_ts_1.sqliteError)("record-resource-limit-exceeded", "page-sealed-runs", "sealed cutoff exceeds its Run ceiling");
|
|
@@ -1491,7 +1493,8 @@ function readSealedRunSummaryPage(connection, afterRunId = "", pageSize = 100, e
|
|
|
1491
1493
|
if (expectedCutoffIdentity !== undefined && expectedCutoffIdentity !== identity) {
|
|
1492
1494
|
throw (0, errors_ts_1.sqliteError)("record-command-conflict", "page-sealed-runs", "sealed cutoff changed; restart pagination");
|
|
1493
1495
|
}
|
|
1494
|
-
const pageRows = rows(connection, `SELECT run_id FROM runs WHERE status='sealed'
|
|
1496
|
+
const pageRows = rows(connection, `SELECT run_id FROM runs WHERE run_id>? AND (status='sealed' OR EXISTS
|
|
1497
|
+
(SELECT 1 FROM attempt_publications p WHERE p.origin_run_id=runs.run_id)) ORDER BY run_id LIMIT ?`, afterRunId, pageSize + 1);
|
|
1495
1498
|
const selected = pageRows.slice(0, pageSize);
|
|
1496
1499
|
const summaries = selected.map((row) => {
|
|
1497
1500
|
const summary = readSealedRunSummary(connection, text(row, "run_id"));
|