niceeval 0.16.2 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/dist/cli/bootstrap.cjs +7 -1
  2. package/dist/cli/bootstrap.cjs.map +1 -1
  3. package/dist/cli/project-configuration.cjs +8 -11
  4. package/dist/cli/project-configuration.cjs.map +1 -1
  5. package/dist/expect/index.cjs.map +1 -1
  6. package/dist/expect/index.d.cts +1 -0
  7. package/dist/expect/index.d.mts +1 -0
  8. package/dist/expect/index.d.ts +1 -0
  9. package/dist/experiment/host/cli/contribution.cjs +6 -11
  10. package/dist/experiment/host/cli/contribution.cjs.map +1 -1
  11. package/dist/experiment/host/cli/contribution.d.cts +0 -16
  12. package/dist/experiment/host/cli/contribution.d.mts +0 -16
  13. package/dist/experiment/host/cli/contribution.d.ts +0 -16
  14. package/dist/experiment/host/operations.cjs +3 -3
  15. package/dist/experiment/host/operations.cjs.map +1 -1
  16. package/dist/experiment/host/types.cjs.map +1 -1
  17. package/dist/experiment/host/types.d.cts +0 -4
  18. package/dist/experiment/host/types.d.mts +0 -4
  19. package/dist/experiment/host/types.d.ts +0 -4
  20. package/dist/fresh-import.cjs +2 -2
  21. package/dist/fresh-import.cjs.map +1 -1
  22. package/dist/fresh-import.d.cts +3 -3
  23. package/dist/fresh-import.d.mts +3 -3
  24. package/dist/fresh-import.d.ts +3 -3
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +1 -0
  27. package/dist/index.d.mts +1 -0
  28. package/dist/index.d.ts +1 -0
  29. package/dist/inspection/codec.cjs.map +1 -1
  30. package/dist/inspection/codec.d.cts +1 -1
  31. package/dist/inspection/codec.d.mts +1 -1
  32. package/dist/inspection/codec.d.ts +1 -1
  33. package/dist/inspection/facts.cjs +66 -9
  34. package/dist/inspection/facts.cjs.map +1 -1
  35. package/dist/inspection/facts.d.cts +4 -0
  36. package/dist/inspection/facts.d.mts +4 -0
  37. package/dist/inspection/facts.d.ts +4 -0
  38. package/dist/inspection/facts.js +4 -2
  39. package/dist/inspection/index.cjs +1 -3
  40. package/dist/inspection/index.cjs.map +1 -1
  41. package/dist/inspection/index.d.cts +1 -1
  42. package/dist/inspection/index.d.mts +1 -1
  43. package/dist/inspection/index.d.ts +1 -1
  44. package/dist/inspection/index.js +44 -48
  45. package/dist/inspection/limits.cjs +3 -1
  46. package/dist/inspection/limits.cjs.map +1 -1
  47. package/dist/inspection/limits.d.cts +2 -0
  48. package/dist/inspection/limits.d.mts +2 -0
  49. package/dist/inspection/limits.d.ts +2 -0
  50. package/dist/inspection/limits.js +6 -4
  51. package/dist/inspection/project-source.cjs +4 -1
  52. package/dist/inspection/project-source.cjs.map +1 -1
  53. package/dist/inspection/protocol.cjs +10 -18
  54. package/dist/inspection/protocol.cjs.map +1 -1
  55. package/dist/inspection/protocol.d.cts +111 -173
  56. package/dist/inspection/protocol.d.mts +111 -173
  57. package/dist/inspection/protocol.d.ts +111 -173
  58. package/dist/inspection/public.mjs +73 -109
  59. package/dist/inspection/results.cjs +12 -48
  60. package/dist/inspection/results.cjs.map +1 -1
  61. package/dist/inspection/results.d.cts +124 -122
  62. package/dist/inspection/results.d.mts +124 -122
  63. package/dist/inspection/results.d.ts +124 -122
  64. package/dist/inspection/results.js +16 -20
  65. package/dist/inspection/select.cjs +80 -117
  66. package/dist/inspection/select.cjs.map +1 -1
  67. package/dist/inspection/source.cjs +14 -15
  68. package/dist/inspection/source.cjs.map +1 -1
  69. package/dist/inspection/source.d.cts +6 -3
  70. package/dist/inspection/source.d.mts +6 -3
  71. package/dist/inspection/source.d.ts +6 -3
  72. package/dist/inspection/trace.cjs +1 -1
  73. package/dist/inspection/trace.cjs.map +1 -1
  74. package/dist/load-config.cjs +17 -11
  75. package/dist/load-config.cjs.map +1 -1
  76. package/dist/load-config.d.cts +3 -2
  77. package/dist/load-config.d.mts +3 -2
  78. package/dist/load-config.d.ts +3 -2
  79. package/dist/o11y/adapter-usage-projection.cjs +5 -1
  80. package/dist/o11y/adapter-usage-projection.cjs.map +1 -1
  81. package/dist/o11y/adapter-usage-projection.d.cts +109 -1
  82. package/dist/o11y/adapter-usage-projection.d.mts +109 -1
  83. package/dist/o11y/adapter-usage-projection.d.ts +109 -1
  84. package/dist/o11y/cache-read.cjs +113 -0
  85. package/dist/o11y/cache-read.cjs.map +1 -0
  86. package/dist/o11y/cache-read.d.cts +80 -0
  87. package/dist/o11y/cache-read.d.mts +80 -0
  88. package/dist/o11y/cache-read.d.ts +80 -0
  89. package/dist/o11y/cache-read.js +8 -0
  90. package/dist/o11y/cache-read.js.map +1 -0
  91. package/dist/o11y/eval-usage.cjs +4 -1
  92. package/dist/o11y/eval-usage.cjs.map +1 -1
  93. package/dist/o11y/eval-usage.d.cts +4 -1
  94. package/dist/o11y/eval-usage.d.mts +4 -1
  95. package/dist/o11y/eval-usage.d.ts +4 -1
  96. package/dist/record/host/sqlite-host.cjs +188 -53
  97. package/dist/record/host/sqlite-host.cjs.map +1 -1
  98. package/dist/record/host/sqlite-host.d.cts +37 -1
  99. package/dist/record/host/sqlite-host.d.mts +37 -1
  100. package/dist/record/host/sqlite-host.d.ts +37 -1
  101. package/dist/record/host/sqlite-host.js +16 -8
  102. package/dist/record/maintenance/runtime.cjs +3 -3
  103. package/dist/record/maintenance/runtime.cjs.map +1 -1
  104. package/dist/record/sqlite/admission-repository.cjs +18 -18
  105. package/dist/record/sqlite/admission-repository.cjs.map +1 -1
  106. package/dist/record/sqlite/case-repository.cjs +6 -6
  107. package/dist/record/sqlite/case-repository.cjs.map +1 -1
  108. package/dist/record/sqlite/coordination-repository.cjs +25 -25
  109. package/dist/record/sqlite/coordination-repository.cjs.map +1 -1
  110. package/dist/record/sqlite/current-schema.cjs +115 -111
  111. package/dist/record/sqlite/current-schema.cjs.map +1 -1
  112. package/dist/record/sqlite/current-schema.d.cts +3 -3
  113. package/dist/record/sqlite/current-schema.d.mts +3 -3
  114. package/dist/record/sqlite/current-schema.d.ts +3 -3
  115. package/dist/record/sqlite/database.cjs +56 -53
  116. package/dist/record/sqlite/database.cjs.map +1 -1
  117. package/dist/record/sqlite/index.cjs +3 -1
  118. package/dist/record/sqlite/index.cjs.map +1 -1
  119. package/dist/record/sqlite/index.d.cts +5 -2
  120. package/dist/record/sqlite/index.d.mts +5 -2
  121. package/dist/record/sqlite/index.d.ts +5 -2
  122. package/dist/record/sqlite/legacy-schema-018.cjs +443 -0
  123. package/dist/record/sqlite/legacy-schema-018.cjs.map +1 -0
  124. package/dist/record/sqlite/legacy-schema-018.d.cts +6 -0
  125. package/dist/record/sqlite/legacy-schema-018.d.mts +6 -0
  126. package/dist/record/sqlite/legacy-schema-018.d.ts +6 -0
  127. package/dist/record/sqlite/legacy-schema-018.js +6 -0
  128. package/dist/record/sqlite/legacy-schema-018.js.map +1 -0
  129. package/dist/record/sqlite/migration.cjs +105 -46
  130. package/dist/record/sqlite/migration.cjs.map +1 -1
  131. package/dist/record/sqlite/migration.d.cts +2 -1
  132. package/dist/record/sqlite/migration.d.mts +2 -1
  133. package/dist/record/sqlite/migration.d.ts +2 -1
  134. package/dist/record/sqlite/portable-capture.cjs +13 -13
  135. package/dist/record/sqlite/portable-capture.cjs.map +1 -1
  136. package/dist/record/sqlite/registry-repository.cjs +22 -22
  137. package/dist/record/sqlite/registry-repository.cjs.map +1 -1
  138. package/dist/record/sqlite/schema.cjs +10 -2
  139. package/dist/record/sqlite/schema.cjs.map +1 -1
  140. package/dist/record/sqlite/schema.d.cts +4 -1
  141. package/dist/record/sqlite/schema.d.mts +4 -1
  142. package/dist/record/sqlite/schema.d.ts +4 -1
  143. package/dist/record/sqlite/schema.js +20 -14
  144. package/dist/record/sqlite/storage-worker.cjs +1 -1
  145. package/dist/record/sqlite/storage-worker.cjs.map +1 -1
  146. package/dist/record/sqlite/storage.cjs +316 -232
  147. package/dist/record/sqlite/storage.cjs.map +1 -1
  148. package/dist/record/sqlite/storage.d.cts +10 -2
  149. package/dist/record/sqlite/storage.d.mts +10 -2
  150. package/dist/record/sqlite/storage.d.ts +10 -2
  151. package/dist/record/sqlite/storage.js +54 -50
  152. package/dist/record/sqlite/types.cjs +1 -1
  153. package/dist/record/sqlite/types.cjs.map +1 -1
  154. package/dist/record/sqlite/types.d.cts +13 -1
  155. package/dist/record/sqlite/types.d.mts +13 -1
  156. package/dist/record/sqlite/types.d.ts +13 -1
  157. package/dist/run/cli/contribution.cjs +17 -12
  158. package/dist/run/cli/contribution.cjs.map +1 -1
  159. package/dist/run/host/lifecycle-adapter.cjs +1 -1
  160. package/dist/run/host/lifecycle-adapter.cjs.map +1 -1
  161. package/dist/run/storage/owner-identity.cjs +78 -16
  162. package/dist/run/storage/owner-identity.cjs.map +1 -1
  163. package/dist/run/storage/owner-identity.d.cts +2 -1
  164. package/dist/run/storage/owner-identity.d.mts +2 -1
  165. package/dist/run/storage/owner-identity.d.ts +2 -1
  166. package/dist/run/storage/sqlite.cjs +55 -55
  167. package/dist/run/storage/sqlite.cjs.map +1 -1
  168. package/dist/runner/accept.cjs +12 -42
  169. package/dist/runner/accept.cjs.map +1 -1
  170. package/dist/runner/accept.d.cts +2 -3
  171. package/dist/runner/accept.d.mts +2 -3
  172. package/dist/runner/accept.d.ts +2 -3
  173. package/dist/runner/adapter-usage.cjs +2 -2
  174. package/dist/runner/adapter-usage.cjs.map +1 -1
  175. package/dist/runner/adoption.cjs +14 -26
  176. package/dist/runner/adoption.cjs.map +1 -1
  177. package/dist/runner/adoption.d.cts +5 -13
  178. package/dist/runner/adoption.d.mts +5 -13
  179. package/dist/runner/adoption.d.ts +5 -13
  180. package/dist/runner/adoption.js +2 -4
  181. package/dist/runner/record.cjs +24 -18
  182. package/dist/runner/record.cjs.map +1 -1
  183. package/dist/runner/rename-experiment.cjs +5 -7
  184. package/dist/runner/rename-experiment.cjs.map +1 -1
  185. package/dist/runner/reuse-plan.cjs +37 -18
  186. package/dist/runner/reuse-plan.cjs.map +1 -1
  187. package/dist/runner/reuse-plan.d.cts +4 -1
  188. package/dist/runner/reuse-plan.d.mts +4 -1
  189. package/dist/runner/reuse-plan.d.ts +4 -1
  190. package/dist/runner/setup-prefix-plan.cjs +17 -12
  191. package/dist/runner/setup-prefix-plan.cjs.map +1 -1
  192. package/dist/runner/setup-prefix-plan.d.cts +0 -2
  193. package/dist/runner/setup-prefix-plan.d.mts +0 -2
  194. package/dist/runner/setup-prefix-plan.d.ts +0 -2
  195. package/dist/runner/setup-prefix-plan.js +8 -12
  196. package/dist/sandbox/backend.cjs +10 -1
  197. package/dist/sandbox/backend.cjs.map +1 -1
  198. package/dist/sandbox/backend.d.cts +16 -8
  199. package/dist/sandbox/backend.d.mts +16 -8
  200. package/dist/sandbox/backend.d.ts +16 -8
  201. package/dist/sandbox/backend.js +28 -26
  202. package/dist/sandbox/docker.cjs +7 -1
  203. package/dist/sandbox/docker.cjs.map +1 -1
  204. package/dist/sandbox/e2b-cache-repository.cjs +13 -3
  205. package/dist/sandbox/e2b-cache-repository.cjs.map +1 -1
  206. package/dist/sandbox/e2b-cache-repository.d.cts +3 -0
  207. package/dist/sandbox/e2b-cache-repository.d.mts +3 -0
  208. package/dist/sandbox/e2b-cache-repository.d.ts +3 -0
  209. package/dist/sandbox/e2b-cache-repository.js +16 -12
  210. package/dist/sandbox/e2b.cjs +2 -2
  211. package/dist/sandbox/e2b.cjs.map +1 -1
  212. package/dist/sandbox/incus/materialize.cjs +1 -1
  213. package/dist/sandbox/incus/materialize.cjs.map +1 -1
  214. package/dist/show/contribution.cjs +3 -3
  215. package/dist/show/contribution.cjs.map +1 -1
  216. package/dist/show/model.cjs +14 -13
  217. package/dist/show/model.cjs.map +1 -1
  218. package/dist/show/model.d.cts +7 -7
  219. package/dist/show/model.d.mts +7 -7
  220. package/dist/show/model.d.ts +7 -7
  221. package/dist/show/render.cjs +14 -0
  222. package/dist/show/render.cjs.map +1 -1
  223. package/dist/user-database/storage-worker.cjs +13 -3
  224. package/dist/user-database/storage-worker.cjs.map +1 -1
  225. package/dist/view/app-dist/.vite/manifest.json +2 -2
  226. package/dist/view/app-dist/assets/{index-CmVoXbwG.js → index-B3ijZRph.js} +17 -17
  227. package/dist/view/app-dist/assets/{quality-cost-scatter-BuLISaH4.js → quality-cost-scatter-B--DfJ9s.js} +1 -1
  228. package/dist/view/app-dist/index.html +1 -1
  229. package/dist/view/application-runtime.cjs +8 -0
  230. package/dist/view/application-runtime.cjs.map +1 -0
  231. package/dist/view/application-runtime.d.cts +9 -0
  232. package/dist/view/application-runtime.d.mts +9 -0
  233. package/dist/view/application-runtime.d.ts +9 -0
  234. package/dist/view/application-runtime.js +6 -0
  235. package/dist/view/application-runtime.js.map +1 -0
  236. package/dist/view/cli/contribution.cjs +5 -2
  237. package/dist/view/cli/contribution.cjs.map +1 -1
  238. package/dist/view/cli/contribution.d.cts +2 -1
  239. package/dist/view/cli/contribution.d.mts +2 -1
  240. package/dist/view/cli/contribution.d.ts +2 -1
  241. package/dist/view/function-runtime.mjs +1019 -456
  242. package/dist/view/http-protocol.d.cts +1 -9
  243. package/dist/view/http-protocol.d.mts +1 -9
  244. package/dist/view/http-protocol.d.ts +1 -9
  245. package/dist/view/inspection-host.cjs +39 -30
  246. package/dist/view/inspection-host.cjs.map +1 -1
  247. package/dist/view/inspection-host.d.cts +7545 -2
  248. package/dist/view/inspection-host.d.mts +7545 -2
  249. package/dist/view/inspection-host.d.ts +7545 -2
  250. package/dist/view/server.cjs +8 -5
  251. package/dist/view/server.cjs.map +1 -1
  252. package/dist/view/server.d.cts +4 -2
  253. package/dist/view/server.d.mts +4 -2
  254. package/dist/view/server.d.ts +4 -2
  255. package/docs-site/zh/reference/cli.mdx +1 -2
  256. package/docs-site/zh/tutorials/control-run-cost.mdx +22 -0
  257. package/docs-site/zh/tutorials/niceeval-taste-application.mdx +21 -0
  258. package/package.json +1 -1
@@ -15,7 +15,7 @@ export interface FreshImportGeneration {
15
15
  * projectRoot retain canonical process identity.
16
16
  */
17
17
  export declare function acquireFreshImportGeneration(projectRoot?: string): Effect.Effect<FreshImportGeneration, never, Scope.Scope>;
18
- /** Promise ABI facade for callers that cannot retain an Effect Scope. */
19
- export declare function freshImportModule(absPath: string): Promise<{
18
+ /** Load one fresh entry while retaining the generation gate until import settles. */
19
+ export declare function freshImportModule(absPath: string): Effect.Effect<{
20
20
  default?: unknown;
21
- }>;
21
+ }, import("effect/Cause").UnknownError, never>;
@@ -15,7 +15,7 @@ export interface FreshImportGeneration {
15
15
  * projectRoot retain canonical process identity.
16
16
  */
17
17
  export declare function acquireFreshImportGeneration(projectRoot?: string): Effect.Effect<FreshImportGeneration, never, Scope.Scope>;
18
- /** Promise ABI facade for callers that cannot retain an Effect Scope. */
19
- export declare function freshImportModule(absPath: string): Promise<{
18
+ /** Load one fresh entry while retaining the generation gate until import settles. */
19
+ export declare function freshImportModule(absPath: string): Effect.Effect<{
20
20
  default?: unknown;
21
- }>;
21
+ }, import("effect/Cause").UnknownError, never>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAC/C,uEAAuE;AACvE,yCAA2G;AAAlG,uGAAA,UAAU,OAAA;AAAE,4GAAA,eAAe,OAAA;AAAE,4GAAA,eAAe,OAAA;AAAE,yGAAA,YAAY,OAAA;AAAE,6GAAA,gBAAgB,OAAA;AACrF,2CAAoE;AAA3D,2GAAA,aAAa,OAAA;AAAE,mHAAA,qBAAqB,OAAA;AAC7C,kDAAoD;AAA3C,uGAAA,WAAW,OAAA;AAEpB,kDAAyD;AAAhD,4GAAA,gBAAgB,OAAA;AAGzB,0EAAuN;AAA9M,2HAAA,mBAAmB,OAAA;AAG5B,qCAA8D;AAArD,qGAAA,UAAU,OAAA;AAAE,iGAAA,MAAM,OAAA;AAAE,wGAAA,aAAa,OAAA;AAC1C,6CAA6C;AAC7C,6EAA6E;AAC7E,8DAAiG;AAAxF,wHAAA,oBAAoB,OAAA;AAAE,kHAAA,cAAc,OAAA;AAAE,kHAAA,cAAc,OAAA;AAK7D,kEAAmH;AAA1G,8GAAA,UAAU,OAAA;AAAE,gHAAA,YAAY,OAAA;AAAE,wHAAA,oBAAoB,OAAA;AAAE,sHAAA,kBAAkB,OAAA;AAG3E,wDAAiH;AAAxG,kHAAA,sBAAsB,OAAA;AAI/B,kEAAwF;AAA/E,uHAAA,mBAAmB,OAAA;AAAE,sHAAA,kBAAkB,OAAA","sourcesContent":["// niceeval 公开导出(import { … } from \"niceeval\")。\n// Agent/Adapter 相关见 \"niceeval/adapter\";Sandbox 相关见 \"niceeval/sandbox\"。\nexport { defineEval, defineScoreEval, defineEvalGroup, defineConfig, defineExperiment } from \"./define.ts\";\nexport { defineAdapter, defineAdapterContract } from \"./adapter.ts\";\nexport { defineJudge } from \"./assertions/judge.ts\";\nexport type { JudgeAnchor, JudgeDefinition, JudgeOptions } from \"./assertions/judge.ts\";\nexport { defineScoreMatch } from \"./assertions/match.ts\";\nexport type { ManagedScoreMatchOptions, ScoreMatch, ScoreMatchAnchor, ScoreMatchContext, ScoreMatchLlmFailure, ScoreMatchResult } from \"./assertions/match.ts\";\nexport type { AssertionEntryId } from \"./assertions/identity.ts\";\nexport { readScoreMatchAudit, type ScoreMatchAudit, type ScoreMatchAuditV3, type ScoreMatchAuditImageContent, type ScoreMatchAuditEnvelope, type ScoreMatchAuditReadResult, } from \"./assertions/score-match-audit.ts\";\nexport type { AgentSendWindowIdentity, AgentWorkspaceDiffEndpoint, AgentWorkspaceDiffHunks, AgentWorkspaceDiffPolicy, AgentWorkspaceDiff, AgentWorkspaceDiffWindow, AgentWorkspaceDiffWindowChange, } from \"./assertions/workspace-diff.ts\";\nexport type { AssertionCheck, ScoreFunction, PolymorphicBooleanAssertionHandle, PolymorphicMeasurementAssertionHandle, PostRunBooleanAssertionHandle, } from \"./assertions/api.ts\";\nexport { requireEnv, getEnv, stripComments } from \"./util.ts\";\n// 执行失败分类:抛出点糖衣类(声明死因波及多远)+ 结构守卫。判据、分类链与止损语义见\n// docs/feature/error-classification/README.md;`niceeval/adapter` 复导出同一份词表类型。\nexport { ExperimentFatalError, EvalFatalError, failureClassOf } from \"./shared/failure-class.ts\";\n// 类型(eval 作者会用到;跑哪个 agent / 用哪个 sandbox 见对应子路径)\nexport type { StreamEvent, ToolName, JsonValue, FlagValue, ExperimentFlags, JsonMatch, Usage, Turn, EvidenceCoverageStatus, EvidenceCoverageEntry, EvidenceCoverage, TurnEvidenceCoverage, TurnInput, InputFile, AnswerValue, InputResponse, RespondAnswer, TurnHandle, SessionHandle, TestContext, ScoreTestContext, Verdict, EvalAuthorFields, EvalInput, ScoreEvalInput, EvalDefinition, AnyEvalDefinition, EvalGroupMember, EvalGroupInput, EvalGroupDefinition, EvaluationKind, EvalDescriptor, ExperimentAuthorFields, SharedStateConfig, ExperimentInput, ExperimentDefinition, ExperimentHook, ExperimentHookContext, Config, LocalizedText, Reporter, ReporterEvent, EvalResult, AcceptedDifference, AcceptedResult, RetryAttemptRecord, InvocationSummary, InvocationShape, DiagnosticRecord, ExperimentRunInfo, SandboxRunInfo, ScriptResult, CommandResult, InputRequest, InputRequestFilter, O11ySummary, TraceSpan, SpanKind, DerivedFacts, FailureClass, FailureScope, AttemptFailureInfo, AttemptFailureClassifier, ExternalCause, ExternalCauseFact, ExternalCauseLink, ExternalCauseScalar, } from \"./types.ts\";\nexport type { Adapter, AdapterAssertionsFactory, AdapterAssertionsFactoryContext, AdapterCleanupContext, AttemptCancellation, AttemptSignal, AdapterContract, AdapterCreateContext, AdapterDefinition, AdapterEvalDefinition, AdapterEvalInput, AdapterIdentity, AdapterImplementation, AdapterImplementationInput, AdapterRuntimeDefinition, AdapterScoreEvalInput, EvalContext, ReservedAdapterContextKey, } from \"./adapter.ts\";\nexport type { ParsedTranscript } from \"./o11y/parsers/index.ts\";\nexport { factuality, faithfulness, instructionFollowing, pairwisePreference } from \"./assertions/judge-presets.ts\";\nexport type { JudgePresetOptions, FactualityMaterial, FaithfulnessMaterial, InstructionFollowingMaterial, PairwisePreferenceMaterial } from \"./assertions/judge-presets.ts\";\nexport type { JudgeProvider, JudgeSelection } from \"./judge/index.ts\";\nexport { MigrationRequiredError, type MigrationOccurrence, type ErrorSource } from \"./error-assistance/index.ts\";\nexport type { AdapterUsageInput, AdapterUsageSeal } from \"./adapter-usage.ts\";\nexport type { AdapterAttachmentInput, AdapterAttachmentReceipt } from \"./adapter-attachments.ts\";\nexport type { ExecutionDisplayBlock, ExecutionTraceActor, ExecutionTraceEvent, ExecutionTraceEvidence, ExecutionTraceInput, ExecutionTraceLimitation, ExecutionTraceLink, ExecutionTraceReceipt, ExecutionTraceScope, ExecutionTraceScopeMembership, ExecutionTraceSource, ExecutionTraceTime, TraceJson, } from \"./adapter-execution-trace.ts\";\nexport { defineMaterialMatch, defineContextMatch } from \"./assertions/context-match.ts\";\nexport type { MaterialMatch, ContextBooleanMatch, ContextScoreMatch, MatchContext, ReadonlyMaterial, MatchFact, MaterialCollection, MaterialItem, MaterialCaptureBudget, FactCaptureBudget } from \"./assertions/context-match.ts\";\nexport type { AttemptUsageSnapshot, AdapterAttemptUsageSnapshot } from \"./o11y/adapter-usage-projection.ts\";\nexport type { EvalUsage } from \"./o11y/eval-usage.ts\";\nexport type { AgentMatchContext } from \"./context/assert-first.ts\";\nexport type { ModelSlotSelection, ResolvedModelSlot, ResolvedModelSlots } from \"./model-slots.ts\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAC/C,uEAAuE;AACvE,yCAA2G;AAAlG,uGAAA,UAAU,OAAA;AAAE,4GAAA,eAAe,OAAA;AAAE,4GAAA,eAAe,OAAA;AAAE,yGAAA,YAAY,OAAA;AAAE,6GAAA,gBAAgB,OAAA;AACrF,2CAAoE;AAA3D,2GAAA,aAAa,OAAA;AAAE,mHAAA,qBAAqB,OAAA;AAC7C,kDAAoD;AAA3C,uGAAA,WAAW,OAAA;AAEpB,kDAAyD;AAAhD,4GAAA,gBAAgB,OAAA;AAGzB,0EAAuN;AAA9M,2HAAA,mBAAmB,OAAA;AAG5B,qCAA8D;AAArD,qGAAA,UAAU,OAAA;AAAE,iGAAA,MAAM,OAAA;AAAE,wGAAA,aAAa,OAAA;AAC1C,6CAA6C;AAC7C,6EAA6E;AAC7E,8DAAiG;AAAxF,wHAAA,oBAAoB,OAAA;AAAE,kHAAA,cAAc,OAAA;AAAE,kHAAA,cAAc,OAAA;AAK7D,kEAAmH;AAA1G,8GAAA,UAAU,OAAA;AAAE,gHAAA,YAAY,OAAA;AAAE,wHAAA,oBAAoB,OAAA;AAAE,sHAAA,kBAAkB,OAAA;AAG3E,wDAAiH;AAAxG,kHAAA,sBAAsB,OAAA;AAI/B,kEAAwF;AAA/E,uHAAA,mBAAmB,OAAA;AAAE,sHAAA,kBAAkB,OAAA","sourcesContent":["// niceeval 公开导出(import { … } from \"niceeval\")。\n// Agent/Adapter 相关见 \"niceeval/adapter\";Sandbox 相关见 \"niceeval/sandbox\"。\nexport { defineEval, defineScoreEval, defineEvalGroup, defineConfig, defineExperiment } from \"./define.ts\";\nexport { defineAdapter, defineAdapterContract } from \"./adapter.ts\";\nexport { defineJudge } from \"./assertions/judge.ts\";\nexport type { JudgeAnchor, JudgeDefinition, JudgeOptions } from \"./assertions/judge.ts\";\nexport { defineScoreMatch } from \"./assertions/match.ts\";\nexport type { ManagedScoreMatchOptions, ScoreMatch, ScoreMatchAnchor, ScoreMatchContext, ScoreMatchLlmFailure, ScoreMatchResult } from \"./assertions/match.ts\";\nexport type { AssertionEntryId } from \"./assertions/identity.ts\";\nexport { readScoreMatchAudit, type ScoreMatchAudit, type ScoreMatchAuditV3, type ScoreMatchAuditImageContent, type ScoreMatchAuditEnvelope, type ScoreMatchAuditReadResult, } from \"./assertions/score-match-audit.ts\";\nexport type { AgentSendWindowIdentity, AgentWorkspaceDiffEndpoint, AgentWorkspaceDiffHunks, AgentWorkspaceDiffPolicy, AgentWorkspaceDiff, AgentWorkspaceDiffWindow, AgentWorkspaceDiffWindowChange, } from \"./assertions/workspace-diff.ts\";\nexport type { AssertionCheck, ScoreFunction, PolymorphicBooleanAssertionHandle, PolymorphicMeasurementAssertionHandle, PostRunBooleanAssertionHandle, } from \"./assertions/api.ts\";\nexport { requireEnv, getEnv, stripComments } from \"./util.ts\";\n// 执行失败分类:抛出点糖衣类(声明死因波及多远)+ 结构守卫。判据、分类链与止损语义见\n// docs/feature/error-classification/README.md;`niceeval/adapter` 复导出同一份词表类型。\nexport { ExperimentFatalError, EvalFatalError, failureClassOf } from \"./shared/failure-class.ts\";\n// 类型(eval 作者会用到;跑哪个 agent / 用哪个 sandbox 见对应子路径)\nexport type { StreamEvent, ToolName, JsonValue, FlagValue, ExperimentFlags, JsonMatch, Usage, Turn, EvidenceCoverageStatus, EvidenceCoverageEntry, EvidenceCoverage, TurnEvidenceCoverage, TurnInput, InputFile, AnswerValue, InputResponse, RespondAnswer, TurnHandle, SessionHandle, TestContext, ScoreTestContext, Verdict, EvalAuthorFields, EvalInput, ScoreEvalInput, EvalDefinition, AnyEvalDefinition, EvalGroupMember, EvalGroupInput, EvalGroupDefinition, EvaluationKind, EvalDescriptor, ExperimentAuthorFields, SharedStateConfig, ExperimentInput, ExperimentDefinition, ExperimentHook, ExperimentHookContext, Config, LocalizedText, Reporter, ReporterEvent, EvalResult, AcceptedDifference, AcceptedResult, RetryAttemptRecord, InvocationSummary, InvocationShape, DiagnosticRecord, ExperimentRunInfo, SandboxRunInfo, ScriptResult, CommandResult, InputRequest, InputRequestFilter, O11ySummary, TraceSpan, SpanKind, DerivedFacts, FailureClass, FailureScope, AttemptFailureInfo, AttemptFailureClassifier, ExternalCause, ExternalCauseFact, ExternalCauseLink, ExternalCauseScalar, } from \"./types.ts\";\nexport type { Adapter, AdapterAssertionsFactory, AdapterAssertionsFactoryContext, AdapterCleanupContext, AttemptCancellation, AttemptSignal, AdapterContract, AdapterCreateContext, AdapterDefinition, AdapterEvalDefinition, AdapterEvalInput, AdapterIdentity, AdapterImplementation, AdapterImplementationInput, AdapterRuntimeDefinition, AdapterScoreEvalInput, EvalContext, ReservedAdapterContextKey, } from \"./adapter.ts\";\nexport type { ParsedTranscript } from \"./o11y/parsers/index.ts\";\nexport { factuality, faithfulness, instructionFollowing, pairwisePreference } from \"./assertions/judge-presets.ts\";\nexport type { JudgePresetOptions, FactualityMaterial, FaithfulnessMaterial, InstructionFollowingMaterial, PairwisePreferenceMaterial } from \"./assertions/judge-presets.ts\";\nexport type { JudgeProvider, JudgeSelection } from \"./judge/index.ts\";\nexport { MigrationRequiredError, type MigrationOccurrence, type ErrorSource } from \"./error-assistance/index.ts\";\nexport type { AdapterUsageInput, AdapterUsageSeal } from \"./adapter-usage.ts\";\nexport type { AdapterAttachmentInput, AdapterAttachmentReceipt } from \"./adapter-attachments.ts\";\nexport type { ExecutionDisplayBlock, ExecutionTraceActor, ExecutionTraceEvent, ExecutionTraceEvidence, ExecutionTraceInput, ExecutionTraceLimitation, ExecutionTraceLink, ExecutionTraceReceipt, ExecutionTraceScope, ExecutionTraceScopeMembership, ExecutionTraceSource, ExecutionTraceTime, TraceJson, } from \"./adapter-execution-trace.ts\";\nexport { defineMaterialMatch, defineContextMatch } from \"./assertions/context-match.ts\";\nexport type { MaterialMatch, ContextBooleanMatch, ContextScoreMatch, MatchContext, ReadonlyMaterial, MatchFact, MaterialCollection, MaterialItem, MaterialCaptureBudget, FactCaptureBudget } from \"./assertions/context-match.ts\";\nexport type { AttemptUsageSnapshot, AdapterAttemptUsageSnapshot } from \"./o11y/adapter-usage-projection.ts\";\nexport type { EvalUsage } from \"./o11y/eval-usage.ts\";\nexport type { AgentMatchContext } from \"./context/assert-first.ts\";\nexport type { ModelSlotSelection, ResolvedModelSlot, ResolvedModelSlots } from \"./model-slots.ts\";\nexport type { CacheReadReport, CacheReadSummary } from \"./o11y/cache-read.ts\";\n"]}
package/dist/index.d.cts CHANGED
@@ -26,3 +26,4 @@ export type { AttemptUsageSnapshot, AdapterAttemptUsageSnapshot } from "./o11y/a
26
26
  export type { EvalUsage } from "./o11y/eval-usage.cjs";
27
27
  export type { AgentMatchContext } from "./context/assert-first.cjs";
28
28
  export type { ModelSlotSelection, ResolvedModelSlot, ResolvedModelSlots } from "./model-slots.cjs";
29
+ export type { CacheReadReport, CacheReadSummary } from "./o11y/cache-read.cjs";
package/dist/index.d.mts CHANGED
@@ -26,3 +26,4 @@ export type { AttemptUsageSnapshot, AdapterAttemptUsageSnapshot } from "./o11y/a
26
26
  export type { EvalUsage } from "./o11y/eval-usage.mjs";
27
27
  export type { AgentMatchContext } from "./context/assert-first.mjs";
28
28
  export type { ModelSlotSelection, ResolvedModelSlot, ResolvedModelSlots } from "./model-slots.mjs";
29
+ export type { CacheReadReport, CacheReadSummary } from "./o11y/cache-read.mjs";
package/dist/index.d.ts CHANGED
@@ -26,3 +26,4 @@ export type { AttemptUsageSnapshot, AdapterAttemptUsageSnapshot } from "./o11y/a
26
26
  export type { EvalUsage } from "./o11y/eval-usage.js";
27
27
  export type { AgentMatchContext } from "./context/assert-first.js";
28
28
  export type { ModelSlotSelection, ResolvedModelSlot, ResolvedModelSlots } from "./model-slots.js";
29
+ export type { CacheReadReport, CacheReadSummary } from "./o11y/cache-read.js";
@@ -1 +1 @@
1
- {"version":3,"file":"codec.js","sourceRoot":"","sources":["codec.ts"],"names":[],"mappings":";;;AAeA,0DAQC;AAUD,kDAyCC;AAMD,wDAEC;AAlFD,mCAAwC;AAExC,+CAA0G;AAC1G,2DAAmF;AAA1E,iIAAA,2BAA2B,OAAA;AAAE,oHAAA,cAAc,OAAA;AACpD,6CAA+G;AAAtG,uHAAA,wBAAwB,OAAA;AAAE,0HAAA,2BAA2B,OAAA;AAAE,sHAAA,uBAAuB,OAAA;AAOvF,MAAM,qBAAqB,GAAG,IAAI,OAAO,EAAU,CAAC;AACpD,MAAM,mBAAmB,GAAG,eAAM,CAAC,mBAAmB,CAAC,qCAAuB,EAAE;IAC5E,gBAAgB,EAAE,OAAO;CAC5B,CAAC,CAAC;AACH,SAAgB,uBAAuB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AAM,CAAC,OAAO,CAAC,CAAC;QACrB,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC,CAAC;IACF,OAAO,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAC5B,CAAC;AACD,SAAS,aAAa,CAAC,IAAuB,EAAE,MAAc;IAC1D,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,2BAAoC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,MAAM,EAAE,EAAE,CAAC,CAAC;IAC9I,qBAAqB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACjC,OAAO,KAAK,CAAC;AACjB,CAAC;AACD,SAAgB,sBAAsB,CAAC,KAA4C;IAC/E,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,qBAAqB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC/D,CAAC;AACD,MAAM,YAAY,GAAG,sBAAsB,CAAC;AAC5C,SAAS,QAAQ,CAAC,KAAc;IAC5B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAChF,CAAC;AACD,SAAS,gBAAgB,CAAC,IAAY,EAAE,KAAa;IACjD,OAAO,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC","sourcesContent":["import { Result, Schema } from \"effect\";\nimport { QUERY_PROTOCOL } from \"./protocol-values.ts\";\nimport { InspectionRequestSchema, type InspectionOperation, type InspectionRequest } from \"./protocol.ts\";\nexport { INSPECTION_BEHAVIOR_VERSION, QUERY_PROTOCOL } from \"./protocol-values.ts\";\nexport { INSPECTION_OPERATION_IDS, InspectionOperationIdSchema, InspectionRequestSchema } from \"./protocol.ts\";\nexport type { InspectionFailureDocument, InspectionOperation, InspectionOperationId, InspectionRequest } from \"./protocol.ts\";\nexport type InspectionDocument = import(\"./protocol.ts\").InspectionOperationDocument;\nexport interface InspectionCodecError {\n readonly code: \"inspection-request-invalid\" | \"inspection-result-invalid\";\n readonly reason: string;\n}\nconst inspectionCodecErrors = new WeakSet<object>();\nconst strictDecodeRequest = Schema.decodeUnknownResult(InspectionRequestSchema, {\n onExcessProperty: \"error\",\n});\nexport function decodeInspectionRequest(input: unknown): Result.Result<InspectionRequest, InspectionCodecError> {\n const decoded = strictDecodeRequest(input);\n return Result.isFailure(decoded)\n ? Result.fail(Object.freeze({\n code: \"inspection-request-invalid\" as const,\n reason: String(decoded.failure),\n }))\n : Result.succeed(decoded.success);\n}\n/** JSON value accepted at the final machine-delivery boundary. */\nexport type InspectionJson = null | boolean | number | string | readonly InspectionJson[] | {\n readonly [key: string]: InspectionJson;\n};\nexport type InspectionSourceProvenance = {\n readonly kind: \"project-record\" | \"external-record\";\n readonly sealedCutoffIdentity: string;\n};\nexport type InspectionFailureCode = \"inspection-request-invalid\" | \"inspection-selection-missing\" | \"inspection-source-invalid\" | \"inspection-record-integrity-failure\" | \"inspection-operation-failed\" | \"inspection-result-invalid\" | \"evidence-budget-exceeded\" | \"restart-required\";\nexport function closeInspectionJson(value: unknown): InspectionJson | InspectionCodecError {\n const seen = new Set<object>();\n const close = (current: unknown, path: readonly string[]): InspectionJson | InspectionCodecError => {\n if (current === null || typeof current === \"string\" || typeof current === \"boolean\")\n return current;\n if (typeof current === \"number\") {\n return Number.isFinite(current) ? current : invalidResult(path, \"numbers must be finite\");\n }\n if (Array.isArray(current)) {\n if (seen.has(current))\n return invalidResult(path, \"cyclic arrays are not encodable\");\n seen.add(current);\n const output: InspectionJson[] = [];\n for (const [index, entry] of current.entries()) {\n const closed = close(entry, [...path, String(index)]);\n if (isCodecError(closed))\n return closed;\n output.push(closed);\n }\n seen.delete(current);\n return Object.freeze(output);\n }\n if (typeof current !== \"object\" || current === null)\n return invalidResult(path, `unsupported ${typeof current} value`);\n if (seen.has(current))\n return invalidResult(path, \"cyclic objects are not encodable\");\n const prototype = Object.getPrototypeOf(current);\n if (prototype !== Object.prototype && prototype !== null)\n return invalidResult(path, \"only plain objects may cross Inspection delivery\");\n seen.add(current);\n const output: Record<string, InspectionJson> = Object.create(null);\n for (const key of Object.keys(current).sort(compareCodeUnits)) {\n const closed = close(Reflect.get(current, key), [...path, key]);\n if (isCodecError(closed))\n return closed;\n output[key] = closed;\n }\n seen.delete(current);\n return Object.freeze(output);\n };\n return close(value, []);\n}\nfunction invalidResult(path: readonly string[], reason: string): InspectionCodecError {\n const error = Object.freeze({ code: \"inspection-result-invalid\" as const, reason: `${path.length === 0 ? \"$\" : path.join(\".\")}: ${reason}` });\n inspectionCodecErrors.add(error);\n return error;\n}\nexport function isInspectionCodecError(value: InspectionJson | InspectionCodecError): value is InspectionCodecError {\n return isObject(value) && inspectionCodecErrors.has(value);\n}\nconst isCodecError = isInspectionCodecError;\nfunction isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction compareCodeUnits(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n"]}
1
+ {"version":3,"file":"codec.js","sourceRoot":"","sources":["codec.ts"],"names":[],"mappings":";;;AAeA,0DAQC;AAUD,kDAyCC;AAMD,wDAEC;AAlFD,mCAAwC;AAExC,+CAA0G;AAC1G,2DAAmF;AAA1E,iIAAA,2BAA2B,OAAA;AAAE,oHAAA,cAAc,OAAA;AACpD,6CAA+G;AAAtG,uHAAA,wBAAwB,OAAA;AAAE,0HAAA,2BAA2B,OAAA;AAAE,sHAAA,uBAAuB,OAAA;AAOvF,MAAM,qBAAqB,GAAG,IAAI,OAAO,EAAU,CAAC;AACpD,M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effect\";\nimport { QUERY_PROTOCOL } from \"./protocol-values.ts\";\nimport { InspectionRequestSchema, type InspectionOperation, type InspectionRequest } from \"./protocol.ts\";\nexport { INSPECTION_BEHAVIOR_VERSION, QUERY_PROTOCOL } from \"./protocol-values.ts\";\nexport { INSPECTION_OPERATION_IDS, InspectionOperationIdSchema, InspectionRequestSchema } from \"./protocol.ts\";\nexport type { InspectionFailureDocument, InspectionOperation, InspectionOperationId, InspectionRequest } from \"./protocol.ts\";\nexport type InspectionDocument = import(\"./protocol.ts\").InspectionOperationDocument;\nexport interface InspectionCodecError {\n readonly code: \"inspection-request-invalid\" | \"inspection-result-invalid\";\n readonly reason: string;\n}\nconst inspectionCodecErrors = new WeakSet<object>();\nconst strictDecodeRequest = Schema.decodeUnknownResult(InspectionRequestSchema, {\n onExcessProperty: \"error\",\n});\nexport function decodeInspectionRequest(input: unknown): Result.Result<InspectionRequest, InspectionCodecError> {\n const decoded = strictDecodeRequest(input);\n return Result.isFailure(decoded)\n ? Result.fail(Object.freeze({\n code: \"inspection-request-invalid\" as const,\n reason: String(decoded.failure),\n }))\n : Result.succeed(decoded.success);\n}\n/** JSON value accepted at the final machine-delivery boundary. */\nexport type InspectionJson = null | boolean | number | string | readonly InspectionJson[] | {\n readonly [key: string]: InspectionJson;\n};\nexport type InspectionSourceProvenance = {\n readonly kind: \"project-record\" | \"external-record\";\n readonly publicationCutoffIdentity: string;\n};\nexport type InspectionFailureCode = \"inspection-request-invalid\" | \"inspection-selection-missing\" | \"inspection-source-invalid\" | \"inspection-record-integrity-failure\" | \"inspection-operation-failed\" | \"inspection-result-invalid\" | \"evidence-budget-exceeded\" | \"restart-required\";\nexport function closeInspectionJson(value: unknown): InspectionJson | InspectionCodecError {\n const seen = new Set<object>();\n const close = (current: unknown, path: readonly string[]): InspectionJson | InspectionCodecError => {\n if (current === null || typeof current === \"string\" || typeof current === \"boolean\")\n return current;\n if (typeof current === \"number\") {\n return Number.isFinite(current) ? current : invalidResult(path, \"numbers must be finite\");\n }\n if (Array.isArray(current)) {\n if (seen.has(current))\n return invalidResult(path, \"cyclic arrays are not encodable\");\n seen.add(current);\n const output: InspectionJson[] = [];\n for (const [index, entry] of current.entries()) {\n const closed = close(entry, [...path, String(index)]);\n if (isCodecError(closed))\n return closed;\n output.push(closed);\n }\n seen.delete(current);\n return Object.freeze(output);\n }\n if (typeof current !== \"object\" || current === null)\n return invalidResult(path, `unsupported ${typeof current} value`);\n if (seen.has(current))\n return invalidResult(path, \"cyclic objects are not encodable\");\n const prototype = Object.getPrototypeOf(current);\n if (prototype !== Object.prototype && prototype !== null)\n return invalidResult(path, \"only plain objects may cross Inspection delivery\");\n seen.add(current);\n const output: Record<string, InspectionJson> = Object.create(null);\n for (const key of Object.keys(current).sort(compareCodeUnits)) {\n const closed = close(Reflect.get(current, key), [...path, key]);\n if (isCodecError(closed))\n return closed;\n output[key] = closed;\n }\n seen.delete(current);\n return Object.freeze(output);\n };\n return close(value, []);\n}\nfunction invalidResult(path: readonly string[], reason: string): InspectionCodecError {\n const error = Object.freeze({ code: \"inspection-result-invalid\" as const, reason: `${path.length === 0 ? \"$\" : path.join(\".\")}: ${reason}` });\n inspectionCodecErrors.add(error);\n return error;\n}\nexport function isInspectionCodecError(value: InspectionJson | InspectionCodecError): value is InspectionCodecError {\n return isObject(value) && inspectionCodecErrors.has(value);\n}\nconst isCodecError = isInspectionCodecError;\nfunction isObject(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\nfunction compareCodeUnits(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n"]}
@@ -15,7 +15,7 @@ export type InspectionJson = null | boolean | number | string | readonly Inspect
15
15
  };
16
16
  export type InspectionSourceProvenance = {
17
17
  readonly kind: "project-record" | "external-record";
18
- readonly sealedCutoffIdentity: string;
18
+ readonly publicationCutoffIdentity: string;
19
19
  };
20
20
  export type InspectionFailureCode = "inspection-request-invalid" | "inspection-selection-missing" | "inspection-source-invalid" | "inspection-record-integrity-failure" | "inspection-operation-failed" | "inspection-result-invalid" | "evidence-budget-exceeded" | "restart-required";
21
21
  export declare function closeInspectionJson(value: unknown): InspectionJson | InspectionCodecError;
@@ -15,7 +15,7 @@ export type InspectionJson = null | boolean | number | string | readonly Inspect
15
15
  };
16
16
  export type InspectionSourceProvenance = {
17
17
  readonly kind: "project-record" | "external-record";
18
- readonly sealedCutoffIdentity: string;
18
+ readonly publicationCutoffIdentity: string;
19
19
  };
20
20
  export type InspectionFailureCode = "inspection-request-invalid" | "inspection-selection-missing" | "inspection-source-invalid" | "inspection-record-integrity-failure" | "inspection-operation-failed" | "inspection-result-invalid" | "evidence-budget-exceeded" | "restart-required";
21
21
  export declare function closeInspectionJson(value: unknown): InspectionJson | InspectionCodecError;
@@ -15,7 +15,7 @@ export type InspectionJson = null | boolean | number | string | readonly Inspect
15
15
  };
16
16
  export type InspectionSourceProvenance = {
17
17
  readonly kind: "project-record" | "external-record";
18
- readonly sealedCutoffIdentity: string;
18
+ readonly publicationCutoffIdentity: string;
19
19
  };
20
20
  export type InspectionFailureCode = "inspection-request-invalid" | "inspection-selection-missing" | "inspection-source-invalid" | "inspection-record-integrity-failure" | "inspection-operation-failed" | "inspection-result-invalid" | "evidence-budget-exceeded" | "restart-required";
21
21
  export declare function closeInspectionJson(value: unknown): InspectionJson | InspectionCodecError;
@@ -6,6 +6,7 @@ exports.loadInspectionRunResource = loadInspectionRunResource;
6
6
  exports.decodeInspectionRun = decodeInspectionRun;
7
7
  exports.resolveInspectionAttempt = resolveInspectionAttempt;
8
8
  exports.resolveInspectionMemberAttempt = resolveInspectionMemberAttempt;
9
+ exports.resolveInspectionResourceMemberAttempt = resolveInspectionResourceMemberAttempt;
9
10
  exports.attemptAttachment = attemptAttachment;
10
11
  exports.runAttachment = runAttachment;
11
12
  exports.readInspectionAssertions = readInspectionAssertions;
@@ -50,10 +51,15 @@ function loadInspectionRuns(source) {
50
51
  const cutoff = source.cutoff();
51
52
  const summaries = [];
52
53
  const seen = new Set();
54
+ let expectedRunCount;
53
55
  let afterRunId = "";
54
56
  for (;;) {
55
57
  const page = source.readSealedRunSummaryPage(afterRunId, RUN_PAGE_SIZE, cutoff.identity);
56
- requireCutoff(page.cutoff, cutoff);
58
+ if (page.cutoff.identity !== cutoff.identity ||
59
+ expectedRunCount !== undefined && page.cutoff.runCount !== expectedRunCount) {
60
+ throw factsError("Run inventory changed its pinned cutoff or count");
61
+ }
62
+ expectedRunCount ??= page.cutoff.runCount;
57
63
  if (page.afterRunId !== afterRunId) {
58
64
  throw factsError("Run pagination returned a different cursor");
59
65
  }
@@ -75,7 +81,7 @@ function loadInspectionRuns(source) {
75
81
  }
76
82
  afterRunId = page.nextAfterRunId;
77
83
  }
78
- if (summaries.length !== cutoff.runCount) {
84
+ if (summaries.length !== expectedRunCount) {
79
85
  throw factsError("Run pagination did not close the pinned sealed cutoff");
80
86
  }
81
87
  return Object.freeze(summaries.map((summary) => {
@@ -105,13 +111,52 @@ function loadInspectionRunResource(source, runId) {
105
111
  if (resource === undefined)
106
112
  return undefined;
107
113
  const published = readInspectionRun(source, runId);
108
- requireCutoff(source.cutoff(), cutoff);
109
- if (resource.published > 0 && published === undefined) {
110
- throw factsError(`Run ${runId} has published bindings without a readable Core`);
111
- }
112
114
  if (published !== undefined)
113
115
  validateRunResourceCore(resource, published);
114
- return Object.freeze({ source, resource, ...(published === undefined ? {} : { published }) });
116
+ const originIds = resource.slots.flatMap(({ publication }) => publication.state === "published" ? [publication.originRunId] : []);
117
+ const supporting = loadSelectedInspectionRuns(source, [
118
+ ...(published === undefined ? [] : [runId]), ...originIds,
119
+ ]);
120
+ const index = memberIndex(supporting);
121
+ const publications = new Map(supporting.flatMap((origin) => origin.physical.attempts.map((attempt) => [
122
+ `${origin.run.runId}\u0000${attempt.attemptId}`, attempt,
123
+ ])));
124
+ const members = resource.slots.flatMap(({ slotId, publication }) => {
125
+ if (publication.state === "pending")
126
+ return [];
127
+ if (publication.state === "absent") {
128
+ return [decodedRight((0, core_ts_1.decodeMemberDocument)({
129
+ slotId,
130
+ action: publication.reason === "interrupted-before-publication" || publication.reason === "dispatch-failed"
131
+ ? "interrupted" : "not-dispatched",
132
+ attempt: null,
133
+ absenceReason: publication.reason,
134
+ }), "Run resource absence is invalid")];
135
+ }
136
+ const origin = index.origins.get(publication.originRunId);
137
+ const attempt = origin?.attempts.get(publication.attemptId);
138
+ const stored = publications.get(`${publication.originRunId}\u0000${publication.attemptId}`);
139
+ if (attempt === undefined || stored === undefined ||
140
+ attempt.slotId !== publication.originSlotId ||
141
+ stored.attemptLocator !== publication.attemptLocator ||
142
+ stored.publicationIdentity?.originRunId !== publication.publicationIdentity.originRunId ||
143
+ stored.publicationIdentity?.attemptId !== publication.publicationIdentity.attemptId ||
144
+ stored.publicationIdentity?.revision !== publication.publicationIdentity.revision ||
145
+ publication.publicationIdentity.originRunId !== publication.originRunId ||
146
+ publication.publicationIdentity.attemptId !== publication.attemptId ||
147
+ publication.action === "executed" && publication.originRunId !== runId) {
148
+ throw factsError(`Run ${runId} Slot ${slotId} does not bind a matching published origin Attempt`);
149
+ }
150
+ return [decodedRight((0, core_ts_1.decodeMemberDocument)({
151
+ slotId, action: publication.action,
152
+ attempt: { originRunId: publication.originRunId, attemptId: publication.attemptId },
153
+ }), "Run resource binding is invalid")];
154
+ }).sort((left, right) => compareText(left.slotId, right.slotId));
155
+ requireCutoff(source.cutoff(), cutoff);
156
+ return Object.freeze({
157
+ source, resource, members: Object.freeze(members), supporting,
158
+ ...(published === undefined ? {} : { published }),
159
+ });
115
160
  }
116
161
  function validateRunResourceCore(resource, published) {
117
162
  const run = published.run;
@@ -306,6 +351,18 @@ function resolveInspectionMemberAttempt(runs, target, member) {
306
351
  return undefined;
307
352
  return Object.freeze({ attempt, origin: origin.run, locator: (0, attempt_locator_ts_1.encodeAttemptLocator)(attempt.attemptId), targets });
308
353
  }
354
+ /** A target binding does not require the target to have published its own Run Core. */
355
+ function resolveInspectionResourceMemberAttempt(target, member) {
356
+ if (member.attempt === null)
357
+ return undefined;
358
+ const index = memberIndex(target.supporting);
359
+ const origin = index.origins.get(member.attempt.originRunId);
360
+ const attempt = origin?.attempts.get(member.attempt.attemptId);
361
+ if (origin === undefined || attempt === undefined)
362
+ return undefined;
363
+ const targets = index.targets.get(attempt.originRunId)?.get(attempt.attemptId) ?? [];
364
+ return Object.freeze({ attempt, origin: origin.run, locator: (0, attempt_locator_ts_1.encodeAttemptLocator)(attempt.attemptId), targets });
365
+ }
309
366
  function attemptAttachment(resolved, family) {
310
367
  return resolved.origin.attachments.find(({ physical }) => physical.ownerKind === "attempt" &&
311
368
  physical.ownerAttemptId === resolved.attempt.attemptId &&
@@ -466,8 +523,8 @@ function targetMembers(run, attempt) {
466
523
  member.attempt.attemptId === attempt.attemptId);
467
524
  }
468
525
  function requireCutoff(actual, expected) {
469
- if (actual.identity !== expected.identity ||
470
- actual.runCount !== expected.runCount) {
526
+ if (actual.storeGeneration !== expected.storeGeneration ||
527
+ actual.revision !== expected.revision) {
471
528
  throw factsError("Inspection source changed its pinned sealed cutoff");
472
529
  }
473
530
  }
@@ -1 +1 @@
1
- {"version":3,"file":"facts.js","sourceRoot":"","sources":["facts.ts"],"names":[],"mappings":";;AAmFA,gDAuCC;AAED,gEAUC;AAED,8DAaC;AAqBD,kDA0EC;AAID,4DAiDC;AAwCD,wEAaC;AACD,8CAIC;AACD,sCAEC;AAKD,4DA+BC;AA1YD,gDAAgD;AAChD,wDAAwD;AACxD,8DAA8D;AAC9D,wFAAwF;AACxF,mCAAwC;AACxC,8DAA6D;AAC7D,gEAAqG;AACrG,kEAA8M;AAC9M,qDAA6J;AAC7J,4DAA2G;AAI3G,yCAA+F;AAE/F,yCAA8C;AA2C9C,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,2BAA2B,GAAG,EAAE,CAAC;AACvC,MAAM,2BAA2B,GAAG,GAAG,CAAC;AACxC,MAAM,WAAW,GAAG,IAAI,OAAO,EAA0D,CAAC;A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Ac,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACzD,CAAC;AACD,SAAS,KAAK,CAAC,IAAY,EAAE,OAAe;IACxC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AAC5C,CAAC;AACD,SAAS,UAAU,CAAC,MAAc,EAAE,KAAe;IAC/C,OAAO,IAAI,KAAK,CAAC,MAAM,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAC1E,CAAC;AACD,SAAS,WAAW,CAAC,IAAY,EAAE,KAAa;IAC5C,OAAO,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC;AACD,SAAS,YAAY,CAAC,KAAiB,EAAE,MAAc,EAAE,KAAa;IAClE,IAAI,IAAI,2BAAgB,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,KAAK,MAAM;QAC3D,MAAM,UAAU,CAAC,GAAG,KAAK,oBAAoB,CAAC,CAAC;AACvD,CAAC;AACD,SAAS,iBAAiB,CAAC,KAAiB,EAAE,MAAc,EAAE,KAAa;IACvE,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACnC,OAAO,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACnC,CAAC","sourcesContent":["// @concord-file ne-eval-inspection-facts-reader\n// @concord-implements docs/feature/inspection/README.md\n// @concord-implements docs/feature/inspection/architecture.md\n// @concord-implements docs/feature/inspection/use-case/inspection-check-completeness.md\nimport { Result, Schema } from \"effect\";\nimport { encodeAttemptLocator } from \"../attempt-locator.ts\";\nimport { mintRecordContentHandle, type RecordContentHandle, } from \"../record/attachment/content.ts\";\nimport { enumerateRecordAttachmentClosure, hydrateRecordAttachmentCurrent, mintRecordAttachmentReference, RecordAttachmentReference, recordAttachmentReferenceWire, } from \"../record/attachment/protocol.ts\";\nimport { decodeAttemptDocument, decodeMemberDocument, decodeRunDocument, RecordExactParseOptions, RecordSlotIdentitySchema, } from \"../record/codec/core.ts\";\nimport { NiceEvalCurrentRecordAttachments, NiceEvalRecordAttachments, } from \"../record/family/current.ts\";\nimport type { AssertionsAttachment } from \"../record/family/assertions/definition.ts\";\nimport type { AttemptDocument, MemberDocument, RunDocument, } from \"../record/model/core.ts\";\nimport type { PersistedContentMetadata, SealedAttachmentMetadata, SealedRunCore, SealedRunCutoff, SealedRunSummary, } from \"../record/sqlite/types.ts\";\nimport { closeInspectionJson, isInspectionCodecError, type InspectionJson, } from \"./codec.ts\";\nimport type { InspectionFactSource } from \"./source.ts\";\nimport { InspectionSha256 } from \"./bytes.ts\";\nimport type { ReadableRunResource } from \"../run/storage/types.ts\";\nexport interface DecodedInspectionAttachment {\n readonly physical: SealedAttachmentMetadata;\n readonly value: InspectionJson;\n}\n/** A strictly decoded sealed Run with its browser-neutral reader capability. */\nexport interface LoadedInspectionRun {\n readonly source: InspectionFactSource;\n readonly physical: SealedRunCore;\n readonly run: RunDocument;\n readonly members: readonly MemberDocument[];\n readonly attempts: readonly AttemptDocument[];\n readonly attachments: readonly DecodedInspectionAttachment[];\n}\n/** Exact lifecycle resource plus its optional published Core at one cutoff. */\nexport interface LoadedInspectionRunResource {\n readonly source: InspectionFactSource;\n readonly resource: ReadableRunResource;\n readonly published?: LoadedInspectionRun;\n}\nexport interface InspectionAttemptTarget {\n readonly run: LoadedInspectionRun;\n readonly member: MemberDocument;\n}\n/** Exact origin Attempt plus every target membership visible to the resolver. */\nexport interface ResolvedInspectionAttempt {\n readonly attempt: AttemptDocument;\n readonly origin: LoadedInspectionRun;\n readonly locator: string;\n readonly targets: readonly InspectionAttemptTarget[];\n}\nexport type InspectionAssertionsRead = {\n readonly state: \"available\";\n readonly attachment: DecodedInspectionAttachment;\n readonly value: AssertionsAttachment;\n readonly contents: WeakMap<object, PersistedContentMetadata>;\n readonly issues: readonly InspectionJson[];\n} | {\n readonly state: \"not-recorded\" | \"unsupported\" | \"failed\";\n readonly attachment?: DecodedInspectionAttachment;\n readonly issues: readonly InspectionJson[];\n};\nconst RUN_PAGE_SIZE = 100;\nconst ATTEMPT_CANDIDATE_RUN_LIMIT = 64;\nconst ATTEMPT_TARGET_MEMBER_LIMIT = 256;\nconst decodedRuns = new WeakMap<InspectionFactSource, Map<string, LoadedInspectionRun>>();\nfunction readInspectionRun(source: InspectionFactSource, runId: string): LoadedInspectionRun | undefined {\n let cache = decodedRuns.get(source);\n if (cache === undefined)\n decodedRuns.set(source, cache = new Map());\n const cached = cache.get(runId);\n if (cached !== undefined)\n return cached;\n const physical = source.readSealedRunCore(runId);\n if (physical === undefined)\n return undefined;\n const decoded = decodeInspectionRun(source, physical);\n cache.set(runId, decoded);\n return decoded;\n}\n/**\n * Pins the source cutoff, exhausts the fixed Run-summary pagination, then\n * reads and strictly decodes every Run Core in that exact sealed generation.\n */\n// @concord-code ne-eval-inspection-load-runs\n// @concord-implements docs/feature/inspection/architecture.md\n// @concord-implements docs/feature/inspection/use-case/inspection-check-completeness.md\nexport function loadInspectionRuns(source: InspectionFactSource): readonly LoadedInspectionRun[] {\n const cutoff = source.cutoff();\n const summaries: SealedRunSummary[] = [];\n const seen = new Set<string>();\n let afterRunId = \"\";\n for (;;) {\n const page = source.readSealedRunSummaryPage(afterRunId, RUN_PAGE_SIZE, cutoff.identity);\n requireCutoff(page.cutoff, cutoff);\n if (page.afterRunId !== afterRunId) {\n throw factsError(\"Run pagination returned a different cursor\");\n }\n let previous = afterRunId;\n for (const summary of page.summaries) {\n if (summary.runId <= previous || seen.has(summary.runId)) {\n throw factsError(\"Run pagination is not strictly ordered\");\n }\n seen.add(summary.runId);\n summaries.push(summary);\n previous = summary.runId;\n }\n if (page.nextAfterRunId === null)\n break;\n if (page.summaries.length === 0 ||\n page.nextAfterRunId !== page.summaries.at(-1)!.runId ||\n page.nextAfterRunId === afterRunId) {\n throw factsError(\"Run pagination returned an invalid continuation cursor\");\n }\n afterRunId = page.nextAfterRunId;\n }\n if (summaries.length !== cutoff.runCount) {\n throw factsError(\"Run pagination did not close the pinned sealed cutoff\");\n }\n return Object.freeze(summaries.map((summary) => {\n const run = readInspectionRun(source, summary.runId);\n if (run === undefined) {\n throw factsError(`Sealed Run ${summary.runId} disappeared from the pinned cutoff`);\n }\n return run;\n }));\n}\n/** Reads a bounded, explicit Run selection without changing its caller order. */\nexport function loadSelectedInspectionRuns(source: InspectionFactSource, runIds: readonly string[]): readonly LoadedInspectionRun[] {\n const cutoff = source.cutoff();\n const loaded: LoadedInspectionRun[] = [];\n for (const runId of new Set(runIds)) {\n const run = readInspectionRun(source, runId);\n if (run !== undefined)\n loaded.push(run);\n }\n requireCutoff(source.cutoff(), cutoff);\n return Object.freeze(loaded);\n}\n/** Reads Run create/close facts even when no Attempt Core has been published. */\nexport function loadInspectionRunResource(source: InspectionFactSource, runId: string): LoadedInspectionRunResource | undefined {\n const cutoff = source.cutoff();\n const resource = source.readRunResource(runId);\n if (resource === undefined)\n return undefined;\n const published = readInspectionRun(source, runId);\n requireCutoff(source.cutoff(), cutoff);\n if (resource.published > 0 && published === undefined) {\n throw factsError(`Run ${runId} has published bindings without a readable Core`);\n }\n if (published !== undefined)\n validateRunResourceCore(resource, published);\n return Object.freeze({ source, resource, ...(published === undefined ? {} : { published }) });\n}\nfunction validateRunResourceCore(resource: ReadableRunResource, published: LoadedInspectionRun): void {\n const run = published.run;\n if (run.runId !== resource.runId ||\n run.experimentId !== resource.experimentId ||\n run.startedAt !== Date.parse(resource.startedAt) ||\n run.expectedSlots.length !== resource.slots.length) {\n throw factsError(`Run ${resource.runId} lifecycle resource does not match its published Core`);\n }\n for (const [index, slot] of run.expectedSlots.entries()) {\n const expected = resource.slots[index];\n if (expected === undefined ||\n slot.slotId !== expected.slotId ||\n slot.evalId !== expected.evalId ||\n slot.attemptOrdinal !== expected.attemptOrdinal ||\n slot.executionIdentityDigest !== expected.executionIdentityDigest) {\n throw factsError(`Run ${resource.runId} expected Slot does not match its published Core`);\n }\n }\n}\n/** Strictly decodes Core, then decodes each Attachment only on first use. */\nexport function decodeInspectionRun(source: InspectionFactSource, physical: SealedRunCore): LoadedInspectionRun {\n const run = decodedRight(decodeRunDocument(parseVerifiedJson(physical.runCoreBytes, physical.runCoreDigest, \"Run Core\")), \"Run Core is invalid\");\n if (run.runId !== physical.runId) {\n throw factsError(\"Run Core identity does not match its sealed row\");\n }\n if (physical.slots.length !== run.expectedSlots.length) {\n throw factsError(\"Run Core Slot rows do not match its expected denominator\");\n }\n for (const [index, stored] of physical.slots.entries()) {\n const decoded = Schema.decodeUnknownResult(RecordSlotIdentitySchema, RecordExactParseOptions)(parseVerifiedJson(stored.coreBytes, stored.coreDigest, \"Slot Core\"));\n const slot = decodedRight(decoded, \"Slot Core is invalid\");\n const expected = run.expectedSlots[index];\n if (expected === undefined ||\n stored.ordinal !== index ||\n stored.slotId !== slot.slotId ||\n slot.slotId !== expected.slotId ||\n slot.evalId !== expected.evalId ||\n slot.attemptOrdinal !== expected.attemptOrdinal ||\n slot.executionIdentityDigest !== expected.executionIdentityDigest) {\n throw factsError(\"Slot Core does not match its sealed Run denominator\");\n }\n }\n const members = physical.members.map((stored) => {\n const member = decodedRight(decodeMemberDocument(parseVerifiedJson(stored.coreBytes, stored.coreDigest, \"Member Core\")), \"Member Core is invalid\");\n if (member.slotId !== stored.slotId ||\n member.action !== stored.action ||\n (member.attempt?.originRunId ?? undefined) !== stored.originRunId ||\n (member.attempt?.attemptId ?? undefined) !== stored.attemptId) {\n throw factsError(\"Member Core does not match its sealed row\");\n }\n return member;\n });\n const attempts = physical.attempts.map((stored) => {\n const attempt = decodedRight(decodeAttemptDocument(parseVerifiedJson(stored.coreBytes, stored.coreDigest, \"Attempt Core\")), \"Attempt Core is invalid\");\n if (attempt.attemptId !== stored.attemptId ||\n attempt.originRunId !== run.runId ||\n encodeAttemptLocator(attempt.attemptId) !== stored.attemptLocator) {\n throw factsError(\"Attempt Core does not match its sealed row\");\n }\n return attempt;\n });\n validateCoreRelations(run, members, attempts, physical.publicationManaged === true);\n const localAttemptIds = new Set<string>(attempts.map(({ attemptId }) => attemptId));\n const attachments = physical.attachments.map((attachment): DecodedInspectionAttachment => {\n if (attachment.ownerRunId !== run.runId ||\n attachment.ownerKind === \"run\" && attachment.ownerAttemptId !== undefined ||\n attachment.ownerKind === \"attempt\" &&\n (attachment.ownerAttemptId === undefined ||\n !localAttemptIds.has(attachment.ownerAttemptId))) {\n throw factsError(\"Attachment ownership does not match its sealed Run\");\n }\n let value: InspectionJson | undefined;\n let decoded = false;\n return Object.freeze({\n physical: attachment,\n get value(): InspectionJson {\n if (!decoded) {\n verifyDigest(attachment.canonicalBytes, attachment.canonicalDigest, \"Attachment\");\n verifyDigest(attachment.logicalInventoryBytes, attachment.inventoryDigest, \"Attachment inventory\");\n value = parseInspectionJson(attachment.canonicalBytes, \"Attachment\");\n decoded = true;\n }\n return value!;\n },\n });\n });\n return Object.freeze({\n source,\n physical,\n run,\n members: Object.freeze(members),\n attempts: Object.freeze(attempts),\n attachments: Object.freeze(attachments),\n });\n}\n/** Resolves a public locator through the source's bounded exact index. */\n// @concord-code ne-eval-inspection-resolve-attempt\n// @concord-implements docs/feature/inspection/architecture.md\nexport function resolveInspectionAttempt(source: InspectionFactSource, locator: string): ResolvedInspectionAttempt | undefined {\n const projection = source.findAttemptLocatorCandidates(locator, ATTEMPT_CANDIDATE_RUN_LIMIT);\n if (projection.candidates.length === 0)\n return undefined;\n if (projection.ambiguous)\n return undefined;\n const origins = projection.candidates.filter(({ relation }) => relation === \"origin\");\n if (origins.length !== 1) {\n throw factsError(`Attempt ${locator} indexed projection is invalid`);\n }\n const identity = origins[0]!;\n const runs = loadSelectedInspectionRuns(source, projection.candidates.map(({ runId }) => runId));\n const byRunId = new Map<string, LoadedInspectionRun>(runs.map((run) => [run.run.runId, run] as const));\n const origin = byRunId.get(identity.originRunId);\n if (origin === undefined) {\n throw factsError(`Attempt ${locator} origin is not a sealed Run`);\n }\n const attempt = origin.attempts.find((candidate) => candidate.attemptId === identity.attemptId &&\n candidate.originRunId === identity.originRunId &&\n encodeAttemptLocator(candidate.attemptId) === locator);\n if (attempt === undefined) {\n throw factsError(`Attempt ${locator} origin Core is invalid`);\n }\n const targets: InspectionAttemptTarget[] = [];\n const targetRunIds = new Set(projection.candidates.flatMap((candidate) => candidate.relation === \"target\" &&\n candidate.originRunId === identity.originRunId &&\n candidate.attemptId === identity.attemptId\n ? [candidate.runId]\n : []));\n for (const runId of targetRunIds) {\n const run = byRunId.get(runId);\n if (run === undefined) {\n throw factsError(`Attempt ${locator} target is not a sealed Run`);\n }\n const members = targetMembers(run, attempt);\n if (members.length === 0) {\n throw factsError(`Attempt ${locator} target Core is invalid`);\n }\n if (targets.length + members.length > ATTEMPT_TARGET_MEMBER_LIMIT) {\n throw factsError(`Attempt ${locator} exceeds its fixed target member limit`);\n }\n targets.push(...members.map((member) => Object.freeze({ run, member })));\n }\n return Object.freeze({\n attempt,\n origin,\n locator,\n targets: Object.freeze(targets),\n });\n}\ninterface InspectionMemberIndex {\n readonly origins: ReadonlyMap<string, {\n readonly run: LoadedInspectionRun;\n readonly attempts: ReadonlyMap<string, AttemptDocument>;\n readonly members: ReadonlyMap<string, MemberDocument>;\n }>;\n readonly targets: ReadonlyMap<string, ReadonlyMap<string, readonly InspectionAttemptTarget[]>>;\n}\nconst memberIndexes = new WeakMap<readonly LoadedInspectionRun[], InspectionMemberIndex>();\nfunction memberIndex(runs: readonly LoadedInspectionRun[]): InspectionMemberIndex {\n const cached = memberIndexes.get(runs);\n if (cached !== undefined)\n return cached;\n const origins = new Map(runs.map((run) => [run.run.runId, {\n run, attempts: new Map(run.attempts.map((attempt) => [attempt.attemptId, attempt])),\n members: new Map(run.members.map((member) => [member.slotId, member])),\n }]));\n const targets = new Map<string, Map<string, InspectionAttemptTarget[]>>();\n for (const run of runs)\n for (const member of run.members) {\n if (member.attempt === null)\n continue;\n const { originRunId, attemptId } = member.attempt;\n let byAttempt = targets.get(originRunId);\n if (byAttempt === undefined)\n targets.set(originRunId, byAttempt = new Map());\n let members = byAttempt.get(attemptId);\n if (members === undefined)\n byAttempt.set(attemptId, members = []);\n members.push(Object.freeze({ run, member }));\n }\n for (const byAttempt of targets.values())\n for (const members of byAttempt.values())\n Object.freeze(members);\n const index = { origins, targets };\n memberIndexes.set(runs, index);\n return index;\n}\n/** Resolves already loaded facts through one shared identity index. */\nexport function resolveInspectionMemberAttempt(runs: readonly LoadedInspectionRun[], target: LoadedInspectionRun, member: MemberDocument): ResolvedInspectionAttempt | undefined {\n if (member.attempt === null)\n return undefined;\n const index = memberIndex(runs);\n const origin = index.origins.get(member.attempt.originRunId);\n const attempt = origin?.attempts.get(member.attempt.attemptId);\n if (origin === undefined || attempt === undefined || attempt.originRunId !== member.attempt.originRunId)\n return undefined;\n const targets = index.targets.get(attempt.originRunId)?.get(attempt.attemptId) ?? [];\n const targetMember = index.origins.get(target.run.runId)?.members.get(member.slotId);\n if (targetMember?.attempt?.originRunId !== attempt.originRunId || targetMember.attempt.attemptId !== attempt.attemptId)\n return undefined;\n return Object.freeze({ attempt, origin: origin.run, locator: encodeAttemptLocator(attempt.attemptId), targets });\n}\nexport function attemptAttachment(resolved: ResolvedInspectionAttempt, family: string): DecodedInspectionAttachment | undefined {\n return resolved.origin.attachments.find(({ physical }) => physical.ownerKind === \"attempt\" &&\n physical.ownerAttemptId === resolved.attempt.attemptId &&\n physical.family === family);\n}\nexport function runAttachment(run: LoadedInspectionRun, family: string): DecodedInspectionAttachment | undefined {\n return run.attachments.find(({ physical }) => physical.ownerKind === \"run\" && physical.family === family);\n}\n/** Reads only the current logical Assertions family, preserving failure state. */\n// @concord-code ne-eval-inspection-read-assertions\n// @concord-implements docs/feature/assertions/README.md\n// @concord-implements docs/feature/inspection/README.md\nexport function readInspectionAssertions(resolved: ResolvedInspectionAttempt): InspectionAssertionsRead {\n const attachment = attemptAttachment(resolved, NiceEvalRecordAttachments.assertions.family);\n if (attachment === undefined) {\n return Object.freeze({\n state: \"not-recorded\" as const,\n issues: Object.freeze([issue(\"assertions-not-recorded\", resolved.locator)]),\n });\n }\n if (attachment.physical.familyRevision !==\n NiceEvalCurrentRecordAttachments.assertions.revision) {\n return Object.freeze({\n state: \"unsupported\" as const,\n attachment,\n issues: Object.freeze([issue(\"assertions-revision-unsupported\", resolved.locator)]),\n });\n }\n const decoded = decodeCurrentAssertions(attachment);\n if (decoded === undefined) {\n return Object.freeze({\n state: \"failed\" as const,\n attachment,\n issues: Object.freeze([issue(\"assertions-current-invalid\", resolved.locator)]),\n });\n }\n return Object.freeze({\n state: \"available\" as const,\n attachment,\n value: decoded.value,\n contents: decoded.contents,\n issues: Object.freeze([]),\n });\n}\nfunction decodeCurrentAssertions(attachment: DecodedInspectionAttachment): {\n readonly value: AssertionsAttachment;\n readonly contents: WeakMap<object, PersistedContentMetadata>;\n} | undefined {\n const definition = NiceEvalRecordAttachments.assertions;\n const byHandle = new Map(attachment.physical.contents.map((content) => [content.logicalHandle, content]));\n const handles = new Map<string, RecordContentHandle>();\n const contents = new WeakMap<object, PersistedContentMetadata>();\n const usedContent = new Set<string>();\n const hydrated = hydrateRecordAttachmentCurrent(definition, attachment.value, {\n content: (token, declaration) => {\n const logicalHandle = exactMarker(token, \"$niceeval.record.content\");\n if (logicalHandle === undefined &&\n !hasOwnMarker(token, \"$niceeval.record.content\")) {\n return Result.succeed(undefined);\n }\n if (typeof logicalHandle !== \"string\") {\n return Result.fail({ code: \"current-content-bind-failed\" as const });\n }\n const metadata = byHandle.get(logicalHandle);\n if (metadata === undefined ||\n declaration.maximumBytes !== undefined &&\n metadata.byteLength > declaration.maximumBytes) {\n return Result.fail({ code: \"current-content-bind-failed\" as const });\n }\n let handle = handles.get(logicalHandle);\n if (handle === undefined) {\n handle = mintRecordContentHandle(declaration.kind);\n handles.set(logicalHandle, handle);\n contents.set(handle, metadata);\n }\n usedContent.add(logicalHandle);\n return Result.succeed(handle);\n },\n reference: (token, declaration) => {\n const marker = exactMarker(token, \"$niceeval.record.reference\");\n if (marker === undefined &&\n !hasOwnMarker(token, \"$niceeval.record.reference\")) {\n return Result.succeed(undefined);\n }\n if (typeof marker !== \"object\" || marker === null || Array.isArray(marker)) {\n return Result.fail({ code: \"current-reference-bind-failed\" as const });\n }\n const value = marker as Record<string, unknown>;\n if (Reflect.ownKeys(value).length !== 3 ||\n value.owner !== declaration.definition.owner ||\n value.family !== declaration.definition.family ||\n !(\"value\" in value)) {\n return Result.fail({ code: \"current-reference-bind-failed\" as const });\n }\n return Result.succeed(mintRecordAttachmentReference(RecordAttachmentReference.to(declaration.definition, declaration.valueSchema), value.value));\n },\n });\n if (Result.isFailure(hydrated) ||\n usedContent.size !== attachment.physical.contents.length) {\n return undefined;\n }\n const closure = enumerateRecordAttachmentClosure(definition, hydrated.success);\n if (Result.isFailure(closure))\n return undefined;\n const references = new Map<string, {\n readonly owner: string;\n readonly family: string;\n }>();\n for (const reference of closure.success.references) {\n const wire = recordAttachmentReferenceWire(reference);\n if (wire === undefined)\n return undefined;\n references.set(`${wire.owner}\\u0000${wire.family}`, Object.freeze({ owner: wire.owner, family: wire.family }));\n }\n const ordered = [...references.values()].sort((left, right) => compareText(left.owner, right.owner) || compareText(left.family, right.family));\n if (ordered.length !== attachment.physical.references.length)\n return undefined;\n for (let ordinal = 0; ordinal < ordered.length; ordinal += 1) {\n const logical = ordered[ordinal]!;\n const physical = attachment.physical.references[ordinal]!;\n if (physical.ordinal !== ordinal ||\n physical.owner !== logical.owner ||\n physical.family !== logical.family) {\n return undefined;\n }\n }\n return Object.freeze({ value: hydrated.success, contents });\n}\nfunction validateCoreRelations(run: RunDocument, members: readonly MemberDocument[], attempts: readonly AttemptDocument[], allowPendingSlots = false): void {\n const slots = new Map(run.expectedSlots.map((slot) => [slot.slotId, slot] as const));\n if (slots.size !== run.expectedSlots.length || (!allowPendingSlots && members.length !== slots.size) || members.length > slots.size) {\n throw factsError(\"Run Core does not close its expected Slot membership\");\n }\n const memberSlots = new Set<string>();\n for (const member of members) {\n if (!slots.has(member.slotId) || memberSlots.has(member.slotId)) {\n throw factsError(\"Run Core contains an invalid Member Slot\");\n }\n memberSlots.add(member.slotId);\n }\n const attemptIds = new Set<string>();\n for (const attempt of attempts) {\n const slot = slots.get(attempt.slotId);\n if (attemptIds.has(attempt.attemptId) ||\n slot === undefined ||\n attempt.evalId !== slot.evalId ||\n attempt.executionIdentityDigest !== slot.executionIdentityDigest) {\n throw factsError(\"Run Core contains an invalid origin Attempt\");\n }\n attemptIds.add(attempt.attemptId);\n }\n for (const member of members) {\n if (member.action === \"executed\" &&\n (member.attempt === null ||\n member.attempt.originRunId !== run.runId ||\n !attemptIds.has(member.attempt.attemptId))) {\n throw factsError(\"Executed Member does not name a local origin Attempt\");\n }\n }\n}\nfunction targetMembers(run: LoadedInspectionRun, attempt: AttemptDocument): readonly MemberDocument[] {\n return run.members.filter((member) => member.attempt !== null &&\n member.attempt.originRunId === attempt.originRunId &&\n member.attempt.attemptId === attempt.attemptId);\n}\nfunction requireCutoff(actual: SealedRunCutoff, expected: SealedRunCutoff): void {\n if (actual.identity !== expected.identity ||\n actual.runCount !== expected.runCount) {\n throw factsError(\"Inspection source changed its pinned sealed cutoff\");\n }\n}\nfunction parseJson(bytes: Uint8Array, owner: string): unknown {\n try {\n return JSON.parse(new TextDecoder(\"utf-8\", { fatal: true }).decode(bytes)) as unknown;\n }\n catch (cause) {\n throw factsError(`${owner} is not canonical UTF-8 JSON`, cause);\n }\n}\nfunction parseInspectionJson(bytes: Uint8Array, owner: string): InspectionJson {\n const closed = closeInspectionJson(parseJson(bytes, owner));\n if (isInspectionCodecError(closed)) {\n throw factsError(`${owner} is invalid: ${closed.reason}`);\n }\n return closed;\n}\nfunction decodedRight<A>(decoded: Result.Result<A, unknown>, reason: string): A {\n if (Result.isFailure(decoded))\n throw factsError(reason, decoded.failure);\n return decoded.success;\n}\nfunction exactMarker(value: unknown, key: string): unknown | undefined {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return undefined;\n }\n const keys = Reflect.ownKeys(value);\n if (keys.length !== 1 || keys[0] !== key)\n return undefined;\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n return descriptor?.enumerable === true && \"value\" in descriptor\n ? descriptor.value\n : undefined;\n}\nfunction hasOwnMarker(value: unknown, key: string): boolean {\n return typeof value === \"object\" && value !== null && !Array.isArray(value) &&\n Object.prototype.hasOwnProperty.call(value, key);\n}\nfunction issue(code: string, locator: string): InspectionJson {\n return Object.freeze({ code, locator });\n}\nfunction factsError(reason: string, cause?: unknown): Error {\n return new Error(reason, cause === undefined ? undefined : { cause });\n}\nfunction compareText(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\nfunction verifyDigest(bytes: Uint8Array, digest: string, label: string): void {\n if (new InspectionSha256().update(bytes).digestHex() !== digest)\n throw factsError(`${label} digest is invalid`);\n}\nfunction parseVerifiedJson(bytes: Uint8Array, digest: string, label: string): unknown {\n verifyDigest(bytes, digest, label);\n return parseJson(bytes, label);\n}\n"]}
1
+ {"version":3,"file":"facts.js","sourceRoot":"","sources":["facts.ts"],"names":[],"mappings":";;AAqFA,gDA4CC;AAED,gEAUC;AAED,8DAoDC;AAqBD,kDA0EC;AAID,4DAiDC;AAwCD,wEAaC;AAED,wFAUC;AACD,8CAIC;AACD,sCAEC;AAKD,4DA+BC;AApcD,gDAAgD;AAChD,wDAAwD;AACxD,8DAA8D;AAC9D,wFAAwF;AACxF,mCAAwC;AACxC,8DAA6D;AAC7D,gEAAqG;AACrG,kEAA8M;AAC9M,qDAA6J;AAC7J,4DAA2G;AAI3G,yCAA+F;AAE/F,yCAA8C;AA6C9C,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,2BAA2B,GAAG,EAAE,CAAC;AACvC,MAA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AM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACzD,CAAC;AACD,SAAS,KAAK,CAAC,IAAY,EAAE,OAAe;IACxC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AAC5C,CAAC;AACD,SAAS,UAAU,CAAC,MAAc,EAAE,KAAe;IAC/C,OAAO,IAAI,KAAK,CAAC,MAAM,EAAE,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AAC1E,CAAC;AACD,SAAS,WAAW,CAAC,IAAY,EAAE,KAAa;IAC5C,OAAO,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC;AACD,SAAS,YAAY,CAAC,KAAiB,EAAE,MAAc,EAAE,KAAa;IAClE,IAAI,IAAI,2BAAgB,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,KAAK,MAAM;QAC3D,MAAM,UAAU,CAAC,GAAG,KAAK,oBAAoB,CAAC,CAAC;AACvD,CAAC;AACD,SAAS,iBAAiB,CAAC,KAAiB,EAAE,MAAc,EAAE,KAAa;IACvE,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACnC,OAAO,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACnC,CAAC","sourcesContent":["// @concord-file ne-eval-inspection-facts-reader\n// @concord-implements docs/feature/inspection/README.md\n// @concord-implements docs/feature/inspection/architecture.md\n// @concord-implements docs/feature/inspection/use-case/inspection-check-completeness.md\nimport { Result, Schema } from \"effect\";\nimport { encodeAttemptLocator } from \"../attempt-locator.ts\";\nimport { mintRecordContentHandle, type RecordContentHandle, } from \"../record/attachment/content.ts\";\nimport { enumerateRecordAttachmentClosure, hydrateRecordAttachmentCurrent, mintRecordAttachmentReference, RecordAttachmentReference, recordAttachmentReferenceWire, } from \"../record/attachment/protocol.ts\";\nimport { decodeAttemptDocument, decodeMemberDocument, decodeRunDocument, RecordExactParseOptions, RecordSlotIdentitySchema, } from \"../record/codec/core.ts\";\nimport { NiceEvalCurrentRecordAttachments, NiceEvalRecordAttachments, } from \"../record/family/current.ts\";\nimport type { AssertionsAttachment } from \"../record/family/assertions/definition.ts\";\nimport type { AttemptDocument, MemberDocument, RunDocument, } from \"../record/model/core.ts\";\nimport type { PersistedContentMetadata, SealedAttachmentMetadata, SealedRunCore, SealedRunSummary, } from \"../record/sqlite/types.ts\";\nimport { closeInspectionJson, isInspectionCodecError, type InspectionJson, } from \"./codec.ts\";\nimport type { InspectionFactSource } from \"./source.ts\";\nimport { InspectionSha256 } from \"./bytes.ts\";\nimport type { ReadableRunResource } from \"../run/storage/types.ts\";\nexport interface DecodedInspectionAttachment {\n readonly physical: SealedAttachmentMetadata;\n readonly value: InspectionJson;\n}\n/** A strictly decoded sealed Run with its browser-neutral reader capability. */\nexport interface LoadedInspectionRun {\n readonly source: InspectionFactSource;\n readonly physical: SealedRunCore;\n readonly run: RunDocument;\n readonly members: readonly MemberDocument[];\n readonly attempts: readonly AttemptDocument[];\n readonly attachments: readonly DecodedInspectionAttachment[];\n}\n/** Exact lifecycle resource plus its optional published Core at one cutoff. */\nexport interface LoadedInspectionRunResource {\n readonly source: InspectionFactSource;\n readonly resource: ReadableRunResource;\n readonly members: readonly MemberDocument[];\n readonly supporting: readonly LoadedInspectionRun[];\n readonly published?: LoadedInspectionRun;\n}\nexport interface InspectionAttemptTarget {\n readonly run: LoadedInspectionRun;\n readonly member: MemberDocument;\n}\n/** Exact origin Attempt plus every target membership visible to the resolver. */\nexport interface ResolvedInspectionAttempt {\n readonly attempt: AttemptDocument;\n readonly origin: LoadedInspectionRun;\n readonly locator: string;\n readonly targets: readonly InspectionAttemptTarget[];\n}\nexport type InspectionAssertionsRead = {\n readonly state: \"available\";\n readonly attachment: DecodedInspectionAttachment;\n readonly value: AssertionsAttachment;\n readonly contents: WeakMap<object, PersistedContentMetadata>;\n readonly issues: readonly InspectionJson[];\n} | {\n readonly state: \"not-recorded\" | \"unsupported\" | \"failed\";\n readonly attachment?: DecodedInspectionAttachment;\n readonly issues: readonly InspectionJson[];\n};\nconst RUN_PAGE_SIZE = 100;\nconst ATTEMPT_CANDIDATE_RUN_LIMIT = 64;\nconst ATTEMPT_TARGET_MEMBER_LIMIT = 256;\nconst decodedRuns = new WeakMap<InspectionFactSource, Map<string, LoadedInspectionRun>>();\nfunction readInspectionRun(source: InspectionFactSource, runId: string): LoadedInspectionRun | undefined {\n let cache = decodedRuns.get(source);\n if (cache === undefined)\n decodedRuns.set(source, cache = new Map());\n const cached = cache.get(runId);\n if (cached !== undefined)\n return cached;\n const physical = source.readSealedRunCore(runId);\n if (physical === undefined)\n return undefined;\n const decoded = decodeInspectionRun(source, physical);\n cache.set(runId, decoded);\n return decoded;\n}\n/**\n * Pins the source cutoff, exhausts the fixed Run-summary pagination, then\n * reads and strictly decodes every Run Core in that exact sealed generation.\n */\n// @concord-code ne-eval-inspection-load-runs\n// @concord-implements docs/feature/inspection/architecture.md\n// @concord-implements docs/feature/inspection/use-case/inspection-check-completeness.md\nexport function loadInspectionRuns(source: InspectionFactSource): readonly LoadedInspectionRun[] {\n const cutoff = source.cutoff();\n const summaries: SealedRunSummary[] = [];\n const seen = new Set<string>();\n let expectedRunCount: number | undefined;\n let afterRunId = \"\";\n for (;;) {\n const page = source.readSealedRunSummaryPage(afterRunId, RUN_PAGE_SIZE, cutoff.identity);\n if (page.cutoff.identity !== cutoff.identity ||\n expectedRunCount !== undefined && page.cutoff.runCount !== expectedRunCount) {\n throw factsError(\"Run inventory changed its pinned cutoff or count\");\n }\n expectedRunCount ??= page.cutoff.runCount;\n if (page.afterRunId !== afterRunId) {\n throw factsError(\"Run pagination returned a different cursor\");\n }\n let previous = afterRunId;\n for (const summary of page.summaries) {\n if (summary.runId <= previous || seen.has(summary.runId)) {\n throw factsError(\"Run pagination is not strictly ordered\");\n }\n seen.add(summary.runId);\n summaries.push(summary);\n previous = summary.runId;\n }\n if (page.nextAfterRunId === null)\n break;\n if (page.summaries.length === 0 ||\n page.nextAfterRunId !== page.summaries.at(-1)!.runId ||\n page.nextAfterRunId === afterRunId) {\n throw factsError(\"Run pagination returned an invalid continuation cursor\");\n }\n afterRunId = page.nextAfterRunId;\n }\n if (summaries.length !== expectedRunCount) {\n throw factsError(\"Run pagination did not close the pinned sealed cutoff\");\n }\n return Object.freeze(summaries.map((summary) => {\n const run = readInspectionRun(source, summary.runId);\n if (run === undefined) {\n throw factsError(`Sealed Run ${summary.runId} disappeared from the pinned cutoff`);\n }\n return run;\n }));\n}\n/** Reads a bounded, explicit Run selection without changing its caller order. */\nexport function loadSelectedInspectionRuns(source: InspectionFactSource, runIds: readonly string[]): readonly LoadedInspectionRun[] {\n const cutoff = source.cutoff();\n const loaded: LoadedInspectionRun[] = [];\n for (const runId of new Set(runIds)) {\n const run = readInspectionRun(source, runId);\n if (run !== undefined)\n loaded.push(run);\n }\n requireCutoff(source.cutoff(), cutoff);\n return Object.freeze(loaded);\n}\n/** Reads Run create/close facts even when no Attempt Core has been published. */\nexport function loadInspectionRunResource(source: InspectionFactSource, runId: string): LoadedInspectionRunResource | undefined {\n const cutoff = source.cutoff();\n const resource = source.readRunResource(runId);\n if (resource === undefined)\n return undefined;\n const published = readInspectionRun(source, runId);\n if (published !== undefined)\n validateRunResourceCore(resource, published);\n const originIds = resource.slots.flatMap(({ publication }) => publication.state === \"published\" ? [publication.originRunId] : []);\n const supporting = loadSelectedInspectionRuns(source, [\n ...(published === undefined ? [] : [runId]), ...originIds,\n ]);\n const index = memberIndex(supporting);\n const publications = new Map<string, SealedRunCore[\"attempts\"][number]>(supporting.flatMap((origin) => origin.physical.attempts.map((attempt) => [\n `${origin.run.runId}\\u0000${attempt.attemptId}`, attempt,\n ] as const)));\n const members = resource.slots.flatMap(({ slotId, publication }): readonly MemberDocument[] => {\n if (publication.state === \"pending\")\n return [];\n if (publication.state === \"absent\") {\n return [decodedRight(decodeMemberDocument({\n slotId,\n action: publication.reason === \"interrupted-before-publication\" || publication.reason === \"dispatch-failed\"\n ? \"interrupted\" : \"not-dispatched\",\n attempt: null,\n absenceReason: publication.reason,\n }), \"Run resource absence is invalid\")];\n }\n const origin = index.origins.get(publication.originRunId);\n const attempt = origin?.attempts.get(publication.attemptId);\n const stored = publications.get(`${publication.originRunId}\\u0000${publication.attemptId}`);\n if (attempt === undefined || stored === undefined ||\n attempt.slotId !== publication.originSlotId ||\n stored.attemptLocator !== publication.attemptLocator ||\n stored.publicationIdentity?.originRunId !== publication.publicationIdentity.originRunId ||\n stored.publicationIdentity?.attemptId !== publication.publicationIdentity.attemptId ||\n stored.publicationIdentity?.revision !== publication.publicationIdentity.revision ||\n publication.publicationIdentity.originRunId !== publication.originRunId ||\n publication.publicationIdentity.attemptId !== publication.attemptId ||\n publication.action === \"executed\" && publication.originRunId !== runId) {\n throw factsError(`Run ${runId} Slot ${slotId} does not bind a matching published origin Attempt`);\n }\n return [decodedRight(decodeMemberDocument({\n slotId, action: publication.action,\n attempt: { originRunId: publication.originRunId, attemptId: publication.attemptId },\n }), \"Run resource binding is invalid\")];\n }).sort((left, right) => compareText(left.slotId, right.slotId));\n requireCutoff(source.cutoff(), cutoff);\n return Object.freeze({\n source, resource, members: Object.freeze(members), supporting,\n ...(published === undefined ? {} : { published }),\n });\n}\nfunction validateRunResourceCore(resource: ReadableRunResource, published: LoadedInspectionRun): void {\n const run = published.run;\n if (run.runId !== resource.runId ||\n run.experimentId !== resource.experimentId ||\n run.startedAt !== Date.parse(resource.startedAt) ||\n run.expectedSlots.length !== resource.slots.length) {\n throw factsError(`Run ${resource.runId} lifecycle resource does not match its published Core`);\n }\n for (const [index, slot] of run.expectedSlots.entries()) {\n const expected = resource.slots[index];\n if (expected === undefined ||\n slot.slotId !== expected.slotId ||\n slot.evalId !== expected.evalId ||\n slot.attemptOrdinal !== expected.attemptOrdinal ||\n slot.executionIdentityDigest !== expected.executionIdentityDigest) {\n throw factsError(`Run ${resource.runId} expected Slot does not match its published Core`);\n }\n }\n}\n/** Strictly decodes Core, then decodes each Attachment only on first use. */\nexport function decodeInspectionRun(source: InspectionFactSource, physical: SealedRunCore): LoadedInspectionRun {\n const run = decodedRight(decodeRunDocument(parseVerifiedJson(physical.runCoreBytes, physical.runCoreDigest, \"Run Core\")), \"Run Core is invalid\");\n if (run.runId !== physical.runId) {\n throw factsError(\"Run Core identity does not match its sealed row\");\n }\n if (physical.slots.length !== run.expectedSlots.length) {\n throw factsError(\"Run Core Slot rows do not match its expected denominator\");\n }\n for (const [index, stored] of physical.slots.entries()) {\n const decoded = Schema.decodeUnknownResult(RecordSlotIdentitySchema, RecordExactParseOptions)(parseVerifiedJson(stored.coreBytes, stored.coreDigest, \"Slot Core\"));\n const slot = decodedRight(decoded, \"Slot Core is invalid\");\n const expected = run.expectedSlots[index];\n if (expected === undefined ||\n stored.ordinal !== index ||\n stored.slotId !== slot.slotId ||\n slot.slotId !== expected.slotId ||\n slot.evalId !== expected.evalId ||\n slot.attemptOrdinal !== expected.attemptOrdinal ||\n slot.executionIdentityDigest !== expected.executionIdentityDigest) {\n throw factsError(\"Slot Core does not match its sealed Run denominator\");\n }\n }\n const members = physical.members.map((stored) => {\n const member = decodedRight(decodeMemberDocument(parseVerifiedJson(stored.coreBytes, stored.coreDigest, \"Member Core\")), \"Member Core is invalid\");\n if (member.slotId !== stored.slotId ||\n member.action !== stored.action ||\n (member.attempt?.originRunId ?? undefined) !== stored.originRunId ||\n (member.attempt?.attemptId ?? undefined) !== stored.attemptId) {\n throw factsError(\"Member Core does not match its sealed row\");\n }\n return member;\n });\n const attempts = physical.attempts.map((stored) => {\n const attempt = decodedRight(decodeAttemptDocument(parseVerifiedJson(stored.coreBytes, stored.coreDigest, \"Attempt Core\")), \"Attempt Core is invalid\");\n if (attempt.attemptId !== stored.attemptId ||\n attempt.originRunId !== run.runId ||\n encodeAttemptLocator(attempt.attemptId) !== stored.attemptLocator) {\n throw factsError(\"Attempt Core does not match its sealed row\");\n }\n return attempt;\n });\n validateCoreRelations(run, members, attempts, physical.publicationManaged === true);\n const localAttemptIds = new Set<string>(attempts.map(({ attemptId }) => attemptId));\n const attachments = physical.attachments.map((attachment): DecodedInspectionAttachment => {\n if (attachment.ownerRunId !== run.runId ||\n attachment.ownerKind === \"run\" && attachment.ownerAttemptId !== undefined ||\n attachment.ownerKind === \"attempt\" &&\n (attachment.ownerAttemptId === undefined ||\n !localAttemptIds.has(attachment.ownerAttemptId))) {\n throw factsError(\"Attachment ownership does not match its sealed Run\");\n }\n let value: InspectionJson | undefined;\n let decoded = false;\n return Object.freeze({\n physical: attachment,\n get value(): InspectionJson {\n if (!decoded) {\n verifyDigest(attachment.canonicalBytes, attachment.canonicalDigest, \"Attachment\");\n verifyDigest(attachment.logicalInventoryBytes, attachment.inventoryDigest, \"Attachment inventory\");\n value = parseInspectionJson(attachment.canonicalBytes, \"Attachment\");\n decoded = true;\n }\n return value!;\n },\n });\n });\n return Object.freeze({\n source,\n physical,\n run,\n members: Object.freeze(members),\n attempts: Object.freeze(attempts),\n attachments: Object.freeze(attachments),\n });\n}\n/** Resolves a public locator through the source's bounded exact index. */\n// @concord-code ne-eval-inspection-resolve-attempt\n// @concord-implements docs/feature/inspection/architecture.md\nexport function resolveInspectionAttempt(source: InspectionFactSource, locator: string): ResolvedInspectionAttempt | undefined {\n const projection = source.findAttemptLocatorCandidates(locator, ATTEMPT_CANDIDATE_RUN_LIMIT);\n if (projection.candidates.length === 0)\n return undefined;\n if (projection.ambiguous)\n return undefined;\n const origins = projection.candidates.filter(({ relation }) => relation === \"origin\");\n if (origins.length !== 1) {\n throw factsError(`Attempt ${locator} indexed projection is invalid`);\n }\n const identity = origins[0]!;\n const runs = loadSelectedInspectionRuns(source, projection.candidates.map(({ runId }) => runId));\n const byRunId = new Map<string, LoadedInspectionRun>(runs.map((run) => [run.run.runId, run] as const));\n const origin = byRunId.get(identity.originRunId);\n if (origin === undefined) {\n throw factsError(`Attempt ${locator} origin is not a sealed Run`);\n }\n const attempt = origin.attempts.find((candidate) => candidate.attemptId === identity.attemptId &&\n candidate.originRunId === identity.originRunId &&\n encodeAttemptLocator(candidate.attemptId) === locator);\n if (attempt === undefined) {\n throw factsError(`Attempt ${locator} origin Core is invalid`);\n }\n const targets: InspectionAttemptTarget[] = [];\n const targetRunIds = new Set(projection.candidates.flatMap((candidate) => candidate.relation === \"target\" &&\n candidate.originRunId === identity.originRunId &&\n candidate.attemptId === identity.attemptId\n ? [candidate.runId]\n : []));\n for (const runId of targetRunIds) {\n const run = byRunId.get(runId);\n if (run === undefined) {\n throw factsError(`Attempt ${locator} target is not a sealed Run`);\n }\n const members = targetMembers(run, attempt);\n if (members.length === 0) {\n throw factsError(`Attempt ${locator} target Core is invalid`);\n }\n if (targets.length + members.length > ATTEMPT_TARGET_MEMBER_LIMIT) {\n throw factsError(`Attempt ${locator} exceeds its fixed target member limit`);\n }\n targets.push(...members.map((member) => Object.freeze({ run, member })));\n }\n return Object.freeze({\n attempt,\n origin,\n locator,\n targets: Object.freeze(targets),\n });\n}\ninterface InspectionMemberIndex {\n readonly origins: ReadonlyMap<string, {\n readonly run: LoadedInspectionRun;\n readonly attempts: ReadonlyMap<string, AttemptDocument>;\n readonly members: ReadonlyMap<string, MemberDocument>;\n }>;\n readonly targets: ReadonlyMap<string, ReadonlyMap<string, readonly InspectionAttemptTarget[]>>;\n}\nconst memberIndexes = new WeakMap<readonly LoadedInspectionRun[], InspectionMemberIndex>();\nfunction memberIndex(runs: readonly LoadedInspectionRun[]): InspectionMemberIndex {\n const cached = memberIndexes.get(runs);\n if (cached !== undefined)\n return cached;\n const origins = new Map(runs.map((run) => [run.run.runId, {\n run, attempts: new Map(run.attempts.map((attempt) => [attempt.attemptId, attempt])),\n members: new Map(run.members.map((member) => [member.slotId, member])),\n }]));\n const targets = new Map<string, Map<string, InspectionAttemptTarget[]>>();\n for (const run of runs)\n for (const member of run.members) {\n if (member.attempt === null)\n continue;\n const { originRunId, attemptId } = member.attempt;\n let byAttempt = targets.get(originRunId);\n if (byAttempt === undefined)\n targets.set(originRunId, byAttempt = new Map());\n let members = byAttempt.get(attemptId);\n if (members === undefined)\n byAttempt.set(attemptId, members = []);\n members.push(Object.freeze({ run, member }));\n }\n for (const byAttempt of targets.values())\n for (const members of byAttempt.values())\n Object.freeze(members);\n const index = { origins, targets };\n memberIndexes.set(runs, index);\n return index;\n}\n/** Resolves already loaded facts through one shared identity index. */\nexport function resolveInspectionMemberAttempt(runs: readonly LoadedInspectionRun[], target: LoadedInspectionRun, member: MemberDocument): ResolvedInspectionAttempt | undefined {\n if (member.attempt === null)\n return undefined;\n const index = memberIndex(runs);\n const origin = index.origins.get(member.attempt.originRunId);\n const attempt = origin?.attempts.get(member.attempt.attemptId);\n if (origin === undefined || attempt === undefined || attempt.originRunId !== member.attempt.originRunId)\n return undefined;\n const targets = index.targets.get(attempt.originRunId)?.get(attempt.attemptId) ?? [];\n const targetMember = index.origins.get(target.run.runId)?.members.get(member.slotId);\n if (targetMember?.attempt?.originRunId !== attempt.originRunId || targetMember.attempt.attemptId !== attempt.attemptId)\n return undefined;\n return Object.freeze({ attempt, origin: origin.run, locator: encodeAttemptLocator(attempt.attemptId), targets });\n}\n/** A target binding does not require the target to have published its own Run Core. */\nexport function resolveInspectionResourceMemberAttempt(target: LoadedInspectionRunResource, member: MemberDocument): ResolvedInspectionAttempt | undefined {\n if (member.attempt === null)\n return undefined;\n const index = memberIndex(target.supporting);\n const origin = index.origins.get(member.attempt.originRunId);\n const attempt = origin?.attempts.get(member.attempt.attemptId);\n if (origin === undefined || attempt === undefined)\n return undefined;\n const targets = index.targets.get(attempt.originRunId)?.get(attempt.attemptId) ?? [];\n return Object.freeze({ attempt, origin: origin.run, locator: encodeAttemptLocator(attempt.attemptId), targets });\n}\nexport function attemptAttachment(resolved: ResolvedInspectionAttempt, family: string): DecodedInspectionAttachment | undefined {\n return resolved.origin.attachments.find(({ physical }) => physical.ownerKind === \"attempt\" &&\n physical.ownerAttemptId === resolved.attempt.attemptId &&\n physical.family === family);\n}\nexport function runAttachment(run: LoadedInspectionRun, family: string): DecodedInspectionAttachment | undefined {\n return run.attachments.find(({ physical }) => physical.ownerKind === \"run\" && physical.family === family);\n}\n/** Reads only the current logical Assertions family, preserving failure state. */\n// @concord-code ne-eval-inspection-read-assertions\n// @concord-implements docs/feature/assertions/README.md\n// @concord-implements docs/feature/inspection/README.md\nexport function readInspectionAssertions(resolved: ResolvedInspectionAttempt): InspectionAssertionsRead {\n const attachment = attemptAttachment(resolved, NiceEvalRecordAttachments.assertions.family);\n if (attachment === undefined) {\n return Object.freeze({\n state: \"not-recorded\" as const,\n issues: Object.freeze([issue(\"assertions-not-recorded\", resolved.locator)]),\n });\n }\n if (attachment.physical.familyRevision !==\n NiceEvalCurrentRecordAttachments.assertions.revision) {\n return Object.freeze({\n state: \"unsupported\" as const,\n attachment,\n issues: Object.freeze([issue(\"assertions-revision-unsupported\", resolved.locator)]),\n });\n }\n const decoded = decodeCurrentAssertions(attachment);\n if (decoded === undefined) {\n return Object.freeze({\n state: \"failed\" as const,\n attachment,\n issues: Object.freeze([issue(\"assertions-current-invalid\", resolved.locator)]),\n });\n }\n return Object.freeze({\n state: \"available\" as const,\n attachment,\n value: decoded.value,\n contents: decoded.contents,\n issues: Object.freeze([]),\n });\n}\nfunction decodeCurrentAssertions(attachment: DecodedInspectionAttachment): {\n readonly value: AssertionsAttachment;\n readonly contents: WeakMap<object, PersistedContentMetadata>;\n} | undefined {\n const definition = NiceEvalRecordAttachments.assertions;\n const byHandle = new Map(attachment.physical.contents.map((content) => [content.logicalHandle, content]));\n const handles = new Map<string, RecordContentHandle>();\n const contents = new WeakMap<object, PersistedContentMetadata>();\n const usedContent = new Set<string>();\n const hydrated = hydrateRecordAttachmentCurrent(definition, attachment.value, {\n content: (token, declaration) => {\n const logicalHandle = exactMarker(token, \"$niceeval.record.content\");\n if (logicalHandle === undefined &&\n !hasOwnMarker(token, \"$niceeval.record.content\")) {\n return Result.succeed(undefined);\n }\n if (typeof logicalHandle !== \"string\") {\n return Result.fail({ code: \"current-content-bind-failed\" as const });\n }\n const metadata = byHandle.get(logicalHandle);\n if (metadata === undefined ||\n declaration.maximumBytes !== undefined &&\n metadata.byteLength > declaration.maximumBytes) {\n return Result.fail({ code: \"current-content-bind-failed\" as const });\n }\n let handle = handles.get(logicalHandle);\n if (handle === undefined) {\n handle = mintRecordContentHandle(declaration.kind);\n handles.set(logicalHandle, handle);\n contents.set(handle, metadata);\n }\n usedContent.add(logicalHandle);\n return Result.succeed(handle);\n },\n reference: (token, declaration) => {\n const marker = exactMarker(token, \"$niceeval.record.reference\");\n if (marker === undefined &&\n !hasOwnMarker(token, \"$niceeval.record.reference\")) {\n return Result.succeed(undefined);\n }\n if (typeof marker !== \"object\" || marker === null || Array.isArray(marker)) {\n return Result.fail({ code: \"current-reference-bind-failed\" as const });\n }\n const value = marker as Record<string, unknown>;\n if (Reflect.ownKeys(value).length !== 3 ||\n value.owner !== declaration.definition.owner ||\n value.family !== declaration.definition.family ||\n !(\"value\" in value)) {\n return Result.fail({ code: \"current-reference-bind-failed\" as const });\n }\n return Result.succeed(mintRecordAttachmentReference(RecordAttachmentReference.to(declaration.definition, declaration.valueSchema), value.value));\n },\n });\n if (Result.isFailure(hydrated) ||\n usedContent.size !== attachment.physical.contents.length) {\n return undefined;\n }\n const closure = enumerateRecordAttachmentClosure(definition, hydrated.success);\n if (Result.isFailure(closure))\n return undefined;\n const references = new Map<string, {\n readonly owner: string;\n readonly family: string;\n }>();\n for (const reference of closure.success.references) {\n const wire = recordAttachmentReferenceWire(reference);\n if (wire === undefined)\n return undefined;\n references.set(`${wire.owner}\\u0000${wire.family}`, Object.freeze({ owner: wire.owner, family: wire.family }));\n }\n const ordered = [...references.values()].sort((left, right) => compareText(left.owner, right.owner) || compareText(left.family, right.family));\n if (ordered.length !== attachment.physical.references.length)\n return undefined;\n for (let ordinal = 0; ordinal < ordered.length; ordinal += 1) {\n const logical = ordered[ordinal]!;\n const physical = attachment.physical.references[ordinal]!;\n if (physical.ordinal !== ordinal ||\n physical.owner !== logical.owner ||\n physical.family !== logical.family) {\n return undefined;\n }\n }\n return Object.freeze({ value: hydrated.success, contents });\n}\nfunction validateCoreRelations(run: RunDocument, members: readonly MemberDocument[], attempts: readonly AttemptDocument[], allowPendingSlots = false): void {\n const slots = new Map(run.expectedSlots.map((slot) => [slot.slotId, slot] as const));\n if (slots.size !== run.expectedSlots.length || (!allowPendingSlots && members.length !== slots.size) || members.length > slots.size) {\n throw factsError(\"Run Core does not close its expected Slot membership\");\n }\n const memberSlots = new Set<string>();\n for (const member of members) {\n if (!slots.has(member.slotId) || memberSlots.has(member.slotId)) {\n throw factsError(\"Run Core contains an invalid Member Slot\");\n }\n memberSlots.add(member.slotId);\n }\n const attemptIds = new Set<string>();\n for (const attempt of attempts) {\n const slot = slots.get(attempt.slotId);\n if (attemptIds.has(attempt.attemptId) ||\n slot === undefined ||\n attempt.evalId !== slot.evalId ||\n attempt.executionIdentityDigest !== slot.executionIdentityDigest) {\n throw factsError(\"Run Core contains an invalid origin Attempt\");\n }\n attemptIds.add(attempt.attemptId);\n }\n for (const member of members) {\n if (member.action === \"executed\" &&\n (member.attempt === null ||\n member.attempt.originRunId !== run.runId ||\n !attemptIds.has(member.attempt.attemptId))) {\n throw factsError(\"Executed Member does not name a local origin Attempt\");\n }\n }\n}\nfunction targetMembers(run: LoadedInspectionRun, attempt: AttemptDocument): readonly MemberDocument[] {\n return run.members.filter((member) => member.attempt !== null &&\n member.attempt.originRunId === attempt.originRunId &&\n member.attempt.attemptId === attempt.attemptId);\n}\nfunction requireCutoff(actual: ReturnType<InspectionFactSource[\"cutoff\"]>, expected: ReturnType<InspectionFactSource[\"cutoff\"]>): void {\n if (actual.storeGeneration !== expected.storeGeneration ||\n actual.revision !== expected.revision) {\n throw factsError(\"Inspection source changed its pinned sealed cutoff\");\n }\n}\nfunction parseJson(bytes: Uint8Array, owner: string): unknown {\n try {\n return JSON.parse(new TextDecoder(\"utf-8\", { fatal: true }).decode(bytes)) as unknown;\n }\n catch (cause) {\n throw factsError(`${owner} is not canonical UTF-8 JSON`, cause);\n }\n}\nfunction parseInspectionJson(bytes: Uint8Array, owner: string): InspectionJson {\n const closed = closeInspectionJson(parseJson(bytes, owner));\n if (isInspectionCodecError(closed)) {\n throw factsError(`${owner} is invalid: ${closed.reason}`);\n }\n return closed;\n}\nfunction decodedRight<A>(decoded: Result.Result<A, unknown>, reason: string): A {\n if (Result.isFailure(decoded))\n throw factsError(reason, decoded.failure);\n return decoded.success;\n}\nfunction exactMarker(value: unknown, key: string): unknown | undefined {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return undefined;\n }\n const keys = Reflect.ownKeys(value);\n if (keys.length !== 1 || keys[0] !== key)\n return undefined;\n const descriptor = Object.getOwnPropertyDescriptor(value, key);\n return descriptor?.enumerable === true && \"value\" in descriptor\n ? descriptor.value\n : undefined;\n}\nfunction hasOwnMarker(value: unknown, key: string): boolean {\n return typeof value === \"object\" && value !== null && !Array.isArray(value) &&\n Object.prototype.hasOwnProperty.call(value, key);\n}\nfunction issue(code: string, locator: string): InspectionJson {\n return Object.freeze({ code, locator });\n}\nfunction factsError(reason: string, cause?: unknown): Error {\n return new Error(reason, cause === undefined ? undefined : { cause });\n}\nfunction compareText(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\nfunction verifyDigest(bytes: Uint8Array, digest: string, label: string): void {\n if (new InspectionSha256().update(bytes).digestHex() !== digest)\n throw factsError(`${label} digest is invalid`);\n}\nfunction parseVerifiedJson(bytes: Uint8Array, digest: string, label: string): unknown {\n verifyDigest(bytes, digest, label);\n return parseJson(bytes, label);\n}\n"]}
@@ -21,6 +21,8 @@ export interface LoadedInspectionRun {
21
21
  export interface LoadedInspectionRunResource {
22
22
  readonly source: InspectionFactSource;
23
23
  readonly resource: ReadableRunResource;
24
+ readonly members: readonly MemberDocument[];
25
+ readonly supporting: readonly LoadedInspectionRun[];
24
26
  readonly published?: LoadedInspectionRun;
25
27
  }
26
28
  export interface InspectionAttemptTarget {
@@ -60,6 +62,8 @@ export declare function decodeInspectionRun(source: InspectionFactSource, physic
60
62
  export declare function resolveInspectionAttempt(source: InspectionFactSource, locator: string): ResolvedInspectionAttempt | undefined;
61
63
  /** Resolves already loaded facts through one shared identity index. */
62
64
  export declare function resolveInspectionMemberAttempt(runs: readonly LoadedInspectionRun[], target: LoadedInspectionRun, member: MemberDocument): ResolvedInspectionAttempt | undefined;
65
+ /** A target binding does not require the target to have published its own Run Core. */
66
+ export declare function resolveInspectionResourceMemberAttempt(target: LoadedInspectionRunResource, member: MemberDocument): ResolvedInspectionAttempt | undefined;
63
67
  export declare function attemptAttachment(resolved: ResolvedInspectionAttempt, family: string): DecodedInspectionAttachment | undefined;
64
68
  export declare function runAttachment(run: LoadedInspectionRun, family: string): DecodedInspectionAttachment | undefined;
65
69
  /** Reads only the current logical Assertions family, preserving failure state. */
@@ -21,6 +21,8 @@ export interface LoadedInspectionRun {
21
21
  export interface LoadedInspectionRunResource {
22
22
  readonly source: InspectionFactSource;
23
23
  readonly resource: ReadableRunResource;
24
+ readonly members: readonly MemberDocument[];
25
+ readonly supporting: readonly LoadedInspectionRun[];
24
26
  readonly published?: LoadedInspectionRun;
25
27
  }
26
28
  export interface InspectionAttemptTarget {
@@ -60,6 +62,8 @@ export declare function decodeInspectionRun(source: InspectionFactSource, physic
60
62
  export declare function resolveInspectionAttempt(source: InspectionFactSource, locator: string): ResolvedInspectionAttempt | undefined;
61
63
  /** Resolves already loaded facts through one shared identity index. */
62
64
  export declare function resolveInspectionMemberAttempt(runs: readonly LoadedInspectionRun[], target: LoadedInspectionRun, member: MemberDocument): ResolvedInspectionAttempt | undefined;
65
+ /** A target binding does not require the target to have published its own Run Core. */
66
+ export declare function resolveInspectionResourceMemberAttempt(target: LoadedInspectionRunResource, member: MemberDocument): ResolvedInspectionAttempt | undefined;
63
67
  export declare function attemptAttachment(resolved: ResolvedInspectionAttempt, family: string): DecodedInspectionAttachment | undefined;
64
68
  export declare function runAttachment(run: LoadedInspectionRun, family: string): DecodedInspectionAttachment | undefined;
65
69
  /** Reads only the current logical Assertions family, preserving failure state. */
@@ -21,6 +21,8 @@ export interface LoadedInspectionRun {
21
21
  export interface LoadedInspectionRunResource {
22
22
  readonly source: InspectionFactSource;
23
23
  readonly resource: ReadableRunResource;
24
+ readonly members: readonly MemberDocument[];
25
+ readonly supporting: readonly LoadedInspectionRun[];
24
26
  readonly published?: LoadedInspectionRun;
25
27
  }
26
28
  export interface InspectionAttemptTarget {
@@ -60,6 +62,8 @@ export declare function decodeInspectionRun(source: InspectionFactSource, physic
60
62
  export declare function resolveInspectionAttempt(source: InspectionFactSource, locator: string): ResolvedInspectionAttempt | undefined;
61
63
  /** Resolves already loaded facts through one shared identity index. */
62
64
  export declare function resolveInspectionMemberAttempt(runs: readonly LoadedInspectionRun[], target: LoadedInspectionRun, member: MemberDocument): ResolvedInspectionAttempt | undefined;
65
+ /** A target binding does not require the target to have published its own Run Core. */
66
+ export declare function resolveInspectionResourceMemberAttempt(target: LoadedInspectionRunResource, member: MemberDocument): ResolvedInspectionAttempt | undefined;
63
67
  export declare function attemptAttachment(resolved: ResolvedInspectionAttempt, family: string): DecodedInspectionAttachment | undefined;
64
68
  export declare function runAttachment(run: LoadedInspectionRun, family: string): DecodedInspectionAttachment | undefined;
65
69
  /** Reads only the current logical Assertions family, preserving failure state. */
@@ -17,6 +17,8 @@ const __niceevalExport6 = __niceevalCanonical["resolveInspectionAttempt"];
17
17
  export { __niceevalExport6 as resolveInspectionAttempt };
18
18
  const __niceevalExport7 = __niceevalCanonical["resolveInspectionMemberAttempt"];
19
19
  export { __niceevalExport7 as resolveInspectionMemberAttempt };
20
- const __niceevalExport8 = __niceevalCanonical["runAttachment"];
21
- export { __niceevalExport8 as runAttachment };
20
+ const __niceevalExport8 = __niceevalCanonical["resolveInspectionResourceMemberAttempt"];
21
+ export { __niceevalExport8 as resolveInspectionResourceMemberAttempt };
22
+ const __niceevalExport9 = __niceevalCanonical["runAttachment"];
23
+ export { __niceevalExport9 as runAttachment };
22
24
  //# sourceMappingURL=facts.js.map