@contractspec/example.knowledge-canon 1.57.0 → 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.
Files changed (53) hide show
  1. package/.turbo/turbo-build.log +40 -42
  2. package/.turbo/turbo-prebuild.log +1 -0
  3. package/CHANGELOG.md +12 -0
  4. package/dist/agent.d.ts +8 -16
  5. package/dist/agent.d.ts.map +1 -1
  6. package/dist/agent.js +28 -31
  7. package/dist/blueprint.d.ts +2 -6
  8. package/dist/blueprint.d.ts.map +1 -1
  9. package/dist/blueprint.js +26 -28
  10. package/dist/browser/agent.js +31 -0
  11. package/dist/browser/blueprint.js +26 -0
  12. package/dist/browser/docs/index.js +42 -0
  13. package/dist/browser/docs/knowledge-canon.docblock.js +42 -0
  14. package/dist/browser/example.js +33 -0
  15. package/dist/browser/index.js +191 -0
  16. package/dist/browser/source.sample.js +29 -0
  17. package/dist/browser/tenant.js +34 -0
  18. package/dist/docs/index.d.ts +2 -1
  19. package/dist/docs/index.d.ts.map +1 -0
  20. package/dist/docs/index.js +43 -1
  21. package/dist/docs/knowledge-canon.docblock.d.ts +2 -1
  22. package/dist/docs/knowledge-canon.docblock.d.ts.map +1 -0
  23. package/dist/docs/knowledge-canon.docblock.js +40 -26
  24. package/dist/example.d.ts +2 -6
  25. package/dist/example.d.ts.map +1 -1
  26. package/dist/example.js +32 -44
  27. package/dist/index.d.ts +7 -6
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +192 -8
  30. package/dist/node/agent.js +31 -0
  31. package/dist/node/blueprint.js +26 -0
  32. package/dist/node/docs/index.js +42 -0
  33. package/dist/node/docs/knowledge-canon.docblock.js +42 -0
  34. package/dist/node/example.js +33 -0
  35. package/dist/node/index.js +191 -0
  36. package/dist/node/source.sample.js +29 -0
  37. package/dist/node/tenant.js +34 -0
  38. package/dist/source.sample.d.ts +2 -6
  39. package/dist/source.sample.d.ts.map +1 -1
  40. package/dist/source.sample.js +29 -29
  41. package/dist/tenant.d.ts +2 -6
  42. package/dist/tenant.d.ts.map +1 -1
  43. package/dist/tenant.js +34 -32
  44. package/package.json +84 -29
  45. package/tsdown.config.js +1 -2
  46. package/.turbo/turbo-build$colon$bundle.log +0 -42
  47. package/dist/agent.js.map +0 -1
  48. package/dist/blueprint.js.map +0 -1
  49. package/dist/docs/knowledge-canon.docblock.js.map +0 -1
  50. package/dist/example.js.map +0 -1
  51. package/dist/source.sample.js.map +0 -1
  52. package/dist/tenant.js.map +0 -1
  53. package/tsconfig.tsbuildinfo +0 -1
@@ -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
+ };
@@ -0,0 +1,191 @@
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
+
29
+ // src/blueprint.ts
30
+ import {
31
+ OwnersEnum,
32
+ StabilityEnum,
33
+ TagsEnum
34
+ } from "@contractspec/lib.contracts/ownership";
35
+ var artisanKnowledgeBlueprint = {
36
+ meta: {
37
+ key: "artisan.knowledge.product",
38
+ version: "1.0.0",
39
+ appId: "artisan",
40
+ title: "ArtisanOS Knowledge – Product Canon",
41
+ description: "Blueprint that surfaces canonical product knowledge to agents and workflows.",
42
+ domain: "knowledge",
43
+ owners: [OwnersEnum.PlatformContent],
44
+ tags: ["knowledge", "product-canon", TagsEnum.Guide],
45
+ stability: StabilityEnum.Experimental
46
+ },
47
+ workflows: {
48
+ answerFaq: { key: "artisan.knowledge.answerFaq", version: "1.0.0" }
49
+ },
50
+ notes: "Workflows and assistants running on this blueprint should bind the Product Canon knowledge space."
51
+ };
52
+
53
+ // src/docs/knowledge-canon.docblock.ts
54
+ import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
55
+ var blocks = [
56
+ {
57
+ id: "docs.examples.knowledge-canon",
58
+ title: "Knowledge Example — Product Canon Space",
59
+ summary: "Bind the Product Canon KnowledgeSpaceSpec to a tenant and expose it to agents/workflows via ResolvedAppConfig.",
60
+ kind: "reference",
61
+ visibility: "public",
62
+ route: "/docs/examples/knowledge-canon",
63
+ tags: ["knowledge", "canon", "example"],
64
+ body: `## Included assets
65
+ - Blueprint referencing a workflow depending on the Product Canon space.
66
+ - Tenant app config binding the space to a workflow and agent scope.
67
+ - Sample knowledge source configuration.
68
+ - Helper to pick knowledge bindings from ResolvedAppConfig.
69
+
70
+ ## Guardrails
71
+ - Keep sources scoped per tenant.
72
+ - Keep secret fields out of config (use secret providers).
73
+ - Enforce scope restrictions before answering.`
74
+ },
75
+ {
76
+ id: "docs.examples.knowledge-canon.usage",
77
+ title: "Knowledge Canon — Usage",
78
+ summary: "How to register the space, configure sources, and route requests.",
79
+ kind: "usage",
80
+ visibility: "public",
81
+ route: "/docs/examples/knowledge-canon/usage",
82
+ tags: ["knowledge", "usage"],
83
+ body: `## Usage
84
+ 1) Register the knowledge space spec in your KnowledgeSpaceRegistry.
85
+ 2) Persist the source config through knowledge CRUD operations.
86
+ 3) Compose ResolvedAppConfig and pass it to your workflow/agent runtime.
87
+ 4) Use helpers like \`selectKnowledgeBindings\` before dispatching to search/embedding.
88
+
89
+ ## Notes
90
+ - Avoid logging PII.
91
+ - Keep search results auditable and cite sources.`
92
+ }
93
+ ];
94
+ registerDocBlocks(blocks);
95
+ // src/example.ts
96
+ import { defineExample } from "@contractspec/lib.contracts";
97
+ var example = defineExample({
98
+ meta: {
99
+ key: "knowledge-canon",
100
+ version: "1.0.0",
101
+ title: "Knowledge Canon (Product Canon space)",
102
+ description: "Bind a canonical knowledge space to a tenant and route assistant/workflow requests to the right sources (blueprint + app config pattern).",
103
+ kind: "knowledge",
104
+ visibility: "public",
105
+ stability: "experimental",
106
+ owners: ["@platform.core"],
107
+ tags: ["knowledge", "canon", "app-config", "agents", "workflows"]
108
+ },
109
+ docs: {
110
+ rootDocId: "docs.examples.knowledge-canon",
111
+ usageDocId: "docs.examples.knowledge-canon.usage"
112
+ },
113
+ entrypoints: {
114
+ packageName: "@contractspec/example.knowledge-canon",
115
+ docs: "./docs"
116
+ },
117
+ surfaces: {
118
+ templates: true,
119
+ sandbox: { enabled: true, modes: ["markdown", "specs"] },
120
+ studio: { enabled: true, installable: true },
121
+ mcp: { enabled: true }
122
+ }
123
+ });
124
+ var example_default = example;
125
+
126
+ // src/tenant.ts
127
+ var artisanKnowledgeTenantConfig = {
128
+ meta: {
129
+ id: "tenant-config-artisan-knowledge",
130
+ tenantId: "artisan-co",
131
+ appId: "artisan",
132
+ blueprintName: "artisan.knowledge.product",
133
+ blueprintVersion: "1.0.0",
134
+ environment: "production",
135
+ version: "1.0.0",
136
+ status: "published",
137
+ createdAt: "2026-01-01T00:00:00.000Z",
138
+ updatedAt: "2026-01-01T00:00:00.000Z"
139
+ },
140
+ knowledge: [
141
+ {
142
+ spaceKey: "knowledge.product-canon",
143
+ spaceVersion: "1.0.0",
144
+ scope: {
145
+ workflows: ["answerFaq"],
146
+ agents: ["productSupportAssistant"]
147
+ },
148
+ constraints: {
149
+ maxTokensPerQuery: 4096,
150
+ maxQueriesPerMinute: 30
151
+ }
152
+ }
153
+ ],
154
+ integrations: [],
155
+ notes: "Product Canon knowledge space bound for production assistants."
156
+ };
157
+
158
+ // src/source.sample.ts
159
+ var productCanonNotionSource = {
160
+ meta: {
161
+ id: "source-canon-notion",
162
+ tenantId: "artisan-co",
163
+ spaceKey: "knowledge.product-canon",
164
+ spaceVersion: "1.0.0",
165
+ label: "Product Canon (Notion)",
166
+ sourceType: "notion",
167
+ createdAt: "2026-01-01T00:00:00.000Z",
168
+ updatedAt: "2026-01-01T00:00:00.000Z"
169
+ },
170
+ config: {
171
+ notionDatabaseId: "xxxxxxxxxxxxxxxx",
172
+ apiKey: "secret_notion_token"
173
+ },
174
+ syncSchedule: {
175
+ enabled: true,
176
+ cron: "0 * * * *"
177
+ },
178
+ lastSync: {
179
+ timestamp: new Date("2026-01-01T00:00:00.000Z"),
180
+ success: true,
181
+ itemsProcessed: 128
182
+ }
183
+ };
184
+ export {
185
+ selectKnowledgeBindings,
186
+ productCanonNotionSource,
187
+ example_default as example,
188
+ artisanKnowledgeTenantConfig,
189
+ artisanKnowledgeBlueprint,
190
+ answerWithKnowledge
191
+ };
@@ -0,0 +1,29 @@
1
+ // src/source.sample.ts
2
+ var productCanonNotionSource = {
3
+ meta: {
4
+ id: "source-canon-notion",
5
+ tenantId: "artisan-co",
6
+ spaceKey: "knowledge.product-canon",
7
+ spaceVersion: "1.0.0",
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: new Date("2026-01-01T00:00:00.000Z"),
23
+ success: true,
24
+ itemsProcessed: 128
25
+ }
26
+ };
27
+ export {
28
+ productCanonNotionSource
29
+ };
@@ -0,0 +1,34 @@
1
+ // src/tenant.ts
2
+ var artisanKnowledgeTenantConfig = {
3
+ meta: {
4
+ id: "tenant-config-artisan-knowledge",
5
+ tenantId: "artisan-co",
6
+ appId: "artisan",
7
+ blueprintName: "artisan.knowledge.product",
8
+ blueprintVersion: "1.0.0",
9
+ environment: "production",
10
+ version: "1.0.0",
11
+ status: "published",
12
+ createdAt: "2026-01-01T00:00:00.000Z",
13
+ updatedAt: "2026-01-01T00:00:00.000Z"
14
+ },
15
+ knowledge: [
16
+ {
17
+ spaceKey: "knowledge.product-canon",
18
+ spaceVersion: "1.0.0",
19
+ scope: {
20
+ workflows: ["answerFaq"],
21
+ agents: ["productSupportAssistant"]
22
+ },
23
+ constraints: {
24
+ maxTokensPerQuery: 4096,
25
+ maxQueriesPerMinute: 30
26
+ }
27
+ }
28
+ ],
29
+ integrations: [],
30
+ notes: "Product Canon knowledge space bound for production assistants."
31
+ };
32
+ export {
33
+ artisanKnowledgeTenantConfig
34
+ };
@@ -1,7 +1,3 @@
1
- import { KnowledgeSourceConfig } from "@contractspec/lib.contracts/knowledge/source";
2
-
3
- //#region src/source.sample.d.ts
4
- declare const productCanonNotionSource: KnowledgeSourceConfig;
5
- //#endregion
6
- export { productCanonNotionSource };
1
+ import type { KnowledgeSourceConfig } from '@contractspec/lib.contracts/knowledge/source';
2
+ export declare const productCanonNotionSource: KnowledgeSourceConfig;
7
3
  //# sourceMappingURL=source.sample.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"source.sample.d.ts","names":[],"sources":["../src/source.sample.ts"],"mappings":";;;cAEa,wBAAA,EAA0B,qBAAA"}
1
+ {"version":3,"file":"source.sample.d.ts","sourceRoot":"","sources":["../src/source.sample.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAE1F,eAAO,MAAM,wBAAwB,EAAE,qBAwBtC,CAAC"}
@@ -1,30 +1,30 @@
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.0.0",
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
- }
1
+ // @bun
2
+ // src/source.sample.ts
3
+ var productCanonNotionSource = {
4
+ meta: {
5
+ id: "source-canon-notion",
6
+ tenantId: "artisan-co",
7
+ spaceKey: "knowledge.product-canon",
8
+ spaceVersion: "1.0.0",
9
+ label: "Product Canon (Notion)",
10
+ sourceType: "notion",
11
+ createdAt: "2026-01-01T00:00:00.000Z",
12
+ updatedAt: "2026-01-01T00:00:00.000Z"
13
+ },
14
+ config: {
15
+ notionDatabaseId: "xxxxxxxxxxxxxxxx",
16
+ apiKey: "secret_notion_token"
17
+ },
18
+ syncSchedule: {
19
+ enabled: true,
20
+ cron: "0 * * * *"
21
+ },
22
+ lastSync: {
23
+ timestamp: new Date("2026-01-01T00:00:00.000Z"),
24
+ success: true,
25
+ itemsProcessed: 128
26
+ }
27
+ };
28
+ export {
29
+ productCanonNotionSource
26
30
  };
27
-
28
- //#endregion
29
- export { productCanonNotionSource };
30
- //# sourceMappingURL=source.sample.js.map
package/dist/tenant.d.ts CHANGED
@@ -1,7 +1,3 @@
1
- import { TenantAppConfig } from "@contractspec/lib.contracts/app-config/spec";
2
-
3
- //#region src/tenant.d.ts
4
- declare const artisanKnowledgeTenantConfig: TenantAppConfig;
5
- //#endregion
6
- export { artisanKnowledgeTenantConfig };
1
+ import type { TenantAppConfig } from '@contractspec/lib.contracts/app-config/spec';
2
+ export declare const artisanKnowledgeTenantConfig: TenantAppConfig;
7
3
  //# sourceMappingURL=tenant.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tenant.d.ts","names":[],"sources":["../src/tenant.ts"],"mappings":";;;cAEa,4BAAA,EAA8B,eAAA"}
1
+ {"version":3,"file":"tenant.d.ts","sourceRoot":"","sources":["../src/tenant.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAC;AAEnF,eAAO,MAAM,4BAA4B,EAAE,eA6B1C,CAAC"}
package/dist/tenant.js CHANGED
@@ -1,33 +1,35 @@
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.0.0",
9
- environment: "production",
10
- version: "1.0.0",
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.0.0",
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."
1
+ // @bun
2
+ // src/tenant.ts
3
+ var artisanKnowledgeTenantConfig = {
4
+ meta: {
5
+ id: "tenant-config-artisan-knowledge",
6
+ tenantId: "artisan-co",
7
+ appId: "artisan",
8
+ blueprintName: "artisan.knowledge.product",
9
+ blueprintVersion: "1.0.0",
10
+ environment: "production",
11
+ version: "1.0.0",
12
+ status: "published",
13
+ createdAt: "2026-01-01T00:00:00.000Z",
14
+ updatedAt: "2026-01-01T00:00:00.000Z"
15
+ },
16
+ knowledge: [
17
+ {
18
+ spaceKey: "knowledge.product-canon",
19
+ spaceVersion: "1.0.0",
20
+ scope: {
21
+ workflows: ["answerFaq"],
22
+ agents: ["productSupportAssistant"]
23
+ },
24
+ constraints: {
25
+ maxTokensPerQuery: 4096,
26
+ maxQueriesPerMinute: 30
27
+ }
28
+ }
29
+ ],
30
+ integrations: [],
31
+ notes: "Product Canon knowledge space bound for production assistants."
32
+ };
33
+ export {
34
+ artisanKnowledgeTenantConfig
29
35
  };
30
-
31
- //#endregion
32
- export { artisanKnowledgeTenantConfig };
33
- //# sourceMappingURL=tenant.js.map
package/package.json CHANGED
@@ -1,54 +1,109 @@
1
1
  {
2
2
  "name": "@contractspec/example.knowledge-canon",
3
- "version": "1.57.0",
3
+ "version": "1.58.0",
4
4
  "description": "Knowledge example – Product Canon space (blueprint + tenant config + source sample + runtime helper).",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
7
7
  "exports": {
8
- ".": "./dist/index.js",
9
- "./agent": "./dist/agent.js",
10
- "./blueprint": "./dist/blueprint.js",
11
- "./docs": "./dist/docs/index.js",
12
- "./docs/knowledge-canon.docblock": "./dist/docs/knowledge-canon.docblock.js",
13
- "./example": "./dist/example.js",
14
- "./source.sample": "./dist/source.sample.js",
15
- "./tenant": "./dist/tenant.js",
16
- "./*": "./*"
8
+ ".": "./src/index.ts",
9
+ "./agent": "./src/agent.ts",
10
+ "./blueprint": "./src/blueprint.ts",
11
+ "./docs": "./src/docs/index.ts",
12
+ "./docs/index": "./src/docs/index.ts",
13
+ "./docs/knowledge-canon.docblock": "./src/docs/knowledge-canon.docblock.ts",
14
+ "./example": "./src/example.ts",
15
+ "./source.sample": "./src/source.sample.ts",
16
+ "./tenant": "./src/tenant.ts"
17
17
  },
18
18
  "scripts": {
19
19
  "publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
20
20
  "publish:pkg:canary": "bun publish:pkg --tag canary",
21
- "build": "bun build:types && bun build:bundle",
22
- "build:bundle": "tsdown",
23
- "build:types": "tsc --noEmit",
24
- "dev": "bun build:bundle --watch",
21
+ "build": "bun run prebuild && bun run build:bundle && bun run build:types",
22
+ "build:bundle": "contractspec-bun-build transpile",
23
+ "build:types": "contractspec-bun-build types",
24
+ "dev": "contractspec-bun-build dev",
25
25
  "clean": "rimraf dist .turbo",
26
26
  "lint": "bun lint:fix",
27
27
  "lint:fix": "eslint src --fix",
28
28
  "lint:check": "eslint src",
29
- "test": "bun test"
29
+ "test": "bun test",
30
+ "prebuild": "contractspec-bun-build prebuild",
31
+ "typecheck": "tsc --noEmit"
30
32
  },
31
33
  "dependencies": {
32
- "@contractspec/lib.contracts": "1.57.0"
34
+ "@contractspec/lib.contracts": "1.58.0"
33
35
  },
34
36
  "devDependencies": {
35
- "@contractspec/tool.tsdown": "1.57.0",
36
- "@contractspec/tool.typescript": "1.57.0",
37
- "tsdown": "^0.20.3",
38
- "typescript": "^5.9.3"
37
+ "@contractspec/tool.typescript": "1.58.0",
38
+ "typescript": "^5.9.3",
39
+ "@contractspec/tool.bun": "1.57.0"
39
40
  },
40
41
  "publishConfig": {
41
42
  "access": "public",
42
43
  "exports": {
43
- ".": "./dist/index.js",
44
- "./agent": "./dist/agent.js",
45
- "./blueprint": "./dist/blueprint.js",
46
- "./docs": "./dist/docs/index.js",
47
- "./docs/knowledge-canon.docblock": "./dist/docs/knowledge-canon.docblock.js",
48
- "./example": "./dist/example.js",
49
- "./source.sample": "./dist/source.sample.js",
50
- "./tenant": "./dist/tenant.js",
51
- "./*": "./*"
44
+ ".": {
45
+ "types": "./dist/index.d.ts",
46
+ "bun": "./dist/index.js",
47
+ "node": "./dist/node/index.mjs",
48
+ "browser": "./dist/browser/index.js",
49
+ "default": "./dist/index.js"
50
+ },
51
+ "./agent": {
52
+ "types": "./dist/agent.d.ts",
53
+ "bun": "./dist/agent.js",
54
+ "node": "./dist/node/agent.mjs",
55
+ "browser": "./dist/browser/agent.js",
56
+ "default": "./dist/agent.js"
57
+ },
58
+ "./blueprint": {
59
+ "types": "./dist/blueprint.d.ts",
60
+ "bun": "./dist/blueprint.js",
61
+ "node": "./dist/node/blueprint.mjs",
62
+ "browser": "./dist/browser/blueprint.js",
63
+ "default": "./dist/blueprint.js"
64
+ },
65
+ "./docs": {
66
+ "types": "./dist/docs/index.d.ts",
67
+ "bun": "./dist/docs/index.js",
68
+ "node": "./dist/node/docs/index.mjs",
69
+ "browser": "./dist/browser/docs/index.js",
70
+ "default": "./dist/docs/index.js"
71
+ },
72
+ "./docs/index": {
73
+ "types": "./dist/docs/index.d.ts",
74
+ "bun": "./dist/docs/index.js",
75
+ "node": "./dist/node/docs/index.mjs",
76
+ "browser": "./dist/browser/docs/index.js",
77
+ "default": "./dist/docs/index.js"
78
+ },
79
+ "./docs/knowledge-canon.docblock": {
80
+ "types": "./dist/docs/knowledge-canon.docblock.d.ts",
81
+ "bun": "./dist/docs/knowledge-canon.docblock.js",
82
+ "node": "./dist/node/docs/knowledge-canon.docblock.mjs",
83
+ "browser": "./dist/browser/docs/knowledge-canon.docblock.js",
84
+ "default": "./dist/docs/knowledge-canon.docblock.js"
85
+ },
86
+ "./example": {
87
+ "types": "./dist/example.d.ts",
88
+ "bun": "./dist/example.js",
89
+ "node": "./dist/node/example.mjs",
90
+ "browser": "./dist/browser/example.js",
91
+ "default": "./dist/example.js"
92
+ },
93
+ "./source.sample": {
94
+ "types": "./dist/source.sample.d.ts",
95
+ "bun": "./dist/source.sample.js",
96
+ "node": "./dist/node/source.sample.mjs",
97
+ "browser": "./dist/browser/source.sample.js",
98
+ "default": "./dist/source.sample.js"
99
+ },
100
+ "./tenant": {
101
+ "types": "./dist/tenant.d.ts",
102
+ "bun": "./dist/tenant.js",
103
+ "node": "./dist/node/tenant.mjs",
104
+ "browser": "./dist/browser/tenant.js",
105
+ "default": "./dist/tenant.js"
106
+ }
52
107
  },
53
108
  "registry": "https://registry.npmjs.org/"
54
109
  },
package/tsdown.config.js CHANGED
@@ -1,5 +1,4 @@
1
- import { defineConfig } from 'tsdown';
2
- import { moduleLibrary } from '@contractspec/tool.tsdown';
1
+ import { defineConfig, moduleLibrary } from '@contractspec/tool.bun';
3
2
 
4
3
  export default defineConfig(() => ({
5
4
  ...moduleLibrary,
@@ -1,42 +0,0 @@
1
- $ tsdown
2
- ℹ tsdown v0.20.3 powered by rolldown v1.0.0-rc.3
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.68 kB │ gzip: 0.79 kB
10
- ℹ dist/agent.js 1.25 kB │ gzip: 0.62 kB
11
- ℹ dist/example.js 1.05 kB │ gzip: 0.55 kB
12
- ℹ dist/blueprint.js 0.85 kB │ gzip: 0.46 kB
13
- ℹ dist/tenant.js 0.82 kB │ gzip: 0.45 kB
14
- ℹ dist/source.sample.js 0.70 kB │ gzip: 0.41 kB
15
- ℹ dist/index.js 0.47 kB │ gzip: 0.20 kB
16
- ℹ dist/docs/index.js 0.04 kB │ gzip: 0.06 kB
17
- ℹ dist/docs/knowledge-canon.docblock.js.map 2.18 kB │ gzip: 0.97 kB
18
- ℹ dist/agent.js.map 2.13 kB │ gzip: 1.00 kB
19
- ℹ dist/example.js.map 1.52 kB │ gzip: 0.75 kB
20
- ℹ dist/tenant.js.map 1.35 kB │ gzip: 0.68 kB
21
- ℹ dist/blueprint.js.map 1.26 kB │ gzip: 0.64 kB
22
- ℹ dist/source.sample.js.map 1.14 kB │ gzip: 0.58 kB
23
- ℹ dist/agent.d.ts.map 0.29 kB │ gzip: 0.19 kB
24
- ℹ dist/source.sample.d.ts.map 0.13 kB │ gzip: 0.12 kB
25
- ℹ dist/example.d.ts.map 0.13 kB │ gzip: 0.13 kB
26
- ℹ dist/blueprint.d.ts.map 0.12 kB │ gzip: 0.12 kB
27
- ℹ dist/tenant.d.ts.map 0.11 kB │ gzip: 0.12 kB
28
- ℹ dist/agent.d.ts 0.91 kB │ gzip: 0.44 kB
29
- ℹ dist/index.d.ts 0.44 kB │ gzip: 0.19 kB
30
- ℹ dist/source.sample.d.ts 0.28 kB │ gzip: 0.18 kB
31
- ℹ dist/blueprint.d.ts 0.26 kB │ gzip: 0.18 kB
32
- ℹ dist/tenant.d.ts 0.26 kB │ gzip: 0.18 kB
33
- ℹ dist/example.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: 19.65 kB
37
- [PLUGIN_TIMINGS] Warning: Your build spent significant time in plugins. Here is a breakdown:
38
- - rolldown-plugin-dts:generate (72%)
39
- ✔ Build complete in 20975ms
40
- - tsdown:external (25%)
41
- See https://rolldown.rs/options/checks#plugintimings for more details.
42
-
package/dist/agent.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent.js","names":[],"sources":["../src/agent.ts"],"sourcesContent":["import type { ResolvedAppConfig } from '@contractspec/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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"blueprint.js","names":[],"sources":["../src/blueprint.ts"],"sourcesContent":["import type { AppBlueprintSpec } from '@contractspec/lib.contracts/app-config/spec';\nimport {\n OwnersEnum,\n StabilityEnum,\n TagsEnum,\n} from '@contractspec/lib.contracts/ownership';\n\nexport const artisanKnowledgeBlueprint: AppBlueprintSpec = {\n meta: {\n key: 'artisan.knowledge.product',\n version: '1.0.0',\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.0.0' },\n },\n notes:\n 'Workflows and assistants running on this blueprint should bind the Product Canon knowledge space.',\n};\n"],"mappings":";;;AAOA,MAAa,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;EAAS,EACpE;CACD,OACE;CACH"}