truthguard-ai 0.2.0 → 0.3.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.
Potentially problematic release.
This version of truthguard-ai might be problematic. Click here for more details.
- package/dist-npm/Claims/index.d.ts +73 -0
- package/dist-npm/Claims/index.d.ts.map +1 -0
- package/dist-npm/Claims/index.js +1669 -0
- package/dist-npm/Claims/index.js.map +1 -0
- package/dist-npm/Config/index.d.ts +41 -0
- package/dist-npm/Config/index.d.ts.map +1 -0
- package/dist-npm/Config/index.js +129 -0
- package/dist-npm/Config/index.js.map +1 -0
- package/dist-npm/Grounding/index.d.ts +40 -0
- package/dist-npm/Grounding/index.d.ts.map +1 -0
- package/dist-npm/Grounding/index.js +1433 -0
- package/dist-npm/Grounding/index.js.map +1 -0
- package/dist-npm/L2/index.d.ts +93 -0
- package/dist-npm/L2/index.d.ts.map +1 -0
- package/dist-npm/L2/index.js +1773 -0
- package/dist-npm/L2/index.js.map +1 -0
- package/dist-npm/Matchers/index.d.ts +101 -0
- package/dist-npm/Matchers/index.d.ts.map +1 -0
- package/dist-npm/Matchers/index.js +690 -0
- package/dist-npm/Matchers/index.js.map +1 -0
- package/dist-npm/Mode/index.d.ts +87 -0
- package/dist-npm/Mode/index.d.ts.map +1 -0
- package/dist-npm/Mode/index.js +117 -0
- package/dist-npm/Mode/index.js.map +1 -0
- package/dist-npm/Policy/index.d.ts +89 -0
- package/dist-npm/Policy/index.d.ts.map +1 -0
- package/dist-npm/Policy/index.js +143 -0
- package/dist-npm/Policy/index.js.map +1 -0
- package/dist-npm/Registry/index.d.ts +93 -0
- package/dist-npm/Registry/index.d.ts.map +1 -0
- package/dist-npm/Registry/index.js +818 -0
- package/dist-npm/Registry/index.js.map +1 -0
- package/dist-npm/Rules/index.d.ts +587 -0
- package/dist-npm/Rules/index.d.ts.map +1 -0
- package/dist-npm/Rules/index.js +6236 -0
- package/dist-npm/Rules/index.js.map +1 -0
- package/dist-npm/Rules/intents.d.ts +22 -0
- package/dist-npm/Rules/intents.d.ts.map +1 -0
- package/dist-npm/Rules/intents.js +242 -0
- package/dist-npm/Rules/intents.js.map +1 -0
- package/dist-npm/TraceReadiness/index.d.ts +42 -0
- package/dist-npm/TraceReadiness/index.d.ts.map +1 -0
- package/dist-npm/TraceReadiness/index.js +169 -0
- package/dist-npm/TraceReadiness/index.js.map +1 -0
- package/dist-npm/i18n/index.d.ts +44 -0
- package/dist-npm/i18n/index.d.ts.map +1 -0
- package/dist-npm/i18n/index.js +124 -0
- package/dist-npm/i18n/index.js.map +1 -0
- package/package.json +5 -17
- package/dist/cli/index.d.ts +0 -15
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -807
- package/dist/cli/index.js.map +0 -1
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ---------------------------------------------------------------------------
|
|
3
|
+
// Multilingual aggregation intent keywords
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
// Covers top 10 world languages by speakers + Serbian:
|
|
6
|
+
// English, Mandarin Chinese, Hindi, Spanish, French, Arabic,
|
|
7
|
+
// Bengali, Portuguese, Russian, Japanese, Serbian
|
|
8
|
+
//
|
|
9
|
+
// To add a new language: append keywords to the relevant `keywords` array.
|
|
10
|
+
// To add a new operation: add a new entry to AGGREGATION_INTENTS.
|
|
11
|
+
//
|
|
12
|
+
// Guidelines:
|
|
13
|
+
// • Latin-script words use \b word boundaries (e.g. \bsum\b)
|
|
14
|
+
// • CJK / Cyrillic / Devanagari / Arabic / Bengali — no \b (JS \b
|
|
15
|
+
// doesn't match non-ASCII word boundaries), just literal characters
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.TRANSFORMATIONAL_INTENTS = exports.GROUPING_INTENTS = exports.AGGREGATION_INTENTS = void 0;
|
|
19
|
+
// ── helpers ──────────────────────────────────────────────────────────────────
|
|
20
|
+
/** Wrap a Latin-script keyword with \b word boundaries. */
|
|
21
|
+
function wb(word) {
|
|
22
|
+
return `\\b${word}\\b`;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Build a case-insensitive regex from a list of raw keyword strings.
|
|
26
|
+
* Latin-script entries are automatically wrapped with \b boundaries.
|
|
27
|
+
*/
|
|
28
|
+
function buildPattern(keywords) {
|
|
29
|
+
const parts = keywords.map((kw) =>
|
|
30
|
+
// If keyword is purely ASCII-Latin (with optional accents in capture),
|
|
31
|
+
// wrap in \b. Otherwise use as-is for CJK/Cyrillic/Devanagari/Arabic/Bengali.
|
|
32
|
+
/^[\x20-\x7F\u00C0-\u024F\\[\]().+*?|{}^$]+$/.test(kw) ? wb(kw) : kw);
|
|
33
|
+
return new RegExp(`(?:${parts.join('|')})`, 'i');
|
|
34
|
+
}
|
|
35
|
+
// ── intent definitions ───────────────────────────────────────────────────────
|
|
36
|
+
exports.AGGREGATION_INTENTS = [
|
|
37
|
+
{
|
|
38
|
+
op: 'sum',
|
|
39
|
+
pattern: buildPattern([
|
|
40
|
+
// English
|
|
41
|
+
'sum', 'total', 'altogether', 'combined', 'in total', 'all together',
|
|
42
|
+
// Serbian
|
|
43
|
+
'zbir', 'zbirno', 'ukupno', 'ukupan', 'ukupna', 'sveukupno',
|
|
44
|
+
// Chinese (Simplified + Traditional)
|
|
45
|
+
'合计', '总计', '总共', '总和', '合計', '合算',
|
|
46
|
+
// Hindi
|
|
47
|
+
'कुल', 'जोड़', 'योग',
|
|
48
|
+
// Spanish
|
|
49
|
+
'suma', 'en total',
|
|
50
|
+
// French
|
|
51
|
+
'somme', 'au total',
|
|
52
|
+
// Arabic
|
|
53
|
+
'مجموع', 'إجمالي', 'المجموع',
|
|
54
|
+
// Bengali
|
|
55
|
+
'মোট', 'যোগফল',
|
|
56
|
+
// Portuguese
|
|
57
|
+
'soma', 'no total',
|
|
58
|
+
// Russian
|
|
59
|
+
'итого', 'сумма', 'всего',
|
|
60
|
+
// Japanese (shares CJK characters above)
|
|
61
|
+
]),
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
op: 'average',
|
|
65
|
+
pattern: buildPattern([
|
|
66
|
+
// English
|
|
67
|
+
'average', 'mean', 'avg',
|
|
68
|
+
// Serbian
|
|
69
|
+
'prosek', 'prose[čc]n[aoie]',
|
|
70
|
+
// Chinese
|
|
71
|
+
'平均', '平均值',
|
|
72
|
+
// Hindi
|
|
73
|
+
'औसत',
|
|
74
|
+
// Spanish
|
|
75
|
+
'promedio',
|
|
76
|
+
// French
|
|
77
|
+
'moyenne',
|
|
78
|
+
// Arabic
|
|
79
|
+
'متوسط', 'معدل',
|
|
80
|
+
// Bengali
|
|
81
|
+
'গড়',
|
|
82
|
+
// Portuguese
|
|
83
|
+
'm[eé]dia',
|
|
84
|
+
// Russian
|
|
85
|
+
'среднее', 'средн',
|
|
86
|
+
// Japanese
|
|
87
|
+
'平均値',
|
|
88
|
+
]),
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
op: 'max',
|
|
92
|
+
pattern: buildPattern([
|
|
93
|
+
// English
|
|
94
|
+
'highest', 'maximum', 'most', 'largest', 'top', 'biggest', 'greatest',
|
|
95
|
+
// Serbian
|
|
96
|
+
'najv[ei][cć][aie]', 'najvi[sš]e',
|
|
97
|
+
// Chinese
|
|
98
|
+
'最高', '最大', '最多',
|
|
99
|
+
// Hindi
|
|
100
|
+
'सबसे ज्यादा', 'सबसे अधिक',
|
|
101
|
+
// Spanish
|
|
102
|
+
'm[aá]ximo', 'mayor',
|
|
103
|
+
// French
|
|
104
|
+
'le plus',
|
|
105
|
+
// Arabic
|
|
106
|
+
'الأعلى', 'الأكثر', 'أقصى',
|
|
107
|
+
// Bengali
|
|
108
|
+
'সবচেয়ে বেশি', 'সর্বোচ্চ',
|
|
109
|
+
// Portuguese
|
|
110
|
+
'maior',
|
|
111
|
+
// Russian
|
|
112
|
+
'максимум', 'наибольш',
|
|
113
|
+
// Japanese
|
|
114
|
+
'一番',
|
|
115
|
+
]),
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
op: 'min',
|
|
119
|
+
pattern: buildPattern([
|
|
120
|
+
// English
|
|
121
|
+
'lowest', 'minimum', 'least', 'smallest', 'fewest',
|
|
122
|
+
// Serbian
|
|
123
|
+
'najm[ae]nj[aie]', 'najmanje',
|
|
124
|
+
// Chinese
|
|
125
|
+
'最低', '最小', '最少',
|
|
126
|
+
// Hindi
|
|
127
|
+
'सबसे कम', 'सबसे न्यून',
|
|
128
|
+
// Spanish
|
|
129
|
+
'm[ií]nimo', 'menor',
|
|
130
|
+
// French
|
|
131
|
+
'le moins',
|
|
132
|
+
// Arabic
|
|
133
|
+
'الأقل', 'الأدنى', 'أقل',
|
|
134
|
+
// Bengali
|
|
135
|
+
'সবচেয়ে কম', 'সর্বনিম্ন',
|
|
136
|
+
// Russian
|
|
137
|
+
'минимум', 'наименьш',
|
|
138
|
+
]),
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
op: 'difference',
|
|
142
|
+
pattern: buildPattern([
|
|
143
|
+
// English
|
|
144
|
+
'difference', 'differ', 'gap between',
|
|
145
|
+
// Serbian
|
|
146
|
+
'razlika',
|
|
147
|
+
// Chinese
|
|
148
|
+
'差异', '差别', '差距',
|
|
149
|
+
// Hindi
|
|
150
|
+
'अंतर', 'फर्क',
|
|
151
|
+
// Spanish
|
|
152
|
+
'diferencia',
|
|
153
|
+
// French
|
|
154
|
+
'diff[eé]rence',
|
|
155
|
+
// Arabic
|
|
156
|
+
'الفرق',
|
|
157
|
+
// Bengali
|
|
158
|
+
'পার্থক্য',
|
|
159
|
+
// Portuguese
|
|
160
|
+
'diferen[cç]a',
|
|
161
|
+
// Russian
|
|
162
|
+
'разниц',
|
|
163
|
+
// Japanese
|
|
164
|
+
'違い',
|
|
165
|
+
]),
|
|
166
|
+
},
|
|
167
|
+
];
|
|
168
|
+
exports.GROUPING_INTENTS = [
|
|
169
|
+
// English
|
|
170
|
+
{ label: 'by X', pattern: /\b(?:by|per|for each|for every|grouped by|group by|broken down by|breakdown by|split by|segmented by)\s+/i },
|
|
171
|
+
// Serbian
|
|
172
|
+
{ label: 'po X', pattern: /\b(?:po|za svak[oiue]g?|po svakom|prema|grupisano po|grupi[sš]i po|podeljeno po|razbijeno po)\s+/i },
|
|
173
|
+
// Chinese
|
|
174
|
+
{ label: '按X', pattern: /(?:按|每个|分[类別别]|各个?|逐个?)/ },
|
|
175
|
+
// Hindi
|
|
176
|
+
{ label: 'प्रति X', pattern: /(?:प्रति|हर\s*एक|के\s*अनुसार|विभाग\s*के)/ },
|
|
177
|
+
// Spanish
|
|
178
|
+
{ label: 'por X', pattern: /\b(?:por|para cada|agrupado por|desglosado por)\s+/i },
|
|
179
|
+
// French
|
|
180
|
+
{ label: 'par X', pattern: /\b(?:par|pour chaque|group[eé] par|ventil[eé] par)\s+/i },
|
|
181
|
+
// Arabic
|
|
182
|
+
{ label: 'لكل X', pattern: /(?:لكل|حسب|بحسب|وفق)/ },
|
|
183
|
+
// Bengali
|
|
184
|
+
{ label: 'প্রতি X', pattern: /(?:প্রতি|প্রত্যেক|অনুসারে)/ },
|
|
185
|
+
// Portuguese
|
|
186
|
+
{ label: 'por X', pattern: /\b(?:por|para cada|agrupado por|dividido por)\s+/i },
|
|
187
|
+
// Russian
|
|
188
|
+
{ label: 'по X', pattern: /(?:по каждому|по каждой|по\s+(?!\d)|для каждого|для каждой|в разрезе|сгруппирован)/i },
|
|
189
|
+
// Japanese
|
|
190
|
+
{ label: 'ごとに', pattern: /(?:ごとに|別に|毎に|分類)/ },
|
|
191
|
+
];
|
|
192
|
+
exports.TRANSFORMATIONAL_INTENTS = [
|
|
193
|
+
{
|
|
194
|
+
label: 'net_vs_gross',
|
|
195
|
+
pattern: buildPattern([
|
|
196
|
+
// English
|
|
197
|
+
'net', 'gross', 'after[- ]?tax', 'before[- ]?tax', 'take[- ]?home',
|
|
198
|
+
'pre[- ]?tax', 'post[- ]?tax', 'after deductions',
|
|
199
|
+
// Serbian
|
|
200
|
+
'neto', 'bruto', 'nakon poreza', 'pre poreza', 'posle poreza',
|
|
201
|
+
'nakon odbitaka', 'posle odbitaka', 'čist[ao]',
|
|
202
|
+
// Chinese
|
|
203
|
+
'净', '毛', '税后', '税前', '到手',
|
|
204
|
+
// Hindi
|
|
205
|
+
'शुद्ध', 'सकल', 'कर के बाद', 'कर से पहले',
|
|
206
|
+
// Spanish
|
|
207
|
+
'neto', 'bruto', 'despu[eé]s de impuestos', 'antes de impuestos',
|
|
208
|
+
// French
|
|
209
|
+
'apr[eè]s imp[oô]ts?', 'avant imp[oô]ts?',
|
|
210
|
+
// Russian
|
|
211
|
+
'чист', 'после налог', 'до налог', 'на руки',
|
|
212
|
+
]),
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
label: 'discount_adjustment',
|
|
216
|
+
pattern: buildPattern([
|
|
217
|
+
'discounted', 'with discount', 'after discount', 'adjusted',
|
|
218
|
+
'normalized', 'annualized', 'prorated', 'pro[- ]?rata',
|
|
219
|
+
// Serbian
|
|
220
|
+
'sa popustom', 'sa rabatom', 'korigovano', 'anualizirano',
|
|
221
|
+
'srazmer[ao]', 'proporcionalno',
|
|
222
|
+
// Chinese
|
|
223
|
+
'折扣后', '调整后', '年化',
|
|
224
|
+
// Russian
|
|
225
|
+
'со скидкой', 'скорректирован', 'аннуализирован',
|
|
226
|
+
]),
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
label: 'derived_metric',
|
|
230
|
+
pattern: buildPattern([
|
|
231
|
+
'margin', 'ratio', 'rate of', 'percentage of', 'share of',
|
|
232
|
+
'turnover rate', 'attrition rate', 'retention rate', 'utilization',
|
|
233
|
+
// Serbian
|
|
234
|
+
'mar[žz]a', 'stopa', 'procenat', 'u[čc]e[sš][ćc]e', 'fluktuacija',
|
|
235
|
+
// Chinese
|
|
236
|
+
'利润率', '比率', '百分比', '周转率', '流失率',
|
|
237
|
+
// Russian
|
|
238
|
+
'маржа', 'коэффициент', 'доля', 'текучесть',
|
|
239
|
+
]),
|
|
240
|
+
},
|
|
241
|
+
];
|
|
242
|
+
//# sourceMappingURL=intents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intents.js","sourceRoot":"","sources":["../../src/Rules/intents.ts"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,2CAA2C;AAC3C,8EAA8E;AAC9E,uDAAuD;AACvD,+DAA+D;AAC/D,oDAAoD;AACpD,EAAE;AACF,2EAA2E;AAC3E,kEAAkE;AAClE,EAAE;AACF,cAAc;AACd,+DAA+D;AAC/D,oEAAoE;AACpE,wEAAwE;AACxE,8EAA8E;;;AAS9E,gFAAgF;AAEhF,2DAA2D;AAC3D,SAAS,EAAE,CAAC,IAAY;IACtB,OAAO,MAAM,IAAI,KAAK,CAAC;AACzB,CAAC;AAED;;;GAGG;AACH,SAAS,YAAY,CAAC,QAAkB;IACtC,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;IAChC,uEAAuE;IACvE,8EAA8E;IAC9E,6CAA6C,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CACrE,CAAC;IACF,OAAO,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACnD,CAAC;AAED,gFAAgF;AAEnE,QAAA,mBAAmB,GAAwB;IACtD;QACE,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,YAAY,CAAC;YACpB,UAAU;YACV,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc;YACpE,UAAU;YACV,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW;YAC3D,qCAAqC;YACrC,IAAI,EAAE,IAAI,EAAE,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C3D,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc;YACtD,UAAU;YACV,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc;YACzD,aAAa,EAAE,gBAAgB;YAC/B,UAAU;YACV,KAAK,EAAE,KAAK,EAAE,IAAI;YAClB,UAAU;YACV,YAAY,EAAE,gBAAgB,EAAE,gBAAgB;SACjD,CAAC;KACH;IACD;QACE,KAAK,EAAE,gBAAgB;QACvB,OAAO,EAAE,YAAY,CAAC;YACpB,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU;YACzD,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa;YAClE,UAAU;YACV,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,aAAa;YACjE,UAAU;YACV,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;YAChC,UAAU;YACV,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW;SAC5C,CAAC;KACH;CACF,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trace Readiness Check — assesses trace quality before evaluation.
|
|
3
|
+
*
|
|
4
|
+
* Answers two fundamental questions:
|
|
5
|
+
* 1. Is this trace complete enough for reliable grounding analysis?
|
|
6
|
+
* 2. What CANNOT be verified given the missing elements?
|
|
7
|
+
*
|
|
8
|
+
* The goal is to help users distinguish "no evidence of error" from
|
|
9
|
+
* "we found evidence of an error" — the CT-scan analogy.
|
|
10
|
+
*/
|
|
11
|
+
import type { Trace } from '../types';
|
|
12
|
+
export type TraceElement = 'system_prompt' | 'user_input' | 'tool_calls' | 'tool_outputs' | 'final_response';
|
|
13
|
+
export interface ContractElement {
|
|
14
|
+
element: TraceElement;
|
|
15
|
+
/** Is this element required for any evaluation at all? */
|
|
16
|
+
required: boolean;
|
|
17
|
+
/** What grounding capabilities depend on this element? */
|
|
18
|
+
enables: string[];
|
|
19
|
+
}
|
|
20
|
+
export declare const TRACE_CONTRACT: ContractElement[];
|
|
21
|
+
export type TraceQuality = 'HIGH' | 'MEDIUM' | 'LOW';
|
|
22
|
+
export interface ChecklistItem {
|
|
23
|
+
element: TraceElement;
|
|
24
|
+
present: boolean;
|
|
25
|
+
required: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface TraceQualityReport {
|
|
28
|
+
/** Overall quality assessment. */
|
|
29
|
+
quality: TraceQuality;
|
|
30
|
+
/** Completeness percentage (0–100). */
|
|
31
|
+
completeness: number;
|
|
32
|
+
/** Per-element checklist. */
|
|
33
|
+
checklist: ChecklistItem[];
|
|
34
|
+
/** Whether the trace has enough data for reliable grounding. */
|
|
35
|
+
groundingReady: boolean;
|
|
36
|
+
/** Specific capabilities that CANNOT be verified due to missing elements. */
|
|
37
|
+
cannotVerify: string[];
|
|
38
|
+
/** Human-readable recommendation for what to add. */
|
|
39
|
+
recommendations: string[];
|
|
40
|
+
}
|
|
41
|
+
export declare function assessTraceQuality(trace: Trace): TraceQualityReport;
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/TraceReadiness/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAiB,MAAM,UAAU,CAAC;AAOrD,MAAM,MAAM,YAAY,GACpB,eAAe,GACf,YAAY,GACZ,YAAY,GACZ,cAAc,GACd,gBAAgB,CAAC;AAErB,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,YAAY,CAAC;IACtB,0DAA0D;IAC1D,QAAQ,EAAE,OAAO,CAAC;IAClB,0DAA0D;IAC1D,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,eAAO,MAAM,cAAc,EAAE,eAAe,EA0B3C,CAAC;AAMF,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAErD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,YAAY,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,kCAAkC;IAClC,OAAO,EAAE,YAAY,CAAC;IACtB,uCAAuC;IACvC,YAAY,EAAE,MAAM,CAAC;IACrB,6BAA6B;IAC7B,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,gEAAgE;IAChE,cAAc,EAAE,OAAO,CAAC;IACxB,6EAA6E;IAC7E,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,qDAAqD;IACrD,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B;AA2CD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,kBAAkB,CAwGnE"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Trace Readiness Check — assesses trace quality before evaluation.
|
|
4
|
+
*
|
|
5
|
+
* Answers two fundamental questions:
|
|
6
|
+
* 1. Is this trace complete enough for reliable grounding analysis?
|
|
7
|
+
* 2. What CANNOT be verified given the missing elements?
|
|
8
|
+
*
|
|
9
|
+
* The goal is to help users distinguish "no evidence of error" from
|
|
10
|
+
* "we found evidence of an error" — the CT-scan analogy.
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.TRACE_CONTRACT = void 0;
|
|
14
|
+
exports.assessTraceQuality = assessTraceQuality;
|
|
15
|
+
const Trace_1 = require("../Trace");
|
|
16
|
+
exports.TRACE_CONTRACT = [
|
|
17
|
+
{
|
|
18
|
+
element: 'user_input',
|
|
19
|
+
required: true,
|
|
20
|
+
enables: ['query validation', 'wrong_query detection', 'scope verification'],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
element: 'final_response',
|
|
24
|
+
required: true,
|
|
25
|
+
enables: ['claim extraction', 'all grounding checks'],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
element: 'tool_calls',
|
|
29
|
+
required: false,
|
|
30
|
+
enables: ['query parameter verification', 'scope/period validation', 'wrong_query detection'],
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
element: 'tool_outputs',
|
|
34
|
+
required: false,
|
|
35
|
+
enables: ['data accuracy verification', 'numeric grounding', 'entity matching', 'date verification'],
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
element: 'system_prompt',
|
|
39
|
+
required: false,
|
|
40
|
+
enables: ['instruction compliance checks', 'name/entity grounding from prompt'],
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
// ---------------------------------------------------------------------------
|
|
44
|
+
// Impact mapping — what each missing element prevents
|
|
45
|
+
// ---------------------------------------------------------------------------
|
|
46
|
+
const MISSING_IMPACT = {
|
|
47
|
+
user_input: [
|
|
48
|
+
'Cannot validate query correctness (wrong_query)',
|
|
49
|
+
'Cannot verify scope or period parameters',
|
|
50
|
+
],
|
|
51
|
+
final_response: [
|
|
52
|
+
'Cannot extract claims — no response to evaluate',
|
|
53
|
+
'Cannot perform any grounding checks',
|
|
54
|
+
],
|
|
55
|
+
tool_calls: [
|
|
56
|
+
'Cannot verify query parameters were correct',
|
|
57
|
+
'Cannot detect wrong_query errors',
|
|
58
|
+
'Cannot validate period/scope correctness',
|
|
59
|
+
],
|
|
60
|
+
tool_outputs: [
|
|
61
|
+
'Cannot verify data accuracy (numbers, dates, names)',
|
|
62
|
+
'Cannot detect empty_fabrication',
|
|
63
|
+
'Cannot perform numeric grounding',
|
|
64
|
+
'Cannot detect entity mismatches',
|
|
65
|
+
],
|
|
66
|
+
system_prompt: [
|
|
67
|
+
'Cannot verify instruction compliance',
|
|
68
|
+
],
|
|
69
|
+
};
|
|
70
|
+
const MISSING_RECOMMENDATIONS = {
|
|
71
|
+
user_input: 'Store the user\'s original question/request as a step with role "user_input".',
|
|
72
|
+
final_response: 'Store the agent\'s final answer as a step with role "final_response".',
|
|
73
|
+
tool_calls: 'Store each tool/function call with role "tool_call", including toolCalls[{toolName, parameters}].',
|
|
74
|
+
tool_outputs: 'Store each tool response with role "tool_output", including toolOutputs[{toolName, output}].',
|
|
75
|
+
system_prompt: 'Optionally store the system prompt with role "system_prompt" for instruction compliance checks.',
|
|
76
|
+
};
|
|
77
|
+
// ---------------------------------------------------------------------------
|
|
78
|
+
// Core assessment function
|
|
79
|
+
// ---------------------------------------------------------------------------
|
|
80
|
+
function assessTraceQuality(trace) {
|
|
81
|
+
const roles = new Set(trace.steps.map((s) => s.role));
|
|
82
|
+
// Check each contract element
|
|
83
|
+
const hasUserInput = roles.has('user_input');
|
|
84
|
+
const hasFinalResponse = roles.has('final_response');
|
|
85
|
+
const hasToolCalls = Trace_1.TraceUtils.hasToolCalls(trace);
|
|
86
|
+
const toolOutputSteps = Trace_1.TraceUtils.getToolOutputSteps(trace);
|
|
87
|
+
const hasToolOutputs = toolOutputSteps.some((s) => (s.toolOutputs ?? []).some((to) => to.output !== null && to.output !== undefined));
|
|
88
|
+
const hasSystemPrompt = roles.has('system_prompt');
|
|
89
|
+
const presence = {
|
|
90
|
+
user_input: hasUserInput,
|
|
91
|
+
final_response: hasFinalResponse,
|
|
92
|
+
tool_calls: hasToolCalls,
|
|
93
|
+
tool_outputs: hasToolOutputs,
|
|
94
|
+
system_prompt: hasSystemPrompt,
|
|
95
|
+
};
|
|
96
|
+
// Build checklist
|
|
97
|
+
const checklist = exports.TRACE_CONTRACT.map((ce) => ({
|
|
98
|
+
element: ce.element,
|
|
99
|
+
present: presence[ce.element],
|
|
100
|
+
required: ce.required,
|
|
101
|
+
}));
|
|
102
|
+
// Completeness: required elements count double
|
|
103
|
+
const weights = {
|
|
104
|
+
user_input: 2,
|
|
105
|
+
final_response: 2,
|
|
106
|
+
tool_calls: 3,
|
|
107
|
+
tool_outputs: 3,
|
|
108
|
+
system_prompt: 1,
|
|
109
|
+
};
|
|
110
|
+
let totalWeight = 0;
|
|
111
|
+
let presentWeight = 0;
|
|
112
|
+
for (const item of checklist) {
|
|
113
|
+
const w = weights[item.element];
|
|
114
|
+
totalWeight += w;
|
|
115
|
+
if (item.present)
|
|
116
|
+
presentWeight += w;
|
|
117
|
+
}
|
|
118
|
+
const completeness = Math.round((presentWeight / totalWeight) * 100);
|
|
119
|
+
// Grounding readiness: needs tool_outputs for reliable grounding
|
|
120
|
+
const groundingReady = hasToolOutputs && hasFinalResponse;
|
|
121
|
+
// Collect impacts of missing elements
|
|
122
|
+
const cannotVerify = [];
|
|
123
|
+
for (const [element, impact] of Object.entries(MISSING_IMPACT)) {
|
|
124
|
+
if (!presence[element]) {
|
|
125
|
+
cannotVerify.push(...impact);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
// Detect tool-name-only outputs: steps that had content but it was just
|
|
129
|
+
// the function name, not actual data (set by normalizeTrace via _toolNameOnly metadata)
|
|
130
|
+
const toolNameOnlySteps = toolOutputSteps.filter((s) => s.metadata && typeof s.metadata._toolNameOnly === 'string');
|
|
131
|
+
const toolNameOnlyNames = toolNameOnlySteps.map((s) => s.metadata._toolNameOnly);
|
|
132
|
+
// Recommendations for missing elements
|
|
133
|
+
const recommendations = [];
|
|
134
|
+
// Highest priority: tool-name-only is a critical instrumentation problem
|
|
135
|
+
if (toolNameOnlyNames.length > 0) {
|
|
136
|
+
const examples = [...new Set(toolNameOnlyNames)].slice(0, 3).join(', ');
|
|
137
|
+
recommendations.push(`CRITICAL: Your tool_output steps contain only the function name (${examples}) instead of actual API response data. ` +
|
|
138
|
+
`The "content" field of tool_output must contain the real data returned by the tool (e.g., JSON with names, numbers, dates). ` +
|
|
139
|
+
`Without real data, TruthGuard cannot verify any claims. Fix your trace capture to store the tool's return value.`);
|
|
140
|
+
}
|
|
141
|
+
for (const [element, rec] of Object.entries(MISSING_RECOMMENDATIONS)) {
|
|
142
|
+
if (!presence[element]) {
|
|
143
|
+
// Skip system_prompt recommendation when everything else is present
|
|
144
|
+
if (element === 'system_prompt' && cannotVerify.length <= 1)
|
|
145
|
+
continue;
|
|
146
|
+
recommendations.push(rec);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
// Quality level
|
|
150
|
+
let quality;
|
|
151
|
+
if (groundingReady && hasUserInput && hasToolCalls) {
|
|
152
|
+
quality = 'HIGH';
|
|
153
|
+
}
|
|
154
|
+
else if (hasFinalResponse && (hasToolOutputs || hasToolCalls)) {
|
|
155
|
+
quality = 'MEDIUM';
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
quality = 'LOW';
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
quality,
|
|
162
|
+
completeness,
|
|
163
|
+
checklist,
|
|
164
|
+
groundingReady,
|
|
165
|
+
cannotVerify,
|
|
166
|
+
recommendations,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/TraceReadiness/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAwHH,gDAwGC;AA7ND,oCAAsC;AAqBzB,QAAA,cAAc,GAAsB;IAC/C;QACE,OAAO,EAAE,YAAY;QACrB,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,CAAC,kBAAkB,EAAE,uBAAuB,EAAE,oBAAoB,CAAC;KAC7E;IACD;QACE,OAAO,EAAE,gBAAgB;QACzB,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,CAAC,kBAAkB,EAAE,sBAAsB,CAAC;KACtD;IACD;QACE,OAAO,EAAE,YAAY;QACrB,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,CAAC,8BAA8B,EAAE,yBAAyB,EAAE,uBAAuB,CAAC;KAC9F;IACD;QACE,OAAO,EAAE,cAAc;QACvB,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,CAAC,4BAA4B,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,m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C,QAAQ,CAAC,OAAuB,CAAC,EAAE,CAAC;YACvC,oEAAoE;YACpE,IAAI,OAAO,KAAK,eAAe,IAAI,YAAY,CAAC,MAAM,IAAI,CAAC;gBAAE,SAAS;YACtE,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAED,gBAAgB;IAChB,IAAI,OAAqB,CAAC;IAC1B,IAAI,cAAc,IAAI,YAAY,IAAI,YAAY,EAAE,CAAC;QACnD,OAAO,GAAG,MAAM,CAAC;IACnB,CAAC;SAAM,IAAI,gBAAgB,IAAI,CAAC,cAAc,IAAI,YAAY,CAAC,EAAE,CAAC;QAChE,OAAO,GAAG,QAAQ,CAAC;IACrB,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,KAAK,CAAC;IAClB,CAAC;IAED,OAAO;QACL,OAAO;QACP,YAAY;QACZ,SAAS;QACT,cAAc;QACd,YAAY;QACZ,eAAe;KAChB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized multilingual constants for TruthGuard.
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for month names, stop words, and query stop words.
|
|
5
|
+
* Imported by Claims, Rules, and other modules to avoid duplication.
|
|
6
|
+
*
|
|
7
|
+
* Covers 11 languages: English, Spanish, French, Portuguese, Serbian,
|
|
8
|
+
* Russian, Hindi, Arabic, Bengali, Mandarin Chinese, Japanese.
|
|
9
|
+
*/
|
|
10
|
+
/** English month names (full + abbreviated). */
|
|
11
|
+
export declare const EN_MONTHS = "january|jan|february|feb|march|mar|april|apr|may|june|jun|july|jul|august|aug|september|sep|sept|october|oct|november|nov|december|dec";
|
|
12
|
+
/** Serbian month names (nominative + genitive). */
|
|
13
|
+
export declare const SR_MONTHS = "januar|januara|februar|februara|mart|marta|maj|maja|avgust|avgusta|septembar|septembra|oktobar|oktobra|novembar|novembra|decembar|decembra";
|
|
14
|
+
/** Spanish month names. */
|
|
15
|
+
export declare const ES_MONTHS = "enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre";
|
|
16
|
+
/** French month names (with and without accents). */
|
|
17
|
+
export declare const FR_MONTHS = "janvier|f\u00E9vrier|fevrier|mars|avril|mai|juin|juillet|ao\u00FBt|aout|septembre|octobre|novembre|d\u00E9cembre|decembre";
|
|
18
|
+
/** Portuguese month names (with and without accents). */
|
|
19
|
+
export declare const PT_MONTHS = "janeiro|fevereiro|mar\u00E7o|marco|maio|junho|julho|setembro|outubro|novembro|dezembro";
|
|
20
|
+
/** Russian month names (nominative + genitive). */
|
|
21
|
+
export declare const RU_MONTHS = "\u044F\u043D\u0432\u0430\u0440\u044C|\u0444\u0435\u0432\u0440\u0430\u043B\u044C|\u043C\u0430\u0440\u0442|\u0430\u043F\u0440\u0435\u043B\u044C|\u043C\u0430\u0439|\u0438\u044E\u043D\u044C|\u0438\u044E\u043B\u044C|\u0430\u0432\u0433\u0443\u0441\u0442|\u0441\u0435\u043D\u0442\u044F\u0431\u0440\u044C|\u043E\u043A\u0442\u044F\u0431\u0440\u044C|\u043D\u043E\u044F\u0431\u0440\u044C|\u0434\u0435\u043A\u0430\u0431\u0440\u044C|\u044F\u043D\u0432\u0430\u0440\u044F|\u0444\u0435\u0432\u0440\u0430\u043B\u044F|\u043C\u0430\u0440\u0442\u0430|\u0430\u043F\u0440\u0435\u043B\u044F|\u043C\u0430\u044F|\u0438\u044E\u043D\u044F|\u0438\u044E\u043B\u044F|\u0430\u0432\u0433\u0443\u0441\u0442\u0430|\u0441\u0435\u043D\u0442\u044F\u0431\u0440\u044F|\u043E\u043A\u0442\u044F\u0431\u0440\u044F|\u043D\u043E\u044F\u0431\u0440\u044F|\u0434\u0435\u043A\u0430\u0431\u0440\u044F";
|
|
22
|
+
/** Hindi month names. */
|
|
23
|
+
export declare const HI_MONTHS = "\u091C\u0928\u0935\u0930\u0940|\u092B\u0930\u0935\u0930\u0940|\u092E\u093E\u0930\u094D\u091A|\u0905\u092A\u094D\u0930\u0948\u0932|\u092E\u0908|\u091C\u0942\u0928|\u091C\u0941\u0932\u093E\u0908|\u0905\u0917\u0938\u094D\u0924|\u0938\u093F\u0924\u0902\u092C\u0930|\u0905\u0915\u094D\u0924\u0942\u092C\u0930|\u0928\u0935\u0902\u092C\u0930|\u0926\u093F\u0938\u0902\u092C\u0930";
|
|
24
|
+
/** Arabic month names. */
|
|
25
|
+
export declare const AR_MONTHS = "\u064A\u0646\u0627\u064A\u0631|\u0641\u0628\u0631\u0627\u064A\u0631|\u0645\u0627\u0631\u0633|\u0623\u0628\u0631\u064A\u0644|\u0645\u0627\u064A\u0648|\u064A\u0648\u0646\u064A\u0648|\u064A\u0648\u0644\u064A\u0648|\u0623\u063A\u0633\u0637\u0633|\u0633\u0628\u062A\u0645\u0628\u0631|\u0623\u0643\u062A\u0648\u0628\u0631|\u0646\u0648\u0641\u0645\u0628\u0631|\u062F\u064A\u0633\u0645\u0628\u0631";
|
|
26
|
+
/** Bengali month names. */
|
|
27
|
+
export declare const BN_MONTHS = "\u099C\u09BE\u09A8\u09C1\u09AF\u09BC\u09BE\u09B0\u09BF|\u09AB\u09C7\u09AC\u09CD\u09B0\u09C1\u09AF\u09BC\u09BE\u09B0\u09BF|\u09AE\u09BE\u09B0\u09CD\u099A|\u098F\u09AA\u09CD\u09B0\u09BF\u09B2|\u09AE\u09C7|\u099C\u09C1\u09A8|\u099C\u09C1\u09B2\u09BE\u0987|\u0986\u0997\u09B8\u09CD\u099F|\u09B8\u09C7\u09AA\u09CD\u099F\u09C7\u09AE\u09CD\u09AC\u09B0|\u0985\u0995\u09CD\u099F\u09CB\u09AC\u09B0|\u09A8\u09AD\u09C7\u09AE\u09CD\u09AC\u09B0|\u09A1\u09BF\u09B8\u09C7\u09AE\u09CD\u09AC\u09B0";
|
|
28
|
+
/** Chinese/Japanese month names (十二月 and 十一月 first to avoid prefix match). */
|
|
29
|
+
export declare const ZH_JA_MONTHS = "\u5341\u4E8C\u6708|\u5341\u4E00\u6708|\u4E00\u6708|\u4E8C\u6708|\u4E09\u6708|\u56DB\u6708|\u4E94\u6708|\u516D\u6708|\u4E03\u6708|\u516B\u6708|\u4E5D\u6708|\u5341\u6708";
|
|
30
|
+
/** All month names across all 11 languages (pipe-separated for regex). */
|
|
31
|
+
export declare const ALL_MONTHS: string;
|
|
32
|
+
export declare const MONTH_MAP: Record<string, string>;
|
|
33
|
+
/**
|
|
34
|
+
* Common English words that frequently appear in section headers, labels,
|
|
35
|
+
* and bullet points when title-cased. Names composed entirely of these
|
|
36
|
+
* are almost certainly headings, not real entity names.
|
|
37
|
+
*/
|
|
38
|
+
export declare const HEADING_STOP_WORDS: Set<string>;
|
|
39
|
+
/**
|
|
40
|
+
* Common function words to skip when extracting meaningful terms from text.
|
|
41
|
+
* Used by partial_answer detection and irrelevant_context detection.
|
|
42
|
+
*/
|
|
43
|
+
export declare const QUERY_STOP_WORDS: Set<string>;
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/i18n/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,gDAAgD;AAChD,eAAO,MAAM,SAAS,2IAA2I,CAAC;AAClK,mDAAmD;AACnD,eAAO,MAAM,SAAS,+IAA+I,CAAC;AACtK,2BAA2B;AAC3B,eAAO,MAAM,SAAS,6FAA6F,CAAC;AACpH,qDAAqD;AACrD,eAAO,MAAM,SAAS,8HAA+G,CAAC;AACtI,yDAAyD;AACzD,eAAO,MAAM,SAAS,2FAAsF,CAAC;AAC7G,mDAAmD;AACnD,eAAO,MAAM,SAAS,w1BAAsK,CAAC;AAC7L,yBAAyB;AACzB,eAAO,MAAM,SAAS,wXAA4E,CAAC;AACnG,0BAA0B;AAC1B,eAAO,MAAM,SAAS,0YAA+E,CAAC;AACtG,2BAA2B;AAC3B,eAAO,MAAM,SAAS,oeAA8F,CAAC;AACrH,8EAA8E;AAC9E,eAAO,MAAM,YAAY,4KAA0C,CAAC;AAEpE,0EAA0E;AAC1E,eAAO,MAAM,UAAU,QAA8H,CAAC;AAMtJ,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA8C5C,CAAC;AAMF;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,aAc7B,CAAC;AAMH;;;GAGG;AACH,eAAO,MAAM,gBAAgB,aAK3B,CAAC"}
|