@lssm/example.versioned-knowledge-base 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 +225 -191
- package/.turbo/turbo-build.log +226 -37
- package/CHANGELOG.md +3 -3
- package/dist/contracts/index.js +3 -1
- package/dist/contracts/kb.d.ts +70 -70
- package/dist/contracts/kb.js +253 -1
- package/dist/docs/index.js +1 -1
- package/dist/docs/versioned-knowledge-base.docblock.js +29 -18
- package/dist/entities/index.js +3 -1
- package/dist/entities/models.d.ts +36 -36
- package/dist/entities/models.js +152 -1
- package/dist/events.d.ts +17 -17
- package/dist/events.js +106 -1
- package/dist/example.js +41 -1
- package/dist/handlers/index.js +3 -1
- package/dist/handlers/memory.handlers.js +103 -1
- package/dist/index.js +11 -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 +2 -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/versioned-knowledge-base.feature.js +66 -1
- package/package.json +5 -5
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _lssm_lib_schema84 from "@lssm/lib.schema";
|
|
2
2
|
|
|
3
3
|
//#region src/entities/models.d.ts
|
|
4
|
-
declare const SourceDocumentModel:
|
|
4
|
+
declare const SourceDocumentModel: _lssm_lib_schema84.SchemaModel<{
|
|
5
5
|
id: {
|
|
6
|
-
type:
|
|
6
|
+
type: _lssm_lib_schema84.FieldType<string, string>;
|
|
7
7
|
isOptional: false;
|
|
8
8
|
};
|
|
9
9
|
jurisdiction: {
|
|
10
|
-
type:
|
|
10
|
+
type: _lssm_lib_schema84.FieldType<string, string>;
|
|
11
11
|
isOptional: false;
|
|
12
12
|
};
|
|
13
13
|
authority: {
|
|
14
|
-
type:
|
|
14
|
+
type: _lssm_lib_schema84.FieldType<string, string>;
|
|
15
15
|
isOptional: false;
|
|
16
16
|
};
|
|
17
17
|
title: {
|
|
18
|
-
type:
|
|
18
|
+
type: _lssm_lib_schema84.FieldType<string, string>;
|
|
19
19
|
isOptional: false;
|
|
20
20
|
};
|
|
21
21
|
fetchedAt: {
|
|
22
|
-
type:
|
|
22
|
+
type: _lssm_lib_schema84.FieldType<Date, string>;
|
|
23
23
|
isOptional: false;
|
|
24
24
|
};
|
|
25
25
|
hash: {
|
|
26
|
-
type:
|
|
26
|
+
type: _lssm_lib_schema84.FieldType<string, string>;
|
|
27
27
|
isOptional: false;
|
|
28
28
|
};
|
|
29
29
|
fileId: {
|
|
30
|
-
type:
|
|
30
|
+
type: _lssm_lib_schema84.FieldType<string, string>;
|
|
31
31
|
isOptional: false;
|
|
32
32
|
};
|
|
33
33
|
}>;
|
|
34
|
-
declare const SourceRefModel:
|
|
34
|
+
declare const SourceRefModel: _lssm_lib_schema84.SchemaModel<{
|
|
35
35
|
sourceDocumentId: {
|
|
36
|
-
type:
|
|
36
|
+
type: _lssm_lib_schema84.FieldType<string, string>;
|
|
37
37
|
isOptional: false;
|
|
38
38
|
};
|
|
39
39
|
excerpt: {
|
|
40
|
-
type:
|
|
40
|
+
type: _lssm_lib_schema84.FieldType<string, string>;
|
|
41
41
|
isOptional: true;
|
|
42
42
|
};
|
|
43
43
|
}>;
|
|
44
|
-
declare const RuleModel:
|
|
44
|
+
declare const RuleModel: _lssm_lib_schema84.SchemaModel<{
|
|
45
45
|
id: {
|
|
46
|
-
type:
|
|
46
|
+
type: _lssm_lib_schema84.FieldType<string, string>;
|
|
47
47
|
isOptional: false;
|
|
48
48
|
};
|
|
49
49
|
jurisdiction: {
|
|
50
|
-
type:
|
|
50
|
+
type: _lssm_lib_schema84.FieldType<string, string>;
|
|
51
51
|
isOptional: false;
|
|
52
52
|
};
|
|
53
53
|
topicKey: {
|
|
54
|
-
type:
|
|
54
|
+
type: _lssm_lib_schema84.FieldType<string, string>;
|
|
55
55
|
isOptional: false;
|
|
56
56
|
};
|
|
57
57
|
}>;
|
|
58
|
-
declare const RuleVersionModel:
|
|
58
|
+
declare const RuleVersionModel: _lssm_lib_schema84.SchemaModel<{
|
|
59
59
|
id: {
|
|
60
|
-
type:
|
|
60
|
+
type: _lssm_lib_schema84.FieldType<string, string>;
|
|
61
61
|
isOptional: false;
|
|
62
62
|
};
|
|
63
63
|
ruleId: {
|
|
64
|
-
type:
|
|
64
|
+
type: _lssm_lib_schema84.FieldType<string, string>;
|
|
65
65
|
isOptional: false;
|
|
66
66
|
};
|
|
67
67
|
jurisdiction: {
|
|
68
|
-
type:
|
|
68
|
+
type: _lssm_lib_schema84.FieldType<string, string>;
|
|
69
69
|
isOptional: false;
|
|
70
70
|
};
|
|
71
71
|
topicKey: {
|
|
72
|
-
type:
|
|
72
|
+
type: _lssm_lib_schema84.FieldType<string, string>;
|
|
73
73
|
isOptional: false;
|
|
74
74
|
};
|
|
75
75
|
version: {
|
|
76
|
-
type:
|
|
76
|
+
type: _lssm_lib_schema84.FieldType<number, number>;
|
|
77
77
|
isOptional: false;
|
|
78
78
|
};
|
|
79
79
|
content: {
|
|
80
|
-
type:
|
|
80
|
+
type: _lssm_lib_schema84.FieldType<string, string>;
|
|
81
81
|
isOptional: false;
|
|
82
82
|
};
|
|
83
83
|
sourceRefs: {
|
|
84
|
-
type:
|
|
84
|
+
type: _lssm_lib_schema84.SchemaModel<{
|
|
85
85
|
sourceDocumentId: {
|
|
86
|
-
type:
|
|
86
|
+
type: _lssm_lib_schema84.FieldType<string, string>;
|
|
87
87
|
isOptional: false;
|
|
88
88
|
};
|
|
89
89
|
excerpt: {
|
|
90
|
-
type:
|
|
90
|
+
type: _lssm_lib_schema84.FieldType<string, string>;
|
|
91
91
|
isOptional: true;
|
|
92
92
|
};
|
|
93
93
|
}>;
|
|
@@ -95,42 +95,42 @@ declare const RuleVersionModel: _lssm_lib_schema0.SchemaModel<{
|
|
|
95
95
|
isOptional: false;
|
|
96
96
|
};
|
|
97
97
|
status: {
|
|
98
|
-
type:
|
|
98
|
+
type: _lssm_lib_schema84.FieldType<string, string>;
|
|
99
99
|
isOptional: false;
|
|
100
100
|
};
|
|
101
101
|
approvedBy: {
|
|
102
|
-
type:
|
|
102
|
+
type: _lssm_lib_schema84.FieldType<string, string>;
|
|
103
103
|
isOptional: true;
|
|
104
104
|
};
|
|
105
105
|
approvedAt: {
|
|
106
|
-
type:
|
|
106
|
+
type: _lssm_lib_schema84.FieldType<Date, string>;
|
|
107
107
|
isOptional: true;
|
|
108
108
|
};
|
|
109
109
|
createdAt: {
|
|
110
|
-
type:
|
|
110
|
+
type: _lssm_lib_schema84.FieldType<Date, string>;
|
|
111
111
|
isOptional: false;
|
|
112
112
|
};
|
|
113
113
|
}>;
|
|
114
|
-
declare const KBSnapshotModel:
|
|
114
|
+
declare const KBSnapshotModel: _lssm_lib_schema84.SchemaModel<{
|
|
115
115
|
id: {
|
|
116
|
-
type:
|
|
116
|
+
type: _lssm_lib_schema84.FieldType<string, string>;
|
|
117
117
|
isOptional: false;
|
|
118
118
|
};
|
|
119
119
|
jurisdiction: {
|
|
120
|
-
type:
|
|
120
|
+
type: _lssm_lib_schema84.FieldType<string, string>;
|
|
121
121
|
isOptional: false;
|
|
122
122
|
};
|
|
123
123
|
asOfDate: {
|
|
124
|
-
type:
|
|
124
|
+
type: _lssm_lib_schema84.FieldType<Date, string>;
|
|
125
125
|
isOptional: false;
|
|
126
126
|
};
|
|
127
127
|
includedRuleVersionIds: {
|
|
128
|
-
type:
|
|
128
|
+
type: _lssm_lib_schema84.FieldType<string, string>;
|
|
129
129
|
isArray: true;
|
|
130
130
|
isOptional: false;
|
|
131
131
|
};
|
|
132
132
|
publishedAt: {
|
|
133
|
-
type:
|
|
133
|
+
type: _lssm_lib_schema84.FieldType<Date, string>;
|
|
134
134
|
isOptional: false;
|
|
135
135
|
};
|
|
136
136
|
}>;
|
package/dist/entities/models.js
CHANGED
|
@@ -1 +1,152 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { ScalarTypeEnum } from "../libs/schema/dist/ScalarTypeEnum.js";
|
|
2
|
+
import { defineSchemaModel } from "../libs/schema/dist/SchemaModel.js";
|
|
3
|
+
import "../libs/schema/dist/index.js";
|
|
4
|
+
|
|
5
|
+
//#region src/entities/models.ts
|
|
6
|
+
const SourceDocumentModel = defineSchemaModel({
|
|
7
|
+
name: "SourceDocument",
|
|
8
|
+
description: "Immutable raw source document metadata referencing a stored file.",
|
|
9
|
+
fields: {
|
|
10
|
+
id: {
|
|
11
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
12
|
+
isOptional: false
|
|
13
|
+
},
|
|
14
|
+
jurisdiction: {
|
|
15
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
16
|
+
isOptional: false
|
|
17
|
+
},
|
|
18
|
+
authority: {
|
|
19
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
20
|
+
isOptional: false
|
|
21
|
+
},
|
|
22
|
+
title: {
|
|
23
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
24
|
+
isOptional: false
|
|
25
|
+
},
|
|
26
|
+
fetchedAt: {
|
|
27
|
+
type: ScalarTypeEnum.DateTime(),
|
|
28
|
+
isOptional: false
|
|
29
|
+
},
|
|
30
|
+
hash: {
|
|
31
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
32
|
+
isOptional: false
|
|
33
|
+
},
|
|
34
|
+
fileId: {
|
|
35
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
36
|
+
isOptional: false
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
const SourceRefModel = defineSchemaModel({
|
|
41
|
+
name: "SourceRef",
|
|
42
|
+
description: "Reference to a source document used to justify a rule version.",
|
|
43
|
+
fields: {
|
|
44
|
+
sourceDocumentId: {
|
|
45
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
46
|
+
isOptional: false
|
|
47
|
+
},
|
|
48
|
+
excerpt: {
|
|
49
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
50
|
+
isOptional: true
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
const RuleModel = defineSchemaModel({
|
|
55
|
+
name: "Rule",
|
|
56
|
+
description: "Curated rule (stable identity) with topic + jurisdiction scope.",
|
|
57
|
+
fields: {
|
|
58
|
+
id: {
|
|
59
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
60
|
+
isOptional: false
|
|
61
|
+
},
|
|
62
|
+
jurisdiction: {
|
|
63
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
64
|
+
isOptional: false
|
|
65
|
+
},
|
|
66
|
+
topicKey: {
|
|
67
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
68
|
+
isOptional: false
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
const RuleVersionModel = defineSchemaModel({
|
|
73
|
+
name: "RuleVersion",
|
|
74
|
+
description: "A versioned rule content with source references and approval status.",
|
|
75
|
+
fields: {
|
|
76
|
+
id: {
|
|
77
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
78
|
+
isOptional: false
|
|
79
|
+
},
|
|
80
|
+
ruleId: {
|
|
81
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
82
|
+
isOptional: false
|
|
83
|
+
},
|
|
84
|
+
jurisdiction: {
|
|
85
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
86
|
+
isOptional: false
|
|
87
|
+
},
|
|
88
|
+
topicKey: {
|
|
89
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
90
|
+
isOptional: false
|
|
91
|
+
},
|
|
92
|
+
version: {
|
|
93
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
94
|
+
isOptional: false
|
|
95
|
+
},
|
|
96
|
+
content: {
|
|
97
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
98
|
+
isOptional: false
|
|
99
|
+
},
|
|
100
|
+
sourceRefs: {
|
|
101
|
+
type: SourceRefModel,
|
|
102
|
+
isArray: true,
|
|
103
|
+
isOptional: false
|
|
104
|
+
},
|
|
105
|
+
status: {
|
|
106
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
107
|
+
isOptional: false
|
|
108
|
+
},
|
|
109
|
+
approvedBy: {
|
|
110
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
111
|
+
isOptional: true
|
|
112
|
+
},
|
|
113
|
+
approvedAt: {
|
|
114
|
+
type: ScalarTypeEnum.DateTime(),
|
|
115
|
+
isOptional: true
|
|
116
|
+
},
|
|
117
|
+
createdAt: {
|
|
118
|
+
type: ScalarTypeEnum.DateTime(),
|
|
119
|
+
isOptional: false
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
const KBSnapshotModel = defineSchemaModel({
|
|
124
|
+
name: "KBSnapshot",
|
|
125
|
+
description: "Published KB snapshot (as-of) referencing approved rule versions.",
|
|
126
|
+
fields: {
|
|
127
|
+
id: {
|
|
128
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
129
|
+
isOptional: false
|
|
130
|
+
},
|
|
131
|
+
jurisdiction: {
|
|
132
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
133
|
+
isOptional: false
|
|
134
|
+
},
|
|
135
|
+
asOfDate: {
|
|
136
|
+
type: ScalarTypeEnum.DateTime(),
|
|
137
|
+
isOptional: false
|
|
138
|
+
},
|
|
139
|
+
includedRuleVersionIds: {
|
|
140
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
141
|
+
isArray: true,
|
|
142
|
+
isOptional: false
|
|
143
|
+
},
|
|
144
|
+
publishedAt: {
|
|
145
|
+
type: ScalarTypeEnum.DateTime(),
|
|
146
|
+
isOptional: false
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
//#endregion
|
|
152
|
+
export { KBSnapshotModel, RuleModel, RuleVersionModel, SourceDocumentModel, SourceRefModel };
|
package/dist/events.d.ts
CHANGED
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _lssm_lib_schema0 from "@lssm/lib.schema";
|
|
2
2
|
import * as _lssm_lib_contracts0 from "@lssm/lib.contracts";
|
|
3
3
|
|
|
4
4
|
//#region src/events.d.ts
|
|
5
|
-
declare const KbSourceIngestedEvent: _lssm_lib_contracts0.EventSpec<
|
|
5
|
+
declare const KbSourceIngestedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
|
|
6
6
|
sourceDocumentId: {
|
|
7
|
-
type:
|
|
7
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
8
8
|
isOptional: false;
|
|
9
9
|
};
|
|
10
10
|
jurisdiction: {
|
|
11
|
-
type:
|
|
11
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
12
12
|
isOptional: false;
|
|
13
13
|
};
|
|
14
14
|
hash: {
|
|
15
|
-
type:
|
|
15
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
16
16
|
isOptional: false;
|
|
17
17
|
};
|
|
18
18
|
}>>;
|
|
19
|
-
declare const KbRuleVersionCreatedEvent: _lssm_lib_contracts0.EventSpec<
|
|
19
|
+
declare const KbRuleVersionCreatedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
|
|
20
20
|
ruleVersionId: {
|
|
21
|
-
type:
|
|
21
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
22
22
|
isOptional: false;
|
|
23
23
|
};
|
|
24
24
|
ruleId: {
|
|
25
|
-
type:
|
|
25
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
26
26
|
isOptional: false;
|
|
27
27
|
};
|
|
28
28
|
jurisdiction: {
|
|
29
|
-
type:
|
|
29
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
30
30
|
isOptional: false;
|
|
31
31
|
};
|
|
32
32
|
status: {
|
|
33
|
-
type:
|
|
33
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
34
34
|
isOptional: false;
|
|
35
35
|
};
|
|
36
36
|
}>>;
|
|
37
|
-
declare const KbRuleVersionApprovedEvent: _lssm_lib_contracts0.EventSpec<
|
|
37
|
+
declare const KbRuleVersionApprovedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
|
|
38
38
|
ruleVersionId: {
|
|
39
|
-
type:
|
|
39
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
40
40
|
isOptional: false;
|
|
41
41
|
};
|
|
42
42
|
approver: {
|
|
43
|
-
type:
|
|
43
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
44
44
|
isOptional: false;
|
|
45
45
|
};
|
|
46
46
|
}>>;
|
|
47
|
-
declare const KbSnapshotPublishedEvent: _lssm_lib_contracts0.EventSpec<
|
|
47
|
+
declare const KbSnapshotPublishedEvent: _lssm_lib_contracts0.EventSpec<_lssm_lib_schema0.SchemaModel<{
|
|
48
48
|
snapshotId: {
|
|
49
|
-
type:
|
|
49
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
50
50
|
isOptional: false;
|
|
51
51
|
};
|
|
52
52
|
jurisdiction: {
|
|
53
|
-
type:
|
|
53
|
+
type: _lssm_lib_schema0.FieldType<string, string>;
|
|
54
54
|
isOptional: false;
|
|
55
55
|
};
|
|
56
56
|
includedRuleVersionsCount: {
|
|
57
|
-
type:
|
|
57
|
+
type: _lssm_lib_schema0.FieldType<number, number>;
|
|
58
58
|
isOptional: false;
|
|
59
59
|
};
|
|
60
60
|
}>>;
|
package/dist/events.js
CHANGED
|
@@ -1 +1,106 @@
|
|
|
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 KbSourceIngestedPayload = defineSchemaModel({
|
|
9
|
+
name: "KbSourceIngestedPayload",
|
|
10
|
+
description: "Emitted when a source document is ingested.",
|
|
11
|
+
fields: {
|
|
12
|
+
sourceDocumentId: {
|
|
13
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
14
|
+
isOptional: false
|
|
15
|
+
},
|
|
16
|
+
jurisdiction: {
|
|
17
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
18
|
+
isOptional: false
|
|
19
|
+
},
|
|
20
|
+
hash: {
|
|
21
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
22
|
+
isOptional: false
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
const KbSourceIngestedEvent = defineEvent({
|
|
27
|
+
name: "kb.source.ingested",
|
|
28
|
+
version: 1,
|
|
29
|
+
description: "Source document ingested (immutable).",
|
|
30
|
+
payload: KbSourceIngestedPayload
|
|
31
|
+
});
|
|
32
|
+
const KbRuleVersionCreatedPayload = defineSchemaModel({
|
|
33
|
+
name: "KbRuleVersionCreatedPayload",
|
|
34
|
+
description: "Emitted when a rule version draft is created.",
|
|
35
|
+
fields: {
|
|
36
|
+
ruleVersionId: {
|
|
37
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
38
|
+
isOptional: false
|
|
39
|
+
},
|
|
40
|
+
ruleId: {
|
|
41
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
42
|
+
isOptional: false
|
|
43
|
+
},
|
|
44
|
+
jurisdiction: {
|
|
45
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
46
|
+
isOptional: false
|
|
47
|
+
},
|
|
48
|
+
status: {
|
|
49
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
50
|
+
isOptional: false
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
const KbRuleVersionCreatedEvent = defineEvent({
|
|
55
|
+
name: "kb.ruleVersion.created",
|
|
56
|
+
version: 1,
|
|
57
|
+
description: "Rule version created (draft).",
|
|
58
|
+
payload: KbRuleVersionCreatedPayload
|
|
59
|
+
});
|
|
60
|
+
const KbRuleVersionApprovedPayload = defineSchemaModel({
|
|
61
|
+
name: "KbRuleVersionApprovedPayload",
|
|
62
|
+
description: "Emitted when a rule version is approved.",
|
|
63
|
+
fields: {
|
|
64
|
+
ruleVersionId: {
|
|
65
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
66
|
+
isOptional: false
|
|
67
|
+
},
|
|
68
|
+
approver: {
|
|
69
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
70
|
+
isOptional: false
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
const KbRuleVersionApprovedEvent = defineEvent({
|
|
75
|
+
name: "kb.ruleVersion.approved",
|
|
76
|
+
version: 1,
|
|
77
|
+
description: "Rule version approved (human verified).",
|
|
78
|
+
payload: KbRuleVersionApprovedPayload
|
|
79
|
+
});
|
|
80
|
+
const KbSnapshotPublishedPayload = defineSchemaModel({
|
|
81
|
+
name: "KbSnapshotPublishedPayload",
|
|
82
|
+
description: "Emitted when a KB snapshot is published.",
|
|
83
|
+
fields: {
|
|
84
|
+
snapshotId: {
|
|
85
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
86
|
+
isOptional: false
|
|
87
|
+
},
|
|
88
|
+
jurisdiction: {
|
|
89
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
90
|
+
isOptional: false
|
|
91
|
+
},
|
|
92
|
+
includedRuleVersionsCount: {
|
|
93
|
+
type: ScalarTypeEnum.Int_unsecure(),
|
|
94
|
+
isOptional: false
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
const KbSnapshotPublishedEvent = defineEvent({
|
|
99
|
+
name: "kb.snapshot.published",
|
|
100
|
+
version: 1,
|
|
101
|
+
description: "KB snapshot published.",
|
|
102
|
+
payload: KbSnapshotPublishedPayload
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
//#endregion
|
|
106
|
+
export { KbRuleVersionApprovedEvent, KbRuleVersionCreatedEvent, KbSnapshotPublishedEvent, KbSourceIngestedEvent };
|
package/dist/example.js
CHANGED
|
@@ -1 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/example.ts
|
|
2
|
+
const example = {
|
|
3
|
+
id: "versioned-knowledge-base",
|
|
4
|
+
title: "Versioned Knowledge Base",
|
|
5
|
+
summary: "Curated KB with immutable sources, reviewable rule versions, and published snapshots.",
|
|
6
|
+
tags: [
|
|
7
|
+
"knowledge",
|
|
8
|
+
"versioning",
|
|
9
|
+
"snapshots"
|
|
10
|
+
],
|
|
11
|
+
kind: "knowledge",
|
|
12
|
+
visibility: "public",
|
|
13
|
+
docs: { rootDocId: "docs.examples.versioned-knowledge-base" },
|
|
14
|
+
entrypoints: {
|
|
15
|
+
packageName: "@lssm/example.versioned-knowledge-base",
|
|
16
|
+
feature: "./feature",
|
|
17
|
+
contracts: "./contracts",
|
|
18
|
+
handlers: "./handlers",
|
|
19
|
+
docs: "./docs"
|
|
20
|
+
},
|
|
21
|
+
surfaces: {
|
|
22
|
+
templates: true,
|
|
23
|
+
sandbox: {
|
|
24
|
+
enabled: true,
|
|
25
|
+
modes: [
|
|
26
|
+
"markdown",
|
|
27
|
+
"specs",
|
|
28
|
+
"builder"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
studio: {
|
|
32
|
+
enabled: true,
|
|
33
|
+
installable: true
|
|
34
|
+
},
|
|
35
|
+
mcp: { enabled: true }
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var example_default = example;
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
export { example_default as default };
|
package/dist/handlers/index.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
import{createMemoryKbHandlers
|
|
1
|
+
import { createMemoryKbHandlers, createMemoryKbStore } from "./memory.handlers.js";
|
|
2
|
+
|
|
3
|
+
export { createMemoryKbHandlers, createMemoryKbStore };
|
|
@@ -1 +1,103 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/handlers/memory.handlers.ts
|
|
2
|
+
function createMemoryKbStore() {
|
|
3
|
+
return {
|
|
4
|
+
sources: /* @__PURE__ */ new Map(),
|
|
5
|
+
rules: /* @__PURE__ */ new Map(),
|
|
6
|
+
ruleVersions: /* @__PURE__ */ new Map(),
|
|
7
|
+
snapshots: /* @__PURE__ */ new Map(),
|
|
8
|
+
nextRuleVersionNumberByRuleId: /* @__PURE__ */ new Map()
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function stableId(prefix, value) {
|
|
12
|
+
return `${prefix}_${value.replace(/[^a-zA-Z0-9_-]/g, "_")}`;
|
|
13
|
+
}
|
|
14
|
+
function createMemoryKbHandlers(store) {
|
|
15
|
+
async function createRule(rule) {
|
|
16
|
+
store.rules.set(rule.id, rule);
|
|
17
|
+
return rule;
|
|
18
|
+
}
|
|
19
|
+
async function ingestSource(input) {
|
|
20
|
+
const id = stableId("src", `${input.jurisdiction}_${input.hash}`);
|
|
21
|
+
const doc = {
|
|
22
|
+
id,
|
|
23
|
+
...input
|
|
24
|
+
};
|
|
25
|
+
store.sources.set(id, doc);
|
|
26
|
+
return doc;
|
|
27
|
+
}
|
|
28
|
+
async function upsertRuleVersion(input) {
|
|
29
|
+
if (!input.sourceRefs.length) throw new Error("SOURCE_REFS_REQUIRED");
|
|
30
|
+
const rule = store.rules.get(input.ruleId);
|
|
31
|
+
if (!rule) throw new Error("RULE_NOT_FOUND");
|
|
32
|
+
const next = (store.nextRuleVersionNumberByRuleId.get(input.ruleId) ?? 0) + 1;
|
|
33
|
+
store.nextRuleVersionNumberByRuleId.set(input.ruleId, next);
|
|
34
|
+
const id = stableId("rv", `${input.ruleId}_${next}`);
|
|
35
|
+
const ruleVersion = {
|
|
36
|
+
id,
|
|
37
|
+
ruleId: input.ruleId,
|
|
38
|
+
jurisdiction: rule.jurisdiction,
|
|
39
|
+
topicKey: rule.topicKey,
|
|
40
|
+
version: next,
|
|
41
|
+
content: input.content,
|
|
42
|
+
sourceRefs: input.sourceRefs,
|
|
43
|
+
status: "draft",
|
|
44
|
+
createdAt: /* @__PURE__ */ new Date(),
|
|
45
|
+
approvedAt: void 0,
|
|
46
|
+
approvedBy: void 0
|
|
47
|
+
};
|
|
48
|
+
store.ruleVersions.set(id, ruleVersion);
|
|
49
|
+
return ruleVersion;
|
|
50
|
+
}
|
|
51
|
+
async function approveRuleVersion(input) {
|
|
52
|
+
const existing = store.ruleVersions.get(input.ruleVersionId);
|
|
53
|
+
if (!existing) throw new Error("RULE_VERSION_NOT_FOUND");
|
|
54
|
+
const approved = {
|
|
55
|
+
...existing,
|
|
56
|
+
status: "approved",
|
|
57
|
+
approvedBy: input.approver,
|
|
58
|
+
approvedAt: /* @__PURE__ */ new Date()
|
|
59
|
+
};
|
|
60
|
+
store.ruleVersions.set(approved.id, approved);
|
|
61
|
+
return approved;
|
|
62
|
+
}
|
|
63
|
+
async function publishSnapshot(input) {
|
|
64
|
+
const approved = [...store.ruleVersions.values()].filter((rv) => rv.status === "approved" && rv.jurisdiction === input.jurisdiction);
|
|
65
|
+
if (approved.length === 0) throw new Error("NO_APPROVED_RULES");
|
|
66
|
+
const includedRuleVersionIds = approved.map((rv) => rv.id).sort();
|
|
67
|
+
const id = stableId("snap", `${input.jurisdiction}_${input.asOfDate.toISOString().slice(0, 10)}_${includedRuleVersionIds.length}`);
|
|
68
|
+
const snapshot = {
|
|
69
|
+
id,
|
|
70
|
+
jurisdiction: input.jurisdiction,
|
|
71
|
+
asOfDate: input.asOfDate,
|
|
72
|
+
includedRuleVersionIds,
|
|
73
|
+
publishedAt: /* @__PURE__ */ new Date()
|
|
74
|
+
};
|
|
75
|
+
store.snapshots.set(id, snapshot);
|
|
76
|
+
return snapshot;
|
|
77
|
+
}
|
|
78
|
+
async function search(input) {
|
|
79
|
+
const snapshot = store.snapshots.get(input.snapshotId);
|
|
80
|
+
if (!snapshot) throw new Error("SNAPSHOT_NOT_FOUND");
|
|
81
|
+
if (snapshot.jurisdiction !== input.jurisdiction) throw new Error("JURISDICTION_MISMATCH");
|
|
82
|
+
const tokens = input.query.toLowerCase().split(/\s+/).map((t) => t.trim()).filter(Boolean);
|
|
83
|
+
return { items: snapshot.includedRuleVersionIds.map((id) => store.ruleVersions.get(id)).filter((rv) => Boolean(rv)).filter((rv) => {
|
|
84
|
+
if (tokens.length === 0) return true;
|
|
85
|
+
const hay = rv.content.toLowerCase();
|
|
86
|
+
return tokens.every((token) => hay.includes(token));
|
|
87
|
+
}).map((rv) => ({
|
|
88
|
+
ruleVersionId: rv.id,
|
|
89
|
+
excerpt: rv.content.slice(0, 120)
|
|
90
|
+
})) };
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
createRule,
|
|
94
|
+
ingestSource,
|
|
95
|
+
upsertRuleVersion,
|
|
96
|
+
approveRuleVersion,
|
|
97
|
+
publishSnapshot,
|
|
98
|
+
search
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
//#endregion
|
|
103
|
+
export { createMemoryKbHandlers, createMemoryKbStore };
|