@elizaos/plugin-local-ai 0.25.6-alpha.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/LICENSE +21 -0
- package/README.md +153 -0
- package/dist/chunk-TIOOHHYI.js +4727 -0
- package/dist/chunk-TIOOHHYI.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4860 -0
- package/dist/index.js.map +1 -0
- package/dist/multipart-parser-IQPIHJ5G.js +359 -0
- package/dist/multipart-parser-IQPIHJ5G.js.map +1 -0
- package/package.json +102 -0
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FormData,
|
|
3
|
+
file_default
|
|
4
|
+
} from "./chunk-TIOOHHYI.js";
|
|
5
|
+
|
|
6
|
+
// ../../node_modules/node-fetch/src/utils/multipart-parser.js
|
|
7
|
+
var s = 0;
|
|
8
|
+
var S = {
|
|
9
|
+
START_BOUNDARY: s++,
|
|
10
|
+
HEADER_FIELD_START: s++,
|
|
11
|
+
HEADER_FIELD: s++,
|
|
12
|
+
HEADER_VALUE_START: s++,
|
|
13
|
+
HEADER_VALUE: s++,
|
|
14
|
+
HEADER_VALUE_ALMOST_DONE: s++,
|
|
15
|
+
HEADERS_ALMOST_DONE: s++,
|
|
16
|
+
PART_DATA_START: s++,
|
|
17
|
+
PART_DATA: s++,
|
|
18
|
+
END: s++
|
|
19
|
+
};
|
|
20
|
+
var f = 1;
|
|
21
|
+
var F = {
|
|
22
|
+
PART_BOUNDARY: f,
|
|
23
|
+
LAST_BOUNDARY: f *= 2
|
|
24
|
+
};
|
|
25
|
+
var LF = 10;
|
|
26
|
+
var CR = 13;
|
|
27
|
+
var SPACE = 32;
|
|
28
|
+
var HYPHEN = 45;
|
|
29
|
+
var COLON = 58;
|
|
30
|
+
var A = 97;
|
|
31
|
+
var Z = 122;
|
|
32
|
+
var lower = (c) => c | 32;
|
|
33
|
+
var noop = () => {
|
|
34
|
+
};
|
|
35
|
+
var MultipartParser = class {
|
|
36
|
+
/**
|
|
37
|
+
* @param {string} boundary
|
|
38
|
+
*/
|
|
39
|
+
constructor(boundary) {
|
|
40
|
+
this.index = 0;
|
|
41
|
+
this.flags = 0;
|
|
42
|
+
this.onHeaderEnd = noop;
|
|
43
|
+
this.onHeaderField = noop;
|
|
44
|
+
this.onHeadersEnd = noop;
|
|
45
|
+
this.onHeaderValue = noop;
|
|
46
|
+
this.onPartBegin = noop;
|
|
47
|
+
this.onPartData = noop;
|
|
48
|
+
this.onPartEnd = noop;
|
|
49
|
+
this.boundaryChars = {};
|
|
50
|
+
boundary = "\r\n--" + boundary;
|
|
51
|
+
const ui8a = new Uint8Array(boundary.length);
|
|
52
|
+
for (let i = 0; i < boundary.length; i++) {
|
|
53
|
+
ui8a[i] = boundary.charCodeAt(i);
|
|
54
|
+
this.boundaryChars[ui8a[i]] = true;
|
|
55
|
+
}
|
|
56
|
+
this.boundary = ui8a;
|
|
57
|
+
this.lookbehind = new Uint8Array(this.boundary.length + 8);
|
|
58
|
+
this.state = S.START_BOUNDARY;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @param {Uint8Array} data
|
|
62
|
+
*/
|
|
63
|
+
write(data) {
|
|
64
|
+
let i = 0;
|
|
65
|
+
const length_ = data.length;
|
|
66
|
+
let previousIndex = this.index;
|
|
67
|
+
let { lookbehind, boundary, boundaryChars, index, state, flags } = this;
|
|
68
|
+
const boundaryLength = this.boundary.length;
|
|
69
|
+
const boundaryEnd = boundaryLength - 1;
|
|
70
|
+
const bufferLength = data.length;
|
|
71
|
+
let c;
|
|
72
|
+
let cl;
|
|
73
|
+
const mark = (name) => {
|
|
74
|
+
this[name + "Mark"] = i;
|
|
75
|
+
};
|
|
76
|
+
const clear = (name) => {
|
|
77
|
+
delete this[name + "Mark"];
|
|
78
|
+
};
|
|
79
|
+
const callback = (callbackSymbol, start, end, ui8a) => {
|
|
80
|
+
if (start === void 0 || start !== end) {
|
|
81
|
+
this[callbackSymbol](ui8a && ui8a.subarray(start, end));
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const dataCallback = (name, clear2) => {
|
|
85
|
+
const markSymbol = name + "Mark";
|
|
86
|
+
if (!(markSymbol in this)) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (clear2) {
|
|
90
|
+
callback(name, this[markSymbol], i, data);
|
|
91
|
+
delete this[markSymbol];
|
|
92
|
+
} else {
|
|
93
|
+
callback(name, this[markSymbol], data.length, data);
|
|
94
|
+
this[markSymbol] = 0;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
for (i = 0; i < length_; i++) {
|
|
98
|
+
c = data[i];
|
|
99
|
+
switch (state) {
|
|
100
|
+
case S.START_BOUNDARY:
|
|
101
|
+
if (index === boundary.length - 2) {
|
|
102
|
+
if (c === HYPHEN) {
|
|
103
|
+
flags |= F.LAST_BOUNDARY;
|
|
104
|
+
} else if (c !== CR) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
index++;
|
|
108
|
+
break;
|
|
109
|
+
} else if (index - 1 === boundary.length - 2) {
|
|
110
|
+
if (flags & F.LAST_BOUNDARY && c === HYPHEN) {
|
|
111
|
+
state = S.END;
|
|
112
|
+
flags = 0;
|
|
113
|
+
} else if (!(flags & F.LAST_BOUNDARY) && c === LF) {
|
|
114
|
+
index = 0;
|
|
115
|
+
callback("onPartBegin");
|
|
116
|
+
state = S.HEADER_FIELD_START;
|
|
117
|
+
} else {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
if (c !== boundary[index + 2]) {
|
|
123
|
+
index = -2;
|
|
124
|
+
}
|
|
125
|
+
if (c === boundary[index + 2]) {
|
|
126
|
+
index++;
|
|
127
|
+
}
|
|
128
|
+
break;
|
|
129
|
+
case S.HEADER_FIELD_START:
|
|
130
|
+
state = S.HEADER_FIELD;
|
|
131
|
+
mark("onHeaderField");
|
|
132
|
+
index = 0;
|
|
133
|
+
// falls through
|
|
134
|
+
case S.HEADER_FIELD:
|
|
135
|
+
if (c === CR) {
|
|
136
|
+
clear("onHeaderField");
|
|
137
|
+
state = S.HEADERS_ALMOST_DONE;
|
|
138
|
+
break;
|
|
139
|
+
}
|
|
140
|
+
index++;
|
|
141
|
+
if (c === HYPHEN) {
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
if (c === COLON) {
|
|
145
|
+
if (index === 1) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
dataCallback("onHeaderField", true);
|
|
149
|
+
state = S.HEADER_VALUE_START;
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
cl = lower(c);
|
|
153
|
+
if (cl < A || cl > Z) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
break;
|
|
157
|
+
case S.HEADER_VALUE_START:
|
|
158
|
+
if (c === SPACE) {
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
mark("onHeaderValue");
|
|
162
|
+
state = S.HEADER_VALUE;
|
|
163
|
+
// falls through
|
|
164
|
+
case S.HEADER_VALUE:
|
|
165
|
+
if (c === CR) {
|
|
166
|
+
dataCallback("onHeaderValue", true);
|
|
167
|
+
callback("onHeaderEnd");
|
|
168
|
+
state = S.HEADER_VALUE_ALMOST_DONE;
|
|
169
|
+
}
|
|
170
|
+
break;
|
|
171
|
+
case S.HEADER_VALUE_ALMOST_DONE:
|
|
172
|
+
if (c !== LF) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
state = S.HEADER_FIELD_START;
|
|
176
|
+
break;
|
|
177
|
+
case S.HEADERS_ALMOST_DONE:
|
|
178
|
+
if (c !== LF) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
callback("onHeadersEnd");
|
|
182
|
+
state = S.PART_DATA_START;
|
|
183
|
+
break;
|
|
184
|
+
case S.PART_DATA_START:
|
|
185
|
+
state = S.PART_DATA;
|
|
186
|
+
mark("onPartData");
|
|
187
|
+
// falls through
|
|
188
|
+
case S.PART_DATA:
|
|
189
|
+
previousIndex = index;
|
|
190
|
+
if (index === 0) {
|
|
191
|
+
i += boundaryEnd;
|
|
192
|
+
while (i < bufferLength && !(data[i] in boundaryChars)) {
|
|
193
|
+
i += boundaryLength;
|
|
194
|
+
}
|
|
195
|
+
i -= boundaryEnd;
|
|
196
|
+
c = data[i];
|
|
197
|
+
}
|
|
198
|
+
if (index < boundary.length) {
|
|
199
|
+
if (boundary[index] === c) {
|
|
200
|
+
if (index === 0) {
|
|
201
|
+
dataCallback("onPartData", true);
|
|
202
|
+
}
|
|
203
|
+
index++;
|
|
204
|
+
} else {
|
|
205
|
+
index = 0;
|
|
206
|
+
}
|
|
207
|
+
} else if (index === boundary.length) {
|
|
208
|
+
index++;
|
|
209
|
+
if (c === CR) {
|
|
210
|
+
flags |= F.PART_BOUNDARY;
|
|
211
|
+
} else if (c === HYPHEN) {
|
|
212
|
+
flags |= F.LAST_BOUNDARY;
|
|
213
|
+
} else {
|
|
214
|
+
index = 0;
|
|
215
|
+
}
|
|
216
|
+
} else if (index - 1 === boundary.length) {
|
|
217
|
+
if (flags & F.PART_BOUNDARY) {
|
|
218
|
+
index = 0;
|
|
219
|
+
if (c === LF) {
|
|
220
|
+
flags &= ~F.PART_BOUNDARY;
|
|
221
|
+
callback("onPartEnd");
|
|
222
|
+
callback("onPartBegin");
|
|
223
|
+
state = S.HEADER_FIELD_START;
|
|
224
|
+
break;
|
|
225
|
+
}
|
|
226
|
+
} else if (flags & F.LAST_BOUNDARY) {
|
|
227
|
+
if (c === HYPHEN) {
|
|
228
|
+
callback("onPartEnd");
|
|
229
|
+
state = S.END;
|
|
230
|
+
flags = 0;
|
|
231
|
+
} else {
|
|
232
|
+
index = 0;
|
|
233
|
+
}
|
|
234
|
+
} else {
|
|
235
|
+
index = 0;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
if (index > 0) {
|
|
239
|
+
lookbehind[index - 1] = c;
|
|
240
|
+
} else if (previousIndex > 0) {
|
|
241
|
+
const _lookbehind = new Uint8Array(lookbehind.buffer, lookbehind.byteOffset, lookbehind.byteLength);
|
|
242
|
+
callback("onPartData", 0, previousIndex, _lookbehind);
|
|
243
|
+
previousIndex = 0;
|
|
244
|
+
mark("onPartData");
|
|
245
|
+
i--;
|
|
246
|
+
}
|
|
247
|
+
break;
|
|
248
|
+
case S.END:
|
|
249
|
+
break;
|
|
250
|
+
default:
|
|
251
|
+
throw new Error(`Unexpected state entered: ${state}`);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
dataCallback("onHeaderField");
|
|
255
|
+
dataCallback("onHeaderValue");
|
|
256
|
+
dataCallback("onPartData");
|
|
257
|
+
this.index = index;
|
|
258
|
+
this.state = state;
|
|
259
|
+
this.flags = flags;
|
|
260
|
+
}
|
|
261
|
+
end() {
|
|
262
|
+
if (this.state === S.HEADER_FIELD_START && this.index === 0 || this.state === S.PART_DATA && this.index === this.boundary.length) {
|
|
263
|
+
this.onPartEnd();
|
|
264
|
+
} else if (this.state !== S.END) {
|
|
265
|
+
throw new Error("MultipartParser.end(): stream ended unexpectedly");
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
function _fileName(headerValue) {
|
|
270
|
+
const m = headerValue.match(/\bfilename=("(.*?)"|([^()<>@,;:\\"/[\]?={}\s\t]+))($|;\s)/i);
|
|
271
|
+
if (!m) {
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
const match = m[2] || m[3] || "";
|
|
275
|
+
let filename = match.slice(match.lastIndexOf("\\") + 1);
|
|
276
|
+
filename = filename.replace(/%22/g, '"');
|
|
277
|
+
filename = filename.replace(/&#(\d{4});/g, (m2, code) => {
|
|
278
|
+
return String.fromCharCode(code);
|
|
279
|
+
});
|
|
280
|
+
return filename;
|
|
281
|
+
}
|
|
282
|
+
async function toFormData(Body, ct) {
|
|
283
|
+
if (!/multipart/i.test(ct)) {
|
|
284
|
+
throw new TypeError("Failed to fetch");
|
|
285
|
+
}
|
|
286
|
+
const m = ct.match(/boundary=(?:"([^"]+)"|([^;]+))/i);
|
|
287
|
+
if (!m) {
|
|
288
|
+
throw new TypeError("no or bad content-type header, no multipart boundary");
|
|
289
|
+
}
|
|
290
|
+
const parser = new MultipartParser(m[1] || m[2]);
|
|
291
|
+
let headerField;
|
|
292
|
+
let headerValue;
|
|
293
|
+
let entryValue;
|
|
294
|
+
let entryName;
|
|
295
|
+
let contentType;
|
|
296
|
+
let filename;
|
|
297
|
+
const entryChunks = [];
|
|
298
|
+
const formData = new FormData();
|
|
299
|
+
const onPartData = (ui8a) => {
|
|
300
|
+
entryValue += decoder.decode(ui8a, { stream: true });
|
|
301
|
+
};
|
|
302
|
+
const appendToFile = (ui8a) => {
|
|
303
|
+
entryChunks.push(ui8a);
|
|
304
|
+
};
|
|
305
|
+
const appendFileToFormData = () => {
|
|
306
|
+
const file = new file_default(entryChunks, filename, { type: contentType });
|
|
307
|
+
formData.append(entryName, file);
|
|
308
|
+
};
|
|
309
|
+
const appendEntryToFormData = () => {
|
|
310
|
+
formData.append(entryName, entryValue);
|
|
311
|
+
};
|
|
312
|
+
const decoder = new TextDecoder("utf-8");
|
|
313
|
+
decoder.decode();
|
|
314
|
+
parser.onPartBegin = function() {
|
|
315
|
+
parser.onPartData = onPartData;
|
|
316
|
+
parser.onPartEnd = appendEntryToFormData;
|
|
317
|
+
headerField = "";
|
|
318
|
+
headerValue = "";
|
|
319
|
+
entryValue = "";
|
|
320
|
+
entryName = "";
|
|
321
|
+
contentType = "";
|
|
322
|
+
filename = null;
|
|
323
|
+
entryChunks.length = 0;
|
|
324
|
+
};
|
|
325
|
+
parser.onHeaderField = function(ui8a) {
|
|
326
|
+
headerField += decoder.decode(ui8a, { stream: true });
|
|
327
|
+
};
|
|
328
|
+
parser.onHeaderValue = function(ui8a) {
|
|
329
|
+
headerValue += decoder.decode(ui8a, { stream: true });
|
|
330
|
+
};
|
|
331
|
+
parser.onHeaderEnd = function() {
|
|
332
|
+
headerValue += decoder.decode();
|
|
333
|
+
headerField = headerField.toLowerCase();
|
|
334
|
+
if (headerField === "content-disposition") {
|
|
335
|
+
const m2 = headerValue.match(/\bname=("([^"]*)"|([^()<>@,;:\\"/[\]?={}\s\t]+))/i);
|
|
336
|
+
if (m2) {
|
|
337
|
+
entryName = m2[2] || m2[3] || "";
|
|
338
|
+
}
|
|
339
|
+
filename = _fileName(headerValue);
|
|
340
|
+
if (filename) {
|
|
341
|
+
parser.onPartData = appendToFile;
|
|
342
|
+
parser.onPartEnd = appendFileToFormData;
|
|
343
|
+
}
|
|
344
|
+
} else if (headerField === "content-type") {
|
|
345
|
+
contentType = headerValue;
|
|
346
|
+
}
|
|
347
|
+
headerValue = "";
|
|
348
|
+
headerField = "";
|
|
349
|
+
};
|
|
350
|
+
for await (const chunk of Body) {
|
|
351
|
+
parser.write(chunk);
|
|
352
|
+
}
|
|
353
|
+
parser.end();
|
|
354
|
+
return formData;
|
|
355
|
+
}
|
|
356
|
+
export {
|
|
357
|
+
toFormData
|
|
358
|
+
};
|
|
359
|
+
//# sourceMappingURL=multipart-parser-IQPIHJ5G.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/node-fetch/src/utils/multipart-parser.js"],"sourcesContent":["import {File} from 'fetch-blob/from.js';\nimport {FormData} from 'formdata-polyfill/esm.min.js';\n\nlet s = 0;\nconst S = {\n\tSTART_BOUNDARY: s++,\n\tHEADER_FIELD_START: s++,\n\tHEADER_FIELD: s++,\n\tHEADER_VALUE_START: s++,\n\tHEADER_VALUE: s++,\n\tHEADER_VALUE_ALMOST_DONE: s++,\n\tHEADERS_ALMOST_DONE: s++,\n\tPART_DATA_START: s++,\n\tPART_DATA: s++,\n\tEND: s++\n};\n\nlet f = 1;\nconst F = {\n\tPART_BOUNDARY: f,\n\tLAST_BOUNDARY: f *= 2\n};\n\nconst LF = 10;\nconst CR = 13;\nconst SPACE = 32;\nconst HYPHEN = 45;\nconst COLON = 58;\nconst A = 97;\nconst Z = 122;\n\nconst lower = c => c | 0x20;\n\nconst noop = () => {};\n\nclass MultipartParser {\n\t/**\n\t * @param {string} boundary\n\t */\n\tconstructor(boundary) {\n\t\tthis.index = 0;\n\t\tthis.flags = 0;\n\n\t\tthis.onHeaderEnd = noop;\n\t\tthis.onHeaderField = noop;\n\t\tthis.onHeadersEnd = noop;\n\t\tthis.onHeaderValue = noop;\n\t\tthis.onPartBegin = noop;\n\t\tthis.onPartData = noop;\n\t\tthis.onPartEnd = noop;\n\n\t\tthis.boundaryChars = {};\n\n\t\tboundary = '\\r\\n--' + boundary;\n\t\tconst ui8a = new Uint8Array(boundary.length);\n\t\tfor (let i = 0; i < boundary.length; i++) {\n\t\t\tui8a[i] = boundary.charCodeAt(i);\n\t\t\tthis.boundaryChars[ui8a[i]] = true;\n\t\t}\n\n\t\tthis.boundary = ui8a;\n\t\tthis.lookbehind = new Uint8Array(this.boundary.length + 8);\n\t\tthis.state = S.START_BOUNDARY;\n\t}\n\n\t/**\n\t * @param {Uint8Array} data\n\t */\n\twrite(data) {\n\t\tlet i = 0;\n\t\tconst length_ = data.length;\n\t\tlet previousIndex = this.index;\n\t\tlet {lookbehind, boundary, boundaryChars, index, state, flags} = this;\n\t\tconst boundaryLength = this.boundary.length;\n\t\tconst boundaryEnd = boundaryLength - 1;\n\t\tconst bufferLength = data.length;\n\t\tlet c;\n\t\tlet cl;\n\n\t\tconst mark = name => {\n\t\t\tthis[name + 'Mark'] = i;\n\t\t};\n\n\t\tconst clear = name => {\n\t\t\tdelete this[name + 'Mark'];\n\t\t};\n\n\t\tconst callback = (callbackSymbol, start, end, ui8a) => {\n\t\t\tif (start === undefined || start !== end) {\n\t\t\t\tthis[callbackSymbol](ui8a && ui8a.subarray(start, end));\n\t\t\t}\n\t\t};\n\n\t\tconst dataCallback = (name, clear) => {\n\t\t\tconst markSymbol = name + 'Mark';\n\t\t\tif (!(markSymbol in this)) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (clear) {\n\t\t\t\tcallback(name, this[markSymbol], i, data);\n\t\t\t\tdelete this[markSymbol];\n\t\t\t} else {\n\t\t\t\tcallback(name, this[markSymbol], data.length, data);\n\t\t\t\tthis[markSymbol] = 0;\n\t\t\t}\n\t\t};\n\n\t\tfor (i = 0; i < length_; i++) {\n\t\t\tc = data[i];\n\n\t\t\tswitch (state) {\n\t\t\t\tcase S.START_BOUNDARY:\n\t\t\t\t\tif (index === boundary.length - 2) {\n\t\t\t\t\t\tif (c === HYPHEN) {\n\t\t\t\t\t\t\tflags |= F.LAST_BOUNDARY;\n\t\t\t\t\t\t} else if (c !== CR) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tindex++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else if (index - 1 === boundary.length - 2) {\n\t\t\t\t\t\tif (flags & F.LAST_BOUNDARY && c === HYPHEN) {\n\t\t\t\t\t\t\tstate = S.END;\n\t\t\t\t\t\t\tflags = 0;\n\t\t\t\t\t\t} else if (!(flags & F.LAST_BOUNDARY) && c === LF) {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t\tcallback('onPartBegin');\n\t\t\t\t\t\t\tstate = S.HEADER_FIELD_START;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (c !== boundary[index + 2]) {\n\t\t\t\t\t\tindex = -2;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (c === boundary[index + 2]) {\n\t\t\t\t\t\tindex++;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.HEADER_FIELD_START:\n\t\t\t\t\tstate = S.HEADER_FIELD;\n\t\t\t\t\tmark('onHeaderField');\n\t\t\t\t\tindex = 0;\n\t\t\t\t\t// falls through\n\t\t\t\tcase S.HEADER_FIELD:\n\t\t\t\t\tif (c === CR) {\n\t\t\t\t\t\tclear('onHeaderField');\n\t\t\t\t\t\tstate = S.HEADERS_ALMOST_DONE;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tindex++;\n\t\t\t\t\tif (c === HYPHEN) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (c === COLON) {\n\t\t\t\t\t\tif (index === 1) {\n\t\t\t\t\t\t\t// empty header field\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tdataCallback('onHeaderField', true);\n\t\t\t\t\t\tstate = S.HEADER_VALUE_START;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tcl = lower(c);\n\t\t\t\t\tif (cl < A || cl > Z) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.HEADER_VALUE_START:\n\t\t\t\t\tif (c === SPACE) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tmark('onHeaderValue');\n\t\t\t\t\tstate = S.HEADER_VALUE;\n\t\t\t\t\t// falls through\n\t\t\t\tcase S.HEADER_VALUE:\n\t\t\t\t\tif (c === CR) {\n\t\t\t\t\t\tdataCallback('onHeaderValue', true);\n\t\t\t\t\t\tcallback('onHeaderEnd');\n\t\t\t\t\t\tstate = S.HEADER_VALUE_ALMOST_DONE;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.HEADER_VALUE_ALMOST_DONE:\n\t\t\t\t\tif (c !== LF) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tstate = S.HEADER_FIELD_START;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.HEADERS_ALMOST_DONE:\n\t\t\t\t\tif (c !== LF) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tcallback('onHeadersEnd');\n\t\t\t\t\tstate = S.PART_DATA_START;\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.PART_DATA_START:\n\t\t\t\t\tstate = S.PART_DATA;\n\t\t\t\t\tmark('onPartData');\n\t\t\t\t\t// falls through\n\t\t\t\tcase S.PART_DATA:\n\t\t\t\t\tpreviousIndex = index;\n\n\t\t\t\t\tif (index === 0) {\n\t\t\t\t\t\t// boyer-moore derrived algorithm to safely skip non-boundary data\n\t\t\t\t\t\ti += boundaryEnd;\n\t\t\t\t\t\twhile (i < bufferLength && !(data[i] in boundaryChars)) {\n\t\t\t\t\t\t\ti += boundaryLength;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ti -= boundaryEnd;\n\t\t\t\t\t\tc = data[i];\n\t\t\t\t\t}\n\n\t\t\t\t\tif (index < boundary.length) {\n\t\t\t\t\t\tif (boundary[index] === c) {\n\t\t\t\t\t\t\tif (index === 0) {\n\t\t\t\t\t\t\t\tdataCallback('onPartData', true);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tindex++;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (index === boundary.length) {\n\t\t\t\t\t\tindex++;\n\t\t\t\t\t\tif (c === CR) {\n\t\t\t\t\t\t\t// CR = part boundary\n\t\t\t\t\t\t\tflags |= F.PART_BOUNDARY;\n\t\t\t\t\t\t} else if (c === HYPHEN) {\n\t\t\t\t\t\t\t// HYPHEN = end boundary\n\t\t\t\t\t\t\tflags |= F.LAST_BOUNDARY;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (index - 1 === boundary.length) {\n\t\t\t\t\t\tif (flags & F.PART_BOUNDARY) {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t\tif (c === LF) {\n\t\t\t\t\t\t\t\t// unset the PART_BOUNDARY flag\n\t\t\t\t\t\t\t\tflags &= ~F.PART_BOUNDARY;\n\t\t\t\t\t\t\t\tcallback('onPartEnd');\n\t\t\t\t\t\t\t\tcallback('onPartBegin');\n\t\t\t\t\t\t\t\tstate = S.HEADER_FIELD_START;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else if (flags & F.LAST_BOUNDARY) {\n\t\t\t\t\t\t\tif (c === HYPHEN) {\n\t\t\t\t\t\t\t\tcallback('onPartEnd');\n\t\t\t\t\t\t\t\tstate = S.END;\n\t\t\t\t\t\t\t\tflags = 0;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tindex = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (index > 0) {\n\t\t\t\t\t\t// when matching a possible boundary, keep a lookbehind reference\n\t\t\t\t\t\t// in case it turns out to be a false lead\n\t\t\t\t\t\tlookbehind[index - 1] = c;\n\t\t\t\t\t} else if (previousIndex > 0) {\n\t\t\t\t\t\t// if our boundary turned out to be rubbish, the captured lookbehind\n\t\t\t\t\t\t// belongs to partData\n\t\t\t\t\t\tconst _lookbehind = new Uint8Array(lookbehind.buffer, lookbehind.byteOffset, lookbehind.byteLength);\n\t\t\t\t\t\tcallback('onPartData', 0, previousIndex, _lookbehind);\n\t\t\t\t\t\tpreviousIndex = 0;\n\t\t\t\t\t\tmark('onPartData');\n\n\t\t\t\t\t\t// reconsider the current character even so it interrupted the sequence\n\t\t\t\t\t\t// it could be the beginning of a new sequence\n\t\t\t\t\t\ti--;\n\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase S.END:\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error(`Unexpected state entered: ${state}`);\n\t\t\t}\n\t\t}\n\n\t\tdataCallback('onHeaderField');\n\t\tdataCallback('onHeaderValue');\n\t\tdataCallback('onPartData');\n\n\t\t// Update properties for the next call\n\t\tthis.index = index;\n\t\tthis.state = state;\n\t\tthis.flags = flags;\n\t}\n\n\tend() {\n\t\tif ((this.state === S.HEADER_FIELD_START && this.index === 0) ||\n\t\t\t(this.state === S.PART_DATA && this.index === this.boundary.length)) {\n\t\t\tthis.onPartEnd();\n\t\t} else if (this.state !== S.END) {\n\t\t\tthrow new Error('MultipartParser.end(): stream ended unexpectedly');\n\t\t}\n\t}\n}\n\nfunction _fileName(headerValue) {\n\t// matches either a quoted-string or a token (RFC 2616 section 19.5.1)\n\tconst m = headerValue.match(/\\bfilename=(\"(.*?)\"|([^()<>@,;:\\\\\"/[\\]?={}\\s\\t]+))($|;\\s)/i);\n\tif (!m) {\n\t\treturn;\n\t}\n\n\tconst match = m[2] || m[3] || '';\n\tlet filename = match.slice(match.lastIndexOf('\\\\') + 1);\n\tfilename = filename.replace(/%22/g, '\"');\n\tfilename = filename.replace(/&#(\\d{4});/g, (m, code) => {\n\t\treturn String.fromCharCode(code);\n\t});\n\treturn filename;\n}\n\nexport async function toFormData(Body, ct) {\n\tif (!/multipart/i.test(ct)) {\n\t\tthrow new TypeError('Failed to fetch');\n\t}\n\n\tconst m = ct.match(/boundary=(?:\"([^\"]+)\"|([^;]+))/i);\n\n\tif (!m) {\n\t\tthrow new TypeError('no or bad content-type header, no multipart boundary');\n\t}\n\n\tconst parser = new MultipartParser(m[1] || m[2]);\n\n\tlet headerField;\n\tlet headerValue;\n\tlet entryValue;\n\tlet entryName;\n\tlet contentType;\n\tlet filename;\n\tconst entryChunks = [];\n\tconst formData = new FormData();\n\n\tconst onPartData = ui8a => {\n\t\tentryValue += decoder.decode(ui8a, {stream: true});\n\t};\n\n\tconst appendToFile = ui8a => {\n\t\tentryChunks.push(ui8a);\n\t};\n\n\tconst appendFileToFormData = () => {\n\t\tconst file = new File(entryChunks, filename, {type: contentType});\n\t\tformData.append(entryName, file);\n\t};\n\n\tconst appendEntryToFormData = () => {\n\t\tformData.append(entryName, entryValue);\n\t};\n\n\tconst decoder = new TextDecoder('utf-8');\n\tdecoder.decode();\n\n\tparser.onPartBegin = function () {\n\t\tparser.onPartData = onPartData;\n\t\tparser.onPartEnd = appendEntryToFormData;\n\n\t\theaderField = '';\n\t\theaderValue = '';\n\t\tentryValue = '';\n\t\tentryName = '';\n\t\tcontentType = '';\n\t\tfilename = null;\n\t\tentryChunks.length = 0;\n\t};\n\n\tparser.onHeaderField = function (ui8a) {\n\t\theaderField += decoder.decode(ui8a, {stream: true});\n\t};\n\n\tparser.onHeaderValue = function (ui8a) {\n\t\theaderValue += decoder.decode(ui8a, {stream: true});\n\t};\n\n\tparser.onHeaderEnd = function () {\n\t\theaderValue += decoder.decode();\n\t\theaderField = headerField.toLowerCase();\n\n\t\tif (headerField === 'content-disposition') {\n\t\t\t// matches either a quoted-string or a token (RFC 2616 section 19.5.1)\n\t\t\tconst m = headerValue.match(/\\bname=(\"([^\"]*)\"|([^()<>@,;:\\\\\"/[\\]?={}\\s\\t]+))/i);\n\n\t\t\tif (m) {\n\t\t\t\tentryName = m[2] || m[3] || '';\n\t\t\t}\n\n\t\t\tfilename = _fileName(headerValue);\n\n\t\t\tif (filename) {\n\t\t\t\tparser.onPartData = appendToFile;\n\t\t\t\tparser.onPartEnd = appendFileToFormData;\n\t\t\t}\n\t\t} else if (headerField === 'content-type') {\n\t\t\tcontentType = headerValue;\n\t\t}\n\n\t\theaderValue = '';\n\t\theaderField = '';\n\t};\n\n\tfor await (const chunk of Body) {\n\t\tparser.write(chunk);\n\t}\n\n\tparser.end();\n\n\treturn formData;\n}\n"],"mappings":";;;;;;AAGA,IAAI,IAAI;AACR,IAAM,IAAI;AAAA,EACT,gBAAgB;AAAA,EAChB,oBAAoB;AAAA,EACpB,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,cAAc;AAAA,EACd,0BAA0B;AAAA,EAC1B,qBAAqB;AAAA,EACrB,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,KAAK;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aAAS,OAAO,WAAW,IAAI;AAAA,EAChC;AAEA,QAAM,wBAAwB,MAAM;AACnC,aAAS,OAAO,WAAW,UAAU;AAAA,EACtC;AAEA,QAAM,UAAU,IAAI,YAAY,OAAO;AACvC,UAAQ,OAAO;AAEf,SAAO,cAAc,WAAY;AAChC,WAAO,aAAa;AACpB,WAAO,YAAY;AAEnB,kBAAc;AACd,kBAAc;AACd,iBAAa;AACb,gBAAY;AACZ,kBAAc;AACd,eAAW;AACX,gBAAY,SAAS;AAAA,EACtB;AAEA,SAAO,gBAAgB,SAAU,MAAM;AACtC,mBAAe,QAAQ,OAAO,MAAM,EAAC,QAAQ,KAAI,CAAC;AAAA,EACnD;AAEA,SAAO,gBAAgB,SAAU,MAAM;AACtC,mBAAe,QAAQ,OAAO,MAAM,EAAC,QAAQ,KAAI,CAAC;AAAA,EACnD;AAEA,SAAO,cAAc,WAAY;AAChC,mBAAe,QAAQ,OAAO;AAC9B,kBAAc,YAAY,YAAY;AAEtC,QAAI,gBAAgB,uBAAuB;AAE1C,YAAMA,KAAI,YAAY,MAAM,mDAAmD;AAE/E,UAAIA,IAAG;AACN,oBAAYA,GAAE,CAAC,KAAKA,GAAE,CAAC,KAAK;AAAA,MAC7B;AAEA,iBAAW,UAAU,WAAW;AAEhC,UAAI,UAAU;AACb,eAAO,aAAa;AACpB,eAAO,YAAY;AAAA,MACpB;AAAA,IACD,WAAW,gBAAgB,gBAAgB;AAC1C,oBAAc;AAAA,IACf;AAEA,kBAAc;AACd,kBAAc;AAAA,EACf;AAEA,mBAAiB,SAAS,MAAM;AAC/B,WAAO,MAAM,KAAK;AAAA,EACnB;AAEA,SAAO,IAAI;AAEX,SAAO;AACR;","names":["clear","m"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@elizaos/plugin-local-ai",
|
|
3
|
+
"version": "0.25.6-alpha.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
"./package.json": "./package.json",
|
|
10
|
+
".": {
|
|
11
|
+
"import": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@anush008/tokenizers": "^0.0.0",
|
|
22
|
+
"@aws-sdk/client-s3": "^3.749.0",
|
|
23
|
+
"@aws-sdk/s3-request-presigner": "^3.749.0",
|
|
24
|
+
"@cliqz/adblocker-playwright": "1.34.0",
|
|
25
|
+
"@echogarden/espeak-ng-emscripten": "0.3.3",
|
|
26
|
+
"@echogarden/kissfft-wasm": "0.2.0",
|
|
27
|
+
"@echogarden/speex-resampler-wasm": "0.2.1",
|
|
28
|
+
"@elizaos/core": "1.0.0-alpha.0",
|
|
29
|
+
"@huggingface/hub": "^1.0.1",
|
|
30
|
+
"@huggingface/inference": "^3.3.4",
|
|
31
|
+
"@huggingface/transformers": "^3.3.3",
|
|
32
|
+
"@opendocsg/pdf2md": "0.1.32",
|
|
33
|
+
"@types/uuid": "10.0.0",
|
|
34
|
+
"alawmulaw": "6.0.0",
|
|
35
|
+
"bignumber.js": "9.1.2",
|
|
36
|
+
"capsolver-npm": "2.0.2",
|
|
37
|
+
"cldr-segmentation": "2.2.1",
|
|
38
|
+
"command-exists": "1.2.9",
|
|
39
|
+
"cookie": "0.7.0",
|
|
40
|
+
"csv-writer": "1.6.0",
|
|
41
|
+
"echogarden": "2.0.7",
|
|
42
|
+
"espeak-ng": "1.0.2",
|
|
43
|
+
"fastembed": "^1.14.1",
|
|
44
|
+
"ffmpeg-static": "5.2.0",
|
|
45
|
+
"fluent-ffmpeg": "2.1.3",
|
|
46
|
+
"formdata-node": "6.0.3",
|
|
47
|
+
"fs-extra": "11.2.0",
|
|
48
|
+
"gaxios": "6.7.1",
|
|
49
|
+
"glob": "11.0.0",
|
|
50
|
+
"graceful-fs": "4.2.11",
|
|
51
|
+
"html-escaper": "3.0.3",
|
|
52
|
+
"html-to-text": "9.0.5",
|
|
53
|
+
"import-meta-resolve": "4.1.0",
|
|
54
|
+
"jieba-wasm": "2.2.0",
|
|
55
|
+
"json5": "2.2.3",
|
|
56
|
+
"kuromoji": "0.1.2",
|
|
57
|
+
"libsodium-wrappers": "0.7.15",
|
|
58
|
+
"multer": "1.4.5-lts.1",
|
|
59
|
+
"node-cache": "5.1.2",
|
|
60
|
+
"node-llama-cpp": "3.5.0",
|
|
61
|
+
"nodejs-whisper": "0.1.18",
|
|
62
|
+
"onnxruntime-node": "1.20.1",
|
|
63
|
+
"outetts": "0.2.0",
|
|
64
|
+
"pdfjs-dist": "4.7.76",
|
|
65
|
+
"playwright": "1.48.2",
|
|
66
|
+
"pm2": "5.4.3",
|
|
67
|
+
"puppeteer-extra": "3.3.6",
|
|
68
|
+
"puppeteer-extra-plugin-capsolver": "2.0.1",
|
|
69
|
+
"sharp": "0.33.5",
|
|
70
|
+
"srt": "0.0.3",
|
|
71
|
+
"systeminformation": "5.23.8",
|
|
72
|
+
"tar": "7.4.3",
|
|
73
|
+
"tinyld": "1.3.4",
|
|
74
|
+
"tsup": "8.4.0",
|
|
75
|
+
"uuid": "11.0.3",
|
|
76
|
+
"wav": "1.0.2",
|
|
77
|
+
"wav-encoder": "1.3.0",
|
|
78
|
+
"wavefile": "11.0.0",
|
|
79
|
+
"yargs": "17.7.2",
|
|
80
|
+
"youtube-dl-exec": "3.0.15",
|
|
81
|
+
"zod": "3.21.4"
|
|
82
|
+
},
|
|
83
|
+
"scripts": {
|
|
84
|
+
"build": "tsup --format esm --dts",
|
|
85
|
+
"dev": "tsup --format esm --dts --watch",
|
|
86
|
+
"test": "vitest run"
|
|
87
|
+
},
|
|
88
|
+
"peerDependencies": {
|
|
89
|
+
"whatwg-url": "7.1.0"
|
|
90
|
+
},
|
|
91
|
+
"publishConfig": {
|
|
92
|
+
"access": "public"
|
|
93
|
+
},
|
|
94
|
+
"resolutions": {
|
|
95
|
+
"zod": "3.24.1"
|
|
96
|
+
},
|
|
97
|
+
"agentConfig": {
|
|
98
|
+
"pluginType": "elizaos:plugin:1.0.0",
|
|
99
|
+
"pluginParameters": {}
|
|
100
|
+
},
|
|
101
|
+
"gitHead": "084c3b06c279b85528a81d42fc93ef68ff9f7364"
|
|
102
|
+
}
|