@lssm/example.policy-safe-knowledge-assistant 0.0.0-canary-20251213172311 → 0.0.0-canary-20251215231151
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 +2 -2
- package/CHANGELOG.md +14 -14
- package/IMPLEMENTATION_SKETCH.md +1 -0
- package/README.md +1 -0
- package/package.json +2 -2
- package/src/docs/index.ts +0 -2
- package/src/docs/policy-safe-knowledge-assistant.docblock.ts +0 -2
- package/src/example.ts +4 -3
- package/src/index.ts +0 -2
- package/src/integration.test.ts +19 -7
- package/src/orchestrator/buildAnswer.ts +6 -8
- package/src/seed/fixtures.ts +0 -2
- package/src/seed/index.ts +0 -2
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/tsdown.config.js +1 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
$ bun build:bundle && bun build:types
|
|
2
2
|
$ tsdown
|
|
3
|
-
[34mℹ[39m tsdown [2mv0.17.
|
|
3
|
+
[34mℹ[39m tsdown [2mv0.17.4[22m powered by rolldown [2mv1.0.0-beta.53[22m
|
|
4
4
|
[34mℹ[39m config file: [4m/home/runner/work/contractspec/contractspec/packages/examples/policy-safe-knowledge-assistant/tsdown.config.js[24m
|
|
5
5
|
[34mℹ[39m entry: [34msrc/example.ts, src/feature.ts, src/index.ts, src/docs/index.ts, src/docs/policy-safe-knowledge-assistant.docblock.ts, src/orchestrator/buildAnswer.ts, src/seed/fixtures.ts, src/seed/index.ts[39m
|
|
6
6
|
[34mℹ[39m target: [34mesnext[39m
|
|
@@ -15,5 +15,5 @@ $ tsdown
|
|
|
15
15
|
[34mℹ[39m [2mdist/[22m[1mseed/index.js[22m [2m0.07 kB[22m [2m│ gzip: 0.08 kB[22m
|
|
16
16
|
[34mℹ[39m [2mdist/[22m[1mdocs/index.js[22m [2m0.05 kB[22m [2m│ gzip: 0.07 kB[22m
|
|
17
17
|
[34mℹ[39m 8 files, total: 6.60 kB
|
|
18
|
-
[32m✔[39m Build complete in [
|
|
18
|
+
[32m✔[39m Build complete in [32m39ms[39m
|
|
19
19
|
$ tsc --noEmit
|
package/CHANGELOG.md
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
# @lssm/example.policy-safe-knowledge-assistant
|
|
2
2
|
|
|
3
|
-
## 0.0.0-canary-
|
|
3
|
+
## 0.0.0-canary-20251215231151
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
7
|
- Updated dependencies [3086383]
|
|
8
|
-
- @lssm/lib.contracts@0.0.0-canary-
|
|
9
|
-
- @lssm/lib.jobs@0.0.0-canary-
|
|
10
|
-
- @lssm/example.kb-update-pipeline@0.0.0-canary-
|
|
11
|
-
- @lssm/example.locale-jurisdiction-gate@0.0.0-canary-
|
|
12
|
-
- @lssm/example.versioned-knowledge-base@0.0.0-canary-
|
|
13
|
-
- @lssm/lib.feature-flags@0.0.0-canary-
|
|
14
|
-
- @lssm/lib.files@0.0.0-canary-
|
|
15
|
-
- @lssm/lib.identity-rbac@0.0.0-canary-
|
|
16
|
-
- @lssm/lib.metering@0.0.0-canary-
|
|
17
|
-
- @lssm/module.audit-trail@0.0.0-canary-
|
|
18
|
-
- @lssm/module.learning-journey@0.0.0-canary-
|
|
19
|
-
- @lssm/module.notifications@0.0.0-canary-
|
|
20
|
-
- @lssm/example.learning-patterns@0.0.0-canary-
|
|
8
|
+
- @lssm/lib.contracts@0.0.0-canary-20251215231151
|
|
9
|
+
- @lssm/lib.jobs@0.0.0-canary-20251215231151
|
|
10
|
+
- @lssm/example.kb-update-pipeline@0.0.0-canary-20251215231151
|
|
11
|
+
- @lssm/example.locale-jurisdiction-gate@0.0.0-canary-20251215231151
|
|
12
|
+
- @lssm/example.versioned-knowledge-base@0.0.0-canary-20251215231151
|
|
13
|
+
- @lssm/lib.feature-flags@0.0.0-canary-20251215231151
|
|
14
|
+
- @lssm/lib.files@0.0.0-canary-20251215231151
|
|
15
|
+
- @lssm/lib.identity-rbac@0.0.0-canary-20251215231151
|
|
16
|
+
- @lssm/lib.metering@0.0.0-canary-20251215231151
|
|
17
|
+
- @lssm/module.audit-trail@0.0.0-canary-20251215231151
|
|
18
|
+
- @lssm/module.learning-journey@0.0.0-canary-20251215231151
|
|
19
|
+
- @lssm/module.notifications@0.0.0-canary-20251215231151
|
|
20
|
+
- @lssm/example.learning-patterns@0.0.0-canary-20251215231151
|
package/IMPLEMENTATION_SKETCH.md
CHANGED
package/README.md
CHANGED
|
@@ -10,3 +10,4 @@ All-in-one template example demonstrating a **policy-safe knowledge assistant**
|
|
|
10
10
|
|
|
11
11
|
This package is the **spec-first** source of truth. The sandbox UI/runtime integration lives in `@lssm/bundle.contractspec-studio`.\n+\n+## Seed scenario\n+\n+See `src/seed/fixtures.ts` for deterministic offline fixtures (no web dependencies).\n+\n+## Running tests\n+\n+```bash\n+bun test\n+```\n+
|
|
12
12
|
|
|
13
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lssm/example.policy-safe-knowledge-assistant",
|
|
3
|
-
"version": "0.0.0-canary-
|
|
3
|
+
"version": "0.0.0-canary-20251215231151",
|
|
4
4
|
"description": "All-in-one template example: policy-safe knowledge assistant with locale/jurisdiction gating, versioned KB snapshots, HITL update pipeline, and learning hub.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@lssm/tool.tsdown": "workspace:*",
|
|
48
48
|
"@lssm/tool.typescript": "workspace:*",
|
|
49
|
-
"tsdown": "^0.17.
|
|
49
|
+
"tsdown": "^0.17.4",
|
|
50
50
|
"typescript": "^5.9.3"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
package/src/docs/index.ts
CHANGED
package/src/example.ts
CHANGED
|
@@ -17,12 +17,13 @@ const example = {
|
|
|
17
17
|
},
|
|
18
18
|
surfaces: {
|
|
19
19
|
templates: true,
|
|
20
|
-
sandbox: {
|
|
20
|
+
sandbox: {
|
|
21
|
+
enabled: true,
|
|
22
|
+
modes: ['playground', 'specs', 'builder', 'markdown', 'evolution'],
|
|
23
|
+
},
|
|
21
24
|
studio: { enabled: true, installable: true },
|
|
22
25
|
mcp: { enabled: true },
|
|
23
26
|
},
|
|
24
27
|
} as const;
|
|
25
28
|
|
|
26
29
|
export default example;
|
|
27
|
-
|
|
28
|
-
|
package/src/index.ts
CHANGED
package/src/integration.test.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { describe, expect, it } from 'bun:test';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
createMemoryKbHandlers,
|
|
5
|
+
createMemoryKbStore,
|
|
6
|
+
} from '@lssm/example.versioned-knowledge-base/handlers/memory.handlers';
|
|
7
|
+
import {
|
|
8
|
+
createPipelineMemoryHandlers,
|
|
9
|
+
createPipelineMemoryStore,
|
|
10
|
+
} from '@lssm/example.kb-update-pipeline/handlers/memory.handlers';
|
|
5
11
|
|
|
6
12
|
import { buildPolicySafeAnswer } from './orchestrator/buildAnswer';
|
|
7
13
|
import { DEMO_FIXTURES } from './seed/fixtures';
|
|
@@ -23,7 +29,10 @@ describe('@lssm/example.policy-safe-knowledge-assistant integration', () => {
|
|
|
23
29
|
content: 'EU: Reporting obligations v1',
|
|
24
30
|
sourceRefs: [{ sourceDocumentId: 'src_eu_v1', excerpt: 'v1 excerpt' }],
|
|
25
31
|
});
|
|
26
|
-
await kb.approveRuleVersion({
|
|
32
|
+
await kb.approveRuleVersion({
|
|
33
|
+
ruleVersionId: rv1.id,
|
|
34
|
+
approver: 'expert_1',
|
|
35
|
+
});
|
|
27
36
|
const snap1 = await kb.publishSnapshot({
|
|
28
37
|
jurisdiction: 'EU',
|
|
29
38
|
asOfDate: new Date('2026-01-01T00:00:00.000Z'),
|
|
@@ -54,7 +63,9 @@ describe('@lssm/example.policy-safe-knowledge-assistant integration', () => {
|
|
|
54
63
|
diffSummary: 'Updated obligations',
|
|
55
64
|
riskLevel: 'high',
|
|
56
65
|
});
|
|
57
|
-
const review = await pipeline.createReviewTask({
|
|
66
|
+
const review = await pipeline.createReviewTask({
|
|
67
|
+
changeCandidateId: 'cand_1',
|
|
68
|
+
});
|
|
58
69
|
await pipeline.submitDecision({
|
|
59
70
|
reviewTaskId: review.id,
|
|
60
71
|
decision: 'approve',
|
|
@@ -68,7 +79,10 @@ describe('@lssm/example.policy-safe-knowledge-assistant integration', () => {
|
|
|
68
79
|
content: 'EU: Reporting obligations v2 (updated)',
|
|
69
80
|
sourceRefs: [{ sourceDocumentId: 'src_eu_v2', excerpt: 'v2 excerpt' }],
|
|
70
81
|
});
|
|
71
|
-
await kb.approveRuleVersion({
|
|
82
|
+
await kb.approveRuleVersion({
|
|
83
|
+
ruleVersionId: rv2.id,
|
|
84
|
+
approver: 'expert_2',
|
|
85
|
+
});
|
|
72
86
|
|
|
73
87
|
// Link pipeline proposal to the actual KB rule version id, then mark it approved
|
|
74
88
|
await pipeline.proposeRulePatch({
|
|
@@ -92,5 +106,3 @@ describe('@lssm/example.policy-safe-knowledge-assistant integration', () => {
|
|
|
92
106
|
expect(a2.citations[0]?.kbSnapshotId).toBe(snap2.id);
|
|
93
107
|
});
|
|
94
108
|
});
|
|
95
|
-
|
|
96
|
-
|
|
@@ -6,23 +6,23 @@ import {
|
|
|
6
6
|
|
|
7
7
|
type AllowedScope = 'education_only' | 'generic_info' | 'escalation_required';
|
|
8
8
|
|
|
9
|
-
export
|
|
9
|
+
export interface AssistantAnswerIR {
|
|
10
10
|
locale: string;
|
|
11
11
|
jurisdiction: string;
|
|
12
12
|
allowedScope: AllowedScope;
|
|
13
|
-
sections:
|
|
14
|
-
citations:
|
|
13
|
+
sections: { heading: string; body: string }[];
|
|
14
|
+
citations: {
|
|
15
15
|
kbSnapshotId: string;
|
|
16
16
|
sourceType: string;
|
|
17
17
|
sourceId: string;
|
|
18
18
|
title?: string;
|
|
19
19
|
excerpt?: string;
|
|
20
|
-
}
|
|
20
|
+
}[];
|
|
21
21
|
disclaimers?: string[];
|
|
22
22
|
riskFlags?: string[];
|
|
23
23
|
refused?: boolean;
|
|
24
24
|
refusalReason?: string;
|
|
25
|
-
}
|
|
25
|
+
}
|
|
26
26
|
|
|
27
27
|
export interface BuildAnswerInput {
|
|
28
28
|
envelope: {
|
|
@@ -37,7 +37,7 @@ export interface BuildAnswerInput {
|
|
|
37
37
|
snapshotId: string;
|
|
38
38
|
jurisdiction: string;
|
|
39
39
|
query: string;
|
|
40
|
-
}) => Promise<{ items:
|
|
40
|
+
}) => Promise<{ items: { ruleVersionId: string; excerpt?: string }[] }>;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
/**
|
|
@@ -120,5 +120,3 @@ export async function buildPolicySafeAnswer(
|
|
|
120
120
|
|
|
121
121
|
return draft;
|
|
122
122
|
}
|
|
123
|
-
|
|
124
|
-
|
package/src/seed/fixtures.ts
CHANGED
package/src/seed/index.ts
CHANGED
package/tsconfig.json
CHANGED