llm-kb 0.2.0 → 0.4.1
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 +322 -60
- package/bin/anthropic-5TIU2EED.js +5515 -0
- package/bin/azure-openai-responses-ZVUVMK3G.js +190 -0
- package/bin/chunk-2WV6TQRI.js +4792 -0
- package/bin/chunk-3YMNGUZZ.js +262 -0
- package/bin/chunk-5PYKQQLA.js +14295 -0
- package/bin/chunk-65KFH7OI.js +31 -0
- package/bin/chunk-DHOXVEIR.js +7261 -0
- package/bin/chunk-EAQYK3U2.js +41 -0
- package/bin/chunk-IFS3OKBN.js +428 -0
- package/bin/chunk-LDHOKBJA.js +86 -0
- package/bin/chunk-SLYBG6ZQ.js +32681 -0
- package/bin/chunk-UEODFF7H.js +17 -0
- package/bin/chunk-XCXTZJGO.js +174 -0
- package/bin/chunk-XFV534WU.js +7056 -0
- package/bin/cli.js +5496 -163
- package/bin/dist-3YH7P2QF.js +1244 -0
- package/bin/google-JFC43EFJ.js +371 -0
- package/bin/google-gemini-cli-K4XNMYDI.js +712 -0
- package/bin/google-vertex-Y42F254G.js +414 -0
- package/bin/indexer-KSYRIVVN.js +10 -0
- package/bin/mistral-ZU2JS5XZ.js +38406 -0
- package/bin/multipart-parser-CO464TZY.js +371 -0
- package/bin/openai-codex-responses-NW2LELBH.js +712 -0
- package/bin/openai-completions-TW3VKTHO.js +662 -0
- package/bin/openai-responses-VGL522MK.js +198 -0
- package/bin/src-Y22OHE3S.js +1408 -0
- package/package.json +16 -6
- package/PHASE2_SPEC.md +0 -274
- package/SPEC.md +0 -275
- package/bin/chunk-MYQ36JJB.js +0 -118
- package/bin/indexer-LSYSZXZX.js +0 -6
- package/plan.md +0 -55
- package/src/cli.ts +0 -132
- package/src/indexer.ts +0 -148
- package/src/pdf.ts +0 -119
- package/src/query.ts +0 -132
- package/src/resolve-kb.ts +0 -19
- package/src/scan.ts +0 -59
- package/src/watcher.ts +0 -84
- package/tsconfig.json +0 -14
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__commonJS,
|
|
3
|
+
__toESM
|
|
4
|
+
} from "./chunk-EAQYK3U2.js";
|
|
5
|
+
|
|
6
|
+
// node_modules/partial-json/dist/options.js
|
|
7
|
+
var require_options = __commonJS({
|
|
8
|
+
"node_modules/partial-json/dist/options.js"(exports) {
|
|
9
|
+
"use strict";
|
|
10
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
+
exports.Allow = exports.ALL = exports.COLLECTION = exports.ATOM = exports.SPECIAL = exports.INF = exports._INFINITY = exports.INFINITY = exports.NAN = exports.BOOL = exports.NULL = exports.OBJ = exports.ARR = exports.NUM = exports.STR = void 0;
|
|
12
|
+
exports.STR = 1;
|
|
13
|
+
exports.NUM = 2;
|
|
14
|
+
exports.ARR = 4;
|
|
15
|
+
exports.OBJ = 8;
|
|
16
|
+
exports.NULL = 16;
|
|
17
|
+
exports.BOOL = 32;
|
|
18
|
+
exports.NAN = 64;
|
|
19
|
+
exports.INFINITY = 128;
|
|
20
|
+
exports._INFINITY = 256;
|
|
21
|
+
exports.INF = exports.INFINITY | exports._INFINITY;
|
|
22
|
+
exports.SPECIAL = exports.NULL | exports.BOOL | exports.INF | exports.NAN;
|
|
23
|
+
exports.ATOM = exports.STR | exports.NUM | exports.SPECIAL;
|
|
24
|
+
exports.COLLECTION = exports.ARR | exports.OBJ;
|
|
25
|
+
exports.ALL = exports.ATOM | exports.COLLECTION;
|
|
26
|
+
exports.Allow = { STR: exports.STR, NUM: exports.NUM, ARR: exports.ARR, OBJ: exports.OBJ, NULL: exports.NULL, BOOL: exports.BOOL, NAN: exports.NAN, INFINITY: exports.INFINITY, _INFINITY: exports._INFINITY, INF: exports.INF, SPECIAL: exports.SPECIAL, ATOM: exports.ATOM, COLLECTION: exports.COLLECTION, ALL: exports.ALL };
|
|
27
|
+
exports.default = exports.Allow;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// node_modules/partial-json/dist/index.js
|
|
32
|
+
var require_dist = __commonJS({
|
|
33
|
+
"node_modules/partial-json/dist/index.js"(exports) {
|
|
34
|
+
"use strict";
|
|
35
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
36
|
+
if (k2 === void 0) k2 = k;
|
|
37
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
38
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
39
|
+
desc = { enumerable: true, get: function() {
|
|
40
|
+
return m[k];
|
|
41
|
+
} };
|
|
42
|
+
}
|
|
43
|
+
Object.defineProperty(o, k2, desc);
|
|
44
|
+
}) : (function(o, m, k, k2) {
|
|
45
|
+
if (k2 === void 0) k2 = k;
|
|
46
|
+
o[k2] = m[k];
|
|
47
|
+
}));
|
|
48
|
+
var __exportStar = exports && exports.__exportStar || function(m, exports2) {
|
|
49
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
|
|
50
|
+
};
|
|
51
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
52
|
+
exports.Allow = exports.MalformedJSON = exports.PartialJSON = exports.parseJSON = exports.parse = void 0;
|
|
53
|
+
var options_1 = require_options();
|
|
54
|
+
Object.defineProperty(exports, "Allow", { enumerable: true, get: function() {
|
|
55
|
+
return options_1.Allow;
|
|
56
|
+
} });
|
|
57
|
+
__exportStar(require_options(), exports);
|
|
58
|
+
var PartialJSON = class extends Error {
|
|
59
|
+
};
|
|
60
|
+
exports.PartialJSON = PartialJSON;
|
|
61
|
+
var MalformedJSON = class extends Error {
|
|
62
|
+
};
|
|
63
|
+
exports.MalformedJSON = MalformedJSON;
|
|
64
|
+
function parseJSON(jsonString, allowPartial = options_1.Allow.ALL) {
|
|
65
|
+
if (typeof jsonString !== "string") {
|
|
66
|
+
throw new TypeError(`expecting str, got ${typeof jsonString}`);
|
|
67
|
+
}
|
|
68
|
+
if (!jsonString.trim()) {
|
|
69
|
+
throw new Error(`${jsonString} is empty`);
|
|
70
|
+
}
|
|
71
|
+
return _parseJSON(jsonString.trim(), allowPartial);
|
|
72
|
+
}
|
|
73
|
+
exports.parseJSON = parseJSON;
|
|
74
|
+
var _parseJSON = (jsonString, allow) => {
|
|
75
|
+
const length = jsonString.length;
|
|
76
|
+
let index = 0;
|
|
77
|
+
const markPartialJSON = (msg) => {
|
|
78
|
+
throw new PartialJSON(`${msg} at position ${index}`);
|
|
79
|
+
};
|
|
80
|
+
const throwMalformedError = (msg) => {
|
|
81
|
+
throw new MalformedJSON(`${msg} at position ${index}`);
|
|
82
|
+
};
|
|
83
|
+
const parseAny = () => {
|
|
84
|
+
skipBlank();
|
|
85
|
+
if (index >= length)
|
|
86
|
+
markPartialJSON("Unexpected end of input");
|
|
87
|
+
if (jsonString[index] === '"')
|
|
88
|
+
return parseStr();
|
|
89
|
+
if (jsonString[index] === "{")
|
|
90
|
+
return parseObj();
|
|
91
|
+
if (jsonString[index] === "[")
|
|
92
|
+
return parseArr();
|
|
93
|
+
if (jsonString.substring(index, index + 4) === "null" || options_1.Allow.NULL & allow && length - index < 4 && "null".startsWith(jsonString.substring(index))) {
|
|
94
|
+
index += 4;
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
if (jsonString.substring(index, index + 4) === "true" || options_1.Allow.BOOL & allow && length - index < 4 && "true".startsWith(jsonString.substring(index))) {
|
|
98
|
+
index += 4;
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
if (jsonString.substring(index, index + 5) === "false" || options_1.Allow.BOOL & allow && length - index < 5 && "false".startsWith(jsonString.substring(index))) {
|
|
102
|
+
index += 5;
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
if (jsonString.substring(index, index + 8) === "Infinity" || options_1.Allow.INFINITY & allow && length - index < 8 && "Infinity".startsWith(jsonString.substring(index))) {
|
|
106
|
+
index += 8;
|
|
107
|
+
return Infinity;
|
|
108
|
+
}
|
|
109
|
+
if (jsonString.substring(index, index + 9) === "-Infinity" || options_1.Allow._INFINITY & allow && 1 < length - index && length - index < 9 && "-Infinity".startsWith(jsonString.substring(index))) {
|
|
110
|
+
index += 9;
|
|
111
|
+
return -Infinity;
|
|
112
|
+
}
|
|
113
|
+
if (jsonString.substring(index, index + 3) === "NaN" || options_1.Allow.NAN & allow && length - index < 3 && "NaN".startsWith(jsonString.substring(index))) {
|
|
114
|
+
index += 3;
|
|
115
|
+
return NaN;
|
|
116
|
+
}
|
|
117
|
+
return parseNum();
|
|
118
|
+
};
|
|
119
|
+
const parseStr = () => {
|
|
120
|
+
const start = index;
|
|
121
|
+
let escape = false;
|
|
122
|
+
index++;
|
|
123
|
+
while (index < length && (jsonString[index] !== '"' || escape && jsonString[index - 1] === "\\")) {
|
|
124
|
+
escape = jsonString[index] === "\\" ? !escape : false;
|
|
125
|
+
index++;
|
|
126
|
+
}
|
|
127
|
+
if (jsonString.charAt(index) == '"') {
|
|
128
|
+
try {
|
|
129
|
+
return JSON.parse(jsonString.substring(start, ++index - Number(escape)));
|
|
130
|
+
} catch (e) {
|
|
131
|
+
throwMalformedError(String(e));
|
|
132
|
+
}
|
|
133
|
+
} else if (options_1.Allow.STR & allow) {
|
|
134
|
+
try {
|
|
135
|
+
return JSON.parse(jsonString.substring(start, index - Number(escape)) + '"');
|
|
136
|
+
} catch (e) {
|
|
137
|
+
return JSON.parse(jsonString.substring(start, jsonString.lastIndexOf("\\")) + '"');
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
markPartialJSON("Unterminated string literal");
|
|
141
|
+
};
|
|
142
|
+
const parseObj = () => {
|
|
143
|
+
index++;
|
|
144
|
+
skipBlank();
|
|
145
|
+
const obj = {};
|
|
146
|
+
try {
|
|
147
|
+
while (jsonString[index] !== "}") {
|
|
148
|
+
skipBlank();
|
|
149
|
+
if (index >= length && options_1.Allow.OBJ & allow)
|
|
150
|
+
return obj;
|
|
151
|
+
const key = parseStr();
|
|
152
|
+
skipBlank();
|
|
153
|
+
index++;
|
|
154
|
+
try {
|
|
155
|
+
const value = parseAny();
|
|
156
|
+
obj[key] = value;
|
|
157
|
+
} catch (e) {
|
|
158
|
+
if (options_1.Allow.OBJ & allow)
|
|
159
|
+
return obj;
|
|
160
|
+
else
|
|
161
|
+
throw e;
|
|
162
|
+
}
|
|
163
|
+
skipBlank();
|
|
164
|
+
if (jsonString[index] === ",")
|
|
165
|
+
index++;
|
|
166
|
+
}
|
|
167
|
+
} catch (e) {
|
|
168
|
+
if (options_1.Allow.OBJ & allow)
|
|
169
|
+
return obj;
|
|
170
|
+
else
|
|
171
|
+
markPartialJSON("Expected '}' at end of object");
|
|
172
|
+
}
|
|
173
|
+
index++;
|
|
174
|
+
return obj;
|
|
175
|
+
};
|
|
176
|
+
const parseArr = () => {
|
|
177
|
+
index++;
|
|
178
|
+
const arr = [];
|
|
179
|
+
try {
|
|
180
|
+
while (jsonString[index] !== "]") {
|
|
181
|
+
arr.push(parseAny());
|
|
182
|
+
skipBlank();
|
|
183
|
+
if (jsonString[index] === ",") {
|
|
184
|
+
index++;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
} catch (e) {
|
|
188
|
+
if (options_1.Allow.ARR & allow) {
|
|
189
|
+
return arr;
|
|
190
|
+
}
|
|
191
|
+
markPartialJSON("Expected ']' at end of array");
|
|
192
|
+
}
|
|
193
|
+
index++;
|
|
194
|
+
return arr;
|
|
195
|
+
};
|
|
196
|
+
const parseNum = () => {
|
|
197
|
+
if (index === 0) {
|
|
198
|
+
if (jsonString === "-")
|
|
199
|
+
throwMalformedError("Not sure what '-' is");
|
|
200
|
+
try {
|
|
201
|
+
return JSON.parse(jsonString);
|
|
202
|
+
} catch (e) {
|
|
203
|
+
if (options_1.Allow.NUM & allow)
|
|
204
|
+
try {
|
|
205
|
+
return JSON.parse(jsonString.substring(0, jsonString.lastIndexOf("e")));
|
|
206
|
+
} catch (e2) {
|
|
207
|
+
}
|
|
208
|
+
throwMalformedError(String(e));
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
const start = index;
|
|
212
|
+
if (jsonString[index] === "-")
|
|
213
|
+
index++;
|
|
214
|
+
while (jsonString[index] && ",]}".indexOf(jsonString[index]) === -1)
|
|
215
|
+
index++;
|
|
216
|
+
if (index == length && !(options_1.Allow.NUM & allow))
|
|
217
|
+
markPartialJSON("Unterminated number literal");
|
|
218
|
+
try {
|
|
219
|
+
return JSON.parse(jsonString.substring(start, index));
|
|
220
|
+
} catch (e) {
|
|
221
|
+
if (jsonString.substring(start, index) === "-")
|
|
222
|
+
markPartialJSON("Not sure what '-' is");
|
|
223
|
+
try {
|
|
224
|
+
return JSON.parse(jsonString.substring(start, jsonString.lastIndexOf("e")));
|
|
225
|
+
} catch (e2) {
|
|
226
|
+
throwMalformedError(String(e2));
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
const skipBlank = () => {
|
|
231
|
+
while (index < length && " \n\r ".includes(jsonString[index])) {
|
|
232
|
+
index++;
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
return parseAny();
|
|
236
|
+
};
|
|
237
|
+
var parse = parseJSON;
|
|
238
|
+
exports.parse = parse;
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
// node_modules/@mariozechner/pi-ai/dist/utils/json-parse.js
|
|
243
|
+
var import_partial_json = __toESM(require_dist(), 1);
|
|
244
|
+
function parseStreamingJson(partialJson) {
|
|
245
|
+
if (!partialJson || partialJson.trim() === "") {
|
|
246
|
+
return {};
|
|
247
|
+
}
|
|
248
|
+
try {
|
|
249
|
+
return JSON.parse(partialJson);
|
|
250
|
+
} catch {
|
|
251
|
+
try {
|
|
252
|
+
const result = (0, import_partial_json.parse)(partialJson);
|
|
253
|
+
return result ?? {};
|
|
254
|
+
} catch {
|
|
255
|
+
return {};
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export {
|
|
261
|
+
parseStreamingJson
|
|
262
|
+
};
|