@factiii/runner 0.10.0 → 0.10.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/dist/cli.js +32 -15
- package/index/index.js +2 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -13461,10 +13461,11 @@ function execLogin(command, opts) {
|
|
|
13461
13461
|
return new Promise((resolve2) => {
|
|
13462
13462
|
let output = "";
|
|
13463
13463
|
let settled = false;
|
|
13464
|
+
let timer;
|
|
13464
13465
|
const done = (code, extra = "") => {
|
|
13465
13466
|
if (settled) return;
|
|
13466
13467
|
settled = true;
|
|
13467
|
-
clearTimeout(timer);
|
|
13468
|
+
if (timer) clearTimeout(timer);
|
|
13468
13469
|
resolve2({ code, output: (output + extra).slice(-cap) });
|
|
13469
13470
|
};
|
|
13470
13471
|
let proc;
|
|
@@ -13481,7 +13482,7 @@ function execLogin(command, opts) {
|
|
|
13481
13482
|
done(-1, err instanceof Error ? err.message : String(err));
|
|
13482
13483
|
return;
|
|
13483
13484
|
}
|
|
13484
|
-
|
|
13485
|
+
timer = setTimeout(() => {
|
|
13485
13486
|
killTree(proc);
|
|
13486
13487
|
done(-1, `
|
|
13487
13488
|
[timed out after ${Math.round(opts.timeout / 1e3)}s]`);
|
|
@@ -16808,6 +16809,19 @@ function posixDirname(p) {
|
|
|
16808
16809
|
function shEscape(s) {
|
|
16809
16810
|
return `'${s.replace(/'/g, `'\\''`)}'`;
|
|
16810
16811
|
}
|
|
16812
|
+
async function writeBase64File(target, abs, b64, opts = {}) {
|
|
16813
|
+
const file = shEscape(abs);
|
|
16814
|
+
const cap = opts.maxBytes ? ` && if [ $(wc -c < ${file}) -gt ${opts.maxBytes} ]; then rm -f ${file}; echo 'file too large' >&2; exit 1; fi` : "";
|
|
16815
|
+
await target.runWithStdin(
|
|
16816
|
+
[
|
|
16817
|
+
"bash",
|
|
16818
|
+
"-c",
|
|
16819
|
+
`mkdir -p ${shEscape(posixDirname(abs))} && base64 -d ${opts.append ? ">>" : ">"} ${file}${cap}`
|
|
16820
|
+
],
|
|
16821
|
+
b64,
|
|
16822
|
+
`Write ${abs}`
|
|
16823
|
+
);
|
|
16824
|
+
}
|
|
16811
16825
|
var TerminalModeEngine = class {
|
|
16812
16826
|
constructor(core, emitter) {
|
|
16813
16827
|
this.core = core;
|
|
@@ -17204,32 +17218,35 @@ var TerminalModeEngine = class {
|
|
|
17204
17218
|
throw new Error("Invalid base64 payload.");
|
|
17205
17219
|
}
|
|
17206
17220
|
this.expectWrite(String(postId), path17);
|
|
17207
|
-
await target
|
|
17208
|
-
`mkdir -p ${shEscape(posixDirname(abs))} && printf %s ${shEscape(b64)} | base64 -d > ${shEscape(abs)}`
|
|
17209
|
-
);
|
|
17221
|
+
await writeBase64File(target, abs, b64);
|
|
17210
17222
|
const session = this.sessions.get(String(postId));
|
|
17211
17223
|
if (session) delete session.buffers[path17];
|
|
17212
17224
|
}
|
|
17213
|
-
/**
|
|
17214
|
-
* card worktree so it never touches the repo)
|
|
17225
|
+
/** Append one chunk of a dropped image to the per-space drops dir
|
|
17226
|
+
* (`paths.root`, OUTSIDE the card worktree so it never touches the repo).
|
|
17227
|
+
* Returns the absolute path on the last chunk, '' before that. */
|
|
17215
17228
|
async terminalDropImage({
|
|
17216
17229
|
postId,
|
|
17217
17230
|
content,
|
|
17218
|
-
ext
|
|
17231
|
+
ext,
|
|
17232
|
+
dropId,
|
|
17233
|
+
last
|
|
17219
17234
|
}) {
|
|
17220
17235
|
const target = this.getBareTarget(postId);
|
|
17221
17236
|
if (!/^[A-Za-z0-9+/=\n\r]*$/.test(content)) {
|
|
17222
17237
|
throw new Error("Invalid base64 payload.");
|
|
17223
17238
|
}
|
|
17224
|
-
if (content.length > 14e6) {
|
|
17225
|
-
throw new Error("Image too large (max ~10MB).");
|
|
17226
|
-
}
|
|
17227
17239
|
const safeExt = (ext || "png").toLowerCase().replace(/[^a-z0-9]/g, "") || "png";
|
|
17240
|
+
const oneShot = !dropId;
|
|
17241
|
+
const safeId2 = oneShot ? (0, import_crypto.randomUUID)() : dropId.toLowerCase().replace(/[^a-z0-9-]/g, "");
|
|
17242
|
+
if (!safeId2) throw new Error("Invalid drop id.");
|
|
17228
17243
|
const dropsDir = `${target.paths.root}/drops`;
|
|
17229
|
-
const abs = `${dropsDir}/${
|
|
17230
|
-
await target
|
|
17231
|
-
|
|
17232
|
-
|
|
17244
|
+
const abs = `${dropsDir}/${safeId2}.${safeExt}`;
|
|
17245
|
+
await writeBase64File(target, abs, content, {
|
|
17246
|
+
append: !oneShot,
|
|
17247
|
+
maxBytes: 1e7
|
|
17248
|
+
});
|
|
17249
|
+
if (!last && !oneShot) return "";
|
|
17233
17250
|
try {
|
|
17234
17251
|
await target.sh(
|
|
17235
17252
|
`find ${shEscape(dropsDir)} -type f -mtime +1 -delete 2>/dev/null || true`
|
package/index/index.js
CHANGED
|
@@ -6915,9 +6915,9 @@ var require_dist = __commonJS({
|
|
|
6915
6915
|
}
|
|
6916
6916
|
});
|
|
6917
6917
|
|
|
6918
|
-
// ../../node_modules
|
|
6918
|
+
// ../../node_modules/content-type/index.js
|
|
6919
6919
|
var require_content_type = __commonJS({
|
|
6920
|
-
"../../node_modules
|
|
6920
|
+
"../../node_modules/content-type/index.js"(exports2) {
|
|
6921
6921
|
"use strict";
|
|
6922
6922
|
var PARAM_REGEXP = /; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g;
|
|
6923
6923
|
var TEXT_REGEXP = /^[\u000b\u0020-\u007e\u0080-\u00ff]+$/;
|
package/package.json
CHANGED