@yolk-sdk/knowledge 0.1.0-canary.58 → 0.1.0-canary.59
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 +29 -2
- package/dist/ingestion.d.mts +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -35,7 +35,9 @@ KnowledgeDocument
|
|
|
35
35
|
- `searchable`: host may expose through search tools.
|
|
36
36
|
- `archived`: retained, normally omitted from prompt and search.
|
|
37
37
|
|
|
38
|
-
Optional files and chunks are modeled as `KnowledgeFile` and `KnowledgeChunk`.
|
|
38
|
+
Optional files and chunks are modeled as `KnowledgeFile` and `KnowledgeChunk`. File records carry
|
|
39
|
+
metadata and host-owned blob keys; `KnowledgeFileBlobStore` stores the bytes separately. Chunks are
|
|
40
|
+
search-index records. Hosts own blob storage, chunk persistence, transactions, and lifecycle.
|
|
39
41
|
|
|
40
42
|
`KnowledgeSource` is a separate ingestion ADT:
|
|
41
43
|
|
|
@@ -60,12 +62,16 @@ These are contracts, not automatic policy. `buildKnowledgeContext` formats exact
|
|
|
60
62
|
you pass; `searchKnowledge` delegates candidate filtering to `SearchIndexStore`. Hosts must select
|
|
61
63
|
ready/pinned documents and exclude processing, error, or archived records as appropriate.
|
|
62
64
|
|
|
65
|
+
`KnowledgeScope` and `KnowledgeSearchScope` are opaque, caller-provided routing metadata. Hosts
|
|
66
|
+
construct and enforce them; the package does not infer identity, tenancy, or permissions from scope
|
|
67
|
+
ids or kinds.
|
|
68
|
+
|
|
63
69
|
## Subpaths
|
|
64
70
|
|
|
65
71
|
| Subpath | Purpose |
|
|
66
72
|
| ----------------------------------- | -------------------------------------------------------------- |
|
|
67
73
|
| `@yolk-sdk/knowledge` | Root context/store/file/error helpers |
|
|
68
|
-
| `@yolk-sdk/knowledge/documents` | Document, file, chunk, status, availability, and scope schemas |
|
|
74
|
+
| `@yolk-sdk/knowledge/documents` | Document, source, file, chunk, status, availability, and scope schemas |
|
|
69
75
|
| `@yolk-sdk/knowledge/files` | File blob-store contract |
|
|
70
76
|
| `@yolk-sdk/knowledge/store` | Document store and search-index store contracts |
|
|
71
77
|
| `@yolk-sdk/knowledge/context` | Pinned context builder |
|
|
@@ -100,6 +106,27 @@ const context = buildKnowledgeContext({
|
|
|
100
106
|
|
|
101
107
|
Add the resulting text to your system prompt. Your app chooses which documents are pinned.
|
|
102
108
|
|
|
109
|
+
## Agent tools
|
|
110
|
+
|
|
111
|
+
`makeKnowledgeLookupTool` creates the read-only `knowledge_lookup` tool with `search` and `get`
|
|
112
|
+
operations. `makeKnowledgeManageTool` creates the write-classified `knowledge_manage` tool with
|
|
113
|
+
`upsert`, `set_availability`, `rename_slug`, and `delete` operations.
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
import { makeKnowledgeLookupTool, makeKnowledgeManageTool } from '@yolk-sdk/knowledge/agent'
|
|
117
|
+
|
|
118
|
+
const lookupTool = makeKnowledgeLookupTool({ search: searchKnowledge, get: getKnowledge })
|
|
119
|
+
const manageTool = makeKnowledgeManageTool({
|
|
120
|
+
upsert: upsertKnowledge,
|
|
121
|
+
setAvailability: setKnowledgeAvailability,
|
|
122
|
+
renameSlug: renameKnowledgeSlug,
|
|
123
|
+
delete: deleteKnowledge
|
|
124
|
+
})
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The callbacks are host adapters and receive the agent tool context. Hosts own authorization,
|
|
128
|
+
storage, scope enforcement, and safe `ToolError` mapping.
|
|
129
|
+
|
|
103
130
|
## Ingestion semantics
|
|
104
131
|
|
|
105
132
|
`ingestKnowledgeDocument` upserts a `processing` index record, extracts, chunks, embeds and
|
package/dist/ingestion.d.mts
CHANGED
|
@@ -39,7 +39,7 @@ declare const ingestKnowledgeDocument: (input: IngestKnowledgeDocumentInput) =>
|
|
|
39
39
|
readonly title?: string | undefined;
|
|
40
40
|
readonly contentHash?: string | undefined;
|
|
41
41
|
readonly chunkCount?: number | undefined;
|
|
42
|
-
}, KnowledgeIngestionError, KnowledgeSummarizer | KnowledgeChunker |
|
|
42
|
+
}, KnowledgeIngestionError, KnowledgeSummarizer | KnowledgeChunker | KnowledgeExtractor | KnowledgeEmbedder | SearchIndexStore>;
|
|
43
43
|
type KnowledgeIngestionPipeline = {
|
|
44
44
|
readonly ingest: (input: IngestKnowledgeDocumentInput) => ReturnType<typeof ingestKnowledgeDocument>;
|
|
45
45
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yolk-sdk/knowledge",
|
|
3
|
-
"version": "0.1.0-canary.
|
|
3
|
+
"version": "0.1.0-canary.59",
|
|
4
4
|
"description": "Domain-free durable knowledge document, file, search, context, and tool contracts for Yolk agents.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"dependencies": {
|
|
107
107
|
"effect": "4.0.0-beta.65",
|
|
108
108
|
"gpt-tokenizer": "^3.4.0",
|
|
109
|
-
"@yolk-sdk/agent": "^0.1.0-canary.
|
|
109
|
+
"@yolk-sdk/agent": "^0.1.0-canary.59"
|
|
110
110
|
},
|
|
111
111
|
"scripts": {
|
|
112
112
|
"build": "tsdown",
|