wiki-formant 0.69.0 → 0.70.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/README.md +1 -0
- package/dist/wiki-tools.d.ts +7 -0
- package/dist/wiki-tools.js +11 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -91,6 +91,7 @@ const { items, total } = await searchWiki(reading, 'validators', { page: 1, size
|
|
|
91
91
|
|
|
92
92
|
- Every row carries `path`, which every read tool takes back, and `chars` where the page's text was read. A pasted URL resolves, with `pathPrefix` stripped; a category's path reads its hub article; a miss names the nearest pages.
|
|
93
93
|
- Every row carries the page `id` too, which a `pageList` block takes. `get_page` with `blocks: true` returns the stored blocks, the page `id`, its whole metadata and `version`: what an edit starts from. `forEdit` adds what the app's write tool takes beside them, and `authors` names each revision's author in `get_page_history`.
|
|
94
|
+
- `text` should be the serializer the page's markdown twin uses, and `resolve` the resolver its page uses to fill what is read live (a page list's pages): `get_page`, `get_pages` and the default corpus read text through both, so a page reads the same over MCP as at its twin, which `twinParity` checks.
|
|
94
95
|
- `privateHidden` closes the back office to every tool; without it a hidden page is unlisted but readable by path, as its URL is.
|
|
95
96
|
- `metadata`, `label`, `corpus`, `noMatch` and `skills` are the app's: what a row adds, how a category is named, the sections its llms-full.txt is made of, what an empty search says, and the A2A skills.
|
|
96
97
|
- Writes stay with each app, because who may write is the one thing no two of them agree on.
|
package/dist/wiki-tools.d.ts
CHANGED
|
@@ -11,6 +11,13 @@ export interface WikiToolsOptions<B extends DiffBlock> {
|
|
|
11
11
|
url: (tagPath: string, slug: string) => string;
|
|
12
12
|
/** A page's blocks as plain prose: what `get_page` returns and `chars` counts. */
|
|
13
13
|
text: (blocks: B[]) => string;
|
|
14
|
+
/**
|
|
15
|
+
* A page's blocks with what is read live filled in, such as a page list's
|
|
16
|
+
* pages: the resolver the app's page and markdown twin use. `get_page`,
|
|
17
|
+
* `get_pages` and the default corpus read their text through it, so a list
|
|
18
|
+
* reads there as it does on the twin rather than as its stored placeholder.
|
|
19
|
+
*/
|
|
20
|
+
resolve?: (blocks: B[]) => Promise<B[]>;
|
|
14
21
|
/** The wiki as the descriptions name it: "the Radix Wiki", "this DAO's wiki". */
|
|
15
22
|
noun: string;
|
|
16
23
|
/** The corpus document's heading. */
|
package/dist/wiki-tools.js
CHANGED
|
@@ -90,21 +90,23 @@ export function wikiReadTools(o) {
|
|
|
90
90
|
hint: 'Paths are exact. Use search_wiki for a keyword, or list_pages with the tagPath to enumerate the branch.',
|
|
91
91
|
});
|
|
92
92
|
};
|
|
93
|
-
|
|
93
|
+
/** Blocks as the page shows them. */
|
|
94
|
+
const shown = (blocks) => (o.resolve ? o.resolve(blocks) : Promise.resolve(blocks));
|
|
95
|
+
const head = (page) => ({
|
|
94
96
|
...summary({ ...page, snippet: describe(openingText(page.content)) }),
|
|
95
97
|
version: page.version,
|
|
96
|
-
content: o.text(page.content),
|
|
97
98
|
});
|
|
99
|
+
const full = async (page) => ({ ...head(page), content: o.text(await shown(page.content)) });
|
|
98
100
|
const sections = async (tagPath) => {
|
|
99
101
|
if (o.corpus)
|
|
100
102
|
return o.corpus(tagPath);
|
|
101
103
|
const pages = (await store.corpus())
|
|
102
104
|
.filter(p => !(p.tagPath === '' && p.slug === '') && (!tagPath || p.tagPath === tagPath || p.tagPath.startsWith(`${tagPath}/`)))
|
|
103
105
|
.sort((a, b) => b.updatedAt.getTime() - a.updatedAt.getTime());
|
|
104
|
-
return pages.map(p => {
|
|
106
|
+
return Promise.all(pages.map(async (p) => {
|
|
105
107
|
const path = pathOf(p.tagPath, p.slug);
|
|
106
|
-
return { path, tagPath: p.tagPath, section: `## ${p.title}\n\nPath: ${path}\nURL: ${o.url(p.tagPath, p.slug)}\nUpdated: ${isoDate(p.updatedAt)}\n\n${o.text(p.content)}` };
|
|
107
|
-
});
|
|
108
|
+
return { path, tagPath: p.tagPath, section: `## ${p.title}\n\nPath: ${path}\nURL: ${o.url(p.tagPath, p.slug)}\nUpdated: ${isoDate(p.updatedAt)}\n\n${o.text(await shown(p.content))}` };
|
|
109
|
+
}));
|
|
108
110
|
};
|
|
109
111
|
const tools = [
|
|
110
112
|
{
|
|
@@ -165,8 +167,9 @@ export function wikiReadTools(o) {
|
|
|
165
167
|
const r = readArgs(args);
|
|
166
168
|
const page = await named(r);
|
|
167
169
|
if (!r.bool('blocks'))
|
|
168
|
-
return withAdjustments(r, full(page));
|
|
169
|
-
|
|
170
|
+
return withAdjustments(r, await full(page));
|
|
171
|
+
// Stored, not resolved: what an edit sends back is what was stored.
|
|
172
|
+
return withAdjustments(r, { ...head(page), id: page.id, content: page.content, metadata: page.metadata, ...o.forEdit?.(page) });
|
|
170
173
|
},
|
|
171
174
|
},
|
|
172
175
|
{
|
|
@@ -207,7 +210,7 @@ export function wikiReadTools(o) {
|
|
|
207
210
|
missing.push(input);
|
|
208
211
|
continue;
|
|
209
212
|
}
|
|
210
|
-
const row = full(page);
|
|
213
|
+
const row = await full(page);
|
|
211
214
|
// At least one page always comes back, so one oversized page can still be read.
|
|
212
215
|
if (pages.length && used + row.content.length > maxChars) {
|
|
213
216
|
omitted.push({ path: row.path, chars: row.content.length });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wiki-formant",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.70.0",
|
|
4
4
|
"description": "The portable half of a wiki: derived taxonomy and facet controls, a version-negotiating MCP transport, markdown twins, block rendering, a rich-text editor engine, conditional-GET plumbing, and the headers and CSP every origin sends.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|