daftari 3.3.0 → 3.5.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/CHANGELOG.md +18 -0
- package/README.md +34 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +6 -0
- package/dist/cli.js.map +1 -1
- package/dist/search/contested.d.ts +1 -1
- package/dist/search/contested.d.ts.map +1 -1
- package/dist/search/contested.js +4 -3
- package/dist/search/contested.js.map +1 -1
- package/dist/tools/backlinks.d.ts +6 -0
- package/dist/tools/backlinks.d.ts.map +1 -1
- package/dist/tools/backlinks.js +55 -1
- package/dist/tools/backlinks.js.map +1 -1
- package/dist/view/doc-view.d.ts +21 -0
- package/dist/view/doc-view.d.ts.map +1 -0
- package/dist/view/doc-view.js +53 -0
- package/dist/view/doc-view.js.map +1 -0
- package/dist/view/graph.d.ts +52 -0
- package/dist/view/graph.d.ts.map +1 -0
- package/dist/view/graph.js +133 -0
- package/dist/view/graph.js.map +1 -0
- package/dist/view/index.d.ts +3 -0
- package/dist/view/index.d.ts.map +1 -0
- package/dist/view/index.js +70 -0
- package/dist/view/index.js.map +1 -0
- package/dist/view/pages.d.ts +63 -0
- package/dist/view/pages.d.ts.map +1 -0
- package/dist/view/pages.js +478 -0
- package/dist/view/pages.js.map +1 -0
- package/dist/view/render.d.ts +15 -0
- package/dist/view/render.d.ts.map +1 -0
- package/dist/view/render.js +117 -0
- package/dist/view/render.js.map +1 -0
- package/dist/view/server.d.ts +16 -0
- package/dist/view/server.d.ts.map +1 -0
- package/dist/view/server.js +302 -0
- package/dist/view/server.js.map +1 -0
- package/dist/view/status-view.d.ts +32 -0
- package/dist/view/status-view.d.ts.map +1 -0
- package/dist/view/status-view.js +39 -0
- package/dist/view/status-view.js.map +1 -0
- package/package.json +10 -4
- package/templates/view/cytoscape.min.js +31 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Server } from "node:http";
|
|
2
|
+
export declare function isAllowedHost(hostHeader: string | undefined): boolean;
|
|
3
|
+
export interface ViewResponse {
|
|
4
|
+
status: number;
|
|
5
|
+
contentType: string;
|
|
6
|
+
body: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function handleView(vaultRoot: string, req: {
|
|
9
|
+
method?: string;
|
|
10
|
+
path: string;
|
|
11
|
+
host?: string;
|
|
12
|
+
query?: string;
|
|
13
|
+
params?: URLSearchParams;
|
|
14
|
+
}): Promise<ViewResponse>;
|
|
15
|
+
export declare function createViewServer(vaultRoot: string): Server;
|
|
16
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/view/server.ts"],"names":[],"mappings":"AAUA,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AA+CtD,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAGrE;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAiGD,wBAAsB,UAAU,CAC9B,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,eAAe,CAAA;CAAE,GAC9F,OAAO,CAAC,YAAY,CAAC,CAgKvB;AAGD,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAe1D"}
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
// The `daftari view` HTTP server — a read-only browse portal over the vault.
|
|
2
|
+
// Uses node:http (the same choice `daftari serve` makes; no framework) and
|
|
3
|
+
// binds loopback only. Every request is checked against a Host allow-list to
|
|
4
|
+
// blunt DNS-rebinding: a loopback bind still answers a rebind request whose
|
|
5
|
+
// Host is the attacker's name, so the guard rejects anything but localhost.
|
|
6
|
+
//
|
|
7
|
+
// Read-only by construction: only GET is served, there are no mutation routes,
|
|
8
|
+
// and document bodies are rendered through the sanitizing pipeline.
|
|
9
|
+
import { readFileSync } from "node:fs";
|
|
10
|
+
import { createServer } from "node:http";
|
|
11
|
+
import { dirname, resolve } from "node:path";
|
|
12
|
+
import { fileURLToPath } from "node:url";
|
|
13
|
+
import { computeDecay } from "../curation/decay.js";
|
|
14
|
+
import { listTensions } from "../curation/tension.js";
|
|
15
|
+
import { buildReverseLinkMap, buildReverseSourceMap } from "../curation/tension-blast.js";
|
|
16
|
+
import { buildPathIndexes, loadDocuments, resolveLink } from "../curation/vault-docs.js";
|
|
17
|
+
import { vaultEdges } from "../tools/edges.js";
|
|
18
|
+
import { vaultSearch } from "../tools/search.js";
|
|
19
|
+
import { buildDocView } from "./doc-view.js";
|
|
20
|
+
import { buildGraph } from "./graph.js";
|
|
21
|
+
import { renderDashboardPage, renderDocPage, renderGraphPage, renderIndexPage, renderSearchPage, } from "./pages.js";
|
|
22
|
+
import { escHtml, renderDocBody } from "./render.js";
|
|
23
|
+
import { buildStatusView } from "./status-view.js";
|
|
24
|
+
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
25
|
+
// The graph library is vendored (templates/view/cytoscape.min.js), served from
|
|
26
|
+
// the local install — never hot-linked — and lazy-loaded only on /graph. Read
|
|
27
|
+
// once and cache in memory; the same file backs every request.
|
|
28
|
+
let cytoscapeAsset = null;
|
|
29
|
+
function cytoscapeJs() {
|
|
30
|
+
if (cytoscapeAsset === null) {
|
|
31
|
+
cytoscapeAsset = readFileSync(resolve(HERE, "..", "..", "templates", "view", "cytoscape.min.js"), "utf-8");
|
|
32
|
+
}
|
|
33
|
+
return cytoscapeAsset;
|
|
34
|
+
}
|
|
35
|
+
const ALLOWED_HOSTS = new Set(["localhost", "127.0.0.1", "[::1]", "::1"]);
|
|
36
|
+
// Loopback Host allow-list. A legitimate request to a loopback bind always
|
|
37
|
+
// carries a localhost Host; a rebind attack carries the attacker's name.
|
|
38
|
+
export function isAllowedHost(hostHeader) {
|
|
39
|
+
const name = String(hostHeader ?? "").replace(/:\d+$/, "");
|
|
40
|
+
return ALLOWED_HOSTS.has(name);
|
|
41
|
+
}
|
|
42
|
+
function html(status, body) {
|
|
43
|
+
return { status, contentType: "text/html; charset=utf-8", body };
|
|
44
|
+
}
|
|
45
|
+
function json(status, value) {
|
|
46
|
+
return { status, contentType: "application/json; charset=utf-8", body: JSON.stringify(value) };
|
|
47
|
+
}
|
|
48
|
+
function js(status, body) {
|
|
49
|
+
return { status, contentType: "application/javascript; charset=utf-8", body };
|
|
50
|
+
}
|
|
51
|
+
// Collect the non-null epistemic banners the DTO carries into display banners,
|
|
52
|
+
// each tagged by kind so the page colors them distinctly. Every report follows
|
|
53
|
+
// the null-when-silent contract, so a fresh, healthy doc yields an empty array.
|
|
54
|
+
function docBanners(dto) {
|
|
55
|
+
const banners = [];
|
|
56
|
+
if (dto.decay?.banner)
|
|
57
|
+
banners.push({ kind: "decay", text: dto.decay.banner });
|
|
58
|
+
if (dto.structural?.banner)
|
|
59
|
+
banners.push({ kind: "structural", text: dto.structural.banner });
|
|
60
|
+
if (dto.upstream_staleness?.banner)
|
|
61
|
+
banners.push({ kind: "upstream", text: dto.upstream_staleness.banner });
|
|
62
|
+
if (dto.anchors?.banner)
|
|
63
|
+
banners.push({ kind: "anchor", text: dto.anchors.banner });
|
|
64
|
+
if (dto.validity?.banner)
|
|
65
|
+
banners.push({ kind: "validity", text: dto.validity.banner });
|
|
66
|
+
return banners;
|
|
67
|
+
}
|
|
68
|
+
// A compact valid-time chip, when the document authors an interval.
|
|
69
|
+
function validityChip(dto) {
|
|
70
|
+
const v = dto.validity;
|
|
71
|
+
if (!v || (v.from === null && v.until === null))
|
|
72
|
+
return null;
|
|
73
|
+
return `${v.from ?? "…"} → ${v.until ?? "now"}`;
|
|
74
|
+
}
|
|
75
|
+
// Assemble the graph inputs from the loaded doc set and the vault's edge/tension
|
|
76
|
+
// stores — the same primitives the rest of the viewer and vault_backlinks use,
|
|
77
|
+
// so the graph cannot drift from them. Per-doc decay is the cheap pure
|
|
78
|
+
// computeDecay (not a full vault_read per node); contested pairs are open
|
|
79
|
+
// tensions; derives_from edges are the live (non-revoked) ones.
|
|
80
|
+
async function collectGraphInput(vaultRoot, docs) {
|
|
81
|
+
const decayed = new Set();
|
|
82
|
+
for (const d of docs) {
|
|
83
|
+
const state = computeDecay({
|
|
84
|
+
status: d.frontmatter.status,
|
|
85
|
+
confidence: d.frontmatter.confidence,
|
|
86
|
+
updated: d.frontmatter.updated,
|
|
87
|
+
created: d.frontmatter.created,
|
|
88
|
+
ttl_days: d.frontmatter.ttl_days ?? null,
|
|
89
|
+
superseded_by: d.frontmatter.superseded_by ?? null,
|
|
90
|
+
});
|
|
91
|
+
if (state)
|
|
92
|
+
decayed.add(d.path);
|
|
93
|
+
}
|
|
94
|
+
const edgesRes = await vaultEdges(vaultRoot, {});
|
|
95
|
+
const derivesEdges = edgesRes.ok
|
|
96
|
+
? edgesRes.value.edges
|
|
97
|
+
.filter((e) => e.status !== "revoked")
|
|
98
|
+
.map((e) => ({ from: e.fromPath, to: e.toPath }))
|
|
99
|
+
: [];
|
|
100
|
+
const tensionsRes = await listTensions(vaultRoot);
|
|
101
|
+
const contestedPairs = tensionsRes.ok
|
|
102
|
+
? tensionsRes.value.filter((t) => !t.resolved).map((t) => ({ a: t.sourceA, b: t.sourceB }))
|
|
103
|
+
: [];
|
|
104
|
+
return {
|
|
105
|
+
docs: docs.map((d) => ({
|
|
106
|
+
path: d.path,
|
|
107
|
+
title: d.frontmatter.title,
|
|
108
|
+
collection: d.frontmatter.collection,
|
|
109
|
+
tier: d.frontmatter.tier ?? null,
|
|
110
|
+
status: d.frontmatter.status,
|
|
111
|
+
})),
|
|
112
|
+
reverseSource: buildReverseSourceMap(docs),
|
|
113
|
+
reverseLink: buildReverseLinkMap(docs),
|
|
114
|
+
derivesEdges,
|
|
115
|
+
contestedPairs,
|
|
116
|
+
decayed,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
// scope=all|ego, root=<vault path>, depth=<n> from the query string.
|
|
120
|
+
function parseGraphOptions(params) {
|
|
121
|
+
const scope = params?.get("scope") === "ego" ? "ego" : "all";
|
|
122
|
+
const rootRaw = params?.get("root");
|
|
123
|
+
const depthRaw = params?.get("depth");
|
|
124
|
+
const depth = depthRaw != null ? Number.parseInt(depthRaw, 10) : undefined;
|
|
125
|
+
return {
|
|
126
|
+
scope,
|
|
127
|
+
root: rootRaw ? decodeURIComponent(rootRaw) : undefined,
|
|
128
|
+
depth: depth !== undefined && Number.isFinite(depth) ? depth : undefined,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
// Resolve, render, and route one request. Pure over the vault's current state
|
|
132
|
+
// (no server object needed) so it is directly unit-testable.
|
|
133
|
+
export async function handleView(vaultRoot, req) {
|
|
134
|
+
if (!isAllowedHost(req.host)) {
|
|
135
|
+
return html(403, "<h1>403</h1><p>Host not allowed.</p>");
|
|
136
|
+
}
|
|
137
|
+
if ((req.method ?? "GET") !== "GET") {
|
|
138
|
+
return html(405, "<h1>405</h1><p>The vault viewer is read-only.</p>");
|
|
139
|
+
}
|
|
140
|
+
// Vendored graph library, lazy-loaded by the /graph shell. Static, no vault
|
|
141
|
+
// access needed.
|
|
142
|
+
if (req.path === "/assets/cytoscape.min.js") {
|
|
143
|
+
return js(200, cytoscapeJs());
|
|
144
|
+
}
|
|
145
|
+
// The graph shell: an HTML page that lazy-loads the library and renders
|
|
146
|
+
// /api/graph client-side. The shell itself needs no doc load — the data comes
|
|
147
|
+
// from the JSON endpoint (the B-seam) — so a large vault never blocks it.
|
|
148
|
+
if (req.path === "/graph") {
|
|
149
|
+
const opts = parseGraphOptions(req.params);
|
|
150
|
+
return html(200, renderGraphPage(opts));
|
|
151
|
+
}
|
|
152
|
+
// Search runs against the hybrid index (which it builds on demand), not the
|
|
153
|
+
// loaded doc set — handle it before loadDocuments so an empty query is cheap.
|
|
154
|
+
if (req.path === "/search") {
|
|
155
|
+
const query = (req.query ?? "").trim();
|
|
156
|
+
if (query.length === 0) {
|
|
157
|
+
return html(200, renderSearchPage("", []));
|
|
158
|
+
}
|
|
159
|
+
const result = await vaultSearch(vaultRoot, { query });
|
|
160
|
+
if (!result.ok) {
|
|
161
|
+
return html(500, `<h1>500</h1><p>${escHtml(result.error.message)}</p>`);
|
|
162
|
+
}
|
|
163
|
+
const hits = result.value.hits.map((h) => ({
|
|
164
|
+
path: h.path,
|
|
165
|
+
title: h.title,
|
|
166
|
+
collection: h.collection,
|
|
167
|
+
snippet: h.snippet,
|
|
168
|
+
}));
|
|
169
|
+
return html(200, renderSearchPage(query, hits));
|
|
170
|
+
}
|
|
171
|
+
// The JSON data contract behind a document page (the B-seam): the same DTO
|
|
172
|
+
// the HTML page renders from, so a future client app consumes it unchanged.
|
|
173
|
+
if (req.path.startsWith("/api/doc/")) {
|
|
174
|
+
const target = decodeURIComponent(req.path.slice("/api/doc/".length));
|
|
175
|
+
const view = await buildDocView(vaultRoot, target);
|
|
176
|
+
if (!view.ok)
|
|
177
|
+
return json(500, { error: view.error.message });
|
|
178
|
+
if (view.value === null)
|
|
179
|
+
return json(404, { error: `no document at ${target}` });
|
|
180
|
+
return json(200, view.value);
|
|
181
|
+
}
|
|
182
|
+
// The knowledge-graph JSON contract (the B-seam): the /graph client renders
|
|
183
|
+
// this, and a future client app would consume it unchanged.
|
|
184
|
+
if (req.path === "/api/graph") {
|
|
185
|
+
const loaded = await loadDocuments(vaultRoot);
|
|
186
|
+
if (!loaded.ok)
|
|
187
|
+
return json(500, { error: loaded.error.message });
|
|
188
|
+
const input = await collectGraphInput(vaultRoot, loaded.value);
|
|
189
|
+
return json(200, buildGraph(input, parseGraphOptions(req.params)));
|
|
190
|
+
}
|
|
191
|
+
// The dashboard JSON contract (the B-seam): vault metrics + staleness +
|
|
192
|
+
// open tensions + ratification queue + the sleep run-ledger trend.
|
|
193
|
+
if (req.path === "/api/status") {
|
|
194
|
+
const view = await buildStatusView(vaultRoot);
|
|
195
|
+
if (!view.ok)
|
|
196
|
+
return json(500, { error: view.error.message });
|
|
197
|
+
return json(200, view.value);
|
|
198
|
+
}
|
|
199
|
+
// Home is the dashboard (R10), rendered from /api/status; the collection
|
|
200
|
+
// index moves to /docs below.
|
|
201
|
+
if (req.path === "/" || req.path === "") {
|
|
202
|
+
const view = await buildStatusView(vaultRoot);
|
|
203
|
+
if (!view.ok)
|
|
204
|
+
return html(500, `<h1>500</h1><p>${escHtml(view.error.message)}</p>`);
|
|
205
|
+
return html(200, renderDashboardPage(view.value));
|
|
206
|
+
}
|
|
207
|
+
if (req.path.startsWith("/doc/")) {
|
|
208
|
+
const target = decodeURIComponent(req.path.slice("/doc/".length));
|
|
209
|
+
const view = await buildDocView(vaultRoot, target);
|
|
210
|
+
if (!view.ok)
|
|
211
|
+
return html(500, `<h1>500</h1><p>${escHtml(view.error.message)}</p>`);
|
|
212
|
+
if (view.value === null) {
|
|
213
|
+
return html(404, `<h1>404</h1><p>No document at ${escHtml(target)}.</p>`);
|
|
214
|
+
}
|
|
215
|
+
const dto = view.value;
|
|
216
|
+
const backlinks = dto.backlinks.map((b) => ({ doc: b.doc, label: b.via }));
|
|
217
|
+
const tensions = dto.contested.map((c) => ({
|
|
218
|
+
counterpart: c.counterpart,
|
|
219
|
+
kind: c.kind,
|
|
220
|
+
claimSelf: c.claimSelf,
|
|
221
|
+
claimOther: c.claimOther,
|
|
222
|
+
loggedAt: c.loggedAt,
|
|
223
|
+
}));
|
|
224
|
+
// R11: resolve in-vault relative links to /doc/<path> with the SAME
|
|
225
|
+
// resolver backlinks use, so the two can't disagree. A cold doc-page load;
|
|
226
|
+
// the /api/doc JSON deliberately stays raw markdown (a presentation concern
|
|
227
|
+
// lives in rendering, not the DTO/B-seam).
|
|
228
|
+
const linkDocs = await loadDocuments(vaultRoot);
|
|
229
|
+
const indexes = linkDocs.ok ? buildPathIndexes(linkDocs.value) : null;
|
|
230
|
+
const rendered = renderDocBody(dto.content, {
|
|
231
|
+
resolveLink: indexes
|
|
232
|
+
? (raw) => resolveLink(raw, dto.path, indexes.byPath, indexes.byBasename)
|
|
233
|
+
: undefined,
|
|
234
|
+
});
|
|
235
|
+
return html(200, renderDocPage({
|
|
236
|
+
path: dto.path,
|
|
237
|
+
frontmatter: {
|
|
238
|
+
title: dto.frontmatter.title,
|
|
239
|
+
collection: dto.frontmatter.collection,
|
|
240
|
+
status: dto.frontmatter.status,
|
|
241
|
+
confidence: dto.frontmatter.confidence,
|
|
242
|
+
provenance: dto.frontmatter.provenance,
|
|
243
|
+
tier: dto.frontmatter.tier ?? null,
|
|
244
|
+
tags: dto.frontmatter.tags ?? [],
|
|
245
|
+
},
|
|
246
|
+
bodyHtml: rendered.html,
|
|
247
|
+
toc: rendered.toc,
|
|
248
|
+
backlinks,
|
|
249
|
+
tensions,
|
|
250
|
+
banners: docBanners(dto),
|
|
251
|
+
validity: validityChip(dto),
|
|
252
|
+
decayLevel: dto.decay?.level ?? null,
|
|
253
|
+
contestedCount: dto.contested.length,
|
|
254
|
+
}));
|
|
255
|
+
}
|
|
256
|
+
const loaded = await loadDocuments(vaultRoot);
|
|
257
|
+
if (!loaded.ok) {
|
|
258
|
+
return html(500, `<h1>500</h1><p>${escHtml(loaded.error.message)}</p>`);
|
|
259
|
+
}
|
|
260
|
+
const docs = loaded.value;
|
|
261
|
+
if (req.path === "/docs") {
|
|
262
|
+
const byCollection = new Map();
|
|
263
|
+
for (const d of docs) {
|
|
264
|
+
const col = d.frontmatter.collection || "(uncategorized)";
|
|
265
|
+
const list = byCollection.get(col) ?? [];
|
|
266
|
+
list.push({
|
|
267
|
+
path: d.path,
|
|
268
|
+
title: d.frontmatter.title,
|
|
269
|
+
status: d.frontmatter.status,
|
|
270
|
+
confidence: d.frontmatter.confidence,
|
|
271
|
+
tier: d.frontmatter.tier ?? null,
|
|
272
|
+
});
|
|
273
|
+
byCollection.set(col, list);
|
|
274
|
+
}
|
|
275
|
+
const groups = [...byCollection.entries()]
|
|
276
|
+
.sort(([a], [b]) => a.localeCompare(b))
|
|
277
|
+
.map(([collection, entries]) => ({
|
|
278
|
+
collection,
|
|
279
|
+
docs: entries.sort((a, b) => (a.title || a.path).localeCompare(b.title || b.path)),
|
|
280
|
+
}));
|
|
281
|
+
return html(200, renderIndexPage(groups));
|
|
282
|
+
}
|
|
283
|
+
return html(404, "<h1>404</h1><p>Not found.</p>");
|
|
284
|
+
}
|
|
285
|
+
// Wrap handleView in an http.Server bound to `bind`/`port`.
|
|
286
|
+
export function createViewServer(vaultRoot) {
|
|
287
|
+
return createServer((request, response) => {
|
|
288
|
+
const url = request.url ?? "/";
|
|
289
|
+
const parsed = new URL(url, "http://localhost");
|
|
290
|
+
void handleView(vaultRoot, {
|
|
291
|
+
method: request.method,
|
|
292
|
+
path: parsed.pathname,
|
|
293
|
+
query: parsed.searchParams.get("q") ?? undefined,
|
|
294
|
+
params: parsed.searchParams,
|
|
295
|
+
host: request.headers.host,
|
|
296
|
+
}).then((res) => {
|
|
297
|
+
response.writeHead(res.status, { "Content-Type": res.contentType });
|
|
298
|
+
response.end(res.body);
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/view/server.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,2EAA2E;AAC3E,6EAA6E;AAC7E,4EAA4E;AAC5E,4EAA4E;AAC5E,EAAE;AACF,+EAA+E;AAC/E,oEAAoE;AAEpE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,YAAY,EAAe,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,C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AI,CAAC,GAAG,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED,OAAO,IAAI,CAAC,GAAG,EAAE,+BAA+B,CAAC,CAAC;AACpD,CAAC;AAED,4DAA4D;AAC5D,MAAM,UAAU,gBAAgB,CAAC,SAAiB;IAChD,OAAO,YAAY,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE;QACxC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC;QAC/B,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC;QAChD,KAAK,UAAU,CAAC,SAAS,EAAE;YACzB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,IAAI,EAAE,MAAM,CAAC,QAAQ;YACrB,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,SAAS;YAChD,MAAM,EAAE,MAAM,CAAC,YAAY;YAC3B,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI;SAC3B,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE;YACd,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,cAAc,EAAE,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;YACpE,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type Result } from "../frontmatter/types.js";
|
|
2
|
+
export interface StatusRun {
|
|
3
|
+
id: string;
|
|
4
|
+
kind: string;
|
|
5
|
+
ts: string;
|
|
6
|
+
}
|
|
7
|
+
export interface StatusView {
|
|
8
|
+
vault: string;
|
|
9
|
+
fileCount: number;
|
|
10
|
+
collections: {
|
|
11
|
+
collection: string;
|
|
12
|
+
count: number;
|
|
13
|
+
}[];
|
|
14
|
+
staleness: {
|
|
15
|
+
fresh: number;
|
|
16
|
+
aging: number;
|
|
17
|
+
stale: number;
|
|
18
|
+
total: number;
|
|
19
|
+
};
|
|
20
|
+
validity: {
|
|
21
|
+
authored: number;
|
|
22
|
+
unknown: number;
|
|
23
|
+
total: number;
|
|
24
|
+
};
|
|
25
|
+
unresolvedTensions: number;
|
|
26
|
+
ratificationQueue: number;
|
|
27
|
+
recentRuns: StatusRun[];
|
|
28
|
+
invalidCount: number;
|
|
29
|
+
generatedAt: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function buildStatusView(vaultRoot: string): Promise<Result<StatusView, Error>>;
|
|
32
|
+
//# sourceMappingURL=status-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-view.d.ts","sourceRoot":"","sources":["../../src/view/status-view.ts"],"names":[],"mappings":"AAMA,OAAO,EAAM,KAAK,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAK1D,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACrD,SAAS,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1E,QAAQ,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/D,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB;AAKD,wBAAsB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CA2B3F"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// The dashboard DTO — the JSON data contract behind the home page (the same
|
|
2
|
+
// B-seam as doc-view): both the server-rendered dashboard and /api/status read
|
|
3
|
+
// this one shape. Pure reuse — it composes vault_status (metrics, staleness,
|
|
4
|
+
// validity, unresolved tensions), the sleep run ledger (the trend), and the
|
|
5
|
+
// tier-2 ratification queue. No knowledge state is recomputed here.
|
|
6
|
+
import { ok } from "../frontmatter/types.js";
|
|
7
|
+
import { listRuns } from "../sleep/run-ledger.js";
|
|
8
|
+
import { vaultStatus } from "../tools/read.js";
|
|
9
|
+
import { vaultTier2Queue } from "../tools/tier2.js";
|
|
10
|
+
// How many recent sleep runs the trend shows.
|
|
11
|
+
const RUN_TREND_LIMIT = 12;
|
|
12
|
+
export async function buildStatusView(vaultRoot) {
|
|
13
|
+
const status = await vaultStatus(vaultRoot);
|
|
14
|
+
if (!status.ok)
|
|
15
|
+
return status;
|
|
16
|
+
const s = status.value;
|
|
17
|
+
// The ratification queue and run ledger are best-effort surfaces: a failure
|
|
18
|
+
// to read them degrades that tile to zero/empty, never fails the dashboard.
|
|
19
|
+
const tier2 = await vaultTier2Queue(vaultRoot, {});
|
|
20
|
+
const ratificationQueue = tier2.ok ? tier2.value.total : 0;
|
|
21
|
+
const recentRuns = listRuns(vaultRoot, RUN_TREND_LIMIT).map((r) => ({
|
|
22
|
+
id: r.id,
|
|
23
|
+
kind: r.kind,
|
|
24
|
+
ts: r.ts,
|
|
25
|
+
}));
|
|
26
|
+
return ok({
|
|
27
|
+
vault: s.vault,
|
|
28
|
+
fileCount: s.fileCount,
|
|
29
|
+
collections: s.collections,
|
|
30
|
+
staleness: s.stalenessDistribution,
|
|
31
|
+
validity: s.validityCoverage,
|
|
32
|
+
unresolvedTensions: s.unresolvedTensions.count,
|
|
33
|
+
ratificationQueue,
|
|
34
|
+
recentRuns,
|
|
35
|
+
invalidCount: s.invalidCount,
|
|
36
|
+
generatedAt: s.generatedAt,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=status-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-view.js","sourceRoot":"","sources":["../../src/view/status-view.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,+EAA+E;AAC/E,6EAA6E;AAC7E,4EAA4E;AAC5E,oEAAoE;AAEpE,OAAO,EAAE,EAAE,EAAe,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAqBpD,8CAA8C;AAC9C,MAAM,eAAe,GAAG,EAAE,CAAC;AAE3B,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,SAAiB;IACrD,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,SAAS,CAAC,CAAC;IAC5C,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,OAAO,MAAM,CAAC;IAC9B,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC;IAEvB,4EAA4E;IAC5E,4EAA4E;IAC5E,MAAM,KAAK,GAAG,MAAM,eAAe,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IACnD,MAAM,iBAAiB,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3D,MAAM,UAAU,GAAG,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAClE,EAAE,EAAE,CAAC,CAAC,EAAE;QACR,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,EAAE,EAAE,CAAC,CAAC,EAAE;KACT,CAAC,CAAC,CAAC;IAEJ,OAAO,EAAE,CAAC;QACR,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,SAAS,EAAE,CAAC,CAAC,SAAS;QACtB,WAAW,EAAE,CAAC,CAAC,WAAW;QAC1B,SAAS,EAAE,CAAC,CAAC,qBAAqB;QAClC,QAAQ,EAAE,CAAC,CAAC,gBAAgB;QAC5B,kBAAkB,EAAE,CAAC,CAAC,kBAAkB,CAAC,KAAK;QAC9C,iBAAiB;QACjB,UAAU;QACV,YAAY,EAAE,CAAC,CAAC,YAAY;QAC5B,WAAW,EAAE,CAAC,CAAC,WAAW;KAC3B,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "daftari",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "An open-source, multi-user knowledge vault exposed to AI agents via an MCP server.",
|
|
5
5
|
"mcpName": "io.github.mavaali/daftari",
|
|
6
6
|
"license": "MIT",
|
|
@@ -65,7 +65,13 @@
|
|
|
65
65
|
"gray-matter": "^4.0.3",
|
|
66
66
|
"jose": "^6.2.4",
|
|
67
67
|
"js-yaml": "^4.1.1",
|
|
68
|
-
"
|
|
68
|
+
"rehype-sanitize": "^6.0.0",
|
|
69
|
+
"rehype-stringify": "^10.0.1",
|
|
70
|
+
"remark-gfm": "^4.0.1",
|
|
71
|
+
"remark-parse": "^11.0.0",
|
|
72
|
+
"remark-rehype": "^11.1.2",
|
|
73
|
+
"sqlite-vec": "^0.1.9",
|
|
74
|
+
"unified": "^11.0.5"
|
|
69
75
|
},
|
|
70
76
|
"devDependencies": {
|
|
71
77
|
"@biomejs/biome": "^2.4.15",
|
|
@@ -87,9 +93,9 @@
|
|
|
87
93
|
"hono": "^4.12.25"
|
|
88
94
|
},
|
|
89
95
|
"peerDependencies": {
|
|
90
|
-
"pg": ">=8",
|
|
91
96
|
"@aws-sdk/client-s3": "^3.600.0",
|
|
92
|
-
"@azure/storage-blob": "^12.24.0"
|
|
97
|
+
"@azure/storage-blob": "^12.24.0",
|
|
98
|
+
"pg": ">=8"
|
|
93
99
|
},
|
|
94
100
|
"peerDependenciesMeta": {
|
|
95
101
|
"pg": {
|