@hasna/knowledge 0.2.7 → 0.2.9
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 +35 -1
- package/bin/open-knowledge-mcp.js +624 -5
- package/bin/open-knowledge.js +47 -25
- package/docs/architecture/ai-native-knowledge-base.md +24 -0
- package/package.json +1 -1
- package/src/cli.ts +61 -13
- package/src/manifest-ingest.ts +36 -10
- package/src/mcp.js +25 -0
- package/src/source-ingest.ts +268 -0
- package/src/source-ref.ts +12 -0
- package/src/source-resolver.ts +418 -0
package/README.md
CHANGED
|
@@ -66,9 +66,15 @@ open-knowledge wiki init --scope project
|
|
|
66
66
|
# Ingest an open-files source manifest into the project SQLite catalog
|
|
67
67
|
open-knowledge ingest manifest ./open-files-manifest.jsonl --scope project --json
|
|
68
68
|
|
|
69
|
+
# Ingest one read-only source ref directly
|
|
70
|
+
open-knowledge ingest source file:///absolute/path/to/handbook.md --purpose knowledge_index --scope project --json
|
|
71
|
+
|
|
69
72
|
# Consume open-files change events and invalidate stale source chunks
|
|
70
73
|
open-knowledge reindex outbox ./open-files-outbox.jsonl --scope project --json
|
|
71
74
|
|
|
75
|
+
# Resolve indexed source text and citation evidence through the read-only source boundary
|
|
76
|
+
open-knowledge source resolve open-files://file/f_123/revision/rev_456 --scope project --json
|
|
77
|
+
|
|
72
78
|
# Inspect local safety policy and approvals
|
|
73
79
|
open-knowledge safety status --scope project --json
|
|
74
80
|
```
|
|
@@ -169,14 +175,32 @@ Create starter generated-knowledge artifacts through the artifact store:
|
|
|
169
175
|
`schemas/v1.md`, `indexes/root.md`, `wiki/README.md`, and a dated JSONL log
|
|
170
176
|
partition.
|
|
171
177
|
|
|
178
|
+
### source
|
|
179
|
+
```bash
|
|
180
|
+
open-knowledge source resolve <source-ref> [--purpose knowledge_answer|knowledge_index] [--limit <n>] [--scope project] [--json]
|
|
181
|
+
```
|
|
182
|
+
Resolve an indexed source through the read-only open-files boundary. The result
|
|
183
|
+
returns source metadata, permissions, the selected revision, derived chunk text,
|
|
184
|
+
and citation evidence. It does not expose raw file bytes or storage credentials;
|
|
185
|
+
raw source retrieval remains owned by `open-files`.
|
|
186
|
+
|
|
172
187
|
### ingest
|
|
173
188
|
```bash
|
|
174
189
|
open-knowledge ingest manifest <file|s3://bucket/key> [--scope project] [--json]
|
|
190
|
+
open-knowledge ingest source <source-ref> [--purpose knowledge_index] [--scope project] [--json]
|
|
175
191
|
```
|
|
176
192
|
Import an open-files JSON or JSONL source manifest into `knowledge.db`. This
|
|
177
193
|
upserts sources and source revisions, stores hash/MIME/status/permission
|
|
178
194
|
metadata, and chunks embedded extracted text when the manifest includes it.
|
|
179
195
|
|
|
196
|
+
`ingest source` accepts `open-files://`, `file://`, `s3://`, and `https://`
|
|
197
|
+
refs. It reads source content through a read-only boundary, redacts known
|
|
198
|
+
secrets before storage, records hashes/revisions, and stores only derived chunks
|
|
199
|
+
and citation spans. Web and S3 reads remain opt-in through the safety policy.
|
|
200
|
+
For `open-files://` refs, the source must already be present in the local
|
|
201
|
+
knowledge catalog through a manifest or extracted-text ref until the open-files
|
|
202
|
+
resolver API lands.
|
|
203
|
+
|
|
180
204
|
### reindex
|
|
181
205
|
```bash
|
|
182
206
|
open-knowledge reindex outbox <file|s3://bucket/key> [--scope project] [--json]
|
|
@@ -232,7 +256,7 @@ The MCP server exposes item tools (`ok_add`, `ok_list`, `ok_get`, `ok_update`,
|
|
|
232
256
|
`ok_delete`, `ok_archive`, `ok_restore`, `ok_upsert`, `ok_untag`,
|
|
233
257
|
`ok_bulk_delete`, `ok_prune`, `ok_dedupe`, `ok_stats`, `ok_export`,
|
|
234
258
|
`ok_import`, `ok_batch`), workspace inspection (`ok_paths`), and source-ref
|
|
235
|
-
parsing (`ok_parse_source_ref`).
|
|
259
|
+
parsing/resolution (`ok_parse_source_ref`, `ok_resolve_source`).
|
|
236
260
|
|
|
237
261
|
## Source And Artifact Boundary
|
|
238
262
|
|
|
@@ -242,6 +266,16 @@ stores source references such as `open-files://file/<id>`,
|
|
|
242
266
|
and `https://...`, plus citations, chunks, generated wiki pages, indexes,
|
|
243
267
|
logs, runs, and search metadata.
|
|
244
268
|
|
|
269
|
+
`open-knowledge source resolve` and the MCP `ok_resolve_source` tool resolve
|
|
270
|
+
only the indexed, derived knowledge catalog. The resolver enforces read-only
|
|
271
|
+
purpose labels from source permissions, returns chunk citation evidence, writes
|
|
272
|
+
an audit event, and keeps bytes/storage credentials inside `open-files`.
|
|
273
|
+
|
|
274
|
+
`open-knowledge ingest source` can also build derived chunks from an allowed
|
|
275
|
+
source ref. It does not copy raw files into the knowledge workspace; local file,
|
|
276
|
+
S3, web, and open-files inputs are converted into redacted chunks with offsets,
|
|
277
|
+
hashes, revision metadata, and FTS rows.
|
|
278
|
+
|
|
245
279
|
Generated knowledge artifacts can be stored locally under
|
|
246
280
|
`.hasna/apps/knowledge/artifacts` or through the S3 artifact-store adapter.
|
|
247
281
|
|