@contractspec/example.knowledge-canon 1.44.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$colon$bundle.log +37 -0
- package/.turbo/turbo-build.log +38 -0
- package/CHANGELOG.md +161 -0
- package/LICENSE +21 -0
- package/README.md +27 -0
- package/dist/agent.d.ts +25 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +35 -0
- package/dist/agent.js.map +1 -0
- package/dist/blueprint.d.ts +7 -0
- package/dist/blueprint.d.ts.map +1 -0
- package/dist/blueprint.js +29 -0
- package/dist/blueprint.js.map +1 -0
- package/dist/docs/index.d.ts +1 -0
- package/dist/docs/index.js +1 -0
- package/dist/docs/knowledge-canon.docblock.d.ts +1 -0
- package/dist/docs/knowledge-canon.docblock.js +29 -0
- package/dist/docs/knowledge-canon.docblock.js.map +1 -0
- package/dist/example.d.ts +34 -0
- package/dist/example.d.ts.map +1 -0
- package/dist/example.js +40 -0
- package/dist/example.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +8 -0
- package/dist/source.sample.d.ts +7 -0
- package/dist/source.sample.d.ts.map +1 -0
- package/dist/source.sample.js +30 -0
- package/dist/source.sample.js.map +1 -0
- package/dist/tenant.d.ts +7 -0
- package/dist/tenant.d.ts.map +1 -0
- package/dist/tenant.js +33 -0
- package/dist/tenant.js.map +1 -0
- package/package.json +65 -0
- package/src/agent.ts +47 -0
- package/src/blueprint.ts +26 -0
- package/src/docs/index.ts +1 -0
- package/src/docs/knowledge-canon.docblock.ts +29 -0
- package/src/example.ts +25 -0
- package/src/index.ts +6 -0
- package/src/source.sample.ts +27 -0
- package/src/tenant.ts +32 -0
- package/tsconfig.json +11 -0
- package/tsdown.config.js +6 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
$ tsdown
|
|
2
|
+
[34mℹ[39m tsdown [2mv0.18.3[22m powered by rolldown [2mv1.0.0-beta.57[22m
|
|
3
|
+
[34mℹ[39m config file: [4m/home/runner/work/contractspec/contractspec/packages/examples/knowledge-canon/tsdown.config.js[24m
|
|
4
|
+
[34mℹ[39m entry: [34msrc/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[39m
|
|
5
|
+
[34mℹ[39m target: [34mesnext[39m
|
|
6
|
+
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
7
|
+
[34mℹ[39m Build start
|
|
8
|
+
[34mℹ[39m Cleaning 28 files
|
|
9
|
+
[34mℹ[39m [2mdist/[22m[1mdocs/knowledge-canon.docblock.js[22m [2m1.68 kB[22m [2m│ gzip: 0.79 kB[22m
|
|
10
|
+
[34mℹ[39m [2mdist/[22m[1magent.js[22m [2m1.25 kB[22m [2m│ gzip: 0.62 kB[22m
|
|
11
|
+
[34mℹ[39m [2mdist/[22m[1mexample.js[22m [2m0.90 kB[22m [2m│ gzip: 0.48 kB[22m
|
|
12
|
+
[34mℹ[39m [2mdist/[22m[1mblueprint.js[22m [2m0.84 kB[22m [2m│ gzip: 0.46 kB[22m
|
|
13
|
+
[34mℹ[39m [2mdist/[22m[1mtenant.js[22m [2m0.80 kB[22m [2m│ gzip: 0.44 kB[22m
|
|
14
|
+
[34mℹ[39m [2mdist/[22m[1msource.sample.js[22m [2m0.69 kB[22m [2m│ gzip: 0.40 kB[22m
|
|
15
|
+
[34mℹ[39m [2mdist/[22m[1mindex.js[22m [2m0.50 kB[22m [2m│ gzip: 0.21 kB[22m
|
|
16
|
+
[34mℹ[39m [2mdist/[22m[1mdocs/index.js[22m [2m0.04 kB[22m [2m│ gzip: 0.06 kB[22m
|
|
17
|
+
[34mℹ[39m [2mdist/[22mdocs/knowledge-canon.docblock.js.map [2m2.18 kB[22m [2m│ gzip: 0.97 kB[22m
|
|
18
|
+
[34mℹ[39m [2mdist/[22magent.js.map [2m2.13 kB[22m [2m│ gzip: 1.00 kB[22m
|
|
19
|
+
[34mℹ[39m [2mdist/[22mtenant.js.map [2m1.39 kB[22m [2m│ gzip: 0.68 kB[22m
|
|
20
|
+
[34mℹ[39m [2mdist/[22mblueprint.js.map [2m1.30 kB[22m [2m│ gzip: 0.64 kB[22m
|
|
21
|
+
[34mℹ[39m [2mdist/[22mexample.js.map [2m1.26 kB[22m [2m│ gzip: 0.65 kB[22m
|
|
22
|
+
[34mℹ[39m [2mdist/[22msource.sample.js.map [2m1.18 kB[22m [2m│ gzip: 0.58 kB[22m
|
|
23
|
+
[34mℹ[39m [2mdist/[22magent.d.ts.map [2m0.29 kB[22m [2m│ gzip: 0.20 kB[22m
|
|
24
|
+
[34mℹ[39m [2mdist/[22mexample.d.ts.map [2m0.14 kB[22m [2m│ gzip: 0.13 kB[22m
|
|
25
|
+
[34mℹ[39m [2mdist/[22msource.sample.d.ts.map [2m0.14 kB[22m [2m│ gzip: 0.12 kB[22m
|
|
26
|
+
[34mℹ[39m [2mdist/[22mblueprint.d.ts.map [2m0.13 kB[22m [2m│ gzip: 0.12 kB[22m
|
|
27
|
+
[34mℹ[39m [2mdist/[22mtenant.d.ts.map [2m0.12 kB[22m [2m│ gzip: 0.12 kB[22m
|
|
28
|
+
[34mℹ[39m [2mdist/[22m[32m[1mexample.d.ts[22m[39m [2m1.14 kB[22m [2m│ gzip: 0.48 kB[22m
|
|
29
|
+
[34mℹ[39m [2mdist/[22m[32m[1magent.d.ts[22m[39m [2m0.97 kB[22m [2m│ gzip: 0.44 kB[22m
|
|
30
|
+
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.ts[22m[39m [2m0.44 kB[22m [2m│ gzip: 0.19 kB[22m
|
|
31
|
+
[34mℹ[39m [2mdist/[22m[32m[1msource.sample.d.ts[22m[39m [2m0.28 kB[22m [2m│ gzip: 0.18 kB[22m
|
|
32
|
+
[34mℹ[39m [2mdist/[22m[32m[1mblueprint.d.ts[22m[39m [2m0.26 kB[22m [2m│ gzip: 0.18 kB[22m
|
|
33
|
+
[34mℹ[39m [2mdist/[22m[32m[1mtenant.d.ts[22m[39m [2m0.26 kB[22m [2m│ gzip: 0.18 kB[22m
|
|
34
|
+
[34mℹ[39m [2mdist/[22m[32m[1mdocs/index.d.ts[22m[39m [2m0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
35
|
+
[34mℹ[39m [2mdist/[22m[32m[1mdocs/knowledge-canon.docblock.d.ts[22m[39m [2m0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
36
|
+
[34mℹ[39m 27 files, total: 20.33 kB
|
|
37
|
+
[32m✔[39m Build complete in [32m15599ms[39m
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
$ bun build:types && bun build:bundle
|
|
2
|
+
$ tsc --noEmit
|
|
3
|
+
$ tsdown
|
|
4
|
+
[34mℹ[39m tsdown [2mv0.18.3[22m powered by rolldown [2mv1.0.0-beta.57[22m
|
|
5
|
+
[34mℹ[39m config file: [4m/home/runner/work/contractspec/contractspec/packages/examples/knowledge-canon/tsdown.config.js[24m
|
|
6
|
+
[34mℹ[39m entry: [34msrc/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[39m
|
|
7
|
+
[34mℹ[39m target: [34mesnext[39m
|
|
8
|
+
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
9
|
+
[34mℹ[39m Build start
|
|
10
|
+
[34mℹ[39m [2mdist/[22m[1mdocs/knowledge-canon.docblock.js[22m [2m1.68 kB[22m [2m│ gzip: 0.79 kB[22m
|
|
11
|
+
[34mℹ[39m [2mdist/[22m[1magent.js[22m [2m1.25 kB[22m [2m│ gzip: 0.62 kB[22m
|
|
12
|
+
[34mℹ[39m [2mdist/[22m[1mexample.js[22m [2m0.90 kB[22m [2m│ gzip: 0.48 kB[22m
|
|
13
|
+
[34mℹ[39m [2mdist/[22m[1mblueprint.js[22m [2m0.84 kB[22m [2m│ gzip: 0.46 kB[22m
|
|
14
|
+
[34mℹ[39m [2mdist/[22m[1mtenant.js[22m [2m0.80 kB[22m [2m│ gzip: 0.44 kB[22m
|
|
15
|
+
[34mℹ[39m [2mdist/[22m[1msource.sample.js[22m [2m0.69 kB[22m [2m│ gzip: 0.40 kB[22m
|
|
16
|
+
[34mℹ[39m [2mdist/[22m[1mindex.js[22m [2m0.50 kB[22m [2m│ gzip: 0.21 kB[22m
|
|
17
|
+
[34mℹ[39m [2mdist/[22m[1mdocs/index.js[22m [2m0.04 kB[22m [2m│ gzip: 0.06 kB[22m
|
|
18
|
+
[34mℹ[39m [2mdist/[22mdocs/knowledge-canon.docblock.js.map [2m2.18 kB[22m [2m│ gzip: 0.97 kB[22m
|
|
19
|
+
[34mℹ[39m [2mdist/[22magent.js.map [2m2.13 kB[22m [2m│ gzip: 1.00 kB[22m
|
|
20
|
+
[34mℹ[39m [2mdist/[22mtenant.js.map [2m1.39 kB[22m [2m│ gzip: 0.68 kB[22m
|
|
21
|
+
[34mℹ[39m [2mdist/[22mblueprint.js.map [2m1.30 kB[22m [2m│ gzip: 0.64 kB[22m
|
|
22
|
+
[34mℹ[39m [2mdist/[22mexample.js.map [2m1.26 kB[22m [2m│ gzip: 0.65 kB[22m
|
|
23
|
+
[34mℹ[39m [2mdist/[22msource.sample.js.map [2m1.18 kB[22m [2m│ gzip: 0.58 kB[22m
|
|
24
|
+
[34mℹ[39m [2mdist/[22magent.d.ts.map [2m0.29 kB[22m [2m│ gzip: 0.20 kB[22m
|
|
25
|
+
[34mℹ[39m [2mdist/[22mexample.d.ts.map [2m0.14 kB[22m [2m│ gzip: 0.13 kB[22m
|
|
26
|
+
[34mℹ[39m [2mdist/[22msource.sample.d.ts.map [2m0.14 kB[22m [2m│ gzip: 0.12 kB[22m
|
|
27
|
+
[34mℹ[39m [2mdist/[22mblueprint.d.ts.map [2m0.13 kB[22m [2m│ gzip: 0.12 kB[22m
|
|
28
|
+
[34mℹ[39m [2mdist/[22mtenant.d.ts.map [2m0.12 kB[22m [2m│ gzip: 0.12 kB[22m
|
|
29
|
+
[34mℹ[39m [2mdist/[22m[32m[1mexample.d.ts[22m[39m [2m1.14 kB[22m [2m│ gzip: 0.48 kB[22m
|
|
30
|
+
[34mℹ[39m [2mdist/[22m[32m[1magent.d.ts[22m[39m [2m0.97 kB[22m [2m│ gzip: 0.44 kB[22m
|
|
31
|
+
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.ts[22m[39m [2m0.44 kB[22m [2m│ gzip: 0.19 kB[22m
|
|
32
|
+
[34mℹ[39m [2mdist/[22m[32m[1msource.sample.d.ts[22m[39m [2m0.28 kB[22m [2m│ gzip: 0.18 kB[22m
|
|
33
|
+
[34mℹ[39m [2mdist/[22m[32m[1mblueprint.d.ts[22m[39m [2m0.26 kB[22m [2m│ gzip: 0.18 kB[22m
|
|
34
|
+
[34mℹ[39m [2mdist/[22m[32m[1mtenant.d.ts[22m[39m [2m0.26 kB[22m [2m│ gzip: 0.18 kB[22m
|
|
35
|
+
[34mℹ[39m [2mdist/[22m[32m[1mdocs/index.d.ts[22m[39m [2m0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
36
|
+
[34mℹ[39m [2mdist/[22m[32m[1mdocs/knowledge-canon.docblock.d.ts[22m[39m [2m0.01 kB[22m [2m│ gzip: 0.03 kB[22m
|
|
37
|
+
[34mℹ[39m 27 files, total: 20.33 kB
|
|
38
|
+
[32m✔[39m Build complete in [32m17577ms[39m
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# @contractspec/example.knowledge-canon
|
|
2
|
+
|
|
3
|
+
## 1.44.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5f3a868: chore: isolate branding to contractspec.io
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [5f3a868]
|
|
12
|
+
- @contractspec/lib.contracts@1.44.0
|
|
13
|
+
- @contractspec/lib.schema@1.44.0
|
|
14
|
+
|
|
15
|
+
## 1.43.4
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 9216062: fix: cross-platform compatibility
|
|
20
|
+
- Updated dependencies [9216062]
|
|
21
|
+
- @contractspec/lib.contracts@1.43.4
|
|
22
|
+
- @contractspec/lib.schema@1.43.3
|
|
23
|
+
|
|
24
|
+
## 1.43.3
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- 24d9759: improve documentation
|
|
29
|
+
- Updated dependencies [24d9759]
|
|
30
|
+
- @contractspec/lib.contracts@1.43.3
|
|
31
|
+
- @contractspec/lib.schema@1.43.2
|
|
32
|
+
|
|
33
|
+
## 1.43.2
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- e147271: fix: improve stability
|
|
38
|
+
- Updated dependencies [e147271]
|
|
39
|
+
- @contractspec/lib.contracts@1.43.2
|
|
40
|
+
- @contractspec/lib.schema@1.43.1
|
|
41
|
+
|
|
42
|
+
## 1.43.1
|
|
43
|
+
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- Updated dependencies [f28fdad]
|
|
47
|
+
- @contractspec/lib.contracts@1.43.1
|
|
48
|
+
|
|
49
|
+
## 1.43.0
|
|
50
|
+
|
|
51
|
+
### Minor Changes
|
|
52
|
+
|
|
53
|
+
- 042d072: feat: schema declaration using json schema, including zod
|
|
54
|
+
|
|
55
|
+
### Patch Changes
|
|
56
|
+
|
|
57
|
+
- Updated dependencies [042d072]
|
|
58
|
+
- @contractspec/lib.contracts@1.43.0
|
|
59
|
+
- @contractspec/lib.schema@1.43.0
|
|
60
|
+
|
|
61
|
+
## 1.42.10
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- 1e6a0f1: fix: mcp server
|
|
66
|
+
- Updated dependencies [1e6a0f1]
|
|
67
|
+
- @contractspec/lib.contracts@1.42.10
|
|
68
|
+
- @contractspec/lib.schema@1.42.10
|
|
69
|
+
|
|
70
|
+
## 1.42.9
|
|
71
|
+
|
|
72
|
+
### Patch Changes
|
|
73
|
+
|
|
74
|
+
- 9281db7: fix ModelRegistry
|
|
75
|
+
- Updated dependencies [9281db7]
|
|
76
|
+
- @contractspec/lib.contracts@1.42.9
|
|
77
|
+
- @contractspec/lib.schema@1.42.9
|
|
78
|
+
|
|
79
|
+
## 1.42.8
|
|
80
|
+
|
|
81
|
+
### Patch Changes
|
|
82
|
+
|
|
83
|
+
- e07b5ac: fix
|
|
84
|
+
- Updated dependencies [e07b5ac]
|
|
85
|
+
- @contractspec/lib.contracts@1.42.8
|
|
86
|
+
- @contractspec/lib.schema@1.42.8
|
|
87
|
+
|
|
88
|
+
## 1.42.7
|
|
89
|
+
|
|
90
|
+
### Patch Changes
|
|
91
|
+
|
|
92
|
+
- e9b575d: fix release
|
|
93
|
+
- Updated dependencies [e9b575d]
|
|
94
|
+
- @contractspec/lib.contracts@1.42.7
|
|
95
|
+
- @contractspec/lib.schema@1.42.7
|
|
96
|
+
|
|
97
|
+
## 1.42.6
|
|
98
|
+
|
|
99
|
+
### Patch Changes
|
|
100
|
+
|
|
101
|
+
- 1500242: fix tooling
|
|
102
|
+
- Updated dependencies [1500242]
|
|
103
|
+
- @contractspec/lib.contracts@1.42.6
|
|
104
|
+
- @contractspec/lib.schema@1.42.6
|
|
105
|
+
|
|
106
|
+
## 1.42.5
|
|
107
|
+
|
|
108
|
+
### Patch Changes
|
|
109
|
+
|
|
110
|
+
- 1299719: fix vscode
|
|
111
|
+
- Updated dependencies [1299719]
|
|
112
|
+
- @contractspec/lib.contracts@1.42.5
|
|
113
|
+
- @contractspec/lib.schema@1.42.5
|
|
114
|
+
|
|
115
|
+
## 1.42.4
|
|
116
|
+
|
|
117
|
+
### Patch Changes
|
|
118
|
+
|
|
119
|
+
- ac28b99: fix: generate from openapi
|
|
120
|
+
- Updated dependencies [ac28b99]
|
|
121
|
+
- @contractspec/lib.contracts@1.42.4
|
|
122
|
+
- @contractspec/lib.schema@1.42.4
|
|
123
|
+
|
|
124
|
+
## 1.42.3
|
|
125
|
+
|
|
126
|
+
### Patch Changes
|
|
127
|
+
|
|
128
|
+
- 3f5d015: fix(tooling): cicd
|
|
129
|
+
- Updated dependencies [3f5d015]
|
|
130
|
+
- @contractspec/lib.contracts@1.42.3
|
|
131
|
+
- @contractspec/lib.schema@1.42.3
|
|
132
|
+
|
|
133
|
+
## 1.42.2
|
|
134
|
+
|
|
135
|
+
### Patch Changes
|
|
136
|
+
|
|
137
|
+
- 1f9ac4c: fix
|
|
138
|
+
- Updated dependencies [1f9ac4c]
|
|
139
|
+
- @contractspec/lib.contracts@1.42.2
|
|
140
|
+
- @contractspec/lib.schema@1.42.2
|
|
141
|
+
|
|
142
|
+
## 1.42.1
|
|
143
|
+
|
|
144
|
+
### Patch Changes
|
|
145
|
+
|
|
146
|
+
- f043995: Fix release
|
|
147
|
+
- Updated dependencies [f043995]
|
|
148
|
+
- @contractspec/lib.contracts@1.42.1
|
|
149
|
+
- @contractspec/lib.schema@1.42.1
|
|
150
|
+
|
|
151
|
+
## 1.42.0
|
|
152
|
+
|
|
153
|
+
### Minor Changes
|
|
154
|
+
|
|
155
|
+
- 8eefd9c: initial release
|
|
156
|
+
|
|
157
|
+
### Patch Changes
|
|
158
|
+
|
|
159
|
+
- Updated dependencies [8eefd9c]
|
|
160
|
+
- @contractspec/lib.contracts@1.42.0
|
|
161
|
+
- @contractspec/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
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
### Knowledge Example – Product Canon Space
|
|
2
|
+
|
|
3
|
+
Website: https://contractspec.io/
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
This example demonstrates how to bind the Product Canon `KnowledgeSpaceSpec` to a tenant and surface it to agents/workflows.
|
|
7
|
+
|
|
8
|
+
Included assets:
|
|
9
|
+
|
|
10
|
+
- `blueprint.ts` – `AppBlueprintSpec` that references an FAQ workflow depending on the Product Canon space.
|
|
11
|
+
- `tenant.ts` – `TenantAppConfig` binding the canonical knowledge space to the workflow and a `productSupportAssistant` agent.
|
|
12
|
+
- `source.sample.ts` – illustrative `KnowledgeSourceConfig` for syncing a Notion database into the canonical corpus.
|
|
13
|
+
- `agent.ts` – helper illustrating how to pick knowledge bindings from a `ResolvedAppConfig` at runtime.
|
|
14
|
+
|
|
15
|
+
Usage sketch:
|
|
16
|
+
|
|
17
|
+
1. Register the knowledge space spec (`knowledge.product-canon`) via `KnowledgeSpaceRegistry`.
|
|
18
|
+
2. Persist the Notion source through the knowledge CRUD contracts (`knowledge.source.create`).
|
|
19
|
+
3. Compose the app configuration and pass the `ResolvedAppConfig` to your workflow runner / agent runtime.
|
|
20
|
+
4. Use helpers similar to `selectKnowledgeBindings` to scope which spaces can answer a given request before dispatching to embedding/vector services.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
package/dist/agent.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as _contractspec_lib_contracts_app_config_runtime0 from "@contractspec/lib.contracts/app-config/runtime";
|
|
2
|
+
import { ResolvedAppConfig } from "@contractspec/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
|
+
}): _contractspec_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,+CAAA,CACuB,iBAAA,EAsBhD;;;;;iBAHkB,mBAAA,WACV;;;;;;IAGT"}
|
package/dist/agent.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
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 '@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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AppBlueprintSpec } from "@contractspec/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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { OwnersEnum, StabilityEnum, TagsEnum } from "@contractspec/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 '@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,\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 { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./knowledge-canon.docblock.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { registerDocBlocks } from "@contractspec/lib.contracts/docs";
|
|
2
|
+
|
|
3
|
+
//#region src/docs/knowledge-canon.docblock.ts
|
|
4
|
+
registerDocBlocks([{
|
|
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: [
|
|
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
|
+
}]);
|
|
27
|
+
|
|
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 '@contractspec/lib.contracts/docs';\nimport { registerDocBlocks } from '@contractspec/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: "@contractspec/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
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
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: "@contractspec/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: '@contractspec/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"}
|
package/dist/index.d.ts
ADDED
|
@@ -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
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
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 "@contractspec/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"}
|
|
@@ -0,0 +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,
|
|
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 '@contractspec/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"}
|
package/dist/tenant.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
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 };
|
|
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
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
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 '@contractspec/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"}
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@contractspec/example.knowledge-canon",
|
|
3
|
+
"version": "1.44.0",
|
|
4
|
+
"description": "Knowledge example – Product Canon space (blueprint + tenant config + source sample + runtime helper).",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./dist/index.js",
|
|
10
|
+
"./agent": "./dist/agent.js",
|
|
11
|
+
"./blueprint": "./dist/blueprint.js",
|
|
12
|
+
"./docs": "./dist/docs/index.js",
|
|
13
|
+
"./docs/knowledge-canon.docblock": "./dist/docs/knowledge-canon.docblock.js",
|
|
14
|
+
"./example": "./dist/example.js",
|
|
15
|
+
"./source.sample": "./dist/source.sample.js",
|
|
16
|
+
"./tenant": "./dist/tenant.js",
|
|
17
|
+
"./*": "./*"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
|
|
21
|
+
"publish:pkg:canary": "bun publish:pkg --tag canary",
|
|
22
|
+
"build": "bun build:types && bun build:bundle",
|
|
23
|
+
"build:bundle": "tsdown",
|
|
24
|
+
"build:types": "tsc --noEmit",
|
|
25
|
+
"dev": "bun build:bundle --watch",
|
|
26
|
+
"clean": "rimraf dist .turbo",
|
|
27
|
+
"lint": "bun lint:fix",
|
|
28
|
+
"lint:fix": "eslint src --fix",
|
|
29
|
+
"lint:check": "eslint src",
|
|
30
|
+
"test": "bun test"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@contractspec/lib.schema": "1.44.0",
|
|
34
|
+
"@contractspec/lib.contracts": "1.44.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@contractspec/tool.tsdown": "1.44.0",
|
|
38
|
+
"@contractspec/tool.typescript": "1.44.0",
|
|
39
|
+
"tsdown": "^0.18.3",
|
|
40
|
+
"typescript": "^5.9.3"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public",
|
|
44
|
+
"exports": {
|
|
45
|
+
".": "./dist/index.js",
|
|
46
|
+
"./agent": "./dist/agent.js",
|
|
47
|
+
"./blueprint": "./dist/blueprint.js",
|
|
48
|
+
"./docs": "./dist/docs/index.js",
|
|
49
|
+
"./docs/knowledge-canon.docblock": "./dist/docs/knowledge-canon.docblock.js",
|
|
50
|
+
"./example": "./dist/example.js",
|
|
51
|
+
"./source.sample": "./dist/source.sample.js",
|
|
52
|
+
"./tenant": "./dist/tenant.js",
|
|
53
|
+
"./*": "./*"
|
|
54
|
+
},
|
|
55
|
+
"registry": "https://registry.npmjs.org/"
|
|
56
|
+
},
|
|
57
|
+
"module": "./dist/index.js",
|
|
58
|
+
"license": "MIT",
|
|
59
|
+
"repository": {
|
|
60
|
+
"type": "git",
|
|
61
|
+
"url": "https://github.com/lssm-tech/contractspec.git",
|
|
62
|
+
"directory": "packages/examples/knowledge-canon"
|
|
63
|
+
},
|
|
64
|
+
"homepage": "https://contractspec.io"
|
|
65
|
+
}
|
package/src/agent.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ResolvedAppConfig } from '@contractspec/lib.contracts/app-config/runtime';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Selects knowledge bindings that apply to a workflow or agent identifier.
|
|
5
|
+
*/
|
|
6
|
+
export function selectKnowledgeBindings(
|
|
7
|
+
resolved: ResolvedAppConfig,
|
|
8
|
+
options: { workflowId?: string; agentId?: string }
|
|
9
|
+
) {
|
|
10
|
+
return resolved.knowledge.filter(({ binding }) => {
|
|
11
|
+
if (!binding.scope) return true;
|
|
12
|
+
if (
|
|
13
|
+
options.workflowId &&
|
|
14
|
+
binding.scope.workflows?.includes(options.workflowId)
|
|
15
|
+
)
|
|
16
|
+
return true;
|
|
17
|
+
if (options.agentId && binding.scope.agents?.includes(options.agentId))
|
|
18
|
+
return true;
|
|
19
|
+
return false;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Pseudo implementation of an assistant lookup that routes prompts to the appropriate
|
|
25
|
+
* knowledge sources. In a real system this would call the ingestion/search services.
|
|
26
|
+
*/
|
|
27
|
+
export async function answerWithKnowledge(
|
|
28
|
+
resolved: ResolvedAppConfig,
|
|
29
|
+
question: string,
|
|
30
|
+
{ workflowId, agentId }: { workflowId?: string; agentId?: string }
|
|
31
|
+
): Promise<string> {
|
|
32
|
+
const bindings = selectKnowledgeBindings(resolved, { workflowId, agentId });
|
|
33
|
+
if (bindings.length === 0) {
|
|
34
|
+
return 'No knowledge space available for this request.';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const summaries = bindings.map(
|
|
38
|
+
({ space }) => `• ${space.meta.title || space.meta.description}`
|
|
39
|
+
);
|
|
40
|
+
return [
|
|
41
|
+
`Q: ${question}`,
|
|
42
|
+
'Routed to knowledge spaces:',
|
|
43
|
+
...summaries,
|
|
44
|
+
'',
|
|
45
|
+
'TODO: invoke knowledge search service and synthesize response.',
|
|
46
|
+
].join('\n');
|
|
47
|
+
}
|
package/src/blueprint.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AppBlueprintSpec } from '@contractspec/lib.contracts/app-config/spec';
|
|
2
|
+
import {
|
|
3
|
+
OwnersEnum,
|
|
4
|
+
StabilityEnum,
|
|
5
|
+
TagsEnum,
|
|
6
|
+
} from '@contractspec/lib.contracts/ownership';
|
|
7
|
+
|
|
8
|
+
export const artisanKnowledgeBlueprint: AppBlueprintSpec = {
|
|
9
|
+
meta: {
|
|
10
|
+
key: 'artisan.knowledge.product',
|
|
11
|
+
version: 1,
|
|
12
|
+
appId: 'artisan',
|
|
13
|
+
title: 'ArtisanOS Knowledge – Product Canon',
|
|
14
|
+
description:
|
|
15
|
+
'Blueprint that surfaces canonical product knowledge to agents and workflows.',
|
|
16
|
+
domain: 'knowledge',
|
|
17
|
+
owners: [OwnersEnum.PlatformContent],
|
|
18
|
+
tags: ['knowledge', 'product-canon', TagsEnum.Guide],
|
|
19
|
+
stability: StabilityEnum.Experimental,
|
|
20
|
+
},
|
|
21
|
+
workflows: {
|
|
22
|
+
answerFaq: { key: 'artisan.knowledge.answerFaq', version: 1 },
|
|
23
|
+
},
|
|
24
|
+
notes:
|
|
25
|
+
'Workflows and assistants running on this blueprint should bind the Product Canon knowledge space.',
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './knowledge-canon.docblock';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { DocBlock } from '@contractspec/lib.contracts/docs';
|
|
2
|
+
import { registerDocBlocks } from '@contractspec/lib.contracts/docs';
|
|
3
|
+
|
|
4
|
+
const blocks: DocBlock[] = [
|
|
5
|
+
{
|
|
6
|
+
id: 'docs.examples.knowledge-canon',
|
|
7
|
+
title: 'Knowledge Example — Product Canon Space',
|
|
8
|
+
summary:
|
|
9
|
+
'Bind the Product Canon KnowledgeSpaceSpec to a tenant and expose it to agents/workflows via ResolvedAppConfig.',
|
|
10
|
+
kind: 'reference',
|
|
11
|
+
visibility: 'public',
|
|
12
|
+
route: '/docs/examples/knowledge-canon',
|
|
13
|
+
tags: ['knowledge', 'canon', 'example'],
|
|
14
|
+
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.`,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: 'docs.examples.knowledge-canon.usage',
|
|
18
|
+
title: 'Knowledge Canon — Usage',
|
|
19
|
+
summary:
|
|
20
|
+
'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
|
+
},
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
registerDocBlocks(blocks);
|
package/src/example.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const example = {
|
|
2
|
+
id: 'knowledge-canon',
|
|
3
|
+
title: 'Knowledge Canon (Product Canon space)',
|
|
4
|
+
summary:
|
|
5
|
+
'Bind a canonical knowledge space to a tenant and route assistant/workflow requests to the right sources (blueprint + app config pattern).',
|
|
6
|
+
tags: ['knowledge', 'canon', 'app-config', 'agents', 'workflows'],
|
|
7
|
+
kind: 'knowledge',
|
|
8
|
+
visibility: 'public',
|
|
9
|
+
docs: {
|
|
10
|
+
rootDocId: 'docs.examples.knowledge-canon',
|
|
11
|
+
usageDocId: 'docs.examples.knowledge-canon.usage',
|
|
12
|
+
},
|
|
13
|
+
entrypoints: {
|
|
14
|
+
packageName: '@contractspec/example.knowledge-canon',
|
|
15
|
+
docs: './docs',
|
|
16
|
+
},
|
|
17
|
+
surfaces: {
|
|
18
|
+
templates: true,
|
|
19
|
+
sandbox: { enabled: true, modes: ['markdown', 'specs'] },
|
|
20
|
+
studio: { enabled: true, installable: true },
|
|
21
|
+
mcp: { enabled: true },
|
|
22
|
+
},
|
|
23
|
+
} as const;
|
|
24
|
+
|
|
25
|
+
export default example;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { KnowledgeSourceConfig } from '@contractspec/lib.contracts/knowledge/source';
|
|
2
|
+
|
|
3
|
+
export const productCanonNotionSource: KnowledgeSourceConfig = {
|
|
4
|
+
meta: {
|
|
5
|
+
id: 'source-canon-notion',
|
|
6
|
+
tenantId: 'artisan-co',
|
|
7
|
+
spaceKey: 'knowledge.product-canon',
|
|
8
|
+
spaceVersion: 1,
|
|
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
|
+
};
|
package/src/tenant.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { TenantAppConfig } from '@contractspec/lib.contracts/app-config/spec';
|
|
2
|
+
|
|
3
|
+
export const artisanKnowledgeTenantConfig: TenantAppConfig = {
|
|
4
|
+
meta: {
|
|
5
|
+
id: 'tenant-config-artisan-knowledge',
|
|
6
|
+
tenantId: 'artisan-co',
|
|
7
|
+
appId: 'artisan',
|
|
8
|
+
blueprintName: 'artisan.knowledge.product',
|
|
9
|
+
blueprintVersion: 1,
|
|
10
|
+
environment: 'production',
|
|
11
|
+
version: 1,
|
|
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,
|
|
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
|
+
};
|
package/tsconfig.json
ADDED