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.
Files changed (108) hide show
  1. package/INDEX.md +3 -3
  2. package/dist/experiment/host/operations.cjs +58 -0
  3. package/dist/experiment/host/operations.cjs.map +1 -1
  4. package/dist/inspection/overview.cjs +20 -9
  5. package/dist/inspection/overview.cjs.map +1 -1
  6. package/dist/inspection/overview.d.cts +5 -0
  7. package/dist/inspection/overview.d.mts +5 -0
  8. package/dist/inspection/overview.d.ts +5 -0
  9. package/dist/inspection/protocol.d.cts +238 -0
  10. package/dist/inspection/protocol.d.mts +238 -0
  11. package/dist/inspection/protocol.d.ts +238 -0
  12. package/dist/inspection/public.mjs +43 -19
  13. package/dist/inspection/results.cjs +11 -10
  14. package/dist/inspection/results.cjs.map +1 -1
  15. package/dist/inspection/results.d.cts +34 -0
  16. package/dist/inspection/results.d.mts +34 -0
  17. package/dist/inspection/results.d.ts +34 -0
  18. package/dist/record/attachment/protocol.cjs +10 -5
  19. package/dist/record/attachment/protocol.cjs.map +1 -1
  20. package/dist/record/attachment/protocol.d.cts +4 -0
  21. package/dist/record/attachment/protocol.d.mts +4 -0
  22. package/dist/record/attachment/protocol.d.ts +4 -0
  23. package/dist/record/family/source-receipt/index.cjs +16 -3
  24. package/dist/record/family/source-receipt/index.cjs.map +1 -1
  25. package/dist/record/family/source-receipt/index.d.cts +1 -0
  26. package/dist/record/family/source-receipt/index.d.mts +1 -0
  27. package/dist/record/family/source-receipt/index.d.ts +1 -0
  28. package/dist/record/family/source-receipt/index.js +2 -0
  29. package/dist/record/host/sqlite-host.cjs +3 -0
  30. package/dist/record/host/sqlite-host.cjs.map +1 -1
  31. package/dist/record/host/types.cjs.map +1 -1
  32. package/dist/record/host/types.d.cts +3 -1
  33. package/dist/record/host/types.d.mts +3 -1
  34. package/dist/record/host/types.d.ts +3 -1
  35. package/dist/record/sqlite/storage.cjs +11 -8
  36. package/dist/record/sqlite/storage.cjs.map +1 -1
  37. package/dist/record/writer/current-attachment.cjs +18 -13
  38. package/dist/record/writer/current-attachment.cjs.map +1 -1
  39. package/dist/record/writer/errors.cjs +6 -1
  40. package/dist/record/writer/errors.cjs.map +1 -1
  41. package/dist/record/writer/errors.d.cts +7 -1
  42. package/dist/record/writer/errors.d.mts +7 -1
  43. package/dist/record/writer/errors.d.ts +7 -1
  44. package/dist/runner/adoption.cjs +1 -1
  45. package/dist/runner/adoption.cjs.map +1 -1
  46. package/dist/runner/reuse-plan.cjs +1 -1
  47. package/dist/runner/reuse-plan.cjs.map +1 -1
  48. package/dist/runner/source-receipts/support.cjs +2 -1
  49. package/dist/runner/source-receipts/support.cjs.map +1 -1
  50. package/dist/runner/source-receipts/support.d.cts +1 -1
  51. package/dist/runner/source-receipts/support.d.mts +1 -1
  52. package/dist/runner/source-receipts/support.d.ts +1 -1
  53. package/dist/show/contribution.cjs +11 -2
  54. package/dist/show/contribution.cjs.map +1 -1
  55. package/dist/show/contribution.d.cts +7 -0
  56. package/dist/show/contribution.d.mts +7 -0
  57. package/dist/show/contribution.d.ts +7 -0
  58. package/dist/show/model.cjs +1 -0
  59. package/dist/show/model.cjs.map +1 -1
  60. package/dist/show/model.d.cts +2 -0
  61. package/dist/show/model.d.mts +2 -0
  62. package/dist/show/model.d.ts +2 -0
  63. package/dist/show/render.cjs +149 -81
  64. package/dist/show/render.cjs.map +1 -1
  65. package/dist/show/render.d.cts +3 -1
  66. package/dist/show/render.d.mts +3 -1
  67. package/dist/show/render.d.ts +3 -1
  68. package/dist/view/app-dist/.vite/manifest.json +18 -18
  69. package/dist/view/app-dist/assets/{AttemptDialog-DKEWcS7m.js → AttemptDialog-76dX1VQq.js} +1 -1
  70. package/dist/view/app-dist/assets/{AttemptRoute-DUs5kic4.js → AttemptRoute-DRHVh2JA.js} +1 -1
  71. package/dist/view/app-dist/assets/{ResultsPage-VlExJ6F0.js → ResultsPage-9CSI8dvZ.js} +2 -2
  72. package/dist/view/app-dist/assets/{RunPage-B9Bagswz.js → RunPage-BUF0REv7.js} +1 -1
  73. package/dist/view/app-dist/assets/{TableContentView-ZL9elUsA.js → TableContentView-_Sbg5wDr.js} +1 -1
  74. package/dist/view/app-dist/assets/index-BGr_6pGY.js +19 -0
  75. package/dist/view/app-dist/assets/{quality-cost-scatter-BqIAORD4.js → quality-cost-scatter-B5wDa_F1.js} +1 -1
  76. package/dist/view/app-dist/assets/useSuspenseQuery-D3W8Uy33.js +1 -0
  77. package/dist/view/app-dist/index.html +1 -1
  78. package/dist/view/function-runtime.mjs +68 -29
  79. package/docs-site/zh/examples/ai-agent-application.mdx +1 -1
  80. package/docs-site/zh/examples/index.mdx +1 -3
  81. package/docs-site/zh/explanation/evals.mdx +1 -1
  82. package/docs-site/zh/explanation/experiment.mdx +3 -1
  83. package/docs-site/zh/explanation/overview.mdx +6 -4
  84. package/docs-site/zh/explanation/record.mdx +9 -5
  85. package/docs-site/zh/explanation/runner.mdx +3 -3
  86. package/docs-site/zh/index.mdx +4 -8
  87. package/docs-site/zh/introduction.mdx +2 -2
  88. package/docs-site/zh/reference/cli.mdx +8 -7
  89. package/docs-site/zh/troubleshooting/debug-sandbox.mdx +5 -5
  90. package/docs-site/zh/troubleshooting/debugging.mdx +8 -8
  91. package/docs-site/zh/troubleshooting/recover-after-kill.mdx +35 -55
  92. package/docs-site/zh/tutorials/accept-results.mdx +4 -4
  93. package/docs-site/zh/tutorials/agent-onboarding.mdx +2 -2
  94. package/docs-site/zh/tutorials/authoring.mdx +1 -1
  95. package/docs-site/zh/tutorials/compare-runs.mdx +3 -3
  96. package/docs-site/zh/tutorials/concurrency.mdx +6 -6
  97. package/docs-site/zh/tutorials/connect-your-agent.mdx +2 -2
  98. package/docs-site/zh/tutorials/docker-in-docker.mdx +1 -1
  99. package/docs-site/zh/tutorials/experiments.mdx +1 -1
  100. package/docs-site/zh/tutorials/install-custom-sandbox-agent.mdx +1 -1
  101. package/docs-site/zh/tutorials/quickstart.mdx +2 -2
  102. package/docs-site/zh/tutorials/reporters.mdx +3 -3
  103. package/docs-site/zh/tutorials/sandbox-agent.mdx +2 -2
  104. package/docs-site/zh/tutorials/sandbox-reuse.mdx +3 -3
  105. package/docs-site/zh/tutorials/viewing-results.mdx +10 -11
  106. package/package.json +1 -1
  107. package/dist/view/app-dist/assets/index-C1E4NkG0.js +0 -19
  108. package/dist/view/app-dist/assets/useSuspenseQuery-BlFuYKyI.js +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"reuse-plan.js","sourceRoot":"","sources":["reuse-plan.ts"],"names":[],"mappings":";;;AA+JA,wDAKC;AAED,kFA2EC;AAKD,wDAyCC;AAED,oFAuBC;AAxTD,mCAAgC;AAGhC,4DAAwE;AACxE,kEAAkG;AAClG,sFAAiK;AACjK,0DAA2F;AAG3F,mEAAkM;AAIrL,QAAA,0BAA0B,GAAG,gBAAyB,CAAC;AACvD,QAAA,6BAA6B,GAAG,CAAU,CAAC;AAC3C,QAAA,2CAA2C,GAAG,GAAY,CAAC;AAC3D,QAAA,6CAA6C,GAAG,IAAa,CAAC;AAK9D,QAAA,2BAA2B,GAA4B,MAAM,CAAC,MAAM,CAAC;IAC9E,IAAI,EAAE,kCAA0B;IAChC,OAAO,EAAE,qCAA6B;CACzC,CAAC,CAAC;AAUH;;;;GAIG;AACU,QAAA,qCAAqC,GAAG,MAAM,CAAC,MAAM,CAAC;IAC/D,iBAAiB,EAAE,oBAA6B;CACnD,CAAC,CAAC;AACU,QAAA,kCAAkC,GAAG;IAC9C,GAAG,mDAAwB;IAC3B,6CAAqC,CAAC,iBAAiB;CACjD,CAAC;AA6GX;;;;GAIG;AACH,SAAgB,sBAAsB,CAAC,KAGtC;IACG,OAAO,IAAA,uCAA0B,EAAC,KAAK,CAAC,CAAC;AAC7C,CAAC;AACD,uFAAuF;AACvF,SAAgB,mCAAmC,CAAC,KAGnD;IACG,MAAM,YAAY,GAAY,KAAK,CAAC;IACpC,IAAI,OAAO,YAAY,KAAK,QA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AK,QAAQ,IAAI,KAAK,KAAK,KAAK,CAAC;AACrE,CAAC;AACD,SAAS,mBAAmB,CAAC,KAAc;IACvC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAC3C,OAAO,KAAK,CAAC;IACjB,MAAM,QAAQ,GAAG,KAGhB,CAAC;IACF,OAAO,OAAO,QAAQ,CAAC,MAAM,KAAK,QAAQ;WACnC,uBAAuB,CAAC,QAAQ,CAAC,MAAM,CAAC;WACxC,OAAO,QAAQ,CAAC,KAAK,KAAK,QAAQ;WAClC,uBAAuB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACnD,CAAC;AACD,SAAS,wBAAwB,CAAC,KAAc;IAC5C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAC3C,OAAO,KAAK,CAAC;IACjB,MAAM,QAAQ,GAAG,KAGhB,CAAC;IACF,OAAO,OAAO,QAAQ,CAAC,MAAM,KAAK,QAAQ;WACnC,uBAAuB,CAAC,QAAQ,CAAC,MAAM,CAAC;WACxC,OAAO,QAAQ,CAAC,YAAY,KAAK,QAAQ;WACzC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC;WACtC,QAAQ,CAAC,YAAY,IAAI,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import { Effect } from \"effect\";\nimport type { RecordIssue } from \"../record/errors/record-errors.ts\";\nimport type { AssertionsAttachment, } from \"../record/family/assertions/definition.ts\";\nimport { NiceEvalRecordAttachments } from \"../record/family/catalog.ts\";\nimport { readAttemptExecutionDuration, type DurationLimit, } from \"../eval/record/eligibility.ts\";\nimport { COMPARISON_SOURCE_STATES, type ComparisonAttachment, type ComparisonResult, type RecordedAttemptClaim, } from \"../eval/record/membership-provenance.ts\";\nimport { foldRecordedAttemptVerdict, type VerdictState, } from \"../eval/record/verdict.ts\";\nimport type { RecordReadSession, ReadableAttempt, ReadableRun, SelectedAttemptRef, SelectedRunRef, } from \"../record/host/types.ts\";\nimport type { RecordCoreRead } from \"../record/model/read-state.ts\";\nimport { compareCanonicalIdentity, isPortableSegment, isSha256Digest, isUtcMillis, type ExecutionIdentityDigest, type RunId, type SlotId, type UtcMillis, } from \"../record/model/identifiers.ts\";\nimport type { AttemptOutcome, RecordSlotIdentity } from \"../record/model/core.ts\";\nimport type { RecordReaderReadError } from \"../record/reader/errors.ts\";\nimport type { EvaluationKind } from \"./types.ts\";\nexport const PROJECT_TARGET_POLICY_NAME = \"project-target\" as const;\nexport const PROJECT_TARGET_POLICY_VERSION = 1 as const;\nexport const PROJECT_TARGET_INVOCATION_ID_MAXIMUM_LENGTH = 255 as const;\nexport const PROJECT_TARGET_RECORD_IDENTITY_MAXIMUM_LENGTH = 4096 as const;\nexport interface ExecutionPolicyIdentity {\n readonly name: typeof PROJECT_TARGET_POLICY_NAME;\n readonly version: typeof PROJECT_TARGET_POLICY_VERSION;\n}\nexport const projectTargetPolicyIdentity: ExecutionPolicyIdentity = Object.freeze({\n name: PROJECT_TARGET_POLICY_NAME,\n version: PROJECT_TARGET_POLICY_VERSION,\n});\n/** Current planner input, kept in memory rather than persisted as an Attachment. */\nexport interface ExecutionIdentity {\n readonly domain: string;\n readonly value: string;\n}\nexport interface ExecutionDurationLimit {\n readonly domain: string;\n readonly milliseconds: number;\n}\n/**\n * Reuse compares current execution identity with the immutable Core Slot,\n * folds Core outcome with Assertions, and reads duration from Runner Activity\n * receipts. None of these facts is a separate eligibility/verdict family.\n */\nexport const EXECUTION_COMPARISON_PROJECTION_STATE = Object.freeze({\n migrationRequired: \"migration-required\" as const,\n});\nexport const EXECUTION_COMPARISON_SOURCE_STATES = [\n ...COMPARISON_SOURCE_STATES,\n EXECUTION_COMPARISON_PROJECTION_STATE.migrationRequired,\n] as const;\nexport type ExecutionComparisonAttachment = ComparisonAttachment;\nexport type ExecutionComparisonSourceState = (typeof EXECUTION_COMPARISON_SOURCE_STATES)[number];\nexport type ExecutionComparisonResult = ComparisonResult;\nexport type ExecutionRecordedClaim = RecordedAttemptClaim;\nexport interface ExecutionComparison {\n readonly attachment: ExecutionComparisonAttachment;\n readonly recordedClaim: ExecutionRecordedClaim;\n readonly sourceState: ExecutionComparisonSourceState;\n readonly result: ExecutionComparisonResult;\n readonly reason: string;\n}\nexport type ExecutionGapReason = \"no-source-run\" | \"source-slot-missing\" | \"source-member-missing\" | \"source-core-invalid\" | \"source-publication-unavailable\" | \"source-attachment-unavailable\" | \"source-attachment-migration-required\" | \"source-attachment-unsupported\" | \"source-attachment-invalid\" | \"reuse-contract-domain-mismatch\" | \"reuse-contract-mismatch\" | \"identity-mismatch\" | \"identity-domain-mismatch\" | \"duration-domain-mismatch\" | \"timeout-exceeded\" | \"attempt-outcome-ineligible\" | \"accepted-action-ineligible\" | \"verdict-ineligible\" | \"rerun-requested\" | \"sandbox-retention-requested\";\nexport type ExecutionGapScope = \"slot\" | \"experiment\" | \"target\";\n/** Origin identity is read from the immutable Attempt, never reconstructed. */\nexport interface ExecutionSourceOrigin {\n readonly runId: RunId;\n readonly slotId: SlotId;\n}\n/** The selected Run boundary may itself be a reference Run. */\nexport interface ExecutionSourceBarrier {\n readonly runId: RunId;\n readonly startedAt: UtcMillis;\n}\nexport interface ExecutionReuseEffectiveOptions {\n readonly rerun: \"none\" | \"failed\" | \"all\";\n readonly keepSandbox: boolean;\n readonly reuseContract: ExecutionIdentity;\n}\nexport interface ExecutionTarget {\n readonly invocationId: string;\n readonly runs: readonly TargetRun[];\n}\nexport interface TargetRun {\n readonly runId: RunId;\n readonly experimentId: string;\n readonly startedAt: UtcMillis;\n readonly slots: readonly TargetSlot[];\n}\n/**\n * `slotId` and `executionIdentityDigest` are deterministic current planning\n * facts. A carried Member can therefore point at the exact immutable origin\n * Attempt without an out-of-band provenance Attachment.\n */\nexport interface TargetSlot {\n readonly runId: RunId;\n readonly slotId: SlotId;\n readonly experimentId: string;\n readonly evalId: string;\n readonly attempt: number;\n readonly evaluationKind: EvaluationKind;\n readonly executionIdentityDigest: ExecutionIdentityDigest;\n readonly inputIdentity: ExecutionIdentity;\n readonly configIdentity: ExecutionIdentity;\n readonly timeout?: ExecutionDurationLimit;\n}\nexport type AssertionsVerdict = VerdictState;\n/** The exact selection-issued references remain live only while its reader Scope is live. */\nexport interface ExecutionReusePlanSource {\n readonly attemptId: SelectedAttemptRef[\"attemptId\"];\n readonly attempt: SelectedAttemptRef & {\n readonly publicationIdentity: NonNullable<SelectedAttemptRef[\"publicationIdentity\"]>;\n };\n readonly origin: ExecutionSourceOrigin;\n readonly originRun: SelectedRunRef;\n readonly sourceBarrier: ExecutionSourceBarrier;\n readonly evaluationKind: EvaluationKind;\n}\nexport interface ProjectTargetPolicy {\n readonly identity: ExecutionPolicyIdentity;\n readonly reuseContract: ExecutionIdentity;\n readonly rerun: \"none\" | \"failed\" | \"all\";\n readonly keepSandbox: boolean;\n}\nexport interface ExecutionReusePlanSlotBase extends TargetSlot {\n readonly comparisons: readonly ExecutionComparison[];\n}\nexport interface ReusePlanSlot extends ExecutionReusePlanSlotBase {\n readonly state: \"reuse\";\n readonly adoption: \"carried\";\n readonly source: ExecutionReusePlanSource;\n}\nexport interface ExecutionGapSlot extends ExecutionReusePlanSlotBase {\n readonly state: \"gap\";\n readonly reason: ExecutionGapReason;\n readonly scope: ExecutionGapScope;\n readonly issues: readonly RecordIssue[];\n readonly sourceBarrier?: ExecutionSourceBarrier;\n readonly candidate?: ExecutionReusePlanSource;\n}\nexport type ExecutionReusePlanSlot = ReusePlanSlot | ExecutionGapSlot;\nexport interface ExecutionReusePlan {\n readonly target: ExecutionTarget;\n readonly policy: ExecutionPolicyIdentity;\n readonly effectiveOptions: ExecutionReuseEffectiveOptions;\n readonly slots: readonly ExecutionReusePlanSlot[];\n readonly reuse: readonly ReusePlanSlot[];\n readonly gaps: readonly ExecutionGapSlot[];\n}\nexport interface ProjectTargetReusePlanInput {\n readonly reader: RecordReadSession;\n readonly target: ExecutionTarget;\n readonly policy: ProjectTargetPolicy;\n}\nexport type ProjectTargetReusePlanInvalidReason = \"invocation-id-invalid\" | \"target-run-invalid\" | \"target-run-duplicate\" | \"target-slot-invalid\" | \"target-slot-duplicate\" | \"target-slot-run-mismatch\" | \"target-slot-experiment-mismatch\" | \"target-slot-ordinal-duplicate\" | \"policy-unsupported\" | \"policy-input-invalid\";\nexport interface ProjectTargetReusePlanInvalid {\n readonly code: \"project-target-reuse-plan-invalid\";\n readonly reason: ProjectTargetReusePlanInvalidReason;\n}\n/**\n * Fold the terminal Verdict from the source Attempt's immutable Core outcome\n * and its fixed Assertions facts. This is a projection, not a second durable\n * Verdict family.\n */\nexport function recordedAttemptVerdict(input: {\n readonly outcome: AttemptOutcome;\n readonly assertions: AssertionsAttachment;\n}): AssertionsVerdict {\n return foldRecordedAttemptVerdict(input);\n}\n/** Input validation is pure; it never invents a target Slot or repairs an identity. */\nexport function validateProjectTargetReusePlanInput(input: {\n readonly target: ExecutionTarget;\n readonly policy: ProjectTargetPolicy;\n}): ProjectTargetReusePlanInvalid | undefined {\n const unknownInput: unknown = input;\n if (typeof unknownInput !== \"object\" || unknownInput === null) {\n return invalidPlan(\"target-run-invalid\");\n }\n const envelope = unknownInput as {\n readonly target?: unknown;\n readonly policy?: unknown;\n };\n if (typeof envelope.target !== \"object\" || envelope.target === null) {\n return invalidPlan(\"target-run-invalid\");\n }\n const target = envelope.target as {\n readonly invocationId?: unknown;\n readonly runs?: unknown;\n };\n if (typeof target.invocationId !== \"string\"\n || !isBoundedNonEmptyText(target.invocationId, PROJECT_TARGET_INVOCATION_ID_MAXIMUM_LENGTH)\n || !Array.isArray(target.runs)) {\n return invalidPlan(\"invocation-id-invalid\");\n }\n if (typeof envelope.policy !== \"object\" || envelope.policy === null) {\n return invalidPlan(\"policy-input-invalid\");\n }\n const policy = envelope.policy as {\n readonly identity?: unknown;\n readonly reuseContract?: unknown;\n readonly rerun?: unknown;\n readonly keepSandbox?: unknown;\n };\n if (typeof policy.identity !== \"object\"\n || policy.identity === null\n || (policy.identity as {\n readonly name?: unknown;\n }).name !== PROJECT_TARGET_POLICY_NAME\n || (policy.identity as {\n readonly version?: unknown;\n }).version !== PROJECT_TARGET_POLICY_VERSION) {\n return invalidPlan(\"policy-unsupported\");\n }\n if (!isExecutionIdentity(policy.reuseContract)\n || !isRerunOption(policy.rerun)\n || typeof policy.keepSandbox !== \"boolean\") {\n return invalidPlan(\"policy-input-invalid\");\n }\n const runIds = new Set<string>();\n const slotIds = new Set<string>();\n const ordinals = new Set<string>();\n for (const run of target.runs) {\n if (!isTargetRun(run))\n return invalidPlan(\"target-run-invalid\");\n if (runIds.has(run.runId))\n return invalidPlan(\"target-run-duplicate\");\n runIds.add(run.runId);\n for (const slot of run.slots) {\n if (!isTargetSlot(slot))\n return invalidPlan(\"target-slot-invalid\");\n if (slot.runId !== run.runId)\n return invalidPlan(\"target-slot-run-mismatch\");\n if (slot.experimentId !== run.experimentId) {\n return invalidPlan(\"target-slot-experiment-mismatch\");\n }\n if (slotIds.has(slot.slotId))\n return invalidPlan(\"target-slot-duplicate\");\n slotIds.add(slot.slotId);\n const ordinal = sourceKey(slot.experimentId, slot.evalId, String(slot.attempt));\n if (ordinals.has(ordinal))\n return invalidPlan(\"target-slot-ordinal-duplicate\");\n ordinals.add(ordinal);\n }\n }\n return undefined;\n}\n/**\n * Plans only from Record Host selection references. It neither reconstructs\n * attempt handles from strings nor reads private Record paths.\n */\nexport function planProjectTargetReuse(input: ProjectTargetReusePlanInput): Effect.Effect<ExecutionReusePlan, ProjectTargetReusePlanInvalid | RecordReaderReadError> {\n return Effect.suspend<ExecutionReusePlan, ProjectTargetReusePlanInvalid | RecordReaderReadError, never>(() => {\n const invalid = validateProjectTargetReusePlanInput(input);\n if (invalid !== undefined)\n return Effect.fail(invalid);\n return Effect.gen(function* () {\n const selection = yield* input.reader.selectRuns();\n const readable = yield* Effect.forEach(selection.runRefs, (ref) => input.reader.readRun(ref), { concurrency: 1 });\n const runs: ReadableRun[] = [];\n const coreIssues: RecordIssue[] = [];\n for (const read of readable) {\n if (read.state === \"available\")\n runs.push(read.value);\n else if (read.state === \"core-invalid\")\n coreIssues.push(...read.issues);\n }\n const byRunId = new Map(runs.map((run) => [run.document.runId, run] as const));\n const slots: ExecutionReusePlanSlot[] = [];\n for (const target of flattenTargetSlots(input.target)) {\n slots.push(yield* planTargetSlot({\n reader: input.reader,\n target,\n policy: input.policy,\n runs,\n byRunId,\n selectionHasProblem: selection.problems.length > 0 || coreIssues.length > 0,\n coreIssues,\n }));\n }\n const reuse = slots.filter((slot): slot is ReusePlanSlot => slot.state === \"reuse\");\n const gaps = slots.filter((slot): slot is ExecutionGapSlot => slot.state === \"gap\");\n return Object.freeze({\n target: input.target,\n policy: projectTargetPolicyIdentity,\n effectiveOptions: effectiveOptions(input.policy),\n slots: Object.freeze(slots),\n reuse: Object.freeze(reuse),\n gaps: Object.freeze(gaps),\n });\n });\n });\n}\n/** Empty or not-yet-created Record roots produce no source capability. */\nexport function planProjectTargetReuseWithoutSources(input: {\n readonly target: ExecutionTarget;\n readonly policy: ProjectTargetPolicy;\n}): Effect.Effect<ExecutionReusePlan, ProjectTargetReusePlanInvalid> {\n return Effect.suspend(() => {\n const invalid = validateProjectTargetReusePlanInput(input);\n if (invalid !== undefined)\n return Effect.fail(invalid);\n const gaps = Object.freeze(flattenTargetSlots(input.target).map((target) => gapSlot(target, {\n reason: \"no-source-run\",\n scope: \"slot\",\n issues: [],\n comparisons: [],\n })));\n return Effect.succeed(Object.freeze({\n target: input.target,\n policy: projectTargetPolicyIdentity,\n effectiveOptions: effectiveOptions(input.policy),\n slots: gaps,\n reuse: Object.freeze([]),\n gaps,\n }));\n });\n}\nexport const ProjectTargetReusePlanner = Object.freeze({ plan: planProjectTargetReuse });\nfunction planTargetSlot(input: {\n readonly reader: RecordReadSession;\n readonly target: TargetSlot;\n readonly policy: ProjectTargetPolicy;\n readonly runs: readonly ReadableRun[];\n readonly byRunId: ReadonlyMap<RunId, ReadableRun>;\n readonly selectionHasProblem: boolean;\n readonly coreIssues: readonly RecordIssue[];\n}): Effect.Effect<ExecutionReusePlanSlot, RecordReaderReadError> {\n return Effect.gen(function* () {\n if (input.selectionHasProblem) {\n return gapSlot(input.target, {\n reason: \"source-core-invalid\",\n scope: \"target\",\n issues: input.coreIssues,\n comparisons: [],\n });\n }\n const sourceRun = latestSourceRun(input.runs, input.target);\n if (sourceRun === undefined) {\n return gapSlot(input.target, {\n reason: \"no-source-run\",\n scope: \"slot\",\n issues: [],\n comparisons: [],\n });\n }\n const sourceBarrier = Object.freeze({\n runId: sourceRun.document.runId,\n startedAt: sourceRun.document.startedAt,\n });\n const expected = sourceRun.document.expectedSlots.find((slot) => slot.evalId === input.target.evalId\n && slot.attemptOrdinal === input.target.attempt);\n if (expected === undefined) {\n return gapSlot(input.target, {\n reason: \"source-slot-missing\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n comparisons: [],\n });\n }\n const member = sourceRun.members.find((candidate) => candidate.document.slotId === expected.slotId);\n if (member === undefined || member.attempt === null) {\n return gapSlot(input.target, {\n reason: \"source-member-missing\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n comparisons: [],\n });\n }\n const readAttempt = yield* input.reader.readAttempt(member.attempt);\n if (readAttempt.state !== \"available\") {\n return gapSlot(input.target, {\n reason: \"source-core-invalid\",\n scope: \"slot\",\n issues: issuesOf(readAttempt),\n sourceBarrier,\n comparisons: [],\n });\n }\n if (!hasPublicationIdentity(readAttempt.value)) {\n return gapSlot(input.target, {\n reason: \"source-publication-unavailable\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n comparisons: [],\n });\n }\n const candidateResolution = candidateFor({\n target: input.target,\n sourceBarrier,\n attempt: readAttempt.value,\n byRunId: input.byRunId,\n });\n if (candidateResolution === undefined) {\n return gapSlot(input.target, {\n reason: \"source-core-invalid\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n comparisons: [],\n });\n }\n const candidate = candidateResolution.source;\n if (member.document.action === \"accepted\") {\n return gapSlot(input.target, {\n reason: \"accepted-action-ineligible\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [],\n });\n }\n if (!reusableSlotIdentityMatches({\n target: input.target,\n sourceExpected: expected,\n originExpected: candidateResolution.originExpected,\n })) {\n return gapSlot(input.target, {\n reason: \"identity-mismatch\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [identityMismatchComparison()],\n });\n }\n const assertions = yield* input.reader.read(readAttempt.value.owner, NiceEvalRecordAttachments.assertions);\n if (assertions.state !== \"available\") {\n const problem = attachmentProblem(assertions);\n return gapSlot(input.target, {\n reason: problem.reason,\n scope: \"slot\",\n issues: problem.issues,\n sourceBarrier,\n candidate,\n comparisons: [comparison(\"niceeval.assertions\", \"assertion-verdict\", problem.state, \"not-comparable\", problem.reason)],\n });\n }\n const verdict = recordedAttemptVerdict({\n outcome: readAttempt.value.document.outcome,\n assertions: assertions.value,\n });\n if (readAttempt.value.document.outcome !== \"completed\") {\n return gapSlot(input.target, {\n reason: \"attempt-outcome-ineligible\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [\n comparison(\"core\", \"attempt-outcome\", \"available\", \"ineligible\", `attempt-${readAttempt.value.document.outcome}`),\n verdictComparison(verdict, \"ineligible\"),\n ],\n });\n }\n if (verdict !== \"passed\" && verdict !== \"failed\") {\n return gapSlot(input.target, {\n reason: \"verdict-ineligible\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [verdictComparison(verdict, \"ineligible\")],\n });\n }\n const activities = yield* input.reader.read(readAttempt.value.owner, NiceEvalRecordAttachments.runnerActivities.attempt);\n if (activities.state !== \"available\") {\n const problem = attachmentProblem(activities);\n return gapSlot(input.target, {\n reason: problem.reason,\n scope: \"slot\",\n issues: problem.issues,\n sourceBarrier,\n candidate,\n comparisons: [comparison(\"niceeval.runner-activities\", \"execution-duration\", problem.state, \"not-comparable\", problem.reason)],\n });\n }\n const durationRead = readAttemptExecutionDuration(activities.value);\n if (durationRead.state !== \"available\") {\n return gapSlot(input.target, {\n reason: \"source-attachment-unavailable\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [comparison(\"niceeval.runner-activities\", \"execution-duration\", \"unavailable\", \"not-comparable\", durationRead.reason)],\n });\n }\n const duration = durationComparison({\n source: durationRead.duration,\n target: input.target.timeout,\n });\n if (duration.failure !== undefined) {\n return gapSlot(input.target, {\n reason: duration.failure,\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [duration.comparison],\n });\n }\n if (input.policy.rerun === \"all\"\n || (input.policy.rerun === \"failed\" && verdict === \"failed\")) {\n return gapSlot(input.target, {\n reason: \"rerun-requested\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [verdictComparison(verdict, \"match\"), duration.comparison],\n });\n }\n if (input.policy.keepSandbox) {\n return gapSlot(input.target, {\n reason: \"sandbox-retention-requested\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [verdictComparison(verdict, \"match\"), duration.comparison],\n });\n }\n return Object.freeze({\n ...input.target,\n state: \"reuse\" as const,\n adoption: \"carried\" as const,\n source: candidate,\n comparisons: Object.freeze([\n comparison(\"core\", \"execution-identity\", \"available\", \"match\", \"execution-identity-match\"),\n comparison(\"core\", \"attempt-outcome\", \"available\", \"match\", \"attempt-completed\"),\n verdictComparison(verdict, \"match\"),\n duration.comparison,\n ]),\n });\n });\n}\nfunction latestSourceRun(runs: readonly ReadableRun[], target: TargetSlot): ReadableRun | undefined {\n const candidates = runs.filter((run) => run.document.experimentId === target.experimentId\n && run.document.expectedSlots.some((slot) => slot.evalId === target.evalId));\n return candidates.sort(compareReadableRuns).at(-1);\n}\nfunction compareReadableRuns(left: ReadableRun, right: ReadableRun): number {\n if (left.document.startedAt !== right.document.startedAt) {\n return left.document.startedAt < right.document.startedAt ? -1 : 1;\n }\n return compareCanonicalIdentity(left.document.runId, right.document.runId);\n}\ninterface CandidateResolution {\n readonly source: ExecutionReusePlanSource;\n readonly originExpected: RecordSlotIdentity;\n}\nfunction hasPublicationIdentity(attempt: ReadableAttempt): attempt is ReadableAttempt & {\n readonly ref: ExecutionReusePlanSource[\"attempt\"];\n} {\n return attempt.ref.publicationIdentity !== undefined;\n}\nfunction candidateFor(input: {\n readonly target: TargetSlot;\n readonly sourceBarrier: ExecutionSourceBarrier;\n readonly attempt: ReadableAttempt & {\n readonly ref: ExecutionReusePlanSource[\"attempt\"];\n };\n readonly byRunId: ReadonlyMap<RunId, ReadableRun>;\n}): CandidateResolution | undefined {\n const document = input.attempt.document;\n const originRun = input.byRunId.get(document.originRunId);\n if (originRun === undefined)\n return undefined;\n const originExpected = originRun.document.expectedSlots.find((slot) => slot.slotId === document.slotId);\n if (originExpected === undefined\n || document.evalId !== originExpected.evalId\n || document.executionIdentityDigest !== originExpected.executionIdentityDigest) {\n return undefined;\n }\n return Object.freeze({\n source: Object.freeze({\n attemptId: input.attempt.ref.attemptId,\n attempt: input.attempt.ref,\n origin: Object.freeze({ runId: document.originRunId, slotId: document.slotId }),\n originRun: originRun.ref,\n sourceBarrier: input.sourceBarrier,\n evaluationKind: input.target.evaluationKind,\n }),\n originExpected,\n });\n}\nfunction sameSlotIdentity(left: RecordSlotIdentity, right: RecordSlotIdentity): boolean {\n return left.slotId === right.slotId\n && left.evalId === right.evalId\n && left.attemptOrdinal === right.attemptOrdinal\n && left.executionIdentityDigest === right.executionIdentityDigest;\n}\nfunction targetMatchesSlotIdentity(target: TargetSlot, slot: RecordSlotIdentity): boolean {\n return target.slotId === slot.slotId\n && target.evalId === slot.evalId\n && target.attempt === slot.attemptOrdinal\n && target.executionIdentityDigest === slot.executionIdentityDigest;\n}\nfunction reusableSlotIdentityMatches(input: {\n readonly target: TargetSlot;\n readonly sourceExpected: RecordSlotIdentity;\n readonly originExpected: RecordSlotIdentity;\n}): boolean {\n return sameSlotIdentity(input.sourceExpected, input.originExpected)\n && targetMatchesSlotIdentity(input.target, input.sourceExpected)\n && targetMatchesSlotIdentity(input.target, input.originExpected);\n}\nfunction issuesOf(read: RecordCoreRead<unknown>): readonly RecordIssue[] {\n return read.state === \"core-invalid\" ? read.issues : Object.freeze([]);\n}\nfunction attachmentProblem(input: {\n readonly state: \"not-recorded\" | \"migration-required\" | \"unsupported\" | \"invalid\";\n readonly family?: string;\n readonly schemaVersion?: number;\n readonly issues?: readonly RecordIssue[];\n}): {\n readonly reason: Extract<ExecutionGapReason, \"source-attachment-unavailable\" | \"source-attachment-migration-required\" | \"source-attachment-unsupported\" | \"source-attachment-invalid\">;\n readonly state: Exclude<ExecutionComparisonSourceState, \"available\">;\n readonly issues: readonly RecordIssue[];\n} {\n switch (input.state) {\n case \"not-recorded\":\n return Object.freeze({\n reason: \"source-attachment-unavailable\" as const,\n state: \"unavailable\" as const,\n issues: Object.freeze([]),\n });\n case \"migration-required\":\n return Object.freeze({\n reason: \"source-attachment-migration-required\" as const,\n state: EXECUTION_COMPARISON_PROJECTION_STATE.migrationRequired,\n issues: Object.freeze([]),\n });\n case \"unsupported\":\n return Object.freeze({\n reason: \"source-attachment-unsupported\" as const,\n state: \"unsupported\" as const,\n issues: Object.freeze([]),\n });\n case \"invalid\":\n return Object.freeze({\n reason: \"source-attachment-invalid\" as const,\n state: \"invalid\" as const,\n issues: input.issues ?? Object.freeze([]),\n });\n }\n}\nfunction identityMismatchComparison(): ExecutionComparison {\n return comparison(\"core\", \"execution-identity\", \"available\", \"mismatch\", \"identity-mismatch\");\n}\nfunction verdictComparison(verdict: AssertionsVerdict, result: Extract<ExecutionComparisonResult, \"match\" | \"ineligible\">): ExecutionComparison {\n return comparison(\"niceeval.assertions\", \"assertion-verdict\", \"available\", result, verdict === \"errored\" ? \"verdict-ineligible\" : `verdict-${verdict}`);\n}\nfunction durationComparison(input: {\n readonly source: DurationLimit;\n readonly target: ExecutionDurationLimit | undefined;\n}): {\n readonly comparison: ExecutionComparison;\n readonly failure?: \"duration-domain-mismatch\" | \"timeout-exceeded\";\n} {\n if (input.target === undefined) {\n return {\n comparison: comparison(\"niceeval.runner-activities\", \"execution-duration\", \"available\", \"match\", \"timeout-unbounded\"),\n };\n }\n if (input.source.domain !== input.target.domain) {\n return {\n comparison: comparison(\"niceeval.runner-activities\", \"execution-duration\", \"available\", \"mismatch\", \"duration-domain-mismatch\"),\n failure: \"duration-domain-mismatch\",\n };\n }\n if (input.source.milliseconds > input.target.milliseconds) {\n return {\n comparison: comparison(\"niceeval.runner-activities\", \"execution-duration\", \"available\", \"mismatch\", \"timeout-exceeded\"),\n failure: \"timeout-exceeded\",\n };\n }\n return {\n comparison: comparison(\"niceeval.runner-activities\", \"execution-duration\", \"available\", \"match\", \"duration-within-timeout\"),\n };\n}\nfunction comparison(attachment: ExecutionComparisonAttachment, recordedClaim: ExecutionRecordedClaim, sourceState: ExecutionComparisonSourceState, result: ExecutionComparisonResult, reason: string): ExecutionComparison {\n return Object.freeze({ attachment, recordedClaim, sourceState, result, reason });\n}\nfunction gapSlot(target: TargetSlot, input: {\n readonly reason: ExecutionGapReason;\n readonly scope: ExecutionGapScope;\n readonly issues: readonly RecordIssue[];\n readonly comparisons: readonly ExecutionComparison[];\n readonly sourceBarrier?: ExecutionSourceBarrier;\n readonly candidate?: ExecutionReusePlanSource;\n}): ExecutionGapSlot {\n return Object.freeze({\n ...target,\n state: \"gap\" as const,\n reason: input.reason,\n scope: input.scope,\n issues: Object.freeze([...input.issues]),\n ...(input.sourceBarrier === undefined ? {} : { sourceBarrier: input.sourceBarrier }),\n ...(input.candidate === undefined ? {} : { candidate: input.candidate }),\n comparisons: Object.freeze([...input.comparisons]),\n });\n}\nfunction effectiveOptions(policy: ProjectTargetPolicy): ExecutionReuseEffectiveOptions {\n return Object.freeze({\n rerun: policy.rerun,\n keepSandbox: policy.keepSandbox,\n reuseContract: Object.freeze({\n domain: policy.reuseContract.domain,\n value: policy.reuseContract.value,\n }),\n });\n}\nfunction flattenTargetSlots(target: ExecutionTarget): readonly TargetSlot[] {\n return Object.freeze(target.runs.flatMap((run) => run.slots));\n}\nfunction sourceKey(experimentId: string, evalId: string, ordinal?: string): string {\n return ordinal === undefined\n ? `${experimentId}\\u0000${evalId}`\n : `${experimentId}\\u0000${evalId}\\u0000${ordinal}`;\n}\nfunction invalidPlan(reason: ProjectTargetReusePlanInvalidReason): ProjectTargetReusePlanInvalid {\n return Object.freeze({ code: \"project-target-reuse-plan-invalid\", reason });\n}\nfunction isTargetRun(value: unknown): value is TargetRun {\n if (typeof value !== \"object\" || value === null)\n return false;\n const run = value as Partial<TargetRun>;\n return (typeof run.runId === \"string\"\n && isPortableSegment(run.runId)\n && typeof run.experimentId === \"string\"\n && isBoundedRecordIdentity(run.experimentId)\n && typeof run.startedAt === \"number\"\n && isUtcMillis(run.startedAt)\n && Array.isArray(run.slots));\n}\nfunction isTargetSlot(value: unknown): value is TargetSlot {\n if (typeof value !== \"object\" || value === null)\n return false;\n const slot = value as Partial<TargetSlot>;\n return (typeof slot.runId === \"string\"\n && isPortableSegment(slot.runId)\n && typeof slot.slotId === \"string\"\n && isPortableSegment(slot.slotId)\n && typeof slot.experimentId === \"string\"\n && isBoundedRecordIdentity(slot.experimentId)\n && typeof slot.evalId === \"string\"\n && isBoundedRecordIdentity(slot.evalId)\n && typeof slot.attempt === \"number\"\n && Number.isSafeInteger(slot.attempt)\n && slot.attempt >= 0\n && (slot.evaluationKind === \"pass\" || slot.evaluationKind === \"score\")\n && typeof slot.executionIdentityDigest === \"string\"\n && isSha256Digest(slot.executionIdentityDigest)\n && isExecutionIdentity(slot.inputIdentity)\n && isExecutionIdentity(slot.configIdentity)\n && (slot.timeout === undefined || isExecutionDurationLimit(slot.timeout)));\n}\nfunction isBoundedNonEmptyText(value: string, maximumLength: number): boolean {\n return value.length > 0 && value.length <= maximumLength;\n}\nfunction isBoundedRecordIdentity(value: string): boolean {\n return isBoundedNonEmptyText(value, PROJECT_TARGET_RECORD_IDENTITY_MAXIMUM_LENGTH)\n && !value.includes(\"\\u0000\");\n}\nfunction isRerunOption(value: unknown): value is ProjectTargetPolicy[\"rerun\"] {\n return value === \"none\" || value === \"failed\" || value === \"all\";\n}\nfunction isExecutionIdentity(value: unknown): value is ExecutionIdentity {\n if (typeof value !== \"object\" || value === null)\n return false;\n const identity = value as {\n readonly domain?: unknown;\n readonly value?: unknown;\n };\n return typeof identity.domain === \"string\"\n && isBoundedRecordIdentity(identity.domain)\n && typeof identity.value === \"string\"\n && isBoundedRecordIdentity(identity.value);\n}\nfunction isExecutionDurationLimit(value: unknown): value is ExecutionDurationLimit {\n if (typeof value !== \"object\" || value === null)\n return false;\n const duration = value as {\n readonly domain?: unknown;\n readonly milliseconds?: unknown;\n };\n return typeof duration.domain === \"string\"\n && isBoundedRecordIdentity(duration.domain)\n && typeof duration.milliseconds === \"number\"\n && Number.isFinite(duration.milliseconds)\n && duration.milliseconds >= 0;\n}\n"]}
1
+ {"version":3,"file":"reuse-plan.js","sourceRoot":"","sources":["reuse-plan.ts"],"names":[],"mappings":";;;AA+JA,wDAKC;AAED,kFA2EC;AAKD,wDAyCC;AAED,oFAuBC;AAxTD,mCAAgC;AAGhC,4DAAwE;AACxE,kEAAkG;AAClG,sFAAiK;AACjK,0DAA2F;AAG3F,mEAAkM;AAIrL,QAAA,0BAA0B,GAAG,gBAAyB,CAAC;AACvD,QAAA,6BAA6B,GAAG,CAAU,CAAC;AAC3C,QAAA,2CAA2C,GAAG,GAAY,CAAC;AAC3D,QAAA,6CAA6C,GAAG,IAAa,CAAC;AAK9D,QAAA,2BAA2B,GAA4B,MAAM,CAAC,MAAM,CAAC;IAC9E,IAAI,EAAE,kCAA0B;IAChC,OAAO,EAAE,qCAA6B;CACzC,CAAC,CAAC;AAUH;;;;GAIG;AACU,QAAA,qCAAqC,GAAG,MAAM,CAAC,MAAM,CAAC;IAC/D,iBAAiB,EAAE,oBAA6B;CACnD,CAAC,CAAC;AACU,QAAA,kCAAkC,GAAG;IAC9C,GAAG,mDAAwB;IAC3B,6CAA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,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,aAAa,CAAC;AAC7D,CAAC;AACD,SAAS,uBAAuB,CAAC,KAAa;IAC1C,OAAO,qBAAqB,CAAC,KAAK,EAAE,qDAA6C,CAAC;WAC3E,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACrC,CAAC;AACD,SAAS,aAAa,CAAC,KAAc;IACjC,OAAO,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,KAAK,CAAC;AACrE,CAAC;AACD,SAAS,mBAAmB,CAAC,KAAc;IACvC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAC3C,OAAO,KAAK,CAAC;IACjB,MAAM,QAAQ,GAAG,KAGhB,CAAC;IACF,OAAO,OAAO,QAAQ,CAAC,MAAM,KAAK,QAAQ;WACnC,uBAAuB,CAAC,QAAQ,CAAC,MAAM,CAAC;WACxC,OAAO,QAAQ,CAAC,KAAK,KAAK,QAAQ;WAClC,uBAAuB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACnD,CAAC;AACD,SAAS,wBAAwB,CAAC,KAAc;IAC5C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAC3C,OAAO,KAAK,CAAC;IACjB,MAAM,QAAQ,GAAG,KAGhB,CAAC;IACF,OAAO,OAAO,QAAQ,CAAC,MAAM,KAAK,QAAQ;WACnC,uBAAuB,CAAC,QAAQ,CAAC,MAAM,CAAC;WACxC,OAAO,QAAQ,CAAC,YAAY,KAAK,QAAQ;WACzC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC;WACtC,QAAQ,CAAC,YAAY,IAAI,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import { Effect } from \"effect\";\nimport type { RecordIssue } from \"../record/errors/record-errors.ts\";\nimport type { AssertionsAttachment, } from \"../record/family/assertions/definition.ts\";\nimport { NiceEvalRecordAttachments } from \"../record/family/catalog.ts\";\nimport { readAttemptExecutionDuration, type DurationLimit, } from \"../eval/record/eligibility.ts\";\nimport { COMPARISON_SOURCE_STATES, type ComparisonAttachment, type ComparisonResult, type RecordedAttemptClaim, } from \"../eval/record/membership-provenance.ts\";\nimport { foldRecordedAttemptVerdict, type VerdictState, } from \"../eval/record/verdict.ts\";\nimport type { RecordReadSession, ReadableAttempt, ReadableRun, SelectedAttemptRef, SelectedRunRef, } from \"../record/host/types.ts\";\nimport type { RecordCoreRead } from \"../record/model/read-state.ts\";\nimport { compareCanonicalIdentity, isPortableSegment, isSha256Digest, isUtcMillis, type ExecutionIdentityDigest, type RunId, type SlotId, type UtcMillis, } from \"../record/model/identifiers.ts\";\nimport type { AttemptOutcome, RecordSlotIdentity } from \"../record/model/core.ts\";\nimport type { RecordReaderReadError } from \"../record/reader/errors.ts\";\nimport type { EvaluationKind } from \"./types.ts\";\nexport const PROJECT_TARGET_POLICY_NAME = \"project-target\" as const;\nexport const PROJECT_TARGET_POLICY_VERSION = 1 as const;\nexport const PROJECT_TARGET_INVOCATION_ID_MAXIMUM_LENGTH = 255 as const;\nexport const PROJECT_TARGET_RECORD_IDENTITY_MAXIMUM_LENGTH = 4096 as const;\nexport interface ExecutionPolicyIdentity {\n readonly name: typeof PROJECT_TARGET_POLICY_NAME;\n readonly version: typeof PROJECT_TARGET_POLICY_VERSION;\n}\nexport const projectTargetPolicyIdentity: ExecutionPolicyIdentity = Object.freeze({\n name: PROJECT_TARGET_POLICY_NAME,\n version: PROJECT_TARGET_POLICY_VERSION,\n});\n/** Current planner input, kept in memory rather than persisted as an Attachment. */\nexport interface ExecutionIdentity {\n readonly domain: string;\n readonly value: string;\n}\nexport interface ExecutionDurationLimit {\n readonly domain: string;\n readonly milliseconds: number;\n}\n/**\n * Reuse compares current execution identity with the immutable Core Slot,\n * folds Core outcome with Assertions, and reads duration from Runner Activity\n * receipts. None of these facts is a separate eligibility/verdict family.\n */\nexport const EXECUTION_COMPARISON_PROJECTION_STATE = Object.freeze({\n migrationRequired: \"migration-required\" as const,\n});\nexport const EXECUTION_COMPARISON_SOURCE_STATES = [\n ...COMPARISON_SOURCE_STATES,\n EXECUTION_COMPARISON_PROJECTION_STATE.migrationRequired,\n] as const;\nexport type ExecutionComparisonAttachment = ComparisonAttachment;\nexport type ExecutionComparisonSourceState = (typeof EXECUTION_COMPARISON_SOURCE_STATES)[number];\nexport type ExecutionComparisonResult = ComparisonResult;\nexport type ExecutionRecordedClaim = RecordedAttemptClaim;\nexport interface ExecutionComparison {\n readonly attachment: ExecutionComparisonAttachment;\n readonly recordedClaim: ExecutionRecordedClaim;\n readonly sourceState: ExecutionComparisonSourceState;\n readonly result: ExecutionComparisonResult;\n readonly reason: string;\n}\nexport type ExecutionGapReason = \"no-source-run\" | \"source-slot-missing\" | \"source-member-missing\" | \"source-core-invalid\" | \"source-publication-unavailable\" | \"source-attachment-unavailable\" | \"source-attachment-migration-required\" | \"source-attachment-unsupported\" | \"source-attachment-invalid\" | \"reuse-contract-domain-mismatch\" | \"reuse-contract-mismatch\" | \"identity-mismatch\" | \"identity-domain-mismatch\" | \"duration-domain-mismatch\" | \"timeout-exceeded\" | \"attempt-outcome-ineligible\" | \"accepted-action-ineligible\" | \"verdict-ineligible\" | \"rerun-requested\" | \"sandbox-retention-requested\";\nexport type ExecutionGapScope = \"slot\" | \"experiment\" | \"target\";\n/** Origin identity is read from the immutable Attempt, never reconstructed. */\nexport interface ExecutionSourceOrigin {\n readonly runId: RunId;\n readonly slotId: SlotId;\n}\n/** The selected Run boundary may itself be a reference Run. */\nexport interface ExecutionSourceBarrier {\n readonly runId: RunId;\n readonly startedAt: UtcMillis;\n}\nexport interface ExecutionReuseEffectiveOptions {\n readonly rerun: \"none\" | \"failed\" | \"all\";\n readonly keepSandbox: boolean;\n readonly reuseContract: ExecutionIdentity;\n}\nexport interface ExecutionTarget {\n readonly invocationId: string;\n readonly runs: readonly TargetRun[];\n}\nexport interface TargetRun {\n readonly runId: RunId;\n readonly experimentId: string;\n readonly startedAt: UtcMillis;\n readonly slots: readonly TargetSlot[];\n}\n/**\n * `slotId` and `executionIdentityDigest` are deterministic current planning\n * facts. A carried Member can therefore point at the exact immutable origin\n * Attempt without an out-of-band provenance Attachment.\n */\nexport interface TargetSlot {\n readonly runId: RunId;\n readonly slotId: SlotId;\n readonly experimentId: string;\n readonly evalId: string;\n readonly attempt: number;\n readonly evaluationKind: EvaluationKind;\n readonly executionIdentityDigest: ExecutionIdentityDigest;\n readonly inputIdentity: ExecutionIdentity;\n readonly configIdentity: ExecutionIdentity;\n readonly timeout?: ExecutionDurationLimit;\n}\nexport type AssertionsVerdict = VerdictState;\n/** The exact selection-issued references remain live only while its reader Scope is live. */\nexport interface ExecutionReusePlanSource {\n readonly attemptId: SelectedAttemptRef[\"attemptId\"];\n readonly attempt: SelectedAttemptRef & {\n readonly publicationIdentity: NonNullable<SelectedAttemptRef[\"publicationIdentity\"]>;\n };\n readonly origin: ExecutionSourceOrigin;\n readonly originRun: SelectedRunRef;\n readonly sourceBarrier: ExecutionSourceBarrier;\n readonly evaluationKind: EvaluationKind;\n}\nexport interface ProjectTargetPolicy {\n readonly identity: ExecutionPolicyIdentity;\n readonly reuseContract: ExecutionIdentity;\n readonly rerun: \"none\" | \"failed\" | \"all\";\n readonly keepSandbox: boolean;\n}\nexport interface ExecutionReusePlanSlotBase extends TargetSlot {\n readonly comparisons: readonly ExecutionComparison[];\n}\nexport interface ReusePlanSlot extends ExecutionReusePlanSlotBase {\n readonly state: \"reuse\";\n readonly adoption: \"carried\";\n readonly source: ExecutionReusePlanSource;\n}\nexport interface ExecutionGapSlot extends ExecutionReusePlanSlotBase {\n readonly state: \"gap\";\n readonly reason: ExecutionGapReason;\n readonly scope: ExecutionGapScope;\n readonly issues: readonly RecordIssue[];\n readonly sourceBarrier?: ExecutionSourceBarrier;\n readonly candidate?: ExecutionReusePlanSource;\n}\nexport type ExecutionReusePlanSlot = ReusePlanSlot | ExecutionGapSlot;\nexport interface ExecutionReusePlan {\n readonly target: ExecutionTarget;\n readonly policy: ExecutionPolicyIdentity;\n readonly effectiveOptions: ExecutionReuseEffectiveOptions;\n readonly slots: readonly ExecutionReusePlanSlot[];\n readonly reuse: readonly ReusePlanSlot[];\n readonly gaps: readonly ExecutionGapSlot[];\n}\nexport interface ProjectTargetReusePlanInput {\n readonly reader: RecordReadSession;\n readonly target: ExecutionTarget;\n readonly policy: ProjectTargetPolicy;\n}\nexport type ProjectTargetReusePlanInvalidReason = \"invocation-id-invalid\" | \"target-run-invalid\" | \"target-run-duplicate\" | \"target-slot-invalid\" | \"target-slot-duplicate\" | \"target-slot-run-mismatch\" | \"target-slot-experiment-mismatch\" | \"target-slot-ordinal-duplicate\" | \"policy-unsupported\" | \"policy-input-invalid\";\nexport interface ProjectTargetReusePlanInvalid {\n readonly code: \"project-target-reuse-plan-invalid\";\n readonly reason: ProjectTargetReusePlanInvalidReason;\n}\n/**\n * Fold the terminal Verdict from the source Attempt's immutable Core outcome\n * and its fixed Assertions facts. This is a projection, not a second durable\n * Verdict family.\n */\nexport function recordedAttemptVerdict(input: {\n readonly outcome: AttemptOutcome;\n readonly assertions: AssertionsAttachment;\n}): AssertionsVerdict {\n return foldRecordedAttemptVerdict(input);\n}\n/** Input validation is pure; it never invents a target Slot or repairs an identity. */\nexport function validateProjectTargetReusePlanInput(input: {\n readonly target: ExecutionTarget;\n readonly policy: ProjectTargetPolicy;\n}): ProjectTargetReusePlanInvalid | undefined {\n const unknownInput: unknown = input;\n if (typeof unknownInput !== \"object\" || unknownInput === null) {\n return invalidPlan(\"target-run-invalid\");\n }\n const envelope = unknownInput as {\n readonly target?: unknown;\n readonly policy?: unknown;\n };\n if (typeof envelope.target !== \"object\" || envelope.target === null) {\n return invalidPlan(\"target-run-invalid\");\n }\n const target = envelope.target as {\n readonly invocationId?: unknown;\n readonly runs?: unknown;\n };\n if (typeof target.invocationId !== \"string\"\n || !isBoundedNonEmptyText(target.invocationId, PROJECT_TARGET_INVOCATION_ID_MAXIMUM_LENGTH)\n || !Array.isArray(target.runs)) {\n return invalidPlan(\"invocation-id-invalid\");\n }\n if (typeof envelope.policy !== \"object\" || envelope.policy === null) {\n return invalidPlan(\"policy-input-invalid\");\n }\n const policy = envelope.policy as {\n readonly identity?: unknown;\n readonly reuseContract?: unknown;\n readonly rerun?: unknown;\n readonly keepSandbox?: unknown;\n };\n if (typeof policy.identity !== \"object\"\n || policy.identity === null\n || (policy.identity as {\n readonly name?: unknown;\n }).name !== PROJECT_TARGET_POLICY_NAME\n || (policy.identity as {\n readonly version?: unknown;\n }).version !== PROJECT_TARGET_POLICY_VERSION) {\n return invalidPlan(\"policy-unsupported\");\n }\n if (!isExecutionIdentity(policy.reuseContract)\n || !isRerunOption(policy.rerun)\n || typeof policy.keepSandbox !== \"boolean\") {\n return invalidPlan(\"policy-input-invalid\");\n }\n const runIds = new Set<string>();\n const slotIds = new Set<string>();\n const ordinals = new Set<string>();\n for (const run of target.runs) {\n if (!isTargetRun(run))\n return invalidPlan(\"target-run-invalid\");\n if (runIds.has(run.runId))\n return invalidPlan(\"target-run-duplicate\");\n runIds.add(run.runId);\n for (const slot of run.slots) {\n if (!isTargetSlot(slot))\n return invalidPlan(\"target-slot-invalid\");\n if (slot.runId !== run.runId)\n return invalidPlan(\"target-slot-run-mismatch\");\n if (slot.experimentId !== run.experimentId) {\n return invalidPlan(\"target-slot-experiment-mismatch\");\n }\n if (slotIds.has(slot.slotId))\n return invalidPlan(\"target-slot-duplicate\");\n slotIds.add(slot.slotId);\n const ordinal = sourceKey(slot.experimentId, slot.evalId, String(slot.attempt));\n if (ordinals.has(ordinal))\n return invalidPlan(\"target-slot-ordinal-duplicate\");\n ordinals.add(ordinal);\n }\n }\n return undefined;\n}\n/**\n * Plans only from Record Host selection references. It neither reconstructs\n * attempt handles from strings nor reads private Record paths.\n */\nexport function planProjectTargetReuse(input: ProjectTargetReusePlanInput): Effect.Effect<ExecutionReusePlan, ProjectTargetReusePlanInvalid | RecordReaderReadError> {\n return Effect.suspend<ExecutionReusePlan, ProjectTargetReusePlanInvalid | RecordReaderReadError, never>(() => {\n const invalid = validateProjectTargetReusePlanInput(input);\n if (invalid !== undefined)\n return Effect.fail(invalid);\n return Effect.gen(function* () {\n const selection = yield* input.reader.selectRuns({ includePublishedActive: true });\n const readable = yield* Effect.forEach(selection.runRefs, (ref) => input.reader.readRun(ref), { concurrency: 1 });\n const runs: ReadableRun[] = [];\n const coreIssues: RecordIssue[] = [];\n for (const read of readable) {\n if (read.state === \"available\")\n runs.push(read.value);\n else if (read.state === \"core-invalid\")\n coreIssues.push(...read.issues);\n }\n const byRunId = new Map(runs.map((run) => [run.document.runId, run] as const));\n const slots: ExecutionReusePlanSlot[] = [];\n for (const target of flattenTargetSlots(input.target)) {\n slots.push(yield* planTargetSlot({\n reader: input.reader,\n target,\n policy: input.policy,\n runs,\n byRunId,\n selectionHasProblem: selection.problems.length > 0 || coreIssues.length > 0,\n coreIssues,\n }));\n }\n const reuse = slots.filter((slot): slot is ReusePlanSlot => slot.state === \"reuse\");\n const gaps = slots.filter((slot): slot is ExecutionGapSlot => slot.state === \"gap\");\n return Object.freeze({\n target: input.target,\n policy: projectTargetPolicyIdentity,\n effectiveOptions: effectiveOptions(input.policy),\n slots: Object.freeze(slots),\n reuse: Object.freeze(reuse),\n gaps: Object.freeze(gaps),\n });\n });\n });\n}\n/** Empty or not-yet-created Record roots produce no source capability. */\nexport function planProjectTargetReuseWithoutSources(input: {\n readonly target: ExecutionTarget;\n readonly policy: ProjectTargetPolicy;\n}): Effect.Effect<ExecutionReusePlan, ProjectTargetReusePlanInvalid> {\n return Effect.suspend(() => {\n const invalid = validateProjectTargetReusePlanInput(input);\n if (invalid !== undefined)\n return Effect.fail(invalid);\n const gaps = Object.freeze(flattenTargetSlots(input.target).map((target) => gapSlot(target, {\n reason: \"no-source-run\",\n scope: \"slot\",\n issues: [],\n comparisons: [],\n })));\n return Effect.succeed(Object.freeze({\n target: input.target,\n policy: projectTargetPolicyIdentity,\n effectiveOptions: effectiveOptions(input.policy),\n slots: gaps,\n reuse: Object.freeze([]),\n gaps,\n }));\n });\n}\nexport const ProjectTargetReusePlanner = Object.freeze({ plan: planProjectTargetReuse });\nfunction planTargetSlot(input: {\n readonly reader: RecordReadSession;\n readonly target: TargetSlot;\n readonly policy: ProjectTargetPolicy;\n readonly runs: readonly ReadableRun[];\n readonly byRunId: ReadonlyMap<RunId, ReadableRun>;\n readonly selectionHasProblem: boolean;\n readonly coreIssues: readonly RecordIssue[];\n}): Effect.Effect<ExecutionReusePlanSlot, RecordReaderReadError> {\n return Effect.gen(function* () {\n if (input.selectionHasProblem) {\n return gapSlot(input.target, {\n reason: \"source-core-invalid\",\n scope: \"target\",\n issues: input.coreIssues,\n comparisons: [],\n });\n }\n const sourceRun = latestSourceRun(input.runs, input.target);\n if (sourceRun === undefined) {\n return gapSlot(input.target, {\n reason: \"no-source-run\",\n scope: \"slot\",\n issues: [],\n comparisons: [],\n });\n }\n const sourceBarrier = Object.freeze({\n runId: sourceRun.document.runId,\n startedAt: sourceRun.document.startedAt,\n });\n const expected = sourceRun.document.expectedSlots.find((slot) => slot.evalId === input.target.evalId\n && slot.attemptOrdinal === input.target.attempt);\n if (expected === undefined) {\n return gapSlot(input.target, {\n reason: \"source-slot-missing\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n comparisons: [],\n });\n }\n const member = sourceRun.members.find((candidate) => candidate.document.slotId === expected.slotId);\n if (member === undefined || member.attempt === null) {\n return gapSlot(input.target, {\n reason: \"source-member-missing\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n comparisons: [],\n });\n }\n const readAttempt = yield* input.reader.readAttempt(member.attempt);\n if (readAttempt.state !== \"available\") {\n return gapSlot(input.target, {\n reason: \"source-core-invalid\",\n scope: \"slot\",\n issues: issuesOf(readAttempt),\n sourceBarrier,\n comparisons: [],\n });\n }\n if (!hasPublicationIdentity(readAttempt.value)) {\n return gapSlot(input.target, {\n reason: \"source-publication-unavailable\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n comparisons: [],\n });\n }\n const candidateResolution = candidateFor({\n target: input.target,\n sourceBarrier,\n attempt: readAttempt.value,\n byRunId: input.byRunId,\n });\n if (candidateResolution === undefined) {\n return gapSlot(input.target, {\n reason: \"source-core-invalid\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n comparisons: [],\n });\n }\n const candidate = candidateResolution.source;\n if (member.document.action === \"accepted\") {\n return gapSlot(input.target, {\n reason: \"accepted-action-ineligible\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [],\n });\n }\n if (!reusableSlotIdentityMatches({\n target: input.target,\n sourceExpected: expected,\n originExpected: candidateResolution.originExpected,\n })) {\n return gapSlot(input.target, {\n reason: \"identity-mismatch\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [identityMismatchComparison()],\n });\n }\n const assertions = yield* input.reader.read(readAttempt.value.owner, NiceEvalRecordAttachments.assertions);\n if (assertions.state !== \"available\") {\n const problem = attachmentProblem(assertions);\n return gapSlot(input.target, {\n reason: problem.reason,\n scope: \"slot\",\n issues: problem.issues,\n sourceBarrier,\n candidate,\n comparisons: [comparison(\"niceeval.assertions\", \"assertion-verdict\", problem.state, \"not-comparable\", problem.reason)],\n });\n }\n const verdict = recordedAttemptVerdict({\n outcome: readAttempt.value.document.outcome,\n assertions: assertions.value,\n });\n if (readAttempt.value.document.outcome !== \"completed\") {\n return gapSlot(input.target, {\n reason: \"attempt-outcome-ineligible\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [\n comparison(\"core\", \"attempt-outcome\", \"available\", \"ineligible\", `attempt-${readAttempt.value.document.outcome}`),\n verdictComparison(verdict, \"ineligible\"),\n ],\n });\n }\n if (verdict !== \"passed\" && verdict !== \"failed\") {\n return gapSlot(input.target, {\n reason: \"verdict-ineligible\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [verdictComparison(verdict, \"ineligible\")],\n });\n }\n const activities = yield* input.reader.read(readAttempt.value.owner, NiceEvalRecordAttachments.runnerActivities.attempt);\n if (activities.state !== \"available\") {\n const problem = attachmentProblem(activities);\n return gapSlot(input.target, {\n reason: problem.reason,\n scope: \"slot\",\n issues: problem.issues,\n sourceBarrier,\n candidate,\n comparisons: [comparison(\"niceeval.runner-activities\", \"execution-duration\", problem.state, \"not-comparable\", problem.reason)],\n });\n }\n const durationRead = readAttemptExecutionDuration(activities.value);\n if (durationRead.state !== \"available\") {\n return gapSlot(input.target, {\n reason: \"source-attachment-unavailable\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [comparison(\"niceeval.runner-activities\", \"execution-duration\", \"unavailable\", \"not-comparable\", durationRead.reason)],\n });\n }\n const duration = durationComparison({\n source: durationRead.duration,\n target: input.target.timeout,\n });\n if (duration.failure !== undefined) {\n return gapSlot(input.target, {\n reason: duration.failure,\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [duration.comparison],\n });\n }\n if (input.policy.rerun === \"all\"\n || (input.policy.rerun === \"failed\" && verdict === \"failed\")) {\n return gapSlot(input.target, {\n reason: \"rerun-requested\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [verdictComparison(verdict, \"match\"), duration.comparison],\n });\n }\n if (input.policy.keepSandbox) {\n return gapSlot(input.target, {\n reason: \"sandbox-retention-requested\",\n scope: \"slot\",\n issues: [],\n sourceBarrier,\n candidate,\n comparisons: [verdictComparison(verdict, \"match\"), duration.comparison],\n });\n }\n return Object.freeze({\n ...input.target,\n state: \"reuse\" as const,\n adoption: \"carried\" as const,\n source: candidate,\n comparisons: Object.freeze([\n comparison(\"core\", \"execution-identity\", \"available\", \"match\", \"execution-identity-match\"),\n comparison(\"core\", \"attempt-outcome\", \"available\", \"match\", \"attempt-completed\"),\n verdictComparison(verdict, \"match\"),\n duration.comparison,\n ]),\n });\n });\n}\nfunction latestSourceRun(runs: readonly ReadableRun[], target: TargetSlot): ReadableRun | undefined {\n const candidates = runs.filter((run) => run.document.experimentId === target.experimentId\n && run.document.expectedSlots.some((slot) => slot.evalId === target.evalId));\n return candidates.sort(compareReadableRuns).at(-1);\n}\nfunction compareReadableRuns(left: ReadableRun, right: ReadableRun): number {\n if (left.document.startedAt !== right.document.startedAt) {\n return left.document.startedAt < right.document.startedAt ? -1 : 1;\n }\n return compareCanonicalIdentity(left.document.runId, right.document.runId);\n}\ninterface CandidateResolution {\n readonly source: ExecutionReusePlanSource;\n readonly originExpected: RecordSlotIdentity;\n}\nfunction hasPublicationIdentity(attempt: ReadableAttempt): attempt is ReadableAttempt & {\n readonly ref: ExecutionReusePlanSource[\"attempt\"];\n} {\n return attempt.ref.publicationIdentity !== undefined;\n}\nfunction candidateFor(input: {\n readonly target: TargetSlot;\n readonly sourceBarrier: ExecutionSourceBarrier;\n readonly attempt: ReadableAttempt & {\n readonly ref: ExecutionReusePlanSource[\"attempt\"];\n };\n readonly byRunId: ReadonlyMap<RunId, ReadableRun>;\n}): CandidateResolution | undefined {\n const document = input.attempt.document;\n const originRun = input.byRunId.get(document.originRunId);\n if (originRun === undefined)\n return undefined;\n const originExpected = originRun.document.expectedSlots.find((slot) => slot.slotId === document.slotId);\n if (originExpected === undefined\n || document.evalId !== originExpected.evalId\n || document.executionIdentityDigest !== originExpected.executionIdentityDigest) {\n return undefined;\n }\n return Object.freeze({\n source: Object.freeze({\n attemptId: input.attempt.ref.attemptId,\n attempt: input.attempt.ref,\n origin: Object.freeze({ runId: document.originRunId, slotId: document.slotId }),\n originRun: originRun.ref,\n sourceBarrier: input.sourceBarrier,\n evaluationKind: input.target.evaluationKind,\n }),\n originExpected,\n });\n}\nfunction sameSlotIdentity(left: RecordSlotIdentity, right: RecordSlotIdentity): boolean {\n return left.slotId === right.slotId\n && left.evalId === right.evalId\n && left.attemptOrdinal === right.attemptOrdinal\n && left.executionIdentityDigest === right.executionIdentityDigest;\n}\nfunction targetMatchesSlotIdentity(target: TargetSlot, slot: RecordSlotIdentity): boolean {\n return target.slotId === slot.slotId\n && target.evalId === slot.evalId\n && target.attempt === slot.attemptOrdinal\n && target.executionIdentityDigest === slot.executionIdentityDigest;\n}\nfunction reusableSlotIdentityMatches(input: {\n readonly target: TargetSlot;\n readonly sourceExpected: RecordSlotIdentity;\n readonly originExpected: RecordSlotIdentity;\n}): boolean {\n return sameSlotIdentity(input.sourceExpected, input.originExpected)\n && targetMatchesSlotIdentity(input.target, input.sourceExpected)\n && targetMatchesSlotIdentity(input.target, input.originExpected);\n}\nfunction issuesOf(read: RecordCoreRead<unknown>): readonly RecordIssue[] {\n return read.state === \"core-invalid\" ? read.issues : Object.freeze([]);\n}\nfunction attachmentProblem(input: {\n readonly state: \"not-recorded\" | \"migration-required\" | \"unsupported\" | \"invalid\";\n readonly family?: string;\n readonly schemaVersion?: number;\n readonly issues?: readonly RecordIssue[];\n}): {\n readonly reason: Extract<ExecutionGapReason, \"source-attachment-unavailable\" | \"source-attachment-migration-required\" | \"source-attachment-unsupported\" | \"source-attachment-invalid\">;\n readonly state: Exclude<ExecutionComparisonSourceState, \"available\">;\n readonly issues: readonly RecordIssue[];\n} {\n switch (input.state) {\n case \"not-recorded\":\n return Object.freeze({\n reason: \"source-attachment-unavailable\" as const,\n state: \"unavailable\" as const,\n issues: Object.freeze([]),\n });\n case \"migration-required\":\n return Object.freeze({\n reason: \"source-attachment-migration-required\" as const,\n state: EXECUTION_COMPARISON_PROJECTION_STATE.migrationRequired,\n issues: Object.freeze([]),\n });\n case \"unsupported\":\n return Object.freeze({\n reason: \"source-attachment-unsupported\" as const,\n state: \"unsupported\" as const,\n issues: Object.freeze([]),\n });\n case \"invalid\":\n return Object.freeze({\n reason: \"source-attachment-invalid\" as const,\n state: \"invalid\" as const,\n issues: input.issues ?? Object.freeze([]),\n });\n }\n}\nfunction identityMismatchComparison(): ExecutionComparison {\n return comparison(\"core\", \"execution-identity\", \"available\", \"mismatch\", \"identity-mismatch\");\n}\nfunction verdictComparison(verdict: AssertionsVerdict, result: Extract<ExecutionComparisonResult, \"match\" | \"ineligible\">): ExecutionComparison {\n return comparison(\"niceeval.assertions\", \"assertion-verdict\", \"available\", result, verdict === \"errored\" ? \"verdict-ineligible\" : `verdict-${verdict}`);\n}\nfunction durationComparison(input: {\n readonly source: DurationLimit;\n readonly target: ExecutionDurationLimit | undefined;\n}): {\n readonly comparison: ExecutionComparison;\n readonly failure?: \"duration-domain-mismatch\" | \"timeout-exceeded\";\n} {\n if (input.target === undefined) {\n return {\n comparison: comparison(\"niceeval.runner-activities\", \"execution-duration\", \"available\", \"match\", \"timeout-unbounded\"),\n };\n }\n if (input.source.domain !== input.target.domain) {\n return {\n comparison: comparison(\"niceeval.runner-activities\", \"execution-duration\", \"available\", \"mismatch\", \"duration-domain-mismatch\"),\n failure: \"duration-domain-mismatch\",\n };\n }\n if (input.source.milliseconds > input.target.milliseconds) {\n return {\n comparison: comparison(\"niceeval.runner-activities\", \"execution-duration\", \"available\", \"mismatch\", \"timeout-exceeded\"),\n failure: \"timeout-exceeded\",\n };\n }\n return {\n comparison: comparison(\"niceeval.runner-activities\", \"execution-duration\", \"available\", \"match\", \"duration-within-timeout\"),\n };\n}\nfunction comparison(attachment: ExecutionComparisonAttachment, recordedClaim: ExecutionRecordedClaim, sourceState: ExecutionComparisonSourceState, result: ExecutionComparisonResult, reason: string): ExecutionComparison {\n return Object.freeze({ attachment, recordedClaim, sourceState, result, reason });\n}\nfunction gapSlot(target: TargetSlot, input: {\n readonly reason: ExecutionGapReason;\n readonly scope: ExecutionGapScope;\n readonly issues: readonly RecordIssue[];\n readonly comparisons: readonly ExecutionComparison[];\n readonly sourceBarrier?: ExecutionSourceBarrier;\n readonly candidate?: ExecutionReusePlanSource;\n}): ExecutionGapSlot {\n return Object.freeze({\n ...target,\n state: \"gap\" as const,\n reason: input.reason,\n scope: input.scope,\n issues: Object.freeze([...input.issues]),\n ...(input.sourceBarrier === undefined ? {} : { sourceBarrier: input.sourceBarrier }),\n ...(input.candidate === undefined ? {} : { candidate: input.candidate }),\n comparisons: Object.freeze([...input.comparisons]),\n });\n}\nfunction effectiveOptions(policy: ProjectTargetPolicy): ExecutionReuseEffectiveOptions {\n return Object.freeze({\n rerun: policy.rerun,\n keepSandbox: policy.keepSandbox,\n reuseContract: Object.freeze({\n domain: policy.reuseContract.domain,\n value: policy.reuseContract.value,\n }),\n });\n}\nfunction flattenTargetSlots(target: ExecutionTarget): readonly TargetSlot[] {\n return Object.freeze(target.runs.flatMap((run) => run.slots));\n}\nfunction sourceKey(experimentId: string, evalId: string, ordinal?: string): string {\n return ordinal === undefined\n ? `${experimentId}\\u0000${evalId}`\n : `${experimentId}\\u0000${evalId}\\u0000${ordinal}`;\n}\nfunction invalidPlan(reason: ProjectTargetReusePlanInvalidReason): ProjectTargetReusePlanInvalid {\n return Object.freeze({ code: \"project-target-reuse-plan-invalid\", reason });\n}\nfunction isTargetRun(value: unknown): value is TargetRun {\n if (typeof value !== \"object\" || value === null)\n return false;\n const run = value as Partial<TargetRun>;\n return (typeof run.runId === \"string\"\n && isPortableSegment(run.runId)\n && typeof run.experimentId === \"string\"\n && isBoundedRecordIdentity(run.experimentId)\n && typeof run.startedAt === \"number\"\n && isUtcMillis(run.startedAt)\n && Array.isArray(run.slots));\n}\nfunction isTargetSlot(value: unknown): value is TargetSlot {\n if (typeof value !== \"object\" || value === null)\n return false;\n const slot = value as Partial<TargetSlot>;\n return (typeof slot.runId === \"string\"\n && isPortableSegment(slot.runId)\n && typeof slot.slotId === \"string\"\n && isPortableSegment(slot.slotId)\n && typeof slot.experimentId === \"string\"\n && isBoundedRecordIdentity(slot.experimentId)\n && typeof slot.evalId === \"string\"\n && isBoundedRecordIdentity(slot.evalId)\n && typeof slot.attempt === \"number\"\n && Number.isSafeInteger(slot.attempt)\n && slot.attempt >= 0\n && (slot.evaluationKind === \"pass\" || slot.evaluationKind === \"score\")\n && typeof slot.executionIdentityDigest === \"string\"\n && isSha256Digest(slot.executionIdentityDigest)\n && isExecutionIdentity(slot.inputIdentity)\n && isExecutionIdentity(slot.configIdentity)\n && (slot.timeout === undefined || isExecutionDurationLimit(slot.timeout)));\n}\nfunction isBoundedNonEmptyText(value: string, maximumLength: number): boolean {\n return value.length > 0 && value.length <= maximumLength;\n}\nfunction isBoundedRecordIdentity(value: string): boolean {\n return isBoundedNonEmptyText(value, PROJECT_TARGET_RECORD_IDENTITY_MAXIMUM_LENGTH)\n && !value.includes(\"\\u0000\");\n}\nfunction isRerunOption(value: unknown): value is ProjectTargetPolicy[\"rerun\"] {\n return value === \"none\" || value === \"failed\" || value === \"all\";\n}\nfunction isExecutionIdentity(value: unknown): value is ExecutionIdentity {\n if (typeof value !== \"object\" || value === null)\n return false;\n const identity = value as {\n readonly domain?: unknown;\n readonly value?: unknown;\n };\n return typeof identity.domain === \"string\"\n && isBoundedRecordIdentity(identity.domain)\n && typeof identity.value === \"string\"\n && isBoundedRecordIdentity(identity.value);\n}\nfunction isExecutionDurationLimit(value: unknown): value is ExecutionDurationLimit {\n if (typeof value !== \"object\" || value === null)\n return false;\n const duration = value as {\n readonly domain?: unknown;\n readonly milliseconds?: unknown;\n };\n return typeof duration.domain === \"string\"\n && isBoundedRecordIdentity(duration.domain)\n && typeof duration.milliseconds === \"number\"\n && Number.isFinite(duration.milliseconds)\n && duration.milliseconds >= 0;\n}\n"]}
@@ -9,6 +9,7 @@ exports.producerCommandRegistrationInvalid = producerCommandRegistrationInvalid;
9
9
  exports.requiredPositive = requiredPositive;
10
10
  exports.requiredNonNegative = requiredNonNegative;
11
11
  exports.sourceCollection = sourceCollection;
12
+ const index_ts_1 = require("../../record/family/source-receipt/index.cjs");
12
13
  const model_ts_1 = require("../../record/family/source-receipt/model.cjs");
13
14
  function isRunnerObservabilityProducerError(value) {
14
15
  if (typeof value !== "object" || value === null || !("code" in value))
@@ -218,7 +219,7 @@ function sourceCollection(sources, additional = []) {
218
219
  ...sources.flatMap(({ collection, stage }) => collection.limitations.map((limitation) => sourceLimitation(limitation, stage))),
219
220
  ...additional,
220
221
  ];
221
- const byKey = new Map(limitations.map((limitation) => [JSON.stringify(limitation), limitation]));
222
+ const byKey = new Map(limitations.map((limitation) => [(0, index_ts_1.sourceReceiptLimitationKey)(limitation), limitation]));
222
223
  const canonical = [...byKey.entries()]
223
224
  .sort(([left], [right]) => left === right ? 0 : left < right ? -1 : 1)
224
225
  .map(([, limitation]) => limitation);
@@ -1 +1 @@
1
- {"version":3,"file":"support.js","sourceRoot":"","sources":["support.ts"],"names":[],"mappings":";;;AAiBA,gFAeC;AACD,0DAKC;AACD,gEAKC;AACD,wDAEC;AACD,gFAEC;AACD,4CAQC;AACD,kDAQC;AAqKD,4CA6BC;AArQD,0EAAmX;AAgBnX,SAAgB,kCAAkC,CAAC,KAAc;IAC7D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC;QACjE,OAAO,KAAK,CAAC;IACjB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACxB,QAAQ,IAAI,EAAE,CAAC;QACX,KAAK,sCAAsC,CAAC;QAC5C,KAAK,mDAAmD;YACpD,OAAO,IAAI,CAAC;QAChB,KAAK,2CAA2C;YAC5C,OAAO,OAAO,IAAI,KAAK,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;QACpF,KAAK,wCAAwC;YACzC,OAAO,MAAM,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;QAC7D;YACI,OAAO,KAAK,CAAC;IACrB,CAAC;AACL,CAAC;AACD,SAAgB,uBAAuB,CAAC,IAA6B;IACjE,OAAO,MAAM,CAAC,MAAM,CAAC;QACjB,IAAI,EAAE,wCAAiD;QACvD,IAAI;KACP,CAAC,CAAC;AACP,CAAC;AACD,SAAgB,0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SAAkB;QACzB,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAG1C;KACJ,CAAC,CAAC;AACP,CAAC","sourcesContent":["import type { SourceReceiptCollection, SourceReceiptLimitation } from \"../../record/family/source-receipt/index.ts\";\nimport { compareObservabilityLimitation, limitationTarget, makeNonNegativeSafeInteger, makePositiveSafeInteger, type Collection, type CollectionStage, type CollectionTarget, type CommandId, type ItemId, type NonNegativeSafeInteger, type ObservabilityEntityKind, type ObservabilityLimitation, type PositiveSafeInteger, } from \"../../record/family/source-receipt/model.ts\";\n/**\n * The Runner never exposes raw provider frames to the Record layer. These\n * errors therefore carry only an internal stable code and entity kind.\n */\nexport type RunnerObservabilityProducerError = {\n readonly code: \"runner-observability-entity-id-invalid\";\n readonly kind: ObservabilityEntityKind;\n} | {\n readonly code: \"runner-observability-capture-seal-invalid\";\n readonly owner: \"attempt\" | \"run\";\n} | {\n readonly code: \"runner-observability-capture-missing\";\n} | {\n readonly code: \"runner-observability-command-registration-invalid\";\n};\nexport function isRunnerObservabilityProducerError(value: unknown): value is RunnerObservabilityProducerError {\n if (typeof value !== \"object\" || value === null || !(\"code\" in value))\n return false;\n const code = value.code;\n switch (code) {\n case \"runner-observability-capture-missing\":\n case \"runner-observability-command-registration-invalid\":\n return true;\n case \"runner-observability-capture-seal-invalid\":\n return \"owner\" in value && (value.owner === \"attempt\" || value.owner === \"run\");\n case \"runner-observability-entity-id-invalid\":\n return \"kind\" in value && typeof value.kind === \"string\";\n default:\n return false;\n }\n}\nexport function producerEntityIdInvalid(kind: ObservabilityEntityKind): RunnerObservabilityProducerError {\n return Object.freeze({\n code: \"runner-observability-entity-id-invalid\" as const,\n kind,\n });\n}\nexport function producerCaptureSealInvalid(owner: \"attempt\" | \"run\"): RunnerObservabilityProducerError {\n return Object.freeze({\n code: \"runner-observability-capture-seal-invalid\" as const,\n owner,\n });\n}\nexport function producerCaptureMissing(): RunnerObservabilityProducerError {\n return Object.freeze({ code: \"runner-observability-capture-missing\" as const });\n}\nexport function producerCommandRegistrationInvalid(): RunnerObservabilityProducerError {\n return Object.freeze({ code: \"runner-observability-command-registration-invalid\" as const });\n}\nexport function requiredPositive(value: number): PositiveSafeInteger {\n const positive = makePositiveSafeInteger(value);\n if (positive !== undefined)\n return positive;\n const fallback = makePositiveSafeInteger(1);\n if (fallback === undefined)\n throw new Error(\"One must be a positive safe integer\");\n return fallback;\n}\nexport function requiredNonNegative(value: number): NonNegativeSafeInteger {\n const nonNegative = makeNonNegativeSafeInteger(value);\n if (nonNegative !== undefined)\n return nonNegative;\n const fallback = makeNonNegativeSafeInteger(0);\n if (fallback === undefined)\n throw new Error(\"Zero must be a non-negative safe integer\");\n return fallback;\n}\n/** Coalesces and canonically orders the closed durable limitation union. */\nexport class RunnerCollectionLimitations {\n private readonly captureFailed = new Map<string, {\n readonly stage: CollectionStage;\n readonly target: CollectionTarget;\n }>();\n private readonly captureInterrupted = new Map<string, {\n readonly stage: CollectionStage;\n readonly target: CollectionTarget;\n }>();\n private readonly unsupported = new Map<CollectionTarget, number>();\n private readonly redacted = new Map<CollectionTarget, number>();\n private readonly caps = new Map<CollectionTarget, {\n readonly retained: number;\n readonly omittedAtLeast: number;\n }>();\n private readonly textTruncations: ObservabilityLimitation[] = [];\n addCaptureFailed(stage: CollectionStage, target: CollectionTarget): void {\n this.captureFailed.set(`${stage}\\u0000${target}`, Object.freeze({ stage, target }));\n }\n addCaptureInterrupted(stage: CollectionStage, target: CollectionTarget): void {\n this.captureInterrupted.set(`${stage}\\u0000${target}`, Object.freeze({ stage, target }));\n }\n addUnsupported(target: CollectionTarget, omittedAtLeast = 1): void {\n this.unsupported.set(target, (this.unsupported.get(target) ?? 0) + omittedAtLeast);\n }\n addRedacted(target: CollectionTarget, replacements = 1): void {\n this.redacted.set(target, (this.redacted.get(target) ?? 0) + replacements);\n }\n addCap(target: CollectionTarget, retained: number, omittedAtLeast = 1): void {\n const current = this.caps.get(target);\n this.caps.set(target, Object.freeze({\n retained: Math.max(retained, current?.retained ?? 0),\n omittedAtLeast: (current?.omittedAtLeast ?? 0) + omittedAtLeast,\n }));\n }\n addConversationTextTruncated(itemId: ItemId, retainedBytes: NonNegativeSafeInteger, omittedBytes: PositiveSafeInteger): void {\n this.textTruncations.push(Object.freeze({\n code: \"text-truncated\" as const,\n target: \"conversation-text\" as const,\n itemId,\n retainedBytes,\n omittedBytes,\n }));\n }\n addCommandManifestTextTruncated(commandId: CommandId, retainedBytes: NonNegativeSafeInteger, omittedBytes: PositiveSafeInteger): void {\n this.textTruncations.push(Object.freeze({\n code: \"text-truncated\" as const,\n target: \"command-manifest\" as const,\n commandId,\n retainedBytes,\n omittedBytes,\n }));\n }\n addCommandStreamTruncated(commandId: CommandId, stream: \"stdout\" | \"stderr\", retainedBytes: NonNegativeSafeInteger, omittedBytes: PositiveSafeInteger): void {\n this.textTruncations.push(Object.freeze({\n code: \"stream-truncated\" as const,\n commandId,\n stream,\n retainedBytes,\n omittedBytes,\n }));\n }\n addUnsafeCommandControlStripped(commandId: CommandId, stream: \"stdout\" | \"stderr\", strippedCount: number): void {\n this.textTruncations.push(Object.freeze({\n code: \"unsafe-control-stripped\" as const,\n commandId,\n stream,\n strippedCount: requiredPositive(strippedCount),\n }));\n }\n collection(): Collection {\n const limitations: ObservabilityLimitation[] = [];\n for (const { stage, target } of this.captureFailed.values()) {\n limitations.push(Object.freeze({\n code: \"capture-failed\" as const,\n stage,\n target,\n }));\n }\n for (const { stage, target } of this.captureInterrupted.values()) {\n limitations.push(Object.freeze({\n code: \"capture-interrupted\" as const,\n stage,\n target,\n }));\n }\n for (const [target, omittedAtLeast] of this.unsupported) {\n limitations.push(Object.freeze({\n code: \"unsupported-input\" as const,\n target,\n omittedAtLeast: requiredPositive(omittedAtLeast),\n }));\n }\n for (const [target, replacements] of this.redacted) {\n limitations.push(Object.freeze({\n code: \"redacted\" as const,\n target,\n replacementCount: requiredPositive(replacements),\n }));\n }\n for (const [target, cap] of this.caps) {\n limitations.push(Object.freeze({\n code: \"collection-cap-reached\" as const,\n target,\n retained: requiredNonNegative(cap.retained),\n omittedAtLeast: requiredPositive(cap.omittedAtLeast),\n }));\n }\n limitations.push(...this.textTruncations);\n limitations.sort(compareObservabilityLimitation);\n if (limitations.length === 0) {\n return Object.freeze({\n state: \"complete\" as const,\n limitations: Object.freeze([]) as readonly [\n ],\n });\n }\n const [first, ...rest] = limitations;\n if (first === undefined)\n throw new Error(\"A non-empty limitation list needs a first entry\");\n return Object.freeze({\n state: \"partial\" as const,\n limitations: Object.freeze([first, ...rest]) as readonly [\n ObservabilityLimitation,\n ...ObservabilityLimitation[]\n ],\n });\n }\n}\ntype SourceStage = \"adapter\" | \"sandbox-wrapper\" | \"runner-clock\" | \"runner-diagnostic-sink\";\nfunction sourceTarget(target: CollectionTarget): SourceReceiptLimitation[\"target\"] {\n switch (target) {\n case \"conversation-item\":\n case \"conversation-text\": return \"turn-item\";\n case \"usage-observation\": return \"usage-observation\";\n case \"command-manifest\": return \"command\";\n case \"command-stdout\": return \"stdout\";\n case \"command-stderr\": return \"stderr\";\n case \"timing-interval\": return \"activity\";\n case \"diagnostic\": return \"diagnostic\";\n }\n}\nfunction sourceLimitation(limitation: ObservabilityLimitation, stage: SourceStage): SourceReceiptLimitation {\n const target = sourceTarget(limitationTarget(limitation));\n switch (limitation.code) {\n case \"capture-failed\":\n case \"capture-interrupted\":\n return Object.freeze({ code: limitation.code, stage, target });\n case \"collection-cap-reached\":\n case \"unsupported-input\":\n return Object.freeze({ code: limitation.code, target, omittedAtLeast: limitation.omittedAtLeast });\n case \"text-truncated\":\n return Object.freeze({ code: \"text-truncated\", target, replacementOrOmittedCount: limitation.omittedBytes });\n case \"redacted\":\n return Object.freeze({ code: \"redacted\", target, replacementOrOmittedCount: limitation.replacementCount });\n case \"stream-truncated\":\n return Object.freeze({ code: \"text-truncated\", target, replacementOrOmittedCount: limitation.omittedBytes });\n case \"invalid-utf8-replaced\":\n return Object.freeze({ code: \"invalid-utf8-replaced\", target, replacementOrOmittedCount: limitation.replacementCount });\n case \"unsafe-control-stripped\":\n return Object.freeze({ code: \"unsafe-control-stripped\", target, replacementOrOmittedCount: limitation.strippedCount });\n }\n}\nexport function sourceCollection(sources: readonly {\n readonly collection: Collection;\n readonly stage: SourceStage;\n}[], additional: readonly SourceReceiptLimitation[] = []): SourceReceiptCollection {\n const limitations = [\n ...sources.flatMap(({ collection, stage }) => collection.limitations.map((limitation) => sourceLimitation(limitation, stage))),\n ...additional,\n ];\n const byKey = new Map(limitations.map((limitation) => [JSON.stringify(limitation), limitation] as const));\n const canonical = [...byKey.entries()]\n .sort(([left], [right]) => left === right ? 0 : left < right ? -1 : 1)\n .map(([, limitation]) => limitation);\n if (canonical.length === 0) {\n return Object.freeze({\n state: \"complete\" as const,\n limitations: Object.freeze([]) as readonly [\n ],\n });\n }\n const [first, ...rest] = canonical;\n if (first === undefined)\n throw new Error(\"A partial source collection needs a limitation\");\n return Object.freeze({\n state: \"partial\" as const,\n limitations: Object.freeze([first, ...rest]) as readonly [\n SourceReceiptLimitation,\n ...SourceReceiptLimitation[]\n ],\n });\n}\n"]}
1
+ {"version":3,"file":"support.js","sourceRoot":"","sources":["support.ts"],"names":[],"mappings":";;;AAiBA,gFAeC;AACD,0DAKC;AACD,gEAKC;AACD,wDAEC;AACD,gFAEC;AACD,4CAQC;AACD,kDAQC;AAqKD,4CA6BC;AAtQD,0EAAsJ;AACtJ,0EAAmX;AAgBnX,SAAgB,kCAAkC,CAAC,KAAc;IAC7D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC;QACjE,OAAO,KAAK,CAAC;IACjB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC;IACxB,QAAQ,IAAI,EAAE,CAAC;QACX,KAAK,sCAAsC,CAAC;QAC5C,KAAK,mDAAmD;YACpD,OAAO,IAAI,CAAC;QAChB,KA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EAAE,CAAC,UAAU,CAAC,CAAC;IACzC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,MAAM,CAAC,MAAM,CAAC;YACjB,KAAK,EAAE,UAAmB;YAC1B,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAC5B;SACJ,CAAC,CAAC;IACP,CAAC;IACD,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,SAAS,CAAC;IACnC,IAAI,KAAK,KAAK,SAAS;QACnB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACtE,OAAO,MAAM,CAAC,MAAM,CAAC;QACjB,KAAK,EAAE,SAAkB;QACzB,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAG1C;KACJ,CAAC,CAAC;AACP,CAAC","sourcesContent":["import { sourceReceiptLimitationKey, type SourceReceiptCollection, type SourceReceiptLimitation, } from \"../../record/family/source-receipt/index.ts\";\nimport { compareObservabilityLimitation, limitationTarget, makeNonNegativeSafeInteger, makePositiveSafeInteger, type Collection, type CollectionStage, type CollectionTarget, type CommandId, type ItemId, type NonNegativeSafeInteger, type ObservabilityEntityKind, type ObservabilityLimitation, type PositiveSafeInteger, } from \"../../record/family/source-receipt/model.ts\";\n/**\n * The Runner never exposes raw provider frames to the Record layer. These\n * errors therefore carry only an internal stable code and entity kind.\n */\nexport type RunnerObservabilityProducerError = {\n readonly code: \"runner-observability-entity-id-invalid\";\n readonly kind: ObservabilityEntityKind;\n} | {\n readonly code: \"runner-observability-capture-seal-invalid\";\n readonly owner: \"attempt\" | \"run\";\n} | {\n readonly code: \"runner-observability-capture-missing\";\n} | {\n readonly code: \"runner-observability-command-registration-invalid\";\n};\nexport function isRunnerObservabilityProducerError(value: unknown): value is RunnerObservabilityProducerError {\n if (typeof value !== \"object\" || value === null || !(\"code\" in value))\n return false;\n const code = value.code;\n switch (code) {\n case \"runner-observability-capture-missing\":\n case \"runner-observability-command-registration-invalid\":\n return true;\n case \"runner-observability-capture-seal-invalid\":\n return \"owner\" in value && (value.owner === \"attempt\" || value.owner === \"run\");\n case \"runner-observability-entity-id-invalid\":\n return \"kind\" in value && typeof value.kind === \"string\";\n default:\n return false;\n }\n}\nexport function producerEntityIdInvalid(kind: ObservabilityEntityKind): RunnerObservabilityProducerError {\n return Object.freeze({\n code: \"runner-observability-entity-id-invalid\" as const,\n kind,\n });\n}\nexport function producerCaptureSealInvalid(owner: \"attempt\" | \"run\"): RunnerObservabilityProducerError {\n return Object.freeze({\n code: \"runner-observability-capture-seal-invalid\" as const,\n owner,\n });\n}\nexport function producerCaptureMissing(): RunnerObservabilityProducerError {\n return Object.freeze({ code: \"runner-observability-capture-missing\" as const });\n}\nexport function producerCommandRegistrationInvalid(): RunnerObservabilityProducerError {\n return Object.freeze({ code: \"runner-observability-command-registration-invalid\" as const });\n}\nexport function requiredPositive(value: number): PositiveSafeInteger {\n const positive = makePositiveSafeInteger(value);\n if (positive !== undefined)\n return positive;\n const fallback = makePositiveSafeInteger(1);\n if (fallback === undefined)\n throw new Error(\"One must be a positive safe integer\");\n return fallback;\n}\nexport function requiredNonNegative(value: number): NonNegativeSafeInteger {\n const nonNegative = makeNonNegativeSafeInteger(value);\n if (nonNegative !== undefined)\n return nonNegative;\n const fallback = makeNonNegativeSafeInteger(0);\n if (fallback === undefined)\n throw new Error(\"Zero must be a non-negative safe integer\");\n return fallback;\n}\n/** Coalesces and canonically orders the closed durable limitation union. */\nexport class RunnerCollectionLimitations {\n private readonly captureFailed = new Map<string, {\n readonly stage: CollectionStage;\n readonly target: CollectionTarget;\n }>();\n private readonly captureInterrupted = new Map<string, {\n readonly stage: CollectionStage;\n readonly target: CollectionTarget;\n }>();\n private readonly unsupported = new Map<CollectionTarget, number>();\n private readonly redacted = new Map<CollectionTarget, number>();\n private readonly caps = new Map<CollectionTarget, {\n readonly retained: number;\n readonly omittedAtLeast: number;\n }>();\n private readonly textTruncations: ObservabilityLimitation[] = [];\n addCaptureFailed(stage: CollectionStage, target: CollectionTarget): void {\n this.captureFailed.set(`${stage}\\u0000${target}`, Object.freeze({ stage, target }));\n }\n addCaptureInterrupted(stage: CollectionStage, target: CollectionTarget): void {\n this.captureInterrupted.set(`${stage}\\u0000${target}`, Object.freeze({ stage, target }));\n }\n addUnsupported(target: CollectionTarget, omittedAtLeast = 1): void {\n this.unsupported.set(target, (this.unsupported.get(target) ?? 0) + omittedAtLeast);\n }\n addRedacted(target: CollectionTarget, replacements = 1): void {\n this.redacted.set(target, (this.redacted.get(target) ?? 0) + replacements);\n }\n addCap(target: CollectionTarget, retained: number, omittedAtLeast = 1): void {\n const current = this.caps.get(target);\n this.caps.set(target, Object.freeze({\n retained: Math.max(retained, current?.retained ?? 0),\n omittedAtLeast: (current?.omittedAtLeast ?? 0) + omittedAtLeast,\n }));\n }\n addConversationTextTruncated(itemId: ItemId, retainedBytes: NonNegativeSafeInteger, omittedBytes: PositiveSafeInteger): void {\n this.textTruncations.push(Object.freeze({\n code: \"text-truncated\" as const,\n target: \"conversation-text\" as const,\n itemId,\n retainedBytes,\n omittedBytes,\n }));\n }\n addCommandManifestTextTruncated(commandId: CommandId, retainedBytes: NonNegativeSafeInteger, omittedBytes: PositiveSafeInteger): void {\n this.textTruncations.push(Object.freeze({\n code: \"text-truncated\" as const,\n target: \"command-manifest\" as const,\n commandId,\n retainedBytes,\n omittedBytes,\n }));\n }\n addCommandStreamTruncated(commandId: CommandId, stream: \"stdout\" | \"stderr\", retainedBytes: NonNegativeSafeInteger, omittedBytes: PositiveSafeInteger): void {\n this.textTruncations.push(Object.freeze({\n code: \"stream-truncated\" as const,\n commandId,\n stream,\n retainedBytes,\n omittedBytes,\n }));\n }\n addUnsafeCommandControlStripped(commandId: CommandId, stream: \"stdout\" | \"stderr\", strippedCount: number): void {\n this.textTruncations.push(Object.freeze({\n code: \"unsafe-control-stripped\" as const,\n commandId,\n stream,\n strippedCount: requiredPositive(strippedCount),\n }));\n }\n collection(): Collection {\n const limitations: ObservabilityLimitation[] = [];\n for (const { stage, target } of this.captureFailed.values()) {\n limitations.push(Object.freeze({\n code: \"capture-failed\" as const,\n stage,\n target,\n }));\n }\n for (const { stage, target } of this.captureInterrupted.values()) {\n limitations.push(Object.freeze({\n code: \"capture-interrupted\" as const,\n stage,\n target,\n }));\n }\n for (const [target, omittedAtLeast] of this.unsupported) {\n limitations.push(Object.freeze({\n code: \"unsupported-input\" as const,\n target,\n omittedAtLeast: requiredPositive(omittedAtLeast),\n }));\n }\n for (const [target, replacements] of this.redacted) {\n limitations.push(Object.freeze({\n code: \"redacted\" as const,\n target,\n replacementCount: requiredPositive(replacements),\n }));\n }\n for (const [target, cap] of this.caps) {\n limitations.push(Object.freeze({\n code: \"collection-cap-reached\" as const,\n target,\n retained: requiredNonNegative(cap.retained),\n omittedAtLeast: requiredPositive(cap.omittedAtLeast),\n }));\n }\n limitations.push(...this.textTruncations);\n limitations.sort(compareObservabilityLimitation);\n if (limitations.length === 0) {\n return Object.freeze({\n state: \"complete\" as const,\n limitations: Object.freeze([]) as readonly [\n ],\n });\n }\n const [first, ...rest] = limitations;\n if (first === undefined)\n throw new Error(\"A non-empty limitation list needs a first entry\");\n return Object.freeze({\n state: \"partial\" as const,\n limitations: Object.freeze([first, ...rest]) as readonly [\n ObservabilityLimitation,\n ...ObservabilityLimitation[]\n ],\n });\n }\n}\ntype SourceStage = \"adapter\" | \"sandbox-wrapper\" | \"runner-clock\" | \"runner-diagnostic-sink\";\nfunction sourceTarget(target: CollectionTarget): SourceReceiptLimitation[\"target\"] {\n switch (target) {\n case \"conversation-item\":\n case \"conversation-text\": return \"turn-item\";\n case \"usage-observation\": return \"usage-observation\";\n case \"command-manifest\": return \"command\";\n case \"command-stdout\": return \"stdout\";\n case \"command-stderr\": return \"stderr\";\n case \"timing-interval\": return \"activity\";\n case \"diagnostic\": return \"diagnostic\";\n }\n}\nfunction sourceLimitation(limitation: ObservabilityLimitation, stage: SourceStage): SourceReceiptLimitation {\n const target = sourceTarget(limitationTarget(limitation));\n switch (limitation.code) {\n case \"capture-failed\":\n case \"capture-interrupted\":\n return Object.freeze({ code: limitation.code, stage, target });\n case \"collection-cap-reached\":\n case \"unsupported-input\":\n return Object.freeze({ code: limitation.code, target, omittedAtLeast: limitation.omittedAtLeast });\n case \"text-truncated\":\n return Object.freeze({ code: \"text-truncated\", target, replacementOrOmittedCount: limitation.omittedBytes });\n case \"redacted\":\n return Object.freeze({ code: \"redacted\", target, replacementOrOmittedCount: limitation.replacementCount });\n case \"stream-truncated\":\n return Object.freeze({ code: \"text-truncated\", target, replacementOrOmittedCount: limitation.omittedBytes });\n case \"invalid-utf8-replaced\":\n return Object.freeze({ code: \"invalid-utf8-replaced\", target, replacementOrOmittedCount: limitation.replacementCount });\n case \"unsafe-control-stripped\":\n return Object.freeze({ code: \"unsafe-control-stripped\", target, replacementOrOmittedCount: limitation.strippedCount });\n }\n}\nexport function sourceCollection(sources: readonly {\n readonly collection: Collection;\n readonly stage: SourceStage;\n}[], additional: readonly SourceReceiptLimitation[] = []): SourceReceiptCollection {\n const limitations = [\n ...sources.flatMap(({ collection, stage }) => collection.limitations.map((limitation) => sourceLimitation(limitation, stage))),\n ...additional,\n ];\n const byKey = new Map(limitations.map((limitation) => [sourceReceiptLimitationKey(limitation), limitation] as const));\n const canonical = [...byKey.entries()]\n .sort(([left], [right]) => left === right ? 0 : left < right ? -1 : 1)\n .map(([, limitation]) => limitation);\n if (canonical.length === 0) {\n return Object.freeze({\n state: \"complete\" as const,\n limitations: Object.freeze([]) as readonly [\n ],\n });\n }\n const [first, ...rest] = canonical;\n if (first === undefined)\n throw new Error(\"A partial source collection needs a limitation\");\n return Object.freeze({\n state: \"partial\" as const,\n limitations: Object.freeze([first, ...rest]) as readonly [\n SourceReceiptLimitation,\n ...SourceReceiptLimitation[]\n ],\n });\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { SourceReceiptCollection, SourceReceiptLimitation } from "../../record/family/source-receipt/index.cjs";
1
+ import { type SourceReceiptCollection, type SourceReceiptLimitation } from "../../record/family/source-receipt/index.cjs";
2
2
  import { type Collection, type CollectionStage, type CollectionTarget, type CommandId, type ItemId, type NonNegativeSafeInteger, type ObservabilityEntityKind, type PositiveSafeInteger } from "../../record/family/source-receipt/model.cjs";
3
3
  /**
4
4
  * The Runner never exposes raw provider frames to the Record layer. These
@@ -1,4 +1,4 @@
1
- import type { SourceReceiptCollection, SourceReceiptLimitation } from "../../record/family/source-receipt/index.mjs";
1
+ import { type SourceReceiptCollection, type SourceReceiptLimitation } from "../../record/family/source-receipt/index.mjs";
2
2
  import { type Collection, type CollectionStage, type CollectionTarget, type CommandId, type ItemId, type NonNegativeSafeInteger, type ObservabilityEntityKind, type PositiveSafeInteger } from "../../record/family/source-receipt/model.mjs";
3
3
  /**
4
4
  * The Runner never exposes raw provider frames to the Record layer. These
@@ -1,4 +1,4 @@
1
- import type { SourceReceiptCollection, SourceReceiptLimitation } from "../../record/family/source-receipt/index.js";
1
+ import { type SourceReceiptCollection, type SourceReceiptLimitation } from "../../record/family/source-receipt/index.js";
2
2
  import { type Collection, type CollectionStage, type CollectionTarget, type CommandId, type ItemId, type NonNegativeSafeInteger, type ObservabilityEntityKind, type PositiveSafeInteger } from "../../record/family/source-receipt/model.js";
3
3
  /**
4
4
  * The Runner never exposes raw provider frames to the Record layer. These
@@ -26,6 +26,10 @@ exports.SHOW_CLI_OPTIONS = Object.freeze({
26
26
  multiple: true,
27
27
  help: help("Show one Experiment; repeat to show more."),
28
28
  }),
29
+ all: option({
30
+ type: "boolean",
31
+ help: help("Show Attempts hidden by the compact Results view."),
32
+ }),
29
33
  source: option({
30
34
  type: "boolean",
31
35
  help: help("Show captured source facts for one Attempt locator."),
@@ -55,7 +59,7 @@ exports.SHOW_CLI_OPTIONS = Object.freeze({
55
59
  const SHOW_HELP = `niceeval show — inspect results in the terminal
56
60
 
57
61
  Usage:
58
- niceeval show [--record <file>]
62
+ niceeval show [--all] [--record <file>]
59
63
  niceeval show --run <run-id>... [--record <file>]
60
64
  niceeval show --experiment <experiment-id>... [--record <file>]
61
65
  niceeval show @<locator> [--record <file>]
@@ -69,6 +73,7 @@ Selectors:
69
73
  --record <file> Read an external canonical SQLite Record.
70
74
  --run <run-id> Show one exact sealed Run; repeatable.
71
75
  --experiment <experiment-id> Show one exact Experiment; repeatable.
76
+ --all Show Attempts hidden by compact Results.
72
77
 
73
78
  Attempt details:
74
79
  --source Show captured sources and Assertion sites.
@@ -139,6 +144,7 @@ function runShow(argv) {
139
144
  const timing = parsed.values.timing === true;
140
145
  const showUsage = parsed.values.usage === true;
141
146
  const diff = parsed.values.diff === true;
147
+ const all = parsed.values.all === true;
142
148
  const detailModes = [source, execution, timing, showUsage, diff].filter(Boolean).length;
143
149
  const expand = typeof parsed.values.expand === "string"
144
150
  ? parsed.values.expand
@@ -155,6 +161,9 @@ function runShow(argv) {
155
161
  return yield* usage("An Attempt locator, --run, and --experiment are mutually exclusive.");
156
162
  if (runIds.length > 0 && experimentIds.length > 0)
157
163
  return yield* usage("--run and --experiment are mutually exclusive.");
164
+ if (all &&
165
+ (locator !== undefined || runIds.length > 0 || experimentIds.length > 0))
166
+ return yield* usage("--all applies only to Results, not --experiment, --run, or an Attempt locator.");
158
167
  const facts = yield* effect_1.Effect.flatMap(application_ts_1.CliInvocationFacts, ({ facts }) => facts).pipe(effect_1.Effect.mapError((cause) => failure("read invocation facts", cause)));
159
168
  const inspectionSource = typeof parsed.values.record === "string"
160
169
  ? (0, index_ts_1.externalInspectionSource)(facts.cwd, parsed.values.record)
@@ -173,7 +182,7 @@ function runShow(argv) {
173
182
  runIds.length === 0 &&
174
183
  experimentIds.length === 0) {
175
184
  const document = yield* select("overview.get", () => (0, index_ts_1.selectInspectionOperation)(opened, { kind: "overview.get" }));
176
- yield* write("stdout", (0, render_ts_1.renderOverview)(yield* project("overview.get", () => (0, model_ts_1.projectOverview)(document))));
185
+ yield* write("stdout", (0, render_ts_1.renderOverview)(yield* project("overview.get", () => (0, model_ts_1.projectOverview)(document)), { all }));
177
186
  return 0;
178
187
  }
179
188
  if (runIds.length > 0) {