flyspace-cli 0.1.58 → 0.1.59
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-TAUF3WGB.js → chunk-7W5FEG63.js} +279 -36
- package/dist/cli.js +50 -14
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -19186,6 +19186,111 @@ Nothing was run. Channels on the \`host\` runtime are unaffected.`
|
|
|
19186
19186
|
};
|
|
19187
19187
|
}
|
|
19188
19188
|
|
|
19189
|
+
// src/claude/plugin-ui.ts
|
|
19190
|
+
var SURFACE = "desktop";
|
|
19191
|
+
var CLIENT_ID = "flyspace";
|
|
19192
|
+
var RENDER_TIMEOUT_MS = 5e3;
|
|
19193
|
+
var SETTLE_TIMEOUT_MS = 2e3;
|
|
19194
|
+
var PluginUiSession = class {
|
|
19195
|
+
constructor(stdin) {
|
|
19196
|
+
this.stdin = stdin;
|
|
19197
|
+
}
|
|
19198
|
+
panes = [];
|
|
19199
|
+
status = {};
|
|
19200
|
+
pending = /* @__PURE__ */ new Map();
|
|
19201
|
+
seq = 0;
|
|
19202
|
+
onInvalidate;
|
|
19203
|
+
write(obj) {
|
|
19204
|
+
if (this.stdin.writable) this.stdin.write(`${JSON.stringify(obj)}
|
|
19205
|
+
`);
|
|
19206
|
+
}
|
|
19207
|
+
/** Attach as a surface, then send the user's prompt. */
|
|
19208
|
+
start(prompt) {
|
|
19209
|
+
this.write({
|
|
19210
|
+
type: "control_request",
|
|
19211
|
+
request_id: "flyspace-ui-attach",
|
|
19212
|
+
request: { subtype: "ui_attach", surface: SURFACE, client_id: CLIENT_ID }
|
|
19213
|
+
});
|
|
19214
|
+
this.write({ type: "user", message: { role: "user", content: prompt } });
|
|
19215
|
+
}
|
|
19216
|
+
/** Feed every parsed stdout event through here. */
|
|
19217
|
+
onEvent(event) {
|
|
19218
|
+
if (event.type === "control_response") {
|
|
19219
|
+
const res = event.response;
|
|
19220
|
+
const resolve8 = res?.request_id ? this.pending.get(res.request_id) : void 0;
|
|
19221
|
+
if (!resolve8 || !res?.request_id) return;
|
|
19222
|
+
this.pending.delete(res.request_id);
|
|
19223
|
+
resolve8(res.subtype === "success" ? res.response?.tree : void 0);
|
|
19224
|
+
return;
|
|
19225
|
+
}
|
|
19226
|
+
const e = event;
|
|
19227
|
+
if (e.type !== "system") return;
|
|
19228
|
+
if (e.subtype === "ui_invalidate") this.onInvalidate?.();
|
|
19229
|
+
if (e.subtype === "ui_panes" && Array.isArray(e.panes)) {
|
|
19230
|
+
this.panes = e.panes.filter((p) => typeof p?.id === "string").map((p) => ({
|
|
19231
|
+
id: p.id,
|
|
19232
|
+
title: p.title ?? p.id,
|
|
19233
|
+
...p.plugin ? { plugin: p.plugin } : {}
|
|
19234
|
+
}));
|
|
19235
|
+
} else if (e.subtype === "ui_status" && e.plugin) {
|
|
19236
|
+
if (e.text) this.status[e.plugin] = e.text;
|
|
19237
|
+
else delete this.status[e.plugin];
|
|
19238
|
+
}
|
|
19239
|
+
}
|
|
19240
|
+
render(instanceId) {
|
|
19241
|
+
const requestId = `flyspace-ui-render-${++this.seq}`;
|
|
19242
|
+
return new Promise((resolve8) => {
|
|
19243
|
+
this.pending.set(requestId, resolve8);
|
|
19244
|
+
this.write({
|
|
19245
|
+
type: "control_request",
|
|
19246
|
+
request_id: requestId,
|
|
19247
|
+
request: {
|
|
19248
|
+
subtype: "ui_render",
|
|
19249
|
+
surface: SURFACE,
|
|
19250
|
+
client_id: CLIENT_ID,
|
|
19251
|
+
component: "Pane",
|
|
19252
|
+
instance_id: instanceId,
|
|
19253
|
+
props: {}
|
|
19254
|
+
}
|
|
19255
|
+
});
|
|
19256
|
+
});
|
|
19257
|
+
}
|
|
19258
|
+
/**
|
|
19259
|
+
* Render every open pane, then close stdin so the CLI exits. Resolves with
|
|
19260
|
+
* the snapshot; panes whose render failed or timed out keep no tree.
|
|
19261
|
+
*/
|
|
19262
|
+
async finish() {
|
|
19263
|
+
if (this.panes.length) {
|
|
19264
|
+
await new Promise((resolve8) => {
|
|
19265
|
+
const timer2 = setTimeout(resolve8, SETTLE_TIMEOUT_MS);
|
|
19266
|
+
this.onInvalidate = () => {
|
|
19267
|
+
clearTimeout(timer2);
|
|
19268
|
+
resolve8();
|
|
19269
|
+
};
|
|
19270
|
+
});
|
|
19271
|
+
this.onInvalidate = void 0;
|
|
19272
|
+
}
|
|
19273
|
+
const renders = Promise.all(
|
|
19274
|
+
this.panes.map(async (p) => ({ ...p, tree: await this.render(p.id) }))
|
|
19275
|
+
);
|
|
19276
|
+
let timer;
|
|
19277
|
+
const timeout = new Promise((resolve8) => {
|
|
19278
|
+
timer = setTimeout(() => resolve8(void 0), RENDER_TIMEOUT_MS);
|
|
19279
|
+
});
|
|
19280
|
+
const rendered = await Promise.race([renders, timeout]);
|
|
19281
|
+
clearTimeout(timer);
|
|
19282
|
+
this.pending.clear();
|
|
19283
|
+
this.close();
|
|
19284
|
+
return {
|
|
19285
|
+
panes: rendered ?? this.panes,
|
|
19286
|
+
...Object.keys(this.status).length ? { status: { ...this.status } } : {}
|
|
19287
|
+
};
|
|
19288
|
+
}
|
|
19289
|
+
close() {
|
|
19290
|
+
if (this.stdin.writable) this.stdin.end();
|
|
19291
|
+
}
|
|
19292
|
+
};
|
|
19293
|
+
|
|
19189
19294
|
// src/claude/model-aliases.ts
|
|
19190
19295
|
var MODEL_ALIASES = {
|
|
19191
19296
|
fable: "claude-fable-5"
|
|
@@ -19674,7 +19779,9 @@ var KILLED_TOOL_RE = /exit code (137|143)\b|command timed out after/i;
|
|
|
19674
19779
|
function hasKilledToolResult(event) {
|
|
19675
19780
|
if (event.type !== "user") return false;
|
|
19676
19781
|
return (event.message?.content ?? []).some(
|
|
19677
|
-
(block) => block.type === "tool_result" && block.is_error === true && KILLED_TOOL_RE.test(
|
|
19782
|
+
(block) => block.type === "tool_result" && block.is_error === true && KILLED_TOOL_RE.test(
|
|
19783
|
+
typeof block.content === "string" ? block.content : JSON.stringify(block.content ?? "")
|
|
19784
|
+
)
|
|
19678
19785
|
);
|
|
19679
19786
|
}
|
|
19680
19787
|
function extractActivities(event) {
|
|
@@ -19959,6 +20066,9 @@ function isModelForGateway(model, pinned) {
|
|
|
19959
20066
|
if (!pinned) return true;
|
|
19960
20067
|
return model.split("-")[0].toLowerCase() === pinned.split("-")[0].toLowerCase();
|
|
19961
20068
|
}
|
|
20069
|
+
function usesPluginUi(options) {
|
|
20070
|
+
return Boolean(options.onPluginUi && options.onActivity) && (options.runtime ?? "host") === "host";
|
|
20071
|
+
}
|
|
19962
20072
|
function buildArgs(prompt, botName, options, resumeSessionId, isolatedStyle) {
|
|
19963
20073
|
const args = [
|
|
19964
20074
|
"--print",
|
|
@@ -19966,6 +20076,7 @@ function buildArgs(prompt, botName, options, resumeSessionId, isolatedStyle) {
|
|
|
19966
20076
|
// activity); plain json emits one blob on completion. stream-json with
|
|
19967
20077
|
// --print requires --verbose.
|
|
19968
20078
|
...options.onActivity ? ["--output-format", "stream-json", "--verbose"] : ["--output-format", "json"],
|
|
20079
|
+
...usesPluginUi(options) ? ["--input-format", "stream-json"] : [],
|
|
19969
20080
|
...permissionArgs(options.permissionMode, options.permissionPromptTool),
|
|
19970
20081
|
"--no-chrome",
|
|
19971
20082
|
// `=` form: the flag is variadic and would otherwise swallow the next token.
|
|
@@ -20019,7 +20130,7 @@ function buildArgs(prompt, botName, options, resumeSessionId, isolatedStyle) {
|
|
|
20019
20130
|
if (resumeSessionId) {
|
|
20020
20131
|
args.push("--resume", resumeSessionId);
|
|
20021
20132
|
}
|
|
20022
|
-
args.push(prompt);
|
|
20133
|
+
if (!usesPluginUi(options)) args.push(prompt);
|
|
20023
20134
|
return args;
|
|
20024
20135
|
}
|
|
20025
20136
|
function recordUsage2(response, options) {
|
|
@@ -20048,7 +20159,8 @@ function runCli(prompt, cwd, botName, options, claudeConfigDir, resumeSessionId,
|
|
|
20048
20159
|
);
|
|
20049
20160
|
const env = resolveMiseEnv(cwd);
|
|
20050
20161
|
env["FLYSPACE_SCRATCH_DIR"] = paths.SCRATCH_DIR;
|
|
20051
|
-
if (options.permissionPromptTool && !env["MCP_TOOL_TIMEOUT"])
|
|
20162
|
+
if (options.permissionPromptTool && !env["MCP_TOOL_TIMEOUT"])
|
|
20163
|
+
env["MCP_TOOL_TIMEOUT"] = "360000";
|
|
20052
20164
|
env["CLAUDE_CODE_ARTIFACT"] = "1";
|
|
20053
20165
|
if (options.disableAutoMemory) env["CLAUDE_CODE_DISABLE_AUTO_MEMORY"] = "1";
|
|
20054
20166
|
else delete env["CLAUDE_CODE_DISABLE_AUTO_MEMORY"];
|
|
@@ -20091,7 +20203,11 @@ function runCli(prompt, cwd, botName, options, claudeConfigDir, resumeSessionId,
|
|
|
20091
20203
|
env: plan.env,
|
|
20092
20204
|
stdio: ["pipe", "pipe", "pipe"]
|
|
20093
20205
|
});
|
|
20094
|
-
child.stdin
|
|
20206
|
+
const pluginUi = usesPluginUi(options) ? new PluginUiSession(child.stdin) : void 0;
|
|
20207
|
+
child.stdin.on("error", () => {
|
|
20208
|
+
});
|
|
20209
|
+
if (pluginUi) pluginUi.start(prompt);
|
|
20210
|
+
else child.stdin.end();
|
|
20095
20211
|
let stdout = "";
|
|
20096
20212
|
let stderr = "";
|
|
20097
20213
|
let timedOut = false;
|
|
@@ -20161,6 +20277,17 @@ function runCli(prompt, cwd, botName, options, claudeConfigDir, resumeSessionId,
|
|
|
20161
20277
|
}
|
|
20162
20278
|
if (event.session_id) liveSessionId = event.session_id;
|
|
20163
20279
|
if (event.type === "result") streamResultLine = line;
|
|
20280
|
+
if (pluginUi) {
|
|
20281
|
+
pluginUi.onEvent(event);
|
|
20282
|
+
if (event.type === "result") {
|
|
20283
|
+
void pluginUi.finish().then((state) => {
|
|
20284
|
+
try {
|
|
20285
|
+
options.onPluginUi?.(state);
|
|
20286
|
+
} catch {
|
|
20287
|
+
}
|
|
20288
|
+
});
|
|
20289
|
+
}
|
|
20290
|
+
}
|
|
20164
20291
|
if (hasKilledToolResult(event)) killedTool = true;
|
|
20165
20292
|
if (event.type === "assistant" && !event.parent_tool_use_id) {
|
|
20166
20293
|
for (const block of event.message?.content ?? []) {
|
|
@@ -21262,6 +21389,26 @@ async function requestAttachmentUrl(key) {
|
|
|
21262
21389
|
send({ type: "attachment-url", id, key });
|
|
21263
21390
|
});
|
|
21264
21391
|
}
|
|
21392
|
+
var pendingSvgs = /* @__PURE__ */ new Map();
|
|
21393
|
+
function handlePluginSvgResult(id, url) {
|
|
21394
|
+
pendingSvgs.get(id)?.(url);
|
|
21395
|
+
pendingSvgs.delete(id);
|
|
21396
|
+
}
|
|
21397
|
+
async function requestPluginSvg(workspace, svg) {
|
|
21398
|
+
const send = await whenConnected();
|
|
21399
|
+
const id = randomUUID2();
|
|
21400
|
+
return new Promise((resolve8, reject) => {
|
|
21401
|
+
const timer = setTimeout(() => {
|
|
21402
|
+
pendingSvgs.delete(id);
|
|
21403
|
+
reject(new Error("Data API did not answer in time"));
|
|
21404
|
+
}, REQUEST_TIMEOUT_MS2);
|
|
21405
|
+
pendingSvgs.set(id, (url) => {
|
|
21406
|
+
clearTimeout(timer);
|
|
21407
|
+
resolve8(url);
|
|
21408
|
+
});
|
|
21409
|
+
send({ type: "plugin-svg", id, workspace, svg });
|
|
21410
|
+
});
|
|
21411
|
+
}
|
|
21265
21412
|
var pendingRespond = /* @__PURE__ */ new Map();
|
|
21266
21413
|
function handleShouldRespondResult(id, respond) {
|
|
21267
21414
|
pendingRespond.get(id)?.(respond);
|
|
@@ -25217,7 +25364,7 @@ async function withMcpConfig(profile, connectionIds, fn, extraServers = {}) {
|
|
|
25217
25364
|
|
|
25218
25365
|
// ../api/src/version.ts
|
|
25219
25366
|
import { readFileSync as readFileSync10 } from "fs";
|
|
25220
|
-
var CLI_VERSION = true ? "0.1.
|
|
25367
|
+
var CLI_VERSION = true ? "0.1.59" : devVersion();
|
|
25221
25368
|
function isOlderVersion(a, b) {
|
|
25222
25369
|
const parse2 = (v) => v.replace(/^v/, "").split("-")[0].split(".").map(Number);
|
|
25223
25370
|
const [pa, pb] = [parse2(a), parse2(b)];
|
|
@@ -27066,6 +27213,41 @@ async function downloadChatAttachments(body) {
|
|
|
27066
27213
|
return { succeeded, skipped };
|
|
27067
27214
|
}
|
|
27068
27215
|
|
|
27216
|
+
// src/dashboard/plugin-ui-store.ts
|
|
27217
|
+
import { createHash as createHash5 } from "crypto";
|
|
27218
|
+
var INLINE_MAX = 2048;
|
|
27219
|
+
var uploaded = /* @__PURE__ */ new Map();
|
|
27220
|
+
var sha256 = (s) => createHash5("sha256").update(s).digest("hex");
|
|
27221
|
+
async function offloadSvg(workspace, source) {
|
|
27222
|
+
const cacheKey2 = `${workspace}:${sha256(source)}`;
|
|
27223
|
+
const cached = uploaded.get(cacheKey2);
|
|
27224
|
+
if (cached) return cached;
|
|
27225
|
+
const url = await requestPluginSvg(workspace, source);
|
|
27226
|
+
if (url) uploaded.set(cacheKey2, url);
|
|
27227
|
+
return url;
|
|
27228
|
+
}
|
|
27229
|
+
async function offloadNode(workspace, node) {
|
|
27230
|
+
const children = node.children ? await Promise.all(node.children.map((c) => typeof c === "string" ? c : offloadNode(workspace, c))) : void 0;
|
|
27231
|
+
const source = node.props?.["source"];
|
|
27232
|
+
if (node.type !== "Svg" || typeof source !== "string" || source.length <= INLINE_MAX) {
|
|
27233
|
+
return children ? { ...node, children } : node;
|
|
27234
|
+
}
|
|
27235
|
+
const src = await offloadSvg(workspace, source).catch((err) => {
|
|
27236
|
+
console.error(`[plugin-ui-store] SVG upload failed: ${err.message}`);
|
|
27237
|
+
return null;
|
|
27238
|
+
});
|
|
27239
|
+
if (!src) return children ? { ...node, children } : node;
|
|
27240
|
+
const { source: _, ...props } = node.props;
|
|
27241
|
+
return { ...node, props: { ...props, src }, ...children ? { children } : {} };
|
|
27242
|
+
}
|
|
27243
|
+
async function offloadPluginUi(workspace, state) {
|
|
27244
|
+
const panes = await Promise.all(
|
|
27245
|
+
state.panes.map(async (p) => p.tree ? { ...p, tree: await offloadNode(workspace, p.tree) } : p)
|
|
27246
|
+
);
|
|
27247
|
+
return { ...state, panes };
|
|
27248
|
+
}
|
|
27249
|
+
var pluginUiHash = (state) => sha256(JSON.stringify(state));
|
|
27250
|
+
|
|
27069
27251
|
// src/dashboard/doc-mention-guard.ts
|
|
27070
27252
|
import { existsSync as existsSync22, statSync as statSync8 } from "fs";
|
|
27071
27253
|
|
|
@@ -27295,7 +27477,7 @@ async function putDocTranslation(input) {
|
|
|
27295
27477
|
}
|
|
27296
27478
|
|
|
27297
27479
|
// ../api/src/dashboard/share-translate.ts
|
|
27298
|
-
import { createHash as
|
|
27480
|
+
import { createHash as createHash6 } from "crypto";
|
|
27299
27481
|
|
|
27300
27482
|
// ../api/src/store/doc-share-store.ts
|
|
27301
27483
|
function rowToKind(value) {
|
|
@@ -27605,7 +27787,7 @@ function languageName(lang) {
|
|
|
27605
27787
|
return BY_CODE.get(lang)?.name ?? null;
|
|
27606
27788
|
}
|
|
27607
27789
|
function translationHash(title, content) {
|
|
27608
|
-
return
|
|
27790
|
+
return createHash6("sha256").update(`${RECIPE_VERSION}
|
|
27609
27791
|
${title}
|
|
27610
27792
|
${content}`).digest("hex");
|
|
27611
27793
|
}
|
|
@@ -27840,7 +28022,7 @@ async function clearStaleDocAudios(channelId, sourcePath, lang, exceptHash) {
|
|
|
27840
28022
|
}
|
|
27841
28023
|
|
|
27842
28024
|
// ../api/src/dashboard/share-audio.ts
|
|
27843
|
-
import { createHash as
|
|
28025
|
+
import { createHash as createHash7 } from "crypto";
|
|
27844
28026
|
import { DeleteObjectCommand, PutObjectCommand as PutObjectCommand2 } from "@aws-sdk/client-s3";
|
|
27845
28027
|
|
|
27846
28028
|
// ../api/src/dashboard/tts-routes.ts
|
|
@@ -28039,7 +28221,7 @@ Pacing \u2014 the engine has NO pause control, so rhythm has to be built into th
|
|
|
28039
28221
|
Output plain text ONLY. No tags of any kind, no angle brackets, no Markdown, no quotation wrapping. Any tag you emit will be deleted before synthesis, so it buys nothing and costs meaning.`;
|
|
28040
28222
|
}
|
|
28041
28223
|
function articleAudioHash(title, content) {
|
|
28042
|
-
return
|
|
28224
|
+
return createHash7("sha256").update(`v${RECIPE_VERSION2}
|
|
28043
28225
|
${title}
|
|
28044
28226
|
|
|
28045
28227
|
${content}`).digest("hex").slice(0, 32);
|
|
@@ -28266,7 +28448,7 @@ function queueShareAudio(share) {
|
|
|
28266
28448
|
var PENDING_STALE_MS = 30 * 60 * 1e3;
|
|
28267
28449
|
var FAILED_RETRY_MS = 10 * 60 * 1e3;
|
|
28268
28450
|
function langAudioHash(title, content, lang) {
|
|
28269
|
-
return
|
|
28451
|
+
return createHash7("sha256").update(`v${RECIPE_VERSION2}
|
|
28270
28452
|
${lang}
|
|
28271
28453
|
${translationHash(title, content)}`).digest("hex").slice(0, 32);
|
|
28272
28454
|
}
|
|
@@ -28760,7 +28942,7 @@ function injectShareHead(html, head) {
|
|
|
28760
28942
|
}
|
|
28761
28943
|
|
|
28762
28944
|
// ../api/src/dashboard/app-icon.ts
|
|
28763
|
-
import { createHash as
|
|
28945
|
+
import { createHash as createHash8 } from "crypto";
|
|
28764
28946
|
import { existsSync as existsSync19, readFileSync as readFileSync16 } from "fs";
|
|
28765
28947
|
import { join as join21 } from "path";
|
|
28766
28948
|
import sharp3 from "sharp";
|
|
@@ -28839,7 +29021,7 @@ async function renderAppIcon({
|
|
|
28839
29021
|
size,
|
|
28840
29022
|
maskable ? "maskable" : "std",
|
|
28841
29023
|
plain ? "plain" : "badged",
|
|
28842
|
-
logo ?
|
|
29024
|
+
logo ? createHash8("sha1").update(logo).digest("hex").slice(0, 12) : transparent ? "stock-transparent" : "stock"
|
|
28843
29025
|
].join(":");
|
|
28844
29026
|
const hit = cache4.get(key);
|
|
28845
29027
|
if (hit) return hit;
|
|
@@ -28870,7 +29052,7 @@ async function composeIcon(logo, size, maskable, plain) {
|
|
|
28870
29052
|
}
|
|
28871
29053
|
|
|
28872
29054
|
// ../api/src/dashboard/share-og.ts
|
|
28873
|
-
import { createHash as
|
|
29055
|
+
import { createHash as createHash9 } from "crypto";
|
|
28874
29056
|
import sharp4 from "sharp";
|
|
28875
29057
|
var WIDTH = 1200;
|
|
28876
29058
|
var HEIGHT = 630;
|
|
@@ -29048,7 +29230,7 @@ function cacheKey(input) {
|
|
|
29048
29230
|
input.logo ?? "",
|
|
29049
29231
|
input.theme ?? ""
|
|
29050
29232
|
];
|
|
29051
|
-
return
|
|
29233
|
+
return createHash9("sha1").update(parts.join("\0")).digest("hex");
|
|
29052
29234
|
}
|
|
29053
29235
|
async function renderShareOgImage(input) {
|
|
29054
29236
|
const key = cacheKey(input);
|
|
@@ -29063,7 +29245,7 @@ async function renderShareOgImage(input) {
|
|
|
29063
29245
|
}
|
|
29064
29246
|
|
|
29065
29247
|
// ../api/src/dashboard/share-ask.ts
|
|
29066
|
-
import { createHash as
|
|
29248
|
+
import { createHash as createHash10 } from "crypto";
|
|
29067
29249
|
var MAX_ARTICLE_CHARS3 = 24e3;
|
|
29068
29250
|
var MAX_QUESTION_CHARS = 500;
|
|
29069
29251
|
var SUGGESTION_COUNT = 4;
|
|
@@ -29128,7 +29310,7 @@ function parseSuggestions(raw) {
|
|
|
29128
29310
|
var CACHE_LIMIT = 200;
|
|
29129
29311
|
var suggestionCache = /* @__PURE__ */ new Map();
|
|
29130
29312
|
function articleHash(title, content, lang) {
|
|
29131
|
-
return
|
|
29313
|
+
return createHash10("sha256").update(`${lang ?? ""}
|
|
29132
29314
|
${title}
|
|
29133
29315
|
|
|
29134
29316
|
${content}`).digest("hex").slice(0, 32);
|
|
@@ -30249,7 +30431,7 @@ function createDocsRouter({ gate = requireDocsAccess } = {}) {
|
|
|
30249
30431
|
const dir = typeof form.get("path") === "string" ? form.get("path") : "";
|
|
30250
30432
|
const files = form.getAll("file").filter((f) => f instanceof File);
|
|
30251
30433
|
if (files.length === 0) return c.json({ error: "missing file" }, 400);
|
|
30252
|
-
const
|
|
30434
|
+
const uploaded2 = [];
|
|
30253
30435
|
const failed = [];
|
|
30254
30436
|
for (const file of files) {
|
|
30255
30437
|
if (file.size > MAX_UPLOAD_BYTES) {
|
|
@@ -30262,7 +30444,7 @@ function createDocsRouter({ gate = requireDocsAccess } = {}) {
|
|
|
30262
30444
|
const result = saveUploadedFile(cwd, dir, file.name, Buffer.from(await file.arrayBuffer()));
|
|
30263
30445
|
switch (result.status) {
|
|
30264
30446
|
case "ok":
|
|
30265
|
-
|
|
30447
|
+
uploaded2.push({ path: result.path, name: result.name });
|
|
30266
30448
|
break;
|
|
30267
30449
|
case "no-dir":
|
|
30268
30450
|
return c.json({ error: "folder not found" }, 404);
|
|
@@ -30276,7 +30458,7 @@ function createDocsRouter({ gate = requireDocsAccess } = {}) {
|
|
|
30276
30458
|
failed.push({ name: file.name, error: "invalid filename" });
|
|
30277
30459
|
}
|
|
30278
30460
|
}
|
|
30279
|
-
return c.json({ path: dir, uploaded, failed },
|
|
30461
|
+
return c.json({ path: dir, uploaded: uploaded2, failed }, uploaded2.length > 0 ? 201 : 400);
|
|
30280
30462
|
});
|
|
30281
30463
|
app.post("/:id/docs/folder", async (c) => {
|
|
30282
30464
|
const { cwd } = resolveChannelConfig(c.req.param("id"));
|
|
@@ -31124,7 +31306,9 @@ var ChatAgent = class {
|
|
|
31124
31306
|
async wake(threadId, replyId, text) {
|
|
31125
31307
|
const wakes = this.consecutiveWakes.get(threadId) ?? 0;
|
|
31126
31308
|
if (wakes >= MAX_CONSECUTIVE_WAKES) {
|
|
31127
|
-
console.log(
|
|
31309
|
+
console.log(
|
|
31310
|
+
`[chat-agent] wake refused, cap of ${MAX_CONSECUTIVE_WAKES} reached. thread=${threadId}`
|
|
31311
|
+
);
|
|
31128
31312
|
return false;
|
|
31129
31313
|
}
|
|
31130
31314
|
const { data } = await this.supabase().from("thread_replies").select("author").eq("thread_id", threadId).is("archived_at", null).order("created_at", { ascending: false }).limit(50);
|
|
@@ -31166,7 +31350,8 @@ var ChatAgent = class {
|
|
|
31166
31350
|
* background.
|
|
31167
31351
|
*/
|
|
31168
31352
|
async continueAfterKilledTool(threadId, channelId, profile, topic, reply) {
|
|
31169
|
-
if (!await this.shouldResume(topic, [{ author: AGENT_AUTHOR, body: reply }], "killed-tool"))
|
|
31353
|
+
if (!await this.shouldResume(topic, [{ author: AGENT_AUTHOR, body: reply }], "killed-tool"))
|
|
31354
|
+
return;
|
|
31170
31355
|
const slot = this.claimAutoContinue(threadId, channelId);
|
|
31171
31356
|
if (!slot) return;
|
|
31172
31357
|
await this.autoContinue(
|
|
@@ -31189,7 +31374,10 @@ var ChatAgent = class {
|
|
|
31189
31374
|
if (tasks.length === 0) return;
|
|
31190
31375
|
this.watchedTasks.set(threadId, { profile, channelId, firstSeen: Date.now(), tasks });
|
|
31191
31376
|
this.channelActivityNotifier()("background", { channelId, threadId, on: true });
|
|
31192
|
-
this.backgroundSweep ??= setInterval(
|
|
31377
|
+
this.backgroundSweep ??= setInterval(
|
|
31378
|
+
() => void this.sweepBackgroundTasks(),
|
|
31379
|
+
BACKGROUND_SWEEP_MS
|
|
31380
|
+
);
|
|
31193
31381
|
this.backgroundSweep.unref?.();
|
|
31194
31382
|
}
|
|
31195
31383
|
async sweepBackgroundTasks() {
|
|
@@ -31198,7 +31386,11 @@ var ChatAgent = class {
|
|
|
31198
31386
|
const tasks = live.get(threadId);
|
|
31199
31387
|
if (tasks?.length) {
|
|
31200
31388
|
watched.tasks = tasks;
|
|
31201
|
-
this.channelActivityNotifier()("background", {
|
|
31389
|
+
this.channelActivityNotifier()("background", {
|
|
31390
|
+
channelId: watched.channelId,
|
|
31391
|
+
threadId,
|
|
31392
|
+
on: true
|
|
31393
|
+
});
|
|
31202
31394
|
const oldest = Math.min(...tasks.map((t) => t.startedAt));
|
|
31203
31395
|
if (!watched.checkedIn && Date.now() - oldest >= BACKGROUND_CHECK_IN_MS) {
|
|
31204
31396
|
watched.checkedIn = true;
|
|
@@ -31207,19 +31399,27 @@ var ChatAgent = class {
|
|
|
31207
31399
|
await runWithProfile(watched.profile, async () => {
|
|
31208
31400
|
const { replyId } = await postToDashboardChannel({ threadId, text: text2 });
|
|
31209
31401
|
await this.wake(threadId, replyId, text2);
|
|
31210
|
-
}).catch(
|
|
31402
|
+
}).catch(
|
|
31403
|
+
(err) => console.error("[chat-agent] background check-in failed:", err.message)
|
|
31404
|
+
);
|
|
31211
31405
|
}
|
|
31212
31406
|
continue;
|
|
31213
31407
|
}
|
|
31214
31408
|
this.watchedTasks.delete(threadId);
|
|
31215
|
-
this.channelActivityNotifier()("background", {
|
|
31409
|
+
this.channelActivityNotifier()("background", {
|
|
31410
|
+
channelId: watched.channelId,
|
|
31411
|
+
threadId,
|
|
31412
|
+
on: false
|
|
31413
|
+
});
|
|
31216
31414
|
if ((this.lastWakeAt.get(threadId) ?? 0) >= watched.firstSeen) continue;
|
|
31217
31415
|
console.log(`[chat-agent] background task ended without waking. thread=${threadId}`);
|
|
31218
31416
|
const text = "Background task ended without reporting a result (it may have been killed or the machine restarted).";
|
|
31219
31417
|
await runWithProfile(watched.profile, async () => {
|
|
31220
31418
|
const { replyId } = await postToDashboardChannel({ threadId, text });
|
|
31221
31419
|
await this.wake(threadId, replyId, text);
|
|
31222
|
-
}).catch(
|
|
31420
|
+
}).catch(
|
|
31421
|
+
(err) => console.error("[chat-agent] background wake failed:", err.message)
|
|
31422
|
+
);
|
|
31223
31423
|
}
|
|
31224
31424
|
if (this.watchedTasks.size === 0 && this.backgroundSweep) {
|
|
31225
31425
|
clearInterval(this.backgroundSweep);
|
|
@@ -31351,10 +31551,9 @@ var ChatAgent = class {
|
|
|
31351
31551
|
const { data: thread } = await this.supabase().from("threads").select("channel_id").eq("id", threadId).single();
|
|
31352
31552
|
if (!thread?.channel_id) return false;
|
|
31353
31553
|
const { data } = await this.supabase().from("workspaces").select("agent_paused, plan_status").eq("slug", findOwningProfile(thread.channel_id));
|
|
31354
|
-
const paused = (data ?? []).some(
|
|
31355
|
-
|
|
31356
|
-
|
|
31357
|
-
if (paused) console.log(`[chat-agent] agent paused or plan locked, not answering thread=${threadId}`);
|
|
31554
|
+
const paused = (data ?? []).some((r) => r.agent_paused === true || isLockedPlan(r.plan_status ?? null));
|
|
31555
|
+
if (paused)
|
|
31556
|
+
console.log(`[chat-agent] agent paused or plan locked, not answering thread=${threadId}`);
|
|
31358
31557
|
return paused;
|
|
31359
31558
|
} catch (err) {
|
|
31360
31559
|
console.error(`[chat-agent] pause check failed for thread=${threadId}:`, err);
|
|
@@ -31618,12 +31817,16 @@ var ChatAgent = class {
|
|
|
31618
31817
|
...isHumanAuthor(msg.author) ? { requesterHandle: msg.author } : {},
|
|
31619
31818
|
slackBound: !!channelRow?.external_channel_id
|
|
31620
31819
|
};
|
|
31621
|
-
if (memory.memoryPrompt)
|
|
31820
|
+
if (memory.memoryPrompt)
|
|
31821
|
+
channelConfig = { ...channelConfig, memoryPrompt: memory.memoryPrompt };
|
|
31622
31822
|
const store = this.openSessionStore();
|
|
31623
31823
|
try {
|
|
31624
31824
|
const channelKey = `chat:${thread.channel_id}`;
|
|
31625
31825
|
const session = store.getSession(channelKey, msg.threadId);
|
|
31626
|
-
const docsNote = docsAccessPromptNote(
|
|
31826
|
+
const docsNote = docsAccessPromptNote(
|
|
31827
|
+
channelConfig.docsAccess,
|
|
31828
|
+
channelConfig.docsAccessUnverified
|
|
31829
|
+
);
|
|
31627
31830
|
const header = (docsNote ? `[access: ${docsNote}]
|
|
31628
31831
|
|
|
31629
31832
|
` : "") + `[context: chat channel=${thread.channel_id}, thread_id=${thread.id}` + (thread.title ? `, thread="${thread.title}"` : "") + `, sender=${msg.author}. This is the Flyspace dashboard, not Slack \u2014 it renders full Markdown, so use normal paragraphs, line breaks, and real Markdown lists instead of Slack-style single-line replies. When you name a file that lives in this channel's folder, write it as @ + its cwd-relative path (@docs/spec.md, @web/src/App.tsx) as plain text, never inside backticks or a Markdown link \u2014 the dashboard turns that into a chip the reader clicks to open the file. A trailing line number (@src/app.ts:120) is fine. Paths outside the cwd stay in backticks.]
|
|
@@ -31735,7 +31938,13 @@ ${msg.body}` : expandSkillCommand(channelConfig.claudeConfigDir, channelConfig.c
|
|
|
31735
31938
|
if (!response2 || response2.isError) {
|
|
31736
31939
|
await this.postReply(
|
|
31737
31940
|
msg.threadId,
|
|
31738
|
-
this.failureReply(
|
|
31941
|
+
this.failureReply(
|
|
31942
|
+
owningProfile,
|
|
31943
|
+
thread.channel_id,
|
|
31944
|
+
msg.threadId,
|
|
31945
|
+
"codex",
|
|
31946
|
+
response2?.failure
|
|
31947
|
+
)
|
|
31739
31948
|
);
|
|
31740
31949
|
return;
|
|
31741
31950
|
}
|
|
@@ -31814,7 +32023,13 @@ ${msg.body}` : expandSkillCommand(channelConfig.claudeConfigDir, channelConfig.c
|
|
|
31814
32023
|
if (!response || this.isTransientFailure(response)) {
|
|
31815
32024
|
await this.postReply(
|
|
31816
32025
|
msg.threadId,
|
|
31817
|
-
this.failureReply(
|
|
32026
|
+
this.failureReply(
|
|
32027
|
+
owningProfile,
|
|
32028
|
+
thread.channel_id,
|
|
32029
|
+
msg.threadId,
|
|
32030
|
+
"claude",
|
|
32031
|
+
response?.failure
|
|
32032
|
+
)
|
|
31818
32033
|
);
|
|
31819
32034
|
return;
|
|
31820
32035
|
}
|
|
@@ -31826,14 +32041,17 @@ ${msg.body}` : expandSkillCommand(channelConfig.claudeConfigDir, channelConfig.c
|
|
|
31826
32041
|
if (response.isTimeout) {
|
|
31827
32042
|
const slot = response.sessionId ? this.claimAutoContinue(msg.threadId, thread.channel_id) : null;
|
|
31828
32043
|
if (slot) {
|
|
31829
|
-
if (response.partialText)
|
|
32044
|
+
if (response.partialText)
|
|
32045
|
+
await this.postReply(msg.threadId, response.partialText, activities);
|
|
31830
32046
|
const idle = response.timeoutKind === "idle";
|
|
31831
32047
|
void this.autoContinue(
|
|
31832
32048
|
msg.threadId,
|
|
31833
32049
|
owningProfile,
|
|
31834
32050
|
`This turn hit its time limit, continuing automatically (${slot.n}/${slot.limit}).`,
|
|
31835
32051
|
(idle ? "Your last turn was stopped after several minutes with no output, most likely a command that never exited or ran too long. Run long or open-ended commands in the background with a `flyspace chat wake` callback instead." : "Your last turn was stopped because it ran past the time limit for a single turn.") + " Check what already got done, then carry on with what is left."
|
|
31836
|
-
).catch(
|
|
32052
|
+
).catch(
|
|
32053
|
+
(err) => console.error("[chat-agent] timeout continue failed:", err.message)
|
|
32054
|
+
);
|
|
31837
32055
|
return;
|
|
31838
32056
|
}
|
|
31839
32057
|
if (response.sessionId) {
|
|
@@ -32085,6 +32303,9 @@ ${msg.body}` : expandSkillCommand(channelConfig.claudeConfigDir, channelConfig.c
|
|
|
32085
32303
|
ownPersona: channelConfig.ownPersona,
|
|
32086
32304
|
slackBound: channelConfig.slackBound,
|
|
32087
32305
|
onActivity,
|
|
32306
|
+
...channelConfig.permissionThread ? {
|
|
32307
|
+
onPluginUi: (state) => void this.savePluginUi(channelConfig.profile, channelConfig.permissionThread.threadId, state)
|
|
32308
|
+
} : {},
|
|
32088
32309
|
signal,
|
|
32089
32310
|
mcpConfigPath,
|
|
32090
32311
|
...usageContext ? { usageContext } : {},
|
|
@@ -32105,6 +32326,27 @@ ${msg.body}` : expandSkillCommand(channelConfig.claudeConfigDir, channelConfig.c
|
|
|
32105
32326
|
return failure ? { sessionId: sessionId ?? "", text: "", isError: true, isTransientError: true, failure } : null;
|
|
32106
32327
|
}
|
|
32107
32328
|
}
|
|
32329
|
+
pluginUiHashes = /* @__PURE__ */ new Map();
|
|
32330
|
+
/**
|
|
32331
|
+
* Keep the latest mod UI snapshot for a thread (0129). One row per thread,
|
|
32332
|
+
* overwritten only when it changed. Large SVGs go to R2 via the Data API (plugin-ui-store),
|
|
32333
|
+
* so the row stays a few KB. A turn with no panes clears the row, so a mod that closed its pane stops showing.
|
|
32334
|
+
*/
|
|
32335
|
+
async savePluginUi(workspace, threadId, raw) {
|
|
32336
|
+
const empty = !raw.panes.length && !raw.status;
|
|
32337
|
+
const state = empty ? raw : await offloadPluginUi(workspace, raw);
|
|
32338
|
+
const hash = empty ? "" : pluginUiHash(state);
|
|
32339
|
+
if (this.pluginUiHashes.get(threadId) === hash) return;
|
|
32340
|
+
const table = this.supabase().from("thread_plugin_ui");
|
|
32341
|
+
const { error } = !empty ? await table.upsert({
|
|
32342
|
+
thread_id: threadId,
|
|
32343
|
+
panes: state.panes,
|
|
32344
|
+
status: state.status ?? null,
|
|
32345
|
+
updated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
32346
|
+
}) : await table.delete().eq("thread_id", threadId);
|
|
32347
|
+
if (error) console.error(`[chat-agent] save plugin UI ${threadId}: ${error.message}`);
|
|
32348
|
+
else this.pluginUiHashes.set(threadId, hash);
|
|
32349
|
+
}
|
|
32108
32350
|
async tryAskCodex(channelConfig, prompt, sessionId, signal, onActivity, usageContext) {
|
|
32109
32351
|
const name = subAgentName(channelConfig.agentName);
|
|
32110
32352
|
const agentPersona = name ? readAgentPersona(channelConfig.claudeConfigDir, channelConfig.cwd, name) : void 0;
|
|
@@ -34687,6 +34929,7 @@ export {
|
|
|
34687
34929
|
handleHostDbResult,
|
|
34688
34930
|
requestHostDb,
|
|
34689
34931
|
handleAttachmentUrlResult,
|
|
34932
|
+
handlePluginSvgResult,
|
|
34690
34933
|
handleShouldRespondResult,
|
|
34691
34934
|
LOCAL_DB_PATH,
|
|
34692
34935
|
createHostDbClient,
|
package/dist/cli.js
CHANGED
|
@@ -121,6 +121,7 @@ import {
|
|
|
121
121
|
getWorkspacePlanStatus,
|
|
122
122
|
handleAttachmentUrlResult,
|
|
123
123
|
handleHostDbResult,
|
|
124
|
+
handlePluginSvgResult,
|
|
124
125
|
handleShouldRespondResult,
|
|
125
126
|
handleSupportMention,
|
|
126
127
|
highlightLanguageOf,
|
|
@@ -279,7 +280,7 @@ import {
|
|
|
279
280
|
workspaceHostname,
|
|
280
281
|
workspaceSkillsDir,
|
|
281
282
|
writeSkillFile
|
|
282
|
-
} from "./chunk-
|
|
283
|
+
} from "./chunk-7W5FEG63.js";
|
|
283
284
|
import {
|
|
284
285
|
canReadThread,
|
|
285
286
|
firstReplyBody,
|
|
@@ -2191,7 +2192,7 @@ function npmEnv(target) {
|
|
|
2191
2192
|
return nodeBin ? { ...process.env, PATH: `${nodeBin}:${process.env.PATH ?? ""}` } : process.env;
|
|
2192
2193
|
}
|
|
2193
2194
|
async function runUpgrade() {
|
|
2194
|
-
const current = "0.1.
|
|
2195
|
+
const current = "0.1.59";
|
|
2195
2196
|
console.log(`Current version: ${current}`);
|
|
2196
2197
|
console.log("Checking for updates...\n");
|
|
2197
2198
|
try {
|
|
@@ -6556,7 +6557,7 @@ function loadHostPrivateKey(path = hostPrivateKeyPath()) {
|
|
|
6556
6557
|
}
|
|
6557
6558
|
|
|
6558
6559
|
// ../api/src/dashboard/uploads-routes.ts
|
|
6559
|
-
import { randomUUID } from "crypto";
|
|
6560
|
+
import { createHash as createHash3, randomUUID } from "crypto";
|
|
6560
6561
|
import { Hono as Hono5 } from "hono";
|
|
6561
6562
|
import sharp2 from "sharp";
|
|
6562
6563
|
import { PutObjectCommand, GetObjectCommand as GetObjectCommand2 } from "@aws-sdk/client-s3";
|
|
@@ -6564,6 +6565,7 @@ import { getSignedUrl as getSignedUrl2 } from "@aws-sdk/s3-request-presigner";
|
|
|
6564
6565
|
var MAX_FILE_BYTES = 10 * 1024 * 1024;
|
|
6565
6566
|
var PRESIGN_TTL_SECONDS = 300;
|
|
6566
6567
|
var KEY_PREFIX = "chat";
|
|
6568
|
+
var PLUGIN_UI_PREFIX = "plugin-ui";
|
|
6567
6569
|
var RESIZABLE = /* @__PURE__ */ new Set(["image/jpeg", "image/png", "image/webp", "image/avif"]);
|
|
6568
6570
|
var FULL_EDGE = 2560;
|
|
6569
6571
|
var THUMB_EDGE = 480;
|
|
@@ -6571,7 +6573,8 @@ var WEBP_QUALITY = 80;
|
|
|
6571
6573
|
function toWebp(input2, edge) {
|
|
6572
6574
|
return sharp2(input2).rotate().resize({ width: edge, height: edge, fit: "inside", withoutEnlargement: true }).webp({ quality: WEBP_QUALITY }).toBuffer();
|
|
6573
6575
|
}
|
|
6574
|
-
var READABLE_PREFIXES = [KEY_PREFIX, SCRATCH_PREFIX];
|
|
6576
|
+
var READABLE_PREFIXES = [KEY_PREFIX, SCRATCH_PREFIX, PLUGIN_UI_PREFIX];
|
|
6577
|
+
var MAX_PLUGIN_SVG_BYTES = 1024 * 1024;
|
|
6575
6578
|
function sanitizeFilename(name) {
|
|
6576
6579
|
const cleaned = name.replace(/[/\\]/g, "_").replace(/\s+/g, "-").replace(/[^\w.-]/g, "").trim();
|
|
6577
6580
|
return (cleaned || "file").slice(-100);
|
|
@@ -7729,7 +7732,7 @@ function createContinuousChatRouter() {
|
|
|
7729
7732
|
}
|
|
7730
7733
|
|
|
7731
7734
|
// ../api/src/dashboard/thread-translate.ts
|
|
7732
|
-
import { createHash as
|
|
7735
|
+
import { createHash as createHash4 } from "crypto";
|
|
7733
7736
|
|
|
7734
7737
|
// ../api/src/store/thread-translation-store.ts
|
|
7735
7738
|
var TABLES = {
|
|
@@ -7811,7 +7814,7 @@ function isTranslatableLanguage2(lang) {
|
|
|
7811
7814
|
return BY_CODE.has(lang);
|
|
7812
7815
|
}
|
|
7813
7816
|
function translationHash(author, body) {
|
|
7814
|
-
return
|
|
7817
|
+
return createHash4("sha256").update(`${RECIPE_VERSION}
|
|
7815
7818
|
${author}
|
|
7816
7819
|
${body}`).digest("hex");
|
|
7817
7820
|
}
|
|
@@ -7923,7 +7926,7 @@ async function translateCached(lang, scope, messages, contextFor) {
|
|
|
7923
7926
|
if (!BY_CODE.has(lang)) throw new Error(`unsupported translation language: ${lang}`);
|
|
7924
7927
|
if (messages.length === 0) return [];
|
|
7925
7928
|
const keyed = messages.map((m) => ({ ...m, hash: translationHash(m.author, m.body) }));
|
|
7926
|
-
const shape =
|
|
7929
|
+
const shape = createHash4("sha256").update(keyed.map((m) => `${m.kind}:${m.id}:${m.hash}`).join("\n")).digest("hex");
|
|
7927
7930
|
const key = `${lang}:${shape}`;
|
|
7928
7931
|
const running2 = inFlight.get(key);
|
|
7929
7932
|
if (running2) return running2;
|
|
@@ -8414,11 +8417,28 @@ function createChatRouter(agent = {}) {
|
|
|
8414
8417
|
const limit = Number.isFinite(requestedLimit) && requestedLimit > 0 ? Math.min(requestedLimit, BOARD_PAGE_SIZE_MAX) : BOARD_PAGE_SIZE;
|
|
8415
8418
|
const before = c.req.query("before");
|
|
8416
8419
|
const meta = c.req.query("scope") === "all" ? await globalChannelMeta(c) : null;
|
|
8420
|
+
const listParam = (name) => (c.req.query(name) ?? "").split(",").filter(Boolean);
|
|
8421
|
+
const channelFilter = new Set(listParam("channel"));
|
|
8422
|
+
const authors = listParam("author").filter((a) => /^[\w.-]+$/.test(a));
|
|
8423
|
+
const instant = (name) => {
|
|
8424
|
+
const raw = c.req.query(name);
|
|
8425
|
+
const ms = raw ? Date.parse(raw) : NaN;
|
|
8426
|
+
return Number.isNaN(ms) ? void 0 : new Date(ms).toISOString();
|
|
8427
|
+
};
|
|
8428
|
+
const since2 = instant("since");
|
|
8429
|
+
const until = instant("until");
|
|
8430
|
+
const cursor = until && (!before || Date.parse(until) < Date.parse(before)) ? until : before;
|
|
8431
|
+
const channelIds = (meta ? [...meta.keys()] : [...ownChannelIds(c)]).filter(
|
|
8432
|
+
(id) => !channelFilter.size || channelFilter.has(id)
|
|
8433
|
+
);
|
|
8434
|
+
if (channelIds.length === 0) return c.json({ threads: [], nextCursor: null });
|
|
8417
8435
|
const supabase = getSupabaseClient();
|
|
8418
|
-
let query = supabase.from("threads").select("*").in("channel_id",
|
|
8436
|
+
let query = supabase.from("threads").select("*").in("channel_id", channelIds);
|
|
8419
8437
|
query = column === NO_STATUS_COLUMN ? query.is("board_status", null) : query.eq("board_status", column);
|
|
8420
8438
|
query = query.is("archived_at", null).order("updated_at", { ascending: false }).limit(limit);
|
|
8421
|
-
if (
|
|
8439
|
+
if (cursor) query = query.lt("updated_at", cursor);
|
|
8440
|
+
if (since2) query = query.gte("updated_at", since2);
|
|
8441
|
+
if (authors.length) query = query.or(authors.map((a) => `author.ilike.${a}`).join(","));
|
|
8422
8442
|
const { data: threads, error: error2 } = await query;
|
|
8423
8443
|
if (error2) return c.json({ error: error2.message }, 500);
|
|
8424
8444
|
if (!threads || threads.length === 0) return c.json({ threads: [], nextCursor: null });
|
|
@@ -8592,6 +8612,18 @@ function createChatRouter(agent = {}) {
|
|
|
8592
8612
|
nextCursor
|
|
8593
8613
|
});
|
|
8594
8614
|
});
|
|
8615
|
+
app.get("/threads/:id/plugin-ui", async (c) => {
|
|
8616
|
+
const id = c.req.param("id");
|
|
8617
|
+
const supabase = getSupabaseClient();
|
|
8618
|
+
const { data: thread } = await supabase.from("threads").select("channel_id").eq("id", id).maybeSingle();
|
|
8619
|
+
const channelId = thread?.channel_id;
|
|
8620
|
+
if (!channelId || !(await globalChannelMeta(c)).has(channelId)) {
|
|
8621
|
+
return c.json({ error: "not found" }, 404);
|
|
8622
|
+
}
|
|
8623
|
+
const { data, error: error2 } = await supabase.from("thread_plugin_ui").select("panes, status, updated_at").eq("thread_id", id).maybeSingle();
|
|
8624
|
+
if (error2) return c.json({ error: error2.message }, 500);
|
|
8625
|
+
return c.json(data ?? { panes: [], status: null, updated_at: null });
|
|
8626
|
+
});
|
|
8595
8627
|
app.post("/threads/:id/translation/:lang", async (c) => {
|
|
8596
8628
|
const id = c.req.param("id");
|
|
8597
8629
|
const lang = canonicalLanguage(c.req.param("lang"));
|
|
@@ -10114,7 +10146,7 @@ ${screenshots}` : ""}` }
|
|
|
10114
10146
|
}
|
|
10115
10147
|
|
|
10116
10148
|
// ../api/src/dashboard/avatars-routes.ts
|
|
10117
|
-
import { createHash as
|
|
10149
|
+
import { createHash as createHash5, randomUUID as randomUUID3 } from "crypto";
|
|
10118
10150
|
import { Hono as Hono21 } from "hono";
|
|
10119
10151
|
import sharp3 from "sharp";
|
|
10120
10152
|
import { PutObjectCommand as PutObjectCommand3, DeleteObjectCommand as DeleteObjectCommand2 } from "@aws-sdk/client-s3";
|
|
@@ -10124,7 +10156,7 @@ var AVATAR_MIME_TYPES = ["image/png", "image/jpeg"];
|
|
|
10124
10156
|
var KEY_PREFIX2 = "avatar";
|
|
10125
10157
|
var GRAVATAR_TIMEOUT_MS = 5e3;
|
|
10126
10158
|
async function fetchGravatar(email) {
|
|
10127
|
-
const hash =
|
|
10159
|
+
const hash = createHash5("sha256").update(email.trim().toLowerCase()).digest("hex");
|
|
10128
10160
|
const res = await fetch(`https://gravatar.com/avatar/${hash}?s=${AVATAR_SIZE}&d=404`, {
|
|
10129
10161
|
signal: AbortSignal.timeout(GRAVATAR_TIMEOUT_MS)
|
|
10130
10162
|
}).catch(() => null);
|
|
@@ -12910,7 +12942,7 @@ function createDeviceAuthRouter() {
|
|
|
12910
12942
|
import { dirname as dirname6 } from "path";
|
|
12911
12943
|
|
|
12912
12944
|
// ../api/src/dashboard/skill-mirror.ts
|
|
12913
|
-
import { createHash as
|
|
12945
|
+
import { createHash as createHash6 } from "crypto";
|
|
12914
12946
|
import { existsSync as existsSync18, statSync as statSync3 } from "fs";
|
|
12915
12947
|
var SYNC_INTERVAL_MS = 6e4;
|
|
12916
12948
|
var UPSERT_BATCH = 50;
|
|
@@ -12958,7 +12990,7 @@ function snapshot(scopes) {
|
|
|
12958
12990
|
return rows;
|
|
12959
12991
|
}
|
|
12960
12992
|
function hashOf(row) {
|
|
12961
|
-
return
|
|
12993
|
+
return createHash6("sha1").update(JSON.stringify([row.description, row.body, row.path, row.plugin, row.mtime])).digest("hex");
|
|
12962
12994
|
}
|
|
12963
12995
|
async function pushSkillScopes(scopes) {
|
|
12964
12996
|
if (!databaseReachable()) return;
|
|
@@ -14813,6 +14845,10 @@ function connectHostSocket(url, callbacks, onAuthenticated, onWorkspaces) {
|
|
|
14813
14845
|
handleHostDbResult(msg.id, msg.res);
|
|
14814
14846
|
return;
|
|
14815
14847
|
}
|
|
14848
|
+
if (msg.type === "plugin-svg-result") {
|
|
14849
|
+
handlePluginSvgResult(msg.id, msg.url);
|
|
14850
|
+
return;
|
|
14851
|
+
}
|
|
14816
14852
|
if (msg.type === "attachment-url-result") {
|
|
14817
14853
|
handleAttachmentUrlResult(msg.id, msg.url);
|
|
14818
14854
|
return;
|
|
@@ -15604,7 +15640,7 @@ async function main() {
|
|
|
15604
15640
|
break;
|
|
15605
15641
|
case "-v":
|
|
15606
15642
|
case "--version":
|
|
15607
|
-
printRaw("0.1.
|
|
15643
|
+
printRaw("0.1.59");
|
|
15608
15644
|
break;
|
|
15609
15645
|
case "-h":
|
|
15610
15646
|
case "--help":
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createRequire as __flyspaceCreateRequire } from 'node:module';
|
|
|
3
3
|
const require = __flyspaceCreateRequire(import.meta.url);
|
|
4
4
|
import {
|
|
5
5
|
startServer
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7W5FEG63.js";
|
|
7
7
|
import "./chunk-XACRG7BO.js";
|
|
8
8
|
export {
|
|
9
9
|
startServer
|