wiki-graph 0.4.1 → 0.6.0
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/dist/cli.js +1360 -1017
- package/dist/cli.js.map +1 -1
- package/dist/data/help/commands/library-predicate.jinja +19 -19
- package/dist/data/help/commands/library.jinja +8 -5
- package/dist/data/help/commands/maintenance/chapter/add.jinja +2 -2
- package/dist/data/help/commands/maintenance/chapter/set-source.jinja +3 -20
- package/dist/data/help/commands/maintenance/chapter.jinja +3 -2
- package/dist/data/help/commands/maintenance/upgrade.jinja +2 -2
- package/dist/data/help/commands/maintenance.jinja +1 -1
- package/dist/data/help/commands/predicate.jinja +143 -119
- package/dist/data/help/commands/root.jinja +4 -2
- package/dist/data/help/commands/shared/chapter-source-set.jinja +21 -0
- package/dist/data/help/commands/uri.jinja +89 -23
- package/dist/data/help/topics/config.jinja +27 -0
- package/dist/data/help/topics/file-import.jinja +49 -0
- package/dist/data/help/topics/format.jinja +6 -4
- package/dist/data/help/topics/library.jinja +11 -7
- package/dist/data/help/topics/readiness.jinja +73 -34
- package/dist/data/help/topics/recipe.jinja +15 -12
- package/dist/data/help/topics/runtime.jinja +1 -1
- package/dist/data/help/topics/source-locators.jinja +45 -0
- package/dist/data/help/topics/uri.jinja +19 -4
- package/dist/gc-worker.js +508 -253
- package/dist/gc-worker.js.map +1 -1
- package/dist/index.cjs +5232 -2809
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5153 -2731
- package/dist/index.js.map +1 -1
- package/dist/queue-worker.js +1856 -647
- package/dist/queue-worker.js.map +1 -1
- package/package.json +9 -8
- package/LICENSE +0 -201
- package/dist/cli.d.ts +0 -1
- package/dist/gc-worker.d.ts +0 -1
- package/dist/index.d.cts +0 -36
- package/dist/queue-worker.d.ts +0 -1
|
@@ -10,7 +10,7 @@ Purpose:
|
|
|
10
10
|
Operating rules:
|
|
11
11
|
- Never unzip a `.wikg` archive, rewrite internal files, or bypass this CLI. Use CLI commands for archive edits.
|
|
12
12
|
- Use Wiki Graph URIs as stable object handles.
|
|
13
|
-
- Use `--json` when you want stable Agent-readable fields instead of human text. Whole `source` and `summary`
|
|
13
|
+
- Use `--json` when you want stable Agent-readable fields instead of human text. Whole and ranged `source` and `summary` reads return `uri` and `text`.
|
|
14
14
|
- If you have a URI and need valid operations, run `{{ commandName }} <uri> --help`.
|
|
15
15
|
- If you need concrete predicate usage for that URI type, run `{{ commandName }} <uri> <predicate> --help`.
|
|
16
16
|
- Never pass a bare filesystem path to URI-targeted commands.
|
|
@@ -32,9 +32,11 @@ Choose your starting point:
|
|
|
32
32
|
{{ commandName }} help library
|
|
33
33
|
|
|
34
34
|
- User gave you source content and needs a reusable knowledge-base archive:
|
|
35
|
-
Create an empty
|
|
35
|
+
Create an empty archive and add UTF-8 chapter text, or create one while importing EPUB.
|
|
36
36
|
{{ commandName }} wikg://book.wikg create
|
|
37
|
+
{{ commandName }} wikg://book.wikg/chapter add --title "Part" --input ./chapter.txt
|
|
37
38
|
{{ commandName }} wikg://book.wikg create --import ./book.epub
|
|
39
|
+
Read `{{ commandName }} help file-import` for EPUB or source-locator JSONL.
|
|
38
40
|
|
|
39
41
|
- User needs one-shot conversion without keeping an archive:
|
|
40
42
|
Use transform. Source input usually requires LLM configuration.
|
|
@@ -50,15 +52,16 @@ After inspect:
|
|
|
50
52
|
{{ commandName }} wikg:///Users/me/book.wikg --query "attention memory"
|
|
51
53
|
{{ commandName }} wikg:///Users/me/book.wikg/chapter/part --query "attention"
|
|
52
54
|
|
|
53
|
-
- If inspect reports
|
|
54
|
-
{{ commandName }} <archive-uri
|
|
55
|
-
{{ commandName }} <archive-uri
|
|
56
|
-
|
|
57
|
-
{{ commandName }}
|
|
55
|
+
- If inspect reports query blockers, build the free local FTS artifacts, then inspect again.
|
|
56
|
+
{{ commandName }} wikg://local/job add --input <archive-uri> --task index-fts
|
|
57
|
+
{{ commandName }} <archive-uri> inspect
|
|
58
|
+
If artifacts are ready but only the local cache is missing or outdated, sync it:
|
|
59
|
+
{{ commandName }} <archive-uri>/index sync
|
|
60
|
+
Read `{{ commandName }} help readiness` for artifact and cache alternatives.
|
|
58
61
|
|
|
59
|
-
- If library-wide query reports a missing or
|
|
62
|
+
- If library-wide query reports a missing, stale, or not-ready index cache, inspect the library index target and sync it when appropriate.
|
|
60
63
|
{{ commandName }} wikg://lib/index --help
|
|
61
|
-
{{ commandName }} wikg://lib/index
|
|
64
|
+
{{ commandName }} wikg://lib/index sync --help
|
|
62
65
|
{{ commandName }} help library
|
|
63
66
|
|
|
64
67
|
- If Reading Graph data is missing, chunk `--query`, related expansion, and pack may be unavailable or incomplete.
|
|
@@ -83,8 +86,8 @@ Finding material:
|
|
|
83
86
|
{{ commandName }} wikg://book.wikg/chapter/part
|
|
84
87
|
|
|
85
88
|
- Need to search across all archives in a managed library:
|
|
86
|
-
Use library-wide scopes after
|
|
87
|
-
{{ commandName }} wikg://lib/index
|
|
89
|
+
Use library-wide scopes after syncing the library index cache.
|
|
90
|
+
{{ commandName }} wikg://lib/index sync
|
|
88
91
|
{{ commandName }} wikg://lib/entity --query "attention" --evidence 2
|
|
89
92
|
{{ commandName }} wikg://lib/triple --query "attention memory" --evidence 2
|
|
90
93
|
{{ commandName }} wikg://lib/chunk --query "attention memory" --evidence 2
|
|
@@ -168,7 +171,7 @@ When to read deeper:
|
|
|
168
171
|
{{ commandName }} help format
|
|
169
172
|
- LLM, concurrency, and WikiSpine provider setup:
|
|
170
173
|
{{ commandName }} help config
|
|
171
|
-
-
|
|
174
|
+
- Search index, embeddings, LLM, WikiSpine, and generated-data prerequisites:
|
|
172
175
|
{{ commandName }} help readiness
|
|
173
176
|
- Library registry, membership, path binding, and aggregate index:
|
|
174
177
|
{{ commandName }} help library
|
|
@@ -8,7 +8,7 @@ Purpose:
|
|
|
8
8
|
|
|
9
9
|
Archive-first streams:
|
|
10
10
|
- `{{ commandName }} <archive-uri> create` creates an empty archive; it does not read stdin.
|
|
11
|
-
- `{{ commandName }} <archive-uri> create --import <
|
|
11
|
+
- `{{ commandName }} <archive-uri> create --import <source-file>` imports a source file into a new archive; read `{{ commandName }} help file-import` for the import contract.
|
|
12
12
|
- `{{ commandName }} <archive-uri> export --output-format markdown|txt` can write text projections to stdout.
|
|
13
13
|
- `{{ commandName }} transform --input-format markdown|txt --output-format markdown|txt` runs direct one-shot stream digest/export and usually requires LLM configuration.
|
|
14
14
|
- Retrieval commands print human-readable text by default and support `--json` where documented.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
Help Type: topic
|
|
2
|
+
Topic: source-locators
|
|
3
|
+
|
|
4
|
+
Source Artifacts and Locator Scope
|
|
5
|
+
|
|
6
|
+
Purpose:
|
|
7
|
+
Trace a returned source passage back to the imported file location that
|
|
8
|
+
produced it.
|
|
9
|
+
|
|
10
|
+
Artifact URIs:
|
|
11
|
+
- A source artifact identifies an imported PDF or EPUB by the SHA-256 digest
|
|
12
|
+
of its file bytes. Output uses its stable archive-local short UID:
|
|
13
|
+
`wikg://artifact/<short-uid>`.
|
|
14
|
+
- A short UID starts with the first 12 digest characters and lengthens only
|
|
15
|
+
when needed for uniqueness. The full digest form remains valid:
|
|
16
|
+
`wikg://artifact/<sha256-digest>`.
|
|
17
|
+
- The short UID belongs to the archive, not to one chapter. Add the archive
|
|
18
|
+
locator when opening a returned short URI. Use the full `digest` from the
|
|
19
|
+
artifact details as its content identity across archives.
|
|
20
|
+
- A fragment selects a location inside that artifact. PDF uses
|
|
21
|
+
`#page=21&bbox=left,bottom,right,top`; EPUB uses `#epubcfi(...)`.
|
|
22
|
+
- PDF pages are 1-based. Bounding boxes use normalized `[0,1]` coordinates
|
|
23
|
+
in left,bottom,right,top order with a lower-left origin.
|
|
24
|
+
|
|
25
|
+
Locator scope:
|
|
26
|
+
{{ commandName }} <chapter-uri>/source/locators
|
|
27
|
+
{{ commandName }} <chapter-uri>/source/locators#4..8
|
|
28
|
+
- Source and evidence reads contain text only. Use this scope when provenance
|
|
29
|
+
details are needed.
|
|
30
|
+
- The fragment selects source sentences. Returned `range` values count Unicode
|
|
31
|
+
characters within the selected source text; both are 1-based and inclusive.
|
|
32
|
+
- Plain output is `3..13 -> <artifact-locator-uri>`. JSON and JSONL items are
|
|
33
|
+
`{"range":[3,13],"uri":"<artifact-locator-uri>"}`.
|
|
34
|
+
- Missing ranges mean those characters have no stored source locator.
|
|
35
|
+
- Use `--limit <n>` and `{{ commandName }} next <cursor>` for paging, or `--all`
|
|
36
|
+
for the complete collection.
|
|
37
|
+
|
|
38
|
+
Reading details:
|
|
39
|
+
{{ commandName }} <chapter-uri>/source/locators --json
|
|
40
|
+
{{ commandName }} wikg://book.wikg/artifact/<short-uid>
|
|
41
|
+
{{ commandName }} 'wikg://book.wikg/artifact/<short-uid>#page=21&bbox=0.1,0.2,0.9,0.35'
|
|
42
|
+
|
|
43
|
+
See also:
|
|
44
|
+
- {{ commandName }} help file-import
|
|
45
|
+
- {{ commandName }} help uri
|
|
@@ -31,6 +31,7 @@ Library locators:
|
|
|
31
31
|
wikg://lib/arc/<archive-id>/chapter
|
|
32
32
|
wikg://lib/arc/<archive-id>/entity
|
|
33
33
|
wikg://lib/arc/<archive-id>/triple
|
|
34
|
+
wikg://lib/arc/<archive-id>/artifact/<sha256-digest>
|
|
34
35
|
- Library-wide scopes such as `wikg://lib/entity` query the aggregate library index.
|
|
35
36
|
- Read `{{ commandName }} help library` before managing registry, membership, path binding, or library index lifecycle.
|
|
36
37
|
|
|
@@ -38,6 +39,8 @@ Short and located URIs:
|
|
|
38
39
|
Commands may return short object URIs without local file paths:
|
|
39
40
|
wikg://chapter/part/title
|
|
40
41
|
wikg://chapter/part/source#4..8
|
|
42
|
+
wikg://chapter/part/source/locators#4..8
|
|
43
|
+
wikg://artifact/<sha256-digest>#epubcfi(...)
|
|
41
44
|
wikg://chunk/12
|
|
42
45
|
wikg://entity/Q8018
|
|
43
46
|
wikg://triple/Q8018/discusses/Q123
|
|
@@ -48,7 +51,7 @@ Short and located URIs:
|
|
|
48
51
|
|
|
49
52
|
Command routing:
|
|
50
53
|
- `{{ commandName }} <scope-uri>` enumerates objects.
|
|
51
|
-
- `{{ commandName }} <scope-uri> --query <query>` applies
|
|
54
|
+
- `{{ commandName }} <scope-uri> --query <query>` applies search index retrieval within that scope.
|
|
52
55
|
- `{{ commandName }} <object-uri>` reads one object.
|
|
53
56
|
- `{{ commandName }} <uri> --help` explains that URI target and its supported predicates.
|
|
54
57
|
- `{{ commandName }} <uri> <predicate> --help` explains a URI-bound predicate.
|
|
@@ -61,7 +64,8 @@ Common command shapes:
|
|
|
61
64
|
{{ commandName }} <entity|triple|chunk-uri> evidence
|
|
62
65
|
{{ commandName }} <located-chunk-uri|located-entity-uri> pack
|
|
63
66
|
{{ commandName }} next <cursor>
|
|
64
|
-
{{ commandName }} <archive-uri> create [--import <
|
|
67
|
+
{{ commandName }} <archive-uri> create [--import <source-file>]
|
|
68
|
+
{{ commandName }} help file-import
|
|
65
69
|
{{ commandName }} <archive-uri> export --output-format <format>
|
|
66
70
|
{{ commandName }} <archive-uri> inspect
|
|
67
71
|
{{ commandName }} transform [options]
|
|
@@ -69,12 +73,16 @@ Common command shapes:
|
|
|
69
73
|
{{ commandName }} wikg://lib/entity --query <query>
|
|
70
74
|
{{ commandName }} wikg://lib/arc/<archive-id>/entity --query <query>
|
|
71
75
|
{{ commandName }} wikg://local/job
|
|
72
|
-
{{ commandName }} wikg://local/job add --input <archive-uri|chapter-uri> --task <reading-graph|reading-summary|knowledge-graph> --accept-cost
|
|
76
|
+
{{ commandName }} wikg://local/job add --input <archive-uri|chapter-uri> --task <index-fts|index-embedding-source|index-embedding-summary|reading-graph|reading-summary|knowledge-graph> [--accept-cost]
|
|
73
77
|
{{ commandName }} wikg://local/job/<job-id>
|
|
74
78
|
|
|
75
79
|
Scope URIs:
|
|
76
|
-
Scope URIs enumerate objects by default. With `--query <query>`, they apply
|
|
80
|
+
Scope URIs enumerate objects by default. With `--query <query>`, they apply search index retrieval within that scope.
|
|
77
81
|
A chapter URI used as a scope covers that chapter's full subtree by default.
|
|
82
|
+
Query is strict by default: every chapter in scope must have a current FTS artifact or source embedding artifact.
|
|
83
|
+
Add `--skip-unindexed` only when you intentionally want to search indexed chapters and ignore uncovered chapters.
|
|
84
|
+
Broad query is grouped by result type before ranking within each group. Use `/chunk`, `/entity`, or `/triple` lenses when you want one object family instead of the mixed broad result. Query an archive or chapter scope to find source or summary text, then read the returned `/source` or `/summary` object.
|
|
85
|
+
Search uses FTS-only, Dense-only, or Hybrid automatically from the current artifacts and index cache; use `{{ commandName }} help readiness` to inspect what must exist.
|
|
78
86
|
Add `--depth <N>` to limit chapter subtree expansion:
|
|
79
87
|
- no `--depth`: full subtree
|
|
80
88
|
- `--depth 0`: only the current chapter, or root-level chapters for `<archive-uri>/chapter`
|
|
@@ -86,6 +94,7 @@ Scope URIs:
|
|
|
86
94
|
wikg://book.wikg/chapter/part/chunk
|
|
87
95
|
wikg://book.wikg/chapter/part/entity
|
|
88
96
|
wikg://book.wikg/chapter/part/triple
|
|
97
|
+
wikg://book.wikg/chapter/part/source/locators
|
|
89
98
|
wikg://book.wikg/chunk
|
|
90
99
|
wikg://book.wikg/entity
|
|
91
100
|
wikg://book.wikg/triple
|
|
@@ -101,6 +110,7 @@ Object URIs:
|
|
|
101
110
|
wikg://book.wikg/chapter/part/source#4..8
|
|
102
111
|
wikg://book.wikg/chapter/part/summary
|
|
103
112
|
wikg://book.wikg/chapter/part/summary#4..8
|
|
113
|
+
wikg://book.wikg/artifact/<sha256-digest>
|
|
104
114
|
wikg://book.wikg/chapter/part/chunk/12
|
|
105
115
|
wikg://book.wikg/chapter/part/entity/Q8018
|
|
106
116
|
wikg://book.wikg/chapter/part/triple/Q8018/discusses/Q123
|
|
@@ -123,10 +133,12 @@ Object boundaries:
|
|
|
123
133
|
- `chapter/<path>` is a scope, not an object.
|
|
124
134
|
- `chapter/<path>/title` is the queryable chapter title object.
|
|
125
135
|
- Whole `source` and `summary` objects are readable text streams, not collection scopes.
|
|
136
|
+
- `<chapter-uri>/source/locators` is a collection scope. Its optional fragment selects source sentences before their locator mappings are listed.
|
|
126
137
|
- Chapter-qualified scope URIs such as `<chapter-uri>/chunk`, `<chapter-uri>/entity`, and `<chapter-uri>/triple` expand to the chapter subtree and support `--depth`.
|
|
127
138
|
- Chapter-qualified resource and object URIs such as `/source`, `/summary`, `/title`, `/state`, `/chunk/<id>`, `/entity/<qid>`, and complete `/triple/<subject>/<predicate>/<object>` do not expand to subtrees and do not support `--depth`.
|
|
128
139
|
- `move`, `remove`, and `reset` are chapter node maintenance predicates; they target the chapter node itself, not the subtree. Use `remove --recursive` for explicit recursive deletion.
|
|
129
140
|
- Ranged fragments such as `/source#4..8` and `/summary#4..8` are structured range objects.
|
|
141
|
+
- In `/source/locators#4..8`, the fragment belongs to the locator scope and selects the same source sentence range.
|
|
130
142
|
- Source and summary range numbers are 1-based and inclusive. `/source#1..2` means the first two source sentences.
|
|
131
143
|
- Source text is the grounding material. `evidence` is not available for source, summary, or chapter scope URIs.
|
|
132
144
|
- `chunk`, `entity`, and `triple` can return source-backed evidence.
|
|
@@ -156,6 +168,7 @@ Literal source passages:
|
|
|
156
168
|
Use `--query` on the narrowest useful scope when the task is to find source wording or passages mentioning a literal term:
|
|
157
169
|
{{ commandName }} <archive-uri> --query "term"
|
|
158
170
|
{{ commandName }} <archive-uri>/chapter/<path> --query "term"
|
|
171
|
+
{{ commandName }} <archive-uri> --query "term" --skip-unindexed
|
|
159
172
|
{{ commandName }} <archive-uri>/chapter/<path>/source#20..30
|
|
160
173
|
|
|
161
174
|
Entity-grounded evidence:
|
|
@@ -178,6 +191,8 @@ Recovery hints:
|
|
|
178
191
|
{{ commandName }} <archive-uri>/chapter/tree
|
|
179
192
|
{{ commandName }} help readiness
|
|
180
193
|
- Missing generated objects: start the relevant generation job for the chapter.
|
|
194
|
+
{{ commandName }} wikg://local/job add --input <archive-uri|chapter-uri> --task index-fts
|
|
195
|
+
{{ commandName }} wikg://local/job add --input <archive-uri|chapter-uri> --task index-embedding-source --accept-cost
|
|
181
196
|
{{ commandName }} wikg://local/job add --input <archive-uri|chapter-uri> --task reading-graph --accept-cost
|
|
182
197
|
{{ commandName }} wikg://local/job add --input <archive-uri|chapter-uri> --task reading-summary --accept-cost
|
|
183
198
|
{{ commandName }} help readiness
|