@poe-platform/safe-bash 0.1.820 → 0.1.822
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/dist/safe-bash/command-chunks/{chunk-V2PJO6JL.js → chunk-4VHCA4KK.js} +187 -3
- package/dist/safe-bash/command-chunks/{chunk-RTUDDAAY.js → chunk-O3KFOFJM.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-SLD5A7IL.js → chunk-OU5UEUZN.js} +1 -1
- package/dist/safe-bash/command-chunks/{chunk-FVHPDYV5.js → chunk-RKAL5VFP.js} +29 -10
- package/dist/safe-bash/command-chunks/{chunk-YNFQ5AXM.js → chunk-SENLC5KK.js} +1 -1
- package/dist/safe-bash-command-llm/collections.js +2 -2
- package/dist/safe-bash-command-llm/command.js +2 -2
- package/dist/safe-bash-command-llm/index.js +2 -2
- package/dist/safe-bash-command-llm/service.js +1 -1
- package/dist/safe-bash-command-patch/index.js +2 -2
- package/dist/safe-bash-command-patch/patch-publication.js +1 -1
- package/dist/safe-bash-command-patch/patch.js +2 -2
- package/dist/safe-bash-csv-engine/index.js +1 -1
- package/dist/safe-bash-csv-engine/python-iso2022.d.ts +21 -0
- package/dist/safe-bash-csv-engine/text-decoder.d.ts +1 -0
- package/dist/safe-bash-csv-engine/text-decoder.js +3 -1
- package/package.json +2 -2
|
@@ -172,6 +172,189 @@ var PythonMultibyteDecoder = class {
|
|
|
172
172
|
}
|
|
173
173
|
};
|
|
174
174
|
|
|
175
|
+
// packages/safe-bash-csv-engine/src/python-iso2022.ts
|
|
176
|
+
var pythonIso2022Charsets = {
|
|
177
|
+
iso2022_jp: [194, 74, 192],
|
|
178
|
+
iso2022_jp_1: [194, 196, 74, 192],
|
|
179
|
+
iso2022_jp_2: [194, 196, 195, 193, 74, 192, 65, 70],
|
|
180
|
+
iso2022_jp_2004: [209, 194, 208],
|
|
181
|
+
iso2022_jp_3: [207, 194, 208],
|
|
182
|
+
iso2022_jp_ext: [194, 196, 74, 73, 192],
|
|
183
|
+
iso2022_kr: [195]
|
|
184
|
+
};
|
|
185
|
+
var escapeEnd = (byte) => byte === 64 || byte >= 65 && byte <= 90;
|
|
186
|
+
var PythonIso2022PendingError = class extends Error {
|
|
187
|
+
constructor() {
|
|
188
|
+
super("pending buffer overflow");
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
var PythonIso2022Decoder = class {
|
|
192
|
+
constructor(encoding) {
|
|
193
|
+
this.encoding = encoding;
|
|
194
|
+
}
|
|
195
|
+
encoding;
|
|
196
|
+
groups = [66, 66, 66];
|
|
197
|
+
shifted = false;
|
|
198
|
+
through = false;
|
|
199
|
+
pending = [];
|
|
200
|
+
maps = /* @__PURE__ */ new Map();
|
|
201
|
+
invalid() {
|
|
202
|
+
throw new PythonTextDecodeError("Invalid ISO-2022 input");
|
|
203
|
+
}
|
|
204
|
+
character(charset, bytes) {
|
|
205
|
+
const a = bytes[0];
|
|
206
|
+
if (charset === 74) return String.fromCodePoint(a === 92 ? 165 : a === 126 ? 8254 : a);
|
|
207
|
+
if (charset === 73) {
|
|
208
|
+
if (a < 33 || a > 95) return this.invalid();
|
|
209
|
+
return String.fromCodePoint(a + 65344);
|
|
210
|
+
}
|
|
211
|
+
if (charset === 65 || charset === 70) return this.invalid();
|
|
212
|
+
const b = bytes[1];
|
|
213
|
+
if (a < 33 || a > 126 || b < 33 || b > 126) return this.invalid();
|
|
214
|
+
if (charset === 208 && a < 110 && ![33, 35, 36, 37, 40, 44, 45, 46, 47].includes(a)) return this.invalid();
|
|
215
|
+
if ((charset === 207 || charset === 209) && a === 34 && b === 50) return "~";
|
|
216
|
+
const mapping = charset === 193 ? "gb2312" : charset === 195 ? "cp949" : charset === 207 ? "euc_jisx0213" : charset === 209 ? "euc_jis_2004" : charset === 208 ? "euc_jis_2004" : "euc_jp";
|
|
217
|
+
let decoder = this.maps.get(mapping);
|
|
218
|
+
if (!decoder) {
|
|
219
|
+
decoder = new PythonMultibyteDecoder(pythonMultibyteTables[mapping]);
|
|
220
|
+
this.maps.set(mapping, decoder);
|
|
221
|
+
}
|
|
222
|
+
return decoder.decode(Uint8Array.from(charset === 196 || charset === 208 ? [143, a + 128, b + 128] : [a + 128, b + 128]));
|
|
223
|
+
}
|
|
224
|
+
secondary(byte) {
|
|
225
|
+
const group = this.groups[2];
|
|
226
|
+
if (group === 66) {
|
|
227
|
+
if (byte >= 128) return this.invalid();
|
|
228
|
+
return String.fromCharCode(byte);
|
|
229
|
+
}
|
|
230
|
+
if (group === 65) {
|
|
231
|
+
if (byte >= 128) return this.invalid();
|
|
232
|
+
return String.fromCharCode(byte + 128);
|
|
233
|
+
}
|
|
234
|
+
if (group !== 70) throw new Error("Invalid ISO-2022 secondary designation");
|
|
235
|
+
const value = byte ^ 128;
|
|
236
|
+
if (value === 164 || value === 165 || value === 170) return this.invalid();
|
|
237
|
+
const point = pythonFileCodepages["iso8859-7"]?.[value];
|
|
238
|
+
if (point === void 0 || point < 0) return this.invalid();
|
|
239
|
+
return String.fromCodePoint(point);
|
|
240
|
+
}
|
|
241
|
+
escape(bytes) {
|
|
242
|
+
let length = 0;
|
|
243
|
+
for (let i = 1; i < 16; i++) {
|
|
244
|
+
if (i >= bytes.length) return void 0;
|
|
245
|
+
if (escapeEnd(bytes[i])) {
|
|
246
|
+
length = i + 1;
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
if (this.encoding !== "iso2022_kr" && bytes[i] === 38 && bytes[i + 1] === 64) i += 2;
|
|
250
|
+
}
|
|
251
|
+
if (!length) return this.invalid();
|
|
252
|
+
let group, charset;
|
|
253
|
+
if (length === 3) {
|
|
254
|
+
charset = bytes[2];
|
|
255
|
+
if (bytes[1] === 36) {
|
|
256
|
+
charset |= 128;
|
|
257
|
+
group = 0;
|
|
258
|
+
} else if (bytes[1] === 40) group = 0;
|
|
259
|
+
else if (bytes[1] === 41) group = 1;
|
|
260
|
+
else if (bytes[1] === 46 && this.encoding === "iso2022_jp_2") group = 2;
|
|
261
|
+
else return this.invalid();
|
|
262
|
+
} else if (length === 4 && bytes[1] === 36 && (bytes[2] === 40 || bytes[2] === 41)) {
|
|
263
|
+
group = bytes[2] === 40 ? 0 : 1;
|
|
264
|
+
charset = bytes[3] | 128;
|
|
265
|
+
} else if (length === 6 && this.encoding !== "iso2022_kr" && bytes[3] === 27 && bytes[4] === 36 && bytes[5] === 66) {
|
|
266
|
+
group = 0;
|
|
267
|
+
charset = 194;
|
|
268
|
+
} else return this.invalid();
|
|
269
|
+
if (charset !== 66 && !pythonIso2022Charsets[this.encoding].includes(charset)) return this.invalid();
|
|
270
|
+
this.groups[group] = charset;
|
|
271
|
+
return length;
|
|
272
|
+
}
|
|
273
|
+
decode(bytes = new Uint8Array(), options = {}) {
|
|
274
|
+
const previous = this.pending, pending = [...previous];
|
|
275
|
+
let output = "";
|
|
276
|
+
if (bytes.length) this.pending = [];
|
|
277
|
+
for (const byte of bytes) {
|
|
278
|
+
pending.push(byte);
|
|
279
|
+
while (pending.length) {
|
|
280
|
+
const first = pending[0];
|
|
281
|
+
let consumed = 1;
|
|
282
|
+
if (this.through) {
|
|
283
|
+
output += String.fromCharCode(first);
|
|
284
|
+
if (escapeEnd(first)) this.through = false;
|
|
285
|
+
} else if (first === 27) {
|
|
286
|
+
if (pending.length < 2) break;
|
|
287
|
+
if ([40, 41, 36, 46, 38].includes(pending[1])) {
|
|
288
|
+
const length = this.escape(pending);
|
|
289
|
+
if (length === void 0) break;
|
|
290
|
+
consumed = length;
|
|
291
|
+
} else if (this.encoding === "iso2022_jp_2" && pending[1] === 78) {
|
|
292
|
+
if (pending.length < 3) break;
|
|
293
|
+
output += this.secondary(pending[2]);
|
|
294
|
+
consumed = 3;
|
|
295
|
+
} else {
|
|
296
|
+
output += "\x1B";
|
|
297
|
+
this.through = true;
|
|
298
|
+
}
|
|
299
|
+
} else if (this.encoding === "iso2022_kr" && (first === 14 || first === 15)) this.shifted = first === 14;
|
|
300
|
+
else if (first === 10) {
|
|
301
|
+
this.shifted = false;
|
|
302
|
+
output += "\n";
|
|
303
|
+
} else if (first < 32) output += String.fromCharCode(first);
|
|
304
|
+
else if (first >= 128) return this.invalid();
|
|
305
|
+
else {
|
|
306
|
+
const charset = this.groups[this.shifted ? 1 : 0];
|
|
307
|
+
if (charset === 66) output += String.fromCharCode(first);
|
|
308
|
+
else {
|
|
309
|
+
consumed = charset & 128 ? 2 : 1;
|
|
310
|
+
if (pending.length < consumed) break;
|
|
311
|
+
output += this.character(charset, pending);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
pending.splice(0, consumed);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
if (!options.stream && pending.length) {
|
|
318
|
+
this.pending = previous;
|
|
319
|
+
throw new PythonTextDecodeError("Incomplete ISO-2022 input");
|
|
320
|
+
}
|
|
321
|
+
if (pending.length > 8) throw new PythonIso2022PendingError();
|
|
322
|
+
this.pending = pending;
|
|
323
|
+
return output;
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
// packages/safe-bash-csv-engine/src/python-hz.ts
|
|
328
|
+
var PythonHzDecoder = class {
|
|
329
|
+
shifted = false;
|
|
330
|
+
pending;
|
|
331
|
+
gb = new PythonMultibyteDecoder(pythonMultibyteTables.gb2312);
|
|
332
|
+
decode(bytes = new Uint8Array(), options = {}) {
|
|
333
|
+
let pending = this.pending, output = "";
|
|
334
|
+
if (bytes.length) this.pending = void 0;
|
|
335
|
+
for (const byte of bytes) {
|
|
336
|
+
if (pending !== void 0) {
|
|
337
|
+
const lead = pending;
|
|
338
|
+
pending = void 0;
|
|
339
|
+
if (lead === 126) {
|
|
340
|
+
if (!this.shifted && byte === 123) this.shifted = true;
|
|
341
|
+
else if (this.shifted && byte === 125) this.shifted = false;
|
|
342
|
+
else if (!this.shifted && byte === 126) output += "~";
|
|
343
|
+
else if (!this.shifted && byte === 10) continue;
|
|
344
|
+
else throw new PythonTextDecodeError("Invalid HZ input");
|
|
345
|
+
} else if (this.shifted && lead >= 33 && lead <= 125 && byte >= 33 && byte <= 126) {
|
|
346
|
+
output += this.gb.decode(Uint8Array.of(lead + 128, byte + 128));
|
|
347
|
+
} else throw new PythonTextDecodeError("Invalid HZ input");
|
|
348
|
+
} else if (byte >= 128) throw new PythonTextDecodeError("Invalid HZ input");
|
|
349
|
+
else if (this.shifted || byte === 126) pending = byte;
|
|
350
|
+
else output += String.fromCharCode(byte);
|
|
351
|
+
}
|
|
352
|
+
if (!options.stream && pending !== void 0) throw new PythonTextDecodeError("Incomplete HZ input");
|
|
353
|
+
this.pending = pending;
|
|
354
|
+
return output;
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
|
|
175
358
|
// packages/safe-bash-csv-engine/src/python-utf32.ts
|
|
176
359
|
var PythonUtf32Decoder = class {
|
|
177
360
|
little;
|
|
@@ -224,15 +407,15 @@ var PythonTextDecoder = class {
|
|
|
224
407
|
constructor(encoding) {
|
|
225
408
|
const name = normalizeEncoding(encoding);
|
|
226
409
|
const canonical = Object.hasOwn(pythonCodecAliases, name) ? pythonCodecAliases[name] : void 0;
|
|
227
|
-
if (canonical === void 0 || !["utf-8-sig", "utf-8", "utf-16", "utf-16-le", "utf-16-be", "utf-32", "utf-32-le", "utf-32-be"].includes(canonical) && !Object.hasOwn(fileCodepages, canonical) && !Object.hasOwn(pythonMultibyteTables, canonical)) throw new RangeError(`unknown encoding: ${encoding}`);
|
|
410
|
+
if (canonical === void 0 || !["hz", "utf-8-sig", "utf-8", "utf-16", "utf-16-le", "utf-16-be", "utf-32", "utf-32-le", "utf-32-be"].includes(canonical) && !Object.hasOwn(pythonIso2022Charsets, canonical) && !Object.hasOwn(fileCodepages, canonical) && !Object.hasOwn(pythonMultibyteTables, canonical)) throw new RangeError(`unknown encoding: ${encoding}`);
|
|
228
411
|
this.encoding = canonical;
|
|
229
412
|
this.codepoints = fileCodepages[canonical];
|
|
230
413
|
this.signatureComplete = canonical !== "utf-8-sig";
|
|
231
|
-
this.decoder = pythonMultibyteTables[canonical] ? new PythonMultibyteDecoder(pythonMultibyteTables[canonical]) : canonical === "utf-16" || canonical === "utf-16-le" || canonical === "utf-16-be" ? new PythonUtf16Decoder(canonical) : canonical === "utf-32" || canonical === "utf-32-le" || canonical === "utf-32-be" ? new PythonUtf32Decoder(canonical) : new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
|
|
414
|
+
this.decoder = Object.hasOwn(pythonIso2022Charsets, canonical) ? new PythonIso2022Decoder(canonical) : canonical === "hz" ? new PythonHzDecoder() : pythonMultibyteTables[canonical] ? new PythonMultibyteDecoder(pythonMultibyteTables[canonical]) : canonical === "utf-16" || canonical === "utf-16-le" || canonical === "utf-16-be" ? new PythonUtf16Decoder(canonical) : canonical === "utf-32" || canonical === "utf-32-le" || canonical === "utf-32-be" ? new PythonUtf32Decoder(canonical) : new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
|
|
232
415
|
}
|
|
233
416
|
decode(bytes, options) {
|
|
234
417
|
if (this.codepoints) return decodePythonSingleByte(bytes ?? new Uint8Array(), this.codepoints, this.encoding);
|
|
235
|
-
if (this.decoder instanceof PythonUtf16Decoder || this.decoder instanceof PythonUtf32Decoder || this.decoder instanceof PythonMultibyteDecoder) return this.decoder.decode(bytes, options);
|
|
418
|
+
if (this.decoder instanceof PythonIso2022Decoder || this.decoder instanceof PythonHzDecoder || this.decoder instanceof PythonUtf16Decoder || this.decoder instanceof PythonUtf32Decoder || this.decoder instanceof PythonMultibyteDecoder) return this.decoder.decode(bytes, options);
|
|
236
419
|
try {
|
|
237
420
|
let offset = 0;
|
|
238
421
|
if (!this.signatureComplete) {
|
|
@@ -259,5 +442,6 @@ var PythonTextDecoder = class {
|
|
|
259
442
|
};
|
|
260
443
|
|
|
261
444
|
export {
|
|
445
|
+
PythonIso2022PendingError,
|
|
262
446
|
PythonTextDecoder
|
|
263
447
|
};
|
|
@@ -110,7 +110,7 @@ var PatchPublication = class {
|
|
|
110
110
|
data: new Uint8Array()
|
|
111
111
|
}, {
|
|
112
112
|
parent,
|
|
113
|
-
retainCleanup:
|
|
113
|
+
...retained ? { retainCleanup: true } : {},
|
|
114
114
|
signal: context.signal,
|
|
115
115
|
...mode === void 0 ? {} : { mode },
|
|
116
116
|
...mtimeMs === void 0 ? {} : { atimeMs: mtimeMs, mtimeMs }
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
import {
|
|
16
16
|
createLlmService,
|
|
17
17
|
validateModelOptions
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-SENLC5KK.js";
|
|
19
19
|
import {
|
|
20
20
|
validateJsonData
|
|
21
21
|
} from "./chunk-3PO534WJ.js";
|
|
@@ -1929,9 +1929,8 @@ function interpolate(text, params, validateOnly = false, admitText) {
|
|
|
1929
1929
|
while (index + 1 < text.length && "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_".includes(text[index + 1])) name += text[++index];
|
|
1930
1930
|
if (!name || "0123456789".includes(name[0]) || braced && text[index + 1] !== "}") throw new Error(`Invalid placeholder in template at position ${start}`);
|
|
1931
1931
|
if (braced) index++;
|
|
1932
|
-
if (!Object.hasOwn(params, name))
|
|
1933
|
-
|
|
1934
|
-
} else if (!validateOnly) append(String(params[name]));
|
|
1932
|
+
if (!Object.hasOwn(params, name)) missing.push(name);
|
|
1933
|
+
else if (!validateOnly) append(String(params[name]));
|
|
1935
1934
|
}
|
|
1936
1935
|
if (missing.length) throw new Error(`Missing variables: ${missing.join(", ")}`);
|
|
1937
1936
|
return result;
|
|
@@ -2816,7 +2815,7 @@ var llmReferenceVersion = "0.27.1";
|
|
|
2816
2815
|
var LlmPromptUsageError = class extends Error {
|
|
2817
2816
|
};
|
|
2818
2817
|
async function parse(length, text, step, chat = false, toolsDebugEnv) {
|
|
2819
|
-
const parsed = { toolNames: [], functions: [], chainLimit: 5, prompt: "", queries: [], fragments: [], systemFragments: [], params: {}, options: /* @__PURE__ */ Object.create(null), attachments: [] };
|
|
2818
|
+
const parsed = { toolNames: [], functions: [], chainLimit: 5, prompt: "", queries: [], fragments: [], systemFragments: [], params: {}, optionNames: [], options: /* @__PURE__ */ Object.create(null), attachments: [] };
|
|
2820
2819
|
const operands = [];
|
|
2821
2820
|
let ended = false, chainLimit;
|
|
2822
2821
|
for (let index = 0; index < length; index++) {
|
|
@@ -2880,8 +2879,10 @@ Error: No such option: ${flag}${await chatOptionSuggestion(flag, step)}`);
|
|
|
2880
2879
|
else if (flag === "-p" || flag === "--param") Object.defineProperty(parsed.params, value, { value: text(++index), enumerable: true, configurable: true, writable: true });
|
|
2881
2880
|
else if (flag === "-m" || flag === "--model") parsed.model = value;
|
|
2882
2881
|
else if (flag === "-s" || flag === "--system") parsed.system = value;
|
|
2883
|
-
else if (flag === "-o" || flag === "--option")
|
|
2884
|
-
|
|
2882
|
+
else if (flag === "-o" || flag === "--option") {
|
|
2883
|
+
if (!Object.hasOwn(parsed.options, value)) parsed.optionNames.push(value);
|
|
2884
|
+
parsed.options[value] = text(++index);
|
|
2885
|
+
} else if (flag === "--at" || flag === "--attachment-type") parsed.attachments.push({ path: value, mimeType: text(++index) });
|
|
2885
2886
|
else parsed.attachments.push({ path: value });
|
|
2886
2887
|
break;
|
|
2887
2888
|
}
|
|
@@ -3223,7 +3224,7 @@ async function execute(context, service, limits, templateLoaderOptions, collecti
|
|
|
3223
3224
|
if (stored) {
|
|
3224
3225
|
if (!isChat && stored.schema_object) schema = stored.schema_object;
|
|
3225
3226
|
try {
|
|
3226
|
-
validateLlmTemplateParameters(stored, args.params);
|
|
3227
|
+
if (!isChat) validateLlmTemplateParameters(stored, args.params);
|
|
3227
3228
|
} catch (error) {
|
|
3228
3229
|
throw new Error(`Error: ${error instanceof Error ? error.message : "Invalid template"}`);
|
|
3229
3230
|
}
|
|
@@ -3253,6 +3254,25 @@ async function execute(context, service, limits, templateLoaderOptions, collecti
|
|
|
3253
3254
|
Try 'llm chat -h' for help.
|
|
3254
3255
|
|
|
3255
3256
|
Error: Got unexpected extra argument (${args.prompt})`);
|
|
3257
|
+
let chatModelOptions;
|
|
3258
|
+
if (isChat) {
|
|
3259
|
+
const configured = await configuration.modelOptions(entry.model.id);
|
|
3260
|
+
const names = args.optionNames;
|
|
3261
|
+
chatModelOptions = names.length ? args.options : configured;
|
|
3262
|
+
if (names.length) {
|
|
3263
|
+
const rules = entry.model.options ?? {}, errors = [];
|
|
3264
|
+
const ordered = [...Object.keys(rules).filter((name) => Object.hasOwn(args.options, name)), ...names.filter((name) => !Object.hasOwn(rules, name))];
|
|
3265
|
+
for (const name of ordered) {
|
|
3266
|
+
await step();
|
|
3267
|
+
try {
|
|
3268
|
+
validateModelOptions(entry.model, { [name]: args.options[name] });
|
|
3269
|
+
} catch (error) {
|
|
3270
|
+
errors.push(error instanceof Error ? error.message : String(error));
|
|
3271
|
+
}
|
|
3272
|
+
}
|
|
3273
|
+
if (errors.length) throw new Error("Error: " + errors.join("\n"));
|
|
3274
|
+
}
|
|
3275
|
+
}
|
|
3256
3276
|
const loadSelectedTools = async () => {
|
|
3257
3277
|
let selectedTools2;
|
|
3258
3278
|
try {
|
|
@@ -3444,7 +3464,6 @@ Error: Got unexpected extra argument (${args.prompt})`);
|
|
|
3444
3464
|
let initialPromptFragments = [], initialSystemFragments = [];
|
|
3445
3465
|
const initialAttachments = [], initialSourceAttachments = [];
|
|
3446
3466
|
if (chat) {
|
|
3447
|
-
validateModelOptions(entry.model, { ...await configuration.modelOptions(entry.model.id), ...args.options });
|
|
3448
3467
|
initialPromptFragments = await prepareFragments(args.fragments, false);
|
|
3449
3468
|
initialSystemFragments = await prepareFragments(args.systemFragments, true);
|
|
3450
3469
|
initialAttachments.push(...pluginAttachments);
|
|
@@ -3576,7 +3595,7 @@ ${args.prompt}` : evaluated.prompt;
|
|
|
3576
3595
|
}
|
|
3577
3596
|
if (chat && (stored ? ["exit", "quit"].includes(stripPythonWhitespace(prompt)) : chatPrompt.exit)) return { exitCode: 0 };
|
|
3578
3597
|
if (!entry) throw new Error("No model selected; use --model or configure defaultModel");
|
|
3579
|
-
args.options = { ...await configuration.modelOptions(entry.model.id), ...
|
|
3598
|
+
args.options = chat ? { ...chatModelOptions } : { ...await configuration.modelOptions(entry.model.id), ...stored?.options, ...args.options };
|
|
3580
3599
|
args.attachments = [
|
|
3581
3600
|
...(chat ? [] : stored?.attachments ?? []).map((path) => ({ path })),
|
|
3582
3601
|
...args.attachments.filter((item) => item.mimeType === void 0),
|
|
@@ -52,7 +52,7 @@ function validateModelOptions(model, values) {
|
|
|
52
52
|
const text = String(input).toLowerCase();
|
|
53
53
|
if (["true", "1", "yes", "on", "y", "t"].includes(text)) value = true;
|
|
54
54
|
else if (["false", "0", "no", "off", "n", "f"].includes(text)) value = false;
|
|
55
|
-
else fail("Input should be a valid boolean");
|
|
55
|
+
else fail(typeof input === "string" ? "Input should be a valid boolean, unable to interpret input" : "Input should be a valid boolean");
|
|
56
56
|
break;
|
|
57
57
|
}
|
|
58
58
|
case "object":
|
|
@@ -1303,7 +1303,7 @@ async function withEmbeddingFileGlob(options, source, operation) {
|
|
|
1303
1303
|
|
|
1304
1304
|
// packages/safe-bash-command-llm/src/import-files.ts
|
|
1305
1305
|
import { FsError as FsError9 } from "../safe-bash-contracts/index.js";
|
|
1306
|
-
import { PythonTextDecoder, PythonTextDecodeError } from "../safe-bash-csv-engine/text-decoder.js";
|
|
1306
|
+
import { PythonTextDecoder, PythonTextDecodeError, PythonIso2022PendingError } from "../safe-bash-csv-engine/text-decoder.js";
|
|
1307
1307
|
async function withFileEmbeddingEntries(options, files, operation) {
|
|
1308
1308
|
const { fs, directory, signal } = options, maxBytes = options.maxInputBytes ?? Infinity;
|
|
1309
1309
|
if (maxBytes !== Infinity && (!Number.isSafeInteger(maxBytes) || maxBytes < 0)) throw new RangeError("Invalid embedding input byte limit");
|
|
@@ -1347,7 +1347,7 @@ async function withFileEmbeddingEntries(options, files, operation) {
|
|
|
1347
1347
|
} catch (error) {
|
|
1348
1348
|
failedAttempt = true;
|
|
1349
1349
|
signal.throwIfAborted();
|
|
1350
|
-
if (!(error instanceof PythonTextDecodeError)) throw error;
|
|
1350
|
+
if (!(error instanceof PythonTextDecodeError) && !(error instanceof PythonIso2022PendingError)) throw error;
|
|
1351
1351
|
failedAttempt = false;
|
|
1352
1352
|
} finally {
|
|
1353
1353
|
if (!accepted) try {
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
createLlmCommands,
|
|
4
4
|
llmCommands,
|
|
5
5
|
llmReferenceVersion
|
|
6
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
6
|
+
} from "../safe-bash/command-chunks/chunk-RKAL5VFP.js";
|
|
7
7
|
import "../safe-bash/command-chunks/chunk-MCUDSE4H.js";
|
|
8
8
|
import "../safe-bash/command-chunks/chunk-WOT2YXBT.js";
|
|
9
9
|
import "../safe-bash/command-chunks/chunk-BZLLQWRK.js";
|
|
10
|
-
import "../safe-bash/command-chunks/chunk-
|
|
10
|
+
import "../safe-bash/command-chunks/chunk-SENLC5KK.js";
|
|
11
11
|
import "../safe-bash/command-chunks/chunk-3PO534WJ.js";
|
|
12
12
|
import "../safe-bash/command-chunks/chunk-B74LVFAN.js";
|
|
13
13
|
import "../safe-bash/command-chunks/chunk-GDH7OVYK.js";
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
serializeLlmTokenUsage,
|
|
44
44
|
streamLlmToolChain,
|
|
45
45
|
validateLlmTemplateParameters
|
|
46
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
46
|
+
} from "../safe-bash/command-chunks/chunk-RKAL5VFP.js";
|
|
47
47
|
import "../safe-bash/command-chunks/chunk-MCUDSE4H.js";
|
|
48
48
|
import {
|
|
49
49
|
createLlmConfiguration
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
import {
|
|
55
55
|
createLlmService,
|
|
56
56
|
validateModelOptions
|
|
57
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
57
|
+
} from "../safe-bash/command-chunks/chunk-SENLC5KK.js";
|
|
58
58
|
import "../safe-bash/command-chunks/chunk-3PO534WJ.js";
|
|
59
59
|
import {
|
|
60
60
|
getLlmAttachmentUrlId
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLlmService
|
|
3
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
3
|
+
} from "../safe-bash/command-chunks/chunk-SENLC5KK.js";
|
|
4
4
|
import "../safe-bash/command-chunks/chunk-3PO534WJ.js";
|
|
5
5
|
import "../safe-bash/command-chunks/chunk-CKQ5SXOO.js";
|
|
6
6
|
import "../safe-bash/command-chunks/chunk-B6NAEWHC.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
patchCommand
|
|
3
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
3
|
+
} from "../safe-bash/command-chunks/chunk-OU5UEUZN.js";
|
|
4
4
|
import "../safe-bash/command-chunks/chunk-6GCK2KSL.js";
|
|
5
5
|
import "../safe-bash/command-chunks/chunk-2C4QMQQD.js";
|
|
6
6
|
import "../safe-bash/command-chunks/chunk-OQNX2OOS.js";
|
|
7
7
|
import "../safe-bash/command-chunks/chunk-5XUWGUGN.js";
|
|
8
8
|
import "../safe-bash/command-chunks/chunk-AJEQUVDN.js";
|
|
9
|
-
import "../safe-bash/command-chunks/chunk-
|
|
9
|
+
import "../safe-bash/command-chunks/chunk-O3KFOFJM.js";
|
|
10
10
|
import "../safe-bash/command-chunks/chunk-KASXIRKD.js";
|
|
11
11
|
import "../safe-bash/command-chunks/chunk-KHUT7BB5.js";
|
|
12
12
|
import {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PatchPublication
|
|
3
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
3
|
+
} from "../safe-bash/command-chunks/chunk-O3KFOFJM.js";
|
|
4
4
|
import "../safe-bash/command-chunks/chunk-KASXIRKD.js";
|
|
5
5
|
import "../safe-bash/command-chunks/chunk-KHUT7BB5.js";
|
|
6
6
|
import "../safe-bash/command-chunks/chunk-65DS4IOB.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
patchCommand
|
|
3
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
3
|
+
} from "../safe-bash/command-chunks/chunk-OU5UEUZN.js";
|
|
4
4
|
import "../safe-bash/command-chunks/chunk-6GCK2KSL.js";
|
|
5
5
|
import "../safe-bash/command-chunks/chunk-2C4QMQQD.js";
|
|
6
6
|
import "../safe-bash/command-chunks/chunk-OQNX2OOS.js";
|
|
7
7
|
import "../safe-bash/command-chunks/chunk-5XUWGUGN.js";
|
|
8
8
|
import "../safe-bash/command-chunks/chunk-AJEQUVDN.js";
|
|
9
|
-
import "../safe-bash/command-chunks/chunk-
|
|
9
|
+
import "../safe-bash/command-chunks/chunk-O3KFOFJM.js";
|
|
10
10
|
import "../safe-bash/command-chunks/chunk-KASXIRKD.js";
|
|
11
11
|
import "../safe-bash/command-chunks/chunk-KHUT7BB5.js";
|
|
12
12
|
import "../safe-bash/command-chunks/chunk-65DS4IOB.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PythonTextDecoder
|
|
3
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
3
|
+
} from "../safe-bash/command-chunks/chunk-4VHCA4KK.js";
|
|
4
4
|
import "../safe-bash/command-chunks/chunk-OLXMWQJ5.js";
|
|
5
5
|
import "../safe-bash/command-chunks/chunk-OOYVZAWL.js";
|
|
6
6
|
import "../safe-bash/command-chunks/chunk-ZERCTWUI.js";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const pythonIso2022Charsets: Readonly<Record<string, readonly number[]>>;
|
|
2
|
+
export declare class PythonIso2022PendingError extends Error {
|
|
3
|
+
constructor();
|
|
4
|
+
}
|
|
5
|
+
/** Bounded ISO-2022 designation and shift state, with existing Python mappings. */
|
|
6
|
+
export declare class PythonIso2022Decoder {
|
|
7
|
+
private readonly encoding;
|
|
8
|
+
private readonly groups;
|
|
9
|
+
private shifted;
|
|
10
|
+
private through;
|
|
11
|
+
private pending;
|
|
12
|
+
private readonly maps;
|
|
13
|
+
constructor(encoding: string);
|
|
14
|
+
private invalid;
|
|
15
|
+
private character;
|
|
16
|
+
private secondary;
|
|
17
|
+
private escape;
|
|
18
|
+
decode(bytes?: Uint8Array, options?: {
|
|
19
|
+
stream?: boolean;
|
|
20
|
+
}): string;
|
|
21
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
PythonIso2022PendingError,
|
|
2
3
|
PythonTextDecoder
|
|
3
|
-
} from "../safe-bash/command-chunks/chunk-
|
|
4
|
+
} from "../safe-bash/command-chunks/chunk-4VHCA4KK.js";
|
|
4
5
|
import "../safe-bash/command-chunks/chunk-OLXMWQJ5.js";
|
|
5
6
|
import {
|
|
6
7
|
PythonTextDecodeError
|
|
@@ -10,6 +11,7 @@ import "../safe-bash/command-chunks/chunk-WIUEM7HP.js";
|
|
|
10
11
|
import "../safe-bash/command-chunks/chunk-HNEWGADJ.js";
|
|
11
12
|
import "../safe-bash/command-chunks/chunk-65DS4IOB.js";
|
|
12
13
|
export {
|
|
14
|
+
PythonIso2022PendingError,
|
|
13
15
|
PythonTextDecodeError,
|
|
14
16
|
PythonTextDecoder
|
|
15
17
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poe-platform/safe-bash",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.822",
|
|
4
4
|
"description": "Extensible virtual shell with pluggable filesystems and streaming commands",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -1407,7 +1407,7 @@
|
|
|
1407
1407
|
"access": "public"
|
|
1408
1408
|
},
|
|
1409
1409
|
"dependencies": {
|
|
1410
|
-
"@poe-platform/safe-fs": "0.1.
|
|
1410
|
+
"@poe-platform/safe-fs": "0.1.822",
|
|
1411
1411
|
"pdf-lib": "1.17.1",
|
|
1412
1412
|
"@types/node": "^25.2.2",
|
|
1413
1413
|
"@formatjs/intl-numberformat": "9.4.0",
|