truthguard-ai 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist-npm/Claims/index.d.ts +73 -0
  2. package/dist-npm/Claims/index.d.ts.map +1 -0
  3. package/dist-npm/Claims/index.js +1669 -0
  4. package/dist-npm/Claims/index.js.map +1 -0
  5. package/dist-npm/Config/index.d.ts +41 -0
  6. package/dist-npm/Config/index.d.ts.map +1 -0
  7. package/dist-npm/Config/index.js +129 -0
  8. package/dist-npm/Config/index.js.map +1 -0
  9. package/dist-npm/Grounding/index.d.ts +40 -0
  10. package/dist-npm/Grounding/index.d.ts.map +1 -0
  11. package/dist-npm/Grounding/index.js +1433 -0
  12. package/dist-npm/Grounding/index.js.map +1 -0
  13. package/dist-npm/L2/index.d.ts +93 -0
  14. package/dist-npm/L2/index.d.ts.map +1 -0
  15. package/dist-npm/L2/index.js +1773 -0
  16. package/dist-npm/L2/index.js.map +1 -0
  17. package/dist-npm/MCP/thin.d.ts +37 -0
  18. package/dist-npm/MCP/thin.d.ts.map +1 -0
  19. package/dist-npm/MCP/thin.js +542 -0
  20. package/dist-npm/MCP/thin.js.map +1 -0
  21. package/dist-npm/Matchers/index.d.ts +101 -0
  22. package/dist-npm/Matchers/index.d.ts.map +1 -0
  23. package/dist-npm/Matchers/index.js +690 -0
  24. package/dist-npm/Matchers/index.js.map +1 -0
  25. package/dist-npm/Mode/index.d.ts +87 -0
  26. package/dist-npm/Mode/index.d.ts.map +1 -0
  27. package/dist-npm/Mode/index.js +117 -0
  28. package/dist-npm/Mode/index.js.map +1 -0
  29. package/dist-npm/Policy/index.d.ts +89 -0
  30. package/dist-npm/Policy/index.d.ts.map +1 -0
  31. package/dist-npm/Policy/index.js +143 -0
  32. package/dist-npm/Policy/index.js.map +1 -0
  33. package/dist-npm/Registry/index.d.ts +93 -0
  34. package/dist-npm/Registry/index.d.ts.map +1 -0
  35. package/dist-npm/Registry/index.js +818 -0
  36. package/dist-npm/Registry/index.js.map +1 -0
  37. package/dist-npm/Rules/index.d.ts +587 -0
  38. package/dist-npm/Rules/index.d.ts.map +1 -0
  39. package/dist-npm/Rules/index.js +6236 -0
  40. package/dist-npm/Rules/index.js.map +1 -0
  41. package/dist-npm/Rules/intents.d.ts +22 -0
  42. package/dist-npm/Rules/intents.d.ts.map +1 -0
  43. package/dist-npm/Rules/intents.js +242 -0
  44. package/dist-npm/Rules/intents.js.map +1 -0
  45. package/dist-npm/TraceReadiness/index.d.ts +42 -0
  46. package/dist-npm/TraceReadiness/index.d.ts.map +1 -0
  47. package/dist-npm/TraceReadiness/index.js +169 -0
  48. package/dist-npm/TraceReadiness/index.js.map +1 -0
  49. package/dist-npm/cli-entry.d.ts +7 -0
  50. package/dist-npm/cli-entry.d.ts.map +1 -0
  51. package/dist-npm/cli-entry.js +23 -0
  52. package/dist-npm/cli-entry.js.map +1 -0
  53. package/dist-npm/i18n/index.d.ts +44 -0
  54. package/dist-npm/i18n/index.d.ts.map +1 -0
  55. package/dist-npm/i18n/index.js +124 -0
  56. package/dist-npm/i18n/index.js.map +1 -0
  57. package/package.json +6 -15
  58. package/dist/cli/index.d.ts +0 -15
  59. package/dist/cli/index.d.ts.map +0 -1
  60. package/dist/cli/index.js +0 -807
  61. package/dist/cli/index.js.map +0 -1
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Claim Extractor
3
+ *
4
+ * Extracts factual claims from free-form LLM text.
5
+ *
6
+ * V1 supports:
7
+ * - numbers (integer and decimal)
8
+ * - dates (common formats → ISO-8601)
9
+ * - names (capitalised multi-word proper nouns)
10
+ * - counts (explicit "N [items]" patterns)
11
+ *
12
+ * V1 explicitly skips vague qualitative claims ("most", "significant", "many").
13
+ */
14
+ import type { Claim, TraceStepRole } from '../types';
15
+ /**
16
+ * Attempt to parse a date-like string into an ISO-8601 date (YYYY-MM-DD).
17
+ * Returns null if parsing fails.
18
+ */
19
+ export declare function tryParseDate(raw: string, _referenceDate?: Date): string | null;
20
+ /**
21
+ * A date range representing a period (inclusive start, inclusive end).
22
+ */
23
+ export interface PeriodBounds {
24
+ start: string;
25
+ end: string;
26
+ label: string;
27
+ }
28
+ /**
29
+ * Parse a period expression into start/end bounds.
30
+ * Supports: Q1-Q4, H1/H2, FY, YTD, MTD, "last quarter", "this quarter",
31
+ * "last month", "this month", "MonthName YYYY", "YYYY", rolling periods.
32
+ *
33
+ * Returns null if the expression is not a recognized period.
34
+ */
35
+ export declare function parsePeriodBounds(raw: string, referenceDate?: Date): PeriodBounds | null;
36
+ /**
37
+ * Strip diacritics (č→c, ć→c, š→s, ž→z, đ→d, etc.) and lowercase.
38
+ * Allows entity matching across diacritic and case variants.
39
+ */
40
+ export declare function normalizeEntityName(name: string): string;
41
+ /**
42
+ * Check if two entity names refer to the same person/thing.
43
+ * Handles: case, diacritics, partial name matching (first/last name subset).
44
+ */
45
+ export declare function entitiesMatch(a: string, b: string): boolean;
46
+ /**
47
+ * Strips combining diacritical marks for matching purposes.
48
+ * "Tasić" → "Tasic", "Čačak" → "Cacak", "Новосибирск" → "Новосибирск" (Cyrillic unchanged).
49
+ * Uses Unicode NFD decomposition + strip combining marks (U+0300–U+036F).
50
+ */
51
+ export declare function normalizeDiacritics(str: string): string;
52
+ /** Options for claim extraction. */
53
+ export interface ExtractorOptions {
54
+ /** Step ID of the source (defaults to 'unknown'). */
55
+ sourceStepId?: string;
56
+ /** Role of the source step. */
57
+ sourceRole?: TraceStepRole;
58
+ /** Reference date for resolving relative dates ("yesterday", "pre 3 dana"). Defaults to now. */
59
+ referenceDate?: Date;
60
+ }
61
+ /**
62
+ * Extracts factual claims from a text string.
63
+ *
64
+ * Extraction order:
65
+ * 1. Dates — before numbers so date digits are not re-extracted as numbers
66
+ * 2. Counts — before numbers so count numerals are not re-extracted as plain numbers
67
+ * 3. Numbers
68
+ * 4. Names
69
+ *
70
+ * Vague qualitative claims are skipped.
71
+ */
72
+ export declare function extractClaims(text: string, options?: ExtractorOptions): Claim[];
73
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Claims/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,KAAK,EAAE,KAAK,EAA0B,aAAa,EAAY,MAAM,UAAU,CAAC;AAyGvF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CA6J9E;AAcD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAYD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,IAAI,GAAG,YAAY,GAAG,IAAI,CAyLxF;AAkXD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQxD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAoB3D;AAqSD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvD;AA4CD,oCAAoC;AACpC,MAAM,WAAW,gBAAgB;IAC/B,qDAAqD;IACrD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+BAA+B;IAC/B,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,gGAAgG;IAChG,aAAa,CAAC,EAAE,IAAI,CAAC;CACtB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,KAAK,EAAE,CA4jBnF"}