@bendyline/gezel-sdk 1.0.9 → 1.0.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/dist/checks.d.ts CHANGED
@@ -318,6 +318,24 @@ declare function jsonPathEquals(ws: WorkspaceLike, file: string, path: string, e
318
318
  * spacing survive. (Ported verbatim from decoy-research.)
319
319
  */
320
320
  declare function normalizeDigitGroups(text: string): string;
321
+ /**
322
+ * Drop inline-emphasis delimiters so a value is compared as a value, not as
323
+ * formatting. A deck that writes `Original wait: **14** minutes` is quoting
324
+ * its source exactly; the asterisks are presentation and must not decide a
325
+ * grounding verdict.
326
+ *
327
+ * Wild-caught on the powerpoint-deck eval: a correct, correctly-cited slide
328
+ * failed `valueGrounding` for /14 minutes/ because the model had bolded the
329
+ * figure. A gate that rejects right answers over markdown caps the pass rate
330
+ * of every model equally, which is the one kind of failure an eval must never
331
+ * manufacture.
332
+ *
333
+ * Only the UNAMBIGUOUS delimiters are stripped — `**`, `__`, and backticks.
334
+ * Single `*` and `_` are deliberately left alone: `_` is a word character in
335
+ * every identifier a fact might legitimately require (`read_file`), and `*`
336
+ * carries meaning in globs.
337
+ */
338
+ declare function normalizeInlineEmphasis(text: string): string;
321
339
  /** A single grounded fact: at least one `required` form must appear and no
322
340
  * `forbidden` (decoy) form may. Values are regex sources, matched
323
341
  * case-insensitively against the (optionally digit-normalized) text. */
@@ -829,4 +847,4 @@ declare function workspaceFromGezel(g: {
829
847
  };
830
848
  }): WorkspaceLike;
831
849
 
832
- export { type CellType, type CheckResult, type CitationsResult, type CodebaseReviewReportOptions, type CodebaseReviewReportResult, type CorpusCoverageLedger, type CorpusCoverageMergeResult, type CorpusCoverageShardInput, type CsvShapeResult, type CsvShapeSpec, type EntitiesResult, type EntitySpec, type ExplainableSniff, GateScriptResult, type GroundingFact, type GroundingResult, IMG_EXT, type ImageRefsReport, type InlineScript, type JsonPathEqualsResult, type JsonScalar, type JudgeVerdict, MIN_INLINE_JS_BYTES, MIN_JUDGE_EVIDENCE_SUBSTRING, type MarkdownHeadingsMatchResult, type ParsedTable, type PlanRow, type PlanStructureResult, type PlanStructureSpec, type ReadingLevelResult, type RecordFieldSpec, type RecordSchemaResult, type RecordSchemaSpec, type ScriptValidation, type SecurityReportOptions, type SecurityReportResult, type TableShapeResult, type TableShapeSpec, type UnsupportedClaimPattern, type UnsupportedClaimViolation, type UnsupportedClaimsResult, type ValuesSubsetResult, type ValuesSubsetSpec, type WordBandResult, type WorkspaceLike, buildJudgePrompt, citationsResolve, citedPathKey, cleanCitedPath, codebaseReviewReport, containsPattern, countDistinctMatches, createCitedPathChecker, cssMinBytes, csvShape, dataTableSniff, detectTypeScriptOnlySyntax, detectUnclosedScript, esmImports, explainSniff, extractInlineScripts, fileCountByExt, fileMinBytes, fileMinLines, findImageRefs, gateResult, grepMatches, htmlCompleteSniff, htmlGameSniff, imageRefsResolve, inlineJsBytes, isRealIsoDate, jsonPathEquals, jsonValid, markdownHeadingsMatch, mergeCorpusCoverageShards, namedEntitiesConsistent, normalizeDigitGroups, notContainsPattern, parseCsv, parseJudgeVerdict, parseMarkdownTable, planStructure, readingLevel, recordSchema, requireOrderedSections, resolveRelative, securityReport, standaloneJsParses, tableShape, totalMinBytes, unsupportedClaims, validateJudgeEvidence, validateScriptSyntax, valueGrounding, valuesSubsetOf, wordBand, workspaceFromGezel, wrapperReturnHint };
850
+ export { type CellType, type CheckResult, type CitationsResult, type CodebaseReviewReportOptions, type CodebaseReviewReportResult, type CorpusCoverageLedger, type CorpusCoverageMergeResult, type CorpusCoverageShardInput, type CsvShapeResult, type CsvShapeSpec, type EntitiesResult, type EntitySpec, type ExplainableSniff, GateScriptResult, type GroundingFact, type GroundingResult, IMG_EXT, type ImageRefsReport, type InlineScript, type JsonPathEqualsResult, type JsonScalar, type JudgeVerdict, MIN_INLINE_JS_BYTES, MIN_JUDGE_EVIDENCE_SUBSTRING, type MarkdownHeadingsMatchResult, type ParsedTable, type PlanRow, type PlanStructureResult, type PlanStructureSpec, type ReadingLevelResult, type RecordFieldSpec, type RecordSchemaResult, type RecordSchemaSpec, type ScriptValidation, type SecurityReportOptions, type SecurityReportResult, type TableShapeResult, type TableShapeSpec, type UnsupportedClaimPattern, type UnsupportedClaimViolation, type UnsupportedClaimsResult, type ValuesSubsetResult, type ValuesSubsetSpec, type WordBandResult, type WorkspaceLike, buildJudgePrompt, citationsResolve, citedPathKey, cleanCitedPath, codebaseReviewReport, containsPattern, countDistinctMatches, createCitedPathChecker, cssMinBytes, csvShape, dataTableSniff, detectTypeScriptOnlySyntax, detectUnclosedScript, esmImports, explainSniff, extractInlineScripts, fileCountByExt, fileMinBytes, fileMinLines, findImageRefs, gateResult, grepMatches, htmlCompleteSniff, htmlGameSniff, imageRefsResolve, inlineJsBytes, isRealIsoDate, jsonPathEquals, jsonValid, markdownHeadingsMatch, mergeCorpusCoverageShards, namedEntitiesConsistent, normalizeDigitGroups, normalizeInlineEmphasis, notContainsPattern, parseCsv, parseJudgeVerdict, parseMarkdownTable, planStructure, readingLevel, recordSchema, requireOrderedSections, resolveRelative, securityReport, standaloneJsParses, tableShape, totalMinBytes, unsupportedClaims, validateJudgeEvidence, validateScriptSyntax, valueGrounding, valuesSubsetOf, wordBand, workspaceFromGezel, wrapperReturnHint };
package/dist/checks.js CHANGED
@@ -529,6 +529,9 @@ async function jsonPathEquals(ws, file, path, expected, label) {
529
529
  function normalizeDigitGroups(text) {
530
530
  return text.replace(/(\d)[,\s](?=\d{3}(?:\D|$))/g, "$1");
531
531
  }
532
+ function normalizeInlineEmphasis(text) {
533
+ return text.replace(/\*\*|__|`/g, "");
534
+ }
532
535
  function safeRegExp(src, flags) {
533
536
  try {
534
537
  return new RegExp(src, flags);
@@ -537,7 +540,9 @@ function safeRegExp(src, flags) {
537
540
  }
538
541
  }
539
542
  function valueGrounding(text, facts, opts = {}) {
540
- const haystack = opts.normalizeDigits === false ? text : normalizeDigitGroups(text);
543
+ const haystack = normalizeInlineEmphasis(
544
+ opts.normalizeDigits === false ? text : normalizeDigitGroups(text)
545
+ );
541
546
  const signals = [];
542
547
  const decoysDetected = [];
543
548
  let firstFailure = null;
@@ -579,13 +584,14 @@ var DEFAULT_CITATION_RE = (
579
584
  function stripFencedBlocks(text) {
580
585
  return text.replace(/^[ \t]*(`{3,}|~{3,})[^\n]*\n[\s\S]*?^[ \t]*\1[ \t]*$/gm, "").replace(/^[ \t]*(`{3,}|~{3,})[^\n]*\n[\s\S]*$/m, "");
581
586
  }
587
+ var TASK_REF_RE = /^[A-Za-z0-9][A-Za-z0-9._-]*\/\d+$/;
582
588
  function extractCitations(text, re) {
583
589
  const flags = re.flags.includes("g") ? re.flags : `${re.flags}g`;
584
590
  const global = new RegExp(re.source, flags);
585
591
  const out = [];
586
592
  for (const m of stripFencedBlocks(text).matchAll(global)) {
587
593
  const cap = m.slice(1).find((x) => x !== void 0) ?? m[0];
588
- if (cap) out.push(cap);
594
+ if (cap && !TASK_REF_RE.test(cap)) out.push(cap);
589
595
  }
590
596
  return out;
591
597
  }
@@ -1700,13 +1706,15 @@ function headingLevelHint(file, documentHeadings, h2s, expected) {
1700
1706
  return `${file} puts its ${expected} slides at \`##\`${title}, but slides are split on H1 \u2014 as written this converts to a single slide. Promote each \`## Slide\` heading to \`# \` and drop the document title.`;
1701
1707
  }
1702
1708
  function outlineSlideHeadings(markdown) {
1703
- const headings = [];
1709
+ const explicit = [];
1710
+ const numberedOnly = [];
1704
1711
  for (const match of markdown.matchAll(/^#{2,6}\s+(.+?)\s*$/gm)) {
1705
1712
  const raw = match[1].trim();
1706
- const numbered = /^(?:slide\s+)?\d+(?:\s*[.:\-–—]\s*|\s+)(\S.*)$/i.exec(raw);
1707
- if (numbered?.[1]) headings.push(numbered[1].trim());
1713
+ const numbered = /^(slide\s+)?\d+(?:\s*[.:\-–—]\s*|\s+)(\S.*)$/i.exec(raw);
1714
+ if (!numbered?.[2]) continue;
1715
+ (numbered[1] ? explicit : numberedOnly).push(numbered[2].trim());
1708
1716
  }
1709
- return headings;
1717
+ return explicit.length > 0 ? explicit : numberedOnly;
1710
1718
  }
1711
1719
  async function markdownHeadingsMatch(ws, file, outlineFile, outlineWs = ws) {
1712
1720
  const [document, outline] = await Promise.all([ws.read(file), outlineWs.read(outlineFile)]);
@@ -2269,6 +2277,7 @@ export {
2269
2277
  mergeCorpusCoverageShards,
2270
2278
  namedEntitiesConsistent,
2271
2279
  normalizeDigitGroups,
2280
+ normalizeInlineEmphasis,
2272
2281
  notContainsPattern,
2273
2282
  parseCsv,
2274
2283
  parseJudgeVerdict,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bendyline/gezel-sdk",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "SDK imported by scripts running in the Gezel sandbox. Exposes the `gezel` object and `defineScript` helper.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -59,7 +59,7 @@
59
59
  "!dist/**/*.map"
60
60
  ],
61
61
  "devDependencies": {
62
- "@bendyline/gezel": "1.1.1",
62
+ "@bendyline/gezel": "1.1.2",
63
63
  "tsup": "^8.5.1",
64
64
  "typescript": "^6.0.3",
65
65
  "vitest": "^4.1.10"