@contractspec/example.locale-jurisdiction-gate 1.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +161 -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 +36 -0
  22. package/dist/example.d.ts.map +1 -0
  23. package/dist/example.js +40 -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 +51 -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 +80 -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 +27 -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,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,
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,
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,
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,\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,\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,\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,36 @@
1
+ //#region src/example.d.ts
2
+ declare const example: {
3
+ readonly id: "locale-jurisdiction-gate";
4
+ readonly title: "Locale / Jurisdiction Gate";
5
+ readonly summary: "Fail-closed gating for assistant calls: locale + jurisdiction + kbSnapshotId + allowedScope must be explicit, answers must cite a snapshot.";
6
+ readonly tags: readonly ["policy", "locale", "jurisdiction", "assistant", "gating"];
7
+ readonly kind: "knowledge";
8
+ readonly visibility: "public";
9
+ readonly docs: {
10
+ readonly rootDocId: "docs.examples.locale-jurisdiction-gate";
11
+ };
12
+ readonly entrypoints: {
13
+ readonly packageName: "@contractspec/example.locale-jurisdiction-gate";
14
+ readonly feature: "./feature";
15
+ readonly contracts: "./contracts";
16
+ readonly handlers: "./handlers";
17
+ readonly docs: "./docs";
18
+ };
19
+ readonly surfaces: {
20
+ readonly templates: true;
21
+ readonly sandbox: {
22
+ readonly enabled: true;
23
+ readonly modes: readonly ["markdown", "specs"];
24
+ };
25
+ readonly studio: {
26
+ readonly enabled: true;
27
+ readonly installable: true;
28
+ };
29
+ readonly mcp: {
30
+ readonly enabled: true;
31
+ };
32
+ };
33
+ };
34
+ //#endregion
35
+ export { example as default };
36
+ //# sourceMappingURL=example.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"sourcesContent":[],"mappings":";cAAM;EAAA,SAAA,EAwBI,EAAA,0BAAA"}
@@ -0,0 +1,40 @@
1
+ //#region src/example.ts
2
+ const example = {
3
+ id: "locale-jurisdiction-gate",
4
+ title: "Locale / Jurisdiction Gate",
5
+ summary: "Fail-closed gating for assistant calls: locale + jurisdiction + kbSnapshotId + allowedScope must be explicit, answers must cite a snapshot.",
6
+ tags: [
7
+ "policy",
8
+ "locale",
9
+ "jurisdiction",
10
+ "assistant",
11
+ "gating"
12
+ ],
13
+ kind: "knowledge",
14
+ visibility: "public",
15
+ docs: { rootDocId: "docs.examples.locale-jurisdiction-gate" },
16
+ entrypoints: {
17
+ packageName: "@contractspec/example.locale-jurisdiction-gate",
18
+ feature: "./feature",
19
+ contracts: "./contracts",
20
+ handlers: "./handlers",
21
+ docs: "./docs"
22
+ },
23
+ surfaces: {
24
+ templates: true,
25
+ sandbox: {
26
+ enabled: true,
27
+ modes: ["markdown", "specs"]
28
+ },
29
+ studio: {
30
+ enabled: true,
31
+ installable: true
32
+ },
33
+ mcp: { enabled: true }
34
+ }
35
+ };
36
+ var example_default = example;
37
+
38
+ //#endregion
39
+ export { example_default as default };
40
+ //# sourceMappingURL=example.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.js","names":[],"sources":["../src/example.ts"],"sourcesContent":["const example = {\n id: 'locale-jurisdiction-gate',\n title: 'Locale / Jurisdiction Gate',\n summary:\n 'Fail-closed gating for assistant calls: locale + jurisdiction + kbSnapshotId + allowedScope must be explicit, answers must cite a snapshot.',\n tags: ['policy', 'locale', 'jurisdiction', 'assistant', 'gating'],\n kind: 'knowledge',\n visibility: 'public',\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} as const;\n\nexport default example;\n"],"mappings":";AAAA,MAAM,UAAU;CACd,IAAI;CACJ,OAAO;CACP,SACE;CACF,MAAM;EAAC;EAAU;EAAU;EAAgB;EAAa;EAAS;CACjE,MAAM;CACN,YAAY;CACZ,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;AAED,sBAAe"}
@@ -0,0 +1,59 @@
1
+ //#region src/handlers/demo.handlers.d.ts
2
+ type AllowedScope = 'education_only' | 'generic_info' | 'escalation_required';
3
+ interface AssistantAnswerIR {
4
+ locale: string;
5
+ jurisdiction: string;
6
+ allowedScope: AllowedScope;
7
+ sections: {
8
+ heading: string;
9
+ body: string;
10
+ }[];
11
+ citations: {
12
+ kbSnapshotId: string;
13
+ sourceType: string;
14
+ sourceId: string;
15
+ title?: string;
16
+ excerpt?: string;
17
+ }[];
18
+ disclaimers?: string[];
19
+ riskFlags?: string[];
20
+ refused?: boolean;
21
+ refusalReason?: string;
22
+ }
23
+ interface DemoAssistantHandlers {
24
+ answer(input: {
25
+ envelope: {
26
+ traceId: string;
27
+ locale: string;
28
+ kbSnapshotId: string;
29
+ allowedScope: AllowedScope;
30
+ regulatoryContext: {
31
+ jurisdiction: string;
32
+ };
33
+ };
34
+ question: string;
35
+ }): Promise<AssistantAnswerIR>;
36
+ explainConcept(input: {
37
+ envelope: {
38
+ traceId: string;
39
+ locale: string;
40
+ kbSnapshotId: string;
41
+ allowedScope: AllowedScope;
42
+ regulatoryContext: {
43
+ jurisdiction: string;
44
+ };
45
+ };
46
+ conceptKey: string;
47
+ }): Promise<AssistantAnswerIR>;
48
+ }
49
+ /**
50
+ * Deterministic demo assistant handlers (no LLM).
51
+ *
52
+ * - Validates envelope
53
+ * - Requires citations
54
+ * - Enforces allowedScope (education_only blocks actionable language)
55
+ */
56
+ declare function createDemoAssistantHandlers(): DemoAssistantHandlers;
57
+ //#endregion
58
+ export { DemoAssistantHandlers, createDemoAssistantHandlers };
59
+ //# sourceMappingURL=demo.handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"demo.handlers.d.ts","names":[],"sources":["../../src/handlers/demo.handlers.ts"],"sourcesContent":[],"mappings":";KAMK,YAAA;UAEK,iBAAA,CAFO;EAEP,MAAA,EAAA,MAAA;EAkBO,YAAA,EAAA,MAAA;EAMG,YAAA,EArBJ,YAqBI;EAIN,QAAA,EAAA;IAAR,OAAA,EAAA,MAAA;IAOc,IAAA,EAAA,MAAA;EAIN,CAAA,EAAA;EAAR,SAAA,EAAA;IAAO,YAAA,EAAA,MAAA;IAUG,UAAA,EAAA,MAAA;;;;;;;;;;UA/BC,qBAAA;;;;;;oBAMG;;;;;;MAId,QAAQ;;;;;;oBAOM;;;;;;MAId,QAAQ;;;;;;;;;iBAUE,2BAAA,CAAA,GAA+B"}
@@ -0,0 +1,86 @@
1
+ import { enforceAllowedScope, enforceCitations, validateEnvelope } from "../policy/guard.js";
2
+
3
+ //#region src/handlers/demo.handlers.ts
4
+ /**
5
+ * Deterministic demo assistant handlers (no LLM).
6
+ *
7
+ * - Validates envelope
8
+ * - Requires citations
9
+ * - Enforces allowedScope (education_only blocks actionable language)
10
+ */
11
+ function createDemoAssistantHandlers() {
12
+ async function answer(input) {
13
+ const env = validateEnvelope(input.envelope);
14
+ if (!env.ok) return {
15
+ locale: input.envelope.locale ?? "en-US",
16
+ jurisdiction: input.envelope.regulatoryContext?.jurisdiction ?? "UNKNOWN",
17
+ allowedScope: input.envelope.allowedScope ?? "education_only",
18
+ sections: [{
19
+ heading: "Request blocked",
20
+ body: env.error.message
21
+ }],
22
+ citations: [],
23
+ disclaimers: ["This system refuses to answer without a valid envelope."],
24
+ riskFlags: [env.error.code],
25
+ refused: true,
26
+ refusalReason: env.error.code
27
+ };
28
+ const draft = {
29
+ locale: env.value.locale,
30
+ jurisdiction: env.value.regulatoryContext?.jurisdiction ?? "UNKNOWN",
31
+ allowedScope: env.value.allowedScope ?? "education_only",
32
+ sections: [{
33
+ heading: "Answer (demo)",
34
+ body: `You asked: "${input.question}". This demo answer is derived from the KB snapshot only.`
35
+ }],
36
+ citations: [{
37
+ kbSnapshotId: env.value.kbSnapshotId ?? "unknown",
38
+ sourceType: "ruleVersion",
39
+ sourceId: "rv_demo",
40
+ title: "Demo rule version",
41
+ excerpt: "Demo excerpt"
42
+ }],
43
+ disclaimers: ["Educational demo only."],
44
+ riskFlags: []
45
+ };
46
+ const scope = enforceAllowedScope(env.value.allowedScope, draft);
47
+ if (!scope.ok) return {
48
+ ...draft,
49
+ sections: [{
50
+ heading: "Escalation required",
51
+ body: scope.error.message
52
+ }],
53
+ citations: draft.citations,
54
+ refused: true,
55
+ refusalReason: scope.error.code,
56
+ riskFlags: [...draft.riskFlags ?? [], scope.error.code]
57
+ };
58
+ const cited = enforceCitations(draft);
59
+ if (!cited.ok) return {
60
+ ...draft,
61
+ sections: [{
62
+ heading: "Request blocked",
63
+ body: cited.error.message
64
+ }],
65
+ citations: [],
66
+ refused: true,
67
+ refusalReason: cited.error.code,
68
+ riskFlags: [...draft.riskFlags ?? [], cited.error.code]
69
+ };
70
+ return draft;
71
+ }
72
+ async function explainConcept(input) {
73
+ return await answer({
74
+ envelope: input.envelope,
75
+ question: `Explain concept: ${input.conceptKey}`
76
+ });
77
+ }
78
+ return {
79
+ answer,
80
+ explainConcept
81
+ };
82
+ }
83
+
84
+ //#endregion
85
+ export { createDemoAssistantHandlers };
86
+ //# sourceMappingURL=demo.handlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"demo.handlers.js","names":["draft: AssistantAnswerIR"],"sources":["../../src/handlers/demo.handlers.ts"],"sourcesContent":["import {\n enforceAllowedScope,\n enforceCitations,\n validateEnvelope,\n} from '../policy/guard';\n\ntype AllowedScope = 'education_only' | 'generic_info' | 'escalation_required';\n\ninterface AssistantAnswerIR {\n locale: string;\n jurisdiction: string;\n allowedScope: AllowedScope;\n sections: { heading: string; body: string }[];\n citations: {\n kbSnapshotId: string;\n sourceType: string;\n sourceId: string;\n title?: string;\n excerpt?: string;\n }[];\n disclaimers?: string[];\n riskFlags?: string[];\n refused?: boolean;\n refusalReason?: string;\n}\n\nexport interface DemoAssistantHandlers {\n answer(input: {\n envelope: {\n traceId: string;\n locale: string;\n kbSnapshotId: string;\n allowedScope: AllowedScope;\n regulatoryContext: { jurisdiction: string };\n };\n question: string;\n }): Promise<AssistantAnswerIR>;\n\n explainConcept(input: {\n envelope: {\n traceId: string;\n locale: string;\n kbSnapshotId: string;\n allowedScope: AllowedScope;\n regulatoryContext: { jurisdiction: string };\n };\n conceptKey: string;\n }): Promise<AssistantAnswerIR>;\n}\n\n/**\n * Deterministic demo assistant handlers (no LLM).\n *\n * - Validates envelope\n * - Requires citations\n * - Enforces allowedScope (education_only blocks actionable language)\n */\nexport function createDemoAssistantHandlers(): DemoAssistantHandlers {\n async function answer(input: {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n envelope: DemoAssistantHandlers['answer'] extends (a: infer A) => any\n ? A extends { envelope: infer E }\n ? E\n : never\n : never;\n question: string;\n }): Promise<AssistantAnswerIR> {\n const env = validateEnvelope(input.envelope);\n if (!env.ok) {\n return {\n locale: input.envelope.locale ?? 'en-US',\n jurisdiction:\n input.envelope.regulatoryContext?.jurisdiction ?? 'UNKNOWN',\n allowedScope: input.envelope.allowedScope ?? 'education_only',\n sections: [\n {\n heading: 'Request blocked',\n body: env.error.message,\n },\n ],\n citations: [],\n disclaimers: [\n 'This system refuses to answer without a valid envelope.',\n ],\n riskFlags: [env.error.code],\n refused: true,\n refusalReason: env.error.code,\n };\n }\n\n const draft: AssistantAnswerIR = {\n locale: env.value.locale,\n jurisdiction: env.value.regulatoryContext?.jurisdiction ?? 'UNKNOWN',\n allowedScope: env.value.allowedScope ?? 'education_only',\n sections: [\n {\n heading: 'Answer (demo)',\n body: `You asked: \"${input.question}\". This demo answer is derived from the KB snapshot only.`,\n },\n ],\n citations: [\n {\n kbSnapshotId: env.value.kbSnapshotId ?? 'unknown',\n sourceType: 'ruleVersion',\n sourceId: 'rv_demo',\n title: 'Demo rule version',\n excerpt: 'Demo excerpt',\n },\n ],\n disclaimers: ['Educational demo only.'],\n riskFlags: [],\n };\n\n const scope = enforceAllowedScope(env.value.allowedScope, draft);\n if (!scope.ok) {\n return {\n ...draft,\n sections: [\n { heading: 'Escalation required', body: scope.error.message },\n ],\n citations: draft.citations,\n refused: true,\n refusalReason: scope.error.code,\n riskFlags: [...(draft.riskFlags ?? []), scope.error.code],\n };\n }\n\n const cited = enforceCitations(draft);\n if (!cited.ok) {\n return {\n ...draft,\n sections: [{ heading: 'Request blocked', body: cited.error.message }],\n citations: [],\n refused: true,\n refusalReason: cited.error.code,\n riskFlags: [...(draft.riskFlags ?? []), cited.error.code],\n };\n }\n\n return draft;\n }\n\n async function explainConcept(input: {\n envelope: DemoAssistantHandlers['explainConcept'] extends (\n a: infer A\n ) => any // eslint-disable-line @typescript-eslint/no-explicit-any\n ? A extends { envelope: infer E }\n ? E\n : never\n : never;\n conceptKey: string;\n }): Promise<AssistantAnswerIR> {\n return await answer({\n envelope: input.envelope,\n question: `Explain concept: ${input.conceptKey}`,\n });\n }\n\n return { answer, explainConcept };\n}\n"],"mappings":";;;;;;;;;;AAyDA,SAAgB,8BAAqD;CACnE,eAAe,OAAO,OAQS;EAC7B,MAAM,MAAM,iBAAiB,MAAM,SAAS;AAC5C,MAAI,CAAC,IAAI,GACP,QAAO;GACL,QAAQ,MAAM,SAAS,UAAU;GACjC,cACE,MAAM,SAAS,mBAAmB,gBAAgB;GACpD,cAAc,MAAM,SAAS,gBAAgB;GAC7C,UAAU,CACR;IACE,SAAS;IACT,MAAM,IAAI,MAAM;IACjB,CACF;GACD,WAAW,EAAE;GACb,aAAa,CACX,0DACD;GACD,WAAW,CAAC,IAAI,MAAM,KAAK;GAC3B,SAAS;GACT,eAAe,IAAI,MAAM;GAC1B;EAGH,MAAMA,QAA2B;GAC/B,QAAQ,IAAI,MAAM;GAClB,cAAc,IAAI,MAAM,mBAAmB,gBAAgB;GAC3D,cAAc,IAAI,MAAM,gBAAgB;GACxC,UAAU,CACR;IACE,SAAS;IACT,MAAM,eAAe,MAAM,SAAS;IACrC,CACF;GACD,WAAW,CACT;IACE,cAAc,IAAI,MAAM,gBAAgB;IACxC,YAAY;IACZ,UAAU;IACV,OAAO;IACP,SAAS;IACV,CACF;GACD,aAAa,CAAC,yBAAyB;GACvC,WAAW,EAAE;GACd;EAED,MAAM,QAAQ,oBAAoB,IAAI,MAAM,cAAc,MAAM;AAChE,MAAI,CAAC,MAAM,GACT,QAAO;GACL,GAAG;GACH,UAAU,CACR;IAAE,SAAS;IAAuB,MAAM,MAAM,MAAM;IAAS,CAC9D;GACD,WAAW,MAAM;GACjB,SAAS;GACT,eAAe,MAAM,MAAM;GAC3B,WAAW,CAAC,GAAI,MAAM,aAAa,EAAE,EAAG,MAAM,MAAM,KAAK;GAC1D;EAGH,MAAM,QAAQ,iBAAiB,MAAM;AACrC,MAAI,CAAC,MAAM,GACT,QAAO;GACL,GAAG;GACH,UAAU,CAAC;IAAE,SAAS;IAAmB,MAAM,MAAM,MAAM;IAAS,CAAC;GACrE,WAAW,EAAE;GACb,SAAS;GACT,eAAe,MAAM,MAAM;GAC3B,WAAW,CAAC,GAAI,MAAM,aAAa,EAAE,EAAG,MAAM,MAAM,KAAK;GAC1D;AAGH,SAAO;;CAGT,eAAe,eAAe,OASC;AAC7B,SAAO,MAAM,OAAO;GAClB,UAAU,MAAM;GAChB,UAAU,oBAAoB,MAAM;GACrC,CAAC;;AAGJ,QAAO;EAAE;EAAQ;EAAgB"}
@@ -0,0 +1,2 @@
1
+ import { DemoAssistantHandlers, createDemoAssistantHandlers } from "./demo.handlers.js";
2
+ export { DemoAssistantHandlers, createDemoAssistantHandlers };
@@ -0,0 +1,3 @@
1
+ import { createDemoAssistantHandlers } from "./demo.handlers.js";
2
+
3
+ export { createDemoAssistantHandlers };
@@ -0,0 +1,11 @@
1
+ import { AllowedScopeEnum, AssistantAnswerIRModel, AssistantAnswerSectionModel, AssistantCitationModel, LLMCallEnvelopeModel, RegulatoryContextModel, UserProfileModel } from "./entities/models.js";
2
+ import "./entities/index.js";
3
+ import { AssistantAnswerBlockedEvent, AssistantAnswerDeliveredEvent, AssistantAnswerRequestedEvent } from "./events.js";
4
+ import example from "./example.js";
5
+ import { DemoAssistantHandlers, createDemoAssistantHandlers } from "./handlers/demo.handlers.js";
6
+ import { AssistantAnswerContract, AssistantExplainConceptContract } from "./operations/assistant.js";
7
+ import "./operations/index.js";
8
+ import { AllowedScope, GateError, GateResult } from "./policy/types.js";
9
+ import { enforceAllowedScope, enforceCitations, validateEnvelope } from "./policy/guard.js";
10
+ import { LocaleJurisdictionGateFeature } from "./locale-jurisdiction-gate.feature.js";
11
+ export { AllowedScope, AllowedScopeEnum, AssistantAnswerBlockedEvent, AssistantAnswerContract, AssistantAnswerDeliveredEvent, AssistantAnswerIRModel, AssistantAnswerRequestedEvent, AssistantAnswerSectionModel, AssistantCitationModel, AssistantExplainConceptContract, DemoAssistantHandlers, GateError, GateResult, LLMCallEnvelopeModel, LocaleJurisdictionGateFeature, RegulatoryContextModel, UserProfileModel, createDemoAssistantHandlers, enforceAllowedScope, enforceCitations, example, validateEnvelope };