@hasna/knowledge 0.2.8 → 0.2.10
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 +22 -0
- package/bin/open-knowledge-mcp.js +1447 -34
- package/bin/open-knowledge.js +64 -59
- package/docs/architecture/ai-native-knowledge-base.md +10 -1
- package/package.json +2 -2
- package/src/cli.ts +33 -72
- package/src/manifest-ingest.ts +36 -10
- package/src/mcp.js +5 -27
- package/src/service.ts +157 -0
- package/src/source-ingest.ts +268 -0
package/README.md
CHANGED
|
@@ -11,6 +11,11 @@ engine for AI agents. It stores simple knowledge items today, creates a Hasna
|
|
|
11
11
|
project workspace under `.hasna/apps/knowledge`, initializes a versioned
|
|
12
12
|
`knowledge.db`, writes generated wiki artifacts, and exposes a stdio MCP server.
|
|
13
13
|
|
|
14
|
+
CLI and MCP workspace operations share a `KnowledgeService` facade for config,
|
|
15
|
+
safety policy, artifact storage, DB/wiki setup, source ingestion, source
|
|
16
|
+
resolution, and outbox consumption. That keeps local project mode and future
|
|
17
|
+
remote/S3-backed wrappers on the same service contracts.
|
|
18
|
+
|
|
14
19
|
## Install
|
|
15
20
|
|
|
16
21
|
```bash
|
|
@@ -66,6 +71,9 @@ open-knowledge wiki init --scope project
|
|
|
66
71
|
# Ingest an open-files source manifest into the project SQLite catalog
|
|
67
72
|
open-knowledge ingest manifest ./open-files-manifest.jsonl --scope project --json
|
|
68
73
|
|
|
74
|
+
# Ingest one read-only source ref directly
|
|
75
|
+
open-knowledge ingest source file:///absolute/path/to/handbook.md --purpose knowledge_index --scope project --json
|
|
76
|
+
|
|
69
77
|
# Consume open-files change events and invalidate stale source chunks
|
|
70
78
|
open-knowledge reindex outbox ./open-files-outbox.jsonl --scope project --json
|
|
71
79
|
|
|
@@ -184,11 +192,20 @@ raw source retrieval remains owned by `open-files`.
|
|
|
184
192
|
### ingest
|
|
185
193
|
```bash
|
|
186
194
|
open-knowledge ingest manifest <file|s3://bucket/key> [--scope project] [--json]
|
|
195
|
+
open-knowledge ingest source <source-ref> [--purpose knowledge_index] [--scope project] [--json]
|
|
187
196
|
```
|
|
188
197
|
Import an open-files JSON or JSONL source manifest into `knowledge.db`. This
|
|
189
198
|
upserts sources and source revisions, stores hash/MIME/status/permission
|
|
190
199
|
metadata, and chunks embedded extracted text when the manifest includes it.
|
|
191
200
|
|
|
201
|
+
`ingest source` accepts `open-files://`, `file://`, `s3://`, and `https://`
|
|
202
|
+
refs. It reads source content through a read-only boundary, redacts known
|
|
203
|
+
secrets before storage, records hashes/revisions, and stores only derived chunks
|
|
204
|
+
and citation spans. Web and S3 reads remain opt-in through the safety policy.
|
|
205
|
+
For `open-files://` refs, the source must already be present in the local
|
|
206
|
+
knowledge catalog through a manifest or extracted-text ref until the open-files
|
|
207
|
+
resolver API lands.
|
|
208
|
+
|
|
192
209
|
### reindex
|
|
193
210
|
```bash
|
|
194
211
|
open-knowledge reindex outbox <file|s3://bucket/key> [--scope project] [--json]
|
|
@@ -259,6 +276,11 @@ only the indexed, derived knowledge catalog. The resolver enforces read-only
|
|
|
259
276
|
purpose labels from source permissions, returns chunk citation evidence, writes
|
|
260
277
|
an audit event, and keeps bytes/storage credentials inside `open-files`.
|
|
261
278
|
|
|
279
|
+
`open-knowledge ingest source` can also build derived chunks from an allowed
|
|
280
|
+
source ref. It does not copy raw files into the knowledge workspace; local file,
|
|
281
|
+
S3, web, and open-files inputs are converted into redacted chunks with offsets,
|
|
282
|
+
hashes, revision metadata, and FTS rows.
|
|
283
|
+
|
|
262
284
|
Generated knowledge artifacts can be stored locally under
|
|
263
285
|
`.hasna/apps/knowledge/artifacts` or through the S3 artifact-store adapter.
|
|
264
286
|
|