@lssm/example.versioned-knowledge-base 0.0.0-canary-20251217062943 → 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.
Files changed (140) hide show
  1. package/.turbo/turbo-build$colon$bundle.log +225 -191
  2. package/.turbo/turbo-build.log +226 -37
  3. package/CHANGELOG.md +3 -3
  4. package/dist/contracts/index.js +3 -1
  5. package/dist/contracts/kb.d.ts +70 -70
  6. package/dist/contracts/kb.js +253 -1
  7. package/dist/docs/index.js +1 -1
  8. package/dist/docs/versioned-knowledge-base.docblock.js +29 -18
  9. package/dist/entities/index.js +3 -1
  10. package/dist/entities/models.d.ts +36 -36
  11. package/dist/entities/models.js +152 -1
  12. package/dist/events.js +106 -1
  13. package/dist/example.js +41 -1
  14. package/dist/handlers/index.js +3 -1
  15. package/dist/handlers/memory.handlers.js +103 -1
  16. package/dist/index.js +11 -1
  17. package/dist/libs/contracts/dist/capabilities/openbanking.js +88 -1
  18. package/dist/libs/contracts/dist/client/index.js +5 -1
  19. package/dist/libs/contracts/dist/client/react/feature-render.js +2 -1
  20. package/dist/libs/contracts/dist/client/react/form-render.js +4 -1
  21. package/dist/libs/contracts/dist/client/react/index.js +4 -1
  22. package/dist/libs/contracts/dist/contract-registry/index.js +1 -1
  23. package/dist/libs/contracts/dist/contract-registry/schemas.js +60 -1
  24. package/dist/libs/contracts/dist/docs/PUBLISHING.docblock.js +16 -76
  25. package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +16 -350
  26. package/dist/libs/contracts/dist/docs/index.js +29 -1
  27. package/dist/libs/contracts/dist/docs/presentations.js +71 -1
  28. package/dist/libs/contracts/dist/docs/registry.js +44 -1
  29. package/dist/libs/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +16 -383
  30. package/dist/libs/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +16 -68
  31. package/dist/libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +16 -140
  32. package/dist/libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +16 -86
  33. package/dist/libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +16 -1
  34. package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +24 -2
  35. package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +21 -2
  36. package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +16 -213
  37. package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +73 -5
  38. package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +37 -1
  39. package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +16 -1
  40. package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +20 -262
  41. package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +48 -1
  42. package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +24 -2
  43. package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +23 -2
  44. package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +25 -16
  45. package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +67 -1
  46. package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +22 -2
  47. package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +40 -36
  48. package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +47 -1
  49. package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +23 -2
  50. package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +36 -3
  51. package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +20 -1
  52. package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +36 -3
  53. package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +20 -1
  54. package/dist/libs/contracts/dist/events.js +10 -1
  55. package/dist/libs/contracts/dist/experiments/evaluator.js +1 -1
  56. package/dist/libs/contracts/dist/index.js +71 -1
  57. package/dist/libs/contracts/dist/install.js +2 -1
  58. package/dist/libs/contracts/dist/integrations/contracts.js +377 -1
  59. package/dist/libs/contracts/dist/integrations/index.js +18 -1
  60. package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js +228 -1
  61. package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js +159 -1
  62. package/dist/libs/contracts/dist/integrations/openbanking/contracts/index.js +3 -1
  63. package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js +210 -1
  64. package/dist/libs/contracts/dist/integrations/openbanking/models.js +242 -1
  65. package/dist/libs/contracts/dist/integrations/openbanking/telemetry.js +13 -1
  66. package/dist/libs/contracts/dist/integrations/providers/elevenlabs.js +52 -1
  67. package/dist/libs/contracts/dist/integrations/providers/gcs-storage.js +75 -1
  68. package/dist/libs/contracts/dist/integrations/providers/gmail.js +87 -1
  69. package/dist/libs/contracts/dist/integrations/providers/google-calendar.js +66 -1
  70. package/dist/libs/contracts/dist/integrations/providers/index.js +11 -1
  71. package/dist/libs/contracts/dist/integrations/providers/mistral.js +68 -1
  72. package/dist/libs/contracts/dist/integrations/providers/postmark.js +68 -1
  73. package/dist/libs/contracts/dist/integrations/providers/powens.js +116 -1
  74. package/dist/libs/contracts/dist/integrations/providers/qdrant.js +73 -1
  75. package/dist/libs/contracts/dist/integrations/providers/registry.js +10 -1
  76. package/dist/libs/contracts/dist/integrations/providers/stripe.js +83 -1
  77. package/dist/libs/contracts/dist/integrations/providers/twilio-sms.js +61 -1
  78. package/dist/libs/contracts/dist/jsonschema.js +1 -1
  79. package/dist/libs/contracts/dist/knowledge/contracts.js +306 -1
  80. package/dist/libs/contracts/dist/knowledge/index.js +7 -1
  81. package/dist/libs/contracts/dist/knowledge/spaces/email-threads.js +34 -1
  82. package/dist/libs/contracts/dist/knowledge/spaces/financial-docs.js +34 -1
  83. package/dist/libs/contracts/dist/knowledge/spaces/financial-overview.js +38 -1
  84. package/dist/libs/contracts/dist/knowledge/spaces/index.js +6 -1
  85. package/dist/libs/contracts/dist/knowledge/spaces/product-canon.js +34 -1
  86. package/dist/libs/contracts/dist/knowledge/spaces/support-faq.js +37 -1
  87. package/dist/libs/contracts/dist/knowledge/spaces/uploaded-docs.js +34 -1
  88. package/dist/libs/contracts/dist/llm/exporters.js +19 -1
  89. package/dist/libs/contracts/dist/llm/index.js +2 -1
  90. package/dist/libs/contracts/dist/llm/prompts.js +1 -1
  91. package/dist/libs/contracts/dist/onboarding-base.js +196 -1
  92. package/dist/libs/contracts/dist/openapi.js +1 -1
  93. package/dist/libs/contracts/dist/ownership.js +21 -1
  94. package/dist/libs/contracts/dist/presentations.js +1 -1
  95. package/dist/libs/contracts/dist/presentations.v2.js +11 -1
  96. package/dist/libs/contracts/dist/prompt.js +1 -1
  97. package/dist/libs/contracts/dist/promptRegistry.js +1 -1
  98. package/dist/libs/contracts/dist/regenerator/index.js +1 -1
  99. package/dist/libs/contracts/dist/regenerator/service.js +6 -1
  100. package/dist/libs/contracts/dist/registry.js +2 -1
  101. package/dist/libs/contracts/dist/resources.js +1 -1
  102. package/dist/libs/contracts/dist/schema/dist/EnumType.js +2 -1
  103. package/dist/libs/contracts/dist/schema/dist/FieldType.js +49 -1
  104. package/dist/libs/contracts/dist/schema/dist/ScalarTypeEnum.js +236 -1
  105. package/dist/libs/contracts/dist/schema/dist/SchemaModel.js +39 -1
  106. package/dist/libs/contracts/dist/schema/dist/entity/defineEntity.js +1 -1
  107. package/dist/libs/contracts/dist/schema/dist/entity/index.js +2 -1
  108. package/dist/libs/contracts/dist/schema/dist/entity/types.js +1 -1
  109. package/dist/libs/contracts/dist/schema/dist/index.js +6 -1
  110. package/dist/libs/contracts/dist/server/graphql-pothos.js +6 -1
  111. package/dist/libs/contracts/dist/server/index.js +8 -1
  112. package/dist/libs/contracts/dist/server/mcp/createMcpServer.js +4 -1
  113. package/dist/libs/contracts/dist/server/mcp/registerPresentations.js +2 -1
  114. package/dist/libs/contracts/dist/server/mcp/registerPrompts.js +1 -1
  115. package/dist/libs/contracts/dist/server/mcp/registerResources.js +2 -1
  116. package/dist/libs/contracts/dist/server/mcp/registerTools.js +1 -1
  117. package/dist/libs/contracts/dist/server/provider-mcp.js +1 -1
  118. package/dist/libs/contracts/dist/server/rest-elysia.js +1 -1
  119. package/dist/libs/contracts/dist/server/rest-express.js +1 -1
  120. package/dist/libs/contracts/dist/server/rest-generic.js +1 -1
  121. package/dist/libs/contracts/dist/server/rest-next-app.js +1 -1
  122. package/dist/libs/contracts/dist/server/rest-next-pages.js +1 -1
  123. package/dist/libs/contracts/dist/spec.js +34 -1
  124. package/dist/libs/contracts/dist/telemetry/index.js +1 -1
  125. package/dist/libs/contracts/dist/telemetry/tracker.js +1 -1
  126. package/dist/libs/contracts/dist/tests/index.js +1 -1
  127. package/dist/libs/contracts/dist/tests/runner.js +2 -1
  128. package/dist/libs/contracts/dist/workflow/index.js +1 -1
  129. package/dist/libs/contracts/dist/workflow/runner.js +1 -1
  130. package/dist/libs/schema/dist/EnumType.js +2 -1
  131. package/dist/libs/schema/dist/FieldType.js +49 -1
  132. package/dist/libs/schema/dist/ScalarTypeEnum.js +236 -1
  133. package/dist/libs/schema/dist/SchemaModel.js +39 -1
  134. package/dist/libs/schema/dist/entity/defineEntity.js +1 -1
  135. package/dist/libs/schema/dist/entity/index.js +2 -1
  136. package/dist/libs/schema/dist/entity/types.js +1 -1
  137. package/dist/libs/schema/dist/index.js +6 -1
  138. package/dist/versioned-knowledge-base.feature.js +66 -1
  139. package/package.json +5 -5
  140. package/tsconfig.tsbuildinfo +1 -1
@@ -1,93 +1,93 @@
1
- import * as _lssm_lib_schema15 from "@lssm/lib.schema";
1
+ import * as _lssm_lib_schema84 from "@lssm/lib.schema";
2
2
 
3
3
  //#region src/entities/models.d.ts
4
- declare const SourceDocumentModel: _lssm_lib_schema15.SchemaModel<{
4
+ declare const SourceDocumentModel: _lssm_lib_schema84.SchemaModel<{
5
5
  id: {
6
- type: _lssm_lib_schema15.FieldType<string, string>;
6
+ type: _lssm_lib_schema84.FieldType<string, string>;
7
7
  isOptional: false;
8
8
  };
9
9
  jurisdiction: {
10
- type: _lssm_lib_schema15.FieldType<string, string>;
10
+ type: _lssm_lib_schema84.FieldType<string, string>;
11
11
  isOptional: false;
12
12
  };
13
13
  authority: {
14
- type: _lssm_lib_schema15.FieldType<string, string>;
14
+ type: _lssm_lib_schema84.FieldType<string, string>;
15
15
  isOptional: false;
16
16
  };
17
17
  title: {
18
- type: _lssm_lib_schema15.FieldType<string, string>;
18
+ type: _lssm_lib_schema84.FieldType<string, string>;
19
19
  isOptional: false;
20
20
  };
21
21
  fetchedAt: {
22
- type: _lssm_lib_schema15.FieldType<Date, string>;
22
+ type: _lssm_lib_schema84.FieldType<Date, string>;
23
23
  isOptional: false;
24
24
  };
25
25
  hash: {
26
- type: _lssm_lib_schema15.FieldType<string, string>;
26
+ type: _lssm_lib_schema84.FieldType<string, string>;
27
27
  isOptional: false;
28
28
  };
29
29
  fileId: {
30
- type: _lssm_lib_schema15.FieldType<string, string>;
30
+ type: _lssm_lib_schema84.FieldType<string, string>;
31
31
  isOptional: false;
32
32
  };
33
33
  }>;
34
- declare const SourceRefModel: _lssm_lib_schema15.SchemaModel<{
34
+ declare const SourceRefModel: _lssm_lib_schema84.SchemaModel<{
35
35
  sourceDocumentId: {
36
- type: _lssm_lib_schema15.FieldType<string, string>;
36
+ type: _lssm_lib_schema84.FieldType<string, string>;
37
37
  isOptional: false;
38
38
  };
39
39
  excerpt: {
40
- type: _lssm_lib_schema15.FieldType<string, string>;
40
+ type: _lssm_lib_schema84.FieldType<string, string>;
41
41
  isOptional: true;
42
42
  };
43
43
  }>;
44
- declare const RuleModel: _lssm_lib_schema15.SchemaModel<{
44
+ declare const RuleModel: _lssm_lib_schema84.SchemaModel<{
45
45
  id: {
46
- type: _lssm_lib_schema15.FieldType<string, string>;
46
+ type: _lssm_lib_schema84.FieldType<string, string>;
47
47
  isOptional: false;
48
48
  };
49
49
  jurisdiction: {
50
- type: _lssm_lib_schema15.FieldType<string, string>;
50
+ type: _lssm_lib_schema84.FieldType<string, string>;
51
51
  isOptional: false;
52
52
  };
53
53
  topicKey: {
54
- type: _lssm_lib_schema15.FieldType<string, string>;
54
+ type: _lssm_lib_schema84.FieldType<string, string>;
55
55
  isOptional: false;
56
56
  };
57
57
  }>;
58
- declare const RuleVersionModel: _lssm_lib_schema15.SchemaModel<{
58
+ declare const RuleVersionModel: _lssm_lib_schema84.SchemaModel<{
59
59
  id: {
60
- type: _lssm_lib_schema15.FieldType<string, string>;
60
+ type: _lssm_lib_schema84.FieldType<string, string>;
61
61
  isOptional: false;
62
62
  };
63
63
  ruleId: {
64
- type: _lssm_lib_schema15.FieldType<string, string>;
64
+ type: _lssm_lib_schema84.FieldType<string, string>;
65
65
  isOptional: false;
66
66
  };
67
67
  jurisdiction: {
68
- type: _lssm_lib_schema15.FieldType<string, string>;
68
+ type: _lssm_lib_schema84.FieldType<string, string>;
69
69
  isOptional: false;
70
70
  };
71
71
  topicKey: {
72
- type: _lssm_lib_schema15.FieldType<string, string>;
72
+ type: _lssm_lib_schema84.FieldType<string, string>;
73
73
  isOptional: false;
74
74
  };
75
75
  version: {
76
- type: _lssm_lib_schema15.FieldType<number, number>;
76
+ type: _lssm_lib_schema84.FieldType<number, number>;
77
77
  isOptional: false;
78
78
  };
79
79
  content: {
80
- type: _lssm_lib_schema15.FieldType<string, string>;
80
+ type: _lssm_lib_schema84.FieldType<string, string>;
81
81
  isOptional: false;
82
82
  };
83
83
  sourceRefs: {
84
- type: _lssm_lib_schema15.SchemaModel<{
84
+ type: _lssm_lib_schema84.SchemaModel<{
85
85
  sourceDocumentId: {
86
- type: _lssm_lib_schema15.FieldType<string, string>;
86
+ type: _lssm_lib_schema84.FieldType<string, string>;
87
87
  isOptional: false;
88
88
  };
89
89
  excerpt: {
90
- type: _lssm_lib_schema15.FieldType<string, string>;
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_schema15.SchemaModel<{
95
95
  isOptional: false;
96
96
  };
97
97
  status: {
98
- type: _lssm_lib_schema15.FieldType<string, string>;
98
+ type: _lssm_lib_schema84.FieldType<string, string>;
99
99
  isOptional: false;
100
100
  };
101
101
  approvedBy: {
102
- type: _lssm_lib_schema15.FieldType<string, string>;
102
+ type: _lssm_lib_schema84.FieldType<string, string>;
103
103
  isOptional: true;
104
104
  };
105
105
  approvedAt: {
106
- type: _lssm_lib_schema15.FieldType<Date, string>;
106
+ type: _lssm_lib_schema84.FieldType<Date, string>;
107
107
  isOptional: true;
108
108
  };
109
109
  createdAt: {
110
- type: _lssm_lib_schema15.FieldType<Date, string>;
110
+ type: _lssm_lib_schema84.FieldType<Date, string>;
111
111
  isOptional: false;
112
112
  };
113
113
  }>;
114
- declare const KBSnapshotModel: _lssm_lib_schema15.SchemaModel<{
114
+ declare const KBSnapshotModel: _lssm_lib_schema84.SchemaModel<{
115
115
  id: {
116
- type: _lssm_lib_schema15.FieldType<string, string>;
116
+ type: _lssm_lib_schema84.FieldType<string, string>;
117
117
  isOptional: false;
118
118
  };
119
119
  jurisdiction: {
120
- type: _lssm_lib_schema15.FieldType<string, string>;
120
+ type: _lssm_lib_schema84.FieldType<string, string>;
121
121
  isOptional: false;
122
122
  };
123
123
  asOfDate: {
124
- type: _lssm_lib_schema15.FieldType<Date, string>;
124
+ type: _lssm_lib_schema84.FieldType<Date, string>;
125
125
  isOptional: false;
126
126
  };
127
127
  includedRuleVersionIds: {
128
- type: _lssm_lib_schema15.FieldType<string, string>;
128
+ type: _lssm_lib_schema84.FieldType<string, string>;
129
129
  isArray: true;
130
130
  isOptional: false;
131
131
  };
132
132
  publishedAt: {
133
- type: _lssm_lib_schema15.FieldType<Date, string>;
133
+ type: _lssm_lib_schema84.FieldType<Date, string>;
134
134
  isOptional: false;
135
135
  };
136
136
  }>;
@@ -1 +1,152 @@
1
- import{l as e}from"../libs/schema/dist/ScalarTypeEnum.js";import{n as t}from"../libs/schema/dist/SchemaModel.js";import"../libs/schema/dist/index.js";const n=t({name:`SourceDocument`,description:`Immutable raw source document metadata referencing a stored file.`,fields:{id:{type:e.String_unsecure(),isOptional:!1},jurisdiction:{type:e.String_unsecure(),isOptional:!1},authority:{type:e.String_unsecure(),isOptional:!1},title:{type:e.String_unsecure(),isOptional:!1},fetchedAt:{type:e.DateTime(),isOptional:!1},hash:{type:e.String_unsecure(),isOptional:!1},fileId:{type:e.String_unsecure(),isOptional:!1}}}),r=t({name:`SourceRef`,description:`Reference to a source document used to justify a rule version.`,fields:{sourceDocumentId:{type:e.String_unsecure(),isOptional:!1},excerpt:{type:e.String_unsecure(),isOptional:!0}}}),i=t({name:`Rule`,description:`Curated rule (stable identity) with topic + jurisdiction scope.`,fields:{id:{type:e.String_unsecure(),isOptional:!1},jurisdiction:{type:e.String_unsecure(),isOptional:!1},topicKey:{type:e.String_unsecure(),isOptional:!1}}}),a=t({name:`RuleVersion`,description:`A versioned rule content with source references and approval status.`,fields:{id:{type:e.String_unsecure(),isOptional:!1},ruleId:{type:e.String_unsecure(),isOptional:!1},jurisdiction:{type:e.String_unsecure(),isOptional:!1},topicKey:{type:e.String_unsecure(),isOptional:!1},version:{type:e.Int_unsecure(),isOptional:!1},content:{type:e.String_unsecure(),isOptional:!1},sourceRefs:{type:r,isArray:!0,isOptional:!1},status:{type:e.String_unsecure(),isOptional:!1},approvedBy:{type:e.String_unsecure(),isOptional:!0},approvedAt:{type:e.DateTime(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1}}}),o=t({name:`KBSnapshot`,description:`Published KB snapshot (as-of) referencing approved rule versions.`,fields:{id:{type:e.String_unsecure(),isOptional:!1},jurisdiction:{type:e.String_unsecure(),isOptional:!1},asOfDate:{type:e.DateTime(),isOptional:!1},includedRuleVersionIds:{type:e.String_unsecure(),isArray:!0,isOptional:!1},publishedAt:{type:e.DateTime(),isOptional:!1}}});export{o as KBSnapshotModel,i as RuleModel,a as RuleVersionModel,n as SourceDocumentModel,r as SourceRefModel};
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.js CHANGED
@@ -1 +1,106 @@
1
- import{n as e}from"./libs/contracts/dist/schema/dist/SchemaModel.js";import{e as t}from"./libs/contracts/dist/events.js";import"./libs/contracts/dist/index.js";import{l as n}from"./libs/schema/dist/ScalarTypeEnum.js";import"./libs/schema/dist/index.js";const r=t({name:`kb.source.ingested`,version:1,description:`Source document ingested (immutable).`,payload:e({name:`KbSourceIngestedPayload`,description:`Emitted when a source document is ingested.`,fields:{sourceDocumentId:{type:n.String_unsecure(),isOptional:!1},jurisdiction:{type:n.String_unsecure(),isOptional:!1},hash:{type:n.String_unsecure(),isOptional:!1}}})}),i=t({name:`kb.ruleVersion.created`,version:1,description:`Rule version created (draft).`,payload:e({name:`KbRuleVersionCreatedPayload`,description:`Emitted when a rule version draft is created.`,fields:{ruleVersionId:{type:n.String_unsecure(),isOptional:!1},ruleId:{type:n.String_unsecure(),isOptional:!1},jurisdiction:{type:n.String_unsecure(),isOptional:!1},status:{type:n.String_unsecure(),isOptional:!1}}})}),a=t({name:`kb.ruleVersion.approved`,version:1,description:`Rule version approved (human verified).`,payload:e({name:`KbRuleVersionApprovedPayload`,description:`Emitted when a rule version is approved.`,fields:{ruleVersionId:{type:n.String_unsecure(),isOptional:!1},approver:{type:n.String_unsecure(),isOptional:!1}}})}),o=t({name:`kb.snapshot.published`,version:1,description:`KB snapshot published.`,payload:e({name:`KbSnapshotPublishedPayload`,description:`Emitted when a KB snapshot is published.`,fields:{snapshotId:{type:n.String_unsecure(),isOptional:!1},jurisdiction:{type:n.String_unsecure(),isOptional:!1},includedRuleVersionsCount:{type:n.Int_unsecure(),isOptional:!1}}})});export{a as KbRuleVersionApprovedEvent,i as KbRuleVersionCreatedEvent,o as KbSnapshotPublishedEvent,r as KbSourceIngestedEvent};
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
- var e={id:`versioned-knowledge-base`,title:`Versioned Knowledge Base`,summary:`Curated KB with immutable sources, reviewable rule versions, and published snapshots.`,tags:[`knowledge`,`versioning`,`snapshots`],kind:`knowledge`,visibility:`public`,docs:{rootDocId:`docs.examples.versioned-knowledge-base`},entrypoints:{packageName:`@lssm/example.versioned-knowledge-base`,feature:`./feature`,contracts:`./contracts`,handlers:`./handlers`,docs:`./docs`},surfaces:{templates:!0,sandbox:{enabled:!0,modes:[`markdown`,`specs`,`builder`]},studio:{enabled:!0,installable:!0},mcp:{enabled:!0}}};export{e as default};
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 };
@@ -1 +1,3 @@
1
- import{createMemoryKbHandlers as e,createMemoryKbStore as t}from"./memory.handlers.js";export{e as createMemoryKbHandlers,t as createMemoryKbStore};
1
+ import { createMemoryKbHandlers, createMemoryKbStore } from "./memory.handlers.js";
2
+
3
+ export { createMemoryKbHandlers, createMemoryKbStore };
@@ -1 +1,103 @@
1
- function e(){return{sources:new Map,rules:new Map,ruleVersions:new Map,snapshots:new Map,nextRuleVersionNumberByRuleId:new Map}}function t(e,t){return`${e}_${t.replace(/[^a-zA-Z0-9_-]/g,`_`)}`}function n(e){async function n(t){return e.rules.set(t.id,t),t}async function r(n){let r=t(`src`,`${n.jurisdiction}_${n.hash}`),i={id:r,...n};return e.sources.set(r,i),i}async function i(n){if(!n.sourceRefs.length)throw Error(`SOURCE_REFS_REQUIRED`);let r=e.rules.get(n.ruleId);if(!r)throw Error(`RULE_NOT_FOUND`);let i=(e.nextRuleVersionNumberByRuleId.get(n.ruleId)??0)+1;e.nextRuleVersionNumberByRuleId.set(n.ruleId,i);let a=t(`rv`,`${n.ruleId}_${i}`),o={id:a,ruleId:n.ruleId,jurisdiction:r.jurisdiction,topicKey:r.topicKey,version:i,content:n.content,sourceRefs:n.sourceRefs,status:`draft`,createdAt:new Date,approvedAt:void 0,approvedBy:void 0};return e.ruleVersions.set(a,o),o}async function a(t){let n=e.ruleVersions.get(t.ruleVersionId);if(!n)throw Error(`RULE_VERSION_NOT_FOUND`);let r={...n,status:`approved`,approvedBy:t.approver,approvedAt:new Date};return e.ruleVersions.set(r.id,r),r}async function o(n){let r=[...e.ruleVersions.values()].filter(e=>e.status===`approved`&&e.jurisdiction===n.jurisdiction);if(r.length===0)throw Error(`NO_APPROVED_RULES`);let i=r.map(e=>e.id).sort(),a=t(`snap`,`${n.jurisdiction}_${n.asOfDate.toISOString().slice(0,10)}_${i.length}`),o={id:a,jurisdiction:n.jurisdiction,asOfDate:n.asOfDate,includedRuleVersionIds:i,publishedAt:new Date};return e.snapshots.set(a,o),o}async function s(t){let n=e.snapshots.get(t.snapshotId);if(!n)throw Error(`SNAPSHOT_NOT_FOUND`);if(n.jurisdiction!==t.jurisdiction)throw Error(`JURISDICTION_MISMATCH`);let r=t.query.toLowerCase().split(/\s+/).map(e=>e.trim()).filter(Boolean);return{items:n.includedRuleVersionIds.map(t=>e.ruleVersions.get(t)).filter(e=>!!e).filter(e=>{if(r.length===0)return!0;let t=e.content.toLowerCase();return r.every(e=>t.includes(e))}).map(e=>({ruleVersionId:e.id,excerpt:e.content.slice(0,120)}))}}return{createRule:n,ingestSource:r,upsertRuleVersion:i,approveRuleVersion:a,publishSnapshot:o,search:s}}export{n as createMemoryKbHandlers,e as createMemoryKbStore};
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 };
package/dist/index.js CHANGED
@@ -1 +1,11 @@
1
- import{KbRuleVersionApprovedEvent as e,KbRuleVersionCreatedEvent as t,KbSnapshotPublishedEvent as n,KbSourceIngestedEvent as r}from"./events.js";import i from"./example.js";import{KBSnapshotModel as a,RuleModel as o,RuleVersionModel as s,SourceDocumentModel as c,SourceRefModel as l}from"./entities/models.js";import"./entities/index.js";import{KbApproveRuleVersionContract as u,KbIngestSourceContract as d,KbPublishSnapshotContract as f,KbSearchContract as p,KbUpsertRuleVersionContract as m}from"./contracts/kb.js";import"./contracts/index.js";import{createMemoryKbHandlers as h,createMemoryKbStore as g}from"./handlers/memory.handlers.js";import{VersionedKnowledgeBaseFeature as _}from"./versioned-knowledge-base.feature.js";import"./docs/index.js";export{a as KBSnapshotModel,u as KbApproveRuleVersionContract,d as KbIngestSourceContract,f as KbPublishSnapshotContract,e as KbRuleVersionApprovedEvent,t as KbRuleVersionCreatedEvent,p as KbSearchContract,n as KbSnapshotPublishedEvent,r as KbSourceIngestedEvent,m as KbUpsertRuleVersionContract,o as RuleModel,s as RuleVersionModel,c as SourceDocumentModel,l as SourceRefModel,_ as VersionedKnowledgeBaseFeature,h as createMemoryKbHandlers,g as createMemoryKbStore,i as example};
1
+ import { KbRuleVersionApprovedEvent, KbRuleVersionCreatedEvent, KbSnapshotPublishedEvent, KbSourceIngestedEvent } from "./events.js";
2
+ import example_default from "./example.js";
3
+ import { KBSnapshotModel, RuleModel, RuleVersionModel, SourceDocumentModel, SourceRefModel } from "./entities/models.js";
4
+ import "./entities/index.js";
5
+ import { KbApproveRuleVersionContract, KbIngestSourceContract, KbPublishSnapshotContract, KbSearchContract, KbUpsertRuleVersionContract } from "./contracts/kb.js";
6
+ import "./contracts/index.js";
7
+ import { createMemoryKbHandlers, createMemoryKbStore } from "./handlers/memory.handlers.js";
8
+ import { VersionedKnowledgeBaseFeature } from "./versioned-knowledge-base.feature.js";
9
+ import "./docs/index.js";
10
+
11
+ export { KBSnapshotModel, KbApproveRuleVersionContract, KbIngestSourceContract, KbPublishSnapshotContract, KbRuleVersionApprovedEvent, KbRuleVersionCreatedEvent, KbSearchContract, KbSnapshotPublishedEvent, KbSourceIngestedEvent, KbUpsertRuleVersionContract, RuleModel, RuleVersionModel, SourceDocumentModel, SourceRefModel, VersionedKnowledgeBaseFeature, createMemoryKbHandlers, createMemoryKbStore, example_default as example };