@contractspec/example.policy-safe-knowledge-assistant 3.7.6 → 3.7.7
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 +3 -3
- package/AGENTS.md +50 -26
- package/README.md +68 -15
- package/dist/browser/index.js +15 -15
- package/dist/browser/ui/PolicySafeKnowledgeAssistantDashboard.js +15 -15
- package/dist/browser/ui/hooks/usePolicySafeKnowledgeAssistant.js +1 -1
- package/dist/browser/ui/index.js +15 -15
- package/dist/index.d.ts +3 -3
- package/dist/index.js +15 -15
- package/dist/node/index.js +15 -15
- package/dist/node/ui/PolicySafeKnowledgeAssistantDashboard.js +15 -15
- package/dist/node/ui/hooks/usePolicySafeKnowledgeAssistant.js +1 -1
- package/dist/node/ui/index.js +15 -15
- package/dist/ui/PolicySafeKnowledgeAssistantDashboard.js +15 -15
- package/dist/ui/hooks/usePolicySafeKnowledgeAssistant.js +1 -1
- package/dist/ui/index.js +15 -15
- package/package.json +12 -12
- package/src/docs/policy-safe-knowledge-assistant.docblock.ts +21 -21
- package/src/example.ts +30 -30
- package/src/handlers/policy-safe-knowledge-assistant.handlers.ts +426 -425
- package/src/index.ts +4 -3
- package/src/integration.test.ts +87 -88
- package/src/orchestrator/buildAnswer.ts +97 -97
- package/src/policy-safe-knowledge-assistant.feature.ts +61 -61
- package/src/seed/fixtures.ts +29 -29
- package/src/seeders/index.ts +12 -12
- package/src/ui/PolicySafeKnowledgeAssistantDashboard.tsx +191 -191
- package/src/ui/hooks/usePolicySafeKnowledgeAssistant.ts +204 -204
- package/tsconfig.json +7 -17
- package/tsdown.config.js +7 -13
package/dist/index.js
CHANGED
|
@@ -499,8 +499,8 @@ var DEMO_FIXTURES = {
|
|
|
499
499
|
}
|
|
500
500
|
};
|
|
501
501
|
// src/ui/hooks/usePolicySafeKnowledgeAssistant.ts
|
|
502
|
-
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
503
502
|
import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
|
|
503
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
504
504
|
"use client";
|
|
505
505
|
function isCitationLike(value) {
|
|
506
506
|
if (!value || typeof value !== "object")
|
|
@@ -651,7 +651,6 @@ function usePolicySafeKnowledgeAssistant() {
|
|
|
651
651
|
}
|
|
652
652
|
|
|
653
653
|
// src/ui/PolicySafeKnowledgeAssistantDashboard.tsx
|
|
654
|
-
import { useCallback as useCallback2, useMemo as useMemo2, useState as useState2 } from "react";
|
|
655
654
|
import {
|
|
656
655
|
Button,
|
|
657
656
|
ErrorState,
|
|
@@ -661,7 +660,6 @@ import {
|
|
|
661
660
|
} from "@contractspec/lib.design-system";
|
|
662
661
|
import { Card } from "@contractspec/lib.ui-kit-web/ui/card";
|
|
663
662
|
import { Input } from "@contractspec/lib.ui-kit-web/ui/input";
|
|
664
|
-
import { Textarea } from "@contractspec/lib.ui-kit-web/ui/textarea";
|
|
665
663
|
import {
|
|
666
664
|
Select,
|
|
667
665
|
SelectContent,
|
|
@@ -669,6 +667,8 @@ import {
|
|
|
669
667
|
SelectTrigger,
|
|
670
668
|
SelectValue
|
|
671
669
|
} from "@contractspec/lib.ui-kit-web/ui/select";
|
|
670
|
+
import { Textarea } from "@contractspec/lib.ui-kit-web/ui/textarea";
|
|
671
|
+
import { useCallback as useCallback2, useMemo as useMemo2, useState as useState2 } from "react";
|
|
672
672
|
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
673
673
|
"use client";
|
|
674
674
|
function PolicySafeKnowledgeAssistantDashboard() {
|
|
@@ -731,7 +731,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
731
731
|
className: "p-4",
|
|
732
732
|
children: [
|
|
733
733
|
/* @__PURE__ */ jsxDEV("h3", {
|
|
734
|
-
className: "text-lg
|
|
734
|
+
className: "font-semibold text-lg",
|
|
735
735
|
children: "1) Onboarding (explicit locale + jurisdiction)"
|
|
736
736
|
}, undefined, false, undefined, this),
|
|
737
737
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -740,7 +740,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
740
740
|
/* @__PURE__ */ jsxDEV("div", {
|
|
741
741
|
children: [
|
|
742
742
|
/* @__PURE__ */ jsxDEV("div", {
|
|
743
|
-
className: "text-muted-foreground
|
|
743
|
+
className: "mb-1 font-semibold text-muted-foreground text-xs uppercase tracking-wide",
|
|
744
744
|
children: "Locale"
|
|
745
745
|
}, undefined, false, undefined, this),
|
|
746
746
|
/* @__PURE__ */ jsxDEV(Input, {
|
|
@@ -752,7 +752,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
752
752
|
/* @__PURE__ */ jsxDEV("div", {
|
|
753
753
|
children: [
|
|
754
754
|
/* @__PURE__ */ jsxDEV("div", {
|
|
755
|
-
className: "text-muted-foreground
|
|
755
|
+
className: "mb-1 font-semibold text-muted-foreground text-xs uppercase tracking-wide",
|
|
756
756
|
children: "Jurisdiction"
|
|
757
757
|
}, undefined, false, undefined, this),
|
|
758
758
|
/* @__PURE__ */ jsxDEV(Input, {
|
|
@@ -764,7 +764,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
764
764
|
/* @__PURE__ */ jsxDEV("div", {
|
|
765
765
|
children: [
|
|
766
766
|
/* @__PURE__ */ jsxDEV("div", {
|
|
767
|
-
className: "text-muted-foreground
|
|
767
|
+
className: "mb-1 font-semibold text-muted-foreground text-xs uppercase tracking-wide",
|
|
768
768
|
children: "Allowed scope"
|
|
769
769
|
}, undefined, false, undefined, this),
|
|
770
770
|
/* @__PURE__ */ jsxDEV(Select, {
|
|
@@ -818,7 +818,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
818
818
|
className: "p-4",
|
|
819
819
|
children: [
|
|
820
820
|
/* @__PURE__ */ jsxDEV("h3", {
|
|
821
|
-
className: "text-lg
|
|
821
|
+
className: "font-semibold text-lg",
|
|
822
822
|
children: "2) Ask the assistant (must cite KB snapshot)"
|
|
823
823
|
}, undefined, false, undefined, this),
|
|
824
824
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -841,7 +841,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
841
841
|
className: "mt-4 space-y-3",
|
|
842
842
|
children: [
|
|
843
843
|
state.lastAnswer.refused ? /* @__PURE__ */ jsxDEV("div", {
|
|
844
|
-
className: "text-
|
|
844
|
+
className: "text-red-600 text-sm",
|
|
845
845
|
children: [
|
|
846
846
|
"Refused: ",
|
|
847
847
|
state.lastAnswer.refusalReason ?? "UNKNOWN"
|
|
@@ -850,7 +850,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
850
850
|
state.lastAnswer.sections.map((s, idx) => /* @__PURE__ */ jsxDEV("div", {
|
|
851
851
|
children: [
|
|
852
852
|
/* @__PURE__ */ jsxDEV("div", {
|
|
853
|
-
className: "text-sm
|
|
853
|
+
className: "font-semibold text-sm",
|
|
854
854
|
children: s.heading
|
|
855
855
|
}, undefined, false, undefined, this),
|
|
856
856
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -860,11 +860,11 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
860
860
|
]
|
|
861
861
|
}, `${s.heading}-${idx}`, true, undefined, this)),
|
|
862
862
|
/* @__PURE__ */ jsxDEV("div", {
|
|
863
|
-
className: "text-sm
|
|
863
|
+
className: "font-semibold text-sm",
|
|
864
864
|
children: "Citations"
|
|
865
865
|
}, undefined, false, undefined, this),
|
|
866
866
|
/* @__PURE__ */ jsxDEV("ul", {
|
|
867
|
-
className: "
|
|
867
|
+
className: "list-disc pl-5 text-muted-foreground text-sm",
|
|
868
868
|
children: state.lastAnswer.citations.map((c) => /* @__PURE__ */ jsxDEV("li", {
|
|
869
869
|
children: [
|
|
870
870
|
c.kbSnapshotId,
|
|
@@ -881,7 +881,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
881
881
|
className: "p-4",
|
|
882
882
|
children: [
|
|
883
883
|
/* @__PURE__ */ jsxDEV("h3", {
|
|
884
|
-
className: "text-lg
|
|
884
|
+
className: "font-semibold text-lg",
|
|
885
885
|
children: "3) Admin: publish a new snapshot (HITL)"
|
|
886
886
|
}, undefined, false, undefined, this),
|
|
887
887
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -903,11 +903,11 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
903
903
|
className: "p-4",
|
|
904
904
|
children: [
|
|
905
905
|
/* @__PURE__ */ jsxDEV("h3", {
|
|
906
|
-
className: "text-lg
|
|
906
|
+
className: "font-semibold text-lg",
|
|
907
907
|
children: "4) Learning hub (patterns)"
|
|
908
908
|
}, undefined, false, undefined, this),
|
|
909
909
|
/* @__PURE__ */ jsxDEV("p", {
|
|
910
|
-
className: "text-muted-foreground
|
|
910
|
+
className: "mt-2 text-muted-foreground text-sm",
|
|
911
911
|
children: "This template includes drills, ambient coach, and quests as reusable Learning Journey tracks. The interactive learning UI is demonstrated in dedicated Learning Journey examples."
|
|
912
912
|
}, undefined, false, undefined, this)
|
|
913
913
|
]
|
package/dist/node/index.js
CHANGED
|
@@ -498,8 +498,8 @@ var DEMO_FIXTURES = {
|
|
|
498
498
|
}
|
|
499
499
|
};
|
|
500
500
|
// src/ui/hooks/usePolicySafeKnowledgeAssistant.ts
|
|
501
|
-
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
502
501
|
import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
|
|
502
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
503
503
|
"use client";
|
|
504
504
|
function isCitationLike(value) {
|
|
505
505
|
if (!value || typeof value !== "object")
|
|
@@ -650,7 +650,6 @@ function usePolicySafeKnowledgeAssistant() {
|
|
|
650
650
|
}
|
|
651
651
|
|
|
652
652
|
// src/ui/PolicySafeKnowledgeAssistantDashboard.tsx
|
|
653
|
-
import { useCallback as useCallback2, useMemo as useMemo2, useState as useState2 } from "react";
|
|
654
653
|
import {
|
|
655
654
|
Button,
|
|
656
655
|
ErrorState,
|
|
@@ -660,7 +659,6 @@ import {
|
|
|
660
659
|
} from "@contractspec/lib.design-system";
|
|
661
660
|
import { Card } from "@contractspec/lib.ui-kit-web/ui/card";
|
|
662
661
|
import { Input } from "@contractspec/lib.ui-kit-web/ui/input";
|
|
663
|
-
import { Textarea } from "@contractspec/lib.ui-kit-web/ui/textarea";
|
|
664
662
|
import {
|
|
665
663
|
Select,
|
|
666
664
|
SelectContent,
|
|
@@ -668,6 +666,8 @@ import {
|
|
|
668
666
|
SelectTrigger,
|
|
669
667
|
SelectValue
|
|
670
668
|
} from "@contractspec/lib.ui-kit-web/ui/select";
|
|
669
|
+
import { Textarea } from "@contractspec/lib.ui-kit-web/ui/textarea";
|
|
670
|
+
import { useCallback as useCallback2, useMemo as useMemo2, useState as useState2 } from "react";
|
|
671
671
|
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
672
672
|
"use client";
|
|
673
673
|
function PolicySafeKnowledgeAssistantDashboard() {
|
|
@@ -730,7 +730,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
730
730
|
className: "p-4",
|
|
731
731
|
children: [
|
|
732
732
|
/* @__PURE__ */ jsxDEV("h3", {
|
|
733
|
-
className: "text-lg
|
|
733
|
+
className: "font-semibold text-lg",
|
|
734
734
|
children: "1) Onboarding (explicit locale + jurisdiction)"
|
|
735
735
|
}, undefined, false, undefined, this),
|
|
736
736
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -739,7 +739,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
739
739
|
/* @__PURE__ */ jsxDEV("div", {
|
|
740
740
|
children: [
|
|
741
741
|
/* @__PURE__ */ jsxDEV("div", {
|
|
742
|
-
className: "text-muted-foreground
|
|
742
|
+
className: "mb-1 font-semibold text-muted-foreground text-xs uppercase tracking-wide",
|
|
743
743
|
children: "Locale"
|
|
744
744
|
}, undefined, false, undefined, this),
|
|
745
745
|
/* @__PURE__ */ jsxDEV(Input, {
|
|
@@ -751,7 +751,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
751
751
|
/* @__PURE__ */ jsxDEV("div", {
|
|
752
752
|
children: [
|
|
753
753
|
/* @__PURE__ */ jsxDEV("div", {
|
|
754
|
-
className: "text-muted-foreground
|
|
754
|
+
className: "mb-1 font-semibold text-muted-foreground text-xs uppercase tracking-wide",
|
|
755
755
|
children: "Jurisdiction"
|
|
756
756
|
}, undefined, false, undefined, this),
|
|
757
757
|
/* @__PURE__ */ jsxDEV(Input, {
|
|
@@ -763,7 +763,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
763
763
|
/* @__PURE__ */ jsxDEV("div", {
|
|
764
764
|
children: [
|
|
765
765
|
/* @__PURE__ */ jsxDEV("div", {
|
|
766
|
-
className: "text-muted-foreground
|
|
766
|
+
className: "mb-1 font-semibold text-muted-foreground text-xs uppercase tracking-wide",
|
|
767
767
|
children: "Allowed scope"
|
|
768
768
|
}, undefined, false, undefined, this),
|
|
769
769
|
/* @__PURE__ */ jsxDEV(Select, {
|
|
@@ -817,7 +817,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
817
817
|
className: "p-4",
|
|
818
818
|
children: [
|
|
819
819
|
/* @__PURE__ */ jsxDEV("h3", {
|
|
820
|
-
className: "text-lg
|
|
820
|
+
className: "font-semibold text-lg",
|
|
821
821
|
children: "2) Ask the assistant (must cite KB snapshot)"
|
|
822
822
|
}, undefined, false, undefined, this),
|
|
823
823
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -840,7 +840,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
840
840
|
className: "mt-4 space-y-3",
|
|
841
841
|
children: [
|
|
842
842
|
state.lastAnswer.refused ? /* @__PURE__ */ jsxDEV("div", {
|
|
843
|
-
className: "text-
|
|
843
|
+
className: "text-red-600 text-sm",
|
|
844
844
|
children: [
|
|
845
845
|
"Refused: ",
|
|
846
846
|
state.lastAnswer.refusalReason ?? "UNKNOWN"
|
|
@@ -849,7 +849,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
849
849
|
state.lastAnswer.sections.map((s, idx) => /* @__PURE__ */ jsxDEV("div", {
|
|
850
850
|
children: [
|
|
851
851
|
/* @__PURE__ */ jsxDEV("div", {
|
|
852
|
-
className: "text-sm
|
|
852
|
+
className: "font-semibold text-sm",
|
|
853
853
|
children: s.heading
|
|
854
854
|
}, undefined, false, undefined, this),
|
|
855
855
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -859,11 +859,11 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
859
859
|
]
|
|
860
860
|
}, `${s.heading}-${idx}`, true, undefined, this)),
|
|
861
861
|
/* @__PURE__ */ jsxDEV("div", {
|
|
862
|
-
className: "text-sm
|
|
862
|
+
className: "font-semibold text-sm",
|
|
863
863
|
children: "Citations"
|
|
864
864
|
}, undefined, false, undefined, this),
|
|
865
865
|
/* @__PURE__ */ jsxDEV("ul", {
|
|
866
|
-
className: "
|
|
866
|
+
className: "list-disc pl-5 text-muted-foreground text-sm",
|
|
867
867
|
children: state.lastAnswer.citations.map((c) => /* @__PURE__ */ jsxDEV("li", {
|
|
868
868
|
children: [
|
|
869
869
|
c.kbSnapshotId,
|
|
@@ -880,7 +880,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
880
880
|
className: "p-4",
|
|
881
881
|
children: [
|
|
882
882
|
/* @__PURE__ */ jsxDEV("h3", {
|
|
883
|
-
className: "text-lg
|
|
883
|
+
className: "font-semibold text-lg",
|
|
884
884
|
children: "3) Admin: publish a new snapshot (HITL)"
|
|
885
885
|
}, undefined, false, undefined, this),
|
|
886
886
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -902,11 +902,11 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
902
902
|
className: "p-4",
|
|
903
903
|
children: [
|
|
904
904
|
/* @__PURE__ */ jsxDEV("h3", {
|
|
905
|
-
className: "text-lg
|
|
905
|
+
className: "font-semibold text-lg",
|
|
906
906
|
children: "4) Learning hub (patterns)"
|
|
907
907
|
}, undefined, false, undefined, this),
|
|
908
908
|
/* @__PURE__ */ jsxDEV("p", {
|
|
909
|
-
className: "text-muted-foreground
|
|
909
|
+
className: "mt-2 text-muted-foreground text-sm",
|
|
910
910
|
children: "This template includes drills, ambient coach, and quests as reusable Learning Journey tracks. The interactive learning UI is demonstrated in dedicated Learning Journey examples."
|
|
911
911
|
}, undefined, false, undefined, this)
|
|
912
912
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/ui/hooks/usePolicySafeKnowledgeAssistant.ts
|
|
2
|
-
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
3
2
|
import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
|
|
3
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
4
4
|
"use client";
|
|
5
5
|
function isCitationLike(value) {
|
|
6
6
|
if (!value || typeof value !== "object")
|
|
@@ -151,7 +151,6 @@ function usePolicySafeKnowledgeAssistant() {
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
// src/ui/PolicySafeKnowledgeAssistantDashboard.tsx
|
|
154
|
-
import { useCallback as useCallback2, useMemo as useMemo2, useState as useState2 } from "react";
|
|
155
154
|
import {
|
|
156
155
|
Button,
|
|
157
156
|
ErrorState,
|
|
@@ -161,7 +160,6 @@ import {
|
|
|
161
160
|
} from "@contractspec/lib.design-system";
|
|
162
161
|
import { Card } from "@contractspec/lib.ui-kit-web/ui/card";
|
|
163
162
|
import { Input } from "@contractspec/lib.ui-kit-web/ui/input";
|
|
164
|
-
import { Textarea } from "@contractspec/lib.ui-kit-web/ui/textarea";
|
|
165
163
|
import {
|
|
166
164
|
Select,
|
|
167
165
|
SelectContent,
|
|
@@ -169,6 +167,8 @@ import {
|
|
|
169
167
|
SelectTrigger,
|
|
170
168
|
SelectValue
|
|
171
169
|
} from "@contractspec/lib.ui-kit-web/ui/select";
|
|
170
|
+
import { Textarea } from "@contractspec/lib.ui-kit-web/ui/textarea";
|
|
171
|
+
import { useCallback as useCallback2, useMemo as useMemo2, useState as useState2 } from "react";
|
|
172
172
|
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
173
173
|
"use client";
|
|
174
174
|
function PolicySafeKnowledgeAssistantDashboard() {
|
|
@@ -231,7 +231,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
231
231
|
className: "p-4",
|
|
232
232
|
children: [
|
|
233
233
|
/* @__PURE__ */ jsxDEV("h3", {
|
|
234
|
-
className: "text-lg
|
|
234
|
+
className: "font-semibold text-lg",
|
|
235
235
|
children: "1) Onboarding (explicit locale + jurisdiction)"
|
|
236
236
|
}, undefined, false, undefined, this),
|
|
237
237
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -240,7 +240,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
240
240
|
/* @__PURE__ */ jsxDEV("div", {
|
|
241
241
|
children: [
|
|
242
242
|
/* @__PURE__ */ jsxDEV("div", {
|
|
243
|
-
className: "text-muted-foreground
|
|
243
|
+
className: "mb-1 font-semibold text-muted-foreground text-xs uppercase tracking-wide",
|
|
244
244
|
children: "Locale"
|
|
245
245
|
}, undefined, false, undefined, this),
|
|
246
246
|
/* @__PURE__ */ jsxDEV(Input, {
|
|
@@ -252,7 +252,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
252
252
|
/* @__PURE__ */ jsxDEV("div", {
|
|
253
253
|
children: [
|
|
254
254
|
/* @__PURE__ */ jsxDEV("div", {
|
|
255
|
-
className: "text-muted-foreground
|
|
255
|
+
className: "mb-1 font-semibold text-muted-foreground text-xs uppercase tracking-wide",
|
|
256
256
|
children: "Jurisdiction"
|
|
257
257
|
}, undefined, false, undefined, this),
|
|
258
258
|
/* @__PURE__ */ jsxDEV(Input, {
|
|
@@ -264,7 +264,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
264
264
|
/* @__PURE__ */ jsxDEV("div", {
|
|
265
265
|
children: [
|
|
266
266
|
/* @__PURE__ */ jsxDEV("div", {
|
|
267
|
-
className: "text-muted-foreground
|
|
267
|
+
className: "mb-1 font-semibold text-muted-foreground text-xs uppercase tracking-wide",
|
|
268
268
|
children: "Allowed scope"
|
|
269
269
|
}, undefined, false, undefined, this),
|
|
270
270
|
/* @__PURE__ */ jsxDEV(Select, {
|
|
@@ -318,7 +318,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
318
318
|
className: "p-4",
|
|
319
319
|
children: [
|
|
320
320
|
/* @__PURE__ */ jsxDEV("h3", {
|
|
321
|
-
className: "text-lg
|
|
321
|
+
className: "font-semibold text-lg",
|
|
322
322
|
children: "2) Ask the assistant (must cite KB snapshot)"
|
|
323
323
|
}, undefined, false, undefined, this),
|
|
324
324
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -341,7 +341,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
341
341
|
className: "mt-4 space-y-3",
|
|
342
342
|
children: [
|
|
343
343
|
state.lastAnswer.refused ? /* @__PURE__ */ jsxDEV("div", {
|
|
344
|
-
className: "text-
|
|
344
|
+
className: "text-red-600 text-sm",
|
|
345
345
|
children: [
|
|
346
346
|
"Refused: ",
|
|
347
347
|
state.lastAnswer.refusalReason ?? "UNKNOWN"
|
|
@@ -350,7 +350,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
350
350
|
state.lastAnswer.sections.map((s, idx) => /* @__PURE__ */ jsxDEV("div", {
|
|
351
351
|
children: [
|
|
352
352
|
/* @__PURE__ */ jsxDEV("div", {
|
|
353
|
-
className: "text-sm
|
|
353
|
+
className: "font-semibold text-sm",
|
|
354
354
|
children: s.heading
|
|
355
355
|
}, undefined, false, undefined, this),
|
|
356
356
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -360,11 +360,11 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
360
360
|
]
|
|
361
361
|
}, `${s.heading}-${idx}`, true, undefined, this)),
|
|
362
362
|
/* @__PURE__ */ jsxDEV("div", {
|
|
363
|
-
className: "text-sm
|
|
363
|
+
className: "font-semibold text-sm",
|
|
364
364
|
children: "Citations"
|
|
365
365
|
}, undefined, false, undefined, this),
|
|
366
366
|
/* @__PURE__ */ jsxDEV("ul", {
|
|
367
|
-
className: "
|
|
367
|
+
className: "list-disc pl-5 text-muted-foreground text-sm",
|
|
368
368
|
children: state.lastAnswer.citations.map((c) => /* @__PURE__ */ jsxDEV("li", {
|
|
369
369
|
children: [
|
|
370
370
|
c.kbSnapshotId,
|
|
@@ -381,7 +381,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
381
381
|
className: "p-4",
|
|
382
382
|
children: [
|
|
383
383
|
/* @__PURE__ */ jsxDEV("h3", {
|
|
384
|
-
className: "text-lg
|
|
384
|
+
className: "font-semibold text-lg",
|
|
385
385
|
children: "3) Admin: publish a new snapshot (HITL)"
|
|
386
386
|
}, undefined, false, undefined, this),
|
|
387
387
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -403,11 +403,11 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
403
403
|
className: "p-4",
|
|
404
404
|
children: [
|
|
405
405
|
/* @__PURE__ */ jsxDEV("h3", {
|
|
406
|
-
className: "text-lg
|
|
406
|
+
className: "font-semibold text-lg",
|
|
407
407
|
children: "4) Learning hub (patterns)"
|
|
408
408
|
}, undefined, false, undefined, this),
|
|
409
409
|
/* @__PURE__ */ jsxDEV("p", {
|
|
410
|
-
className: "text-muted-foreground
|
|
410
|
+
className: "mt-2 text-muted-foreground text-sm",
|
|
411
411
|
children: "This template includes drills, ambient coach, and quests as reusable Learning Journey tracks. The interactive learning UI is demonstrated in dedicated Learning Journey examples."
|
|
412
412
|
}, undefined, false, undefined, this)
|
|
413
413
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/ui/hooks/usePolicySafeKnowledgeAssistant.ts
|
|
2
|
-
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
3
2
|
import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
|
|
3
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
4
4
|
"use client";
|
|
5
5
|
function isCitationLike(value) {
|
|
6
6
|
if (!value || typeof value !== "object")
|
package/dist/node/ui/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/ui/hooks/usePolicySafeKnowledgeAssistant.ts
|
|
2
|
-
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
3
2
|
import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
|
|
3
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
4
4
|
"use client";
|
|
5
5
|
function isCitationLike(value) {
|
|
6
6
|
if (!value || typeof value !== "object")
|
|
@@ -151,7 +151,6 @@ function usePolicySafeKnowledgeAssistant() {
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
// src/ui/PolicySafeKnowledgeAssistantDashboard.tsx
|
|
154
|
-
import { useCallback as useCallback2, useMemo as useMemo2, useState as useState2 } from "react";
|
|
155
154
|
import {
|
|
156
155
|
Button,
|
|
157
156
|
ErrorState,
|
|
@@ -161,7 +160,6 @@ import {
|
|
|
161
160
|
} from "@contractspec/lib.design-system";
|
|
162
161
|
import { Card } from "@contractspec/lib.ui-kit-web/ui/card";
|
|
163
162
|
import { Input } from "@contractspec/lib.ui-kit-web/ui/input";
|
|
164
|
-
import { Textarea } from "@contractspec/lib.ui-kit-web/ui/textarea";
|
|
165
163
|
import {
|
|
166
164
|
Select,
|
|
167
165
|
SelectContent,
|
|
@@ -169,6 +167,8 @@ import {
|
|
|
169
167
|
SelectTrigger,
|
|
170
168
|
SelectValue
|
|
171
169
|
} from "@contractspec/lib.ui-kit-web/ui/select";
|
|
170
|
+
import { Textarea } from "@contractspec/lib.ui-kit-web/ui/textarea";
|
|
171
|
+
import { useCallback as useCallback2, useMemo as useMemo2, useState as useState2 } from "react";
|
|
172
172
|
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
173
173
|
"use client";
|
|
174
174
|
function PolicySafeKnowledgeAssistantDashboard() {
|
|
@@ -231,7 +231,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
231
231
|
className: "p-4",
|
|
232
232
|
children: [
|
|
233
233
|
/* @__PURE__ */ jsxDEV("h3", {
|
|
234
|
-
className: "text-lg
|
|
234
|
+
className: "font-semibold text-lg",
|
|
235
235
|
children: "1) Onboarding (explicit locale + jurisdiction)"
|
|
236
236
|
}, undefined, false, undefined, this),
|
|
237
237
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -240,7 +240,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
240
240
|
/* @__PURE__ */ jsxDEV("div", {
|
|
241
241
|
children: [
|
|
242
242
|
/* @__PURE__ */ jsxDEV("div", {
|
|
243
|
-
className: "text-muted-foreground
|
|
243
|
+
className: "mb-1 font-semibold text-muted-foreground text-xs uppercase tracking-wide",
|
|
244
244
|
children: "Locale"
|
|
245
245
|
}, undefined, false, undefined, this),
|
|
246
246
|
/* @__PURE__ */ jsxDEV(Input, {
|
|
@@ -252,7 +252,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
252
252
|
/* @__PURE__ */ jsxDEV("div", {
|
|
253
253
|
children: [
|
|
254
254
|
/* @__PURE__ */ jsxDEV("div", {
|
|
255
|
-
className: "text-muted-foreground
|
|
255
|
+
className: "mb-1 font-semibold text-muted-foreground text-xs uppercase tracking-wide",
|
|
256
256
|
children: "Jurisdiction"
|
|
257
257
|
}, undefined, false, undefined, this),
|
|
258
258
|
/* @__PURE__ */ jsxDEV(Input, {
|
|
@@ -264,7 +264,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
264
264
|
/* @__PURE__ */ jsxDEV("div", {
|
|
265
265
|
children: [
|
|
266
266
|
/* @__PURE__ */ jsxDEV("div", {
|
|
267
|
-
className: "text-muted-foreground
|
|
267
|
+
className: "mb-1 font-semibold text-muted-foreground text-xs uppercase tracking-wide",
|
|
268
268
|
children: "Allowed scope"
|
|
269
269
|
}, undefined, false, undefined, this),
|
|
270
270
|
/* @__PURE__ */ jsxDEV(Select, {
|
|
@@ -318,7 +318,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
318
318
|
className: "p-4",
|
|
319
319
|
children: [
|
|
320
320
|
/* @__PURE__ */ jsxDEV("h3", {
|
|
321
|
-
className: "text-lg
|
|
321
|
+
className: "font-semibold text-lg",
|
|
322
322
|
children: "2) Ask the assistant (must cite KB snapshot)"
|
|
323
323
|
}, undefined, false, undefined, this),
|
|
324
324
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -341,7 +341,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
341
341
|
className: "mt-4 space-y-3",
|
|
342
342
|
children: [
|
|
343
343
|
state.lastAnswer.refused ? /* @__PURE__ */ jsxDEV("div", {
|
|
344
|
-
className: "text-
|
|
344
|
+
className: "text-red-600 text-sm",
|
|
345
345
|
children: [
|
|
346
346
|
"Refused: ",
|
|
347
347
|
state.lastAnswer.refusalReason ?? "UNKNOWN"
|
|
@@ -350,7 +350,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
350
350
|
state.lastAnswer.sections.map((s, idx) => /* @__PURE__ */ jsxDEV("div", {
|
|
351
351
|
children: [
|
|
352
352
|
/* @__PURE__ */ jsxDEV("div", {
|
|
353
|
-
className: "text-sm
|
|
353
|
+
className: "font-semibold text-sm",
|
|
354
354
|
children: s.heading
|
|
355
355
|
}, undefined, false, undefined, this),
|
|
356
356
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -360,11 +360,11 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
360
360
|
]
|
|
361
361
|
}, `${s.heading}-${idx}`, true, undefined, this)),
|
|
362
362
|
/* @__PURE__ */ jsxDEV("div", {
|
|
363
|
-
className: "text-sm
|
|
363
|
+
className: "font-semibold text-sm",
|
|
364
364
|
children: "Citations"
|
|
365
365
|
}, undefined, false, undefined, this),
|
|
366
366
|
/* @__PURE__ */ jsxDEV("ul", {
|
|
367
|
-
className: "
|
|
367
|
+
className: "list-disc pl-5 text-muted-foreground text-sm",
|
|
368
368
|
children: state.lastAnswer.citations.map((c) => /* @__PURE__ */ jsxDEV("li", {
|
|
369
369
|
children: [
|
|
370
370
|
c.kbSnapshotId,
|
|
@@ -381,7 +381,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
381
381
|
className: "p-4",
|
|
382
382
|
children: [
|
|
383
383
|
/* @__PURE__ */ jsxDEV("h3", {
|
|
384
|
-
className: "text-lg
|
|
384
|
+
className: "font-semibold text-lg",
|
|
385
385
|
children: "3) Admin: publish a new snapshot (HITL)"
|
|
386
386
|
}, undefined, false, undefined, this),
|
|
387
387
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -403,11 +403,11 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
403
403
|
className: "p-4",
|
|
404
404
|
children: [
|
|
405
405
|
/* @__PURE__ */ jsxDEV("h3", {
|
|
406
|
-
className: "text-lg
|
|
406
|
+
className: "font-semibold text-lg",
|
|
407
407
|
children: "4) Learning hub (patterns)"
|
|
408
408
|
}, undefined, false, undefined, this),
|
|
409
409
|
/* @__PURE__ */ jsxDEV("p", {
|
|
410
|
-
className: "text-muted-foreground
|
|
410
|
+
className: "mt-2 text-muted-foreground text-sm",
|
|
411
411
|
children: "This template includes drills, ambient coach, and quests as reusable Learning Journey tracks. The interactive learning UI is demonstrated in dedicated Learning Journey examples."
|
|
412
412
|
}, undefined, false, undefined, this)
|
|
413
413
|
]
|