@lssm/example.locale-jurisdiction-gate 0.0.0-canary-20251217063201 → 0.0.0-canary-20251217072406
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$colon$bundle.log +231 -197
- package/.turbo/turbo-build.log +232 -43
- package/CHANGELOG.md +3 -3
- package/dist/contracts/assistant.d.ts +59 -59
- package/dist/contracts/assistant.js +117 -1
- package/dist/contracts/index.js +3 -1
- package/dist/docs/index.js +1 -1
- package/dist/docs/locale-jurisdiction-gate.docblock.js +37 -3
- package/dist/entities/index.js +3 -1
- package/dist/entities/models.d.ts +48 -48
- package/dist/entities/models.js +170 -1
- package/dist/events.js +102 -1
- package/dist/example.js +39 -1
- package/dist/handlers/demo.handlers.js +85 -1
- package/dist/handlers/index.js +3 -1
- package/dist/index.js +12 -1
- package/dist/libs/contracts/dist/capabilities/openbanking.js +88 -1
- package/dist/libs/contracts/dist/client/index.js +5 -1
- package/dist/libs/contracts/dist/client/react/feature-render.js +2 -1
- package/dist/libs/contracts/dist/client/react/form-render.js +4 -1
- package/dist/libs/contracts/dist/client/react/index.js +4 -1
- package/dist/libs/contracts/dist/contract-registry/index.js +1 -1
- package/dist/libs/contracts/dist/contract-registry/schemas.js +60 -1
- package/dist/libs/contracts/dist/docs/PUBLISHING.docblock.js +16 -76
- package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +16 -350
- package/dist/libs/contracts/dist/docs/index.js +29 -1
- package/dist/libs/contracts/dist/docs/presentations.js +71 -1
- package/dist/libs/contracts/dist/docs/registry.js +44 -1
- package/dist/libs/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +16 -383
- package/dist/libs/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +16 -68
- package/dist/libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +16 -140
- package/dist/libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +16 -86
- package/dist/libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +16 -1
- package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +24 -2
- package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +21 -2
- package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +16 -213
- package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +73 -5
- package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +37 -1
- package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +16 -1
- package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +20 -262
- package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +48 -1
- package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +24 -2
- package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +23 -2
- package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +25 -16
- package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +67 -1
- package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +22 -2
- package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +40 -36
- package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +47 -1
- package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +23 -2
- package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +36 -3
- package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +20 -1
- package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +36 -3
- package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +20 -1
- package/dist/libs/contracts/dist/events.js +10 -1
- package/dist/libs/contracts/dist/experiments/evaluator.js +1 -1
- package/dist/libs/contracts/dist/index.js +71 -1
- package/dist/libs/contracts/dist/install.js +2 -1
- package/dist/libs/contracts/dist/integrations/contracts.js +377 -1
- package/dist/libs/contracts/dist/integrations/index.js +18 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js +228 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js +159 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/index.js +3 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js +210 -1
- package/dist/libs/contracts/dist/integrations/openbanking/models.js +242 -1
- package/dist/libs/contracts/dist/integrations/openbanking/telemetry.js +13 -1
- package/dist/libs/contracts/dist/integrations/providers/elevenlabs.js +52 -1
- package/dist/libs/contracts/dist/integrations/providers/gcs-storage.js +75 -1
- package/dist/libs/contracts/dist/integrations/providers/gmail.js +87 -1
- package/dist/libs/contracts/dist/integrations/providers/google-calendar.js +66 -1
- package/dist/libs/contracts/dist/integrations/providers/index.js +11 -1
- package/dist/libs/contracts/dist/integrations/providers/mistral.js +68 -1
- package/dist/libs/contracts/dist/integrations/providers/postmark.js +68 -1
- package/dist/libs/contracts/dist/integrations/providers/powens.js +116 -1
- package/dist/libs/contracts/dist/integrations/providers/qdrant.js +73 -1
- package/dist/libs/contracts/dist/integrations/providers/registry.js +10 -1
- package/dist/libs/contracts/dist/integrations/providers/stripe.js +83 -1
- package/dist/libs/contracts/dist/integrations/providers/twilio-sms.js +61 -1
- package/dist/libs/contracts/dist/jsonschema.js +1 -1
- package/dist/libs/contracts/dist/knowledge/contracts.js +306 -1
- package/dist/libs/contracts/dist/knowledge/index.js +7 -1
- package/dist/libs/contracts/dist/knowledge/spaces/email-threads.js +34 -1
- package/dist/libs/contracts/dist/knowledge/spaces/financial-docs.js +34 -1
- package/dist/libs/contracts/dist/knowledge/spaces/financial-overview.js +38 -1
- package/dist/libs/contracts/dist/knowledge/spaces/index.js +6 -1
- package/dist/libs/contracts/dist/knowledge/spaces/product-canon.js +34 -1
- package/dist/libs/contracts/dist/knowledge/spaces/support-faq.js +37 -1
- package/dist/libs/contracts/dist/knowledge/spaces/uploaded-docs.js +34 -1
- package/dist/libs/contracts/dist/llm/exporters.js +19 -1
- package/dist/libs/contracts/dist/llm/index.js +2 -1
- package/dist/libs/contracts/dist/llm/prompts.js +1 -1
- package/dist/libs/contracts/dist/onboarding-base.js +196 -1
- package/dist/libs/contracts/dist/openapi.js +1 -1
- package/dist/libs/contracts/dist/ownership.js +21 -1
- package/dist/libs/contracts/dist/presentations.js +1 -1
- package/dist/libs/contracts/dist/presentations.v2.js +11 -1
- package/dist/libs/contracts/dist/prompt.js +1 -1
- package/dist/libs/contracts/dist/promptRegistry.js +1 -1
- package/dist/libs/contracts/dist/regenerator/index.js +1 -1
- package/dist/libs/contracts/dist/regenerator/service.js +6 -1
- package/dist/libs/contracts/dist/registry.js +2 -1
- package/dist/libs/contracts/dist/resources.js +1 -1
- package/dist/libs/contracts/dist/schema/dist/EnumType.js +2 -1
- package/dist/libs/contracts/dist/schema/dist/FieldType.js +49 -1
- package/dist/libs/contracts/dist/schema/dist/ScalarTypeEnum.js +236 -1
- package/dist/libs/contracts/dist/schema/dist/SchemaModel.js +39 -1
- package/dist/libs/contracts/dist/schema/dist/entity/defineEntity.js +1 -1
- package/dist/libs/contracts/dist/schema/dist/entity/index.js +2 -1
- package/dist/libs/contracts/dist/schema/dist/entity/types.js +1 -1
- package/dist/libs/contracts/dist/schema/dist/index.js +6 -1
- package/dist/libs/contracts/dist/server/graphql-pothos.js +6 -1
- package/dist/libs/contracts/dist/server/index.js +8 -1
- package/dist/libs/contracts/dist/server/mcp/createMcpServer.js +4 -1
- package/dist/libs/contracts/dist/server/mcp/registerPresentations.js +2 -1
- package/dist/libs/contracts/dist/server/mcp/registerPrompts.js +1 -1
- package/dist/libs/contracts/dist/server/mcp/registerResources.js +2 -1
- package/dist/libs/contracts/dist/server/mcp/registerTools.js +1 -1
- package/dist/libs/contracts/dist/server/provider-mcp.js +1 -1
- package/dist/libs/contracts/dist/server/rest-elysia.js +1 -1
- package/dist/libs/contracts/dist/server/rest-express.js +1 -1
- package/dist/libs/contracts/dist/server/rest-generic.js +1 -1
- package/dist/libs/contracts/dist/server/rest-next-app.js +1 -1
- package/dist/libs/contracts/dist/server/rest-next-pages.js +1 -1
- package/dist/libs/contracts/dist/spec.js +34 -1
- package/dist/libs/contracts/dist/telemetry/index.js +1 -1
- package/dist/libs/contracts/dist/telemetry/tracker.js +1 -1
- package/dist/libs/contracts/dist/tests/index.js +1 -1
- package/dist/libs/contracts/dist/tests/runner.js +2 -1
- package/dist/libs/contracts/dist/workflow/index.js +1 -1
- package/dist/libs/contracts/dist/workflow/runner.js +1 -1
- package/dist/libs/schema/dist/EnumType.js +56 -1
- package/dist/libs/schema/dist/FieldType.js +49 -1
- package/dist/libs/schema/dist/ScalarTypeEnum.js +236 -1
- package/dist/libs/schema/dist/SchemaModel.js +39 -1
- package/dist/libs/schema/dist/entity/defineEntity.js +1 -1
- package/dist/libs/schema/dist/entity/index.js +2 -1
- package/dist/libs/schema/dist/entity/types.js +1 -1
- package/dist/libs/schema/dist/index.js +6 -1
- package/dist/locale-jurisdiction-gate.feature.js +49 -1
- package/dist/policy/guard.js +72 -2
- package/dist/policy/index.js +3 -1
- package/package.json +5 -5
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,135 +1,135 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _lssm_lib_schema74 from "@lssm/lib.schema";
|
|
2
2
|
|
|
3
3
|
//#region src/entities/models.d.ts
|
|
4
|
-
declare const AllowedScopeEnum:
|
|
5
|
-
declare const UserProfileModel:
|
|
4
|
+
declare const AllowedScopeEnum: _lssm_lib_schema74.EnumType<[string, string, string]>;
|
|
5
|
+
declare const UserProfileModel: _lssm_lib_schema74.SchemaModel<{
|
|
6
6
|
preferredLocale: {
|
|
7
|
-
type:
|
|
7
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
8
8
|
isOptional: true;
|
|
9
9
|
};
|
|
10
10
|
residencyCountry: {
|
|
11
|
-
type:
|
|
11
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
12
12
|
isOptional: true;
|
|
13
13
|
};
|
|
14
14
|
taxResidenceCountry: {
|
|
15
|
-
type:
|
|
15
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
16
16
|
isOptional: true;
|
|
17
17
|
};
|
|
18
18
|
clientType: {
|
|
19
|
-
type:
|
|
19
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
20
20
|
isOptional: true;
|
|
21
21
|
};
|
|
22
22
|
}>;
|
|
23
|
-
declare const RegulatoryContextModel:
|
|
23
|
+
declare const RegulatoryContextModel: _lssm_lib_schema74.SchemaModel<{
|
|
24
24
|
jurisdiction: {
|
|
25
|
-
type:
|
|
25
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
26
26
|
isOptional: false;
|
|
27
27
|
};
|
|
28
28
|
region: {
|
|
29
|
-
type:
|
|
29
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
30
30
|
isOptional: true;
|
|
31
31
|
};
|
|
32
32
|
clientType: {
|
|
33
|
-
type:
|
|
33
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
34
34
|
isOptional: true;
|
|
35
35
|
};
|
|
36
36
|
allowedScope: {
|
|
37
|
-
type:
|
|
37
|
+
type: _lssm_lib_schema74.EnumType<[string, string, string]>;
|
|
38
38
|
isOptional: false;
|
|
39
39
|
};
|
|
40
40
|
}>;
|
|
41
|
-
declare const LLMCallEnvelopeModel:
|
|
41
|
+
declare const LLMCallEnvelopeModel: _lssm_lib_schema74.SchemaModel<{
|
|
42
42
|
traceId: {
|
|
43
|
-
type:
|
|
43
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
44
44
|
isOptional: false;
|
|
45
45
|
};
|
|
46
46
|
locale: {
|
|
47
|
-
type:
|
|
47
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
48
48
|
isOptional: false;
|
|
49
49
|
};
|
|
50
50
|
regulatoryContext: {
|
|
51
|
-
type:
|
|
51
|
+
type: _lssm_lib_schema74.SchemaModel<{
|
|
52
52
|
jurisdiction: {
|
|
53
|
-
type:
|
|
53
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
54
54
|
isOptional: false;
|
|
55
55
|
};
|
|
56
56
|
region: {
|
|
57
|
-
type:
|
|
57
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
58
58
|
isOptional: true;
|
|
59
59
|
};
|
|
60
60
|
clientType: {
|
|
61
|
-
type:
|
|
61
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
62
62
|
isOptional: true;
|
|
63
63
|
};
|
|
64
64
|
allowedScope: {
|
|
65
|
-
type:
|
|
65
|
+
type: _lssm_lib_schema74.EnumType<[string, string, string]>;
|
|
66
66
|
isOptional: false;
|
|
67
67
|
};
|
|
68
68
|
}>;
|
|
69
69
|
isOptional: false;
|
|
70
70
|
};
|
|
71
71
|
kbSnapshotId: {
|
|
72
|
-
type:
|
|
72
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
73
73
|
isOptional: false;
|
|
74
74
|
};
|
|
75
75
|
allowedScope: {
|
|
76
|
-
type:
|
|
76
|
+
type: _lssm_lib_schema74.EnumType<[string, string, string]>;
|
|
77
77
|
isOptional: false;
|
|
78
78
|
};
|
|
79
79
|
}>;
|
|
80
|
-
declare const AssistantCitationModel:
|
|
80
|
+
declare const AssistantCitationModel: _lssm_lib_schema74.SchemaModel<{
|
|
81
81
|
kbSnapshotId: {
|
|
82
|
-
type:
|
|
82
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
83
83
|
isOptional: false;
|
|
84
84
|
};
|
|
85
85
|
sourceType: {
|
|
86
|
-
type:
|
|
86
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
87
87
|
isOptional: false;
|
|
88
88
|
};
|
|
89
89
|
sourceId: {
|
|
90
|
-
type:
|
|
90
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
91
91
|
isOptional: false;
|
|
92
92
|
};
|
|
93
93
|
title: {
|
|
94
|
-
type:
|
|
94
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
95
95
|
isOptional: true;
|
|
96
96
|
};
|
|
97
97
|
excerpt: {
|
|
98
|
-
type:
|
|
98
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
99
99
|
isOptional: true;
|
|
100
100
|
};
|
|
101
101
|
}>;
|
|
102
|
-
declare const AssistantAnswerSectionModel:
|
|
102
|
+
declare const AssistantAnswerSectionModel: _lssm_lib_schema74.SchemaModel<{
|
|
103
103
|
heading: {
|
|
104
|
-
type:
|
|
104
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
105
105
|
isOptional: false;
|
|
106
106
|
};
|
|
107
107
|
body: {
|
|
108
|
-
type:
|
|
108
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
109
109
|
isOptional: false;
|
|
110
110
|
};
|
|
111
111
|
}>;
|
|
112
|
-
declare const AssistantAnswerIRModel:
|
|
112
|
+
declare const AssistantAnswerIRModel: _lssm_lib_schema74.SchemaModel<{
|
|
113
113
|
locale: {
|
|
114
|
-
type:
|
|
114
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
115
115
|
isOptional: false;
|
|
116
116
|
};
|
|
117
117
|
jurisdiction: {
|
|
118
|
-
type:
|
|
118
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
119
119
|
isOptional: false;
|
|
120
120
|
};
|
|
121
121
|
allowedScope: {
|
|
122
|
-
type:
|
|
122
|
+
type: _lssm_lib_schema74.EnumType<[string, string, string]>;
|
|
123
123
|
isOptional: false;
|
|
124
124
|
};
|
|
125
125
|
sections: {
|
|
126
|
-
type:
|
|
126
|
+
type: _lssm_lib_schema74.SchemaModel<{
|
|
127
127
|
heading: {
|
|
128
|
-
type:
|
|
128
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
129
129
|
isOptional: false;
|
|
130
130
|
};
|
|
131
131
|
body: {
|
|
132
|
-
type:
|
|
132
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
133
133
|
isOptional: false;
|
|
134
134
|
};
|
|
135
135
|
}>;
|
|
@@ -137,25 +137,25 @@ declare const AssistantAnswerIRModel: _lssm_lib_schema16.SchemaModel<{
|
|
|
137
137
|
isOptional: false;
|
|
138
138
|
};
|
|
139
139
|
citations: {
|
|
140
|
-
type:
|
|
140
|
+
type: _lssm_lib_schema74.SchemaModel<{
|
|
141
141
|
kbSnapshotId: {
|
|
142
|
-
type:
|
|
142
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
143
143
|
isOptional: false;
|
|
144
144
|
};
|
|
145
145
|
sourceType: {
|
|
146
|
-
type:
|
|
146
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
147
147
|
isOptional: false;
|
|
148
148
|
};
|
|
149
149
|
sourceId: {
|
|
150
|
-
type:
|
|
150
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
151
151
|
isOptional: false;
|
|
152
152
|
};
|
|
153
153
|
title: {
|
|
154
|
-
type:
|
|
154
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
155
155
|
isOptional: true;
|
|
156
156
|
};
|
|
157
157
|
excerpt: {
|
|
158
|
-
type:
|
|
158
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
159
159
|
isOptional: true;
|
|
160
160
|
};
|
|
161
161
|
}>;
|
|
@@ -163,21 +163,21 @@ declare const AssistantAnswerIRModel: _lssm_lib_schema16.SchemaModel<{
|
|
|
163
163
|
isOptional: false;
|
|
164
164
|
};
|
|
165
165
|
disclaimers: {
|
|
166
|
-
type:
|
|
166
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
167
167
|
isArray: true;
|
|
168
168
|
isOptional: true;
|
|
169
169
|
};
|
|
170
170
|
riskFlags: {
|
|
171
|
-
type:
|
|
171
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
172
172
|
isArray: true;
|
|
173
173
|
isOptional: true;
|
|
174
174
|
};
|
|
175
175
|
refused: {
|
|
176
|
-
type:
|
|
176
|
+
type: _lssm_lib_schema74.FieldType<boolean, boolean>;
|
|
177
177
|
isOptional: true;
|
|
178
178
|
};
|
|
179
179
|
refusalReason: {
|
|
180
|
-
type:
|
|
180
|
+
type: _lssm_lib_schema74.FieldType<string, string>;
|
|
181
181
|
isOptional: true;
|
|
182
182
|
};
|
|
183
183
|
}>;
|
package/dist/entities/models.js
CHANGED
|
@@ -1 +1,170 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { defineEnum } from "../libs/schema/dist/EnumType.js";
|
|
2
|
+
import { ScalarTypeEnum } from "../libs/schema/dist/ScalarTypeEnum.js";
|
|
3
|
+
import { defineSchemaModel } from "../libs/schema/dist/SchemaModel.js";
|
|
4
|
+
import "../libs/schema/dist/index.js";
|
|
5
|
+
|
|
6
|
+
//#region src/entities/models.ts
|
|
7
|
+
const AllowedScopeEnum = defineEnum("AllowedScope", [
|
|
8
|
+
"education_only",
|
|
9
|
+
"generic_info",
|
|
10
|
+
"escalation_required"
|
|
11
|
+
]);
|
|
12
|
+
const UserProfileModel = defineSchemaModel({
|
|
13
|
+
name: "UserProfile",
|
|
14
|
+
description: "User profile inputs used to derive regulatory context.",
|
|
15
|
+
fields: {
|
|
16
|
+
preferredLocale: {
|
|
17
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
18
|
+
isOptional: true
|
|
19
|
+
},
|
|
20
|
+
residencyCountry: {
|
|
21
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
22
|
+
isOptional: true
|
|
23
|
+
},
|
|
24
|
+
taxResidenceCountry: {
|
|
25
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
26
|
+
isOptional: true
|
|
27
|
+
},
|
|
28
|
+
clientType: {
|
|
29
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
30
|
+
isOptional: true
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const RegulatoryContextModel = defineSchemaModel({
|
|
35
|
+
name: "RegulatoryContext",
|
|
36
|
+
description: "Explicit regulatory context (no guessing).",
|
|
37
|
+
fields: {
|
|
38
|
+
jurisdiction: {
|
|
39
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
40
|
+
isOptional: false
|
|
41
|
+
},
|
|
42
|
+
region: {
|
|
43
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
44
|
+
isOptional: true
|
|
45
|
+
},
|
|
46
|
+
clientType: {
|
|
47
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
48
|
+
isOptional: true
|
|
49
|
+
},
|
|
50
|
+
allowedScope: {
|
|
51
|
+
type: AllowedScopeEnum,
|
|
52
|
+
isOptional: false
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
const LLMCallEnvelopeModel = defineSchemaModel({
|
|
57
|
+
name: "LLMCallEnvelope",
|
|
58
|
+
description: "Mandatory envelope for assistant calls. All fields are explicit and required for policy gating.",
|
|
59
|
+
fields: {
|
|
60
|
+
traceId: {
|
|
61
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
62
|
+
isOptional: false
|
|
63
|
+
},
|
|
64
|
+
locale: {
|
|
65
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
66
|
+
isOptional: false
|
|
67
|
+
},
|
|
68
|
+
regulatoryContext: {
|
|
69
|
+
type: RegulatoryContextModel,
|
|
70
|
+
isOptional: false
|
|
71
|
+
},
|
|
72
|
+
kbSnapshotId: {
|
|
73
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
74
|
+
isOptional: false
|
|
75
|
+
},
|
|
76
|
+
allowedScope: {
|
|
77
|
+
type: AllowedScopeEnum,
|
|
78
|
+
isOptional: false
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
const AssistantCitationModel = defineSchemaModel({
|
|
83
|
+
name: "AssistantCitation",
|
|
84
|
+
description: "Citation referencing a KB snapshot + a specific item within it.",
|
|
85
|
+
fields: {
|
|
86
|
+
kbSnapshotId: {
|
|
87
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
88
|
+
isOptional: false
|
|
89
|
+
},
|
|
90
|
+
sourceType: {
|
|
91
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
92
|
+
isOptional: false
|
|
93
|
+
},
|
|
94
|
+
sourceId: {
|
|
95
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
96
|
+
isOptional: false
|
|
97
|
+
},
|
|
98
|
+
title: {
|
|
99
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
100
|
+
isOptional: true
|
|
101
|
+
},
|
|
102
|
+
excerpt: {
|
|
103
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
104
|
+
isOptional: true
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
const AssistantAnswerSectionModel = defineSchemaModel({
|
|
109
|
+
name: "AssistantAnswerSection",
|
|
110
|
+
description: "Structured answer section.",
|
|
111
|
+
fields: {
|
|
112
|
+
heading: {
|
|
113
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
114
|
+
isOptional: false
|
|
115
|
+
},
|
|
116
|
+
body: {
|
|
117
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
118
|
+
isOptional: false
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
const AssistantAnswerIRModel = defineSchemaModel({
|
|
123
|
+
name: "AssistantAnswerIR",
|
|
124
|
+
description: "Structured assistant answer with mandatory citations and explicit locale/jurisdiction.",
|
|
125
|
+
fields: {
|
|
126
|
+
locale: {
|
|
127
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
128
|
+
isOptional: false
|
|
129
|
+
},
|
|
130
|
+
jurisdiction: {
|
|
131
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
132
|
+
isOptional: false
|
|
133
|
+
},
|
|
134
|
+
allowedScope: {
|
|
135
|
+
type: AllowedScopeEnum,
|
|
136
|
+
isOptional: false
|
|
137
|
+
},
|
|
138
|
+
sections: {
|
|
139
|
+
type: AssistantAnswerSectionModel,
|
|
140
|
+
isArray: true,
|
|
141
|
+
isOptional: false
|
|
142
|
+
},
|
|
143
|
+
citations: {
|
|
144
|
+
type: AssistantCitationModel,
|
|
145
|
+
isArray: true,
|
|
146
|
+
isOptional: false
|
|
147
|
+
},
|
|
148
|
+
disclaimers: {
|
|
149
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
150
|
+
isArray: true,
|
|
151
|
+
isOptional: true
|
|
152
|
+
},
|
|
153
|
+
riskFlags: {
|
|
154
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
155
|
+
isArray: true,
|
|
156
|
+
isOptional: true
|
|
157
|
+
},
|
|
158
|
+
refused: {
|
|
159
|
+
type: ScalarTypeEnum.Boolean(),
|
|
160
|
+
isOptional: true
|
|
161
|
+
},
|
|
162
|
+
refusalReason: {
|
|
163
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
164
|
+
isOptional: true
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
//#endregion
|
|
170
|
+
export { AllowedScopeEnum, AssistantAnswerIRModel, AssistantAnswerSectionModel, AssistantCitationModel, LLMCallEnvelopeModel, RegulatoryContextModel, UserProfileModel };
|
package/dist/events.js
CHANGED
|
@@ -1 +1,102 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { defineSchemaModel } from "./libs/contracts/dist/schema/dist/SchemaModel.js";
|
|
2
|
+
import { defineEvent } from "./libs/contracts/dist/events.js";
|
|
3
|
+
import "./libs/contracts/dist/index.js";
|
|
4
|
+
import { ScalarTypeEnum } from "./libs/schema/dist/ScalarTypeEnum.js";
|
|
5
|
+
import "./libs/schema/dist/index.js";
|
|
6
|
+
|
|
7
|
+
//#region src/events.ts
|
|
8
|
+
const AssistantAnswerRequestedPayload = defineSchemaModel({
|
|
9
|
+
name: "AssistantAnswerRequestedPayload",
|
|
10
|
+
description: "Emitted when an assistant answer is requested (pre-gate).",
|
|
11
|
+
fields: {
|
|
12
|
+
traceId: {
|
|
13
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
14
|
+
isOptional: false
|
|
15
|
+
},
|
|
16
|
+
locale: {
|
|
17
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
18
|
+
isOptional: false
|
|
19
|
+
},
|
|
20
|
+
jurisdiction: {
|
|
21
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
22
|
+
isOptional: false
|
|
23
|
+
},
|
|
24
|
+
kbSnapshotId: {
|
|
25
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
26
|
+
isOptional: false
|
|
27
|
+
},
|
|
28
|
+
allowedScope: {
|
|
29
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
30
|
+
isOptional: false
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const AssistantAnswerRequestedEvent = defineEvent({
|
|
35
|
+
name: "assistant.answer.requested",
|
|
36
|
+
version: 1,
|
|
37
|
+
description: "Assistant answer requested (policy gate will run).",
|
|
38
|
+
payload: AssistantAnswerRequestedPayload
|
|
39
|
+
});
|
|
40
|
+
const AssistantAnswerBlockedPayload = defineSchemaModel({
|
|
41
|
+
name: "AssistantAnswerBlockedPayload",
|
|
42
|
+
description: "Emitted when a request is blocked by the gate.",
|
|
43
|
+
fields: {
|
|
44
|
+
traceId: {
|
|
45
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
46
|
+
isOptional: false
|
|
47
|
+
},
|
|
48
|
+
reasonCode: {
|
|
49
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
50
|
+
isOptional: false
|
|
51
|
+
},
|
|
52
|
+
reason: {
|
|
53
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
54
|
+
isOptional: false
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
const AssistantAnswerBlockedEvent = defineEvent({
|
|
59
|
+
name: "assistant.answer.blocked",
|
|
60
|
+
version: 1,
|
|
61
|
+
description: "Assistant answer blocked (fail-closed).",
|
|
62
|
+
payload: AssistantAnswerBlockedPayload
|
|
63
|
+
});
|
|
64
|
+
const AssistantAnswerDeliveredPayload = defineSchemaModel({
|
|
65
|
+
name: "AssistantAnswerDeliveredPayload",
|
|
66
|
+
description: "Emitted when a structured, cited answer is delivered.",
|
|
67
|
+
fields: {
|
|
68
|
+
traceId: {
|
|
69
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
70
|
+
isOptional: false
|
|
71
|
+
},
|
|
72
|
+
locale: {
|
|
73
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
74
|
+
isOptional: false
|
|
75
|
+
},
|
|
76
|
+
jurisdiction: {
|
|
77
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
78
|
+
isOptional: false
|
|
79
|
+
},
|
|
80
|
+
kbSnapshotId: {
|
|
81
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
82
|
+
isOptional: false
|
|
83
|
+
},
|
|
84
|
+
allowedScope: {
|
|
85
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
86
|
+
isOptional: false
|
|
87
|
+
},
|
|
88
|
+
citationsCount: {
|
|
89
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
90
|
+
isOptional: false
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
const AssistantAnswerDeliveredEvent = defineEvent({
|
|
95
|
+
name: "assistant.answer.delivered",
|
|
96
|
+
version: 1,
|
|
97
|
+
description: "Assistant answer delivered (must include KB snapshot citations).",
|
|
98
|
+
payload: AssistantAnswerDeliveredPayload
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
//#endregion
|
|
102
|
+
export { AssistantAnswerBlockedEvent, AssistantAnswerDeliveredEvent, AssistantAnswerRequestedEvent };
|
package/dist/example.js
CHANGED
|
@@ -1 +1,39 @@
|
|
|
1
|
-
|
|
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: "@lssm/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 };
|
|
@@ -1 +1,85 @@
|
|
|
1
|
-
import{enforceAllowedScope
|
|
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,
|
|
31
|
+
allowedScope: env.value.allowedScope,
|
|
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,
|
|
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 };
|
package/dist/handlers/index.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { AssistantAnswerBlockedEvent, AssistantAnswerDeliveredEvent, AssistantAnswerRequestedEvent } from "./events.js";
|
|
2
|
+
import example_default from "./example.js";
|
|
3
|
+
import { AllowedScopeEnum, AssistantAnswerIRModel, AssistantAnswerSectionModel, AssistantCitationModel, LLMCallEnvelopeModel, RegulatoryContextModel, UserProfileModel } from "./entities/models.js";
|
|
4
|
+
import "./entities/index.js";
|
|
5
|
+
import { AssistantAnswerContract, AssistantExplainConceptContract } from "./contracts/assistant.js";
|
|
6
|
+
import "./contracts/index.js";
|
|
7
|
+
import { enforceAllowedScope, enforceCitations, validateEnvelope } from "./policy/guard.js";
|
|
8
|
+
import { createDemoAssistantHandlers } from "./handlers/demo.handlers.js";
|
|
9
|
+
import { LocaleJurisdictionGateFeature } from "./locale-jurisdiction-gate.feature.js";
|
|
10
|
+
import "./docs/index.js";
|
|
11
|
+
|
|
12
|
+
export { AllowedScopeEnum, AssistantAnswerBlockedEvent, AssistantAnswerContract, AssistantAnswerDeliveredEvent, AssistantAnswerIRModel, AssistantAnswerRequestedEvent, AssistantAnswerSectionModel, AssistantCitationModel, AssistantExplainConceptContract, LLMCallEnvelopeModel, LocaleJurisdictionGateFeature, RegulatoryContextModel, UserProfileModel, createDemoAssistantHandlers, enforceAllowedScope, enforceCitations, example_default as example, validateEnvelope };
|