llmtxt 2026.4.1 → 2026.4.4
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 +55 -0
- package/LICENSE +0 -0
- package/README.md +24 -0
- package/dist/cache.d.ts +0 -0
- package/dist/cache.d.ts.map +0 -0
- package/dist/cache.js +0 -0
- package/dist/cache.js.map +0 -0
- package/dist/client.d.ts +0 -0
- package/dist/client.d.ts.map +0 -0
- package/dist/client.js +0 -0
- package/dist/client.js.map +0 -0
- package/dist/compression.d.ts +2 -2
- package/dist/compression.d.ts.map +1 -1
- package/dist/compression.js +1 -1
- package/dist/compression.js.map +1 -1
- package/dist/disclosure.d.ts +11 -131
- package/dist/disclosure.d.ts.map +1 -1
- package/dist/disclosure.js +10 -525
- package/dist/disclosure.js.map +1 -1
- package/dist/graph.d.ts +6 -70
- package/dist/graph.d.ts.map +1 -1
- package/dist/graph.js +5 -131
- package/dist/graph.js.map +1 -1
- package/dist/index.d.ts +30 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +37 -6
- package/dist/index.js.map +1 -1
- package/dist/merge.d.ts +9 -0
- package/dist/merge.d.ts.map +1 -0
- package/dist/merge.js +8 -0
- package/dist/merge.js.map +1 -0
- package/dist/patch.d.ts +2 -0
- package/dist/patch.d.ts.map +1 -1
- package/dist/patch.js +1 -0
- package/dist/patch.js.map +1 -1
- package/dist/schemas.d.ts +12 -12
- package/dist/schemas.d.ts.map +0 -0
- package/dist/schemas.js +0 -0
- package/dist/schemas.js.map +0 -0
- package/dist/sdk/attribution.d.ts +0 -0
- package/dist/sdk/attribution.d.ts.map +0 -0
- package/dist/sdk/attribution.js +0 -0
- package/dist/sdk/attribution.js.map +0 -0
- package/dist/sdk/consensus.d.ts +0 -0
- package/dist/sdk/consensus.d.ts.map +0 -0
- package/dist/sdk/consensus.js +0 -0
- package/dist/sdk/consensus.js.map +0 -0
- package/dist/sdk/document.d.ts +0 -0
- package/dist/sdk/document.d.ts.map +0 -0
- package/dist/sdk/document.js +0 -0
- package/dist/sdk/document.js.map +0 -0
- package/dist/sdk/index.d.ts +0 -0
- package/dist/sdk/index.d.ts.map +0 -0
- package/dist/sdk/index.js +0 -0
- package/dist/sdk/index.js.map +0 -0
- package/dist/sdk/lifecycle.d.ts +0 -0
- package/dist/sdk/lifecycle.d.ts.map +0 -0
- package/dist/sdk/lifecycle.js +0 -0
- package/dist/sdk/lifecycle.js.map +0 -0
- package/dist/sdk/retrieval.d.ts +0 -0
- package/dist/sdk/retrieval.d.ts.map +0 -0
- package/dist/sdk/retrieval.js +0 -0
- package/dist/sdk/retrieval.js.map +0 -0
- package/dist/sdk/storage-adapter.d.ts +0 -0
- package/dist/sdk/storage-adapter.d.ts.map +0 -0
- package/dist/sdk/storage-adapter.js +0 -0
- package/dist/sdk/storage-adapter.js.map +0 -0
- package/dist/sdk/storage.d.ts +0 -0
- package/dist/sdk/storage.d.ts.map +0 -0
- package/dist/sdk/storage.js +0 -0
- package/dist/sdk/storage.js.map +0 -0
- package/dist/sdk/versions.d.ts +0 -0
- package/dist/sdk/versions.d.ts.map +0 -0
- package/dist/sdk/versions.js +0 -0
- package/dist/sdk/versions.js.map +0 -0
- package/dist/signed-url.d.ts +0 -0
- package/dist/signed-url.d.ts.map +0 -0
- package/dist/signed-url.js +0 -0
- package/dist/signed-url.js.map +0 -0
- package/dist/similarity.d.ts +10 -51
- package/dist/similarity.d.ts.map +1 -1
- package/dist/similarity.js +10 -128
- package/dist/similarity.js.map +1 -1
- package/dist/snapshot.d.ts +0 -0
- package/dist/snapshot.d.ts.map +0 -0
- package/dist/snapshot.js +0 -0
- package/dist/snapshot.js.map +0 -0
- package/dist/types.d.ts +129 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +87 -1
- package/dist/types.js.map +1 -1
- package/dist/validation.d.ts +5 -2
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +12 -51
- package/dist/validation.js.map +1 -1
- package/dist/wasm.d.ts +565 -0
- package/dist/wasm.d.ts.map +1 -1
- package/dist/wasm.js +515 -0
- package/dist/wasm.js.map +1 -1
- package/package.json +11 -11
- package/wasm/LICENSE +0 -0
- package/wasm/README.md +0 -0
- package/wasm/llmtxt_core.d.ts +382 -1
- package/wasm/llmtxt_core.js +1166 -124
- package/wasm/llmtxt_core_bg.wasm +0 -0
- package/wasm/llmtxt_core_bg.wasm.d.ts +61 -20
- package/wasm/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,61 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2026.4.3] - 2026-04-13
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **multi-diff**: `multiWayDiff()` — LCS-aligned N-way comparison across up to 5 versions with per-line consensus, divergence, and insertion detection. WASM-backed via `multi_way_diff_wasm`
|
|
14
|
+
- **merge**: `cherryPickMerge()` — section-based cherry-pick merge from multiple versions. Heading-keyed claims, fill-from for unclaimed sections, provenance tracking. WASM-backed via `cherry_pick_merge_wasm`
|
|
15
|
+
- **types**: `MultiDiffResult`, `MultiDiffLine`, `MultiDiffVariant`, `MultiDiffStats`, `CherryPickResult`, `CherryPickProvenance`, `CherryPickStats` interfaces
|
|
16
|
+
- **types**: `"insertion"` line type added to `MultiDiffLine.type` union
|
|
17
|
+
- **backend**: `GET /documents/:slug/multi-diff?versions=2,3,4,5` — multi-version comparison endpoint
|
|
18
|
+
- **backend**: `POST /documents/:slug/merge` — cherry-pick merge endpoint with provenance in changelog
|
|
19
|
+
- **backend**: `agentId` alias accepted on PUT and POST /compress (maps to `createdBy`)
|
|
20
|
+
- **backend**: `targetState` alias accepted on POST /transition (maps to `state`)
|
|
21
|
+
- **backend**: HTTP 423 Locked response on PUT/merge/patch for LOCKED and ARCHIVED documents
|
|
22
|
+
- **backend**: `requireOwnerAllowAnon` middleware — anonymous doc owners can create signed URLs and transition state
|
|
23
|
+
- **backend**: Concurrent version creation wrapped in `BEGIN IMMEDIATE` transactions with retry on UNIQUE violation
|
|
24
|
+
- **backend**: Duplicate approval/rejection prevention (409 Conflict on second attempt from same reviewer)
|
|
25
|
+
- **backend**: Rejections cleared on REVIEW to DRAFT transition for fresh review cycles
|
|
26
|
+
- **backend**: autoLock race protection with atomic `WHERE state=REVIEW` check
|
|
27
|
+
- **frontend**: `MultiDiffViewer` component — version selector, consensus visualization, expandable divergent variants, insertion line rendering
|
|
28
|
+
- **frontend**: `MergeBuilder` component — cherry-pick merge UI with preview, provenance colors, inline validation
|
|
29
|
+
- **frontend**: Version selector dropdown on Content tab with "Version N of M" indicator
|
|
30
|
+
- **frontend**: Token stats clearly label original vs compressed counts
|
|
31
|
+
- **frontend**: Favicons, OG meta tags, Twitter cards, per-page dynamic OG tags
|
|
32
|
+
- **infra**: Cloudflare Configuration Rule bypassing bot detection for api.llmtxt.my
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
- **backend**: Anonymous sessions can now use lifecycle transitions, approvals, rejections, patches, and signed URL creation
|
|
36
|
+
- **backend**: Merge provenance `fromVersion` uses actual DB version numbers instead of 0-based indices
|
|
37
|
+
- **backend**: Similarity results use `title` field instead of `sectionTitle` (consistent with overview/plan-retrieval)
|
|
38
|
+
- **frontend**: Renamed `state` variable to `docState` to avoid Svelte 5 `$state` rune collision (77 svelte-check errors resolved)
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
- Multi-diff false divergence when versions have line insertions/deletions (LCS alignment rewrite)
|
|
42
|
+
- Cherry-pick merge false "Overlapping line ranges" error on multi-version section merge
|
|
43
|
+
- Cherry-pick merge section duplication with hierarchical headings
|
|
44
|
+
- Concurrent version creation race condition (transaction + retry)
|
|
45
|
+
- HTTP 500 from async transaction callbacks in better-sqlite3 (switched to synchronous)
|
|
46
|
+
- Rejection permanently blocking consensus (now cleared on REVIEW to DRAFT)
|
|
47
|
+
- autoLock creating duplicate state transition records on simultaneous approvals
|
|
48
|
+
- LOCKED documents accepting write operations
|
|
49
|
+
|
|
50
|
+
## [2026.4.2] - 2026-04-01
|
|
51
|
+
|
|
52
|
+
### Added
|
|
53
|
+
- **diff**: `structuredDiff()` — WASM-backed structured line-level diff returning interleaved `{type, content, oldLine, newLine}` lines with summary counts. Replaces client-side patch parsing and backend set-based diff computation
|
|
54
|
+
- **types**: `StructuredDiffLine` and `StructuredDiffResult` interfaces exported from `llmtxt`
|
|
55
|
+
|
|
56
|
+
### Changed
|
|
57
|
+
- **diff**: Backend `/documents/:slug/diff` endpoint now returns `lines` array (structured diff) instead of `addedLines`/`removedLines` string arrays
|
|
58
|
+
- **diff**: Frontend `DiffViewer` consumes structured diff lines directly from API — no more client-side unified diff parsing
|
|
59
|
+
- **backend**: PUT `/documents/:slug` now upserts contributor records with accurate token stats via `structuredDiff()`
|
|
60
|
+
- **frontend**: `Contributor` type aligned to actual DB schema fields (`agentId`, `versionsAuthored`, `lastContribution`)
|
|
61
|
+
- **frontend**: Version list redesigned as compact table rows with columns for version, changelog, tokens, contributor, and date
|
|
62
|
+
- **frontend**: Side-by-side comparison view now highlights added/removed lines vs base version
|
|
63
|
+
- **frontend**: Edit page uses `invalidateAll()` before navigation to prevent stale data
|
|
64
|
+
|
|
10
65
|
## [2026.4.1] - 2026-03-31
|
|
11
66
|
|
|
12
67
|
### Added
|
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@ npm install llmtxt
|
|
|
17
17
|
import {
|
|
18
18
|
compress, decompress, generateId, hashContent,
|
|
19
19
|
createPatch, applyPatch, generateSignedUrl,
|
|
20
|
+
multiWayDiff, cherryPickMerge,
|
|
20
21
|
} from 'llmtxt';
|
|
21
22
|
|
|
22
23
|
const compressed = await compress('Hello world');
|
|
@@ -28,6 +29,27 @@ const patch = createPatch('hello\n', 'hello world\n');
|
|
|
28
29
|
const rebuilt = applyPatch('hello\n', patch);
|
|
29
30
|
```
|
|
30
31
|
|
|
32
|
+
## Multi-Way Diff and Cherry-Pick Merge
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { multiWayDiff, cherryPickMerge } from 'llmtxt';
|
|
36
|
+
|
|
37
|
+
// Compare multiple agent versions against a base using LCS alignment
|
|
38
|
+
const diff = multiWayDiff(base, JSON.stringify([v2Content, v3Content, v4Content]));
|
|
39
|
+
// Returns MultiDiffResult: { sections, totalVersions, baseTokenCount }
|
|
40
|
+
|
|
41
|
+
// Selectively merge sections from different versions
|
|
42
|
+
const merged = cherryPickMerge(
|
|
43
|
+
base,
|
|
44
|
+
JSON.stringify([v2Content, v3Content]),
|
|
45
|
+
JSON.stringify([
|
|
46
|
+
{ section: 'Introduction', fromVersion: 1 },
|
|
47
|
+
{ section: 'API Reference', fromVersion: 2 },
|
|
48
|
+
])
|
|
49
|
+
);
|
|
50
|
+
// Returns CherryPickResult: { content, provenance, stats }
|
|
51
|
+
```
|
|
52
|
+
|
|
31
53
|
## SDK (Collaborative Documents)
|
|
32
54
|
|
|
33
55
|
```ts
|
|
@@ -50,6 +72,8 @@ import { buildGraph } from 'llmtxt/graph';
|
|
|
50
72
|
- Compression, hashing, base62, token estimation (Rust WASM)
|
|
51
73
|
- Signed URL generation and verification
|
|
52
74
|
- Unified diff patch creation, application, version reconstruction
|
|
75
|
+
- Multi-way diff across up to 5 agent versions (LCS-aligned, WASM)
|
|
76
|
+
- Cherry-pick merge: selectively assemble sections from multiple versions (WASM)
|
|
53
77
|
- Progressive disclosure: overview, section extraction, content search
|
|
54
78
|
- Collaborative document lifecycle (DRAFT, REVIEW, LOCKED, ARCHIVED)
|
|
55
79
|
- Version stack management with attribution tracking
|
package/dist/cache.d.ts
CHANGED
|
File without changes
|
package/dist/cache.d.ts.map
CHANGED
|
File without changes
|
package/dist/cache.js
CHANGED
|
File without changes
|
package/dist/cache.js.map
CHANGED
|
File without changes
|
package/dist/client.d.ts
CHANGED
|
File without changes
|
package/dist/client.d.ts.map
CHANGED
|
File without changes
|
package/dist/client.js
CHANGED
|
File without changes
|
package/dist/client.js.map
CHANGED
|
File without changes
|
package/dist/compression.d.ts
CHANGED
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* All portable primitives delegate to the Rust WASM module — single
|
|
5
5
|
* source of truth, zero drift between TypeScript and Rust consumers.
|
|
6
6
|
*/
|
|
7
|
-
export { encodeBase62, decodeBase62, compress, decompress, generateId, hashContent, calculateTokens, calculateCompressionRatio, computeDiff, } from './wasm.js';
|
|
8
|
-
export type { DiffResult } from './wasm.js';
|
|
7
|
+
export { encodeBase62, decodeBase62, compress, decompress, generateId, hashContent, calculateTokens, calculateCompressionRatio, computeDiff, structuredDiff, } from './wasm.js';
|
|
8
|
+
export type { DiffResult, StructuredDiffLine, StructuredDiffResult } from './wasm.js';
|
|
9
9
|
//# sourceMappingURL=compression.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compression.d.ts","sourceRoot":"","sources":["../src/compression.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,UAAU,EACV,WAAW,EACX,eAAe,EACf,yBAAyB,EACzB,WAAW,
|
|
1
|
+
{"version":3,"file":"compression.d.ts","sourceRoot":"","sources":["../src/compression.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,UAAU,EACV,WAAW,EACX,eAAe,EACf,yBAAyB,EACzB,WAAW,EACX,cAAc,GACf,MAAM,WAAW,CAAC;AAEnB,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/compression.js
CHANGED
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* All portable primitives delegate to the Rust WASM module — single
|
|
5
5
|
* source of truth, zero drift between TypeScript and Rust consumers.
|
|
6
6
|
*/
|
|
7
|
-
export { encodeBase62, decodeBase62, compress, decompress, generateId, hashContent, calculateTokens, calculateCompressionRatio, computeDiff, } from './wasm.js';
|
|
7
|
+
export { encodeBase62, decodeBase62, compress, decompress, generateId, hashContent, calculateTokens, calculateCompressionRatio, computeDiff, structuredDiff, } from './wasm.js';
|
|
8
8
|
//# sourceMappingURL=compression.js.map
|
package/dist/compression.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compression.js","sourceRoot":"","sources":["../src/compression.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,UAAU,EACV,WAAW,EACX,eAAe,EACf,yBAAyB,EACzB,WAAW,
|
|
1
|
+
{"version":3,"file":"compression.js","sourceRoot":"","sources":["../src/compression.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,UAAU,EACV,WAAW,EACX,eAAe,EACf,yBAAyB,EACzB,WAAW,EACX,cAAc,GACf,MAAM,WAAW,CAAC"}
|
package/dist/disclosure.d.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Progressive disclosure: structural analysis, section extraction,
|
|
3
|
+
* line-range access, content search, and JSONPath queries.
|
|
4
|
+
*
|
|
5
|
+
* All logic now lives in `crates/llmtxt-core::disclosure` (Rust/WASM).
|
|
6
|
+
* This module is a thin TypeScript wrapper that delegates to the WASM
|
|
7
|
+
* entry-points via `wasm.ts`.
|
|
8
|
+
*
|
|
9
|
+
* @see {@link https://github.com/kryptobaseddev/llmtxt/tree/main/crates/llmtxt-core/src/disclosure}
|
|
10
|
+
*/
|
|
1
11
|
/**
|
|
2
12
|
* A logical section identified within a document.
|
|
3
13
|
*
|
|
@@ -81,135 +91,5 @@ export interface LineRangeResult {
|
|
|
81
91
|
/** Number of tokens saved by extracting only this range. */
|
|
82
92
|
tokensSaved: number;
|
|
83
93
|
}
|
|
84
|
-
|
|
85
|
-
* Extract a range of lines from a document, returning content and token statistics.
|
|
86
|
-
*
|
|
87
|
-
* @remarks
|
|
88
|
-
* Line numbers are 1-based and clamped to the document boundaries. This
|
|
89
|
-
* enables agents to request only the portion of a document they need,
|
|
90
|
-
* reducing token consumption.
|
|
91
|
-
*
|
|
92
|
-
* @param content - The full document content.
|
|
93
|
-
* @param start - The 1-based starting line number.
|
|
94
|
-
* @param end - The 1-based ending line number (inclusive).
|
|
95
|
-
* @returns A {@link LineRangeResult} with the extracted content and token savings.
|
|
96
|
-
*
|
|
97
|
-
* @example
|
|
98
|
-
* ```ts
|
|
99
|
-
* const range = getLineRange(doc, 10, 25);
|
|
100
|
-
* console.log(`Saved ${range.tokensSaved} tokens`);
|
|
101
|
-
* ```
|
|
102
|
-
*/
|
|
103
|
-
export declare function getLineRange(content: string, start: number, end: number): LineRangeResult;
|
|
104
|
-
/**
|
|
105
|
-
* Search document content for lines matching a query string or regex.
|
|
106
|
-
*
|
|
107
|
-
* @remarks
|
|
108
|
-
* Supports plain-text substring matching (case-insensitive) and regex
|
|
109
|
-
* patterns delimited with slashes (e.g. `/pattern/i`). Results include
|
|
110
|
-
* configurable surrounding context lines to help agents understand each
|
|
111
|
-
* match in context.
|
|
112
|
-
*
|
|
113
|
-
* @param content - The full document content to search.
|
|
114
|
-
* @param query - A plain-text substring or `/regex/flags` pattern.
|
|
115
|
-
* @param contextLines - Number of context lines before and after each match (default: 2).
|
|
116
|
-
* @param maxResults - Maximum number of matches to return (default: 20).
|
|
117
|
-
* @returns An array of {@link SearchResult} objects for each matching line.
|
|
118
|
-
*
|
|
119
|
-
* @example
|
|
120
|
-
* ```ts
|
|
121
|
-
* const hits = searchContent(doc, 'TODO', 3, 10);
|
|
122
|
-
* ```
|
|
123
|
-
*/
|
|
124
|
-
export declare function searchContent(content: string, query: string, contextLines?: number, maxResults?: number): SearchResult[];
|
|
125
|
-
/**
|
|
126
|
-
* Detect the structural format of a document using content heuristics.
|
|
127
|
-
*
|
|
128
|
-
* @remarks
|
|
129
|
-
* Applies the following precedence: JSON (valid `JSON.parse`), then
|
|
130
|
-
* markdown (2+ markdown signals such as headings, lists, or links), then
|
|
131
|
-
* code (2+ code signals such as `import`, `function`, or arrow syntax),
|
|
132
|
-
* and finally falls back to plain text.
|
|
133
|
-
*
|
|
134
|
-
* @param content - The document content to classify.
|
|
135
|
-
* @returns The detected format: `"json"`, `"markdown"`, `"code"`, or `"text"`.
|
|
136
|
-
*
|
|
137
|
-
* @example
|
|
138
|
-
* ```ts
|
|
139
|
-
* detectDocumentFormat('# Title\n- item'); // "markdown"
|
|
140
|
-
* ```
|
|
141
|
-
*/
|
|
142
|
-
export declare function detectDocumentFormat(content: string): 'json' | 'markdown' | 'code' | 'text';
|
|
143
|
-
/**
|
|
144
|
-
* Generate a structural overview of a document for progressive disclosure.
|
|
145
|
-
*
|
|
146
|
-
* @remarks
|
|
147
|
-
* Detects the document format, splits it into logical sections, computes
|
|
148
|
-
* token counts, and extracts format-specific metadata (JSON keys or
|
|
149
|
-
* markdown table of contents). The overview allows agents to decide
|
|
150
|
-
* which sections to request in full, minimizing total token usage.
|
|
151
|
-
*
|
|
152
|
-
* @param content - The full document content to analyze.
|
|
153
|
-
* @returns A {@link DocumentOverview} with format, sections, and token counts.
|
|
154
|
-
*
|
|
155
|
-
* @example
|
|
156
|
-
* ```ts
|
|
157
|
-
* const overview = generateOverview(markdownDoc);
|
|
158
|
-
* console.log(`${overview.sections.length} sections, ${overview.tokenCount} tokens`);
|
|
159
|
-
* ```
|
|
160
|
-
*/
|
|
161
|
-
export declare function generateOverview(content: string): DocumentOverview;
|
|
162
|
-
/**
|
|
163
|
-
* Execute a JSONPath-style query against JSON content.
|
|
164
|
-
*
|
|
165
|
-
* @remarks
|
|
166
|
-
* Parses the content as JSON and resolves the dot/bracket path (e.g.
|
|
167
|
-
* `$.messages[0].content` or `data.items`). Supports wildcard (`*`) for
|
|
168
|
-
* arrays and objects. Throws on invalid JSON or missing keys to provide
|
|
169
|
-
* clear error messages to calling agents.
|
|
170
|
-
*
|
|
171
|
-
* @param content - A valid JSON string to query.
|
|
172
|
-
* @param path - A JSONPath expression (e.g. `"$.key"`, `"items[0].name"`).
|
|
173
|
-
* @returns An object containing the resolved `result`, its `tokenCount`, and the original `path`.
|
|
174
|
-
* @throws Error if the JSON is invalid or the path cannot be resolved.
|
|
175
|
-
*
|
|
176
|
-
* @example
|
|
177
|
-
* ```ts
|
|
178
|
-
* const { result } = queryJsonPath('{"a":{"b":42}}', '$.a.b');
|
|
179
|
-
* // result === 42
|
|
180
|
-
* ```
|
|
181
|
-
*/
|
|
182
|
-
export declare function queryJsonPath(content: string, path: string): {
|
|
183
|
-
result: unknown;
|
|
184
|
-
tokenCount: number;
|
|
185
|
-
path: string;
|
|
186
|
-
};
|
|
187
|
-
/**
|
|
188
|
-
* Extract a named section from a document by title.
|
|
189
|
-
*
|
|
190
|
-
* @remarks
|
|
191
|
-
* Searches the document's sections (from {@link generateOverview}) for a
|
|
192
|
-
* matching title using progressively looser comparisons: exact match,
|
|
193
|
-
* substring match, and alphanumeric-only substring match. When
|
|
194
|
-
* `depthAll` is `true`, child sections at deeper nesting levels are
|
|
195
|
-
* included in the extracted content.
|
|
196
|
-
*
|
|
197
|
-
* @param content - The full document content.
|
|
198
|
-
* @param sectionName - The section title (or substring) to search for.
|
|
199
|
-
* @param depthAll - When `true`, include all child sections nested under the match (default: `false`).
|
|
200
|
-
* @returns An object with the matched section, extracted content, and token savings, or `null` if not found.
|
|
201
|
-
*
|
|
202
|
-
* @example
|
|
203
|
-
* ```ts
|
|
204
|
-
* const section = getSection(doc, 'Installation', true);
|
|
205
|
-
* if (section) console.log(section.content);
|
|
206
|
-
* ```
|
|
207
|
-
*/
|
|
208
|
-
export declare function getSection(content: string, sectionName: string, depthAll?: boolean): {
|
|
209
|
-
section: Section;
|
|
210
|
-
content: string;
|
|
211
|
-
tokenCount: number;
|
|
212
|
-
totalTokens: number;
|
|
213
|
-
tokensSaved: number;
|
|
214
|
-
} | null;
|
|
94
|
+
export { detectDocumentFormat, generateOverview, getLineRange, searchContent, queryJsonPath, getSection, } from './wasm.js';
|
|
215
95
|
//# sourceMappingURL=disclosure.d.ts.map
|
package/dist/disclosure.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disclosure.d.ts","sourceRoot":"","sources":["../src/disclosure.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"disclosure.d.ts","sourceRoot":"","sources":["../src/disclosure.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH;;;;;;GAMG;AACH,MAAM,WAAW,OAAO;IACtB,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,oDAAoD;IACpD,SAAS,EAAE,MAAM,CAAC;IAClB,8DAA8D;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB,qDAAqD;IACrD,UAAU,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,IAAI,EAAE,SAAS,GAAG,UAAU,GAAG,YAAY,GAAG,UAAU,GAAG,OAAO,CAAC;CACpE;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,oCAAoC;IACpC,MAAM,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;IAC9C,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,2DAA2D;IAC3D,UAAU,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,4EAA4E;IAC5E,IAAI,CAAC,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7D,oEAAoE;IACpE,GAAG,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC7D;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,gDAAgD;IAChD,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,oEAAoE;IACpE,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB,+DAA+D;IAC/D,OAAO,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,UAAU,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,UAAU,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,WAAW,EAAE,MAAM,CAAC;IACpB,4DAA4D;IAC5D,WAAW,EAAE,MAAM,CAAC;CACrB;AAQD,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,UAAU,GACX,MAAM,WAAW,CAAC"}
|