@hasna/knowledge 0.2.16 → 0.2.18
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 +2553 -1887
- package/bin/open-knowledge.js +104 -83
- package/docs/architecture/ai-native-knowledge-base.md +13 -0
- package/docs/architecture/hybrid-semantic-search.md +8 -0
- package/package.json +2 -1
- package/src/agent.ts +367 -0
- package/src/cli.ts +70 -5
- package/src/mcp.js +37 -0
- package/src/providers.ts +1 -1
- package/src/service.ts +21 -0
- package/src/web-search.ts +330 -0
package/README.md
CHANGED
|
@@ -98,6 +98,13 @@ open-knowledge embeddings search "company wiki policy" --scope project --json
|
|
|
98
98
|
open-knowledge search "company wiki policy" --scope project --json
|
|
99
99
|
open-knowledge search "company wiki policy" --scope project --semantic --json
|
|
100
100
|
open-knowledge search "company wiki policy" --scope project --context --json
|
|
101
|
+
|
|
102
|
+
# Build a citation answer/context draft for a prompt
|
|
103
|
+
open-knowledge ask "How do we cite handbook policy?" --scope project --json
|
|
104
|
+
knowledge "How do we cite handbook policy?" --scope project --json
|
|
105
|
+
|
|
106
|
+
# Provider-native web search, safety-gated for real network access
|
|
107
|
+
HASNA_KNOWLEDGE_WEB_SEARCH=1 open-knowledge web search "latest AI SDK web search" --provider openai --json
|
|
101
108
|
```
|
|
102
109
|
|
|
103
110
|
## Commands
|
|
@@ -259,6 +266,31 @@ assembled citations, freshness and permission notes, graph evidence from
|
|
|
259
266
|
`citations`/`wiki_backlinks`, and final rerank scores. This is the shape future
|
|
260
267
|
`knowledge <prompt>` flows should send to a model instead of raw search rows.
|
|
261
268
|
|
|
269
|
+
### ask / build
|
|
270
|
+
```bash
|
|
271
|
+
open-knowledge ask <prompt> [--scope project] [--json]
|
|
272
|
+
open-knowledge build <prompt> [--generate] [--model default|provider:model] [--scope project] [--json]
|
|
273
|
+
knowledge <prompt> [--scope project] [--json]
|
|
274
|
+
```
|
|
275
|
+
Build an agent-native prompt run. The command first creates a read-only context
|
|
276
|
+
pack, returns a local citation draft by default, records a run ledger in
|
|
277
|
+
`runs`/`run_events`, and proposes durable wiki updates without writing them.
|
|
278
|
+
`--generate` explicitly calls AI SDK text generation; `--fake --generate` keeps
|
|
279
|
+
the flow deterministic for local tests. `--approve-write` records approval
|
|
280
|
+
intent, but durable wiki writes remain deferred to the wiki compile/write task.
|
|
281
|
+
|
|
282
|
+
### web
|
|
283
|
+
```bash
|
|
284
|
+
open-knowledge web search <query> [--provider openai|anthropic] [--model provider:model] [--domain <domain>] [--file-results] [--scope project] [--json]
|
|
285
|
+
```
|
|
286
|
+
Run provider-native hosted web search and return cited web sources. Real network
|
|
287
|
+
search is disabled unless `safety.network.web_search_enabled=true` or
|
|
288
|
+
`HASNA_KNOWLEDGE_WEB_SEARCH=1` is set. OpenAI uses the AI SDK OpenAI
|
|
289
|
+
`tools.webSearch` path; Anthropic uses its provider web-search tool when
|
|
290
|
+
available. `--file-results` stores returned snippets as read-only `web` source
|
|
291
|
+
refs in `knowledge.db` so later local search can cite them. `--fake` returns
|
|
292
|
+
deterministic offline sources for tests.
|
|
293
|
+
|
|
262
294
|
### safety
|
|
263
295
|
```bash
|
|
264
296
|
open-knowledge safety status [--scope project] [--json]
|
|
@@ -340,7 +372,9 @@ The MCP server exposes item tools (`ok_add`, `ok_list`, `ok_get`, `ok_update`,
|
|
|
340
372
|
`ok_semantic_search`), hybrid retrieval (`ok_search`), and source-ref
|
|
341
373
|
parsing/resolution (`ok_parse_source_ref`, `ok_resolve_source`). The
|
|
342
374
|
`knowledge_search` MCP tool returns reranked citation context packs for agent
|
|
343
|
-
prompts
|
|
375
|
+
prompts, and `knowledge_ask` runs the same prompt flow exposed by
|
|
376
|
+
`open-knowledge ask`. `ok_web_search` exposes safety-gated provider web search
|
|
377
|
+
to MCP clients.
|
|
344
378
|
|
|
345
379
|
## Source And Artifact Boundary
|
|
346
380
|
|