@yolk-sdk/knowledge 0.1.0-canary.13 → 0.1.0-canary.130
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/README.md +160 -80
- package/dist/agent.d.mts +118 -19
- package/dist/agent.d.mts.map +1 -1
- package/dist/agent.mjs +256 -34
- package/dist/agent.mjs.map +1 -1
- package/dist/chunking.d.mts +13 -16
- package/dist/chunking.d.mts.map +1 -1
- package/dist/chunking.mjs +4 -4
- package/dist/chunking.mjs.map +1 -1
- package/dist/context.d.mts +4 -13
- package/dist/context.d.mts.map +1 -1
- package/dist/context.mjs +17 -13
- package/dist/context.mjs.map +1 -1
- package/dist/documents.d.mts +128 -78
- package/dist/documents.d.mts.map +1 -1
- package/dist/documents.mjs +89 -61
- package/dist/documents.mjs.map +1 -1
- package/dist/embeddings.d.mts +4 -7
- package/dist/embeddings.d.mts.map +1 -1
- package/dist/embeddings.mjs +1 -2
- package/dist/embeddings.mjs.map +1 -1
- package/dist/errors.d.mts +19 -22
- package/dist/errors.d.mts.map +1 -1
- package/dist/errors.mjs +12 -13
- package/dist/errors.mjs.map +1 -1
- package/dist/extraction.d.mts +4 -7
- package/dist/extraction.d.mts.map +1 -1
- package/dist/extraction.mjs +1 -2
- package/dist/extraction.mjs.map +1 -1
- package/dist/files.d.mts +19 -0
- package/dist/files.d.mts.map +1 -0
- package/dist/files.mjs +6 -0
- package/dist/files.mjs.map +1 -0
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +4 -4
- package/dist/ingestion.d.mts +21 -23
- package/dist/ingestion.d.mts.map +1 -1
- package/dist/ingestion.mjs +12 -17
- package/dist/ingestion.mjs.map +1 -1
- package/dist/search.d.mts +13 -17
- package/dist/search.d.mts.map +1 -1
- package/dist/search.mjs +9 -12
- package/dist/search.mjs.map +1 -1
- package/dist/store.d.mts +92 -29
- package/dist/store.d.mts.map +1 -1
- package/dist/store.mjs +3 -3
- package/dist/store.mjs.map +1 -1
- package/dist/summarization.d.mts +6 -9
- package/dist/summarization.d.mts.map +1 -1
- package/dist/summarization.mjs +1 -2
- package/dist/summarization.mjs.map +1 -1
- package/package.json +11 -41
- package/src/agent.ts +393 -65
- package/src/chunking.ts +27 -8
- package/src/context.ts +21 -16
- package/src/documents.ts +140 -71
- package/src/errors.ts +4 -4
- package/src/extraction.ts +4 -3
- package/src/files.ts +24 -0
- package/src/index.ts +6 -3
- package/src/ingestion.ts +46 -27
- package/src/search.ts +90 -62
- package/src/store.ts +139 -25
- package/src/summarization.ts +4 -3
- package/dist/artifacts.d.mts +0 -37
- package/dist/artifacts.d.mts.map +0 -1
- package/dist/artifacts.mjs +0 -28
- package/dist/artifacts.mjs.map +0 -1
- package/dist/links.d.mts +0 -17
- package/dist/links.d.mts.map +0 -1
- package/dist/links.mjs +0 -24
- package/dist/links.mjs.map +0 -1
- package/dist/provenance.d.mts +0 -20
- package/dist/provenance.d.mts.map +0 -1
- package/dist/provenance.mjs +0 -26
- package/dist/provenance.mjs.map +0 -1
- package/dist/records.d.mts +0 -59
- package/dist/records.d.mts.map +0 -1
- package/dist/records.mjs +0 -64
- package/dist/records.mjs.map +0 -1
- package/dist/representations.d.mts +0 -36
- package/dist/representations.d.mts.map +0 -1
- package/dist/representations.mjs +0 -44
- package/dist/representations.mjs.map +0 -1
- package/dist/search-store.d.mts +0 -77
- package/dist/search-store.d.mts.map +0 -1
- package/dist/search-store.mjs +0 -7
- package/dist/search-store.mjs.map +0 -1
- package/dist/vector-store.d.mts +0 -3
- package/dist/vector-store.mjs +0 -2
- package/src/artifacts.ts +0 -48
- package/src/links.ts +0 -23
- package/src/provenance.ts +0 -25
- package/src/records.ts +0 -76
- package/src/representations.ts +0 -51
- package/src/search-store.ts +0 -98
- package/src/vector-store.ts +0 -6
package/src/search.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Effect } from 'effect'
|
|
2
|
-
import type {
|
|
1
|
+
import { Effect, Match } from 'effect'
|
|
2
|
+
import type { IndexedKnowledgeDocument, KnowledgeChunk, KnowledgeSearchScope } from './documents.ts'
|
|
3
3
|
import { KnowledgeEmbedder } from './embeddings.ts'
|
|
4
4
|
import { KnowledgeSearchError } from './errors.ts'
|
|
5
|
-
import { SearchIndexStore } from './
|
|
5
|
+
import { SearchIndexStore } from './store.ts'
|
|
6
6
|
|
|
7
7
|
export type KnowledgeSearchInput = {
|
|
8
8
|
readonly scope: KnowledgeSearchScope
|
|
@@ -26,7 +26,7 @@ export type KnowledgeSearchScores = {
|
|
|
26
26
|
export type KnowledgeSearchResult = {
|
|
27
27
|
readonly chunk: KnowledgeChunk
|
|
28
28
|
readonly score: number
|
|
29
|
-
readonly document:
|
|
29
|
+
readonly document: IndexedKnowledgeDocument
|
|
30
30
|
readonly context?: ReadonlyArray<KnowledgeChunk>
|
|
31
31
|
readonly scores?: KnowledgeSearchScores
|
|
32
32
|
}
|
|
@@ -46,21 +46,22 @@ export type KnowledgeSearcher = {
|
|
|
46
46
|
const packedResultText = (result: KnowledgeSearchResult) =>
|
|
47
47
|
result.context?.map(chunk => chunk.content).join('\n\n') ?? result.chunk.content
|
|
48
48
|
|
|
49
|
-
export const packKnowledgeSearchContext = (
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
49
|
+
export const packKnowledgeSearchContext = (
|
|
50
|
+
query: string,
|
|
51
|
+
results: ReadonlyArray<KnowledgeSearchResult>
|
|
52
|
+
): KnowledgeSearchContext => ({
|
|
53
|
+
query,
|
|
54
|
+
results,
|
|
55
|
+
text: results.map(packedResultText).join('\n\n')
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
const scopeIds = (scope: KnowledgeSearchScope): ReadonlyArray<string> =>
|
|
59
|
+
Match.value(scope).pipe(
|
|
60
|
+
Match.tagsExhaustive({
|
|
61
|
+
KnowledgeScope: ({ id }) => [id],
|
|
62
|
+
KnowledgeScopes: ({ ids }) => ids
|
|
63
|
+
})
|
|
64
|
+
)
|
|
64
65
|
|
|
65
66
|
const defaultHybridCandidateLimit = (limit: number) => Math.max(limit * 5, 40)
|
|
66
67
|
|
|
@@ -73,6 +74,7 @@ export const fuseKnowledgeSearchResults = (input: {
|
|
|
73
74
|
readonly rankConstant?: number
|
|
74
75
|
}): ReadonlyArray<KnowledgeSearchResult> => {
|
|
75
76
|
const rankConstant = input.rankConstant ?? 60
|
|
77
|
+
|
|
76
78
|
const fused = new Map<
|
|
77
79
|
string,
|
|
78
80
|
{
|
|
@@ -116,36 +118,54 @@ const validateSearchInput = (input: KnowledgeSearchInput) => {
|
|
|
116
118
|
const limit = input.limit ?? 10
|
|
117
119
|
const contextChunks = input.contextChunks ?? 0
|
|
118
120
|
const mode = input.mode ?? 'hybrid'
|
|
119
|
-
|
|
121
|
+
|
|
122
|
+
const vectorLimit =
|
|
123
|
+
input.vectorLimit ?? (mode === 'hybrid' ? defaultHybridCandidateLimit(limit) : limit)
|
|
124
|
+
|
|
120
125
|
const textLimit = input.textLimit ?? defaultHybridCandidateLimit(limit)
|
|
121
126
|
|
|
122
127
|
if (query.length === 0) {
|
|
123
|
-
return Effect.fail(
|
|
128
|
+
return Effect.fail(
|
|
129
|
+
new KnowledgeSearchError({ message: 'Search query is empty', stage: 'embed' })
|
|
130
|
+
)
|
|
124
131
|
}
|
|
125
132
|
|
|
126
133
|
if (ids.length === 0) {
|
|
127
|
-
return Effect.fail(
|
|
134
|
+
return Effect.fail(
|
|
135
|
+
new KnowledgeSearchError({ message: 'Search scope is empty', stage: 'store' })
|
|
136
|
+
)
|
|
128
137
|
}
|
|
129
138
|
|
|
130
139
|
if (!Number.isInteger(limit) || limit < 1) {
|
|
131
|
-
return Effect.fail(
|
|
140
|
+
return Effect.fail(
|
|
141
|
+
new KnowledgeSearchError({ message: 'Search limit must be positive', stage: 'store' })
|
|
142
|
+
)
|
|
132
143
|
}
|
|
133
144
|
|
|
134
145
|
if (!Number.isInteger(vectorLimit) || vectorLimit < 1) {
|
|
135
|
-
return Effect.fail(
|
|
146
|
+
return Effect.fail(
|
|
147
|
+
new KnowledgeSearchError({ message: 'Vector search limit must be positive', stage: 'store' })
|
|
148
|
+
)
|
|
136
149
|
}
|
|
137
150
|
|
|
138
151
|
if (!Number.isInteger(textLimit) || textLimit < 1) {
|
|
139
|
-
return Effect.fail(
|
|
152
|
+
return Effect.fail(
|
|
153
|
+
new KnowledgeSearchError({ message: 'Text search limit must be positive', stage: 'store' })
|
|
154
|
+
)
|
|
140
155
|
}
|
|
141
156
|
|
|
142
157
|
if (mode !== 'vector' && mode !== 'hybrid') {
|
|
143
|
-
return Effect.fail(
|
|
158
|
+
return Effect.fail(
|
|
159
|
+
new KnowledgeSearchError({ message: 'Search mode is invalid', stage: 'store' })
|
|
160
|
+
)
|
|
144
161
|
}
|
|
145
162
|
|
|
146
163
|
if (!Number.isInteger(contextChunks) || contextChunks < 0) {
|
|
147
164
|
return Effect.fail(
|
|
148
|
-
new KnowledgeSearchError({
|
|
165
|
+
new KnowledgeSearchError({
|
|
166
|
+
message: 'Context chunks must be zero or positive',
|
|
167
|
+
stage: 'store'
|
|
168
|
+
})
|
|
149
169
|
)
|
|
150
170
|
}
|
|
151
171
|
|
|
@@ -167,11 +187,13 @@ const searchVectorChunks = (input: {
|
|
|
167
187
|
Effect.gen(function* () {
|
|
168
188
|
const store = yield* SearchIndexStore
|
|
169
189
|
const embedder = yield* KnowledgeEmbedder
|
|
190
|
+
|
|
170
191
|
const embedding = yield* embedder
|
|
171
192
|
.embedQuery(input.query)
|
|
172
193
|
.pipe(
|
|
173
194
|
Effect.mapError(
|
|
174
|
-
error =>
|
|
195
|
+
error =>
|
|
196
|
+
new KnowledgeSearchError({ message: error.message, stage: 'embed', cause: error })
|
|
175
197
|
)
|
|
176
198
|
)
|
|
177
199
|
|
|
@@ -184,7 +206,8 @@ const searchVectorChunks = (input: {
|
|
|
184
206
|
})
|
|
185
207
|
.pipe(
|
|
186
208
|
Effect.mapError(
|
|
187
|
-
error =>
|
|
209
|
+
error =>
|
|
210
|
+
new KnowledgeSearchError({ message: error.message, stage: 'store', cause: error })
|
|
188
211
|
)
|
|
189
212
|
)
|
|
190
213
|
})
|
|
@@ -196,11 +219,13 @@ const searchTextChunks = (input: {
|
|
|
196
219
|
}) =>
|
|
197
220
|
Effect.gen(function* () {
|
|
198
221
|
const store = yield* SearchIndexStore
|
|
222
|
+
|
|
199
223
|
return yield* store
|
|
200
224
|
.searchChunksByText({ scope: input.scope, query: input.query, limit: input.limit })
|
|
201
225
|
.pipe(
|
|
202
226
|
Effect.mapError(
|
|
203
|
-
error =>
|
|
227
|
+
error =>
|
|
228
|
+
new KnowledgeSearchError({ message: error.message, stage: 'store', cause: error })
|
|
204
229
|
)
|
|
205
230
|
)
|
|
206
231
|
})
|
|
@@ -216,37 +241,39 @@ export const searchKnowledge = (input: KnowledgeSearchInput) =>
|
|
|
216
241
|
'knowledge_search.scope_count': scopeIds(input.scope).length
|
|
217
242
|
})
|
|
218
243
|
const store = yield* SearchIndexStore
|
|
219
|
-
const results: ReadonlyArray<KnowledgeSearchResult> = valid.mode === 'vector'
|
|
220
|
-
? yield* searchVectorChunks({
|
|
221
|
-
scope: input.scope,
|
|
222
|
-
query: valid.query,
|
|
223
|
-
limit: valid.vectorLimit,
|
|
224
|
-
minScore: input.minScore
|
|
225
|
-
})
|
|
226
|
-
: yield* Effect.gen(function* () {
|
|
227
|
-
const searches = yield* Effect.all(
|
|
228
|
-
{
|
|
229
|
-
vectorResults: searchVectorChunks({
|
|
230
|
-
scope: input.scope,
|
|
231
|
-
query: valid.query,
|
|
232
|
-
limit: valid.vectorLimit,
|
|
233
|
-
minScore: input.minScore
|
|
234
|
-
}),
|
|
235
|
-
textResults: searchTextChunks({
|
|
236
|
-
scope: input.scope,
|
|
237
|
-
query: valid.query,
|
|
238
|
-
limit: valid.textLimit
|
|
239
|
-
})
|
|
240
|
-
},
|
|
241
|
-
{ concurrency: 'unbounded' }
|
|
242
|
-
)
|
|
243
244
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
245
|
+
const results: ReadonlyArray<KnowledgeSearchResult> =
|
|
246
|
+
valid.mode === 'vector'
|
|
247
|
+
? yield* searchVectorChunks({
|
|
248
|
+
scope: input.scope,
|
|
249
|
+
query: valid.query,
|
|
250
|
+
limit: valid.vectorLimit,
|
|
251
|
+
minScore: input.minScore
|
|
252
|
+
})
|
|
253
|
+
: yield* Effect.gen(function* () {
|
|
254
|
+
const searches = yield* Effect.all(
|
|
255
|
+
{
|
|
256
|
+
vectorResults: searchVectorChunks({
|
|
257
|
+
scope: input.scope,
|
|
258
|
+
query: valid.query,
|
|
259
|
+
limit: valid.vectorLimit,
|
|
260
|
+
minScore: input.minScore
|
|
261
|
+
}),
|
|
262
|
+
textResults: searchTextChunks({
|
|
263
|
+
scope: input.scope,
|
|
264
|
+
query: valid.query,
|
|
265
|
+
limit: valid.textLimit
|
|
266
|
+
})
|
|
267
|
+
},
|
|
268
|
+
{ concurrency: 'unbounded' }
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
return fuseKnowledgeSearchResults({
|
|
272
|
+
vectorResults: searches.vectorResults,
|
|
273
|
+
textResults: searches.textResults,
|
|
274
|
+
limit: valid.limit
|
|
275
|
+
})
|
|
276
|
+
})
|
|
250
277
|
|
|
251
278
|
if (valid.contextChunks === 0) {
|
|
252
279
|
return results
|
|
@@ -255,7 +282,7 @@ export const searchKnowledge = (input: KnowledgeSearchInput) =>
|
|
|
255
282
|
return yield* Effect.forEach(results, result =>
|
|
256
283
|
store
|
|
257
284
|
.getContextChunks({
|
|
258
|
-
|
|
285
|
+
scopeId: result.chunk.scopeId,
|
|
259
286
|
documentId: result.chunk.documentId,
|
|
260
287
|
position: result.chunk.position,
|
|
261
288
|
contextChunks: valid.contextChunks
|
|
@@ -263,7 +290,8 @@ export const searchKnowledge = (input: KnowledgeSearchInput) =>
|
|
|
263
290
|
.pipe(
|
|
264
291
|
Effect.map(context => ({ ...result, context })),
|
|
265
292
|
Effect.mapError(
|
|
266
|
-
error =>
|
|
293
|
+
error =>
|
|
294
|
+
new KnowledgeSearchError({ message: error.message, stage: 'store', cause: error })
|
|
267
295
|
)
|
|
268
296
|
)
|
|
269
297
|
)
|
package/src/store.ts
CHANGED
|
@@ -1,29 +1,38 @@
|
|
|
1
1
|
import { Context } from 'effect'
|
|
2
2
|
import type { Effect } from 'effect'
|
|
3
|
-
import type { KnowledgeArtifact } from './artifacts.ts'
|
|
4
|
-
import type { KnowledgeStoreError } from './errors.ts'
|
|
5
|
-
import type { KnowledgeLink } from './links.ts'
|
|
6
3
|
import type {
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
CreateKnowledgeDocumentInput,
|
|
5
|
+
IndexedKnowledgeDocument,
|
|
6
|
+
KnowledgeChunk,
|
|
7
|
+
KnowledgeDocument,
|
|
8
|
+
KnowledgeDocumentId,
|
|
9
|
+
KnowledgeFile,
|
|
9
10
|
KnowledgeScope,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
KnowledgeScopeId,
|
|
12
|
+
KnowledgeSearchScope,
|
|
13
|
+
UpdateKnowledgeDocumentInput
|
|
14
|
+
} from './documents.ts'
|
|
15
|
+
import type { KnowledgeEmbedding } from './embeddings.ts'
|
|
16
|
+
import type { KnowledgeStoreError, SearchIndexStoreError } from './errors.ts'
|
|
14
17
|
|
|
15
|
-
export type
|
|
18
|
+
export type GetKnowledgeDocumentInput = {
|
|
16
19
|
readonly scope: KnowledgeScope
|
|
17
|
-
readonly id:
|
|
20
|
+
readonly id: KnowledgeDocumentId
|
|
18
21
|
}
|
|
19
22
|
|
|
20
|
-
export type
|
|
23
|
+
export type GetKnowledgeDocumentBySlugInput = {
|
|
24
|
+
readonly scope: KnowledgeScope
|
|
25
|
+
readonly slug: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type ListKnowledgeDocumentsInput = {
|
|
21
29
|
readonly scope: KnowledgeScope
|
|
22
30
|
readonly limit: number
|
|
31
|
+
readonly availability?: KnowledgeDocument['availability']
|
|
23
32
|
}
|
|
24
33
|
|
|
25
|
-
export type
|
|
26
|
-
readonly
|
|
34
|
+
export type ListKnowledgeDocumentsResult = {
|
|
35
|
+
readonly documents: ReadonlyArray<KnowledgeDocument>
|
|
27
36
|
}
|
|
28
37
|
|
|
29
38
|
export type ListPinnedKnowledgeInput = {
|
|
@@ -32,22 +41,127 @@ export type ListPinnedKnowledgeInput = {
|
|
|
32
41
|
}
|
|
33
42
|
|
|
34
43
|
export type ListPinnedKnowledgeResult = {
|
|
35
|
-
readonly
|
|
36
|
-
readonly representations: ReadonlyArray<KnowledgeRepresentation>
|
|
44
|
+
readonly documents: ReadonlyArray<KnowledgeDocument>
|
|
37
45
|
}
|
|
38
46
|
|
|
39
47
|
export type KnowledgeStoreApi = {
|
|
40
|
-
readonly
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
readonly
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
readonly
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
readonly createDocument: (
|
|
49
|
+
input: CreateKnowledgeDocumentInput
|
|
50
|
+
) => Effect.Effect<KnowledgeDocument, KnowledgeStoreError>
|
|
51
|
+
readonly updateDocument: (
|
|
52
|
+
input: UpdateKnowledgeDocumentInput
|
|
53
|
+
) => Effect.Effect<KnowledgeDocument, KnowledgeStoreError>
|
|
54
|
+
readonly getDocument: (
|
|
55
|
+
input: GetKnowledgeDocumentInput
|
|
56
|
+
) => Effect.Effect<KnowledgeDocument, KnowledgeStoreError>
|
|
57
|
+
readonly getDocumentBySlug: (
|
|
58
|
+
input: GetKnowledgeDocumentBySlugInput
|
|
59
|
+
) => Effect.Effect<KnowledgeDocument, KnowledgeStoreError>
|
|
60
|
+
readonly listDocuments: (
|
|
61
|
+
input: ListKnowledgeDocumentsInput
|
|
62
|
+
) => Effect.Effect<ListKnowledgeDocumentsResult, KnowledgeStoreError>
|
|
63
|
+
readonly listPinned: (
|
|
64
|
+
input: ListPinnedKnowledgeInput
|
|
65
|
+
) => Effect.Effect<ListPinnedKnowledgeResult, KnowledgeStoreError>
|
|
66
|
+
readonly deleteDocument: (
|
|
67
|
+
input: GetKnowledgeDocumentInput
|
|
68
|
+
) => Effect.Effect<void, KnowledgeStoreError>
|
|
69
|
+
readonly listFiles: (
|
|
70
|
+
input: GetKnowledgeDocumentInput
|
|
71
|
+
) => Effect.Effect<ReadonlyArray<KnowledgeFile>, KnowledgeStoreError>
|
|
49
72
|
}
|
|
50
73
|
|
|
51
74
|
export class KnowledgeStore extends Context.Service<KnowledgeStore, KnowledgeStoreApi>()(
|
|
52
75
|
'@yolk-sdk/knowledge/KnowledgeStore'
|
|
53
76
|
) {}
|
|
77
|
+
|
|
78
|
+
export type UpsertIndexedKnowledgeDocumentInput = {
|
|
79
|
+
readonly document: IndexedKnowledgeDocument
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export type ReplaceKnowledgeDocumentChunksInput = {
|
|
83
|
+
readonly scopeId: KnowledgeScopeId
|
|
84
|
+
readonly documentId: KnowledgeDocumentId
|
|
85
|
+
readonly chunks: ReadonlyArray<{
|
|
86
|
+
readonly chunk: KnowledgeChunk
|
|
87
|
+
readonly embedding: KnowledgeEmbedding
|
|
88
|
+
}>
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export type MarkKnowledgeDocumentReadyInput = {
|
|
92
|
+
readonly scopeId: KnowledgeScopeId
|
|
93
|
+
readonly documentId: KnowledgeDocumentId
|
|
94
|
+
readonly title?: string
|
|
95
|
+
readonly summary?: string
|
|
96
|
+
readonly contentHash?: string
|
|
97
|
+
readonly tokenCount: number
|
|
98
|
+
readonly chunkCount: number
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export type MarkKnowledgeDocumentErrorInput = {
|
|
102
|
+
readonly scopeId: KnowledgeScopeId
|
|
103
|
+
readonly documentId: KnowledgeDocumentId
|
|
104
|
+
readonly message: string
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export type KnowledgeChunkSearchInput = {
|
|
108
|
+
readonly scope: KnowledgeSearchScope
|
|
109
|
+
readonly embedding: KnowledgeEmbedding
|
|
110
|
+
readonly limit: number
|
|
111
|
+
readonly minScore?: number
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export type KnowledgeChunkTextSearchInput = {
|
|
115
|
+
readonly scope: KnowledgeSearchScope
|
|
116
|
+
readonly query: string
|
|
117
|
+
readonly limit: number
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export type KnowledgeChunkSearchResult = {
|
|
121
|
+
readonly chunk: KnowledgeChunk
|
|
122
|
+
readonly score: number
|
|
123
|
+
readonly document: IndexedKnowledgeDocument
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export type KnowledgeSearchContextChunksInput = {
|
|
127
|
+
readonly scopeId: KnowledgeScopeId
|
|
128
|
+
readonly documentId: KnowledgeDocumentId
|
|
129
|
+
readonly position: number
|
|
130
|
+
readonly contextChunks: number
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export type SearchIndexStoreApi = {
|
|
134
|
+
readonly upsertDocument: (
|
|
135
|
+
input: UpsertIndexedKnowledgeDocumentInput
|
|
136
|
+
) => Effect.Effect<IndexedKnowledgeDocument, SearchIndexStoreError>
|
|
137
|
+
readonly markDocumentProcessing: (input: {
|
|
138
|
+
readonly scopeId: KnowledgeScopeId
|
|
139
|
+
readonly documentId: KnowledgeDocumentId
|
|
140
|
+
}) => Effect.Effect<IndexedKnowledgeDocument, SearchIndexStoreError>
|
|
141
|
+
readonly replaceDocumentChunks: (
|
|
142
|
+
input: ReplaceKnowledgeDocumentChunksInput
|
|
143
|
+
) => Effect.Effect<void, SearchIndexStoreError>
|
|
144
|
+
readonly markDocumentReady: (
|
|
145
|
+
input: MarkKnowledgeDocumentReadyInput
|
|
146
|
+
) => Effect.Effect<IndexedKnowledgeDocument, SearchIndexStoreError>
|
|
147
|
+
readonly markDocumentError: (
|
|
148
|
+
input: MarkKnowledgeDocumentErrorInput
|
|
149
|
+
) => Effect.Effect<void, SearchIndexStoreError>
|
|
150
|
+
readonly deleteDocument: (input: {
|
|
151
|
+
readonly scopeId: KnowledgeScopeId
|
|
152
|
+
readonly documentId: KnowledgeDocumentId
|
|
153
|
+
}) => Effect.Effect<void, SearchIndexStoreError>
|
|
154
|
+
readonly searchChunks: (
|
|
155
|
+
input: KnowledgeChunkSearchInput
|
|
156
|
+
) => Effect.Effect<ReadonlyArray<KnowledgeChunkSearchResult>, SearchIndexStoreError>
|
|
157
|
+
readonly searchChunksByText: (
|
|
158
|
+
input: KnowledgeChunkTextSearchInput
|
|
159
|
+
) => Effect.Effect<ReadonlyArray<KnowledgeChunkSearchResult>, SearchIndexStoreError>
|
|
160
|
+
readonly getContextChunks: (
|
|
161
|
+
input: KnowledgeSearchContextChunksInput
|
|
162
|
+
) => Effect.Effect<ReadonlyArray<KnowledgeChunk>, SearchIndexStoreError>
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export class SearchIndexStore extends Context.Service<SearchIndexStore, SearchIndexStoreApi>()(
|
|
166
|
+
'@yolk-sdk/knowledge/SearchIndexStore'
|
|
167
|
+
) {}
|
package/src/summarization.ts
CHANGED
|
@@ -19,9 +19,10 @@ export type KnowledgeSummarizerApi = {
|
|
|
19
19
|
) => Effect.Effect<KnowledgeDocumentSummary, KnowledgeSummarizationError>
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export class KnowledgeSummarizer extends Context.Service<
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
export class KnowledgeSummarizer extends Context.Service<
|
|
23
|
+
KnowledgeSummarizer,
|
|
24
|
+
KnowledgeSummarizerApi
|
|
25
|
+
>()('@yolk-sdk/knowledge/KnowledgeSummarizer') {}
|
|
25
26
|
|
|
26
27
|
export const NoopKnowledgeSummarizerLive = Layer.succeed(KnowledgeSummarizer, {
|
|
27
28
|
summarize: input => Effect.succeed({ title: input.sourceTitle })
|
package/dist/artifacts.d.mts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { KnowledgeArtifactError } from "./errors.mjs";
|
|
2
|
-
import { Context, Effect } from "effect";
|
|
3
|
-
import * as Schema$1 from "effect/Schema";
|
|
4
|
-
|
|
5
|
-
//#region src/artifacts.d.ts
|
|
6
|
-
declare const KnowledgeArtifactKindSchema: Schema$1.Literals<readonly ["original", "extracted_text", "thumbnail", "transcript", "caption", "structured"]>;
|
|
7
|
-
type KnowledgeArtifactKind = Schema$1.Schema.Type<typeof KnowledgeArtifactKindSchema>;
|
|
8
|
-
declare const KnowledgeArtifactSchema: Schema$1.Struct<{
|
|
9
|
-
readonly id: Schema$1.Trimmed;
|
|
10
|
-
readonly recordId: Schema$1.Trimmed;
|
|
11
|
-
readonly kind: Schema$1.Literals<readonly ["original", "extracted_text", "thumbnail", "transcript", "caption", "structured"]>;
|
|
12
|
-
readonly storageKey: Schema$1.Trimmed;
|
|
13
|
-
readonly mediaType: Schema$1.optional<Schema$1.Trimmed>;
|
|
14
|
-
readonly byteSize: Schema$1.optional<Schema$1.Int>;
|
|
15
|
-
readonly checksum: Schema$1.optional<Schema$1.Trimmed>;
|
|
16
|
-
readonly metadata: Schema$1.optional<Schema$1.$Record<Schema$1.String, Schema$1.Unknown>>;
|
|
17
|
-
readonly createdAt: Schema$1.DateTimeUtc;
|
|
18
|
-
}>;
|
|
19
|
-
type KnowledgeArtifact = Schema$1.Schema.Type<typeof KnowledgeArtifactSchema>;
|
|
20
|
-
type PutKnowledgeArtifactInput = {
|
|
21
|
-
readonly storageKey: string;
|
|
22
|
-
readonly mediaType?: string;
|
|
23
|
-
readonly bytes: Uint8Array;
|
|
24
|
-
};
|
|
25
|
-
type GetKnowledgeArtifactInput = {
|
|
26
|
-
readonly storageKey: string;
|
|
27
|
-
};
|
|
28
|
-
type KnowledgeArtifactStoreApi = {
|
|
29
|
-
readonly putArtifact: (input: PutKnowledgeArtifactInput) => Effect.Effect<void, KnowledgeArtifactError>;
|
|
30
|
-
readonly getArtifact: (input: GetKnowledgeArtifactInput) => Effect.Effect<Uint8Array, KnowledgeArtifactError>;
|
|
31
|
-
readonly deleteArtifact: (input: GetKnowledgeArtifactInput) => Effect.Effect<void, KnowledgeArtifactError>;
|
|
32
|
-
};
|
|
33
|
-
declare const KnowledgeArtifactStore_base: Context.ServiceClass<KnowledgeArtifactStore, "@yolk-sdk/knowledge/KnowledgeArtifactStore", KnowledgeArtifactStoreApi>;
|
|
34
|
-
declare class KnowledgeArtifactStore extends KnowledgeArtifactStore_base {}
|
|
35
|
-
//#endregion
|
|
36
|
-
export { GetKnowledgeArtifactInput, KnowledgeArtifact, KnowledgeArtifactKind, KnowledgeArtifactKindSchema, KnowledgeArtifactSchema, KnowledgeArtifactStore, KnowledgeArtifactStoreApi, PutKnowledgeArtifactInput };
|
|
37
|
-
//# sourceMappingURL=artifacts.d.mts.map
|
package/dist/artifacts.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.d.mts","names":[],"sources":["../src/artifacts.ts"],"mappings":";;;;;cAMa,2BAAA,EAA2B,QAAA,CAAA,QAAA;AAAA,KAQ5B,qBAAA,GAAwB,QAAA,CAAO,MAAA,CAAO,IAAI,QAAQ,2BAAA;AAAA,cAEjD,uBAAA,EAAuB,QAAA,CAAA,MAAA;EAAA;;;;;;;;;;KAWxB,iBAAA,GAAoB,QAAA,CAAO,MAAA,CAAO,IAAI,QAAQ,uBAAA;AAAA,KAE9C,yBAAA;EAAA,SACD,UAAA;EAAA,SACA,SAAA;EAAA,SACA,KAAA,EAAO,UAAU;AAAA;AAAA,KAGhB,yBAAA;EAAA,SACD,UAAU;AAAA;AAAA,KAGT,yBAAA;EAAA,SACD,WAAA,GAAc,KAAA,EAAO,yBAAA,KAA8B,MAAA,CAAO,MAAA,OAAa,sBAAA;EAAA,SACvE,WAAA,GAAc,KAAA,EAAO,yBAAA,KAA8B,MAAA,CAAO,MAAA,CAAO,UAAA,EAAY,sBAAA;EAAA,SAC7E,cAAA,GAAiB,KAAA,EAAO,yBAAA,KAA8B,MAAA,CAAO,MAAA,OAAa,sBAAA;AAAA;AAAA,cACpF,2BAAA;cAEY,sBAAA,SAA+B,2BAE3C"}
|
package/dist/artifacts.mjs
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { KnowledgeMetadataSchema, NonEmptyTrimmedString, NonNegativeInteger } from "./records.mjs";
|
|
2
|
-
import { Context } from "effect";
|
|
3
|
-
import * as Schema$1 from "effect/Schema";
|
|
4
|
-
//#region src/artifacts.ts
|
|
5
|
-
const KnowledgeArtifactKindSchema = Schema$1.Literals([
|
|
6
|
-
"original",
|
|
7
|
-
"extracted_text",
|
|
8
|
-
"thumbnail",
|
|
9
|
-
"transcript",
|
|
10
|
-
"caption",
|
|
11
|
-
"structured"
|
|
12
|
-
]);
|
|
13
|
-
const KnowledgeArtifactSchema = Schema$1.Struct({
|
|
14
|
-
id: NonEmptyTrimmedString,
|
|
15
|
-
recordId: NonEmptyTrimmedString,
|
|
16
|
-
kind: KnowledgeArtifactKindSchema,
|
|
17
|
-
storageKey: NonEmptyTrimmedString,
|
|
18
|
-
mediaType: Schema$1.optional(NonEmptyTrimmedString),
|
|
19
|
-
byteSize: Schema$1.optional(NonNegativeInteger),
|
|
20
|
-
checksum: Schema$1.optional(NonEmptyTrimmedString),
|
|
21
|
-
metadata: Schema$1.optional(KnowledgeMetadataSchema),
|
|
22
|
-
createdAt: Schema$1.DateTimeUtc
|
|
23
|
-
});
|
|
24
|
-
var KnowledgeArtifactStore = class extends Context.Service()("@yolk-sdk/knowledge/KnowledgeArtifactStore") {};
|
|
25
|
-
//#endregion
|
|
26
|
-
export { KnowledgeArtifactKindSchema, KnowledgeArtifactSchema, KnowledgeArtifactStore };
|
|
27
|
-
|
|
28
|
-
//# sourceMappingURL=artifacts.mjs.map
|
package/dist/artifacts.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.mjs","names":["Schema"],"sources":["../src/artifacts.ts"],"sourcesContent":["import { Context } from 'effect'\nimport type { Effect } from 'effect'\nimport * as Schema from 'effect/Schema'\nimport type { KnowledgeArtifactError } from './errors.ts'\nimport { KnowledgeMetadataSchema, NonEmptyTrimmedString, NonNegativeInteger } from './records.ts'\n\nexport const KnowledgeArtifactKindSchema = Schema.Literals([\n 'original',\n 'extracted_text',\n 'thumbnail',\n 'transcript',\n 'caption',\n 'structured'\n])\nexport type KnowledgeArtifactKind = Schema.Schema.Type<typeof KnowledgeArtifactKindSchema>\n\nexport const KnowledgeArtifactSchema = Schema.Struct({\n id: NonEmptyTrimmedString,\n recordId: NonEmptyTrimmedString,\n kind: KnowledgeArtifactKindSchema,\n storageKey: NonEmptyTrimmedString,\n mediaType: Schema.optional(NonEmptyTrimmedString),\n byteSize: Schema.optional(NonNegativeInteger),\n checksum: Schema.optional(NonEmptyTrimmedString),\n metadata: Schema.optional(KnowledgeMetadataSchema),\n createdAt: Schema.DateTimeUtc\n})\nexport type KnowledgeArtifact = Schema.Schema.Type<typeof KnowledgeArtifactSchema>\n\nexport type PutKnowledgeArtifactInput = {\n readonly storageKey: string\n readonly mediaType?: string\n readonly bytes: Uint8Array\n}\n\nexport type GetKnowledgeArtifactInput = {\n readonly storageKey: string\n}\n\nexport type KnowledgeArtifactStoreApi = {\n readonly putArtifact: (input: PutKnowledgeArtifactInput) => Effect.Effect<void, KnowledgeArtifactError>\n readonly getArtifact: (input: GetKnowledgeArtifactInput) => Effect.Effect<Uint8Array, KnowledgeArtifactError>\n readonly deleteArtifact: (input: GetKnowledgeArtifactInput) => Effect.Effect<void, KnowledgeArtifactError>\n}\n\nexport class KnowledgeArtifactStore extends Context.Service<KnowledgeArtifactStore, KnowledgeArtifactStoreApi>()(\n '@yolk-sdk/knowledge/KnowledgeArtifactStore'\n) {}\n"],"mappings":";;;;AAMA,MAAa,8BAA8BA,SAAO,SAAS;CACzD;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAGD,MAAa,0BAA0BA,SAAO,OAAO;CACnD,IAAI;CACJ,UAAU;CACV,MAAM;CACN,YAAY;CACZ,WAAWA,SAAO,SAAS,qBAAqB;CAChD,UAAUA,SAAO,SAAS,kBAAkB;CAC5C,UAAUA,SAAO,SAAS,qBAAqB;CAC/C,UAAUA,SAAO,SAAS,uBAAuB;CACjD,WAAWA,SAAO;AACpB,CAAC;AAmBD,IAAa,yBAAb,cAA4C,QAAQ,QAA2D,EAC7G,4CACF,EAAE,CAAC"}
|
package/dist/links.d.mts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as Schema from "effect/Schema";
|
|
2
|
-
|
|
3
|
-
//#region src/links.d.ts
|
|
4
|
-
declare const KnowledgeLinkTypeSchema: Schema.Literals<readonly ["cites", "supports", "contradicts", "supersedes", "mentions", "derived_from", "related_to"]>;
|
|
5
|
-
type KnowledgeLinkType = Schema.Schema.Type<typeof KnowledgeLinkTypeSchema>;
|
|
6
|
-
declare const KnowledgeLinkSchema: Schema.Struct<{
|
|
7
|
-
readonly id: Schema.Trimmed;
|
|
8
|
-
readonly fromRecordId: Schema.Trimmed;
|
|
9
|
-
readonly toRecordId: Schema.Trimmed;
|
|
10
|
-
readonly type: Schema.Literals<readonly ["cites", "supports", "contradicts", "supersedes", "mentions", "derived_from", "related_to"]>;
|
|
11
|
-
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
12
|
-
readonly createdAt: Schema.DateTimeUtc;
|
|
13
|
-
}>;
|
|
14
|
-
type KnowledgeLink = Schema.Schema.Type<typeof KnowledgeLinkSchema>;
|
|
15
|
-
//#endregion
|
|
16
|
-
export { KnowledgeLink, KnowledgeLinkSchema, KnowledgeLinkType, KnowledgeLinkTypeSchema };
|
|
17
|
-
//# sourceMappingURL=links.d.mts.map
|
package/dist/links.d.mts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"links.d.mts","names":[],"sources":["../src/links.ts"],"mappings":";;;cAGa,uBAAA,EAAuB,MAAA,CAAA,QAAA;AAAA,KASxB,iBAAA,GAAoB,MAAA,CAAO,MAAA,CAAO,IAAI,QAAQ,uBAAA;AAAA,cAE7C,mBAAA,EAAmB,MAAA,CAAA,MAAA;EAAA;;;;;;;KAQpB,aAAA,GAAgB,MAAA,CAAO,MAAA,CAAO,IAAI,QAAQ,mBAAA"}
|
package/dist/links.mjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { KnowledgeMetadataSchema, NonEmptyTrimmedString } from "./records.mjs";
|
|
2
|
-
import * as Schema from "effect/Schema";
|
|
3
|
-
//#region src/links.ts
|
|
4
|
-
const KnowledgeLinkTypeSchema = Schema.Literals([
|
|
5
|
-
"cites",
|
|
6
|
-
"supports",
|
|
7
|
-
"contradicts",
|
|
8
|
-
"supersedes",
|
|
9
|
-
"mentions",
|
|
10
|
-
"derived_from",
|
|
11
|
-
"related_to"
|
|
12
|
-
]);
|
|
13
|
-
const KnowledgeLinkSchema = Schema.Struct({
|
|
14
|
-
id: NonEmptyTrimmedString,
|
|
15
|
-
fromRecordId: NonEmptyTrimmedString,
|
|
16
|
-
toRecordId: NonEmptyTrimmedString,
|
|
17
|
-
type: KnowledgeLinkTypeSchema,
|
|
18
|
-
metadata: Schema.optional(KnowledgeMetadataSchema),
|
|
19
|
-
createdAt: Schema.DateTimeUtc
|
|
20
|
-
});
|
|
21
|
-
//#endregion
|
|
22
|
-
export { KnowledgeLinkSchema, KnowledgeLinkTypeSchema };
|
|
23
|
-
|
|
24
|
-
//# sourceMappingURL=links.mjs.map
|
package/dist/links.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"links.mjs","names":[],"sources":["../src/links.ts"],"sourcesContent":["import * as Schema from 'effect/Schema'\nimport { KnowledgeMetadataSchema, NonEmptyTrimmedString } from './records.ts'\n\nexport const KnowledgeLinkTypeSchema = Schema.Literals([\n 'cites',\n 'supports',\n 'contradicts',\n 'supersedes',\n 'mentions',\n 'derived_from',\n 'related_to'\n])\nexport type KnowledgeLinkType = Schema.Schema.Type<typeof KnowledgeLinkTypeSchema>\n\nexport const KnowledgeLinkSchema = Schema.Struct({\n id: NonEmptyTrimmedString,\n fromRecordId: NonEmptyTrimmedString,\n toRecordId: NonEmptyTrimmedString,\n type: KnowledgeLinkTypeSchema,\n metadata: Schema.optional(KnowledgeMetadataSchema),\n createdAt: Schema.DateTimeUtc\n})\nexport type KnowledgeLink = Schema.Schema.Type<typeof KnowledgeLinkSchema>\n"],"mappings":";;;AAGA,MAAa,0BAA0B,OAAO,SAAS;CACrD;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAGD,MAAa,sBAAsB,OAAO,OAAO;CAC/C,IAAI;CACJ,cAAc;CACd,YAAY;CACZ,MAAM;CACN,UAAU,OAAO,SAAS,uBAAuB;CACjD,WAAW,OAAO;AACpB,CAAC"}
|
package/dist/provenance.d.mts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import * as Schema from "effect/Schema";
|
|
2
|
-
|
|
3
|
-
//#region src/provenance.d.ts
|
|
4
|
-
declare const KnowledgeProvenanceSourceKindSchema: Schema.Literals<readonly ["upload", "user_statement", "url", "generated", "imported", "external_api"]>;
|
|
5
|
-
type KnowledgeProvenanceSourceKind = Schema.Schema.Type<typeof KnowledgeProvenanceSourceKindSchema>;
|
|
6
|
-
declare const KnowledgeProvenanceSchema: Schema.Struct<{
|
|
7
|
-
readonly id: Schema.Trimmed;
|
|
8
|
-
readonly recordId: Schema.Trimmed;
|
|
9
|
-
readonly artifactId: Schema.optional<Schema.Trimmed>;
|
|
10
|
-
readonly sourceKind: Schema.Literals<readonly ["upload", "user_statement", "url", "generated", "imported", "external_api"]>;
|
|
11
|
-
readonly sourceLabel: Schema.Trimmed;
|
|
12
|
-
readonly sourceUrl: Schema.optional<Schema.Trimmed>;
|
|
13
|
-
readonly observedAt: Schema.optional<Schema.DateTimeUtc>;
|
|
14
|
-
readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
|
|
15
|
-
readonly createdAt: Schema.DateTimeUtc;
|
|
16
|
-
}>;
|
|
17
|
-
type KnowledgeProvenance = Schema.Schema.Type<typeof KnowledgeProvenanceSchema>;
|
|
18
|
-
//#endregion
|
|
19
|
-
export { KnowledgeProvenance, KnowledgeProvenanceSchema, KnowledgeProvenanceSourceKind, KnowledgeProvenanceSourceKindSchema };
|
|
20
|
-
//# sourceMappingURL=provenance.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"provenance.d.mts","names":[],"sources":["../src/provenance.ts"],"mappings":";;;cAGa,mCAAA,EAAmC,MAAA,CAAA,QAAA;AAAA,KAQpC,6BAAA,GAAgC,MAAA,CAAO,MAAA,CAAO,IAAI,QAAQ,mCAAA;AAAA,cAEzD,yBAAA,EAAyB,MAAA,CAAA,MAAA;EAAA;;;;;;;;;;KAW1B,mBAAA,GAAsB,MAAA,CAAO,MAAA,CAAO,IAAI,QAAQ,yBAAA"}
|
package/dist/provenance.mjs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { KnowledgeMetadataSchema, NonEmptyTrimmedString } from "./records.mjs";
|
|
2
|
-
import * as Schema from "effect/Schema";
|
|
3
|
-
//#region src/provenance.ts
|
|
4
|
-
const KnowledgeProvenanceSourceKindSchema = Schema.Literals([
|
|
5
|
-
"upload",
|
|
6
|
-
"user_statement",
|
|
7
|
-
"url",
|
|
8
|
-
"generated",
|
|
9
|
-
"imported",
|
|
10
|
-
"external_api"
|
|
11
|
-
]);
|
|
12
|
-
const KnowledgeProvenanceSchema = Schema.Struct({
|
|
13
|
-
id: NonEmptyTrimmedString,
|
|
14
|
-
recordId: NonEmptyTrimmedString,
|
|
15
|
-
artifactId: Schema.optional(NonEmptyTrimmedString),
|
|
16
|
-
sourceKind: KnowledgeProvenanceSourceKindSchema,
|
|
17
|
-
sourceLabel: NonEmptyTrimmedString,
|
|
18
|
-
sourceUrl: Schema.optional(NonEmptyTrimmedString),
|
|
19
|
-
observedAt: Schema.optional(Schema.DateTimeUtc),
|
|
20
|
-
metadata: Schema.optional(KnowledgeMetadataSchema),
|
|
21
|
-
createdAt: Schema.DateTimeUtc
|
|
22
|
-
});
|
|
23
|
-
//#endregion
|
|
24
|
-
export { KnowledgeProvenanceSchema, KnowledgeProvenanceSourceKindSchema };
|
|
25
|
-
|
|
26
|
-
//# sourceMappingURL=provenance.mjs.map
|
package/dist/provenance.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"provenance.mjs","names":[],"sources":["../src/provenance.ts"],"sourcesContent":["import * as Schema from 'effect/Schema'\nimport { KnowledgeMetadataSchema, NonEmptyTrimmedString } from './records.ts'\n\nexport const KnowledgeProvenanceSourceKindSchema = Schema.Literals([\n 'upload',\n 'user_statement',\n 'url',\n 'generated',\n 'imported',\n 'external_api'\n])\nexport type KnowledgeProvenanceSourceKind = Schema.Schema.Type<typeof KnowledgeProvenanceSourceKindSchema>\n\nexport const KnowledgeProvenanceSchema = Schema.Struct({\n id: NonEmptyTrimmedString,\n recordId: NonEmptyTrimmedString,\n artifactId: Schema.optional(NonEmptyTrimmedString),\n sourceKind: KnowledgeProvenanceSourceKindSchema,\n sourceLabel: NonEmptyTrimmedString,\n sourceUrl: Schema.optional(NonEmptyTrimmedString),\n observedAt: Schema.optional(Schema.DateTimeUtc),\n metadata: Schema.optional(KnowledgeMetadataSchema),\n createdAt: Schema.DateTimeUtc\n})\nexport type KnowledgeProvenance = Schema.Schema.Type<typeof KnowledgeProvenanceSchema>\n"],"mappings":";;;AAGA,MAAa,sCAAsC,OAAO,SAAS;CACjE;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAGD,MAAa,4BAA4B,OAAO,OAAO;CACrD,IAAI;CACJ,UAAU;CACV,YAAY,OAAO,SAAS,qBAAqB;CACjD,YAAY;CACZ,aAAa;CACb,WAAW,OAAO,SAAS,qBAAqB;CAChD,YAAY,OAAO,SAAS,OAAO,WAAW;CAC9C,UAAU,OAAO,SAAS,uBAAuB;CACjD,WAAW,OAAO;AACpB,CAAC"}
|