flyspace-cli 0.1.61 → 0.1.63
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-METRJ6PG.js → chunk-SBNBTJKW.js} +160 -74
- package/dist/cli.js +64 -14
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/system.capabilities.md +2 -1
|
@@ -20392,7 +20392,7 @@ function interpretCliOutcome(result, resumeSessionId, maxBudgetUsd, model, using
|
|
|
20392
20392
|
}
|
|
20393
20393
|
var DEFAULT_IDLE_TIMEOUT_SECONDS = 300;
|
|
20394
20394
|
var DEFAULT_MAX_DURATION_SECONDS = 600;
|
|
20395
|
-
var DEFAULT_STREAMING_MAX_DURATION_SECONDS =
|
|
20395
|
+
var DEFAULT_STREAMING_MAX_DURATION_SECONDS = 7200;
|
|
20396
20396
|
var KILL_GRACE_MS = 1e4;
|
|
20397
20397
|
function envSeconds(name, defaultSeconds) {
|
|
20398
20398
|
const raw = process.env[name];
|
|
@@ -20704,6 +20704,7 @@ function runCli(prompt, cwd, botName, options, claudeConfigDir, resumeSessionId,
|
|
|
20704
20704
|
let liveSessionId;
|
|
20705
20705
|
const streamedText = [];
|
|
20706
20706
|
let killedTool = false;
|
|
20707
|
+
let mcpNeedsAuth = [];
|
|
20707
20708
|
const onLine = options.onActivity ? createLineSplitter((line) => {
|
|
20708
20709
|
let event;
|
|
20709
20710
|
try {
|
|
@@ -20712,6 +20713,9 @@ function runCli(prompt, cwd, botName, options, claudeConfigDir, resumeSessionId,
|
|
|
20712
20713
|
return;
|
|
20713
20714
|
}
|
|
20714
20715
|
if (event.session_id) liveSessionId = event.session_id;
|
|
20716
|
+
if (event.mcp_servers) {
|
|
20717
|
+
mcpNeedsAuth = event.mcp_servers.filter((server) => server.status === "needs-auth" && server.name).map((server) => server.name);
|
|
20718
|
+
}
|
|
20715
20719
|
if (event.type === "result") streamResultLine = line;
|
|
20716
20720
|
if (pluginUi) {
|
|
20717
20721
|
pluginUi.onEvent(event);
|
|
@@ -20823,7 +20827,11 @@ function runCli(prompt, cwd, botName, options, claudeConfigDir, resumeSessionId,
|
|
|
20823
20827
|
stderrTail: stderrTail(stderr),
|
|
20824
20828
|
message: (result.result ?? "").slice(0, 500)
|
|
20825
20829
|
}
|
|
20826
|
-
} :
|
|
20830
|
+
} : {
|
|
20831
|
+
...response,
|
|
20832
|
+
...killedTool ? { killedTool } : {},
|
|
20833
|
+
...mcpNeedsAuth.length ? { mcpNeedsAuth } : {}
|
|
20834
|
+
}
|
|
20827
20835
|
);
|
|
20828
20836
|
} catch {
|
|
20829
20837
|
const fallback = onLine ? "" : stdout.trim();
|
|
@@ -24648,7 +24656,8 @@ async function ownIdentityFor(client) {
|
|
|
24648
24656
|
async function mirrorIncomingMessage(client, msg) {
|
|
24649
24657
|
if (!databaseReachable()) return;
|
|
24650
24658
|
if (msg.subtype && SKIP_SUBTYPES.has(msg.subtype)) return;
|
|
24651
|
-
if (msg.subtype === "
|
|
24659
|
+
if (msg.subtype === "message_deleted") return;
|
|
24660
|
+
if (msg.subtype === "message_changed") return mirrorEditedMessage(client, msg);
|
|
24652
24661
|
try {
|
|
24653
24662
|
await ensureUsersCached(client, mentionedUserIds(msg));
|
|
24654
24663
|
const body = bodyTextFor(msg);
|
|
@@ -24744,6 +24753,19 @@ async function mirrorIncomingMessage(client, msg) {
|
|
|
24744
24753
|
);
|
|
24745
24754
|
}
|
|
24746
24755
|
}
|
|
24756
|
+
async function mirrorEditedMessage(client, msg) {
|
|
24757
|
+
try {
|
|
24758
|
+
await ensureUsersCached(client, mentionedUserIds(msg));
|
|
24759
|
+
const body = bodyTextFor(msg);
|
|
24760
|
+
if (!body) return;
|
|
24761
|
+
const { error } = await getSupabaseClient().from("thread_replies").update({ body }).eq("external_thread_replies_id", `${msg.channel}:${msg.ts}`);
|
|
24762
|
+
if (error) throw new Error(error.message);
|
|
24763
|
+
} catch (err) {
|
|
24764
|
+
console.warn(
|
|
24765
|
+
`[live-mirror] edit ${msg.channel}:${msg.ts}: ${err instanceof Error ? err.message : String(err)}`
|
|
24766
|
+
);
|
|
24767
|
+
}
|
|
24768
|
+
}
|
|
24747
24769
|
|
|
24748
24770
|
// src/slack/thread-summary.ts
|
|
24749
24771
|
function buildSummaryPrompt(transcript) {
|
|
@@ -25483,7 +25505,7 @@ async function withMcpConfig(profile, connectionIds, fn, extraServers = {}) {
|
|
|
25483
25505
|
|
|
25484
25506
|
// ../api/src/version.ts
|
|
25485
25507
|
import { readFileSync as readFileSync8 } from "fs";
|
|
25486
|
-
var CLI_VERSION = true ? "0.1.
|
|
25508
|
+
var CLI_VERSION = true ? "0.1.63" : devVersion();
|
|
25487
25509
|
function isOlderVersion(a, b) {
|
|
25488
25510
|
const parse2 = (v) => v.replace(/^v/, "").split("-")[0].split(".").map(Number);
|
|
25489
25511
|
const [pa, pb] = [parse2(a), parse2(b)];
|
|
@@ -26264,6 +26286,20 @@ var RATE_CARDS = [
|
|
|
26264
26286
|
cacheWritePer1M: 3.75,
|
|
26265
26287
|
effectiveFrom: "2026-09-01"
|
|
26266
26288
|
},
|
|
26289
|
+
{
|
|
26290
|
+
// Anthropic's pricing page, checked 2026-11-09: the scheduled rise to $3/$15
|
|
26291
|
+
// never happened and $2/$10 became the standard price. Rows recorded since
|
|
26292
|
+
// 2026-09-01 still point at the card above and were overpriced by 50%.
|
|
26293
|
+
id: "anthropic:sonnet-5@2026-11-09",
|
|
26294
|
+
provider: "anthropic",
|
|
26295
|
+
model: "Claude Sonnet 5",
|
|
26296
|
+
matches: ["sonnet", "claude-sonnet"],
|
|
26297
|
+
inputPer1M: 2,
|
|
26298
|
+
outputPer1M: 10,
|
|
26299
|
+
cacheReadPer1M: 0.2,
|
|
26300
|
+
cacheWritePer1M: 2.5,
|
|
26301
|
+
effectiveFrom: "2026-11-09"
|
|
26302
|
+
},
|
|
26267
26303
|
{
|
|
26268
26304
|
id: "anthropic:opus-5@launch",
|
|
26269
26305
|
provider: "anthropic",
|
|
@@ -26339,6 +26375,18 @@ var RATE_CARDS = [
|
|
|
26339
26375
|
cacheWritePer1M: 5,
|
|
26340
26376
|
effectiveFrom: EPOCH
|
|
26341
26377
|
},
|
|
26378
|
+
{
|
|
26379
|
+
// OpenAI's pricing page, checked 2026-11-09: GPT-5.6 Sol dropped to $4/$20.
|
|
26380
|
+
id: "openai:gpt-5.6-sol@2026-11-09",
|
|
26381
|
+
provider: "openai",
|
|
26382
|
+
model: "GPT-5.6 Sol",
|
|
26383
|
+
matches: ["gpt-5.6-sol"],
|
|
26384
|
+
inputPer1M: 4,
|
|
26385
|
+
outputPer1M: 20,
|
|
26386
|
+
cacheReadPer1M: 0.4,
|
|
26387
|
+
cacheWritePer1M: 4,
|
|
26388
|
+
effectiveFrom: "2026-11-09"
|
|
26389
|
+
},
|
|
26342
26390
|
{
|
|
26343
26391
|
id: "openai:gpt-5.6-terra@0730",
|
|
26344
26392
|
provider: "openai",
|
|
@@ -32222,7 +32270,11 @@ ${msg.body}` : expandSkillCommand(channelConfig.claudeConfigDir, channelConfig.c
|
|
|
32222
32270
|
)) {
|
|
32223
32271
|
return;
|
|
32224
32272
|
}
|
|
32225
|
-
await this.postReply(
|
|
32273
|
+
await this.postReply(
|
|
32274
|
+
msg.threadId,
|
|
32275
|
+
withMcpRetryButton(response.text || "No response", response.mcpNeedsAuth),
|
|
32276
|
+
activities
|
|
32277
|
+
);
|
|
32226
32278
|
if (response.killedTool) {
|
|
32227
32279
|
void this.continueAfterKilledTool(
|
|
32228
32280
|
msg.threadId,
|
|
@@ -32402,42 +32454,49 @@ ${msg.body}` : expandSkillCommand(channelConfig.claudeConfigDir, channelConfig.c
|
|
|
32402
32454
|
} : {};
|
|
32403
32455
|
const permissionServer = channelConfig.runtime === "host" && permission;
|
|
32404
32456
|
try {
|
|
32405
|
-
return await
|
|
32457
|
+
return await runWithProfile(
|
|
32406
32458
|
channelConfig.profile,
|
|
32407
|
-
|
|
32408
|
-
|
|
32409
|
-
|
|
32410
|
-
|
|
32411
|
-
|
|
32412
|
-
|
|
32413
|
-
|
|
32414
|
-
|
|
32415
|
-
|
|
32416
|
-
|
|
32417
|
-
|
|
32418
|
-
|
|
32419
|
-
|
|
32420
|
-
|
|
32421
|
-
|
|
32422
|
-
|
|
32423
|
-
|
|
32424
|
-
|
|
32425
|
-
|
|
32426
|
-
|
|
32427
|
-
|
|
32428
|
-
|
|
32429
|
-
|
|
32430
|
-
|
|
32431
|
-
|
|
32432
|
-
|
|
32433
|
-
|
|
32434
|
-
|
|
32435
|
-
|
|
32436
|
-
|
|
32437
|
-
|
|
32438
|
-
|
|
32439
|
-
|
|
32440
|
-
|
|
32459
|
+
() => withMcpConfig(
|
|
32460
|
+
channelConfig.profile,
|
|
32461
|
+
channelConfig.mcpConnections,
|
|
32462
|
+
(mcpConfigPath) => this.ask(
|
|
32463
|
+
prompt,
|
|
32464
|
+
channelConfig.cwd,
|
|
32465
|
+
this.config.botName,
|
|
32466
|
+
{
|
|
32467
|
+
model: channelConfig.model,
|
|
32468
|
+
effort: channelConfig.effort,
|
|
32469
|
+
runtime: channelConfig.runtime,
|
|
32470
|
+
mounts: channelConfig.mounts,
|
|
32471
|
+
permissionMode: channelConfig.permissionMode,
|
|
32472
|
+
...permissionServer ? { permissionPromptTool: PERMISSION_PROMPT_TOOL } : {},
|
|
32473
|
+
maxBudgetUsd: this.config.maxBudgetUsd,
|
|
32474
|
+
agentPersona,
|
|
32475
|
+
channelPrompt: channelConfig.prompt,
|
|
32476
|
+
ownPersona: channelConfig.ownPersona,
|
|
32477
|
+
slackBound: channelConfig.slackBound,
|
|
32478
|
+
onActivity,
|
|
32479
|
+
...channelConfig.permissionThread ? {
|
|
32480
|
+
onPluginUi: (state) => void this.savePluginUi(
|
|
32481
|
+
channelConfig.profile,
|
|
32482
|
+
channelConfig.permissionThread.threadId,
|
|
32483
|
+
state
|
|
32484
|
+
)
|
|
32485
|
+
} : {},
|
|
32486
|
+
signal,
|
|
32487
|
+
mcpConfigPath,
|
|
32488
|
+
...usageContext ? { usageContext } : {},
|
|
32489
|
+
...channelConfig.docsAccess ? { docsAccess: channelConfig.docsAccess } : {},
|
|
32490
|
+
...channelConfig.docsAccessUnverified ? { docsAccessUnverified: true } : {},
|
|
32491
|
+
...channelConfig.memoryPrompt ? { memoryPrompt: channelConfig.memoryPrompt } : {},
|
|
32492
|
+
...channelConfig.disableAutoMemory ? { disableAutoMemory: true } : {}
|
|
32493
|
+
},
|
|
32494
|
+
channelConfig.claudeConfigDir,
|
|
32495
|
+
sessionId,
|
|
32496
|
+
channelConfig.claudeCodeOauthToken
|
|
32497
|
+
),
|
|
32498
|
+
ownServers
|
|
32499
|
+
)
|
|
32441
32500
|
);
|
|
32442
32501
|
} catch (err) {
|
|
32443
32502
|
console.error("[chat-agent] ask failed:", err.message);
|
|
@@ -32470,40 +32529,43 @@ ${msg.body}` : expandSkillCommand(channelConfig.claudeConfigDir, channelConfig.c
|
|
|
32470
32529
|
const name = subAgentName(channelConfig.agentName);
|
|
32471
32530
|
const agentPersona = name ? readAgentPersona(channelConfig.claudeConfigDir, channelConfig.cwd, name) : void 0;
|
|
32472
32531
|
try {
|
|
32473
|
-
return await
|
|
32474
|
-
|
|
32475
|
-
|
|
32476
|
-
|
|
32477
|
-
|
|
32478
|
-
|
|
32479
|
-
|
|
32480
|
-
|
|
32481
|
-
|
|
32482
|
-
|
|
32483
|
-
|
|
32484
|
-
|
|
32485
|
-
|
|
32486
|
-
|
|
32487
|
-
|
|
32488
|
-
|
|
32489
|
-
|
|
32490
|
-
|
|
32491
|
-
|
|
32492
|
-
|
|
32493
|
-
|
|
32494
|
-
|
|
32495
|
-
|
|
32496
|
-
|
|
32497
|
-
|
|
32498
|
-
|
|
32499
|
-
|
|
32500
|
-
|
|
32501
|
-
|
|
32502
|
-
|
|
32503
|
-
|
|
32504
|
-
|
|
32505
|
-
|
|
32506
|
-
|
|
32532
|
+
return await runWithProfile(
|
|
32533
|
+
channelConfig.profile,
|
|
32534
|
+
() => askCodex(
|
|
32535
|
+
prompt,
|
|
32536
|
+
channelConfig.cwd,
|
|
32537
|
+
{
|
|
32538
|
+
// A channel (or the composer) can name a Codex model in the same
|
|
32539
|
+
// `model` field Claude uses — whichever runner recognises the value
|
|
32540
|
+
// owns it. Falling back to CUSTIE_CODEX_MODEL, then to whatever
|
|
32541
|
+
// Codex's own config.toml says.
|
|
32542
|
+
...isCodexModel(channelConfig.model) ? { model: channelConfig.model } : channelConfig.codexModel ? { model: channelConfig.codexModel } : {},
|
|
32543
|
+
...channelConfig.effort ? { effort: channelConfig.effort } : {},
|
|
32544
|
+
// Codex has no --append-system-prompt, so the workspace persona and
|
|
32545
|
+
// the channel's own instructions ride in with the prompt. Without
|
|
32546
|
+
// this a Codex turn answers as a generic coding agent: no house
|
|
32547
|
+
// language rules, no Slack/dashboard conventions, no channel prompt.
|
|
32548
|
+
systemPrompt: [
|
|
32549
|
+
buildSystemPrompt(
|
|
32550
|
+
this.config.botName,
|
|
32551
|
+
agentPersona,
|
|
32552
|
+
channelConfig.prompt,
|
|
32553
|
+
resolveSelectedOutputStyle(channelConfig.claudeConfigDir)?.body,
|
|
32554
|
+
channelConfig.slackBound
|
|
32555
|
+
),
|
|
32556
|
+
channelConfig.memoryPrompt,
|
|
32557
|
+
docsAccessPromptNote(channelConfig.docsAccess, channelConfig.docsAccessUnverified)
|
|
32558
|
+
].filter(Boolean).join("\n\n---\n\n"),
|
|
32559
|
+
// Codex has no per-tool deny list, so any restricted requester gets
|
|
32560
|
+
// its read-only sandbox (no file writes). It can still read: see the
|
|
32561
|
+
// residual-gap note in docs/features/user-roles.md.
|
|
32562
|
+
...channelConfig.docsAccess === "read" || channelConfig.docsAccess === "none" ? { sandbox: "read-only" } : {},
|
|
32563
|
+
...onActivity ? { onActivity } : {},
|
|
32564
|
+
...signal ? { signal } : {},
|
|
32565
|
+
...usageContext ? { usageContext } : {}
|
|
32566
|
+
},
|
|
32567
|
+
sessionId
|
|
32568
|
+
)
|
|
32507
32569
|
);
|
|
32508
32570
|
} catch (err) {
|
|
32509
32571
|
console.error("[chat-agent] ask codex failed:", err.message);
|
|
@@ -32751,6 +32813,12 @@ ${lines}
|
|
|
32751
32813
|
}
|
|
32752
32814
|
}
|
|
32753
32815
|
};
|
|
32816
|
+
function withMcpRetryButton(text, needsAuth) {
|
|
32817
|
+
if (!needsAuth?.length || /\[BUTTONS:/i.test(text)) return text;
|
|
32818
|
+
return `${text}
|
|
32819
|
+
|
|
32820
|
+
[BUTTONS: \u{1F504} Signed in to ${needsAuth.join(", ")}, retry]`;
|
|
32821
|
+
}
|
|
32754
32822
|
|
|
32755
32823
|
// src/slack/commands.ts
|
|
32756
32824
|
var SKILL_SELECT_ACTION_ID = "custie_skill_select";
|
|
@@ -33382,6 +33450,11 @@ ${trimmedDetail.slice(0, 1500)}
|
|
|
33382
33450
|
return;
|
|
33383
33451
|
}
|
|
33384
33452
|
const askOptions = {
|
|
33453
|
+
// Stream mode, even though Slack shows no live activity: it puts the
|
|
33454
|
+
// turn under the idle watchdog, so a busy turn keeps running instead
|
|
33455
|
+
// of hitting the short plain-json wall-clock cap.
|
|
33456
|
+
onActivity: () => {
|
|
33457
|
+
},
|
|
33385
33458
|
model: effectiveModel2,
|
|
33386
33459
|
effort: effectiveEffort,
|
|
33387
33460
|
maxBudgetUsd,
|
|
@@ -33674,6 +33747,18 @@ retry: ${retryDetail}`);
|
|
|
33674
33747
|
});
|
|
33675
33748
|
});
|
|
33676
33749
|
app.event("message", async ({ event, client }) => {
|
|
33750
|
+
if (event.subtype === "message_changed") {
|
|
33751
|
+
const edited = event.message;
|
|
33752
|
+
if (!edited.ts) return;
|
|
33753
|
+
await mirrorIncomingMessage(client, {
|
|
33754
|
+
channel: event.channel,
|
|
33755
|
+
ts: edited.ts,
|
|
33756
|
+
subtype: "message_changed",
|
|
33757
|
+
text: typeof edited.text === "string" ? edited.text : void 0,
|
|
33758
|
+
blocks: Array.isArray(edited.blocks) ? edited.blocks : void 0
|
|
33759
|
+
});
|
|
33760
|
+
return;
|
|
33761
|
+
}
|
|
33677
33762
|
await mirrorIncomingMessage(client, {
|
|
33678
33763
|
channel: event.channel,
|
|
33679
33764
|
ts: event.ts,
|
|
@@ -35165,6 +35250,7 @@ export {
|
|
|
35165
35250
|
TRANSLATION_LANGUAGES,
|
|
35166
35251
|
canonicalLanguage,
|
|
35167
35252
|
isTranslatableLanguage,
|
|
35253
|
+
isSourceLanguage,
|
|
35168
35254
|
detectSourceLanguage,
|
|
35169
35255
|
createTtsRouter,
|
|
35170
35256
|
dropShareAudio,
|
package/dist/cli.js
CHANGED
|
@@ -139,6 +139,7 @@ import {
|
|
|
139
139
|
isOlderVersion,
|
|
140
140
|
isPermissionMode,
|
|
141
141
|
isSlugAvailable,
|
|
142
|
+
isSourceLanguage,
|
|
142
143
|
isTranslatableLanguage,
|
|
143
144
|
isUnderLogicalRoot,
|
|
144
145
|
isUnknownWorkspaceHost,
|
|
@@ -280,7 +281,7 @@ import {
|
|
|
280
281
|
workspaceHostname,
|
|
281
282
|
workspaceSkillsDir,
|
|
282
283
|
writeSkillFile
|
|
283
|
-
} from "./chunk-
|
|
284
|
+
} from "./chunk-SBNBTJKW.js";
|
|
284
285
|
import {
|
|
285
286
|
checkPermissionAction,
|
|
286
287
|
createThreadAction,
|
|
@@ -2206,7 +2207,7 @@ function npmEnv(target) {
|
|
|
2206
2207
|
return nodeBin ? { ...process.env, PATH: `${nodeBin}:${process.env.PATH ?? ""}` } : process.env;
|
|
2207
2208
|
}
|
|
2208
2209
|
async function runUpgrade() {
|
|
2209
|
-
const current = "0.1.
|
|
2210
|
+
const current = "0.1.63";
|
|
2210
2211
|
console.log(`Current version: ${current}`);
|
|
2211
2212
|
console.log("Checking for updates...\n");
|
|
2212
2213
|
try {
|
|
@@ -4120,7 +4121,10 @@ function createAuthConfirmRouter() {
|
|
|
4120
4121
|
const back = `/auth/invite?token=${encodeURIComponent(token)}`;
|
|
4121
4122
|
const lookup = await findInvite(token);
|
|
4122
4123
|
if (lookup.state !== "valid") return c.redirect(back, 303);
|
|
4123
|
-
const
|
|
4124
|
+
const workspace = await getWorkspaceById(lookup.invite.workspaceId);
|
|
4125
|
+
const callback = new URL(callbackUrl(c));
|
|
4126
|
+
if (workspace) callback.searchParams.set("next", `/${encodeURIComponent(workspace.slug)}`);
|
|
4127
|
+
const link = await generateSignInLink(lookup.invite.email, callback.toString());
|
|
4124
4128
|
const src = new URL(link.actionLink);
|
|
4125
4129
|
const params = readParams({
|
|
4126
4130
|
token: src.searchParams.get("token") ?? void 0,
|
|
@@ -8424,6 +8428,31 @@ function createContinuousChatRouter() {
|
|
|
8424
8428
|
return app;
|
|
8425
8429
|
}
|
|
8426
8430
|
|
|
8431
|
+
// ../api/src/dashboard/reply-language.ts
|
|
8432
|
+
var UNDETERMINED = "und";
|
|
8433
|
+
var BACKFILL_CONCURRENCY = 8;
|
|
8434
|
+
async function detectAndStore(replyId, body) {
|
|
8435
|
+
const lang = await detectSourceLanguage("", body) ?? UNDETERMINED;
|
|
8436
|
+
const { error: error2 } = await getSupabaseClient().from("thread_replies").update({ lang }).eq("id", replyId);
|
|
8437
|
+
if (error2) console.error(`Reply language not stored (${replyId}):`, error2.message);
|
|
8438
|
+
return lang;
|
|
8439
|
+
}
|
|
8440
|
+
function recordReplyLanguage(replyId, body) {
|
|
8441
|
+
void detectAndStore(replyId, body).catch(
|
|
8442
|
+
(err) => console.error(`Reply language detection failed (${replyId}):`, err)
|
|
8443
|
+
);
|
|
8444
|
+
}
|
|
8445
|
+
async function backfillReplyLanguages(replies) {
|
|
8446
|
+
const unknown = replies.filter((r) => r.lang == null);
|
|
8447
|
+
for (let i = 0; i < unknown.length; i += BACKFILL_CONCURRENCY) {
|
|
8448
|
+
await Promise.all(
|
|
8449
|
+
unknown.slice(i, i + BACKFILL_CONCURRENCY).map(async (r) => {
|
|
8450
|
+
r.lang = await detectAndStore(r.id, r.body).catch(() => null);
|
|
8451
|
+
})
|
|
8452
|
+
);
|
|
8453
|
+
}
|
|
8454
|
+
}
|
|
8455
|
+
|
|
8427
8456
|
// ../api/src/dashboard/thread-translate.ts
|
|
8428
8457
|
import { createHash as createHash4 } from "crypto";
|
|
8429
8458
|
|
|
@@ -8527,6 +8556,7 @@ Rules:
|
|
|
8527
8556
|
- Translate meaning, not words. These are people talking, not prose to be polished. Keep the speaker's register: a terse message stays terse, a casual one stays casual, a rude one stays rude. Do not make anyone sound more formal, more complete, or more articulate than they wrote.
|
|
8528
8557
|
- A short reply ("\u597D\u554A", "same", "nope") is translated as the natural equivalent in ${languageName}, using the context to see what it is answering. Never expand it into a full sentence the speaker did not write.
|
|
8529
8558
|
- Keep the Markdown exactly as it is: same heading levels, list nesting, table shape, link and image syntax, blockquotes, and order. Do not add, merge, split, or reorder anything.
|
|
8559
|
+
- A line like \`[BUTTONS: A | B | C]\` holds quick-reply button labels: keep the \`[BUTTONS:\` marker, the \` | \` separators and the closing \`]\` exactly, and translate each label. Never put \`|\` or \`]\` inside a translated label.
|
|
8530
8560
|
- Do NOT translate: text inside fenced or inline code blocks, URLs, file paths, command names, or @mentions and /skill tokens. Leave them byte-for-byte identical.
|
|
8531
8561
|
- Keep established technical terms in English where a fluent speaker of ${languageName} would keep them in English rather than reaching for a translated coinage.
|
|
8532
8562
|
- Use the punctuation conventions of ${languageName}, including full-width punctuation for Chinese and Japanese. Use ordinary ASCII hyphens, never typographic or non-breaking hyphen variants.
|
|
@@ -8643,17 +8673,25 @@ async function translateCached(lang, scope, messages, contextFor) {
|
|
|
8643
8673
|
const missing = keyed.filter((m) => !cachedOf(m));
|
|
8644
8674
|
const fresh = /* @__PURE__ */ new Map();
|
|
8645
8675
|
const freshKey = (m) => `${m.kind}:${m.id}`;
|
|
8646
|
-
|
|
8676
|
+
for (const m of missing) {
|
|
8677
|
+
if (isSourceLanguage(lang, m.lang ?? null)) {
|
|
8678
|
+
fresh.set(freshKey(m), { id: m.id, body: m.body, passthrough: true });
|
|
8679
|
+
}
|
|
8680
|
+
}
|
|
8681
|
+
const toModel = missing.filter((m) => !fresh.has(freshKey(m)));
|
|
8682
|
+
if (toModel.length > 0) {
|
|
8647
8683
|
if (await getTranslationTokensToday(scope.workspaceId) >= DAILY_TOKEN_LIMIT) {
|
|
8648
8684
|
throw new TranslationLimitError();
|
|
8649
8685
|
}
|
|
8650
|
-
const batches = batchMessages(
|
|
8686
|
+
const batches = batchMessages(toModel);
|
|
8651
8687
|
const results = await Promise.all(
|
|
8652
8688
|
batches.map((batch) => translateBatch(batch, contextFor(batch[0]), lang, scope))
|
|
8653
8689
|
);
|
|
8654
8690
|
batches.forEach(
|
|
8655
8691
|
(batch, b) => batch.forEach((m, i) => fresh.set(freshKey(m), results[b][i]))
|
|
8656
8692
|
);
|
|
8693
|
+
}
|
|
8694
|
+
if (missing.length > 0) {
|
|
8657
8695
|
await Promise.all(
|
|
8658
8696
|
kinds.map(
|
|
8659
8697
|
(kind) => putThreadTranslations(
|
|
@@ -9323,7 +9361,7 @@ function createChatRouter(agent = {}) {
|
|
|
9323
9361
|
if (!isTranslatableLanguage2(lang)) return c.json({ error: "unsupported language" }, 400);
|
|
9324
9362
|
const [thread, replies] = await Promise.all([
|
|
9325
9363
|
getSupabaseClient().from("threads").select("channel_id").eq("id", id).single(),
|
|
9326
|
-
getSupabaseClient().from("thread_replies").select("id, author, body").eq("thread_id", id).is("archived_at", null).order("created_at", { ascending: true }).limit(TRANSLATABLE_REPLIES_MAX)
|
|
9364
|
+
getSupabaseClient().from("thread_replies").select("id, author, body, lang").eq("thread_id", id).is("archived_at", null).order("created_at", { ascending: true }).limit(TRANSLATABLE_REPLIES_MAX)
|
|
9327
9365
|
]);
|
|
9328
9366
|
if (thread.error) return c.json({ error: "not found" }, 404);
|
|
9329
9367
|
if (replies.error) return c.json({ error: replies.error.message }, 500);
|
|
@@ -9331,10 +9369,15 @@ function createChatRouter(agent = {}) {
|
|
|
9331
9369
|
if (!channelId || !(await globalChannelMeta(c)).has(channelId)) {
|
|
9332
9370
|
return c.json({ error: "not found" }, 404);
|
|
9333
9371
|
}
|
|
9334
|
-
const
|
|
9335
|
-
(r) => ({ id: r.id, author: r.author, body: slackMrkdwnToMarkdown(r.body) })
|
|
9336
|
-
);
|
|
9372
|
+
const rows = replies.data ?? [];
|
|
9337
9373
|
try {
|
|
9374
|
+
await backfillReplyLanguages(rows);
|
|
9375
|
+
const messages = rows.map((r) => ({
|
|
9376
|
+
id: r.id,
|
|
9377
|
+
author: r.author,
|
|
9378
|
+
body: slackMrkdwnToMarkdown(r.body),
|
|
9379
|
+
lang: r.lang
|
|
9380
|
+
}));
|
|
9338
9381
|
const glossary = (await getChannelGlossaries([channelId])).get(channelId)?.terms ?? [];
|
|
9339
9382
|
const scope = { workspaceId: c.get("auth").workspaceId, glossary };
|
|
9340
9383
|
return c.json({ lang, messages: await translateThread(lang, scope, messages) });
|
|
@@ -9562,6 +9605,7 @@ function createChatRouter(agent = {}) {
|
|
|
9562
9605
|
effort: effortFromRow(reply["effort"])
|
|
9563
9606
|
});
|
|
9564
9607
|
askSupport(c, thread.id, input2.author, input2.body);
|
|
9608
|
+
recordReplyLanguage(reply.id, input2.body);
|
|
9565
9609
|
tagStoredReply(c, {
|
|
9566
9610
|
threadId: thread.id,
|
|
9567
9611
|
replyId: reply.id,
|
|
@@ -9686,6 +9730,7 @@ function createChatRouter(agent = {}) {
|
|
|
9686
9730
|
effort: effortFromRow(data.effort)
|
|
9687
9731
|
});
|
|
9688
9732
|
askSupport(c, threadId, input2.author, input2.body);
|
|
9733
|
+
recordReplyLanguage(data.id, input2.body);
|
|
9689
9734
|
tagStoredReply(c, {
|
|
9690
9735
|
threadId,
|
|
9691
9736
|
replyId: data.id,
|
|
@@ -10329,7 +10374,7 @@ function createDomainRouter() {
|
|
|
10329
10374
|
import { Hono as Hono17 } from "hono";
|
|
10330
10375
|
var GROQ_TRANSCRIBE_URL = "https://api.groq.com/openai/v1/audio/transcriptions";
|
|
10331
10376
|
var MODEL2 = "whisper-large-v3-turbo";
|
|
10332
|
-
var MAX_AUDIO_BYTES =
|
|
10377
|
+
var MAX_AUDIO_BYTES = 25 * 1024 * 1024;
|
|
10333
10378
|
var MAX_PROMPT_CHARS = 400;
|
|
10334
10379
|
var NO_SPEECH_THRESHOLD = 0.6;
|
|
10335
10380
|
function createTranscribeRouter() {
|
|
@@ -10340,7 +10385,7 @@ function createTranscribeRouter() {
|
|
|
10340
10385
|
const body = await c.req.parseBody().catch(() => null);
|
|
10341
10386
|
const file = body?.["file"];
|
|
10342
10387
|
if (!(file instanceof File)) return c.json({ error: "missing file" }, 400);
|
|
10343
|
-
if (file.size > MAX_AUDIO_BYTES) return c.json({ error: "audio
|
|
10388
|
+
if (file.size > MAX_AUDIO_BYTES) return c.json({ error: "audio too large" }, 400);
|
|
10344
10389
|
const form = new FormData();
|
|
10345
10390
|
form.append("file", file, file.name || "segment.wav");
|
|
10346
10391
|
form.append("model", MODEL2);
|
|
@@ -12850,7 +12895,7 @@ function registerDataRoutes(api, agent = {}) {
|
|
|
12850
12895
|
const paused = await getAgentPaused(auth.workspaceId);
|
|
12851
12896
|
const cliVersion = agent.getHostCliVersion?.(getProfile()) ?? null;
|
|
12852
12897
|
const latest = cliVersion ? await latestCliVersion() : null;
|
|
12853
|
-
const outdated = !!(cliVersion && latest && isOlderVersion(cliVersion, latest));
|
|
12898
|
+
const outdated = !!(cliVersion && !cliVersion.endsWith("-dev") && latest && isOlderVersion(cliVersion, latest));
|
|
12854
12899
|
const selfUpgrade = !!cliVersion && !isOlderVersion(cliVersion, SELF_UPGRADE_MIN_VERSION);
|
|
12855
12900
|
return c.json({
|
|
12856
12901
|
online: !paused,
|
|
@@ -15124,7 +15169,12 @@ import { mkdirSync as mkdirSync10, openSync as openSync3 } from "fs";
|
|
|
15124
15169
|
import { join as join16 } from "path";
|
|
15125
15170
|
var running = false;
|
|
15126
15171
|
function startHostUpgrade() {
|
|
15127
|
-
if (running) return { started: false };
|
|
15172
|
+
if (running || CLI_VERSION?.endsWith("-dev")) return { started: false };
|
|
15173
|
+
if (process.env.FLY_MACHINE_ID) {
|
|
15174
|
+
running = true;
|
|
15175
|
+
setTimeout(() => process.exit(0), 1e3);
|
|
15176
|
+
return { started: true };
|
|
15177
|
+
}
|
|
15128
15178
|
mkdirSync10(paths.LOG_DIR, { recursive: true });
|
|
15129
15179
|
const log5 = openSync3(join16(paths.LOG_DIR, "host-upgrade.log"), "a");
|
|
15130
15180
|
const child = spawn5(process.execPath, [process.argv[1] ?? "", "upgrade"], {
|
|
@@ -16170,7 +16220,7 @@ async function main() {
|
|
|
16170
16220
|
break;
|
|
16171
16221
|
case "-v":
|
|
16172
16222
|
case "--version":
|
|
16173
|
-
printRaw("0.1.
|
|
16223
|
+
printRaw("0.1.63");
|
|
16174
16224
|
break;
|
|
16175
16225
|
case "-h":
|
|
16176
16226
|
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-SBNBTJKW.js";
|
|
7
7
|
import "./chunk-UZMHXV4D.js";
|
|
8
8
|
export {
|
|
9
9
|
startServer
|
package/package.json
CHANGED
package/system.capabilities.md
CHANGED
|
@@ -51,10 +51,11 @@ Some background tasks DO finish on their own: a build, a deploy, a test suite, a
|
|
|
51
51
|
Instead, bake the notification into the command itself so the task pushes the result back when it finishes. You already know the current channel ID and thread id from the `[context: ...]` header at the top of the message — use those literal values, and pick the right command for where you are: `flyspace chat wake --thread <THREAD_ID>` when the context says `chat channel=...` (a Workspace/dashboard thread — see Flyspace Workspace Tools below), or `flyspace slack post --channel <CHANNEL_ID> --thread <THREAD_TS>` when it's a Slack thread:
|
|
52
52
|
|
|
53
53
|
```bash
|
|
54
|
-
nohup bash -c 'if pnpm build; then S="✅ build 好了"; else S="❌ build
|
|
54
|
+
nohup bash -c 'export LANG=en_US.UTF-8; if pnpm build; then S="✅ build 好了"; else rc=$?; S="❌ build 失敗(exit ${rc}),看 /tmp/build.log"; fi; flyspace chat wake --thread <THREAD_ID> --about "pnpm build" --text "$S"' > /tmp/build.log 2>&1 & disown
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
- The task does not need to know Flyspace exists. YOU append the callback to the command you launch. The `--thread` value routes it back to this exact thread; multiple concurrent tasks each carry their own destination, so they never collide.
|
|
58
|
+
- Always brace shell variables inside `--text` (`${rc}`, `${dir}`, never `$rc`), and start the command with `export LANG=en_US.UTF-8`. Otherwise a variable followed directly by a CJK character (`$rc,`) swallows part of that character, expands to nothing and posts garbled `��` text.
|
|
58
59
|
- Report both success and failure — capture the exit status and post a different message for each. Include the log path on failure.
|
|
59
60
|
- `chat wake` (Workspace threads only) posts the result AND starts a new turn for you in this thread with the result as its prompt, resuming this session, so you can carry on with the next step (fix the failure, continue the plan) without the user coming back. Write the `--text` so your future self can act on it: what finished, pass or fail, and where the log is. Slack threads have no wake: `flyspace slack post` only posts. Wakes are capped at 5 in a row without a human message.
|
|
60
61
|
- Always pass `--about "<what it waits for>"` (a few words, in the user's language, no quotes inside): the thread shows it as "Waiting on: <about>" while the job runs. Every `chat wake` in the same job uses the same `--about`.
|