flyspace-cli 0.1.64 → 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.
|
@@ -18556,10 +18556,17 @@ function sessionUserId(cookies) {
|
|
|
18556
18556
|
}
|
|
18557
18557
|
}
|
|
18558
18558
|
var isScoped = (name) => name.startsWith(SCOPE_MARK);
|
|
18559
|
+
var isSession = (c) => SESSION_NAME.test(c.name);
|
|
18560
|
+
function hasCorruptSession(cookies) {
|
|
18561
|
+
const session = cookies.filter((c) => isSession(c) && c.value !== "");
|
|
18562
|
+
return session.length > 0 && sessionUserId(session) === null;
|
|
18563
|
+
}
|
|
18559
18564
|
function readScopedCookies(all, label) {
|
|
18560
18565
|
const prefix = scopePrefix(label);
|
|
18561
18566
|
const own = all.filter((c) => c.name.startsWith(prefix)).map((c) => ({ name: c.name.slice(prefix.length), value: c.value }));
|
|
18562
|
-
|
|
18567
|
+
if (own.length && !hasCorruptSession(own)) return own;
|
|
18568
|
+
const shared = all.filter((c) => !isScoped(c.name));
|
|
18569
|
+
return hasCorruptSession(shared) ? shared.filter((c) => !isSession(c)) : shared;
|
|
18563
18570
|
}
|
|
18564
18571
|
function routeCookieWrites(all, label, writes) {
|
|
18565
18572
|
const prefix = scopePrefix(label);
|
|
@@ -21822,6 +21829,12 @@ var featureFlags = {
|
|
|
21822
21829
|
title: "Columns view",
|
|
21823
21830
|
description: "A third view next to Rounds and Board: pin up to 6 threads from any channel and read them side by side as full-height columns. Desktop only; pins are kept in this browser.",
|
|
21824
21831
|
stage: "beta"
|
|
21832
|
+
},
|
|
21833
|
+
"voice-guide": {
|
|
21834
|
+
title: "Voice guide",
|
|
21835
|
+
description: "Support walks you through the UI: a Show me button under @support answers that opens the right page and spotlights what to click, and later a Talk mode that answers out loud. Speech is sent to OpenAI.",
|
|
21836
|
+
stage: "beta",
|
|
21837
|
+
operatorOnly: true
|
|
21825
21838
|
}
|
|
21826
21839
|
};
|
|
21827
21840
|
var featureFlagIds = Object.keys(featureFlags);
|
|
@@ -23505,12 +23518,14 @@ async function runAutomation(opts) {
|
|
|
23505
23518
|
|
|
23506
23519
|
// src/automations/script-runner.ts
|
|
23507
23520
|
import { spawn as spawn3 } from "child_process";
|
|
23521
|
+
import { accessSync, constants } from "fs";
|
|
23508
23522
|
var DEFAULT_TIMEOUT_MS = 12e4;
|
|
23509
23523
|
var KILL_GRACE_MS3 = 5e3;
|
|
23510
23524
|
function runScriptAutomation(opts) {
|
|
23511
23525
|
const { name, script, cwd, timeoutMs = DEFAULT_TIMEOUT_MS } = opts;
|
|
23512
23526
|
return new Promise((resolve8, reject) => {
|
|
23513
|
-
const
|
|
23527
|
+
const [cmd, args] = isExecutable(script) ? [script, []] : ["/bin/bash", [script]];
|
|
23528
|
+
const child = spawn3(cmd, args, { cwd, env: resolveMiseEnv(cwd), stdio: ["ignore", "pipe", "pipe"] });
|
|
23514
23529
|
let stdout = "";
|
|
23515
23530
|
let stderr = "";
|
|
23516
23531
|
let timedOut = false;
|
|
@@ -23549,6 +23564,14 @@ function runScriptAutomation(opts) {
|
|
|
23549
23564
|
});
|
|
23550
23565
|
});
|
|
23551
23566
|
}
|
|
23567
|
+
function isExecutable(path) {
|
|
23568
|
+
try {
|
|
23569
|
+
accessSync(path, constants.X_OK);
|
|
23570
|
+
return true;
|
|
23571
|
+
} catch {
|
|
23572
|
+
return false;
|
|
23573
|
+
}
|
|
23574
|
+
}
|
|
23552
23575
|
|
|
23553
23576
|
// ../api/src/automations/manager.ts
|
|
23554
23577
|
function findInChannels(name) {
|
|
@@ -24355,8 +24378,9 @@ function buildFilesPromptSection(result) {
|
|
|
24355
24378
|
const parts = [];
|
|
24356
24379
|
if (result.succeeded.length > 0) {
|
|
24357
24380
|
const list = result.succeeded.map((f) => `- ${f.path} (${f.name}, ${f.mimetype})`).join("\n");
|
|
24381
|
+
const pdfHint = result.succeeded.some((f) => f.mimetype === "application/pdf") ? '\nFor a PDF over 10 pages, Read it in chunks with the `pages` parameter (max 20 pages per call, e.g. "1-20", "21-40"), or convert it with `pdftotext`. Never give up because it is too large.' : "";
|
|
24358
24382
|
parts.push(`[attached files \u2014 use the Read tool to view them]
|
|
24359
|
-
${list}`);
|
|
24383
|
+
${list}${pdfHint}`);
|
|
24360
24384
|
}
|
|
24361
24385
|
if (result.skipped.length > 0) {
|
|
24362
24386
|
const list = result.skipped.map((f) => `- ${f.name}${f.mimetype ? ` (${f.mimetype})` : ""} \u2014 ${f.reason}`).join("\n");
|
|
@@ -25505,7 +25529,7 @@ async function withMcpConfig(profile, connectionIds, fn, extraServers = {}) {
|
|
|
25505
25529
|
|
|
25506
25530
|
// ../api/src/version.ts
|
|
25507
25531
|
import { readFileSync as readFileSync8 } from "fs";
|
|
25508
|
-
var CLI_VERSION = true ? "0.1.
|
|
25532
|
+
var CLI_VERSION = true ? "0.1.65" : devVersion();
|
|
25509
25533
|
function isOlderVersion(a, b) {
|
|
25510
25534
|
const parse2 = (v) => v.replace(/^v/, "").split("-")[0].split(".").map(Number);
|
|
25511
25535
|
const [pa, pb] = [parse2(a), parse2(b)];
|
|
@@ -29137,7 +29161,34 @@ function isDevHost(c) {
|
|
|
29137
29161
|
);
|
|
29138
29162
|
}
|
|
29139
29163
|
|
|
29164
|
+
// ../api/src/dashboard/admin-middleware.ts
|
|
29165
|
+
function platformAdminEmails() {
|
|
29166
|
+
const raw = process.env["PLATFORM_ADMIN_EMAILS"] ?? "";
|
|
29167
|
+
return new Set(
|
|
29168
|
+
raw.split(",").map((e) => e.trim().toLowerCase()).filter(Boolean)
|
|
29169
|
+
);
|
|
29170
|
+
}
|
|
29171
|
+
var requirePlatformOperator = async (c, next) => {
|
|
29172
|
+
const supabase = createRequestSupabaseClient(c);
|
|
29173
|
+
const {
|
|
29174
|
+
data: { user }
|
|
29175
|
+
} = await supabase.auth.getUser();
|
|
29176
|
+
if (!user?.email) return c.json({ error: "not signed in" }, 401);
|
|
29177
|
+
const email = user.email.trim().toLowerCase();
|
|
29178
|
+
if (!platformAdminEmails().has(email)) {
|
|
29179
|
+
return c.json({ error: "platform operator access required" }, 403);
|
|
29180
|
+
}
|
|
29181
|
+
c.set("platformOperator", { userId: user.id, email });
|
|
29182
|
+
return next();
|
|
29183
|
+
};
|
|
29184
|
+
|
|
29140
29185
|
// ../api/src/dashboard/feature-flags-routes.ts
|
|
29186
|
+
function isOperator(auth) {
|
|
29187
|
+
return platformAdminEmails().has(auth.email.toLowerCase());
|
|
29188
|
+
}
|
|
29189
|
+
function isOperatorOnly(id) {
|
|
29190
|
+
return featureFlags[id].operatorOnly === true;
|
|
29191
|
+
}
|
|
29141
29192
|
async function isFeatureEnabled(c, flagId) {
|
|
29142
29193
|
const auth = c.get("auth");
|
|
29143
29194
|
const enabled = await listEnabledFeatureFlags(auth.workspaceId);
|
|
@@ -29149,7 +29200,7 @@ function createFeatureFlagsRouter() {
|
|
|
29149
29200
|
const auth = c.get("auth");
|
|
29150
29201
|
const devHost = isDevHost(c);
|
|
29151
29202
|
const flags = resolveFeatureFlags(await listEnabledFeatureFlags(auth.workspaceId), devHost);
|
|
29152
|
-
const labs = featureFlagIds.filter((id) => isFeatureVisible(featureFlags[id].stage, devHost)).map((id) => ({ id, ...featureFlags[id], enabled: flags[id] }));
|
|
29203
|
+
const labs = featureFlagIds.filter((id) => isFeatureVisible(featureFlags[id].stage, devHost)).filter((id) => !isOperatorOnly(id) || isOperator(auth)).map((id) => ({ id, ...featureFlags[id], enabled: flags[id] }));
|
|
29153
29204
|
return c.json({ flags, labs });
|
|
29154
29205
|
});
|
|
29155
29206
|
const toggle = async (c, enabled) => {
|
|
@@ -29157,6 +29208,9 @@ function createFeatureFlagsRouter() {
|
|
|
29157
29208
|
if (auth.role !== "admin") return c.json({ error: "admin access required" }, 403);
|
|
29158
29209
|
const flagId = c.req.param("flagId") ?? "";
|
|
29159
29210
|
if (!isFeatureFlagId(flagId)) return c.json({ error: "unknown feature flag" }, 404);
|
|
29211
|
+
if (isOperatorOnly(flagId) && !isOperator(auth)) {
|
|
29212
|
+
return c.json({ error: "unknown feature flag" }, 404);
|
|
29213
|
+
}
|
|
29160
29214
|
const stage = featureFlags[flagId].stage;
|
|
29161
29215
|
if (stage !== "setting" && !isFeatureVisible(stage, isDevHost(c))) {
|
|
29162
29216
|
return c.json({ error: "this feature flag cannot be changed here" }, 403);
|
|
@@ -32791,6 +32845,10 @@ ${msg.body}` : expandSkillCommand(channelConfig.claudeConfigDir, channelConfig.c
|
|
|
32791
32845
|
args: ["mcp", "threads"],
|
|
32792
32846
|
env: {
|
|
32793
32847
|
FLYSPACE_THREADS_WORKSPACE: channelConfig.profile,
|
|
32848
|
+
...channelConfig.permissionThread ? {
|
|
32849
|
+
FLYSPACE_THREAD_ID: channelConfig.permissionThread.threadId,
|
|
32850
|
+
FLYSPACE_CHANNEL_ID: channelConfig.permissionThread.channelId
|
|
32851
|
+
} : {},
|
|
32794
32852
|
...channelConfig.requesterHandle ? { FLYSPACE_REQUESTER_HANDLE: channelConfig.requesterHandle } : {}
|
|
32795
32853
|
}
|
|
32796
32854
|
},
|
|
@@ -35620,6 +35678,8 @@ export {
|
|
|
35620
35678
|
workspaceHostname,
|
|
35621
35679
|
trustedHost,
|
|
35622
35680
|
isDevHost,
|
|
35681
|
+
platformAdminEmails,
|
|
35682
|
+
requirePlatformOperator,
|
|
35623
35683
|
isFeatureEnabled,
|
|
35624
35684
|
createFeatureFlagsRouter,
|
|
35625
35685
|
PLATE,
|
|
@@ -14625,6 +14625,30 @@ 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
|
+
});
|
|
14628
14652
|
var listAutoUpdateSharesAction = defineContract({
|
|
14629
14653
|
name: "list_auto_update_shares",
|
|
14630
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.",
|
|
@@ -14661,6 +14685,8 @@ var ACTIONS = [
|
|
|
14661
14685
|
postReplyAction,
|
|
14662
14686
|
moveThreadAction,
|
|
14663
14687
|
shareDocAction,
|
|
14688
|
+
openDocAction,
|
|
14689
|
+
setUiZoomAction,
|
|
14664
14690
|
listAutoUpdateSharesAction,
|
|
14665
14691
|
requestPermissionAction,
|
|
14666
14692
|
checkPermissionAction
|
|
@@ -14799,6 +14825,8 @@ export {
|
|
|
14799
14825
|
postReplyAction,
|
|
14800
14826
|
moveThreadAction,
|
|
14801
14827
|
shareDocAction,
|
|
14828
|
+
openDocAction,
|
|
14829
|
+
setUiZoomAction,
|
|
14802
14830
|
listAutoUpdateSharesAction,
|
|
14803
14831
|
requestPermissionAction,
|
|
14804
14832
|
checkPermissionAction,
|
package/dist/cli.js
CHANGED
|
@@ -185,6 +185,7 @@ import {
|
|
|
185
185
|
mentionedUserIds,
|
|
186
186
|
onboardingPending,
|
|
187
187
|
pinnedClaudeConfigDir,
|
|
188
|
+
platformAdminEmails,
|
|
188
189
|
postToDashboardChannel,
|
|
189
190
|
profileClaudeConfigDir,
|
|
190
191
|
profileEnv,
|
|
@@ -203,6 +204,7 @@ import {
|
|
|
203
204
|
removeChannelMember,
|
|
204
205
|
renderAppIcon,
|
|
205
206
|
requireDocsAccess,
|
|
207
|
+
requirePlatformOperator,
|
|
206
208
|
resetWorkspaceOnboarding,
|
|
207
209
|
resetWorkspacePrompt,
|
|
208
210
|
resolveAuthContext,
|
|
@@ -282,7 +284,7 @@ import {
|
|
|
282
284
|
workspaceHostname,
|
|
283
285
|
workspaceSkillsDir,
|
|
284
286
|
writeSkillFile
|
|
285
|
-
} from "./chunk-
|
|
287
|
+
} from "./chunk-5ISKGSFF.js";
|
|
286
288
|
import {
|
|
287
289
|
checkPermissionAction,
|
|
288
290
|
createThreadAction,
|
|
@@ -294,14 +296,16 @@ import {
|
|
|
294
296
|
listThreads,
|
|
295
297
|
moveThread,
|
|
296
298
|
moveThreadAction,
|
|
299
|
+
openDocAction,
|
|
297
300
|
postReplyAction,
|
|
298
301
|
readThreadAction,
|
|
299
302
|
requestPermissionAction,
|
|
300
303
|
resolveChannel,
|
|
301
304
|
runDocsCmd,
|
|
302
305
|
searchThreadsAction,
|
|
306
|
+
setUiZoomAction,
|
|
303
307
|
shareDocAction
|
|
304
|
-
} from "./chunk-
|
|
308
|
+
} from "./chunk-GQ2QZ5WF.js";
|
|
305
309
|
import {
|
|
306
310
|
AuthApiError,
|
|
307
311
|
DEFAULT_API_URL,
|
|
@@ -2210,7 +2214,7 @@ function npmEnv(target) {
|
|
|
2210
2214
|
return nodeBin ? { ...process.env, PATH: `${nodeBin}:${process.env.PATH ?? ""}` } : process.env;
|
|
2211
2215
|
}
|
|
2212
2216
|
async function runUpgrade() {
|
|
2213
|
-
const current = "0.1.
|
|
2217
|
+
const current = "0.1.65";
|
|
2214
2218
|
console.log(`Current version: ${current}`);
|
|
2215
2219
|
console.log("Checking for updates...\n");
|
|
2216
2220
|
try {
|
|
@@ -6162,7 +6166,7 @@ async function runMcpCmd(args) {
|
|
|
6162
6166
|
useHostDbWithoutCredentials();
|
|
6163
6167
|
switch (server) {
|
|
6164
6168
|
case "threads": {
|
|
6165
|
-
const { startThreadsServer } = await import("./threads-
|
|
6169
|
+
const { startThreadsServer } = await import("./threads-AR6D7V3Y.js");
|
|
6166
6170
|
await startThreadsServer();
|
|
6167
6171
|
return;
|
|
6168
6172
|
}
|
|
@@ -7109,6 +7113,33 @@ var shareDoc = async (input2, ctx) => {
|
|
|
7109
7113
|
if (!res.url) throw new ActionError(`Share failed: ${res.error ?? "unknown error"}`);
|
|
7110
7114
|
return { url: res.url };
|
|
7111
7115
|
};
|
|
7116
|
+
var openDoc = async (input2, ctx) => {
|
|
7117
|
+
const channel = await channelInScope(ctx, input2.channel_id);
|
|
7118
|
+
const { threadId } = ctx.requester;
|
|
7119
|
+
if (!threadId) throw new ActionError("No thread to open the doc in.");
|
|
7120
|
+
await threadInScope(ctx, threadId);
|
|
7121
|
+
const targetUserId = await requesterUserId(ctx);
|
|
7122
|
+
if (!targetUserId) throw new ActionError("No requester to open the doc for.");
|
|
7123
|
+
const res = await getSupabaseClient().channel(`agent-thinking:${threadId}`).httpSend("open-doc", {
|
|
7124
|
+
channelId: channel.id,
|
|
7125
|
+
path: input2.path,
|
|
7126
|
+
...input2.line ? { line: input2.line } : {},
|
|
7127
|
+
targetUserId
|
|
7128
|
+
});
|
|
7129
|
+
if (!res.success) throw new Error(`broadcast failed: ${res.error}`);
|
|
7130
|
+
return { opened: true };
|
|
7131
|
+
};
|
|
7132
|
+
var setUiZoom = async (input2, ctx) => {
|
|
7133
|
+
const { threadId } = ctx.requester;
|
|
7134
|
+
if (!threadId) throw new ActionError("No thread to reach the requester through.");
|
|
7135
|
+
await threadInScope(ctx, threadId);
|
|
7136
|
+
const targetUserId = await requesterUserId(ctx);
|
|
7137
|
+
if (!targetUserId) throw new ActionError("No requester to set the zoom for.");
|
|
7138
|
+
const zoom = Math.round(input2.percent / 10) / 10;
|
|
7139
|
+
const res = await getSupabaseClient().channel(`agent-thinking:${threadId}`).httpSend("set-ui-zoom", { zoom, targetUserId });
|
|
7140
|
+
if (!res.success) throw new Error(`broadcast failed: ${res.error}`);
|
|
7141
|
+
return { zoom };
|
|
7142
|
+
};
|
|
7112
7143
|
var listAutoUpdateShares = async (_input, ctx) => ({
|
|
7113
7144
|
shares: (await listAutoUpdateDocShares(ctx.scope)).map((s) => ({
|
|
7114
7145
|
channel_id: s.channelId,
|
|
@@ -7184,6 +7215,8 @@ var HANDLERS = {
|
|
|
7184
7215
|
[postReplyAction.name]: postReply,
|
|
7185
7216
|
[moveThreadAction.name]: moveThread2,
|
|
7186
7217
|
[shareDocAction.name]: shareDoc,
|
|
7218
|
+
[openDocAction.name]: openDoc,
|
|
7219
|
+
[setUiZoomAction.name]: setUiZoom,
|
|
7187
7220
|
[listAutoUpdateSharesAction.name]: listAutoUpdateShares,
|
|
7188
7221
|
[requestPermissionAction.name]: requestPermission,
|
|
7189
7222
|
[checkPermissionAction.name]: checkPermission
|
|
@@ -7613,27 +7646,6 @@ async function ensureGreetingThread(workspaceId, channelId, ownerName) {
|
|
|
7613
7646
|
return error2?.code === "23505" ? (await existing()).data?.id ?? null : null;
|
|
7614
7647
|
}
|
|
7615
7648
|
|
|
7616
|
-
// ../api/src/dashboard/admin-middleware.ts
|
|
7617
|
-
function platformAdminEmails() {
|
|
7618
|
-
const raw = process.env["PLATFORM_ADMIN_EMAILS"] ?? "";
|
|
7619
|
-
return new Set(
|
|
7620
|
-
raw.split(",").map((e) => e.trim().toLowerCase()).filter(Boolean)
|
|
7621
|
-
);
|
|
7622
|
-
}
|
|
7623
|
-
var requirePlatformOperator = async (c, next) => {
|
|
7624
|
-
const supabase = createRequestSupabaseClient(c);
|
|
7625
|
-
const {
|
|
7626
|
-
data: { user }
|
|
7627
|
-
} = await supabase.auth.getUser();
|
|
7628
|
-
if (!user?.email) return c.json({ error: "not signed in" }, 401);
|
|
7629
|
-
const email = user.email.trim().toLowerCase();
|
|
7630
|
-
if (!platformAdminEmails().has(email)) {
|
|
7631
|
-
return c.json({ error: "platform operator access required" }, 403);
|
|
7632
|
-
}
|
|
7633
|
-
c.set("platformOperator", { userId: user.id, email });
|
|
7634
|
-
return next();
|
|
7635
|
-
};
|
|
7636
|
-
|
|
7637
7649
|
// ../api/src/dashboard/auth-routes.ts
|
|
7638
7650
|
function createAuthRouter() {
|
|
7639
7651
|
const auth = new Hono7();
|
|
@@ -10394,6 +10406,29 @@ var GROQ_TRANSCRIBE_URL = "https://api.groq.com/openai/v1/audio/transcriptions";
|
|
|
10394
10406
|
var MODEL2 = "whisper-large-v3-turbo";
|
|
10395
10407
|
var MAX_AUDIO_BYTES = 25 * 1024 * 1024;
|
|
10396
10408
|
var MAX_PROMPT_CHARS = 400;
|
|
10409
|
+
var MAX_TAIL_CHARS = 200;
|
|
10410
|
+
var MAX_GLOSSARY_CHARS = 150;
|
|
10411
|
+
var STYLE_SEED = "\u9019\u662F\u7E41\u9AD4\u4E2D\u6587\u7684\u53E3\u8FF0\uFF0C\u4E2D\u9593\u593E\u96DC English \u8853\u8A9E\uFF0C\u4F8B\u5982 component\u3001API\u3001deploy\u3002";
|
|
10412
|
+
var HALLUCINATIONS = [
|
|
10413
|
+
/^(謝謝|感謝)(大家|您|你)?(的)?(收看|觀看|收聽|觀賞)[。!!.]?$/,
|
|
10414
|
+
/^請不吝點讚.*$/,
|
|
10415
|
+
/^字幕(由|製作|提供).{0,20}$/,
|
|
10416
|
+
/^(thank you|thanks)( (so much|very much))?( for watching)?[.!]?$/i,
|
|
10417
|
+
/^(you|bye)[.!]?$/i
|
|
10418
|
+
];
|
|
10419
|
+
function isHallucination(text) {
|
|
10420
|
+
const t = text.trim();
|
|
10421
|
+
return HALLUCINATIONS.some((re) => re.test(t));
|
|
10422
|
+
}
|
|
10423
|
+
function buildPrompt(terms, tail) {
|
|
10424
|
+
let glossary = "";
|
|
10425
|
+
for (const term of terms) {
|
|
10426
|
+
const next = glossary ? `${glossary}\u3001${term}` : term;
|
|
10427
|
+
if (next.length > MAX_GLOSSARY_CHARS) break;
|
|
10428
|
+
glossary = next;
|
|
10429
|
+
}
|
|
10430
|
+
return [glossary && `${glossary}\u3002`, STYLE_SEED, tail.slice(-MAX_TAIL_CHARS)].filter(Boolean).join(" ").slice(-MAX_PROMPT_CHARS);
|
|
10431
|
+
}
|
|
10397
10432
|
var NO_SPEECH_THRESHOLD = 0.6;
|
|
10398
10433
|
function createTranscribeRouter() {
|
|
10399
10434
|
const app = new Hono17();
|
|
@@ -10409,9 +10444,17 @@ function createTranscribeRouter() {
|
|
|
10409
10444
|
form.append("model", MODEL2);
|
|
10410
10445
|
form.append("temperature", "0");
|
|
10411
10446
|
form.append("response_format", "verbose_json");
|
|
10412
|
-
const
|
|
10413
|
-
|
|
10414
|
-
|
|
10447
|
+
const tail = typeof body?.["prompt"] === "string" ? body["prompt"] : "";
|
|
10448
|
+
const channelId = body?.["channelId"];
|
|
10449
|
+
let terms = [];
|
|
10450
|
+
if (typeof channelId === "string" && channelId) {
|
|
10451
|
+
const visible = await globalChannelMeta(c).catch(() => /* @__PURE__ */ new Map());
|
|
10452
|
+
if (visible.has(channelId)) {
|
|
10453
|
+
const glossary = await getChannelGlossaries([channelId]).catch(() => /* @__PURE__ */ new Map());
|
|
10454
|
+
terms = (glossary.get(channelId)?.terms ?? []).map((t) => t.term);
|
|
10455
|
+
}
|
|
10456
|
+
}
|
|
10457
|
+
form.append("prompt", buildPrompt(terms, tail));
|
|
10415
10458
|
const language = body?.["language"];
|
|
10416
10459
|
if (typeof language === "string" && /^[a-z]{2}$/.test(language)) {
|
|
10417
10460
|
form.append("language", language);
|
|
@@ -10427,7 +10470,8 @@ function createTranscribeRouter() {
|
|
|
10427
10470
|
if (segments.length > 0 && segments.every((s) => (s.no_speech_prob ?? 0) > NO_SPEECH_THRESHOLD)) {
|
|
10428
10471
|
return c.json({ text: "" });
|
|
10429
10472
|
}
|
|
10430
|
-
|
|
10473
|
+
const text = (data.text ?? "").trim();
|
|
10474
|
+
return c.json({ text: isHallucination(text) ? "" : text });
|
|
10431
10475
|
});
|
|
10432
10476
|
return app;
|
|
10433
10477
|
}
|
|
@@ -16086,7 +16130,7 @@ async function main() {
|
|
|
16086
16130
|
break;
|
|
16087
16131
|
case "-v":
|
|
16088
16132
|
case "--version":
|
|
16089
|
-
printRaw("0.1.
|
|
16133
|
+
printRaw("0.1.65");
|
|
16090
16134
|
break;
|
|
16091
16135
|
case "-h":
|
|
16092
16136
|
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-5ISKGSFF.js";
|
|
7
7
|
import "./chunk-O7OYNQND.js";
|
|
8
8
|
export {
|
|
9
9
|
startServer
|
|
@@ -10,13 +10,15 @@ import {
|
|
|
10
10
|
listAutoUpdateSharesAction,
|
|
11
11
|
listChannelsAction,
|
|
12
12
|
moveThreadAction,
|
|
13
|
+
openDocAction,
|
|
13
14
|
postReplyAction,
|
|
14
15
|
readThreadAction,
|
|
15
16
|
requestPermissionAction,
|
|
16
17
|
searchThreadsAction,
|
|
18
|
+
setUiZoomAction,
|
|
17
19
|
shareDoc,
|
|
18
20
|
shareDocAction
|
|
19
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-GQ2QZ5WF.js";
|
|
20
22
|
import {
|
|
21
23
|
SessionStore,
|
|
22
24
|
paths,
|
|
@@ -89,7 +91,9 @@ function requester() {
|
|
|
89
91
|
const env = process.env;
|
|
90
92
|
return {
|
|
91
93
|
...env["FLYSPACE_THREADS_WORKSPACE"] ? { workspace: env["FLYSPACE_THREADS_WORKSPACE"] } : {},
|
|
92
|
-
...env["FLYSPACE_REQUESTER_HANDLE"] ? { handle: env["FLYSPACE_REQUESTER_HANDLE"] } : {}
|
|
94
|
+
...env["FLYSPACE_REQUESTER_HANDLE"] ? { handle: env["FLYSPACE_REQUESTER_HANDLE"] } : {},
|
|
95
|
+
...env["FLYSPACE_THREAD_ID"] ? { threadId: env["FLYSPACE_THREAD_ID"] } : {},
|
|
96
|
+
...env["FLYSPACE_CHANNEL_ID"] ? { channelId: env["FLYSPACE_CHANNEL_ID"] } : {}
|
|
93
97
|
};
|
|
94
98
|
}
|
|
95
99
|
async function readThread(ref) {
|
|
@@ -198,6 +202,21 @@ async function callTool(name, args, permission) {
|
|
|
198
202
|
if (!channelId || !path) throw new Error("channel_id and path are required");
|
|
199
203
|
return shareDoc(channelId, path, str(args["slug"])?.trim() || void 0);
|
|
200
204
|
}
|
|
205
|
+
case openDocAction.name: {
|
|
206
|
+
const line = typeof args["line"] === "number" ? args["line"] : void 0;
|
|
207
|
+
const path = str(args["path"])?.trim() ?? "";
|
|
208
|
+
await callAction(
|
|
209
|
+
openDocAction,
|
|
210
|
+
{ channel_id: str(args["channel_id"])?.trim() ?? "", path, ...line ? { line } : {} },
|
|
211
|
+
requester()
|
|
212
|
+
);
|
|
213
|
+
return `Opened ${path} in the requester's Docs pane.`;
|
|
214
|
+
}
|
|
215
|
+
case setUiZoomAction.name: {
|
|
216
|
+
const percent = Number(args["percent"]);
|
|
217
|
+
await callAction(setUiZoomAction, { percent }, requester());
|
|
218
|
+
return `Set the requester's UI zoom to ${percent}%.`;
|
|
219
|
+
}
|
|
201
220
|
case requestPermissionAction.name: {
|
|
202
221
|
if (!permission) break;
|
|
203
222
|
const input = args["input"] && typeof args["input"] === "object" ? args["input"] : {};
|