@contractspec/example.versioned-knowledge-base 1.44.0 → 1.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,7 +22,7 @@ interface RuleVersion {
22
22
  ruleId: string;
23
23
  jurisdiction: string;
24
24
  topicKey: string;
25
- version: number;
25
+ version: string;
26
26
  content: string;
27
27
  sourceRefs: SourceRef[];
28
28
  status: 'draft' | 'approved' | 'rejected';
@@ -30,14 +30,13 @@ function createMemoryKbHandlers(store) {
30
30
  const rule = store.rules.get(input.ruleId);
31
31
  if (!rule) throw new Error("RULE_NOT_FOUND");
32
32
  const next = (store.nextRuleVersionNumberByRuleId.get(input.ruleId) ?? 0) + 1;
33
- store.nextRuleVersionNumberByRuleId.set(input.ruleId, next);
34
33
  const id = stableId("rv", `${input.ruleId}_${next}`);
35
34
  const ruleVersion = {
36
35
  id,
37
36
  ruleId: input.ruleId,
38
37
  jurisdiction: rule.jurisdiction,
39
38
  topicKey: rule.topicKey,
40
- version: next,
39
+ version: next.toString(),
41
40
  content: input.content,
42
41
  sourceRefs: input.sourceRefs,
43
42
  status: "draft",
@@ -1 +1 @@
1
- {"version":3,"file":"memory.handlers.js","names":["doc: SourceDocument","ruleVersion: RuleVersion","approved: RuleVersion","snapshot: KBSnapshot"],"sources":["../../src/handlers/memory.handlers.ts"],"sourcesContent":["interface SourceRef {\n sourceDocumentId: string;\n excerpt?: string;\n}\ninterface SourceDocument {\n id: string;\n jurisdiction: string;\n authority: string;\n title: string;\n fetchedAt: Date;\n hash: string;\n fileId: string;\n}\ninterface Rule {\n id: string;\n jurisdiction: string;\n topicKey: string;\n}\ninterface RuleVersion {\n id: string;\n ruleId: string;\n jurisdiction: string;\n topicKey: string;\n version: number;\n content: string;\n sourceRefs: SourceRef[];\n status: 'draft' | 'approved' | 'rejected';\n approvedBy?: string;\n approvedAt?: Date;\n createdAt: Date;\n}\ninterface KBSnapshot {\n id: string;\n jurisdiction: string;\n asOfDate: Date;\n includedRuleVersionIds: string[];\n publishedAt: Date;\n}\n\nexport interface MemoryKbStore {\n sources: Map<string, SourceDocument>;\n rules: Map<string, Rule>;\n ruleVersions: Map<string, RuleVersion>;\n snapshots: Map<string, KBSnapshot>;\n nextRuleVersionNumberByRuleId: Map<string, number>;\n}\n\nexport function createMemoryKbStore(): MemoryKbStore {\n return {\n sources: new Map(),\n rules: new Map(),\n ruleVersions: new Map(),\n snapshots: new Map(),\n nextRuleVersionNumberByRuleId: new Map(),\n };\n}\n\nexport interface MemoryKbHandlers {\n createRule(rule: Rule): Promise<Rule>;\n ingestSource(input: Omit<SourceDocument, 'id'>): Promise<SourceDocument>;\n upsertRuleVersion(input: {\n ruleId: string;\n content: string;\n sourceRefs: SourceRef[];\n }): Promise<RuleVersion>;\n approveRuleVersion(input: {\n ruleVersionId: string;\n approver: string;\n }): Promise<RuleVersion>;\n publishSnapshot(input: {\n jurisdiction: string;\n asOfDate: Date;\n }): Promise<KBSnapshot>;\n search(input: {\n snapshotId: string;\n jurisdiction: string;\n query: string;\n }): Promise<{ items: { ruleVersionId: string; excerpt?: string }[] }>;\n}\n\nfunction stableId(prefix: string, value: string): string {\n return `${prefix}_${value.replace(/[^a-zA-Z0-9_-]/g, '_')}`;\n}\n\nexport function createMemoryKbHandlers(store: MemoryKbStore): MemoryKbHandlers {\n async function createRule(rule: Rule): Promise<Rule> {\n store.rules.set(rule.id, rule);\n return rule;\n }\n\n async function ingestSource(\n input: Omit<SourceDocument, 'id'>\n ): Promise<SourceDocument> {\n const id = stableId('src', `${input.jurisdiction}_${input.hash}`);\n const doc: SourceDocument = { id, ...input };\n store.sources.set(id, doc);\n return doc;\n }\n\n async function upsertRuleVersion(input: {\n ruleId: string;\n content: string;\n sourceRefs: SourceRef[];\n }): Promise<RuleVersion> {\n if (!input.sourceRefs.length) {\n throw new Error('SOURCE_REFS_REQUIRED');\n }\n const rule = store.rules.get(input.ruleId);\n if (!rule) {\n throw new Error('RULE_NOT_FOUND');\n }\n const next =\n (store.nextRuleVersionNumberByRuleId.get(input.ruleId) ?? 0) + 1;\n store.nextRuleVersionNumberByRuleId.set(input.ruleId, next);\n const id = stableId('rv', `${input.ruleId}_${next}`);\n const ruleVersion: RuleVersion = {\n id,\n ruleId: input.ruleId,\n jurisdiction: rule.jurisdiction,\n topicKey: rule.topicKey,\n version: next,\n content: input.content,\n sourceRefs: input.sourceRefs,\n status: 'draft',\n createdAt: new Date(),\n approvedAt: undefined,\n approvedBy: undefined,\n };\n store.ruleVersions.set(id, ruleVersion);\n return ruleVersion;\n }\n\n async function approveRuleVersion(input: {\n ruleVersionId: string;\n approver: string;\n }): Promise<RuleVersion> {\n const existing = store.ruleVersions.get(input.ruleVersionId);\n if (!existing) {\n throw new Error('RULE_VERSION_NOT_FOUND');\n }\n const approved: RuleVersion = {\n ...existing,\n status: 'approved',\n approvedBy: input.approver,\n approvedAt: new Date(),\n };\n store.ruleVersions.set(approved.id, approved);\n return approved;\n }\n\n async function publishSnapshot(input: {\n jurisdiction: string;\n asOfDate: Date;\n }): Promise<KBSnapshot> {\n const approved = [...store.ruleVersions.values()].filter(\n (rv) => rv.status === 'approved' && rv.jurisdiction === input.jurisdiction\n );\n if (approved.length === 0) {\n throw new Error('NO_APPROVED_RULES');\n }\n const includedRuleVersionIds = approved.map((rv) => rv.id).sort();\n const id = stableId(\n 'snap',\n `${input.jurisdiction}_${input.asOfDate.toISOString().slice(0, 10)}_${includedRuleVersionIds.length}`\n );\n const snapshot: KBSnapshot = {\n id,\n jurisdiction: input.jurisdiction,\n asOfDate: input.asOfDate,\n includedRuleVersionIds,\n publishedAt: new Date(),\n };\n store.snapshots.set(id, snapshot);\n return snapshot;\n }\n\n async function search(input: {\n snapshotId: string;\n jurisdiction: string;\n query: string;\n }): Promise<{ items: { ruleVersionId: string; excerpt?: string }[] }> {\n const snapshot = store.snapshots.get(input.snapshotId);\n if (!snapshot) {\n throw new Error('SNAPSHOT_NOT_FOUND');\n }\n if (snapshot.jurisdiction !== input.jurisdiction) {\n throw new Error('JURISDICTION_MISMATCH');\n }\n const q = input.query.toLowerCase();\n const tokens = q\n .split(/\\s+/)\n .map((t) => t.trim())\n .filter(Boolean);\n const items = snapshot.includedRuleVersionIds\n .map((id) => store.ruleVersions.get(id))\n .filter((rv): rv is RuleVersion => Boolean(rv))\n .filter((rv) => {\n if (tokens.length === 0) return true;\n const hay = rv.content.toLowerCase();\n return tokens.every((token) => hay.includes(token));\n })\n .map((rv) => ({\n ruleVersionId: rv.id,\n excerpt: rv.content.slice(0, 120),\n }));\n return { items };\n }\n\n return {\n createRule,\n ingestSource,\n upsertRuleVersion,\n approveRuleVersion,\n publishSnapshot,\n search,\n };\n}\n"],"mappings":";AA+CA,SAAgB,sBAAqC;AACnD,QAAO;EACL,yBAAS,IAAI,KAAK;EAClB,uBAAO,IAAI,KAAK;EAChB,8BAAc,IAAI,KAAK;EACvB,2BAAW,IAAI,KAAK;EACpB,+CAA+B,IAAI,KAAK;EACzC;;AA0BH,SAAS,SAAS,QAAgB,OAAuB;AACvD,QAAO,GAAG,OAAO,GAAG,MAAM,QAAQ,mBAAmB,IAAI;;AAG3D,SAAgB,uBAAuB,OAAwC;CAC7E,eAAe,WAAW,MAA2B;AACnD,QAAM,MAAM,IAAI,KAAK,IAAI,KAAK;AAC9B,SAAO;;CAGT,eAAe,aACb,OACyB;EACzB,MAAM,KAAK,SAAS,OAAO,GAAG,MAAM,aAAa,GAAG,MAAM,OAAO;EACjE,MAAMA,MAAsB;GAAE;GAAI,GAAG;GAAO;AAC5C,QAAM,QAAQ,IAAI,IAAI,IAAI;AAC1B,SAAO;;CAGT,eAAe,kBAAkB,OAIR;AACvB,MAAI,CAAC,MAAM,WAAW,OACpB,OAAM,IAAI,MAAM,uBAAuB;EAEzC,MAAM,OAAO,MAAM,MAAM,IAAI,MAAM,OAAO;AAC1C,MAAI,CAAC,KACH,OAAM,IAAI,MAAM,iBAAiB;EAEnC,MAAM,QACH,MAAM,8BAA8B,IAAI,MAAM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AI,MAAM,WAAW;AACtD,MAAI,CAAC,SACH,OAAM,IAAI,MAAM,qBAAqB;AAEvC,MAAI,SAAS,iBAAiB,MAAM,aAClC,OAAM,IAAI,MAAM,wBAAwB;EAG1C,MAAM,SADI,MAAM,MAAM,aAAa,CAEhC,MAAM,MAAM,CACZ,KAAK,MAAM,EAAE,MAAM,CAAC,CACpB,OAAO,QAAQ;AAalB,SAAO,EAAE,OAZK,SAAS,uBACpB,KAAK,OAAO,MAAM,aAAa,IAAI,GAAG,CAAC,CACvC,QAAQ,OAA0B,QAAQ,GAAG,CAAC,CAC9C,QAAQ,OAAO;AACd,OAAI,OAAO,WAAW,EAAG,QAAO;GAChC,MAAM,MAAM,GAAG,QAAQ,aAAa;AACpC,UAAO,OAAO,OAAO,UAAU,IAAI,SAAS,MAAM,CAAC;IACnD,CACD,KAAK,QAAQ;GACZ,eAAe,GAAG;GAClB,SAAS,GAAG,QAAQ,MAAM,GAAG,IAAI;GAClC,EAAE,EACW;;AAGlB,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACD"}
1
+ {"version":3,"file":"memory.handlers.js","names":["doc: SourceDocument","ruleVersion: RuleVersion","approved: RuleVersion","snapshot: KBSnapshot"],"sources":["../../src/handlers/memory.handlers.ts"],"sourcesContent":["interface SourceRef {\n sourceDocumentId: string;\n excerpt?: string;\n}\ninterface SourceDocument {\n id: string;\n jurisdiction: string;\n authority: string;\n title: string;\n fetchedAt: Date;\n hash: string;\n fileId: string;\n}\ninterface Rule {\n id: string;\n jurisdiction: string;\n topicKey: string;\n}\ninterface RuleVersion {\n id: string;\n ruleId: string;\n jurisdiction: string;\n topicKey: string;\n version: string;\n content: string;\n sourceRefs: SourceRef[];\n status: 'draft' | 'approved' | 'rejected';\n approvedBy?: string;\n approvedAt?: Date;\n createdAt: Date;\n}\ninterface KBSnapshot {\n id: string;\n jurisdiction: string;\n asOfDate: Date;\n includedRuleVersionIds: string[];\n publishedAt: Date;\n}\n\nexport interface MemoryKbStore {\n sources: Map<string, SourceDocument>;\n rules: Map<string, Rule>;\n ruleVersions: Map<string, RuleVersion>;\n snapshots: Map<string, KBSnapshot>;\n nextRuleVersionNumberByRuleId: Map<string, number>;\n}\n\nexport function createMemoryKbStore(): MemoryKbStore {\n return {\n sources: new Map(),\n rules: new Map(),\n ruleVersions: new Map(),\n snapshots: new Map(),\n nextRuleVersionNumberByRuleId: new Map(),\n };\n}\n\nexport interface MemoryKbHandlers {\n createRule(rule: Rule): Promise<Rule>;\n ingestSource(input: Omit<SourceDocument, 'id'>): Promise<SourceDocument>;\n upsertRuleVersion(input: {\n ruleId: string;\n content: string;\n sourceRefs: SourceRef[];\n }): Promise<RuleVersion>;\n approveRuleVersion(input: {\n ruleVersionId: string;\n approver: string;\n }): Promise<RuleVersion>;\n publishSnapshot(input: {\n jurisdiction: string;\n asOfDate: Date;\n }): Promise<KBSnapshot>;\n search(input: {\n snapshotId: string;\n jurisdiction: string;\n query: string;\n }): Promise<{ items: { ruleVersionId: string; excerpt?: string }[] }>;\n}\n\nfunction stableId(prefix: string, value: string): string {\n return `${prefix}_${value.replace(/[^a-zA-Z0-9_-]/g, '_')}`;\n}\n\nexport function createMemoryKbHandlers(store: MemoryKbStore): MemoryKbHandlers {\n async function createRule(rule: Rule): Promise<Rule> {\n store.rules.set(rule.id, rule);\n return rule;\n }\n\n async function ingestSource(\n input: Omit<SourceDocument, 'id'>\n ): Promise<SourceDocument> {\n const id = stableId('src', `${input.jurisdiction}_${input.hash}`);\n const doc: SourceDocument = { id, ...input };\n store.sources.set(id, doc);\n return doc;\n }\n\n async function upsertRuleVersion(input: {\n ruleId: string;\n content: string;\n sourceRefs: SourceRef[];\n }): Promise<RuleVersion> {\n if (!input.sourceRefs.length) {\n throw new Error('SOURCE_REFS_REQUIRED');\n }\n const rule = store.rules.get(input.ruleId);\n if (!rule) {\n throw new Error('RULE_NOT_FOUND');\n }\n const next =\n (store.nextRuleVersionNumberByRuleId.get(input.ruleId) ?? 0) + 1;\n const id = stableId('rv', `${input.ruleId}_${next}`);\n const ruleVersion: RuleVersion = {\n id,\n ruleId: input.ruleId,\n jurisdiction: rule.jurisdiction,\n topicKey: rule.topicKey,\n version: next.toString(),\n content: input.content,\n sourceRefs: input.sourceRefs,\n status: 'draft',\n createdAt: new Date(),\n approvedAt: undefined,\n approvedBy: undefined,\n };\n store.ruleVersions.set(id, ruleVersion);\n return ruleVersion;\n }\n\n async function approveRuleVersion(input: {\n ruleVersionId: string;\n approver: string;\n }): Promise<RuleVersion> {\n const existing = store.ruleVersions.get(input.ruleVersionId);\n if (!existing) {\n throw new Error('RULE_VERSION_NOT_FOUND');\n }\n const approved: RuleVersion = {\n ...existing,\n status: 'approved',\n approvedBy: input.approver,\n approvedAt: new Date(),\n };\n store.ruleVersions.set(approved.id, approved);\n return approved;\n }\n\n async function publishSnapshot(input: {\n jurisdiction: string;\n asOfDate: Date;\n }): Promise<KBSnapshot> {\n const approved = [...store.ruleVersions.values()].filter(\n (rv) => rv.status === 'approved' && rv.jurisdiction === input.jurisdiction\n );\n if (approved.length === 0) {\n throw new Error('NO_APPROVED_RULES');\n }\n const includedRuleVersionIds = approved.map((rv) => rv.id).sort();\n const id = stableId(\n 'snap',\n `${input.jurisdiction}_${input.asOfDate.toISOString().slice(0, 10)}_${includedRuleVersionIds.length}`\n );\n const snapshot: KBSnapshot = {\n id,\n jurisdiction: input.jurisdiction,\n asOfDate: input.asOfDate,\n includedRuleVersionIds,\n publishedAt: new Date(),\n };\n store.snapshots.set(id, snapshot);\n return snapshot;\n }\n\n async function search(input: {\n snapshotId: string;\n jurisdiction: string;\n query: string;\n }): Promise<{ items: { ruleVersionId: string; excerpt?: string }[] }> {\n const snapshot = store.snapshots.get(input.snapshotId);\n if (!snapshot) {\n throw new Error('SNAPSHOT_NOT_FOUND');\n }\n if (snapshot.jurisdiction !== input.jurisdiction) {\n throw new Error('JURISDICTION_MISMATCH');\n }\n const q = input.query.toLowerCase();\n const tokens = q\n .split(/\\s+/)\n .map((t) => t.trim())\n .filter(Boolean);\n const items = snapshot.includedRuleVersionIds\n .map((id) => store.ruleVersions.get(id))\n .filter((rv): rv is RuleVersion => Boolean(rv))\n .filter((rv) => {\n if (tokens.length === 0) return true;\n const hay = rv.content.toLowerCase();\n return tokens.every((token) => hay.includes(token));\n })\n .map((rv) => ({\n ruleVersionId: rv.id,\n excerpt: rv.content.slice(0, 120),\n }));\n return { items };\n }\n\n return {\n createRule,\n ingestSource,\n upsertRuleVersion,\n approveRuleVersion,\n publishSnapshot,\n search,\n };\n}\n"],"mappings":";AA+CA,SAAgB,sBAAqC;AACnD,QAAO;EACL,yBAAS,IAAI,KAAK;EAClB,uBAAO,IAAI,KAAK;EAChB,8BAAc,IAAI,KAAK;EACvB,2BAAW,IAAI,KAAK;EACpB,+CAA+B,IAAI,KAAK;EACzC;;AA0BH,SAAS,SAAS,QAAgB,OAAuB;AACvD,QAAO,GAAG,OAAO,GAAG,MAAM,QAAQ,mBAAmB,IAAI;;AAG3D,SAAgB,uBAAuB,OAAwC;CAC7E,eAAe,WAAW,MAA2B;AACnD,QAAM,MAAM,IAAI,KAAK,IAAI,KAAK;AAC9B,SAAO;;CAGT,eAAe,aACb,OACyB;EACzB,MAAM,KAAK,SAAS,OAAO,GAAG,MAAM,aAAa,GAAG,MAAM,OAAO;EACjE,MAAMA,MAAsB;GAAE;GAAI,GAAG;GAAO;AAC5C,QAAM,QAAQ,IAAI,IAAI,IAAI;AAC1B,SAAO;;CAGT,eAAe,kBAAkB,OAIR;AACvB,MAAI,CAAC,MAAM,WAAW,OACpB,OAAM,IAAI,MAAM,uBAAuB;EAEzC,MAAM,OAAO,MAAM,MAAM,IAAI,MAAM,OAAO;AAC1C,MAAI,CAAC,KACH,OAAM,IAAI,MAAM,iBAAiB;EAEnC,MAAM,QACH,MAAM,8BAA8B,IAAI,MAAM,OAAO,IAAI,KAAK;EACjE,MAAM,KAAK,SAAS,MAAM,GAAG,MAAM,OAAO,GAAG,OAAO;EACpD,MAAMC,cAA2B;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G1C,MAAM,SADI,MAAM,MAAM,aAAa,CAEhC,MAAM,MAAM,CACZ,KAAK,MAAM,EAAE,MAAM,CAAC,CACpB,OAAO,QAAQ;AAalB,SAAO,EAAE,OAZK,SAAS,uBACpB,KAAK,OAAO,MAAM,aAAa,IAAI,GAAG,CAAC,CACvC,QAAQ,OAA0B,QAAQ,GAAG,CAAC,CAC9C,QAAQ,OAAO;AACd,OAAI,OAAO,WAAW,EAAG,QAAO;GAChC,MAAM,MAAM,GAAG,QAAQ,aAAa;AACpC,UAAO,OAAO,OAAO,UAAU,IAAI,SAAS,MAAM,CAAC;IACnD,CACD,KAAK,QAAQ;GACZ,eAAe,GAAG;GAClB,SAAS,GAAG,QAAQ,MAAM,GAAG,IAAI;GAClC,EAAE,EACW;;AAGlB,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACD"}
@@ -1,118 +1,118 @@
1
- import * as _contractspec_lib_contracts3 from "@contractspec/lib.contracts";
2
- import * as _contractspec_lib_schema50 from "@contractspec/lib.schema";
1
+ import * as _contractspec_lib_contracts0 from "@contractspec/lib.contracts";
2
+ import * as _contractspec_lib_schema0 from "@contractspec/lib.schema";
3
3
 
4
4
  //#region src/operations/kb.d.ts
5
- declare const KbIngestSourceContract: _contractspec_lib_contracts3.OperationSpec<_contractspec_lib_schema50.SchemaModel<{
5
+ declare const KbIngestSourceContract: _contractspec_lib_contracts0.OperationSpec<_contractspec_lib_schema0.SchemaModel<{
6
6
  jurisdiction: {
7
- type: _contractspec_lib_schema50.FieldType<string, string>;
7
+ type: _contractspec_lib_schema0.FieldType<string, string>;
8
8
  isOptional: false;
9
9
  };
10
10
  authority: {
11
- type: _contractspec_lib_schema50.FieldType<string, string>;
11
+ type: _contractspec_lib_schema0.FieldType<string, string>;
12
12
  isOptional: false;
13
13
  };
14
14
  title: {
15
- type: _contractspec_lib_schema50.FieldType<string, string>;
15
+ type: _contractspec_lib_schema0.FieldType<string, string>;
16
16
  isOptional: false;
17
17
  };
18
18
  fetchedAt: {
19
- type: _contractspec_lib_schema50.FieldType<Date, string>;
19
+ type: _contractspec_lib_schema0.FieldType<Date, string>;
20
20
  isOptional: false;
21
21
  };
22
22
  hash: {
23
- type: _contractspec_lib_schema50.FieldType<string, string>;
23
+ type: _contractspec_lib_schema0.FieldType<string, string>;
24
24
  isOptional: false;
25
25
  };
26
26
  fileId: {
27
- type: _contractspec_lib_schema50.FieldType<string, string>;
27
+ type: _contractspec_lib_schema0.FieldType<string, string>;
28
28
  isOptional: false;
29
29
  };
30
- }>, _contractspec_lib_schema50.SchemaModel<{
30
+ }>, _contractspec_lib_schema0.SchemaModel<{
31
31
  id: {
32
- type: _contractspec_lib_schema50.FieldType<string, string>;
32
+ type: _contractspec_lib_schema0.FieldType<string, string>;
33
33
  isOptional: false;
34
34
  };
35
35
  jurisdiction: {
36
- type: _contractspec_lib_schema50.FieldType<string, string>;
36
+ type: _contractspec_lib_schema0.FieldType<string, string>;
37
37
  isOptional: false;
38
38
  };
39
39
  authority: {
40
- type: _contractspec_lib_schema50.FieldType<string, string>;
40
+ type: _contractspec_lib_schema0.FieldType<string, string>;
41
41
  isOptional: false;
42
42
  };
43
43
  title: {
44
- type: _contractspec_lib_schema50.FieldType<string, string>;
44
+ type: _contractspec_lib_schema0.FieldType<string, string>;
45
45
  isOptional: false;
46
46
  };
47
47
  fetchedAt: {
48
- type: _contractspec_lib_schema50.FieldType<Date, string>;
48
+ type: _contractspec_lib_schema0.FieldType<Date, string>;
49
49
  isOptional: false;
50
50
  };
51
51
  hash: {
52
- type: _contractspec_lib_schema50.FieldType<string, string>;
52
+ type: _contractspec_lib_schema0.FieldType<string, string>;
53
53
  isOptional: false;
54
54
  };
55
55
  fileId: {
56
- type: _contractspec_lib_schema50.FieldType<string, string>;
56
+ type: _contractspec_lib_schema0.FieldType<string, string>;
57
57
  isOptional: false;
58
58
  };
59
59
  }>, undefined>;
60
- declare const KbUpsertRuleVersionContract: _contractspec_lib_contracts3.OperationSpec<_contractspec_lib_schema50.SchemaModel<{
60
+ declare const KbUpsertRuleVersionContract: _contractspec_lib_contracts0.OperationSpec<_contractspec_lib_schema0.SchemaModel<{
61
61
  ruleId: {
62
- type: _contractspec_lib_schema50.FieldType<string, string>;
62
+ type: _contractspec_lib_schema0.FieldType<string, string>;
63
63
  isOptional: false;
64
64
  };
65
65
  content: {
66
- type: _contractspec_lib_schema50.FieldType<string, string>;
66
+ type: _contractspec_lib_schema0.FieldType<string, string>;
67
67
  isOptional: false;
68
68
  };
69
69
  sourceRefs: {
70
- type: _contractspec_lib_schema50.SchemaModel<{
70
+ type: _contractspec_lib_schema0.SchemaModel<{
71
71
  sourceDocumentId: {
72
- type: _contractspec_lib_schema50.FieldType<string, string>;
72
+ type: _contractspec_lib_schema0.FieldType<string, string>;
73
73
  isOptional: false;
74
74
  };
75
75
  excerpt: {
76
- type: _contractspec_lib_schema50.FieldType<string, string>;
76
+ type: _contractspec_lib_schema0.FieldType<string, string>;
77
77
  isOptional: true;
78
78
  };
79
79
  }>;
80
80
  isArray: true;
81
81
  isOptional: false;
82
82
  };
83
- }>, _contractspec_lib_schema50.SchemaModel<{
83
+ }>, _contractspec_lib_schema0.SchemaModel<{
84
84
  id: {
85
- type: _contractspec_lib_schema50.FieldType<string, string>;
85
+ type: _contractspec_lib_schema0.FieldType<string, string>;
86
86
  isOptional: false;
87
87
  };
88
88
  ruleId: {
89
- type: _contractspec_lib_schema50.FieldType<string, string>;
89
+ type: _contractspec_lib_schema0.FieldType<string, string>;
90
90
  isOptional: false;
91
91
  };
92
92
  jurisdiction: {
93
- type: _contractspec_lib_schema50.FieldType<string, string>;
93
+ type: _contractspec_lib_schema0.FieldType<string, string>;
94
94
  isOptional: false;
95
95
  };
96
96
  topicKey: {
97
- type: _contractspec_lib_schema50.FieldType<string, string>;
97
+ type: _contractspec_lib_schema0.FieldType<string, string>;
98
98
  isOptional: false;
99
99
  };
100
100
  version: {
101
- type: _contractspec_lib_schema50.FieldType<number, number>;
101
+ type: _contractspec_lib_schema0.FieldType<string, string>;
102
102
  isOptional: false;
103
103
  };
104
104
  content: {
105
- type: _contractspec_lib_schema50.FieldType<string, string>;
105
+ type: _contractspec_lib_schema0.FieldType<string, string>;
106
106
  isOptional: false;
107
107
  };
108
108
  sourceRefs: {
109
- type: _contractspec_lib_schema50.SchemaModel<{
109
+ type: _contractspec_lib_schema0.SchemaModel<{
110
110
  sourceDocumentId: {
111
- type: _contractspec_lib_schema50.FieldType<string, string>;
111
+ type: _contractspec_lib_schema0.FieldType<string, string>;
112
112
  isOptional: false;
113
113
  };
114
114
  excerpt: {
115
- type: _contractspec_lib_schema50.FieldType<string, string>;
115
+ type: _contractspec_lib_schema0.FieldType<string, string>;
116
116
  isOptional: true;
117
117
  };
118
118
  }>;
@@ -120,64 +120,64 @@ declare const KbUpsertRuleVersionContract: _contractspec_lib_contracts3.Operatio
120
120
  isOptional: false;
121
121
  };
122
122
  status: {
123
- type: _contractspec_lib_schema50.FieldType<string, string>;
123
+ type: _contractspec_lib_schema0.FieldType<string, string>;
124
124
  isOptional: false;
125
125
  };
126
126
  approvedBy: {
127
- type: _contractspec_lib_schema50.FieldType<string, string>;
127
+ type: _contractspec_lib_schema0.FieldType<string, string>;
128
128
  isOptional: true;
129
129
  };
130
130
  approvedAt: {
131
- type: _contractspec_lib_schema50.FieldType<Date, string>;
131
+ type: _contractspec_lib_schema0.FieldType<Date, string>;
132
132
  isOptional: true;
133
133
  };
134
134
  createdAt: {
135
- type: _contractspec_lib_schema50.FieldType<Date, string>;
135
+ type: _contractspec_lib_schema0.FieldType<Date, string>;
136
136
  isOptional: false;
137
137
  };
138
138
  }>, undefined>;
139
- declare const KbApproveRuleVersionContract: _contractspec_lib_contracts3.OperationSpec<_contractspec_lib_schema50.SchemaModel<{
139
+ declare const KbApproveRuleVersionContract: _contractspec_lib_contracts0.OperationSpec<_contractspec_lib_schema0.SchemaModel<{
140
140
  ruleVersionId: {
141
- type: _contractspec_lib_schema50.FieldType<string, string>;
141
+ type: _contractspec_lib_schema0.FieldType<string, string>;
142
142
  isOptional: false;
143
143
  };
144
144
  approver: {
145
- type: _contractspec_lib_schema50.FieldType<string, string>;
145
+ type: _contractspec_lib_schema0.FieldType<string, string>;
146
146
  isOptional: false;
147
147
  };
148
- }>, _contractspec_lib_schema50.SchemaModel<{
148
+ }>, _contractspec_lib_schema0.SchemaModel<{
149
149
  id: {
150
- type: _contractspec_lib_schema50.FieldType<string, string>;
150
+ type: _contractspec_lib_schema0.FieldType<string, string>;
151
151
  isOptional: false;
152
152
  };
153
153
  ruleId: {
154
- type: _contractspec_lib_schema50.FieldType<string, string>;
154
+ type: _contractspec_lib_schema0.FieldType<string, string>;
155
155
  isOptional: false;
156
156
  };
157
157
  jurisdiction: {
158
- type: _contractspec_lib_schema50.FieldType<string, string>;
158
+ type: _contractspec_lib_schema0.FieldType<string, string>;
159
159
  isOptional: false;
160
160
  };
161
161
  topicKey: {
162
- type: _contractspec_lib_schema50.FieldType<string, string>;
162
+ type: _contractspec_lib_schema0.FieldType<string, string>;
163
163
  isOptional: false;
164
164
  };
165
165
  version: {
166
- type: _contractspec_lib_schema50.FieldType<number, number>;
166
+ type: _contractspec_lib_schema0.FieldType<string, string>;
167
167
  isOptional: false;
168
168
  };
169
169
  content: {
170
- type: _contractspec_lib_schema50.FieldType<string, string>;
170
+ type: _contractspec_lib_schema0.FieldType<string, string>;
171
171
  isOptional: false;
172
172
  };
173
173
  sourceRefs: {
174
- type: _contractspec_lib_schema50.SchemaModel<{
174
+ type: _contractspec_lib_schema0.SchemaModel<{
175
175
  sourceDocumentId: {
176
- type: _contractspec_lib_schema50.FieldType<string, string>;
176
+ type: _contractspec_lib_schema0.FieldType<string, string>;
177
177
  isOptional: false;
178
178
  };
179
179
  excerpt: {
180
- type: _contractspec_lib_schema50.FieldType<string, string>;
180
+ type: _contractspec_lib_schema0.FieldType<string, string>;
181
181
  isOptional: true;
182
182
  };
183
183
  }>;
@@ -185,76 +185,76 @@ declare const KbApproveRuleVersionContract: _contractspec_lib_contracts3.Operati
185
185
  isOptional: false;
186
186
  };
187
187
  status: {
188
- type: _contractspec_lib_schema50.FieldType<string, string>;
188
+ type: _contractspec_lib_schema0.FieldType<string, string>;
189
189
  isOptional: false;
190
190
  };
191
191
  approvedBy: {
192
- type: _contractspec_lib_schema50.FieldType<string, string>;
192
+ type: _contractspec_lib_schema0.FieldType<string, string>;
193
193
  isOptional: true;
194
194
  };
195
195
  approvedAt: {
196
- type: _contractspec_lib_schema50.FieldType<Date, string>;
196
+ type: _contractspec_lib_schema0.FieldType<Date, string>;
197
197
  isOptional: true;
198
198
  };
199
199
  createdAt: {
200
- type: _contractspec_lib_schema50.FieldType<Date, string>;
200
+ type: _contractspec_lib_schema0.FieldType<Date, string>;
201
201
  isOptional: false;
202
202
  };
203
203
  }>, undefined>;
204
- declare const KbPublishSnapshotContract: _contractspec_lib_contracts3.OperationSpec<_contractspec_lib_schema50.SchemaModel<{
204
+ declare const KbPublishSnapshotContract: _contractspec_lib_contracts0.OperationSpec<_contractspec_lib_schema0.SchemaModel<{
205
205
  jurisdiction: {
206
- type: _contractspec_lib_schema50.FieldType<string, string>;
206
+ type: _contractspec_lib_schema0.FieldType<string, string>;
207
207
  isOptional: false;
208
208
  };
209
209
  asOfDate: {
210
- type: _contractspec_lib_schema50.FieldType<Date, string>;
210
+ type: _contractspec_lib_schema0.FieldType<Date, string>;
211
211
  isOptional: false;
212
212
  };
213
- }>, _contractspec_lib_schema50.SchemaModel<{
213
+ }>, _contractspec_lib_schema0.SchemaModel<{
214
214
  id: {
215
- type: _contractspec_lib_schema50.FieldType<string, string>;
215
+ type: _contractspec_lib_schema0.FieldType<string, string>;
216
216
  isOptional: false;
217
217
  };
218
218
  jurisdiction: {
219
- type: _contractspec_lib_schema50.FieldType<string, string>;
219
+ type: _contractspec_lib_schema0.FieldType<string, string>;
220
220
  isOptional: false;
221
221
  };
222
222
  asOfDate: {
223
- type: _contractspec_lib_schema50.FieldType<Date, string>;
223
+ type: _contractspec_lib_schema0.FieldType<Date, string>;
224
224
  isOptional: false;
225
225
  };
226
226
  includedRuleVersionIds: {
227
- type: _contractspec_lib_schema50.FieldType<string, string>;
227
+ type: _contractspec_lib_schema0.FieldType<string, string>;
228
228
  isArray: true;
229
229
  isOptional: false;
230
230
  };
231
231
  publishedAt: {
232
- type: _contractspec_lib_schema50.FieldType<Date, string>;
232
+ type: _contractspec_lib_schema0.FieldType<Date, string>;
233
233
  isOptional: false;
234
234
  };
235
235
  }>, undefined>;
236
- declare const KbSearchContract: _contractspec_lib_contracts3.OperationSpec<_contractspec_lib_schema50.SchemaModel<{
236
+ declare const KbSearchContract: _contractspec_lib_contracts0.OperationSpec<_contractspec_lib_schema0.SchemaModel<{
237
237
  snapshotId: {
238
- type: _contractspec_lib_schema50.FieldType<string, string>;
238
+ type: _contractspec_lib_schema0.FieldType<string, string>;
239
239
  isOptional: false;
240
240
  };
241
241
  jurisdiction: {
242
- type: _contractspec_lib_schema50.FieldType<string, string>;
242
+ type: _contractspec_lib_schema0.FieldType<string, string>;
243
243
  isOptional: false;
244
244
  };
245
245
  query: {
246
- type: _contractspec_lib_schema50.FieldType<string, string>;
246
+ type: _contractspec_lib_schema0.FieldType<string, string>;
247
247
  isOptional: false;
248
248
  };
249
- }>, _contractspec_lib_schema50.SchemaModel<{
249
+ }>, _contractspec_lib_schema0.SchemaModel<{
250
250
  items: {
251
- type: _contractspec_lib_schema50.SchemaModel<{
251
+ type: _contractspec_lib_schema0.SchemaModel<{
252
252
  ruleVersionId: {
253
- type: _contractspec_lib_schema50.FieldType<string, string>;
253
+ type: _contractspec_lib_schema0.FieldType<string, string>;
254
254
  isOptional: false;
255
255
  };
256
256
  excerpt: {
257
- type: _contractspec_lib_schema50.FieldType<string, string>;
257
+ type: _contractspec_lib_schema0.FieldType<string, string>;
258
258
  isOptional: true;
259
259
  };
260
260
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"kb.d.ts","names":[],"sources":["../../src/operations/kb.ts"],"sourcesContent":[],"mappings":";;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}
@@ -124,7 +124,7 @@ const KbIngestSourceContract = defineCommand({
124
124
  meta: {
125
125
  key: "kb.ingestSource",
126
126
  title: "Ingest Source",
127
- version: 1,
127
+ version: "1.0.0",
128
128
  stability: "experimental",
129
129
  owners: ["@examples"],
130
130
  tags: [
@@ -146,7 +146,7 @@ const KbUpsertRuleVersionContract = defineCommand({
146
146
  meta: {
147
147
  key: "kb.upsertRuleVersion",
148
148
  title: "Upsert Rule Version",
149
- version: 1,
149
+ version: "1.0.0",
150
150
  stability: "experimental",
151
151
  owners: ["@examples"],
152
152
  tags: [
@@ -182,7 +182,7 @@ const KbApproveRuleVersionContract = defineCommand({
182
182
  meta: {
183
183
  key: "kb.approveRuleVersion",
184
184
  title: "Approve Rule Version",
185
- version: 1,
185
+ version: "1.0.0",
186
186
  stability: "experimental",
187
187
  owners: ["@examples"],
188
188
  tags: [
@@ -204,7 +204,7 @@ const KbPublishSnapshotContract = defineCommand({
204
204
  meta: {
205
205
  key: "kb.publishSnapshot",
206
206
  title: "Publish Snapshot",
207
- version: 1,
207
+ version: "1.0.0",
208
208
  stability: "experimental",
209
209
  owners: ["@examples"],
210
210
  tags: [
@@ -232,7 +232,7 @@ const KbSearchContract = defineQuery({
232
232
  meta: {
233
233
  key: "kb.search",
234
234
  title: "Search KB",
235
- version: 1,
235
+ version: "1.0.0",
236
236
  stability: "experimental",
237
237
  owners: ["@examples"],
238
238
  tags: [
@@ -1 +1 @@
1
- {"version":3,"file":"kb.js","names":["defineSchemaModel"],"sources":["../../src/operations/kb.ts"],"sourcesContent":["import { defineCommand, defineQuery } from '@contractspec/lib.contracts';\nimport { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\n\nimport {\n KBSnapshotModel,\n RuleVersionModel,\n SourceDocumentModel,\n SourceRefModel,\n} from '../entities/models';\n\nconst IngestSourceInput = defineSchemaModel({\n name: 'KbIngestSourceInput',\n description: 'Ingest immutable source metadata referencing a stored file.',\n fields: {\n jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n authority: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n fetchedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n hash: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst UpsertRuleVersionInput = defineSchemaModel({\n name: 'KbUpsertRuleVersionInput',\n description: 'Create a new draft rule version (immutable history).',\n fields: {\n ruleId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n content: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n sourceRefs: { type: SourceRefModel, isArray: true, isOptional: false },\n },\n});\n\nconst ApproveRuleVersionInput = defineSchemaModel({\n name: 'KbApproveRuleVersionInput',\n description: 'Approve a rule version (human verification).',\n fields: {\n ruleVersionId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n approver: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst PublishSnapshotInput = defineSchemaModel({\n name: 'KbPublishSnapshotInput',\n description: 'Publish a snapshot for a jurisdiction as-of a date.',\n fields: {\n jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n asOfDate: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst SearchKbInput = defineSchemaModel({\n name: 'KbSearchInput',\n description: 'Search within a published snapshot.',\n fields: {\n snapshotId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n query: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst SearchKbResultItem = defineSchemaModel({\n name: 'KbSearchResultItem',\n description: 'Search result referencing a specific rule version.',\n fields: {\n ruleVersionId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n excerpt: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\nconst SearchKbOutput = defineSchemaModel({\n name: 'KbSearchOutput',\n description: 'Search results constrained to snapshot + jurisdiction.',\n fields: {\n items: { type: SearchKbResultItem, isArray: true, isOptional: false },\n },\n});\n\nexport const KbIngestSourceContract = defineCommand({\n meta: {\n key: 'kb.ingestSource',\n title: 'Ingest Source',\n version: 1,\n stability: 'experimental',\n owners: ['@examples'],\n tags: ['knowledge', 'sources', 'ingestion'],\n description: 'Ingest immutable source document metadata.',\n goal: 'Store traceable source documents for curated KB.',\n context: 'Called when an admin uploads/records authoritative sources.',\n },\n io: {\n input: IngestSourceInput,\n output: SourceDocumentModel,\n },\n policy: { auth: 'user' },\n});\n\nexport const KbUpsertRuleVersionContract = defineCommand({\n meta: {\n key: 'kb.upsertRuleVersion',\n title: 'Upsert Rule Version',\n version: 1,\n stability: 'experimental',\n owners: ['@examples'],\n tags: ['knowledge', 'rules', 'versioning'],\n description: 'Create a new draft rule version with source references.',\n goal: 'Propose curated knowledge updates with traceability.',\n context: 'Automation or curators propose draft rule versions.',\n },\n io: {\n input: UpsertRuleVersionInput,\n output: RuleVersionModel,\n errors: {\n SOURCE_REFS_REQUIRED: {\n description: 'Rule version must cite at least one sourceRef',\n http: 400,\n gqlCode: 'SOURCE_REFS_REQUIRED',\n when: 'sourceRefs is empty',\n },\n RULE_NOT_FOUND: {\n description: 'Rule does not exist',\n http: 404,\n gqlCode: 'RULE_NOT_FOUND',\n when: 'ruleId is unknown',\n },\n },\n },\n policy: { auth: 'user' },\n});\n\nexport const KbApproveRuleVersionContract = defineCommand({\n meta: {\n key: 'kb.approveRuleVersion',\n title: 'Approve Rule Version',\n version: 1,\n stability: 'experimental',\n owners: ['@examples'],\n tags: ['knowledge', 'rules', 'approval'],\n description: 'Approve a draft rule version.',\n goal: 'Human verification step before publishing snapshots.',\n context: 'Curators/experts approve proposed KB changes.',\n },\n io: {\n input: ApproveRuleVersionInput,\n output: RuleVersionModel,\n },\n policy: { auth: 'user' },\n});\n\nexport const KbPublishSnapshotContract = defineCommand({\n meta: {\n key: 'kb.publishSnapshot',\n title: 'Publish Snapshot',\n version: 1,\n stability: 'experimental',\n owners: ['@examples'],\n tags: ['knowledge', 'snapshots', 'publishing'],\n description: 'Publish a KB snapshot for a jurisdiction.',\n goal: 'Create a stable snapshot that assistant answers can cite.',\n context:\n 'Publishing happens after approvals; snapshot is referenced by answers.',\n },\n io: {\n input: PublishSnapshotInput,\n output: KBSnapshotModel,\n errors: {\n NO_APPROVED_RULES: {\n description: 'No approved rule versions available to publish',\n http: 409,\n gqlCode: 'NO_APPROVED_RULES',\n when: 'jurisdiction has zero approved rule versions',\n },\n },\n },\n policy: { auth: 'user' },\n});\n\nexport const KbSearchContract = defineQuery({\n meta: {\n key: 'kb.search',\n title: 'Search KB',\n version: 1,\n stability: 'experimental',\n owners: ['@examples'],\n tags: ['knowledge', 'search', 'snapshots'],\n description: 'Search within a published KB snapshot.',\n goal: 'Provide scoped retrieval for assistant answers.',\n context: 'Assistant queries curated rules from a specific snapshot.',\n },\n io: {\n input: SearchKbInput,\n output: SearchKbOutput,\n },\n policy: { auth: 'user' },\n});\n"],"mappings":";;;;;AAUA,MAAM,oBAAoBA,oBAAkB;CAC1C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACxE,OAAO;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACpE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EACjE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE;CACF,CAAC;AAEF,MAAM,yBAAyBA,oBAAkB;CAC/C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,QAAQ;GAAE,MAAM,eAAe,iBAAi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,CAAC,YAAY;EACrB,MAAM;GAAC;GAAa;GAAU;GAAY;EAC1C,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EAAE,MAAM,QAAQ;CACzB,CAAC"}
1
+ {"version":3,"file":"kb.js","names":["defineSchemaModel"],"sources":["../../src/operations/kb.ts"],"sourcesContent":["import { defineCommand, defineQuery } from '@contractspec/lib.contracts';\nimport { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\n\nimport {\n KBSnapshotModel,\n RuleVersionModel,\n SourceDocumentModel,\n SourceRefModel,\n} from '../entities/models';\n\nconst IngestSourceInput = defineSchemaModel({\n name: 'KbIngestSourceInput',\n description: 'Ingest immutable source metadata referencing a stored file.',\n fields: {\n jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n authority: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n fetchedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n hash: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n fileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst UpsertRuleVersionInput = defineSchemaModel({\n name: 'KbUpsertRuleVersionInput',\n description: 'Create a new draft rule version (immutable history).',\n fields: {\n ruleId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n content: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n sourceRefs: { type: SourceRefModel, isArray: true, isOptional: false },\n },\n});\n\nconst ApproveRuleVersionInput = defineSchemaModel({\n name: 'KbApproveRuleVersionInput',\n description: 'Approve a rule version (human verification).',\n fields: {\n ruleVersionId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n approver: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst PublishSnapshotInput = defineSchemaModel({\n name: 'KbPublishSnapshotInput',\n description: 'Publish a snapshot for a jurisdiction as-of a date.',\n fields: {\n jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n asOfDate: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst SearchKbInput = defineSchemaModel({\n name: 'KbSearchInput',\n description: 'Search within a published snapshot.',\n fields: {\n snapshotId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n query: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n },\n});\n\nconst SearchKbResultItem = defineSchemaModel({\n name: 'KbSearchResultItem',\n description: 'Search result referencing a specific rule version.',\n fields: {\n ruleVersionId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n excerpt: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\nconst SearchKbOutput = defineSchemaModel({\n name: 'KbSearchOutput',\n description: 'Search results constrained to snapshot + jurisdiction.',\n fields: {\n items: { type: SearchKbResultItem, isArray: true, isOptional: false },\n },\n});\n\nexport const KbIngestSourceContract = defineCommand({\n meta: {\n key: 'kb.ingestSource',\n title: 'Ingest Source',\n version: '1.0.0',\n stability: 'experimental',\n owners: ['@examples'],\n tags: ['knowledge', 'sources', 'ingestion'],\n description: 'Ingest immutable source document metadata.',\n goal: 'Store traceable source documents for curated KB.',\n context: 'Called when an admin uploads/records authoritative sources.',\n },\n io: {\n input: IngestSourceInput,\n output: SourceDocumentModel,\n },\n policy: { auth: 'user' },\n});\n\nexport const KbUpsertRuleVersionContract = defineCommand({\n meta: {\n key: 'kb.upsertRuleVersion',\n title: 'Upsert Rule Version',\n version: '1.0.0',\n stability: 'experimental',\n owners: ['@examples'],\n tags: ['knowledge', 'rules', 'versioning'],\n description: 'Create a new draft rule version with source references.',\n goal: 'Propose curated knowledge updates with traceability.',\n context: 'Automation or curators propose draft rule versions.',\n },\n io: {\n input: UpsertRuleVersionInput,\n output: RuleVersionModel,\n errors: {\n SOURCE_REFS_REQUIRED: {\n description: 'Rule version must cite at least one sourceRef',\n http: 400,\n gqlCode: 'SOURCE_REFS_REQUIRED',\n when: 'sourceRefs is empty',\n },\n RULE_NOT_FOUND: {\n description: 'Rule does not exist',\n http: 404,\n gqlCode: 'RULE_NOT_FOUND',\n when: 'ruleId is unknown',\n },\n },\n },\n policy: { auth: 'user' },\n});\n\nexport const KbApproveRuleVersionContract = defineCommand({\n meta: {\n key: 'kb.approveRuleVersion',\n title: 'Approve Rule Version',\n version: '1.0.0',\n stability: 'experimental',\n owners: ['@examples'],\n tags: ['knowledge', 'rules', 'approval'],\n description: 'Approve a draft rule version.',\n goal: 'Human verification step before publishing snapshots.',\n context: 'Curators/experts approve proposed KB changes.',\n },\n io: {\n input: ApproveRuleVersionInput,\n output: RuleVersionModel,\n },\n policy: { auth: 'user' },\n});\n\nexport const KbPublishSnapshotContract = defineCommand({\n meta: {\n key: 'kb.publishSnapshot',\n title: 'Publish Snapshot',\n version: '1.0.0',\n stability: 'experimental',\n owners: ['@examples'],\n tags: ['knowledge', 'snapshots', 'publishing'],\n description: 'Publish a KB snapshot for a jurisdiction.',\n goal: 'Create a stable snapshot that assistant answers can cite.',\n context:\n 'Publishing happens after approvals; snapshot is referenced by answers.',\n },\n io: {\n input: PublishSnapshotInput,\n output: KBSnapshotModel,\n errors: {\n NO_APPROVED_RULES: {\n description: 'No approved rule versions available to publish',\n http: 409,\n gqlCode: 'NO_APPROVED_RULES',\n when: 'jurisdiction has zero approved rule versions',\n },\n },\n },\n policy: { auth: 'user' },\n});\n\nexport const KbSearchContract = defineQuery({\n meta: {\n key: 'kb.search',\n title: 'Search KB',\n version: '1.0.0',\n stability: 'experimental',\n owners: ['@examples'],\n tags: ['knowledge', 'search', 'snapshots'],\n description: 'Search within a published KB snapshot.',\n goal: 'Provide scoped retrieval for assistant answers.',\n context: 'Assistant queries curated rules from a specific snapshot.',\n },\n io: {\n input: SearchKbInput,\n output: SearchKbOutput,\n },\n policy: { auth: 'user' },\n});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AAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EAAE,MAAM,QAAQ;CACzB,CAAC;AAEF,MAAa,4BAA4B,cAAc;CACrD,MAAM;EACJ,KAAK;EACL,OAAO;EACP,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,YAAY;EACrB,MAAM;GAAC;GAAa;GAAa;GAAa;EAC9C,aAAa;EACb,MAAM;EACN,SACE;EACH;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACR,QAAQ,EACN,mBAAmB;GACjB,aAAa;GACb,MAAM;GACN,SAAS;GACT,MAAM;GACP,EACF;EACF;CACD,QAAQ,EAAE,MAAM,QAAQ;CACzB,CAAC;AAEF,MAAa,mBAAmB,YAAY;CAC1C,MAAM;EACJ,KAAK;EACL,OAAO;EACP,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,YAAY;EACrB,MAAM;GAAC;GAAa;GAAU;GAAY;EAC1C,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EACF,OAAO;EACP,QAAQ;EACT;CACD,QAAQ,EAAE,MAAM,QAAQ;CACzB,CAAC"}
@@ -2,7 +2,7 @@
2
2
  const VersionedKnowledgeBaseFeature = {
3
3
  meta: {
4
4
  key: "versioned-knowledge-base",
5
- version: 1,
5
+ version: "1.0.0",
6
6
  title: "Versioned Knowledge Base",
7
7
  description: "Curated KB with immutable sources, rule versions, and published snapshots.",
8
8
  domain: "knowledge",
@@ -17,41 +17,41 @@ const VersionedKnowledgeBaseFeature = {
17
17
  operations: [
18
18
  {
19
19
  key: "kb.ingestSource",
20
- version: 1
20
+ version: "1.0.0"
21
21
  },
22
22
  {
23
23
  key: "kb.upsertRuleVersion",
24
- version: 1
24
+ version: "1.0.0"
25
25
  },
26
26
  {
27
27
  key: "kb.approveRuleVersion",
28
- version: 1
28
+ version: "1.0.0"
29
29
  },
30
30
  {
31
31
  key: "kb.publishSnapshot",
32
- version: 1
32
+ version: "1.0.0"
33
33
  },
34
34
  {
35
35
  key: "kb.search",
36
- version: 1
36
+ version: "1.0.0"
37
37
  }
38
38
  ],
39
39
  events: [
40
40
  {
41
41
  key: "kb.source.ingested",
42
- version: 1
42
+ version: "1.0.0"
43
43
  },
44
44
  {
45
45
  key: "kb.ruleVersion.created",
46
- version: 1
46
+ version: "1.0.0"
47
47
  },
48
48
  {
49
49
  key: "kb.ruleVersion.approved",
50
- version: 1
50
+ version: "1.0.0"
51
51
  },
52
52
  {
53
53
  key: "kb.snapshot.published",
54
- version: 1
54
+ version: "1.0.0"
55
55
  }
56
56
  ],
57
57
  presentations: [],
@@ -59,7 +59,7 @@ const VersionedKnowledgeBaseFeature = {
59
59
  presentationsTargets: [],
60
60
  capabilities: { requires: [{
61
61
  key: "knowledge",
62
- version: 1
62
+ version: "1.0.0"
63
63
  }] }
64
64
  };
65
65
 
@@ -1 +1 @@
1
- {"version":3,"file":"versioned-knowledge-base.feature.js","names":["VersionedKnowledgeBaseFeature: FeatureModuleSpec"],"sources":["../src/versioned-knowledge-base.feature.ts"],"sourcesContent":["import type { FeatureModuleSpec } from '@contractspec/lib.contracts';\n\nexport const VersionedKnowledgeBaseFeature: FeatureModuleSpec = {\n meta: {\n key: 'versioned-knowledge-base',\n version: 1,\n title: 'Versioned Knowledge Base',\n description:\n 'Curated KB with immutable sources, rule versions, and published snapshots.',\n domain: 'knowledge',\n owners: ['@examples'],\n tags: ['knowledge', 'versioning', 'snapshots'],\n stability: 'experimental',\n },\n operations: [\n { key: 'kb.ingestSource', version: 1 },\n { key: 'kb.upsertRuleVersion', version: 1 },\n { key: 'kb.approveRuleVersion', version: 1 },\n { key: 'kb.publishSnapshot', version: 1 },\n { key: 'kb.search', version: 1 },\n ],\n events: [\n { key: 'kb.source.ingested', version: 1 },\n { key: 'kb.ruleVersion.created', version: 1 },\n { key: 'kb.ruleVersion.approved', version: 1 },\n { key: 'kb.snapshot.published', version: 1 },\n ],\n presentations: [],\n opToPresentation: [],\n presentationsTargets: [],\n capabilities: {\n requires: [{ key: 'knowledge', version: 1 }],\n },\n};\n"],"mappings":";AAEA,MAAaA,gCAAmD;CAC9D,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,QAAQ;EACR,QAAQ,CAAC,YAAY;EACrB,MAAM;GAAC;GAAa;GAAc;GAAY;EAC9C,WAAW;EACZ;CACD,YAAY;EACV;GAAE,KAAK;GAAmB,SAAS;GAAG;EACtC;GAAE,KAAK;GAAwB,SAAS;GAAG;EAC3C;GAAE,KAAK;GAAyB,SAAS;GAAG;EAC5C;GAAE,KAAK;GAAsB,SAAS;GAAG;EACzC;GAAE,KAAK;GAAa,SAAS;GAAG;EACjC;CACD,QAAQ;EACN;GAAE,KAAK;GAAsB,SAAS;GAAG;EACzC;GAAE,KAAK;GAA0B,SAAS;GAAG;EAC7C;GAAE,KAAK;GAA2B,SAAS;GAAG;EAC9C;GAAE,KAAK;GAAyB,SAAS;GAAG;EAC7C;CACD,eAAe,EAAE;CACjB,kBAAkB,EAAE;CACpB,sBAAsB,EAAE;CACxB,cAAc,EACZ,UAAU,CAAC;EAAE,KAAK;EAAa,SAAS;EAAG,CAAC,EAC7C;CACF"}
1
+ {"version":3,"file":"versioned-knowledge-base.feature.js","names":["VersionedKnowledgeBaseFeature: FeatureModuleSpec"],"sources":["../src/versioned-knowledge-base.feature.ts"],"sourcesContent":["import type { FeatureModuleSpec } from '@contractspec/lib.contracts';\n\nexport const VersionedKnowledgeBaseFeature: FeatureModuleSpec = {\n meta: {\n key: 'versioned-knowledge-base',\n version: '1.0.0',\n title: 'Versioned Knowledge Base',\n description:\n 'Curated KB with immutable sources, rule versions, and published snapshots.',\n domain: 'knowledge',\n owners: ['@examples'],\n tags: ['knowledge', 'versioning', 'snapshots'],\n stability: 'experimental',\n },\n operations: [\n { key: 'kb.ingestSource', version: '1.0.0' },\n { key: 'kb.upsertRuleVersion', version: '1.0.0' },\n { key: 'kb.approveRuleVersion', version: '1.0.0' },\n { key: 'kb.publishSnapshot', version: '1.0.0' },\n { key: 'kb.search', version: '1.0.0' },\n ],\n events: [\n { key: 'kb.source.ingested', version: '1.0.0' },\n { key: 'kb.ruleVersion.created', version: '1.0.0' },\n { key: 'kb.ruleVersion.approved', version: '1.0.0' },\n { key: 'kb.snapshot.published', version: '1.0.0' },\n ],\n presentations: [],\n opToPresentation: [],\n presentationsTargets: [],\n capabilities: {\n requires: [{ key: 'knowledge', version: '1.0.0' }],\n },\n};\n"],"mappings":";AAEA,MAAaA,gCAAmD;CAC9D,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,QAAQ;EACR,QAAQ,CAAC,YAAY;EACrB,MAAM;GAAC;GAAa;GAAc;GAAY;EAC9C,WAAW;EACZ;CACD,YAAY;EACV;GAAE,KAAK;GAAmB,SAAS;GAAS;EAC5C;GAAE,KAAK;GAAwB,SAAS;GAAS;EACjD;GAAE,KAAK;GAAyB,SAAS;GAAS;EAClD;GAAE,KAAK;GAAsB,SAAS;GAAS;EAC/C;GAAE,KAAK;GAAa,SAAS;GAAS;EACvC;CACD,QAAQ;EACN;GAAE,KAAK;GAAsB,SAAS;GAAS;EAC/C;GAAE,KAAK;GAA0B,SAAS;GAAS;EACnD;GAAE,KAAK;GAA2B,SAAS;GAAS;EACpD;GAAE,KAAK;GAAyB,SAAS;GAAS;EACnD;CACD,eAAe,EAAE;CACjB,kBAAkB,EAAE;CACpB,sBAAsB,EAAE;CACxB,cAAc,EACZ,UAAU,CAAC;EAAE,KAAK;EAAa,SAAS;EAAS,CAAC,EACnD;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contractspec/example.versioned-knowledge-base",
3
- "version": "1.44.0",
3
+ "version": "1.45.0",
4
4
  "description": "Example: curated, versioned knowledge base with immutable sources, rule versions, and published snapshots.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -35,13 +35,13 @@
35
35
  "test": "bun test"
36
36
  },
37
37
  "dependencies": {
38
- "@contractspec/lib.contracts": "1.44.0",
39
- "@contractspec/lib.schema": "1.44.0",
38
+ "@contractspec/lib.contracts": "1.45.0",
39
+ "@contractspec/lib.schema": "1.45.0",
40
40
  "zod": "^4.1.13"
41
41
  },
42
42
  "devDependencies": {
43
- "@contractspec/tool.tsdown": "1.44.0",
44
- "@contractspec/tool.typescript": "1.44.0",
43
+ "@contractspec/tool.tsdown": "1.45.0",
44
+ "@contractspec/tool.typescript": "1.45.0",
45
45
  "tsdown": "^0.18.3",
46
46
  "typescript": "^5.9.3"
47
47
  },
@@ -47,7 +47,7 @@ export const RuleVersionModel = defineSchemaModel({
47
47
  ruleId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
48
48
  jurisdiction: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
49
49
  topicKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
50
- version: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
50
+ version: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
51
51
  content: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
52
52
  sourceRefs: { type: SourceRefModel, isArray: true, isOptional: false },
53
53
  status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }, // draft|approved|rejected