@contractspec/lib.knowledge 2.4.0 → 2.6.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 (44) hide show
  1. package/dist/access/guard.d.ts +3 -0
  2. package/dist/access/guard.js +290 -5
  3. package/dist/access/index.js +290 -5
  4. package/dist/i18n/catalogs/en.d.ts +8 -0
  5. package/dist/i18n/catalogs/en.js +107 -0
  6. package/dist/i18n/catalogs/es.d.ts +6 -0
  7. package/dist/i18n/catalogs/es.js +80 -0
  8. package/dist/i18n/catalogs/fr.d.ts +6 -0
  9. package/dist/i18n/catalogs/fr.js +80 -0
  10. package/dist/i18n/catalogs/index.d.ts +8 -0
  11. package/dist/i18n/catalogs/index.js +263 -0
  12. package/dist/i18n/i18n.test.d.ts +1 -0
  13. package/dist/i18n/index.d.ts +27 -0
  14. package/dist/i18n/index.js +321 -0
  15. package/dist/i18n/keys.d.ts +74 -0
  16. package/dist/i18n/keys.js +33 -0
  17. package/dist/i18n/locale.d.ts +8 -0
  18. package/dist/i18n/locale.js +14 -0
  19. package/dist/i18n/messages.d.ts +14 -0
  20. package/dist/i18n/messages.js +275 -0
  21. package/dist/index.js +316 -23
  22. package/dist/ingestion/gmail-adapter.d.ts +2 -1
  23. package/dist/ingestion/gmail-adapter.js +284 -8
  24. package/dist/ingestion/index.js +284 -8
  25. package/dist/node/access/guard.js +290 -5
  26. package/dist/node/access/index.js +290 -5
  27. package/dist/node/i18n/catalogs/en.js +106 -0
  28. package/dist/node/i18n/catalogs/es.js +79 -0
  29. package/dist/node/i18n/catalogs/fr.js +79 -0
  30. package/dist/node/i18n/catalogs/index.js +262 -0
  31. package/dist/node/i18n/index.js +320 -0
  32. package/dist/node/i18n/keys.js +32 -0
  33. package/dist/node/i18n/locale.js +13 -0
  34. package/dist/node/i18n/messages.js +274 -0
  35. package/dist/node/index.js +316 -23
  36. package/dist/node/ingestion/gmail-adapter.js +284 -8
  37. package/dist/node/ingestion/index.js +284 -8
  38. package/dist/node/query/index.js +282 -10
  39. package/dist/node/query/service.js +282 -10
  40. package/dist/query/index.js +282 -10
  41. package/dist/query/service.d.ts +3 -0
  42. package/dist/query/service.js +282 -10
  43. package/dist/types.d.ts +2 -0
  44. package/package.json +125 -5
@@ -0,0 +1,263 @@
1
+ // @bun
2
+ // src/i18n/catalogs/en.ts
3
+ import { defineTranslation } from "@contractspec/lib.contracts-spec/translations";
4
+ var enMessages = defineTranslation({
5
+ meta: {
6
+ key: "knowledge.messages",
7
+ version: "1.0.0",
8
+ domain: "knowledge",
9
+ description: "All user-facing and LLM-facing strings for the knowledge package",
10
+ owners: ["platform"],
11
+ stability: "experimental"
12
+ },
13
+ locale: "en",
14
+ fallback: "en",
15
+ messages: {
16
+ "access.notBound": {
17
+ value: 'Knowledge space "{spaceKey}" is not bound in the resolved app config.',
18
+ description: "Denial reason when a knowledge space is not bound",
19
+ placeholders: [{ name: "spaceKey", type: "string" }]
20
+ },
21
+ "access.readOnly": {
22
+ value: 'Knowledge space "{spaceKey}" is category "{category}" and is read-only.',
23
+ description: "Denial reason when write is attempted on a read-only space",
24
+ placeholders: [
25
+ { name: "spaceKey", type: "string" },
26
+ { name: "category", type: "string" }
27
+ ]
28
+ },
29
+ "access.workflowUnauthorized": {
30
+ value: 'Workflow "{workflowName}" is not authorized to access knowledge space "{spaceKey}".',
31
+ description: "Denial reason when a workflow lacks space access",
32
+ placeholders: [
33
+ { name: "workflowName", type: "string" },
34
+ { name: "spaceKey", type: "string" }
35
+ ]
36
+ },
37
+ "access.agentUnauthorized": {
38
+ value: 'Agent "{agentName}" is not authorized to access knowledge space "{spaceKey}".',
39
+ description: "Denial reason when an agent lacks space access",
40
+ placeholders: [
41
+ { name: "agentName", type: "string" },
42
+ { name: "spaceKey", type: "string" }
43
+ ]
44
+ },
45
+ "access.ephemeralWarning": {
46
+ value: 'Knowledge space "{spaceKey}" is ephemeral; results may be transient.',
47
+ description: "Warning for ephemeral knowledge spaces",
48
+ placeholders: [{ name: "spaceKey", type: "string" }]
49
+ },
50
+ "query.systemPrompt": {
51
+ value: "You are a knowledge assistant that answers questions using the provided context. Cite relevant sources if possible.",
52
+ description: "Default LLM system prompt for knowledge queries"
53
+ },
54
+ "query.userMessage": {
55
+ value: `Question:
56
+ {question}
57
+
58
+ Context:
59
+ {context}`,
60
+ description: "User message template combining question and context",
61
+ placeholders: [
62
+ { name: "question", type: "string" },
63
+ { name: "context", type: "string" }
64
+ ]
65
+ },
66
+ "query.noResults": {
67
+ value: "No relevant documents found.",
68
+ description: "Displayed when vector search returns zero results"
69
+ },
70
+ "query.sourceLabel": {
71
+ value: "Source {index} (score: {score}):",
72
+ description: "Label prefix for each source in the context block",
73
+ placeholders: [
74
+ { name: "index", type: "number" },
75
+ { name: "score", type: "string" }
76
+ ]
77
+ },
78
+ "ingestion.gmail.subject": {
79
+ value: "Subject: {subject}",
80
+ description: "Gmail thread subject label",
81
+ placeholders: [{ name: "subject", type: "string" }]
82
+ },
83
+ "ingestion.gmail.snippet": {
84
+ value: "Snippet: {snippet}",
85
+ description: "Gmail thread snippet label",
86
+ placeholders: [{ name: "snippet", type: "string" }]
87
+ },
88
+ "ingestion.gmail.from": {
89
+ value: "From: {from}",
90
+ description: "Gmail message sender label",
91
+ placeholders: [{ name: "from", type: "string" }]
92
+ },
93
+ "ingestion.gmail.to": {
94
+ value: "To: {to}",
95
+ description: "Gmail message recipients label",
96
+ placeholders: [{ name: "to", type: "string" }]
97
+ },
98
+ "ingestion.gmail.date": {
99
+ value: "Date: {date}",
100
+ description: "Gmail message date label",
101
+ placeholders: [{ name: "date", type: "string" }]
102
+ }
103
+ }
104
+ });
105
+
106
+ // src/i18n/catalogs/fr.ts
107
+ import { defineTranslation as defineTranslation2 } from "@contractspec/lib.contracts-spec/translations";
108
+ var frMessages = defineTranslation2({
109
+ meta: {
110
+ key: "knowledge.messages",
111
+ version: "1.0.0",
112
+ domain: "knowledge",
113
+ description: "All user-facing and LLM-facing strings for the knowledge package (French)",
114
+ owners: ["platform"],
115
+ stability: "experimental"
116
+ },
117
+ locale: "fr",
118
+ fallback: "en",
119
+ messages: {
120
+ "access.notBound": {
121
+ value: `L'espace de connaissances "{spaceKey}" n'est pas li\xE9 dans la configuration de l'application.`,
122
+ description: "Denial reason when a knowledge space is not bound"
123
+ },
124
+ "access.readOnly": {
125
+ value: `L'espace de connaissances "{spaceKey}" est de cat\xE9gorie "{category}" et est en lecture seule.`,
126
+ description: "Denial reason when write is attempted on a read-only space"
127
+ },
128
+ "access.workflowUnauthorized": {
129
+ value: `Le workflow "{workflowName}" n'est pas autoris\xE9 \xE0 acc\xE9der \xE0 l'espace de connaissances "{spaceKey}".`,
130
+ description: "Denial reason when a workflow lacks space access"
131
+ },
132
+ "access.agentUnauthorized": {
133
+ value: `L'agent "{agentName}" n'est pas autoris\xE9 \xE0 acc\xE9der \xE0 l'espace de connaissances "{spaceKey}".`,
134
+ description: "Denial reason when an agent lacks space access"
135
+ },
136
+ "access.ephemeralWarning": {
137
+ value: `L'espace de connaissances "{spaceKey}" est \xE9ph\xE9m\xE8re ; les r\xE9sultats peuvent \xEAtre transitoires.`,
138
+ description: "Warning for ephemeral knowledge spaces"
139
+ },
140
+ "query.systemPrompt": {
141
+ value: "Vous \xEAtes un assistant de connaissances qui r\xE9pond aux questions en utilisant le contexte fourni. Citez les sources pertinentes si possible.",
142
+ description: "Default LLM system prompt for knowledge queries"
143
+ },
144
+ "query.userMessage": {
145
+ value: `Question :
146
+ {question}
147
+
148
+ Contexte :
149
+ {context}`,
150
+ description: "User message template combining question and context"
151
+ },
152
+ "query.noResults": {
153
+ value: "Aucun document pertinent trouv\xE9.",
154
+ description: "Displayed when vector search returns zero results"
155
+ },
156
+ "query.sourceLabel": {
157
+ value: "Source {index} (score : {score}) :",
158
+ description: "Label prefix for each source in the context block"
159
+ },
160
+ "ingestion.gmail.subject": {
161
+ value: "Objet : {subject}",
162
+ description: "Gmail thread subject label"
163
+ },
164
+ "ingestion.gmail.snippet": {
165
+ value: "Extrait : {snippet}",
166
+ description: "Gmail thread snippet label"
167
+ },
168
+ "ingestion.gmail.from": {
169
+ value: "De : {from}",
170
+ description: "Gmail message sender label"
171
+ },
172
+ "ingestion.gmail.to": {
173
+ value: "\xC0 : {to}",
174
+ description: "Gmail message recipients label"
175
+ },
176
+ "ingestion.gmail.date": {
177
+ value: "Date : {date}",
178
+ description: "Gmail message date label"
179
+ }
180
+ }
181
+ });
182
+
183
+ // src/i18n/catalogs/es.ts
184
+ import { defineTranslation as defineTranslation3 } from "@contractspec/lib.contracts-spec/translations";
185
+ var esMessages = defineTranslation3({
186
+ meta: {
187
+ key: "knowledge.messages",
188
+ version: "1.0.0",
189
+ domain: "knowledge",
190
+ description: "All user-facing and LLM-facing strings for the knowledge package (Spanish)",
191
+ owners: ["platform"],
192
+ stability: "experimental"
193
+ },
194
+ locale: "es",
195
+ fallback: "en",
196
+ messages: {
197
+ "access.notBound": {
198
+ value: 'El espacio de conocimiento "{spaceKey}" no est\xE1 vinculado en la configuraci\xF3n de la aplicaci\xF3n.',
199
+ description: "Denial reason when a knowledge space is not bound"
200
+ },
201
+ "access.readOnly": {
202
+ value: 'El espacio de conocimiento "{spaceKey}" es de categor\xEDa "{category}" y es de solo lectura.',
203
+ description: "Denial reason when write is attempted on a read-only space"
204
+ },
205
+ "access.workflowUnauthorized": {
206
+ value: 'El flujo de trabajo "{workflowName}" no est\xE1 autorizado para acceder al espacio de conocimiento "{spaceKey}".',
207
+ description: "Denial reason when a workflow lacks space access"
208
+ },
209
+ "access.agentUnauthorized": {
210
+ value: 'El agente "{agentName}" no est\xE1 autorizado para acceder al espacio de conocimiento "{spaceKey}".',
211
+ description: "Denial reason when an agent lacks space access"
212
+ },
213
+ "access.ephemeralWarning": {
214
+ value: 'El espacio de conocimiento "{spaceKey}" es ef\xEDmero; los resultados pueden ser transitorios.',
215
+ description: "Warning for ephemeral knowledge spaces"
216
+ },
217
+ "query.systemPrompt": {
218
+ value: "Eres un asistente de conocimiento que responde preguntas utilizando el contexto proporcionado. Cita las fuentes relevantes si es posible.",
219
+ description: "Default LLM system prompt for knowledge queries"
220
+ },
221
+ "query.userMessage": {
222
+ value: `Pregunta:
223
+ {question}
224
+
225
+ Contexto:
226
+ {context}`,
227
+ description: "User message template combining question and context"
228
+ },
229
+ "query.noResults": {
230
+ value: "No se encontraron documentos relevantes.",
231
+ description: "Displayed when vector search returns zero results"
232
+ },
233
+ "query.sourceLabel": {
234
+ value: "Fuente {index} (puntuaci\xF3n: {score}):",
235
+ description: "Label prefix for each source in the context block"
236
+ },
237
+ "ingestion.gmail.subject": {
238
+ value: "Asunto: {subject}",
239
+ description: "Gmail thread subject label"
240
+ },
241
+ "ingestion.gmail.snippet": {
242
+ value: "Extracto: {snippet}",
243
+ description: "Gmail thread snippet label"
244
+ },
245
+ "ingestion.gmail.from": {
246
+ value: "De: {from}",
247
+ description: "Gmail message sender label"
248
+ },
249
+ "ingestion.gmail.to": {
250
+ value: "Para: {to}",
251
+ description: "Gmail message recipients label"
252
+ },
253
+ "ingestion.gmail.date": {
254
+ value: "Fecha: {date}",
255
+ description: "Gmail message date label"
256
+ }
257
+ }
258
+ });
259
+ export {
260
+ frMessages,
261
+ esMessages,
262
+ enMessages
263
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Internationalization (i18n) module for @contractspec/lib.knowledge.
3
+ *
4
+ * Provides multi-language support for all strings in the package:
5
+ * - Access guard denial/warning messages
6
+ * - LLM system prompts and query templates
7
+ * - Gmail ingestion formatting labels
8
+ *
9
+ * @module i18n
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { createKnowledgeI18n, I18N_KEYS } from '@contractspec/lib.knowledge/i18n';
14
+ *
15
+ * const i18n = createKnowledgeI18n("fr");
16
+ * const msg = i18n.t("access.notBound", { spaceKey: "docs" });
17
+ * ```
18
+ */
19
+ export { createKnowledgeI18n, getDefaultI18n, resetI18nRegistry, } from './messages';
20
+ export type { KnowledgeI18n } from './messages';
21
+ export { resolveLocale, isSupportedLocale, DEFAULT_LOCALE, SUPPORTED_LOCALES, } from './locale';
22
+ export type { SupportedLocale } from './locale';
23
+ export { I18N_KEYS, ACCESS_KEYS, QUERY_KEYS, INGESTION_KEYS } from './keys';
24
+ export type { KnowledgeMessageKey } from './keys';
25
+ export { enMessages } from './catalogs/en';
26
+ export { frMessages } from './catalogs/fr';
27
+ export { esMessages } from './catalogs/es';
@@ -0,0 +1,321 @@
1
+ // @bun
2
+ // src/i18n/catalogs/en.ts
3
+ import { defineTranslation } from "@contractspec/lib.contracts-spec/translations";
4
+ var enMessages = defineTranslation({
5
+ meta: {
6
+ key: "knowledge.messages",
7
+ version: "1.0.0",
8
+ domain: "knowledge",
9
+ description: "All user-facing and LLM-facing strings for the knowledge package",
10
+ owners: ["platform"],
11
+ stability: "experimental"
12
+ },
13
+ locale: "en",
14
+ fallback: "en",
15
+ messages: {
16
+ "access.notBound": {
17
+ value: 'Knowledge space "{spaceKey}" is not bound in the resolved app config.',
18
+ description: "Denial reason when a knowledge space is not bound",
19
+ placeholders: [{ name: "spaceKey", type: "string" }]
20
+ },
21
+ "access.readOnly": {
22
+ value: 'Knowledge space "{spaceKey}" is category "{category}" and is read-only.',
23
+ description: "Denial reason when write is attempted on a read-only space",
24
+ placeholders: [
25
+ { name: "spaceKey", type: "string" },
26
+ { name: "category", type: "string" }
27
+ ]
28
+ },
29
+ "access.workflowUnauthorized": {
30
+ value: 'Workflow "{workflowName}" is not authorized to access knowledge space "{spaceKey}".',
31
+ description: "Denial reason when a workflow lacks space access",
32
+ placeholders: [
33
+ { name: "workflowName", type: "string" },
34
+ { name: "spaceKey", type: "string" }
35
+ ]
36
+ },
37
+ "access.agentUnauthorized": {
38
+ value: 'Agent "{agentName}" is not authorized to access knowledge space "{spaceKey}".',
39
+ description: "Denial reason when an agent lacks space access",
40
+ placeholders: [
41
+ { name: "agentName", type: "string" },
42
+ { name: "spaceKey", type: "string" }
43
+ ]
44
+ },
45
+ "access.ephemeralWarning": {
46
+ value: 'Knowledge space "{spaceKey}" is ephemeral; results may be transient.',
47
+ description: "Warning for ephemeral knowledge spaces",
48
+ placeholders: [{ name: "spaceKey", type: "string" }]
49
+ },
50
+ "query.systemPrompt": {
51
+ value: "You are a knowledge assistant that answers questions using the provided context. Cite relevant sources if possible.",
52
+ description: "Default LLM system prompt for knowledge queries"
53
+ },
54
+ "query.userMessage": {
55
+ value: `Question:
56
+ {question}
57
+
58
+ Context:
59
+ {context}`,
60
+ description: "User message template combining question and context",
61
+ placeholders: [
62
+ { name: "question", type: "string" },
63
+ { name: "context", type: "string" }
64
+ ]
65
+ },
66
+ "query.noResults": {
67
+ value: "No relevant documents found.",
68
+ description: "Displayed when vector search returns zero results"
69
+ },
70
+ "query.sourceLabel": {
71
+ value: "Source {index} (score: {score}):",
72
+ description: "Label prefix for each source in the context block",
73
+ placeholders: [
74
+ { name: "index", type: "number" },
75
+ { name: "score", type: "string" }
76
+ ]
77
+ },
78
+ "ingestion.gmail.subject": {
79
+ value: "Subject: {subject}",
80
+ description: "Gmail thread subject label",
81
+ placeholders: [{ name: "subject", type: "string" }]
82
+ },
83
+ "ingestion.gmail.snippet": {
84
+ value: "Snippet: {snippet}",
85
+ description: "Gmail thread snippet label",
86
+ placeholders: [{ name: "snippet", type: "string" }]
87
+ },
88
+ "ingestion.gmail.from": {
89
+ value: "From: {from}",
90
+ description: "Gmail message sender label",
91
+ placeholders: [{ name: "from", type: "string" }]
92
+ },
93
+ "ingestion.gmail.to": {
94
+ value: "To: {to}",
95
+ description: "Gmail message recipients label",
96
+ placeholders: [{ name: "to", type: "string" }]
97
+ },
98
+ "ingestion.gmail.date": {
99
+ value: "Date: {date}",
100
+ description: "Gmail message date label",
101
+ placeholders: [{ name: "date", type: "string" }]
102
+ }
103
+ }
104
+ });
105
+
106
+ // src/i18n/catalogs/fr.ts
107
+ import { defineTranslation as defineTranslation2 } from "@contractspec/lib.contracts-spec/translations";
108
+ var frMessages = defineTranslation2({
109
+ meta: {
110
+ key: "knowledge.messages",
111
+ version: "1.0.0",
112
+ domain: "knowledge",
113
+ description: "All user-facing and LLM-facing strings for the knowledge package (French)",
114
+ owners: ["platform"],
115
+ stability: "experimental"
116
+ },
117
+ locale: "fr",
118
+ fallback: "en",
119
+ messages: {
120
+ "access.notBound": {
121
+ value: `L'espace de connaissances "{spaceKey}" n'est pas li\xE9 dans la configuration de l'application.`,
122
+ description: "Denial reason when a knowledge space is not bound"
123
+ },
124
+ "access.readOnly": {
125
+ value: `L'espace de connaissances "{spaceKey}" est de cat\xE9gorie "{category}" et est en lecture seule.`,
126
+ description: "Denial reason when write is attempted on a read-only space"
127
+ },
128
+ "access.workflowUnauthorized": {
129
+ value: `Le workflow "{workflowName}" n'est pas autoris\xE9 \xE0 acc\xE9der \xE0 l'espace de connaissances "{spaceKey}".`,
130
+ description: "Denial reason when a workflow lacks space access"
131
+ },
132
+ "access.agentUnauthorized": {
133
+ value: `L'agent "{agentName}" n'est pas autoris\xE9 \xE0 acc\xE9der \xE0 l'espace de connaissances "{spaceKey}".`,
134
+ description: "Denial reason when an agent lacks space access"
135
+ },
136
+ "access.ephemeralWarning": {
137
+ value: `L'espace de connaissances "{spaceKey}" est \xE9ph\xE9m\xE8re ; les r\xE9sultats peuvent \xEAtre transitoires.`,
138
+ description: "Warning for ephemeral knowledge spaces"
139
+ },
140
+ "query.systemPrompt": {
141
+ value: "Vous \xEAtes un assistant de connaissances qui r\xE9pond aux questions en utilisant le contexte fourni. Citez les sources pertinentes si possible.",
142
+ description: "Default LLM system prompt for knowledge queries"
143
+ },
144
+ "query.userMessage": {
145
+ value: `Question :
146
+ {question}
147
+
148
+ Contexte :
149
+ {context}`,
150
+ description: "User message template combining question and context"
151
+ },
152
+ "query.noResults": {
153
+ value: "Aucun document pertinent trouv\xE9.",
154
+ description: "Displayed when vector search returns zero results"
155
+ },
156
+ "query.sourceLabel": {
157
+ value: "Source {index} (score : {score}) :",
158
+ description: "Label prefix for each source in the context block"
159
+ },
160
+ "ingestion.gmail.subject": {
161
+ value: "Objet : {subject}",
162
+ description: "Gmail thread subject label"
163
+ },
164
+ "ingestion.gmail.snippet": {
165
+ value: "Extrait : {snippet}",
166
+ description: "Gmail thread snippet label"
167
+ },
168
+ "ingestion.gmail.from": {
169
+ value: "De : {from}",
170
+ description: "Gmail message sender label"
171
+ },
172
+ "ingestion.gmail.to": {
173
+ value: "\xC0 : {to}",
174
+ description: "Gmail message recipients label"
175
+ },
176
+ "ingestion.gmail.date": {
177
+ value: "Date : {date}",
178
+ description: "Gmail message date label"
179
+ }
180
+ }
181
+ });
182
+
183
+ // src/i18n/catalogs/es.ts
184
+ import { defineTranslation as defineTranslation3 } from "@contractspec/lib.contracts-spec/translations";
185
+ var esMessages = defineTranslation3({
186
+ meta: {
187
+ key: "knowledge.messages",
188
+ version: "1.0.0",
189
+ domain: "knowledge",
190
+ description: "All user-facing and LLM-facing strings for the knowledge package (Spanish)",
191
+ owners: ["platform"],
192
+ stability: "experimental"
193
+ },
194
+ locale: "es",
195
+ fallback: "en",
196
+ messages: {
197
+ "access.notBound": {
198
+ value: 'El espacio de conocimiento "{spaceKey}" no est\xE1 vinculado en la configuraci\xF3n de la aplicaci\xF3n.',
199
+ description: "Denial reason when a knowledge space is not bound"
200
+ },
201
+ "access.readOnly": {
202
+ value: 'El espacio de conocimiento "{spaceKey}" es de categor\xEDa "{category}" y es de solo lectura.',
203
+ description: "Denial reason when write is attempted on a read-only space"
204
+ },
205
+ "access.workflowUnauthorized": {
206
+ value: 'El flujo de trabajo "{workflowName}" no est\xE1 autorizado para acceder al espacio de conocimiento "{spaceKey}".',
207
+ description: "Denial reason when a workflow lacks space access"
208
+ },
209
+ "access.agentUnauthorized": {
210
+ value: 'El agente "{agentName}" no est\xE1 autorizado para acceder al espacio de conocimiento "{spaceKey}".',
211
+ description: "Denial reason when an agent lacks space access"
212
+ },
213
+ "access.ephemeralWarning": {
214
+ value: 'El espacio de conocimiento "{spaceKey}" es ef\xEDmero; los resultados pueden ser transitorios.',
215
+ description: "Warning for ephemeral knowledge spaces"
216
+ },
217
+ "query.systemPrompt": {
218
+ value: "Eres un asistente de conocimiento que responde preguntas utilizando el contexto proporcionado. Cita las fuentes relevantes si es posible.",
219
+ description: "Default LLM system prompt for knowledge queries"
220
+ },
221
+ "query.userMessage": {
222
+ value: `Pregunta:
223
+ {question}
224
+
225
+ Contexto:
226
+ {context}`,
227
+ description: "User message template combining question and context"
228
+ },
229
+ "query.noResults": {
230
+ value: "No se encontraron documentos relevantes.",
231
+ description: "Displayed when vector search returns zero results"
232
+ },
233
+ "query.sourceLabel": {
234
+ value: "Fuente {index} (puntuaci\xF3n: {score}):",
235
+ description: "Label prefix for each source in the context block"
236
+ },
237
+ "ingestion.gmail.subject": {
238
+ value: "Asunto: {subject}",
239
+ description: "Gmail thread subject label"
240
+ },
241
+ "ingestion.gmail.snippet": {
242
+ value: "Extracto: {snippet}",
243
+ description: "Gmail thread snippet label"
244
+ },
245
+ "ingestion.gmail.from": {
246
+ value: "De: {from}",
247
+ description: "Gmail message sender label"
248
+ },
249
+ "ingestion.gmail.to": {
250
+ value: "Para: {to}",
251
+ description: "Gmail message recipients label"
252
+ },
253
+ "ingestion.gmail.date": {
254
+ value: "Fecha: {date}",
255
+ description: "Gmail message date label"
256
+ }
257
+ }
258
+ });
259
+
260
+ // src/i18n/messages.ts
261
+ import {
262
+ createI18nFactory
263
+ } from "@contractspec/lib.contracts-spec/translations";
264
+ var factory = createI18nFactory({
265
+ specKey: "knowledge.messages",
266
+ catalogs: [enMessages, frMessages, esMessages]
267
+ });
268
+ var createKnowledgeI18n = factory.create;
269
+ var getDefaultI18n = factory.getDefault;
270
+ var resetI18nRegistry = factory.resetRegistry;
271
+
272
+ // src/i18n/locale.ts
273
+ import {
274
+ DEFAULT_LOCALE,
275
+ SUPPORTED_LOCALES,
276
+ resolveLocale,
277
+ isSupportedLocale
278
+ } from "@contractspec/lib.contracts-spec/translations";
279
+
280
+ // src/i18n/keys.ts
281
+ var ACCESS_KEYS = {
282
+ "access.notBound": "access.notBound",
283
+ "access.readOnly": "access.readOnly",
284
+ "access.workflowUnauthorized": "access.workflowUnauthorized",
285
+ "access.agentUnauthorized": "access.agentUnauthorized",
286
+ "access.ephemeralWarning": "access.ephemeralWarning"
287
+ };
288
+ var QUERY_KEYS = {
289
+ "query.systemPrompt": "query.systemPrompt",
290
+ "query.userMessage": "query.userMessage",
291
+ "query.noResults": "query.noResults",
292
+ "query.sourceLabel": "query.sourceLabel"
293
+ };
294
+ var INGESTION_KEYS = {
295
+ "ingestion.gmail.subject": "ingestion.gmail.subject",
296
+ "ingestion.gmail.snippet": "ingestion.gmail.snippet",
297
+ "ingestion.gmail.from": "ingestion.gmail.from",
298
+ "ingestion.gmail.to": "ingestion.gmail.to",
299
+ "ingestion.gmail.date": "ingestion.gmail.date"
300
+ };
301
+ var I18N_KEYS = {
302
+ ...ACCESS_KEYS,
303
+ ...QUERY_KEYS,
304
+ ...INGESTION_KEYS
305
+ };
306
+ export {
307
+ resolveLocale,
308
+ resetI18nRegistry,
309
+ isSupportedLocale,
310
+ getDefaultI18n,
311
+ frMessages,
312
+ esMessages,
313
+ enMessages,
314
+ createKnowledgeI18n,
315
+ SUPPORTED_LOCALES,
316
+ QUERY_KEYS,
317
+ INGESTION_KEYS,
318
+ I18N_KEYS,
319
+ DEFAULT_LOCALE,
320
+ ACCESS_KEYS
321
+ };
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Typed message keys for the knowledge i18n system.
3
+ *
4
+ * All translatable strings in the package are referenced by these keys.
5
+ * Organized by domain: access, query, ingestion.
6
+ *
7
+ * @module i18n/keys
8
+ */
9
+ export declare const ACCESS_KEYS: {
10
+ /** 'Knowledge space "{spaceKey}" is not bound in the resolved app config.' */
11
+ readonly 'access.notBound': "access.notBound";
12
+ /** 'Knowledge space "{spaceKey}" is category "{category}" and is read-only.' */
13
+ readonly 'access.readOnly': "access.readOnly";
14
+ /** 'Workflow "{workflowName}" is not authorized to access knowledge space "{spaceKey}".' */
15
+ readonly 'access.workflowUnauthorized': "access.workflowUnauthorized";
16
+ /** 'Agent "{agentName}" is not authorized to access knowledge space "{spaceKey}".' */
17
+ readonly 'access.agentUnauthorized': "access.agentUnauthorized";
18
+ /** 'Knowledge space "{spaceKey}" is ephemeral; results may be transient.' */
19
+ readonly 'access.ephemeralWarning': "access.ephemeralWarning";
20
+ };
21
+ export declare const QUERY_KEYS: {
22
+ /** Default system prompt for the knowledge assistant LLM */
23
+ readonly 'query.systemPrompt': "query.systemPrompt";
24
+ /** Template for the user message: "Question:\n{question}\n\nContext:\n{context}" */
25
+ readonly 'query.userMessage': "query.userMessage";
26
+ /** "No relevant documents found." */
27
+ readonly 'query.noResults': "query.noResults";
28
+ /** "Source {index} (score: {score}):" */
29
+ readonly 'query.sourceLabel': "query.sourceLabel";
30
+ };
31
+ export declare const INGESTION_KEYS: {
32
+ /** "Subject: {subject}" */
33
+ readonly 'ingestion.gmail.subject': "ingestion.gmail.subject";
34
+ /** "Snippet: {snippet}" */
35
+ readonly 'ingestion.gmail.snippet': "ingestion.gmail.snippet";
36
+ /** "From: {from}" */
37
+ readonly 'ingestion.gmail.from': "ingestion.gmail.from";
38
+ /** "To: {to}" */
39
+ readonly 'ingestion.gmail.to': "ingestion.gmail.to";
40
+ /** "Date: {date}" */
41
+ readonly 'ingestion.gmail.date': "ingestion.gmail.date";
42
+ };
43
+ export declare const I18N_KEYS: {
44
+ /** "Subject: {subject}" */
45
+ readonly 'ingestion.gmail.subject': "ingestion.gmail.subject";
46
+ /** "Snippet: {snippet}" */
47
+ readonly 'ingestion.gmail.snippet': "ingestion.gmail.snippet";
48
+ /** "From: {from}" */
49
+ readonly 'ingestion.gmail.from': "ingestion.gmail.from";
50
+ /** "To: {to}" */
51
+ readonly 'ingestion.gmail.to': "ingestion.gmail.to";
52
+ /** "Date: {date}" */
53
+ readonly 'ingestion.gmail.date': "ingestion.gmail.date";
54
+ /** Default system prompt for the knowledge assistant LLM */
55
+ readonly 'query.systemPrompt': "query.systemPrompt";
56
+ /** Template for the user message: "Question:\n{question}\n\nContext:\n{context}" */
57
+ readonly 'query.userMessage': "query.userMessage";
58
+ /** "No relevant documents found." */
59
+ readonly 'query.noResults': "query.noResults";
60
+ /** "Source {index} (score: {score}):" */
61
+ readonly 'query.sourceLabel': "query.sourceLabel";
62
+ /** 'Knowledge space "{spaceKey}" is not bound in the resolved app config.' */
63
+ readonly 'access.notBound': "access.notBound";
64
+ /** 'Knowledge space "{spaceKey}" is category "{category}" and is read-only.' */
65
+ readonly 'access.readOnly': "access.readOnly";
66
+ /** 'Workflow "{workflowName}" is not authorized to access knowledge space "{spaceKey}".' */
67
+ readonly 'access.workflowUnauthorized': "access.workflowUnauthorized";
68
+ /** 'Agent "{agentName}" is not authorized to access knowledge space "{spaceKey}".' */
69
+ readonly 'access.agentUnauthorized': "access.agentUnauthorized";
70
+ /** 'Knowledge space "{spaceKey}" is ephemeral; results may be transient.' */
71
+ readonly 'access.ephemeralWarning': "access.ephemeralWarning";
72
+ };
73
+ /** Union type of all valid knowledge i18n keys */
74
+ export type KnowledgeMessageKey = keyof typeof I18N_KEYS;