@contractspec/example.locale-jurisdiction-gate 0.0.0-canary-20260113162409

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 (73) hide show
  1. package/.turbo/turbo-build$colon$bundle.log +56 -0
  2. package/.turbo/turbo-build.log +57 -0
  3. package/CHANGELOG.md +302 -0
  4. package/LICENSE +21 -0
  5. package/README.md +42 -0
  6. package/dist/docs/index.d.ts +1 -0
  7. package/dist/docs/index.js +1 -0
  8. package/dist/docs/locale-jurisdiction-gate.docblock.d.ts +1 -0
  9. package/dist/docs/locale-jurisdiction-gate.docblock.js +53 -0
  10. package/dist/docs/locale-jurisdiction-gate.docblock.js.map +1 -0
  11. package/dist/entities/index.d.ts +2 -0
  12. package/dist/entities/index.js +3 -0
  13. package/dist/entities/models.d.ts +186 -0
  14. package/dist/entities/models.d.ts.map +1 -0
  15. package/dist/entities/models.js +168 -0
  16. package/dist/entities/models.js.map +1 -0
  17. package/dist/events.d.ts +69 -0
  18. package/dist/events.d.ts.map +1 -0
  19. package/dist/events.js +123 -0
  20. package/dist/events.js.map +1 -0
  21. package/dist/example.d.ts +7 -0
  22. package/dist/example.d.ts.map +1 -0
  23. package/dist/example.js +47 -0
  24. package/dist/example.js.map +1 -0
  25. package/dist/handlers/demo.handlers.d.ts +59 -0
  26. package/dist/handlers/demo.handlers.d.ts.map +1 -0
  27. package/dist/handlers/demo.handlers.js +86 -0
  28. package/dist/handlers/demo.handlers.js.map +1 -0
  29. package/dist/handlers/index.d.ts +2 -0
  30. package/dist/handlers/index.js +3 -0
  31. package/dist/index.d.ts +11 -0
  32. package/dist/index.js +12 -0
  33. package/dist/locale-jurisdiction-gate.feature.d.ts +7 -0
  34. package/dist/locale-jurisdiction-gate.feature.d.ts.map +1 -0
  35. package/dist/locale-jurisdiction-gate.feature.js +53 -0
  36. package/dist/locale-jurisdiction-gate.feature.js.map +1 -0
  37. package/dist/operations/assistant.d.ts +245 -0
  38. package/dist/operations/assistant.d.ts.map +1 -0
  39. package/dist/operations/assistant.js +115 -0
  40. package/dist/operations/assistant.js.map +1 -0
  41. package/dist/operations/index.d.ts +2 -0
  42. package/dist/operations/index.js +3 -0
  43. package/dist/policy/guard.d.ts +27 -0
  44. package/dist/policy/guard.d.ts.map +1 -0
  45. package/dist/policy/guard.js +73 -0
  46. package/dist/policy/guard.js.map +1 -0
  47. package/dist/policy/index.d.ts +3 -0
  48. package/dist/policy/index.js +3 -0
  49. package/dist/policy/types.d.ts +16 -0
  50. package/dist/policy/types.d.ts.map +1 -0
  51. package/dist/policy/types.js +0 -0
  52. package/example.ts +1 -0
  53. package/package.json +77 -0
  54. package/src/docs/index.ts +1 -0
  55. package/src/docs/locale-jurisdiction-gate.docblock.ts +46 -0
  56. package/src/entities/index.ts +1 -0
  57. package/src/entities/models.ts +110 -0
  58. package/src/events.ts +74 -0
  59. package/src/example.ts +34 -0
  60. package/src/handlers/demo.handlers.test.ts +54 -0
  61. package/src/handlers/demo.handlers.ts +160 -0
  62. package/src/handlers/index.ts +1 -0
  63. package/src/index.ts +15 -0
  64. package/src/locale-jurisdiction-gate.feature.ts +30 -0
  65. package/src/operations/assistant.ts +98 -0
  66. package/src/operations/index.ts +1 -0
  67. package/src/policy/guard.test.ts +25 -0
  68. package/src/policy/guard.ts +102 -0
  69. package/src/policy/index.ts +2 -0
  70. package/src/policy/types.ts +18 -0
  71. package/tsconfig.json +17 -0
  72. package/tsconfig.tsbuildinfo +1 -0
  73. package/tsdown.config.js +17 -0
@@ -0,0 +1,186 @@
1
+ import * as _contractspec_lib_schema16 from "@contractspec/lib.schema";
2
+
3
+ //#region src/entities/models.d.ts
4
+ declare const AllowedScopeEnum: _contractspec_lib_schema16.EnumType<[string, string, string]>;
5
+ declare const UserProfileModel: _contractspec_lib_schema16.SchemaModel<{
6
+ preferredLocale: {
7
+ type: _contractspec_lib_schema16.FieldType<string, string>;
8
+ isOptional: true;
9
+ };
10
+ residencyCountry: {
11
+ type: _contractspec_lib_schema16.FieldType<string, string>;
12
+ isOptional: true;
13
+ };
14
+ taxResidenceCountry: {
15
+ type: _contractspec_lib_schema16.FieldType<string, string>;
16
+ isOptional: true;
17
+ };
18
+ clientType: {
19
+ type: _contractspec_lib_schema16.FieldType<string, string>;
20
+ isOptional: true;
21
+ };
22
+ }>;
23
+ declare const RegulatoryContextModel: _contractspec_lib_schema16.SchemaModel<{
24
+ jurisdiction: {
25
+ type: _contractspec_lib_schema16.FieldType<string, string>;
26
+ isOptional: false;
27
+ };
28
+ region: {
29
+ type: _contractspec_lib_schema16.FieldType<string, string>;
30
+ isOptional: true;
31
+ };
32
+ clientType: {
33
+ type: _contractspec_lib_schema16.FieldType<string, string>;
34
+ isOptional: true;
35
+ };
36
+ allowedScope: {
37
+ type: _contractspec_lib_schema16.EnumType<[string, string, string]>;
38
+ isOptional: false;
39
+ };
40
+ }>;
41
+ declare const LLMCallEnvelopeModel: _contractspec_lib_schema16.SchemaModel<{
42
+ traceId: {
43
+ type: _contractspec_lib_schema16.FieldType<string, string>;
44
+ isOptional: false;
45
+ };
46
+ locale: {
47
+ type: _contractspec_lib_schema16.FieldType<string, string>;
48
+ isOptional: false;
49
+ };
50
+ regulatoryContext: {
51
+ type: _contractspec_lib_schema16.SchemaModel<{
52
+ jurisdiction: {
53
+ type: _contractspec_lib_schema16.FieldType<string, string>;
54
+ isOptional: false;
55
+ };
56
+ region: {
57
+ type: _contractspec_lib_schema16.FieldType<string, string>;
58
+ isOptional: true;
59
+ };
60
+ clientType: {
61
+ type: _contractspec_lib_schema16.FieldType<string, string>;
62
+ isOptional: true;
63
+ };
64
+ allowedScope: {
65
+ type: _contractspec_lib_schema16.EnumType<[string, string, string]>;
66
+ isOptional: false;
67
+ };
68
+ }>;
69
+ isOptional: false;
70
+ };
71
+ kbSnapshotId: {
72
+ type: _contractspec_lib_schema16.FieldType<string, string>;
73
+ isOptional: false;
74
+ };
75
+ allowedScope: {
76
+ type: _contractspec_lib_schema16.EnumType<[string, string, string]>;
77
+ isOptional: false;
78
+ };
79
+ }>;
80
+ declare const AssistantCitationModel: _contractspec_lib_schema16.SchemaModel<{
81
+ kbSnapshotId: {
82
+ type: _contractspec_lib_schema16.FieldType<string, string>;
83
+ isOptional: false;
84
+ };
85
+ sourceType: {
86
+ type: _contractspec_lib_schema16.FieldType<string, string>;
87
+ isOptional: false;
88
+ };
89
+ sourceId: {
90
+ type: _contractspec_lib_schema16.FieldType<string, string>;
91
+ isOptional: false;
92
+ };
93
+ title: {
94
+ type: _contractspec_lib_schema16.FieldType<string, string>;
95
+ isOptional: true;
96
+ };
97
+ excerpt: {
98
+ type: _contractspec_lib_schema16.FieldType<string, string>;
99
+ isOptional: true;
100
+ };
101
+ }>;
102
+ declare const AssistantAnswerSectionModel: _contractspec_lib_schema16.SchemaModel<{
103
+ heading: {
104
+ type: _contractspec_lib_schema16.FieldType<string, string>;
105
+ isOptional: false;
106
+ };
107
+ body: {
108
+ type: _contractspec_lib_schema16.FieldType<string, string>;
109
+ isOptional: false;
110
+ };
111
+ }>;
112
+ declare const AssistantAnswerIRModel: _contractspec_lib_schema16.SchemaModel<{
113
+ locale: {
114
+ type: _contractspec_lib_schema16.FieldType<string, string>;
115
+ isOptional: false;
116
+ };
117
+ jurisdiction: {
118
+ type: _contractspec_lib_schema16.FieldType<string, string>;
119
+ isOptional: false;
120
+ };
121
+ allowedScope: {
122
+ type: _contractspec_lib_schema16.EnumType<[string, string, string]>;
123
+ isOptional: false;
124
+ };
125
+ sections: {
126
+ type: _contractspec_lib_schema16.SchemaModel<{
127
+ heading: {
128
+ type: _contractspec_lib_schema16.FieldType<string, string>;
129
+ isOptional: false;
130
+ };
131
+ body: {
132
+ type: _contractspec_lib_schema16.FieldType<string, string>;
133
+ isOptional: false;
134
+ };
135
+ }>;
136
+ isArray: true;
137
+ isOptional: false;
138
+ };
139
+ citations: {
140
+ type: _contractspec_lib_schema16.SchemaModel<{
141
+ kbSnapshotId: {
142
+ type: _contractspec_lib_schema16.FieldType<string, string>;
143
+ isOptional: false;
144
+ };
145
+ sourceType: {
146
+ type: _contractspec_lib_schema16.FieldType<string, string>;
147
+ isOptional: false;
148
+ };
149
+ sourceId: {
150
+ type: _contractspec_lib_schema16.FieldType<string, string>;
151
+ isOptional: false;
152
+ };
153
+ title: {
154
+ type: _contractspec_lib_schema16.FieldType<string, string>;
155
+ isOptional: true;
156
+ };
157
+ excerpt: {
158
+ type: _contractspec_lib_schema16.FieldType<string, string>;
159
+ isOptional: true;
160
+ };
161
+ }>;
162
+ isArray: true;
163
+ isOptional: false;
164
+ };
165
+ disclaimers: {
166
+ type: _contractspec_lib_schema16.FieldType<string, string>;
167
+ isArray: true;
168
+ isOptional: true;
169
+ };
170
+ riskFlags: {
171
+ type: _contractspec_lib_schema16.FieldType<string, string>;
172
+ isArray: true;
173
+ isOptional: true;
174
+ };
175
+ refused: {
176
+ type: _contractspec_lib_schema16.FieldType<boolean, boolean>;
177
+ isOptional: true;
178
+ };
179
+ refusalReason: {
180
+ type: _contractspec_lib_schema16.FieldType<string, string>;
181
+ isOptional: true;
182
+ };
183
+ }>;
184
+ //#endregion
185
+ export { AllowedScopeEnum, AssistantAnswerIRModel, AssistantAnswerSectionModel, AssistantCitationModel, LLMCallEnvelopeModel, RegulatoryContextModel, UserProfileModel };
186
+ //# sourceMappingURL=models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.d.ts","names":[],"sources":["../../src/entities/models.ts"],"sourcesContent":[],"mappings":";;;cAMa,kBAIX,0BAAA,CAJ2B;cAMhB,6CAAgB;;IANhB,IAAA,EAwBX,0BAAA,CAAA,SApBA,CAAA,MAJ2B,EAAA,MAAA,CAAA;IAMhB,UAAA,EAAA,IAkBX;EAAA,CAAA;;;;;EAlB2B,mBAAA,EAAA;IAoBhB,IAAA,sCASX,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,IAAA;;;;;EATiC,CAAA;AAWnC,CAAA,CAAA;AAWE,cAtBW,sBAsBX,6BAtBiC,WAsBjC,CAAA;;UAbA,0BAAA,CAAA;;;;;;;;IAE+B,IAAA,sCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;IAapB,UAAA,EAAA,IAAA;EAWX,CAAA;;;;;;AAXiC,cAbtB,oBAasB,6BAbF,WAaE,CAAA;EAatB,OAAA,EAAA;IAOX,IAAA,EAtBA,0BAAA,CAAA,SAsBA,CAAA,MAAA,EAAA,MAAA,CAAA;;;EAPsC,MAAA,EAAA;IAS3B,IAAA,sCA+BX,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;;;;;;;;;;;;;;;;;QA/BiC,IAAA,qCAAA,CAAA,CAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,CAAA;;;;;;;;;;;;;;;cAtBtB,mDAAsB;;UAWjC,0BAAA,CAAA;;;;;;;;;;;;;;;;;;;;cAEW,wDAA2B;;UAOtC,0BAAA,CAAA;;;;;;;;cAEW,mDAAsB;;UA+BjC,0BAAA,CAAA"}
@@ -0,0 +1,168 @@
1
+ import { ScalarTypeEnum, defineEnum, defineSchemaModel } from "@contractspec/lib.schema";
2
+
3
+ //#region src/entities/models.ts
4
+ const AllowedScopeEnum = defineEnum("AllowedScope", [
5
+ "education_only",
6
+ "generic_info",
7
+ "escalation_required"
8
+ ]);
9
+ const UserProfileModel = defineSchemaModel({
10
+ name: "UserProfile",
11
+ description: "User profile inputs used to derive regulatory context.",
12
+ fields: {
13
+ preferredLocale: {
14
+ type: ScalarTypeEnum.String_unsecure(),
15
+ isOptional: true
16
+ },
17
+ residencyCountry: {
18
+ type: ScalarTypeEnum.String_unsecure(),
19
+ isOptional: true
20
+ },
21
+ taxResidenceCountry: {
22
+ type: ScalarTypeEnum.String_unsecure(),
23
+ isOptional: true
24
+ },
25
+ clientType: {
26
+ type: ScalarTypeEnum.String_unsecure(),
27
+ isOptional: true
28
+ }
29
+ }
30
+ });
31
+ const RegulatoryContextModel = defineSchemaModel({
32
+ name: "RegulatoryContext",
33
+ description: "Explicit regulatory context (no guessing).",
34
+ fields: {
35
+ jurisdiction: {
36
+ type: ScalarTypeEnum.String_unsecure(),
37
+ isOptional: false
38
+ },
39
+ region: {
40
+ type: ScalarTypeEnum.String_unsecure(),
41
+ isOptional: true
42
+ },
43
+ clientType: {
44
+ type: ScalarTypeEnum.String_unsecure(),
45
+ isOptional: true
46
+ },
47
+ allowedScope: {
48
+ type: AllowedScopeEnum,
49
+ isOptional: false
50
+ }
51
+ }
52
+ });
53
+ const LLMCallEnvelopeModel = defineSchemaModel({
54
+ name: "LLMCallEnvelope",
55
+ description: "Mandatory envelope for assistant calls. All fields are explicit and required for policy gating.",
56
+ fields: {
57
+ traceId: {
58
+ type: ScalarTypeEnum.String_unsecure(),
59
+ isOptional: false
60
+ },
61
+ locale: {
62
+ type: ScalarTypeEnum.String_unsecure(),
63
+ isOptional: false
64
+ },
65
+ regulatoryContext: {
66
+ type: RegulatoryContextModel,
67
+ isOptional: false
68
+ },
69
+ kbSnapshotId: {
70
+ type: ScalarTypeEnum.String_unsecure(),
71
+ isOptional: false
72
+ },
73
+ allowedScope: {
74
+ type: AllowedScopeEnum,
75
+ isOptional: false
76
+ }
77
+ }
78
+ });
79
+ const AssistantCitationModel = defineSchemaModel({
80
+ name: "AssistantCitation",
81
+ description: "Citation referencing a KB snapshot + a specific item within it.",
82
+ fields: {
83
+ kbSnapshotId: {
84
+ type: ScalarTypeEnum.String_unsecure(),
85
+ isOptional: false
86
+ },
87
+ sourceType: {
88
+ type: ScalarTypeEnum.String_unsecure(),
89
+ isOptional: false
90
+ },
91
+ sourceId: {
92
+ type: ScalarTypeEnum.String_unsecure(),
93
+ isOptional: false
94
+ },
95
+ title: {
96
+ type: ScalarTypeEnum.String_unsecure(),
97
+ isOptional: true
98
+ },
99
+ excerpt: {
100
+ type: ScalarTypeEnum.String_unsecure(),
101
+ isOptional: true
102
+ }
103
+ }
104
+ });
105
+ const AssistantAnswerSectionModel = defineSchemaModel({
106
+ name: "AssistantAnswerSection",
107
+ description: "Structured answer section.",
108
+ fields: {
109
+ heading: {
110
+ type: ScalarTypeEnum.String_unsecure(),
111
+ isOptional: false
112
+ },
113
+ body: {
114
+ type: ScalarTypeEnum.String_unsecure(),
115
+ isOptional: false
116
+ }
117
+ }
118
+ });
119
+ const AssistantAnswerIRModel = defineSchemaModel({
120
+ name: "AssistantAnswerIR",
121
+ description: "Structured assistant answer with mandatory citations and explicit locale/jurisdiction.",
122
+ fields: {
123
+ locale: {
124
+ type: ScalarTypeEnum.String_unsecure(),
125
+ isOptional: false
126
+ },
127
+ jurisdiction: {
128
+ type: ScalarTypeEnum.String_unsecure(),
129
+ isOptional: false
130
+ },
131
+ allowedScope: {
132
+ type: AllowedScopeEnum,
133
+ isOptional: false
134
+ },
135
+ sections: {
136
+ type: AssistantAnswerSectionModel,
137
+ isArray: true,
138
+ isOptional: false
139
+ },
140
+ citations: {
141
+ type: AssistantCitationModel,
142
+ isArray: true,
143
+ isOptional: false
144
+ },
145
+ disclaimers: {
146
+ type: ScalarTypeEnum.String_unsecure(),
147
+ isArray: true,
148
+ isOptional: true
149
+ },
150
+ riskFlags: {
151
+ type: ScalarTypeEnum.String_unsecure(),
152
+ isArray: true,
153
+ isOptional: true
154
+ },
155
+ refused: {
156
+ type: ScalarTypeEnum.Boolean(),
157
+ isOptional: true
158
+ },
159
+ refusalReason: {
160
+ type: ScalarTypeEnum.String_unsecure(),
161
+ isOptional: true
162
+ }
163
+ }
164
+ });
165
+
166
+ //#endregion
167
+ export { AllowedScopeEnum, AssistantAnswerIRModel, AssistantAnswerSectionModel, AssistantCitationModel, LLMCallEnvelopeModel, RegulatoryContextModel, UserProfileModel };
168
+ //# sourceMappingURL=models.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.js","names":[],"sources":["../../src/entities/models.ts"],"sourcesContent":["import {\n ScalarTypeEnum,\n defineEnum,\n defineSchemaModel,\n} from '@contractspec/lib.schema';\n\nexport const AllowedScopeEnum = defineEnum('AllowedScope', [\n 'education_only',\n 'generic_info',\n 'escalation_required',\n]);\n\nexport const UserProfileModel = defineSchemaModel({\n name: 'UserProfile',\n description: 'User profile inputs used to derive regulatory context.',\n fields: {\n preferredLocale: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n residencyCountry: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n taxResidenceCountry: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n clientType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\nexport const RegulatoryContextModel = defineSchemaModel({\n name: 'RegulatoryContext',\n description: 'Explicit regulatory context (no guessing).',\n fields: {\n jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n region: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n clientType: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n allowedScope: { type: AllowedScopeEnum, isOptional: false },\n },\n});\n\nexport const LLMCallEnvelopeModel = defineSchemaModel({\n name: 'LLMCallEnvelope',\n description:\n 'Mandatory envelope for assistant calls. All fields are explicit and required for policy gating.',\n fields: {\n traceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n locale: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n regulatoryContext: { type: RegulatoryContextModel, isOptional: false },\n kbSnapshotId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n allowedScope: { type: AllowedScopeEnum, isOptional: false },\n },\n});\n\nexport const AssistantCitationModel = defineSchemaModel({\n name: 'AssistantCitation',\n description:\n 'Citation referencing a KB snapshot + a specific item within it.',\n fields: {\n kbSnapshotId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n sourceType: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n sourceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n title: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n excerpt: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\nexport const AssistantAnswerSectionModel = defineSchemaModel({\n name: 'AssistantAnswerSection',\n description: 'Structured answer section.',\n fields: {\n heading: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n body: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nexport const AssistantAnswerIRModel = defineSchemaModel({\n name: 'AssistantAnswerIR',\n description:\n 'Structured assistant answer with mandatory citations and explicit locale/jurisdiction.',\n fields: {\n locale: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n allowedScope: { type: AllowedScopeEnum, isOptional: false },\n sections: {\n type: AssistantAnswerSectionModel,\n isArray: true,\n isOptional: false,\n },\n citations: {\n type: AssistantCitationModel,\n isArray: true,\n isOptional: false,\n },\n disclaimers: {\n type: ScalarTypeEnum.String_unsecure(),\n isArray: true,\n isOptional: true,\n },\n riskFlags: {\n type: ScalarTypeEnum.String_unsecure(),\n isArray: true,\n isOptional: true,\n },\n refused: { type: ScalarTypeEnum.Boolean(), isOptional: true },\n refusalReason: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n"],"mappings":";;;AAMA,MAAa,mBAAmB,WAAW,gBAAgB;CACzD;CACA;CACA;CACD,CAAC;AAEF,MAAa,mBAAmB,kBAAkB;CAChD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,iBAAiB;GACf,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,kBAAkB;GAChB,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,qBAAqB;GACnB,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,YAAY;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACzE;CACF,CAAC;AAEF,MAAa,yBAAyB,kBAAkB;CACtD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACpE,YAAY;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACxE,cAAc;GAAE,MAAM;GAAkB,YAAY;GAAO;EAC5D;CACF,CAAC;AAEF,MAAa,uBAAuB,kBAAkB;CACpD,MAAM;CACN,aACE;CACF,QAAQ;EACN,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,mBAAmB;GAAE,MAAM;GAAwB,YAAY;GAAO;EACtE,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,cAAc;GAAE,MAAM;GAAkB,YAAY;GAAO;EAC5D;CACF,CAAC;AAEF,MAAa,yBAAyB,kBAAkB;CACtD,MAAM;CACN,aACE;CACF,QAAQ;EACN,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,YAAY;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACzE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,OAAO;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACnE,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACtE;CACF,CAAC;AAEF,MAAa,8BAA8B,kBAAkB;CAC3D,MAAM;CACN,aAAa;CACb,QAAQ;EACN,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACpE;CACF,CAAC;AAEF,MAAa,yBAAyB,kBAAkB;CACtD,MAAM;CACN,aACE;CACF,QAAQ;EACN,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,cAAc;GAAE,MAAM;GAAkB,YAAY;GAAO;EAC3D,UAAU;GACR,MAAM;GACN,SAAS;GACT,YAAY;GACb;EACD,WAAW;GACT,MAAM;GACN,SAAS;GACT,YAAY;GACb;EACD,aAAa;GACX,MAAM,eAAe,iBAAiB;GACtC,SAAS;GACT,YAAY;GACb;EACD,WAAW;GACT,MAAM,eAAe,iBAAiB;GACtC,SAAS;GACT,YAAY;GACb;EACD,SAAS;GAAE,MAAM,eAAe,SAAS;GAAE,YAAY;GAAM;EAC7D,eAAe;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EAC5E;CACF,CAAC"}
@@ -0,0 +1,69 @@
1
+ import * as _contractspec_lib_contracts0 from "@contractspec/lib.contracts";
2
+ import * as _contractspec_lib_schema0 from "@contractspec/lib.schema";
3
+
4
+ //#region src/events.d.ts
5
+ declare const AssistantAnswerRequestedEvent: _contractspec_lib_contracts0.EventSpec<_contractspec_lib_schema0.SchemaModel<{
6
+ traceId: {
7
+ type: _contractspec_lib_schema0.FieldType<string, string>;
8
+ isOptional: false;
9
+ };
10
+ locale: {
11
+ type: _contractspec_lib_schema0.FieldType<string, string>;
12
+ isOptional: false;
13
+ };
14
+ jurisdiction: {
15
+ type: _contractspec_lib_schema0.FieldType<string, string>;
16
+ isOptional: false;
17
+ };
18
+ kbSnapshotId: {
19
+ type: _contractspec_lib_schema0.FieldType<string, string>;
20
+ isOptional: false;
21
+ };
22
+ allowedScope: {
23
+ type: _contractspec_lib_schema0.FieldType<string, string>;
24
+ isOptional: false;
25
+ };
26
+ }>>;
27
+ declare const AssistantAnswerBlockedEvent: _contractspec_lib_contracts0.EventSpec<_contractspec_lib_schema0.SchemaModel<{
28
+ traceId: {
29
+ type: _contractspec_lib_schema0.FieldType<string, string>;
30
+ isOptional: false;
31
+ };
32
+ reasonCode: {
33
+ type: _contractspec_lib_schema0.FieldType<string, string>;
34
+ isOptional: false;
35
+ };
36
+ reason: {
37
+ type: _contractspec_lib_schema0.FieldType<string, string>;
38
+ isOptional: false;
39
+ };
40
+ }>>;
41
+ declare const AssistantAnswerDeliveredEvent: _contractspec_lib_contracts0.EventSpec<_contractspec_lib_schema0.SchemaModel<{
42
+ traceId: {
43
+ type: _contractspec_lib_schema0.FieldType<string, string>;
44
+ isOptional: false;
45
+ };
46
+ locale: {
47
+ type: _contractspec_lib_schema0.FieldType<string, string>;
48
+ isOptional: false;
49
+ };
50
+ jurisdiction: {
51
+ type: _contractspec_lib_schema0.FieldType<string, string>;
52
+ isOptional: false;
53
+ };
54
+ kbSnapshotId: {
55
+ type: _contractspec_lib_schema0.FieldType<string, string>;
56
+ isOptional: false;
57
+ };
58
+ allowedScope: {
59
+ type: _contractspec_lib_schema0.FieldType<string, string>;
60
+ isOptional: false;
61
+ };
62
+ citationsCount: {
63
+ type: _contractspec_lib_schema0.FieldType<number, number>;
64
+ isOptional: false;
65
+ };
66
+ }>>;
67
+ //#endregion
68
+ export { AssistantAnswerBlockedEvent, AssistantAnswerDeliveredEvent, AssistantAnswerRequestedEvent };
69
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","names":[],"sources":["../src/events.ts"],"sourcesContent":[],"mappings":";;;;cAea,+BAA6B,4BAAA,CAAA,oCAAA;;UAUxC,yBAAA,CAAA;;EAVW,CAAA;EAUX,MAAA,EAAA;;;;;6CAVwC,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;EAAA,CAAA;EAsB7B,YAAA,EAAA;IAUX,IAAA,qCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;;;;IAVsC,IAAA,qCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;EAyB3B,CAAA;CAWX,CAAA,CAAA;cApCW,6BAA2B,4BAAA,CAAA,oCAAA;;UAUtC,yBAAA,CAAA;;;;IAewC,IAAA,qCAAA,CAAA,MAAA,EAAA,MAAA,CAAA;IAAA,UAAA,EAAA,KAAA;;;;;;;cAA7B,+BAA6B,4BAAA,CAAA,oCAAA;;UAWxC,yBAAA,CAAA"}
package/dist/events.js ADDED
@@ -0,0 +1,123 @@
1
+ import { defineEvent, defineSchemaModel } from "@contractspec/lib.contracts";
2
+ import { ScalarTypeEnum } from "@contractspec/lib.schema";
3
+
4
+ //#region src/events.ts
5
+ const AssistantAnswerRequestedPayload = defineSchemaModel({
6
+ name: "AssistantAnswerRequestedPayload",
7
+ description: "Emitted when an assistant answer is requested (pre-gate).",
8
+ fields: {
9
+ traceId: {
10
+ type: ScalarTypeEnum.String_unsecure(),
11
+ isOptional: false
12
+ },
13
+ locale: {
14
+ type: ScalarTypeEnum.String_unsecure(),
15
+ isOptional: false
16
+ },
17
+ jurisdiction: {
18
+ type: ScalarTypeEnum.String_unsecure(),
19
+ isOptional: false
20
+ },
21
+ kbSnapshotId: {
22
+ type: ScalarTypeEnum.String_unsecure(),
23
+ isOptional: false
24
+ },
25
+ allowedScope: {
26
+ type: ScalarTypeEnum.String_unsecure(),
27
+ isOptional: false
28
+ }
29
+ }
30
+ });
31
+ const AssistantAnswerRequestedEvent = defineEvent({
32
+ meta: {
33
+ key: "assistant.answer.requested",
34
+ version: "1.0.0",
35
+ description: "Assistant answer requested (policy gate will run).",
36
+ stability: "experimental",
37
+ owners: ["@examples"],
38
+ tags: ["assistant", "policy"]
39
+ },
40
+ payload: AssistantAnswerRequestedPayload
41
+ });
42
+ const AssistantAnswerBlockedPayload = defineSchemaModel({
43
+ name: "AssistantAnswerBlockedPayload",
44
+ description: "Emitted when a request is blocked by the gate.",
45
+ fields: {
46
+ traceId: {
47
+ type: ScalarTypeEnum.String_unsecure(),
48
+ isOptional: false
49
+ },
50
+ reasonCode: {
51
+ type: ScalarTypeEnum.String_unsecure(),
52
+ isOptional: false
53
+ },
54
+ reason: {
55
+ type: ScalarTypeEnum.String_unsecure(),
56
+ isOptional: false
57
+ }
58
+ }
59
+ });
60
+ const AssistantAnswerBlockedEvent = defineEvent({
61
+ meta: {
62
+ key: "assistant.answer.blocked",
63
+ version: "1.0.0",
64
+ description: "Assistant answer blocked (fail-closed).",
65
+ stability: "experimental",
66
+ owners: ["@examples"],
67
+ tags: [
68
+ "assistant",
69
+ "policy",
70
+ "blocked"
71
+ ]
72
+ },
73
+ payload: AssistantAnswerBlockedPayload
74
+ });
75
+ const AssistantAnswerDeliveredPayload = defineSchemaModel({
76
+ name: "AssistantAnswerDeliveredPayload",
77
+ description: "Emitted when a structured, cited answer is delivered.",
78
+ fields: {
79
+ traceId: {
80
+ type: ScalarTypeEnum.String_unsecure(),
81
+ isOptional: false
82
+ },
83
+ locale: {
84
+ type: ScalarTypeEnum.String_unsecure(),
85
+ isOptional: false
86
+ },
87
+ jurisdiction: {
88
+ type: ScalarTypeEnum.String_unsecure(),
89
+ isOptional: false
90
+ },
91
+ kbSnapshotId: {
92
+ type: ScalarTypeEnum.String_unsecure(),
93
+ isOptional: false
94
+ },
95
+ allowedScope: {
96
+ type: ScalarTypeEnum.String_unsecure(),
97
+ isOptional: false
98
+ },
99
+ citationsCount: {
100
+ type: ScalarTypeEnum.Int_unsecure(),
101
+ isOptional: false
102
+ }
103
+ }
104
+ });
105
+ const AssistantAnswerDeliveredEvent = defineEvent({
106
+ meta: {
107
+ key: "assistant.answer.delivered",
108
+ version: "1.0.0",
109
+ description: "Assistant answer delivered (must include KB snapshot citations).",
110
+ stability: "experimental",
111
+ owners: ["@examples"],
112
+ tags: [
113
+ "assistant",
114
+ "policy",
115
+ "delivered"
116
+ ]
117
+ },
118
+ payload: AssistantAnswerDeliveredPayload
119
+ });
120
+
121
+ //#endregion
122
+ export { AssistantAnswerBlockedEvent, AssistantAnswerDeliveredEvent, AssistantAnswerRequestedEvent };
123
+ //# sourceMappingURL=events.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.js","names":[],"sources":["../src/events.ts"],"sourcesContent":["import { defineEvent, defineSchemaModel } from '@contractspec/lib.contracts';\nimport { ScalarTypeEnum } from '@contractspec/lib.schema';\n\nconst AssistantAnswerRequestedPayload = defineSchemaModel({\n name: 'AssistantAnswerRequestedPayload',\n description: 'Emitted when an assistant answer is requested (pre-gate).',\n fields: {\n traceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n locale: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n kbSnapshotId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n allowedScope: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nexport const AssistantAnswerRequestedEvent = defineEvent({\n meta: {\n key: 'assistant.answer.requested',\n version: '1.0.0',\n description: 'Assistant answer requested (policy gate will run).',\n stability: 'experimental',\n owners: ['@examples'],\n tags: ['assistant', 'policy'],\n },\n payload: AssistantAnswerRequestedPayload,\n});\n\nconst AssistantAnswerBlockedPayload = defineSchemaModel({\n name: 'AssistantAnswerBlockedPayload',\n description: 'Emitted when a request is blocked by the gate.',\n fields: {\n traceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n reasonCode: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nexport const AssistantAnswerBlockedEvent = defineEvent({\n meta: {\n key: 'assistant.answer.blocked',\n version: '1.0.0',\n description: 'Assistant answer blocked (fail-closed).',\n stability: 'experimental',\n owners: ['@examples'],\n tags: ['assistant', 'policy', 'blocked'],\n },\n payload: AssistantAnswerBlockedPayload,\n});\n\nconst AssistantAnswerDeliveredPayload = defineSchemaModel({\n name: 'AssistantAnswerDeliveredPayload',\n description: 'Emitted when a structured, cited answer is delivered.',\n fields: {\n traceId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n locale: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n kbSnapshotId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n allowedScope: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n citationsCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n },\n});\n\nexport const AssistantAnswerDeliveredEvent = defineEvent({\n meta: {\n key: 'assistant.answer.delivered',\n version: '1.0.0',\n description:\n 'Assistant answer delivered (must include KB snapshot citations).',\n stability: 'experimental',\n owners: ['@examples'],\n tags: ['assistant', 'policy', 'delivered'],\n },\n payload: AssistantAnswerDeliveredPayload,\n});\n"],"mappings":";;;;AAGA,MAAM,kCAAkC,kBAAkB;CACxD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC5E;CACF,CAAC;AAEF,MAAa,gCAAgC,YAAY;CACvD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,YAAY;EACrB,MAAM,CAAC,aAAa,SAAS;EAC9B;CACD,SAAS;CACV,CAAC;AAEF,MAAM,gCAAgC,kBAAkB;CACtD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,YAAY;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACzE,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE;CACF,CAAC;AAEF,MAAa,8BAA8B,YAAY;CACrD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,YAAY;EACrB,MAAM;GAAC;GAAa;GAAU;GAAU;EACzC;CACD,SAAS;CACV,CAAC;AAEF,MAAM,kCAAkC,kBAAkB;CACxD,MAAM;CACN,aAAa;CACb,QAAQ;EACN,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,gBAAgB;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EAC3E;CACF,CAAC;AAEF,MAAa,gCAAgC,YAAY;CACvD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aACE;EACF,WAAW;EACX,QAAQ,CAAC,YAAY;EACrB,MAAM;GAAC;GAAa;GAAU;GAAY;EAC3C;CACD,SAAS;CACV,CAAC"}
@@ -0,0 +1,7 @@
1
+ import * as _contractspec_lib_contracts2 from "@contractspec/lib.contracts";
2
+
3
+ //#region src/example.d.ts
4
+ declare const example: _contractspec_lib_contracts2.ExampleSpec;
5
+ //#endregion
6
+ export { example as default };
7
+ //# sourceMappingURL=example.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"sourcesContent":[],"mappings":";;;cAEM,SA6BJ,4BAAA,CA7BW"}
@@ -0,0 +1,47 @@
1
+ import { defineExample } from "@contractspec/lib.contracts";
2
+
3
+ //#region src/example.ts
4
+ const example = defineExample({
5
+ meta: {
6
+ key: "locale-jurisdiction-gate",
7
+ version: "1.0.0",
8
+ title: "Locale / Jurisdiction Gate",
9
+ description: "Fail-closed gating for assistant calls: locale + jurisdiction + kbSnapshotId + allowedScope must be explicit, answers must cite a snapshot.",
10
+ kind: "knowledge",
11
+ visibility: "public",
12
+ stability: "experimental",
13
+ owners: ["@platform.core"],
14
+ tags: [
15
+ "policy",
16
+ "locale",
17
+ "jurisdiction",
18
+ "assistant",
19
+ "gating"
20
+ ]
21
+ },
22
+ docs: { rootDocId: "docs.examples.locale-jurisdiction-gate" },
23
+ entrypoints: {
24
+ packageName: "@contractspec/example.locale-jurisdiction-gate",
25
+ feature: "./feature",
26
+ contracts: "./contracts",
27
+ handlers: "./handlers",
28
+ docs: "./docs"
29
+ },
30
+ surfaces: {
31
+ templates: true,
32
+ sandbox: {
33
+ enabled: true,
34
+ modes: ["markdown", "specs"]
35
+ },
36
+ studio: {
37
+ enabled: true,
38
+ installable: true
39
+ },
40
+ mcp: { enabled: true }
41
+ }
42
+ });
43
+ var example_default = example;
44
+
45
+ //#endregion
46
+ export { example_default as default };
47
+ //# sourceMappingURL=example.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.js","names":[],"sources":["../src/example.ts"],"sourcesContent":["import { defineExample } from '@contractspec/lib.contracts';\n\nconst example = defineExample({\n meta: {\n key: 'locale-jurisdiction-gate',\n version: '1.0.0',\n title: 'Locale / Jurisdiction Gate',\n description:\n 'Fail-closed gating for assistant calls: locale + jurisdiction + kbSnapshotId + allowedScope must be explicit, answers must cite a snapshot.',\n kind: 'knowledge',\n visibility: 'public',\n stability: 'experimental',\n owners: ['@platform.core'],\n tags: ['policy', 'locale', 'jurisdiction', 'assistant', 'gating'],\n },\n docs: {\n rootDocId: 'docs.examples.locale-jurisdiction-gate',\n },\n entrypoints: {\n packageName: '@contractspec/example.locale-jurisdiction-gate',\n feature: './feature',\n contracts: './contracts',\n handlers: './handlers',\n docs: './docs',\n },\n surfaces: {\n templates: true,\n sandbox: { enabled: true, modes: ['markdown', 'specs'] },\n studio: { enabled: true, installable: true },\n mcp: { enabled: true },\n },\n});\n\nexport default example;\n"],"mappings":";;;AAEA,MAAM,UAAU,cAAc;CAC5B,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAU;GAAU;GAAgB;GAAa;GAAS;EAClE;CACD,MAAM,EACJ,WAAW,0CACZ;CACD,aAAa;EACX,aAAa;EACb,SAAS;EACT,WAAW;EACX,UAAU;EACV,MAAM;EACP;CACD,UAAU;EACR,WAAW;EACX,SAAS;GAAE,SAAS;GAAM,OAAO,CAAC,YAAY,QAAQ;GAAE;EACxD,QAAQ;GAAE,SAAS;GAAM,aAAa;GAAM;EAC5C,KAAK,EAAE,SAAS,MAAM;EACvB;CACF,CAAC;AAEF,sBAAe"}