@plurnk/plurnk-service 0.51.0 → 0.53.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/SPEC.md +17 -11
- package/dist/core/Engine.d.ts.map +1 -1
- package/dist/core/Engine.js +124 -67
- package/dist/core/Engine.js.map +1 -1
- package/dist/core/Engine.sql +41 -11
- package/dist/core/SchemeRegistry.d.ts.map +1 -1
- package/dist/core/SchemeRegistry.js +1 -2
- package/dist/core/SchemeRegistry.js.map +1 -1
- package/dist/core/git-membership.js +1 -1
- package/dist/core/git-membership.js.map +1 -1
- package/dist/core/packet-wire.d.ts +1 -2
- package/dist/core/packet-wire.d.ts.map +1 -1
- package/dist/core/packet-wire.js +111 -138
- package/dist/core/packet-wire.js.map +1 -1
- package/dist/core/run-ops.sql +5 -0
- package/dist/core/teaching.d.ts +1 -1
- package/dist/core/teaching.d.ts.map +1 -1
- package/dist/core/teaching.js +6 -4
- package/dist/core/teaching.js.map +1 -1
- package/dist/schemes/Exec.d.ts.map +1 -1
- package/dist/schemes/Exec.js +11 -24
- package/dist/schemes/Exec.js.map +1 -1
- package/dist/schemes/Log.d.ts.map +1 -1
- package/dist/schemes/Log.js +3 -2
- package/dist/schemes/Log.js.map +1 -1
- package/dist/schemes/Plurnk.js +1 -1
- package/dist/schemes/Plurnk.js.map +1 -1
- package/dist/schemes/Run.d.ts +4 -2
- package/dist/schemes/Run.d.ts.map +1 -1
- package/dist/schemes/Run.js +86 -51
- package/dist/schemes/Run.js.map +1 -1
- package/dist/schemes/_entry-crud.sql +12 -0
- package/dist/schemes/_entry-find.d.ts +4 -17
- package/dist/schemes/_entry-find.d.ts.map +1 -1
- package/dist/schemes/_entry-find.js +74 -66
- package/dist/schemes/_entry-find.js.map +1 -1
- package/dist/schemes/_entry-graph.d.ts +0 -6
- package/dist/schemes/_entry-graph.d.ts.map +1 -1
- package/dist/schemes/_entry-graph.js +0 -8
- package/dist/schemes/_entry-graph.js.map +1 -1
- package/dist/schemes/_entry-graph.sql +0 -10
- package/dist/schemes/_entry-manifest.d.ts +13 -2
- package/dist/schemes/_entry-manifest.d.ts.map +1 -1
- package/dist/schemes/_entry-manifest.js +84 -89
- package/dist/schemes/_entry-manifest.js.map +1 -1
- package/dist/schemes/_entry-ops.d.ts.map +1 -1
- package/dist/schemes/_entry-ops.js +14 -6
- package/dist/schemes/_entry-ops.js.map +1 -1
- package/dist/schemes/_entry-ops.sql +11 -0
- package/dist/server/Daemon.d.ts.map +1 -1
- package/dist/server/Daemon.js +5 -8
- package/dist/server/Daemon.js.map +1 -1
- package/docs/log.md +1 -1
- package/migrations/0000-00-00.01_schema.sql +3 -1
- package/package.json +16 -15
- package/requirements.md +5 -3
- package/dist/schemes/exec-receipt.d.ts +0 -4
- package/dist/schemes/exec-receipt.d.ts.map +0 -1
- package/dist/schemes/exec-receipt.js +0 -25
- package/dist/schemes/exec-receipt.js.map +0 -1
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
// FIND helper for entry-bearing schemes (SPEC §find; plurnk.md FIND row).
|
|
2
|
-
//
|
|
2
|
+
// FIND resolves to the scheme's CATALOG ROWS — the very rows the manifest catalogs —
|
|
3
|
+
// filtered to the statement's matches. A matcher (glob/regex/jsonpath/xpath/~semantic/
|
|
4
|
+
// @graph) decides WHICH entries appear; it never reshapes a row (there is no per-match
|
|
5
|
+
// extent — match-location is a READ, not a FIND field). The result is a JSON array of
|
|
6
|
+
// catalog rows: the per-scheme slice of the catalog (§find-result-catalog-rows).
|
|
3
7
|
//
|
|
4
8
|
// Slot semantics (plurnk.md §"Body matcher dispatch (FIND, READ, OPEN, FOLD)"):
|
|
5
9
|
// target — required scope (path or glob); selects which entries are candidates
|
|
6
|
-
// body — matcher (glob/regex/jsonpath/xpath).
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// whose content matches; `OPEN(countries/**):Paris*` selects entries
|
|
11
|
-
// whose content matches. The path-glob is the (target).
|
|
10
|
+
// body — matcher (glob/regex/jsonpath/xpath/~semantic/@graph). A content matcher
|
|
11
|
+
// runs against the entry's default-channel CONTENT (Matcher.matchAgainstContent
|
|
12
|
+
// → the mimetypes daughter) and INCLUDES/EXCLUDES the entry — e.g.
|
|
13
|
+
// `FIND(log:///**/error):/timeout/i` keeps logs whose content matches.
|
|
12
14
|
// signal — tag filter: candidate entry must have ALL listed tags
|
|
13
15
|
// <L> — results pagination: select results N..M from the matched list
|
|
14
16
|
import { LineMarkerOps } from "../content/index.js";
|
|
15
17
|
import Matcher from "../content/matcher.js";
|
|
16
18
|
import { decodePathParens } from "../core/path-decode.js";
|
|
17
19
|
import EntryGraph from "./_entry-graph.js";
|
|
20
|
+
import EntryManifest from "./_entry-manifest.js";
|
|
18
21
|
import EntrySemantic from "./_entry-semantic.js";
|
|
19
22
|
export default class EntryFind {
|
|
20
23
|
static #scopePathnameOf(statement) {
|
|
@@ -53,35 +56,44 @@ export default class EntryFind {
|
|
|
53
56
|
return { status: 416 };
|
|
54
57
|
return { status: 200, items: items.slice(n - 1, m) };
|
|
55
58
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
static #unique(xs) {
|
|
60
|
+
const seen = new Set();
|
|
61
|
+
const out = [];
|
|
62
|
+
for (const x of xs)
|
|
63
|
+
if (!seen.has(x)) {
|
|
64
|
+
seen.add(x);
|
|
65
|
+
out.push(x);
|
|
66
|
+
}
|
|
67
|
+
return out;
|
|
68
|
+
}
|
|
69
|
+
// Resolve a FIND to its matched session PATHNAMES — entry-level, unique, in result
|
|
70
|
+
// order (rank for ~semantic, candidate order otherwise). Candidate selection (scope +
|
|
71
|
+
// tags) runs in SQL (find_session_entry_candidates); a content matcher then runs against
|
|
72
|
+
// each candidate's default-channel CONTENT (Matcher.matchAgainstContent → the mimetypes
|
|
73
|
+
// daughter) and INCLUDES/EXCLUDES the entry — 200 keeps it, 204/415/203 drop it, 400
|
|
74
|
+
// (malformed matcher) fails the whole op. Path-scoping stays in the (target). The matched
|
|
75
|
+
// SET is what FIND returns; the match LOCATION (which line/symbol) is a READ concern.
|
|
76
|
+
static async #matchPathnames(statement, ctx, manifest) {
|
|
64
77
|
if (statement.target === null)
|
|
65
|
-
return { status: 400,
|
|
78
|
+
return { status: 400, pathnames: [] };
|
|
66
79
|
// Scope by the manifest's persisted entries.scheme (storedScheme; absent →
|
|
67
80
|
// name). File sets storedScheme=null — bare rows.
|
|
68
81
|
const scheme = manifest.storedScheme === undefined ? manifest.name : manifest.storedScheme;
|
|
69
|
-
const addr = (pathname) => `${manifest.name}://${pathname}`;
|
|
70
82
|
if (statement.body !== null && statement.body.dialect === "semantic") {
|
|
71
83
|
// ~query: embed the query text, FTS-narrow by its terms, cosine-rank the
|
|
72
84
|
// narrowed set, top-K. 501 when no embeddings handler is installed (the
|
|
73
85
|
// channel degrades to empty bytes). <L> carries K.
|
|
74
86
|
const { mimetypes } = ctx;
|
|
75
87
|
if (mimetypes === undefined)
|
|
76
|
-
return { status: 501,
|
|
88
|
+
return { status: 501, pathnames: [] };
|
|
77
89
|
if (statement.lineMarker === null)
|
|
78
|
-
return { status: 400,
|
|
90
|
+
return { status: 400, pathnames: [] }; // ~query needs a top-K, e.g. ~query<10>
|
|
79
91
|
const ranked = await EntrySemantic.rankSemantic(ctx.db, ctx.sessionId, scheme, mimetypes, statement.body.raw, LineMarkerOps.firstLast(statement.lineMarker));
|
|
80
92
|
if (ranked.status !== 200)
|
|
81
|
-
return { status: ranked.status,
|
|
82
|
-
//
|
|
83
|
-
//
|
|
84
|
-
return { status: 200,
|
|
93
|
+
return { status: ranked.status, pathnames: [] };
|
|
94
|
+
// Rank order; a chunk-ranked list can repeat an entry across chunks → dedupe,
|
|
95
|
+
// keeping the highest-ranked occurrence. The winning chunk's span is a READ.
|
|
96
|
+
return { status: 200, pathnames: EntryFind.#unique(ranked.results.map((x) => x.pathname)) };
|
|
85
97
|
}
|
|
86
98
|
const scopePathname = EntryFind.#scopePathnameOf(statement);
|
|
87
99
|
// grammar 0.46 regex-in-path: a `#pattern#flags` target filters by regex over the pathname (below), so it takes no scope-prefix glob.
|
|
@@ -106,14 +118,14 @@ export default class EntryFind {
|
|
|
106
118
|
re = new RegExp(statement.target.pattern, statement.target.flags || undefined);
|
|
107
119
|
}
|
|
108
120
|
catch {
|
|
109
|
-
return { status: 400,
|
|
121
|
+
return { status: 400, pathnames: [] };
|
|
110
122
|
}
|
|
111
123
|
candidates = candidates.filter((c) => re.test(c.pathname));
|
|
112
124
|
}
|
|
113
|
-
let
|
|
125
|
+
let pathnames;
|
|
114
126
|
if (statement.body === null) {
|
|
115
|
-
// No body matcher —
|
|
116
|
-
|
|
127
|
+
// No body matcher — every in-scope candidate is in the result.
|
|
128
|
+
pathnames = candidates.map((c) => c.pathname);
|
|
117
129
|
}
|
|
118
130
|
else if (statement.body.dialect === "graph") {
|
|
119
131
|
// @graph (plurnk-service#186): body is `@<sym` / `@>sym` / `@sym`.
|
|
@@ -122,62 +134,58 @@ export default class EntryFind {
|
|
|
122
134
|
const inScope = new Set(candidates.map((c) => c.pathname));
|
|
123
135
|
const graph = await EntryGraph.match(ctx.db, ctx.sessionId, scheme, statement.body.raw);
|
|
124
136
|
if (graph.status !== 200)
|
|
125
|
-
return { status: graph.status,
|
|
126
|
-
|
|
137
|
+
return { status: graph.status, pathnames: [] };
|
|
138
|
+
pathnames = graph.pathnames.filter((p) => inScope.has(p));
|
|
127
139
|
}
|
|
128
140
|
else {
|
|
129
141
|
const { mimetypes } = ctx;
|
|
130
142
|
if (mimetypes === undefined)
|
|
131
|
-
throw new Error("EntryFind
|
|
132
|
-
|
|
143
|
+
throw new Error("EntryFind.#matchPathnames: body matcher requires the mimetypes capability in ctx");
|
|
144
|
+
pathnames = [];
|
|
133
145
|
for (const cand of candidates) {
|
|
134
146
|
const match = await Matcher.matchAgainstContent(statement.body, cand.content, cand.mimetype, mimetypes); // matcher runs on content — §find-glob-filter-on-content
|
|
135
147
|
if (match.status === 400)
|
|
136
|
-
return { status: 400,
|
|
148
|
+
return { status: 400, pathnames: [] };
|
|
137
149
|
if (match.status !== 200)
|
|
138
150
|
continue; // 204 no-match / 415 unsupported / 203 fallback → not a content hit
|
|
139
|
-
//
|
|
140
|
-
findings.push(...await EntryFind.findingsForMatch(db, cand.entry_id, addr(cand.pathname), match.lines ?? []));
|
|
151
|
+
pathnames.push(cand.pathname); // a content hit includes the entry — entry-level, no extent
|
|
141
152
|
}
|
|
142
153
|
}
|
|
143
154
|
if (statement.lineMarker !== null) {
|
|
144
|
-
const page = EntryFind.#paginate(
|
|
155
|
+
const page = EntryFind.#paginate(pathnames, LineMarkerOps.firstLast(statement.lineMarker));
|
|
145
156
|
if (page.status !== 200)
|
|
146
|
-
return { status: page.status,
|
|
147
|
-
|
|
157
|
+
return { status: page.status, pathnames: [] };
|
|
158
|
+
pathnames = page.items ?? [];
|
|
148
159
|
}
|
|
149
|
-
return { status: 200,
|
|
150
|
-
}
|
|
151
|
-
// Project Findings — resolve a matched entry's hit lines to findings: each line maps to
|
|
152
|
-
// its smallest enclosing symbol (the structural unit it belongs to), or to the line
|
|
153
|
-
// itself when no symbol covers it. Deduped by extent — many hits in one function
|
|
154
|
-
// collapse to one finding. Phase 2b wires this into the FIND result shape.
|
|
155
|
-
static async findingsForMatch(db, entryId, path, lines) {
|
|
156
|
-
const findings = [];
|
|
157
|
-
const seen = new Set();
|
|
158
|
-
for (const line of lines) {
|
|
159
|
-
const sym = await EntryGraph.enclosingSymbol(db, entryId, line);
|
|
160
|
-
const extent = sym === null ? { first: line, last: line } : { first: sym.line, last: sym.endLine };
|
|
161
|
-
const key = `${extent.first}-${extent.last}`;
|
|
162
|
-
if (seen.has(key))
|
|
163
|
-
continue;
|
|
164
|
-
seen.add(key);
|
|
165
|
-
findings.push(sym === null ? { path, extent } : { path, extent, symbol: sym.name });
|
|
166
|
-
}
|
|
167
|
-
return findings;
|
|
160
|
+
return { status: 200, pathnames };
|
|
168
161
|
}
|
|
162
|
+
// FIND result = the scheme's catalog rows, filtered to the matched entries and kept in
|
|
163
|
+
// match order. A catalog row is exactly what the manifest catalogs (path + per-channel
|
|
164
|
+
// {mimetype, tokens, lines}, tags, seconds) — FIND is the filtered, navigable slice of
|
|
165
|
+
// that catalog, rendered as a JSON array (application/json). §find-result-catalog-rows
|
|
169
166
|
static async findSessionEntries(statement, ctx, manifest) {
|
|
170
|
-
const match = await EntryFind
|
|
167
|
+
const match = await EntryFind.#matchPathnames(statement, ctx, manifest);
|
|
171
168
|
if (match.status !== 200)
|
|
172
|
-
return { status: match.status, content: null, mimetype: null, results: [] };
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
const
|
|
180
|
-
|
|
169
|
+
return { status: match.status, content: null, mimetype: null, results: [], itemsTokenTotal: 0 };
|
|
170
|
+
const scheme = manifest.storedScheme === undefined ? manifest.name : manifest.storedScheme;
|
|
171
|
+
// The catalog row is keyed by its addressable path; align each matched pathname to
|
|
172
|
+
// its row through the same EntryManifest.toPath the catalog uses (single source of
|
|
173
|
+
// truth). Match order is preserved (rank for ~semantic); a pathname with no row
|
|
174
|
+
// (e.g. the self-excluded manifest) drops out.
|
|
175
|
+
const byPath = new Map((await EntryManifest.catalogRowsFor(ctx, scheme)).map((r) => [r.path, r]));
|
|
176
|
+
const results = [];
|
|
177
|
+
for (const pathname of match.pathnames) {
|
|
178
|
+
const row = byPath.get(EntryManifest.toPath(scheme, pathname));
|
|
179
|
+
if (row !== undefined)
|
|
180
|
+
results.push(row);
|
|
181
|
+
}
|
|
182
|
+
// The matched set's content weight — the sum of every matched entry's live channel
|
|
183
|
+
// tokens. Self-describes the FIND ("N items holding T tokens"): the per-scheme roll-up
|
|
184
|
+
// in the turn-0 foist, the READ-cost of any search's hits before the model reads them.
|
|
185
|
+
const itemsTokenTotal = results.reduce((sum, r) => sum + Object.values(r.channels).reduce((s, c) => s + c.tokens, 0), 0);
|
|
186
|
+
// Compact JSON — the model parses it natively; the `null, 2` pretty-print was ~36%
|
|
187
|
+
// whitespace of the catalog body, tokens the wire doesn't need.
|
|
188
|
+
return { status: 200, content: JSON.stringify(results), mimetype: "application/json", results, itemsTokenTotal };
|
|
181
189
|
}
|
|
182
190
|
}
|
|
183
191
|
//# sourceMappingURL=_entry-find.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_entry-find.js","sourceRoot":"","sources":["../../src/schemes/_entry-find.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,
|
|
1
|
+
{"version":3,"file":"_entry-find.js","sourceRoot":"","sources":["../../src/schemes/_entry-find.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,qFAAqF;AACrF,uFAAuF;AACvF,uFAAuF;AACvF,sFAAsF;AACtF,iFAAiF;AACjF,EAAE;AACF,gFAAgF;AAChF,kFAAkF;AAClF,sFAAsF;AACtF,4FAA4F;AAC5F,+EAA+E;AAC/E,mFAAmF;AACnF,oEAAoE;AACpE,4EAA4E;AAG5E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAC3C,OAAO,aAAoC,MAAM,sBAAsB,CAAC;AACxE,OAAO,aAAa,MAAM,sBAAsB,CAAC;AAUjD,MAAM,CAAC,OAAO,OAAO,SAAS;IAC1B,MAAM,CAAC,gBAAgB,CAAC,SAAwB;QAC5C,MAAM,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC;QAC9B,IAAI,IAAI,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;QAC/B,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO;YAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,kDAAkD;QAC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, line: number): Promise<{
|
|
11
|
-
name: string;
|
|
12
|
-
kind: string;
|
|
13
|
-
line: number;
|
|
14
|
-
endLine: number;
|
|
15
|
-
} | null>;
|
|
16
10
|
}
|
|
17
11
|
//# sourceMappingURL=_entry-graph.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_entry-graph.d.ts","sourceRoot":"","sources":["../../src/schemes/_entry-graph.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,EAAE,EAAc,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEpE,MAAM,CAAC,OAAO,OAAO,UAAU;;WAId,YAAY,CACrB,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAC1C,OAAO,EAAE,SAAS,UAAU,EAAE,EAAE,UAAU,EAAE,SAAS,OAAO,EAAE,GAC/D,OAAO,CAAC,IAAI,CAAC;WAmBH,KAAK,CAAC,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"_entry-graph.d.ts","sourceRoot":"","sources":["../../src/schemes/_entry-graph.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,EAAE,EAAc,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEpE,MAAM,CAAC,OAAO,OAAO,UAAU;;WAId,YAAY,CACrB,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAC1C,OAAO,EAAE,SAAS,UAAU,EAAE,EAAE,UAAU,EAAE,SAAS,OAAO,EAAE,GAC/D,OAAO,CAAC,IAAI,CAAC;WAmBH,KAAK,CAAC,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CA0CtI"}
|
|
@@ -52,14 +52,6 @@ export default class EntryGraph {
|
|
|
52
52
|
set.add(p);
|
|
53
53
|
return { status: 200, pathnames: [...set].sort() };
|
|
54
54
|
}
|
|
55
|
-
// Project Findings — the smallest symbol_def enclosing a line: the structural unit a
|
|
56
|
-
// match at line N belongs to (a finding IS its enclosing function/class/heading,
|
|
57
|
-
// addressed by <L>). null when no symbol covers the line — then the extent is the
|
|
58
|
-
// match line itself.
|
|
59
|
-
static async enclosingSymbol(db, entryId, line) {
|
|
60
|
-
const row = await db.graph_enclosing_symbol.get({ entry_id: entryId, line });
|
|
61
|
-
return row === undefined ? null : { name: row.name, kind: row.kind, line: row.line, endLine: row.end_line ?? row.line };
|
|
62
|
-
}
|
|
63
55
|
static async #referrers(db, sessionId, scheme, name) {
|
|
64
56
|
const rows = await db.graph_referrers.all({ session_id: sessionId, scheme, name });
|
|
65
57
|
return rows.map((r) => r.pathname);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_entry-graph.js","sourceRoot":"","sources":["../../src/schemes/_entry-graph.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,iFAAiF;AACjF,qFAAqF;AACrF,6EAA6E;AAC7E,sFAAsF;AACtF,EAAE;AACF,mFAAmF;AACnF,6FAA6F;AAC7F,sFAAsF;AACtF,oEAAoE;AAKpE,MAAM,CAAC,OAAO,OAAO,UAAU;IAC3B,4EAA4E;IAC5E,+EAA+E;IAC/E,2EAA2E;IAC3E,MAAM,CAAC,KAAK,CAAC,YAAY,CACrB,EAAM,E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)
|
|
15
15
|
VALUES ($session_id, $entry_id, $name, $kind, $container, $line, $end_line);
|
|
16
16
|
|
|
17
|
-
-- PREP: graph_enclosing_symbol
|
|
18
|
-
-- Project Findings — the smallest symbol_def covering a line: the structural unit a match
|
|
19
|
-
-- at line N belongs to (function/class/heading). Ties → tightest span; a point symbol
|
|
20
|
-
-- (NULL end_line) covers only its own line.
|
|
21
|
-
SELECT name, kind, line, end_line
|
|
22
|
-
FROM symbol_defs
|
|
23
|
-
WHERE entry_id = $entry_id AND line <= $line AND COALESCE(end_line, line) >= $line
|
|
24
|
-
ORDER BY (COALESCE(end_line, line) - line) ASC
|
|
25
|
-
LIMIT 1;
|
|
26
|
-
|
|
27
17
|
-- PREP: graph_insert_ref
|
|
28
18
|
INSERT INTO symbol_refs (session_id, entry_id, name, kind, container, line, col)
|
|
29
19
|
VALUES ($session_id, $entry_id, $name, $kind, $container, $line, $col);
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import type { PlurnkSchemeContext } from "../core/scheme-types.ts";
|
|
2
|
+
export type CatalogEntry = {
|
|
3
|
+
path: string;
|
|
4
|
+
seconds?: number;
|
|
5
|
+
tags?: string[];
|
|
6
|
+
channels: Record<string, {
|
|
7
|
+
mimetype: string;
|
|
8
|
+
tokens: number;
|
|
9
|
+
lines: number;
|
|
10
|
+
}>;
|
|
11
|
+
};
|
|
2
12
|
export default class EntryManifest {
|
|
3
|
-
|
|
4
|
-
static
|
|
13
|
+
static toPath(scheme: string | null, pathname: string): string;
|
|
14
|
+
static catalogRowsFor(ctx: PlurnkSchemeContext, schemeFilter?: string | null): Promise<CatalogEntry[]>;
|
|
15
|
+
static maintainDerivations(ctx: PlurnkSchemeContext): Promise<void>;
|
|
5
16
|
}
|
|
6
17
|
//# sourceMappingURL=_entry-manifest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_entry-manifest.d.ts","sourceRoot":"","sources":["../../src/schemes/_entry-manifest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_entry-manifest.d.ts","sourceRoot":"","sources":["../../src/schemes/_entry-manifest.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAUnE,MAAM,MAAM,YAAY,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC;AAE9J,MAAM,CAAC,OAAO,OAAO,aAAa;IAG9B,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;WAUjD,cAAc,CAAC,GAAG,EAAE,mBAAmB,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;WA4C/F,mBAAmB,CAAC,GAAG,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;CA2C5E"}
|
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
// The
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
// ranks/filters it itself by querying
|
|
1
|
+
// The entry catalog (§packet-manifest-catalog) — the complete, unranked directory of every
|
|
2
|
+
// entry the session holds, served by FIND(scheme:///**), one per-scheme array (there is no
|
|
3
|
+
// plurnk:///manifest.json entry). catalogRowsFor renders engine_list_session_entries' rows,
|
|
4
|
+
// uniformly READable, in no relevance order; the model ranks/filters it itself by querying it
|
|
5
5
|
// (task-aware) — the catalog never ranks for it, or it would be an index again.
|
|
6
|
-
// Each item: { path, seconds?, channels: { <uri>: { mimetype, tokens, lines } } } — each
|
|
7
|
-
// keyed by its addressable URI (default channel → the bare path, non-default → path#channel).
|
|
8
|
-
// `tokens` is the live provider's count, re-counted at render — the write-time
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
// mimetypes' process() totalLines. The catalog never lists itself.
|
|
6
|
+
// Each item: { path, seconds?, tags?, channels: { <uri>: { mimetype, tokens, lines } } } — each
|
|
7
|
+
// channel keyed by its addressable URI (default channel → the bare path, non-default → path#channel).
|
|
8
|
+
// `tokens` is the live provider's count, re-counted at render — the write-time snapshot is NOT
|
|
9
|
+
// trusted, since a model/tokenizer change between loops would make the catalog lie; `lines` is the
|
|
10
|
+
// content's extent from mimetypes' process() totalLines.
|
|
12
11
|
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
// (the same materialization pattern as git membership).
|
|
12
|
+
// maintainDerivations (the per-turn pump) refreshes the deep channels the rows report; both live
|
|
13
|
+
// in the schemes/entry layer, not the engine — building a scheme's catalog is the schemes' job.
|
|
16
14
|
import { renderAddress } from "../core/plurnk-uri.js";
|
|
17
15
|
import { createHash } from "node:crypto";
|
|
18
16
|
import { MimetypeBinary } from "../content/index.js";
|
|
19
17
|
import EntryGraph from "./_entry-graph.js";
|
|
20
18
|
import EntrySemantic from "./_entry-semantic.js";
|
|
21
19
|
export default class EntryManifest {
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
// Public — the catalog's path-rendering is the single source of truth for the
|
|
21
|
+
// addressable key, shared by FIND (EntryFind aligns matched pathnames to catalog rows).
|
|
22
|
+
static toPath(scheme, pathname) {
|
|
24
23
|
// Bare (file, scheme===null) entries store the namespace-absolute key (`/notes.md`)
|
|
25
24
|
// but the model types the relative path it reads — render the leading slash off so
|
|
26
25
|
// the catalog matches what the model writes back (READ/EDIT resolve either form).
|
|
27
26
|
return scheme === null ? pathname.replace(/^\//, "") : renderAddress(scheme, pathname);
|
|
28
27
|
}
|
|
29
|
-
|
|
28
|
+
// Read-only catalog rows for a scheme (or all entries when undefined) — the CatalogEntry[]
|
|
29
|
+
// a per-scheme FIND(scheme:///**) renders as its JSON result, WITHOUT the derivation pump
|
|
30
|
+
// (maintainDerivations runs that once per turn; FIND reads the channels it leaves).
|
|
31
|
+
static async catalogRowsFor(ctx, schemeFilter) {
|
|
30
32
|
const { db, sessionId, mimetypes, tokenize } = ctx;
|
|
31
33
|
if (mimetypes === undefined)
|
|
32
|
-
throw new Error("
|
|
34
|
+
throw new Error("catalogRowsFor: ctx.mimetypes is required for the lines (extent) field");
|
|
33
35
|
if (tokenize === undefined)
|
|
34
|
-
throw new Error("
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
// its own categorization (and can FIND by tag) without a separate read.
|
|
36
|
+
throw new Error("catalogRowsFor: ctx.tokenize is required — depth is re-counted through the live provider, not stored");
|
|
37
|
+
const all = await db.engine_list_session_entries.all({ session_id: sessionId });
|
|
38
|
+
const rows = schemeFilter === undefined ? all : all.filter((r) => r.scheme === schemeFilter);
|
|
38
39
|
const tagsById = new Map();
|
|
39
40
|
for (const { entry_id, tag } of await db.engine_list_session_entry_tags.all({ session_id: sessionId })) {
|
|
40
41
|
const list = tagsById.get(entry_id);
|
|
@@ -44,13 +45,8 @@ export default class EntryManifest {
|
|
|
44
45
|
list.push(tag);
|
|
45
46
|
}
|
|
46
47
|
const byEntry = new Map();
|
|
47
|
-
// The embedding config signature is identical for every entry this build —
|
|
48
|
-
// compute it once and fold it into each deep_hash (re-derive on model/knob change).
|
|
49
|
-
const deepCfgSig = await EntrySemantic.deepConfigSignature(mimetypes);
|
|
50
48
|
for (const r of rows) {
|
|
51
|
-
const path = EntryManifest
|
|
52
|
-
if (path === EntryManifest.#MANIFEST_PATH)
|
|
53
|
-
continue;
|
|
49
|
+
const path = EntryManifest.toPath(r.scheme, r.pathname);
|
|
54
50
|
let entry = byEntry.get(path);
|
|
55
51
|
if (entry === undefined) {
|
|
56
52
|
entry = { path, channels: {} };
|
|
@@ -59,81 +55,80 @@ export default class EntryManifest {
|
|
|
59
55
|
entry.tags = tags;
|
|
60
56
|
byEntry.set(path, entry);
|
|
61
57
|
}
|
|
62
|
-
// seconds: live age of an active stream (open subscription), set once
|
|
63
|
-
// at entry level — a clock on running execs, absent for static entries.
|
|
64
58
|
if (r.seconds !== null && entry.seconds === undefined)
|
|
65
59
|
entry.seconds = r.seconds;
|
|
66
|
-
//
|
|
67
|
-
//
|
|
68
|
-
|
|
69
|
-
// index (#186) and the ~semantic FTS + embedding — alongside the catalog's
|
|
70
|
-
// totalLines, but ONLY when the content changed since the last derivation
|
|
71
|
-
// (the deep_hash gate). An unchanged entry just gets totalLines; its
|
|
72
|
-
// symbol/FTS/embedding rows persist. A handler predating the references
|
|
73
|
-
// channel throws → fall back to metadata-only and clear the graph rows.
|
|
74
|
-
const isBody = r.channel === "body";
|
|
75
|
-
// Per-entry isolation: a malformed/unprocessable entry (e.g. invalid JSON the
|
|
76
|
-
// model wrote) makes mimetypes.process() throw — and uncaught, that crashed the
|
|
77
|
-
// whole manifest build and the turn (the daemon's -32603). Contain it here:
|
|
78
|
-
// degrade the offender to a bare line count with its deep channels cleared, and
|
|
79
|
-
// keep building the rest of the catalog. The hash is stamped so it doesn't
|
|
80
|
-
// re-attempt every turn; a content change re-hashes and re-derives.
|
|
81
|
-
let result;
|
|
60
|
+
// Lines via a read-only process() (no deep channels → no derivation). A malformed
|
|
61
|
+
// entry degrades to a bare line count, parity with buildManifestBody's containment.
|
|
62
|
+
let totalLines;
|
|
82
63
|
try {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
64
|
+
totalLines = (await mimetypes.process({ content: r.content, hint: r.mimetype }, { channels: [] })).totalLines;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
totalLines = r.content.length === 0 ? 0 : r.content.split("\n").length;
|
|
68
|
+
}
|
|
69
|
+
const defaultCh = ctx.defaultChannelFor?.(r.scheme) ?? "body";
|
|
70
|
+
const channelKey = r.channel === defaultCh ? entry.path : `${entry.path}#${r.channel}`;
|
|
71
|
+
entry.channels[channelKey] = { mimetype: r.mimetype, tokens: tokenize(r.content), lines: totalLines };
|
|
72
|
+
}
|
|
73
|
+
return [...byEntry.values()];
|
|
74
|
+
}
|
|
75
|
+
// The per-turn derivation pump (§mimetype). For each BODY channel whose content changed
|
|
76
|
+
// since its last derivation (the deep_hash gate, config-signature-folded), re-derive every
|
|
77
|
+
// deep channel from ONE process() — the @graph symbol index (#186) and the ~semantic FTS +
|
|
78
|
+
// embedding — and stamp the new hash. An unchanged entry is skipped; its symbol/FTS/embedding
|
|
79
|
+
// rows persist. This is the engine-side point where the mimetypes handler legitimately fires
|
|
80
|
+
// (never at a scheme write). It DERIVES; it does not render — FIND and the catalog read what
|
|
81
|
+
// it leaves. Per-entry isolation: a malformed/unprocessable entry (e.g. invalid JSON the model
|
|
82
|
+
// wrote) makes process() throw — uncaught, that once crashed the whole turn (the daemon's
|
|
83
|
+
// -32603); contain it here (clear the deep channels, stamp the hash so it doesn't re-attempt)
|
|
84
|
+
// and keep pumping the rest.
|
|
85
|
+
static async maintainDerivations(ctx) {
|
|
86
|
+
const { db, sessionId, mimetypes } = ctx;
|
|
87
|
+
if (mimetypes === undefined)
|
|
88
|
+
throw new Error("maintainDerivations: ctx.mimetypes is required to derive entry deep channels");
|
|
89
|
+
const rows = await db.engine_list_session_entries.all({ session_id: sessionId });
|
|
90
|
+
// The embedding config signature is identical for every entry this pass — compute it
|
|
91
|
+
// once and fold it into each deep_hash (re-derive on model/knob change).
|
|
92
|
+
const deepCfgSig = await EntrySemantic.deepConfigSignature(mimetypes);
|
|
93
|
+
for (const r of rows) {
|
|
94
|
+
if (r.channel !== "body")
|
|
95
|
+
continue; // derivation fires on the body channel only
|
|
96
|
+
const hash = createHash("sha256").update(r.content).update("\0").update(deepCfgSig).digest("hex");
|
|
97
|
+
if (hash === r.deep_hash)
|
|
98
|
+
continue; // unchanged since last derivation → deep rows persist
|
|
99
|
+
try {
|
|
100
|
+
const wantGraph = r.content.length > 0 && !MimetypeBinary.isBinaryMimetype(r.mimetype);
|
|
101
|
+
let result;
|
|
102
|
+
if (wantGraph) {
|
|
103
|
+
try {
|
|
104
|
+
result = await mimetypes.process({ content: r.content, hint: r.mimetype }, { channels: ["symbols", "references", "embedding"] }); // §mimetype-methods-process-entry-point
|
|
105
|
+
await EntryGraph.populateFrom(db, sessionId, r.entry_id, result.symbols ?? [], result.references ?? []);
|
|
87
106
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
result = await mimetypes.process({ content: r.content, hint: r.mimetype }, { channels: ["symbols", "references", "embedding"] }); // §mimetype-methods-process-entry-point
|
|
93
|
-
await EntryGraph.populateFrom(db, sessionId, r.entry_id, result.symbols ?? [], result.references ?? []);
|
|
94
|
-
}
|
|
95
|
-
catch {
|
|
96
|
-
result = await mimetypes.process({ content: r.content, hint: r.mimetype }, { channels: [] });
|
|
97
|
-
await EntryGraph.populateFrom(db, sessionId, r.entry_id, [], []);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
result = await mimetypes.process({ content: r.content, hint: r.mimetype }, { channels: [] });
|
|
102
|
-
await EntryGraph.populateFrom(db, sessionId, r.entry_id, [], []);
|
|
103
|
-
}
|
|
104
|
-
// The other two deep channels: re-index the body into entry_fts
|
|
105
|
-
// (~semantic's keyword half) and store the embedding vector(s) + model
|
|
106
|
-
// (the vector half). Empty/binary/degraded → cleared, not stored.
|
|
107
|
-
await EntrySemantic.indexFts(db, r.entry_id, r.content);
|
|
108
|
-
// Project Semantics: derive the entry's chunk embeddings. Gated on
|
|
109
|
-
// the embedder reporting its tokenizer — absent → one whole-entry
|
|
110
|
-
// chunk (today's behavior), present → lossless tiling. result.embedding
|
|
111
|
-
// is the fallback whole-entry vector for the dormant path.
|
|
112
|
-
const { chunks, model } = await EntrySemantic.deriveEmbeddings(mimetypes, r.content, result.symbols ?? [], result.embedding, result.embeddingModel);
|
|
113
|
-
await EntrySemantic.indexEmbedding(db, r.entry_id, chunks, model);
|
|
114
|
-
await db.graph_set_deep_hash.run({ entry_id: r.entry_id, deep_hash: hash });
|
|
107
|
+
catch {
|
|
108
|
+
// A handler predating the references channel throws → metadata-only, clear graph.
|
|
109
|
+
result = await mimetypes.process({ content: r.content, hint: r.mimetype }, { channels: [] });
|
|
110
|
+
await EntryGraph.populateFrom(db, sessionId, r.entry_id, [], []);
|
|
115
111
|
}
|
|
116
112
|
}
|
|
117
113
|
else {
|
|
118
114
|
result = await mimetypes.process({ content: r.content, hint: r.mimetype }, { channels: [] });
|
|
115
|
+
await EntryGraph.populateFrom(db, sessionId, r.entry_id, [], []);
|
|
119
116
|
}
|
|
117
|
+
// The other two deep channels: re-index the body into entry_fts (~semantic's keyword
|
|
118
|
+
// half) and store the embedding vector(s) + model (the vector half). Empty/binary →
|
|
119
|
+
// cleared, not stored. result.embedding is the fallback whole-entry vector.
|
|
120
|
+
await EntrySemantic.indexFts(db, r.entry_id, r.content);
|
|
121
|
+
const { chunks, model } = await EntrySemantic.deriveEmbeddings(mimetypes, r.content, result.symbols ?? [], result.embedding, result.embeddingModel);
|
|
122
|
+
await EntrySemantic.indexEmbedding(db, r.entry_id, chunks, model);
|
|
123
|
+
await db.graph_set_deep_hash.run({ entry_id: r.entry_id, deep_hash: hash });
|
|
120
124
|
}
|
|
121
125
|
catch {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
await EntrySemantic.indexEmbedding(db, r.entry_id, [], undefined);
|
|
127
|
-
await db.graph_set_deep_hash.run({ entry_id: r.entry_id, deep_hash: createHash("sha256").update(r.content).update("\0").update(deepCfgSig).digest("hex") });
|
|
128
|
-
}
|
|
126
|
+
await EntryGraph.populateFrom(db, sessionId, r.entry_id, [], []);
|
|
127
|
+
await EntrySemantic.indexFts(db, r.entry_id, "");
|
|
128
|
+
await EntrySemantic.indexEmbedding(db, r.entry_id, [], undefined);
|
|
129
|
+
await db.graph_set_deep_hash.run({ entry_id: r.entry_id, deep_hash: hash });
|
|
129
130
|
}
|
|
130
|
-
// note 4 — key channels by addressable URI: the default channel by the bare entry
|
|
131
|
-
// path, a non-default by path#channel — so the model READs a channel without guessing.
|
|
132
|
-
const defaultCh = ctx.defaultChannelFor?.(r.scheme) ?? "body";
|
|
133
|
-
const channelKey = r.channel === defaultCh ? entry.path : `${entry.path}#${r.channel}`;
|
|
134
|
-
entry.channels[channelKey] = { mimetype: r.mimetype, tokens: tokenize(r.content), lines: result.totalLines };
|
|
135
131
|
}
|
|
136
|
-
return JSON.stringify([...byEntry.values()], null, 2);
|
|
137
132
|
}
|
|
138
133
|
}
|
|
139
134
|
//# sourceMappingURL=_entry-manifest.js.map
|