flyspace-cli 0.1.63 → 0.1.64
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/{chunk-SBNBTJKW.js → chunk-FNKFJQB7.js} +427 -72
- package/dist/{chunk-UZMHXV4D.js → chunk-O7OYNQND.js} +46 -15
- package/dist/{chunk-PLLJ7M62.js → chunk-WFUR2BYO.js} +12 -1
- package/dist/cli.js +118 -252
- package/dist/index.js +2 -2
- package/dist/{threads-BFRTS4EB.js → threads-VOXFIRD6.js} +4 -3
- package/package.json +1 -1
|
@@ -403,9 +403,24 @@ function extractLocalImagePaths(body) {
|
|
|
403
403
|
}
|
|
404
404
|
return paths2;
|
|
405
405
|
}
|
|
406
|
+
async function storeScratchImage(workspace, filename, body) {
|
|
407
|
+
const mimetype = mimetypeOf(filename);
|
|
408
|
+
if (!mimetype || !/^[\w-]+$/.test(workspace) || body.byteLength > MAX_FILE_BYTES) return null;
|
|
409
|
+
const key = `${SCRATCH_PREFIX}/${workspace}/${randomUUID()}-${sanitizeFilename(basename2(filename))}`;
|
|
410
|
+
await getR2Client().send(
|
|
411
|
+
new PutObjectCommand({ Bucket: getR2Bucket(), Key: key, Body: body, ContentType: mimetype })
|
|
412
|
+
);
|
|
413
|
+
return `/api/attachments/${encodeKeyForUrl(key)}`;
|
|
414
|
+
}
|
|
415
|
+
var remoteUploader = null;
|
|
416
|
+
function setScratchImageUploader(fn) {
|
|
417
|
+
remoteUploader = fn;
|
|
418
|
+
}
|
|
419
|
+
function hasR2Keys() {
|
|
420
|
+
return Boolean(process.env["CLOUDFLARE_R2_ACCESS_KEY_ID"] && process.env["CLOUDFLARE_R2_SECRET_ACCESS_KEY"]);
|
|
421
|
+
}
|
|
406
422
|
async function uploadOne(path) {
|
|
407
|
-
|
|
408
|
-
if (!mimetype) return null;
|
|
423
|
+
if (!mimetypeOf(path)) return null;
|
|
409
424
|
try {
|
|
410
425
|
const info = await stat(path);
|
|
411
426
|
if (!info.isFile()) return null;
|
|
@@ -413,17 +428,11 @@ async function uploadOne(path) {
|
|
|
413
428
|
console.error(`[attachment-uploader] ${path} is ${info.size} bytes, over the ${MAX_FILE_BYTES} limit`);
|
|
414
429
|
return null;
|
|
415
430
|
}
|
|
416
|
-
const
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
Body: await readFile(path),
|
|
422
|
-
ContentType: mimetype
|
|
423
|
-
})
|
|
424
|
-
);
|
|
425
|
-
if (debug) console.log(`[attachment-uploader] ${path} -> ${key} (${info.size} bytes)`);
|
|
426
|
-
return `/api/attachments/${encodeKeyForUrl(key)}`;
|
|
431
|
+
const body = await readFile(path);
|
|
432
|
+
const upload = !hasR2Keys() && remoteUploader ? remoteUploader : storeScratchImage;
|
|
433
|
+
const url = await upload(getProfile(), basename2(path), body);
|
|
434
|
+
if (debug) console.log(`[attachment-uploader] ${path} -> ${url} (${info.size} bytes)`);
|
|
435
|
+
return url;
|
|
427
436
|
} catch (err) {
|
|
428
437
|
console.error(`[attachment-uploader] failed to upload ${path}:`, err.message);
|
|
429
438
|
return null;
|
|
@@ -440,10 +449,10 @@ async function uploadLocalImages(rawBody) {
|
|
|
440
449
|
if (url) urls.set(path, url);
|
|
441
450
|
})
|
|
442
451
|
);
|
|
443
|
-
if (urls.size === 0) return body;
|
|
444
452
|
return body.replace(LOCAL_IMAGE_LINK, (original, alt, path) => {
|
|
453
|
+
if (!localPaths.includes(path)) return original;
|
|
445
454
|
const url = urls.get(path);
|
|
446
|
-
return url ? `` :
|
|
455
|
+
return url ? `` : `_(Image unavailable: ${alt || basename2(path)})_`;
|
|
447
456
|
});
|
|
448
457
|
}
|
|
449
458
|
|
|
@@ -952,6 +961,27 @@ async function requestPluginSvg(workspace, svg) {
|
|
|
952
961
|
send({ type: "plugin-svg", id, workspace, svg });
|
|
953
962
|
});
|
|
954
963
|
}
|
|
964
|
+
var pendingImages = /* @__PURE__ */ new Map();
|
|
965
|
+
function handleScratchImageResult(id, url) {
|
|
966
|
+
pendingImages.get(id)?.(url);
|
|
967
|
+
pendingImages.delete(id);
|
|
968
|
+
}
|
|
969
|
+
async function requestScratchImage(workspace, filename, body) {
|
|
970
|
+
const send = await whenConnected();
|
|
971
|
+
const id = randomUUID2();
|
|
972
|
+
return new Promise((resolve3, reject) => {
|
|
973
|
+
const timer = setTimeout(() => {
|
|
974
|
+
pendingImages.delete(id);
|
|
975
|
+
reject(new Error("Data API did not answer in time"));
|
|
976
|
+
}, REQUEST_TIMEOUT_MS);
|
|
977
|
+
pendingImages.set(id, (url) => {
|
|
978
|
+
clearTimeout(timer);
|
|
979
|
+
resolve3(url);
|
|
980
|
+
});
|
|
981
|
+
send({ type: "scratch-image", id, workspace, filename, data: body.toString("base64") });
|
|
982
|
+
});
|
|
983
|
+
}
|
|
984
|
+
setScratchImageUploader(requestScratchImage);
|
|
955
985
|
var ACTION_TIMEOUT_MS = 15e4;
|
|
956
986
|
var pendingActions = /* @__PURE__ */ new Map();
|
|
957
987
|
function handleActionResult(id, res) {
|
|
@@ -1124,6 +1154,7 @@ export {
|
|
|
1124
1154
|
requestAttachmentUrl,
|
|
1125
1155
|
handlePluginSvgResult,
|
|
1126
1156
|
requestPluginSvg,
|
|
1157
|
+
handleScratchImageResult,
|
|
1127
1158
|
handleActionResult,
|
|
1128
1159
|
requestAction,
|
|
1129
1160
|
LOCAL_ACTION_PATH,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
loadEnvFiles,
|
|
9
9
|
readHostEndpoint,
|
|
10
10
|
useHostDbWithoutCredentials
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-O7OYNQND.js";
|
|
12
12
|
|
|
13
13
|
// ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/external.js
|
|
14
14
|
var external_exports = {};
|
|
@@ -14625,6 +14625,15 @@ var shareDocAction = defineContract({
|
|
|
14625
14625
|
}),
|
|
14626
14626
|
output: external_exports.object({ url: external_exports.string() })
|
|
14627
14627
|
});
|
|
14628
|
+
var listAutoUpdateSharesAction = defineContract({
|
|
14629
|
+
name: "list_auto_update_shares",
|
|
14630
|
+
description: "Internal: lists the published docs set to auto-update in this Host's workspaces. Polled by the Host itself; never call it directly.",
|
|
14631
|
+
effect: "read",
|
|
14632
|
+
input: external_exports.object({}),
|
|
14633
|
+
output: external_exports.object({
|
|
14634
|
+
shares: external_exports.array(external_exports.object({ channel_id: external_exports.string(), path: external_exports.string() }))
|
|
14635
|
+
})
|
|
14636
|
+
});
|
|
14628
14637
|
var requestPermissionAction = defineContract({
|
|
14629
14638
|
name: "request_permission",
|
|
14630
14639
|
description: "Internal: asks an admin in the thread to allow or deny a blocked tool call. Called by Claude Code itself as the permission prompt tool; never call it directly.",
|
|
@@ -14652,6 +14661,7 @@ var ACTIONS = [
|
|
|
14652
14661
|
postReplyAction,
|
|
14653
14662
|
moveThreadAction,
|
|
14654
14663
|
shareDocAction,
|
|
14664
|
+
listAutoUpdateSharesAction,
|
|
14655
14665
|
requestPermissionAction,
|
|
14656
14666
|
checkPermissionAction
|
|
14657
14667
|
];
|
|
@@ -14789,6 +14799,7 @@ export {
|
|
|
14789
14799
|
postReplyAction,
|
|
14790
14800
|
moveThreadAction,
|
|
14791
14801
|
shareDocAction,
|
|
14802
|
+
listAutoUpdateSharesAction,
|
|
14792
14803
|
requestPermissionAction,
|
|
14793
14804
|
checkPermissionAction,
|
|
14794
14805
|
ACTIONS,
|