@contractspec/example.policy-safe-knowledge-assistant 3.7.5 → 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/CHANGELOG.md +17 -0
- 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 +15 -15
- 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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/ui/hooks/usePolicySafeKnowledgeAssistant.ts
|
|
3
|
-
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
4
3
|
import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
|
|
4
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
5
5
|
"use client";
|
|
6
6
|
function isCitationLike(value) {
|
|
7
7
|
if (!value || typeof value !== "object")
|
|
@@ -152,7 +152,6 @@ function usePolicySafeKnowledgeAssistant() {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
// src/ui/PolicySafeKnowledgeAssistantDashboard.tsx
|
|
155
|
-
import { useCallback as useCallback2, useMemo as useMemo2, useState as useState2 } from "react";
|
|
156
155
|
import {
|
|
157
156
|
Button,
|
|
158
157
|
ErrorState,
|
|
@@ -162,7 +161,6 @@ import {
|
|
|
162
161
|
} from "@contractspec/lib.design-system";
|
|
163
162
|
import { Card } from "@contractspec/lib.ui-kit-web/ui/card";
|
|
164
163
|
import { Input } from "@contractspec/lib.ui-kit-web/ui/input";
|
|
165
|
-
import { Textarea } from "@contractspec/lib.ui-kit-web/ui/textarea";
|
|
166
164
|
import {
|
|
167
165
|
Select,
|
|
168
166
|
SelectContent,
|
|
@@ -170,6 +168,8 @@ import {
|
|
|
170
168
|
SelectTrigger,
|
|
171
169
|
SelectValue
|
|
172
170
|
} from "@contractspec/lib.ui-kit-web/ui/select";
|
|
171
|
+
import { Textarea } from "@contractspec/lib.ui-kit-web/ui/textarea";
|
|
172
|
+
import { useCallback as useCallback2, useMemo as useMemo2, useState as useState2 } from "react";
|
|
173
173
|
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
174
174
|
"use client";
|
|
175
175
|
function PolicySafeKnowledgeAssistantDashboard() {
|
|
@@ -232,7 +232,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
232
232
|
className: "p-4",
|
|
233
233
|
children: [
|
|
234
234
|
/* @__PURE__ */ jsxDEV("h3", {
|
|
235
|
-
className: "text-lg
|
|
235
|
+
className: "font-semibold text-lg",
|
|
236
236
|
children: "1) Onboarding (explicit locale + jurisdiction)"
|
|
237
237
|
}, undefined, false, undefined, this),
|
|
238
238
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -241,7 +241,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
241
241
|
/* @__PURE__ */ jsxDEV("div", {
|
|
242
242
|
children: [
|
|
243
243
|
/* @__PURE__ */ jsxDEV("div", {
|
|
244
|
-
className: "text-muted-foreground
|
|
244
|
+
className: "mb-1 font-semibold text-muted-foreground text-xs uppercase tracking-wide",
|
|
245
245
|
children: "Locale"
|
|
246
246
|
}, undefined, false, undefined, this),
|
|
247
247
|
/* @__PURE__ */ jsxDEV(Input, {
|
|
@@ -253,7 +253,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
253
253
|
/* @__PURE__ */ jsxDEV("div", {
|
|
254
254
|
children: [
|
|
255
255
|
/* @__PURE__ */ jsxDEV("div", {
|
|
256
|
-
className: "text-muted-foreground
|
|
256
|
+
className: "mb-1 font-semibold text-muted-foreground text-xs uppercase tracking-wide",
|
|
257
257
|
children: "Jurisdiction"
|
|
258
258
|
}, undefined, false, undefined, this),
|
|
259
259
|
/* @__PURE__ */ jsxDEV(Input, {
|
|
@@ -265,7 +265,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
265
265
|
/* @__PURE__ */ jsxDEV("div", {
|
|
266
266
|
children: [
|
|
267
267
|
/* @__PURE__ */ jsxDEV("div", {
|
|
268
|
-
className: "text-muted-foreground
|
|
268
|
+
className: "mb-1 font-semibold text-muted-foreground text-xs uppercase tracking-wide",
|
|
269
269
|
children: "Allowed scope"
|
|
270
270
|
}, undefined, false, undefined, this),
|
|
271
271
|
/* @__PURE__ */ jsxDEV(Select, {
|
|
@@ -319,7 +319,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
319
319
|
className: "p-4",
|
|
320
320
|
children: [
|
|
321
321
|
/* @__PURE__ */ jsxDEV("h3", {
|
|
322
|
-
className: "text-lg
|
|
322
|
+
className: "font-semibold text-lg",
|
|
323
323
|
children: "2) Ask the assistant (must cite KB snapshot)"
|
|
324
324
|
}, undefined, false, undefined, this),
|
|
325
325
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -342,7 +342,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
342
342
|
className: "mt-4 space-y-3",
|
|
343
343
|
children: [
|
|
344
344
|
state.lastAnswer.refused ? /* @__PURE__ */ jsxDEV("div", {
|
|
345
|
-
className: "text-
|
|
345
|
+
className: "text-red-600 text-sm",
|
|
346
346
|
children: [
|
|
347
347
|
"Refused: ",
|
|
348
348
|
state.lastAnswer.refusalReason ?? "UNKNOWN"
|
|
@@ -351,7 +351,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
351
351
|
state.lastAnswer.sections.map((s, idx) => /* @__PURE__ */ jsxDEV("div", {
|
|
352
352
|
children: [
|
|
353
353
|
/* @__PURE__ */ jsxDEV("div", {
|
|
354
|
-
className: "text-sm
|
|
354
|
+
className: "font-semibold text-sm",
|
|
355
355
|
children: s.heading
|
|
356
356
|
}, undefined, false, undefined, this),
|
|
357
357
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -361,11 +361,11 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
361
361
|
]
|
|
362
362
|
}, `${s.heading}-${idx}`, true, undefined, this)),
|
|
363
363
|
/* @__PURE__ */ jsxDEV("div", {
|
|
364
|
-
className: "text-sm
|
|
364
|
+
className: "font-semibold text-sm",
|
|
365
365
|
children: "Citations"
|
|
366
366
|
}, undefined, false, undefined, this),
|
|
367
367
|
/* @__PURE__ */ jsxDEV("ul", {
|
|
368
|
-
className: "
|
|
368
|
+
className: "list-disc pl-5 text-muted-foreground text-sm",
|
|
369
369
|
children: state.lastAnswer.citations.map((c) => /* @__PURE__ */ jsxDEV("li", {
|
|
370
370
|
children: [
|
|
371
371
|
c.kbSnapshotId,
|
|
@@ -382,7 +382,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
382
382
|
className: "p-4",
|
|
383
383
|
children: [
|
|
384
384
|
/* @__PURE__ */ jsxDEV("h3", {
|
|
385
|
-
className: "text-lg
|
|
385
|
+
className: "font-semibold text-lg",
|
|
386
386
|
children: "3) Admin: publish a new snapshot (HITL)"
|
|
387
387
|
}, undefined, false, undefined, this),
|
|
388
388
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -404,11 +404,11 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
404
404
|
className: "p-4",
|
|
405
405
|
children: [
|
|
406
406
|
/* @__PURE__ */ jsxDEV("h3", {
|
|
407
|
-
className: "text-lg
|
|
407
|
+
className: "font-semibold text-lg",
|
|
408
408
|
children: "4) Learning hub (patterns)"
|
|
409
409
|
}, undefined, false, undefined, this),
|
|
410
410
|
/* @__PURE__ */ jsxDEV("p", {
|
|
411
|
-
className: "text-muted-foreground
|
|
411
|
+
className: "mt-2 text-muted-foreground text-sm",
|
|
412
412
|
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."
|
|
413
413
|
}, undefined, false, undefined, this)
|
|
414
414
|
]
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/ui/hooks/usePolicySafeKnowledgeAssistant.ts
|
|
3
|
-
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
4
3
|
import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
|
|
4
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
5
5
|
"use client";
|
|
6
6
|
function isCitationLike(value) {
|
|
7
7
|
if (!value || typeof value !== "object")
|
package/dist/ui/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/ui/hooks/usePolicySafeKnowledgeAssistant.ts
|
|
3
|
-
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
4
3
|
import { useTemplateRuntime } from "@contractspec/lib.example-shared-ui";
|
|
4
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
5
5
|
"use client";
|
|
6
6
|
function isCitationLike(value) {
|
|
7
7
|
if (!value || typeof value !== "object")
|
|
@@ -152,7 +152,6 @@ function usePolicySafeKnowledgeAssistant() {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
// src/ui/PolicySafeKnowledgeAssistantDashboard.tsx
|
|
155
|
-
import { useCallback as useCallback2, useMemo as useMemo2, useState as useState2 } from "react";
|
|
156
155
|
import {
|
|
157
156
|
Button,
|
|
158
157
|
ErrorState,
|
|
@@ -162,7 +161,6 @@ import {
|
|
|
162
161
|
} from "@contractspec/lib.design-system";
|
|
163
162
|
import { Card } from "@contractspec/lib.ui-kit-web/ui/card";
|
|
164
163
|
import { Input } from "@contractspec/lib.ui-kit-web/ui/input";
|
|
165
|
-
import { Textarea } from "@contractspec/lib.ui-kit-web/ui/textarea";
|
|
166
164
|
import {
|
|
167
165
|
Select,
|
|
168
166
|
SelectContent,
|
|
@@ -170,6 +168,8 @@ import {
|
|
|
170
168
|
SelectTrigger,
|
|
171
169
|
SelectValue
|
|
172
170
|
} from "@contractspec/lib.ui-kit-web/ui/select";
|
|
171
|
+
import { Textarea } from "@contractspec/lib.ui-kit-web/ui/textarea";
|
|
172
|
+
import { useCallback as useCallback2, useMemo as useMemo2, useState as useState2 } from "react";
|
|
173
173
|
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
174
174
|
"use client";
|
|
175
175
|
function PolicySafeKnowledgeAssistantDashboard() {
|
|
@@ -232,7 +232,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
232
232
|
className: "p-4",
|
|
233
233
|
children: [
|
|
234
234
|
/* @__PURE__ */ jsxDEV("h3", {
|
|
235
|
-
className: "text-lg
|
|
235
|
+
className: "font-semibold text-lg",
|
|
236
236
|
children: "1) Onboarding (explicit locale + jurisdiction)"
|
|
237
237
|
}, undefined, false, undefined, this),
|
|
238
238
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -241,7 +241,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
241
241
|
/* @__PURE__ */ jsxDEV("div", {
|
|
242
242
|
children: [
|
|
243
243
|
/* @__PURE__ */ jsxDEV("div", {
|
|
244
|
-
className: "text-muted-foreground
|
|
244
|
+
className: "mb-1 font-semibold text-muted-foreground text-xs uppercase tracking-wide",
|
|
245
245
|
children: "Locale"
|
|
246
246
|
}, undefined, false, undefined, this),
|
|
247
247
|
/* @__PURE__ */ jsxDEV(Input, {
|
|
@@ -253,7 +253,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
253
253
|
/* @__PURE__ */ jsxDEV("div", {
|
|
254
254
|
children: [
|
|
255
255
|
/* @__PURE__ */ jsxDEV("div", {
|
|
256
|
-
className: "text-muted-foreground
|
|
256
|
+
className: "mb-1 font-semibold text-muted-foreground text-xs uppercase tracking-wide",
|
|
257
257
|
children: "Jurisdiction"
|
|
258
258
|
}, undefined, false, undefined, this),
|
|
259
259
|
/* @__PURE__ */ jsxDEV(Input, {
|
|
@@ -265,7 +265,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
265
265
|
/* @__PURE__ */ jsxDEV("div", {
|
|
266
266
|
children: [
|
|
267
267
|
/* @__PURE__ */ jsxDEV("div", {
|
|
268
|
-
className: "text-muted-foreground
|
|
268
|
+
className: "mb-1 font-semibold text-muted-foreground text-xs uppercase tracking-wide",
|
|
269
269
|
children: "Allowed scope"
|
|
270
270
|
}, undefined, false, undefined, this),
|
|
271
271
|
/* @__PURE__ */ jsxDEV(Select, {
|
|
@@ -319,7 +319,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
319
319
|
className: "p-4",
|
|
320
320
|
children: [
|
|
321
321
|
/* @__PURE__ */ jsxDEV("h3", {
|
|
322
|
-
className: "text-lg
|
|
322
|
+
className: "font-semibold text-lg",
|
|
323
323
|
children: "2) Ask the assistant (must cite KB snapshot)"
|
|
324
324
|
}, undefined, false, undefined, this),
|
|
325
325
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -342,7 +342,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
342
342
|
className: "mt-4 space-y-3",
|
|
343
343
|
children: [
|
|
344
344
|
state.lastAnswer.refused ? /* @__PURE__ */ jsxDEV("div", {
|
|
345
|
-
className: "text-
|
|
345
|
+
className: "text-red-600 text-sm",
|
|
346
346
|
children: [
|
|
347
347
|
"Refused: ",
|
|
348
348
|
state.lastAnswer.refusalReason ?? "UNKNOWN"
|
|
@@ -351,7 +351,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
351
351
|
state.lastAnswer.sections.map((s, idx) => /* @__PURE__ */ jsxDEV("div", {
|
|
352
352
|
children: [
|
|
353
353
|
/* @__PURE__ */ jsxDEV("div", {
|
|
354
|
-
className: "text-sm
|
|
354
|
+
className: "font-semibold text-sm",
|
|
355
355
|
children: s.heading
|
|
356
356
|
}, undefined, false, undefined, this),
|
|
357
357
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -361,11 +361,11 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
361
361
|
]
|
|
362
362
|
}, `${s.heading}-${idx}`, true, undefined, this)),
|
|
363
363
|
/* @__PURE__ */ jsxDEV("div", {
|
|
364
|
-
className: "text-sm
|
|
364
|
+
className: "font-semibold text-sm",
|
|
365
365
|
children: "Citations"
|
|
366
366
|
}, undefined, false, undefined, this),
|
|
367
367
|
/* @__PURE__ */ jsxDEV("ul", {
|
|
368
|
-
className: "
|
|
368
|
+
className: "list-disc pl-5 text-muted-foreground text-sm",
|
|
369
369
|
children: state.lastAnswer.citations.map((c) => /* @__PURE__ */ jsxDEV("li", {
|
|
370
370
|
children: [
|
|
371
371
|
c.kbSnapshotId,
|
|
@@ -382,7 +382,7 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
382
382
|
className: "p-4",
|
|
383
383
|
children: [
|
|
384
384
|
/* @__PURE__ */ jsxDEV("h3", {
|
|
385
|
-
className: "text-lg
|
|
385
|
+
className: "font-semibold text-lg",
|
|
386
386
|
children: "3) Admin: publish a new snapshot (HITL)"
|
|
387
387
|
}, undefined, false, undefined, this),
|
|
388
388
|
/* @__PURE__ */ jsxDEV("div", {
|
|
@@ -404,11 +404,11 @@ function PolicySafeKnowledgeAssistantDashboard() {
|
|
|
404
404
|
className: "p-4",
|
|
405
405
|
children: [
|
|
406
406
|
/* @__PURE__ */ jsxDEV("h3", {
|
|
407
|
-
className: "text-lg
|
|
407
|
+
className: "font-semibold text-lg",
|
|
408
408
|
children: "4) Learning hub (patterns)"
|
|
409
409
|
}, undefined, false, undefined, this),
|
|
410
410
|
/* @__PURE__ */ jsxDEV("p", {
|
|
411
|
-
className: "text-muted-foreground
|
|
411
|
+
className: "mt-2 text-muted-foreground text-sm",
|
|
412
412
|
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."
|
|
413
413
|
}, undefined, false, undefined, this)
|
|
414
414
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractspec/example.policy-safe-knowledge-assistant",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.7",
|
|
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
|
"types": "./dist/index.d.ts",
|
|
@@ -113,32 +113,32 @@
|
|
|
113
113
|
"dev": "contractspec-bun-build dev",
|
|
114
114
|
"clean": "rimraf dist .turbo",
|
|
115
115
|
"lint": "bun lint:fix",
|
|
116
|
-
"lint:fix": "
|
|
117
|
-
"lint:check": "
|
|
116
|
+
"lint:fix": "biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .",
|
|
117
|
+
"lint:check": "biome check .",
|
|
118
118
|
"test": "bun test",
|
|
119
119
|
"prebuild": "contractspec-bun-build prebuild",
|
|
120
120
|
"typecheck": "tsc --noEmit"
|
|
121
121
|
},
|
|
122
122
|
"dependencies": {
|
|
123
|
-
"@contractspec/example.kb-update-pipeline": "3.7.
|
|
124
|
-
"@contractspec/example.learning-patterns": "3.7.
|
|
125
|
-
"@contractspec/example.locale-jurisdiction-gate": "3.7.
|
|
126
|
-
"@contractspec/example.versioned-knowledge-base": "3.7.
|
|
127
|
-
"@contractspec/lib.contracts-spec": "
|
|
128
|
-
"@contractspec/lib.design-system": "3.
|
|
129
|
-
"@contractspec/lib.example-shared-ui": "6.0.
|
|
130
|
-
"@contractspec/lib.runtime-sandbox": "2.7.
|
|
131
|
-
"@contractspec/lib.ui-kit-web": "3.
|
|
132
|
-
"@contractspec/module.learning-journey": "3.7.
|
|
123
|
+
"@contractspec/example.kb-update-pipeline": "3.7.7",
|
|
124
|
+
"@contractspec/example.learning-patterns": "3.7.7",
|
|
125
|
+
"@contractspec/example.locale-jurisdiction-gate": "3.7.7",
|
|
126
|
+
"@contractspec/example.versioned-knowledge-base": "3.7.7",
|
|
127
|
+
"@contractspec/lib.contracts-spec": "4.0.0",
|
|
128
|
+
"@contractspec/lib.design-system": "3.8.0",
|
|
129
|
+
"@contractspec/lib.example-shared-ui": "6.0.7",
|
|
130
|
+
"@contractspec/lib.runtime-sandbox": "2.7.6",
|
|
131
|
+
"@contractspec/lib.ui-kit-web": "3.8.0",
|
|
132
|
+
"@contractspec/module.learning-journey": "3.7.7",
|
|
133
133
|
"react": "19.2.0",
|
|
134
134
|
"react-dom": "19.2.0"
|
|
135
135
|
},
|
|
136
136
|
"devDependencies": {
|
|
137
|
-
"@contractspec/tool.typescript": "3.7.
|
|
137
|
+
"@contractspec/tool.typescript": "3.7.6",
|
|
138
138
|
"typescript": "^5.9.3",
|
|
139
139
|
"@types/react": "^19.2.14",
|
|
140
140
|
"@types/react-dom": "^19.2.2",
|
|
141
|
-
"@contractspec/tool.bun": "3.7.
|
|
141
|
+
"@contractspec/tool.bun": "3.7.6"
|
|
142
142
|
},
|
|
143
143
|
"publishConfig": {
|
|
144
144
|
"access": "public",
|
|
@@ -2,27 +2,27 @@ import type { DocBlock } from '@contractspec/lib.contracts-spec/docs';
|
|
|
2
2
|
import { registerDocBlocks } from '@contractspec/lib.contracts-spec/docs';
|
|
3
3
|
|
|
4
4
|
const docBlocks: DocBlock[] = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
5
|
+
{
|
|
6
|
+
id: 'docs.examples.policy-safe-knowledge-assistant.goal',
|
|
7
|
+
title: 'Policy-safe Knowledge Assistant — Goal',
|
|
8
|
+
summary:
|
|
9
|
+
'End-to-end example: versioned KB snapshots + locale/jurisdiction gating + HITL pipeline + learning hub.',
|
|
10
|
+
kind: 'goal',
|
|
11
|
+
visibility: 'public',
|
|
12
|
+
route: '/docs/examples/policy-safe-knowledge-assistant/goal',
|
|
13
|
+
tags: ['assistant', 'knowledge', 'policy', 'hitl', 'learning'],
|
|
14
|
+
body: `## What this template proves\n- Assistant answers are structured and must cite a KB snapshot (or refuse).\n- Locale + jurisdiction are mandatory inputs for every assistant call.\n- Automation proposes KB patches; humans verify; publishing stays blocked until approvals.\n- Learning hub demonstrates drills + coaching + quests without spam.\n\n## Offline-first\n- Seeded fixtures are deterministic and require no external services.\n- Optional non-authoritative fallback can be added behind a single feature flag (disabled by default).`,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: 'docs.examples.policy-safe-knowledge-assistant.usage',
|
|
18
|
+
title: 'Policy-safe Knowledge Assistant — Usage',
|
|
19
|
+
summary: '5–10 minute sandbox walkthrough for developers.',
|
|
20
|
+
kind: 'usage',
|
|
21
|
+
visibility: 'public',
|
|
22
|
+
route: '/docs/examples/policy-safe-knowledge-assistant/usage',
|
|
23
|
+
tags: ['assistant', 'knowledge', 'usage'],
|
|
24
|
+
body: `## Demo walkthrough (high level)\n1) Onboard: set locale + jurisdiction.\n2) Publish snapshot: ingest source -> propose rule -> approve -> publish.\n3) Ask assistant: must pass gate and cite snapshot.\n4) Simulate change: watcher -> review -> publish new snapshot.\n5) Learning hub: drills session, ambient tip, quest start + step completion.`,
|
|
25
|
+
},
|
|
26
26
|
];
|
|
27
27
|
|
|
28
28
|
registerDocBlocks(docBlocks);
|
package/src/example.ts
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import { defineExample } from '@contractspec/lib.contracts-spec';
|
|
2
2
|
|
|
3
3
|
const example = defineExample({
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
4
|
+
meta: {
|
|
5
|
+
key: 'policy-safe-knowledge-assistant',
|
|
6
|
+
version: '1.0.0',
|
|
7
|
+
title: 'Policy-safe Knowledge Assistant',
|
|
8
|
+
description:
|
|
9
|
+
'All-in-one template: locale/jurisdiction gating + versioned KB snapshots + HITL update pipeline + learning hub.',
|
|
10
|
+
kind: 'template',
|
|
11
|
+
visibility: 'public',
|
|
12
|
+
stability: 'experimental',
|
|
13
|
+
owners: ['@platform.core'],
|
|
14
|
+
tags: ['assistant', 'knowledge', 'policy', 'hitl', 'learning'],
|
|
15
|
+
},
|
|
16
|
+
docs: {
|
|
17
|
+
goalDocId: 'docs.examples.policy-safe-knowledge-assistant.goal',
|
|
18
|
+
usageDocId: 'docs.examples.policy-safe-knowledge-assistant.usage',
|
|
19
|
+
},
|
|
20
|
+
entrypoints: {
|
|
21
|
+
packageName: '@contractspec/example.policy-safe-knowledge-assistant',
|
|
22
|
+
feature: './policy-safe-knowledge-assistant.feature',
|
|
23
|
+
docs: './docs',
|
|
24
|
+
},
|
|
25
|
+
surfaces: {
|
|
26
|
+
templates: true,
|
|
27
|
+
sandbox: {
|
|
28
|
+
enabled: true,
|
|
29
|
+
modes: ['playground', 'specs', 'builder', 'markdown', 'evolution'],
|
|
30
|
+
},
|
|
31
|
+
studio: { enabled: true, installable: true },
|
|
32
|
+
mcp: { enabled: true },
|
|
33
|
+
},
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
export default example;
|