@contractspec/example.locale-jurisdiction-gate 3.7.17 → 3.7.19
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/.turbo/turbo-build.log +66 -66
- package/CHANGELOG.md +17 -0
- package/dist/browser/docs/index.js +3 -27
- package/dist/browser/docs/locale-jurisdiction-gate.docblock.js +3 -27
- package/dist/browser/entities/index.js +1 -110
- package/dist/browser/entities/models.js +1 -110
- package/dist/browser/events.js +1 -73
- package/dist/browser/example.js +1 -35
- package/dist/browser/forms/assistant-context.form.js +1 -213
- package/dist/browser/forms/index.js +1 -213
- package/dist/browser/handlers/demo.handlers.js +2 -152
- package/dist/browser/handlers/index.js +2 -152
- package/dist/browser/index.js +4 -844
- package/dist/browser/locale-jurisdiction-gate.feature.js +1 -105
- package/dist/browser/operations/assistant.js +1 -192
- package/dist/browser/operations/index.js +1 -192
- package/dist/browser/policy/assistant-gate.policy.js +1 -62
- package/dist/browser/policy/guard.js +2 -73
- package/dist/browser/policy/index.js +2 -134
- package/dist/browser/translations/assistant-gate.en-GB.translation.js +1 -48
- package/dist/browser/translations/assistant-gate.en-US.translation.js +1 -50
- package/dist/browser/translations/assistant-gate.fr-FR.translation.js +1 -52
- package/dist/browser/translations/index.js +1 -148
- package/dist/docs/index.js +3 -27
- package/dist/docs/locale-jurisdiction-gate.docblock.js +3 -27
- package/dist/entities/index.js +1 -110
- package/dist/entities/models.js +1 -110
- package/dist/events.js +1 -73
- package/dist/example.js +1 -35
- package/dist/forms/assistant-context.form.js +1 -213
- package/dist/forms/index.js +1 -213
- package/dist/handlers/demo.handlers.js +2 -152
- package/dist/handlers/index.js +2 -152
- package/dist/index.js +4 -844
- package/dist/locale-jurisdiction-gate.feature.js +1 -105
- package/dist/node/docs/index.js +3 -27
- package/dist/node/docs/locale-jurisdiction-gate.docblock.js +3 -27
- package/dist/node/entities/index.js +1 -110
- package/dist/node/entities/models.js +1 -110
- package/dist/node/events.js +1 -73
- package/dist/node/example.js +1 -35
- package/dist/node/forms/assistant-context.form.js +1 -213
- package/dist/node/forms/index.js +1 -213
- package/dist/node/handlers/demo.handlers.js +2 -152
- package/dist/node/handlers/index.js +2 -152
- package/dist/node/index.js +4 -844
- package/dist/node/locale-jurisdiction-gate.feature.js +1 -105
- package/dist/node/operations/assistant.js +1 -192
- package/dist/node/operations/index.js +1 -192
- package/dist/node/policy/assistant-gate.policy.js +1 -62
- package/dist/node/policy/guard.js +2 -73
- package/dist/node/policy/index.js +2 -134
- package/dist/node/translations/assistant-gate.en-GB.translation.js +1 -48
- package/dist/node/translations/assistant-gate.en-US.translation.js +1 -50
- package/dist/node/translations/assistant-gate.fr-FR.translation.js +1 -52
- package/dist/node/translations/index.js +1 -148
- package/dist/operations/assistant.js +1 -192
- package/dist/operations/index.js +1 -192
- package/dist/policy/assistant-gate.policy.js +1 -62
- package/dist/policy/guard.js +2 -73
- package/dist/policy/index.js +2 -134
- package/dist/translations/assistant-gate.en-GB.translation.js +1 -48
- package/dist/translations/assistant-gate.en-US.translation.js +1 -50
- package/dist/translations/assistant-gate.fr-FR.translation.js +1 -52
- package/dist/translations/index.js +1 -148
- package/package.json +5 -5
package/dist/browser/index.js
CHANGED
|
@@ -1,32 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
import { registerDocBlocks } from "@contractspec/lib.contracts-spec/docs";
|
|
3
|
-
var docBlocks = [
|
|
4
|
-
{
|
|
5
|
-
id: "docs.examples.locale-jurisdiction-gate.goal",
|
|
6
|
-
title: "Locale/Jurisdiction Gate — Goal",
|
|
7
|
-
summary: "Fail-closed gate that forces locale + jurisdiction + kbSnapshotId + allowedScope for assistant calls.",
|
|
8
|
-
kind: "goal",
|
|
9
|
-
visibility: "public",
|
|
10
|
-
route: "/docs/examples/locale-jurisdiction-gate/goal",
|
|
11
|
-
tags: ["assistant", "policy", "locale", "jurisdiction", "knowledge"],
|
|
12
|
-
body: `## Why it matters
|
|
1
|
+
import{registerDocBlocks as H}from"@contractspec/lib.contracts-spec/docs";var J=[{id:"docs.examples.locale-jurisdiction-gate.goal",title:"Locale/Jurisdiction Gate — Goal",summary:"Fail-closed gate that forces locale + jurisdiction + kbSnapshotId + allowedScope for assistant calls.",kind:"goal",visibility:"public",route:"/docs/examples/locale-jurisdiction-gate/goal",tags:["assistant","policy","locale","jurisdiction","knowledge"],body:`## Why it matters
|
|
13
2
|
- Forces all assistant behavior to be bound to explicit inputs (no guessing).
|
|
14
3
|
- Requires KB snapshot citations to make answers traceable and regenerable.
|
|
15
4
|
|
|
16
5
|
## Guardrails
|
|
17
6
|
- Missing locale/jurisdiction/snapshot/scope => refuse (structured).
|
|
18
7
|
- Missing citations => refuse.
|
|
19
|
-
- Scope violations under education_only => refuse/escalate.`
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
id: "docs.examples.locale-jurisdiction-gate.reference",
|
|
23
|
-
title: "Locale/Jurisdiction Gate — Reference",
|
|
24
|
-
summary: "Contracts, models, and events exposed by the gate example.",
|
|
25
|
-
kind: "reference",
|
|
26
|
-
visibility: "public",
|
|
27
|
-
route: "/docs/examples/locale-jurisdiction-gate",
|
|
28
|
-
tags: ["assistant", "policy", "reference"],
|
|
29
|
-
body: `## Contracts
|
|
8
|
+
- Scope violations under education_only => refuse/escalate.`},{id:"docs.examples.locale-jurisdiction-gate.reference",title:"Locale/Jurisdiction Gate — Reference",summary:"Contracts, models, and events exposed by the gate example.",kind:"reference",visibility:"public",route:"/docs/examples/locale-jurisdiction-gate",tags:["assistant","policy","reference"],body:`## Contracts
|
|
30
9
|
- assistant.answer (v1)
|
|
31
10
|
- assistant.explainConcept (v1)
|
|
32
11
|
|
|
@@ -37,824 +16,5 @@ var docBlocks = [
|
|
|
37
16
|
## Events
|
|
38
17
|
- assistant.answer.requested
|
|
39
18
|
- assistant.answer.blocked
|
|
40
|
-
- assistant.answer.delivered`
|
|
41
|
-
}
|
|
42
|
-
];
|
|
43
|
-
registerDocBlocks(docBlocks);
|
|
44
|
-
// src/entities/models.ts
|
|
45
|
-
import {
|
|
46
|
-
defineEnum,
|
|
47
|
-
defineSchemaModel,
|
|
48
|
-
ScalarTypeEnum
|
|
49
|
-
} from "@contractspec/lib.schema";
|
|
50
|
-
var AllowedScopeEnum = defineEnum("AllowedScope", [
|
|
51
|
-
"education_only",
|
|
52
|
-
"generic_info",
|
|
53
|
-
"escalation_required"
|
|
54
|
-
]);
|
|
55
|
-
var UserProfileModel = defineSchemaModel({
|
|
56
|
-
name: "UserProfile",
|
|
57
|
-
description: "User profile inputs used to derive regulatory context.",
|
|
58
|
-
fields: {
|
|
59
|
-
preferredLocale: {
|
|
60
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
61
|
-
isOptional: true
|
|
62
|
-
},
|
|
63
|
-
residencyCountry: {
|
|
64
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
65
|
-
isOptional: true
|
|
66
|
-
},
|
|
67
|
-
taxResidenceCountry: {
|
|
68
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
69
|
-
isOptional: true
|
|
70
|
-
},
|
|
71
|
-
clientType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
var RegulatoryContextModel = defineSchemaModel({
|
|
75
|
-
name: "RegulatoryContext",
|
|
76
|
-
description: "Explicit regulatory context (no guessing).",
|
|
77
|
-
fields: {
|
|
78
|
-
jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
79
|
-
region: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
80
|
-
clientType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
81
|
-
allowedScope: { type: AllowedScopeEnum, isOptional: false }
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
var LLMCallEnvelopeModel = defineSchemaModel({
|
|
85
|
-
name: "LLMCallEnvelope",
|
|
86
|
-
description: "Mandatory envelope for assistant calls. All fields are explicit and required for policy gating.",
|
|
87
|
-
fields: {
|
|
88
|
-
traceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
89
|
-
locale: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
90
|
-
regulatoryContext: { type: RegulatoryContextModel, isOptional: false },
|
|
91
|
-
kbSnapshotId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
92
|
-
allowedScope: { type: AllowedScopeEnum, isOptional: false }
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
var AssistantCitationModel = defineSchemaModel({
|
|
96
|
-
name: "AssistantCitation",
|
|
97
|
-
description: "Citation referencing a KB snapshot + a specific item within it.",
|
|
98
|
-
fields: {
|
|
99
|
-
kbSnapshotId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
100
|
-
sourceType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
101
|
-
sourceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
102
|
-
title: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
103
|
-
excerpt: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
var AssistantAnswerSectionModel = defineSchemaModel({
|
|
107
|
-
name: "AssistantAnswerSection",
|
|
108
|
-
description: "Structured answer section.",
|
|
109
|
-
fields: {
|
|
110
|
-
heading: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
111
|
-
body: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
var AssistantAnswerIRModel = defineSchemaModel({
|
|
115
|
-
name: "AssistantAnswerIR",
|
|
116
|
-
description: "Structured assistant answer with mandatory citations and explicit locale/jurisdiction.",
|
|
117
|
-
fields: {
|
|
118
|
-
locale: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
119
|
-
jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
120
|
-
allowedScope: { type: AllowedScopeEnum, isOptional: false },
|
|
121
|
-
sections: {
|
|
122
|
-
type: AssistantAnswerSectionModel,
|
|
123
|
-
isArray: true,
|
|
124
|
-
isOptional: false
|
|
125
|
-
},
|
|
126
|
-
citations: {
|
|
127
|
-
type: AssistantCitationModel,
|
|
128
|
-
isArray: true,
|
|
129
|
-
isOptional: false
|
|
130
|
-
},
|
|
131
|
-
disclaimers: {
|
|
132
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
133
|
-
isArray: true,
|
|
134
|
-
isOptional: true
|
|
135
|
-
},
|
|
136
|
-
riskFlags: {
|
|
137
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
138
|
-
isArray: true,
|
|
139
|
-
isOptional: true
|
|
140
|
-
},
|
|
141
|
-
refused: { type: ScalarTypeEnum.Boolean(), isOptional: true },
|
|
142
|
-
refusalReason: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
// src/events.ts
|
|
146
|
-
import { defineEvent } from "@contractspec/lib.contracts-spec";
|
|
147
|
-
import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
|
|
148
|
-
var AssistantAnswerRequestedPayload = defineSchemaModel2({
|
|
149
|
-
name: "AssistantAnswerRequestedPayload",
|
|
150
|
-
description: "Emitted when an assistant answer is requested (pre-gate).",
|
|
151
|
-
fields: {
|
|
152
|
-
traceId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
153
|
-
locale: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
154
|
-
jurisdiction: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
155
|
-
kbSnapshotId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
156
|
-
allowedScope: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
var AssistantAnswerRequestedEvent = defineEvent({
|
|
160
|
-
meta: {
|
|
161
|
-
key: "assistant.answer.requested",
|
|
162
|
-
version: "1.0.0",
|
|
163
|
-
description: "Assistant answer requested (policy gate will run).",
|
|
164
|
-
stability: "experimental",
|
|
165
|
-
owners: ["@examples"],
|
|
166
|
-
tags: ["assistant", "policy"]
|
|
167
|
-
},
|
|
168
|
-
payload: AssistantAnswerRequestedPayload
|
|
169
|
-
});
|
|
170
|
-
var AssistantAnswerBlockedPayload = defineSchemaModel2({
|
|
171
|
-
name: "AssistantAnswerBlockedPayload",
|
|
172
|
-
description: "Emitted when a request is blocked by the gate.",
|
|
173
|
-
fields: {
|
|
174
|
-
traceId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
175
|
-
reasonCode: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
176
|
-
reason: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
var AssistantAnswerBlockedEvent = defineEvent({
|
|
180
|
-
meta: {
|
|
181
|
-
key: "assistant.answer.blocked",
|
|
182
|
-
version: "1.0.0",
|
|
183
|
-
description: "Assistant answer blocked (fail-closed).",
|
|
184
|
-
stability: "experimental",
|
|
185
|
-
owners: ["@examples"],
|
|
186
|
-
tags: ["assistant", "policy", "blocked"]
|
|
187
|
-
},
|
|
188
|
-
payload: AssistantAnswerBlockedPayload
|
|
189
|
-
});
|
|
190
|
-
var AssistantAnswerDeliveredPayload = defineSchemaModel2({
|
|
191
|
-
name: "AssistantAnswerDeliveredPayload",
|
|
192
|
-
description: "Emitted when a structured, cited answer is delivered.",
|
|
193
|
-
fields: {
|
|
194
|
-
traceId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
195
|
-
locale: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
196
|
-
jurisdiction: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
197
|
-
kbSnapshotId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
198
|
-
allowedScope: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
199
|
-
citationsCount: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false }
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
var AssistantAnswerDeliveredEvent = defineEvent({
|
|
203
|
-
meta: {
|
|
204
|
-
key: "assistant.answer.delivered",
|
|
205
|
-
version: "1.0.0",
|
|
206
|
-
description: "Assistant answer delivered (must include KB snapshot citations).",
|
|
207
|
-
stability: "experimental",
|
|
208
|
-
owners: ["@examples"],
|
|
209
|
-
tags: ["assistant", "policy", "delivered"]
|
|
210
|
-
},
|
|
211
|
-
payload: AssistantAnswerDeliveredPayload
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
// src/example.ts
|
|
215
|
-
import { defineExample } from "@contractspec/lib.contracts-spec";
|
|
216
|
-
var example = defineExample({
|
|
217
|
-
meta: {
|
|
218
|
-
key: "locale-jurisdiction-gate",
|
|
219
|
-
version: "1.0.0",
|
|
220
|
-
title: "Locale / Jurisdiction Gate",
|
|
221
|
-
description: "Fail-closed gating for assistant calls: locale + jurisdiction + kbSnapshotId + allowedScope must be explicit, answers must cite a snapshot.",
|
|
222
|
-
kind: "knowledge",
|
|
223
|
-
visibility: "public",
|
|
224
|
-
stability: "experimental",
|
|
225
|
-
owners: ["@platform.core"],
|
|
226
|
-
tags: ["policy", "locale", "jurisdiction", "assistant", "gating"]
|
|
227
|
-
},
|
|
228
|
-
docs: {
|
|
229
|
-
rootDocId: "docs.examples.locale-jurisdiction-gate"
|
|
230
|
-
},
|
|
231
|
-
entrypoints: {
|
|
232
|
-
packageName: "@contractspec/example.locale-jurisdiction-gate",
|
|
233
|
-
feature: "./feature",
|
|
234
|
-
contracts: "./contracts",
|
|
235
|
-
handlers: "./handlers",
|
|
236
|
-
docs: "./docs"
|
|
237
|
-
},
|
|
238
|
-
surfaces: {
|
|
239
|
-
templates: true,
|
|
240
|
-
sandbox: { enabled: true, modes: ["markdown", "specs"] },
|
|
241
|
-
studio: { enabled: true, installable: true },
|
|
242
|
-
mcp: { enabled: true }
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
var example_default = example;
|
|
246
|
-
|
|
247
|
-
// src/forms/assistant-context.form.ts
|
|
248
|
-
import { defineFormSpec } from "@contractspec/lib.contracts-spec/forms";
|
|
249
|
-
import {
|
|
250
|
-
OwnersEnum,
|
|
251
|
-
StabilityEnum,
|
|
252
|
-
TagsEnum
|
|
253
|
-
} from "@contractspec/lib.contracts-spec/ownership";
|
|
254
|
-
import { defineSchemaModel as defineSchemaModel3, ScalarTypeEnum as ScalarTypeEnum3 } from "@contractspec/lib.schema";
|
|
255
|
-
var AssistantContextFormModel = defineSchemaModel3({
|
|
256
|
-
name: "AssistantContextFormModel",
|
|
257
|
-
description: "Form values required before a policy-gated assistant request can be executed.",
|
|
258
|
-
fields: {
|
|
259
|
-
locale: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
260
|
-
jurisdiction: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
261
|
-
kbSnapshotId: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false },
|
|
262
|
-
allowedScope: { type: AllowedScopeEnum, isOptional: false },
|
|
263
|
-
question: { type: ScalarTypeEnum3.String_unsecure(), isOptional: false }
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
var AssistantContextForm = defineFormSpec({
|
|
267
|
-
meta: {
|
|
268
|
-
key: "locale-jurisdiction-gate.form.assistant-context",
|
|
269
|
-
version: "1.0.0",
|
|
270
|
-
title: "Assistant Context Gate",
|
|
271
|
-
description: "Collects the explicit locale, jurisdiction, scope, and knowledge snapshot required by the assistant gate.",
|
|
272
|
-
domain: "assistant",
|
|
273
|
-
owners: [OwnersEnum.PlatformFinance],
|
|
274
|
-
tags: [TagsEnum.I18n, "assistant", "form", "policy"],
|
|
275
|
-
stability: StabilityEnum.Experimental
|
|
276
|
-
},
|
|
277
|
-
model: AssistantContextFormModel,
|
|
278
|
-
fields: [
|
|
279
|
-
{
|
|
280
|
-
kind: "select",
|
|
281
|
-
name: "locale",
|
|
282
|
-
labelI18n: "assistantGate.locale.label",
|
|
283
|
-
descriptionI18n: "assistantGate.locale.description",
|
|
284
|
-
options: {
|
|
285
|
-
kind: "static",
|
|
286
|
-
options: [
|
|
287
|
-
{ labelI18n: "assistantGate.locale.enUs", value: "en-US" },
|
|
288
|
-
{ labelI18n: "assistantGate.locale.enGb", value: "en-GB" },
|
|
289
|
-
{ labelI18n: "assistantGate.locale.frFr", value: "fr-FR" }
|
|
290
|
-
]
|
|
291
|
-
},
|
|
292
|
-
required: true
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
kind: "text",
|
|
296
|
-
name: "jurisdiction",
|
|
297
|
-
labelI18n: "assistantGate.jurisdiction.label",
|
|
298
|
-
placeholderI18n: "assistantGate.jurisdiction.placeholder",
|
|
299
|
-
required: true
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
kind: "text",
|
|
303
|
-
name: "kbSnapshotId",
|
|
304
|
-
labelI18n: "assistantGate.kbSnapshotId.label",
|
|
305
|
-
placeholderI18n: "assistantGate.kbSnapshotId.placeholder",
|
|
306
|
-
required: true
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
kind: "radio",
|
|
310
|
-
name: "allowedScope",
|
|
311
|
-
labelI18n: "assistantGate.allowedScope.label",
|
|
312
|
-
options: {
|
|
313
|
-
kind: "static",
|
|
314
|
-
options: [
|
|
315
|
-
{
|
|
316
|
-
labelI18n: "assistantGate.allowedScope.educationOnly",
|
|
317
|
-
value: "education_only"
|
|
318
|
-
},
|
|
319
|
-
{
|
|
320
|
-
labelI18n: "assistantGate.allowedScope.genericInfo",
|
|
321
|
-
value: "generic_info"
|
|
322
|
-
},
|
|
323
|
-
{
|
|
324
|
-
labelI18n: "assistantGate.allowedScope.escalationRequired",
|
|
325
|
-
value: "escalation_required"
|
|
326
|
-
}
|
|
327
|
-
]
|
|
328
|
-
},
|
|
329
|
-
required: true
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
kind: "textarea",
|
|
333
|
-
name: "question",
|
|
334
|
-
labelI18n: "assistantGate.question.label",
|
|
335
|
-
placeholderI18n: "assistantGate.question.placeholder",
|
|
336
|
-
required: true
|
|
337
|
-
}
|
|
338
|
-
],
|
|
339
|
-
actions: [
|
|
340
|
-
{
|
|
341
|
-
key: "submit",
|
|
342
|
-
labelI18n: "assistantGate.submit.label",
|
|
343
|
-
op: { name: "assistant.answer", version: "1.0.0" }
|
|
344
|
-
}
|
|
345
|
-
],
|
|
346
|
-
policy: {
|
|
347
|
-
flags: [],
|
|
348
|
-
pii: ["kbSnapshotId", "question"]
|
|
349
|
-
},
|
|
350
|
-
renderHints: {
|
|
351
|
-
ui: "custom",
|
|
352
|
-
form: "react-hook-form"
|
|
353
|
-
}
|
|
354
|
-
});
|
|
355
|
-
// src/policy/guard.ts
|
|
356
|
-
var SUPPORTED_LOCALES = new Set(["en-US", "en-GB", "fr-FR"]);
|
|
357
|
-
function err(code, message) {
|
|
358
|
-
return { code, message };
|
|
359
|
-
}
|
|
360
|
-
function validateEnvelope(envelope) {
|
|
361
|
-
if (!envelope.locale || !SUPPORTED_LOCALES.has(envelope.locale)) {
|
|
362
|
-
return {
|
|
363
|
-
ok: false,
|
|
364
|
-
error: err("LOCALE_REQUIRED", "locale is required and must be supported")
|
|
365
|
-
};
|
|
366
|
-
}
|
|
367
|
-
if (!envelope.regulatoryContext?.jurisdiction) {
|
|
368
|
-
return {
|
|
369
|
-
ok: false,
|
|
370
|
-
error: err("JURISDICTION_REQUIRED", "jurisdiction is required")
|
|
371
|
-
};
|
|
372
|
-
}
|
|
373
|
-
if (!envelope.kbSnapshotId) {
|
|
374
|
-
return {
|
|
375
|
-
ok: false,
|
|
376
|
-
error: err("KB_SNAPSHOT_REQUIRED", "kbSnapshotId is required")
|
|
377
|
-
};
|
|
378
|
-
}
|
|
379
|
-
if (!envelope.allowedScope) {
|
|
380
|
-
return {
|
|
381
|
-
ok: false,
|
|
382
|
-
error: err("SCOPE_VIOLATION", "allowedScope is required")
|
|
383
|
-
};
|
|
384
|
-
}
|
|
385
|
-
return { ok: true, value: envelope };
|
|
386
|
-
}
|
|
387
|
-
function enforceCitations(answer) {
|
|
388
|
-
const citations = answer.citations ?? [];
|
|
389
|
-
if (!Array.isArray(citations) || citations.length === 0) {
|
|
390
|
-
return {
|
|
391
|
-
ok: false,
|
|
392
|
-
error: err("CITATIONS_REQUIRED", "answers must include at least one citation")
|
|
393
|
-
};
|
|
394
|
-
}
|
|
395
|
-
return { ok: true, value: answer };
|
|
396
|
-
}
|
|
397
|
-
var EDUCATION_ONLY_FORBIDDEN_PATTERNS = [
|
|
398
|
-
/\b(buy|sell)\b/i,
|
|
399
|
-
/\b(should\s+buy|should\s+sell)\b/i,
|
|
400
|
-
/\b(guarantee(d)?|promise(d)?)\b/i
|
|
401
|
-
];
|
|
402
|
-
function enforceAllowedScope(allowedScope, answer) {
|
|
403
|
-
if (!allowedScope) {
|
|
404
|
-
return {
|
|
405
|
-
ok: false,
|
|
406
|
-
error: err("SCOPE_VIOLATION", "allowedScope is required")
|
|
407
|
-
};
|
|
408
|
-
}
|
|
409
|
-
if (allowedScope !== "education_only") {
|
|
410
|
-
return { ok: true, value: answer };
|
|
411
|
-
}
|
|
412
|
-
const bodies = (answer.sections ?? []).map((s) => s.body).join(`
|
|
413
|
-
`);
|
|
414
|
-
const violations = EDUCATION_ONLY_FORBIDDEN_PATTERNS.some((re) => re.test(bodies));
|
|
415
|
-
if (violations) {
|
|
416
|
-
return {
|
|
417
|
-
ok: false,
|
|
418
|
-
error: err("SCOPE_VIOLATION", "answer violates education_only scope (contains actionable or promotional language)")
|
|
419
|
-
};
|
|
420
|
-
}
|
|
421
|
-
return { ok: true, value: answer };
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
// src/handlers/demo.handlers.ts
|
|
425
|
-
function createDemoAssistantHandlers() {
|
|
426
|
-
async function answer(input) {
|
|
427
|
-
const env = validateEnvelope(input.envelope);
|
|
428
|
-
if (!env.ok) {
|
|
429
|
-
return {
|
|
430
|
-
locale: input.envelope.locale ?? "en-US",
|
|
431
|
-
jurisdiction: input.envelope.regulatoryContext?.jurisdiction ?? "UNKNOWN",
|
|
432
|
-
allowedScope: input.envelope.allowedScope ?? "education_only",
|
|
433
|
-
sections: [
|
|
434
|
-
{
|
|
435
|
-
heading: "Request blocked",
|
|
436
|
-
body: env.error.message
|
|
437
|
-
}
|
|
438
|
-
],
|
|
439
|
-
citations: [],
|
|
440
|
-
disclaimers: [
|
|
441
|
-
"This system refuses to answer without a valid envelope."
|
|
442
|
-
],
|
|
443
|
-
riskFlags: [env.error.code],
|
|
444
|
-
refused: true,
|
|
445
|
-
refusalReason: env.error.code
|
|
446
|
-
};
|
|
447
|
-
}
|
|
448
|
-
const draft = {
|
|
449
|
-
locale: env.value.locale,
|
|
450
|
-
jurisdiction: env.value.regulatoryContext?.jurisdiction ?? "UNKNOWN",
|
|
451
|
-
allowedScope: env.value.allowedScope ?? "education_only",
|
|
452
|
-
sections: [
|
|
453
|
-
{
|
|
454
|
-
heading: "Answer (demo)",
|
|
455
|
-
body: `You asked: "${input.question}". This demo answer is derived from the KB snapshot only.`
|
|
456
|
-
}
|
|
457
|
-
],
|
|
458
|
-
citations: [
|
|
459
|
-
{
|
|
460
|
-
kbSnapshotId: env.value.kbSnapshotId ?? "unknown",
|
|
461
|
-
sourceType: "ruleVersion",
|
|
462
|
-
sourceId: "rv_demo",
|
|
463
|
-
title: "Demo rule version",
|
|
464
|
-
excerpt: "Demo excerpt"
|
|
465
|
-
}
|
|
466
|
-
],
|
|
467
|
-
disclaimers: ["Educational demo only."],
|
|
468
|
-
riskFlags: []
|
|
469
|
-
};
|
|
470
|
-
const scope = enforceAllowedScope(env.value.allowedScope, draft);
|
|
471
|
-
if (!scope.ok) {
|
|
472
|
-
return {
|
|
473
|
-
...draft,
|
|
474
|
-
sections: [
|
|
475
|
-
{ heading: "Escalation required", body: scope.error.message }
|
|
476
|
-
],
|
|
477
|
-
citations: draft.citations,
|
|
478
|
-
refused: true,
|
|
479
|
-
refusalReason: scope.error.code,
|
|
480
|
-
riskFlags: [...draft.riskFlags ?? [], scope.error.code]
|
|
481
|
-
};
|
|
482
|
-
}
|
|
483
|
-
const cited = enforceCitations(draft);
|
|
484
|
-
if (!cited.ok) {
|
|
485
|
-
return {
|
|
486
|
-
...draft,
|
|
487
|
-
sections: [{ heading: "Request blocked", body: cited.error.message }],
|
|
488
|
-
citations: [],
|
|
489
|
-
refused: true,
|
|
490
|
-
refusalReason: cited.error.code,
|
|
491
|
-
riskFlags: [...draft.riskFlags ?? [], cited.error.code]
|
|
492
|
-
};
|
|
493
|
-
}
|
|
494
|
-
return draft;
|
|
495
|
-
}
|
|
496
|
-
async function explainConcept(input) {
|
|
497
|
-
return await answer({
|
|
498
|
-
envelope: input.envelope,
|
|
499
|
-
question: `Explain concept: ${input.conceptKey}`
|
|
500
|
-
});
|
|
501
|
-
}
|
|
502
|
-
return { answer, explainConcept };
|
|
503
|
-
}
|
|
504
|
-
// src/policy/assistant-gate.policy.ts
|
|
505
|
-
import {
|
|
506
|
-
OwnersEnum as OwnersEnum2,
|
|
507
|
-
StabilityEnum as StabilityEnum2,
|
|
508
|
-
TagsEnum as TagsEnum2
|
|
509
|
-
} from "@contractspec/lib.contracts-spec/ownership";
|
|
510
|
-
import { definePolicy } from "@contractspec/lib.contracts-spec/policy";
|
|
511
|
-
var AssistantGatePolicy = definePolicy({
|
|
512
|
-
meta: {
|
|
513
|
-
key: "locale-jurisdiction-gate.policy.gate",
|
|
514
|
-
version: "1.0.0",
|
|
515
|
-
title: "Assistant Locale and Jurisdiction Gate",
|
|
516
|
-
description: "Requires explicit locale, jurisdiction, knowledge snapshot, and allowed scope before assistant requests may proceed.",
|
|
517
|
-
domain: "assistant",
|
|
518
|
-
scope: "operation",
|
|
519
|
-
owners: [OwnersEnum2.PlatformFinance],
|
|
520
|
-
tags: [TagsEnum2.I18n, "assistant", "policy", "jurisdiction"],
|
|
521
|
-
stability: StabilityEnum2.Experimental
|
|
522
|
-
},
|
|
523
|
-
rules: [
|
|
524
|
-
{
|
|
525
|
-
effect: "deny",
|
|
526
|
-
actions: ["assistant.answer", "assistant.explainConcept"],
|
|
527
|
-
resource: { type: "assistant-call" },
|
|
528
|
-
conditions: [
|
|
529
|
-
{
|
|
530
|
-
expression: "!context.locale || !context.jurisdiction || !context.kbSnapshotId || !context.allowedScope"
|
|
531
|
-
}
|
|
532
|
-
],
|
|
533
|
-
reason: "Assistant requests fail closed until locale, jurisdiction, kbSnapshotId, and allowedScope are explicit."
|
|
534
|
-
},
|
|
535
|
-
{
|
|
536
|
-
effect: "deny",
|
|
537
|
-
actions: ["assistant.answer", "assistant.explainConcept"],
|
|
538
|
-
resource: { type: "assistant-call" },
|
|
539
|
-
conditions: [
|
|
540
|
-
{
|
|
541
|
-
expression: "!['en-US', 'en-GB', 'fr-FR'].includes(context.locale ?? '')"
|
|
542
|
-
}
|
|
543
|
-
],
|
|
544
|
-
reason: "Only the explicitly reviewed assistant locales are permitted."
|
|
545
|
-
},
|
|
546
|
-
{
|
|
547
|
-
effect: "allow",
|
|
548
|
-
actions: ["assistant.answer", "assistant.explainConcept"],
|
|
549
|
-
resource: { type: "assistant-call" },
|
|
550
|
-
conditions: [
|
|
551
|
-
{
|
|
552
|
-
expression: "['en-US', 'en-GB', 'fr-FR'].includes(context.locale ?? '') && !!context.jurisdiction && !!context.kbSnapshotId && !!context.allowedScope"
|
|
553
|
-
}
|
|
554
|
-
],
|
|
555
|
-
reason: "Explicit context is present, so the request may continue to citation and scope validation."
|
|
556
|
-
}
|
|
557
|
-
],
|
|
558
|
-
pii: {
|
|
559
|
-
fields: ["kbSnapshotId"],
|
|
560
|
-
retentionDays: 30
|
|
561
|
-
}
|
|
562
|
-
});
|
|
563
|
-
|
|
564
|
-
// src/locale-jurisdiction-gate.feature.ts
|
|
565
|
-
import { defineFeature } from "@contractspec/lib.contracts-spec";
|
|
566
|
-
var LocaleJurisdictionGateFeature = defineFeature({
|
|
567
|
-
meta: {
|
|
568
|
-
key: "locale-jurisdiction-gate",
|
|
569
|
-
version: "1.0.0",
|
|
570
|
-
title: "Locale + Jurisdiction Gate",
|
|
571
|
-
description: "Fail-closed gating for assistant calls requiring locale/jurisdiction/snapshot/scope and citations.",
|
|
572
|
-
domain: "knowledge",
|
|
573
|
-
owners: ["@examples"],
|
|
574
|
-
tags: ["assistant", "policy", "locale", "jurisdiction", "knowledge"],
|
|
575
|
-
stability: "experimental"
|
|
576
|
-
},
|
|
577
|
-
operations: [
|
|
578
|
-
{ key: "assistant.answer", version: "1.0.0" },
|
|
579
|
-
{ key: "assistant.explainConcept", version: "1.0.0" }
|
|
580
|
-
],
|
|
581
|
-
events: [
|
|
582
|
-
{ key: "assistant.answer.requested", version: "1.0.0" },
|
|
583
|
-
{ key: "assistant.answer.blocked", version: "1.0.0" },
|
|
584
|
-
{ key: "assistant.answer.delivered", version: "1.0.0" }
|
|
585
|
-
],
|
|
586
|
-
presentations: [],
|
|
587
|
-
opToPresentation: [],
|
|
588
|
-
presentationsTargets: [],
|
|
589
|
-
capabilities: {
|
|
590
|
-
requires: [{ key: "knowledge", version: "1.0.0" }]
|
|
591
|
-
},
|
|
592
|
-
policies: [
|
|
593
|
-
{
|
|
594
|
-
key: AssistantGatePolicy.meta.key,
|
|
595
|
-
version: AssistantGatePolicy.meta.version
|
|
596
|
-
}
|
|
597
|
-
],
|
|
598
|
-
knowledge: [
|
|
599
|
-
{ key: "locale-jurisdiction-gate.knowledge.rules", version: "1.0.0" }
|
|
600
|
-
],
|
|
601
|
-
docs: [
|
|
602
|
-
"docs.examples.locale-jurisdiction-gate.goal",
|
|
603
|
-
"docs.examples.locale-jurisdiction-gate.reference"
|
|
604
|
-
]
|
|
605
|
-
});
|
|
606
|
-
|
|
607
|
-
// src/operations/assistant.ts
|
|
608
|
-
import { defineCommand } from "@contractspec/lib.contracts-spec";
|
|
609
|
-
import { defineSchemaModel as defineSchemaModel4, ScalarTypeEnum as ScalarTypeEnum4 } from "@contractspec/lib.schema";
|
|
610
|
-
var AssistantQuestionInput = defineSchemaModel4({
|
|
611
|
-
name: "AssistantQuestionInput",
|
|
612
|
-
description: "Input for assistant calls with mandatory envelope.",
|
|
613
|
-
fields: {
|
|
614
|
-
envelope: { type: LLMCallEnvelopeModel, isOptional: false },
|
|
615
|
-
question: { type: ScalarTypeEnum4.String_unsecure(), isOptional: false }
|
|
616
|
-
}
|
|
617
|
-
});
|
|
618
|
-
var AssistantConceptInput = defineSchemaModel4({
|
|
619
|
-
name: "AssistantConceptInput",
|
|
620
|
-
description: "Input for explaining a concept with mandatory envelope.",
|
|
621
|
-
fields: {
|
|
622
|
-
envelope: { type: LLMCallEnvelopeModel, isOptional: false },
|
|
623
|
-
conceptKey: { type: ScalarTypeEnum4.String_unsecure(), isOptional: false }
|
|
624
|
-
}
|
|
625
|
-
});
|
|
626
|
-
var AssistantAnswerContract = defineCommand({
|
|
627
|
-
meta: {
|
|
628
|
-
key: "assistant.answer",
|
|
629
|
-
version: "1.0.0",
|
|
630
|
-
stability: "experimental",
|
|
631
|
-
owners: ["@examples"],
|
|
632
|
-
tags: ["assistant", "policy", "locale", "jurisdiction", "knowledge"],
|
|
633
|
-
description: "Answer a user question using a KB snapshot with strict locale/jurisdiction gating.",
|
|
634
|
-
goal: "Provide policy-safe answers that cite a KB snapshot or refuse.",
|
|
635
|
-
context: "Called by UI or workflows; must fail-closed if envelope is invalid or citations are missing."
|
|
636
|
-
},
|
|
637
|
-
io: {
|
|
638
|
-
input: AssistantQuestionInput,
|
|
639
|
-
output: AssistantAnswerIRModel,
|
|
640
|
-
errors: {
|
|
641
|
-
LOCALE_REQUIRED: {
|
|
642
|
-
description: "Locale is required and must be supported",
|
|
643
|
-
http: 400,
|
|
644
|
-
gqlCode: "LOCALE_REQUIRED",
|
|
645
|
-
when: "locale is missing or unsupported"
|
|
646
|
-
},
|
|
647
|
-
JURISDICTION_REQUIRED: {
|
|
648
|
-
description: "Jurisdiction is required",
|
|
649
|
-
http: 400,
|
|
650
|
-
gqlCode: "JURISDICTION_REQUIRED",
|
|
651
|
-
when: "jurisdiction is missing"
|
|
652
|
-
},
|
|
653
|
-
KB_SNAPSHOT_REQUIRED: {
|
|
654
|
-
description: "KB snapshot id is required",
|
|
655
|
-
http: 400,
|
|
656
|
-
gqlCode: "KB_SNAPSHOT_REQUIRED",
|
|
657
|
-
when: "kbSnapshotId is missing"
|
|
658
|
-
},
|
|
659
|
-
CITATIONS_REQUIRED: {
|
|
660
|
-
description: "Answers must include citations to a KB snapshot",
|
|
661
|
-
http: 422,
|
|
662
|
-
gqlCode: "CITATIONS_REQUIRED",
|
|
663
|
-
when: "answer has no citations"
|
|
664
|
-
},
|
|
665
|
-
SCOPE_VIOLATION: {
|
|
666
|
-
description: "Answer violates allowed scope and must be refused/escalated",
|
|
667
|
-
http: 403,
|
|
668
|
-
gqlCode: "SCOPE_VIOLATION",
|
|
669
|
-
when: "output includes forbidden content under the given allowedScope"
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
},
|
|
673
|
-
policy: { auth: "user" }
|
|
674
|
-
});
|
|
675
|
-
var AssistantExplainConceptContract = defineCommand({
|
|
676
|
-
meta: {
|
|
677
|
-
key: "assistant.explainConcept",
|
|
678
|
-
version: "1.0.0",
|
|
679
|
-
stability: "experimental",
|
|
680
|
-
owners: ["@examples"],
|
|
681
|
-
tags: ["assistant", "policy", "knowledge", "concepts"],
|
|
682
|
-
description: "Explain a concept using a KB snapshot with strict locale/jurisdiction gating.",
|
|
683
|
-
goal: "Explain concepts with citations or refuse.",
|
|
684
|
-
context: "Same constraints as assistant.answer."
|
|
685
|
-
},
|
|
686
|
-
io: {
|
|
687
|
-
input: AssistantConceptInput,
|
|
688
|
-
output: AssistantAnswerIRModel,
|
|
689
|
-
errors: AssistantAnswerContract.io.errors
|
|
690
|
-
},
|
|
691
|
-
policy: { auth: "user" }
|
|
692
|
-
});
|
|
693
|
-
// src/translations/assistant-gate.en-GB.translation.ts
|
|
694
|
-
import {
|
|
695
|
-
OwnersEnum as OwnersEnum3,
|
|
696
|
-
StabilityEnum as StabilityEnum3,
|
|
697
|
-
TagsEnum as TagsEnum3
|
|
698
|
-
} from "@contractspec/lib.contracts-spec/ownership";
|
|
699
|
-
import { defineTranslation } from "@contractspec/lib.contracts-spec/translations/spec";
|
|
700
|
-
var AssistantGateMessagesEnGb = defineTranslation({
|
|
701
|
-
meta: {
|
|
702
|
-
key: "locale-jurisdiction-gate.translation.assistant-gate.en-GB",
|
|
703
|
-
version: "1.0.0",
|
|
704
|
-
domain: "assistant",
|
|
705
|
-
description: "British English messages for the assistant locale and jurisdiction gate.",
|
|
706
|
-
owners: [OwnersEnum3.PlatformFinance],
|
|
707
|
-
stability: StabilityEnum3.Experimental,
|
|
708
|
-
tags: [TagsEnum3.I18n, "assistant", "policy"]
|
|
709
|
-
},
|
|
710
|
-
locale: "en-GB",
|
|
711
|
-
fallback: "en-US",
|
|
712
|
-
messages: {
|
|
713
|
-
"assistantGate.locale.label": { value: "Locale" },
|
|
714
|
-
"assistantGate.locale.description": {
|
|
715
|
-
value: "Select the reviewed locale for the assistant response."
|
|
716
|
-
},
|
|
717
|
-
"assistantGate.jurisdiction.label": { value: "Jurisdiction" },
|
|
718
|
-
"assistantGate.jurisdiction.placeholder": { value: "UK-FCA" },
|
|
719
|
-
"assistantGate.kbSnapshotId.label": { value: "Knowledge snapshot ID" },
|
|
720
|
-
"assistantGate.kbSnapshotId.placeholder": {
|
|
721
|
-
value: "kb_2026_03_20_policy_reviewed"
|
|
722
|
-
},
|
|
723
|
-
"assistantGate.allowedScope.label": { value: "Permitted scope" },
|
|
724
|
-
"assistantGate.allowedScope.educationOnly": {
|
|
725
|
-
value: "Educational content only"
|
|
726
|
-
},
|
|
727
|
-
"assistantGate.allowedScope.genericInfo": { value: "General information" },
|
|
728
|
-
"assistantGate.allowedScope.escalationRequired": {
|
|
729
|
-
value: "Escalation required"
|
|
730
|
-
},
|
|
731
|
-
"assistantGate.question.label": { value: "Question" },
|
|
732
|
-
"assistantGate.question.placeholder": {
|
|
733
|
-
value: "What may I say about this product in the selected jurisdiction?"
|
|
734
|
-
},
|
|
735
|
-
"assistantGate.submit.label": { value: "Generate response" }
|
|
736
|
-
}
|
|
737
|
-
});
|
|
738
|
-
|
|
739
|
-
// src/translations/assistant-gate.en-US.translation.ts
|
|
740
|
-
import {
|
|
741
|
-
OwnersEnum as OwnersEnum4,
|
|
742
|
-
StabilityEnum as StabilityEnum4,
|
|
743
|
-
TagsEnum as TagsEnum4
|
|
744
|
-
} from "@contractspec/lib.contracts-spec/ownership";
|
|
745
|
-
import { defineTranslation as defineTranslation2 } from "@contractspec/lib.contracts-spec/translations/spec";
|
|
746
|
-
var AssistantGateMessagesEnUs = defineTranslation2({
|
|
747
|
-
meta: {
|
|
748
|
-
key: "locale-jurisdiction-gate.translation.assistant-gate.en-US",
|
|
749
|
-
version: "1.0.0",
|
|
750
|
-
domain: "assistant",
|
|
751
|
-
description: "US English messages for the assistant locale and jurisdiction gate.",
|
|
752
|
-
owners: [OwnersEnum4.PlatformFinance],
|
|
753
|
-
stability: StabilityEnum4.Experimental,
|
|
754
|
-
tags: [TagsEnum4.I18n, "assistant", "policy"]
|
|
755
|
-
},
|
|
756
|
-
locale: "en-US",
|
|
757
|
-
messages: {
|
|
758
|
-
"assistantGate.locale.label": { value: "Locale" },
|
|
759
|
-
"assistantGate.locale.description": {
|
|
760
|
-
value: "Choose the reviewed locale for the assistant answer."
|
|
761
|
-
},
|
|
762
|
-
"assistantGate.locale.enUs": { value: "English (United States)" },
|
|
763
|
-
"assistantGate.locale.enGb": { value: "English (United Kingdom)" },
|
|
764
|
-
"assistantGate.locale.frFr": { value: "French (France)" },
|
|
765
|
-
"assistantGate.jurisdiction.label": { value: "Jurisdiction" },
|
|
766
|
-
"assistantGate.jurisdiction.placeholder": { value: "US-SEC" },
|
|
767
|
-
"assistantGate.kbSnapshotId.label": { value: "Knowledge snapshot ID" },
|
|
768
|
-
"assistantGate.kbSnapshotId.placeholder": {
|
|
769
|
-
value: "kb_2026_03_20_policy_reviewed"
|
|
770
|
-
},
|
|
771
|
-
"assistantGate.allowedScope.label": { value: "Allowed scope" },
|
|
772
|
-
"assistantGate.allowedScope.educationOnly": {
|
|
773
|
-
value: "Educational content only"
|
|
774
|
-
},
|
|
775
|
-
"assistantGate.allowedScope.genericInfo": { value: "Generic information" },
|
|
776
|
-
"assistantGate.allowedScope.escalationRequired": {
|
|
777
|
-
value: "Escalation required"
|
|
778
|
-
},
|
|
779
|
-
"assistantGate.question.label": { value: "Question" },
|
|
780
|
-
"assistantGate.question.placeholder": {
|
|
781
|
-
value: "What can I say about this product in the selected jurisdiction?"
|
|
782
|
-
},
|
|
783
|
-
"assistantGate.submit.label": { value: "Generate answer" }
|
|
784
|
-
}
|
|
785
|
-
});
|
|
786
|
-
|
|
787
|
-
// src/translations/assistant-gate.fr-FR.translation.ts
|
|
788
|
-
import {
|
|
789
|
-
OwnersEnum as OwnersEnum5,
|
|
790
|
-
StabilityEnum as StabilityEnum5,
|
|
791
|
-
TagsEnum as TagsEnum5
|
|
792
|
-
} from "@contractspec/lib.contracts-spec/ownership";
|
|
793
|
-
import { defineTranslation as defineTranslation3 } from "@contractspec/lib.contracts-spec/translations/spec";
|
|
794
|
-
var AssistantGateMessagesFrFr = defineTranslation3({
|
|
795
|
-
meta: {
|
|
796
|
-
key: "locale-jurisdiction-gate.translation.assistant-gate.fr-FR",
|
|
797
|
-
version: "1.0.0",
|
|
798
|
-
domain: "assistant",
|
|
799
|
-
description: "French messages for the assistant locale and jurisdiction gate.",
|
|
800
|
-
owners: [OwnersEnum5.PlatformFinance],
|
|
801
|
-
stability: StabilityEnum5.Experimental,
|
|
802
|
-
tags: [TagsEnum5.I18n, "assistant", "policy"]
|
|
803
|
-
},
|
|
804
|
-
locale: "fr-FR",
|
|
805
|
-
fallback: "en-US",
|
|
806
|
-
messages: {
|
|
807
|
-
"assistantGate.locale.label": { value: "Langue" },
|
|
808
|
-
"assistantGate.locale.description": {
|
|
809
|
-
value: "Sélectionnez la langue validée pour la réponse de l'assistant."
|
|
810
|
-
},
|
|
811
|
-
"assistantGate.jurisdiction.label": { value: "Juridiction" },
|
|
812
|
-
"assistantGate.jurisdiction.placeholder": { value: "FR-AMF" },
|
|
813
|
-
"assistantGate.kbSnapshotId.label": {
|
|
814
|
-
value: "Identifiant du snapshot documentaire"
|
|
815
|
-
},
|
|
816
|
-
"assistantGate.kbSnapshotId.placeholder": {
|
|
817
|
-
value: "kb_2026_03_20_policy_reviewed"
|
|
818
|
-
},
|
|
819
|
-
"assistantGate.allowedScope.label": { value: "Périmètre autorisé" },
|
|
820
|
-
"assistantGate.allowedScope.educationOnly": {
|
|
821
|
-
value: "Contenu éducatif uniquement"
|
|
822
|
-
},
|
|
823
|
-
"assistantGate.allowedScope.genericInfo": {
|
|
824
|
-
value: "Information générale"
|
|
825
|
-
},
|
|
826
|
-
"assistantGate.allowedScope.escalationRequired": {
|
|
827
|
-
value: "Escalade obligatoire"
|
|
828
|
-
},
|
|
829
|
-
"assistantGate.question.label": { value: "Question" },
|
|
830
|
-
"assistantGate.question.placeholder": {
|
|
831
|
-
value: "Que puis-je dire sur ce produit dans la juridiction sélectionnée ?"
|
|
832
|
-
},
|
|
833
|
-
"assistantGate.submit.label": { value: "Générer la réponse" }
|
|
834
|
-
}
|
|
835
|
-
});
|
|
836
|
-
export {
|
|
837
|
-
validateEnvelope,
|
|
838
|
-
example_default as example,
|
|
839
|
-
enforceCitations,
|
|
840
|
-
enforceAllowedScope,
|
|
841
|
-
createDemoAssistantHandlers,
|
|
842
|
-
UserProfileModel,
|
|
843
|
-
RegulatoryContextModel,
|
|
844
|
-
LocaleJurisdictionGateFeature,
|
|
845
|
-
LLMCallEnvelopeModel,
|
|
846
|
-
AssistantGatePolicy,
|
|
847
|
-
AssistantGateMessagesFrFr,
|
|
848
|
-
AssistantGateMessagesEnUs,
|
|
849
|
-
AssistantGateMessagesEnGb,
|
|
850
|
-
AssistantExplainConceptContract,
|
|
851
|
-
AssistantContextForm,
|
|
852
|
-
AssistantCitationModel,
|
|
853
|
-
AssistantAnswerSectionModel,
|
|
854
|
-
AssistantAnswerRequestedEvent,
|
|
855
|
-
AssistantAnswerIRModel,
|
|
856
|
-
AssistantAnswerDeliveredEvent,
|
|
857
|
-
AssistantAnswerContract,
|
|
858
|
-
AssistantAnswerBlockedEvent,
|
|
859
|
-
AllowedScopeEnum
|
|
860
|
-
};
|
|
19
|
+
- assistant.answer.delivered`}];H(J);import{defineEnum as L,defineSchemaModel as x,ScalarTypeEnum as r}from"@contractspec/lib.schema";var f=L("AllowedScope",["education_only","generic_info","escalation_required"]),sr=x({name:"UserProfile",description:"User profile inputs used to derive regulatory context.",fields:{preferredLocale:{type:r.String_unsecure(),isOptional:!0},residencyCountry:{type:r.String_unsecure(),isOptional:!0},taxResidenceCountry:{type:r.String_unsecure(),isOptional:!0},clientType:{type:r.String_unsecure(),isOptional:!0}}}),V=x({name:"RegulatoryContext",description:"Explicit regulatory context (no guessing).",fields:{jurisdiction:{type:r.String_unsecure(),isOptional:!1},region:{type:r.String_unsecure(),isOptional:!0},clientType:{type:r.String_unsecure(),isOptional:!0},allowedScope:{type:f,isOptional:!1}}}),s=x({name:"LLMCallEnvelope",description:"Mandatory envelope for assistant calls. All fields are explicit and required for policy gating.",fields:{traceId:{type:r.String_unsecure(),isOptional:!1},locale:{type:r.String_unsecure(),isOptional:!1},regulatoryContext:{type:V,isOptional:!1},kbSnapshotId:{type:r.String_unsecure(),isOptional:!1},allowedScope:{type:f,isOptional:!1}}}),z=x({name:"AssistantCitation",description:"Citation referencing a KB snapshot + a specific item within it.",fields:{kbSnapshotId:{type:r.String_unsecure(),isOptional:!1},sourceType:{type:r.String_unsecure(),isOptional:!1},sourceId:{type:r.String_unsecure(),isOptional:!1},title:{type:r.String_unsecure(),isOptional:!0},excerpt:{type:r.String_unsecure(),isOptional:!0}}}),A=x({name:"AssistantAnswerSection",description:"Structured answer section.",fields:{heading:{type:r.String_unsecure(),isOptional:!1},body:{type:r.String_unsecure(),isOptional:!1}}}),R=x({name:"AssistantAnswerIR",description:"Structured assistant answer with mandatory citations and explicit locale/jurisdiction.",fields:{locale:{type:r.String_unsecure(),isOptional:!1},jurisdiction:{type:r.String_unsecure(),isOptional:!1},allowedScope:{type:f,isOptional:!1},sections:{type:A,isArray:!0,isOptional:!1},citations:{type:z,isArray:!0,isOptional:!1},disclaimers:{type:r.String_unsecure(),isArray:!0,isOptional:!0},riskFlags:{type:r.String_unsecure(),isArray:!0,isOptional:!0},refused:{type:r.Boolean(),isOptional:!0},refusalReason:{type:r.String_unsecure(),isOptional:!0}}});import{defineEvent as p}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as U,ScalarTypeEnum as t}from"@contractspec/lib.schema";var N=U({name:"AssistantAnswerRequestedPayload",description:"Emitted when an assistant answer is requested (pre-gate).",fields:{traceId:{type:t.String_unsecure(),isOptional:!1},locale:{type:t.String_unsecure(),isOptional:!1},jurisdiction:{type:t.String_unsecure(),isOptional:!1},kbSnapshotId:{type:t.String_unsecure(),isOptional:!1},allowedScope:{type:t.String_unsecure(),isOptional:!1}}}),qr=p({meta:{key:"assistant.answer.requested",version:"1.0.0",description:"Assistant answer requested (policy gate will run).",stability:"experimental",owners:["@examples"],tags:["assistant","policy"]},payload:N}),S=U({name:"AssistantAnswerBlockedPayload",description:"Emitted when a request is blocked by the gate.",fields:{traceId:{type:t.String_unsecure(),isOptional:!1},reasonCode:{type:t.String_unsecure(),isOptional:!1},reason:{type:t.String_unsecure(),isOptional:!1}}}),Kr=p({meta:{key:"assistant.answer.blocked",version:"1.0.0",description:"Assistant answer blocked (fail-closed).",stability:"experimental",owners:["@examples"],tags:["assistant","policy","blocked"]},payload:S}),W=U({name:"AssistantAnswerDeliveredPayload",description:"Emitted when a structured, cited answer is delivered.",fields:{traceId:{type:t.String_unsecure(),isOptional:!1},locale:{type:t.String_unsecure(),isOptional:!1},jurisdiction:{type:t.String_unsecure(),isOptional:!1},kbSnapshotId:{type:t.String_unsecure(),isOptional:!1},allowedScope:{type:t.String_unsecure(),isOptional:!1},citationsCount:{type:t.Int_unsecure(),isOptional:!1}}}),jr=p({meta:{key:"assistant.answer.delivered",version:"1.0.0",description:"Assistant answer delivered (must include KB snapshot citations).",stability:"experimental",owners:["@examples"],tags:["assistant","policy","delivered"]},payload:W});import{defineExample as X}from"@contractspec/lib.contracts-spec";var Z=X({meta:{key:"locale-jurisdiction-gate",version:"1.0.0",title:"Locale / Jurisdiction Gate",description:"Fail-closed gating for assistant calls: locale + jurisdiction + kbSnapshotId + allowedScope must be explicit, answers must cite a snapshot.",kind:"knowledge",visibility:"public",stability:"experimental",owners:["@platform.core"],tags:["policy","locale","jurisdiction","assistant","gating"]},docs:{rootDocId:"docs.examples.locale-jurisdiction-gate"},entrypoints:{packageName:"@contractspec/example.locale-jurisdiction-gate",feature:"./feature",contracts:"./contracts",handlers:"./handlers",docs:"./docs"},surfaces:{templates:!0,sandbox:{enabled:!0,modes:["markdown","specs"]},studio:{enabled:!0,installable:!0},mcp:{enabled:!0}}}),$=Z;import{defineFormSpec as B}from"@contractspec/lib.contracts-spec/forms";import{OwnersEnum as D,StabilityEnum as Y,TagsEnum as l}from"@contractspec/lib.contracts-spec/ownership";import{defineSchemaModel as h,ScalarTypeEnum as I}from"@contractspec/lib.schema";var M=h({name:"AssistantContextFormModel",description:"Form values required before a policy-gated assistant request can be executed.",fields:{locale:{type:I.String_unsecure(),isOptional:!1},jurisdiction:{type:I.String_unsecure(),isOptional:!1},kbSnapshotId:{type:I.String_unsecure(),isOptional:!1},allowedScope:{type:f,isOptional:!1},question:{type:I.String_unsecure(),isOptional:!1}}}),Ar=B({meta:{key:"locale-jurisdiction-gate.form.assistant-context",version:"1.0.0",title:"Assistant Context Gate",description:"Collects the explicit locale, jurisdiction, scope, and knowledge snapshot required by the assistant gate.",domain:"assistant",owners:[D.PlatformFinance],tags:[l.I18n,"assistant","form","policy"],stability:Y.Experimental},model:M,fields:[{kind:"select",name:"locale",labelI18n:"assistantGate.locale.label",descriptionI18n:"assistantGate.locale.description",options:{kind:"static",options:[{labelI18n:"assistantGate.locale.enUs",value:"en-US"},{labelI18n:"assistantGate.locale.enGb",value:"en-GB"},{labelI18n:"assistantGate.locale.frFr",value:"fr-FR"}]},required:!0},{kind:"text",name:"jurisdiction",labelI18n:"assistantGate.jurisdiction.label",placeholderI18n:"assistantGate.jurisdiction.placeholder",required:!0},{kind:"text",name:"kbSnapshotId",labelI18n:"assistantGate.kbSnapshotId.label",placeholderI18n:"assistantGate.kbSnapshotId.placeholder",required:!0},{kind:"radio",name:"allowedScope",labelI18n:"assistantGate.allowedScope.label",options:{kind:"static",options:[{labelI18n:"assistantGate.allowedScope.educationOnly",value:"education_only"},{labelI18n:"assistantGate.allowedScope.genericInfo",value:"generic_info"},{labelI18n:"assistantGate.allowedScope.escalationRequired",value:"escalation_required"}]},required:!0},{kind:"textarea",name:"question",labelI18n:"assistantGate.question.label",placeholderI18n:"assistantGate.question.placeholder",required:!0}],actions:[{key:"submit",labelI18n:"assistantGate.submit.label",op:{name:"assistant.answer",version:"1.0.0"}}],policy:{flags:[],pii:["kbSnapshotId","question"]},renderHints:{ui:"custom",form:"react-hook-form"}});var F=new Set(["en-US","en-GB","fr-FR"]);function O(i,o){return{code:i,message:o}}function Q(i){if(!i.locale||!F.has(i.locale))return{ok:!1,error:O("LOCALE_REQUIRED","locale is required and must be supported")};if(!i.regulatoryContext?.jurisdiction)return{ok:!1,error:O("JURISDICTION_REQUIRED","jurisdiction is required")};if(!i.kbSnapshotId)return{ok:!1,error:O("KB_SNAPSHOT_REQUIRED","kbSnapshotId is required")};if(!i.allowedScope)return{ok:!1,error:O("SCOPE_VIOLATION","allowedScope is required")};return{ok:!0,value:i}}function q(i){let o=i.citations??[];if(!Array.isArray(o)||o.length===0)return{ok:!1,error:O("CITATIONS_REQUIRED","answers must include at least one citation")};return{ok:!0,value:i}}var P=[/\b(buy|sell)\b/i,/\b(should\s+buy|should\s+sell)\b/i,/\b(guarantee(d)?|promise(d)?)\b/i];function K(i,o){if(!i)return{ok:!1,error:O("SCOPE_VIOLATION","allowedScope is required")};if(i!=="education_only")return{ok:!0,value:o};let _=(o.sections??[]).map((u)=>u.body).join(`
|
|
20
|
+
`);if(P.some((u)=>u.test(_)))return{ok:!1,error:O("SCOPE_VIOLATION","answer violates education_only scope (contains actionable or promotional language)")};return{ok:!0,value:o}}function $r(){async function i(_){let g=Q(_.envelope);if(!g.ok)return{locale:_.envelope.locale??"en-US",jurisdiction:_.envelope.regulatoryContext?.jurisdiction??"UNKNOWN",allowedScope:_.envelope.allowedScope??"education_only",sections:[{heading:"Request blocked",body:g.error.message}],citations:[],disclaimers:["This system refuses to answer without a valid envelope."],riskFlags:[g.error.code],refused:!0,refusalReason:g.error.code};let u={locale:g.value.locale,jurisdiction:g.value.regulatoryContext?.jurisdiction??"UNKNOWN",allowedScope:g.value.allowedScope??"education_only",sections:[{heading:"Answer (demo)",body:`You asked: "${_.question}". This demo answer is derived from the KB snapshot only.`}],citations:[{kbSnapshotId:g.value.kbSnapshotId??"unknown",sourceType:"ruleVersion",sourceId:"rv_demo",title:"Demo rule version",excerpt:"Demo excerpt"}],disclaimers:["Educational demo only."],riskFlags:[]},e=K(g.value.allowedScope,u);if(!e.ok)return{...u,sections:[{heading:"Escalation required",body:e.error.message}],citations:u.citations,refused:!0,refusalReason:e.error.code,riskFlags:[...u.riskFlags??[],e.error.code]};let y=q(u);if(!y.ok)return{...u,sections:[{heading:"Request blocked",body:y.error.message}],citations:[],refused:!0,refusalReason:y.error.code,riskFlags:[...u.riskFlags??[],y.error.code]};return u}async function o(_){return await i({envelope:_.envelope,question:`Explain concept: ${_.conceptKey}`})}return{answer:i,explainConcept:o}}import{OwnersEnum as d,StabilityEnum as w,TagsEnum as b}from"@contractspec/lib.contracts-spec/ownership";import{definePolicy as T}from"@contractspec/lib.contracts-spec/policy";var C=T({meta:{key:"locale-jurisdiction-gate.policy.gate",version:"1.0.0",title:"Assistant Locale and Jurisdiction Gate",description:"Requires explicit locale, jurisdiction, knowledge snapshot, and allowed scope before assistant requests may proceed.",domain:"assistant",scope:"operation",owners:[d.PlatformFinance],tags:[b.I18n,"assistant","policy","jurisdiction"],stability:w.Experimental},rules:[{effect:"deny",actions:["assistant.answer","assistant.explainConcept"],resource:{type:"assistant-call"},conditions:[{expression:"!context.locale || !context.jurisdiction || !context.kbSnapshotId || !context.allowedScope"}],reason:"Assistant requests fail closed until locale, jurisdiction, kbSnapshotId, and allowedScope are explicit."},{effect:"deny",actions:["assistant.answer","assistant.explainConcept"],resource:{type:"assistant-call"},conditions:[{expression:"!['en-US', 'en-GB', 'fr-FR'].includes(context.locale ?? '')"}],reason:"Only the explicitly reviewed assistant locales are permitted."},{effect:"allow",actions:["assistant.answer","assistant.explainConcept"],resource:{type:"assistant-call"},conditions:[{expression:"['en-US', 'en-GB', 'fr-FR'].includes(context.locale ?? '') && !!context.jurisdiction && !!context.kbSnapshotId && !!context.allowedScope"}],reason:"Explicit context is present, so the request may continue to citation and scope validation."}],pii:{fields:["kbSnapshotId"],retentionDays:30}});import{defineFeature as v}from"@contractspec/lib.contracts-spec";var dr=v({meta:{key:"locale-jurisdiction-gate",version:"1.0.0",title:"Locale + Jurisdiction Gate",description:"Fail-closed gating for assistant calls requiring locale/jurisdiction/snapshot/scope and citations.",domain:"knowledge",owners:["@examples"],tags:["assistant","policy","locale","jurisdiction","knowledge"],stability:"experimental"},operations:[{key:"assistant.answer",version:"1.0.0"},{key:"assistant.explainConcept",version:"1.0.0"}],events:[{key:"assistant.answer.requested",version:"1.0.0"},{key:"assistant.answer.blocked",version:"1.0.0"},{key:"assistant.answer.delivered",version:"1.0.0"}],presentations:[],opToPresentation:[],presentationsTargets:[],capabilities:{requires:[{key:"knowledge",version:"1.0.0"}]},policies:[{key:C.meta.key,version:C.meta.version}],knowledge:[{key:"locale-jurisdiction-gate.knowledge.rules",version:"1.0.0"}],docs:["docs.examples.locale-jurisdiction-gate.goal","docs.examples.locale-jurisdiction-gate.reference"]});import{defineCommand as j}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as k,ScalarTypeEnum as G}from"@contractspec/lib.schema";var n=k({name:"AssistantQuestionInput",description:"Input for assistant calls with mandatory envelope.",fields:{envelope:{type:s,isOptional:!1},question:{type:G.String_unsecure(),isOptional:!1}}}),E=k({name:"AssistantConceptInput",description:"Input for explaining a concept with mandatory envelope.",fields:{envelope:{type:s,isOptional:!1},conceptKey:{type:G.String_unsecure(),isOptional:!1}}}),m=j({meta:{key:"assistant.answer",version:"1.0.0",stability:"experimental",owners:["@examples"],tags:["assistant","policy","locale","jurisdiction","knowledge"],description:"Answer a user question using a KB snapshot with strict locale/jurisdiction gating.",goal:"Provide policy-safe answers that cite a KB snapshot or refuse.",context:"Called by UI or workflows; must fail-closed if envelope is invalid or citations are missing."},io:{input:n,output:R,errors:{LOCALE_REQUIRED:{description:"Locale is required and must be supported",http:400,gqlCode:"LOCALE_REQUIRED",when:"locale is missing or unsupported"},JURISDICTION_REQUIRED:{description:"Jurisdiction is required",http:400,gqlCode:"JURISDICTION_REQUIRED",when:"jurisdiction is missing"},KB_SNAPSHOT_REQUIRED:{description:"KB snapshot id is required",http:400,gqlCode:"KB_SNAPSHOT_REQUIRED",when:"kbSnapshotId is missing"},CITATIONS_REQUIRED:{description:"Answers must include citations to a KB snapshot",http:422,gqlCode:"CITATIONS_REQUIRED",when:"answer has no citations"},SCOPE_VIOLATION:{description:"Answer violates allowed scope and must be refused/escalated",http:403,gqlCode:"SCOPE_VIOLATION",when:"output includes forbidden content under the given allowedScope"}}},policy:{auth:"user"}}),nr=j({meta:{key:"assistant.explainConcept",version:"1.0.0",stability:"experimental",owners:["@examples"],tags:["assistant","policy","knowledge","concepts"],description:"Explain a concept using a KB snapshot with strict locale/jurisdiction gating.",goal:"Explain concepts with citations or refuse.",context:"Same constraints as assistant.answer."},io:{input:E,output:R,errors:m.io.errors},policy:{auth:"user"}});import{OwnersEnum as a,StabilityEnum as c,TagsEnum as rr}from"@contractspec/lib.contracts-spec/ownership";import{defineTranslation as ir}from"@contractspec/lib.contracts-spec/translations/spec";var _i=ir({meta:{key:"locale-jurisdiction-gate.translation.assistant-gate.en-GB",version:"1.0.0",domain:"assistant",description:"British English messages for the assistant locale and jurisdiction gate.",owners:[a.PlatformFinance],stability:c.Experimental,tags:[rr.I18n,"assistant","policy"]},locale:"en-GB",fallback:"en-US",messages:{"assistantGate.locale.label":{value:"Locale"},"assistantGate.locale.description":{value:"Select the reviewed locale for the assistant response."},"assistantGate.jurisdiction.label":{value:"Jurisdiction"},"assistantGate.jurisdiction.placeholder":{value:"UK-FCA"},"assistantGate.kbSnapshotId.label":{value:"Knowledge snapshot ID"},"assistantGate.kbSnapshotId.placeholder":{value:"kb_2026_03_20_policy_reviewed"},"assistantGate.allowedScope.label":{value:"Permitted scope"},"assistantGate.allowedScope.educationOnly":{value:"Educational content only"},"assistantGate.allowedScope.genericInfo":{value:"General information"},"assistantGate.allowedScope.escalationRequired":{value:"Escalation required"},"assistantGate.question.label":{value:"Question"},"assistantGate.question.placeholder":{value:"What may I say about this product in the selected jurisdiction?"},"assistantGate.submit.label":{value:"Generate response"}}});import{OwnersEnum as tr,StabilityEnum as ur,TagsEnum as or}from"@contractspec/lib.contracts-spec/ownership";import{defineTranslation as _r}from"@contractspec/lib.contracts-spec/translations/spec";var fi=_r({meta:{key:"locale-jurisdiction-gate.translation.assistant-gate.en-US",version:"1.0.0",domain:"assistant",description:"US English messages for the assistant locale and jurisdiction gate.",owners:[tr.PlatformFinance],stability:ur.Experimental,tags:[or.I18n,"assistant","policy"]},locale:"en-US",messages:{"assistantGate.locale.label":{value:"Locale"},"assistantGate.locale.description":{value:"Choose the reviewed locale for the assistant answer."},"assistantGate.locale.enUs":{value:"English (United States)"},"assistantGate.locale.enGb":{value:"English (United Kingdom)"},"assistantGate.locale.frFr":{value:"French (France)"},"assistantGate.jurisdiction.label":{value:"Jurisdiction"},"assistantGate.jurisdiction.placeholder":{value:"US-SEC"},"assistantGate.kbSnapshotId.label":{value:"Knowledge snapshot ID"},"assistantGate.kbSnapshotId.placeholder":{value:"kb_2026_03_20_policy_reviewed"},"assistantGate.allowedScope.label":{value:"Allowed scope"},"assistantGate.allowedScope.educationOnly":{value:"Educational content only"},"assistantGate.allowedScope.genericInfo":{value:"Generic information"},"assistantGate.allowedScope.escalationRequired":{value:"Escalation required"},"assistantGate.question.label":{value:"Question"},"assistantGate.question.placeholder":{value:"What can I say about this product in the selected jurisdiction?"},"assistantGate.submit.label":{value:"Generate answer"}}});import{OwnersEnum as gr,StabilityEnum as Or,TagsEnum as xr}from"@contractspec/lib.contracts-spec/ownership";import{defineTranslation as fr}from"@contractspec/lib.contracts-spec/translations/spec";var si=fr({meta:{key:"locale-jurisdiction-gate.translation.assistant-gate.fr-FR",version:"1.0.0",domain:"assistant",description:"French messages for the assistant locale and jurisdiction gate.",owners:[gr.PlatformFinance],stability:Or.Experimental,tags:[xr.I18n,"assistant","policy"]},locale:"fr-FR",fallback:"en-US",messages:{"assistantGate.locale.label":{value:"Langue"},"assistantGate.locale.description":{value:"Sélectionnez la langue validée pour la réponse de l'assistant."},"assistantGate.jurisdiction.label":{value:"Juridiction"},"assistantGate.jurisdiction.placeholder":{value:"FR-AMF"},"assistantGate.kbSnapshotId.label":{value:"Identifiant du snapshot documentaire"},"assistantGate.kbSnapshotId.placeholder":{value:"kb_2026_03_20_policy_reviewed"},"assistantGate.allowedScope.label":{value:"Périmètre autorisé"},"assistantGate.allowedScope.educationOnly":{value:"Contenu éducatif uniquement"},"assistantGate.allowedScope.genericInfo":{value:"Information générale"},"assistantGate.allowedScope.escalationRequired":{value:"Escalade obligatoire"},"assistantGate.question.label":{value:"Question"},"assistantGate.question.placeholder":{value:"Que puis-je dire sur ce produit dans la juridiction sélectionnée ?"},"assistantGate.submit.label":{value:"Générer la réponse"}}});export{Q as validateEnvelope,$ as example,q as enforceCitations,K as enforceAllowedScope,$r as createDemoAssistantHandlers,sr as UserProfileModel,V as RegulatoryContextModel,dr as LocaleJurisdictionGateFeature,s as LLMCallEnvelopeModel,C as AssistantGatePolicy,si as AssistantGateMessagesFrFr,fi as AssistantGateMessagesEnUs,_i as AssistantGateMessagesEnGb,nr as AssistantExplainConceptContract,Ar as AssistantContextForm,z as AssistantCitationModel,A as AssistantAnswerSectionModel,qr as AssistantAnswerRequestedEvent,R as AssistantAnswerIRModel,jr as AssistantAnswerDeliveredEvent,m as AssistantAnswerContract,Kr as AssistantAnswerBlockedEvent,f as AllowedScopeEnum};
|