@wasm-oj/organizer 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -1
- package/dist/index.d.ts +246 -2
- package/dist/index.js +2176 -444
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# `@wasm-oj/organizer`
|
|
2
2
|
|
|
3
|
-
Schemas and
|
|
3
|
+
Schemas and repository validation utilities for problem collections, contest projections, and immutable
|
|
4
4
|
judge packages. The Organizer boundary validates schema, paths, size, digest, and deployability; it
|
|
5
5
|
does not compile, run, score, or assess a reference solution.
|
|
6
|
+
|
|
7
|
+
Contest output uses only `wasm-oj-platform/contests/v2`. Authoring presets are expanded into
|
|
8
|
+
canonical typed rules before synchronization; contest v1 and unknown properties are rejected.
|
|
9
|
+
|
|
10
|
+
## Upgrading from 0.2.0
|
|
11
|
+
|
|
12
|
+
Managed collection parsers have been removed. Use `parseRepositoryRoot`,
|
|
13
|
+
`parseRepositoryProblems`, `parseRepositoryContests`, and `validateRepositoryCatalog` for the
|
|
14
|
+
repository-authored catalog. `wasm-oj.json` and its exact Git commit define catalog content.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,249 @@
|
|
|
1
|
-
export { BROWSER_COLLECTION_SCHEMA, BROWSER_PROBLEM_SCHEMA,
|
|
1
|
+
export { BROWSER_COLLECTION_SCHEMA, BROWSER_PROBLEM_SCHEMA, parseProblemCollectionIndex, parseStandaloneProblemBundle, problemCollectionRevision, verifyProblemBundleBytes, verifyProblemCollectionRevision } from '@wasm-oj/core';
|
|
2
|
+
import { BuiltinLanguage as BuiltinLanguage$1, TargetAbi, OptimizationLevel } from '@wasm-oj/contracts';
|
|
2
3
|
|
|
3
4
|
declare function runCollectionCli(arguments_: readonly string[]): Promise<void>;
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
declare const LANGUAGES: readonly ["c", "cpp", "rust", "python", "javascript", "typescript", "go"];
|
|
7
|
+
type BuiltinLanguage = (typeof LANGUAGES)[number];
|
|
8
|
+
|
|
9
|
+
declare const SUBMISSION_VERDICTS: readonly ["accepted", "wrong-answer", "runtime-error", "instruction-limit", "memory-limit", "output-limit", "filesystem-limit", "logical-time-limit", "wall-time-limit", "compile-error", "judge-error", "cancelled"];
|
|
10
|
+
type SubmissionVerdict = typeof SUBMISSION_VERDICTS[number];
|
|
11
|
+
|
|
12
|
+
type ContestEvidenceAt = "input-admitted" | "generated-source-ready" | "judge-terminal";
|
|
13
|
+
interface GlobalContestClock {
|
|
14
|
+
readonly kind: "global";
|
|
15
|
+
readonly registrationOpensAt: string;
|
|
16
|
+
readonly registrationClosesAt: string;
|
|
17
|
+
readonly startsAt: string;
|
|
18
|
+
readonly durationSeconds: number;
|
|
19
|
+
}
|
|
20
|
+
interface IndividualContestClock {
|
|
21
|
+
readonly kind: "individual";
|
|
22
|
+
readonly enrollmentOpensAt: string;
|
|
23
|
+
readonly enrollmentClosesAt: string;
|
|
24
|
+
readonly durationSeconds: number;
|
|
25
|
+
}
|
|
26
|
+
type ContestClock = GlobalContestClock | IndividualContestClock;
|
|
27
|
+
interface CodeOfficialTrack {
|
|
28
|
+
readonly kind: "code";
|
|
29
|
+
readonly aiAssist: "allowed" | "disabled";
|
|
30
|
+
}
|
|
31
|
+
interface PromptCompilerPin {
|
|
32
|
+
readonly configId: string;
|
|
33
|
+
readonly configDigest: string;
|
|
34
|
+
}
|
|
35
|
+
interface PromptProgramLimits {
|
|
36
|
+
readonly promptBytes: number;
|
|
37
|
+
readonly inputTokens: number;
|
|
38
|
+
readonly outputTokens: number;
|
|
39
|
+
readonly generatedSourceBytes: number;
|
|
40
|
+
readonly timeoutSeconds: number;
|
|
41
|
+
}
|
|
42
|
+
interface PromptAttemptPolicy {
|
|
43
|
+
readonly consumeOn: "model-response-received";
|
|
44
|
+
readonly terminalInfrastructureFailure: "release-reservation";
|
|
45
|
+
}
|
|
46
|
+
interface PromptProgramOfficialTrack {
|
|
47
|
+
readonly kind: "prompt-program";
|
|
48
|
+
readonly compiler: PromptCompilerPin;
|
|
49
|
+
readonly limits: PromptProgramLimits;
|
|
50
|
+
readonly attemptPolicy: PromptAttemptPolicy;
|
|
51
|
+
readonly disclosure: "private" | "best-after-end";
|
|
52
|
+
}
|
|
53
|
+
interface ContestProblemRuleBase {
|
|
54
|
+
readonly slug: string;
|
|
55
|
+
readonly batch: number;
|
|
56
|
+
readonly releaseAfterSeconds: number;
|
|
57
|
+
readonly submissionClosesAfterSeconds: number;
|
|
58
|
+
readonly points: number;
|
|
59
|
+
readonly attemptLimit: number;
|
|
60
|
+
}
|
|
61
|
+
interface CodeContestProblemRule extends ContestProblemRuleBase {
|
|
62
|
+
readonly output?: never;
|
|
63
|
+
}
|
|
64
|
+
interface PromptProgramOutputProfile {
|
|
65
|
+
readonly language: BuiltinLanguage$1;
|
|
66
|
+
readonly target: TargetAbi;
|
|
67
|
+
readonly optimization: OptimizationLevel;
|
|
68
|
+
readonly entry: string;
|
|
69
|
+
}
|
|
70
|
+
interface PromptProgramContestProblemRule extends ContestProblemRuleBase {
|
|
71
|
+
readonly output: PromptProgramOutputProfile;
|
|
72
|
+
}
|
|
73
|
+
type ScoreTieBreak = "fully-passed-cases" | "deterministic-cost" | "peak-memory" | "final-best-achieved-at";
|
|
74
|
+
interface ScoreContestScoring {
|
|
75
|
+
readonly kind: "score";
|
|
76
|
+
readonly tieBreaks: readonly ScoreTieBreak[];
|
|
77
|
+
}
|
|
78
|
+
type IcpcTieBreak = "last-solve-at" | "deterministic-cost" | "peak-memory";
|
|
79
|
+
interface IcpcContestScoring {
|
|
80
|
+
readonly kind: "icpc";
|
|
81
|
+
readonly wrongAttemptPenaltyMinutes: number;
|
|
82
|
+
readonly penalizedVerdicts: readonly SubmissionVerdict[];
|
|
83
|
+
readonly tieBreaks: readonly IcpcTieBreak[];
|
|
84
|
+
}
|
|
85
|
+
type ProgressTieBreak = "fully-passed-cases" | "deterministic-cost" | "peak-memory" | "final-best-achieved-at";
|
|
86
|
+
interface ProgressContestScoring {
|
|
87
|
+
readonly kind: "progress";
|
|
88
|
+
readonly tieBreaks: readonly ProgressTieBreak[];
|
|
89
|
+
}
|
|
90
|
+
type ContestScoring = ScoreContestScoring | IcpcContestScoring | ProgressContestScoring;
|
|
91
|
+
type ContestCheckpointScope = {
|
|
92
|
+
readonly kind: "all-released";
|
|
93
|
+
} | {
|
|
94
|
+
readonly kind: "batch";
|
|
95
|
+
readonly batch: number;
|
|
96
|
+
} | {
|
|
97
|
+
readonly kind: "problems";
|
|
98
|
+
readonly slugs: readonly string[];
|
|
99
|
+
};
|
|
100
|
+
interface ContestCheckpointThreshold {
|
|
101
|
+
readonly minimumSolved: number | null;
|
|
102
|
+
readonly minimumScore: number | null;
|
|
103
|
+
}
|
|
104
|
+
type ContestCheckpointRanking = {
|
|
105
|
+
readonly kind: "top-k";
|
|
106
|
+
readonly count: number;
|
|
107
|
+
} | {
|
|
108
|
+
readonly kind: "top-percent";
|
|
109
|
+
readonly percent: number;
|
|
110
|
+
} | null;
|
|
111
|
+
interface ContestCheckpointRule {
|
|
112
|
+
readonly id: string;
|
|
113
|
+
readonly atSeconds: number;
|
|
114
|
+
readonly scope: ContestCheckpointScope;
|
|
115
|
+
readonly threshold: ContestCheckpointThreshold;
|
|
116
|
+
readonly ranking: ContestCheckpointRanking;
|
|
117
|
+
readonly settlement: "provisional" | "pause-until-terminal";
|
|
118
|
+
}
|
|
119
|
+
type ContestLeaderboardRule = {
|
|
120
|
+
readonly kind: "live";
|
|
121
|
+
} | {
|
|
122
|
+
readonly kind: "freeze";
|
|
123
|
+
readonly atSeconds: number;
|
|
124
|
+
} | {
|
|
125
|
+
readonly kind: "hidden-until-end";
|
|
126
|
+
};
|
|
127
|
+
interface ContestRulesBase {
|
|
128
|
+
readonly clock: ContestClock;
|
|
129
|
+
readonly evidenceAt: ContestEvidenceAt;
|
|
130
|
+
readonly scoring: ContestScoring;
|
|
131
|
+
readonly checkpoints: readonly ContestCheckpointRule[];
|
|
132
|
+
readonly leaderboard: ContestLeaderboardRule;
|
|
133
|
+
}
|
|
134
|
+
interface CodeContestRules extends ContestRulesBase {
|
|
135
|
+
readonly officialTrack: CodeOfficialTrack;
|
|
136
|
+
readonly problems: readonly CodeContestProblemRule[];
|
|
137
|
+
}
|
|
138
|
+
interface PromptProgramContestRules extends ContestRulesBase {
|
|
139
|
+
readonly officialTrack: PromptProgramOfficialTrack;
|
|
140
|
+
readonly problems: readonly PromptProgramContestProblemRule[];
|
|
141
|
+
}
|
|
142
|
+
type ContestRules = CodeContestRules | PromptProgramContestRules;
|
|
143
|
+
|
|
144
|
+
declare const REPOSITORY_SCHEMA = "wasm-oj-platform/repository/v1";
|
|
145
|
+
declare const PROBLEMS_SCHEMA = "wasm-oj-platform/problems/v1";
|
|
146
|
+
declare const CONTESTS_SCHEMA = "wasm-oj-platform/contests/v2";
|
|
147
|
+
interface RepositoryObjectDescriptor {
|
|
148
|
+
readonly path: string;
|
|
149
|
+
readonly bytes: number;
|
|
150
|
+
readonly sha256: string;
|
|
151
|
+
}
|
|
152
|
+
interface LocalizedText {
|
|
153
|
+
readonly "zh-TW": string;
|
|
154
|
+
readonly en: string;
|
|
155
|
+
}
|
|
156
|
+
interface RepositoryRootManifest {
|
|
157
|
+
readonly schema: typeof REPOSITORY_SCHEMA;
|
|
158
|
+
readonly problems: string;
|
|
159
|
+
readonly contests: string;
|
|
160
|
+
}
|
|
161
|
+
interface RepositoryProblem {
|
|
162
|
+
readonly slug: string;
|
|
163
|
+
readonly order: number;
|
|
164
|
+
readonly title: LocalizedText;
|
|
165
|
+
readonly summary: LocalizedText;
|
|
166
|
+
readonly practiceEnabled: boolean;
|
|
167
|
+
readonly practiceBundle: RepositoryObjectDescriptor;
|
|
168
|
+
readonly contestBundle: RepositoryObjectDescriptor;
|
|
169
|
+
readonly judgePackage: RepositoryObjectDescriptor;
|
|
170
|
+
}
|
|
171
|
+
interface RepositoryProblemsManifest {
|
|
172
|
+
readonly schema: typeof PROBLEMS_SCHEMA;
|
|
173
|
+
readonly problems: readonly RepositoryProblem[];
|
|
174
|
+
}
|
|
175
|
+
type RepositoryContestStatus = "draft" | "published" | "archived";
|
|
176
|
+
type RepositoryContestAccessMode = "public" | "invite";
|
|
177
|
+
interface RepositoryContest {
|
|
178
|
+
readonly slug: string;
|
|
179
|
+
readonly status: RepositoryContestStatus;
|
|
180
|
+
readonly title: string;
|
|
181
|
+
readonly description: string;
|
|
182
|
+
readonly accessMode: RepositoryContestAccessMode;
|
|
183
|
+
readonly rules: ContestRules;
|
|
184
|
+
}
|
|
185
|
+
interface RepositoryContestsManifest {
|
|
186
|
+
readonly schema: typeof CONTESTS_SCHEMA;
|
|
187
|
+
readonly contests: readonly RepositoryContest[];
|
|
188
|
+
}
|
|
189
|
+
interface RepositoryCatalog {
|
|
190
|
+
readonly root: RepositoryRootManifest;
|
|
191
|
+
readonly problems: RepositoryProblemsManifest;
|
|
192
|
+
readonly contests: RepositoryContestsManifest;
|
|
193
|
+
}
|
|
194
|
+
declare function parseRepositoryRootValue(value: unknown): RepositoryRootManifest;
|
|
195
|
+
declare function parseRepositoryRoot(bytes: Uint8Array): RepositoryRootManifest;
|
|
196
|
+
declare function parseRepositoryProblemsValue(value: unknown): RepositoryProblemsManifest;
|
|
197
|
+
declare function parseRepositoryProblems(bytes: Uint8Array): RepositoryProblemsManifest;
|
|
198
|
+
declare function parseRepositoryContestsValue(value: unknown): RepositoryContestsManifest;
|
|
199
|
+
declare function parseRepositoryContests(bytes: Uint8Array): RepositoryContestsManifest;
|
|
200
|
+
declare function validateRepositoryCatalog(root: RepositoryRootManifest, problems: RepositoryProblemsManifest, contests: RepositoryContestsManifest): RepositoryCatalog;
|
|
201
|
+
|
|
202
|
+
interface JudgeAllowedProfile {
|
|
203
|
+
readonly target: "wasip1" | "wasix";
|
|
204
|
+
readonly optimization: "debug" | "release";
|
|
205
|
+
}
|
|
206
|
+
type JudgeAllowedProfiles = Readonly<Partial<Record<BuiltinLanguage, JudgeAllowedProfile>>>;
|
|
207
|
+
|
|
208
|
+
type TrustedJudgeRuntimeProfile = "c-wasip1-release" | "cpp-wasip1-release" | "rust-wasip1-release" | "go-wasip1-release";
|
|
209
|
+
|
|
210
|
+
declare const REPOSITORY_AUTHORING_JUDGES_SCHEMA = "wasm-oj-platform/repository-authoring-judges/v1";
|
|
211
|
+
interface RepositorySourceObject {
|
|
212
|
+
readonly path: string;
|
|
213
|
+
readonly bytes: number;
|
|
214
|
+
readonly sha256: string;
|
|
215
|
+
}
|
|
216
|
+
interface RepositorySourceArtifact extends RepositorySourceObject {
|
|
217
|
+
readonly runtimeProfile: TrustedJudgeRuntimeProfile;
|
|
218
|
+
}
|
|
219
|
+
interface RepositorySourceAsset extends RepositorySourceObject {
|
|
220
|
+
readonly guestPath: string;
|
|
221
|
+
}
|
|
222
|
+
type RepositorySourceJudge = {
|
|
223
|
+
readonly kind: "text";
|
|
224
|
+
} | {
|
|
225
|
+
readonly kind: "checker";
|
|
226
|
+
readonly artifact: RepositorySourceArtifact;
|
|
227
|
+
readonly assets: readonly RepositorySourceAsset[];
|
|
228
|
+
readonly args: readonly string[];
|
|
229
|
+
} | {
|
|
230
|
+
readonly kind: "interactive";
|
|
231
|
+
readonly artifact: RepositorySourceArtifact;
|
|
232
|
+
readonly assets: readonly RepositorySourceAsset[];
|
|
233
|
+
readonly args: readonly string[];
|
|
234
|
+
readonly inputPath: string;
|
|
235
|
+
};
|
|
236
|
+
interface RepositoryAuthoringJudgeProblem {
|
|
237
|
+
readonly slug: string;
|
|
238
|
+
readonly allowedProfiles: JudgeAllowedProfiles;
|
|
239
|
+
readonly judge: RepositorySourceJudge;
|
|
240
|
+
}
|
|
241
|
+
interface RepositoryAuthoringJudges {
|
|
242
|
+
readonly schema: typeof REPOSITORY_AUTHORING_JUDGES_SCHEMA;
|
|
243
|
+
readonly problems: readonly RepositoryAuthoringJudgeProblem[];
|
|
244
|
+
}
|
|
245
|
+
/** Author-only input used by collection build; never accepted by the platform sync boundary. */
|
|
246
|
+
declare function parseRepositoryAuthoringJudges(value: unknown): RepositoryAuthoringJudges;
|
|
247
|
+
|
|
248
|
+
export { CONTESTS_SCHEMA, PROBLEMS_SCHEMA, REPOSITORY_AUTHORING_JUDGES_SCHEMA, REPOSITORY_SCHEMA, parseRepositoryAuthoringJudges, parseRepositoryContests, parseRepositoryContestsValue, parseRepositoryProblems, parseRepositoryProblemsValue, parseRepositoryRoot, parseRepositoryRootValue, runCollectionCli, validateRepositoryCatalog };
|
|
249
|
+
export type { RepositoryCatalog, RepositoryContest, RepositoryObjectDescriptor, RepositoryProblem, RepositoryRootManifest };
|