@contractspec/example.policy-safe-knowledge-assistant 1.57.0 → 1.58.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.
- package/.turbo/turbo-build.log +58 -60
- package/.turbo/turbo-prebuild.log +1 -0
- package/CHANGELOG.md +21 -0
- package/dist/browser/docs/index.js +38 -0
- package/dist/browser/docs/policy-safe-knowledge-assistant.docblock.js +38 -0
- package/dist/browser/example.js +37 -0
- package/dist/browser/handlers/index.js +334 -0
- package/dist/browser/handlers/policy-safe-knowledge-assistant.handlers.js +334 -0
- package/dist/browser/index.js +917 -0
- package/dist/browser/orchestrator/buildAnswer.js +73 -0
- package/dist/browser/policy-safe-knowledge-assistant.feature.js +57 -0
- package/dist/browser/seed/fixtures.js +35 -0
- package/dist/browser/seed/index.js +35 -0
- package/dist/browser/seeders/index.js +12 -0
- package/dist/browser/ui/PolicySafeKnowledgeAssistantDashboard.js +420 -0
- package/dist/browser/ui/hooks/usePolicySafeKnowledgeAssistant.js +154 -0
- package/dist/browser/ui/index.js +420 -0
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +39 -1
- package/dist/docs/policy-safe-knowledge-assistant.docblock.d.ts +2 -1
- package/dist/docs/policy-safe-knowledge-assistant.docblock.d.ts.map +1 -0
- package/dist/docs/policy-safe-knowledge-assistant.docblock.js +37 -33
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +36 -51
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +334 -2
- package/dist/handlers/policy-safe-knowledge-assistant.handlers.d.ts +124 -121
- package/dist/handlers/policy-safe-knowledge-assistant.handlers.d.ts.map +1 -1
- package/dist/handlers/policy-safe-knowledge-assistant.handlers.js +325 -254
- package/dist/index.d.ts +11 -8
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +918 -10
- package/dist/integration.test.d.ts +2 -0
- package/dist/integration.test.d.ts.map +1 -0
- package/dist/node/docs/index.js +38 -0
- package/dist/node/docs/policy-safe-knowledge-assistant.docblock.js +38 -0
- package/dist/node/example.js +37 -0
- package/dist/node/handlers/index.js +334 -0
- package/dist/node/handlers/policy-safe-knowledge-assistant.handlers.js +334 -0
- package/dist/node/index.js +917 -0
- package/dist/node/orchestrator/buildAnswer.js +73 -0
- package/dist/node/policy-safe-knowledge-assistant.feature.js +57 -0
- package/dist/node/seed/fixtures.js +35 -0
- package/dist/node/seed/index.js +35 -0
- package/dist/node/seeders/index.js +12 -0
- package/dist/node/ui/PolicySafeKnowledgeAssistantDashboard.js +420 -0
- package/dist/node/ui/hooks/usePolicySafeKnowledgeAssistant.js +154 -0
- package/dist/node/ui/index.js +420 -0
- package/dist/orchestrator/buildAnswer.d.ts +40 -42
- package/dist/orchestrator/buildAnswer.d.ts.map +1 -1
- package/dist/orchestrator/buildAnswer.js +72 -75
- package/dist/policy-safe-knowledge-assistant.feature.d.ts +1 -6
- package/dist/policy-safe-knowledge-assistant.feature.d.ts.map +1 -1
- package/dist/policy-safe-knowledge-assistant.feature.js +56 -148
- package/dist/seed/fixtures.d.ts +28 -31
- package/dist/seed/fixtures.d.ts.map +1 -1
- package/dist/seed/fixtures.js +35 -33
- package/dist/seed/index.d.ts +2 -2
- package/dist/seed/index.d.ts.map +1 -0
- package/dist/seed/index.js +36 -3
- package/dist/seeders/index.d.ts +4 -8
- package/dist/seeders/index.d.ts.map +1 -1
- package/dist/seeders/index.js +11 -14
- package/dist/ui/PolicySafeKnowledgeAssistantDashboard.d.ts +1 -6
- package/dist/ui/PolicySafeKnowledgeAssistantDashboard.d.ts.map +1 -1
- package/dist/ui/PolicySafeKnowledgeAssistantDashboard.js +415 -225
- package/dist/ui/hooks/usePolicySafeKnowledgeAssistant.d.ts +49 -51
- package/dist/ui/hooks/usePolicySafeKnowledgeAssistant.d.ts.map +1 -1
- package/dist/ui/hooks/usePolicySafeKnowledgeAssistant.js +147 -185
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +420 -2
- package/package.json +173 -44
- package/tsdown.config.js +1 -2
- package/.turbo/turbo-build$colon$bundle.log +0 -60
- package/dist/docs/policy-safe-knowledge-assistant.docblock.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/handlers/policy-safe-knowledge-assistant.handlers.js.map +0 -1
- package/dist/orchestrator/buildAnswer.js.map +0 -1
- package/dist/policy-safe-knowledge-assistant.feature.js.map +0 -1
- package/dist/seed/fixtures.js.map +0 -1
- package/dist/seeders/index.js.map +0 -1
- package/dist/ui/PolicySafeKnowledgeAssistantDashboard.js.map +0 -1
- package/dist/ui/hooks/usePolicySafeKnowledgeAssistant.js.map +0 -1
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,126 +1,129 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Runtime-local handlers for the Policy-safe Knowledge Assistant template.
|
|
3
|
+
*
|
|
4
|
+
* These handlers are intentionally minimal and deterministic:
|
|
5
|
+
* - No external LLM calls
|
|
6
|
+
* - No web fetching as primary truth
|
|
7
|
+
* - Answers are derived from KB snapshots and must include citations
|
|
8
|
+
*/
|
|
9
|
+
import type { DatabasePort } from '@contractspec/lib.runtime-sandbox';
|
|
6
10
|
type AllowedScope = 'education_only' | 'generic_info' | 'escalation_required';
|
|
7
11
|
type RiskLevel = 'low' | 'medium' | 'high';
|
|
8
12
|
type ReviewRole = 'curator' | 'expert';
|
|
9
|
-
declare function createPolicySafeKnowledgeAssistantHandlers(db: DatabasePort): {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
13
|
+
export declare function createPolicySafeKnowledgeAssistantHandlers(db: DatabasePort): {
|
|
14
|
+
getUserContext: (input: {
|
|
15
|
+
projectId: string;
|
|
16
|
+
}) => Promise<{
|
|
17
|
+
projectId: string;
|
|
18
|
+
locale: string;
|
|
19
|
+
jurisdiction: string;
|
|
20
|
+
allowedScope: AllowedScope;
|
|
21
|
+
kbSnapshotId: string | null;
|
|
22
|
+
}>;
|
|
23
|
+
setUserContext: (input: {
|
|
24
|
+
projectId: string;
|
|
25
|
+
locale: string;
|
|
26
|
+
jurisdiction: string;
|
|
27
|
+
allowedScope: AllowedScope;
|
|
28
|
+
}) => Promise<{
|
|
29
|
+
projectId: string;
|
|
30
|
+
locale: string;
|
|
31
|
+
jurisdiction: string;
|
|
32
|
+
allowedScope: AllowedScope;
|
|
33
|
+
kbSnapshotId: string | null;
|
|
34
|
+
}>;
|
|
35
|
+
createRule: (input: {
|
|
36
|
+
projectId: string;
|
|
37
|
+
jurisdiction: string;
|
|
38
|
+
topicKey: string;
|
|
39
|
+
}) => Promise<{
|
|
40
|
+
projectId: string;
|
|
41
|
+
jurisdiction: string;
|
|
42
|
+
topicKey: string;
|
|
43
|
+
id: string;
|
|
44
|
+
}>;
|
|
45
|
+
upsertRuleVersion: (input: {
|
|
46
|
+
projectId: string;
|
|
47
|
+
ruleId: string;
|
|
48
|
+
content: string;
|
|
49
|
+
sourceRefs: {
|
|
50
|
+
sourceDocumentId: string;
|
|
51
|
+
excerpt?: string;
|
|
52
|
+
}[];
|
|
53
|
+
}) => Promise<{
|
|
54
|
+
id: string;
|
|
55
|
+
ruleId: string;
|
|
56
|
+
jurisdiction: string;
|
|
57
|
+
topicKey: string;
|
|
58
|
+
version: number;
|
|
59
|
+
content: string;
|
|
60
|
+
status: string;
|
|
61
|
+
sourceRefs: {
|
|
62
|
+
sourceDocumentId: string;
|
|
63
|
+
excerpt?: string;
|
|
64
|
+
}[];
|
|
65
|
+
createdAt: Date;
|
|
66
|
+
}>;
|
|
67
|
+
approveRuleVersion: (input: {
|
|
68
|
+
ruleVersionId: string;
|
|
69
|
+
approver: string;
|
|
70
|
+
}) => Promise<{
|
|
71
|
+
ruleVersionId: string;
|
|
72
|
+
status: "approved";
|
|
73
|
+
}>;
|
|
74
|
+
publishSnapshot: (input: {
|
|
75
|
+
projectId: string;
|
|
76
|
+
jurisdiction: string;
|
|
77
|
+
asOfDate: Date;
|
|
78
|
+
}) => Promise<{
|
|
79
|
+
id: string;
|
|
80
|
+
jurisdiction: string;
|
|
81
|
+
includedRuleVersionIds: string[];
|
|
82
|
+
}>;
|
|
83
|
+
searchKb: (input: {
|
|
84
|
+
snapshotId: string;
|
|
85
|
+
jurisdiction: string;
|
|
86
|
+
query: string;
|
|
87
|
+
}) => Promise<{
|
|
88
|
+
items: {
|
|
89
|
+
ruleVersionId: string;
|
|
90
|
+
excerpt?: string;
|
|
91
|
+
}[];
|
|
92
|
+
}>;
|
|
93
|
+
answer: (input: {
|
|
94
|
+
projectId: string;
|
|
95
|
+
question: string;
|
|
96
|
+
}) => Promise<import("..").AssistantAnswerIR>;
|
|
97
|
+
createChangeCandidate: (input: {
|
|
98
|
+
projectId: string;
|
|
99
|
+
jurisdiction: string;
|
|
100
|
+
diffSummary: string;
|
|
101
|
+
riskLevel: RiskLevel;
|
|
102
|
+
proposedRuleVersionIds: string[];
|
|
103
|
+
}) => Promise<{
|
|
104
|
+
id: string;
|
|
105
|
+
}>;
|
|
106
|
+
createReviewTask: (input: {
|
|
107
|
+
changeCandidateId: string;
|
|
108
|
+
}) => Promise<{
|
|
109
|
+
id: string;
|
|
110
|
+
assignedRole: ReviewRole;
|
|
111
|
+
}>;
|
|
112
|
+
submitDecision: (input: {
|
|
113
|
+
reviewTaskId: string;
|
|
114
|
+
decision: "approve" | "reject";
|
|
115
|
+
decidedByRole: ReviewRole;
|
|
116
|
+
decidedBy: string;
|
|
117
|
+
}) => Promise<{
|
|
118
|
+
id: string;
|
|
119
|
+
status: "decided";
|
|
120
|
+
}>;
|
|
121
|
+
publishIfReady: (input: {
|
|
122
|
+
jurisdiction: string;
|
|
123
|
+
}) => Promise<{
|
|
124
|
+
published: true;
|
|
125
|
+
}>;
|
|
122
126
|
};
|
|
123
|
-
type PolicySafeKnowledgeAssistantHandlers = ReturnType<typeof createPolicySafeKnowledgeAssistantHandlers>;
|
|
124
|
-
|
|
125
|
-
export { PolicySafeKnowledgeAssistantHandlers, createPolicySafeKnowledgeAssistantHandlers };
|
|
127
|
+
export type PolicySafeKnowledgeAssistantHandlers = ReturnType<typeof createPolicySafeKnowledgeAssistantHandlers>;
|
|
128
|
+
export {};
|
|
126
129
|
//# sourceMappingURL=policy-safe-knowledge-assistant.handlers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy-safe-knowledge-assistant.handlers.d.ts","
|
|
1
|
+
{"version":3,"file":"policy-safe-knowledge-assistant.handlers.d.ts","sourceRoot":"","sources":["../../src/handlers/policy-safe-knowledge-assistant.handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,YAAY,EAAS,MAAM,mCAAmC,CAAC;AAM7E,KAAK,YAAY,GAAG,gBAAgB,GAAG,cAAc,GAAG,qBAAqB,CAAC;AAC9E,KAAK,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAC3C,KAAK,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;AA2EvC,wBAAgB,0CAA0C,CAAC,EAAE,EAAE,YAAY;4BACpC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE;;;;;;;4BAwBrB;QACnC,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,YAAY,CAAC;KAC5B;;;;;;;wBAyBgC;QAC/B,SAAS,EAAE,MAAM,CAAC;QAClB,YAAY,EAAE,MAAM,CAAC;QACrB,QAAQ,EAAE,MAAM,CAAC;KAClB;mBAHY,MAAM;sBACH,MAAM;kBACV,MAAM;;;+BAUsB;QACtC,SA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