flyspace-cli 0.1.66 → 0.1.67

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/cli.js CHANGED
@@ -2,7 +2,6 @@
2
2
  import { createRequire as __flyspaceCreateRequire } from 'node:module';
3
3
  const require = __flyspaceCreateRequire(import.meta.url);
4
4
  import {
5
- AGENT_AUTHOR,
6
5
  AutomationManager,
7
6
  BOT_DM_KEY,
8
7
  BOT_LABEL,
@@ -10,11 +9,10 @@ import {
10
9
  BRANDING_DEFAULTS,
11
10
  BUILT_IN_OUTPUT_STYLES,
12
11
  CLI_VERSION,
13
- ChannelCwdError,
14
12
  ChatAgent,
15
13
  DEFAULT_TIMEZONE,
16
- DefaultChannelError,
17
14
  DocShareSlugTakenError,
15
+ GUIDE_RULES,
18
16
  HANDLE_PATTERN,
19
17
  HandleTakenError,
20
18
  InvalidTransferError,
@@ -31,14 +29,12 @@ import {
31
29
  UsageStore,
32
30
  agentViewer,
33
31
  allowedOrigins,
34
- auditChannelCwds,
35
32
  authorFor,
36
33
  blockToFallbackText,
37
34
  bodyTextFor,
38
35
  buildAuthorizeUrl,
39
36
  buildAutoTitle,
40
37
  cachedProfileConfig,
41
- canSeeChannel,
42
38
  canonicalLanguage,
43
39
  channelSkillsDir,
44
40
  claudeAuthFailed,
@@ -47,7 +43,6 @@ import {
47
43
  codexAuthAvailable,
48
44
  consumeOAuthState,
49
45
  corsForShell,
50
- createChannel,
51
46
  createDocShare,
52
47
  createDocsRouter,
53
48
  createFeatureFlagsRouter,
@@ -77,25 +72,18 @@ import {
77
72
  deleteWorkspace,
78
73
  deleteWorkspaceDomain,
79
74
  deriveConnectionSlug,
80
- deriveThreadTitle,
81
75
  detectSourceLanguage,
82
- displayCwd,
83
76
  displayNameFor,
84
77
  dropShareAudio,
85
78
  dropShareLangAudioKeys,
86
79
  effectiveModel,
87
- ensureAgentDmChannel,
88
- ensureGeneralChannel,
89
- ensureMemberDmChannel,
90
80
  ensureUsersCached,
91
81
  escalateToHuman,
92
82
  exchangeCode,
93
- expandPath,
94
83
  explainCost,
95
84
  extractCategories,
85
+ extractGuide,
96
86
  filterReadableDocsChannels,
97
- findChannel,
98
- findChannelById,
99
87
  findDocShareBySource,
100
88
  findOwningProfile,
101
89
  findSkillDetail,
@@ -105,7 +93,6 @@ import {
105
93
  getAllowGuestAccess,
106
94
  getChannelDocsMemberAccess,
107
95
  getChannelMemory,
108
- getChannelRegistry,
109
96
  getLocalCache,
110
97
  getMcpConnection,
111
98
  getMcpProvider,
@@ -113,7 +100,6 @@ import {
113
100
  getMembershipByUserId,
114
101
  getMemory,
115
102
  getOutputStyleDefault,
116
- getProfileChannelRegistry,
117
103
  getWorkspaceAutoContinueLimit,
118
104
  getWorkspaceBilling,
119
105
  getWorkspaceBranding,
@@ -132,20 +118,15 @@ import {
132
118
  installUsageRecording,
133
119
  invalidateAuthContextCache,
134
120
  isAllowedModel,
135
- isCwdUsable,
136
121
  isDevHost,
137
122
  isDocsAccess,
138
123
  isFeatureEnabled,
139
- isHumanAuthor,
140
124
  isLockedPlan,
141
- isLogicalCwd,
142
125
  isMemoryType,
143
126
  isOlderVersion,
144
- isPermissionMode,
145
127
  isSlugAvailable,
146
128
  isSourceLanguage,
147
129
  isTranslatableLanguage,
148
- isUnderLogicalRoot,
149
130
  isUnknownWorkspaceHost,
150
131
  isUuid,
151
132
  isValidSkillName,
@@ -184,7 +165,6 @@ import {
184
165
  loadWorkspacePrompt,
185
166
  localDefaults,
186
167
  logSupportAction,
187
- markChannelGreeted,
188
168
  markInviteResent,
189
169
  markMemoryUsed,
190
170
  markWorkspaceGreeted,
@@ -194,7 +174,6 @@ import {
194
174
  onboardingPending,
195
175
  pinnedClaudeConfigDir,
196
176
  platformAdminEmails,
197
- postToDashboardChannel,
198
177
  profileClaudeConfigDir,
199
178
  profileEnv,
200
179
  profileFromHost,
@@ -207,7 +186,6 @@ import {
207
186
  recentRunsForWorkspace,
208
187
  refreshAutomationRegistry,
209
188
  refreshCache,
210
- refreshChannelRegistry,
211
189
  refreshUserCache,
212
190
  removeChannelMember,
213
191
  renderAppIcon,
@@ -218,8 +196,6 @@ import {
218
196
  resolveAuthContext,
219
197
  resolveChannelConfig,
220
198
  resolveChannelId,
221
- resolveCwd,
222
- resolveDashboardChannelId,
223
199
  resolveDocsAccess,
224
200
  resolveRateCard,
225
201
  resolveUserId,
@@ -261,19 +237,15 @@ import {
261
237
  setWorkspaceStripeSubscription,
262
238
  slackMrkdwnToMarkdown,
263
239
  startAutomationRegistryPolling,
264
- startChannelRegistryPolling,
265
240
  startServer,
266
241
  suggestChannelField,
267
- syncPostToDashboard,
268
242
  syncSlackAvatars,
269
243
  syncSupportReply,
270
244
  transferWorkspaceAdmin,
271
245
  trustedHost,
272
246
  tsToIso,
273
247
  undoMemoryEvent,
274
- updateChannelById,
275
248
  updateChannelMemory,
276
- updateChannelsMcpConnections,
277
249
  updateDocShareFeatures,
278
250
  updateDocShareSnapshot,
279
251
  updateMcpConnectionSettings,
@@ -290,37 +262,49 @@ import {
290
262
  useDirectSupabase,
291
263
  useLocalCache,
292
264
  validateMemoryInput,
293
- warnOnBrokenChannelCwds,
294
265
  watchDocs,
295
266
  workspaceHostname,
296
267
  workspaceSkillsDir,
297
268
  writeSkillFile
298
- } from "./chunk-DVHYIWIW.js";
269
+ } from "./chunk-GT2SOVPK.js";
299
270
  import {
271
+ CALL_TIMEOUT_MS,
272
+ DEFAULT_DATA_API_PORT,
273
+ DOCS_CALL_TIMEOUT_MS,
274
+ HEARTBEAT_TIMEOUT_MS,
275
+ HOST_SOCKET_PATH,
276
+ LOCAL_RELAY_PATH,
277
+ MEMORY_EXTRACTION_TIMEOUT_MS,
278
+ RELAYED_METHODS,
300
279
  checkPermissionAction,
280
+ createChannelAction,
301
281
  createThreadAction,
302
- firstReplyBody,
303
- getThread,
282
+ encodeWireMessage,
304
283
  listAutoUpdateSharesAction,
305
- listChannels,
306
284
  listChannelsAction,
307
- listThreads,
308
- moveThread,
309
285
  moveThreadAction,
310
286
  openDocAction,
287
+ parseWireMessage,
311
288
  postReplyAction,
312
289
  readThreadAction,
290
+ renameChannelAction,
313
291
  requestPermissionAction,
314
292
  resolveChannel,
293
+ runChatCmd,
315
294
  runDocsCmd,
316
295
  searchThreadsAction,
296
+ setChannelSlackAction,
317
297
  setUiZoomAction,
318
298
  shareDocAction
319
- } from "./chunk-ODQS4YBM.js";
299
+ } from "./chunk-KP64MCSF.js";
320
300
  import {
301
+ AGENT_AUTHOR,
321
302
  AuthApiError,
303
+ CHANNEL_DESCRIPTION_MAX,
304
+ ChannelCwdError,
322
305
  DEFAULT_API_URL,
323
306
  DEFAULT_PROFILE,
307
+ DefaultChannelError,
324
308
  LOCAL_ACTION_PATH,
325
309
  LOCAL_DB_PATH,
326
310
  SCRATCH_PREFIX,
@@ -328,17 +312,30 @@ import {
328
312
  SessionStore,
329
313
  acquireHostLock,
330
314
  apiUrl,
315
+ auditChannelCwds,
331
316
  boundWorkspaces,
317
+ canSeeChannel,
332
318
  clearLocalAuth,
319
+ createChannel,
333
320
  createHostDbClient,
334
321
  credentialsPath,
335
322
  databaseReachable,
323
+ deriveThreadTitle,
336
324
  deviceKeyPath,
325
+ displayCwd,
326
+ ensureAgentDmChannel,
337
327
  ensureDeviceKey,
338
328
  ensureDirs,
329
+ ensureGeneralChannel,
330
+ ensureMemberDmChannel,
331
+ expandPath,
339
332
  fetchWhoAmI,
333
+ findChannel,
334
+ findChannelById,
340
335
  getAccessToken,
336
+ getChannelRegistry,
341
337
  getProfile,
338
+ getProfileChannelRegistry,
342
339
  getR2Bucket,
343
340
  getR2Client,
344
341
  getSupabaseClient,
@@ -348,27 +345,42 @@ import {
348
345
  handlePluginSvgResult,
349
346
  handleScratchImageResult,
350
347
  handleShouldRespondResult,
348
+ isCwdUsable,
351
349
  isEffort,
350
+ isHumanAuthor,
351
+ isLogicalCwd,
352
+ isPermissionMode,
353
+ isUnderLogicalRoot,
352
354
  loadConfig,
353
355
  loadCredentials,
354
356
  loadEnvFiles,
357
+ markChannelGreeted,
358
+ normaliseChannelDescription,
355
359
  paths,
356
360
  pollDeviceToken,
357
361
  publishHostEndpoint,
358
362
  readHostEndpoint,
363
+ refreshChannelRegistry,
359
364
  requestAction,
360
365
  requestDeviceCode,
361
366
  requestHostDb,
362
367
  requireSlackBotToken,
368
+ resolveCwd,
369
+ resolveDashboardChannelId,
363
370
  revokeDevice,
364
371
  runWithProfile,
365
372
  saveCredentials,
366
373
  setHostDbSender,
367
374
  setSupabaseClient,
368
375
  slackConfigured,
376
+ startChannelRegistryPolling,
369
377
  sumR2PrefixBytes,
370
- useHostDbWithoutCredentials
371
- } from "./chunk-KPZOOR73.js";
378
+ syncPostToDashboard,
379
+ updateChannelById,
380
+ updateChannelsMcpConnections,
381
+ useHostDbWithoutCredentials,
382
+ warnOnBrokenChannelCwds
383
+ } from "./chunk-JH66T2SW.js";
372
384
 
373
385
  // ../core/src/logger.ts
374
386
  var ALREADY_STAMPED = /^\[\d{4}-\d{2}-\d{2}T/;
@@ -707,10 +719,10 @@ function restartHostService() {
707
719
  }
708
720
  return false;
709
721
  }
710
- function serviceActive(label2, unit) {
722
+ function serviceActive(label, unit) {
711
723
  try {
712
724
  if (platform() === "darwin") {
713
- const out = execSync(`launchctl print gui/${process.getuid?.()}/${label2}`, { encoding: "utf-8", stdio: "pipe" });
725
+ const out = execSync(`launchctl print gui/${process.getuid?.()}/${label}`, { encoding: "utf-8", stdio: "pipe" });
714
726
  return /^\s*state = running$/m.test(out);
715
727
  }
716
728
  if (platform() === "linux") {
@@ -2231,7 +2243,7 @@ function npmEnv(target) {
2231
2243
  return nodeBin ? { ...process.env, PATH: `${nodeBin}:${process.env.PATH ?? ""}` } : process.env;
2232
2244
  }
2233
2245
  async function runUpgrade() {
2234
- const current = "0.1.66";
2246
+ const current = "0.1.67";
2235
2247
  console.log(`Current version: ${current}`);
2236
2248
  console.log("Checking for updates...\n");
2237
2249
  try {
@@ -2384,10 +2396,10 @@ function printList(manager) {
2384
2396
  }
2385
2397
  for (const channelRef2 of [...groups.keys()].sort()) {
2386
2398
  const channel = findChannel(channelRef2);
2387
- const label2 = channel ? `${channelRef2} (${channel.name})` : channelRef2;
2399
+ const label = channel ? `${channelRef2} (${channel.name})` : channelRef2;
2388
2400
  const cwd = channel?.cwd ? ` \u2014 cwd: ${channel.cwd}` : "";
2389
2401
  console.log(`
2390
- ${label2}${cwd}`);
2402
+ ${label}${cwd}`);
2391
2403
  for (const line of groups.get(channelRef2)) console.log(line);
2392
2404
  }
2393
2405
  console.log();
@@ -2647,9 +2659,18 @@ async function runAutomationCmd(args) {
2647
2659
  }
2648
2660
  await handleEdit(manager, args[1], args.slice(2));
2649
2661
  break;
2650
- case "add":
2651
- await handleAdd(manager, args.slice(1));
2662
+ case "add": {
2663
+ const addArgs = args.slice(1);
2664
+ const ref = getArg(addArgs, "--channel") ?? getArg(addArgs, "--target-channel");
2665
+ const owner = findChannel(ref)?.profile;
2666
+ if (owner && owner !== getProfile()) {
2667
+ console.log(`Channel ${ref} belongs to workspace "${owner}"; adding the automation there.`);
2668
+ await runWithProfile(owner, () => handleAdd(new AutomationManager(), addArgs));
2669
+ } else {
2670
+ await handleAdd(manager, addArgs);
2671
+ }
2652
2672
  break;
2673
+ }
2653
2674
  case "remove":
2654
2675
  if (!args[1]) {
2655
2676
  console.error("Usage: flyspace automation remove <name>");
@@ -3460,8 +3481,8 @@ function callbackUrl(c) {
3460
3481
  function workspaceOrigin(c, slug) {
3461
3482
  const proto = c.req.header("x-forwarded-proto") ?? "http";
3462
3483
  const host = trustedHost(c) ?? "";
3463
- const [label2 = "", ...rest] = host.split(".");
3464
- const prefix = label2.startsWith("dev-") ? "dev-" : "";
3484
+ const [label = "", ...rest] = host.split(".");
3485
+ const prefix = label.startsWith("dev-") ? "dev-" : "";
3465
3486
  return `${proto}://${[prefix + slug, ...rest].join(".")}`;
3466
3487
  }
3467
3488
 
@@ -4014,8 +4035,8 @@ async function findInvite(token) {
4014
4035
  return lookupInviteByToken(token);
4015
4036
  }
4016
4037
  var PASSWORD_MIN = 8;
4017
- function passwordField(name, label2, autocomplete, display, invalid, value = "") {
4018
- return `<label for="${name}" class="fs-ink" style="display:block;font:600 13px/1.4 ${display};color:${DARK.ink};margin-bottom:6px;">${label2}</label><div style="position:relative;margin-bottom:16px;"><input id="${name}" name="${name}" type="password" required${name === "password" ? " autofocus" : ""} minlength="${PASSWORD_MIN}" autocomplete="${autocomplete}" value="${escapeHtml(value)}" style="display:block;box-sizing:border-box;width:100%;border:1px solid ${invalid ? "#d33" : DARK.line};border-radius:8px;background:transparent;padding:12px 44px 12px 12px;font:500 15px/1.2 ${display};color:inherit;outline:0;"><button type="button" data-toggle-password="${name}" aria-label="Show password" aria-pressed="false" class="fs-dim" style="position:absolute;top:0;right:0;height:100%;width:44px;display:flex;align-items:center;justify-content:center;border:0;background:transparent;color:${DARK.dim};cursor:pointer;"><svg data-eye viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/></svg><svg data-eye-off viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" style="display:none"><path d="M17.94 17.94A10.9 10.9 0 0 1 12 19c-6.5 0-10-7-10-7a18.5 18.5 0 0 1 5.06-5.94M9.9 4.24A10.9 10.9 0 0 1 12 5c6.5 0 10 7 10 7a18.5 18.5 0 0 1-2.16 3.19M1 1l22 22"/><path d="M14.12 14.12a3 3 0 1 1-4.24-4.24"/></svg></button></div>`;
4038
+ function passwordField(name, label, autocomplete, display, invalid, value = "") {
4039
+ return `<label for="${name}" class="fs-ink" style="display:block;font:600 13px/1.4 ${display};color:${DARK.ink};margin-bottom:6px;">${label}</label><div style="position:relative;margin-bottom:16px;"><input id="${name}" name="${name}" type="password" required${name === "password" ? " autofocus" : ""} minlength="${PASSWORD_MIN}" autocomplete="${autocomplete}" value="${escapeHtml(value)}" style="display:block;box-sizing:border-box;width:100%;border:1px solid ${invalid ? "#d33" : DARK.line};border-radius:8px;background:transparent;padding:12px 44px 12px 12px;font:500 15px/1.2 ${display};color:inherit;outline:0;"><button type="button" data-toggle-password="${name}" aria-label="Show password" aria-pressed="false" class="fs-dim" style="position:absolute;top:0;right:0;height:100%;width:44px;display:flex;align-items:center;justify-content:center;border:0;background:transparent;color:${DARK.dim};cursor:pointer;"><svg data-eye viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z"/><circle cx="12" cy="12" r="3"/></svg><svg data-eye-off viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" style="display:none"><path d="M17.94 17.94A10.9 10.9 0 0 1 12 19c-6.5 0-10-7-10-7a18.5 18.5 0 0 1 5.06-5.94M9.9 4.24A10.9 10.9 0 0 1 12 5c6.5 0 10 7 10 7a18.5 18.5 0 0 1-2.16 3.19M1 1l22 22"/><path d="M14.12 14.12a3 3 0 1 1-4.24-4.24"/></svg></button></div>`;
4019
4040
  }
4020
4041
  var CLAUDE_PATH = "m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z";
4021
4042
  var CODEX_PATH = "M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z";
@@ -4169,10 +4190,10 @@ function createAuthConfirmRouter() {
4169
4190
  const target = workspaceOrigin(c, workspace?.slug ?? "app");
4170
4191
  const href = escapeHtml(target);
4171
4192
  const branding = workspace ? await loadWorkspaceBranding(workspace.slug) : null;
4172
- const label2 = escapeHtml(branding?.displayName?.trim() || workspace?.slug || "Flyspace");
4193
+ const label = escapeHtml(branding?.displayName?.trim() || workspace?.slug || "Flyspace");
4173
4194
  return c.html(
4174
4195
  page(
4175
- masthead2("Flyspace", FLYSPACE_MARK, display, true) + `<div class="fs-ink" style="font:600 20px/1.3 ${display};color:${DARK.ink};margin-bottom:10px;">This invitation has already been used</div><p class="fs-muted" style="margin:0;font:400 14px/1.6 ${display};color:${DARK.muted};">Your workspace has been created.</p><p class="fs-muted" style="margin:10px 0 0;font:400 14px/1.6 ${display};color:${DARK.muted};">Taking you to <a href="${href}" style="color:inherit;">${label2}</a> in <span id="n">5</span> seconds.</p><script>(()=>{let n=5;const e=document.getElementById('n');const t=setInterval(()=>{n--;e.textContent=String(n);if(n<=0){clearInterval(t);location.replace(${JSON.stringify(target)})}},1000)})()</script>`,
4196
+ masthead2("Flyspace", FLYSPACE_MARK, display, true) + `<div class="fs-ink" style="font:600 20px/1.3 ${display};color:${DARK.ink};margin-bottom:10px;">This invitation has already been used</div><p class="fs-muted" style="margin:0;font:400 14px/1.6 ${display};color:${DARK.muted};">Your workspace has been created.</p><p class="fs-muted" style="margin:10px 0 0;font:400 14px/1.6 ${display};color:${DARK.muted};">Taking you to <a href="${href}" style="color:inherit;">${label}</a> in <span id="n">5</span> seconds.</p><script>(()=>{let n=5;const e=document.getElementById('n');const t=setInterval(()=>{n--;e.textContent=String(n);if(n<=0){clearInterval(t);location.replace(${JSON.stringify(target)})}},1000)})()</script>`,
4176
4197
  void 0,
4177
4198
  void 0,
4178
4199
  true
@@ -4786,7 +4807,7 @@ function createClient3() {
4786
4807
  const config = loadConfig();
4787
4808
  return new WebClient3(requireSlackBotToken(config));
4788
4809
  }
4789
- async function listChannels2(client2, refresh) {
4810
+ async function listChannels(client2, refresh) {
4790
4811
  if (refresh) await refreshCache(client2);
4791
4812
  let channels = listMemberChannels();
4792
4813
  if (channels.length === 0) {
@@ -4928,9 +4949,9 @@ async function threadReplies(client2, nameOrId, ts2) {
4928
4949
  }) : "?";
4929
4950
  const author = msg.user ? displayNameFor(msg.user) : msg.bot_id ?? "unknown";
4930
4951
  const text = renderText(msg.text ?? "").replace(/\n/g, "\n ");
4931
- const label2 = i === 0 ? "[parent]" : `[reply ${i}]`;
4952
+ const label = i === 0 ? "[parent]" : `[reply ${i}]`;
4932
4953
  console.log(
4933
- ` ${label2} [${time}] ${author} (${msg.user ?? msg.bot_id ?? "?"}, ts: ${msg.ts}):`
4954
+ ` ${label} [${time}] ${author} (${msg.user ?? msg.bot_id ?? "?"}, ts: ${msg.ts}):`
4934
4955
  );
4935
4956
  console.log(` ${text}`);
4936
4957
  console.log();
@@ -5615,7 +5636,7 @@ async function runSlackCmd(args) {
5615
5636
  }
5616
5637
  case "channels": {
5617
5638
  const client2 = createClient3();
5618
- await listChannels2(client2, args.includes("--refresh"));
5639
+ await listChannels(client2, args.includes("--refresh"));
5619
5640
  break;
5620
5641
  }
5621
5642
  case "users": {
@@ -5692,234 +5713,6 @@ async function runSlackCmd(args) {
5692
5713
  }
5693
5714
  }
5694
5715
 
5695
- // src/store/thread-move.ts
5696
- async function moveThreadFully(threadId, toChannelId) {
5697
- const thread = await getThread(threadId);
5698
- if (!thread) throw new Error(`No thread with id ${threadId}.`);
5699
- if (thread.channelId === toChannelId) return "unchanged";
5700
- const channels = await listChannels();
5701
- const to = channels.find((c) => c.id === toChannelId);
5702
- if (!to) throw new Error(`No channel with id ${toChannelId}.`);
5703
- const from = channels.find((c) => c.id === thread.channelId);
5704
- const store = new SessionStore(paths.DB_FILE);
5705
- try {
5706
- await moveThread(thread.id, to.id);
5707
- const counts = store.moveThread(`chat:${thread.channelId}`, `chat:${to.id}`, thread.id);
5708
- return { from, to, ...counts, cwdChanged: !!from && from.cwd !== to.cwd };
5709
- } finally {
5710
- store.close();
5711
- }
5712
- }
5713
-
5714
- // ../core/src/bridge-protocol.ts
5715
- var HOST_SOCKET_PATH = "/internal/host-socket";
5716
- var DEFAULT_DATA_API_PORT = 4757;
5717
- var CALL_TIMEOUT_MS = 15e3;
5718
- var DOCS_CALL_TIMEOUT_MS = 12e4;
5719
- var MEMORY_EXTRACTION_TIMEOUT_MS = 165e3;
5720
- var HEARTBEAT_INTERVAL_MS = 15e3;
5721
- var HEARTBEAT_TIMEOUT_MS = HEARTBEAT_INTERVAL_MS * 2.5;
5722
- var LOCAL_RELAY_PATH = "/internal/agent-call";
5723
- var RELAYED_METHODS = [
5724
- "onChatMessage",
5725
- "isAgentThinking",
5726
- "getAgentActivities",
5727
- "getBackgroundTasks",
5728
- "cancelAgentRun",
5729
- "regenerateAgentRun",
5730
- "listAgentRuns",
5731
- "wakeAgentRun"
5732
- ];
5733
- function encodeWireMessage(msg) {
5734
- return JSON.stringify(msg);
5735
- }
5736
- function parseWireMessage(raw) {
5737
- try {
5738
- return JSON.parse(String(raw));
5739
- } catch {
5740
- return null;
5741
- }
5742
- }
5743
-
5744
- // src/commands/chat.ts
5745
- var USAGE4 = `
5746
- Usage: flyspace chat <subcommand> [options]
5747
-
5748
- Subcommands:
5749
- channels [--profile-name <p>] List dashboard chat channels (id, name, cwd)
5750
- threads <channel> [--limit <n>] List recent threads in a channel (default: 20)
5751
- move <thread-id> --to <channel> Move a thread to another channel
5752
- post --channel <c> --text <t> Start a new thread, or reply with --thread
5753
- [--thread <id>] [--title <t>]
5754
- wake --thread <id> --text <t> Post a background task's result AND start a
5755
- new agent turn on the thread to act on it
5756
- [--about <t>] What the job waits for (shown in the thread)
5757
-
5758
- Options:
5759
- --to <name-or-id> Destination channel for "move"
5760
- --limit <n> Max threads to list (default: 20)
5761
- --profile-name <p> Only channels belonging to this profile
5762
- --dry-run Show what "move" would do, change nothing
5763
- --channel <name-or-id> Target channel for "post"
5764
- --thread <id> Reply to this thread instead of starting one
5765
- --text <t> Message body for "post"
5766
- --title <t> Thread title for "post" (new threads only)
5767
- `;
5768
- function getArg3(args, flag) {
5769
- const idx = args.indexOf(flag);
5770
- return idx !== -1 && idx + 1 < args.length ? args[idx + 1] : void 0;
5771
- }
5772
- function label(thread, opener) {
5773
- const text = thread.title ?? opener ?? "(empty)";
5774
- const oneLine = text.replace(/\s+/g, " ").trim();
5775
- return oneLine.length > 60 ? `${oneLine.slice(0, 59)}\u2026` : oneLine;
5776
- }
5777
- async function runChannels(args) {
5778
- const channels = await listChannels(getArg3(args, "--profile-name"));
5779
- if (channels.length === 0) {
5780
- console.log("No chat channels found.");
5781
- return;
5782
- }
5783
- const width = Math.max(...channels.map((c) => c.name.length));
5784
- for (const channel of channels) {
5785
- console.log(`${channel.id} ${channel.name.padEnd(width)} ${channel.profile} ${channel.cwd}`);
5786
- }
5787
- }
5788
- async function runThreads(args) {
5789
- const nameOrId = args[0];
5790
- if (!nameOrId) throw new Error("Usage: flyspace chat threads <channel> [--limit <n>]");
5791
- const channel = await resolveChannel(nameOrId, getArg3(args, "--profile-name"));
5792
- const limit = Number(getArg3(args, "--limit") ?? 20);
5793
- const threads = await listThreads(channel.id, limit);
5794
- if (threads.length === 0) {
5795
- console.log(`No threads in ${channel.name}.`);
5796
- return;
5797
- }
5798
- console.log(`${channel.name} (${channel.id}):`);
5799
- for (const thread of threads) {
5800
- const opener = thread.title ? void 0 : await firstReplyBody(thread.id);
5801
- const when = thread.updatedAt.slice(0, 16).replace("T", " ");
5802
- const replies = String(thread.replies).padStart(3);
5803
- console.log(` ${thread.id} ${when} ${replies} replies ${label(thread, opener)}`);
5804
- }
5805
- }
5806
- async function runMove(args) {
5807
- const threadId = args[0];
5808
- const to = getArg3(args, "--to");
5809
- if (!threadId || !to) {
5810
- throw new Error("Usage: flyspace chat move <thread-id> --to <channel> [--dry-run]");
5811
- }
5812
- const thread = await getThread(threadId);
5813
- if (!thread) throw new Error(`No thread with id ${threadId}.`);
5814
- const destination = await resolveChannel(to, getArg3(args, "--profile-name"));
5815
- if (thread.channelId === destination.id) {
5816
- console.log(`Thread is already in ${destination.name} \u2014 nothing to do.`);
5817
- return;
5818
- }
5819
- const channels = await listChannels();
5820
- const source = channels.find((c) => c.id === thread.channelId);
5821
- const opener = thread.title ? void 0 : await firstReplyBody(thread.id);
5822
- const from = source ? `${source.name} (${source.id})` : thread.channelId;
5823
- console.log(`Thread: ${label(thread, opener)}`);
5824
- console.log(` ${thread.replies} replies, last active ${thread.updatedAt.slice(0, 16)}`);
5825
- console.log(`From: ${from}`);
5826
- console.log(`To: ${destination.name} (${destination.id})`);
5827
- if (args.includes("--dry-run")) {
5828
- console.log("\n--dry-run: nothing changed.");
5829
- return;
5830
- }
5831
- const moved = await moveThreadFully(thread.id, destination.id);
5832
- if (moved === "unchanged") return;
5833
- console.log(
5834
- `
5835
- Moved. Re-keyed ${moved.sessions} session(s), ${moved.modelOverrides} model override(s), ${moved.effortOverrides} effort override(s).`
5836
- );
5837
- if (moved.cwdChanged && source) {
5838
- console.log(
5839
- `
5840
- Note: the channels have different working directories.
5841
- ${source.cwd}
5842
- ${destination.cwd}
5843
- Files this thread created live in the old one, move them yourself if the
5844
- thread still refers to them.`
5845
- );
5846
- }
5847
- console.log("Reload the dashboard to see it in its new home.");
5848
- }
5849
- async function runPost(args) {
5850
- const channelArg = getArg3(args, "--channel");
5851
- const threadArg = getArg3(args, "--thread");
5852
- const text = getArg3(args, "--text");
5853
- const title = getArg3(args, "--title");
5854
- if (!text || !channelArg && !threadArg) {
5855
- throw new Error(
5856
- "Usage: flyspace chat post --channel <c> --text <t> [--thread <id>] [--title <t>]"
5857
- );
5858
- }
5859
- const channelId = threadArg ? void 0 : (await resolveChannel(channelArg, getArg3(args, "--profile-name"))).id;
5860
- const { threadId } = await postToDashboardChannel({
5861
- channelId,
5862
- threadId: threadArg,
5863
- text,
5864
- title
5865
- });
5866
- console.log(threadArg ? `Replied in thread ${threadId}.` : `Posted new thread ${threadId}.`);
5867
- }
5868
- async function runWake(args) {
5869
- const threadId = getArg3(args, "--thread");
5870
- const text = getArg3(args, "--text");
5871
- if (!threadId || !text) throw new Error("Usage: flyspace chat wake --thread <id> --text <t>");
5872
- const { replyId } = await postToDashboardChannel({ threadId, text });
5873
- const endpoint = readHostEndpoint();
5874
- if (!endpoint) {
5875
- console.log(`Replied in thread ${threadId}, but no Host is running to wake the agent.`);
5876
- return;
5877
- }
5878
- const res = await fetch(`http://127.0.0.1:${endpoint.port}${LOCAL_RELAY_PATH}`, {
5879
- method: "POST",
5880
- headers: { authorization: `Bearer ${endpoint.token}`, "content-type": "application/json" },
5881
- body: JSON.stringify({ method: "wakeAgentRun", profile: getProfile(), args: [threadId, replyId, text] }),
5882
- signal: AbortSignal.timeout(3e4)
5883
- });
5884
- if (!res.ok) throw new Error(`Replied in thread ${threadId}, but the Host answered ${res.status}`);
5885
- const { value } = await res.json();
5886
- console.log(
5887
- value ? `Replied in thread ${threadId} and woke the agent.` : `Replied in thread ${threadId}; wake refused (too many wakes in a row without a human message).`
5888
- );
5889
- }
5890
- async function runChatCmd(args) {
5891
- loadEnvFiles();
5892
- useHostDbWithoutCredentials();
5893
- const subcommand = args[0];
5894
- const rest = args.slice(1);
5895
- switch (subcommand) {
5896
- case "channels":
5897
- await runChannels(rest);
5898
- break;
5899
- case "threads":
5900
- await runThreads(rest);
5901
- break;
5902
- case "move":
5903
- await runMove(rest);
5904
- break;
5905
- case "post":
5906
- await runPost(rest);
5907
- break;
5908
- case "wake":
5909
- await runWake(rest);
5910
- break;
5911
- case "-h":
5912
- case "--help":
5913
- case void 0:
5914
- console.log(USAGE4);
5915
- break;
5916
- default:
5917
- console.error(`Unknown subcommand: ${subcommand}`);
5918
- console.log(USAGE4);
5919
- process.exit(1);
5920
- }
5921
- }
5922
-
5923
5716
  // src/commands/memory.ts
5924
5717
  import { readFileSync as readFileSync13 } from "fs";
5925
5718
 
@@ -6000,7 +5793,7 @@ async function importClaudeMemories(dir, channelId, opts = {}) {
6000
5793
  }
6001
5794
 
6002
5795
  // src/commands/memory.ts
6003
- var USAGE5 = `
5796
+ var USAGE4 = `
6004
5797
  Usage: flyspace memory <subcommand> --channel <name-or-id> [options]
6005
5798
 
6006
5799
  A channel's persistent agent memory (docs/features/workspace-memory.md).
@@ -6027,7 +5820,7 @@ var USAGE5 = `
6027
5820
 
6028
5821
  Types: ${MEMORY_TYPES.join(", ")}
6029
5822
  `;
6030
- function getArg4(args, flag) {
5823
+ function getArg3(args, flag) {
6031
5824
  const idx = args.indexOf(flag);
6032
5825
  return idx !== -1 && idx + 1 < args.length ? args[idx + 1] : void 0;
6033
5826
  }
@@ -6048,12 +5841,12 @@ async function runMemoryCmd(args) {
6048
5841
  const subcommand = args[0];
6049
5842
  const rest = args.slice(1);
6050
5843
  if (!subcommand || subcommand === "-h" || subcommand === "--help") {
6051
- console.log(USAGE5);
5844
+ console.log(USAGE4);
6052
5845
  return;
6053
5846
  }
6054
- const channelArg = getArg4(rest, "--channel");
5847
+ const channelArg = getArg3(rest, "--channel");
6055
5848
  if (!channelArg) throw new Error("--channel <name-or-id> is required");
6056
- const channel = await resolveChannel(channelArg, getArg4(rest, "--profile-name"));
5849
+ const channel = await resolveChannel(channelArg, getArg3(rest, "--profile-name"));
6057
5850
  const words = positionals(rest);
6058
5851
  const target = await resolveTarget(rest, channel);
6059
5852
  const where = target.scope === "channel" ? channel.name : `${target.scope} memory`;
@@ -6086,10 +5879,10 @@ ${memory.body}`);
6086
5879
  break;
6087
5880
  }
6088
5881
  case "save": {
6089
- const name = getArg4(rest, "--name");
6090
- const type = getArg4(rest, "--type");
6091
- const description = getArg4(rest, "--description");
6092
- const bodyArg = getArg4(rest, "--body");
5882
+ const name = getArg3(rest, "--name");
5883
+ const type = getArg3(rest, "--type");
5884
+ const description = getArg3(rest, "--description");
5885
+ const bodyArg = getArg3(rest, "--body");
6093
5886
  if (!name || !type || !description || bodyArg === void 0) {
6094
5887
  throw new Error(
6095
5888
  "Usage: flyspace memory save --channel <c> --name <slug> --type <type> --description <one line> --body <text | -> [--thread <id>]"
@@ -6097,7 +5890,7 @@ ${memory.body}`);
6097
5890
  }
6098
5891
  if (!isMemoryType(type)) throw new Error(`--type must be one of ${MEMORY_TYPES.join(", ")}`);
6099
5892
  const body = bodyArg === "-" ? readFileSync13(0, "utf-8") : bodyArg;
6100
- const thread = getArg4(rest, "--thread");
5893
+ const thread = getArg3(rest, "--thread");
6101
5894
  const { created, changed } = await saveMemory(
6102
5895
  target,
6103
5896
  {
@@ -6117,14 +5910,14 @@ ${memory.body}`);
6117
5910
  case "delete": {
6118
5911
  const ref = words[0];
6119
5912
  if (!ref) throw new Error("Usage: flyspace memory delete --channel <c> <name-or-id>");
6120
- const deleted = await deleteMemory(target, ref, "agent", getArg4(rest, "--thread"));
5913
+ const deleted = await deleteMemory(target, ref, "agent", getArg3(rest, "--thread"));
6121
5914
  if (!deleted) throw new Error(`No memory ${ref} in ${where}.`);
6122
5915
  console.log(`Deleted memory ${ref}.`);
6123
5916
  break;
6124
5917
  }
6125
5918
  case "import": {
6126
5919
  if (target.scope !== "channel") throw new Error("import only fills a channel memory");
6127
- const dir = getArg4(rest, "--dir") ?? claudeMemoryDir(channel.cwd, profileClaudeConfigDirFor(channel.profile));
5920
+ const dir = getArg3(rest, "--dir") ?? claudeMemoryDir(channel.cwd, profileClaudeConfigDirFor(channel.profile));
6128
5921
  const dryRun = rest.includes("--dry-run");
6129
5922
  const results = await importClaudeMemories(dir, channel.id, { dryRun });
6130
5923
  for (const r of results) {
@@ -6139,12 +5932,12 @@ ${memory.body}`);
6139
5932
  }
6140
5933
  default:
6141
5934
  console.error(`Unknown subcommand: ${subcommand}`);
6142
- console.log(USAGE5);
5935
+ console.log(USAGE4);
6143
5936
  process.exit(1);
6144
5937
  }
6145
5938
  }
6146
5939
  async function resolveTarget(args, channel) {
6147
- const scope = getArg4(args, "--scope") ?? "channel";
5940
+ const scope = getArg3(args, "--scope") ?? "channel";
6148
5941
  if (scope === "channel") return { scope: "channel", channelId: channel.id };
6149
5942
  if (scope !== "user" && scope !== "workspace") {
6150
5943
  throw new Error("--scope must be channel, user or workspace");
@@ -6152,13 +5945,13 @@ async function resolveTarget(args, channel) {
6152
5945
  const workspace = await getWorkspaceBySlug(channel.profile);
6153
5946
  if (!workspace) throw new Error(`No workspace for ${channel.profile}.`);
6154
5947
  if (scope === "workspace") return { scope, workspaceId: workspace.id };
6155
- const userId = getArg4(args, "--user");
5948
+ const userId = getArg3(args, "--user");
6156
5949
  if (!userId) throw new Error("--scope user needs --user <user-id>");
6157
5950
  return { scope, workspaceId: workspace.id, userId };
6158
5951
  }
6159
5952
 
6160
5953
  // src/commands/mcp.ts
6161
- var USAGE6 = `
5954
+ var USAGE5 = `
6162
5955
  Usage: flyspace mcp <server>
6163
5956
 
6164
5957
  Run one of Flyspace's own MCP servers on stdio. Spawned by the agent runtime
@@ -6167,7 +5960,8 @@ Usage: flyspace mcp <server>
6167
5960
  Servers:
6168
5961
  threads Search, read, and write this workspace's chat threads
6169
5962
  (search_threads, read_thread, list_channels, create_thread,
6170
- post_reply, move_thread, share_doc)
5963
+ post_reply, move_thread, rename_channel, create_channel,
5964
+ set_channel_slack, share_doc)
6171
5965
 
6172
5966
  Try it by hand (type a JSON-RPC line, or pipe one in):
6173
5967
  flyspace mcp threads
@@ -6175,7 +5969,7 @@ Usage: flyspace mcp <server>
6175
5969
  async function runMcpCmd(args) {
6176
5970
  const server = args[0];
6177
5971
  if (!server || server === "-h" || server === "--help") {
6178
- console.log(USAGE6.trim());
5972
+ console.log(USAGE5.trim());
6179
5973
  return;
6180
5974
  }
6181
5975
  restoreStdout();
@@ -6183,13 +5977,13 @@ async function runMcpCmd(args) {
6183
5977
  useHostDbWithoutCredentials();
6184
5978
  switch (server) {
6185
5979
  case "threads": {
6186
- const { startThreadsServer } = await import("./threads-62Y2BIFT.js");
5980
+ const { startThreadsServer } = await import("./threads-B5FBIJLG.js");
6187
5981
  await startThreadsServer();
6188
5982
  return;
6189
5983
  }
6190
5984
  default:
6191
5985
  console.error(`Unknown MCP server: ${server}`);
6192
- console.error(USAGE6.trim());
5986
+ console.error(USAGE5.trim());
6193
5987
  process.exit(1);
6194
5988
  }
6195
5989
  }
@@ -6264,7 +6058,7 @@ async function ensureServices() {
6264
6058
  }
6265
6059
 
6266
6060
  // ../api/src/dashboard/api.ts
6267
- import { Hono as Hono38 } from "hono";
6061
+ import { Hono as Hono39 } from "hono";
6268
6062
 
6269
6063
  // ../api/src/dashboard/guest-routes.ts
6270
6064
  import { Hono as Hono4 } from "hono";
@@ -7083,7 +6877,7 @@ var readThread = async (input2, ctx) => {
7083
6877
  replies: replies ?? []
7084
6878
  };
7085
6879
  };
7086
- var listChannels3 = async (_input, ctx) => {
6880
+ var listChannels2 = async (_input, ctx) => {
7087
6881
  let query = getSupabaseClient().from("channels").select("id, name, profile, cwd");
7088
6882
  if (ctx.scope !== null) query = query.in("profile", ctx.scope);
7089
6883
  const { data, error: error2 } = await query.order("name");
@@ -7108,7 +6902,7 @@ var postReply = async (input2, ctx) => {
7108
6902
  const owner = await threadInScope(ctx, input2.thread_id);
7109
6903
  return { threadId: owner.threadId, replyId: await insertAgentReply(owner.threadId, input2.text) };
7110
6904
  };
7111
- var moveThread2 = async (input2, ctx) => {
6905
+ var moveThread = async (input2, ctx) => {
7112
6906
  const owner = await threadInScope(ctx, input2.thread_id);
7113
6907
  if (owner.channelId === input2.to_channel_id) return "unchanged";
7114
6908
  const to = await channelInScope(ctx, input2.to_channel_id);
@@ -7123,6 +6917,52 @@ var moveThread2 = async (input2, ctx) => {
7123
6917
  to: { id: to.id, name: to.name, cwd: to.cwd }
7124
6918
  };
7125
6919
  };
6920
+ var renameChannel = async (input2, ctx) => {
6921
+ const channel = await channelInScope(ctx, input2.channel_id);
6922
+ const { error: error2 } = await getSupabaseClient().from("channels").update({ name: input2.name }).eq("id", channel.id);
6923
+ if (error2) throw new Error(`rename failed: ${error2.message}`);
6924
+ return { id: channel.id, from: channel.name, to: input2.name };
6925
+ };
6926
+ async function assertSlackFree(ctx, slackId, exceptId) {
6927
+ const { data, error: error2 } = await getSupabaseClient().from("channels").select("id, name, profile").eq("external_channel_id", slackId).maybeSingle();
6928
+ if (error2) throw new Error(error2.message);
6929
+ if (!data || data["id"] === exceptId) return;
6930
+ throw new ActionError(
6931
+ inScope(ctx, data["profile"]) ? `Slack channel ${slackId} is already bound to #${data["name"]} (${data["id"]}).` : `Slack channel ${slackId} is already bound to another workspace's channel.`
6932
+ );
6933
+ }
6934
+ var createChannel2 = async (input2, ctx) => {
6935
+ const profile = input2.workspace?.trim() || ctx.requester.workspace || (ctx.scope?.length === 1 ? ctx.scope[0] : void 0);
6936
+ if (!profile) throw new ActionError("Which workspace? Pass workspace.");
6937
+ if (!inScope(ctx, profile)) throw new ActionError(`No workspace ${profile}.`);
6938
+ const supabase = getSupabaseClient();
6939
+ const { data: taken, error: takenError } = await supabase.from("channels").select("id").eq("profile", profile).eq("name", input2.name).maybeSingle();
6940
+ if (takenError) throw new Error(takenError.message);
6941
+ if (taken) throw new ActionError(`#${input2.name} already exists (${taken["id"]}).`);
6942
+ if (input2.slack_channel_id) await assertSlackFree(ctx, input2.slack_channel_id);
6943
+ const cwd = `${profile}/${input2.name}`;
6944
+ const { data, error: error2 } = await supabase.from("channels").insert({
6945
+ name: input2.name,
6946
+ cwd,
6947
+ profile,
6948
+ external_channel_id: input2.slack_channel_id ?? null
6949
+ }).select("id, name, profile, cwd").single();
6950
+ if (error2 || !data) throw new Error(`create failed: ${error2?.message ?? "no row returned"}`);
6951
+ await refreshChannelRegistry();
6952
+ return data;
6953
+ };
6954
+ var setChannelSlack = async (input2, ctx) => {
6955
+ const channel = await channelInScope(ctx, input2.channel_id);
6956
+ const supabase = getSupabaseClient();
6957
+ const { data: row, error: readError } = await supabase.from("channels").select("external_channel_id").eq("id", channel.id).single();
6958
+ if (readError) throw new Error(readError.message);
6959
+ const to = input2.slack_channel_id ?? null;
6960
+ if (to) await assertSlackFree(ctx, to, channel.id);
6961
+ const { error: error2 } = await supabase.from("channels").update({ external_channel_id: to, updated_at: (/* @__PURE__ */ new Date()).toISOString() }).eq("id", channel.id);
6962
+ if (error2) throw new Error(`update failed: ${error2.message}`);
6963
+ await refreshChannelRegistry();
6964
+ return { id: channel.id, from: row["external_channel_id"] ?? null, to };
6965
+ };
7126
6966
  var shareDoc = async (input2, ctx) => {
7127
6967
  const res = await publishDocShareForHost(ctx.scope, {
7128
6968
  channelId: input2.channel_id,
@@ -7229,10 +7069,13 @@ var checkPermission = async (input2, ctx) => {
7229
7069
  var HANDLERS = {
7230
7070
  [searchThreadsAction.name]: searchThreads,
7231
7071
  [readThreadAction.name]: readThread,
7232
- [listChannelsAction.name]: listChannels3,
7072
+ [listChannelsAction.name]: listChannels2,
7233
7073
  [createThreadAction.name]: createThread,
7234
7074
  [postReplyAction.name]: postReply,
7235
- [moveThreadAction.name]: moveThread2,
7075
+ [moveThreadAction.name]: moveThread,
7076
+ [renameChannelAction.name]: renameChannel,
7077
+ [createChannelAction.name]: createChannel2,
7078
+ [setChannelSlackAction.name]: setChannelSlack,
7236
7079
  [shareDocAction.name]: shareDoc,
7237
7080
  [openDocAction.name]: openDoc,
7238
7081
  [setUiZoomAction.name]: setUiZoom,
@@ -7343,6 +7186,7 @@ function remoteAgentCallbacks() {
7343
7186
  cancelAgentRun: async (threadId) => await callHost("cancelAgentRun", [threadId]) ?? false,
7344
7187
  regenerateAgentRun: async (threadId, stoppedReplyId) => await callHost("regenerateAgentRun", [threadId, stoppedReplyId]) ?? false,
7345
7188
  listAgentRuns: async () => await callHost("listAgentRuns", []) ?? [],
7189
+ listBackgroundThreads: async () => await callHost("listBackgroundThreads", []) ?? [],
7346
7190
  // `null` (no Host, or no answer in time) passes through: the extractor
7347
7191
  // reads it as a failed call and retries the thread next sweep.
7348
7192
  completeMemoryExtraction: (req) => callHost("completeMemoryExtraction", [req], MEMORY_EXTRACTION_TIMEOUT_MS),
@@ -7712,7 +7556,8 @@ function createAuthRouter() {
7712
7556
  owner: isWorkspaceOwner(ctx),
7713
7557
  // Only the Host's owner can run `flyspace upgrade` on it, so other
7714
7558
  // admins never see the upgrade banner. Support staff can tell them to.
7715
- hostOwner: await isHostOwner(ctx)
7559
+ hostOwner: await isHostOwner(ctx),
7560
+ ...ctx.isSupport ? { isSupport: true } : {}
7716
7561
  });
7717
7562
  });
7718
7563
  auth.patch("/handle", async (c) => {
@@ -7756,6 +7601,9 @@ function shouldLogRead(key, now) {
7756
7601
  }
7757
7602
  return true;
7758
7603
  }
7604
+ function isPassiveRequest(path) {
7605
+ return path.endsWith("/read") || path.endsWith("/autocomplete") || path.includes("/translat") || path.endsWith("/support-access/view");
7606
+ }
7759
7607
  function auditSupport(ctx, action, detail) {
7760
7608
  logSupportAction({
7761
7609
  workspaceId: ctx.workspaceId,
@@ -7777,11 +7625,7 @@ var requireWorkspaceMembership = async (c, next) => {
7777
7625
  auditSupport(ctx, "enter");
7778
7626
  }
7779
7627
  await next();
7780
- if (c.req.method === "GET") {
7781
- if (shouldLogRead(`${key}:${c.req.path}`, Date.now())) {
7782
- auditSupport(ctx, "read", { path: c.req.path, status: c.res.status });
7783
- }
7784
- } else if (!["HEAD", "OPTIONS"].includes(c.req.method)) {
7628
+ if (!["GET", "HEAD", "OPTIONS"].includes(c.req.method) && !isPassiveRequest(c.req.path)) {
7785
7629
  auditSupport(ctx, "write", { method: c.req.method, path: c.req.path, status: c.res.status });
7786
7630
  }
7787
7631
  };
@@ -8161,7 +8005,9 @@ function createChannelAgentRouter() {
8161
8005
  const router = new Hono11();
8162
8006
  router.patch("/:id", async (c, next) => {
8163
8007
  const body = await c.req.raw.clone().json().catch(() => null);
8164
- if (!body || typeof body !== "object" || !("model" in body || "effort" in body)) return next();
8008
+ if (!body || typeof body !== "object" || !("model" in body || "effort" in body || "description" in body)) {
8009
+ return next();
8010
+ }
8165
8011
  const auth = await resolveAuthContext(c);
8166
8012
  if (!auth) return c.json({ error: "workspace access required" }, 403);
8167
8013
  const id = c.req.param("id");
@@ -8176,13 +8022,24 @@ function createChannelAgentRouter() {
8176
8022
  if (effort === "invalid") {
8177
8023
  return c.json({ error: "effort must be low, medium, high, xhigh or max" }, 400);
8178
8024
  }
8179
- if (Object.keys(body).some((k) => k !== "model" && k !== "effort")) return next();
8025
+ const description = "description" in body ? normaliseChannelDescription(body["description"]) : void 0;
8026
+ if (description === "invalid") {
8027
+ return c.json({ error: `description must be text of at most ${CHANNEL_DESCRIPTION_MAX} characters` }, 400);
8028
+ }
8029
+ const own = ["model", "effort", "description"];
8030
+ if (Object.keys(body).some((k) => !own.includes(k))) return next();
8180
8031
  try {
8181
8032
  const updated = await updateChannelById(id, {
8182
8033
  ...model !== void 0 ? { model } : {},
8183
- ...effort !== void 0 ? { effort } : {}
8034
+ ...effort !== void 0 ? { effort } : {},
8035
+ ...description !== void 0 ? { description } : {}
8036
+ });
8037
+ return c.json({
8038
+ id: updated.id,
8039
+ model: updated.model ?? null,
8040
+ effort: updated.effort ?? null,
8041
+ description: updated.description
8184
8042
  });
8185
- return c.json({ id: updated.id, model: updated.model ?? null, effort: updated.effort ?? null });
8186
8043
  } catch (err) {
8187
8044
  return c.json({ error: err.message }, 500);
8188
8045
  }
@@ -8995,6 +8852,9 @@ var NO_STATUS_COLUMN = "none";
8995
8852
  function isBoardStatus(v) {
8996
8853
  return typeof v === "string" && BOARD_STATUSES.includes(v);
8997
8854
  }
8855
+ function callerAuthor(c) {
8856
+ return c.get("auth").handle;
8857
+ }
8998
8858
  async function callerMembershipId(c) {
8999
8859
  const viewer = c.get("auth");
9000
8860
  if (!viewer) return null;
@@ -9163,7 +9023,8 @@ function createChatRouter(agent = {}) {
9163
9023
  getBackgroundTasks,
9164
9024
  cancelAgentRun,
9165
9025
  regenerateAgentRun,
9166
- listAgentRuns
9026
+ listAgentRuns,
9027
+ listBackgroundThreads
9167
9028
  } = agent;
9168
9029
  const askSupport = (c, threadId, author, body) => {
9169
9030
  const viewer = c.get("auth");
@@ -9188,7 +9049,13 @@ function createChatRouter(agent = {}) {
9188
9049
  background: await getBackgroundTasks?.(c.req.param("id")) ?? []
9189
9050
  })
9190
9051
  );
9191
- app.get("/agent-runs", async (c) => c.json({ threadIds: await listAgentRuns?.() ?? [] }));
9052
+ app.get("/agent-runs", async (c) => {
9053
+ const [threadIds, backgroundThreadIds] = await Promise.all([
9054
+ listAgentRuns?.(),
9055
+ listBackgroundThreads?.()
9056
+ ]);
9057
+ return c.json({ threadIds: threadIds ?? [], backgroundThreadIds: backgroundThreadIds ?? [] });
9058
+ });
9192
9059
  app.get("/channels/:channelId/threads", async (c) => {
9193
9060
  const channelId = c.req.param("channelId");
9194
9061
  if (!ownChannelIds(c).has(channelId)) return c.json({ error: "unknown channel" }, 404);
@@ -9591,10 +9458,10 @@ function createChatRouter(agent = {}) {
9591
9458
  app.patch("/replies/:replyId", async (c) => {
9592
9459
  const replyId = c.req.param("replyId");
9593
9460
  const input2 = await c.req.json().catch(() => null);
9594
- const author = input2?.author;
9461
+ const author = callerAuthor(c);
9595
9462
  const body = input2?.body;
9596
- if (!isNonEmptyString(author) || !isNonEmptyString(body)) {
9597
- return c.json({ errors: ["author and body are required"] }, 400);
9463
+ if (!isNonEmptyString(body)) {
9464
+ return c.json({ errors: ["body is required"] }, 400);
9598
9465
  }
9599
9466
  const supabase = getSupabaseClient();
9600
9467
  const { data: existing, error: fetchError } = await supabase.from("thread_replies").select("*").eq("id", replyId).single();
@@ -9617,10 +9484,10 @@ function createChatRouter(agent = {}) {
9617
9484
  app.post("/replies/:replyId/reactions", async (c) => {
9618
9485
  const replyId = c.req.param("replyId");
9619
9486
  const input2 = await c.req.json().catch(() => null);
9620
- const author = input2?.author;
9487
+ const author = callerAuthor(c);
9621
9488
  const emoji = input2?.emoji;
9622
- if (!isNonEmptyString(author) || !isNonEmptyString(emoji)) {
9623
- return c.json({ errors: ["author and emoji are required"] }, 400);
9489
+ if (!isNonEmptyString(emoji)) {
9490
+ return c.json({ errors: ["emoji is required"] }, 400);
9624
9491
  }
9625
9492
  const supabase = getSupabaseClient();
9626
9493
  const { data: reply, error: replyError } = await supabase.from("thread_replies").select("thread_id").eq("id", replyId).single();
@@ -9658,9 +9525,10 @@ function createChatRouter(agent = {}) {
9658
9525
  const channelId = c.req.param("channelId");
9659
9526
  if (!ownChannelIds(c).has(channelId)) return c.json({ error: "unknown channel" }, 404);
9660
9527
  const input2 = await c.req.json();
9661
- if (!isNonEmptyString(input2.author) || !isNonEmptyString(input2.body)) {
9662
- return c.json({ errors: ["author and body are required"] }, 400);
9528
+ if (!isNonEmptyString(input2.body)) {
9529
+ return c.json({ errors: ["body is required"] }, 400);
9663
9530
  }
9531
+ const author = callerAuthor(c);
9664
9532
  const clientKey2 = isNonEmptyString(input2.clientKey) ? input2.clientKey : null;
9665
9533
  const model = requestedModel(c, input2.model);
9666
9534
  const effort = requestedEffort(c, input2.effort);
@@ -9680,7 +9548,7 @@ function createChatRouter(agent = {}) {
9680
9548
  // name, so it lands as null and the topic is derived from the
9681
9549
  // opening message at display time (see threadCrumbLabel).
9682
9550
  title: isNonEmptyString(input2.title) ? input2.title.trim() : null,
9683
- author: input2.author,
9551
+ author,
9684
9552
  client_key: clientKey2,
9685
9553
  board_status: pickedStatus ?? null
9686
9554
  }).select().single();
@@ -9700,7 +9568,7 @@ function createChatRouter(agent = {}) {
9700
9568
  if (!reply) {
9701
9569
  const { data: insertedReply, error: replyError } = await supabase.from("thread_replies").insert({
9702
9570
  thread_id: thread.id,
9703
- author: input2.author,
9571
+ author,
9704
9572
  body: input2.body,
9705
9573
  client_key: clientKey2,
9706
9574
  model,
@@ -9714,7 +9582,7 @@ function createChatRouter(agent = {}) {
9714
9582
  onMessage?.({
9715
9583
  threadId: thread.id,
9716
9584
  replyId: reply.id,
9717
- author: input2.author,
9585
+ author,
9718
9586
  body: input2.body,
9719
9587
  // From the row, not `model`/`effort`: on the replay path the reply
9720
9588
  // predates this request, so its own stored override is the source of
@@ -9722,12 +9590,12 @@ function createChatRouter(agent = {}) {
9722
9590
  model: reply["model"] ?? void 0,
9723
9591
  effort: effortFromRow(reply["effort"])
9724
9592
  });
9725
- askSupport(c, thread.id, input2.author, input2.body);
9593
+ askSupport(c, thread.id, author, input2.body);
9726
9594
  recordReplyLanguage(reply.id, input2.body);
9727
9595
  tagStoredReply(c, {
9728
9596
  threadId: thread.id,
9729
9597
  replyId: reply.id,
9730
- author: input2.author,
9598
+ author,
9731
9599
  body: input2.body
9732
9600
  });
9733
9601
  }
@@ -9755,10 +9623,7 @@ function createChatRouter(agent = {}) {
9755
9623
  app.post("/replies/:replyId/fork", async (c) => {
9756
9624
  const replyId = c.req.param("replyId");
9757
9625
  const input2 = await c.req.json().catch(() => null);
9758
- const author = input2?.author;
9759
- if (!isNonEmptyString(author)) {
9760
- return c.json({ errors: ["author is required"] }, 400);
9761
- }
9626
+ const author = callerAuthor(c);
9762
9627
  const mode = input2?.mode === "focus" ? "focus" : "condense";
9763
9628
  const instructions = isNonEmptyString(input2?.instructions) ? input2.instructions.trim() : void 0;
9764
9629
  const model = requestedModel(c, input2?.model);
@@ -9817,16 +9682,17 @@ function createChatRouter(agent = {}) {
9817
9682
  app.post("/threads/:id/replies", async (c) => {
9818
9683
  const threadId = c.req.param("id");
9819
9684
  const input2 = await c.req.json();
9820
- if (!isNonEmptyString(input2.author) || !isNonEmptyString(input2.body)) {
9821
- return c.json({ errors: ["author and body are required"] }, 400);
9685
+ if (!isNonEmptyString(input2.body)) {
9686
+ return c.json({ errors: ["body is required"] }, 400);
9822
9687
  }
9688
+ const author = callerAuthor(c);
9823
9689
  const clientKey2 = isNonEmptyString(input2.clientKey) ? input2.clientKey : null;
9824
9690
  const effort = requestedEffort(c, input2.effort);
9825
9691
  if (!await threadIsKnown(threadId, c)) return c.json({ error: "not found" }, 404);
9826
9692
  const model = requestedModel(c, input2.model) ?? await threadModel(threadId);
9827
9693
  const { data, error: error2 } = await getSupabaseClient().from("thread_replies").insert({
9828
9694
  thread_id: threadId,
9829
- author: input2.author,
9695
+ author,
9830
9696
  body: input2.body,
9831
9697
  client_key: clientKey2,
9832
9698
  model,
@@ -9842,21 +9708,21 @@ function createChatRouter(agent = {}) {
9842
9708
  onMessage?.({
9843
9709
  threadId,
9844
9710
  replyId: data.id,
9845
- author: input2.author,
9711
+ author,
9846
9712
  body: input2.body,
9847
9713
  model: data.model ?? void 0,
9848
9714
  effort: effortFromRow(data.effort)
9849
9715
  });
9850
- askSupport(c, threadId, input2.author, input2.body);
9716
+ askSupport(c, threadId, author, input2.body);
9851
9717
  recordReplyLanguage(data.id, input2.body);
9852
9718
  tagStoredReply(c, {
9853
9719
  threadId,
9854
9720
  replyId: data.id,
9855
- author: input2.author,
9721
+ author,
9856
9722
  body: input2.body,
9857
9723
  replyToId: isNonEmptyString(input2.replyToId) ? input2.replyToId : void 0
9858
9724
  });
9859
- void syncSupportReply({ threadId, author: input2.author, body: input2.body });
9725
+ void syncSupportReply({ threadId, author, body: input2.body });
9860
9726
  return c.json(data, 201);
9861
9727
  });
9862
9728
  app.post("/replies/:replyId/support-escalate", async (c) => {
@@ -9869,9 +9735,8 @@ function createChatRouter(agent = {}) {
9869
9735
  );
9870
9736
  return c.json({ error: "not found" }, 404);
9871
9737
  }
9872
- const { author } = await c.req.json().catch(() => ({}));
9873
9738
  try {
9874
- const result = await escalateToHuman(replyId, isNonEmptyString(author) ? author : "a member");
9739
+ const result = await escalateToHuman(replyId, callerAuthor(c));
9875
9740
  if (!result.ok) {
9876
9741
  console.warn(`Support escalation ${result.status}: reply=${replyId} ${result.error}`);
9877
9742
  return c.json({ error: result.error }, result.status);
@@ -10505,7 +10370,8 @@ function createSupportGrantRouter() {
10505
10370
  const app = new Hono19();
10506
10371
  app.use("*", async (c, next) => {
10507
10372
  const auth = c.get("auth");
10508
- if (auth.role !== "admin" || auth.isSupport) {
10373
+ const readOnly = c.req.method === "GET" || auth.isSupport && c.req.path.endsWith("/view");
10374
+ if (auth.role !== "admin" || auth.isSupport && !readOnly) {
10509
10375
  return c.json({ error: "workspace admin access required" }, 403);
10510
10376
  }
10511
10377
  await next();
@@ -10515,7 +10381,32 @@ function createSupportGrantRouter() {
10515
10381
  });
10516
10382
  app.get("/activity", async (c) => {
10517
10383
  const limit = Number(c.req.query("limit")) || 200;
10518
- return c.json({ entries: await listSupportLog({ workspaceId: c.get("auth").workspaceId, limit }) });
10384
+ const entries = await listSupportLog({ workspaceId: c.get("auth").workspaceId, limit });
10385
+ const people = await resolvePeople([...new Set(entries.map((e) => e.staffUserId))]);
10386
+ return c.json({
10387
+ entries: entries.map(({ staffEmail, staffUserId, ...e }) => ({
10388
+ ...e,
10389
+ actor: people.get(staffUserId) ?? { name: staffEmail.split("@")[0], avatarUrl: null }
10390
+ }))
10391
+ });
10392
+ });
10393
+ app.post("/view", async (c) => {
10394
+ const auth = c.get("auth");
10395
+ if (!auth.isSupport) return c.json({ ok: true });
10396
+ const body = await c.req.json().catch(() => ({}));
10397
+ const path = typeof body.path === "string" ? body.path.slice(0, 500) : "";
10398
+ const title = typeof body.title === "string" ? body.title.trim().slice(0, 200) : "";
10399
+ if (!path || !shouldLogRead(`${auth.userId}:${auth.workspaceId}:view:${path}`, Date.now())) {
10400
+ return c.json({ ok: true });
10401
+ }
10402
+ await logSupportAction({
10403
+ workspaceId: auth.workspaceId,
10404
+ staffUserId: auth.userId,
10405
+ staffEmail: auth.email,
10406
+ action: "read",
10407
+ detail: { page: path, ...title ? { title } : {} }
10408
+ });
10409
+ return c.json({ ok: true });
10519
10410
  });
10520
10411
  app.post("/", async (c) => {
10521
10412
  const auth = c.get("auth");
@@ -10557,6 +10448,22 @@ function createSupportGrantRouter() {
10557
10448
  });
10558
10449
  return app;
10559
10450
  }
10451
+ async function resolvePeople(ids) {
10452
+ const out = /* @__PURE__ */ new Map();
10453
+ await Promise.all(
10454
+ ids.map(async (id) => {
10455
+ const { data } = await getSupabaseClient().auth.admin.getUserById(id);
10456
+ const user = data?.user;
10457
+ if (!user) return;
10458
+ const meta = user.user_metadata ?? {};
10459
+ out.set(id, {
10460
+ name: meta.name?.trim() || (user.email ?? "").split("@")[0],
10461
+ avatarUrl: meta.avatarKey ? await signAvatarUrl(meta.avatarKey) : null
10462
+ });
10463
+ })
10464
+ );
10465
+ return out;
10466
+ }
10560
10467
 
10561
10468
  // ../api/src/dashboard/transcribe-routes.ts
10562
10469
  import { Hono as Hono20 } from "hono";
@@ -10639,10 +10546,401 @@ function createTranscribeRouter() {
10639
10546
  return app;
10640
10547
  }
10641
10548
 
10642
- // ../api/src/dashboard/autocomplete-routes.ts
10549
+ // ../api/src/dashboard/voice-routes.ts
10643
10550
  import { Hono as Hono21 } from "hono";
10551
+
10552
+ // ../api/src/dashboard/voice-embed.ts
10553
+ import { createRequire } from "module";
10554
+ var extractor;
10555
+ function getExtractor() {
10556
+ if (extractor !== void 0) return extractor;
10557
+ const model = process.env["VOICE_MODEL_PATH"];
10558
+ if (!model) return extractor = null;
10559
+ try {
10560
+ const sherpa = createRequire(import.meta.url)("sherpa-onnx-node");
10561
+ extractor = new sherpa.SpeakerEmbeddingExtractor({ model, numThreads: 1 });
10562
+ } catch (err) {
10563
+ console.error("[voice] speaker model failed to load", err);
10564
+ extractor = null;
10565
+ }
10566
+ return extractor;
10567
+ }
10568
+ function embedVoice(samples) {
10569
+ const ex = getExtractor();
10570
+ if (!ex) return null;
10571
+ const stream = ex.createStream();
10572
+ stream.acceptWaveform({ sampleRate: 16e3, samples });
10573
+ stream.inputFinished();
10574
+ const v = Array.from(ex.compute(stream));
10575
+ const n = Math.hypot(...v) || 1;
10576
+ return v.map((x) => x / n);
10577
+ }
10578
+
10579
+ // ../api/src/dashboard/voice-routes.ts
10580
+ var CLIENT_SECRETS_URL = "https://api.openai.com/v1/realtime/client_secrets";
10581
+ var MODEL3 = process.env["REALTIME_MODEL"] ?? "gpt-realtime-mini";
10644
10582
  var GROQ_API_URL4 = "https://api.groq.com/openai/v1/chat/completions";
10645
- var MODEL3 = "openai/gpt-oss-120b";
10583
+ var GROQ_MODEL = "openai/gpt-oss-120b";
10584
+ var INSTRUCTIONS = `You are the voice of {NAME}, the agent in a Flyspace thread. Warm, relaxed, short sentences.
10585
+ Answer directly yourself, without any tool, when it is general knowledge or small talk that needs nothing from their project or workspace (for example how to reload a page, a keyboard shortcut, what a word means). Keep it to one or two short sentences.
10586
+ You know nothing about their project yourself. For any question or request about their project, code or data: first say one short, natural filler sentence, different each time (for example "Let me check.", "One sec."), then call ask_agent with their request in their own words. Never answer from memory and never make up names or numbers.
10587
+ If what they said sounds unfinished or too vague to act on, do not call ask_agent yet: reply with a few words that keep them talking, then wait.
10588
+ ask_agent returns the agent's full written answer, which is already posted in the thread. Say only the gist in at most three short spoken sentences, no Markdown, no code, no URLs, then mention that the details are in the thread if it was long.
10589
+ For small talk like hello or thanks, reply in a few words.
10590
+ Call end_call only when they say goodbye together with your name (for example "Bye {NAME}"): say a very short goodbye first. A goodbye without your name does not end the call.
10591
+ Call pause_listening when they ask you to pause or stop listening together with your name (for example "Pause {NAME}" or "\u66AB\u505C {NAME}"). Say nothing after it: they resume with the button or by saying "Hey {NAME}". A pause request without your name (for example "\u66AB\u505C\u4E00\u4E0B", "wait") does not pause: just wait for them.
10592
+ If what they said seems meant for someone else in the room, ask briefly "Was that for me?" and wait.
10593
+ When they ask where something is or how to do something in the Flyspace app itself (open settings, invite someone, create a channel), call show_me instead of ask_agent: it points at the right place on screen. Say one short sentence about what you are showing.
10594
+ When they ask what was discussed, decided or said somewhere in the workspace (for example "where did the X discussion get to", "what did we decide about Y"), call search_workspace first: it answers in seconds. Use ask_agent only if search_workspace finds nothing useful or the request needs real work (reading code, running something, changing files).`;
10595
+ var VOICES = /* @__PURE__ */ new Set([
10596
+ "marin",
10597
+ "cedar",
10598
+ "alloy",
10599
+ "ash",
10600
+ "ballad",
10601
+ "coral",
10602
+ "echo",
10603
+ "sage",
10604
+ "shimmer",
10605
+ "verse"
10606
+ ]);
10607
+ var VOICE_MATCH_MIN = 0.35;
10608
+ var LANGUAGES = {
10609
+ auto: { rule: "Speak the same language the user speaks." },
10610
+ "zh-TW": {
10611
+ rule: "Speak Taiwan Mandarin unless the user speaks another language. Chinese always means Traditional Chinese with Taiwanese wording (zh-TW), never Simplified Chinese, including the question text you pass to tools.",
10612
+ transcribe: "\u7E41\u9AD4\u4E2D\u6587\uFF08\u53F0\u7063\u7528\u8A9E\uFF09\uFF0C\u593E\u96DC\u82F1\u6587\u6280\u8853\u540D\u8A5E\u3002"
10613
+ },
10614
+ "zh-CN": {
10615
+ rule: "Speak Mandarin unless the user speaks another language. Chinese means Simplified Chinese (zh-CN), including the question text you pass to tools.",
10616
+ transcribe: "\u7B80\u4F53\u4E2D\u6587\uFF0C\u5939\u6742\u82F1\u6587\u6280\u672F\u540D\u8BCD\u3002"
10617
+ },
10618
+ yue: {
10619
+ rule: "Speak Cantonese (Hong Kong) unless the user speaks another language. Write Chinese in Traditional Chinese with Hong Kong wording, including the question text you pass to tools.",
10620
+ transcribe: "\u5EE3\u6771\u8A71\uFF08\u9999\u6E2F\uFF09\uFF0C\u593E\u96DC\u82F1\u6587\u3002"
10621
+ },
10622
+ en: { rule: "Speak English unless the user speaks another language." },
10623
+ ja: { rule: "Speak Japanese unless the user speaks another language." }
10624
+ };
10625
+ var ACCENTS = {
10626
+ taiwan: "When speaking Mandarin, use a natural Taiwanese accent and Taiwanese wording.",
10627
+ mainland: "When speaking Mandarin, use a natural standard mainland Chinese accent.",
10628
+ australian: "When speaking English, use a natural Australian accent.",
10629
+ american: "When speaking English, use a natural American accent.",
10630
+ british: "When speaking English, use a natural British accent.",
10631
+ indian: "When speaking English, use a natural Indian English accent.",
10632
+ singaporean: "When speaking English, use a natural Singaporean English accent."
10633
+ };
10634
+ function languageRule(raw) {
10635
+ const code = String(raw ?? "auto");
10636
+ if (LANGUAGES[code]) return LANGUAGES[code];
10637
+ if (/^zh-(Hant|HK|MO)/i.test(code)) return LANGUAGES["zh-TW"];
10638
+ if (/^zh/i.test(code)) return LANGUAGES["zh-CN"];
10639
+ if (/^en/i.test(code)) return LANGUAGES["en"];
10640
+ if (/^[a-z]{2,3}(-[A-Za-z0-9]{2,4})?$/.test(code)) {
10641
+ return {
10642
+ rule: `Speak the language with BCP 47 code "${code}" unless the user speaks another language.`
10643
+ };
10644
+ }
10645
+ return LANGUAGES["auto"];
10646
+ }
10647
+ function customAccent(raw) {
10648
+ const text = String(raw ?? "").replace(/[^\p{L}\p{N} ,.()'-]/gu, "").trim().slice(0, 60);
10649
+ return text ? `Speak with this accent or style: ${text}.` : "";
10650
+ }
10651
+ function agentName(raw) {
10652
+ const name = String(raw ?? "").replace(/[^\p{L}\p{N} ._-]/gu, "").trim().slice(0, 40);
10653
+ return name || "Custie";
10654
+ }
10655
+ function buildSession(style) {
10656
+ const name = agentName(style.name);
10657
+ const voice = VOICES.has(String(style.voice)) ? String(style.voice) : "marin";
10658
+ const language = languageRule(style.language);
10659
+ const accent = style.accent === "custom" ? customAccent(style.customAccent) : ACCENTS[String(style.accent)];
10660
+ const n = Number(style.speed);
10661
+ const speed = Number.isFinite(n) ? Math.min(1.5, Math.max(0.25, n)) : 1;
10662
+ const instructions = [INSTRUCTIONS.replaceAll("{NAME}", name), language.rule, accent].filter(Boolean).join("\n");
10663
+ const { transcription } = SESSION.audio.input;
10664
+ return {
10665
+ ...SESSION,
10666
+ instructions,
10667
+ tools: SESSION.tools.map((tool) => ({
10668
+ ...tool,
10669
+ description: tool.description?.replaceAll("{NAME}", name)
10670
+ })),
10671
+ audio: {
10672
+ input: {
10673
+ ...SESSION.audio.input,
10674
+ transcription: language.transcribe ? { ...transcription, prompt: language.transcribe } : { model: transcription.model }
10675
+ },
10676
+ output: { voice, speed }
10677
+ }
10678
+ };
10679
+ }
10680
+ var SESSION = {
10681
+ type: "realtime",
10682
+ model: MODEL3,
10683
+ instructions: INSTRUCTIONS,
10684
+ audio: {
10685
+ input: {
10686
+ transcription: {
10687
+ model: "gpt-4o-mini-transcribe",
10688
+ prompt: "\u7E41\u9AD4\u4E2D\u6587\uFF08\u53F0\u7063\u7528\u8A9E\uFF09\uFF0C\u593E\u96DC\u82F1\u6587\u6280\u8853\u540D\u8A5E\u3002"
10689
+ },
10690
+ turn_detection: { type: "semantic_vad", eagerness: "low" }
10691
+ },
10692
+ output: { voice: "marin" }
10693
+ },
10694
+ tools: [
10695
+ {
10696
+ type: "function",
10697
+ name: "ask_agent",
10698
+ description: "Sends the user's question or request about their project, code or data to the thread's agent and returns its written answer. Not for general knowledge or small talk; answer those yourself. Say a short filler sentence before calling it.",
10699
+ parameters: {
10700
+ type: "object",
10701
+ properties: { question: { type: "string" } },
10702
+ required: ["question"]
10703
+ }
10704
+ },
10705
+ {
10706
+ type: "function",
10707
+ name: "show_me",
10708
+ description: 'Shows the user where something is in the Flyspace app: opens the page and spotlights the buttons. Use for "where is" and "how do I" questions about the app itself.',
10709
+ parameters: {
10710
+ type: "object",
10711
+ properties: { question: { type: "string" } },
10712
+ required: ["question"]
10713
+ }
10714
+ },
10715
+ {
10716
+ type: "function",
10717
+ name: "search_workspace",
10718
+ description: 'Searches past threads across the whole workspace and returns a short spoken summary. Use for "what did we discuss or decide about X" questions. Pass a few keywords plus the question.',
10719
+ parameters: {
10720
+ type: "object",
10721
+ properties: {
10722
+ query: {
10723
+ type: "string",
10724
+ description: 'Two to four distinctive keywords naming the topic (feature or product names, not generic words like "voice" or "latest"), in the words likely used in the threads'
10725
+ },
10726
+ question: { type: "string", description: "The user's question in their own words" }
10727
+ },
10728
+ required: ["query", "question"]
10729
+ }
10730
+ },
10731
+ {
10732
+ type: "function",
10733
+ name: "pause_listening",
10734
+ description: 'When the user asks you to pause or stop listening with your name, e.g. "Pause {NAME}" or "\u66AB\u505C {NAME}". Mutes their mic; they resume with the button or "Hey {NAME}".',
10735
+ parameters: { type: "object", properties: {} }
10736
+ },
10737
+ {
10738
+ type: "function",
10739
+ name: "end_call",
10740
+ description: 'Only when the user says goodbye with your name, e.g. "Bye {NAME}". Say a short goodbye first.',
10741
+ parameters: { type: "object", properties: {} }
10742
+ }
10743
+ ],
10744
+ tool_choice: "auto"
10745
+ };
10746
+ function createVoiceRouter() {
10747
+ const app = new Hono21();
10748
+ app.post("/voice/session", async (c) => {
10749
+ if (!await isFeatureEnabled(c, "voice-chat")) {
10750
+ return c.json({ error: "voice chat is not enabled" }, 403);
10751
+ }
10752
+ const apiKey = process.env["OPENAI_API_KEY"];
10753
+ if (!apiKey) return c.json({ error: "voice chat is not configured" }, 503);
10754
+ const style = await c.req.json().catch(() => ({}));
10755
+ const res = await fetch(CLIENT_SECRETS_URL, {
10756
+ method: "POST",
10757
+ headers: { authorization: `Bearer ${apiKey}`, "content-type": "application/json" },
10758
+ body: JSON.stringify({ session: buildSession(style ?? {}) })
10759
+ });
10760
+ const body = await res.json().catch(() => ({}));
10761
+ if (!res.ok || !body.value) {
10762
+ console.error("[voice] client_secrets failed", res.status, body.error?.message);
10763
+ return c.json({ error: `voice session failed (${res.status})` }, 502);
10764
+ }
10765
+ return c.json({ value: body.value, expiresAt: body.expires_at, model: MODEL3 });
10766
+ });
10767
+ app.post("/voice/triage", async (c) => {
10768
+ if (!await isFeatureEnabled(c, "voice-chat")) return c.json({ error: "not enabled" }, 403);
10769
+ const body = await c.req.json().catch(() => ({}));
10770
+ const request = String(body.request ?? "").slice(0, 1e3);
10771
+ const utterance = String(body.utterance ?? "").slice(0, 1e3);
10772
+ const out = await groqJson(
10773
+ `The user asked an agent to do something, and while it works they said something else. Decide:
10774
+ - "interrupt": they want to stop, change or replace the current request (e.g. "stop", "never mind", "actually do X instead").
10775
+ - "queue": a new, separate question or request to handle after the current one.
10776
+ - "ignore": filler, thanks, thinking aloud, or talk not meant for the agent.
10777
+ Reply with JSON only: {"decision": "interrupt" | "queue" | "ignore"}`,
10778
+ JSON.stringify({ current_request: request, utterance })
10779
+ );
10780
+ const decision = ["interrupt", "queue", "ignore"].includes(String(out?.["decision"])) ? String(out?.["decision"]) : "queue";
10781
+ return c.json({ decision });
10782
+ });
10783
+ app.post("/voice/embed", async (c) => {
10784
+ if (!await isFeatureEnabled(c, "voice-chat")) return c.json({ error: "not enabled" }, 403);
10785
+ const buf = await c.req.arrayBuffer();
10786
+ if (buf.byteLength % 4 !== 0 || buf.byteLength < 32e3 || buf.byteLength > 384e4) {
10787
+ return c.json({ error: "expected 0.5 to 60 s of 16 kHz Float32 PCM" }, 400);
10788
+ }
10789
+ const samples = new Float32Array(buf);
10790
+ const started = performance.now();
10791
+ const embedding = embedVoice(samples);
10792
+ if (!embedding) return c.json({ error: "speaker model unavailable" }, 503);
10793
+ return c.json({
10794
+ embedding,
10795
+ dim: embedding.length,
10796
+ seconds: samples.length / 16e3,
10797
+ ms: Math.round(performance.now() - started)
10798
+ });
10799
+ });
10800
+ app.get("/voice/profile", async (c) => {
10801
+ if (!await isFeatureEnabled(c, "voice-chat")) return c.json({ error: "not enabled" }, 403);
10802
+ const auth = c.get("auth");
10803
+ const { data, error: error2 } = await getSupabaseClient().from("voice_profiles").select("seconds, updated_at").eq("user_id", auth.userId).maybeSingle();
10804
+ if (error2) return c.json({ error: error2.message }, 500);
10805
+ return c.json({ profile: data ? { seconds: data.seconds, updatedAt: data.updated_at } : null });
10806
+ });
10807
+ app.put("/voice/profile", async (c) => {
10808
+ if (!await isFeatureEnabled(c, "voice-chat")) return c.json({ error: "not enabled" }, 403);
10809
+ const auth = c.get("auth");
10810
+ const buf = await c.req.arrayBuffer();
10811
+ if (buf.byteLength % 4 !== 0 || buf.byteLength < 64e4 || buf.byteLength > 384e4) {
10812
+ return c.json({ error: "expected 10 to 60 s of 16 kHz Float32 PCM" }, 400);
10813
+ }
10814
+ const samples = new Float32Array(buf);
10815
+ const embedding = embedVoice(samples);
10816
+ if (!embedding) return c.json({ error: "speaker model unavailable" }, 503);
10817
+ const row = {
10818
+ user_id: auth.userId,
10819
+ embedding,
10820
+ seconds: samples.length / 16e3,
10821
+ updated_at: (/* @__PURE__ */ new Date()).toISOString()
10822
+ };
10823
+ const { error: error2 } = await getSupabaseClient().from("voice_profiles").upsert(row);
10824
+ if (error2) return c.json({ error: error2.message }, 500);
10825
+ return c.json({ profile: { seconds: row.seconds, updatedAt: row.updated_at } });
10826
+ });
10827
+ app.post("/voice/verify", async (c) => {
10828
+ if (!await isFeatureEnabled(c, "voice-chat")) return c.json({ error: "not enabled" }, 403);
10829
+ const auth = c.get("auth");
10830
+ const buf = await c.req.arrayBuffer();
10831
+ if (buf.byteLength % 4 !== 0 || buf.byteLength < 16e3 || buf.byteLength > 64e4) {
10832
+ return c.json({ error: "expected 0.25 to 10 s of 16 kHz Float32 PCM" }, 400);
10833
+ }
10834
+ const { data, error: error2 } = await getSupabaseClient().from("voice_profiles").select("embedding").eq("user_id", auth.userId).maybeSingle();
10835
+ if (error2) return c.json({ error: error2.message }, 500);
10836
+ if (!data) return c.json({ match: true, score: null });
10837
+ const embedding = embedVoice(new Float32Array(buf));
10838
+ if (!embedding) return c.json({ error: "speaker model unavailable" }, 503);
10839
+ const saved = data.embedding;
10840
+ let dot = 0;
10841
+ let a = 0;
10842
+ let b = 0;
10843
+ for (let i = 0; i < embedding.length; i++) {
10844
+ dot += embedding[i] * saved[i];
10845
+ a += embedding[i] * embedding[i];
10846
+ b += saved[i] * saved[i];
10847
+ }
10848
+ const score = dot / Math.sqrt(a * b || 1);
10849
+ return c.json({ match: score >= VOICE_MATCH_MIN, score });
10850
+ });
10851
+ app.delete("/voice/profile", async (c) => {
10852
+ if (!await isFeatureEnabled(c, "voice-chat")) return c.json({ error: "not enabled" }, 403);
10853
+ const auth = c.get("auth");
10854
+ const { error: error2 } = await getSupabaseClient().from("voice_profiles").delete().eq("user_id", auth.userId);
10855
+ if (error2) return c.json({ error: error2.message }, 500);
10856
+ return c.json({ profile: null });
10857
+ });
10858
+ app.post("/voice/guide", async (c) => {
10859
+ if (!await isFeatureEnabled(c, "voice-chat")) return c.json({ error: "not enabled" }, 403);
10860
+ const body = await c.req.json().catch(() => ({}));
10861
+ const question = String(body.question ?? "").slice(0, 1e3);
10862
+ if (!question.trim()) return c.json({ guide: null });
10863
+ const text = await groqText(
10864
+ `You point people at the right place in the Flyspace web app. Write nothing but the guide line.${GUIDE_RULES}`,
10865
+ question
10866
+ );
10867
+ return c.json({ guide: text ? extractGuide(text).guide : null });
10868
+ });
10869
+ app.post("/voice/search", async (c) => {
10870
+ if (!await isFeatureEnabled(c, "voice-chat")) return c.json({ error: "not enabled" }, 403);
10871
+ const body = await c.req.json().catch(() => ({}));
10872
+ const query = String(body.query ?? "").slice(0, 200).trim();
10873
+ const question = String(body.question ?? query).slice(0, 1e3);
10874
+ if (!query) return c.json({ answer: null, results: [] });
10875
+ const hits = (await searchThreads2(query)).slice(0, 8);
10876
+ if (hits.length === 0) return c.json({ answer: null, results: [] });
10877
+ const tails = await Promise.all(hits.slice(0, 3).map((h) => threadTail(h.id)));
10878
+ const context = hits.map((h, i) => ({
10879
+ title: h.title,
10880
+ channel: h.channelName,
10881
+ date: h.createdAt?.slice(0, 10),
10882
+ excerpt: h.snippet,
10883
+ ...tails[i]?.length ? { latestReplies: tails[i] } : {}
10884
+ }));
10885
+ const answer = await groqText(
10886
+ `Answer the question using ONLY facts stated explicitly in these workspace threads. Never guess, infer causes, or combine unrelated threads. Prefer the most recent replies, since later replies override earlier ones. Reply in at most two short spoken sentences, in the language of the question (Chinese means Taiwan Traditional Chinese), and name the thread it came from. No Markdown, no URLs. If the threads do not clearly answer it, say exactly: NOT_FOUND`,
10887
+ JSON.stringify({ question, threads: context })
10888
+ );
10889
+ const found = answer && !answer.includes("NOT_FOUND") ? answer.trim() : null;
10890
+ return c.json({
10891
+ answer: found,
10892
+ results: hits.map((h) => ({ id: h.id, title: h.title, url: h.url, channel: h.channelName }))
10893
+ });
10894
+ });
10895
+ return app;
10896
+ }
10897
+ async function threadTail(threadId) {
10898
+ const { data, error: error2 } = await getSupabaseClient().from("thread_replies").select("author, body, created_at").eq("thread_id", threadId).order("created_at", { ascending: false }).limit(10);
10899
+ if (error2 || !data) return [];
10900
+ return data.reverse().map((r) => ({
10901
+ author: String(r.author ?? ""),
10902
+ date: String(r.created_at ?? "").slice(0, 10),
10903
+ text: String(r.body ?? "").slice(0, 800)
10904
+ }));
10905
+ }
10906
+ async function groqText(system, user) {
10907
+ const apiKey = process.env["GROQ_API_KEY"];
10908
+ if (!apiKey) return null;
10909
+ const res = await fetch(GROQ_API_URL4, {
10910
+ method: "POST",
10911
+ headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
10912
+ signal: AbortSignal.timeout(12e3),
10913
+ body: JSON.stringify({
10914
+ model: GROQ_MODEL,
10915
+ max_completion_tokens: 600,
10916
+ reasoning_effort: "low",
10917
+ include_reasoning: false,
10918
+ temperature: 0,
10919
+ messages: [
10920
+ { role: "system", content: system },
10921
+ { role: "user", content: user }
10922
+ ]
10923
+ })
10924
+ }).catch(() => null);
10925
+ if (!res?.ok) return null;
10926
+ const data = await res.json().catch(() => null);
10927
+ return data?.choices?.[0]?.message?.content ?? null;
10928
+ }
10929
+ async function groqJson(system, user) {
10930
+ const text = await groqText(system, user);
10931
+ const match = text?.match(/\{[\s\S]*\}/);
10932
+ if (!match) return null;
10933
+ try {
10934
+ return JSON.parse(match[0]);
10935
+ } catch {
10936
+ return null;
10937
+ }
10938
+ }
10939
+
10940
+ // ../api/src/dashboard/autocomplete-routes.ts
10941
+ import { Hono as Hono22 } from "hono";
10942
+ var GROQ_API_URL5 = "https://api.groq.com/openai/v1/chat/completions";
10943
+ var MODEL4 = "openai/gpt-oss-120b";
10646
10944
  var MAX_REPLY_CHARS = 4e3;
10647
10945
  var MAX_EARLIER_CHARS = 1500;
10648
10946
  var THREAD_TAIL_REPLIES = 5;
@@ -10651,7 +10949,7 @@ Base it on the agent's last reply: answer a question it asked, approve or pick a
10651
10949
  Keep it short (under 15 words), in the language the user writes in. No greetings, thanks or filler.
10652
10950
  Output ONLY the message text, no quotes or explanation. If there is no clear next step, output nothing.`;
10653
10951
  function createAutocompleteRouter() {
10654
- const app = new Hono21();
10952
+ const app = new Hono22();
10655
10953
  app.post("/autocomplete", async (c) => {
10656
10954
  const apiKey = process.env["GROQ_API_KEY"];
10657
10955
  if (!apiKey) return c.json({ error: "autocomplete is not configured" }, 503);
@@ -10664,12 +10962,12 @@ function createAutocompleteRouter() {
10664
10962
  const context = `Channel: #${channel.name}${channel.prompt ? `
10665
10963
  Channel instructions: ${channel.prompt.slice(0, 500)}` : ""}
10666
10964
  ${thread}`;
10667
- const res = await fetch(GROQ_API_URL4, {
10965
+ const res = await fetch(GROQ_API_URL5, {
10668
10966
  method: "POST",
10669
10967
  headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
10670
10968
  signal: AbortSignal.timeout(5e3),
10671
10969
  body: JSON.stringify({
10672
- model: MODEL3,
10970
+ model: MODEL4,
10673
10971
  // gpt-oss reasons first; a newline stop would cut it off before any content.
10674
10972
  max_completion_tokens: 200,
10675
10973
  reasoning_effort: "low",
@@ -10717,9 +11015,9 @@ ${last.body.slice(-MAX_REPLY_CHARS)}`;
10717
11015
  }
10718
11016
 
10719
11017
  // ../api/src/dashboard/daily-line-routes.ts
10720
- import { Hono as Hono22 } from "hono";
10721
- var GROQ_API_URL5 = "https://api.groq.com/openai/v1/chat/completions";
10722
- var MODEL4 = "openai/gpt-oss-120b";
11018
+ import { Hono as Hono23 } from "hono";
11019
+ var GROQ_API_URL6 = "https://api.groq.com/openai/v1/chat/completions";
11020
+ var MODEL5 = "openai/gpt-oss-120b";
10723
11021
  var DAY_MS = 864e5;
10724
11022
  var RULES3 = `You write one short line of encouragement shown in the corner of an empty screen, for a founder building a product with a small team.
10725
11023
  You are given what the team recently built and decided. Draw on its real substance to remind them how far they have come or why the work matters, so they feel like pushing on.
@@ -10743,7 +11041,7 @@ function pickMemories(memories, day, now = Date.now()) {
10743
11041
  return [...pool, ...pool].slice(start, start + Math.min(CONTEXT_COUNT, pool.length));
10744
11042
  }
10745
11043
  function createDailyLineRouter() {
10746
- const app = new Hono22();
11044
+ const app = new Hono23();
10747
11045
  app.get("/daily-line", async (c) => {
10748
11046
  if (!await isFeatureEnabled(c, "daily-line"))
10749
11047
  return c.json({ error: "feature not enabled" }, 403);
@@ -10764,12 +11062,12 @@ function createDailyLineRouter() {
10764
11062
  const key = `${day}:${memory.id}:${language}`;
10765
11063
  let text = cache3.get(key);
10766
11064
  if (text === void 0) {
10767
- const res = await fetch(GROQ_API_URL5, {
11065
+ const res = await fetch(GROQ_API_URL6, {
10768
11066
  method: "POST",
10769
11067
  headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
10770
11068
  signal: AbortSignal.timeout(8e3),
10771
11069
  body: JSON.stringify({
10772
- model: MODEL4,
11070
+ model: MODEL5,
10773
11071
  max_completion_tokens: 300,
10774
11072
  reasoning_effort: "low",
10775
11073
  include_reasoning: false,
@@ -10799,9 +11097,9 @@ Write it in ${language} (BCP 47 tag). For Chinese use Traditional Chinese (Taiwa
10799
11097
  }
10800
11098
 
10801
11099
  // ../api/src/dashboard/channel-route.ts
10802
- import { Hono as Hono23 } from "hono";
10803
- var GROQ_API_URL6 = "https://api.groq.com/openai/v1/chat/completions";
10804
- var MODEL5 = "openai/gpt-oss-120b";
11100
+ import { Hono as Hono24 } from "hono";
11101
+ var GROQ_API_URL7 = "https://api.groq.com/openai/v1/chat/completions";
11102
+ var MODEL6 = "openai/gpt-oss-120b";
10805
11103
  var MAX_MESSAGE_CHARS2 = 3e3;
10806
11104
  var MAX_PROMPT_CHARS2 = 300;
10807
11105
  var TITLES_PER_CHANNEL = 8;
@@ -10818,7 +11116,7 @@ async function describeImages(text, workspace, apiKey) {
10818
11116
  (u) => !!u
10819
11117
  );
10820
11118
  if (urls.length === 0) return "";
10821
- const res = await fetch(GROQ_API_URL6, {
11119
+ const res = await fetch(GROQ_API_URL7, {
10822
11120
  method: "POST",
10823
11121
  headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
10824
11122
  signal: AbortSignal.timeout(1e4),
@@ -10869,7 +11167,7 @@ A topic word that could fit many projects (notification, scrollbar, login, bug)
10869
11167
  When a screenshot description is given, the app and names visible in it are strong evidence of the project.
10870
11168
  Output ONLY the channel's number and your confidence, e.g. "3 high" or "3 low". Say low when the message could reasonably belong to more than one channel.`;
10871
11169
  function createChannelRouteRouter() {
10872
- const app = new Hono23();
11170
+ const app = new Hono24();
10873
11171
  app.post("/route-channel", async (c) => {
10874
11172
  if (!await isFeatureEnabled(c, "auto-channel"))
10875
11173
  return c.json({ error: "feature not enabled" }, 403);
@@ -10893,12 +11191,12 @@ function createChannelRouteRouter() {
10893
11191
  titles.get(ch.id)?.length ? ` Recent topics: ${titles.get(ch.id).join(" | ")}` : ""
10894
11192
  ].filter(Boolean).join("\n")
10895
11193
  ).join("\n");
10896
- const res = await fetch(GROQ_API_URL6, {
11194
+ const res = await fetch(GROQ_API_URL7, {
10897
11195
  method: "POST",
10898
11196
  headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
10899
11197
  signal: AbortSignal.timeout(8e3),
10900
11198
  body: JSON.stringify({
10901
- model: MODEL5,
11199
+ model: MODEL6,
10902
11200
  max_completion_tokens: 400,
10903
11201
  reasoning_effort: "low",
10904
11202
  include_reasoning: false,
@@ -10929,7 +11227,7 @@ ${screenshots}` : ""}` }
10929
11227
 
10930
11228
  // ../api/src/dashboard/avatars-routes.ts
10931
11229
  import { createHash as createHash5, randomUUID as randomUUID3 } from "crypto";
10932
- import { Hono as Hono24 } from "hono";
11230
+ import { Hono as Hono25 } from "hono";
10933
11231
  import sharp3 from "sharp";
10934
11232
  import { PutObjectCommand as PutObjectCommand3, DeleteObjectCommand as DeleteObjectCommand2 } from "@aws-sdk/client-s3";
10935
11233
  var AVATAR_SIZE = 192;
@@ -10982,7 +11280,7 @@ function avatarKeyPrefix() {
10982
11280
  return `${KEY_PREFIX2}/${getProfile()}/`;
10983
11281
  }
10984
11282
  function createAvatarsRouter() {
10985
- const app = new Hono24();
11283
+ const app = new Hono25();
10986
11284
  app.get("/avatars/slack", async (c) => {
10987
11285
  const ctx = await resolveAuthContext(c);
10988
11286
  if (!ctx) return c.json({ error: "not signed in" }, 401);
@@ -11031,7 +11329,7 @@ function createAvatarsRouter() {
11031
11329
  }
11032
11330
 
11033
11331
  // ../api/src/dashboard/members-routes.ts
11034
- import { Hono as Hono25 } from "hono";
11332
+ import { Hono as Hono26 } from "hono";
11035
11333
  function inviteLinkFor(c, token) {
11036
11334
  const url = new URL("/auth/invite", callbackUrl(c));
11037
11335
  url.searchParams.set("token", token);
@@ -11039,7 +11337,7 @@ function inviteLinkFor(c, token) {
11039
11337
  }
11040
11338
  var EMAIL_RE2 = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
11041
11339
  function createMembersRouter() {
11042
- const members = new Hono25();
11340
+ const members = new Hono26();
11043
11341
  members.get("/", async (c) => {
11044
11342
  const ctx = await resolveAuthContext(c);
11045
11343
  if (ctx?.role !== "admin") return c.json({ error: "admin access required" }, 403);
@@ -11262,7 +11560,7 @@ function createMembersRouter() {
11262
11560
  }
11263
11561
 
11264
11562
  // ../api/src/dashboard/notifications-routes.ts
11265
- import { Hono as Hono26 } from "hono";
11563
+ import { Hono as Hono27 } from "hono";
11266
11564
 
11267
11565
  // ../api/src/store/push-store.ts
11268
11566
  function rowToSubscription(row) {
@@ -11447,7 +11745,7 @@ function startPushWatcher() {
11447
11745
 
11448
11746
  // ../api/src/dashboard/notifications-routes.ts
11449
11747
  function createNotificationsRouter() {
11450
- const notifications = new Hono26();
11748
+ const notifications = new Hono27();
11451
11749
  notifications.get("/", async (c) => {
11452
11750
  const auth = c.get("auth");
11453
11751
  const channelIds = getProfileChannelRegistry().filter((ch) => canSeeChannel(ch, auth)).map((ch) => ch.id);
@@ -11474,7 +11772,7 @@ function createNotificationsRouter() {
11474
11772
  return notifications;
11475
11773
  }
11476
11774
  function createThreadReadRouter() {
11477
- const threads = new Hono26();
11775
+ const threads = new Hono27();
11478
11776
  threads.post("/threads/:threadId/read", async (c) => {
11479
11777
  const { userId } = c.get("auth");
11480
11778
  const threadId = c.req.param("threadId");
@@ -11498,9 +11796,9 @@ function createThreadReadRouter() {
11498
11796
  }
11499
11797
 
11500
11798
  // ../api/src/dashboard/push-routes.ts
11501
- import { Hono as Hono27 } from "hono";
11799
+ import { Hono as Hono28 } from "hono";
11502
11800
  function createPushRouter() {
11503
- const push = new Hono27();
11801
+ const push = new Hono28();
11504
11802
  push.get("/key", (c) => c.json({ publicKey: getVapidPublicKey() }));
11505
11803
  push.post("/subscribe", async (c) => {
11506
11804
  const { userId } = c.get("auth");
@@ -11531,7 +11829,7 @@ function createPushRouter() {
11531
11829
  }
11532
11830
 
11533
11831
  // ../api/src/dashboard/mcp-oauth-routes.ts
11534
- import { Hono as Hono28 } from "hono";
11832
+ import { Hono as Hono29 } from "hono";
11535
11833
  var CONNECTIONS_PAGE = "/settings/connections";
11536
11834
  function callbackUri(c) {
11537
11835
  const proto = c.req.header("x-forwarded-proto") ?? "http";
@@ -11546,7 +11844,7 @@ function backToDashboard(c, to, params) {
11546
11844
  return c.redirect(`${target.pathname}${target.search}`);
11547
11845
  }
11548
11846
  function createMcpOAuthRouter() {
11549
- const app = new Hono28();
11847
+ const app = new Hono29();
11550
11848
  app.get("/oauth/:provider/start", async (c) => {
11551
11849
  const auth = c.get("auth");
11552
11850
  if (auth.role !== "admin") return c.json({ error: "admin access required" }, 403);
@@ -11673,7 +11971,7 @@ function createMcpOAuthRouter() {
11673
11971
  }
11674
11972
 
11675
11973
  // ../api/src/dashboard/mcp-routes.ts
11676
- import { Hono as Hono29 } from "hono";
11974
+ import { Hono as Hono30 } from "hono";
11677
11975
 
11678
11976
  // ../api/src/mcp/transport.ts
11679
11977
  var KINDS = ["inherit", "npx", "local", "http", "sse"];
@@ -11803,7 +12101,7 @@ function bindingsByConnection() {
11803
12101
  return map;
11804
12102
  }
11805
12103
  function createMcpRouter() {
11806
- const app = new Hono29();
12104
+ const app = new Hono30();
11807
12105
  app.get("/providers", async (c) => {
11808
12106
  const denied = requireAdmin(c.get("auth"));
11809
12107
  if (denied) return c.json({ error: denied }, 403);
@@ -11841,8 +12139,8 @@ function createMcpRouter() {
11841
12139
  const denied = requireAdmin(auth);
11842
12140
  if (denied) return c.json({ error: denied }, 403);
11843
12141
  const body = await c.req.json().catch(() => null);
11844
- const label2 = typeof body?.label === "string" ? body.label.trim() : "";
11845
- if (!label2) return c.json({ error: "label is required" }, 400);
12142
+ const label = typeof body?.label === "string" ? body.label.trim() : "";
12143
+ if (!label) return c.json({ error: "label is required" }, 400);
11846
12144
  const slug = typeof body?.slug === "string" ? body.slug.trim() : "";
11847
12145
  if (!/^[a-z][a-z0-9_]{0,38}$/.test(slug)) {
11848
12146
  return c.json(
@@ -11859,7 +12157,7 @@ function createMcpRouter() {
11859
12157
  const created = await insertMcpConnection({
11860
12158
  workspaceId: auth.workspaceId,
11861
12159
  providerSlug: CUSTOM_PROVIDER,
11862
- label: label2,
12160
+ label,
11863
12161
  slug,
11864
12162
  serverCommand: toServerCommand(parsed.transport),
11865
12163
  createdBy: auth.userId ?? null
@@ -11881,9 +12179,9 @@ function createMcpRouter() {
11881
12179
  if (!body) return c.json({ error: "a body is required" }, 400);
11882
12180
  const patch = {};
11883
12181
  if (body.label !== void 0) {
11884
- const label2 = typeof body.label === "string" ? body.label.trim() : "";
11885
- if (!label2) return c.json({ error: "label cannot be empty" }, 400);
11886
- patch.label = label2;
12182
+ const label = typeof body.label === "string" ? body.label.trim() : "";
12183
+ if (!label) return c.json({ error: "label cannot be empty" }, 400);
12184
+ patch.label = label;
11887
12185
  }
11888
12186
  if (body.enabled !== void 0) {
11889
12187
  if (typeof body.enabled !== "boolean")
@@ -12333,9 +12631,9 @@ ${transcriptOf(data ?? [])}`
12333
12631
  }
12334
12632
 
12335
12633
  // ../api/src/dashboard/permission-routes.ts
12336
- import { Hono as Hono30 } from "hono";
12634
+ import { Hono as Hono31 } from "hono";
12337
12635
  function createPermissionRequestsRouter() {
12338
- const app = new Hono30();
12636
+ const app = new Hono31();
12339
12637
  app.post("/:id", async (c) => {
12340
12638
  const auth = c.get("auth");
12341
12639
  if (auth.role !== "admin") return c.json({ error: "only an admin can answer this" }, 403);
@@ -12365,7 +12663,7 @@ function createPermissionRequestsRouter() {
12365
12663
  }
12366
12664
 
12367
12665
  // ../api/src/dashboard/channel-greeting.ts
12368
- import { Hono as Hono31 } from "hono";
12666
+ import { Hono as Hono32 } from "hono";
12369
12667
  function eligible(ch) {
12370
12668
  return !!ch && !ch.isDefault && !ch.dmKey && !ch.agentName && !ch.archivedAt;
12371
12669
  }
@@ -12394,7 +12692,7 @@ function introOpening(channelName) {
12394
12692
  return `Welcome to #${channelName}. I'm reading this project's folder, docs, skills and automations to work out how I can help here. Below you'll find a short intro and a few first steps you can click to try.`;
12395
12693
  }
12396
12694
  function createChannelGreetingRouter(agent) {
12397
- const app = new Hono31();
12695
+ const app = new Hono32();
12398
12696
  app.get("/:id/greeting", async (c) => {
12399
12697
  const ctx = await resolveAuthContext(c);
12400
12698
  const ch = findChannelById(c.req.param("id"));
@@ -12452,7 +12750,7 @@ async function ensureIntroThread(ch) {
12452
12750
  }
12453
12751
 
12454
12752
  // ../api/src/dashboard/channel-suggest.ts
12455
- import { Hono as Hono32 } from "hono";
12753
+ import { Hono as Hono33 } from "hono";
12456
12754
  var CATEGORY_MAX_CHARS = 16;
12457
12755
  var CATEGORY_MAX_ITEMS = 30;
12458
12756
  var PROMPT_MAX_CHARS = 4e3;
@@ -12500,7 +12798,7 @@ function parseSuggestion(field, raw) {
12500
12798
  return items2.length ? items2.slice(0, CATEGORY_MAX_ITEMS).join("\n") : null;
12501
12799
  }
12502
12800
  function createChannelSuggestRouter(agent) {
12503
- const router = new Hono32();
12801
+ const router = new Hono33();
12504
12802
  router.post("/:id/suggest", async (c) => {
12505
12803
  const channel = findChannel(c.req.param("id"));
12506
12804
  if (!channel || !canSeeChannel(channel, c.get("auth"))) {
@@ -12538,10 +12836,10 @@ function createChannelSuggestRouter(agent) {
12538
12836
  }
12539
12837
 
12540
12838
  // ../api/src/dashboard/channel-destroy-routes.ts
12541
- import { Hono as Hono33 } from "hono";
12839
+ import { Hono as Hono34 } from "hono";
12542
12840
  import { DeleteObjectCommand as DeleteObjectCommand3, ListObjectsV2Command } from "@aws-sdk/client-s3";
12543
12841
  function createChannelDestroyRouter() {
12544
- const router = new Hono33();
12842
+ const router = new Hono34();
12545
12843
  const gate = async (c) => {
12546
12844
  const auth = await resolveAuthContext(c);
12547
12845
  if (!auth || auth.role !== "admin" || auth.isSupport) return null;
@@ -12634,7 +12932,7 @@ async function purgeR2(shareIds, keys) {
12634
12932
  }
12635
12933
 
12636
12934
  // ../api/src/dashboard/memories-routes.ts
12637
- import { Hono as Hono34 } from "hono";
12935
+ import { Hono as Hono35 } from "hono";
12638
12936
  async function readPatch(c) {
12639
12937
  const body = await c.req.json().catch(() => ({}));
12640
12938
  const patch = {};
@@ -12662,7 +12960,7 @@ var requireAgentMemory = async (c, next) => {
12662
12960
  await next();
12663
12961
  };
12664
12962
  function createMemoriesRouter() {
12665
- const router = new Hono34();
12963
+ const router = new Hono35();
12666
12964
  for (const path of [
12667
12965
  "/:id/memories",
12668
12966
  "/:id/memories/*",
@@ -12735,7 +13033,7 @@ function createMemoriesRouter() {
12735
13033
  return router;
12736
13034
  }
12737
13035
  function createScopedMemoriesRouter() {
12738
- const router = new Hono34();
13036
+ const router = new Hono35();
12739
13037
  router.use("*", requireAgentMemory);
12740
13038
  const workspace = (c) => ({
12741
13039
  scope: "workspace",
@@ -12795,7 +13093,7 @@ function createScopedMemoriesRouter() {
12795
13093
  }
12796
13094
 
12797
13095
  // ../api/src/dashboard/session-import-routes.ts
12798
- import { Hono as Hono35 } from "hono";
13096
+ import { Hono as Hono36 } from "hono";
12799
13097
  var MAX_FOLDERS2 = 20;
12800
13098
  var DAY_MS2 = 24 * 60 * 60 * 1e3;
12801
13099
  var IMPORT_RANGES = ["all", "7d", "latest5"];
@@ -12902,7 +13200,7 @@ async function syncSession(agent, channelId, session, author, existing) {
12902
13200
  return messages.length;
12903
13201
  }
12904
13202
  function createSessionImportRouter(agent) {
12905
- const app = new Hono35();
13203
+ const app = new Hono36();
12906
13204
  const scanFolders = async () => {
12907
13205
  const scan = await ask(agent, { op: "scan", slug: getProfile() });
12908
13206
  return scan && importableFolders(scan.folders, getProfileChannelRegistry());
@@ -13190,7 +13488,8 @@ function registerDataRoutes(api, agent = {}) {
13190
13488
  agentName: ch.agentName,
13191
13489
  dmKey: ch.dmKey,
13192
13490
  isDefault: ch.isDefault,
13193
- archived: !!ch.archivedAt
13491
+ archived: !!ch.archivedAt,
13492
+ description: ch.description
13194
13493
  }));
13195
13494
  return c.json({
13196
13495
  channels: list,
@@ -13440,6 +13739,7 @@ function registerDataRoutes(api, agent = {}) {
13440
13739
  });
13441
13740
  api.route("/", createUploadsRouter());
13442
13741
  api.route("/", createTranscribeRouter());
13742
+ api.route("/", createVoiceRouter());
13443
13743
  api.route("/", createAutocompleteRouter());
13444
13744
  api.route("/", createDailyLineRouter());
13445
13745
  api.route("/", createChannelRouteRouter());
@@ -13545,7 +13845,7 @@ function registerDataRoutes(api, agent = {}) {
13545
13845
  // ../api/src/dashboard/device-auth-routes.ts
13546
13846
  import { verify } from "crypto";
13547
13847
  import { getConnInfo } from "@hono/node-server/conninfo";
13548
- import { Hono as Hono36 } from "hono";
13848
+ import { Hono as Hono37 } from "hono";
13549
13849
  var UUID2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
13550
13850
  function cleanText(value, max) {
13551
13851
  if (typeof value !== "string") return null;
@@ -13593,7 +13893,7 @@ async function boundWorkspaceIds(publicKey, userId) {
13593
13893
  return new Set(existing ? (await listDeviceWorkspaces(existing)).map((w) => w.id) : []);
13594
13894
  }
13595
13895
  function createDeviceAuthRouter() {
13596
- const app = new Hono36();
13896
+ const app = new Hono37();
13597
13897
  app.post("/code", async (c) => {
13598
13898
  const body = await readBody(c);
13599
13899
  const publicKey = typeof body["public_key"] === "string" ? body["public_key"] : "";
@@ -13912,7 +14212,7 @@ var workspaceRef = () => ({ kind: "workspace" });
13912
14212
  var channelRef = (c) => ({ kind: "channel", channelId: c.req.param("id") });
13913
14213
 
13914
14214
  // ../api/src/dashboard/output-styles-routes.ts
13915
- import { Hono as Hono37 } from "hono";
14215
+ import { Hono as Hono38 } from "hono";
13916
14216
  function requireAdmin3(auth) {
13917
14217
  return auth?.role === "admin" ? null : "admin access required";
13918
14218
  }
@@ -13932,7 +14232,7 @@ function failure(c, err) {
13932
14232
  return c.json({ error: message }, err instanceof OutputStyleConflictError ? 409 : 500);
13933
14233
  }
13934
14234
  function createOutputStylesRouter() {
13935
- const app = new Hono37();
14235
+ const app = new Hono38();
13936
14236
  app.get("/", (c) => {
13937
14237
  const auth = c.get("auth");
13938
14238
  const denied = requireAdmin3(auth);
@@ -14024,7 +14324,7 @@ function createOutputStylesRouter() {
14024
14324
  return app;
14025
14325
  }
14026
14326
  async function handleOutputStylesRequest(req) {
14027
- const app = new Hono37();
14327
+ const app = new Hono38();
14028
14328
  app.use("*", async (c, next) => {
14029
14329
  c.set("auth", { role: "admin" });
14030
14330
  await next();
@@ -14063,7 +14363,7 @@ async function viewerProfile(c, known) {
14063
14363
  return candidates[0]?.w.slug ?? null;
14064
14364
  }
14065
14365
  function createGatedRouter(agent, register) {
14066
- const api = new Hono38();
14366
+ const api = new Hono39();
14067
14367
  api.use("*", async (c, next) => {
14068
14368
  const known = await listKnownWorkspaces();
14069
14369
  const fromHost = profileFromHost(trustedHost(c), known);
@@ -14115,7 +14415,7 @@ import sharp5 from "sharp";
14115
14415
 
14116
14416
  // src/dashboard/channels-routes.ts
14117
14417
  import { existsSync as existsSync19, mkdirSync as mkdirSync8 } from "fs";
14118
- import { Hono as Hono39 } from "hono";
14418
+ import { Hono as Hono40 } from "hono";
14119
14419
  function coerceAccess(raw) {
14120
14420
  if (raw === "open" || raw === "*" || raw === "all") return raw;
14121
14421
  if (Array.isArray(raw) && raw.every((v) => typeof v === "string")) return raw;
@@ -14183,11 +14483,12 @@ function toResponse3(channel) {
14183
14483
  agentName: channel.agentName,
14184
14484
  dmKey: channel.dmKey,
14185
14485
  isDefault: channel.isDefault,
14186
- archived: !!channel.archivedAt
14486
+ archived: !!channel.archivedAt,
14487
+ description: channel.description
14187
14488
  };
14188
14489
  }
14189
14490
  function createChannelWriteRouter() {
14190
- const app = new Hono39();
14491
+ const app = new Hono40();
14191
14492
  app.post("/", async (c) => {
14192
14493
  const body = await c.req.json().catch(() => ({}));
14193
14494
  const name = typeof body["name"] === "string" ? body["name"].trim() : "";
@@ -14297,6 +14598,11 @@ function createChannelWriteRouter() {
14297
14598
  if (r) patch.runtime = r;
14298
14599
  }
14299
14600
  if ("mounts" in body) patch.mounts = coerceMounts(body["mounts"]);
14601
+ if ("description" in body) {
14602
+ const d = normaliseChannelDescription(body["description"]);
14603
+ if (d === "invalid") return c.json({ error: "description must be text of at most 1000 characters" }, 400);
14604
+ patch.description = d;
14605
+ }
14300
14606
  if ("permissionMode" in body) patch.permissionMode = coercePermissionMode(body["permissionMode"]);
14301
14607
  if (typeof body["archived"] === "boolean") {
14302
14608
  patch.archivedAt = body["archived"] ? (/* @__PURE__ */ new Date()).toISOString() : null;
@@ -14316,7 +14622,7 @@ function createChannelWriteRouter() {
14316
14622
  // src/dashboard/skills-routes-host.ts
14317
14623
  import { existsSync as existsSync20, statSync as statSync4 } from "fs";
14318
14624
  import { dirname as dirname7 } from "path";
14319
- import { Hono as Hono40 } from "hono";
14625
+ import { Hono as Hono41 } from "hono";
14320
14626
  function workspaceScope() {
14321
14627
  const claudeConfigDir = profileClaudeConfigDir();
14322
14628
  const cwd = defaultClaudeCwd();
@@ -14422,12 +14728,12 @@ var diskBackend = {
14422
14728
  write: writeSkillAndSync
14423
14729
  };
14424
14730
  function createWorkspaceSkillsRouter() {
14425
- const app = new Hono40();
14731
+ const app = new Hono41();
14426
14732
  mountSkillRoutes(app, "/skills", workspaceRef, diskBackend);
14427
14733
  return app;
14428
14734
  }
14429
14735
  function createChannelSkillsRouter() {
14430
- const app = new Hono40();
14736
+ const app = new Hono41();
14431
14737
  mountSkillRoutes(app, "/:id/skill-files", channelRef, diskBackend);
14432
14738
  return app;
14433
14739
  }
@@ -14491,21 +14797,21 @@ function claudeAuthAvailable() {
14491
14797
  }
14492
14798
  }
14493
14799
  function probe2(runner) {
14494
- const label2 = PROVIDER_LABELS[runner];
14800
+ const label = PROVIDER_LABELS[runner];
14495
14801
  const bin = runner === "codex" ? "codex" : "claude";
14496
14802
  if (!binaryOnPath(bin)) {
14497
- return { runner, label: label2, connected: false, reason: `The ${bin} CLI isn't on this machine's PATH.` };
14803
+ return { runner, label, connected: false, reason: `The ${bin} CLI isn't on this machine's PATH.` };
14498
14804
  }
14499
14805
  const signedIn = runner === "codex" ? codexAuthAvailable() : claudeAuthAvailable();
14500
14806
  if (!signedIn) {
14501
14807
  return {
14502
14808
  runner,
14503
- label: label2,
14809
+ label,
14504
14810
  connected: false,
14505
- reason: `${label2} is installed but signed out. Use Sign in below.`
14811
+ reason: `${label} is installed but signed out. Use Sign in below.`
14506
14812
  };
14507
14813
  }
14508
- return { runner, label: label2, connected: true, account: runner === "codex" ? codexAccount() : claudeAccount() };
14814
+ return { runner, label, connected: true, account: runner === "codex" ? codexAccount() : claudeAccount() };
14509
14815
  }
14510
14816
  function claudeAccount() {
14511
14817
  const token = profileOauthToken();
@@ -14557,9 +14863,9 @@ function providerStatuses() {
14557
14863
  import { spawn as spawn4 } from "child_process";
14558
14864
  import { randomUUID as randomUUID4 } from "crypto";
14559
14865
  import { chmodSync, existsSync as existsSync22, mkdirSync as mkdirSync9, readFileSync as readFileSync16, writeFileSync as writeFileSync8 } from "fs";
14560
- import { createRequire } from "module";
14866
+ import { createRequire as createRequire2 } from "module";
14561
14867
  import { dirname as dirname8, join as join14 } from "path";
14562
- import { Hono as Hono41 } from "hono";
14868
+ import { Hono as Hono42 } from "hono";
14563
14869
  var SESSION_TTL_MS = 10 * 6e4;
14564
14870
  var URL_WAIT_MS = 3e4;
14565
14871
  var TOKEN_WAIT_MS = 6e4;
@@ -14620,7 +14926,7 @@ function waitFor(s, parse, ms) {
14620
14926
  });
14621
14927
  }
14622
14928
  function loadPty() {
14623
- const require2 = createRequire(import.meta.url);
14929
+ const require2 = createRequire2(import.meta.url);
14624
14930
  const root = dirname8(require2.resolve("node-pty/package.json"));
14625
14931
  const helper = join14(root, "prebuilds", `${process.platform}-${process.arch}`, "spawn-helper");
14626
14932
  try {
@@ -14718,7 +15024,7 @@ function failure2(c, err) {
14718
15024
  return c.json({ error: err.message }, 500);
14719
15025
  }
14720
15026
  function createProviderLoginRouter() {
14721
- const app = new Hono41();
15027
+ const app = new Hono42();
14722
15028
  app.use("*", async (c, next) => {
14723
15029
  const denied = requireAdmin4(c.get("auth"));
14724
15030
  if (denied) return c.json({ error: denied }, 403);
@@ -14762,7 +15068,7 @@ function createProviderLoginRouter() {
14762
15068
  return app;
14763
15069
  }
14764
15070
  async function handleProviderLoginRequest(req) {
14765
- const app = new Hono41();
15071
+ const app = new Hono42();
14766
15072
  app.use("*", async (c, next) => {
14767
15073
  c.set("auth", { role: "admin" });
14768
15074
  await next();
@@ -15166,13 +15472,13 @@ function handleSessionImportRequest(req) {
15166
15472
  }
15167
15473
 
15168
15474
  // src/dashboard/docs-relay-host.ts
15169
- import { Hono as Hono42 } from "hono";
15475
+ import { Hono as Hono43 } from "hono";
15170
15476
  var RETURNED_HEADERS = ["content-type", "content-disposition", "content-security-policy", "cache-control"];
15171
15477
  async function handleDocsRequest(req) {
15172
15478
  return runRelayed(req, (app) => app.route("/channels", createDocsRouter({ gate: async (_c, next) => next() })));
15173
15479
  }
15174
15480
  async function runRelayed(req, register) {
15175
- const app = new Hono42();
15481
+ const app = new Hono43();
15176
15482
  app.use("*", async (c, next) => {
15177
15483
  c.set("auth", req.auth);
15178
15484
  await next();
@@ -15317,6 +15623,7 @@ function localAgentCallbacks(chatAgent) {
15317
15623
  cancelAgentRun: (threadId) => chatAgent.cancel(threadId),
15318
15624
  regenerateAgentRun: (threadId, stoppedReplyId) => chatAgent.regenerate(threadId, stoppedReplyId),
15319
15625
  listAgentRuns: () => chatAgent.runningThreadIds(),
15626
+ listBackgroundThreads: () => chatAgent.backgroundThreadIds(),
15320
15627
  wakeAgentRun: (threadId, replyId, text) => chatAgent.wake(threadId, replyId, text),
15321
15628
  completeMemoryExtraction: (req) => chatAgent.completeMemoryExtraction(req),
15322
15629
  suggestChannelField: (req) => suggestChannelField(req),
@@ -15558,7 +15865,7 @@ import { join as join17 } from "path";
15558
15865
  import { serveStatic } from "@hono/node-server/serve-static";
15559
15866
 
15560
15867
  // ../api/src/dashboard/app-icon-routes.ts
15561
- import { Hono as Hono43 } from "hono";
15868
+ import { Hono as Hono44 } from "hono";
15562
15869
  var MANIFEST = {
15563
15870
  id: "/",
15564
15871
  name: "Flyspace",
@@ -15592,7 +15899,7 @@ async function resolvedProfileHost(c) {
15592
15899
  return profileFromHost(trustedHost(c), known);
15593
15900
  }
15594
15901
  function createAppIconRouter() {
15595
- const app = new Hono43();
15902
+ const app = new Hono44();
15596
15903
  app.get("/manifest.json", (c) => c.json(MANIFEST));
15597
15904
  app.get("/icons/app/:profile/:file", async (c) => {
15598
15905
  const profile = c.req.param("profile");
@@ -15968,7 +16275,7 @@ async function runDashboard(args) {
15968
16275
 
15969
16276
  // src/commands/workspace.ts
15970
16277
  import { existsSync as existsSync28, mkdirSync as mkdirSync12, writeFileSync as writeFileSync9 } from "fs";
15971
- var USAGE7 = `
16278
+ var USAGE6 = `
15972
16279
  Usage: flyspace workspace <subcommand> [options]
15973
16280
 
15974
16281
  Subcommands:
@@ -15985,7 +16292,7 @@ var USAGE7 = `
15985
16292
  --no-invite Never send an invite email. Fails if the admin
15986
16293
  has no existing account.
15987
16294
  `;
15988
- function getArg5(args, flag) {
16295
+ function getArg4(args, flag) {
15989
16296
  const idx = args.indexOf(flag);
15990
16297
  return idx !== -1 && idx + 1 < args.length ? args[idx + 1] : void 0;
15991
16298
  }
@@ -16086,10 +16393,10 @@ async function provisionChannels(specs) {
16086
16393
  async function handleCreate(args) {
16087
16394
  const slug = args[0];
16088
16395
  if (!slug || slug.startsWith("-")) fail2("Usage: flyspace workspace create <slug> --admin-email <email>");
16089
- const adminEmail = getArg5(args, "--admin-email");
16396
+ const adminEmail = getArg4(args, "--admin-email");
16090
16397
  if (!adminEmail?.includes("@")) fail2("--admin-email is required and must be an email address");
16091
- const botName = getArg5(args, "--bot-name") ?? slug;
16092
- const baseDomain = getArg5(args, "--base-domain") ?? "flyspace.ai";
16398
+ const botName = getArg4(args, "--bot-name") ?? slug;
16399
+ const baseDomain = getArg4(args, "--base-domain") ?? "flyspace.ai";
16093
16400
  const allowInvite = !args.includes("--no-invite");
16094
16401
  const channels = getAllArgs(args, "--channel").map(parseChannelSpec);
16095
16402
  loadEnvFiles();
@@ -16112,13 +16419,13 @@ async function runWorkspaceCmd(args) {
16112
16419
  await handleCreate(args.slice(1));
16113
16420
  break;
16114
16421
  default:
16115
- console.log(USAGE7);
16422
+ console.log(USAGE6);
16116
16423
  process.exit(args[0] ? 1 : 0);
16117
16424
  }
16118
16425
  }
16119
16426
 
16120
16427
  // src/commands/reconcile.ts
16121
- var USAGE8 = `
16428
+ var USAGE7 = `
16122
16429
  Usage: flyspace reconcile [<workspace> | --all]
16123
16430
 
16124
16431
  Repair a workspace's local filesystem state (profile dir, config.env,
@@ -16138,7 +16445,7 @@ function printLog(name, log5) {
16138
16445
  }
16139
16446
  async function runReconcileCmd(args) {
16140
16447
  if (args.includes("-h") || args.includes("--help")) {
16141
- console.log(USAGE8);
16448
+ console.log(USAGE7);
16142
16449
  return;
16143
16450
  }
16144
16451
  loadEnvFiles();
@@ -16156,11 +16463,11 @@ async function runReconcileCmd(args) {
16156
16463
  import { spawnSync as spawnSync2 } from "child_process";
16157
16464
  var SCRIPT_SH = "https://flyspace.ai/install-desktop.sh";
16158
16465
  var SCRIPT_PS1 = "https://flyspace.ai/install-desktop.ps1";
16159
- var USAGE9 = "Usage: flyspace desktop install [--dev]";
16466
+ var USAGE8 = "Usage: flyspace desktop install [--dev]";
16160
16467
  async function runDesktopCmd(args) {
16161
16468
  const [sub, ...rest] = args;
16162
16469
  if (sub !== "install" || rest.some((a) => a !== "--dev")) {
16163
- printRaw(USAGE9);
16470
+ printRaw(USAGE8);
16164
16471
  process.exit(1);
16165
16472
  }
16166
16473
  const dev = rest.includes("--dev");
@@ -16186,7 +16493,7 @@ if (home) {
16186
16493
  if (!path.split(":").includes(bin)) process.env.PATH = path ? `${bin}:${path}` : bin;
16187
16494
  }
16188
16495
  var XERO_USAGE = false ? " xero Connect to Xero and expose it as an MCP server\n" : "";
16189
- var USAGE10 = `
16496
+ var USAGE9 = `
16190
16497
  Usage: flyspace <command> [options]
16191
16498
 
16192
16499
  Commands:
@@ -16346,12 +16653,12 @@ async function main() {
16346
16653
  break;
16347
16654
  case "-v":
16348
16655
  case "--version":
16349
- printRaw("0.1.66");
16656
+ printRaw("0.1.67");
16350
16657
  break;
16351
16658
  case "-h":
16352
16659
  case "--help":
16353
16660
  case void 0:
16354
- printRaw(USAGE10);
16661
+ printRaw(USAGE9);
16355
16662
  break;
16356
16663
  case "xero":
16357
16664
  if (false) {
@@ -16362,7 +16669,7 @@ async function main() {
16362
16669
  // falls through
16363
16670
  default:
16364
16671
  printRaw(`Unknown command: ${command}`);
16365
- printRaw(USAGE10);
16672
+ printRaw(USAGE9);
16366
16673
  process.exit(1);
16367
16674
  }
16368
16675
  }