@contractspec/example.knowledge-canon 1.56.1 → 1.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +41 -38
- package/.turbo/turbo-prebuild.log +1 -0
- package/CHANGELOG.md +28 -0
- package/dist/agent.d.ts +8 -16
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +28 -31
- package/dist/blueprint.d.ts +2 -6
- package/dist/blueprint.d.ts.map +1 -1
- package/dist/blueprint.js +26 -28
- package/dist/browser/agent.js +31 -0
- package/dist/browser/blueprint.js +26 -0
- package/dist/browser/docs/index.js +42 -0
- package/dist/browser/docs/knowledge-canon.docblock.js +42 -0
- package/dist/browser/example.js +33 -0
- package/dist/browser/index.js +191 -0
- package/dist/browser/source.sample.js +29 -0
- package/dist/browser/tenant.js +34 -0
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +43 -1
- package/dist/docs/knowledge-canon.docblock.d.ts +2 -1
- package/dist/docs/knowledge-canon.docblock.d.ts.map +1 -0
- package/dist/docs/knowledge-canon.docblock.js +40 -26
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +31 -44
- package/dist/index.d.ts +7 -6
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +192 -8
- package/dist/node/agent.js +31 -0
- package/dist/node/blueprint.js +26 -0
- package/dist/node/docs/index.js +42 -0
- package/dist/node/docs/knowledge-canon.docblock.js +42 -0
- package/dist/node/example.js +33 -0
- package/dist/node/index.js +191 -0
- package/dist/node/source.sample.js +29 -0
- package/dist/node/tenant.js +34 -0
- package/dist/source.sample.d.ts +2 -6
- package/dist/source.sample.d.ts.map +1 -1
- package/dist/source.sample.js +29 -29
- package/dist/tenant.d.ts +2 -6
- package/dist/tenant.d.ts.map +1 -1
- package/dist/tenant.js +34 -32
- package/package.json +84 -29
- package/tsdown.config.js +1 -2
- package/.turbo/turbo-build$colon$bundle.log +0 -37
- package/dist/agent.js.map +0 -1
- package/dist/blueprint.js.map +0 -1
- package/dist/docs/knowledge-canon.docblock.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/source.sample.js.map +0 -1
- package/dist/tenant.js.map +0 -1
- package/tsconfig.tsbuildinfo +0 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,38 +1,41 @@
|
|
|
1
|
-
$ bun
|
|
2
|
-
$
|
|
3
|
-
$
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
$ contractspec-bun-build prebuild
|
|
2
|
+
$ bun run prebuild && bun run build:bundle && bun run build:types
|
|
3
|
+
$ contractspec-bun-build prebuild
|
|
4
|
+
$ contractspec-bun-build transpile
|
|
5
|
+
[contractspec-bun-build] transpile target=bun root=src entries=8
|
|
6
|
+
Bundled 8 modules in 10ms
|
|
7
|
+
|
|
8
|
+
./agent.js 1.0 KB (entry point)
|
|
9
|
+
./index.js 5.98 KB (entry point)
|
|
10
|
+
./blueprint.js 0.82 KB (entry point)
|
|
11
|
+
docs/index.js 1.67 KB (entry point)
|
|
12
|
+
docs/knowledge-canon.docblock.js 1.67 KB (entry point)
|
|
13
|
+
./example.js 1.0 KB (entry point)
|
|
14
|
+
./source.sample.js 0.67 KB (entry point)
|
|
15
|
+
./tenant.js 0.85 KB (entry point)
|
|
16
|
+
|
|
17
|
+
[contractspec-bun-build] transpile target=node root=src entries=8
|
|
18
|
+
Bundled 8 modules in 31ms
|
|
19
|
+
|
|
20
|
+
./agent.js 0.99 KB (entry point)
|
|
21
|
+
./index.js 5.96 KB (entry point)
|
|
22
|
+
./blueprint.js 0.81 KB (entry point)
|
|
23
|
+
docs/index.js 1.66 KB (entry point)
|
|
24
|
+
docs/knowledge-canon.docblock.js 1.66 KB (entry point)
|
|
25
|
+
./example.js 1.0 KB (entry point)
|
|
26
|
+
./source.sample.js 0.66 KB (entry point)
|
|
27
|
+
./tenant.js 0.84 KB (entry point)
|
|
28
|
+
|
|
29
|
+
[contractspec-bun-build] transpile target=browser root=src entries=8
|
|
30
|
+
Bundled 8 modules in 16ms
|
|
31
|
+
|
|
32
|
+
./agent.js 0.99 KB (entry point)
|
|
33
|
+
./index.js 5.96 KB (entry point)
|
|
34
|
+
./blueprint.js 0.81 KB (entry point)
|
|
35
|
+
docs/index.js 1.66 KB (entry point)
|
|
36
|
+
docs/knowledge-canon.docblock.js 1.66 KB (entry point)
|
|
37
|
+
./example.js 1.0 KB (entry point)
|
|
38
|
+
./source.sample.js 0.66 KB (entry point)
|
|
39
|
+
./tenant.js 0.84 KB (entry point)
|
|
40
|
+
|
|
41
|
+
$ contractspec-bun-build types
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
$ contractspec-bun-build prebuild
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @contractspec/example.knowledge-canon
|
|
2
2
|
|
|
3
|
+
## 1.58.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- d1f0fd0: chore: Migrate non-app package builds from tsdown to shared Bun tooling, add `@contractspec/tool.bun`, and standardize `prebuild`/`build`/`typecheck` with platform-aware exports and `tsc` declaration emission into `dist`.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [d1f0fd0]
|
|
12
|
+
- Updated dependencies [4355a9e]
|
|
13
|
+
- @contractspec/lib.contracts@1.58.0
|
|
14
|
+
|
|
15
|
+
## 1.57.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- 11a5a05: feat: improve product intent
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [8ecf3c1]
|
|
24
|
+
- Updated dependencies [47c48c2]
|
|
25
|
+
- Updated dependencies [a119963]
|
|
26
|
+
- Updated dependencies [4651e06]
|
|
27
|
+
- Updated dependencies [ad9d10a]
|
|
28
|
+
- Updated dependencies [11a5a05]
|
|
29
|
+
- @contractspec/lib.contracts@1.57.0
|
|
30
|
+
|
|
3
31
|
## 1.56.1
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
package/dist/agent.d.ts
CHANGED
|
@@ -1,25 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { ResolvedAppConfig } from "@contractspec/lib.contracts/app-config/runtime";
|
|
3
|
-
|
|
4
|
-
//#region src/agent.d.ts
|
|
1
|
+
import type { ResolvedAppConfig } from '@contractspec/lib.contracts/app-config/runtime';
|
|
5
2
|
/**
|
|
6
3
|
* Selects knowledge bindings that apply to a workflow or agent identifier.
|
|
7
4
|
*/
|
|
8
|
-
declare function selectKnowledgeBindings(resolved: ResolvedAppConfig, options: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}):
|
|
5
|
+
export declare function selectKnowledgeBindings(resolved: ResolvedAppConfig, options: {
|
|
6
|
+
workflowId?: string;
|
|
7
|
+
agentId?: string;
|
|
8
|
+
}): import("@contractspec/lib.contracts").ResolvedKnowledge[];
|
|
12
9
|
/**
|
|
13
10
|
* Pseudo implementation of an assistant lookup that routes prompts to the appropriate
|
|
14
11
|
* knowledge sources. In a real system this would call the ingestion/search services.
|
|
15
12
|
*/
|
|
16
|
-
declare function answerWithKnowledge(resolved: ResolvedAppConfig, question: string, {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}: {
|
|
20
|
-
workflowId?: string;
|
|
21
|
-
agentId?: string;
|
|
13
|
+
export declare function answerWithKnowledge(resolved: ResolvedAppConfig, question: string, { workflowId, agentId }: {
|
|
14
|
+
workflowId?: string;
|
|
15
|
+
agentId?: string;
|
|
22
16
|
}): Promise<string>;
|
|
23
|
-
//#endregion
|
|
24
|
-
export { answerWithKnowledge, selectKnowledgeBindings };
|
|
25
17
|
//# sourceMappingURL=agent.d.ts.map
|
package/dist/agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAC;AAExF;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,iBAAiB,EAC3B,OAAO,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,6DAanD;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,iBAAiB,EAC3B,QAAQ,EAAE,MAAM,EAChB,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GACjE,OAAO,CAAC,MAAM,CAAC,CAgBjB"}
|
package/dist/agent.js
CHANGED
|
@@ -1,35 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Selects knowledge bindings that apply to a workflow or agent identifier.
|
|
4
|
-
*/
|
|
1
|
+
// @bun
|
|
2
|
+
// src/agent.ts
|
|
5
3
|
function selectKnowledgeBindings(resolved, options) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
return resolved.knowledge.filter(({ binding }) => {
|
|
5
|
+
if (!binding.scope)
|
|
6
|
+
return true;
|
|
7
|
+
if (options.workflowId && binding.scope.workflows?.includes(options.workflowId))
|
|
8
|
+
return true;
|
|
9
|
+
if (options.agentId && binding.scope.agents?.includes(options.agentId))
|
|
10
|
+
return true;
|
|
11
|
+
return false;
|
|
12
|
+
});
|
|
12
13
|
}
|
|
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
14
|
async function answerWithKnowledge(resolved, question, { workflowId, agentId }) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
const bindings = selectKnowledgeBindings(resolved, { workflowId, agentId });
|
|
16
|
+
if (bindings.length === 0) {
|
|
17
|
+
return "No knowledge space available for this request.";
|
|
18
|
+
}
|
|
19
|
+
const summaries = bindings.map(({ space }) => `\u2022 ${space.meta.title || space.meta.description}`);
|
|
20
|
+
return [
|
|
21
|
+
`Q: ${question}`,
|
|
22
|
+
"Routed to knowledge spaces:",
|
|
23
|
+
...summaries,
|
|
24
|
+
"",
|
|
25
|
+
"TODO: invoke knowledge search service and synthesize response."
|
|
26
|
+
].join(`
|
|
27
|
+
`);
|
|
31
28
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
export {
|
|
30
|
+
selectKnowledgeBindings,
|
|
31
|
+
answerWithKnowledge
|
|
32
|
+
};
|
package/dist/blueprint.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import { AppBlueprintSpec } from
|
|
2
|
-
|
|
3
|
-
//#region src/blueprint.d.ts
|
|
4
|
-
declare const artisanKnowledgeBlueprint: AppBlueprintSpec;
|
|
5
|
-
//#endregion
|
|
6
|
-
export { artisanKnowledgeBlueprint };
|
|
1
|
+
import type { AppBlueprintSpec } from '@contractspec/lib.contracts/app-config/spec';
|
|
2
|
+
export declare const artisanKnowledgeBlueprint: AppBlueprintSpec;
|
|
7
3
|
//# sourceMappingURL=blueprint.d.ts.map
|
package/dist/blueprint.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blueprint.d.ts","
|
|
1
|
+
{"version":3,"file":"blueprint.d.ts","sourceRoot":"","sources":["../src/blueprint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAOpF,eAAO,MAAM,yBAAyB,EAAE,gBAkBvC,CAAC"}
|
package/dist/blueprint.js
CHANGED
|
@@ -1,29 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
1
|
+
// @bun
|
|
2
|
+
// src/blueprint.ts
|
|
3
|
+
import {
|
|
4
|
+
OwnersEnum,
|
|
5
|
+
StabilityEnum,
|
|
6
|
+
TagsEnum
|
|
7
|
+
} from "@contractspec/lib.contracts/ownership";
|
|
8
|
+
var artisanKnowledgeBlueprint = {
|
|
9
|
+
meta: {
|
|
10
|
+
key: "artisan.knowledge.product",
|
|
11
|
+
version: "1.0.0",
|
|
12
|
+
appId: "artisan",
|
|
13
|
+
title: "ArtisanOS Knowledge \u2013 Product Canon",
|
|
14
|
+
description: "Blueprint that surfaces canonical product knowledge to agents and workflows.",
|
|
15
|
+
domain: "knowledge",
|
|
16
|
+
owners: [OwnersEnum.PlatformContent],
|
|
17
|
+
tags: ["knowledge", "product-canon", TagsEnum.Guide],
|
|
18
|
+
stability: StabilityEnum.Experimental
|
|
19
|
+
},
|
|
20
|
+
workflows: {
|
|
21
|
+
answerFaq: { key: "artisan.knowledge.answerFaq", version: "1.0.0" }
|
|
22
|
+
},
|
|
23
|
+
notes: "Workflows and assistants running on this blueprint should bind the Product Canon knowledge space."
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
artisanKnowledgeBlueprint
|
|
25
27
|
};
|
|
26
|
-
|
|
27
|
-
//#endregion
|
|
28
|
-
export { artisanKnowledgeBlueprint };
|
|
29
|
-
//# sourceMappingURL=blueprint.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// src/agent.ts
|
|
2
|
+
function selectKnowledgeBindings(resolved, options) {
|
|
3
|
+
return resolved.knowledge.filter(({ binding }) => {
|
|
4
|
+
if (!binding.scope)
|
|
5
|
+
return true;
|
|
6
|
+
if (options.workflowId && binding.scope.workflows?.includes(options.workflowId))
|
|
7
|
+
return true;
|
|
8
|
+
if (options.agentId && binding.scope.agents?.includes(options.agentId))
|
|
9
|
+
return true;
|
|
10
|
+
return false;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
async function answerWithKnowledge(resolved, question, { workflowId, agentId }) {
|
|
14
|
+
const bindings = selectKnowledgeBindings(resolved, { workflowId, agentId });
|
|
15
|
+
if (bindings.length === 0) {
|
|
16
|
+
return "No knowledge space available for this request.";
|
|
17
|
+
}
|
|
18
|
+
const summaries = bindings.map(({ space }) => `• ${space.meta.title || space.meta.description}`);
|
|
19
|
+
return [
|
|
20
|
+
`Q: ${question}`,
|
|
21
|
+
"Routed to knowledge spaces:",
|
|
22
|
+
...summaries,
|
|
23
|
+
"",
|
|
24
|
+
"TODO: invoke knowledge search service and synthesize response."
|
|
25
|
+
].join(`
|
|
26
|
+
`);
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
selectKnowledgeBindings,
|
|
30
|
+
answerWithKnowledge
|
|
31
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// src/blueprint.ts
|
|
2
|
+
import {
|
|
3
|
+
OwnersEnum,
|
|
4
|
+
StabilityEnum,
|
|
5
|
+
TagsEnum
|
|
6
|
+
} from "@contractspec/lib.contracts/ownership";
|
|
7
|
+
var artisanKnowledgeBlueprint = {
|
|
8
|
+
meta: {
|
|
9
|
+
key: "artisan.knowledge.product",
|
|
10
|
+
version: "1.0.0",
|
|
11
|
+
appId: "artisan",
|
|
12
|
+
title: "ArtisanOS Knowledge – Product Canon",
|
|
13
|
+
description: "Blueprint that surfaces canonical product knowledge to agents and workflows.",
|
|
14
|
+
domain: "knowledge",
|
|
15
|
+
owners: [OwnersEnum.PlatformContent],
|
|
16
|
+
tags: ["knowledge", "product-canon", TagsEnum.Guide],
|
|
17
|
+
stability: StabilityEnum.Experimental
|
|
18
|
+
},
|
|
19
|
+
workflows: {
|
|
20
|
+
answerFaq: { key: "artisan.knowledge.answerFaq", version: "1.0.0" }
|
|
21
|
+
},
|
|
22
|
+
notes: "Workflows and assistants running on this blueprint should bind the Product Canon knowledge space."
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
artisanKnowledgeBlueprint
|
|
26
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// src/docs/knowledge-canon.docblock.ts
|
|
2
|
+
import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
|
|
3
|
+
var blocks = [
|
|
4
|
+
{
|
|
5
|
+
id: "docs.examples.knowledge-canon",
|
|
6
|
+
title: "Knowledge Example — Product 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: ["knowledge", "canon", "example"],
|
|
12
|
+
body: `## Included assets
|
|
13
|
+
- Blueprint referencing a workflow depending on the Product Canon space.
|
|
14
|
+
- Tenant app config binding the space to a workflow and agent scope.
|
|
15
|
+
- Sample knowledge source configuration.
|
|
16
|
+
- Helper to pick knowledge bindings from ResolvedAppConfig.
|
|
17
|
+
|
|
18
|
+
## Guardrails
|
|
19
|
+
- Keep sources scoped per tenant.
|
|
20
|
+
- Keep secret fields out of config (use secret providers).
|
|
21
|
+
- Enforce scope restrictions before answering.`
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "docs.examples.knowledge-canon.usage",
|
|
25
|
+
title: "Knowledge Canon — Usage",
|
|
26
|
+
summary: "How to register the space, configure sources, and route requests.",
|
|
27
|
+
kind: "usage",
|
|
28
|
+
visibility: "public",
|
|
29
|
+
route: "/docs/examples/knowledge-canon/usage",
|
|
30
|
+
tags: ["knowledge", "usage"],
|
|
31
|
+
body: `## Usage
|
|
32
|
+
1) Register the knowledge space spec in your KnowledgeSpaceRegistry.
|
|
33
|
+
2) Persist the source config through knowledge CRUD operations.
|
|
34
|
+
3) Compose ResolvedAppConfig and pass it to your workflow/agent runtime.
|
|
35
|
+
4) Use helpers like \`selectKnowledgeBindings\` before dispatching to search/embedding.
|
|
36
|
+
|
|
37
|
+
## Notes
|
|
38
|
+
- Avoid logging PII.
|
|
39
|
+
- Keep search results auditable and cite sources.`
|
|
40
|
+
}
|
|
41
|
+
];
|
|
42
|
+
registerDocBlocks(blocks);
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// src/docs/knowledge-canon.docblock.ts
|
|
2
|
+
import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
|
|
3
|
+
var blocks = [
|
|
4
|
+
{
|
|
5
|
+
id: "docs.examples.knowledge-canon",
|
|
6
|
+
title: "Knowledge Example — Product 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: ["knowledge", "canon", "example"],
|
|
12
|
+
body: `## Included assets
|
|
13
|
+
- Blueprint referencing a workflow depending on the Product Canon space.
|
|
14
|
+
- Tenant app config binding the space to a workflow and agent scope.
|
|
15
|
+
- Sample knowledge source configuration.
|
|
16
|
+
- Helper to pick knowledge bindings from ResolvedAppConfig.
|
|
17
|
+
|
|
18
|
+
## Guardrails
|
|
19
|
+
- Keep sources scoped per tenant.
|
|
20
|
+
- Keep secret fields out of config (use secret providers).
|
|
21
|
+
- Enforce scope restrictions before answering.`
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "docs.examples.knowledge-canon.usage",
|
|
25
|
+
title: "Knowledge Canon — Usage",
|
|
26
|
+
summary: "How to register the space, configure sources, and route requests.",
|
|
27
|
+
kind: "usage",
|
|
28
|
+
visibility: "public",
|
|
29
|
+
route: "/docs/examples/knowledge-canon/usage",
|
|
30
|
+
tags: ["knowledge", "usage"],
|
|
31
|
+
body: `## Usage
|
|
32
|
+
1) Register the knowledge space spec in your KnowledgeSpaceRegistry.
|
|
33
|
+
2) Persist the source config through knowledge CRUD operations.
|
|
34
|
+
3) Compose ResolvedAppConfig and pass it to your workflow/agent runtime.
|
|
35
|
+
4) Use helpers like \`selectKnowledgeBindings\` before dispatching to search/embedding.
|
|
36
|
+
|
|
37
|
+
## Notes
|
|
38
|
+
- Avoid logging PII.
|
|
39
|
+
- Keep search results auditable and cite sources.`
|
|
40
|
+
}
|
|
41
|
+
];
|
|
42
|
+
registerDocBlocks(blocks);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// src/example.ts
|
|
2
|
+
import { defineExample } from "@contractspec/lib.contracts";
|
|
3
|
+
var example = defineExample({
|
|
4
|
+
meta: {
|
|
5
|
+
key: "knowledge-canon",
|
|
6
|
+
version: "1.0.0",
|
|
7
|
+
title: "Knowledge Canon (Product Canon space)",
|
|
8
|
+
description: "Bind a canonical knowledge space to a tenant and route assistant/workflow requests to the right sources (blueprint + app config pattern).",
|
|
9
|
+
kind: "knowledge",
|
|
10
|
+
visibility: "public",
|
|
11
|
+
stability: "experimental",
|
|
12
|
+
owners: ["@platform.core"],
|
|
13
|
+
tags: ["knowledge", "canon", "app-config", "agents", "workflows"]
|
|
14
|
+
},
|
|
15
|
+
docs: {
|
|
16
|
+
rootDocId: "docs.examples.knowledge-canon",
|
|
17
|
+
usageDocId: "docs.examples.knowledge-canon.usage"
|
|
18
|
+
},
|
|
19
|
+
entrypoints: {
|
|
20
|
+
packageName: "@contractspec/example.knowledge-canon",
|
|
21
|
+
docs: "./docs"
|
|
22
|
+
},
|
|
23
|
+
surfaces: {
|
|
24
|
+
templates: true,
|
|
25
|
+
sandbox: { enabled: true, modes: ["markdown", "specs"] },
|
|
26
|
+
studio: { enabled: true, installable: true },
|
|
27
|
+
mcp: { enabled: true }
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var example_default = example;
|
|
31
|
+
export {
|
|
32
|
+
example_default as default
|
|
33
|
+
};
|