@gmickel/gno 2.15.0 → 2.17.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 -1
- package/assets/skill/SKILL.md +27 -0
- package/assets/skill/cli-reference.md +24 -15
- package/assets/spa-production.json.gz +0 -0
- package/browser-extension/artifacts/{gno-browser-clipper-v2.15.0.zip → gno-browser-clipper-v2.17.0.zip} +0 -0
- package/browser-extension/artifacts/gno-browser-clipper-v2.17.0.zip.sha256 +1 -0
- package/browser-extension/dist/manifest.json +1 -1
- package/package.json +1 -1
- package/spec/cli.md +43 -3
- package/spec/db/schema.sql +53 -1
- package/spec/mcp.md +9 -3
- package/spec/output-schemas/doctor.schema.json +27 -0
- package/spec/output-schemas/retrieval-trace-payloads.schema.json +14 -0
- package/spec/output-schemas/search-results.schema.json +14 -0
- package/spec/output-schemas/status.schema.json +22 -0
- package/src/cli/commands/agents/commands.ts +1 -1
- package/src/cli/commands/ask.ts +1 -1
- package/src/cli/commands/context-build.ts +1 -1
- package/src/cli/commands/doctor.ts +101 -29
- package/src/cli/commands/embed.ts +2 -2
- package/src/cli/commands/links.ts +30 -6
- package/src/cli/commands/mcp/install.ts +2 -2
- package/src/cli/commands/mcp/status.ts +1 -1
- package/src/cli/commands/mcp/uninstall.ts +1 -1
- package/src/cli/commands/query.ts +1 -1
- package/src/cli/commands/shared.ts +4 -4
- package/src/cli/commands/skill/install.ts +1 -1
- package/src/cli/commands/skill/paths-cmd.ts +1 -1
- package/src/cli/commands/skill/uninstall.ts +1 -1
- package/src/cli/commands/status.ts +75 -58
- package/src/cli/commands/vec.ts +180 -8
- package/src/cli/config-cache.ts +86 -0
- package/src/cli/globals.ts +64 -0
- package/src/cli/program.ts +63 -36
- package/src/cli/run.ts +121 -67
- package/src/cli/runtime-health.ts +132 -122
- package/src/cli/session-binding.ts +11 -2
- package/src/config/saver.ts +8 -0
- package/src/config/types.ts +6 -0
- package/src/converters/adapters/browser-export/formats.ts +25 -15
- package/src/converters/adapters/email/adapter.ts +37 -53
- package/src/converters/adapters/email/html.ts +37 -20
- package/src/converters/adapters/email/mime.ts +71 -39
- package/src/converters/adapters/ical/adapter.ts +20 -12
- package/src/converters/adapters/jsonl/adapter.ts +8 -6
- package/src/converters/adapters/shared/html-text.ts +55 -37
- package/src/converters/adapters/shared/ooxml-protection.ts +5 -13
- package/src/converters/adapters/shared/utf8-lines.ts +69 -31
- package/src/converters/adapters/transcript/adapter.ts +12 -7
- package/src/converters/adapters/xlsx/adapter.ts +10 -7
- package/src/converters/adapters/xlsx/sheet-markdown.ts +93 -50
- package/src/converters/canonicalize.ts +17 -3
- package/src/converters/native/markdown.ts +24 -17
- package/src/converters/native/plaintext.ts +5 -6
- package/src/converters/registry.ts +130 -8
- package/src/core/activation-status.ts +4 -8
- package/src/core/change-diff.ts +38 -11
- package/src/core/context-compiler.ts +17 -18
- package/src/core/context-evidence.ts +116 -25
- package/src/core/context-verifier.ts +70 -31
- package/src/core/file-lock.ts +10 -2
- package/src/core/graph-analysis.ts +3 -3
- package/src/core/link-inventory-markdown.ts +2 -2
- package/src/core/links.ts +20 -87
- package/src/core/memory-fence.ts +16 -9
- package/src/core/memory-recall.ts +168 -34
- package/src/core/path-rules.ts +143 -0
- package/src/core/retrieval-trace-session.ts +3 -0
- package/src/core/retrieval-trace.ts +9 -0
- package/src/core/section-parse.ts +16 -6
- package/src/core/typed-metadata.ts +68 -0
- package/src/core/vector-partition-status.ts +13 -0
- package/src/core/wiki-link-syntax.ts +88 -0
- package/src/embed/backlog.ts +142 -60
- package/src/embed/retry.ts +39 -33
- package/src/embed/variant-backlog.ts +582 -116
- package/src/embed/variant-retry.ts +157 -48
- package/src/index.ts +3 -3
- package/src/ingestion/budget-error-codes.ts +13 -0
- package/src/ingestion/chunker.ts +60 -49
- package/src/ingestion/compiled-context.ts +4 -5
- package/src/ingestion/convert-file.ts +1 -1
- package/src/ingestion/document-metadata.ts +16 -9
- package/src/ingestion/excluded-ranges.ts +97 -0
- package/src/ingestion/file-processor.ts +122 -37
- package/src/ingestion/frontmatter.ts +35 -7
- package/src/ingestion/graph-reconciliation.ts +187 -51
- package/src/ingestion/language.ts +66 -61
- package/src/ingestion/position.ts +5 -5
- package/src/ingestion/prepare-file.ts +50 -29
- package/src/ingestion/record-adapter-canonical.ts +37 -26
- package/src/ingestion/record-adapter.ts +46 -26
- package/src/ingestion/record-container.ts +121 -53
- package/src/ingestion/record-path.ts +5 -2
- package/src/ingestion/source-availability/darwin-io.ts +10 -7
- package/src/ingestion/source-availability/darwin-path.ts +21 -3
- package/src/ingestion/source-availability/readers.ts +51 -0
- package/src/ingestion/strip.ts +39 -105
- package/src/ingestion/sync.ts +692 -386
- package/src/ingestion/typed-metadata.ts +10 -4
- package/src/ingestion/walker.ts +485 -158
- package/src/llm/cache.ts +128 -84
- package/src/llm/http-inference.ts +112 -35
- package/src/llm/http-policy.ts +101 -0
- package/src/llm/httpEmbedding.ts +8 -1
- package/src/llm/httpGeneration.ts +5 -1
- package/src/llm/httpRerank.ts +5 -1
- package/src/llm/inference-scope.ts +15 -2
- package/src/llm/lazy-ports.ts +33 -3
- package/src/llm/lockfile.ts +34 -7
- package/src/llm/model-cleanup.ts +24 -0
- package/src/llm/native-worker/client.ts +23 -12
- package/src/llm/native-worker/dispatcher.ts +19 -9
- package/src/llm/native-worker/embedding-identity.ts +42 -16
- package/src/llm/native-worker/entry.ts +2 -1
- package/src/llm/native-worker/owner.ts +1 -0
- package/src/llm/native-worker/ports.ts +86 -23
- package/src/llm/native-worker/protocol.ts +386 -55
- package/src/llm/nodeLlamaCpp/adapter.ts +46 -29
- package/src/llm/nodeLlamaCpp/embedding.ts +93 -40
- package/src/llm/nodeLlamaCpp/generation.ts +194 -30
- package/src/llm/nodeLlamaCpp/lifecycle.ts +2 -0
- package/src/llm/nodeLlamaCpp/rerank-capacity.ts +101 -23
- package/src/llm/nodeLlamaCpp/rerank.ts +253 -44
- package/src/llm/types.ts +14 -0
- package/src/mcp/context.ts +342 -23
- package/src/mcp/http-transport.ts +21 -3
- package/src/mcp/tool-profile-types.ts +62 -0
- package/src/mcp/tool-profile.ts +32 -56
- package/src/mcp/tools/context.ts +5 -1
- package/src/mcp/tools/index.ts +269 -191
- package/src/mcp/tools/links.ts +14 -6
- package/src/mcp/tools/query.ts +60 -37
- package/src/mcp/tools/vsearch.ts +25 -14
- package/src/pipeline/answer.ts +133 -40
- package/src/pipeline/claim-verification.ts +293 -189
- package/src/pipeline/claim-verifier.ts +6 -7
- package/src/pipeline/egress-lineage.ts +37 -26
- package/src/pipeline/exclude.ts +34 -11
- package/src/pipeline/expansion.ts +233 -19
- package/src/pipeline/explain.ts +17 -2
- package/src/pipeline/filters.ts +169 -33
- package/src/pipeline/graph-retrieval.ts +117 -61
- package/src/pipeline/hybrid.ts +626 -330
- package/src/pipeline/hydration.ts +86 -24
- package/src/pipeline/intent.ts +15 -7
- package/src/pipeline/owner-fusion.ts +61 -19
- package/src/pipeline/query-language.ts +15 -2
- package/src/pipeline/rerank.ts +15 -22
- package/src/pipeline/search.ts +193 -72
- package/src/pipeline/snippet.ts +15 -2
- package/src/pipeline/temporal.ts +51 -10
- package/src/pipeline/types.ts +7 -0
- package/src/pipeline/vsearch.ts +269 -154
- package/src/publish/attachment-raster.ts +2 -16
- package/src/publish/encrypted-export.ts +15 -5
- package/src/serve/browse-tree.ts +50 -42
- package/src/serve/connectors.ts +2 -1
- package/src/serve/context.ts +13 -4
- package/src/serve/doc-events.ts +3 -0
- package/src/serve/public/app.tsx +49 -21
- package/src/serve/public/components/BrowseTreeSidebar.tsx +163 -23
- package/src/serve/public/components/CaptureModal.tsx +14 -10
- package/src/serve/public/components/ai-elements/code-block.tsx +87 -50
- package/src/serve/public/components/editor/MarkdownPreview.tsx +99 -67
- package/src/serve/public/globals.built.css +1 -1
- package/src/serve/public/globals.css +19 -0
- package/src/serve/public/hooks/useCaptureModal.tsx +23 -10
- package/src/serve/public/lib/metadata-filter.ts +234 -9
- package/src/serve/public/pages/Browse.tsx +61 -27
- package/src/serve/public/pages/DocView.tsx +44 -25
- package/src/serve/public/pages/GraphView.tsx +8 -3
- package/src/serve/resident-runtime.ts +199 -48
- package/src/serve/routes/api.ts +98 -67
- package/src/serve/routes/links.ts +25 -5
- package/src/serve/server.ts +1370 -1180
- package/src/serve/spa-bundle-source.ts +52 -27
- package/src/serve/status.ts +101 -52
- package/src/serve/watch-reconciliation-fallback.ts +11 -7
- package/src/serve/watch-reconciliation-shared.ts +42 -4
- package/src/serve/watch-reconciliation.ts +21 -8
- package/src/serve/watch-service-events.ts +7 -1
- package/src/serve/watch-service-hosts.ts +3 -1
- package/src/serve/watch-service.ts +46 -21
- package/src/serve/watch-snapshot-scan.ts +6 -15
- package/src/sessions/archive.ts +20 -8
- package/src/sessions/sanitize.ts +38 -18
- package/src/sessions/service.ts +180 -102
- package/src/store/migrations/037-performance-indexes.ts +56 -0
- package/src/store/migrations/038-vector-mirror-null-cosine.ts +47 -0
- package/src/store/migrations/039-vector-mirror-v2.ts +94 -0
- package/src/store/migrations/index.ts +6 -0
- package/src/store/sqlite/adapter.ts +1260 -651
- package/src/store/sqlite/chunking-policy.ts +15 -1
- package/src/store/sqlite/eligibility.ts +110 -70
- package/src/store/sqlite/graph-neighbors.ts +71 -46
- package/src/store/sqlite/graph-reference-state.ts +27 -3
- package/src/store/sqlite/graph-similarity.ts +59 -12
- package/src/store/sqlite/metadata-predicate.ts +123 -28
- package/src/store/sqlite/retrieval-trace-management-store.ts +126 -33
- package/src/store/sqlite/retrieval-trace-retention.ts +88 -76
- package/src/store/sqlite/retrieval-trace-rows.ts +7 -3
- package/src/store/types.ts +32 -0
- package/src/store/vector/coarse-router.ts +312 -0
- package/src/store/vector/eligibility.ts +39 -0
- package/src/store/vector/lazy.ts +17 -0
- package/src/store/vector/partition-index.ts +333 -59
- package/src/store/vector/proof-cache.ts +209 -0
- package/src/store/vector/runtime-compat.ts +6 -0
- package/src/store/vector/sqlite-vec.ts +270 -162
- package/src/store/vector/stats.ts +37 -73
- package/src/store/vector/status.ts +169 -53
- package/src/store/vector/stored-vectors.ts +131 -45
- package/src/store/vector/types.ts +19 -0
- package/src/store/vector/v2-mirror.ts +669 -0
- package/src/store/vector/variant-search.ts +1187 -111
- package/src/store/vector/variants.ts +964 -160
- package/browser-extension/artifacts/gno-browser-clipper-v2.15.0.zip.sha256 +0 -1
package/src/ingestion/strip.ts
CHANGED
|
@@ -34,25 +34,19 @@ import { gfmFootnote } from "micromark-extension-gfm-footnote";
|
|
|
34
34
|
import { gfmStrikethrough } from "micromark-extension-gfm-strikethrough";
|
|
35
35
|
import { gfmTaskListItem } from "micromark-extension-gfm-task-list-item";
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
import {
|
|
38
|
+
type ExcludedRange,
|
|
39
|
+
type ExcludedRangeKind,
|
|
40
|
+
isExcluded,
|
|
41
|
+
rangeIntersectsExcluded,
|
|
42
|
+
} from "./excluded-ranges";
|
|
40
43
|
|
|
41
|
-
export
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
export interface ExcludedRange {
|
|
49
|
-
/** String offset in original string (inclusive, UTF-16 code unit index) */
|
|
50
|
-
start: number;
|
|
51
|
-
/** String offset in original string (exclusive, UTF-16 code unit index) */
|
|
52
|
-
end: number;
|
|
53
|
-
/** Type of excluded region */
|
|
54
|
-
kind: ExcludedRangeKind;
|
|
55
|
-
}
|
|
44
|
+
export {
|
|
45
|
+
type ExcludedRange,
|
|
46
|
+
type ExcludedRangeKind,
|
|
47
|
+
isExcluded,
|
|
48
|
+
rangeIntersectsExcluded,
|
|
49
|
+
};
|
|
56
50
|
|
|
57
51
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
58
52
|
// Regex Patterns
|
|
@@ -69,8 +63,6 @@ const FRONTMATTER_REGEX = /^---\r?\n[\s\S]*?(?:\r?\n)?---(?:\r?\n|$)/;
|
|
|
69
63
|
*/
|
|
70
64
|
export const MAX_PARSED_TABLE_CELLS = 5000;
|
|
71
65
|
|
|
72
|
-
/** Backtick (code span or fence) or tilde fence anywhere in the text. */
|
|
73
|
-
const INLINE_OR_FENCE_TRIGGER_REGEX = /`|~~~/;
|
|
74
66
|
/** Blockquote markers and indentation before a line's content. */
|
|
75
67
|
const CONTAINER_PREFIX_REGEX = /^[\t >]*/;
|
|
76
68
|
/** Four columns of indentation after any blockquote markers. */
|
|
@@ -88,11 +80,24 @@ const BLOCK_END_LINE_REGEX =
|
|
|
88
80
|
* line that can open an indented code block (not a list continuation). When
|
|
89
81
|
* it fails the note has no code and the parser is skipped.
|
|
90
82
|
*/
|
|
91
|
-
const mayContainCode = (markdown: string): boolean => {
|
|
92
|
-
if (
|
|
83
|
+
const mayContainCode = (markdown: string, startOffset = 0): boolean => {
|
|
84
|
+
if (
|
|
85
|
+
markdown.indexOf("`", startOffset) !== -1 ||
|
|
86
|
+
markdown.indexOf("~~~", startOffset) !== -1
|
|
87
|
+
) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
93
90
|
let previous: string | null = null;
|
|
94
|
-
|
|
95
|
-
|
|
91
|
+
let lineStart = startOffset;
|
|
92
|
+
const len = markdown.length;
|
|
93
|
+
while (lineStart <= len) {
|
|
94
|
+
const nl = markdown.indexOf("\n", lineStart);
|
|
95
|
+
const rawEnd = nl === -1 ? len : nl;
|
|
96
|
+
const lineEnd =
|
|
97
|
+
rawEnd > lineStart && markdown.charCodeAt(rawEnd - 1) === 13
|
|
98
|
+
? rawEnd - 1
|
|
99
|
+
: rawEnd;
|
|
100
|
+
const line = markdown.slice(lineStart, lineEnd);
|
|
96
101
|
const content = line.replace(CONTAINER_PREFIX_REGEX, "");
|
|
97
102
|
if (
|
|
98
103
|
content !== "" &&
|
|
@@ -104,6 +109,8 @@ const mayContainCode = (markdown: string): boolean => {
|
|
|
104
109
|
return true;
|
|
105
110
|
}
|
|
106
111
|
previous = content;
|
|
112
|
+
if (nl === -1) break;
|
|
113
|
+
lineStart = nl + 1;
|
|
107
114
|
}
|
|
108
115
|
return false;
|
|
109
116
|
};
|
|
@@ -167,6 +174,12 @@ const GFM_WITHOUT_TABLES = {
|
|
|
167
174
|
],
|
|
168
175
|
};
|
|
169
176
|
|
|
177
|
+
/** GFM with tables, hoisted once at module load. */
|
|
178
|
+
const GFM_WITH_TABLES = {
|
|
179
|
+
extensions: [gfm()],
|
|
180
|
+
mdastExtensions: [gfmFromMarkdown()],
|
|
181
|
+
};
|
|
182
|
+
|
|
170
183
|
/** Opening fence at the start of a code node: backtick or tilde fence. */
|
|
171
184
|
const FENCE_START_REGEX = /^[\t ]*(?:`{3,}|~{3,})/;
|
|
172
185
|
|
|
@@ -193,9 +206,7 @@ const collectCodeRanges = (
|
|
|
193
206
|
: markdown;
|
|
194
207
|
const root = fromMarkdown(
|
|
195
208
|
source,
|
|
196
|
-
hasOversizedTable(source)
|
|
197
|
-
? GFM_WITHOUT_TABLES
|
|
198
|
-
: { extensions: [gfm()], mdastExtensions: [gfmFromMarkdown()] }
|
|
209
|
+
hasOversizedTable(source) ? GFM_WITHOUT_TABLES : GFM_WITH_TABLES
|
|
199
210
|
) as CodeNode;
|
|
200
211
|
const ranges: ExcludedRange[] = [];
|
|
201
212
|
const visit = (node: CodeNode): void => {
|
|
@@ -258,7 +269,7 @@ export function getExcludedRanges(markdown: string): ExcludedRange[] {
|
|
|
258
269
|
|
|
259
270
|
// 3. Code spans and fenced or indented code blocks, from the parser.
|
|
260
271
|
const frontmatterEnd = frontmatterMatch?.[0].length ?? 0;
|
|
261
|
-
if (mayContainCode(markdown
|
|
272
|
+
if (mayContainCode(markdown, frontmatterEnd)) {
|
|
262
273
|
ranges.push(...collectCodeRanges(markdown, frontmatterEnd));
|
|
263
274
|
}
|
|
264
275
|
|
|
@@ -267,80 +278,3 @@ export function getExcludedRanges(markdown: string): ExcludedRange[] {
|
|
|
267
278
|
|
|
268
279
|
return ranges;
|
|
269
280
|
}
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Check if an offset is inside any excluded range.
|
|
273
|
-
* Uses binary search for O(log N) lookup.
|
|
274
|
-
*/
|
|
275
|
-
export function isExcluded(
|
|
276
|
-
offset: number,
|
|
277
|
-
excludedRanges: ExcludedRange[]
|
|
278
|
-
): boolean {
|
|
279
|
-
if (excludedRanges.length === 0) return false;
|
|
280
|
-
|
|
281
|
-
// Binary search for the range that could contain offset
|
|
282
|
-
let left = 0;
|
|
283
|
-
let right = excludedRanges.length - 1;
|
|
284
|
-
|
|
285
|
-
while (left <= right) {
|
|
286
|
-
const mid = Math.floor((left + right) / 2);
|
|
287
|
-
const range = excludedRanges[mid];
|
|
288
|
-
if (range === undefined) return false;
|
|
289
|
-
|
|
290
|
-
if (offset < range.start) {
|
|
291
|
-
right = mid - 1;
|
|
292
|
-
} else if (offset >= range.end) {
|
|
293
|
-
left = mid + 1;
|
|
294
|
-
} else {
|
|
295
|
-
// offset is in [start, end)
|
|
296
|
-
return true;
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
return false;
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* Largest `end` among each prefix of a start-sorted range list, built once
|
|
305
|
-
* per list. Ranges can overlap (a comment around a code span), so a range
|
|
306
|
-
* list's ends are not sorted and the prefix maximum stands in for them.
|
|
307
|
-
*/
|
|
308
|
-
const prefixMaxEnds = new WeakMap<readonly ExcludedRange[], Int32Array>();
|
|
309
|
-
|
|
310
|
-
const getPrefixMaxEnds = (ranges: readonly ExcludedRange[]): Int32Array => {
|
|
311
|
-
let maxEnds = prefixMaxEnds.get(ranges);
|
|
312
|
-
if (maxEnds?.length !== ranges.length) {
|
|
313
|
-
maxEnds = new Int32Array(ranges.length);
|
|
314
|
-
let maxEnd = -1;
|
|
315
|
-
for (const [index, range] of ranges.entries()) {
|
|
316
|
-
maxEnd = Math.max(maxEnd, range.end);
|
|
317
|
-
maxEnds[index] = maxEnd;
|
|
318
|
-
}
|
|
319
|
-
prefixMaxEnds.set(ranges, maxEnds);
|
|
320
|
-
}
|
|
321
|
-
return maxEnds;
|
|
322
|
-
};
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
* Check if a range [start, end) intersects any excluded range.
|
|
326
|
-
* More precise than isExcluded for multi-character matches. Ranges must be
|
|
327
|
-
* sorted by start, as getExcludedRanges returns them; one lookup is a binary
|
|
328
|
-
* search, so checking every link of a large note stays linear.
|
|
329
|
-
*/
|
|
330
|
-
export function rangeIntersectsExcluded(
|
|
331
|
-
start: number,
|
|
332
|
-
end: number,
|
|
333
|
-
excludedRanges: readonly ExcludedRange[]
|
|
334
|
-
): boolean {
|
|
335
|
-
// Ranges starting before `end` form a prefix; one of them intersects
|
|
336
|
-
// [start, end) exactly when the largest end among them passes `start`.
|
|
337
|
-
let low = 0;
|
|
338
|
-
let high = excludedRanges.length;
|
|
339
|
-
while (low < high) {
|
|
340
|
-
const mid = (low + high) >>> 1;
|
|
341
|
-
if ((excludedRanges[mid]?.start ?? end) < end) low = mid + 1;
|
|
342
|
-
else high = mid;
|
|
343
|
-
}
|
|
344
|
-
if (low === 0) return false;
|
|
345
|
-
return (getPrefixMaxEnds(excludedRanges)[low - 1] ?? -1) > start;
|
|
346
|
-
}
|