@lssm/example.knowledge-canon 1.41.0 → 1.42.1

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.
@@ -0,0 +1,37 @@
1
+ $ tsdown
2
+ ℹ tsdown v0.18.3 powered by rolldown v1.0.0-beta.57
3
+ ℹ config file: /home/runner/work/contractspec/contractspec/packages/examples/knowledge-canon/tsdown.config.js
4
+ ℹ entry: src/agent.ts, src/blueprint.ts, src/example.ts, src/index.ts, src/source.sample.ts, src/tenant.ts, src/docs/index.ts, src/docs/knowledge-canon.docblock.ts
5
+ ℹ target: esnext
6
+ ℹ tsconfig: tsconfig.json
7
+ ℹ Build start
8
+ ℹ Cleaning 28 files
9
+ ℹ dist/docs/knowledge-canon.docblock.js 1.67 kB │ gzip: 0.79 kB
10
+ ℹ dist/agent.js 1.25 kB │ gzip: 0.62 kB
11
+ ℹ dist/example.js 0.89 kB │ gzip: 0.48 kB
12
+ ℹ dist/blueprint.js 0.83 kB │ gzip: 0.45 kB
13
+ ℹ dist/tenant.js 0.80 kB │ gzip: 0.44 kB
14
+ ℹ dist/source.sample.js 0.69 kB │ gzip: 0.40 kB
15
+ ℹ dist/index.js 0.50 kB │ gzip: 0.21 kB
16
+ ℹ dist/docs/index.js 0.04 kB │ gzip: 0.06 kB
17
+ ℹ dist/docs/knowledge-canon.docblock.js.map 2.16 kB │ gzip: 0.97 kB
18
+ ℹ dist/agent.js.map 2.12 kB │ gzip: 1.00 kB
19
+ ℹ dist/tenant.js.map 1.38 kB │ gzip: 0.68 kB
20
+ ℹ dist/blueprint.js.map 1.28 kB │ gzip: 0.64 kB
21
+ ℹ dist/example.js.map 1.26 kB │ gzip: 0.65 kB
22
+ ℹ dist/source.sample.js.map 1.17 kB │ gzip: 0.58 kB
23
+ ℹ dist/agent.d.ts.map 0.29 kB │ gzip: 0.20 kB
24
+ ℹ dist/example.d.ts.map 0.14 kB │ gzip: 0.13 kB
25
+ ℹ dist/source.sample.d.ts.map 0.14 kB │ gzip: 0.12 kB
26
+ ℹ dist/blueprint.d.ts.map 0.13 kB │ gzip: 0.12 kB
27
+ ℹ dist/tenant.d.ts.map 0.12 kB │ gzip: 0.12 kB
28
+ ℹ dist/example.d.ts 1.13 kB │ gzip: 0.47 kB
29
+ ℹ dist/agent.d.ts 0.94 kB │ gzip: 0.44 kB
30
+ ℹ dist/index.d.ts 0.44 kB │ gzip: 0.19 kB
31
+ ℹ dist/source.sample.d.ts 0.27 kB │ gzip: 0.18 kB
32
+ ℹ dist/blueprint.d.ts 0.25 kB │ gzip: 0.17 kB
33
+ ℹ dist/tenant.d.ts 0.25 kB │ gzip: 0.17 kB
34
+ ℹ dist/docs/index.d.ts 0.01 kB │ gzip: 0.03 kB
35
+ ℹ dist/docs/knowledge-canon.docblock.d.ts 0.01 kB │ gzip: 0.03 kB
36
+ ℹ 27 files, total: 20.18 kB
37
+ ✔ Build complete in 16746ms
@@ -1,19 +1,38 @@
1
- $ bun build:bundle && bun build:types
1
+ $ bun build:types && bun build:bundle
2
+ $ tsc --noEmit
2
3
  $ tsdown
3
- ℹ tsdown v0.17.4 powered by rolldown v1.0.0-beta.53
4
- ℹ config file: /home/runner/work/contractspec/contractspec/packages/examples/knowledge-canon/tsdown.config.js
4
+ ℹ tsdown v0.18.3 powered by rolldown v1.0.0-beta.57
5
+ ℹ config file: /home/runner/work/contractspec/contractspec/packages/examples/knowledge-canon/tsdown.config.js (unrun)
5
6
  ℹ entry: src/agent.ts, src/blueprint.ts, src/example.ts, src/index.ts, src/source.sample.ts, src/tenant.ts, src/docs/index.ts, src/docs/knowledge-canon.docblock.ts
6
7
  ℹ target: esnext
7
8
  ℹ tsconfig: tsconfig.json
8
9
  ℹ Build start
9
- ℹ dist/docs/knowledge-canon.docblock.js 1.46 kB │ gzip: 0.71 kB
10
- ℹ dist/example.js 0.64 kB │ gzip: 0.38 kB
11
- ℹ dist/blueprint.js 0.63 kB │ gzip: 0.38 kB
12
- ℹ dist/tenant.js 0.60 kB │ gzip: 0.37 kB
13
- ℹ dist/agent.js 0.58 kB │ gzip: 0.37 kB
14
- ℹ dist/source.sample.js 0.48 kB │ gzip: 0.31 kB
15
- ℹ dist/index.js 0.48 kB │ gzip: 0.22 kB
16
- ℹ dist/docs/index.js 0.04 kB │ gzip: 0.06 kB
17
- ℹ 8 files, total: 4.91 kB
18
- ✔ Build complete in 47ms
19
- $ tsc --noEmit
10
+ ℹ dist/docs/knowledge-canon.docblock.js 1.67 kB │ gzip: 0.79 kB
11
+ ℹ dist/agent.js 1.25 kB │ gzip: 0.62 kB
12
+ ℹ dist/example.js 0.89 kB │ gzip: 0.48 kB
13
+ ℹ dist/blueprint.js 0.83 kB │ gzip: 0.45 kB
14
+ ℹ dist/tenant.js 0.80 kB │ gzip: 0.44 kB
15
+ ℹ dist/source.sample.js 0.69 kB │ gzip: 0.40 kB
16
+ ℹ dist/index.js 0.50 kB │ gzip: 0.21 kB
17
+ ℹ dist/docs/index.js 0.04 kB │ gzip: 0.06 kB
18
+ ℹ dist/docs/knowledge-canon.docblock.js.map 2.16 kB │ gzip: 0.97 kB
19
+ ℹ dist/agent.js.map 2.12 kB │ gzip: 1.00 kB
20
+ ℹ dist/tenant.js.map 1.38 kB │ gzip: 0.68 kB
21
+ ℹ dist/blueprint.js.map 1.28 kB │ gzip: 0.64 kB
22
+ ℹ dist/example.js.map 1.26 kB │ gzip: 0.65 kB
23
+ ℹ dist/source.sample.js.map 1.17 kB │ gzip: 0.58 kB
24
+ ℹ dist/agent.d.ts.map 0.29 kB │ gzip: 0.20 kB
25
+ ℹ dist/example.d.ts.map 0.14 kB │ gzip: 0.13 kB
26
+ ℹ dist/source.sample.d.ts.map 0.14 kB │ gzip: 0.12 kB
27
+ ℹ dist/blueprint.d.ts.map 0.13 kB │ gzip: 0.12 kB
28
+ ℹ dist/tenant.d.ts.map 0.12 kB │ gzip: 0.12 kB
29
+ ℹ dist/example.d.ts 1.13 kB │ gzip: 0.47 kB
30
+ ℹ dist/agent.d.ts 0.94 kB │ gzip: 0.44 kB
31
+ ℹ dist/index.d.ts 0.44 kB │ gzip: 0.19 kB
32
+ ℹ dist/source.sample.d.ts 0.27 kB │ gzip: 0.18 kB
33
+ ℹ dist/blueprint.d.ts 0.25 kB │ gzip: 0.17 kB
34
+ ℹ dist/tenant.d.ts 0.25 kB │ gzip: 0.17 kB
35
+ ℹ dist/docs/index.d.ts 0.01 kB │ gzip: 0.03 kB
36
+ ℹ dist/docs/knowledge-canon.docblock.d.ts 0.01 kB │ gzip: 0.03 kB
37
+ ℹ 27 files, total: 20.18 kB
38
+ ✔ Build complete in 19559ms
package/CHANGELOG.md ADDED
@@ -0,0 +1,22 @@
1
+ # @lssm/example.knowledge-canon
2
+
3
+ ## 1.42.1
4
+
5
+ ### Patch Changes
6
+
7
+ - f043995: Fix release
8
+ - Updated dependencies [f043995]
9
+ - @lssm/lib.contracts@1.42.1
10
+ - @lssm/lib.schema@1.42.1
11
+
12
+ ## 1.42.0
13
+
14
+ ### Minor Changes
15
+
16
+ - 8eefd9c: initial release
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies [8eefd9c]
21
+ - @lssm/lib.contracts@1.42.0
22
+ - @lssm/lib.schema@1.42.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Chaman Ventures, SASU
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  ### Knowledge Example – Product Canon Space
2
2
 
3
+ Website: https://contractspec.lssm.tech/
4
+
5
+
3
6
  This example demonstrates how to bind the Product Canon `KnowledgeSpaceSpec` to a tenant and surface it to agents/workflows.
4
7
 
5
8
  Included assets:
@@ -0,0 +1,25 @@
1
+ import * as _lssm_lib_contracts_app_config_runtime0 from "@lssm/lib.contracts/app-config/runtime";
2
+ import { ResolvedAppConfig } from "@lssm/lib.contracts/app-config/runtime";
3
+
4
+ //#region src/agent.d.ts
5
+ /**
6
+ * Selects knowledge bindings that apply to a workflow or agent identifier.
7
+ */
8
+ declare function selectKnowledgeBindings(resolved: ResolvedAppConfig, options: {
9
+ workflowId?: string;
10
+ agentId?: string;
11
+ }): _lssm_lib_contracts_app_config_runtime0.ResolvedKnowledge[];
12
+ /**
13
+ * Pseudo implementation of an assistant lookup that routes prompts to the appropriate
14
+ * knowledge sources. In a real system this would call the ingestion/search services.
15
+ */
16
+ declare function answerWithKnowledge(resolved: ResolvedAppConfig, question: string, {
17
+ workflowId,
18
+ agentId
19
+ }: {
20
+ workflowId?: string;
21
+ agentId?: string;
22
+ }): Promise<string>;
23
+ //#endregion
24
+ export { answerWithKnowledge, selectKnowledgeBindings };
25
+ //# sourceMappingURL=agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.d.ts","names":[],"sources":["../src/agent.ts"],"sourcesContent":[],"mappings":";;;;;;;AAKgB,iBAAA,uBAAA,CACJ,QAAA,EAAA,iBAAiB,EAAA,OAAA,EAAA;EAoBP,UAAA,CAAA,EAAA,MAAA;EACV,OAAA,CAAA,EAAA,MAAA;CAER,CAAA,EAvByB,uCAAA,CACuB,iBAAA,EAsBhD;;;;;iBAHkB,mBAAA,WACV;;;;;;IAGT"}
package/dist/agent.js CHANGED
@@ -1,2 +1,35 @@
1
- function e(e,t){return e.knowledge.filter(({binding:e})=>!!(!e.scope||t.workflowId&&e.scope.workflows?.includes(t.workflowId)||t.agentId&&e.scope.agents?.includes(t.agentId)))}async function t(t,n,{workflowId:r,agentId:i}){let a=e(t,{workflowId:r,agentId:i});if(a.length===0)return`No knowledge space available for this request.`;let o=a.map(({space:e})=>`• ${e.meta.displayName}`);return[`Q: ${n}`,`Routed to knowledge spaces:`,...o,``,`TODO: invoke knowledge search service and synthesize response.`].join(`
2
- `)}export{t as answerWithKnowledge,e as selectKnowledgeBindings};
1
+ //#region src/agent.ts
2
+ /**
3
+ * Selects knowledge bindings that apply to a workflow or agent identifier.
4
+ */
5
+ function selectKnowledgeBindings(resolved, options) {
6
+ return resolved.knowledge.filter(({ binding }) => {
7
+ if (!binding.scope) return true;
8
+ if (options.workflowId && binding.scope.workflows?.includes(options.workflowId)) return true;
9
+ if (options.agentId && binding.scope.agents?.includes(options.agentId)) return true;
10
+ return false;
11
+ });
12
+ }
13
+ /**
14
+ * Pseudo implementation of an assistant lookup that routes prompts to the appropriate
15
+ * knowledge sources. In a real system this would call the ingestion/search services.
16
+ */
17
+ async function answerWithKnowledge(resolved, question, { workflowId, agentId }) {
18
+ const bindings = selectKnowledgeBindings(resolved, {
19
+ workflowId,
20
+ agentId
21
+ });
22
+ if (bindings.length === 0) return "No knowledge space available for this request.";
23
+ const summaries = bindings.map(({ space }) => `• ${space.meta.title || space.meta.description}`);
24
+ return [
25
+ `Q: ${question}`,
26
+ "Routed to knowledge spaces:",
27
+ ...summaries,
28
+ "",
29
+ "TODO: invoke knowledge search service and synthesize response."
30
+ ].join("\n");
31
+ }
32
+
33
+ //#endregion
34
+ export { answerWithKnowledge, selectKnowledgeBindings };
35
+ //# sourceMappingURL=agent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.js","names":[],"sources":["../src/agent.ts"],"sourcesContent":["import type { ResolvedAppConfig } from '@lssm/lib.contracts/app-config/runtime';\n\n/**\n * Selects knowledge bindings that apply to a workflow or agent identifier.\n */\nexport function selectKnowledgeBindings(\n resolved: ResolvedAppConfig,\n options: { workflowId?: string; agentId?: string }\n) {\n return resolved.knowledge.filter(({ binding }) => {\n if (!binding.scope) return true;\n if (\n options.workflowId &&\n binding.scope.workflows?.includes(options.workflowId)\n )\n return true;\n if (options.agentId && binding.scope.agents?.includes(options.agentId))\n return true;\n return false;\n });\n}\n\n/**\n * Pseudo implementation of an assistant lookup that routes prompts to the appropriate\n * knowledge sources. In a real system this would call the ingestion/search services.\n */\nexport async function answerWithKnowledge(\n resolved: ResolvedAppConfig,\n question: string,\n { workflowId, agentId }: { workflowId?: string; agentId?: string }\n): Promise<string> {\n const bindings = selectKnowledgeBindings(resolved, { workflowId, agentId });\n if (bindings.length === 0) {\n return 'No knowledge space available for this request.';\n }\n\n const summaries = bindings.map(\n ({ space }) => `• ${space.meta.title || space.meta.description}`\n );\n return [\n `Q: ${question}`,\n 'Routed to knowledge spaces:',\n ...summaries,\n '',\n 'TODO: invoke knowledge search service and synthesize response.',\n ].join('\\n');\n}\n"],"mappings":";;;;AAKA,SAAgB,wBACd,UACA,SACA;AACA,QAAO,SAAS,UAAU,QAAQ,EAAE,cAAc;AAChD,MAAI,CAAC,QAAQ,MAAO,QAAO;AAC3B,MACE,QAAQ,cACR,QAAQ,MAAM,WAAW,SAAS,QAAQ,WAAW,CAErD,QAAO;AACT,MAAI,QAAQ,WAAW,QAAQ,MAAM,QAAQ,SAAS,QAAQ,QAAQ,CACpE,QAAO;AACT,SAAO;GACP;;;;;;AAOJ,eAAsB,oBACpB,UACA,UACA,EAAE,YAAY,WACG;CACjB,MAAM,WAAW,wBAAwB,UAAU;EAAE;EAAY;EAAS,CAAC;AAC3E,KAAI,SAAS,WAAW,EACtB,QAAO;CAGT,MAAM,YAAY,SAAS,KACxB,EAAE,YAAY,KAAK,MAAM,KAAK,SAAS,MAAM,KAAK,cACpD;AACD,QAAO;EACL,MAAM;EACN;EACA,GAAG;EACH;EACA;EACD,CAAC,KAAK,KAAK"}
@@ -0,0 +1,7 @@
1
+ import { AppBlueprintSpec } from "@lssm/lib.contracts/app-config/spec";
2
+
3
+ //#region src/blueprint.d.ts
4
+ declare const artisanKnowledgeBlueprint: AppBlueprintSpec;
5
+ //#endregion
6
+ export { artisanKnowledgeBlueprint };
7
+ //# sourceMappingURL=blueprint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blueprint.d.ts","names":[],"sources":["../src/blueprint.ts"],"sourcesContent":[],"mappings":";;;cAOa,2BAA2B"}
package/dist/blueprint.js CHANGED
@@ -1 +1,29 @@
1
- import{OwnersEnum as e,StabilityEnum as t,TagsEnum as n}from"@lssm/lib.contracts/ownership";const r={meta:{name:`artisan.knowledge.product`,version:1,appId:`artisan`,title:`ArtisanOS Knowledge – Product Canon`,description:`Blueprint that surfaces canonical product knowledge to agents and workflows.`,domain:`knowledge`,owners:[e.PlatformContent],tags:[`knowledge`,`product-canon`,n.Guide],stability:t.Experimental},workflows:{answerFaq:{name:`artisan.knowledge.answerFaq`,version:1}},notes:`Workflows and assistants running on this blueprint should bind the Product Canon knowledge space.`};export{r as artisanKnowledgeBlueprint};
1
+ import { OwnersEnum, StabilityEnum, TagsEnum } from "@lssm/lib.contracts/ownership";
2
+
3
+ //#region src/blueprint.ts
4
+ const artisanKnowledgeBlueprint = {
5
+ meta: {
6
+ key: "artisan.knowledge.product",
7
+ version: 1,
8
+ appId: "artisan",
9
+ title: "ArtisanOS Knowledge – Product Canon",
10
+ description: "Blueprint that surfaces canonical product knowledge to agents and workflows.",
11
+ domain: "knowledge",
12
+ owners: [OwnersEnum.PlatformContent],
13
+ tags: [
14
+ "knowledge",
15
+ "product-canon",
16
+ TagsEnum.Guide
17
+ ],
18
+ stability: StabilityEnum.Experimental
19
+ },
20
+ workflows: { answerFaq: {
21
+ key: "artisan.knowledge.answerFaq",
22
+ version: 1
23
+ } },
24
+ notes: "Workflows and assistants running on this blueprint should bind the Product Canon knowledge space."
25
+ };
26
+
27
+ //#endregion
28
+ export { artisanKnowledgeBlueprint };
29
+ //# sourceMappingURL=blueprint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blueprint.js","names":["artisanKnowledgeBlueprint: AppBlueprintSpec"],"sources":["../src/blueprint.ts"],"sourcesContent":["import type { AppBlueprintSpec } from '@lssm/lib.contracts/app-config/spec';\nimport {\n OwnersEnum,\n StabilityEnum,\n TagsEnum,\n} from '@lssm/lib.contracts/ownership';\n\nexport const artisanKnowledgeBlueprint: AppBlueprintSpec = {\n meta: {\n key: 'artisan.knowledge.product',\n version: 1,\n appId: 'artisan',\n title: 'ArtisanOS Knowledge – Product Canon',\n description:\n 'Blueprint that surfaces canonical product knowledge to agents and workflows.',\n domain: 'knowledge',\n owners: [OwnersEnum.PlatformContent],\n tags: ['knowledge', 'product-canon', TagsEnum.Guide],\n stability: StabilityEnum.Experimental,\n },\n workflows: {\n answerFaq: { key: 'artisan.knowledge.answerFaq', version: 1 },\n },\n notes:\n 'Workflows and assistants running on this blueprint should bind the Product Canon knowledge space.',\n};\n"],"mappings":";;;AAOA,MAAaA,4BAA8C;CACzD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,OAAO;EACP,aACE;EACF,QAAQ;EACR,QAAQ,CAAC,WAAW,gBAAgB;EACpC,MAAM;GAAC;GAAa;GAAiB,SAAS;GAAM;EACpD,WAAW,cAAc;EAC1B;CACD,WAAW,EACT,WAAW;EAAE,KAAK;EAA+B,SAAS;EAAG,EAC9D;CACD,OACE;CACH"}
@@ -0,0 +1 @@
1
+ export { };
@@ -1 +1 @@
1
- import"./knowledge-canon.docblock.js";
1
+ import "./knowledge-canon.docblock.js";
@@ -0,0 +1 @@
1
+ export { };
@@ -1,18 +1,29 @@
1
- import{registerDocBlocks as e}from"@lssm/lib.contracts/docs";e([{id:`docs.examples.knowledge-canon`,title:`Knowledge Example — Product Canon Space`,summary:`Bind the Product Canon KnowledgeSpaceSpec to a tenant and expose it to agents/workflows via ResolvedAppConfig.`,kind:`reference`,visibility:`public`,route:`/docs/examples/knowledge-canon`,tags:[`knowledge`,`canon`,`example`],body:`## Included assets
2
- - Blueprint referencing a workflow depending on the Product Canon space.
3
- - Tenant app config binding the space to a workflow and agent scope.
4
- - Sample knowledge source configuration.
5
- - Helper to pick knowledge bindings from ResolvedAppConfig.
1
+ import { registerDocBlocks } from "@lssm/lib.contracts/docs";
6
2
 
7
- ## Guardrails
8
- - Keep sources scoped per tenant.
9
- - Keep secret fields out of config (use secret providers).
10
- - Enforce scope restrictions before answering.`},{id:`docs.examples.knowledge-canon.usage`,title:`Knowledge CanonUsage`,summary:`How to register the space, configure sources, and route requests.`,kind:`usage`,visibility:`public`,route:`/docs/examples/knowledge-canon/usage`,tags:[`knowledge`,`usage`],body:`## Usage
11
- 1) Register the knowledge space spec in your KnowledgeSpaceRegistry.
12
- 2) Persist the source config through knowledge CRUD operations.
13
- 3) Compose ResolvedAppConfig and pass it to your workflow/agent runtime.
14
- 4) Use helpers like \`selectKnowledgeBindings\` before dispatching to search/embedding.
3
+ //#region src/docs/knowledge-canon.docblock.ts
4
+ registerDocBlocks([{
5
+ id: "docs.examples.knowledge-canon",
6
+ title: "Knowledge ExampleProduct Canon Space",
7
+ summary: "Bind the Product Canon KnowledgeSpaceSpec to a tenant and expose it to agents/workflows via ResolvedAppConfig.",
8
+ kind: "reference",
9
+ visibility: "public",
10
+ route: "/docs/examples/knowledge-canon",
11
+ tags: [
12
+ "knowledge",
13
+ "canon",
14
+ "example"
15
+ ],
16
+ body: `## Included assets\n- Blueprint referencing a workflow depending on the Product Canon space.\n- Tenant app config binding the space to a workflow and agent scope.\n- Sample knowledge source configuration.\n- Helper to pick knowledge bindings from ResolvedAppConfig.\n\n## Guardrails\n- Keep sources scoped per tenant.\n- Keep secret fields out of config (use secret providers).\n- Enforce scope restrictions before answering.`
17
+ }, {
18
+ id: "docs.examples.knowledge-canon.usage",
19
+ title: "Knowledge Canon — Usage",
20
+ summary: "How to register the space, configure sources, and route requests.",
21
+ kind: "usage",
22
+ visibility: "public",
23
+ route: "/docs/examples/knowledge-canon/usage",
24
+ tags: ["knowledge", "usage"],
25
+ body: `## Usage\n1) Register the knowledge space spec in your KnowledgeSpaceRegistry.\n2) Persist the source config through knowledge CRUD operations.\n3) Compose ResolvedAppConfig and pass it to your workflow/agent runtime.\n4) Use helpers like \`selectKnowledgeBindings\` before dispatching to search/embedding.\n\n## Notes\n- Avoid logging PII.\n- Keep search results auditable and cite sources.`
26
+ }]);
15
27
 
16
- ## Notes
17
- - Avoid logging PII.
18
- - Keep search results auditable and cite sources.`}]);
28
+ //#endregion
29
+ //# sourceMappingURL=knowledge-canon.docblock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knowledge-canon.docblock.js","names":[],"sources":["../../src/docs/knowledge-canon.docblock.ts"],"sourcesContent":["import type { DocBlock } from '@lssm/lib.contracts/docs';\nimport { registerDocBlocks } from '@lssm/lib.contracts/docs';\n\nconst blocks: DocBlock[] = [\n {\n id: 'docs.examples.knowledge-canon',\n title: 'Knowledge Example — Product Canon Space',\n summary:\n 'Bind the Product Canon KnowledgeSpaceSpec to a tenant and expose it to agents/workflows via ResolvedAppConfig.',\n kind: 'reference',\n visibility: 'public',\n route: '/docs/examples/knowledge-canon',\n tags: ['knowledge', 'canon', 'example'],\n body: `## Included assets\\n- Blueprint referencing a workflow depending on the Product Canon space.\\n- Tenant app config binding the space to a workflow and agent scope.\\n- Sample knowledge source configuration.\\n- Helper to pick knowledge bindings from ResolvedAppConfig.\\n\\n## Guardrails\\n- Keep sources scoped per tenant.\\n- Keep secret fields out of config (use secret providers).\\n- Enforce scope restrictions before answering.`,\n },\n {\n id: 'docs.examples.knowledge-canon.usage',\n title: 'Knowledge Canon — Usage',\n summary:\n 'How to register the space, configure sources, and route requests.',\n kind: 'usage',\n visibility: 'public',\n route: '/docs/examples/knowledge-canon/usage',\n tags: ['knowledge', 'usage'],\n body: `## Usage\\n1) Register the knowledge space spec in your KnowledgeSpaceRegistry.\\n2) Persist the source config through knowledge CRUD operations.\\n3) Compose ResolvedAppConfig and pass it to your workflow/agent runtime.\\n4) Use helpers like \\`selectKnowledgeBindings\\` before dispatching to search/embedding.\\n\\n## Notes\\n- Avoid logging PII.\\n- Keep search results auditable and cite sources.`,\n },\n];\n\nregisterDocBlocks(blocks);\n"],"mappings":";;;AA4BA,kBAzB2B,CACzB;CACE,IAAI;CACJ,OAAO;CACP,SACE;CACF,MAAM;CACN,YAAY;CACZ,OAAO;CACP,MAAM;EAAC;EAAa;EAAS;EAAU;CACvC,MAAM;CACP,EACD;CACE,IAAI;CACJ,OAAO;CACP,SACE;CACF,MAAM;CACN,YAAY;CACZ,OAAO;CACP,MAAM,CAAC,aAAa,QAAQ;CAC5B,MAAM;CACP,CACF,CAEwB"}
@@ -0,0 +1,34 @@
1
+ //#region src/example.d.ts
2
+ declare const example: {
3
+ readonly id: "knowledge-canon";
4
+ readonly title: "Knowledge Canon (Product Canon space)";
5
+ readonly summary: "Bind a canonical knowledge space to a tenant and route assistant/workflow requests to the right sources (blueprint + app config pattern).";
6
+ readonly tags: readonly ["knowledge", "canon", "app-config", "agents", "workflows"];
7
+ readonly kind: "knowledge";
8
+ readonly visibility: "public";
9
+ readonly docs: {
10
+ readonly rootDocId: "docs.examples.knowledge-canon";
11
+ readonly usageDocId: "docs.examples.knowledge-canon.usage";
12
+ };
13
+ readonly entrypoints: {
14
+ readonly packageName: "@lssm/example.knowledge-canon";
15
+ readonly docs: "./docs";
16
+ };
17
+ readonly surfaces: {
18
+ readonly templates: true;
19
+ readonly sandbox: {
20
+ readonly enabled: true;
21
+ readonly modes: readonly ["markdown", "specs"];
22
+ };
23
+ readonly studio: {
24
+ readonly enabled: true;
25
+ readonly installable: true;
26
+ };
27
+ readonly mcp: {
28
+ readonly enabled: true;
29
+ };
30
+ };
31
+ };
32
+ //#endregion
33
+ export { example as default };
34
+ //# sourceMappingURL=example.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"sourcesContent":[],"mappings":";cAAM;EAAA,SAAA,EAsBI,EAAA,iBAAA"}
package/dist/example.js CHANGED
@@ -1 +1,40 @@
1
- var e={id:`knowledge-canon`,title:`Knowledge Canon (Product Canon space)`,summary:`Bind a canonical knowledge space to a tenant and route assistant/workflow requests to the right sources (blueprint + app config pattern).`,tags:[`knowledge`,`canon`,`app-config`,`agents`,`workflows`],kind:`knowledge`,visibility:`public`,docs:{rootDocId:`docs.examples.knowledge-canon`,usageDocId:`docs.examples.knowledge-canon.usage`},entrypoints:{packageName:`@lssm/example.knowledge-canon`,docs:`./docs`},surfaces:{templates:!0,sandbox:{enabled:!0,modes:[`markdown`,`specs`]},studio:{enabled:!0,installable:!0},mcp:{enabled:!0}}};export{e as default};
1
+ //#region src/example.ts
2
+ const example = {
3
+ id: "knowledge-canon",
4
+ title: "Knowledge Canon (Product Canon space)",
5
+ summary: "Bind a canonical knowledge space to a tenant and route assistant/workflow requests to the right sources (blueprint + app config pattern).",
6
+ tags: [
7
+ "knowledge",
8
+ "canon",
9
+ "app-config",
10
+ "agents",
11
+ "workflows"
12
+ ],
13
+ kind: "knowledge",
14
+ visibility: "public",
15
+ docs: {
16
+ rootDocId: "docs.examples.knowledge-canon",
17
+ usageDocId: "docs.examples.knowledge-canon.usage"
18
+ },
19
+ entrypoints: {
20
+ packageName: "@lssm/example.knowledge-canon",
21
+ docs: "./docs"
22
+ },
23
+ surfaces: {
24
+ templates: true,
25
+ sandbox: {
26
+ enabled: true,
27
+ modes: ["markdown", "specs"]
28
+ },
29
+ studio: {
30
+ enabled: true,
31
+ installable: true
32
+ },
33
+ mcp: { enabled: true }
34
+ }
35
+ };
36
+ var example_default = example;
37
+
38
+ //#endregion
39
+ export { example_default as default };
40
+ //# sourceMappingURL=example.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.js","names":[],"sources":["../src/example.ts"],"sourcesContent":["const example = {\n id: 'knowledge-canon',\n title: 'Knowledge Canon (Product Canon space)',\n summary:\n 'Bind a canonical knowledge space to a tenant and route assistant/workflow requests to the right sources (blueprint + app config pattern).',\n tags: ['knowledge', 'canon', 'app-config', 'agents', 'workflows'],\n kind: 'knowledge',\n visibility: 'public',\n docs: {\n rootDocId: 'docs.examples.knowledge-canon',\n usageDocId: 'docs.examples.knowledge-canon.usage',\n },\n entrypoints: {\n packageName: '@lssm/example.knowledge-canon',\n docs: './docs',\n },\n surfaces: {\n templates: true,\n sandbox: { enabled: true, modes: ['markdown', 'specs'] },\n studio: { enabled: true, installable: true },\n mcp: { enabled: true },\n },\n} as const;\n\nexport default example;\n"],"mappings":";AAAA,MAAM,UAAU;CACd,IAAI;CACJ,OAAO;CACP,SACE;CACF,MAAM;EAAC;EAAa;EAAS;EAAc;EAAU;EAAY;CACjE,MAAM;CACN,YAAY;CACZ,MAAM;EACJ,WAAW;EACX,YAAY;EACb;CACD,aAAa;EACX,aAAa;EACb,MAAM;EACP;CACD,UAAU;EACR,WAAW;EACX,SAAS;GAAE,SAAS;GAAM,OAAO,CAAC,YAAY,QAAQ;GAAE;EACxD,QAAQ;GAAE,SAAS;GAAM,aAAa;GAAM;EAC5C,KAAK,EAAE,SAAS,MAAM;EACvB;CACF;AAED,sBAAe"}
@@ -0,0 +1,6 @@
1
+ import { answerWithKnowledge, selectKnowledgeBindings } from "./agent.js";
2
+ import { artisanKnowledgeBlueprint } from "./blueprint.js";
3
+ import example from "./example.js";
4
+ import { artisanKnowledgeTenantConfig } from "./tenant.js";
5
+ import { productCanonNotionSource } from "./source.sample.js";
6
+ export { answerWithKnowledge, artisanKnowledgeBlueprint, artisanKnowledgeTenantConfig, example, productCanonNotionSource, selectKnowledgeBindings };
package/dist/index.js CHANGED
@@ -1 +1,8 @@
1
- import{answerWithKnowledge as e,selectKnowledgeBindings as t}from"./agent.js";import{artisanKnowledgeBlueprint as n}from"./blueprint.js";import r from"./example.js";import{artisanKnowledgeTenantConfig as i}from"./tenant.js";import{productCanonNotionSource as a}from"./source.sample.js";import"./docs/index.js";export{e as answerWithKnowledge,n as artisanKnowledgeBlueprint,i as artisanKnowledgeTenantConfig,r as example,a as productCanonNotionSource,t as selectKnowledgeBindings};
1
+ import { answerWithKnowledge, selectKnowledgeBindings } from "./agent.js";
2
+ import { artisanKnowledgeBlueprint } from "./blueprint.js";
3
+ import example_default from "./example.js";
4
+ import { artisanKnowledgeTenantConfig } from "./tenant.js";
5
+ import { productCanonNotionSource } from "./source.sample.js";
6
+ import "./docs/index.js";
7
+
8
+ export { answerWithKnowledge, artisanKnowledgeBlueprint, artisanKnowledgeTenantConfig, example_default as example, productCanonNotionSource, selectKnowledgeBindings };
@@ -0,0 +1,7 @@
1
+ import { KnowledgeSourceConfig } from "@lssm/lib.contracts/knowledge/source";
2
+
3
+ //#region src/source.sample.d.ts
4
+ declare const productCanonNotionSource: KnowledgeSourceConfig;
5
+ //#endregion
6
+ export { productCanonNotionSource };
7
+ //# sourceMappingURL=source.sample.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source.sample.d.ts","names":[],"sources":["../src/source.sample.ts"],"sourcesContent":[],"mappings":";;;cAEa,0BAA0B"}
@@ -1 +1,30 @@
1
- const e={meta:{id:`source-canon-notion`,tenantId:`artisan-co`,spaceKey:`knowledge.product-canon`,spaceVersion:1,label:`Product Canon (Notion)`,sourceType:`notion`,createdAt:`2026-01-01T00:00:00.000Z`,updatedAt:`2026-01-01T00:00:00.000Z`},config:{notionDatabaseId:`xxxxxxxxxxxxxxxx`,apiKey:`secret_notion_token`},syncSchedule:{enabled:!0,cron:`0 * * * *`},lastSync:{timestamp:new Date(`2026-01-01T00:00:00.000Z`),success:!0,itemsProcessed:128}};export{e as productCanonNotionSource};
1
+ //#region src/source.sample.ts
2
+ const productCanonNotionSource = {
3
+ meta: {
4
+ id: "source-canon-notion",
5
+ tenantId: "artisan-co",
6
+ spaceKey: "knowledge.product-canon",
7
+ spaceVersion: 1,
8
+ label: "Product Canon (Notion)",
9
+ sourceType: "notion",
10
+ createdAt: "2026-01-01T00:00:00.000Z",
11
+ updatedAt: "2026-01-01T00:00:00.000Z"
12
+ },
13
+ config: {
14
+ notionDatabaseId: "xxxxxxxxxxxxxxxx",
15
+ apiKey: "secret_notion_token"
16
+ },
17
+ syncSchedule: {
18
+ enabled: true,
19
+ cron: "0 * * * *"
20
+ },
21
+ lastSync: {
22
+ timestamp: /* @__PURE__ */ new Date("2026-01-01T00:00:00.000Z"),
23
+ success: true,
24
+ itemsProcessed: 128
25
+ }
26
+ };
27
+
28
+ //#endregion
29
+ export { productCanonNotionSource };
30
+ //# sourceMappingURL=source.sample.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source.sample.js","names":["productCanonNotionSource: KnowledgeSourceConfig"],"sources":["../src/source.sample.ts"],"sourcesContent":["import type { KnowledgeSourceConfig } from '@lssm/lib.contracts/knowledge/source';\n\nexport const productCanonNotionSource: KnowledgeSourceConfig = {\n meta: {\n id: 'source-canon-notion',\n tenantId: 'artisan-co',\n spaceKey: 'knowledge.product-canon',\n spaceVersion: 1,\n label: 'Product Canon (Notion)',\n sourceType: 'notion',\n createdAt: '2026-01-01T00:00:00.000Z',\n updatedAt: '2026-01-01T00:00:00.000Z',\n },\n config: {\n notionDatabaseId: 'xxxxxxxxxxxxxxxx',\n apiKey: 'secret_notion_token',\n },\n syncSchedule: {\n enabled: true,\n cron: '0 * * * *',\n },\n lastSync: {\n timestamp: new Date('2026-01-01T00:00:00.000Z'),\n success: true,\n itemsProcessed: 128,\n },\n};\n"],"mappings":";AAEA,MAAaA,2BAAkD;CAC7D,MAAM;EACJ,IAAI;EACJ,UAAU;EACV,UAAU;EACV,cAAc;EACd,OAAO;EACP,YAAY;EACZ,WAAW;EACX,WAAW;EACZ;CACD,QAAQ;EACN,kBAAkB;EAClB,QAAQ;EACT;CACD,cAAc;EACZ,SAAS;EACT,MAAM;EACP;CACD,UAAU;EACR,2BAAW,IAAI,KAAK,2BAA2B;EAC/C,SAAS;EACT,gBAAgB;EACjB;CACF"}
@@ -0,0 +1,7 @@
1
+ import { TenantAppConfig } from "@lssm/lib.contracts/app-config/spec";
2
+
3
+ //#region src/tenant.d.ts
4
+ declare const artisanKnowledgeTenantConfig: TenantAppConfig;
5
+ //#endregion
6
+ export { artisanKnowledgeTenantConfig };
7
+ //# sourceMappingURL=tenant.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tenant.d.ts","names":[],"sources":["../src/tenant.ts"],"sourcesContent":[],"mappings":";;;cAEa,8BAA8B"}
package/dist/tenant.js CHANGED
@@ -1 +1,33 @@
1
- const e={meta:{id:`tenant-config-artisan-knowledge`,tenantId:`artisan-co`,appId:`artisan`,blueprintName:`artisan.knowledge.product`,blueprintVersion:1,environment:`production`,version:1,status:`published`,createdAt:`2026-01-01T00:00:00.000Z`,updatedAt:`2026-01-01T00:00:00.000Z`},knowledge:[{spaceKey:`knowledge.product-canon`,spaceVersion:1,scope:{workflows:[`answerFaq`],agents:[`productSupportAssistant`]},constraints:{maxTokensPerQuery:4096,maxQueriesPerMinute:30}}],integrations:[],notes:`Product Canon knowledge space bound for production assistants.`};export{e as artisanKnowledgeTenantConfig};
1
+ //#region src/tenant.ts
2
+ const artisanKnowledgeTenantConfig = {
3
+ meta: {
4
+ id: "tenant-config-artisan-knowledge",
5
+ tenantId: "artisan-co",
6
+ appId: "artisan",
7
+ blueprintName: "artisan.knowledge.product",
8
+ blueprintVersion: 1,
9
+ environment: "production",
10
+ version: 1,
11
+ status: "published",
12
+ createdAt: "2026-01-01T00:00:00.000Z",
13
+ updatedAt: "2026-01-01T00:00:00.000Z"
14
+ },
15
+ knowledge: [{
16
+ spaceKey: "knowledge.product-canon",
17
+ spaceVersion: 1,
18
+ scope: {
19
+ workflows: ["answerFaq"],
20
+ agents: ["productSupportAssistant"]
21
+ },
22
+ constraints: {
23
+ maxTokensPerQuery: 4096,
24
+ maxQueriesPerMinute: 30
25
+ }
26
+ }],
27
+ integrations: [],
28
+ notes: "Product Canon knowledge space bound for production assistants."
29
+ };
30
+
31
+ //#endregion
32
+ export { artisanKnowledgeTenantConfig };
33
+ //# sourceMappingURL=tenant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tenant.js","names":["artisanKnowledgeTenantConfig: TenantAppConfig"],"sources":["../src/tenant.ts"],"sourcesContent":["import type { TenantAppConfig } from '@lssm/lib.contracts/app-config/spec';\n\nexport const artisanKnowledgeTenantConfig: TenantAppConfig = {\n meta: {\n id: 'tenant-config-artisan-knowledge',\n tenantId: 'artisan-co',\n appId: 'artisan',\n blueprintName: 'artisan.knowledge.product',\n blueprintVersion: 1,\n environment: 'production',\n version: 1,\n status: 'published',\n createdAt: '2026-01-01T00:00:00.000Z',\n updatedAt: '2026-01-01T00:00:00.000Z',\n },\n knowledge: [\n {\n spaceKey: 'knowledge.product-canon',\n spaceVersion: 1,\n scope: {\n workflows: ['answerFaq'],\n agents: ['productSupportAssistant'],\n },\n constraints: {\n maxTokensPerQuery: 4096,\n maxQueriesPerMinute: 30,\n },\n },\n ],\n integrations: [],\n notes: 'Product Canon knowledge space bound for production assistants.',\n};\n"],"mappings":";AAEA,MAAaA,+BAAgD;CAC3D,MAAM;EACJ,IAAI;EACJ,UAAU;EACV,OAAO;EACP,eAAe;EACf,kBAAkB;EAClB,aAAa;EACb,SAAS;EACT,QAAQ;EACR,WAAW;EACX,WAAW;EACZ;CACD,WAAW,CACT;EACE,UAAU;EACV,cAAc;EACd,OAAO;GACL,WAAW,CAAC,YAAY;GACxB,QAAQ,CAAC,0BAA0B;GACpC;EACD,aAAa;GACX,mBAAmB;GACnB,qBAAqB;GACtB;EACF,CACF;CACD,cAAc,EAAE;CAChB,OAAO;CACR"}