superlab 0.1.9 → 0.1.10

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/lib/context.cjs CHANGED
@@ -28,7 +28,7 @@ function readWorkflowLanguage(targetDir) {
28
28
  function extractValue(text, labels) {
29
29
  for (const label of labels) {
30
30
  const escaped = label.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
31
- const regex = new RegExp(`^\\s*(?:[-\\d.]+\\s*)?${escaped}:\\s*(.+?)\\s*$`, "im");
31
+ const regex = new RegExp(`^\\s*(?:[-\\d.]+\\s*)?${escaped}:[ \\t]*([^\\n\\r]+?)[ \\t]*$`, "im");
32
32
  const match = text.match(regex);
33
33
  if (match && match[1]) {
34
34
  return match[1].trim();
@@ -53,6 +53,10 @@ function extractOpenQuestion(text) {
53
53
  return "";
54
54
  }
55
55
 
56
+ function joinNonEmpty(parts, separator = "; ") {
57
+ return parts.filter(Boolean).join(separator);
58
+ }
59
+
56
60
  function extractClaim(text) {
57
61
  const blocks = text
58
62
  .split(/\n(?=\d+\.\s)/)
@@ -67,6 +71,10 @@ function extractClaim(text) {
67
71
  return "";
68
72
  }
69
73
 
74
+ function labelValue(text, englishLabels, chineseLabels = []) {
75
+ return extractValue(text, [...englishLabels, ...chineseLabels]);
76
+ }
77
+
70
78
  function renderSummary(lang, data) {
71
79
  if (lang === "zh") {
72
80
  return `# 研究摘要
@@ -76,6 +84,15 @@ function renderSummary(lang, data) {
76
84
  - Mission: ${data.problem || "待补充"}
77
85
  - Approved direction: ${data.direction || "待补充"}
78
86
  - Active stage: ${data.stage || "待补充"}
87
+ - Dataset package: ${data.datasetPackage || "待补充"}
88
+ - Dataset years: ${data.datasetYears || "待补充"}
89
+ - Benchmark role: ${data.benchmarkRole || "待补充"}
90
+ - Benchmark rationale: ${data.benchmarkRationale || "待补充"}
91
+ - Comparison suite: ${data.comparisonMethods || "待补充"}
92
+ - Comparison rationale: ${data.comparisonRationale || "待补充"}
93
+ - Comparison evidence: ${data.comparisonEvidence || "待补充"}
94
+ - Source basis: ${data.datasetSources || "待补充"}
95
+ - Representative papers: ${data.datasetPapers || "待补充"}
79
96
 
80
97
  ## 最强证据
81
98
 
@@ -98,6 +115,15 @@ function renderSummary(lang, data) {
98
115
  - Mission: ${data.problem || "TBD"}
99
116
  - Approved direction: ${data.direction || "TBD"}
100
117
  - Active stage: ${data.stage || "TBD"}
118
+ - Dataset package: ${data.datasetPackage || "TBD"}
119
+ - Dataset years: ${data.datasetYears || "TBD"}
120
+ - Benchmark role: ${data.benchmarkRole || "TBD"}
121
+ - Benchmark rationale: ${data.benchmarkRationale || "TBD"}
122
+ - Comparison suite: ${data.comparisonMethods || "TBD"}
123
+ - Comparison rationale: ${data.comparisonRationale || "TBD"}
124
+ - Comparison evidence: ${data.comparisonEvidence || "TBD"}
125
+ - Source basis: ${data.datasetSources || "TBD"}
126
+ - Representative papers: ${data.datasetPapers || "TBD"}
101
127
 
102
128
  ## Strongest Evidence
103
129
 
@@ -175,6 +201,15 @@ ${data.problem || "待补充"}
175
201
 
176
202
  - Approved direction: ${data.direction || "待补充"}
177
203
  - Why this is the active path: ${data.why || "当前已批准方向"}
204
+ - Dataset package: ${data.datasetPackage || "待补充"}
205
+ - Dataset years: ${data.datasetYears || "待补充"}
206
+ - Benchmark role: ${data.benchmarkRole || "待补充"}
207
+ - Benchmark rationale: ${data.benchmarkRationale || "待补充"}
208
+ - Comparison suite: ${data.comparisonMethods || "待补充"}
209
+ - Comparison rationale: ${data.comparisonRationale || "待补充"}
210
+ - Comparison evidence: ${data.comparisonEvidence || "待补充"}
211
+ - Source basis: ${data.datasetSources || "待补充"}
212
+ - Representative papers: ${data.datasetPapers || "待补充"}
178
213
 
179
214
  ## 主要风险
180
215
 
@@ -208,6 +243,15 @@ ${data.problem || "TBD"}
208
243
 
209
244
  - Approved direction: ${data.direction || "TBD"}
210
245
  - Why this is the active path: ${data.why || "This is the approved direction"}
246
+ - Dataset package: ${data.datasetPackage || "TBD"}
247
+ - Dataset years: ${data.datasetYears || "TBD"}
248
+ - Benchmark role: ${data.benchmarkRole || "TBD"}
249
+ - Benchmark rationale: ${data.benchmarkRationale || "TBD"}
250
+ - Comparison suite: ${data.comparisonMethods || "TBD"}
251
+ - Comparison rationale: ${data.comparisonRationale || "TBD"}
252
+ - Comparison evidence: ${data.comparisonEvidence || "TBD"}
253
+ - Source basis: ${data.datasetSources || "TBD"}
254
+ - Representative papers: ${data.datasetPapers || "TBD"}
211
255
 
212
256
  ## Main Risk
213
257
 
@@ -232,6 +276,62 @@ function buildContextSnapshot(targetDir) {
232
276
  const state = readFileIfExists(contextFile(targetDir, "state.md"));
233
277
  const evidence = readFileIfExists(contextFile(targetDir, "evidence-index.md"));
234
278
  const questions = readFileIfExists(contextFile(targetDir, "open-questions.md"));
279
+ const dataDecisions = readFileIfExists(contextFile(targetDir, "data-decisions.md"));
280
+ const classicBenchmarks = labelValue(
281
+ dataDecisions,
282
+ ["Classic public benchmarks", "Classic benchmarks"],
283
+ ["经典公开 benchmark", "经典 benchmark"]
284
+ );
285
+ const recentBenchmarks = labelValue(
286
+ dataDecisions,
287
+ ["Recent strong public benchmarks", "Latest benchmarks"],
288
+ ["近期强公开 benchmark", "最新 benchmark"]
289
+ );
290
+ const claimSpecificBenchmarks = labelValue(
291
+ dataDecisions,
292
+ ["Claim-specific benchmarks"],
293
+ ["专项 benchmark"]
294
+ );
295
+ const canonicalComparisons = labelValue(
296
+ dataDecisions,
297
+ ["Canonical baselines", "Classic comparison methods"],
298
+ ["规范基线", "经典对比方法"]
299
+ );
300
+ const strongHistoricalComparisons = labelValue(
301
+ dataDecisions,
302
+ ["Strong historical baselines"],
303
+ ["强历史基线"]
304
+ );
305
+ const recentComparisons = labelValue(
306
+ dataDecisions,
307
+ ["Recent strong public methods", "Recent strong or SOTA comparison methods"],
308
+ ["近期强公开方法", "近期强基线或 SOTA 对比方法"]
309
+ );
310
+ const closestPriorWork = labelValue(
311
+ dataDecisions,
312
+ ["Closest prior work"],
313
+ ["最接近的前作"]
314
+ );
315
+ const canonicalComparisonPapers = labelValue(
316
+ dataDecisions,
317
+ ["Representative papers for canonical baselines"],
318
+ ["规范基线的代表论文"]
319
+ );
320
+ const strongHistoricalComparisonPapers = labelValue(
321
+ dataDecisions,
322
+ ["Representative papers for strong historical baselines"],
323
+ ["强历史基线的代表论文"]
324
+ );
325
+ const recentComparisonPapers = labelValue(
326
+ dataDecisions,
327
+ ["Representative papers for recent strong public methods"],
328
+ ["近期强公开方法的代表论文"]
329
+ );
330
+ const closestPriorPapers = labelValue(
331
+ dataDecisions,
332
+ ["Representative papers for closest prior work"],
333
+ ["最接近前作的代表论文"]
334
+ );
235
335
 
236
336
  return {
237
337
  problem: extractValue(mission, ["One-sentence problem", "一句话问题"]),
@@ -246,6 +346,128 @@ function buildContextSnapshot(targetDir) {
246
346
  claim: extractClaim(evidence),
247
347
  question: extractOpenQuestion(questions),
248
348
  risk: extractValue(questions, ["Why it matters", "为什么重要"]) || extractValue(state, ["Current blocker", "当前阻塞"]),
349
+ datasetPackage:
350
+ extractValue(dataDecisions, ["Approved dataset package", "已批准数据集包"]) ||
351
+ extractValue(dataDecisions, ["Approved datasets", "已批准数据集"]),
352
+ datasetYears: extractValue(dataDecisions, ["Dataset years", "数据集年份"]),
353
+ datasetPapers: extractValue(dataDecisions, ["Papers that used the approved datasets", "使用过已批准数据集的论文", "使用过该数据集的论文"]),
354
+ datasetSources: joinNonEmpty(
355
+ [
356
+ labelValue(dataDecisions, ["Why the selected download sources are trusted"], ["为什么这些下载来源可信"]),
357
+ labelValue(dataDecisions, ["Official benchmark or dataset pages"], ["官方 benchmark 或数据集页面"]),
358
+ ],
359
+ " | "
360
+ ),
361
+ benchmarkRationale: joinNonEmpty(
362
+ [
363
+ (() => {
364
+ const value = labelValue(
365
+ dataDecisions,
366
+ ["Why classic public benchmarks are included", "Why classic benchmarks are included"],
367
+ ["为什么纳入经典公开 benchmark", "为什么纳入经典 benchmark"]
368
+ );
369
+ return value ? `Classic public: ${value}` : "";
370
+ })(),
371
+ (() => {
372
+ const value = labelValue(
373
+ dataDecisions,
374
+ ["Why recent strong public benchmarks are included", "Why latest benchmarks are included"],
375
+ ["为什么纳入近期强公开 benchmark", "为什么纳入最新 benchmark"]
376
+ );
377
+ return value ? `Recent strong public: ${value}` : "";
378
+ })(),
379
+ (() => {
380
+ const value = labelValue(
381
+ dataDecisions,
382
+ ["Why claim-specific benchmarks are included or why none are needed"],
383
+ ["为什么纳入专项 benchmark 或为什么不需要"]
384
+ );
385
+ return value ? `Claim-specific: ${value}` : "";
386
+ })(),
387
+ (() => {
388
+ const value = labelValue(
389
+ dataDecisions,
390
+ ["Why this benchmark mix is representative"],
391
+ ["为什么这个 benchmark 组合具有代表性"]
392
+ );
393
+ return value ? `Mix: ${value}` : "";
394
+ })(),
395
+ ],
396
+ " | "
397
+ ),
398
+ comparisonMethods: joinNonEmpty(
399
+ [
400
+ canonicalComparisons ? `Canonical: ${canonicalComparisons}` : "",
401
+ strongHistoricalComparisons ? `Strong historical: ${strongHistoricalComparisons}` : "",
402
+ recentComparisons ? `Recent strong public: ${recentComparisons}` : "",
403
+ closestPriorWork ? `Closest prior: ${closestPriorWork}` : "",
404
+ ],
405
+ "; "
406
+ ),
407
+ comparisonEvidence: joinNonEmpty(
408
+ [
409
+ canonicalComparisonPapers ? `Canonical baselines: ${canonicalComparisonPapers}` : "",
410
+ strongHistoricalComparisonPapers
411
+ ? `Strong historical baselines: ${strongHistoricalComparisonPapers}`
412
+ : "",
413
+ recentComparisonPapers ? `Recent strong public methods: ${recentComparisonPapers}` : "",
414
+ closestPriorPapers ? `Closest prior work: ${closestPriorPapers}` : "",
415
+ ],
416
+ " | "
417
+ ),
418
+ comparisonRationale: joinNonEmpty(
419
+ [
420
+ (() => {
421
+ const value = labelValue(
422
+ dataDecisions,
423
+ ["Why these canonical baselines are included", "Why these classic baselines are included"],
424
+ ["为什么纳入这些规范基线", "为什么纳入这些经典基线"]
425
+ );
426
+ return value ? `Canonical baselines: ${value}` : "";
427
+ })(),
428
+ (() => {
429
+ const value = labelValue(
430
+ dataDecisions,
431
+ ["Why these strong historical baselines are included"],
432
+ ["为什么纳入这些强历史基线"]
433
+ );
434
+ return value ? `Strong historical baselines: ${value}` : "";
435
+ })(),
436
+ (() => {
437
+ const value = labelValue(
438
+ dataDecisions,
439
+ ["Why these recent strong public methods are included", "Why these recent or SOTA baselines are included"],
440
+ ["为什么纳入这些近期强公开方法", "为什么纳入这些近期或 SOTA 基线"]
441
+ );
442
+ return value ? `Recent strong public methods: ${value}` : "";
443
+ })(),
444
+ (() => {
445
+ const value = labelValue(
446
+ dataDecisions,
447
+ ["Why this closest prior work is included or why none qualifies"],
448
+ ["为什么纳入这个最接近的前作或为什么没有合格项"]
449
+ );
450
+ return value ? `Closest prior work: ${value}` : "";
451
+ })(),
452
+ (() => {
453
+ const value = labelValue(
454
+ dataDecisions,
455
+ ["Why these comparison methods are fair"],
456
+ ["为什么这些对比方法是公平的"]
457
+ );
458
+ return value ? `Fairness: ${value}` : "";
459
+ })(),
460
+ ],
461
+ " | "
462
+ ),
463
+ benchmarkRole: joinNonEmpty(
464
+ [
465
+ classicBenchmarks ? `Classic public: ${classicBenchmarks}` : "",
466
+ recentBenchmarks ? `Recent strong public: ${recentBenchmarks}` : "",
467
+ claimSpecificBenchmarks ? `Claim-specific: ${claimSpecificBenchmarks}` : "",
468
+ ],
469
+ "; "
470
+ ),
249
471
  };
250
472
  }
251
473