@leostera/evalkit 0.2.0 → 0.4.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/CHANGELOG.md +81 -0
- package/README.md +8 -7
- package/dist/cli.mjs +909 -149
- package/dist/cli.mjs.map +1 -1
- package/dist/dashboard/assets/index-D9NtA46z.css +2 -0
- package/dist/dashboard/assets/index-DrBwLKJD.js +30 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/files-C-U0-PWW.mjs +26 -0
- package/dist/files-C-U0-PWW.mjs.map +1 -0
- package/dist/{index-M5eRlMfd.d.mts → index-U6TUTBf7.d.mts} +87 -9
- package/dist/index-U6TUTBf7.d.mts.map +1 -0
- package/dist/index-db-HdZXelOS.d.mts +142 -0
- package/dist/index-db-HdZXelOS.d.mts.map +1 -0
- package/dist/index-db-vbqEGFaU.mjs +548 -0
- package/dist/index-db-vbqEGFaU.mjs.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/runner.d.mts +21 -3
- package/dist/runner.d.mts.map +1 -1
- package/dist/runner.mjs +1 -1
- package/dist/share-worker.d.mts +51 -0
- package/dist/share-worker.d.mts.map +1 -0
- package/dist/share-worker.mjs +73 -0
- package/dist/share-worker.mjs.map +1 -0
- package/dist/share.d.mts +116 -0
- package/dist/share.d.mts.map +1 -0
- package/dist/share.mjs +4 -0
- package/dist/{src-DrwwgaPn.mjs → src-ButXPY8P.mjs} +20 -5
- package/dist/src-ButXPY8P.mjs.map +1 -0
- package/dist/{src-DluldGKn.mjs → src-DoPs9Yug.mjs} +11 -7
- package/dist/src-DoPs9Yug.mjs.map +1 -0
- package/dist/src-DzZueFn3.mjs +98 -0
- package/dist/src-DzZueFn3.mjs.map +1 -0
- package/package.json +10 -1
- package/dist/dashboard/assets/index-Z6raM-uW.js +0 -30
- package/dist/dashboard/assets/index-fUDsY6z-.css +0 -2
- package/dist/index-M5eRlMfd.d.mts.map +0 -1
- package/dist/src-DluldGKn.mjs.map +0 -1
- package/dist/src-DrwwgaPn.mjs.map +0 -1
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>EvalKit</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-DrBwLKJD.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="/assets/index-D9NtA46z.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
11
11
|
<div id="root"></div>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//#region ../share/src/files.ts
|
|
2
|
+
function r2Files(bucket) {
|
|
3
|
+
return {
|
|
4
|
+
async get(key) {
|
|
5
|
+
return (await bucket.get(key))?.body ?? null;
|
|
6
|
+
},
|
|
7
|
+
async put(key, data) {
|
|
8
|
+
await bucket.put(key, data);
|
|
9
|
+
},
|
|
10
|
+
async *list(prefix) {
|
|
11
|
+
let cursor;
|
|
12
|
+
do {
|
|
13
|
+
const page = await bucket.list({
|
|
14
|
+
prefix,
|
|
15
|
+
cursor
|
|
16
|
+
});
|
|
17
|
+
for (const object of page.objects) yield object.key;
|
|
18
|
+
cursor = page.truncated ? page.cursor : void 0;
|
|
19
|
+
} while (cursor);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { r2Files as t };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=files-C-U0-PWW.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files-C-U0-PWW.mjs","names":[],"sources":["../../share/src/files.ts"],"sourcesContent":["/** Where uploaded result files live: R2 in a Worker, a directory elsewhere. */\nexport type ShareFiles = {\n get(key: string): Promise<ReadableStream<Uint8Array> | Uint8Array | null>;\n put(key: string, data: Uint8Array | string): Promise<void>;\n /** Every key below `prefix`, in no particular order. */\n list(prefix: string): AsyncIterable<string>;\n};\n\n/** The subset of the Workers R2 binding used here. */\nexport type R2BucketLike = {\n get(key: string): Promise<{ body: ReadableStream<Uint8Array> } | null>;\n put(key: string, value: Uint8Array | string): Promise<unknown>;\n list(options: { prefix: string; cursor?: string }): Promise<{\n objects: { key: string }[];\n truncated: boolean;\n cursor?: string;\n }>;\n};\n\nexport function r2Files(bucket: R2BucketLike): ShareFiles {\n return {\n async get(key) {\n return (await bucket.get(key))?.body ?? null;\n },\n async put(key, data) {\n await bucket.put(key, data);\n },\n async *list(prefix) {\n let cursor: string | undefined;\n do {\n const page = await bucket.list({ prefix, cursor });\n for (const object of page.objects) yield object.key;\n cursor = page.truncated ? page.cursor : undefined;\n } while (cursor);\n },\n };\n}\n"],"mappings":";AAmBA,SAAgB,QAAQ,QAAkC;CACxD,OAAO;EACL,MAAM,IAAI,KAAK;GACb,QAAQ,MAAM,OAAO,IAAI,GAAG,EAAA,EAAI,QAAQ;EAC1C;EACA,MAAM,IAAI,KAAK,MAAM;GACnB,MAAM,OAAO,IAAI,KAAK,IAAI;EAC5B;EACA,OAAO,KAAK,QAAQ;GAClB,IAAI;GACJ,GAAG;IACD,MAAM,OAAO,MAAM,OAAO,KAAK;KAAE;KAAQ;IAAO,CAAC;IACjD,KAAK,MAAM,UAAU,KAAK,SAAS,MAAM,OAAO;IAChD,SAAS,KAAK,YAAY,KAAK,SAAS,KAAA;GAC1C,SAAS;EACX;CACF;AACF"}
|
|
@@ -76,6 +76,10 @@ type EvalkitConfig = {
|
|
|
76
76
|
};
|
|
77
77
|
reportDir?: string;
|
|
78
78
|
sandboxDir?: string;
|
|
79
|
+
/** Where `evalkit share` uploads results. `EVALKIT_SHARE_URL` overrides it. */
|
|
80
|
+
share?: {
|
|
81
|
+
url: string;
|
|
82
|
+
};
|
|
79
83
|
};
|
|
80
84
|
/** Pure, typed project configuration. Loading/discovery belongs to the CLI. */
|
|
81
85
|
declare function defineConfig<const T extends EvalkitConfig>(configuration: T): T;
|
|
@@ -95,8 +99,22 @@ declare const AutIdentitySchema: Schema.Struct<{
|
|
|
95
99
|
version: Schema.optional<typeof Schema.String>;
|
|
96
100
|
}>;
|
|
97
101
|
declare const JsonValueSchema: Schema.Schema<JsonValue>;
|
|
102
|
+
declare const RunSourceSchema: Schema.Struct<{
|
|
103
|
+
repo: typeof Schema.String;
|
|
104
|
+
project: typeof Schema.String;
|
|
105
|
+
commit: typeof Schema.String;
|
|
106
|
+
ref: Schema.optional<typeof Schema.String>;
|
|
107
|
+
committedAt: Schema.optional<typeof Schema.String>;
|
|
108
|
+
dirty: typeof Schema.Boolean;
|
|
109
|
+
ci: Schema.optional<Schema.Struct<{
|
|
110
|
+
provider: typeof Schema.String;
|
|
111
|
+
pipeline: Schema.optional<typeof Schema.String>;
|
|
112
|
+
job: Schema.optional<typeof Schema.String>;
|
|
113
|
+
url: Schema.optional<typeof Schema.String>;
|
|
114
|
+
}>>;
|
|
115
|
+
}>;
|
|
98
116
|
declare const RunMetadataSchema: Schema.Struct<{
|
|
99
|
-
schemaVersion: Schema.Literal<[2, 3]>;
|
|
117
|
+
schemaVersion: Schema.Literal<[2, 3, 4]>;
|
|
100
118
|
runUri: Schema.filter<typeof Schema.String>;
|
|
101
119
|
evalId: typeof Schema.String;
|
|
102
120
|
suiteId: Schema.optional<typeof Schema.String>;
|
|
@@ -112,9 +130,23 @@ declare const RunMetadataSchema: Schema.Struct<{
|
|
|
112
130
|
version: Schema.optional<typeof Schema.String>;
|
|
113
131
|
}>>;
|
|
114
132
|
startedAt: typeof Schema.String;
|
|
133
|
+
source: Schema.optional<Schema.Struct<{
|
|
134
|
+
repo: typeof Schema.String;
|
|
135
|
+
project: typeof Schema.String;
|
|
136
|
+
commit: typeof Schema.String;
|
|
137
|
+
ref: Schema.optional<typeof Schema.String>;
|
|
138
|
+
committedAt: Schema.optional<typeof Schema.String>;
|
|
139
|
+
dirty: typeof Schema.Boolean;
|
|
140
|
+
ci: Schema.optional<Schema.Struct<{
|
|
141
|
+
provider: typeof Schema.String;
|
|
142
|
+
pipeline: Schema.optional<typeof Schema.String>;
|
|
143
|
+
job: Schema.optional<typeof Schema.String>;
|
|
144
|
+
url: Schema.optional<typeof Schema.String>;
|
|
145
|
+
}>>;
|
|
146
|
+
}>>;
|
|
115
147
|
}>;
|
|
116
148
|
declare const TrialMetadataSchema: Schema.Struct<{
|
|
117
|
-
schemaVersion: Schema.Literal<[2, 3]>;
|
|
149
|
+
schemaVersion: Schema.Literal<[2, 3, 4]>;
|
|
118
150
|
runUri: Schema.filter<typeof Schema.String>;
|
|
119
151
|
trialUri: Schema.filter<typeof Schema.String>;
|
|
120
152
|
trialIndex: typeof Schema.Number;
|
|
@@ -134,7 +166,7 @@ declare const TrialMetadataSchema: Schema.Struct<{
|
|
|
134
166
|
}>;
|
|
135
167
|
/** On-disk manifests include a lifecycle status; older finalized manifests may still say running. */
|
|
136
168
|
declare const RunManifestSchema: Schema.Struct<{
|
|
137
|
-
schemaVersion: Schema.Literal<[2, 3]>;
|
|
169
|
+
schemaVersion: Schema.Literal<[2, 3, 4]>;
|
|
138
170
|
runUri: Schema.filter<typeof Schema.String>;
|
|
139
171
|
evalId: typeof Schema.String;
|
|
140
172
|
suiteId: Schema.optional<typeof Schema.String>;
|
|
@@ -150,10 +182,24 @@ declare const RunManifestSchema: Schema.Struct<{
|
|
|
150
182
|
version: Schema.optional<typeof Schema.String>;
|
|
151
183
|
}>>;
|
|
152
184
|
startedAt: typeof Schema.String;
|
|
185
|
+
source: Schema.optional<Schema.Struct<{
|
|
186
|
+
repo: typeof Schema.String;
|
|
187
|
+
project: typeof Schema.String;
|
|
188
|
+
commit: typeof Schema.String;
|
|
189
|
+
ref: Schema.optional<typeof Schema.String>;
|
|
190
|
+
committedAt: Schema.optional<typeof Schema.String>;
|
|
191
|
+
dirty: typeof Schema.Boolean;
|
|
192
|
+
ci: Schema.optional<Schema.Struct<{
|
|
193
|
+
provider: typeof Schema.String;
|
|
194
|
+
pipeline: Schema.optional<typeof Schema.String>;
|
|
195
|
+
job: Schema.optional<typeof Schema.String>;
|
|
196
|
+
url: Schema.optional<typeof Schema.String>;
|
|
197
|
+
}>>;
|
|
198
|
+
}>>;
|
|
153
199
|
status: Schema.optional<Schema.Literal<["running", "completed", "failed", "cancelled"]>>;
|
|
154
200
|
}>;
|
|
155
201
|
declare const TrialManifestSchema: Schema.Struct<{
|
|
156
|
-
schemaVersion: Schema.Literal<[2, 3]>;
|
|
202
|
+
schemaVersion: Schema.Literal<[2, 3, 4]>;
|
|
157
203
|
runUri: Schema.filter<typeof Schema.String>;
|
|
158
204
|
trialUri: Schema.filter<typeof Schema.String>;
|
|
159
205
|
trialIndex: typeof Schema.Number;
|
|
@@ -815,8 +861,36 @@ type EvalCatalogEntry = {
|
|
|
815
861
|
*/
|
|
816
862
|
declare function registerEvals<const TRegistrations extends readonly EvalRegistration[]>(registrations: TRegistrations): EvalRegistry;
|
|
817
863
|
type RunStatus = 'running' | 'completed' | 'failed' | 'cancelled';
|
|
864
|
+
/**
|
|
865
|
+
* Where a run's eval code came from: the repository, eval project and commit.
|
|
866
|
+
* Results are tagged with it; they are never stored in the repository itself.
|
|
867
|
+
*/
|
|
868
|
+
type RunSource = {
|
|
869
|
+
/** Normalized repository key, e.g. `gitlab.example.com/group/repo`. */
|
|
870
|
+
repo: string;
|
|
871
|
+
/** Eval project directory relative to the repository root; `""` at the root. */
|
|
872
|
+
project: string;
|
|
873
|
+
/** Full commit SHA. */
|
|
874
|
+
commit: string;
|
|
875
|
+
ref?: string;
|
|
876
|
+
committedAt?: string;
|
|
877
|
+
/** True when the working tree had uncommitted changes at run time. */
|
|
878
|
+
dirty: boolean;
|
|
879
|
+
ci?: {
|
|
880
|
+
provider: string;
|
|
881
|
+
pipeline?: string;
|
|
882
|
+
job?: string;
|
|
883
|
+
url?: string;
|
|
884
|
+
};
|
|
885
|
+
};
|
|
886
|
+
/** The project's evals and suites when a run started; written beside its manifest. */
|
|
887
|
+
type RunCatalog = {
|
|
888
|
+
catalog: EvalCatalogEntry[];
|
|
889
|
+
evals: EvalRegistryMetadata[];
|
|
890
|
+
suites: EvalSuiteMetadata[];
|
|
891
|
+
};
|
|
818
892
|
type RunMetadata = {
|
|
819
|
-
schemaVersion: 2 | 3;
|
|
893
|
+
schemaVersion: 2 | 3 | 4;
|
|
820
894
|
runId: string;
|
|
821
895
|
runUri: ResourceUri<'run'>;
|
|
822
896
|
evalId: string;
|
|
@@ -828,9 +902,11 @@ type RunMetadata = {
|
|
|
828
902
|
};
|
|
829
903
|
aut?: AutIdentity;
|
|
830
904
|
startedAt: string;
|
|
905
|
+
/** Present from schema version 4 when the run's commit could be determined. */
|
|
906
|
+
source?: RunSource;
|
|
831
907
|
};
|
|
832
908
|
type TrialMetadata = {
|
|
833
|
-
schemaVersion: 2 | 3;
|
|
909
|
+
schemaVersion: 2 | 3 | 4;
|
|
834
910
|
runId: string;
|
|
835
911
|
runUri: ResourceUri<'run'>;
|
|
836
912
|
trialId: string;
|
|
@@ -905,7 +981,9 @@ type RunWriter = {
|
|
|
905
981
|
finalize(summary: RunSummary): Promise<void>;
|
|
906
982
|
};
|
|
907
983
|
type ReportStore = {
|
|
908
|
-
startRun(metadata: RunMetadata
|
|
984
|
+
startRun(metadata: RunMetadata, context?: {
|
|
985
|
+
catalog?: RunCatalog;
|
|
986
|
+
}): Promise<RunWriter>;
|
|
909
987
|
};
|
|
910
988
|
type TrialResult = {
|
|
911
989
|
runId: string;
|
|
@@ -937,5 +1015,5 @@ type RunResult = TrialResult & {
|
|
|
937
1015
|
};
|
|
938
1016
|
declare function recordError(error: unknown): RecordedError;
|
|
939
1017
|
//#endregion
|
|
940
|
-
export {
|
|
941
|
-
//# sourceMappingURL=index-
|
|
1018
|
+
export { TrajectoryEvent as $, ResourceKindSchema as $t, FixtureContext as A, JsonValueSchema as At, ReportStore as B, TrialManifestSchema as Bt, EvalRegistryMetadata as C, registerEvals as Ct, ExpectToolCallStep as D, ArtifactEntrySchema as Dt, EvaluatorWorkspace as E, ApiErrorSchema as Et, JsonValue as F, RunSourceSchema as Ft, RunStatus as G, EvalkitConfig as Gt, RunMetadata as H, TrialScoringSchema as Ht, JudgeRule as I, RunStatusSchema as It, RunnerEvent as J, EvalMatrixCell as Jt, RunSummary as K, defineConfig as Kt, JudgeRunInfo as L, RunSummarySchema as Lt, InlineFixture as M, RecordedErrorSchema as Mt, JsonObject as N, RunManifestSchema as Nt, FileFixture as O, AutIdentitySchema as Ot, JsonPrimitive as P, RunMetadataSchema as Pt, ScoringRule as Q, ResourceKind as Qt, PredicateScorer as R, ScoreResultSchema as Rt, EvalRegistry as S, recordError as St, EvalSuiteMetadata as T, parseTrajectoryJsonl as Tt, RunResult as U, TrialSummarySchema as Ut, RunCatalog as V, TrialMetadataSchema as Vt, RunSource as W, UsageSchema as Wt, ScoreValue as X, defineEvalMatrix as Xt, ScoreResult as Y, MatrixSelection as Yt, ScoringContext as Z, canonicalParameters as Zt, EvalCatalogEntry as _, expectToolCall as _t, AggregateScoring as a, parseResourceUri as an, TrialWriter as at, EvalPolicy as b, judge as bt, AutAdapter as c, resourceUuid as cn, UserStep as ct, AutIdentity as d, authoringId as dt, ResourceUri as en, TranscriptStep as et, AutSession as f, defineAgent as ft, DynamicFixture as g, dynamic as gt, DirectoryFixture as h, directory as ht, AgentStep as i, authorId as in, TrialSummary as it, FixtureVisibility as j, JudgeRunInfoSchema as jt, Fixture as k, CheckpointResultSchema as kt, AutContext as l, WorkspaceView as lt, CheckpointResult as m, defineSuite as mt, AgentRuntimeName as n, Uuid as nn, TrialResult as nt, ArtifactEntry as o, resourceUri as on, TurnView as ot, CandidateWorkspace as p, defineEval as pt, RunWriter as q, EvalMatrix as qt, AgentRuntimes as r, UuidSchema as rn, TrialScoring as rt, ArtifactView as s, resourceUriSchema as sn, Usage as st, AgentRuntime as t, ResourceUriSchema as tn, TrialMetadata as tt, AutEvent as u, agent as ut, EvalCatalogFixture as v, file as vt, EvalSuite as w, user as wt, EvalRegistration as x, predicate as xt, EvalDefinition as y, inlineFile as yt, RecordedError as z, TrajectoryEventSchema as zt };
|
|
1019
|
+
//# sourceMappingURL=index-U6TUTBf7.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-U6TUTBf7.d.mts","names":[],"sources":["../../core/src/identity.ts","../../core/src/canonical-json.ts","../../core/src/matrix.ts","../../core/src/config.ts","../../core/src/schema.ts","../../core/src/trajectory.ts","../../core/src/index.ts"],"mappings":";;cAEa,oBAAkB,OAAA;KACnB,sBAAsB,mBAAmB;;iBAGrC,SAAS;;cAOZ,YAAU,OAAA,cAAA,OAAA;KAKX,cAAc,WAAW;KAEzB,YAAY,cAAc,eAAe,2BACxC;cAEA,mBAAiB,OAAA,cAAA,OAAA;iBAMd,kBAAkB,cAAc,cAAc,MAAM,QAAK,OAAA,cAAA,OAAA;iBAWzD,YAAY,cAAc,cACxC,MAAM,OACN,MAAM,OACL,YAAY;iBAIC,iBAAiB,cAAc,cAC7C,eACA,eAAe;EACZ,MAAM;EAAO,MAAM;EAAM,KAAK,YAAY;;iBAY/B,aAAa,eAAe,eAAe,eAAe;;;;iBCzD1D,oBAAoB,OAAO;;;KCK/B;;EAEV;;EAEA,aAAa,SAAS,wBAAwB;;EAE9C,YAAY;;KAEF;EACV;;EAEA;EACA,MAAM;EACN,YAAY;;KAEF;EACV;EACA;EACA,gBAAgB;EAChB,YAAY,SAAS,wBAAwB;EAC7C,WAAW;;EAEX,iBAAiB;;EAEjB,mBAAmB;;KAET,aAAa;EACvB;EACA,MAAM,YAAY;EAClB,MAAM,YAAY,kBAAkB,iBAAiB;;iBAWvC,uBAAuB,UAAU,sBAC/C,YAAY,IACX,aAAa;;;KCjDJ;;EAEV;EACA;EACA;;EAEA,iBAAiB;EACjB,WAAW;;EAEX,SAAS,KAAK;IAA0C;;EACxD;IAAc;IAAsB;IAAiB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iBAOK,YAAY,iBAAiB"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
//#region ../share/src/files.d.ts
|
|
2
|
+
/** Where uploaded result files live: R2 in a Worker, a directory elsewhere. */
|
|
3
|
+
type ShareFiles = {
|
|
4
|
+
get(key: string): Promise<ReadableStream<Uint8Array> | Uint8Array | null>;
|
|
5
|
+
put(key: string, data: Uint8Array | string): Promise<void>;
|
|
6
|
+
/** Every key below `prefix`, in no particular order. */
|
|
7
|
+
list(prefix: string): AsyncIterable<string>;
|
|
8
|
+
};
|
|
9
|
+
/** The subset of the Workers R2 binding used here. */
|
|
10
|
+
type R2BucketLike = {
|
|
11
|
+
get(key: string): Promise<{
|
|
12
|
+
body: ReadableStream<Uint8Array>;
|
|
13
|
+
} | null>;
|
|
14
|
+
put(key: string, value: Uint8Array | string): Promise<unknown>;
|
|
15
|
+
list(options: {
|
|
16
|
+
prefix: string;
|
|
17
|
+
cursor?: string;
|
|
18
|
+
}): Promise<{
|
|
19
|
+
objects: {
|
|
20
|
+
key: string;
|
|
21
|
+
}[];
|
|
22
|
+
truncated: boolean;
|
|
23
|
+
cursor?: string;
|
|
24
|
+
}>;
|
|
25
|
+
};
|
|
26
|
+
declare function r2Files(bucket: R2BucketLike): ShareFiles;
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region ../share/src/bundle.d.ts
|
|
29
|
+
/**
|
|
30
|
+
* A run bundle: the snapshot files for one run, as one gzip-compressed body.
|
|
31
|
+
*
|
|
32
|
+
* "EKBUNDLE" (8 bytes) · header length (u32 BE) · header JSON · file bytes…
|
|
33
|
+
* header = { format: 1, files: [{ path, size }, …] }, bytes in that order.
|
|
34
|
+
*
|
|
35
|
+
* Both ends are EvalKit, so this is simpler than tar and has no path-length limit.
|
|
36
|
+
*/
|
|
37
|
+
declare const BUNDLE_FORMAT = 1;
|
|
38
|
+
type BundleFile = {
|
|
39
|
+
path: string;
|
|
40
|
+
data: Uint8Array;
|
|
41
|
+
};
|
|
42
|
+
declare function encodeBundle(files: BundleFile[]): Promise<Uint8Array>;
|
|
43
|
+
/** Decode and check the framing; path rules are enforced by the caller. */
|
|
44
|
+
declare function decodeBundle(body: Uint8Array, limits: {
|
|
45
|
+
maxBytes: number;
|
|
46
|
+
}): Promise<BundleFile[]>;
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region ../share/src/upload.d.ts
|
|
49
|
+
/** Finished runs only: a shared run's files are immutable once stored. */
|
|
50
|
+
type SharedRunStatus = 'passed' | 'failed' | 'errored';
|
|
51
|
+
type SharedSource = {
|
|
52
|
+
repo: string;
|
|
53
|
+
project: string;
|
|
54
|
+
commit: string;
|
|
55
|
+
ref?: string;
|
|
56
|
+
committedAt?: string;
|
|
57
|
+
dirty: boolean;
|
|
58
|
+
};
|
|
59
|
+
/** The fields of an uploaded run.json the server relies on. */
|
|
60
|
+
type SharedRun = {
|
|
61
|
+
id: string;
|
|
62
|
+
evalId: string;
|
|
63
|
+
suiteId?: string;
|
|
64
|
+
status: SharedRunStatus;
|
|
65
|
+
score?: number;
|
|
66
|
+
startedAt: string;
|
|
67
|
+
source: SharedSource;
|
|
68
|
+
/** Repository key (`repo` plus `/~project`), checked to be URL- and path-safe. */
|
|
69
|
+
repoKey: string;
|
|
70
|
+
/** The whole run.json object, served as-is in runs.json. */
|
|
71
|
+
summary: unknown;
|
|
72
|
+
};
|
|
73
|
+
/** A run bundle that passed every check; storing it cannot fail on its contents. */
|
|
74
|
+
type RunUpload = {
|
|
75
|
+
run: SharedRun;
|
|
76
|
+
runJson: Uint8Array;
|
|
77
|
+
catalog?: Uint8Array;
|
|
78
|
+
/** trials.json and trials/** files. */
|
|
79
|
+
files: BundleFile[];
|
|
80
|
+
};
|
|
81
|
+
declare function parseUpload(bundle: readonly BundleFile[]): RunUpload;
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region ../share/src/index-db.d.ts
|
|
84
|
+
/**
|
|
85
|
+
* The share server's metadata index: repositories, commits and runs.
|
|
86
|
+
* R2 (or a directory) holds the files; this index answers "what exists" and
|
|
87
|
+
* every listing query. It is derived from stored run.json files and can be
|
|
88
|
+
* rebuilt from them (`POST /api/v1/reindex`).
|
|
89
|
+
*/
|
|
90
|
+
/** Synchronous SQLite access, provided by Durable Object storage or bun:sqlite. */
|
|
91
|
+
type Sql = {
|
|
92
|
+
all<T>(query: string, ...params: SqlValue[]): T[];
|
|
93
|
+
run(query: string, ...params: SqlValue[]): void;
|
|
94
|
+
transaction<T>(work: () => T): T;
|
|
95
|
+
};
|
|
96
|
+
type SqlValue = string | number | null;
|
|
97
|
+
type RepoRow = {
|
|
98
|
+
key: string;
|
|
99
|
+
url: string;
|
|
100
|
+
project: string;
|
|
101
|
+
firstSeenAt: string;
|
|
102
|
+
lastUploadAt: string;
|
|
103
|
+
commits: number;
|
|
104
|
+
};
|
|
105
|
+
type CommitRow = {
|
|
106
|
+
commit: string;
|
|
107
|
+
ref?: string;
|
|
108
|
+
committedAt?: string;
|
|
109
|
+
firstSeenAt: string;
|
|
110
|
+
runs: number;
|
|
111
|
+
passed: number;
|
|
112
|
+
failed: number;
|
|
113
|
+
};
|
|
114
|
+
/** The operations the app needs; async so a Durable Object can sit behind it. */
|
|
115
|
+
type ShareIndex = {
|
|
116
|
+
hasRun(runId: string): Promise<boolean>;
|
|
117
|
+
recordRun(run: SharedRun): Promise<void>;
|
|
118
|
+
repos(): Promise<RepoRow[]>;
|
|
119
|
+
commits(repo: string): Promise<CommitRow[]>;
|
|
120
|
+
runs(repo: string, sha: string): Promise<unknown[]>;
|
|
121
|
+
/** Full SHA for a full SHA, a unique prefix (≥ 7), or a ref's latest commit. */
|
|
122
|
+
resolve(repo: string, ref: string): Promise<string | undefined>;
|
|
123
|
+
latest(repo: string): Promise<string | undefined>;
|
|
124
|
+
};
|
|
125
|
+
declare class ShareIndexDb {
|
|
126
|
+
private readonly sql;
|
|
127
|
+
private readonly now;
|
|
128
|
+
constructor(sql: Sql, now?: () => Date);
|
|
129
|
+
hasRun(runId: string): boolean;
|
|
130
|
+
/** Idempotent: recording an indexed run again changes nothing. */
|
|
131
|
+
recordRun(run: SharedRun): void;
|
|
132
|
+
repos(): RepoRow[];
|
|
133
|
+
commits(repo: string): CommitRow[];
|
|
134
|
+
runs(repo: string, sha: string): unknown[];
|
|
135
|
+
resolve(repo: string, ref: string): string | undefined;
|
|
136
|
+
latest(repo: string): string | undefined;
|
|
137
|
+
}
|
|
138
|
+
/** Adapt the synchronous index (bun:sqlite) to the app's async interface. */
|
|
139
|
+
declare function asyncIndex(db: ShareIndexDb): ShareIndex;
|
|
140
|
+
//#endregion
|
|
141
|
+
export { r2Files as _, Sql as a, SharedRun as c, BUNDLE_FORMAT as d, BundleFile as f, ShareFiles as g, R2BucketLike as h, ShareIndexDb as i, SharedRunStatus as l, encodeBundle as m, RepoRow as n, SqlValue as o, decodeBundle as p, ShareIndex as r, asyncIndex as s, CommitRow as t, parseUpload as u };
|
|
142
|
+
//# sourceMappingURL=index-db-HdZXelOS.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-db-HdZXelOS.d.mts","names":[],"sources":["../../share/src/files.ts","../../share/src/bundle.ts","../../share/src/upload.ts","../../share/src/index-db.ts"],"mappings":";;KACY;EACV,IAAI,cAAc,QAAQ,eAAe,cAAc;EACvD,IAAI,aAAa,MAAM,sBAAsB;;EAE7C,KAAK,iBAAiB;;;KAIZ;EACV,IAAI,cAAc;IAAU,MAAM,eAAe;;EACjD,IAAI,aAAa,OAAO,sBAAsB;EAC9C,KAAK;IAAW;IAAgB;MAAoB;IAClD;MAAW;;IACX;IACA;;;iBAIY,QAAQ,QAAQ,eAAe;;;;;;;;;;;cCXlC;KAGD;EAAe;EAAc,MAAM;;iBAUzB,aAAa,OAAO,eAAe,QAAQ;;iBA2B3C,aACpB,MAAM,YACN;EAAU;IACT,QAAQ;;;;KCtCC;KAEA;EACV;EACA;EACA;EACA;EACA;EACA;;;KAIU;EACV;EACA;EACA;EACA,QAAQ;EACR;EACA;EACA,QAAQ;;EAER;;EAEA;;;KAUU;EACV,KAAK;EACL,SAAS;EACT,UAAU;;EAEV,OAAO;;iBAGO,YAAY,iBAAiB,eAAe;;;;;;;;;;KC5ChD;EACV,IAAI,GAAG,kBAAkB,QAAQ,aAAa;EAC9C,IAAI,kBAAkB,QAAQ;EAC9B,YAAY,GAAG,YAAY,IAAI;;KAErB;KAEA;EACV;EACA;EACA;EACA;EACA;EACA;;KAGU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;;;KAIU;EACV,OAAO,gBAAgB;EACvB,UAAU,KAAK,YAAY;EAC3B,SAAS,QAAQ;EACjB,QAAQ,eAAe,QAAQ;EAC/B,KAAK,cAAc,cAAc;;EAEjC,QAAQ,cAAc,cAAc;EACpC,OAAO,eAAe;;cA4CX;mBAEQ;mBACA;EAFnB,YACmB,KAAK,KACL,YAAW;EAK9B,OAAO;;EAKP,UAAU,KAAK;EAwDf,SAAS;EAST,QAAQ,eAAe;EAevB,KAAK,cAAc;EAUnB,QAAQ,cAAc;EAiBtB,OAAO;;;iBASO,WAAW,IAAI,eAAe"}
|