llmtxt 2026.4.3 → 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.
Files changed (107) hide show
  1. package/CHANGELOG.md +0 -0
  2. package/LICENSE +0 -0
  3. package/README.md +0 -0
  4. package/dist/cache.d.ts +0 -0
  5. package/dist/cache.d.ts.map +0 -0
  6. package/dist/cache.js +0 -0
  7. package/dist/cache.js.map +0 -0
  8. package/dist/client.d.ts +0 -0
  9. package/dist/client.d.ts.map +0 -0
  10. package/dist/client.js +0 -0
  11. package/dist/client.js.map +0 -0
  12. package/dist/compression.d.ts +0 -0
  13. package/dist/compression.d.ts.map +0 -0
  14. package/dist/compression.js +0 -0
  15. package/dist/compression.js.map +0 -0
  16. package/dist/disclosure.d.ts +11 -131
  17. package/dist/disclosure.d.ts.map +1 -1
  18. package/dist/disclosure.js +10 -584
  19. package/dist/disclosure.js.map +1 -1
  20. package/dist/graph.d.ts +6 -70
  21. package/dist/graph.d.ts.map +1 -1
  22. package/dist/graph.js +5 -131
  23. package/dist/graph.js.map +1 -1
  24. package/dist/index.d.ts +28 -7
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +36 -7
  27. package/dist/index.js.map +1 -1
  28. package/dist/merge.d.ts +9 -0
  29. package/dist/merge.d.ts.map +1 -0
  30. package/dist/merge.js +8 -0
  31. package/dist/merge.js.map +1 -0
  32. package/dist/patch.d.ts +2 -2
  33. package/dist/patch.d.ts.map +1 -1
  34. package/dist/patch.js +1 -1
  35. package/dist/patch.js.map +1 -1
  36. package/dist/schemas.d.ts +12 -12
  37. package/dist/schemas.d.ts.map +0 -0
  38. package/dist/schemas.js +0 -0
  39. package/dist/schemas.js.map +0 -0
  40. package/dist/sdk/attribution.d.ts +0 -0
  41. package/dist/sdk/attribution.d.ts.map +0 -0
  42. package/dist/sdk/attribution.js +0 -0
  43. package/dist/sdk/attribution.js.map +0 -0
  44. package/dist/sdk/consensus.d.ts +0 -0
  45. package/dist/sdk/consensus.d.ts.map +0 -0
  46. package/dist/sdk/consensus.js +0 -0
  47. package/dist/sdk/consensus.js.map +0 -0
  48. package/dist/sdk/document.d.ts +0 -0
  49. package/dist/sdk/document.d.ts.map +0 -0
  50. package/dist/sdk/document.js +0 -0
  51. package/dist/sdk/document.js.map +0 -0
  52. package/dist/sdk/index.d.ts +0 -0
  53. package/dist/sdk/index.d.ts.map +0 -0
  54. package/dist/sdk/index.js +0 -0
  55. package/dist/sdk/index.js.map +0 -0
  56. package/dist/sdk/lifecycle.d.ts +0 -0
  57. package/dist/sdk/lifecycle.d.ts.map +0 -0
  58. package/dist/sdk/lifecycle.js +0 -0
  59. package/dist/sdk/lifecycle.js.map +0 -0
  60. package/dist/sdk/retrieval.d.ts +0 -0
  61. package/dist/sdk/retrieval.d.ts.map +0 -0
  62. package/dist/sdk/retrieval.js +0 -0
  63. package/dist/sdk/retrieval.js.map +0 -0
  64. package/dist/sdk/storage-adapter.d.ts +0 -0
  65. package/dist/sdk/storage-adapter.d.ts.map +0 -0
  66. package/dist/sdk/storage-adapter.js +0 -0
  67. package/dist/sdk/storage-adapter.js.map +0 -0
  68. package/dist/sdk/storage.d.ts +0 -0
  69. package/dist/sdk/storage.d.ts.map +0 -0
  70. package/dist/sdk/storage.js +0 -0
  71. package/dist/sdk/storage.js.map +0 -0
  72. package/dist/sdk/versions.d.ts +0 -0
  73. package/dist/sdk/versions.d.ts.map +0 -0
  74. package/dist/sdk/versions.js +0 -0
  75. package/dist/sdk/versions.js.map +0 -0
  76. package/dist/signed-url.d.ts +0 -0
  77. package/dist/signed-url.d.ts.map +0 -0
  78. package/dist/signed-url.js +0 -0
  79. package/dist/signed-url.js.map +0 -0
  80. package/dist/similarity.d.ts +10 -51
  81. package/dist/similarity.d.ts.map +1 -1
  82. package/dist/similarity.js +10 -128
  83. package/dist/similarity.js.map +1 -1
  84. package/dist/snapshot.d.ts +0 -0
  85. package/dist/snapshot.d.ts.map +0 -0
  86. package/dist/snapshot.js +0 -0
  87. package/dist/snapshot.js.map +0 -0
  88. package/dist/types.d.ts +129 -0
  89. package/dist/types.d.ts.map +1 -1
  90. package/dist/types.js +87 -1
  91. package/dist/types.js.map +1 -1
  92. package/dist/validation.d.ts +5 -2
  93. package/dist/validation.d.ts.map +1 -1
  94. package/dist/validation.js +12 -51
  95. package/dist/validation.js.map +1 -1
  96. package/dist/wasm.d.ts +476 -0
  97. package/dist/wasm.d.ts.map +1 -1
  98. package/dist/wasm.js +477 -0
  99. package/dist/wasm.js.map +1 -1
  100. package/package.json +11 -11
  101. package/wasm/LICENSE +0 -0
  102. package/wasm/README.md +0 -0
  103. package/wasm/llmtxt_core.d.ts +341 -1
  104. package/wasm/llmtxt_core.js +925 -13
  105. package/wasm/llmtxt_core_bg.wasm +0 -0
  106. package/wasm/llmtxt_core_bg.wasm.d.ts +60 -23
  107. package/wasm/package.json +0 -0
package/CHANGELOG.md CHANGED
File without changes
package/LICENSE CHANGED
File without changes
package/README.md CHANGED
File without changes
package/dist/cache.d.ts CHANGED
File without changes
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
File without changes
package/dist/client.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -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
@@ -1 +1 @@
1
- {"version":3,"file":"disclosure.d.ts","sourceRoot":"","sources":["../src/disclosure.ts"],"names":[],"mappings":"AAWA;;;;;;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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