@contractspec/example.locale-jurisdiction-gate 3.7.6 → 3.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +72 -51
- package/AGENTS.md +50 -27
- package/CHANGELOG.md +21 -0
- package/README.md +87 -42
- package/dist/browser/entities/index.js +2 -2
- package/dist/browser/entities/models.js +2 -2
- package/dist/browser/events.js +1 -1
- package/dist/browser/forms/assistant-context.form.js +213 -0
- package/dist/browser/forms/index.js +213 -0
- package/dist/browser/index.js +362 -40
- package/dist/browser/locale-jurisdiction-gate.feature.js +66 -1
- package/dist/browser/operations/assistant.js +3 -3
- package/dist/browser/operations/index.js +3 -3
- package/dist/browser/policy/assistant-gate.policy.js +62 -0
- package/dist/browser/policy/index.js +62 -1
- package/dist/browser/translations/assistant-gate.en-GB.translation.js +48 -0
- package/dist/browser/translations/assistant-gate.en-US.translation.js +50 -0
- package/dist/browser/translations/assistant-gate.fr-FR.translation.js +52 -0
- package/dist/browser/translations/index.js +148 -0
- package/dist/contracts.test.d.ts +1 -0
- package/dist/entities/index.js +2 -2
- package/dist/entities/models.js +2 -2
- package/dist/events.js +1 -1
- package/dist/forms/assistant-context.form.d.ts +22 -0
- package/dist/forms/assistant-context.form.js +214 -0
- package/dist/forms/index.d.ts +1 -0
- package/dist/forms/index.js +214 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +362 -40
- package/dist/locale-jurisdiction-gate.feature.js +66 -1
- package/dist/node/entities/index.js +2 -2
- package/dist/node/entities/models.js +2 -2
- package/dist/node/events.js +1 -1
- package/dist/node/forms/assistant-context.form.js +213 -0
- package/dist/node/forms/index.js +213 -0
- package/dist/node/index.js +362 -40
- package/dist/node/locale-jurisdiction-gate.feature.js +66 -1
- package/dist/node/operations/assistant.js +3 -3
- package/dist/node/operations/index.js +3 -3
- package/dist/node/policy/assistant-gate.policy.js +62 -0
- package/dist/node/policy/index.js +62 -1
- package/dist/node/translations/assistant-gate.en-GB.translation.js +48 -0
- package/dist/node/translations/assistant-gate.en-US.translation.js +50 -0
- package/dist/node/translations/assistant-gate.fr-FR.translation.js +52 -0
- package/dist/node/translations/index.js +148 -0
- package/dist/operations/assistant.js +3 -3
- package/dist/operations/index.js +3 -3
- package/dist/policy/assistant-gate.policy.d.ts +1 -0
- package/dist/policy/assistant-gate.policy.js +63 -0
- package/dist/policy/index.d.ts +2 -1
- package/dist/policy/index.js +62 -1
- package/dist/translations/assistant-gate.en-GB.translation.d.ts +1 -0
- package/dist/translations/assistant-gate.en-GB.translation.js +49 -0
- package/dist/translations/assistant-gate.en-US.translation.d.ts +1 -0
- package/dist/translations/assistant-gate.en-US.translation.js +51 -0
- package/dist/translations/assistant-gate.fr-FR.translation.d.ts +1 -0
- package/dist/translations/assistant-gate.fr-FR.translation.js +53 -0
- package/dist/translations/index.d.ts +3 -0
- package/dist/translations/index.js +149 -0
- package/package.json +105 -7
- package/src/contracts.test.ts +32 -0
- package/src/docs/locale-jurisdiction-gate.docblock.ts +21 -21
- package/src/entities/models.ts +87 -87
- package/src/events.ts +55 -55
- package/src/example.ts +28 -28
- package/src/forms/assistant-context.form.ts +112 -0
- package/src/forms/index.ts +1 -0
- package/src/handlers/demo.handlers.test.ts +46 -46
- package/src/handlers/demo.handlers.ts +133 -133
- package/src/index.ts +5 -3
- package/src/locale-jurisdiction-gate.feature.ts +40 -34
- package/src/operations/assistant.ts +82 -82
- package/src/policy/assistant-gate.policy.ts +65 -0
- package/src/policy/guard.test.ts +18 -18
- package/src/policy/guard.ts +75 -75
- package/src/policy/index.ts +2 -1
- package/src/policy/types.ts +12 -12
- package/src/translations/assistant-gate.en-GB.translation.ts +46 -0
- package/src/translations/assistant-gate.en-US.translation.ts +48 -0
- package/src/translations/assistant-gate.fr-FR.translation.ts +51 -0
- package/src/translations/index.ts +3 -0
- package/tsconfig.json +7 -15
- package/tsdown.config.js +7 -13
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/translations/assistant-gate.fr-FR.translation.ts
|
|
3
|
+
import {
|
|
4
|
+
OwnersEnum,
|
|
5
|
+
StabilityEnum,
|
|
6
|
+
TagsEnum
|
|
7
|
+
} from "@contractspec/lib.contracts-spec/ownership";
|
|
8
|
+
import { defineTranslation } from "@contractspec/lib.contracts-spec/translations/spec";
|
|
9
|
+
var AssistantGateMessagesFrFr = defineTranslation({
|
|
10
|
+
meta: {
|
|
11
|
+
key: "locale-jurisdiction-gate.translation.assistant-gate.fr-FR",
|
|
12
|
+
version: "1.0.0",
|
|
13
|
+
domain: "assistant",
|
|
14
|
+
description: "French messages for the assistant locale and jurisdiction gate.",
|
|
15
|
+
owners: [OwnersEnum.PlatformFinance],
|
|
16
|
+
stability: StabilityEnum.Experimental,
|
|
17
|
+
tags: [TagsEnum.I18n, "assistant", "policy"]
|
|
18
|
+
},
|
|
19
|
+
locale: "fr-FR",
|
|
20
|
+
fallback: "en-US",
|
|
21
|
+
messages: {
|
|
22
|
+
"assistantGate.locale.label": { value: "Langue" },
|
|
23
|
+
"assistantGate.locale.description": {
|
|
24
|
+
value: "S\xE9lectionnez la langue valid\xE9e pour la r\xE9ponse de l'assistant."
|
|
25
|
+
},
|
|
26
|
+
"assistantGate.jurisdiction.label": { value: "Juridiction" },
|
|
27
|
+
"assistantGate.jurisdiction.placeholder": { value: "FR-AMF" },
|
|
28
|
+
"assistantGate.kbSnapshotId.label": {
|
|
29
|
+
value: "Identifiant du snapshot documentaire"
|
|
30
|
+
},
|
|
31
|
+
"assistantGate.kbSnapshotId.placeholder": {
|
|
32
|
+
value: "kb_2026_03_20_policy_reviewed"
|
|
33
|
+
},
|
|
34
|
+
"assistantGate.allowedScope.label": { value: "P\xE9rim\xE8tre autoris\xE9" },
|
|
35
|
+
"assistantGate.allowedScope.educationOnly": {
|
|
36
|
+
value: "Contenu \xE9ducatif uniquement"
|
|
37
|
+
},
|
|
38
|
+
"assistantGate.allowedScope.genericInfo": {
|
|
39
|
+
value: "Information g\xE9n\xE9rale"
|
|
40
|
+
},
|
|
41
|
+
"assistantGate.allowedScope.escalationRequired": {
|
|
42
|
+
value: "Escalade obligatoire"
|
|
43
|
+
},
|
|
44
|
+
"assistantGate.question.label": { value: "Question" },
|
|
45
|
+
"assistantGate.question.placeholder": {
|
|
46
|
+
value: "Que puis-je dire sur ce produit dans la juridiction s\xE9lectionn\xE9e ?"
|
|
47
|
+
},
|
|
48
|
+
"assistantGate.submit.label": { value: "G\xE9n\xE9rer la r\xE9ponse" }
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
export {
|
|
52
|
+
AssistantGateMessagesFrFr
|
|
53
|
+
};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/translations/assistant-gate.en-GB.translation.ts
|
|
3
|
+
import {
|
|
4
|
+
OwnersEnum,
|
|
5
|
+
StabilityEnum,
|
|
6
|
+
TagsEnum
|
|
7
|
+
} from "@contractspec/lib.contracts-spec/ownership";
|
|
8
|
+
import { defineTranslation } from "@contractspec/lib.contracts-spec/translations/spec";
|
|
9
|
+
var AssistantGateMessagesEnGb = defineTranslation({
|
|
10
|
+
meta: {
|
|
11
|
+
key: "locale-jurisdiction-gate.translation.assistant-gate.en-GB",
|
|
12
|
+
version: "1.0.0",
|
|
13
|
+
domain: "assistant",
|
|
14
|
+
description: "British English messages for the assistant locale and jurisdiction gate.",
|
|
15
|
+
owners: [OwnersEnum.PlatformFinance],
|
|
16
|
+
stability: StabilityEnum.Experimental,
|
|
17
|
+
tags: [TagsEnum.I18n, "assistant", "policy"]
|
|
18
|
+
},
|
|
19
|
+
locale: "en-GB",
|
|
20
|
+
fallback: "en-US",
|
|
21
|
+
messages: {
|
|
22
|
+
"assistantGate.locale.label": { value: "Locale" },
|
|
23
|
+
"assistantGate.locale.description": {
|
|
24
|
+
value: "Select the reviewed locale for the assistant response."
|
|
25
|
+
},
|
|
26
|
+
"assistantGate.jurisdiction.label": { value: "Jurisdiction" },
|
|
27
|
+
"assistantGate.jurisdiction.placeholder": { value: "UK-FCA" },
|
|
28
|
+
"assistantGate.kbSnapshotId.label": { value: "Knowledge snapshot ID" },
|
|
29
|
+
"assistantGate.kbSnapshotId.placeholder": {
|
|
30
|
+
value: "kb_2026_03_20_policy_reviewed"
|
|
31
|
+
},
|
|
32
|
+
"assistantGate.allowedScope.label": { value: "Permitted scope" },
|
|
33
|
+
"assistantGate.allowedScope.educationOnly": {
|
|
34
|
+
value: "Educational content only"
|
|
35
|
+
},
|
|
36
|
+
"assistantGate.allowedScope.genericInfo": { value: "General information" },
|
|
37
|
+
"assistantGate.allowedScope.escalationRequired": {
|
|
38
|
+
value: "Escalation required"
|
|
39
|
+
},
|
|
40
|
+
"assistantGate.question.label": { value: "Question" },
|
|
41
|
+
"assistantGate.question.placeholder": {
|
|
42
|
+
value: "What may I say about this product in the selected jurisdiction?"
|
|
43
|
+
},
|
|
44
|
+
"assistantGate.submit.label": { value: "Generate response" }
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// src/translations/assistant-gate.en-US.translation.ts
|
|
49
|
+
import {
|
|
50
|
+
OwnersEnum as OwnersEnum2,
|
|
51
|
+
StabilityEnum as StabilityEnum2,
|
|
52
|
+
TagsEnum as TagsEnum2
|
|
53
|
+
} from "@contractspec/lib.contracts-spec/ownership";
|
|
54
|
+
import { defineTranslation as defineTranslation2 } from "@contractspec/lib.contracts-spec/translations/spec";
|
|
55
|
+
var AssistantGateMessagesEnUs = defineTranslation2({
|
|
56
|
+
meta: {
|
|
57
|
+
key: "locale-jurisdiction-gate.translation.assistant-gate.en-US",
|
|
58
|
+
version: "1.0.0",
|
|
59
|
+
domain: "assistant",
|
|
60
|
+
description: "US English messages for the assistant locale and jurisdiction gate.",
|
|
61
|
+
owners: [OwnersEnum2.PlatformFinance],
|
|
62
|
+
stability: StabilityEnum2.Experimental,
|
|
63
|
+
tags: [TagsEnum2.I18n, "assistant", "policy"]
|
|
64
|
+
},
|
|
65
|
+
locale: "en-US",
|
|
66
|
+
messages: {
|
|
67
|
+
"assistantGate.locale.label": { value: "Locale" },
|
|
68
|
+
"assistantGate.locale.description": {
|
|
69
|
+
value: "Choose the reviewed locale for the assistant answer."
|
|
70
|
+
},
|
|
71
|
+
"assistantGate.locale.enUs": { value: "English (United States)" },
|
|
72
|
+
"assistantGate.locale.enGb": { value: "English (United Kingdom)" },
|
|
73
|
+
"assistantGate.locale.frFr": { value: "French (France)" },
|
|
74
|
+
"assistantGate.jurisdiction.label": { value: "Jurisdiction" },
|
|
75
|
+
"assistantGate.jurisdiction.placeholder": { value: "US-SEC" },
|
|
76
|
+
"assistantGate.kbSnapshotId.label": { value: "Knowledge snapshot ID" },
|
|
77
|
+
"assistantGate.kbSnapshotId.placeholder": {
|
|
78
|
+
value: "kb_2026_03_20_policy_reviewed"
|
|
79
|
+
},
|
|
80
|
+
"assistantGate.allowedScope.label": { value: "Allowed scope" },
|
|
81
|
+
"assistantGate.allowedScope.educationOnly": {
|
|
82
|
+
value: "Educational content only"
|
|
83
|
+
},
|
|
84
|
+
"assistantGate.allowedScope.genericInfo": { value: "Generic information" },
|
|
85
|
+
"assistantGate.allowedScope.escalationRequired": {
|
|
86
|
+
value: "Escalation required"
|
|
87
|
+
},
|
|
88
|
+
"assistantGate.question.label": { value: "Question" },
|
|
89
|
+
"assistantGate.question.placeholder": {
|
|
90
|
+
value: "What can I say about this product in the selected jurisdiction?"
|
|
91
|
+
},
|
|
92
|
+
"assistantGate.submit.label": { value: "Generate answer" }
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// src/translations/assistant-gate.fr-FR.translation.ts
|
|
97
|
+
import {
|
|
98
|
+
OwnersEnum as OwnersEnum3,
|
|
99
|
+
StabilityEnum as StabilityEnum3,
|
|
100
|
+
TagsEnum as TagsEnum3
|
|
101
|
+
} from "@contractspec/lib.contracts-spec/ownership";
|
|
102
|
+
import { defineTranslation as defineTranslation3 } from "@contractspec/lib.contracts-spec/translations/spec";
|
|
103
|
+
var AssistantGateMessagesFrFr = defineTranslation3({
|
|
104
|
+
meta: {
|
|
105
|
+
key: "locale-jurisdiction-gate.translation.assistant-gate.fr-FR",
|
|
106
|
+
version: "1.0.0",
|
|
107
|
+
domain: "assistant",
|
|
108
|
+
description: "French messages for the assistant locale and jurisdiction gate.",
|
|
109
|
+
owners: [OwnersEnum3.PlatformFinance],
|
|
110
|
+
stability: StabilityEnum3.Experimental,
|
|
111
|
+
tags: [TagsEnum3.I18n, "assistant", "policy"]
|
|
112
|
+
},
|
|
113
|
+
locale: "fr-FR",
|
|
114
|
+
fallback: "en-US",
|
|
115
|
+
messages: {
|
|
116
|
+
"assistantGate.locale.label": { value: "Langue" },
|
|
117
|
+
"assistantGate.locale.description": {
|
|
118
|
+
value: "S\xE9lectionnez la langue valid\xE9e pour la r\xE9ponse de l'assistant."
|
|
119
|
+
},
|
|
120
|
+
"assistantGate.jurisdiction.label": { value: "Juridiction" },
|
|
121
|
+
"assistantGate.jurisdiction.placeholder": { value: "FR-AMF" },
|
|
122
|
+
"assistantGate.kbSnapshotId.label": {
|
|
123
|
+
value: "Identifiant du snapshot documentaire"
|
|
124
|
+
},
|
|
125
|
+
"assistantGate.kbSnapshotId.placeholder": {
|
|
126
|
+
value: "kb_2026_03_20_policy_reviewed"
|
|
127
|
+
},
|
|
128
|
+
"assistantGate.allowedScope.label": { value: "P\xE9rim\xE8tre autoris\xE9" },
|
|
129
|
+
"assistantGate.allowedScope.educationOnly": {
|
|
130
|
+
value: "Contenu \xE9ducatif uniquement"
|
|
131
|
+
},
|
|
132
|
+
"assistantGate.allowedScope.genericInfo": {
|
|
133
|
+
value: "Information g\xE9n\xE9rale"
|
|
134
|
+
},
|
|
135
|
+
"assistantGate.allowedScope.escalationRequired": {
|
|
136
|
+
value: "Escalade obligatoire"
|
|
137
|
+
},
|
|
138
|
+
"assistantGate.question.label": { value: "Question" },
|
|
139
|
+
"assistantGate.question.placeholder": {
|
|
140
|
+
value: "Que puis-je dire sur ce produit dans la juridiction s\xE9lectionn\xE9e ?"
|
|
141
|
+
},
|
|
142
|
+
"assistantGate.submit.label": { value: "G\xE9n\xE9rer la r\xE9ponse" }
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
export {
|
|
146
|
+
AssistantGateMessagesFrFr,
|
|
147
|
+
AssistantGateMessagesEnUs,
|
|
148
|
+
AssistantGateMessagesEnGb
|
|
149
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractspec/example.locale-jurisdiction-gate",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.10",
|
|
4
4
|
"description": "Example: enforce locale + jurisdiction + kbSnapshotId + allowed scope for assistant calls (fail-closed).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -54,6 +54,20 @@
|
|
|
54
54
|
"node": "./dist/node/example.js",
|
|
55
55
|
"default": "./dist/example.js"
|
|
56
56
|
},
|
|
57
|
+
"./forms": {
|
|
58
|
+
"types": "./dist/forms/index.d.ts",
|
|
59
|
+
"browser": "./dist/browser/forms/index.js",
|
|
60
|
+
"bun": "./dist/forms/index.js",
|
|
61
|
+
"node": "./dist/node/forms/index.js",
|
|
62
|
+
"default": "./dist/forms/index.js"
|
|
63
|
+
},
|
|
64
|
+
"./forms/assistant-context.form": {
|
|
65
|
+
"types": "./dist/forms/assistant-context.form.d.ts",
|
|
66
|
+
"browser": "./dist/browser/forms/assistant-context.form.js",
|
|
67
|
+
"bun": "./dist/forms/assistant-context.form.js",
|
|
68
|
+
"node": "./dist/node/forms/assistant-context.form.js",
|
|
69
|
+
"default": "./dist/forms/assistant-context.form.js"
|
|
70
|
+
},
|
|
57
71
|
"./handlers": {
|
|
58
72
|
"types": "./dist/handlers/index.d.ts",
|
|
59
73
|
"browser": "./dist/browser/handlers/index.js",
|
|
@@ -96,6 +110,13 @@
|
|
|
96
110
|
"node": "./dist/node/policy/index.js",
|
|
97
111
|
"default": "./dist/policy/index.js"
|
|
98
112
|
},
|
|
113
|
+
"./policy/assistant-gate.policy": {
|
|
114
|
+
"types": "./dist/policy/assistant-gate.policy.d.ts",
|
|
115
|
+
"browser": "./dist/browser/policy/assistant-gate.policy.js",
|
|
116
|
+
"bun": "./dist/policy/assistant-gate.policy.js",
|
|
117
|
+
"node": "./dist/node/policy/assistant-gate.policy.js",
|
|
118
|
+
"default": "./dist/policy/assistant-gate.policy.js"
|
|
119
|
+
},
|
|
99
120
|
"./policy/guard": {
|
|
100
121
|
"types": "./dist/policy/guard.d.ts",
|
|
101
122
|
"browser": "./dist/browser/policy/guard.js",
|
|
@@ -109,6 +130,34 @@
|
|
|
109
130
|
"bun": "./dist/policy/types.js",
|
|
110
131
|
"node": "./dist/node/policy/types.js",
|
|
111
132
|
"default": "./dist/policy/types.js"
|
|
133
|
+
},
|
|
134
|
+
"./translations": {
|
|
135
|
+
"types": "./dist/translations/index.d.ts",
|
|
136
|
+
"browser": "./dist/browser/translations/index.js",
|
|
137
|
+
"bun": "./dist/translations/index.js",
|
|
138
|
+
"node": "./dist/node/translations/index.js",
|
|
139
|
+
"default": "./dist/translations/index.js"
|
|
140
|
+
},
|
|
141
|
+
"./translations/assistant-gate.en-GB.translation": {
|
|
142
|
+
"types": "./dist/translations/assistant-gate.en-GB.translation.d.ts",
|
|
143
|
+
"browser": "./dist/browser/translations/assistant-gate.en-GB.translation.js",
|
|
144
|
+
"bun": "./dist/translations/assistant-gate.en-GB.translation.js",
|
|
145
|
+
"node": "./dist/node/translations/assistant-gate.en-GB.translation.js",
|
|
146
|
+
"default": "./dist/translations/assistant-gate.en-GB.translation.js"
|
|
147
|
+
},
|
|
148
|
+
"./translations/assistant-gate.en-US.translation": {
|
|
149
|
+
"types": "./dist/translations/assistant-gate.en-US.translation.d.ts",
|
|
150
|
+
"browser": "./dist/browser/translations/assistant-gate.en-US.translation.js",
|
|
151
|
+
"bun": "./dist/translations/assistant-gate.en-US.translation.js",
|
|
152
|
+
"node": "./dist/node/translations/assistant-gate.en-US.translation.js",
|
|
153
|
+
"default": "./dist/translations/assistant-gate.en-US.translation.js"
|
|
154
|
+
},
|
|
155
|
+
"./translations/assistant-gate.fr-FR.translation": {
|
|
156
|
+
"types": "./dist/translations/assistant-gate.fr-FR.translation.d.ts",
|
|
157
|
+
"browser": "./dist/browser/translations/assistant-gate.fr-FR.translation.js",
|
|
158
|
+
"bun": "./dist/translations/assistant-gate.fr-FR.translation.js",
|
|
159
|
+
"node": "./dist/node/translations/assistant-gate.fr-FR.translation.js",
|
|
160
|
+
"default": "./dist/translations/assistant-gate.fr-FR.translation.js"
|
|
112
161
|
}
|
|
113
162
|
},
|
|
114
163
|
"scripts": {
|
|
@@ -120,20 +169,20 @@
|
|
|
120
169
|
"dev": "contractspec-bun-build dev",
|
|
121
170
|
"clean": "rimraf dist .turbo",
|
|
122
171
|
"lint": "bun lint:fix",
|
|
123
|
-
"lint:fix": "
|
|
124
|
-
"lint:check": "
|
|
172
|
+
"lint:fix": "biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .",
|
|
173
|
+
"lint:check": "biome check .",
|
|
125
174
|
"test": "bun test",
|
|
126
175
|
"prebuild": "contractspec-bun-build prebuild",
|
|
127
176
|
"typecheck": "tsc --noEmit"
|
|
128
177
|
},
|
|
129
178
|
"dependencies": {
|
|
130
|
-
"@contractspec/lib.contracts-spec": "
|
|
131
|
-
"@contractspec/lib.schema": "3.7.
|
|
179
|
+
"@contractspec/lib.contracts-spec": "4.1.2",
|
|
180
|
+
"@contractspec/lib.schema": "3.7.8"
|
|
132
181
|
},
|
|
133
182
|
"devDependencies": {
|
|
134
|
-
"@contractspec/tool.typescript": "3.7.
|
|
183
|
+
"@contractspec/tool.typescript": "3.7.8",
|
|
135
184
|
"typescript": "^5.9.3",
|
|
136
|
-
"@contractspec/tool.bun": "3.7.
|
|
185
|
+
"@contractspec/tool.bun": "3.7.8"
|
|
137
186
|
},
|
|
138
187
|
"publishConfig": {
|
|
139
188
|
"access": "public",
|
|
@@ -187,6 +236,20 @@
|
|
|
187
236
|
"node": "./dist/node/example.js",
|
|
188
237
|
"default": "./dist/example.js"
|
|
189
238
|
},
|
|
239
|
+
"./forms": {
|
|
240
|
+
"types": "./dist/forms/index.d.ts",
|
|
241
|
+
"browser": "./dist/browser/forms/index.js",
|
|
242
|
+
"bun": "./dist/forms/index.js",
|
|
243
|
+
"node": "./dist/node/forms/index.js",
|
|
244
|
+
"default": "./dist/forms/index.js"
|
|
245
|
+
},
|
|
246
|
+
"./forms/assistant-context.form": {
|
|
247
|
+
"types": "./dist/forms/assistant-context.form.d.ts",
|
|
248
|
+
"browser": "./dist/browser/forms/assistant-context.form.js",
|
|
249
|
+
"bun": "./dist/forms/assistant-context.form.js",
|
|
250
|
+
"node": "./dist/node/forms/assistant-context.form.js",
|
|
251
|
+
"default": "./dist/forms/assistant-context.form.js"
|
|
252
|
+
},
|
|
190
253
|
"./handlers": {
|
|
191
254
|
"types": "./dist/handlers/index.d.ts",
|
|
192
255
|
"browser": "./dist/browser/handlers/index.js",
|
|
@@ -229,6 +292,13 @@
|
|
|
229
292
|
"node": "./dist/node/policy/index.js",
|
|
230
293
|
"default": "./dist/policy/index.js"
|
|
231
294
|
},
|
|
295
|
+
"./policy/assistant-gate.policy": {
|
|
296
|
+
"types": "./dist/policy/assistant-gate.policy.d.ts",
|
|
297
|
+
"browser": "./dist/browser/policy/assistant-gate.policy.js",
|
|
298
|
+
"bun": "./dist/policy/assistant-gate.policy.js",
|
|
299
|
+
"node": "./dist/node/policy/assistant-gate.policy.js",
|
|
300
|
+
"default": "./dist/policy/assistant-gate.policy.js"
|
|
301
|
+
},
|
|
232
302
|
"./policy/guard": {
|
|
233
303
|
"types": "./dist/policy/guard.d.ts",
|
|
234
304
|
"browser": "./dist/browser/policy/guard.js",
|
|
@@ -242,6 +312,34 @@
|
|
|
242
312
|
"bun": "./dist/policy/types.js",
|
|
243
313
|
"node": "./dist/node/policy/types.js",
|
|
244
314
|
"default": "./dist/policy/types.js"
|
|
315
|
+
},
|
|
316
|
+
"./translations": {
|
|
317
|
+
"types": "./dist/translations/index.d.ts",
|
|
318
|
+
"browser": "./dist/browser/translations/index.js",
|
|
319
|
+
"bun": "./dist/translations/index.js",
|
|
320
|
+
"node": "./dist/node/translations/index.js",
|
|
321
|
+
"default": "./dist/translations/index.js"
|
|
322
|
+
},
|
|
323
|
+
"./translations/assistant-gate.en-GB.translation": {
|
|
324
|
+
"types": "./dist/translations/assistant-gate.en-GB.translation.d.ts",
|
|
325
|
+
"browser": "./dist/browser/translations/assistant-gate.en-GB.translation.js",
|
|
326
|
+
"bun": "./dist/translations/assistant-gate.en-GB.translation.js",
|
|
327
|
+
"node": "./dist/node/translations/assistant-gate.en-GB.translation.js",
|
|
328
|
+
"default": "./dist/translations/assistant-gate.en-GB.translation.js"
|
|
329
|
+
},
|
|
330
|
+
"./translations/assistant-gate.en-US.translation": {
|
|
331
|
+
"types": "./dist/translations/assistant-gate.en-US.translation.d.ts",
|
|
332
|
+
"browser": "./dist/browser/translations/assistant-gate.en-US.translation.js",
|
|
333
|
+
"bun": "./dist/translations/assistant-gate.en-US.translation.js",
|
|
334
|
+
"node": "./dist/node/translations/assistant-gate.en-US.translation.js",
|
|
335
|
+
"default": "./dist/translations/assistant-gate.en-US.translation.js"
|
|
336
|
+
},
|
|
337
|
+
"./translations/assistant-gate.fr-FR.translation": {
|
|
338
|
+
"types": "./dist/translations/assistant-gate.fr-FR.translation.d.ts",
|
|
339
|
+
"browser": "./dist/browser/translations/assistant-gate.fr-FR.translation.js",
|
|
340
|
+
"bun": "./dist/translations/assistant-gate.fr-FR.translation.js",
|
|
341
|
+
"node": "./dist/node/translations/assistant-gate.fr-FR.translation.js",
|
|
342
|
+
"default": "./dist/translations/assistant-gate.fr-FR.translation.js"
|
|
245
343
|
}
|
|
246
344
|
},
|
|
247
345
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test';
|
|
2
|
+
import {
|
|
3
|
+
AssistantContextForm,
|
|
4
|
+
AssistantGateMessagesEnGb,
|
|
5
|
+
AssistantGateMessagesEnUs,
|
|
6
|
+
AssistantGateMessagesFrFr,
|
|
7
|
+
AssistantGatePolicy,
|
|
8
|
+
LocaleJurisdictionGateFeature,
|
|
9
|
+
} from './index';
|
|
10
|
+
|
|
11
|
+
describe('@contractspec/example.locale-jurisdiction-gate', () => {
|
|
12
|
+
test('exports the canonical policy, form, and translations', () => {
|
|
13
|
+
expect(AssistantGatePolicy.meta.key).toBe(
|
|
14
|
+
'locale-jurisdiction-gate.policy.gate'
|
|
15
|
+
);
|
|
16
|
+
expect(AssistantContextForm.meta.key).toBe(
|
|
17
|
+
'locale-jurisdiction-gate.form.assistant-context'
|
|
18
|
+
);
|
|
19
|
+
expect(AssistantContextForm.actions?.[0]?.op?.name).toBe(
|
|
20
|
+
'assistant.answer'
|
|
21
|
+
);
|
|
22
|
+
expect(AssistantGateMessagesEnUs.locale).toBe('en-US');
|
|
23
|
+
expect(AssistantGateMessagesEnGb.fallback).toBe('en-US');
|
|
24
|
+
expect(AssistantGateMessagesFrFr.locale).toBe('fr-FR');
|
|
25
|
+
expect(LocaleJurisdictionGateFeature.policies).toEqual([
|
|
26
|
+
{
|
|
27
|
+
key: AssistantGatePolicy.meta.key,
|
|
28
|
+
version: AssistantGatePolicy.meta.version,
|
|
29
|
+
},
|
|
30
|
+
]);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -2,16 +2,16 @@ import type { DocBlock } from '@contractspec/lib.contracts-spec/docs';
|
|
|
2
2
|
import { registerDocBlocks } from '@contractspec/lib.contracts-spec/docs';
|
|
3
3
|
|
|
4
4
|
const docBlocks: DocBlock[] = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
{
|
|
6
|
+
id: 'docs.examples.locale-jurisdiction-gate.goal',
|
|
7
|
+
title: 'Locale/Jurisdiction Gate — Goal',
|
|
8
|
+
summary:
|
|
9
|
+
'Fail-closed gate that forces locale + jurisdiction + kbSnapshotId + allowedScope for assistant calls.',
|
|
10
|
+
kind: 'goal',
|
|
11
|
+
visibility: 'public',
|
|
12
|
+
route: '/docs/examples/locale-jurisdiction-gate/goal',
|
|
13
|
+
tags: ['assistant', 'policy', 'locale', 'jurisdiction', 'knowledge'],
|
|
14
|
+
body: `## Why it matters
|
|
15
15
|
- Forces all assistant behavior to be bound to explicit inputs (no guessing).
|
|
16
16
|
- Requires KB snapshot citations to make answers traceable and regenerable.
|
|
17
17
|
|
|
@@ -19,16 +19,16 @@ const docBlocks: DocBlock[] = [
|
|
|
19
19
|
- Missing locale/jurisdiction/snapshot/scope => refuse (structured).
|
|
20
20
|
- Missing citations => refuse.
|
|
21
21
|
- Scope violations under education_only => refuse/escalate.`,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: 'docs.examples.locale-jurisdiction-gate.reference',
|
|
25
|
+
title: 'Locale/Jurisdiction Gate — Reference',
|
|
26
|
+
summary: 'Contracts, models, and events exposed by the gate example.',
|
|
27
|
+
kind: 'reference',
|
|
28
|
+
visibility: 'public',
|
|
29
|
+
route: '/docs/examples/locale-jurisdiction-gate',
|
|
30
|
+
tags: ['assistant', 'policy', 'reference'],
|
|
31
|
+
body: `## Contracts
|
|
32
32
|
- assistant.answer (v1)
|
|
33
33
|
- assistant.explainConcept (v1)
|
|
34
34
|
|
|
@@ -40,7 +40,7 @@ const docBlocks: DocBlock[] = [
|
|
|
40
40
|
- assistant.answer.requested
|
|
41
41
|
- assistant.answer.blocked
|
|
42
42
|
- assistant.answer.delivered`,
|
|
43
|
-
|
|
43
|
+
},
|
|
44
44
|
];
|
|
45
45
|
|
|
46
46
|
registerDocBlocks(docBlocks);
|