flyspace-cli 0.1.63 → 0.1.65
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-5ISKGSFF.js} +491 -76
- package/dist/{chunk-PLLJ7M62.js → chunk-GQ2QZ5WF.js} +40 -1
- package/dist/{chunk-UZMHXV4D.js → chunk-O7OYNQND.js} +46 -15
- package/dist/cli.js +187 -277
- package/dist/index.js +2 -2
- package/dist/{threads-BFRTS4EB.js → threads-AR6D7V3Y.js} +24 -4
- package/package.json +1 -1
|
@@ -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,39 @@ var shareDocAction = defineContract({
|
|
|
14625
14625
|
}),
|
|
14626
14626
|
output: external_exports.object({ url: external_exports.string() })
|
|
14627
14627
|
});
|
|
14628
|
+
var docPath = id.refine(
|
|
14629
|
+
(p) => !p.startsWith("/") && !p.startsWith("\\") && !/^[a-z]:/i.test(p) && !p.split(/[\\/]/).includes(".."),
|
|
14630
|
+
{ message: "path must be relative to the channel folder, without .." }
|
|
14631
|
+
);
|
|
14632
|
+
var openDocAction = defineContract({
|
|
14633
|
+
name: "open_doc",
|
|
14634
|
+
description: "Open a channel doc in the Docs pane of the requester's Flyspace web UI. Use it when you want the user to see a file you created, edited or are referring to, instead of only naming its path. Only the person who sent the message you are answering sees it open.",
|
|
14635
|
+
effect: "write",
|
|
14636
|
+
input: external_exports.object({
|
|
14637
|
+
channel_id: id.describe("The channel the doc belongs to."),
|
|
14638
|
+
path: docPath.describe("Doc path relative to the channel folder, e.g. docs/plan.md."),
|
|
14639
|
+
line: external_exports.number().int().positive().optional().describe("Optional 1-based line to scroll to.")
|
|
14640
|
+
}),
|
|
14641
|
+
output: external_exports.object({ opened: external_exports.boolean() })
|
|
14642
|
+
});
|
|
14643
|
+
var setUiZoomAction = defineContract({
|
|
14644
|
+
name: "set_ui_zoom",
|
|
14645
|
+
description: "Set the whole-UI zoom (display size, same as the View menu's Aa slider) in the requester's Flyspace web UI. Use when the user asks to make text or the UI bigger or smaller. Only the person who sent the message you are answering is affected.",
|
|
14646
|
+
effect: "write",
|
|
14647
|
+
input: external_exports.object({
|
|
14648
|
+
percent: external_exports.number().int().min(80).max(200).describe("Zoom level in percent, 80 to 200, in steps of 10 (e.g. 150).")
|
|
14649
|
+
}),
|
|
14650
|
+
output: external_exports.object({ zoom: external_exports.number() })
|
|
14651
|
+
});
|
|
14652
|
+
var listAutoUpdateSharesAction = defineContract({
|
|
14653
|
+
name: "list_auto_update_shares",
|
|
14654
|
+
description: "Internal: lists the published docs set to auto-update in this Host's workspaces. Polled by the Host itself; never call it directly.",
|
|
14655
|
+
effect: "read",
|
|
14656
|
+
input: external_exports.object({}),
|
|
14657
|
+
output: external_exports.object({
|
|
14658
|
+
shares: external_exports.array(external_exports.object({ channel_id: external_exports.string(), path: external_exports.string() }))
|
|
14659
|
+
})
|
|
14660
|
+
});
|
|
14628
14661
|
var requestPermissionAction = defineContract({
|
|
14629
14662
|
name: "request_permission",
|
|
14630
14663
|
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 +14685,9 @@ var ACTIONS = [
|
|
|
14652
14685
|
postReplyAction,
|
|
14653
14686
|
moveThreadAction,
|
|
14654
14687
|
shareDocAction,
|
|
14688
|
+
openDocAction,
|
|
14689
|
+
setUiZoomAction,
|
|
14690
|
+
listAutoUpdateSharesAction,
|
|
14655
14691
|
requestPermissionAction,
|
|
14656
14692
|
checkPermissionAction
|
|
14657
14693
|
];
|
|
@@ -14789,6 +14825,9 @@ export {
|
|
|
14789
14825
|
postReplyAction,
|
|
14790
14826
|
moveThreadAction,
|
|
14791
14827
|
shareDocAction,
|
|
14828
|
+
openDocAction,
|
|
14829
|
+
setUiZoomAction,
|
|
14830
|
+
listAutoUpdateSharesAction,
|
|
14792
14831
|
requestPermissionAction,
|
|
14793
14832
|
checkPermissionAction,
|
|
14794
14833
|
ACTIONS,
|
|
@@ -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,
|