@wasm-oj/core 0.2.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.
@@ -0,0 +1,1883 @@
1
+ import * as ___core_types from '@wasm-oj/contracts';
2
+ import { ExecutionMetrics as ExecutionMetrics$1, BuildArtifact as BuildArtifact$1, Project as Project$1, BuildResult as BuildResult$1, WorkerProgress, RunConfig as RunConfig$1, RunResult as RunResult$1, InteractiveRunConfig, InteractiveRunResult as InteractiveRunResult$1, DeterminismConfig as DeterminismConfig$1, ResourcePolicy as ResourcePolicy$1, WASM_OJ_CONTRACT_VERSION as WASM_OJ_CONTRACT_VERSION$1, InteractiveProgramConfig, Language as Language$1, TargetAbi as TargetAbi$1, OptimizationLevel as OptimizationLevel$1, WasmOjErrorRecord, BuiltinLanguage as BuiltinLanguage$1 } from '@wasm-oj/contracts';
3
+ export { ArtifactMetadata, BrowserRuntimeDriverPlugin, BrowserToolchainSource, BuildArtifact, BuildConfig, BuildResult, BuiltinLanguage, CompilerRequest, CompilerResponse, CompilerTraceEvent, DeterminismConfig, Diagnostic, DiagnosticSeverity, ExecutionMetrics, ExecutionTermination, InteractiveProcessResult, InteractiveProgramConfig, InteractiveRunConfig, InteractiveRunResult, LANGUAGES, Language, OptimizationLevel, Project, ProjectConfig, ProjectFile, ResourcePolicy, RunConfig, RunResult, RunnerRequest, RunnerResponse, RuntimeBundleArtifact, ServerToolchainSource, TargetAbi, ToolchainAssetDescriptor, ToolchainDescriptor, ToolchainProfile, WASM_OJ_CONTRACT_ID, WASM_OJ_CONTRACT_VERSION, WASM_OJ_ERROR_CODES, WASM_OJ_ERROR_STAGES, WASM_OJ_SCHEMAS, WASM_OJ_STORAGE, WasmArtifact, WasmOjError, WasmOjErrorCode, WasmOjErrorOptions, WasmOjErrorRecord, WasmOjErrorStage, WorkerProgress, asWasmOjError, assertLanguageIdentifier, isBuiltinLanguage } from '@wasm-oj/contracts';
4
+
5
+ /**
6
+ * The single compatibility boundary shared by WASM-OJ compilers, runners,
7
+ * artifacts, judge specifications, caches, and conformance evidence.
8
+ *
9
+ * Package and upstream toolchain versions remain independent release metadata;
10
+ * they do not define WASM-OJ protocol compatibility.
11
+ */
12
+ declare const WASM_OJ_CONTRACT_VERSION: 2;
13
+ declare const WASM_OJ_SCHEMAS: Readonly<{
14
+ readonly clangPins: "wasm-oj-v2/clang-pins";
15
+ readonly clangLibcxxPch: "wasm-oj-v2/clang-libcxx-pch";
16
+ readonly clangToolchain: "wasm-oj-v2/clang-toolchain";
17
+ readonly compileBatch: "wasm-oj-v2/compile-batch";
18
+ readonly compileTrace: "wasm-oj-v2/compile-trace";
19
+ readonly conformance: "wasm-oj-v2/conformance";
20
+ readonly conformanceEvidence: "wasm-oj-v2/conformance-evidence";
21
+ readonly conformanceMatrix: "wasm-oj-v2/conformance-matrix";
22
+ readonly cppDependencyLock: "wasm-oj-v2/cpp-dependency-lock";
23
+ readonly dependencyLock: "wasm-oj-v2/dependency-lock";
24
+ readonly dependencyOfflineBundle: "wasm-oj-v2/dependency-offline-bundle";
25
+ readonly incrementalBuildGraph: "wasm-oj-v2/incremental-build-graph";
26
+ readonly interactiveRequest: "wasm-oj-v2/interactive-request";
27
+ readonly goToolchain: "wasm-oj-v2/go-toolchain";
28
+ readonly objectCache: "wasm-oj-v2/object-cache";
29
+ readonly pythonToolchain: "wasm-oj-v2/python-toolchain";
30
+ readonly replayBundle: "wasm-oj-v2/replay-bundle";
31
+ readonly releaseManifest: "wasm-oj-v2/release-manifest";
32
+ readonly rustToolchain: "wasm-oj-v2/rust-toolchain";
33
+ readonly runRequest: "wasm-oj-v2/run-request";
34
+ readonly runtimeBundle: "wasm-oj-v2/runtime-bundle";
35
+ readonly runtimeCoreLicenses: "wasm-oj-v2/runtime-core-licenses";
36
+ readonly thirdPartyComponents: "wasm-oj-v2/third-party-components";
37
+ readonly wasmerSdkLicenses: "wasm-oj-v2/wasmer-sdk-licenses";
38
+ readonly toolchainPackage: "wasm-oj-v2/toolchain-package";
39
+ }>;
40
+
41
+ declare const LANGUAGES: readonly ["c", "cpp", "rust", "python", "javascript", "typescript", "go"];
42
+ type BuiltinLanguage = (typeof LANGUAGES)[number];
43
+ /**
44
+ * Stable language identity carried by projects and artifacts.
45
+ *
46
+ * WASM-OJ ships the values in `LANGUAGES`; downstream compiler implementations
47
+ * may use their own non-empty identifier without forking the contract.
48
+ */
49
+ type Language = BuiltinLanguage | (string & {});
50
+ type TargetAbi = "wasip1" | "wasix";
51
+ type OptimizationLevel = "debug" | "release";
52
+ declare const DEPENDENCY_ECOSYSTEMS: readonly ["cargo", "npm", "pypi", "go", "cpp"];
53
+ type DependencyEcosystem = (typeof DEPENDENCY_ECOSYSTEMS)[number];
54
+ interface DependencyRequirement {
55
+ ecosystem: DependencyEcosystem;
56
+ name: string;
57
+ requirement: string;
58
+ features?: readonly string[];
59
+ }
60
+ interface DependencySourceFile {
61
+ ecosystem: DependencyEcosystem;
62
+ role: "manifest" | "lockfile" | "source";
63
+ path: string;
64
+ contents: string;
65
+ }
66
+ interface DependencyManifest {
67
+ requirements: readonly DependencyRequirement[];
68
+ sourceFiles?: readonly DependencySourceFile[];
69
+ }
70
+ interface LockedDependencyPackage {
71
+ id: string;
72
+ ecosystem: DependencyEcosystem;
73
+ name: string;
74
+ version: string;
75
+ source: string;
76
+ integritySha256: string;
77
+ dependencies: readonly string[];
78
+ features?: readonly string[];
79
+ }
80
+ interface DependencyLock {
81
+ schema: typeof WASM_OJ_SCHEMAS.dependencyLock;
82
+ wasmOjContract: typeof WASM_OJ_CONTRACT_VERSION;
83
+ manifestSha256: string;
84
+ roots: readonly string[];
85
+ packages: readonly LockedDependencyPackage[];
86
+ }
87
+ interface MaterializedDependencyPackage {
88
+ package: LockedDependencyPackage;
89
+ filesSha256: string;
90
+ files: Readonly<Record<string, Uint8Array>>;
91
+ }
92
+ /** Archive-independent, fully verified dependency input admitted by compilers. */
93
+ interface DependencyBuildBundle {
94
+ lock: DependencyLock;
95
+ lockSha256: string;
96
+ packages: readonly MaterializedDependencyPackage[];
97
+ }
98
+ interface ProjectFile {
99
+ path: string;
100
+ language: Language;
101
+ content: string;
102
+ }
103
+ interface BuildConfig {
104
+ language: Language;
105
+ target: TargetAbi;
106
+ optimization: OptimizationLevel;
107
+ entry: string;
108
+ }
109
+ interface DeterminismConfig {
110
+ /** Unsigned 32-bit seed used by every guest entropy source. */
111
+ randomSeed: number;
112
+ /** Unix epoch exposed by the first realtime-clock observation. */
113
+ realtimeEpochMs: number;
114
+ /** Virtual clock advancement after each clock observation. */
115
+ clockStepNs: number;
116
+ }
117
+ interface ResourcePolicy {
118
+ /** Versioned baseline-normalized weighted Wasm instruction budget. */
119
+ instructionBudget: number;
120
+ /** Deterministic virtual elapsed-time budget, including sleeps and clock observations. */
121
+ logicalTimeLimitMs: number;
122
+ /** Hard upper bound for guest linear memory. */
123
+ memoryLimitBytes: number;
124
+ /** Combined stdout and stderr upper bound. */
125
+ outputLimitBytes: number;
126
+ /** Additional live VFS file bytes permitted above the mounted baseline. */
127
+ filesystemWriteLimitBytes: number;
128
+ /** Additional live VFS entries permitted above the mounted baseline. */
129
+ filesystemEntryLimit: number;
130
+ /** Host safety deadline; excluded from the deterministic transcript. */
131
+ wallTimeLimitMs: number;
132
+ }
133
+ type ExecutionTermination = "exited" | "instruction-limit" | "logical-time-limit" | "memory-limit" | "output-limit" | "filesystem-limit" | "wall-time-limit" | "trap";
134
+ interface ExecutionMetrics {
135
+ /** Baseline-normalized weighted deterministic cost used for judging. */
136
+ cost: number | null;
137
+ /** Unadjusted weighted cost observed by the runtime core. */
138
+ rawCost: number | null;
139
+ /** Empty-program cost subtracted from rawCost. */
140
+ baselineCost: number;
141
+ /** Versioned compiler/runtime baseline identity. */
142
+ costProfile: string;
143
+ /** Meter policy used to interpret cost. */
144
+ costModel: string;
145
+ /** WARK-compatible static counts of original Wasm operators. */
146
+ operations: Readonly<Record<string, number>> | null;
147
+ /** Peak linear-memory allocation observed by the runner. */
148
+ memoryBytes: number | null;
149
+ /** Deterministic virtual time elapsed during execution. */
150
+ logicalTimeNs: number | null;
151
+ /** Peak live VFS file bytes, including the mounted baseline. */
152
+ filesystemBytes: number | null;
153
+ /** Peak live VFS inode count, excluding the root inode. */
154
+ filesystemEntries: number | null;
155
+ stdoutBytes: number | null;
156
+ stderrBytes: number | null;
157
+ }
158
+ interface RunConfig {
159
+ args: string[];
160
+ stdin: string;
161
+ env: Record<string, string>;
162
+ /** Absolute, normalized guest files mounted before execution. */
163
+ files?: Record<string, Uint8Array>;
164
+ /** Absolute, normalized guest files collected after execution. */
165
+ outputPaths?: string[];
166
+ /** Absolute, normalized initial working directory. */
167
+ cwd?: string;
168
+ determinism: DeterminismConfig;
169
+ resources: ResourcePolicy;
170
+ }
171
+ interface ProjectConfig extends BuildConfig, RunConfig {
172
+ }
173
+ interface Project {
174
+ id: string;
175
+ name: string;
176
+ files: ProjectFile[];
177
+ config: ProjectConfig;
178
+ activeFile: string;
179
+ updatedAt: number;
180
+ /** Verified archive-independent dependency input, if this project uses packages. */
181
+ dependencies?: DependencyBuildBundle;
182
+ }
183
+ type DiagnosticSeverity = "error" | "warning" | "info";
184
+ interface Diagnostic {
185
+ severity: DiagnosticSeverity;
186
+ message: string;
187
+ file: string;
188
+ line: number;
189
+ column: number;
190
+ endLine?: number;
191
+ endColumn?: number;
192
+ source: string;
193
+ code?: string;
194
+ }
195
+ interface ArtifactMetadata {
196
+ /** WASM-OJ compatibility contract required to consume this artifact. */
197
+ wasmOjContract: typeof WASM_OJ_CONTRACT_VERSION;
198
+ id: string;
199
+ projectId: string;
200
+ cacheKey: string;
201
+ name: string;
202
+ language: Language;
203
+ target: TargetAbi;
204
+ optimization: OptimizationLevel;
205
+ createdAt: number;
206
+ durationMs: number;
207
+ size: number;
208
+ toolchains: string[];
209
+ /** Trusted empty-program cost profile selected by the compiler contract. */
210
+ costProfile: string;
211
+ /** Canonical dependency lock used for this build. */
212
+ dependencyLockSha256?: string;
213
+ }
214
+ interface WasmArtifact extends ArtifactMetadata {
215
+ kind: "wasm";
216
+ bytes: Uint8Array;
217
+ }
218
+ interface RuntimeBundleArtifact extends ArtifactMetadata {
219
+ kind: "runtime-bundle";
220
+ runtimePackage: string;
221
+ command: string;
222
+ entry: string;
223
+ files: Record<string, string | Uint8Array>;
224
+ manifest: string;
225
+ }
226
+ type BuildArtifact = WasmArtifact | RuntimeBundleArtifact;
227
+ interface BuildResult {
228
+ success: boolean;
229
+ diagnostics: Diagnostic[];
230
+ artifact?: BuildArtifact;
231
+ stdout: string;
232
+ stderr: string;
233
+ cacheHit: boolean;
234
+ buildGraph?: {
235
+ hits: Partial<Record<"pch" | "object" | "link-result", number>>;
236
+ misses: Partial<Record<"pch" | "object" | "link-result", number>>;
237
+ stores: Partial<Record<"pch" | "object" | "link-result", number>>;
238
+ };
239
+ }
240
+ interface RunResult {
241
+ code: number;
242
+ stdout: string;
243
+ stderr: string;
244
+ /** Requested output files that existed when the process terminated. */
245
+ files: Record<string, Uint8Array>;
246
+ durationMs: number;
247
+ determinism: DeterminismConfig;
248
+ resources: ResourcePolicy;
249
+ termination: ExecutionTermination;
250
+ /** Runtime trap text when termination is `trap`; absent for normal guest exits. */
251
+ trapMessage?: string;
252
+ metrics: ExecutionMetrics;
253
+ }
254
+ interface InteractiveProcessResult {
255
+ code: number;
256
+ stderr: string;
257
+ termination: ExecutionTermination;
258
+ metrics: ExecutionMetrics;
259
+ }
260
+ interface InteractiveRunResult {
261
+ contestant: InteractiveProcessResult;
262
+ interactor: InteractiveProcessResult;
263
+ contestantToInteractor: string;
264
+ interactorToContestant: string;
265
+ durationMs: number;
266
+ determinism: DeterminismConfig;
267
+ }
268
+ interface ToolchainProfile {
269
+ language: Language;
270
+ target: TargetAbi;
271
+ optimization: OptimizationLevel;
272
+ }
273
+ interface ToolchainAssetDescriptor {
274
+ /** Logical filename expected by the compiler/runtime implementation. */
275
+ path: string;
276
+ bytes: number;
277
+ sha256: string;
278
+ /** Exact package export used by deployment tooling. */
279
+ exportPath: string;
280
+ }
281
+ interface ToolchainDescriptor {
282
+ schema: typeof WASM_OJ_SCHEMAS.toolchainPackage;
283
+ id: string;
284
+ version: string;
285
+ wasmOjContract: typeof WASM_OJ_CONTRACT_VERSION;
286
+ languages: readonly Language[];
287
+ profiles: readonly ToolchainProfile[];
288
+ assets: readonly ToolchainAssetDescriptor[];
289
+ }
290
+ interface BrowserToolchainSource {
291
+ kind: "browser";
292
+ descriptor: ToolchainDescriptor;
293
+ baseUrl: string;
294
+ }
295
+ interface ServerToolchainSource {
296
+ kind: "server";
297
+ descriptor: ToolchainDescriptor;
298
+ directory: URL;
299
+ }
300
+ type ToolchainSource = BrowserToolchainSource | ServerToolchainSource;
301
+
302
+ declare const DEFAULT_DETERMINISM: Readonly<DeterminismConfig>;
303
+ declare function resolveDeterminism(value: Partial<DeterminismConfig> | undefined): DeterminismConfig;
304
+
305
+ type CanonicalJsonValue = null | boolean | number | string | readonly CanonicalJsonValue[] | {
306
+ readonly [key: string]: CanonicalJsonValue;
307
+ };
308
+ /** WASM-OJ canonical JSON: sorted object keys, safe integers, UTF-8, and one trailing newline. */
309
+ declare function canonicalJsonBytes(value: unknown): Uint8Array;
310
+ declare function parseCanonicalJsonBytes(bytes: Uint8Array, label?: string): CanonicalJsonValue;
311
+
312
+ /** The weighted meter defined by the active WASM-OJ contract. */
313
+ declare const WEIGHTED_METER_MODEL = "weighted";
314
+ declare const DEFAULT_RESOURCE_POLICY: Readonly<ResourcePolicy>;
315
+ declare function resolveResourcePolicy(value: Partial<ResourcePolicy> | undefined): ResourcePolicy;
316
+
317
+ interface RawExecutionMetrics {
318
+ cost: number;
319
+ costModel: string;
320
+ operations: Readonly<Record<string, number>>;
321
+ memoryBytes: number;
322
+ logicalTimeNs: number;
323
+ filesystemBytes: number;
324
+ filesystemEntries: number;
325
+ stdoutBytes: number;
326
+ stderrBytes: number;
327
+ }
328
+ interface CostBudget {
329
+ profile: string;
330
+ baselineCost: number;
331
+ netInstructionBudget: number;
332
+ rawInstructionBudget: number;
333
+ }
334
+ declare class CostBaselineRegistry {
335
+ private readonly baselines;
336
+ private sealed;
337
+ constructor(entries?: Readonly<Record<string, number>>);
338
+ register(profile: string, baseline: number): void;
339
+ baseline(profile: string): number;
340
+ }
341
+ declare function createDefaultCostBaselineRegistry(): CostBaselineRegistry;
342
+ declare function createExtendedCostBaselineRegistry(additional?: Readonly<Record<string, number>>): CostBaselineRegistry;
343
+ declare function resolveCostBudget(profile: string, netInstructionBudget: number, registry?: CostBaselineRegistry): CostBudget;
344
+ declare function resolveArtifactCostBudget(artifact: BuildArtifact$1, netInstructionBudget: number, registry?: CostBaselineRegistry): CostBudget;
345
+ declare function normalizeExecutionMetrics(raw: RawExecutionMetrics, budget: CostBudget): ExecutionMetrics$1;
346
+ declare function unavailableExecutionMetrics(budget: CostBudget, costModel: string): ExecutionMetrics$1;
347
+
348
+ /** Stable identity for one calibrated compiler/runtime overhead profile. */
349
+ declare function costProfileId(language: Language, target: TargetAbi, optimization: OptimizationLevel, downstreamToolchainContent?: string): string;
350
+ declare function isCostProfileFor(profile: string, language: Language, target: TargetAbi, optimization: OptimizationLevel): boolean;
351
+
352
+ /** Executable runtime components covered by deterministic cost calibration. */
353
+ declare const WASM_OJ_RUNTIME_COMPONENTS: Readonly<{
354
+ readonly runtimeCoreWasmSha256: "92500f3a2e65fe6979e893179d8000e12d66822c160eeb779b0d4fe0a6b55603";
355
+ readonly runtimeSourceRootSha256: "3ef42cb2c70e7013e4a6f9d4d7457a7071101795fbd3753efcd20c1ac338ebd5";
356
+ readonly wasmerNativeVersion: "7.2.1";
357
+ readonly wasmerSdkVersion: "0.10.0";
358
+ readonly wasmerSdkWasmSha256: "49a6646209f5ab5e7c737eac33407d87d9a9959ac83e5ecaaab9261b2323589e";
359
+ readonly wasmerWasixVersion: "0.702.1";
360
+ }>;
361
+ /**
362
+ * SHA-256 of `runtimeIdentityBytes()`.
363
+ * Release verification independently checks the component bytes before this
364
+ * identity is admitted into a calibrated release.
365
+ */
366
+ declare const WASM_OJ_RUNTIME_IDENTITY_SHA256 = "24c0bcff9820fbfd1fd4db1c57e2a866b83041409dd22b5b725688739bd3e223";
367
+ /** Exact canonical serialization hashed by `WASM_OJ_RUNTIME_IDENTITY_SHA256`. */
368
+ declare function runtimeIdentityBytes(): Uint8Array;
369
+ declare function verifyRuntimeIdentity(): Promise<void>;
370
+
371
+ declare const WASM_OJ_RELEASE_MANIFEST_SCHEMA: "wasm-oj-v2/release-manifest";
372
+ declare const WASM_OJ_CONTAINER_PROTOCOL_VERSION = "wasm-oj-container-v2";
373
+ interface ReleaseManifest {
374
+ readonly schema: typeof WASM_OJ_RELEASE_MANIFEST_SCHEMA;
375
+ readonly releaseId: string;
376
+ readonly version: string;
377
+ readonly wasmOjContract: typeof WASM_OJ_CONTRACT_VERSION;
378
+ readonly createdAt: string;
379
+ readonly source: {
380
+ readonly repository: string;
381
+ readonly commit: string;
382
+ readonly sourceTreeSha256: string;
383
+ readonly tag?: string;
384
+ };
385
+ readonly build: {
386
+ readonly nodeVersion: string;
387
+ readonly pnpmVersion: string;
388
+ readonly rustVersion: string;
389
+ readonly lockSha256: string;
390
+ readonly sbomSha256: string;
391
+ readonly licensesSha256: string;
392
+ readonly auditSha256: string;
393
+ };
394
+ readonly artifacts: {
395
+ readonly npmPackage: ArtifactDigest;
396
+ readonly workerBundle: ArtifactDigest;
397
+ readonly staticAssets: ArtifactDigest;
398
+ readonly containerImage: {
399
+ readonly registry: string;
400
+ readonly digest: string;
401
+ readonly identitySha256: string;
402
+ readonly platform: "linux/amd64";
403
+ readonly dockerfileSha256: string;
404
+ readonly baseImages: readonly {
405
+ readonly stage: "node-build" | "rust-build" | "judge";
406
+ readonly image: string;
407
+ readonly digest: string;
408
+ }[];
409
+ };
410
+ };
411
+ readonly runtime: {
412
+ readonly protocolVersion: typeof WASM_OJ_CONTAINER_PROTOCOL_VERSION;
413
+ readonly executionRootSha256: string;
414
+ readonly rootSha256: string;
415
+ readonly runtimeIdentitySha256: string;
416
+ readonly runtimeCoreSha256: string;
417
+ readonly wasmerVersion: string;
418
+ readonly wasmerSha256: string;
419
+ readonly compilerSha256: string;
420
+ readonly runnerSha256: string;
421
+ };
422
+ readonly toolchains: {
423
+ readonly rootSha256: string;
424
+ readonly manifestSha256: string;
425
+ };
426
+ readonly cost: {
427
+ readonly model: typeof WEIGHTED_METER_MODEL;
428
+ readonly profileRootSha256: string;
429
+ readonly baselineSha256: string;
430
+ };
431
+ readonly evidence: {
432
+ readonly conformanceSha256: string;
433
+ readonly testsSha256: string;
434
+ readonly costCalibrationSha256: string;
435
+ };
436
+ readonly migrations: {
437
+ readonly databaseSha256: string;
438
+ };
439
+ readonly provenance: {
440
+ readonly issuer: string;
441
+ readonly subject: string;
442
+ };
443
+ }
444
+ interface ArtifactDigest {
445
+ readonly sha256: string;
446
+ readonly bytes: number;
447
+ }
448
+ declare function parseReleaseManifest(value: unknown): ReleaseManifest;
449
+ declare function createReleaseManifest(value: ReleaseManifest): ReleaseManifest;
450
+ declare function releaseManifestBytes(value: ReleaseManifest): Uint8Array;
451
+ declare function releaseManifestSha256(value: ReleaseManifest): Promise<string>;
452
+ declare function verifyReleaseManifestBytes(bytes: Uint8Array, expectedSha256?: string): Promise<ReleaseManifest>;
453
+
454
+ /**
455
+ * Fail-closed validation boundary for projects crossing persistence or
456
+ * transport boundaries. The candidate is checked without mutation, defaults,
457
+ * type coercion, or shape recovery.
458
+ */
459
+ declare function assertValidProject(candidate: unknown): asserts candidate is Project;
460
+
461
+ declare const PROJECT_SOURCE_LIMITS: Readonly<{
462
+ files: 256;
463
+ bytesPerFile: number;
464
+ totalBytes: number;
465
+ }>;
466
+
467
+ interface ArtifactBuildExpectation {
468
+ readonly project: Project;
469
+ readonly cacheKey: string;
470
+ }
471
+ /** Canonical WASM-OJ manifest constructor for built-in and downstream runtime bundles. */
472
+ declare function createRuntimeBundleManifest(project: Project, runtimePackage: string, command: string, entry: string): string;
473
+ /**
474
+ * Fail-closed compatibility boundary for cache, compiler, and runner inputs.
475
+ * Built-in languages are bound to WASM-OJ's exact artifact/runtime/toolchain
476
+ * profile; downstream languages retain their own toolchain and runtime driver.
477
+ */
478
+ declare function assertValidBuildArtifact(candidate: unknown, expectation?: ArtifactBuildExpectation): asserts candidate is BuildArtifact;
479
+
480
+ interface ToolchainAssetSource<Source extends ToolchainSource = ToolchainSource> {
481
+ source: Source;
482
+ asset: ToolchainAssetDescriptor;
483
+ }
484
+ interface ToolchainProfileSource<Source extends ToolchainSource = ToolchainSource> {
485
+ source: Source;
486
+ profile: ToolchainProfile;
487
+ }
488
+ /**
489
+ * Validates a complete, homogeneous toolchain-source set at the host boundary.
490
+ * No source is inferred and no duplicate language, profile, or asset ownership
491
+ * is accepted.
492
+ */
493
+ declare function validateToolchainDescriptors<Source extends ToolchainSource>(sources: readonly Source[], expectedKind?: Source["kind"]): readonly Source[];
494
+ declare function validateBrowserToolchainSources(sources: readonly BrowserToolchainSource[]): readonly BrowserToolchainSource[];
495
+ declare function validateServerToolchainSources(sources: readonly ServerToolchainSource[]): readonly ServerToolchainSource[];
496
+ /** Returns an immutable, structured-clone-safe browser source snapshot. */
497
+ declare function snapshotBrowserToolchainSources(sources: readonly BrowserToolchainSource[]): readonly BrowserToolchainSource[];
498
+ declare function toolchainAssetSource<Source extends ToolchainSource>(sources: readonly Source[], path: string): ToolchainAssetSource<Source>;
499
+ declare function toolchainProfileSource<Source extends ToolchainSource>(sources: readonly Source[], language: string, target: TargetAbi, optimization: OptimizationLevel): ToolchainProfileSource<Source>;
500
+ declare function browserToolchainAssetBaseUrl(sources: readonly BrowserToolchainSource[], path: string, resolutionBaseUrl: string | URL): URL;
501
+ declare function browserToolchainAssetUrl(sources: readonly BrowserToolchainSource[], path: string, resolutionBaseUrl: string | URL): URL;
502
+
503
+ declare function assertCompilerCacheKey(cacheKey: unknown): asserts cacheKey is string;
504
+
505
+ declare const CLANG_VERSION = "22.0.0-git20542-10";
506
+ /** SHA-256 after browser-side gzip decompression. */
507
+ declare const CLANG_PACKAGE_SHA256 = "21ded33b9c6d4e1aaad5528c940bdaf6c3e84be77ea8f522f018ca7289a2a224";
508
+ /** SHA-256 of the pinned cc1/wasm-ld argv manifest; regenerated by scripts/pin-clang-cc1-argv.mjs. */
509
+ declare const CLANG_CC1_PINS_SHA256 = "66c4604dccd3f89d8e1472bf4432367d7396cce4a01279b1a1db445f229dba72";
510
+ declare function toolchainCacheIdentity(language: Language): {
511
+ wasmOjContract: 2;
512
+ version: string;
513
+ compilerPackages: string[];
514
+ contentSha256: string[];
515
+ runtimePackage?: undefined;
516
+ } | {
517
+ wasmOjContract: 2;
518
+ version: string;
519
+ compilerPackages: string[];
520
+ runtimePackage: string | undefined;
521
+ contentSha256: string[];
522
+ };
523
+
524
+ /** Environment-neutral compiler contract implemented by browser and server hosts. */
525
+ interface Compiler {
526
+ /**
527
+ * Stable, content-addressed identity for the compiler inputs used by this
528
+ * project. WASM-OJ incorporates it into artifact cache keys before building.
529
+ */
530
+ cacheIdentity(project: Project$1): string;
531
+ ready(): Promise<void>;
532
+ build(project: Project$1, cacheKey: string): Promise<BuildResult$1>;
533
+ onProgress(listener: (progress: WorkerProgress) => void): () => void;
534
+ clearToolchainCache(): Promise<void>;
535
+ cancel(): void;
536
+ restart(): void;
537
+ dispose(): void;
538
+ }
539
+
540
+ interface ArtifactStore {
541
+ load(cacheKey: string): Promise<BuildArtifact$1 | undefined>;
542
+ save(artifact: BuildArtifact$1): Promise<void>;
543
+ delete(cacheKey: string): Promise<void>;
544
+ clear(): Promise<void>;
545
+ }
546
+ type PrecompileStatus = "ready" | "compile-error" | "superseded" | "failed";
547
+ interface PrecompileOutcome {
548
+ cacheKey: string;
549
+ status: PrecompileStatus;
550
+ result?: BuildResult$1;
551
+ error?: Error;
552
+ }
553
+
554
+ declare const TRUSTED_JUDGE_WASM_MAX_BYTES: number;
555
+ /** Exact deterministic WASI Preview 1 surface admitted for trusted judge commands. */
556
+ declare const TRUSTED_JUDGE_WASIP1_IMPORTS: Readonly<Set<string>>;
557
+ type TrustedJudgeRuntimeProfile = "c-wasip1-release" | "cpp-wasip1-release" | "rust-wasip1-release" | "go-wasip1-release";
558
+ declare const TRUSTED_JUDGE_RUNTIME_PROFILES: Readonly<Set<TrustedJudgeRuntimeProfile>>;
559
+ /** Runtime-owned executable identity. This is deliberately not a compiler BuildArtifact. */
560
+ interface TrustedJudgeProgram {
561
+ readonly runtimeProfile: TrustedJudgeRuntimeProfile;
562
+ readonly wasm: Uint8Array;
563
+ }
564
+ interface TrustedJudgeWasmInfo {
565
+ readonly bytes: number;
566
+ readonly initialMemoryPages: number;
567
+ readonly maximumMemoryPages?: number;
568
+ readonly imports: readonly string[];
569
+ }
570
+ interface TrustedJudgeWasmValidationOptions {
571
+ /** Problem-level memory ceiling used to reject an impossible initial memory. */
572
+ readonly memoryLimitBytes?: number;
573
+ }
574
+ /**
575
+ * Pure static admission for prebuilt checker/interactor modules. It validates
576
+ * structure and ABI only; it never compiles, instantiates, or executes guest code.
577
+ */
578
+ declare function validateTrustedJudgeWasm(bytes: Uint8Array, options?: TrustedJudgeWasmValidationOptions): TrustedJudgeWasmInfo;
579
+
580
+ /** Environment-neutral runner contract implemented by browser and native hosts. */
581
+ interface Runner {
582
+ ready(): Promise<void>;
583
+ run(artifact: BuildArtifact$1, config: RunConfig$1): Promise<RunResult$1>;
584
+ interact(contestant: BuildArtifact$1, interactor: BuildArtifact$1, config: InteractiveRunConfig): Promise<InteractiveRunResult$1>;
585
+ /** Server-side immutable judge command path; browser hosts intentionally omit it. */
586
+ runTrusted?(program: TrustedJudgeProgram, config: RunConfig$1): Promise<RunResult$1>;
587
+ interactTrusted?(contestant: BuildArtifact$1, interactor: TrustedJudgeProgram, config: InteractiveRunConfig): Promise<InteractiveRunResult$1>;
588
+ onProgress(listener: (progress: WorkerProgress) => void): () => void;
589
+ onStream(listener: (stream: "stdout" | "stderr", chunk: string) => void): () => void;
590
+ clearRuntimeCache(): Promise<void>;
591
+ cancel(): void;
592
+ /** Cancel accepted execution work and wait until it can no longer mutate caches. */
593
+ cancelAndWait(): Promise<void>;
594
+ restart(): void;
595
+ dispose(): void;
596
+ }
597
+
598
+ type OutputNormalization = "exact" | "lines" | "trimmed-lines";
599
+ declare function normalizeOutput(value: string, mode: OutputNormalization): string;
600
+
601
+ type JudgeInputSpec = {
602
+ kind: "inline";
603
+ value: string;
604
+ } | {
605
+ kind: "provider";
606
+ provider: string;
607
+ key: string;
608
+ sha256?: string;
609
+ };
610
+ /** Binary-safe materialized input accepted only for mounted guest files. */
611
+ type JudgeFileInputSpec = JudgeInputSpec | {
612
+ kind: "inline-bytes";
613
+ value: Uint8Array;
614
+ };
615
+ /** Serializable matcher descriptor. Libraries may register additional matcher IDs. */
616
+ interface JudgeMatcherSpec {
617
+ id: string;
618
+ config: Readonly<Record<string, unknown>>;
619
+ }
620
+ interface JudgeProgramSpec {
621
+ args?: readonly string[];
622
+ env?: Readonly<Record<string, string>>;
623
+ cwd?: string;
624
+ resources?: Partial<ResourcePolicy$1>;
625
+ }
626
+ interface JudgeCaseBase {
627
+ id: string;
628
+ input: JudgeInputSpec;
629
+ /** Additional secret inputs resolved with the same provider contract as stdin. */
630
+ files?: Readonly<Record<string, JudgeFileInputSpec>>;
631
+ determinism?: Partial<DeterminismConfig$1>;
632
+ }
633
+ interface BatchJudgeCaseSpec extends JudgeCaseBase, JudgeProgramSpec {
634
+ kind: "batch";
635
+ /** Guest files collected for file-output matchers and custom checkers. */
636
+ outputPaths?: readonly string[];
637
+ matcher: JudgeMatcherSpec;
638
+ }
639
+ interface InteractiveJudgeCaseSpec extends JudgeCaseBase {
640
+ kind: "interactive";
641
+ /** Contestant execution policy. Secret case files are never mounted here. */
642
+ contestant?: JudgeProgramSpec;
643
+ interactor: JudgeProgramSpec & {
644
+ program: TrustedJudgeProgram;
645
+ /** Absolute guest path receiving the resolved primary case input. */
646
+ inputPath: string;
647
+ };
648
+ }
649
+ type JudgeCaseSpec = BatchJudgeCaseSpec | InteractiveJudgeCaseSpec;
650
+ interface JudgeSpec {
651
+ version: typeof WASM_OJ_CONTRACT_VERSION$1;
652
+ cases: readonly JudgeCaseSpec[];
653
+ /** Stop after the first non-accepted case. Defaults to true. */
654
+ failFast?: boolean;
655
+ }
656
+ declare function textMatcher(expected: string, normalization?: OutputNormalization): JudgeMatcherSpec;
657
+ declare function sha256Matcher(digest: string, normalization?: OutputNormalization): JudgeMatcherSpec;
658
+ declare function fileMatcher(expected: Readonly<Record<string, string>>, normalization?: OutputNormalization): JudgeMatcherSpec;
659
+ declare function tokenMatcher(expected: string): JudgeMatcherSpec;
660
+ declare function floatMatcher(expected: string, absoluteTolerance?: number, relativeTolerance?: number): JudgeMatcherSpec;
661
+ declare function setMatcher(expected: string, multiplicity?: boolean): JudgeMatcherSpec;
662
+ declare function wasmCheckerMatcher(checker: TrustedJudgeProgram, expected: string, args?: readonly string[], files?: Readonly<Record<string, Uint8Array>>): JudgeMatcherSpec;
663
+ declare function validateJudgeSpec(spec: JudgeSpec): void;
664
+ /** Shared strict guest-path boundary for trusted judge assets. */
665
+ declare function assertJudgeGuestFilePath(value: unknown, label?: string): string;
666
+
667
+ type JudgeCaseVerdict = "accepted" | "wrong-answer" | "runtime-error" | "instruction-limit" | "memory-limit" | "output-limit" | "filesystem-limit" | "logical-time-limit" | "wall-time-limit" | "judge-error";
668
+ interface JudgeMatchResult {
669
+ accepted: boolean;
670
+ message?: string;
671
+ /** Output produced by a trusted matcher subprocess while deciding this case. */
672
+ auxiliaryOutputBytes?: number;
673
+ }
674
+ interface JudgeMatcherContext {
675
+ case: BatchJudgeCaseSpec;
676
+ artifact: BuildArtifact$1;
677
+ stdin: string;
678
+ run: RunResult$1;
679
+ stdout: string;
680
+ stderr: string;
681
+ files: Readonly<Record<string, Uint8Array>>;
682
+ }
683
+ interface JudgeMatcher {
684
+ readonly id: string;
685
+ match(spec: JudgeMatcherSpec, context: JudgeMatcherContext): Promise<JudgeMatchResult>;
686
+ }
687
+ interface JudgeInputProvider {
688
+ readonly id: string;
689
+ resolve(input: Extract<JudgeInputSpec, {
690
+ kind: "provider";
691
+ }>, caseSpec: JudgeCaseSpec): Promise<string>;
692
+ }
693
+ interface JudgeCaseResult {
694
+ id: string;
695
+ verdict: JudgeCaseVerdict;
696
+ message?: string;
697
+ run?: RunResult$1;
698
+ interaction?: InteractiveRunResult$1;
699
+ }
700
+ interface JudgeResult {
701
+ verdict: JudgeCaseVerdict | "accepted";
702
+ completed: number;
703
+ total: number;
704
+ cases: JudgeCaseResult[];
705
+ metrics: {
706
+ cost: number | null;
707
+ rawCost: number | null;
708
+ baselineCost: number;
709
+ logicalTimeNs: number | null;
710
+ maxMemoryBytes: number | null;
711
+ maxFilesystemBytes: number | null;
712
+ maxFilesystemEntries: number | null;
713
+ stdoutBytes: number | null;
714
+ stderrBytes: number | null;
715
+ };
716
+ }
717
+ interface JudgeExecutor {
718
+ run(artifact: BuildArtifact$1, caseSpec: BatchJudgeCaseSpec, input: JudgeResolvedInput): Promise<RunResult$1>;
719
+ runTrusted(program: TrustedJudgeProgram, caseSpec: BatchJudgeCaseSpec, input: JudgeResolvedInput): Promise<RunResult$1>;
720
+ interact(contestant: BuildArtifact$1, caseSpec: InteractiveJudgeCaseSpec, input: JudgeResolvedInput): Promise<InteractiveRunResult$1>;
721
+ }
722
+ interface JudgeResolvedInput {
723
+ stdin: string;
724
+ files: Readonly<Record<string, Uint8Array>>;
725
+ }
726
+ interface JudgeEngineOptions {
727
+ inputProviders?: readonly JudgeInputProvider[];
728
+ matchers?: readonly JudgeMatcher[];
729
+ }
730
+ interface JudgeRunOptions {
731
+ onCase?(result: JudgeCaseResult, completed: number, total: number): void | Promise<void>;
732
+ /**
733
+ * Receives the exact retained-output byte count before `metrics-only`
734
+ * redaction. Server orchestration uses this to enforce one budget across
735
+ * several compile/judge invocations without retaining contestant bytes.
736
+ */
737
+ onOutputBytes?(caseBytes: number, aggregateBytes: number): void | Promise<void>;
738
+ /**
739
+ * Controls whether per-case stdout, stderr, output files, and interactive
740
+ * transcripts remain attached to the returned result. Formal server judging
741
+ * should use `metrics-only`; browser/local callers default to `full`.
742
+ */
743
+ retention?: "full" | "metrics-only";
744
+ /**
745
+ * Hard cumulative byte budget for contestant-visible output across the job.
746
+ * Crossing it adjudicates the current and remaining cases as output-limit and
747
+ * stops executing more cases. Each individual process remains subject to its
748
+ * own ResourcePolicy output limit.
749
+ */
750
+ aggregateOutputLimitBytes?: number;
751
+ }
752
+ declare class JudgeEngine {
753
+ private readonly executor;
754
+ private readonly inputs;
755
+ private readonly matchers;
756
+ constructor(executor: JudgeExecutor, options?: JudgeEngineOptions);
757
+ registerInputProvider(provider: JudgeInputProvider): void;
758
+ registerMatcher(matcher: JudgeMatcher): void;
759
+ judge(artifact: BuildArtifact$1, spec: JudgeSpec, options?: JudgeRunOptions): Promise<JudgeResult>;
760
+ private runCase;
761
+ private resolveInput;
762
+ private resolveInputSpec;
763
+ }
764
+ interface JudgeExecutionAdapter {
765
+ run(artifact: BuildArtifact$1, options: {
766
+ args: readonly string[];
767
+ stdin: string;
768
+ env: Readonly<Record<string, string>>;
769
+ files: Record<string, Uint8Array>;
770
+ outputPaths: string[];
771
+ cwd?: string;
772
+ determinism: ReturnType<typeof resolveDeterminism>;
773
+ resources: ReturnType<typeof resolveResourcePolicy>;
774
+ }): Promise<RunResult$1>;
775
+ interact(contestant: BuildArtifact$1, interactor: BuildArtifact$1, options: {
776
+ contestant: InteractiveProgramConfig;
777
+ interactor: InteractiveProgramConfig;
778
+ determinism: DeterminismConfig$1;
779
+ }): Promise<InteractiveRunResult$1>;
780
+ runTrusted?(program: TrustedJudgeProgram, options: {
781
+ args: readonly string[];
782
+ stdin: string;
783
+ env: Readonly<Record<string, string>>;
784
+ files: Record<string, Uint8Array>;
785
+ outputPaths: string[];
786
+ cwd?: string;
787
+ determinism: ReturnType<typeof resolveDeterminism>;
788
+ resources: ReturnType<typeof resolveResourcePolicy>;
789
+ }): Promise<RunResult$1>;
790
+ interactTrusted?(contestant: BuildArtifact$1, interactor: TrustedJudgeProgram, options: {
791
+ contestant: InteractiveProgramConfig;
792
+ interactor: InteractiveProgramConfig;
793
+ determinism: DeterminismConfig$1;
794
+ }): Promise<InteractiveRunResult$1>;
795
+ }
796
+ declare function createJudgeExecutor(adapter: JudgeExecutionAdapter): JudgeExecutor;
797
+
798
+ declare const DEPENDENCY_BUILD_LIMITS: Readonly<{
799
+ packages: 512;
800
+ filesPerPackage: 16384;
801
+ bytesPerFile: number;
802
+ totalBytes: number;
803
+ }>;
804
+ declare function createDependencyLock(manifestSha256: string, roots: readonly string[], packages: readonly LockedDependencyPackage[]): DependencyLock;
805
+ declare function assertValidDependencyLock(value: unknown): asserts value is DependencyLock;
806
+ declare function dependencyLockSha256(lock: DependencyLock): Promise<string>;
807
+ declare function dependencyManifestSha256(manifest: DependencyManifest): Promise<string>;
808
+ declare function assertValidDependencyBuildBundle(value: unknown): asserts value is DependencyBuildBundle;
809
+ declare function verifyDependencyBuildBundle(bundle: DependencyBuildBundle): Promise<void>;
810
+ declare function dependencyFileTreeSha256(files: Readonly<Record<string, Uint8Array>>): Promise<string>;
811
+
812
+ interface DependencyBuildAdapter {
813
+ readonly ecosystem: DependencyEcosystem;
814
+ materialize(packageRecord: LockedDependencyPackage, payload: Uint8Array): Promise<Readonly<Record<string, Uint8Array>>>;
815
+ }
816
+ declare function createDefaultDependencyBuildAdapters(): readonly DependencyBuildAdapter[];
817
+ declare function createDependencyBuildBundle(lock: DependencyLock, payloads: ReadonlyMap<string, Uint8Array>, adapters?: readonly DependencyBuildAdapter[]): Promise<DependencyBuildBundle>;
818
+
819
+ interface CompileInput {
820
+ language: Language$1;
821
+ entry: string;
822
+ files: Readonly<Record<string, string>>;
823
+ target?: TargetAbi$1;
824
+ optimization?: OptimizationLevel$1;
825
+ name?: string;
826
+ projectId?: string;
827
+ dependencies?: DependencyBuildBundle;
828
+ }
829
+ declare function createSdkProject(input: CompileInput): Project$1;
830
+
831
+ interface CompileOptions {
832
+ /** Read and write the configured artifact store for this build. Defaults to true. */
833
+ cache?: boolean;
834
+ }
835
+ interface RunOptions {
836
+ args?: readonly string[];
837
+ stdin?: string;
838
+ env?: Readonly<Record<string, string>>;
839
+ files?: Readonly<Record<string, string | Uint8Array>>;
840
+ outputPaths?: readonly string[];
841
+ cwd?: string;
842
+ determinism?: Partial<DeterminismConfig$1>;
843
+ resources?: Partial<ResourcePolicy$1>;
844
+ }
845
+ interface InteractiveProgramOptions {
846
+ args?: readonly string[];
847
+ env?: Readonly<Record<string, string>>;
848
+ files?: Readonly<Record<string, string | Uint8Array>>;
849
+ cwd?: string;
850
+ resources?: Partial<ResourcePolicy$1>;
851
+ }
852
+ interface InteractiveOptions {
853
+ contestant?: InteractiveProgramOptions;
854
+ interactor?: InteractiveProgramOptions;
855
+ determinism?: Partial<DeterminismConfig$1>;
856
+ }
857
+ interface InteractiveExecuteResult {
858
+ contestantBuild: BuildResult$1;
859
+ interactorBuild: BuildResult$1;
860
+ run?: InteractiveRunResult$1;
861
+ }
862
+ interface ExecuteResult {
863
+ build: BuildResult$1;
864
+ run?: RunResult$1;
865
+ }
866
+
867
+ interface ConformanceHost {
868
+ readonly id: string;
869
+ compile(input: CompileInput, options?: CompileOptions): Promise<BuildResult>;
870
+ run(artifact: BuildArtifact, options?: RunOptions): Promise<RunResult>;
871
+ }
872
+ interface ConformanceCase {
873
+ id: string;
874
+ label: string;
875
+ input: CompileInput & {
876
+ target: TargetAbi;
877
+ };
878
+ run?: RunOptions;
879
+ expect: ConformanceRunExpectation;
880
+ }
881
+ interface ConformanceRunExpectation {
882
+ code: number;
883
+ stdout: string;
884
+ stderr?: string;
885
+ termination: RunResult["termination"];
886
+ logicalTimeNs?: number;
887
+ trapMessageIncludes?: string;
888
+ files?: Readonly<Record<string, string>>;
889
+ }
890
+ interface ConformanceSample {
891
+ host: string;
892
+ caseId: string;
893
+ caseLabel: string;
894
+ success: boolean;
895
+ artifactDigest?: string;
896
+ artifactBytes?: number;
897
+ firstUncachedCompileMs: number;
898
+ repeatUncachedCompileMs?: number;
899
+ runMedianMs?: number;
900
+ transcript?: DeterministicTranscript;
901
+ diagnostics: BuildResult["diagnostics"];
902
+ error?: string;
903
+ }
904
+ interface DeterministicTranscript {
905
+ code: number;
906
+ stdout: string;
907
+ stderr: string;
908
+ /** Collected guest output files encoded as lowercase hexadecimal bytes. */
909
+ files: Readonly<Record<string, string>>;
910
+ termination: RunResult["termination"];
911
+ trapMessage?: string;
912
+ determinism: RunResult["determinism"];
913
+ resources: RunResult["resources"];
914
+ metrics: RunResult["metrics"];
915
+ }
916
+ interface ConformanceMismatch {
917
+ caseId: string;
918
+ baselineHost: string;
919
+ comparedHost: string;
920
+ fields: string[];
921
+ }
922
+ interface ConformanceReport {
923
+ compatible: boolean;
924
+ repetitions: number;
925
+ samples: ConformanceSample[];
926
+ mismatches: ConformanceMismatch[];
927
+ efficiency: Array<{
928
+ caseId: string;
929
+ host: string;
930
+ firstUncachedCompileMs: number;
931
+ repeatUncachedCompileMs?: number;
932
+ runMedianMs?: number;
933
+ artifactBytes?: number;
934
+ netWeightedCost?: number | null;
935
+ rawWeightedCost?: number | null;
936
+ baselineWeightedCost?: number;
937
+ logicalTimeNs?: number | null;
938
+ }>;
939
+ }
940
+ interface ConformanceSnapshot {
941
+ schema: typeof WASM_OJ_SCHEMAS.conformance;
942
+ host: string;
943
+ repetitions: number;
944
+ caseIds: string[];
945
+ samples: ConformanceSample[];
946
+ }
947
+ interface ConformanceOptions {
948
+ repetitions?: number;
949
+ repeatCompile?: boolean;
950
+ onSample?(sample: ConformanceSample, completed: number, total: number): void | Promise<void>;
951
+ }
952
+ declare function runConformanceMatrix(hosts: readonly ConformanceHost[], cases: readonly ConformanceCase[], options?: ConformanceOptions): Promise<ConformanceReport>;
953
+ /** Run one host independently so browser and server snapshots can be produced in different processes. */
954
+ declare function runConformanceHost(host: ConformanceHost, cases: readonly ConformanceCase[], options?: ConformanceOptions): Promise<ConformanceSnapshot>;
955
+ /** Compare independently serialized snapshots and produce the efficiency matrix. */
956
+ declare function compareConformanceSnapshots(snapshots: readonly ConformanceSnapshot[]): ConformanceReport;
957
+ declare function deterministicTranscript(run: RunResult): DeterministicTranscript;
958
+
959
+ interface ResolvedDependencyGraph {
960
+ roots: readonly string[];
961
+ packages: readonly LockedDependencyPackage[];
962
+ /** One canonical archive/blob per package ID. */
963
+ payloads: Readonly<Record<string, Uint8Array>>;
964
+ }
965
+ /** @internal Shared by all adapters participating in one bounded resolution. */
966
+ interface DependencyDownloadBudget {
967
+ readonly limitBytes: number;
968
+ readonly usedBytes: number;
969
+ reserve(bytes: number): void;
970
+ consume(bytes: number): void;
971
+ release(bytes: number): void;
972
+ }
973
+ interface DependencyResolutionContext {
974
+ previousLock?: DependencyLock;
975
+ /** Explicit browser/network consent scope. Omit only for offline resolution. */
976
+ networkAccess?: DependencyNetworkAccess;
977
+ /** @internal WASM-OJ-owned aggregate budget; custom resolvers must pass it through to network transports. */
978
+ downloadBudget?: DependencyDownloadBudget;
979
+ }
980
+ /** Repository and immutable problem-bundle identity used to isolate cached locks. */
981
+ interface DependencyNetworkScope {
982
+ sourceKey: string;
983
+ bundleDigest: string;
984
+ }
985
+ /** Complete host set approved for one repository source and immutable problem bundle. */
986
+ interface DependencyNetworkAccess extends DependencyNetworkScope {
987
+ hosts: readonly string[];
988
+ }
989
+ /** Performs the user- or host-owned authorization step before any dependency request. */
990
+ interface DependencyNetworkAuthorizer {
991
+ authorize(access: DependencyNetworkAccess): Promise<void>;
992
+ }
993
+ interface DependencyResolver {
994
+ readonly ecosystem: DependencyEcosystem;
995
+ resolve(manifest: DependencyManifest, context: DependencyResolutionContext): Promise<ResolvedDependencyGraph>;
996
+ }
997
+ interface DependencyCache {
998
+ load(integritySha256: string): Promise<Uint8Array | undefined>;
999
+ save(integritySha256: string, payload: Uint8Array): Promise<void>;
1000
+ delete(integritySha256: string): Promise<void>;
1001
+ clear(): Promise<void>;
1002
+ }
1003
+ interface DependencyOfflineBundle {
1004
+ schema: typeof WASM_OJ_SCHEMAS.dependencyOfflineBundle;
1005
+ wasmOjContract: typeof WASM_OJ_CONTRACT_VERSION;
1006
+ lock: DependencyLock;
1007
+ payloads: Readonly<Record<string, Uint8Array>>;
1008
+ }
1009
+ interface ResolveDependencyOptions {
1010
+ offline?: boolean;
1011
+ previousLock?: DependencyLock;
1012
+ /** Required to use `previousLock` after a genuine network transport failure. */
1013
+ previousLockNetworkScope?: DependencyNetworkScope;
1014
+ networkAccess?: DependencyNetworkAccess;
1015
+ }
1016
+
1017
+ interface ReplayRunOperation {
1018
+ kind: "run";
1019
+ config: RunConfig;
1020
+ expected: DeterministicTranscript;
1021
+ expectedSha256: string;
1022
+ }
1023
+ interface ReplayJudgeCaseTranscript {
1024
+ id: string;
1025
+ verdict: JudgeResult["cases"][number]["verdict"];
1026
+ message?: string;
1027
+ run?: DeterministicTranscript;
1028
+ interaction?: Omit<InteractiveRunResult, "durationMs">;
1029
+ }
1030
+ interface ReplayJudgeTranscript {
1031
+ verdict: JudgeResult["verdict"];
1032
+ completed: number;
1033
+ total: number;
1034
+ cases: ReplayJudgeCaseTranscript[];
1035
+ metrics: JudgeResult["metrics"];
1036
+ }
1037
+ interface ReplayJudgeOperation {
1038
+ kind: "judge";
1039
+ spec: JudgeSpec;
1040
+ expected: ReplayJudgeTranscript;
1041
+ expectedSha256: string;
1042
+ }
1043
+ type ReplayOperation = ReplayRunOperation | ReplayJudgeOperation;
1044
+ interface ReplayBundle {
1045
+ schema: typeof WASM_OJ_SCHEMAS.replayBundle;
1046
+ wasmOjContract: typeof WASM_OJ_CONTRACT_VERSION;
1047
+ projectSha256: string;
1048
+ artifactSha256: string;
1049
+ project: Project;
1050
+ artifact: BuildArtifact;
1051
+ dependencies?: DependencyOfflineBundle;
1052
+ operation: ReplayOperation;
1053
+ }
1054
+ type ReplayBundleInput = {
1055
+ project: Project;
1056
+ artifact: BuildArtifact;
1057
+ dependencies?: DependencyOfflineBundle;
1058
+ } & ({
1059
+ operation: {
1060
+ kind: "run";
1061
+ config: RunConfig;
1062
+ result: RunResult;
1063
+ };
1064
+ } | {
1065
+ operation: {
1066
+ kind: "judge";
1067
+ spec: JudgeSpec;
1068
+ result: JudgeResult;
1069
+ };
1070
+ });
1071
+ interface ReplayHost {
1072
+ compileProject(project: Project, options?: {
1073
+ cache?: boolean;
1074
+ }): Promise<BuildResult>;
1075
+ run(artifact: BuildArtifact, config: RunConfig): Promise<RunResult>;
1076
+ judge(artifact: BuildArtifact, spec: JudgeSpec): Promise<JudgeResult>;
1077
+ }
1078
+ interface ReplayOptions {
1079
+ /** Rebuild sources and compare the stable artifact digest before execution. Defaults to true. */
1080
+ recompile?: boolean;
1081
+ }
1082
+ interface ReplayResult {
1083
+ compatible: boolean;
1084
+ mismatches: readonly string[];
1085
+ build?: BuildResult;
1086
+ run?: RunResult;
1087
+ judge?: JudgeResult;
1088
+ }
1089
+ interface ReplayDecodeOptions {
1090
+ maxBundleBytes?: number;
1091
+ maxManifestBytes?: number;
1092
+ maxBlobs?: number;
1093
+ }
1094
+ declare function createReplayBundle(input: ReplayBundleInput): Promise<ReplayBundle>;
1095
+ declare function assertValidReplayBundle(value: unknown): Promise<void>;
1096
+ declare function encodeReplayBundle(bundle: ReplayBundle): Promise<Uint8Array>;
1097
+ declare function decodeReplayBundle(encoded: Uint8Array, options?: ReplayDecodeOptions): Promise<ReplayBundle>;
1098
+ declare function replayBundleSha256(bundle: ReplayBundle): Promise<string>;
1099
+ declare function replayBundle(host: ReplayHost, bundle: ReplayBundle, options?: ReplayOptions): Promise<ReplayResult>;
1100
+ declare function judgeTranscript(result: JudgeResult): ReplayJudgeTranscript;
1101
+
1102
+ type OperationKind = "submission";
1103
+ type OperationState = "queued" | "running" | "succeeded" | "failed" | "cancelled";
1104
+ type OperationEventPayload = {
1105
+ type: "state";
1106
+ state: OperationState;
1107
+ } | {
1108
+ type: "progress";
1109
+ progress: WorkerProgress;
1110
+ } | {
1111
+ type: "stream";
1112
+ stream: "stdout" | "stderr";
1113
+ chunk: string;
1114
+ } | {
1115
+ type: "build";
1116
+ success: boolean;
1117
+ cacheHit: boolean;
1118
+ diagnosticCount: number;
1119
+ artifact?: {
1120
+ id: string;
1121
+ kind: "wasm" | "runtime-bundle";
1122
+ size: number;
1123
+ };
1124
+ } | {
1125
+ type: "case";
1126
+ caseId: string;
1127
+ verdict: JudgeCaseVerdict;
1128
+ message?: string;
1129
+ completed: number;
1130
+ total: number;
1131
+ } | {
1132
+ type: "error";
1133
+ error: WasmOjErrorRecord;
1134
+ };
1135
+ type OperationEvent = OperationEventPayload & {
1136
+ operationId: string;
1137
+ sequence: number;
1138
+ };
1139
+ interface SubmissionRequest {
1140
+ id?: string;
1141
+ input: CompileInput;
1142
+ spec: JudgeSpec;
1143
+ compile?: CompileOptions;
1144
+ judge?: Omit<JudgeRunOptions, "onCase">;
1145
+ signal?: AbortSignal;
1146
+ }
1147
+ interface Operation<T> {
1148
+ readonly id: string;
1149
+ readonly kind: OperationKind;
1150
+ readonly signal: AbortSignal;
1151
+ readonly result: Promise<T>;
1152
+ state(): OperationState;
1153
+ cancel(reason?: string): void;
1154
+ onEvent(listener: (event: OperationEvent) => void): () => void;
1155
+ }
1156
+ type SubmissionOperation = Operation<JudgeProjectResult>;
1157
+
1158
+ type DependencyFetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
1159
+ /** A transport failure before an HTTP response exists; the only cache-fallback trigger. */
1160
+ declare class DependencyNetworkError extends Error {
1161
+ constructor(hostname: string, options?: ErrorOptions);
1162
+ }
1163
+ interface DependencyResolverOptions {
1164
+ fetch?: DependencyFetch;
1165
+ networkAuthorizer?: DependencyNetworkAuthorizer;
1166
+ maxMetadataBytes?: number;
1167
+ maxPackageBytes?: number;
1168
+ maxUnpackedBytes?: number;
1169
+ concurrency?: number;
1170
+ cargoCrateBaseUrl?: string;
1171
+ pypiApiUrl?: string;
1172
+ goProxyUrl?: string;
1173
+ }
1174
+ interface ResolvedOptions {
1175
+ fetch: DependencyFetch;
1176
+ /** Only the platform Fetch contract may translate its specified TypeError network rejection. */
1177
+ classifyPlatformFetchRejections: boolean;
1178
+ networkAuthorizer?: DependencyNetworkAuthorizer;
1179
+ maxMetadataBytes: number;
1180
+ maxPackageBytes: number;
1181
+ maxUnpackedBytes: number;
1182
+ concurrency: number;
1183
+ cargoCrateBaseUrl: string;
1184
+ pypiApiUrl: string;
1185
+ goProxyUrl: string;
1186
+ }
1187
+ /**
1188
+ * Creates WASM-OJ's native-lockfile adapters. They consume exact versions and
1189
+ * ecosystem integrity data; they deliberately do not act as a second package solver.
1190
+ */
1191
+ declare function createDefaultDependencyResolvers(options?: DependencyResolverOptions): readonly DependencyResolver[];
1192
+ declare class CargoLockDependencyResolver implements DependencyResolver {
1193
+ readonly ecosystem: "cargo";
1194
+ private readonly options;
1195
+ constructor(options?: DependencyResolverOptions | ResolvedOptions);
1196
+ resolve(manifest: DependencyManifest, context: DependencyResolutionContext): Promise<ResolvedDependencyGraph>;
1197
+ }
1198
+ declare class NpmLockDependencyResolver implements DependencyResolver {
1199
+ readonly ecosystem: "npm";
1200
+ private readonly options;
1201
+ constructor(options?: DependencyResolverOptions | ResolvedOptions);
1202
+ resolve(manifest: DependencyManifest, context: DependencyResolutionContext): Promise<ResolvedDependencyGraph>;
1203
+ }
1204
+ declare class PyPiLockDependencyResolver implements DependencyResolver {
1205
+ readonly ecosystem: "pypi";
1206
+ private readonly options;
1207
+ constructor(options?: DependencyResolverOptions | ResolvedOptions);
1208
+ resolve(manifest: DependencyManifest, context: DependencyResolutionContext): Promise<ResolvedDependencyGraph>;
1209
+ }
1210
+ declare class GoLockDependencyResolver implements DependencyResolver {
1211
+ readonly ecosystem: "go";
1212
+ private readonly options;
1213
+ constructor(options?: DependencyResolverOptions | ResolvedOptions);
1214
+ resolve(manifest: DependencyManifest, context: DependencyResolutionContext): Promise<ResolvedDependencyGraph>;
1215
+ }
1216
+ interface CppDependencyLockSource {
1217
+ schema: typeof WASM_OJ_SCHEMAS.cppDependencyLock;
1218
+ roots: readonly string[];
1219
+ packages: readonly {
1220
+ name: string;
1221
+ version: string;
1222
+ url: string;
1223
+ sha256: string;
1224
+ dependencies?: readonly string[];
1225
+ }[];
1226
+ }
1227
+ declare class CppLockDependencyResolver implements DependencyResolver {
1228
+ readonly ecosystem: "cpp";
1229
+ private readonly options;
1230
+ constructor(options?: DependencyResolverOptions | ResolvedOptions);
1231
+ resolve(manifest: DependencyManifest, context: DependencyResolutionContext): Promise<ResolvedDependencyGraph>;
1232
+ }
1233
+ /** Implements Go's official `dirhash.HashZip` h1 checksum over module ZIP entries. */
1234
+ declare function goModuleZipHash(payload: Uint8Array, maxUnpackedBytes?: number, maxFiles?: number): Promise<string>;
1235
+
1236
+ declare class MemoryDependencyCache implements DependencyCache {
1237
+ private readonly payloads;
1238
+ load(integritySha256: string): Promise<Uint8Array | undefined>;
1239
+ save(integritySha256: string, payload: Uint8Array): Promise<void>;
1240
+ delete(integritySha256: string): Promise<void>;
1241
+ clear(): Promise<void>;
1242
+ }
1243
+ /** Host-neutral dependency resolution, locking, cache, and offline transport. */
1244
+ declare class DependencyManager {
1245
+ private readonly cache;
1246
+ private readonly resolvers;
1247
+ constructor(cache: DependencyCache, resolvers?: readonly DependencyResolver[]);
1248
+ registerResolver(resolver: DependencyResolver): void;
1249
+ resolve(manifest: DependencyManifest, options?: ResolveDependencyOptions): Promise<DependencyLock>;
1250
+ private resolveOnline;
1251
+ verifyCached(lock: DependencyLock): Promise<void>;
1252
+ clearCache(): Promise<void>;
1253
+ /** Returns package-ID keyed payloads after re-verifying the content-addressed cache. */
1254
+ materialize(lock: DependencyLock): Promise<ReadonlyMap<string, Uint8Array>>;
1255
+ /** Resolve cached archives into the verified, compiler-facing file-tree contract. */
1256
+ prepareBuild(lock: DependencyLock, adapters?: readonly DependencyBuildAdapter[]): Promise<DependencyBuildBundle>;
1257
+ exportOffline(lock: DependencyLock): Promise<DependencyOfflineBundle>;
1258
+ importOffline(bundle: DependencyOfflineBundle): Promise<DependencyLock>;
1259
+ }
1260
+ declare function createDefaultDependencyManager(cache: DependencyCache, options?: DependencyResolverOptions): DependencyManager;
1261
+
1262
+ interface EngineOptions {
1263
+ compiler: Compiler;
1264
+ runner: Runner;
1265
+ artifactStore?: ArtifactStore;
1266
+ judge?: JudgeEngineOptions;
1267
+ dependencyManager?: DependencyManager;
1268
+ }
1269
+ interface JudgeProjectResult {
1270
+ build: BuildResult$1;
1271
+ judge?: JudgeResult;
1272
+ }
1273
+ /** High-level compile/run API shared by browser and server hosts. */
1274
+ declare class Engine {
1275
+ protected readonly compiler: Compiler;
1276
+ protected readonly runner: Runner;
1277
+ private readonly artifactStore?;
1278
+ private readonly dependencyManager?;
1279
+ private readonly compilation;
1280
+ private readonly operationScheduler;
1281
+ private readonly observationListeners;
1282
+ private disposed;
1283
+ private cacheClearActive;
1284
+ private cacheClearOperation?;
1285
+ /** Extensible judge registry for custom input providers and output matchers. */
1286
+ readonly judging: JudgeEngine;
1287
+ constructor(options: EngineOptions);
1288
+ ready(): Promise<void>;
1289
+ onProgress(listener: (progress: WorkerProgress) => void): () => void;
1290
+ onStream(listener: (stream: "stdout" | "stderr", chunk: string) => void): () => void;
1291
+ /** Subscribe to operation-scoped, structured host observations. */
1292
+ onObservation(listener: (event: OperationEvent) => void): () => void;
1293
+ /** Enqueue one independently observable and cancellable compile-and-judge submission. */
1294
+ submit(request: SubmissionRequest): SubmissionOperation;
1295
+ /** Resolve and cache one canonical dependency graph using this host's adapters. */
1296
+ resolveDependencies(manifest: DependencyManifest, options?: ResolveDependencyOptions): Promise<DependencyLock>;
1297
+ /** Materialize a lock into the archive-independent compiler input contract. */
1298
+ prepareDependencies(lock: DependencyLock, adapters?: readonly DependencyBuildAdapter[]): Promise<DependencyBuildBundle>;
1299
+ compile(input: CompileInput, options?: CompileOptions): Promise<BuildResult$1>;
1300
+ /** Compile an already-normalized Project without reconstructing its library identity. */
1301
+ compileProject(project: Project$1, options?: CompileOptions): Promise<BuildResult$1>;
1302
+ replay(bundle: ReplayBundle, options?: ReplayOptions): Promise<ReplayResult>;
1303
+ /** Compile during idle time; a matching foreground compile joins this exact request. */
1304
+ precompile(input: CompileInput): Promise<PrecompileOutcome>;
1305
+ /** Supersede only speculative work; a foreground build is never cancelled here. */
1306
+ supersedePrecompile(): void;
1307
+ run(artifact: BuildArtifact$1, options?: RunOptions): Promise<RunResult$1>;
1308
+ interact(contestant: BuildArtifact$1, interactor: BuildArtifact$1, options?: InteractiveOptions): Promise<InteractiveRunResult$1>;
1309
+ judge(artifact: BuildArtifact$1, spec: JudgeSpec, options?: JudgeRunOptions): Promise<JudgeResult>;
1310
+ judgeProject(input: CompileInput, spec: JudgeSpec, compile?: CompileOptions, judge?: JudgeRunOptions): Promise<JudgeProjectResult>;
1311
+ execute(input: CompileInput, run?: RunOptions, compile?: CompileOptions): Promise<ExecuteResult>;
1312
+ cancel(): void;
1313
+ restart(): void;
1314
+ clearCache(): Promise<void>;
1315
+ private clearCacheOperationInternal;
1316
+ dispose(): void;
1317
+ private assertActive;
1318
+ private assertAvailable;
1319
+ private cancelExecution;
1320
+ private executeSubmission;
1321
+ private notifyObservation;
1322
+ }
1323
+ declare function createEngine(options: EngineOptions): Promise<Engine>;
1324
+
1325
+ declare const WASM_OJ_LIBCXX_PCH_HEADER = "#pragma once\n#include <algorithm>\n#include <array>\n#include <bitset>\n#include <cassert>\n#include <cctype>\n#include <cerrno>\n#include <cfloat>\n#include <charconv>\n#include <chrono>\n#include <climits>\n#include <cmath>\n#include <compare>\n#include <concepts>\n#include <cstddef>\n#include <cstdint>\n#include <cstdio>\n#include <cstdlib>\n#include <cstring>\n#include <deque>\n#include <exception>\n#include <functional>\n#include <iomanip>\n#include <ios>\n#include <iostream>\n#include <iterator>\n#include <limits>\n#include <map>\n#include <memory>\n#include <numeric>\n#include <optional>\n#include <queue>\n#include <random>\n#include <ranges>\n#include <set>\n#include <span>\n#include <sstream>\n#include <stack>\n#include <string>\n#include <string_view>\n#include <tuple>\n#include <type_traits>\n#include <unordered_map>\n#include <unordered_set>\n#include <utility>\n#include <variant>\n#include <vector>\n";
1326
+ type LibcxxPchProfile = "cpp-debug" | "cpp-release";
1327
+ interface LibcxxPchAsset {
1328
+ path: string;
1329
+ byteLength: number;
1330
+ sha256: string;
1331
+ compressedByteLength: number;
1332
+ compressedSha256: string;
1333
+ }
1334
+ interface LibcxxPchManifest {
1335
+ schema: typeof WASM_OJ_SCHEMAS.clangLibcxxPch;
1336
+ version: typeof CLANG_VERSION;
1337
+ clangPackageSha256: typeof CLANG_PACKAGE_SHA256;
1338
+ clangPinsSha256: typeof CLANG_CC1_PINS_SHA256;
1339
+ header: typeof WASM_OJ_LIBCXX_PCH_HEADER;
1340
+ headerSha256: string;
1341
+ profiles: Readonly<Record<LibcxxPchProfile, LibcxxPchAsset>>;
1342
+ }
1343
+ declare function decodeLibcxxPchManifest(bytes: Uint8Array): Promise<LibcxxPchManifest>;
1344
+ declare function isToolchainLibcxxPchHeader(contents: string): boolean;
1345
+
1346
+ interface CompilerRegistration {
1347
+ readonly languages: readonly Language$1[];
1348
+ readonly compiler: Compiler;
1349
+ }
1350
+ /**
1351
+ * Environment-neutral router for composing built-in and downstream compilers.
1352
+ *
1353
+ * Registration is frozen by the first lifecycle operation, keeping routing
1354
+ * deterministic for the lifetime of an engine and making each language owned
1355
+ * by exactly one compiler.
1356
+ */
1357
+ declare class CompilerRegistry implements Compiler {
1358
+ private readonly routes;
1359
+ private readonly compilers;
1360
+ private readonly progressListeners;
1361
+ private readonly removeCompilerListeners;
1362
+ private initialization;
1363
+ private sealed;
1364
+ private disposed;
1365
+ private generation;
1366
+ constructor(registrations?: readonly CompilerRegistration[]);
1367
+ register(languages: readonly Language$1[], compiler: Compiler): this;
1368
+ languages(): Language$1[];
1369
+ cacheIdentity(project: Project$1): string;
1370
+ ready(): Promise<void>;
1371
+ build(project: Project$1, cacheKey: string): Promise<___core_types.BuildResult>;
1372
+ onProgress(listener: (progress: WorkerProgress) => void): () => void;
1373
+ clearToolchainCache(): Promise<void>;
1374
+ cancel(): void;
1375
+ restart(): void;
1376
+ dispose(): void;
1377
+ private assertActive;
1378
+ private compilerFor;
1379
+ private invalidateInitialization;
1380
+ private invokeCompilers;
1381
+ }
1382
+
1383
+ interface RuntimeResolver {
1384
+ quickJs(): Promise<Uint8Array>;
1385
+ packageCommand(packageSpecifier: string, command: string): Promise<Uint8Array>;
1386
+ packageFileSystem(request: PackageFileSystemRequest): Promise<Record<string, Uint8Array>>;
1387
+ }
1388
+ interface PackageFileSystemRequest {
1389
+ packageSpecifier: string;
1390
+ command: string;
1391
+ args: string[];
1392
+ cacheKey: string;
1393
+ expectedSha256: string;
1394
+ }
1395
+ interface PreparedRunRequest {
1396
+ wasm: Uint8Array;
1397
+ args: string[];
1398
+ env: Record<string, string>;
1399
+ stdin: Uint8Array;
1400
+ files: Record<string, Uint8Array>;
1401
+ outputPaths: string[];
1402
+ cwd?: string;
1403
+ /** Fixed runtime-internal entropy prefix; it does not consume the caller-seeded stream. */
1404
+ startupEntropyBytes: number;
1405
+ cost: CostBudget;
1406
+ determinism: {
1407
+ randomSeed: number;
1408
+ realtimeEpochMs: number;
1409
+ clockStepNs: number;
1410
+ };
1411
+ resources: {
1412
+ instructionBudget: number;
1413
+ logicalTimeLimitMs: number;
1414
+ memoryLimitBytes: number;
1415
+ outputLimitBytes: number;
1416
+ filesystemWriteLimitBytes: number;
1417
+ filesystemEntryLimit: number;
1418
+ };
1419
+ }
1420
+ interface RuntimeDriver {
1421
+ readonly id: string;
1422
+ /** Declares that the prepared process consumes protocol input from fd 0 incrementally. */
1423
+ readonly interactive?: "streaming";
1424
+ supports(artifact: BuildArtifact$1): boolean;
1425
+ prepare(artifact: BuildArtifact$1, config: RunConfig$1, resolver: RuntimeResolver): Promise<PreparedRunRequest>;
1426
+ }
1427
+ declare class RuntimeDriverRegistry {
1428
+ private readonly drivers;
1429
+ private sealed;
1430
+ register(driver: RuntimeDriver): void;
1431
+ driver(artifact: BuildArtifact$1): RuntimeDriver;
1432
+ }
1433
+ declare function createDefaultRuntimeDrivers(costBaselines?: CostBaselineRegistry): RuntimeDriverRegistry;
1434
+ declare function prepareArtifactRun(artifact: BuildArtifact$1, config: RunConfig$1, resolver: RuntimeResolver, registry?: RuntimeDriverRegistry): Promise<PreparedRunRequest>;
1435
+ declare function prepareArtifactInteraction(artifact: BuildArtifact$1, config: RunConfig$1, resolver: RuntimeResolver, registry?: RuntimeDriverRegistry): Promise<PreparedRunRequest>;
1436
+ /** Prepare a statically admitted judge command without fabricating compiler artifact metadata. */
1437
+ declare function prepareTrustedJudgeRun(program: TrustedJudgeProgram, config: RunConfig$1, costBaselines?: CostBaselineRegistry): PreparedRunRequest;
1438
+
1439
+ declare const PROBLEM_LOCALES: readonly ["zh-TW", "en"];
1440
+ type ProblemLocale = typeof PROBLEM_LOCALES[number];
1441
+ type ProblemDifficulty = "easy" | "medium" | "hard";
1442
+ type ProblemCaseKind = "sample" | "adversarial" | "regression";
1443
+ type LocalizedText = Readonly<Record<ProblemLocale, string>>;
1444
+ interface JudgeCase {
1445
+ readonly id: string;
1446
+ readonly kind: ProblemCaseKind;
1447
+ readonly input: string;
1448
+ readonly output: string;
1449
+ }
1450
+ interface ProblemPolicyLimits {
1451
+ readonly instructionBudget: number;
1452
+ readonly memoryLimitBytes: number;
1453
+ readonly logicalTimeLimitMs?: number;
1454
+ }
1455
+ interface ProblemScoringPolicy {
1456
+ readonly id: string;
1457
+ readonly title: LocalizedText;
1458
+ readonly points: number;
1459
+ readonly limits: ProblemPolicyLimits;
1460
+ }
1461
+ interface ProblemScoring {
1462
+ readonly maximumPoints: 100;
1463
+ readonly calibration: {
1464
+ readonly method: "wasm-oj-v2/compiled-average-optimal-rounded/v1";
1465
+ readonly profiles: Readonly<Record<string, string>>;
1466
+ };
1467
+ readonly policies: readonly ProblemScoringPolicy[];
1468
+ readonly safetyLimits: {
1469
+ readonly wallTimeLimitMs: number;
1470
+ };
1471
+ }
1472
+ interface ProblemComplexity {
1473
+ readonly name: LocalizedText;
1474
+ readonly time: string;
1475
+ readonly space: string;
1476
+ readonly accepted: boolean;
1477
+ }
1478
+ /**
1479
+ * Author-supplied source tree used to create a fresh draft. The entry must be
1480
+ * one of the exact file-map keys; consumers copy these bytes and never invent
1481
+ * source for a missing language.
1482
+ */
1483
+ interface JudgeStarterTemplate {
1484
+ readonly entry: string;
1485
+ readonly files: Readonly<Record<string, string>>;
1486
+ }
1487
+ type JudgeStarterTemplates = Readonly<Record<BuiltinLanguage$1, JudgeStarterTemplate>>;
1488
+ interface JudgeProblem {
1489
+ readonly id: string;
1490
+ readonly number: number;
1491
+ readonly title: LocalizedText;
1492
+ readonly trackId: string;
1493
+ readonly track: LocalizedText;
1494
+ readonly difficulty: ProblemDifficulty;
1495
+ readonly tags: readonly string[];
1496
+ readonly statement: LocalizedText;
1497
+ readonly editorial: LocalizedText;
1498
+ readonly starterTemplates: JudgeStarterTemplates;
1499
+ readonly judgeCases: readonly JudgeCase[];
1500
+ readonly scoring: ProblemScoring;
1501
+ readonly complexities: readonly ProblemComplexity[];
1502
+ }
1503
+ interface JudgeProblemSummary {
1504
+ readonly id: string;
1505
+ readonly number: number;
1506
+ readonly title: LocalizedText;
1507
+ readonly trackId: string;
1508
+ readonly track: LocalizedText;
1509
+ readonly difficulty: ProblemDifficulty;
1510
+ readonly tags: readonly string[];
1511
+ readonly caseCount: number;
1512
+ }
1513
+
1514
+ declare const BROWSER_COLLECTION_SCHEMA = "wasm-oj-browser-collection-v5";
1515
+ declare const BROWSER_PROBLEM_SCHEMA = "wasm-oj-browser-problem-v4";
1516
+ declare const PROBLEM_STARTER_LIMITS: Readonly<{
1517
+ filesPerLanguage: 128;
1518
+ bytesPerFile: number;
1519
+ totalBytesPerLanguage: number;
1520
+ }>;
1521
+ interface ProblemBundleDescriptor {
1522
+ readonly path: string;
1523
+ readonly sha256: string;
1524
+ readonly bytes: number;
1525
+ }
1526
+ interface ProblemCollectionEntry extends JudgeProblemSummary {
1527
+ readonly statementPaths: LocalizedText;
1528
+ readonly bundle: ProblemBundleDescriptor;
1529
+ }
1530
+ interface ProblemCollectionIndex {
1531
+ readonly schema: typeof BROWSER_COLLECTION_SCHEMA;
1532
+ readonly problemSchema: typeof BROWSER_PROBLEM_SCHEMA;
1533
+ readonly revision: string;
1534
+ readonly localization: {
1535
+ readonly defaultLocale: "zh-TW";
1536
+ readonly supportedLocales: readonly ["zh-TW", "en"];
1537
+ };
1538
+ readonly problems: readonly ProblemCollectionEntry[];
1539
+ }
1540
+ declare function parseProblemCollectionIndex(value: unknown): ProblemCollectionIndex;
1541
+ declare function parseProblemBundle(value: unknown, expected: ProblemCollectionEntry): JudgeProblem;
1542
+ declare function parseStandaloneProblemBundle(value: unknown): JudgeProblem;
1543
+ declare function verifyProblemBundleBytes(bytes: Uint8Array, entry: ProblemCollectionEntry): Promise<JudgeProblem>;
1544
+ declare function problemCollectionRevision(index: Pick<ProblemCollectionIndex, "problems">): Promise<string>;
1545
+ declare function verifyProblemCollectionRevision(index: ProblemCollectionIndex): Promise<void>;
1546
+
1547
+ declare const WASM_OJ_JUDGE_DATA_SCHEMA = "wasm-oj-v2/judge-data";
1548
+ declare const POLICY_IDS: readonly ["baseline", "efficient", "optimal"];
1549
+ declare const CALIBRATION_METHOD = "wasm-oj-v2/compiled-average-optimal-rounded/v1";
1550
+ interface JudgeDataCase {
1551
+ readonly id: string;
1552
+ readonly input: string;
1553
+ readonly output: string;
1554
+ }
1555
+ interface JudgePolicy {
1556
+ readonly id: typeof POLICY_IDS[number];
1557
+ readonly points: number;
1558
+ readonly limits: ProblemPolicyLimits;
1559
+ }
1560
+ interface JudgeData {
1561
+ readonly schema: typeof WASM_OJ_JUDGE_DATA_SCHEMA;
1562
+ readonly cases: readonly JudgeDataCase[];
1563
+ readonly scoring: {
1564
+ readonly maximumPoints: 100;
1565
+ readonly calibration: {
1566
+ readonly method: typeof CALIBRATION_METHOD;
1567
+ readonly profiles: Readonly<Partial<Record<BuiltinLanguage, string>>>;
1568
+ };
1569
+ readonly policies: readonly JudgePolicy[];
1570
+ readonly safetyLimits: {
1571
+ readonly wallTimeLimitMs: number;
1572
+ };
1573
+ };
1574
+ }
1575
+ /** Derive only execution-significant data; statement, editorial, titles, and slug never enter the package digest. */
1576
+ declare function deriveJudgeData(practice: JudgeProblem, allowedLanguages: readonly BuiltinLanguage[]): JudgeData;
1577
+ /**
1578
+ * Bind an execution package to the public contract without requiring hidden
1579
+ * data to appear in the public bundle. Scoring/resources must match exactly,
1580
+ * and every published sample must be an exact case in the private package.
1581
+ */
1582
+ declare function assertJudgeDataMatchesPracticePublic(judgeData: JudgeData, practice: JudgeProblem, allowedLanguages: readonly BuiltinLanguage[]): void;
1583
+ declare function parseJudgeData(value: unknown, allowedLanguages: readonly BuiltinLanguage[]): JudgeData;
1584
+
1585
+ interface ScoredProblemCase {
1586
+ id: string;
1587
+ outputAccepted: boolean;
1588
+ metrics: ObservedCaseMetrics | null;
1589
+ policyEvaluations: readonly PolicyEvaluation[];
1590
+ passedPolicyIds: readonly string[];
1591
+ points: number;
1592
+ }
1593
+ interface ObservedCaseMetrics {
1594
+ cost: number | null;
1595
+ rawCost: number | null;
1596
+ baselineCost: number;
1597
+ memoryBytes: number | null;
1598
+ logicalTimeNs: number | null;
1599
+ }
1600
+ interface PolicyEvaluation {
1601
+ id: string;
1602
+ points: number;
1603
+ costPassed: boolean;
1604
+ memoryPassed: boolean;
1605
+ logicalTimePassed: boolean | null;
1606
+ resourcePassed: boolean;
1607
+ earned: boolean;
1608
+ }
1609
+ interface ProblemScore {
1610
+ numerator: number;
1611
+ denominator: number;
1612
+ points: number;
1613
+ maximumPoints: number;
1614
+ cases: readonly ScoredProblemCase[];
1615
+ passedByPolicy: Readonly<Record<string, number>>;
1616
+ }
1617
+ declare const PERFORMANCE_POLICY_IDS: readonly ["baseline", "efficient", "optimal"];
1618
+ type PerformancePolicyId = (typeof PERFORMANCE_POLICY_IDS)[number];
1619
+ interface PolicyPerformanceAggregate {
1620
+ readonly id: PerformancePolicyId;
1621
+ readonly earnedCases: number;
1622
+ readonly costExceededCases: number;
1623
+ readonly memoryExceededCases: number;
1624
+ readonly logicalTimeExceededCases: number;
1625
+ }
1626
+ interface SubmissionPolicySummary {
1627
+ readonly totalCases: number;
1628
+ readonly outputAcceptedCases: number;
1629
+ readonly policies: readonly PolicyPerformanceAggregate[];
1630
+ }
1631
+ /**
1632
+ * Collapse case-level judge details into the only policy data allowed to cross
1633
+ * the container boundary. Resource failures are counted only after output
1634
+ * acceptance, so an output error is never mislabeled as an efficiency error.
1635
+ */
1636
+ declare function summarizeProblemPolicies(score: ProblemScore): SubmissionPolicySummary;
1637
+ declare function assertProblemCostProfile(problem: JudgeProblem, language: BuiltinLanguage$1, costProfile: string): void;
1638
+ declare function assertJudgeDataCostProfile(data: JudgeData, language: BuiltinLanguage$1, costProfile: string): void;
1639
+ declare function scoreProblemResults(problem: JudgeProblem, language: BuiltinLanguage$1, results: readonly JudgeCaseResult[]): ProblemScore;
1640
+ /** Score immutable execution-only judge data without reconstructing a public problem bundle. */
1641
+ declare function scoreJudgeDataResults(data: JudgeData, language: BuiltinLanguage$1, results: readonly JudgeCaseResult[]): ProblemScore;
1642
+
1643
+ interface JudgeAllowedProfile {
1644
+ readonly target: "wasip1" | "wasix";
1645
+ readonly optimization: "debug" | "release";
1646
+ }
1647
+ type JudgeAllowedProfiles = Readonly<Partial<Record<BuiltinLanguage, JudgeAllowedProfile>>>;
1648
+ declare function parseJudgeAllowedProfiles(value: unknown, label?: string): JudgeAllowedProfiles;
1649
+
1650
+ declare const MANAGED_COLLECTION_SCHEMA = "wasm-oj-platform/managed-collection/v2";
1651
+ interface ManagedRepositoryObject {
1652
+ /** Normalized path relative to the directory containing collection/index.json. */
1653
+ readonly repositoryPath: string;
1654
+ readonly bytes: number;
1655
+ readonly sha256: string;
1656
+ }
1657
+ interface ManagedProblemPublication {
1658
+ readonly slug: string;
1659
+ readonly allowedProfiles: JudgeAllowedProfiles;
1660
+ readonly contestPublic: ManagedRepositoryObject;
1661
+ readonly judgePackage: ManagedRepositoryObject;
1662
+ }
1663
+ interface ManagedCollectionV2 {
1664
+ readonly schema: typeof MANAGED_COLLECTION_SCHEMA;
1665
+ readonly collectionRevision: string;
1666
+ readonly problems: readonly ManagedProblemPublication[];
1667
+ }
1668
+ /** Parse the value form used by the authoring CLI after JSON decoding. */
1669
+ declare function parseManagedCollectionValueV2(value: unknown): ManagedCollectionV2;
1670
+ /**
1671
+ * Stable platform boundary for generated collection/managed.json bytes.
1672
+ * Published managed contracts must use WASM-OJ canonical JSON; author-only
1673
+ * managed-source documents are intentionally not accepted here.
1674
+ */
1675
+ declare function parseManagedCollectionV2(bytes: Uint8Array): ManagedCollectionV2;
1676
+ /** Same v2-only value parser retained as the environment-neutral library entry point. */
1677
+ declare const parseManagedCollectionContract: typeof parseManagedCollectionValueV2;
1678
+
1679
+ declare const CONTEST_PUBLIC_PROJECTION_SCHEMA = "wasm-oj-platform/contest-public-problem-projection/v1";
1680
+ interface ContestPublicProjection {
1681
+ readonly schema: typeof CONTEST_PUBLIC_PROJECTION_SCHEMA;
1682
+ readonly problem: JudgeProblem;
1683
+ readonly digest: string;
1684
+ }
1685
+ /**
1686
+ * The bundle referenced by collection/index.json is safe to fetch for every
1687
+ * practice visitor. Hidden cases and their expected answers exist only in the
1688
+ * immutable judge package built from the authoring source.
1689
+ */
1690
+ declare function derivePracticePublic(authored: JudgeProblem): JudgeProblem;
1691
+ /** The single deterministic hidden-data redaction used by author CI and platform validation. */
1692
+ declare function deriveContestPublic(practice: JudgeProblem): JudgeProblem;
1693
+ declare function createContestPublicProjection(practice: JudgeProblem, problemBundleSha256: string): ContestPublicProjection;
1694
+ declare function contestPublicProjectionBytes(practice: JudgeProblem, problemBundleSha256: string): Uint8Array;
1695
+
1696
+ declare const WASM_OJ_JUDGE_PACKAGE_SCHEMA = "wasm-oj-v2/judge-package";
1697
+ declare const WASM_OJ_JUDGE_PACKAGE_MAGIC = "WOJJDG02";
1698
+ declare const WASM_OJ_JUDGE_PACKAGE_MAX_BYTES: number;
1699
+ interface JudgePackageBlobReference {
1700
+ readonly bytes: number;
1701
+ readonly sha256: string;
1702
+ }
1703
+ interface JudgePackageAssetReference extends JudgePackageBlobReference {
1704
+ readonly guestPath: string;
1705
+ }
1706
+ type JudgePackageAllowedProfile = JudgeAllowedProfile;
1707
+ type JudgePackageManifestJudge = {
1708
+ readonly kind: "text";
1709
+ } | {
1710
+ readonly kind: "checker";
1711
+ readonly runtimeProfile: TrustedJudgeRuntimeProfile;
1712
+ readonly artifact: JudgePackageBlobReference;
1713
+ readonly assets: readonly JudgePackageAssetReference[];
1714
+ readonly args: readonly string[];
1715
+ } | {
1716
+ readonly kind: "interactive";
1717
+ readonly runtimeProfile: TrustedJudgeRuntimeProfile;
1718
+ readonly artifact: JudgePackageBlobReference;
1719
+ readonly assets: readonly JudgePackageAssetReference[];
1720
+ readonly args: readonly string[];
1721
+ readonly inputPath: string;
1722
+ };
1723
+ interface JudgePackageManifest {
1724
+ readonly schema: typeof WASM_OJ_JUDGE_PACKAGE_SCHEMA;
1725
+ readonly wasmOjContract: typeof WASM_OJ_CONTRACT_VERSION;
1726
+ readonly judgeData: JudgePackageBlobReference;
1727
+ readonly allowedProfiles: JudgeAllowedProfiles;
1728
+ readonly judge: JudgePackageManifestJudge;
1729
+ }
1730
+ interface JudgePackageAssetInput {
1731
+ readonly guestPath: string;
1732
+ readonly contents: Uint8Array;
1733
+ }
1734
+ type JudgePackageInputJudge = {
1735
+ readonly kind: "text";
1736
+ } | {
1737
+ readonly kind: "checker";
1738
+ readonly runtimeProfile: TrustedJudgeRuntimeProfile;
1739
+ readonly artifact: Uint8Array;
1740
+ readonly assets: readonly JudgePackageAssetInput[];
1741
+ readonly args: readonly string[];
1742
+ } | {
1743
+ readonly kind: "interactive";
1744
+ readonly runtimeProfile: TrustedJudgeRuntimeProfile;
1745
+ readonly artifact: Uint8Array;
1746
+ readonly assets: readonly JudgePackageAssetInput[];
1747
+ readonly args: readonly string[];
1748
+ readonly inputPath: string;
1749
+ };
1750
+ interface JudgePackageInput {
1751
+ readonly judgeData: JudgeData;
1752
+ readonly allowedProfiles: JudgeAllowedProfiles;
1753
+ readonly judge: JudgePackageInputJudge;
1754
+ }
1755
+ interface EncodedJudgePackage {
1756
+ readonly bytes: Uint8Array;
1757
+ readonly manifest: JudgePackageManifest;
1758
+ readonly executionSemanticSha256: string;
1759
+ }
1760
+ type JudgePackageByteSource = Uint8Array | ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>;
1761
+ interface ValidateJudgePackageOptions {
1762
+ readonly expectedBytes?: number;
1763
+ readonly expectedSha256?: string;
1764
+ readonly memoryLimitBytes?: number;
1765
+ }
1766
+ interface ValidatedJudgePackage {
1767
+ readonly manifest: JudgePackageManifest;
1768
+ readonly judgeData: JudgeData;
1769
+ readonly bytes: number;
1770
+ readonly executionSemanticSha256: string;
1771
+ }
1772
+ interface TrustedJudgeAsset {
1773
+ readonly guestPath: string;
1774
+ readonly bytes: Uint8Array;
1775
+ }
1776
+ type TrustedJudgeExecutable = {
1777
+ readonly kind: "text";
1778
+ } | {
1779
+ readonly kind: "checker";
1780
+ readonly runtimeProfile: TrustedJudgeRuntimeProfile;
1781
+ readonly artifact: Uint8Array;
1782
+ readonly assets: readonly TrustedJudgeAsset[];
1783
+ readonly args: readonly string[];
1784
+ } | {
1785
+ readonly kind: "interactive";
1786
+ readonly runtimeProfile: TrustedJudgeRuntimeProfile;
1787
+ readonly artifact: Uint8Array;
1788
+ readonly assets: readonly TrustedJudgeAsset[];
1789
+ readonly args: readonly string[];
1790
+ readonly inputPath: string;
1791
+ };
1792
+ interface DecodedJudgePackageForExecution extends ValidatedJudgePackage {
1793
+ readonly allowedProfiles: JudgePackageManifest["allowedProfiles"];
1794
+ readonly judge: TrustedJudgeExecutable;
1795
+ }
1796
+ declare function parseJudgePackageManifest(value: unknown): JudgePackageManifest;
1797
+ /** Author-side deterministic package builder. It never executes the trusted module. */
1798
+ declare function encodeJudgePackage(input: JudgePackageInput): Promise<EncodedJudgePackage>;
1799
+ /** Read only the bounded canonical manifest from complete package bytes. */
1800
+ declare function readJudgePackageManifest(bytes: Uint8Array): JudgePackageManifest;
1801
+ /**
1802
+ * Stream-validates one package while retaining at most the manifest and one
1803
+ * bounded blob. This is the Worker-facing admission API used before R2 publish.
1804
+ */
1805
+ declare function validateJudgePackage(source: JudgePackageByteSource, options?: ValidateJudgePackageOptions): Promise<ValidatedJudgePackage>;
1806
+ /** Decode a fully verified package into the exact trusted executable contract consumed by the container runtime. */
1807
+ declare function decodeJudgePackageForExecution(bytes: Uint8Array): Promise<DecodedJudgePackageForExecution>;
1808
+ /** Execution identity is the digest of the exact canonical WOJJDG02 bytes. */
1809
+ declare function judgePackageSemanticDigest(bytes: Uint8Array): Promise<string>;
1810
+
1811
+ declare const MANAGED_COLLECTION_SOURCE_SCHEMA = "wasm-oj-platform/managed-collection-source/v1";
1812
+ interface ManagedSourceObject {
1813
+ readonly path: string;
1814
+ readonly bytes: number;
1815
+ readonly sha256: string;
1816
+ }
1817
+ interface ManagedSourceArtifact extends ManagedSourceObject {
1818
+ readonly runtimeProfile: TrustedJudgeRuntimeProfile;
1819
+ }
1820
+ interface ManagedSourceAsset extends ManagedSourceObject {
1821
+ readonly guestPath: string;
1822
+ }
1823
+ type ManagedSourceJudge = {
1824
+ readonly kind: "text";
1825
+ } | {
1826
+ readonly kind: "checker";
1827
+ readonly artifact: ManagedSourceArtifact;
1828
+ readonly assets: readonly ManagedSourceAsset[];
1829
+ readonly args: readonly string[];
1830
+ } | {
1831
+ readonly kind: "interactive";
1832
+ readonly artifact: ManagedSourceArtifact;
1833
+ readonly assets: readonly ManagedSourceAsset[];
1834
+ readonly args: readonly string[];
1835
+ readonly inputPath: string;
1836
+ };
1837
+ interface ManagedCollectionSourceProblem {
1838
+ readonly slug: string;
1839
+ readonly allowedProfiles: JudgeAllowedProfiles;
1840
+ readonly judge: ManagedSourceJudge;
1841
+ }
1842
+ interface ManagedCollectionSource {
1843
+ readonly schema: typeof MANAGED_COLLECTION_SOURCE_SCHEMA;
1844
+ readonly problems: readonly ManagedCollectionSourceProblem[];
1845
+ }
1846
+ /** Author-only parser. Platform publication parsers must never call this API. */
1847
+ declare function parseManagedCollectionSource(value: unknown): ManagedCollectionSource;
1848
+
1849
+ /** Build the runtime judge spec directly from verified WOJJDG02 execution data. */
1850
+ declare function trustedJudgeSpec(data: JudgeData, executable: TrustedJudgeExecutable): JudgeSpec;
1851
+
1852
+ interface DependencyNetworkConsentPrompt {
1853
+ (access: DependencyNetworkAccess): Promise<boolean>;
1854
+ }
1855
+ interface DependencyConsentStorage {
1856
+ getItem(key: string): string | null;
1857
+ setItem(key: string, value: string): void;
1858
+ removeItem(key: string): void;
1859
+ }
1860
+ /**
1861
+ * Browser consent authorizer isolated by repository source, immutable bundle,
1862
+ * and the complete requested host set. A newly introduced host always prompts.
1863
+ */
1864
+ declare class BrowserDependencyNetworkConsent implements DependencyNetworkAuthorizer {
1865
+ #private;
1866
+ constructor(storage: DependencyConsentStorage, prompt: DependencyNetworkConsentPrompt, now?: () => Date);
1867
+ authorize(rawAccess: DependencyNetworkAccess): Promise<void>;
1868
+ revoke(sourceKey: string, bundleDigest: string): Promise<void>;
1869
+ }
1870
+ declare function normalizeDependencyNetworkAccess(access: DependencyNetworkAccess): DependencyNetworkAccess;
1871
+ declare function normalizeDependencyNetworkScope(scope: DependencyNetworkScope): DependencyNetworkScope;
1872
+
1873
+ declare const DEFAULT_CONFORMANCE_CASES: readonly ConformanceCase[];
1874
+ /**
1875
+ * Slower header-heavy case that verifies the bundled libc++ headers and libraries.
1876
+ * It is opt-in because parsing libc++ inside the WebAssembly Clang frontend is a
1877
+ * materially different efficiency benchmark from basic language conformance.
1878
+ */
1879
+ declare const CPP_STDLIB_CONFORMANCE_CASE: ConformanceCase;
1880
+ declare const FULL_CONFORMANCE_CASES: readonly ConformanceCase[];
1881
+
1882
+ export { BROWSER_COLLECTION_SCHEMA, BROWSER_PROBLEM_SCHEMA, BrowserDependencyNetworkConsent, CONTEST_PUBLIC_PROJECTION_SCHEMA, CPP_STDLIB_CONFORMANCE_CASE, CargoLockDependencyResolver, CompilerRegistry, CostBaselineRegistry, CppLockDependencyResolver, DEFAULT_CONFORMANCE_CASES, DEFAULT_DETERMINISM, DEFAULT_RESOURCE_POLICY, DEPENDENCY_BUILD_LIMITS, DependencyManager, DependencyNetworkError, Engine, FULL_CONFORMANCE_CASES, GoLockDependencyResolver, JudgeEngine, MANAGED_COLLECTION_SCHEMA, MANAGED_COLLECTION_SOURCE_SCHEMA, MemoryDependencyCache, NpmLockDependencyResolver, PROBLEM_STARTER_LIMITS, PROJECT_SOURCE_LIMITS, PyPiLockDependencyResolver, RuntimeDriverRegistry, TRUSTED_JUDGE_RUNTIME_PROFILES, TRUSTED_JUDGE_WASIP1_IMPORTS, TRUSTED_JUDGE_WASM_MAX_BYTES, WASM_OJ_CONTAINER_PROTOCOL_VERSION, WASM_OJ_JUDGE_DATA_SCHEMA, WASM_OJ_JUDGE_PACKAGE_MAGIC, WASM_OJ_JUDGE_PACKAGE_MAX_BYTES, WASM_OJ_JUDGE_PACKAGE_SCHEMA, WASM_OJ_LIBCXX_PCH_HEADER, WASM_OJ_RELEASE_MANIFEST_SCHEMA, WASM_OJ_RUNTIME_COMPONENTS, WASM_OJ_RUNTIME_IDENTITY_SHA256, WEIGHTED_METER_MODEL, assertCompilerCacheKey, assertJudgeDataCostProfile, assertJudgeDataMatchesPracticePublic, assertJudgeGuestFilePath, assertProblemCostProfile, assertValidBuildArtifact, assertValidDependencyBuildBundle, assertValidDependencyLock, assertValidProject, assertValidReplayBundle, browserToolchainAssetBaseUrl, browserToolchainAssetUrl, canonicalJsonBytes, compareConformanceSnapshots, contestPublicProjectionBytes, costProfileId, createContestPublicProjection, createDefaultCostBaselineRegistry, createDefaultDependencyBuildAdapters, createDefaultDependencyManager, createDefaultDependencyResolvers, createDefaultRuntimeDrivers, createDependencyBuildBundle, createDependencyLock, createEngine, createExtendedCostBaselineRegistry, createJudgeExecutor, createReleaseManifest, createReplayBundle, createRuntimeBundleManifest, createSdkProject, decodeJudgePackageForExecution, decodeLibcxxPchManifest, decodeReplayBundle, dependencyFileTreeSha256, dependencyLockSha256, dependencyManifestSha256, deriveContestPublic, deriveJudgeData, derivePracticePublic, deterministicTranscript, encodeJudgePackage, encodeReplayBundle, fileMatcher, floatMatcher, goModuleZipHash, isCostProfileFor, isToolchainLibcxxPchHeader, judgePackageSemanticDigest, judgeTranscript, normalizeDependencyNetworkAccess, normalizeDependencyNetworkScope, normalizeExecutionMetrics, normalizeOutput, parseCanonicalJsonBytes, parseJudgeAllowedProfiles, parseJudgeData, parseJudgePackageManifest, parseManagedCollectionContract, parseManagedCollectionSource, parseManagedCollectionV2, parseManagedCollectionValueV2, parseProblemBundle, parseProblemCollectionIndex, parseReleaseManifest, parseStandaloneProblemBundle, prepareArtifactInteraction, prepareArtifactRun, prepareTrustedJudgeRun, problemCollectionRevision, readJudgePackageManifest, releaseManifestBytes, releaseManifestSha256, replayBundle, replayBundleSha256, resolveArtifactCostBudget, resolveCostBudget, resolveDeterminism, resolveResourcePolicy, runConformanceHost, runConformanceMatrix, runtimeIdentityBytes, scoreJudgeDataResults, scoreProblemResults, setMatcher, sha256Matcher, snapshotBrowserToolchainSources, summarizeProblemPolicies, textMatcher, tokenMatcher, toolchainAssetSource, toolchainCacheIdentity, toolchainProfileSource, trustedJudgeSpec, unavailableExecutionMetrics, validateBrowserToolchainSources, validateJudgePackage, validateJudgeSpec, validateServerToolchainSources, validateToolchainDescriptors, validateTrustedJudgeWasm, verifyDependencyBuildBundle, verifyProblemBundleBytes, verifyProblemCollectionRevision, verifyReleaseManifestBytes, verifyRuntimeIdentity, wasmCheckerMatcher };
1883
+ export type { ArtifactBuildExpectation, ArtifactDigest, ArtifactStore, BatchJudgeCaseSpec, CanonicalJsonValue, CompileInput, CompileOptions, Compiler, CompilerRegistration, ConformanceCase, ConformanceHost, ConformanceMismatch, ConformanceOptions, ConformanceReport, ConformanceRunExpectation, ConformanceSample, ConformanceSnapshot, ContestPublicProjection, CostBudget, CppDependencyLockSource, DecodedJudgePackageForExecution, DependencyBuildAdapter, DependencyBuildBundle, DependencyCache, DependencyConsentStorage, DependencyEcosystem, DependencyFetch, DependencyLock, DependencyManifest, DependencyNetworkAccess, DependencyNetworkAuthorizer, DependencyNetworkConsentPrompt, DependencyNetworkScope, DependencyOfflineBundle, DependencyRequirement, DependencyResolutionContext, DependencyResolver, DependencyResolverOptions, DependencySourceFile, DeterministicTranscript, EncodedJudgePackage, EngineOptions, ExecuteResult, InteractiveExecuteResult, InteractiveJudgeCaseSpec, InteractiveOptions, InteractiveProgramOptions, JudgeAllowedProfile, JudgeAllowedProfiles, JudgeCaseResult, JudgeCaseSpec, JudgeCaseVerdict, JudgeData, JudgeDataCase, JudgeEngineOptions, JudgeExecutionAdapter, JudgeExecutor, JudgeFileInputSpec, JudgeInputProvider, JudgeInputSpec, JudgeMatchResult, JudgeMatcher, JudgeMatcherContext, JudgeMatcherSpec, JudgePackageAllowedProfile, JudgePackageAssetInput, JudgePackageAssetReference, JudgePackageBlobReference, JudgePackageByteSource, JudgePackageInput, JudgePackageInputJudge, JudgePackageManifest, JudgePackageManifestJudge, JudgePolicy, JudgeProblem, JudgeProgramSpec, JudgeProjectResult, JudgeResolvedInput, JudgeResult, JudgeRunOptions, JudgeSpec, JudgeStarterTemplate, JudgeStarterTemplates, LibcxxPchAsset, LibcxxPchManifest, LibcxxPchProfile, LockedDependencyPackage, ManagedCollectionSource, ManagedCollectionSourceProblem, ManagedCollectionV2, ManagedProblemPublication, ManagedRepositoryObject, ManagedSourceArtifact, ManagedSourceAsset, ManagedSourceJudge, ManagedSourceObject, MaterializedDependencyPackage, Operation, OperationEvent, OperationEventPayload, OperationKind, OperationState, OutputNormalization, PackageFileSystemRequest, PolicyPerformanceAggregate, PrecompileOutcome, PrecompileStatus, PreparedRunRequest, ProblemBundleDescriptor, ProblemCollectionEntry, ProblemCollectionIndex, ProblemScore, RawExecutionMetrics, ReleaseManifest, ReplayBundle, ReplayBundleInput, ReplayDecodeOptions, ReplayHost, ReplayJudgeCaseTranscript, ReplayJudgeOperation, ReplayJudgeTranscript, ReplayOperation, ReplayOptions, ReplayResult, ReplayRunOperation, ResolveDependencyOptions, ResolvedDependencyGraph, RunOptions, Runner, RuntimeDriver, RuntimeResolver, ScoredProblemCase, SubmissionOperation, SubmissionPolicySummary, SubmissionRequest, TrustedJudgeAsset, TrustedJudgeExecutable, TrustedJudgeProgram, TrustedJudgeRuntimeProfile, TrustedJudgeWasmInfo, TrustedJudgeWasmValidationOptions, ValidateJudgePackageOptions, ValidatedJudgePackage };