@lssm/example.policy-safe-knowledge-assistant 0.0.0-canary-20251217060834 → 0.0.0-canary-20251217073102

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.
Files changed (44) hide show
  1. package/.turbo/turbo-build$colon$bundle.log +58 -26
  2. package/.turbo/turbo-build.log +21 -27
  3. package/CHANGELOG.md +15 -14
  4. package/dist/docs/index.js +1 -1
  5. package/dist/docs/policy-safe-knowledge-assistant.docblock.js +34 -13
  6. package/dist/example.js +46 -1
  7. package/dist/examples/locale-jurisdiction-gate/dist/policy/guard.js +72 -0
  8. package/dist/feature.js +146 -1
  9. package/dist/index.js +7 -1
  10. package/dist/libs/contracts/dist/docs/PUBLISHING.docblock.js +16 -0
  11. package/dist/libs/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +16 -0
  12. package/dist/libs/contracts/dist/docs/index.js +29 -0
  13. package/dist/libs/contracts/dist/docs/presentations.js +71 -0
  14. package/dist/libs/contracts/dist/docs/registry.js +44 -0
  15. package/dist/libs/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +16 -0
  16. package/dist/libs/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +16 -0
  17. package/dist/libs/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +16 -0
  18. package/dist/libs/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +16 -0
  19. package/dist/libs/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +16 -0
  20. package/dist/libs/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +80 -0
  21. package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +57 -0
  22. package/dist/libs/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +16 -0
  23. package/dist/libs/contracts/dist/docs/tech/llm/llm-integration.docblock.js +357 -0
  24. package/dist/libs/contracts/dist/docs/tech/mcp-endpoints.docblock.js +37 -0
  25. package/dist/libs/contracts/dist/docs/tech/presentation-runtime.docblock.js +16 -0
  26. package/dist/libs/contracts/dist/docs/tech/schema/README.docblock.js +20 -0
  27. package/dist/libs/contracts/dist/docs/tech/studio/learning-events.docblock.js +48 -0
  28. package/dist/libs/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +79 -0
  29. package/dist/libs/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +84 -0
  30. package/dist/libs/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +45 -0
  31. package/dist/libs/contracts/dist/docs/tech/studio/project-routing.docblock.js +67 -0
  32. package/dist/libs/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +40 -0
  33. package/dist/libs/contracts/dist/docs/tech/studio/team-invitations.docblock.js +69 -0
  34. package/dist/libs/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +47 -0
  35. package/dist/libs/contracts/dist/docs/tech/studio/workspaces.docblock.js +62 -0
  36. package/dist/libs/contracts/dist/docs/tech/telemetry-ingest.docblock.js +155 -0
  37. package/dist/libs/contracts/dist/docs/tech/templates/runtime.docblock.js +20 -0
  38. package/dist/libs/contracts/dist/docs/tech/vscode-extension.docblock.js +101 -0
  39. package/dist/libs/contracts/dist/docs/tech/workflows/overview.docblock.js +20 -0
  40. package/dist/orchestrator/buildAnswer.js +76 -1
  41. package/dist/seed/fixtures.js +33 -1
  42. package/dist/seed/index.js +3 -1
  43. package/package.json +17 -16
  44. package/tsconfig.tsbuildinfo +1 -1
@@ -1 +1,76 @@
1
- import{enforceAllowedScope as e,enforceCitations as t,validateEnvelope as n}from"@lssm/example.locale-jurisdiction-gate/policy/guard";async function r(r){let i=n(r.envelope);if(!i.ok)return{locale:r.envelope.locale??`en-GB`,jurisdiction:r.envelope.regulatoryContext?.jurisdiction??`UNKNOWN`,allowedScope:r.envelope.allowedScope??`education_only`,sections:[{heading:`Request blocked`,body:i.error.message}],citations:[],disclaimers:[`This system refuses to answer without a valid envelope.`],riskFlags:[i.error.code],refused:!0,refusalReason:i.error.code};let a=await r.kbSearch({snapshotId:i.value.kbSnapshotId,jurisdiction:i.value.regulatoryContext.jurisdiction,query:r.question}),o=a.items.map(e=>({kbSnapshotId:i.value.kbSnapshotId,sourceType:`ruleVersion`,sourceId:e.ruleVersionId,title:`Curated rule version`,excerpt:e.excerpt})),s={locale:i.value.locale,jurisdiction:i.value.regulatoryContext.jurisdiction,allowedScope:i.value.allowedScope,sections:[{heading:`Answer (KB-derived)`,body:a.items.length>0?`This answer is derived from ${a.items.length} curated rule version(s) in the referenced snapshot.`:`No curated knowledge found in the referenced snapshot.`}],citations:o,disclaimers:[`Educational demo only.`],riskFlags:[]},c=e(i.value.allowedScope,s);if(!c.ok)return{...s,sections:[{heading:`Escalation required`,body:c.error.message}],refused:!0,refusalReason:c.error.code,riskFlags:[...s.riskFlags??[],c.error.code]};let l=t(s);return l.ok?s:{...s,sections:[{heading:`Request blocked`,body:l.error.message}],citations:[],refused:!0,refusalReason:l.error.code,riskFlags:[...s.riskFlags??[],l.error.code]}}export{r as buildPolicySafeAnswer};
1
+ import { enforceAllowedScope, enforceCitations, validateEnvelope } from "../examples/locale-jurisdiction-gate/dist/policy/guard.js";
2
+
3
+ //#region src/orchestrator/buildAnswer.ts
4
+ /**
5
+ * Build a policy-safe assistant answer derived from KB search results.
6
+ *
7
+ * Deterministic: no LLM calls; if search yields no results, it refuses.
8
+ */
9
+ async function buildPolicySafeAnswer(input) {
10
+ const env = validateEnvelope(input.envelope);
11
+ if (!env.ok) return {
12
+ locale: input.envelope.locale ?? "en-GB",
13
+ jurisdiction: input.envelope.regulatoryContext?.jurisdiction ?? "UNKNOWN",
14
+ allowedScope: input.envelope.allowedScope ?? "education_only",
15
+ sections: [{
16
+ heading: "Request blocked",
17
+ body: env.error.message
18
+ }],
19
+ citations: [],
20
+ disclaimers: ["This system refuses to answer without a valid envelope."],
21
+ riskFlags: [env.error.code],
22
+ refused: true,
23
+ refusalReason: env.error.code
24
+ };
25
+ const results = await input.kbSearch({
26
+ snapshotId: env.value.kbSnapshotId,
27
+ jurisdiction: env.value.regulatoryContext.jurisdiction,
28
+ query: input.question
29
+ });
30
+ const citations = results.items.map((item) => ({
31
+ kbSnapshotId: env.value.kbSnapshotId,
32
+ sourceType: "ruleVersion",
33
+ sourceId: item.ruleVersionId,
34
+ title: "Curated rule version",
35
+ excerpt: item.excerpt
36
+ }));
37
+ const draft = {
38
+ locale: env.value.locale,
39
+ jurisdiction: env.value.regulatoryContext.jurisdiction,
40
+ allowedScope: env.value.allowedScope,
41
+ sections: [{
42
+ heading: "Answer (KB-derived)",
43
+ body: results.items.length > 0 ? `This answer is derived from ${results.items.length} curated rule version(s) in the referenced snapshot.` : "No curated knowledge found in the referenced snapshot."
44
+ }],
45
+ citations,
46
+ disclaimers: ["Educational demo only."],
47
+ riskFlags: []
48
+ };
49
+ const scope = enforceAllowedScope(env.value.allowedScope, draft);
50
+ if (!scope.ok) return {
51
+ ...draft,
52
+ sections: [{
53
+ heading: "Escalation required",
54
+ body: scope.error.message
55
+ }],
56
+ refused: true,
57
+ refusalReason: scope.error.code,
58
+ riskFlags: [...draft.riskFlags ?? [], scope.error.code]
59
+ };
60
+ const cited = enforceCitations(draft);
61
+ if (!cited.ok) return {
62
+ ...draft,
63
+ sections: [{
64
+ heading: "Request blocked",
65
+ body: cited.error.message
66
+ }],
67
+ citations: [],
68
+ refused: true,
69
+ refusalReason: cited.error.code,
70
+ riskFlags: [...draft.riskFlags ?? [], cited.error.code]
71
+ };
72
+ return draft;
73
+ }
74
+
75
+ //#endregion
76
+ export { buildPolicySafeAnswer };
@@ -1 +1,33 @@
1
- const e={jurisdictions:[`EU`,`FR`],locales:[`en-GB`,`fr-FR`],demoOrgId:`org_demo`,demoUserId:`user_demo`,sources:{EU_SOURCE_1:{jurisdiction:`EU`,authority:`DemoAuthority`,title:`EU Demo Source v1`,fetchedAt:new Date(`2026-01-01T00:00:00.000Z`),hash:`hash_eu_v1`,fileId:`file_eu_v1`},EU_SOURCE_2:{jurisdiction:`EU`,authority:`DemoAuthority`,title:`EU Demo Source v2`,fetchedAt:new Date(`2026-02-01T00:00:00.000Z`),hash:`hash_eu_v2`,fileId:`file_eu_v2`}},rules:{EU_RULE_TAX:{id:`rule_eu_tax`,jurisdiction:`EU`,topicKey:`tax_reporting`}}};export{e as DEMO_FIXTURES};
1
+ //#region src/seed/fixtures.ts
2
+ const DEMO_FIXTURES = {
3
+ jurisdictions: ["EU", "FR"],
4
+ locales: ["en-GB", "fr-FR"],
5
+ demoOrgId: "org_demo",
6
+ demoUserId: "user_demo",
7
+ sources: {
8
+ EU_SOURCE_1: {
9
+ jurisdiction: "EU",
10
+ authority: "DemoAuthority",
11
+ title: "EU Demo Source v1",
12
+ fetchedAt: /* @__PURE__ */ new Date("2026-01-01T00:00:00.000Z"),
13
+ hash: "hash_eu_v1",
14
+ fileId: "file_eu_v1"
15
+ },
16
+ EU_SOURCE_2: {
17
+ jurisdiction: "EU",
18
+ authority: "DemoAuthority",
19
+ title: "EU Demo Source v2",
20
+ fetchedAt: /* @__PURE__ */ new Date("2026-02-01T00:00:00.000Z"),
21
+ hash: "hash_eu_v2",
22
+ fileId: "file_eu_v2"
23
+ }
24
+ },
25
+ rules: { EU_RULE_TAX: {
26
+ id: "rule_eu_tax",
27
+ jurisdiction: "EU",
28
+ topicKey: "tax_reporting"
29
+ } }
30
+ };
31
+
32
+ //#endregion
33
+ export { DEMO_FIXTURES };
@@ -1 +1,3 @@
1
- import{DEMO_FIXTURES as e}from"./fixtures.js";export{e as DEMO_FIXTURES};
1
+ import { DEMO_FIXTURES } from "./fixtures.js";
2
+
3
+ export { DEMO_FIXTURES };
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-20251217060834",
3
+ "version": "0.0.0-canary-20251217073102",
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",
@@ -31,23 +31,24 @@
31
31
  "test": "bun test"
32
32
  },
33
33
  "dependencies": {
34
- "@lssm/example.locale-jurisdiction-gate": "0.0.0-canary-20251217060834",
35
- "@lssm/example.versioned-knowledge-base": "0.0.0-canary-20251217060834",
36
- "@lssm/example.kb-update-pipeline": "0.0.0-canary-20251217060834",
37
- "@lssm/example.learning-patterns": "0.0.0-canary-20251217060834",
38
- "@lssm/lib.contracts": "0.0.0-canary-20251217060834",
39
- "@lssm/lib.identity-rbac": "0.0.0-canary-20251217060834",
40
- "@lssm/lib.jobs": "0.0.0-canary-20251217060834",
41
- "@lssm/lib.feature-flags": "0.0.0-canary-20251217060834",
42
- "@lssm/lib.files": "0.0.0-canary-20251217060834",
43
- "@lssm/lib.metering": "0.0.0-canary-20251217060834",
44
- "@lssm/module.audit-trail": "0.0.0-canary-20251217060834",
45
- "@lssm/module.notifications": "0.0.0-canary-20251217060834",
46
- "@lssm/module.learning-journey": "0.0.0-canary-20251217060834"
34
+ "@lssm/example.locale-jurisdiction-gate": "0.0.0-canary-20251217073102",
35
+ "@lssm/example.versioned-knowledge-base": "0.0.0-canary-20251217073102",
36
+ "@lssm/example.kb-update-pipeline": "0.0.0-canary-20251217073102",
37
+ "@lssm/example.learning-patterns": "0.0.0-canary-20251217073102",
38
+ "@lssm/lib.schema": "0.0.0-canary-20251217073102",
39
+ "@lssm/lib.contracts": "0.0.0-canary-20251217073102",
40
+ "@lssm/lib.identity-rbac": "0.0.0-canary-20251217073102",
41
+ "@lssm/lib.jobs": "0.0.0-canary-20251217073102",
42
+ "@lssm/lib.feature-flags": "0.0.0-canary-20251217073102",
43
+ "@lssm/lib.files": "0.0.0-canary-20251217073102",
44
+ "@lssm/lib.metering": "0.0.0-canary-20251217073102",
45
+ "@lssm/module.audit-trail": "0.0.0-canary-20251217073102",
46
+ "@lssm/module.notifications": "0.0.0-canary-20251217073102",
47
+ "@lssm/module.learning-journey": "0.0.0-canary-20251217073102"
47
48
  },
48
49
  "devDependencies": {
49
- "@lssm/tool.tsdown": "0.0.0-canary-20251217060834",
50
- "@lssm/tool.typescript": "0.0.0-canary-20251217060834",
50
+ "@lssm/tool.tsdown": "0.0.0-canary-20251217073102",
51
+ "@lssm/tool.typescript": "0.0.0-canary-20251217073102",
51
52
  "tsdown": "^0.17.4",
52
53
  "typescript": "^5.9.3"
53
54
  },