@contractspec/example.versioned-knowledge-base 3.7.16 → 3.7.18
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.log +42 -42
- package/CHANGELOG.md +22 -0
- package/dist/browser/docs/index.js +3 -27
- package/dist/browser/docs/versioned-knowledge-base.docblock.js +3 -27
- package/dist/browser/entities/index.js +1 -74
- package/dist/browser/entities/models.js +1 -74
- package/dist/browser/events.js +1 -101
- package/dist/browser/example.js +1 -35
- package/dist/browser/handlers/index.js +1 -115
- package/dist/browser/handlers/memory.handlers.js +1 -115
- package/dist/browser/index.js +4 -617
- package/dist/browser/knowledge-snapshot-publication.migration.js +2 -44
- package/dist/browser/operations/index.js +1 -257
- package/dist/browser/operations/kb.js +1 -257
- package/dist/browser/versioned-knowledge-base.feature.js +1 -41
- package/dist/docs/index.js +3 -27
- package/dist/docs/versioned-knowledge-base.docblock.js +3 -27
- package/dist/entities/index.js +1 -74
- package/dist/entities/models.js +1 -74
- package/dist/events.js +1 -101
- package/dist/example.js +1 -35
- package/dist/handlers/index.js +1 -115
- package/dist/handlers/memory.handlers.js +1 -115
- package/dist/index.js +4 -617
- package/dist/knowledge-snapshot-publication.migration.js +2 -44
- package/dist/node/docs/index.js +3 -27
- package/dist/node/docs/versioned-knowledge-base.docblock.js +3 -27
- package/dist/node/entities/index.js +1 -74
- package/dist/node/entities/models.js +1 -74
- package/dist/node/events.js +1 -101
- package/dist/node/example.js +1 -35
- package/dist/node/handlers/index.js +1 -115
- package/dist/node/handlers/memory.handlers.js +1 -115
- package/dist/node/index.js +4 -617
- package/dist/node/knowledge-snapshot-publication.migration.js +2 -44
- package/dist/node/operations/index.js +1 -257
- package/dist/node/operations/kb.js +1 -257
- package/dist/node/versioned-knowledge-base.feature.js +1 -41
- package/dist/operations/index.js +1 -257
- package/dist/operations/kb.js +1 -257
- package/dist/versioned-knowledge-base.feature.js +1 -41
- package/package.json +7 -7
package/dist/operations/index.js
CHANGED
|
@@ -1,258 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
|
|
3
|
-
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
4
|
-
var SourceDocumentModel = defineSchemaModel({
|
|
5
|
-
name: "SourceDocument",
|
|
6
|
-
description: "Immutable raw source document metadata referencing a stored file.",
|
|
7
|
-
fields: {
|
|
8
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
9
|
-
jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
10
|
-
authority: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
11
|
-
title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
12
|
-
fetchedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
13
|
-
hash: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
14
|
-
fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
var SourceRefModel = defineSchemaModel({
|
|
18
|
-
name: "SourceRef",
|
|
19
|
-
description: "Reference to a source document used to justify a rule version.",
|
|
20
|
-
fields: {
|
|
21
|
-
sourceDocumentId: {
|
|
22
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
23
|
-
isOptional: false
|
|
24
|
-
},
|
|
25
|
-
excerpt: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
var RuleModel = defineSchemaModel({
|
|
29
|
-
name: "Rule",
|
|
30
|
-
description: "Curated rule (stable identity) with topic + jurisdiction scope.",
|
|
31
|
-
fields: {
|
|
32
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
33
|
-
jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
34
|
-
topicKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
var RuleVersionModel = defineSchemaModel({
|
|
38
|
-
name: "RuleVersion",
|
|
39
|
-
description: "A versioned rule content with source references and approval status.",
|
|
40
|
-
fields: {
|
|
41
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
42
|
-
ruleId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
43
|
-
jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
44
|
-
topicKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
45
|
-
version: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
46
|
-
content: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
47
|
-
sourceRefs: { type: SourceRefModel, isArray: true, isOptional: false },
|
|
48
|
-
status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
49
|
-
approvedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
50
|
-
approvedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
51
|
-
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
var KBSnapshotModel = defineSchemaModel({
|
|
55
|
-
name: "KBSnapshot",
|
|
56
|
-
description: "Published KB snapshot (as-of) referencing approved rule versions.",
|
|
57
|
-
fields: {
|
|
58
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
59
|
-
jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
60
|
-
asOfDate: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
61
|
-
includedRuleVersionIds: {
|
|
62
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
63
|
-
isArray: true,
|
|
64
|
-
isOptional: false
|
|
65
|
-
},
|
|
66
|
-
publishedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
// src/operations/kb.ts
|
|
71
|
-
import { defineCommand, defineQuery } from "@contractspec/lib.contracts-spec";
|
|
72
|
-
import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
|
|
73
|
-
var IngestSourceInput = defineSchemaModel2({
|
|
74
|
-
name: "KbIngestSourceInput",
|
|
75
|
-
description: "Ingest immutable source metadata referencing a stored file.",
|
|
76
|
-
fields: {
|
|
77
|
-
jurisdiction: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
78
|
-
authority: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
79
|
-
title: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
80
|
-
fetchedAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false },
|
|
81
|
-
hash: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
82
|
-
fileId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
var UpsertRuleVersionInput = defineSchemaModel2({
|
|
86
|
-
name: "KbUpsertRuleVersionInput",
|
|
87
|
-
description: "Create a new draft rule version (immutable history).",
|
|
88
|
-
fields: {
|
|
89
|
-
ruleId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
90
|
-
content: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
91
|
-
sourceRefs: { type: SourceRefModel, isArray: true, isOptional: false }
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
var ApproveRuleVersionInput = defineSchemaModel2({
|
|
95
|
-
name: "KbApproveRuleVersionInput",
|
|
96
|
-
description: "Approve a rule version (human verification).",
|
|
97
|
-
fields: {
|
|
98
|
-
ruleVersionId: {
|
|
99
|
-
type: ScalarTypeEnum2.String_unsecure(),
|
|
100
|
-
isOptional: false
|
|
101
|
-
},
|
|
102
|
-
approver: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
var PublishSnapshotInput = defineSchemaModel2({
|
|
106
|
-
name: "KbPublishSnapshotInput",
|
|
107
|
-
description: "Publish a snapshot for a jurisdiction as-of a date.",
|
|
108
|
-
fields: {
|
|
109
|
-
jurisdiction: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
110
|
-
asOfDate: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
var SearchKbInput = defineSchemaModel2({
|
|
114
|
-
name: "KbSearchInput",
|
|
115
|
-
description: "Search within a published snapshot.",
|
|
116
|
-
fields: {
|
|
117
|
-
snapshotId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
118
|
-
jurisdiction: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
119
|
-
query: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
var SearchKbResultItem = defineSchemaModel2({
|
|
123
|
-
name: "KbSearchResultItem",
|
|
124
|
-
description: "Search result referencing a specific rule version.",
|
|
125
|
-
fields: {
|
|
126
|
-
ruleVersionId: {
|
|
127
|
-
type: ScalarTypeEnum2.String_unsecure(),
|
|
128
|
-
isOptional: false
|
|
129
|
-
},
|
|
130
|
-
excerpt: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true }
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
var SearchKbOutput = defineSchemaModel2({
|
|
134
|
-
name: "KbSearchOutput",
|
|
135
|
-
description: "Search results constrained to snapshot + jurisdiction.",
|
|
136
|
-
fields: {
|
|
137
|
-
items: { type: SearchKbResultItem, isArray: true, isOptional: false }
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
var KbIngestSourceContract = defineCommand({
|
|
141
|
-
meta: {
|
|
142
|
-
key: "kb.ingestSource",
|
|
143
|
-
title: "Ingest Source",
|
|
144
|
-
version: "1.0.0",
|
|
145
|
-
stability: "experimental",
|
|
146
|
-
owners: ["@examples"],
|
|
147
|
-
tags: ["knowledge", "sources", "ingestion"],
|
|
148
|
-
description: "Ingest immutable source document metadata.",
|
|
149
|
-
goal: "Store traceable source documents for curated KB.",
|
|
150
|
-
context: "Called when an admin uploads/records authoritative sources."
|
|
151
|
-
},
|
|
152
|
-
io: {
|
|
153
|
-
input: IngestSourceInput,
|
|
154
|
-
output: SourceDocumentModel
|
|
155
|
-
},
|
|
156
|
-
policy: { auth: "user" }
|
|
157
|
-
});
|
|
158
|
-
var KbUpsertRuleVersionContract = defineCommand({
|
|
159
|
-
meta: {
|
|
160
|
-
key: "kb.upsertRuleVersion",
|
|
161
|
-
title: "Upsert Rule Version",
|
|
162
|
-
version: "1.0.0",
|
|
163
|
-
stability: "experimental",
|
|
164
|
-
owners: ["@examples"],
|
|
165
|
-
tags: ["knowledge", "rules", "versioning"],
|
|
166
|
-
description: "Create a new draft rule version with source references.",
|
|
167
|
-
goal: "Propose curated knowledge updates with traceability.",
|
|
168
|
-
context: "Automation or curators propose draft rule versions."
|
|
169
|
-
},
|
|
170
|
-
io: {
|
|
171
|
-
input: UpsertRuleVersionInput,
|
|
172
|
-
output: RuleVersionModel,
|
|
173
|
-
errors: {
|
|
174
|
-
SOURCE_REFS_REQUIRED: {
|
|
175
|
-
description: "Rule version must cite at least one sourceRef",
|
|
176
|
-
http: 400,
|
|
177
|
-
gqlCode: "SOURCE_REFS_REQUIRED",
|
|
178
|
-
when: "sourceRefs is empty"
|
|
179
|
-
},
|
|
180
|
-
RULE_NOT_FOUND: {
|
|
181
|
-
description: "Rule does not exist",
|
|
182
|
-
http: 404,
|
|
183
|
-
gqlCode: "RULE_NOT_FOUND",
|
|
184
|
-
when: "ruleId is unknown"
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
policy: { auth: "user" }
|
|
189
|
-
});
|
|
190
|
-
var KbApproveRuleVersionContract = defineCommand({
|
|
191
|
-
meta: {
|
|
192
|
-
key: "kb.approveRuleVersion",
|
|
193
|
-
title: "Approve Rule Version",
|
|
194
|
-
version: "1.0.0",
|
|
195
|
-
stability: "experimental",
|
|
196
|
-
owners: ["@examples"],
|
|
197
|
-
tags: ["knowledge", "rules", "approval"],
|
|
198
|
-
description: "Approve a draft rule version.",
|
|
199
|
-
goal: "Human verification step before publishing snapshots.",
|
|
200
|
-
context: "Curators/experts approve proposed KB changes."
|
|
201
|
-
},
|
|
202
|
-
io: {
|
|
203
|
-
input: ApproveRuleVersionInput,
|
|
204
|
-
output: RuleVersionModel
|
|
205
|
-
},
|
|
206
|
-
policy: { auth: "user" }
|
|
207
|
-
});
|
|
208
|
-
var KbPublishSnapshotContract = defineCommand({
|
|
209
|
-
meta: {
|
|
210
|
-
key: "kb.publishSnapshot",
|
|
211
|
-
title: "Publish Snapshot",
|
|
212
|
-
version: "1.0.0",
|
|
213
|
-
stability: "experimental",
|
|
214
|
-
owners: ["@examples"],
|
|
215
|
-
tags: ["knowledge", "snapshots", "publishing"],
|
|
216
|
-
description: "Publish a KB snapshot for a jurisdiction.",
|
|
217
|
-
goal: "Create a stable snapshot that assistant answers can cite.",
|
|
218
|
-
context: "Publishing happens after approvals; snapshot is referenced by answers."
|
|
219
|
-
},
|
|
220
|
-
io: {
|
|
221
|
-
input: PublishSnapshotInput,
|
|
222
|
-
output: KBSnapshotModel,
|
|
223
|
-
errors: {
|
|
224
|
-
NO_APPROVED_RULES: {
|
|
225
|
-
description: "No approved rule versions available to publish",
|
|
226
|
-
http: 409,
|
|
227
|
-
gqlCode: "NO_APPROVED_RULES",
|
|
228
|
-
when: "jurisdiction has zero approved rule versions"
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
},
|
|
232
|
-
policy: { auth: "user" }
|
|
233
|
-
});
|
|
234
|
-
var KbSearchContract = defineQuery({
|
|
235
|
-
meta: {
|
|
236
|
-
key: "kb.search",
|
|
237
|
-
title: "Search KB",
|
|
238
|
-
version: "1.0.0",
|
|
239
|
-
stability: "experimental",
|
|
240
|
-
owners: ["@examples"],
|
|
241
|
-
tags: ["knowledge", "search", "snapshots"],
|
|
242
|
-
description: "Search within a published KB snapshot.",
|
|
243
|
-
goal: "Provide scoped retrieval for assistant answers.",
|
|
244
|
-
context: "Assistant queries curated rules from a specific snapshot."
|
|
245
|
-
},
|
|
246
|
-
io: {
|
|
247
|
-
input: SearchKbInput,
|
|
248
|
-
output: SearchKbOutput
|
|
249
|
-
},
|
|
250
|
-
policy: { auth: "user" }
|
|
251
|
-
});
|
|
252
|
-
export {
|
|
253
|
-
KbUpsertRuleVersionContract,
|
|
254
|
-
KbSearchContract,
|
|
255
|
-
KbPublishSnapshotContract,
|
|
256
|
-
KbIngestSourceContract,
|
|
257
|
-
KbApproveRuleVersionContract
|
|
258
|
-
};
|
|
2
|
+
import{defineSchemaModel as s,ScalarTypeEnum as t}from"@contractspec/lib.schema";var p=s({name:"SourceDocument",description:"Immutable raw source document metadata referencing a stored file.",fields:{id:{type:t.String_unsecure(),isOptional:!1},jurisdiction:{type:t.String_unsecure(),isOptional:!1},authority:{type:t.String_unsecure(),isOptional:!1},title:{type:t.String_unsecure(),isOptional:!1},fetchedAt:{type:t.DateTime(),isOptional:!1},hash:{type:t.String_unsecure(),isOptional:!1},fileId:{type:t.String_unsecure(),isOptional:!1}}}),n=s({name:"SourceRef",description:"Reference to a source document used to justify a rule version.",fields:{sourceDocumentId:{type:t.String_unsecure(),isOptional:!1},excerpt:{type:t.String_unsecure(),isOptional:!0}}}),D=s({name:"Rule",description:"Curated rule (stable identity) with topic + jurisdiction scope.",fields:{id:{type:t.String_unsecure(),isOptional:!1},jurisdiction:{type:t.String_unsecure(),isOptional:!1},topicKey:{type:t.String_unsecure(),isOptional:!1}}}),o=s({name:"RuleVersion",description:"A versioned rule content with source references and approval status.",fields:{id:{type:t.String_unsecure(),isOptional:!1},ruleId:{type:t.String_unsecure(),isOptional:!1},jurisdiction:{type:t.String_unsecure(),isOptional:!1},topicKey:{type:t.String_unsecure(),isOptional:!1},version:{type:t.String_unsecure(),isOptional:!1},content:{type:t.String_unsecure(),isOptional:!1},sourceRefs:{type:n,isArray:!0,isOptional:!1},status:{type:t.String_unsecure(),isOptional:!1},approvedBy:{type:t.String_unsecure(),isOptional:!0},approvedAt:{type:t.DateTime(),isOptional:!0},createdAt:{type:t.DateTime(),isOptional:!1}}}),u=s({name:"KBSnapshot",description:"Published KB snapshot (as-of) referencing approved rule versions.",fields:{id:{type:t.String_unsecure(),isOptional:!1},jurisdiction:{type:t.String_unsecure(),isOptional:!1},asOfDate:{type:t.DateTime(),isOptional:!1},includedRuleVersionIds:{type:t.String_unsecure(),isArray:!0,isOptional:!1},publishedAt:{type:t.DateTime(),isOptional:!1}}});import{defineCommand as r,defineQuery as l}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as i,ScalarTypeEnum as e}from"@contractspec/lib.schema";var a=i({name:"KbIngestSourceInput",description:"Ingest immutable source metadata referencing a stored file.",fields:{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}}}),f=i({name:"KbUpsertRuleVersionInput",description:"Create a new draft rule version (immutable history).",fields:{ruleId:{type:e.String_unsecure(),isOptional:!1},content:{type:e.String_unsecure(),isOptional:!1},sourceRefs:{type:n,isArray:!0,isOptional:!1}}}),O=i({name:"KbApproveRuleVersionInput",description:"Approve a rule version (human verification).",fields:{ruleVersionId:{type:e.String_unsecure(),isOptional:!1},approver:{type:e.String_unsecure(),isOptional:!1}}}),c=i({name:"KbPublishSnapshotInput",description:"Publish a snapshot for a jurisdiction as-of a date.",fields:{jurisdiction:{type:e.String_unsecure(),isOptional:!1},asOfDate:{type:e.DateTime(),isOptional:!1}}}),g=i({name:"KbSearchInput",description:"Search within a published snapshot.",fields:{snapshotId:{type:e.String_unsecure(),isOptional:!1},jurisdiction:{type:e.String_unsecure(),isOptional:!1},query:{type:e.String_unsecure(),isOptional:!1}}}),_=i({name:"KbSearchResultItem",description:"Search result referencing a specific rule version.",fields:{ruleVersionId:{type:e.String_unsecure(),isOptional:!1},excerpt:{type:e.String_unsecure(),isOptional:!0}}}),d=i({name:"KbSearchOutput",description:"Search results constrained to snapshot + jurisdiction.",fields:{items:{type:_,isArray:!0,isOptional:!1}}}),w=r({meta:{key:"kb.ingestSource",title:"Ingest Source",version:"1.0.0",stability:"experimental",owners:["@examples"],tags:["knowledge","sources","ingestion"],description:"Ingest immutable source document metadata.",goal:"Store traceable source documents for curated KB.",context:"Called when an admin uploads/records authoritative sources."},io:{input:a,output:p},policy:{auth:"user"}}),B=r({meta:{key:"kb.upsertRuleVersion",title:"Upsert Rule Version",version:"1.0.0",stability:"experimental",owners:["@examples"],tags:["knowledge","rules","versioning"],description:"Create a new draft rule version with source references.",goal:"Propose curated knowledge updates with traceability.",context:"Automation or curators propose draft rule versions."},io:{input:f,output:o,errors:{SOURCE_REFS_REQUIRED:{description:"Rule version must cite at least one sourceRef",http:400,gqlCode:"SOURCE_REFS_REQUIRED",when:"sourceRefs is empty"},RULE_NOT_FOUND:{description:"Rule does not exist",http:404,gqlCode:"RULE_NOT_FOUND",when:"ruleId is unknown"}}},policy:{auth:"user"}}),R=r({meta:{key:"kb.approveRuleVersion",title:"Approve Rule Version",version:"1.0.0",stability:"experimental",owners:["@examples"],tags:["knowledge","rules","approval"],description:"Approve a draft rule version.",goal:"Human verification step before publishing snapshots.",context:"Curators/experts approve proposed KB changes."},io:{input:O,output:o},policy:{auth:"user"}}),K=r({meta:{key:"kb.publishSnapshot",title:"Publish Snapshot",version:"1.0.0",stability:"experimental",owners:["@examples"],tags:["knowledge","snapshots","publishing"],description:"Publish a KB snapshot for a jurisdiction.",goal:"Create a stable snapshot that assistant answers can cite.",context:"Publishing happens after approvals; snapshot is referenced by answers."},io:{input:c,output:u,errors:{NO_APPROVED_RULES:{description:"No approved rule versions available to publish",http:409,gqlCode:"NO_APPROVED_RULES",when:"jurisdiction has zero approved rule versions"}}},policy:{auth:"user"}}),k=l({meta:{key:"kb.search",title:"Search KB",version:"1.0.0",stability:"experimental",owners:["@examples"],tags:["knowledge","search","snapshots"],description:"Search within a published KB snapshot.",goal:"Provide scoped retrieval for assistant answers.",context:"Assistant queries curated rules from a specific snapshot."},io:{input:g,output:d},policy:{auth:"user"}});export{B as KbUpsertRuleVersionContract,k as KbSearchContract,K as KbPublishSnapshotContract,w as KbIngestSourceContract,R as KbApproveRuleVersionContract};
|
package/dist/operations/kb.js
CHANGED
|
@@ -1,258 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
|
|
3
|
-
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
4
|
-
var SourceDocumentModel = defineSchemaModel({
|
|
5
|
-
name: "SourceDocument",
|
|
6
|
-
description: "Immutable raw source document metadata referencing a stored file.",
|
|
7
|
-
fields: {
|
|
8
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
9
|
-
jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
10
|
-
authority: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
11
|
-
title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
12
|
-
fetchedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
13
|
-
hash: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
14
|
-
fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
var SourceRefModel = defineSchemaModel({
|
|
18
|
-
name: "SourceRef",
|
|
19
|
-
description: "Reference to a source document used to justify a rule version.",
|
|
20
|
-
fields: {
|
|
21
|
-
sourceDocumentId: {
|
|
22
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
23
|
-
isOptional: false
|
|
24
|
-
},
|
|
25
|
-
excerpt: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
var RuleModel = defineSchemaModel({
|
|
29
|
-
name: "Rule",
|
|
30
|
-
description: "Curated rule (stable identity) with topic + jurisdiction scope.",
|
|
31
|
-
fields: {
|
|
32
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
33
|
-
jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
34
|
-
topicKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
var RuleVersionModel = defineSchemaModel({
|
|
38
|
-
name: "RuleVersion",
|
|
39
|
-
description: "A versioned rule content with source references and approval status.",
|
|
40
|
-
fields: {
|
|
41
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
42
|
-
ruleId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
43
|
-
jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
44
|
-
topicKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
45
|
-
version: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
46
|
-
content: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
47
|
-
sourceRefs: { type: SourceRefModel, isArray: true, isOptional: false },
|
|
48
|
-
status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
49
|
-
approvedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
50
|
-
approvedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
51
|
-
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
var KBSnapshotModel = defineSchemaModel({
|
|
55
|
-
name: "KBSnapshot",
|
|
56
|
-
description: "Published KB snapshot (as-of) referencing approved rule versions.",
|
|
57
|
-
fields: {
|
|
58
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
59
|
-
jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
60
|
-
asOfDate: { type: ScalarTypeEnum.DateTime(), isOptional: false },
|
|
61
|
-
includedRuleVersionIds: {
|
|
62
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
63
|
-
isArray: true,
|
|
64
|
-
isOptional: false
|
|
65
|
-
},
|
|
66
|
-
publishedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
67
|
-
}
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
// src/operations/kb.ts
|
|
71
|
-
import { defineCommand, defineQuery } from "@contractspec/lib.contracts-spec";
|
|
72
|
-
import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
|
|
73
|
-
var IngestSourceInput = defineSchemaModel2({
|
|
74
|
-
name: "KbIngestSourceInput",
|
|
75
|
-
description: "Ingest immutable source metadata referencing a stored file.",
|
|
76
|
-
fields: {
|
|
77
|
-
jurisdiction: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
78
|
-
authority: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
79
|
-
title: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
80
|
-
fetchedAt: { type: ScalarTypeEnum2.DateTime(), isOptional: false },
|
|
81
|
-
hash: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
82
|
-
fileId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
var UpsertRuleVersionInput = defineSchemaModel2({
|
|
86
|
-
name: "KbUpsertRuleVersionInput",
|
|
87
|
-
description: "Create a new draft rule version (immutable history).",
|
|
88
|
-
fields: {
|
|
89
|
-
ruleId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
90
|
-
content: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
91
|
-
sourceRefs: { type: SourceRefModel, isArray: true, isOptional: false }
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
var ApproveRuleVersionInput = defineSchemaModel2({
|
|
95
|
-
name: "KbApproveRuleVersionInput",
|
|
96
|
-
description: "Approve a rule version (human verification).",
|
|
97
|
-
fields: {
|
|
98
|
-
ruleVersionId: {
|
|
99
|
-
type: ScalarTypeEnum2.String_unsecure(),
|
|
100
|
-
isOptional: false
|
|
101
|
-
},
|
|
102
|
-
approver: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
var PublishSnapshotInput = defineSchemaModel2({
|
|
106
|
-
name: "KbPublishSnapshotInput",
|
|
107
|
-
description: "Publish a snapshot for a jurisdiction as-of a date.",
|
|
108
|
-
fields: {
|
|
109
|
-
jurisdiction: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
110
|
-
asOfDate: { type: ScalarTypeEnum2.DateTime(), isOptional: false }
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
var SearchKbInput = defineSchemaModel2({
|
|
114
|
-
name: "KbSearchInput",
|
|
115
|
-
description: "Search within a published snapshot.",
|
|
116
|
-
fields: {
|
|
117
|
-
snapshotId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
118
|
-
jurisdiction: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
119
|
-
query: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false }
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
var SearchKbResultItem = defineSchemaModel2({
|
|
123
|
-
name: "KbSearchResultItem",
|
|
124
|
-
description: "Search result referencing a specific rule version.",
|
|
125
|
-
fields: {
|
|
126
|
-
ruleVersionId: {
|
|
127
|
-
type: ScalarTypeEnum2.String_unsecure(),
|
|
128
|
-
isOptional: false
|
|
129
|
-
},
|
|
130
|
-
excerpt: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true }
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
var SearchKbOutput = defineSchemaModel2({
|
|
134
|
-
name: "KbSearchOutput",
|
|
135
|
-
description: "Search results constrained to snapshot + jurisdiction.",
|
|
136
|
-
fields: {
|
|
137
|
-
items: { type: SearchKbResultItem, isArray: true, isOptional: false }
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
var KbIngestSourceContract = defineCommand({
|
|
141
|
-
meta: {
|
|
142
|
-
key: "kb.ingestSource",
|
|
143
|
-
title: "Ingest Source",
|
|
144
|
-
version: "1.0.0",
|
|
145
|
-
stability: "experimental",
|
|
146
|
-
owners: ["@examples"],
|
|
147
|
-
tags: ["knowledge", "sources", "ingestion"],
|
|
148
|
-
description: "Ingest immutable source document metadata.",
|
|
149
|
-
goal: "Store traceable source documents for curated KB.",
|
|
150
|
-
context: "Called when an admin uploads/records authoritative sources."
|
|
151
|
-
},
|
|
152
|
-
io: {
|
|
153
|
-
input: IngestSourceInput,
|
|
154
|
-
output: SourceDocumentModel
|
|
155
|
-
},
|
|
156
|
-
policy: { auth: "user" }
|
|
157
|
-
});
|
|
158
|
-
var KbUpsertRuleVersionContract = defineCommand({
|
|
159
|
-
meta: {
|
|
160
|
-
key: "kb.upsertRuleVersion",
|
|
161
|
-
title: "Upsert Rule Version",
|
|
162
|
-
version: "1.0.0",
|
|
163
|
-
stability: "experimental",
|
|
164
|
-
owners: ["@examples"],
|
|
165
|
-
tags: ["knowledge", "rules", "versioning"],
|
|
166
|
-
description: "Create a new draft rule version with source references.",
|
|
167
|
-
goal: "Propose curated knowledge updates with traceability.",
|
|
168
|
-
context: "Automation or curators propose draft rule versions."
|
|
169
|
-
},
|
|
170
|
-
io: {
|
|
171
|
-
input: UpsertRuleVersionInput,
|
|
172
|
-
output: RuleVersionModel,
|
|
173
|
-
errors: {
|
|
174
|
-
SOURCE_REFS_REQUIRED: {
|
|
175
|
-
description: "Rule version must cite at least one sourceRef",
|
|
176
|
-
http: 400,
|
|
177
|
-
gqlCode: "SOURCE_REFS_REQUIRED",
|
|
178
|
-
when: "sourceRefs is empty"
|
|
179
|
-
},
|
|
180
|
-
RULE_NOT_FOUND: {
|
|
181
|
-
description: "Rule does not exist",
|
|
182
|
-
http: 404,
|
|
183
|
-
gqlCode: "RULE_NOT_FOUND",
|
|
184
|
-
when: "ruleId is unknown"
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
},
|
|
188
|
-
policy: { auth: "user" }
|
|
189
|
-
});
|
|
190
|
-
var KbApproveRuleVersionContract = defineCommand({
|
|
191
|
-
meta: {
|
|
192
|
-
key: "kb.approveRuleVersion",
|
|
193
|
-
title: "Approve Rule Version",
|
|
194
|
-
version: "1.0.0",
|
|
195
|
-
stability: "experimental",
|
|
196
|
-
owners: ["@examples"],
|
|
197
|
-
tags: ["knowledge", "rules", "approval"],
|
|
198
|
-
description: "Approve a draft rule version.",
|
|
199
|
-
goal: "Human verification step before publishing snapshots.",
|
|
200
|
-
context: "Curators/experts approve proposed KB changes."
|
|
201
|
-
},
|
|
202
|
-
io: {
|
|
203
|
-
input: ApproveRuleVersionInput,
|
|
204
|
-
output: RuleVersionModel
|
|
205
|
-
},
|
|
206
|
-
policy: { auth: "user" }
|
|
207
|
-
});
|
|
208
|
-
var KbPublishSnapshotContract = defineCommand({
|
|
209
|
-
meta: {
|
|
210
|
-
key: "kb.publishSnapshot",
|
|
211
|
-
title: "Publish Snapshot",
|
|
212
|
-
version: "1.0.0",
|
|
213
|
-
stability: "experimental",
|
|
214
|
-
owners: ["@examples"],
|
|
215
|
-
tags: ["knowledge", "snapshots", "publishing"],
|
|
216
|
-
description: "Publish a KB snapshot for a jurisdiction.",
|
|
217
|
-
goal: "Create a stable snapshot that assistant answers can cite.",
|
|
218
|
-
context: "Publishing happens after approvals; snapshot is referenced by answers."
|
|
219
|
-
},
|
|
220
|
-
io: {
|
|
221
|
-
input: PublishSnapshotInput,
|
|
222
|
-
output: KBSnapshotModel,
|
|
223
|
-
errors: {
|
|
224
|
-
NO_APPROVED_RULES: {
|
|
225
|
-
description: "No approved rule versions available to publish",
|
|
226
|
-
http: 409,
|
|
227
|
-
gqlCode: "NO_APPROVED_RULES",
|
|
228
|
-
when: "jurisdiction has zero approved rule versions"
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
},
|
|
232
|
-
policy: { auth: "user" }
|
|
233
|
-
});
|
|
234
|
-
var KbSearchContract = defineQuery({
|
|
235
|
-
meta: {
|
|
236
|
-
key: "kb.search",
|
|
237
|
-
title: "Search KB",
|
|
238
|
-
version: "1.0.0",
|
|
239
|
-
stability: "experimental",
|
|
240
|
-
owners: ["@examples"],
|
|
241
|
-
tags: ["knowledge", "search", "snapshots"],
|
|
242
|
-
description: "Search within a published KB snapshot.",
|
|
243
|
-
goal: "Provide scoped retrieval for assistant answers.",
|
|
244
|
-
context: "Assistant queries curated rules from a specific snapshot."
|
|
245
|
-
},
|
|
246
|
-
io: {
|
|
247
|
-
input: SearchKbInput,
|
|
248
|
-
output: SearchKbOutput
|
|
249
|
-
},
|
|
250
|
-
policy: { auth: "user" }
|
|
251
|
-
});
|
|
252
|
-
export {
|
|
253
|
-
KbUpsertRuleVersionContract,
|
|
254
|
-
KbSearchContract,
|
|
255
|
-
KbPublishSnapshotContract,
|
|
256
|
-
KbIngestSourceContract,
|
|
257
|
-
KbApproveRuleVersionContract
|
|
258
|
-
};
|
|
2
|
+
import{defineSchemaModel as s,ScalarTypeEnum as t}from"@contractspec/lib.schema";var p=s({name:"SourceDocument",description:"Immutable raw source document metadata referencing a stored file.",fields:{id:{type:t.String_unsecure(),isOptional:!1},jurisdiction:{type:t.String_unsecure(),isOptional:!1},authority:{type:t.String_unsecure(),isOptional:!1},title:{type:t.String_unsecure(),isOptional:!1},fetchedAt:{type:t.DateTime(),isOptional:!1},hash:{type:t.String_unsecure(),isOptional:!1},fileId:{type:t.String_unsecure(),isOptional:!1}}}),n=s({name:"SourceRef",description:"Reference to a source document used to justify a rule version.",fields:{sourceDocumentId:{type:t.String_unsecure(),isOptional:!1},excerpt:{type:t.String_unsecure(),isOptional:!0}}}),D=s({name:"Rule",description:"Curated rule (stable identity) with topic + jurisdiction scope.",fields:{id:{type:t.String_unsecure(),isOptional:!1},jurisdiction:{type:t.String_unsecure(),isOptional:!1},topicKey:{type:t.String_unsecure(),isOptional:!1}}}),o=s({name:"RuleVersion",description:"A versioned rule content with source references and approval status.",fields:{id:{type:t.String_unsecure(),isOptional:!1},ruleId:{type:t.String_unsecure(),isOptional:!1},jurisdiction:{type:t.String_unsecure(),isOptional:!1},topicKey:{type:t.String_unsecure(),isOptional:!1},version:{type:t.String_unsecure(),isOptional:!1},content:{type:t.String_unsecure(),isOptional:!1},sourceRefs:{type:n,isArray:!0,isOptional:!1},status:{type:t.String_unsecure(),isOptional:!1},approvedBy:{type:t.String_unsecure(),isOptional:!0},approvedAt:{type:t.DateTime(),isOptional:!0},createdAt:{type:t.DateTime(),isOptional:!1}}}),u=s({name:"KBSnapshot",description:"Published KB snapshot (as-of) referencing approved rule versions.",fields:{id:{type:t.String_unsecure(),isOptional:!1},jurisdiction:{type:t.String_unsecure(),isOptional:!1},asOfDate:{type:t.DateTime(),isOptional:!1},includedRuleVersionIds:{type:t.String_unsecure(),isArray:!0,isOptional:!1},publishedAt:{type:t.DateTime(),isOptional:!1}}});import{defineCommand as r,defineQuery as l}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as i,ScalarTypeEnum as e}from"@contractspec/lib.schema";var a=i({name:"KbIngestSourceInput",description:"Ingest immutable source metadata referencing a stored file.",fields:{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}}}),f=i({name:"KbUpsertRuleVersionInput",description:"Create a new draft rule version (immutable history).",fields:{ruleId:{type:e.String_unsecure(),isOptional:!1},content:{type:e.String_unsecure(),isOptional:!1},sourceRefs:{type:n,isArray:!0,isOptional:!1}}}),O=i({name:"KbApproveRuleVersionInput",description:"Approve a rule version (human verification).",fields:{ruleVersionId:{type:e.String_unsecure(),isOptional:!1},approver:{type:e.String_unsecure(),isOptional:!1}}}),c=i({name:"KbPublishSnapshotInput",description:"Publish a snapshot for a jurisdiction as-of a date.",fields:{jurisdiction:{type:e.String_unsecure(),isOptional:!1},asOfDate:{type:e.DateTime(),isOptional:!1}}}),g=i({name:"KbSearchInput",description:"Search within a published snapshot.",fields:{snapshotId:{type:e.String_unsecure(),isOptional:!1},jurisdiction:{type:e.String_unsecure(),isOptional:!1},query:{type:e.String_unsecure(),isOptional:!1}}}),_=i({name:"KbSearchResultItem",description:"Search result referencing a specific rule version.",fields:{ruleVersionId:{type:e.String_unsecure(),isOptional:!1},excerpt:{type:e.String_unsecure(),isOptional:!0}}}),d=i({name:"KbSearchOutput",description:"Search results constrained to snapshot + jurisdiction.",fields:{items:{type:_,isArray:!0,isOptional:!1}}}),w=r({meta:{key:"kb.ingestSource",title:"Ingest Source",version:"1.0.0",stability:"experimental",owners:["@examples"],tags:["knowledge","sources","ingestion"],description:"Ingest immutable source document metadata.",goal:"Store traceable source documents for curated KB.",context:"Called when an admin uploads/records authoritative sources."},io:{input:a,output:p},policy:{auth:"user"}}),B=r({meta:{key:"kb.upsertRuleVersion",title:"Upsert Rule Version",version:"1.0.0",stability:"experimental",owners:["@examples"],tags:["knowledge","rules","versioning"],description:"Create a new draft rule version with source references.",goal:"Propose curated knowledge updates with traceability.",context:"Automation or curators propose draft rule versions."},io:{input:f,output:o,errors:{SOURCE_REFS_REQUIRED:{description:"Rule version must cite at least one sourceRef",http:400,gqlCode:"SOURCE_REFS_REQUIRED",when:"sourceRefs is empty"},RULE_NOT_FOUND:{description:"Rule does not exist",http:404,gqlCode:"RULE_NOT_FOUND",when:"ruleId is unknown"}}},policy:{auth:"user"}}),R=r({meta:{key:"kb.approveRuleVersion",title:"Approve Rule Version",version:"1.0.0",stability:"experimental",owners:["@examples"],tags:["knowledge","rules","approval"],description:"Approve a draft rule version.",goal:"Human verification step before publishing snapshots.",context:"Curators/experts approve proposed KB changes."},io:{input:O,output:o},policy:{auth:"user"}}),K=r({meta:{key:"kb.publishSnapshot",title:"Publish Snapshot",version:"1.0.0",stability:"experimental",owners:["@examples"],tags:["knowledge","snapshots","publishing"],description:"Publish a KB snapshot for a jurisdiction.",goal:"Create a stable snapshot that assistant answers can cite.",context:"Publishing happens after approvals; snapshot is referenced by answers."},io:{input:c,output:u,errors:{NO_APPROVED_RULES:{description:"No approved rule versions available to publish",http:409,gqlCode:"NO_APPROVED_RULES",when:"jurisdiction has zero approved rule versions"}}},policy:{auth:"user"}}),k=l({meta:{key:"kb.search",title:"Search KB",version:"1.0.0",stability:"experimental",owners:["@examples"],tags:["knowledge","search","snapshots"],description:"Search within a published KB snapshot.",goal:"Provide scoped retrieval for assistant answers.",context:"Assistant queries curated rules from a specific snapshot."},io:{input:g,output:d},policy:{auth:"user"}});export{B as KbUpsertRuleVersionContract,k as KbSearchContract,K as KbPublishSnapshotContract,w as KbIngestSourceContract,R as KbApproveRuleVersionContract};
|
|
@@ -1,42 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
|
|
3
|
-
import { defineFeature } from "@contractspec/lib.contracts-spec";
|
|
4
|
-
var VersionedKnowledgeBaseFeature = defineFeature({
|
|
5
|
-
meta: {
|
|
6
|
-
key: "versioned-knowledge-base",
|
|
7
|
-
version: "1.0.0",
|
|
8
|
-
title: "Versioned Knowledge Base",
|
|
9
|
-
description: "Curated KB with immutable sources, rule versions, and published snapshots.",
|
|
10
|
-
domain: "knowledge",
|
|
11
|
-
owners: ["@examples"],
|
|
12
|
-
tags: ["knowledge", "versioning", "snapshots"],
|
|
13
|
-
stability: "experimental"
|
|
14
|
-
},
|
|
15
|
-
operations: [
|
|
16
|
-
{ key: "kb.ingestSource", version: "1.0.0" },
|
|
17
|
-
{ key: "kb.upsertRuleVersion", version: "1.0.0" },
|
|
18
|
-
{ key: "kb.approveRuleVersion", version: "1.0.0" },
|
|
19
|
-
{ key: "kb.publishSnapshot", version: "1.0.0" },
|
|
20
|
-
{ key: "kb.search", version: "1.0.0" }
|
|
21
|
-
],
|
|
22
|
-
events: [
|
|
23
|
-
{ key: "kb.source.ingested", version: "1.0.0" },
|
|
24
|
-
{ key: "kb.ruleVersion.created", version: "1.0.0" },
|
|
25
|
-
{ key: "kb.ruleVersion.approved", version: "1.0.0" },
|
|
26
|
-
{ key: "kb.snapshot.published", version: "1.0.0" }
|
|
27
|
-
],
|
|
28
|
-
presentations: [],
|
|
29
|
-
opToPresentation: [],
|
|
30
|
-
presentationsTargets: [],
|
|
31
|
-
capabilities: {
|
|
32
|
-
requires: [{ key: "knowledge", version: "1.0.0" }]
|
|
33
|
-
},
|
|
34
|
-
knowledge: [{ key: "kb.knowledge.rules", version: "1.0.0" }],
|
|
35
|
-
docs: [
|
|
36
|
-
"docs.examples.versioned-knowledge-base.goal",
|
|
37
|
-
"docs.examples.versioned-knowledge-base.reference"
|
|
38
|
-
]
|
|
39
|
-
});
|
|
40
|
-
export {
|
|
41
|
-
VersionedKnowledgeBaseFeature
|
|
42
|
-
};
|
|
2
|
+
import{defineFeature as g}from"@contractspec/lib.contracts-spec";var j=g({meta:{key:"versioned-knowledge-base",version:"1.0.0",title:"Versioned Knowledge Base",description:"Curated KB with immutable sources, rule versions, and published snapshots.",domain:"knowledge",owners:["@examples"],tags:["knowledge","versioning","snapshots"],stability:"experimental"},operations:[{key:"kb.ingestSource",version:"1.0.0"},{key:"kb.upsertRuleVersion",version:"1.0.0"},{key:"kb.approveRuleVersion",version:"1.0.0"},{key:"kb.publishSnapshot",version:"1.0.0"},{key:"kb.search",version:"1.0.0"}],events:[{key:"kb.source.ingested",version:"1.0.0"},{key:"kb.ruleVersion.created",version:"1.0.0"},{key:"kb.ruleVersion.approved",version:"1.0.0"},{key:"kb.snapshot.published",version:"1.0.0"}],presentations:[],opToPresentation:[],presentationsTargets:[],capabilities:{requires:[{key:"knowledge",version:"1.0.0"}]},knowledge:[{key:"kb.knowledge.rules",version:"1.0.0"}],docs:["docs.examples.versioned-knowledge-base.goal","docs.examples.versioned-knowledge-base.reference"]});export{j as VersionedKnowledgeBaseFeature};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractspec/example.versioned-knowledge-base",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.18",
|
|
4
4
|
"description": "Example: curated, versioned knowledge base with immutable sources, rule versions, and published snapshots.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -106,20 +106,20 @@
|
|
|
106
106
|
"dev": "contractspec-bun-build dev",
|
|
107
107
|
"clean": "rimraf dist .turbo",
|
|
108
108
|
"lint": "bun lint:fix",
|
|
109
|
-
"lint:fix": "biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .",
|
|
110
|
-
"lint:check": "biome check .",
|
|
109
|
+
"lint:fix": "node ../../../scripts/biome.cjs check --write --unsafe --only=nursery/useSortedClasses . && node ../../../scripts/biome.cjs check --write .",
|
|
110
|
+
"lint:check": "node ../../../scripts/biome.cjs check .",
|
|
111
111
|
"test": "bun test",
|
|
112
112
|
"prebuild": "contractspec-bun-build prebuild",
|
|
113
113
|
"typecheck": "tsc --noEmit"
|
|
114
114
|
},
|
|
115
115
|
"dependencies": {
|
|
116
|
-
"@contractspec/lib.contracts-spec": "5.0
|
|
117
|
-
"@contractspec/lib.schema": "3.7.
|
|
116
|
+
"@contractspec/lib.contracts-spec": "5.2.0",
|
|
117
|
+
"@contractspec/lib.schema": "3.7.14"
|
|
118
118
|
},
|
|
119
119
|
"devDependencies": {
|
|
120
|
-
"@contractspec/tool.typescript": "3.7.
|
|
120
|
+
"@contractspec/tool.typescript": "3.7.13",
|
|
121
121
|
"typescript": "^5.9.3",
|
|
122
|
-
"@contractspec/tool.bun": "3.7.
|
|
122
|
+
"@contractspec/tool.bun": "3.7.14"
|
|
123
123
|
},
|
|
124
124
|
"publishConfig": {
|
|
125
125
|
"access": "public",
|