niceeval 0.16.2 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/bootstrap.cjs +7 -1
- package/dist/cli/bootstrap.cjs.map +1 -1
- package/dist/cli/project-configuration.cjs +8 -11
- package/dist/cli/project-configuration.cjs.map +1 -1
- package/dist/expect/index.cjs.map +1 -1
- package/dist/expect/index.d.cts +1 -0
- package/dist/expect/index.d.mts +1 -0
- package/dist/expect/index.d.ts +1 -0
- package/dist/experiment/host/cli/contribution.cjs +6 -11
- package/dist/experiment/host/cli/contribution.cjs.map +1 -1
- package/dist/experiment/host/cli/contribution.d.cts +0 -16
- package/dist/experiment/host/cli/contribution.d.mts +0 -16
- package/dist/experiment/host/cli/contribution.d.ts +0 -16
- package/dist/experiment/host/operations.cjs +3 -3
- package/dist/experiment/host/operations.cjs.map +1 -1
- package/dist/experiment/host/types.cjs.map +1 -1
- package/dist/experiment/host/types.d.cts +0 -4
- package/dist/experiment/host/types.d.mts +0 -4
- package/dist/experiment/host/types.d.ts +0 -4
- package/dist/fresh-import.cjs +2 -2
- package/dist/fresh-import.cjs.map +1 -1
- package/dist/fresh-import.d.cts +3 -3
- package/dist/fresh-import.d.mts +3 -3
- package/dist/fresh-import.d.ts +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/inspection/codec.cjs.map +1 -1
- package/dist/inspection/codec.d.cts +1 -1
- package/dist/inspection/codec.d.mts +1 -1
- package/dist/inspection/codec.d.ts +1 -1
- package/dist/inspection/facts.cjs +66 -9
- package/dist/inspection/facts.cjs.map +1 -1
- package/dist/inspection/facts.d.cts +4 -0
- package/dist/inspection/facts.d.mts +4 -0
- package/dist/inspection/facts.d.ts +4 -0
- package/dist/inspection/facts.js +4 -2
- package/dist/inspection/index.cjs +1 -3
- package/dist/inspection/index.cjs.map +1 -1
- package/dist/inspection/index.d.cts +1 -1
- package/dist/inspection/index.d.mts +1 -1
- package/dist/inspection/index.d.ts +1 -1
- package/dist/inspection/index.js +44 -48
- package/dist/inspection/limits.cjs +3 -1
- package/dist/inspection/limits.cjs.map +1 -1
- package/dist/inspection/limits.d.cts +2 -0
- package/dist/inspection/limits.d.mts +2 -0
- package/dist/inspection/limits.d.ts +2 -0
- package/dist/inspection/limits.js +6 -4
- package/dist/inspection/project-source.cjs +4 -1
- package/dist/inspection/project-source.cjs.map +1 -1
- package/dist/inspection/protocol.cjs +10 -18
- package/dist/inspection/protocol.cjs.map +1 -1
- package/dist/inspection/protocol.d.cts +111 -173
- package/dist/inspection/protocol.d.mts +111 -173
- package/dist/inspection/protocol.d.ts +111 -173
- package/dist/inspection/public.mjs +73 -109
- package/dist/inspection/results.cjs +12 -48
- package/dist/inspection/results.cjs.map +1 -1
- package/dist/inspection/results.d.cts +124 -122
- package/dist/inspection/results.d.mts +124 -122
- package/dist/inspection/results.d.ts +124 -122
- package/dist/inspection/results.js +16 -20
- package/dist/inspection/select.cjs +80 -117
- package/dist/inspection/select.cjs.map +1 -1
- package/dist/inspection/source.cjs +14 -15
- package/dist/inspection/source.cjs.map +1 -1
- package/dist/inspection/source.d.cts +6 -3
- package/dist/inspection/source.d.mts +6 -3
- package/dist/inspection/source.d.ts +6 -3
- package/dist/inspection/trace.cjs +1 -1
- package/dist/inspection/trace.cjs.map +1 -1
- package/dist/load-config.cjs +17 -11
- package/dist/load-config.cjs.map +1 -1
- package/dist/load-config.d.cts +3 -2
- package/dist/load-config.d.mts +3 -2
- package/dist/load-config.d.ts +3 -2
- package/dist/o11y/adapter-usage-projection.cjs +5 -1
- package/dist/o11y/adapter-usage-projection.cjs.map +1 -1
- package/dist/o11y/adapter-usage-projection.d.cts +109 -1
- package/dist/o11y/adapter-usage-projection.d.mts +109 -1
- package/dist/o11y/adapter-usage-projection.d.ts +109 -1
- package/dist/o11y/cache-read.cjs +113 -0
- package/dist/o11y/cache-read.cjs.map +1 -0
- package/dist/o11y/cache-read.d.cts +80 -0
- package/dist/o11y/cache-read.d.mts +80 -0
- package/dist/o11y/cache-read.d.ts +80 -0
- package/dist/o11y/cache-read.js +8 -0
- package/dist/o11y/cache-read.js.map +1 -0
- package/dist/o11y/eval-usage.cjs +4 -1
- package/dist/o11y/eval-usage.cjs.map +1 -1
- package/dist/o11y/eval-usage.d.cts +4 -1
- package/dist/o11y/eval-usage.d.mts +4 -1
- package/dist/o11y/eval-usage.d.ts +4 -1
- package/dist/record/host/sqlite-host.cjs +188 -53
- package/dist/record/host/sqlite-host.cjs.map +1 -1
- package/dist/record/host/sqlite-host.d.cts +37 -1
- package/dist/record/host/sqlite-host.d.mts +37 -1
- package/dist/record/host/sqlite-host.d.ts +37 -1
- package/dist/record/host/sqlite-host.js +16 -8
- package/dist/record/maintenance/runtime.cjs +3 -3
- package/dist/record/maintenance/runtime.cjs.map +1 -1
- package/dist/record/sqlite/admission-repository.cjs +18 -18
- package/dist/record/sqlite/admission-repository.cjs.map +1 -1
- package/dist/record/sqlite/case-repository.cjs +6 -6
- package/dist/record/sqlite/case-repository.cjs.map +1 -1
- package/dist/record/sqlite/coordination-repository.cjs +25 -25
- package/dist/record/sqlite/coordination-repository.cjs.map +1 -1
- package/dist/record/sqlite/current-schema.cjs +115 -111
- package/dist/record/sqlite/current-schema.cjs.map +1 -1
- package/dist/record/sqlite/current-schema.d.cts +3 -3
- package/dist/record/sqlite/current-schema.d.mts +3 -3
- package/dist/record/sqlite/current-schema.d.ts +3 -3
- package/dist/record/sqlite/database.cjs +56 -53
- package/dist/record/sqlite/database.cjs.map +1 -1
- package/dist/record/sqlite/index.cjs +3 -1
- package/dist/record/sqlite/index.cjs.map +1 -1
- package/dist/record/sqlite/index.d.cts +5 -2
- package/dist/record/sqlite/index.d.mts +5 -2
- package/dist/record/sqlite/index.d.ts +5 -2
- package/dist/record/sqlite/legacy-schema-018.cjs +443 -0
- package/dist/record/sqlite/legacy-schema-018.cjs.map +1 -0
- package/dist/record/sqlite/legacy-schema-018.d.cts +6 -0
- package/dist/record/sqlite/legacy-schema-018.d.mts +6 -0
- package/dist/record/sqlite/legacy-schema-018.d.ts +6 -0
- package/dist/record/sqlite/legacy-schema-018.js +6 -0
- package/dist/record/sqlite/legacy-schema-018.js.map +1 -0
- package/dist/record/sqlite/migration.cjs +105 -46
- package/dist/record/sqlite/migration.cjs.map +1 -1
- package/dist/record/sqlite/migration.d.cts +2 -1
- package/dist/record/sqlite/migration.d.mts +2 -1
- package/dist/record/sqlite/migration.d.ts +2 -1
- package/dist/record/sqlite/portable-capture.cjs +13 -13
- package/dist/record/sqlite/portable-capture.cjs.map +1 -1
- package/dist/record/sqlite/registry-repository.cjs +22 -22
- package/dist/record/sqlite/registry-repository.cjs.map +1 -1
- package/dist/record/sqlite/schema.cjs +10 -2
- package/dist/record/sqlite/schema.cjs.map +1 -1
- package/dist/record/sqlite/schema.d.cts +4 -1
- package/dist/record/sqlite/schema.d.mts +4 -1
- package/dist/record/sqlite/schema.d.ts +4 -1
- package/dist/record/sqlite/schema.js +20 -14
- package/dist/record/sqlite/storage-worker.cjs +1 -1
- package/dist/record/sqlite/storage-worker.cjs.map +1 -1
- package/dist/record/sqlite/storage.cjs +316 -232
- package/dist/record/sqlite/storage.cjs.map +1 -1
- package/dist/record/sqlite/storage.d.cts +10 -2
- package/dist/record/sqlite/storage.d.mts +10 -2
- package/dist/record/sqlite/storage.d.ts +10 -2
- package/dist/record/sqlite/storage.js +54 -50
- package/dist/record/sqlite/types.cjs +1 -1
- package/dist/record/sqlite/types.cjs.map +1 -1
- package/dist/record/sqlite/types.d.cts +13 -1
- package/dist/record/sqlite/types.d.mts +13 -1
- package/dist/record/sqlite/types.d.ts +13 -1
- package/dist/run/cli/contribution.cjs +17 -12
- package/dist/run/cli/contribution.cjs.map +1 -1
- package/dist/run/host/lifecycle-adapter.cjs +1 -1
- package/dist/run/host/lifecycle-adapter.cjs.map +1 -1
- package/dist/run/storage/owner-identity.cjs +78 -16
- package/dist/run/storage/owner-identity.cjs.map +1 -1
- package/dist/run/storage/owner-identity.d.cts +2 -1
- package/dist/run/storage/owner-identity.d.mts +2 -1
- package/dist/run/storage/owner-identity.d.ts +2 -1
- package/dist/run/storage/sqlite.cjs +55 -55
- package/dist/run/storage/sqlite.cjs.map +1 -1
- package/dist/runner/accept.cjs +12 -42
- package/dist/runner/accept.cjs.map +1 -1
- package/dist/runner/accept.d.cts +2 -3
- package/dist/runner/accept.d.mts +2 -3
- package/dist/runner/accept.d.ts +2 -3
- package/dist/runner/adapter-usage.cjs +2 -2
- package/dist/runner/adapter-usage.cjs.map +1 -1
- package/dist/runner/adoption.cjs +14 -26
- package/dist/runner/adoption.cjs.map +1 -1
- package/dist/runner/adoption.d.cts +5 -13
- package/dist/runner/adoption.d.mts +5 -13
- package/dist/runner/adoption.d.ts +5 -13
- package/dist/runner/adoption.js +2 -4
- package/dist/runner/record.cjs +24 -18
- package/dist/runner/record.cjs.map +1 -1
- package/dist/runner/rename-experiment.cjs +5 -7
- package/dist/runner/rename-experiment.cjs.map +1 -1
- package/dist/runner/reuse-plan.cjs +37 -18
- package/dist/runner/reuse-plan.cjs.map +1 -1
- package/dist/runner/reuse-plan.d.cts +4 -1
- package/dist/runner/reuse-plan.d.mts +4 -1
- package/dist/runner/reuse-plan.d.ts +4 -1
- package/dist/runner/setup-prefix-plan.cjs +17 -12
- package/dist/runner/setup-prefix-plan.cjs.map +1 -1
- package/dist/runner/setup-prefix-plan.d.cts +0 -2
- package/dist/runner/setup-prefix-plan.d.mts +0 -2
- package/dist/runner/setup-prefix-plan.d.ts +0 -2
- package/dist/runner/setup-prefix-plan.js +8 -12
- package/dist/sandbox/backend.cjs +10 -1
- package/dist/sandbox/backend.cjs.map +1 -1
- package/dist/sandbox/backend.d.cts +16 -8
- package/dist/sandbox/backend.d.mts +16 -8
- package/dist/sandbox/backend.d.ts +16 -8
- package/dist/sandbox/backend.js +28 -26
- package/dist/sandbox/docker.cjs +7 -1
- package/dist/sandbox/docker.cjs.map +1 -1
- package/dist/sandbox/e2b-cache-repository.cjs +13 -3
- package/dist/sandbox/e2b-cache-repository.cjs.map +1 -1
- package/dist/sandbox/e2b-cache-repository.d.cts +3 -0
- package/dist/sandbox/e2b-cache-repository.d.mts +3 -0
- package/dist/sandbox/e2b-cache-repository.d.ts +3 -0
- package/dist/sandbox/e2b-cache-repository.js +16 -12
- package/dist/sandbox/e2b.cjs +2 -2
- package/dist/sandbox/e2b.cjs.map +1 -1
- package/dist/sandbox/incus/materialize.cjs +1 -1
- package/dist/sandbox/incus/materialize.cjs.map +1 -1
- package/dist/show/contribution.cjs +3 -3
- package/dist/show/contribution.cjs.map +1 -1
- package/dist/show/model.cjs +14 -13
- package/dist/show/model.cjs.map +1 -1
- package/dist/show/model.d.cts +7 -7
- package/dist/show/model.d.mts +7 -7
- package/dist/show/model.d.ts +7 -7
- package/dist/show/render.cjs +14 -0
- package/dist/show/render.cjs.map +1 -1
- package/dist/user-database/storage-worker.cjs +13 -3
- package/dist/user-database/storage-worker.cjs.map +1 -1
- package/dist/view/app-dist/.vite/manifest.json +2 -2
- package/dist/view/app-dist/assets/{index-CmVoXbwG.js → index-B3ijZRph.js} +17 -17
- package/dist/view/app-dist/assets/{quality-cost-scatter-BuLISaH4.js → quality-cost-scatter-B--DfJ9s.js} +1 -1
- package/dist/view/app-dist/index.html +1 -1
- package/dist/view/application-runtime.cjs +8 -0
- package/dist/view/application-runtime.cjs.map +1 -0
- package/dist/view/application-runtime.d.cts +9 -0
- package/dist/view/application-runtime.d.mts +9 -0
- package/dist/view/application-runtime.d.ts +9 -0
- package/dist/view/application-runtime.js +6 -0
- package/dist/view/application-runtime.js.map +1 -0
- package/dist/view/cli/contribution.cjs +5 -2
- package/dist/view/cli/contribution.cjs.map +1 -1
- package/dist/view/cli/contribution.d.cts +2 -1
- package/dist/view/cli/contribution.d.mts +2 -1
- package/dist/view/cli/contribution.d.ts +2 -1
- package/dist/view/function-runtime.mjs +1019 -456
- package/dist/view/http-protocol.d.cts +1 -9
- package/dist/view/http-protocol.d.mts +1 -9
- package/dist/view/http-protocol.d.ts +1 -9
- package/dist/view/inspection-host.cjs +39 -30
- package/dist/view/inspection-host.cjs.map +1 -1
- package/dist/view/inspection-host.d.cts +7545 -2
- package/dist/view/inspection-host.d.mts +7545 -2
- package/dist/view/inspection-host.d.ts +7545 -2
- package/dist/view/server.cjs +8 -5
- package/dist/view/server.cjs.map +1 -1
- package/dist/view/server.d.cts +4 -2
- package/dist/view/server.d.mts +4 -2
- package/dist/view/server.d.ts +4 -2
- package/docs-site/zh/reference/cli.mdx +1 -2
- package/docs-site/zh/tutorials/control-run-cost.mdx +22 -0
- package/docs-site/zh/tutorials/niceeval-taste-application.mdx +21 -0
- package/package.json +1 -1
|
@@ -16,6 +16,7 @@ const errors_ts_1 = require("../record/reader/errors.cjs");
|
|
|
16
16
|
const protocol_ts_1 = require("../run/protocol.cjs");
|
|
17
17
|
const index_ts_1 = require("../record/sqlite/index.cjs");
|
|
18
18
|
const external_record_import_ts_1 = require("../record/sqlite/external-record-import.cjs");
|
|
19
|
+
const cutoff_ts_1 = require("../run/storage/cutoff.cjs");
|
|
19
20
|
class InspectionSourceError extends effect_1.Data.TaggedError("InspectionSourceError") {
|
|
20
21
|
}
|
|
21
22
|
exports.InspectionSourceError = InspectionSourceError;
|
|
@@ -81,7 +82,8 @@ function openHostOwnedInspectionSource(recordPath) {
|
|
|
81
82
|
}
|
|
82
83
|
const EMPTY_OPERATIONAL_CUTOFF = Object.freeze({
|
|
83
84
|
identity: protocol_ts_1.EMPTY_PUBLICATION_CUTOFF_IDENTITY,
|
|
84
|
-
|
|
85
|
+
storeGeneration: protocol_ts_1.EMPTY_PUBLICATION_CUTOFF_IDENTITY,
|
|
86
|
+
revision: 0,
|
|
85
87
|
});
|
|
86
88
|
function emptyOperationalFacts() {
|
|
87
89
|
return Object.freeze({
|
|
@@ -89,6 +91,11 @@ function emptyOperationalFacts() {
|
|
|
89
91
|
cutoff: () => EMPTY_OPERATIONAL_CUTOFF,
|
|
90
92
|
findExperimentRunIds: () => Object.freeze([]),
|
|
91
93
|
readRunResource: () => undefined,
|
|
94
|
+
readRunResourcePage: () => Object.freeze({
|
|
95
|
+
cutoff: Object.freeze({ storeGeneration: protocol_ts_1.EMPTY_PUBLICATION_CUTOFF_IDENTITY, revision: 0 }),
|
|
96
|
+
runs: Object.freeze([]),
|
|
97
|
+
nextAfterRunId: null,
|
|
98
|
+
}),
|
|
92
99
|
readSealedRunSummaryPage: (afterRunId = "", _pageSize = 100, expectedCutoffIdentity) => {
|
|
93
100
|
if (expectedCutoffIdentity !== undefined && expectedCutoffIdentity !== EMPTY_OPERATIONAL_CUTOFF.identity) {
|
|
94
101
|
throw new InspectionSourceError({
|
|
@@ -97,7 +104,7 @@ function emptyOperationalFacts() {
|
|
|
97
104
|
});
|
|
98
105
|
}
|
|
99
106
|
return Object.freeze({
|
|
100
|
-
cutoff: EMPTY_OPERATIONAL_CUTOFF,
|
|
107
|
+
cutoff: Object.freeze({ identity: EMPTY_OPERATIONAL_CUTOFF.identity, runCount: 0 }),
|
|
101
108
|
afterRunId,
|
|
102
109
|
summaries: Object.freeze([]),
|
|
103
110
|
nextAfterRunId: null,
|
|
@@ -124,23 +131,15 @@ function emptyOperationalFacts() {
|
|
|
124
131
|
});
|
|
125
132
|
}
|
|
126
133
|
function sessionFacts(session, kind) {
|
|
127
|
-
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
throw new InspectionSourceError({
|
|
131
|
-
code: "inspection-source-invalid",
|
|
132
|
-
reason: "Pinned Record session changed its sealed cutoff.",
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
observedCutoff = page.cutoff;
|
|
136
|
-
return page;
|
|
137
|
-
};
|
|
138
|
-
const readPage = (afterRunId = "", pageSize = 100, expectedCutoffIdentity) => remember(session.readSealedRunSummaryPage(afterRunId, pageSize, expectedCutoffIdentity ?? observedCutoff?.identity));
|
|
134
|
+
const publication = session.publicationCutoff();
|
|
135
|
+
const cutoff = Object.freeze({ ...publication, identity: (0, cutoff_ts_1.publicationCutoffIdentity)(publication) });
|
|
136
|
+
const readPage = (afterRunId = "", pageSize = 100, expectedCutoffIdentity) => session.readSealedRunSummaryPage(afterRunId, pageSize, expectedCutoffIdentity ?? cutoff.identity);
|
|
139
137
|
return Object.freeze({
|
|
140
138
|
kind,
|
|
141
|
-
cutoff: () =>
|
|
139
|
+
cutoff: () => cutoff,
|
|
142
140
|
findExperimentRunIds: session.findExperimentRunIds,
|
|
143
141
|
readRunResource: (runId) => session.readRunResource(runId),
|
|
142
|
+
readRunResourcePage: (afterRunId = "", pageSize = 100) => session.listRunResources({ afterRunId, pageSize }),
|
|
144
143
|
readSealedRunSummaryPage: readPage,
|
|
145
144
|
findAttemptLocatorCandidates: (locator, maximumCandidateRuns) => session.findAttemptLocatorCandidates(locator, maximumCandidateRuns),
|
|
146
145
|
readSealedRunCore: (runId) => session.readSealedRunCore(runId, true),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.js","sourceRoot":"","sources":["source.ts"],"names":[],"mappings":";;;AA6CA,kEAKC;AACD,4DAKC;AAMD,oDA2BC;AAED,sEAQC;AAnGD,0CAA0C;AAC1C,wDAAwD;AACxD,8DAA8D;AAC9D,qDAAqD;AACrD,qCAAqC;AACrC,yCAA6C;AAC7C,mCAAsC;AAEtC,0DAAoE;AACpE,oDAAuE;AACvE,wDAAqU;AACrU,0FAAuF;AASvF,MAAa,qBAAsB,SAAQ,aAAI,CAAC,WAAW,CAAC,uBAAuB,CAIjF;CACD;AALD,sDAKC;AACD,4EAA4E;AAC5E,MAAa,wBAAyB,SAAQ,aAAI,CAAC,WAAW,CAAC,0BAA0B,CAGvF;CACD;AAJD,4DAIC;AAaD,gFAAgF;AAChF,SAAgB,2BAA2B,CAAC,GAAW;IACnD,OAAO,MAAM,CAAC,MAAM,CAAC;QACjB,IAAI,EAAE,gBAAyB;QAC/B,YAAY,EAAE,IA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eAAe,CAAC,KAAK,CAAC;QAClE,wBAAwB,EAAE,QAAQ;QAClC,4BAA4B,EAAE,CAAC,OAAe,EAAE,oBAA4B,EAAE,EAAE,CAAC,OAAO,CAAC,4BAA4B,CAAC,OAAO,EAAE,oBAAoB,CAAC;QACpJ,iBAAiB,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,OAAO,CAAC,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC;QAC5E,eAAe,EAAE,CAAC,SAAiB,EAAE,YAAoB,EAAE,QAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,oBAAoB,CAAC,SAAS,EAAE,YAAY,EAAE,QAAQ,CAAC;QAC/I,kBAAkB,EAAE,CAAC,YAAoB,EAAE,YAAoB,EAAE,QAAgB,EAAE,EAAE,CAAC,OAAO,CAAC,sBAAsB,CAAC,YAAY,EAAE,YAAY,EAAE,QAAQ,CAAC;KAC7J,CAAC,CAAC;AACP,CAAC;AACD,SAAS,WAAW,CAAC,KAAc;IAC/B,IAAI,KAAK,YAAY,kCAAsB,EAAE,CAAC;QAC1C,OAAO,IAAI,wBAAwB,CAAC;YAChC,IAAI,EAAE,qCAAqC;YAC3C,KAAK,EAAE,KAAK,CAAC,KAAK;SACrB,CAAC,CAAC;IACP,CAAC;IACD,OAAO,IAAI,qBAAqB,CAAC;QAC7B,IAAI,EAAE,2BAA2B;QACjC,MAAM,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,iCAAiC;QAClF,KAAK;KACR,CAAC,CAAC;AACP,CAAC","sourcesContent":["// @concord-file ne-eval-inspection-source\n// @concord-implements docs/feature/inspection/README.md\n// @concord-implements docs/feature/inspection/architecture.md\n// @concord-implements docs/feature/insight/README.md\nimport { existsSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\nimport { Data, Effect } from \"effect\";\nimport type * as Scope from \"effect/Scope\";\nimport { RecordIntegrityFailure } from \"../record/reader/errors.ts\";\nimport { EMPTY_PUBLICATION_CUTOFF_IDENTITY } from \"../run/protocol.ts\";\nimport { openHostOwnedRecordReadSession, acquireProjectRecordReadSession, RECORD_SQLITE_VALIDATION_DEADLINE_MS, type AttemptLocatorCandidates, type CollectionItemPage, type ContentChunkPage, type PinnedRecordReadSession, type SealedRunCore, type SealedRunCutoff, type SealedRunSummaryPage, } from \"../record/sqlite/index.ts\";\nimport { startExternalRecordImport } from \"../record/sqlite/external-record-import.ts\";\nimport type { ReadableRunResource } from \"../run/storage/types.ts\";\nexport type InspectionSource = {\n readonly kind: \"project-record\";\n readonly databasePath: string;\n} | {\n readonly kind: \"external-record\";\n readonly recordPath: string;\n};\nexport class InspectionSourceError extends Data.TaggedError(\"InspectionSourceError\")<{\n readonly code: \"inspection-source-invalid\";\n readonly reason: string;\n readonly cause?: unknown;\n}> {\n}\n/** Safe Inspection identity for a Record publication that is not closed. */\nexport class InspectionIntegrityError extends Data.TaggedError(\"InspectionIntegrityError\")<{\n readonly code: \"inspection-record-integrity-failure\";\n readonly runId: string;\n}> {\n}\n/** Browser-neutral fixed reader capability backed by one pinned Record generation. */\nexport interface InspectionFactSource {\n readonly kind: InspectionSource[\"kind\"];\n readonly cutoff: () => SealedRunCutoff;\n readonly findExperimentRunIds: (experimentId: string) => readonly string[];\n readonly readRunResource: (runId: string) => ReadableRunResource | undefined;\n readonly readSealedRunSummaryPage: (afterRunId?: string, pageSize?: number, expectedCutoffIdentity?: string) => SealedRunSummaryPage;\n readonly findAttemptLocatorCandidates: (locator: string, maximumCandidateRuns: number) => AttemptLocatorCandidates;\n readonly readSealedRunCore: (runId: string) => SealedRunCore | undefined;\n readonly readContentPage: (contentId: string, afterOrdinal: number, pageSize: number) => ContentChunkPage;\n readonly readCollectionPage: (attachmentId: string, afterOrdinal: number, pageSize: number) => CollectionItemPage;\n}\n/** Pure source selection; opening and validation happen only inside a Scope. */\nexport function operationalInspectionSource(cwd: string): InspectionSource {\n return Object.freeze({\n kind: \"project-record\" as const,\n databasePath: resolve(cwd, \".niceeval/record.sqlite\"),\n });\n}\nexport function externalInspectionSource(cwd: string, pathname: string): InspectionSource {\n return Object.freeze({\n kind: \"external-record\" as const,\n recordPath: resolve(cwd, pathname),\n });\n}\n/**\n * Acquires exactly one pinned Record reader. Every fixed operation in the\n * returned source sees the same generation, and Scope closes the session on\n * success, typed failure, defect, or interruption.\n */\nexport function openInspectionSource(source: InspectionSource): Effect.Effect<InspectionFactSource, InspectionSourceError | InspectionIntegrityError, Scope.Scope> {\n return Effect.gen(function* () {\n let session: PinnedRecordReadSession;\n if (source.kind === \"project-record\") {\n if (!existsSync(source.databasePath))\n return emptyOperationalFacts();\n session = yield* acquireProjectRecordReadSession(dirname(source.databasePath)).pipe(Effect.mapError(sourceError));\n }\n else {\n const importDeadline = Date.now() + RECORD_SQLITE_VALIDATION_DEADLINE_MS;\n const importer = yield* Effect.acquireRelease(Effect.try({\n try: () => startExternalRecordImport(source.recordPath, importDeadline),\n catch: (cause) => sourceError(cause),\n }), (handle) => Effect.promise(() => handle.close().catch(() => undefined)));\n const generation = yield* Effect.tryPromise({\n // Declaring the AbortSignal keeps this await interruptible. Scope then\n // terminates the Worker and removes its private generation.\n try: (_signal) => importer.result,\n catch: (cause) => sourceError(cause),\n });\n session = yield* Effect.acquireRelease(Effect.try({\n try: () => openHostOwnedRecordReadSession(generation.path),\n catch: (cause) => sourceError(cause),\n }), (opened) => Effect.sync(() => opened.close()));\n }\n return sessionFacts(session, source.kind);\n });\n}\n/** Opens one already-imported private generation without accepting a public path. */\nexport function openHostOwnedInspectionSource(recordPath: string): Effect.Effect<InspectionFactSource, InspectionSourceError | InspectionIntegrityError, Scope.Scope> {\n return Effect.gen(function* () {\n const session = yield* Effect.acquireRelease(Effect.try({\n try: () => openHostOwnedRecordReadSession(recordPath),\n catch: (cause) => sourceError(cause),\n }), (opened) => Effect.sync(() => opened.close()));\n return sessionFacts(session, \"external-record\");\n });\n}\nconst EMPTY_OPERATIONAL_CUTOFF = Object.freeze({\n identity: EMPTY_PUBLICATION_CUTOFF_IDENTITY,\n runCount: 0,\n});\nfunction emptyOperationalFacts(): InspectionFactSource {\n return Object.freeze({\n kind: \"project-record\" as const,\n cutoff: () => EMPTY_OPERATIONAL_CUTOFF,\n findExperimentRunIds: () => Object.freeze([]),\n readRunResource: () => undefined,\n readSealedRunSummaryPage: (afterRunId = \"\", _pageSize = 100, expectedCutoffIdentity?: string) => {\n if (expectedCutoffIdentity !== undefined && expectedCutoffIdentity !== EMPTY_OPERATIONAL_CUTOFF.identity) {\n throw new InspectionSourceError({\n code: \"inspection-source-invalid\",\n reason: \"The empty operational publication cutoff changed; restart pagination.\",\n });\n }\n return Object.freeze({\n cutoff: EMPTY_OPERATIONAL_CUTOFF,\n afterRunId,\n summaries: Object.freeze([]),\n nextAfterRunId: null,\n });\n },\n findAttemptLocatorCandidates: (locator: string) => Object.freeze({\n locator,\n ambiguous: false,\n candidates: Object.freeze([]),\n }),\n readSealedRunCore: () => undefined,\n readContentPage: (contentId: string, afterOrdinal: number) => Object.freeze({\n contentId,\n afterOrdinal,\n chunks: Object.freeze([]),\n nextOrdinal: null,\n }),\n readCollectionPage: (attachmentId: string, afterOrdinal: number) => Object.freeze({\n attachmentId,\n afterOrdinal,\n items: Object.freeze([]),\n nextOrdinal: null,\n }),\n });\n}\nfunction sessionFacts(session: PinnedRecordReadSession, kind: InspectionSource[\"kind\"]): InspectionFactSource {\n let observedCutoff: SealedRunCutoff | undefined;\n const remember = (page: SealedRunSummaryPage): SealedRunSummaryPage => {\n if (observedCutoff !== undefined && observedCutoff.identity !== page.cutoff.identity) {\n throw new InspectionSourceError({\n code: \"inspection-source-invalid\",\n reason: \"Pinned Record session changed its sealed cutoff.\",\n });\n }\n observedCutoff = page.cutoff;\n return page;\n };\n const readPage = (afterRunId = \"\", pageSize = 100, expectedCutoffIdentity?: string): SealedRunSummaryPage => remember(session.readSealedRunSummaryPage(afterRunId, pageSize, expectedCutoffIdentity ?? observedCutoff?.identity));\n return Object.freeze({\n kind,\n cutoff: () => observedCutoff ??= session.sealedCutoff(),\n findExperimentRunIds: session.findExperimentRunIds,\n readRunResource: (runId: string) => session.readRunResource(runId),\n readSealedRunSummaryPage: readPage,\n findAttemptLocatorCandidates: (locator: string, maximumCandidateRuns: number) => session.findAttemptLocatorCandidates(locator, maximumCandidateRuns),\n readSealedRunCore: (runId: string) => session.readSealedRunCore(runId, true),\n readContentPage: (contentId: string, afterOrdinal: number, pageSize: number) => session.readContentChunkPage(contentId, afterOrdinal, pageSize),\n readCollectionPage: (attachmentId: string, afterOrdinal: number, pageSize: number) => session.readCollectionItemPage(attachmentId, afterOrdinal, pageSize),\n });\n}\nfunction sourceError(cause: unknown): InspectionSourceError | InspectionIntegrityError {\n if (cause instanceof RecordIntegrityFailure) {\n return new InspectionIntegrityError({\n code: \"inspection-record-integrity-failure\",\n runId: cause.runId,\n });\n }\n return new InspectionSourceError({\n code: \"inspection-source-invalid\",\n reason: cause instanceof Error ? cause.message : \"Record source validation failed\",\n cause,\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"source.js","sourceRoot":"","sources":["source.ts"],"names":[],"mappings":";;;AAiDA,kEAKC;AACD,4DAKC;AAMD,oDA2BC;AAED,sEAQC;AAvGD,0CAA0C;AAC1C,wDAAwD;AACxD,8DAA8D;AAC9D,qDAAqD;AACrD,qCAAqC;AACrC,yCAA6C;AAC7C,mCAAsC;AAEtC,0DAAoE;AACpE,oDAAuE;AACvE,wDAA+S;AAC/S,0FAAuF;AACvF,wDAAqE;AASrE,MAAa,qBAAsB,SAAQ,aAAI,CAAC,WAAW,CAAC,uBAAuB,CAIjF;CACD;AALD,sDAKC;AACD,4EAA4E;AAC5E,MAAa,wBAAyB,SAAQ,aAAI,CAAC,WAAW,CAAC,0BAA0B,CAGvF;CACD;AAJD,4DAIC;AAgBD,gFAAgF;AAChF,SAAgB,2BAA2B,CAAC,GAAW;IACnD,OAAO,MAAM,CAAC,MAAM,CAAC;QACjB,IAAI,EAAE,g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,OAAO,CAAC,CAAC,CAAC,iCAAiC;QAClF,KAAK;KACR,CAAC,CAAC;AACP,CAAC","sourcesContent":["// @concord-file ne-eval-inspection-source\n// @concord-implements docs/feature/inspection/README.md\n// @concord-implements docs/feature/inspection/architecture.md\n// @concord-implements docs/feature/insight/README.md\nimport { existsSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\nimport { Data, Effect } from \"effect\";\nimport type * as Scope from \"effect/Scope\";\nimport { RecordIntegrityFailure } from \"../record/reader/errors.ts\";\nimport { EMPTY_PUBLICATION_CUTOFF_IDENTITY } from \"../run/protocol.ts\";\nimport { openHostOwnedRecordReadSession, acquireProjectRecordReadSession, RECORD_SQLITE_VALIDATION_DEADLINE_MS, type AttemptLocatorCandidates, type CollectionItemPage, type ContentChunkPage, type PinnedRecordReadSession, type SealedRunCore, type SealedRunSummaryPage, } from \"../record/sqlite/index.ts\";\nimport { startExternalRecordImport } from \"../record/sqlite/external-record-import.ts\";\nimport { publicationCutoffIdentity } from \"../run/storage/cutoff.ts\";\nimport type { PublicationCutoff, ReadableRunResource, RunResourcePage } from \"../run/storage/types.ts\";\nexport type InspectionSource = {\n readonly kind: \"project-record\";\n readonly databasePath: string;\n} | {\n readonly kind: \"external-record\";\n readonly recordPath: string;\n};\nexport class InspectionSourceError extends Data.TaggedError(\"InspectionSourceError\")<{\n readonly code: \"inspection-source-invalid\";\n readonly reason: string;\n readonly cause?: unknown;\n}> {\n}\n/** Safe Inspection identity for a Record publication that is not closed. */\nexport class InspectionIntegrityError extends Data.TaggedError(\"InspectionIntegrityError\")<{\n readonly code: \"inspection-record-integrity-failure\";\n readonly runId: string;\n}> {\n}\n/** Browser-neutral fixed reader capability backed by one pinned Record generation. */\nexport interface InspectionFactSource {\n readonly kind: InspectionSource[\"kind\"];\n readonly cutoff: () => PublicationCutoff & {\n readonly identity: string;\n };\n readonly findExperimentRunIds: (experimentId: string) => readonly string[];\n readonly readRunResource: (runId: string) => ReadableRunResource | undefined;\n readonly readRunResourcePage: (afterRunId?: string, pageSize?: number) => RunResourcePage;\n readonly readSealedRunSummaryPage: (afterRunId?: string, pageSize?: number, expectedCutoffIdentity?: string) => SealedRunSummaryPage;\n readonly findAttemptLocatorCandidates: (locator: string, maximumCandidateRuns: number) => AttemptLocatorCandidates;\n readonly readSealedRunCore: (runId: string) => SealedRunCore | undefined;\n readonly readContentPage: (contentId: string, afterOrdinal: number, pageSize: number) => ContentChunkPage;\n readonly readCollectionPage: (attachmentId: string, afterOrdinal: number, pageSize: number) => CollectionItemPage;\n}\n/** Pure source selection; opening and validation happen only inside a Scope. */\nexport function operationalInspectionSource(cwd: string): InspectionSource {\n return Object.freeze({\n kind: \"project-record\" as const,\n databasePath: resolve(cwd, \".niceeval/record.sqlite\"),\n });\n}\nexport function externalInspectionSource(cwd: string, pathname: string): InspectionSource {\n return Object.freeze({\n kind: \"external-record\" as const,\n recordPath: resolve(cwd, pathname),\n });\n}\n/**\n * Acquires exactly one pinned Record reader. Every fixed operation in the\n * returned source sees the same generation, and Scope closes the session on\n * success, typed failure, defect, or interruption.\n */\nexport function openInspectionSource(source: InspectionSource): Effect.Effect<InspectionFactSource, InspectionSourceError | InspectionIntegrityError, Scope.Scope> {\n return Effect.gen(function* () {\n let session: PinnedRecordReadSession;\n if (source.kind === \"project-record\") {\n if (!existsSync(source.databasePath))\n return emptyOperationalFacts();\n session = yield* acquireProjectRecordReadSession(dirname(source.databasePath)).pipe(Effect.mapError(sourceError));\n }\n else {\n const importDeadline = Date.now() + RECORD_SQLITE_VALIDATION_DEADLINE_MS;\n const importer = yield* Effect.acquireRelease(Effect.try({\n try: () => startExternalRecordImport(source.recordPath, importDeadline),\n catch: (cause) => sourceError(cause),\n }), (handle) => Effect.promise(() => handle.close().catch(() => undefined)));\n const generation = yield* Effect.tryPromise({\n // Declaring the AbortSignal keeps this await interruptible. Scope then\n // terminates the Worker and removes its private generation.\n try: (_signal) => importer.result,\n catch: (cause) => sourceError(cause),\n });\n session = yield* Effect.acquireRelease(Effect.try({\n try: () => openHostOwnedRecordReadSession(generation.path),\n catch: (cause) => sourceError(cause),\n }), (opened) => Effect.sync(() => opened.close()));\n }\n return sessionFacts(session, source.kind);\n });\n}\n/** Opens one already-imported private generation without accepting a public path. */\nexport function openHostOwnedInspectionSource(recordPath: string): Effect.Effect<InspectionFactSource, InspectionSourceError | InspectionIntegrityError, Scope.Scope> {\n return Effect.gen(function* () {\n const session = yield* Effect.acquireRelease(Effect.try({\n try: () => openHostOwnedRecordReadSession(recordPath),\n catch: (cause) => sourceError(cause),\n }), (opened) => Effect.sync(() => opened.close()));\n return sessionFacts(session, \"external-record\");\n });\n}\nconst EMPTY_OPERATIONAL_CUTOFF = Object.freeze({\n identity: EMPTY_PUBLICATION_CUTOFF_IDENTITY,\n storeGeneration: EMPTY_PUBLICATION_CUTOFF_IDENTITY,\n revision: 0,\n});\nfunction emptyOperationalFacts(): InspectionFactSource {\n return Object.freeze({\n kind: \"project-record\" as const,\n cutoff: () => EMPTY_OPERATIONAL_CUTOFF,\n findExperimentRunIds: () => Object.freeze([]),\n readRunResource: () => undefined,\n readRunResourcePage: () => Object.freeze({\n cutoff: Object.freeze({ storeGeneration: EMPTY_PUBLICATION_CUTOFF_IDENTITY, revision: 0 }),\n runs: Object.freeze([]),\n nextAfterRunId: null,\n }),\n readSealedRunSummaryPage: (afterRunId = \"\", _pageSize = 100, expectedCutoffIdentity?: string) => {\n if (expectedCutoffIdentity !== undefined && expectedCutoffIdentity !== EMPTY_OPERATIONAL_CUTOFF.identity) {\n throw new InspectionSourceError({\n code: \"inspection-source-invalid\",\n reason: \"The empty operational publication cutoff changed; restart pagination.\",\n });\n }\n return Object.freeze({\n cutoff: Object.freeze({ identity: EMPTY_OPERATIONAL_CUTOFF.identity, runCount: 0 }),\n afterRunId,\n summaries: Object.freeze([]),\n nextAfterRunId: null,\n });\n },\n findAttemptLocatorCandidates: (locator: string) => Object.freeze({\n locator,\n ambiguous: false,\n candidates: Object.freeze([]),\n }),\n readSealedRunCore: () => undefined,\n readContentPage: (contentId: string, afterOrdinal: number) => Object.freeze({\n contentId,\n afterOrdinal,\n chunks: Object.freeze([]),\n nextOrdinal: null,\n }),\n readCollectionPage: (attachmentId: string, afterOrdinal: number) => Object.freeze({\n attachmentId,\n afterOrdinal,\n items: Object.freeze([]),\n nextOrdinal: null,\n }),\n });\n}\nfunction sessionFacts(session: PinnedRecordReadSession, kind: InspectionSource[\"kind\"]): InspectionFactSource {\n const publication = session.publicationCutoff();\n const cutoff = Object.freeze({ ...publication, identity: publicationCutoffIdentity(publication) });\n const readPage = (afterRunId = \"\", pageSize = 100, expectedCutoffIdentity?: string): SealedRunSummaryPage => session.readSealedRunSummaryPage(afterRunId, pageSize, expectedCutoffIdentity ?? cutoff.identity);\n return Object.freeze({\n kind,\n cutoff: () => cutoff,\n findExperimentRunIds: session.findExperimentRunIds,\n readRunResource: (runId: string) => session.readRunResource(runId),\n readRunResourcePage: (afterRunId = \"\", pageSize = 100) => session.listRunResources({ afterRunId, pageSize }),\n readSealedRunSummaryPage: readPage,\n findAttemptLocatorCandidates: (locator: string, maximumCandidateRuns: number) => session.findAttemptLocatorCandidates(locator, maximumCandidateRuns),\n readSealedRunCore: (runId: string) => session.readSealedRunCore(runId, true),\n readContentPage: (contentId: string, afterOrdinal: number, pageSize: number) => session.readContentChunkPage(contentId, afterOrdinal, pageSize),\n readCollectionPage: (attachmentId: string, afterOrdinal: number, pageSize: number) => session.readCollectionItemPage(attachmentId, afterOrdinal, pageSize),\n });\n}\nfunction sourceError(cause: unknown): InspectionSourceError | InspectionIntegrityError {\n if (cause instanceof RecordIntegrityFailure) {\n return new InspectionIntegrityError({\n code: \"inspection-record-integrity-failure\",\n runId: cause.runId,\n });\n }\n return new InspectionSourceError({\n code: \"inspection-source-invalid\",\n reason: cause instanceof Error ? cause.message : \"Record source validation failed\",\n cause,\n });\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import type * as Scope from "effect/Scope";
|
|
3
|
-
import { type AttemptLocatorCandidates, type CollectionItemPage, type ContentChunkPage, type SealedRunCore, type
|
|
4
|
-
import type { ReadableRunResource } from "../run/storage/types.cjs";
|
|
3
|
+
import { type AttemptLocatorCandidates, type CollectionItemPage, type ContentChunkPage, type SealedRunCore, type SealedRunSummaryPage } from "../record/sqlite/index.cjs";
|
|
4
|
+
import type { PublicationCutoff, ReadableRunResource, RunResourcePage } from "../run/storage/types.cjs";
|
|
5
5
|
export type InspectionSource = {
|
|
6
6
|
readonly kind: "project-record";
|
|
7
7
|
readonly databasePath: string;
|
|
@@ -30,9 +30,12 @@ export declare class InspectionIntegrityError extends InspectionIntegrityError_b
|
|
|
30
30
|
/** Browser-neutral fixed reader capability backed by one pinned Record generation. */
|
|
31
31
|
export interface InspectionFactSource {
|
|
32
32
|
readonly kind: InspectionSource["kind"];
|
|
33
|
-
readonly cutoff: () =>
|
|
33
|
+
readonly cutoff: () => PublicationCutoff & {
|
|
34
|
+
readonly identity: string;
|
|
35
|
+
};
|
|
34
36
|
readonly findExperimentRunIds: (experimentId: string) => readonly string[];
|
|
35
37
|
readonly readRunResource: (runId: string) => ReadableRunResource | undefined;
|
|
38
|
+
readonly readRunResourcePage: (afterRunId?: string, pageSize?: number) => RunResourcePage;
|
|
36
39
|
readonly readSealedRunSummaryPage: (afterRunId?: string, pageSize?: number, expectedCutoffIdentity?: string) => SealedRunSummaryPage;
|
|
37
40
|
readonly findAttemptLocatorCandidates: (locator: string, maximumCandidateRuns: number) => AttemptLocatorCandidates;
|
|
38
41
|
readonly readSealedRunCore: (runId: string) => SealedRunCore | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import type * as Scope from "effect/Scope";
|
|
3
|
-
import { type AttemptLocatorCandidates, type CollectionItemPage, type ContentChunkPage, type SealedRunCore, type
|
|
4
|
-
import type { ReadableRunResource } from "../run/storage/types.mjs";
|
|
3
|
+
import { type AttemptLocatorCandidates, type CollectionItemPage, type ContentChunkPage, type SealedRunCore, type SealedRunSummaryPage } from "../record/sqlite/index.mjs";
|
|
4
|
+
import type { PublicationCutoff, ReadableRunResource, RunResourcePage } from "../run/storage/types.mjs";
|
|
5
5
|
export type InspectionSource = {
|
|
6
6
|
readonly kind: "project-record";
|
|
7
7
|
readonly databasePath: string;
|
|
@@ -30,9 +30,12 @@ export declare class InspectionIntegrityError extends InspectionIntegrityError_b
|
|
|
30
30
|
/** Browser-neutral fixed reader capability backed by one pinned Record generation. */
|
|
31
31
|
export interface InspectionFactSource {
|
|
32
32
|
readonly kind: InspectionSource["kind"];
|
|
33
|
-
readonly cutoff: () =>
|
|
33
|
+
readonly cutoff: () => PublicationCutoff & {
|
|
34
|
+
readonly identity: string;
|
|
35
|
+
};
|
|
34
36
|
readonly findExperimentRunIds: (experimentId: string) => readonly string[];
|
|
35
37
|
readonly readRunResource: (runId: string) => ReadableRunResource | undefined;
|
|
38
|
+
readonly readRunResourcePage: (afterRunId?: string, pageSize?: number) => RunResourcePage;
|
|
36
39
|
readonly readSealedRunSummaryPage: (afterRunId?: string, pageSize?: number, expectedCutoffIdentity?: string) => SealedRunSummaryPage;
|
|
37
40
|
readonly findAttemptLocatorCandidates: (locator: string, maximumCandidateRuns: number) => AttemptLocatorCandidates;
|
|
38
41
|
readonly readSealedRunCore: (runId: string) => SealedRunCore | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import type * as Scope from "effect/Scope";
|
|
3
|
-
import { type AttemptLocatorCandidates, type CollectionItemPage, type ContentChunkPage, type SealedRunCore, type
|
|
4
|
-
import type { ReadableRunResource } from "../run/storage/types.js";
|
|
3
|
+
import { type AttemptLocatorCandidates, type CollectionItemPage, type ContentChunkPage, type SealedRunCore, type SealedRunSummaryPage } from "../record/sqlite/index.js";
|
|
4
|
+
import type { PublicationCutoff, ReadableRunResource, RunResourcePage } from "../run/storage/types.js";
|
|
5
5
|
export type InspectionSource = {
|
|
6
6
|
readonly kind: "project-record";
|
|
7
7
|
readonly databasePath: string;
|
|
@@ -30,9 +30,12 @@ export declare class InspectionIntegrityError extends InspectionIntegrityError_b
|
|
|
30
30
|
/** Browser-neutral fixed reader capability backed by one pinned Record generation. */
|
|
31
31
|
export interface InspectionFactSource {
|
|
32
32
|
readonly kind: InspectionSource["kind"];
|
|
33
|
-
readonly cutoff: () =>
|
|
33
|
+
readonly cutoff: () => PublicationCutoff & {
|
|
34
|
+
readonly identity: string;
|
|
35
|
+
};
|
|
34
36
|
readonly findExperimentRunIds: (experimentId: string) => readonly string[];
|
|
35
37
|
readonly readRunResource: (runId: string) => ReadableRunResource | undefined;
|
|
38
|
+
readonly readRunResourcePage: (afterRunId?: string, pageSize?: number) => RunResourcePage;
|
|
36
39
|
readonly readSealedRunSummaryPage: (afterRunId?: string, pageSize?: number, expectedCutoffIdentity?: string) => SealedRunSummaryPage;
|
|
37
40
|
readonly findAttemptLocatorCandidates: (locator: string, maximumCandidateRuns: number) => AttemptLocatorCandidates;
|
|
38
41
|
readonly readSealedRunCore: (runId: string) => SealedRunCore | undefined;
|
|
@@ -1105,7 +1105,7 @@ function projectApplicationUsage(attachments, models) {
|
|
|
1105
1105
|
const read = readAdapterUsageAttachment(attachments.adapterUsage, models);
|
|
1106
1106
|
const modelUsage = (0, adapter_usage_projection_ts_1.projectAdapterModelUsage)(read.state === "available" ? read.value : null, models, {
|
|
1107
1107
|
basis: "recorded-calls", reason: read.state === "invalid" ? "source-invalid" : "usage-not-recorded",
|
|
1108
|
-
});
|
|
1108
|
+
}, attachments.adapterUsage.physical.familyRevision === 4);
|
|
1109
1109
|
const empty = {
|
|
1110
1110
|
source: "adapter",
|
|
1111
1111
|
coverage: "recorded-calls",
|