flyspace-cli 0.1.52 → 0.1.53

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.
@@ -10390,7 +10390,7 @@ var require_ms = __commonJS({
10390
10390
  options = options || {};
10391
10391
  var type = typeof val;
10392
10392
  if (type === "string" && val.length > 0) {
10393
- return parse(val);
10393
+ return parse2(val);
10394
10394
  } else if (type === "number" && isFinite(val)) {
10395
10395
  return options.long ? fmtLong(val) : fmtShort(val);
10396
10396
  }
@@ -10398,7 +10398,7 @@ var require_ms = __commonJS({
10398
10398
  "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
10399
10399
  );
10400
10400
  };
10401
- function parse(str) {
10401
+ function parse2(str) {
10402
10402
  str = String(str);
10403
10403
  if (str.length > 100) {
10404
10404
  return;
@@ -12978,10 +12978,10 @@ var require_axios = __commonJS({
12978
12978
  }
12979
12979
  };
12980
12980
  var CanceledError$1 = CanceledError;
12981
- function settle(resolve8, reject, response) {
12981
+ function settle(resolve9, reject, response) {
12982
12982
  const validateStatus = response.config.validateStatus;
12983
12983
  if (!response.status || !validateStatus || validateStatus(response.status)) {
12984
- resolve8(response);
12984
+ resolve9(response);
12985
12985
  } else {
12986
12986
  reject(
12987
12987
  new AxiosError$1(
@@ -13573,7 +13573,7 @@ var require_axios = __commonJS({
13573
13573
  }
13574
13574
  var isHttpAdapterSupported = typeof process !== "undefined" && utils$1.kindOf(process) === "process";
13575
13575
  var wrapAsync = (asyncExecutor) => {
13576
- return new Promise((resolve8, reject) => {
13576
+ return new Promise((resolve9, reject) => {
13577
13577
  let onDone;
13578
13578
  let isDone;
13579
13579
  const done = (value, isRejected) => {
@@ -13583,7 +13583,7 @@ var require_axios = __commonJS({
13583
13583
  };
13584
13584
  const _resolve = (value) => {
13585
13585
  done(value);
13586
- resolve8(value);
13586
+ resolve9(value);
13587
13587
  };
13588
13588
  const _reject = (reason) => {
13589
13589
  done(reason, true);
@@ -13630,7 +13630,7 @@ var require_axios = __commonJS({
13630
13630
  }
13631
13631
  };
13632
13632
  var httpAdapter = isHttpAdapterSupported && function httpAdapter2(config) {
13633
- return wrapAsync(async function dispatchHttpRequest(resolve8, reject, onDone) {
13633
+ return wrapAsync(async function dispatchHttpRequest(resolve9, reject, onDone) {
13634
13634
  let { data, lookup: lookup2, family, httpVersion = 1, http2Options } = config;
13635
13635
  const { responseType, responseEncoding } = config;
13636
13636
  const method = config.method.toUpperCase();
@@ -13720,7 +13720,7 @@ var require_axios = __commonJS({
13720
13720
  }
13721
13721
  let convertedData;
13722
13722
  if (method !== "GET") {
13723
- return settle(resolve8, reject, {
13723
+ return settle(resolve9, reject, {
13724
13724
  status: 405,
13725
13725
  statusText: "method not allowed",
13726
13726
  headers: {},
@@ -13742,7 +13742,7 @@ var require_axios = __commonJS({
13742
13742
  } else if (responseType === "stream") {
13743
13743
  convertedData = stream__default["default"].Readable.from(convertedData);
13744
13744
  }
13745
- return settle(resolve8, reject, {
13745
+ return settle(resolve9, reject, {
13746
13746
  data: convertedData,
13747
13747
  status: 200,
13748
13748
  statusText: "OK",
@@ -13983,7 +13983,7 @@ var require_axios = __commonJS({
13983
13983
  };
13984
13984
  if (responseType === "stream") {
13985
13985
  response.data = responseStream;
13986
- settle(resolve8, reject, response);
13986
+ settle(resolve9, reject, response);
13987
13987
  } else {
13988
13988
  const responseBuffer = [];
13989
13989
  let totalResponseBytes = 0;
@@ -14033,7 +14033,7 @@ var require_axios = __commonJS({
14033
14033
  } catch (err) {
14034
14034
  return reject(AxiosError$1.from(err, null, config, response.request, response));
14035
14035
  }
14036
- settle(resolve8, reject, response);
14036
+ settle(resolve9, reject, response);
14037
14037
  });
14038
14038
  }
14039
14039
  abortEmitter.once("abort", (err) => {
@@ -14283,7 +14283,7 @@ var require_axios = __commonJS({
14283
14283
  };
14284
14284
  var isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
14285
14285
  var xhrAdapter = isXHRAdapterSupported && function(config) {
14286
- return new Promise(function dispatchXhrRequest(resolve8, reject) {
14286
+ return new Promise(function dispatchXhrRequest(resolve9, reject) {
14287
14287
  const _config = resolveConfig(config);
14288
14288
  let requestData = _config.data;
14289
14289
  const requestHeaders = AxiosHeaders$1.from(_config.headers).normalize();
@@ -14318,7 +14318,7 @@ var require_axios = __commonJS({
14318
14318
  };
14319
14319
  settle(
14320
14320
  function _resolve(value) {
14321
- resolve8(value);
14321
+ resolve9(value);
14322
14322
  done();
14323
14323
  },
14324
14324
  function _reject(err) {
@@ -14710,8 +14710,8 @@ var require_axios = __commonJS({
14710
14710
  config
14711
14711
  );
14712
14712
  !isStreamResponse && unsubscribe && unsubscribe();
14713
- return await new Promise((resolve8, reject) => {
14714
- settle(resolve8, reject, {
14713
+ return await new Promise((resolve9, reject) => {
14714
+ settle(resolve9, reject, {
14715
14715
  data: responseData,
14716
14716
  headers: AxiosHeaders$1.from(response.headers),
14717
14717
  status: response.status,
@@ -15115,8 +15115,8 @@ var require_axios = __commonJS({
15115
15115
  throw new TypeError("executor must be a function.");
15116
15116
  }
15117
15117
  let resolvePromise;
15118
- this.promise = new Promise(function promiseExecutor(resolve8) {
15119
- resolvePromise = resolve8;
15118
+ this.promise = new Promise(function promiseExecutor(resolve9) {
15119
+ resolvePromise = resolve9;
15120
15120
  });
15121
15121
  const token = this;
15122
15122
  this.promise.then((cancel) => {
@@ -15129,9 +15129,9 @@ var require_axios = __commonJS({
15129
15129
  });
15130
15130
  this.promise.then = (onfulfilled) => {
15131
15131
  let _resolve;
15132
- const promise = new Promise((resolve8) => {
15133
- token.subscribe(resolve8);
15134
- _resolve = resolve8;
15132
+ const promise = new Promise((resolve9) => {
15133
+ token.subscribe(resolve9);
15134
+ _resolve = resolve9;
15135
15135
  }).then(onfulfilled);
15136
15136
  promise.cancel = function reject() {
15137
15137
  token.unsubscribe(_resolve);
@@ -17417,7 +17417,7 @@ var require_MsEdgeTTS = __commonJS({
17417
17417
  };
17418
17418
  const ws = this._ws = this._isBrowser ? new isomorphic_ws_1.default(synthUrl) : new isomorphic_ws_1.default(synthUrl, { ...options, agent: this._agent });
17419
17419
  ws.binaryType = "arraybuffer";
17420
- return new Promise((resolve8, reject) => {
17420
+ return new Promise((resolve9, reject) => {
17421
17421
  let connecting = true;
17422
17422
  const connectionTimeout = this._connectionTimeoutMs ? setTimeout(() => {
17423
17423
  connecting = false;
@@ -17460,7 +17460,7 @@ Path:${messageTypes.SPEECH_CONFIG}${_MsEdgeTTS.JSON_XML_DELIM}
17460
17460
  }
17461
17461
  }
17462
17462
  }
17463
- `, void 0, ws).then(resolve8, (error) => {
17463
+ `, void 0, ws).then(resolve9, (error) => {
17464
17464
  this._closeSocket(ws);
17465
17465
  reject(error);
17466
17466
  });
@@ -17602,12 +17602,12 @@ Path:${messageTypes.SPEECH_CONFIG}${_MsEdgeTTS.JSON_XML_DELIM}
17602
17602
  this._log("<-", message);
17603
17603
  return;
17604
17604
  }
17605
- await new Promise((resolve8, reject) => {
17605
+ await new Promise((resolve9, reject) => {
17606
17606
  socket.send(message, (error) => {
17607
17607
  if (error)
17608
17608
  return reject(error);
17609
17609
  this._log("<-", message);
17610
- resolve8();
17610
+ resolve9();
17611
17611
  });
17612
17612
  });
17613
17613
  }
@@ -17643,8 +17643,8 @@ Path:${messageTypes.SPEECH_CONFIG}${_MsEdgeTTS.JSON_XML_DELIM}
17643
17643
  * These, however, are not all. The complete list of voices supported by this module [can be found here](https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/language-support) (neural, standard, and preview).
17644
17644
  */
17645
17645
  getVoices() {
17646
- return new Promise((resolve8, reject) => {
17647
- axios_1.default.get(_MsEdgeTTS.VOICES_URL).then((res) => resolve8(res.data)).catch(reject);
17646
+ return new Promise((resolve9, reject) => {
17647
+ axios_1.default.get(_MsEdgeTTS.VOICES_URL).then((res) => resolve9(res.data)).catch(reject);
17648
17648
  });
17649
17649
  }
17650
17650
  /**
@@ -17747,7 +17747,7 @@ Path:${messageTypes.SPEECH_CONFIG}${_MsEdgeTTS.JSON_XML_DELIM}
17747
17747
  const metadataFilePath = !!metadataStream ? (0, utils_1.joinPath)(dirPath, "metadata.json") : null;
17748
17748
  try {
17749
17749
  await Promise.all([
17750
- new Promise((resolve8, reject) => {
17750
+ new Promise((resolve9, reject) => {
17751
17751
  const writableAudioFile = audioStream.pipe(fs.createWriteStream(audioFilePath));
17752
17752
  audioStream.once("error", (e) => {
17753
17753
  writableAudioFile.destroy();
@@ -17755,7 +17755,7 @@ Path:${messageTypes.SPEECH_CONFIG}${_MsEdgeTTS.JSON_XML_DELIM}
17755
17755
  });
17756
17756
  writableAudioFile.once("close", async () => {
17757
17757
  if (writableAudioFile.bytesWritten > 0) {
17758
- resolve8(audioFilePath);
17758
+ resolve9(audioFilePath);
17759
17759
  } else {
17760
17760
  reject(new Error("No audio data received"));
17761
17761
  fs.rmSync(audioFilePath, { force: true });
@@ -17763,9 +17763,9 @@ Path:${messageTypes.SPEECH_CONFIG}${_MsEdgeTTS.JSON_XML_DELIM}
17763
17763
  });
17764
17764
  writableAudioFile.once("error", reject);
17765
17765
  }),
17766
- new Promise((resolve8, reject) => {
17766
+ new Promise((resolve9, reject) => {
17767
17767
  if (!metadataFilePath) {
17768
- return resolve8(null);
17768
+ return resolve9(null);
17769
17769
  }
17770
17770
  const metadataItems = { Metadata: [] };
17771
17771
  metadataStream.on("data", (chunk) => {
@@ -17775,7 +17775,7 @@ Path:${messageTypes.SPEECH_CONFIG}${_MsEdgeTTS.JSON_XML_DELIM}
17775
17775
  metadataStream.once("close", () => {
17776
17776
  if (metadataItems.Metadata.length > 0) {
17777
17777
  fs.writeFileSync(metadataFilePath, JSON.stringify(metadataItems, null, 2));
17778
- resolve8(metadataFilePath);
17778
+ resolve9(metadataFilePath);
17779
17779
  } else {
17780
17780
  reject(new Error("No metadata received"));
17781
17781
  fs.rmSync(metadataFilePath, { force: true });
@@ -18121,6 +18121,7 @@ function stopAutomationRegistryPolling() {
18121
18121
  }
18122
18122
 
18123
18123
  // ../api/src/channels.ts
18124
+ import { createHash } from "crypto";
18124
18125
  import { existsSync as existsSync2, mkdirSync, realpathSync, statSync } from "fs";
18125
18126
  import { homedir } from "os";
18126
18127
  import { isAbsolute, relative, resolve as resolve2, sep } from "path";
@@ -18310,8 +18311,15 @@ function findChannelById(id) {
18310
18311
  function findChannelByExternalId(externalId) {
18311
18312
  return byExternalId.get(externalId);
18312
18313
  }
18313
- function findChannelByAgentName(agentName) {
18314
- return getProfileChannelRegistry().find((c) => c.agentName === agentName);
18314
+ function agentDmKey(agentName, userId) {
18315
+ return `agent:${agentName}:${userId}`;
18316
+ }
18317
+ function dmCwd(dmKey, profile = getProfile()) {
18318
+ return `${profile}/dm-${createHash("sha256").update(dmKey).digest("hex").slice(0, 24)}`;
18319
+ }
18320
+ function findChannelByAgentName(agentName, userId) {
18321
+ const dmKey = agentDmKey(agentName, userId);
18322
+ return getProfileChannelRegistry().find((c) => c.agentName === agentName && c.dmKey === dmKey);
18315
18323
  }
18316
18324
  function findChannel(ref) {
18317
18325
  if (!ref) return void 0;
@@ -18577,28 +18585,24 @@ async function ensureChannelProvisioned(externalChannelId, opts = {}) {
18577
18585
  throw err;
18578
18586
  }
18579
18587
  }
18580
- async function upsertChannelByAgentName(input) {
18581
- const { data, error } = await getSupabaseClient().from("channels").upsert(
18582
- { ...toRow(input), profile: getProfile(), updated_at: (/* @__PURE__ */ new Date()).toISOString() },
18583
- { onConflict: "profile,agent_name" }
18584
- ).select().single();
18585
- if (error) throw new Error(error.message);
18586
- if (data.profile !== getProfile()) {
18587
- throw new Error(`agent DM upsert for ${input.agentName} resolved to another workspace's channel`);
18588
+ async function ensureAgentDmChannel(agentName, viewer, opts) {
18589
+ const existing = findChannelByAgentName(agentName, viewer.userId);
18590
+ if (existing) {
18591
+ return existing.name === opts.name ? existing : updateChannelById(existing.id, { name: opts.name });
18588
18592
  }
18589
- await refreshChannelRegistry();
18590
- return rowToChannel(data);
18591
- }
18592
- async function ensureAgentDmChannel(agentName, opts) {
18593
+ const dmKey = agentDmKey(agentName, viewer.userId);
18593
18594
  try {
18594
- return await upsertChannelByAgentName({
18595
+ return await createChannel({
18595
18596
  name: opts.name,
18596
- cwd: opts.cwd,
18597
- agentName
18597
+ cwd: dmCwd(dmKey),
18598
+ visibility: "private",
18599
+ memberEmails: [viewer.email],
18600
+ agentName,
18601
+ dmKey
18598
18602
  });
18599
18603
  } catch (err) {
18600
18604
  await refreshChannelRegistry();
18601
- const raced = findChannelByAgentName(agentName);
18605
+ const raced = findChannelByAgentName(agentName, viewer.userId);
18602
18606
  if (raced) return raced;
18603
18607
  throw err;
18604
18608
  }
@@ -18629,7 +18633,9 @@ async function ensureMemberDmChannel(a, b) {
18629
18633
  try {
18630
18634
  return await createChannel({
18631
18635
  name: `${a.handle}, ${b.handle}`,
18632
- cwd: `${getProfile()}/dm-${dmKey.replace(/[^a-z0-9]/gi, "").slice(0, 24)}`,
18636
+ // Hash the whole key: a prefix of the sorted ids is just the first user's
18637
+ // id, which put every DM that user sorts first in into one shared folder.
18638
+ cwd: dmCwd(dmKey),
18633
18639
  visibility: "private",
18634
18640
  memberEmails: [a.email, b.email],
18635
18641
  dmKey
@@ -18835,7 +18841,7 @@ function modelLabel(value) {
18835
18841
 
18836
18842
  // src/claude/container.ts
18837
18843
  import { execFileSync } from "child_process";
18838
- import { createHash } from "crypto";
18844
+ import { createHash as createHash2 } from "crypto";
18839
18845
  import { existsSync as existsSync4, mkdirSync as mkdirSync3 } from "fs";
18840
18846
  import { join as join2 } from "path";
18841
18847
 
@@ -18934,7 +18940,7 @@ function memoryLimit() {
18934
18940
  return process.env["FLYSPACE_AGENT_MEMORY"]?.trim() || "2g";
18935
18941
  }
18936
18942
  function containerHomeFor(cwd) {
18937
- const digest = createHash("sha256").update(cwd).digest("hex").slice(0, 12);
18943
+ const digest = createHash2("sha256").update(cwd).digest("hex").slice(0, 12);
18938
18944
  const label = (cwd.split("/").pop() || "channel").replace(/[^a-zA-Z0-9._-]/g, "-").slice(0, 32);
18939
18945
  return join2(paths.CONTAINER_HOMES_DIR, `${label}-${digest}`);
18940
18946
  }
@@ -19055,14 +19061,14 @@ function userFlags() {
19055
19061
 
19056
19062
  // src/claude/sandbox.ts
19057
19063
  import { execFileSync as execFileSync2 } from "child_process";
19058
- import { createHash as createHash2 } from "crypto";
19064
+ import { createHash as createHash3 } from "crypto";
19059
19065
  import { existsSync as existsSync5, mkdirSync as mkdirSync4, writeFileSync } from "fs";
19060
19066
  import { join as join3 } from "path";
19061
19067
  function sandboxRuntimeEntrypoint() {
19062
19068
  return join3(paths.PACKAGE_ROOT, "node_modules/@anthropic-ai/sandbox-runtime/dist/cli.js");
19063
19069
  }
19064
19070
  function sandboxHomeFor(cwd) {
19065
- const digest = createHash2("sha256").update(cwd).digest("hex").slice(0, 12);
19071
+ const digest = createHash3("sha256").update(cwd).digest("hex").slice(0, 12);
19066
19072
  const label = (cwd.split("/").pop() || "channel").replace(/[^a-zA-Z0-9._-]/g, "-").slice(0, 32);
19067
19073
  return join3(paths.SANDBOX_HOMES_DIR, `${label}-${digest}`);
19068
19074
  }
@@ -19889,7 +19895,7 @@ function pinnedClaudeConfigDir(dir) {
19889
19895
  return resolvePath(dir.replace(/^~(?=\/|$)/, homedir3())) === resolvePath(homedir3(), ".claude") ? void 0 : dir;
19890
19896
  }
19891
19897
  function runCli(prompt, cwd, botName, options, claudeConfigDir, resumeSessionId, claudeCodeOauthToken) {
19892
- return new Promise((resolve8, reject) => {
19898
+ return new Promise((resolve9, reject) => {
19893
19899
  const isolated = options.runtime === "container" || options.runtime === "sandbox";
19894
19900
  const args = buildArgs(
19895
19901
  prompt,
@@ -20055,7 +20061,7 @@ function runCli(prompt, cwd, botName, options, claudeConfigDir, resumeSessionId,
20055
20061
  console.log(`[agent] stderr: ${stderr.trim()}`);
20056
20062
  }
20057
20063
  if (cancelled) {
20058
- resolve8({
20064
+ resolve9({
20059
20065
  sessionId: liveSessionId ?? resumeSessionId ?? "",
20060
20066
  text: "",
20061
20067
  isCancelled: true
@@ -20064,7 +20070,7 @@ function runCli(prompt, cwd, botName, options, claudeConfigDir, resumeSessionId,
20064
20070
  }
20065
20071
  if (timedOut) {
20066
20072
  const text = timeoutKind === "wall-clock" && streaming ? `This task ran for over ${Math.round(maxDurationMs / 6e4)} minutes in total, so I was terminated as a runaway backstop. I was still making progress \u2014 the task is just too big for one turn. Consider splitting it into smaller steps, or continue and I'll pick up where I left off.` : `I got stuck for over ${Math.round((timeoutKind === "idle" ? idleTimeoutMs : maxDurationMs) / 6e4)} minutes with no activity and had to be terminated. Most likely cause: a Bash tool call to a long-running process (dev server, watcher, \`tail -f\`, etc.) that never exits. If you wanted to start a server, ask me to run it in the background (\`nohup ... > /tmp/log 2>&1 & disown\`) and I'll come back with the PID.`;
20067
- resolve8({
20073
+ resolve9({
20068
20074
  sessionId: liveSessionId ?? resumeSessionId ?? "",
20069
20075
  text,
20070
20076
  isError: true,
@@ -20102,7 +20108,7 @@ function runCli(prompt, cwd, botName, options, claudeConfigDir, resumeSessionId,
20102
20108
  !!claudeCodeOauthToken
20103
20109
  );
20104
20110
  recordUsage2(response, options);
20105
- resolve8(
20111
+ resolve9(
20106
20112
  response.isError ? {
20107
20113
  ...response,
20108
20114
  failure: {
@@ -20116,7 +20122,7 @@ function runCli(prompt, cwd, botName, options, claudeConfigDir, resumeSessionId,
20116
20122
  );
20117
20123
  } catch {
20118
20124
  const fallback = onLine ? "" : stdout.trim();
20119
- resolve8({ sessionId: resumeSessionId ?? "", text: fallback || "No response" });
20125
+ resolve9({ sessionId: resumeSessionId ?? "", text: fallback || "No response" });
20120
20126
  }
20121
20127
  });
20122
20128
  });
@@ -20197,7 +20203,7 @@ var featureFlags = {
20197
20203
  "ai-cost": {
20198
20204
  title: "AI cost",
20199
20205
  description: "Shows admins what the agent has spent: a Cost section in a channel's AI overview and a per-thread cost in the thread menu. Estimated at API list rates, so on a Claude subscription it will not match your bill.",
20200
- stage: "beta"
20206
+ stage: "setting"
20201
20207
  },
20202
20208
  "session-retro": {
20203
20209
  title: "Session retro",
@@ -20212,7 +20218,7 @@ var featureFlags = {
20212
20218
  excalidraw: {
20213
20219
  title: "Excalidraw",
20214
20220
  description: "Create and edit whiteboard drawings (.excalidraw files) in the Docs pane. Existing drawings stay viewable with this off.",
20215
- stage: "beta"
20221
+ stage: "ga"
20216
20222
  },
20217
20223
  sandbox: {
20218
20224
  title: "Sandbox runtime",
@@ -20222,7 +20228,7 @@ var featureFlags = {
20222
20228
  dictation: {
20223
20229
  title: "Dictation",
20224
20230
  description: "A mic button in the message composer that turns speech into text as you talk. Each phrase uses speech-to-text.",
20225
- stage: "beta"
20231
+ stage: "setting"
20226
20232
  },
20227
20233
  "agent-memory": {
20228
20234
  title: "Agent memory",
@@ -20237,11 +20243,26 @@ var featureFlags = {
20237
20243
  autocomplete: {
20238
20244
  title: "Autocomplete",
20239
20245
  description: "Gray inline suggestions in the message composer that continue what you are typing, based on the channel. Press Tab to accept, Esc to dismiss. Your draft is sent to an AI model.",
20240
- stage: "beta"
20246
+ stage: "setting"
20247
+ },
20248
+ "auto-channel": {
20249
+ title: "Auto channel",
20250
+ description: "New question picks the channel for you: an AI model reads your message and the channel list, and posts it where it belongs. You can still pick a channel yourself.",
20251
+ stage: "setting"
20241
20252
  },
20242
20253
  languages: {
20243
20254
  title: "Languages",
20244
20255
  description: "Pick the interface language in your user settings (13 languages, machine translated). Off: the interface is always English.",
20256
+ stage: "ga"
20257
+ },
20258
+ "continuous-chat": {
20259
+ title: "Continuous chat",
20260
+ description: "Read a direct message as one continuous chat instead of a list of threads: a new session starts each day (4am) or with /new, and each message is tagged with a topic so the Threads view (View menu) groups the DM by topic. Your DM messages are sent to an AI model for tagging.",
20261
+ stage: "beta"
20262
+ },
20263
+ "daily-line": {
20264
+ title: "Daily line",
20265
+ description: "A soft colour glow and one quiet line in the corner of Rounds mode's empty space, a different decision or fact from your workspace memory each day. The memory is sent to an AI model to phrase the line.",
20245
20266
  stage: "beta"
20246
20267
  }
20247
20268
  };
@@ -20257,7 +20278,7 @@ function resolveFeatureFlags(enabledIds, devHost) {
20257
20278
  const out = {};
20258
20279
  for (const id of featureFlagIds) {
20259
20280
  const stage = featureFlags[id].stage;
20260
- out[id] = stage === "ga" || isFeatureVisible(stage, devHost) && enabled.has(id);
20281
+ out[id] = stage === "ga" || (stage === "setting" || isFeatureVisible(stage, devHost)) && enabled.has(id);
20261
20282
  }
20262
20283
  return out;
20263
20284
  }
@@ -21631,10 +21652,10 @@ function recordCodexUsage(response, options) {
21631
21652
  });
21632
21653
  }
21633
21654
  function runCodexCli(prompt, cwd, options, resumeSessionId) {
21634
- return new Promise((resolve8, reject) => {
21655
+ return new Promise((resolve9, reject) => {
21635
21656
  const finish = (response) => {
21636
21657
  recordCodexUsage(response, options);
21637
- resolve8(response);
21658
+ resolve9(response);
21638
21659
  };
21639
21660
  const scratch = mkdtempSync(join5(tmpdir(), "flyspace-codex-"));
21640
21661
  const lastMessageFile = join5(scratch, "last-message.txt");
@@ -22479,7 +22500,7 @@ var DEFAULT_TIMEOUT_MS = 12e4;
22479
22500
  var KILL_GRACE_MS3 = 5e3;
22480
22501
  function runScriptAutomation(opts) {
22481
22502
  const { name, script, cwd, timeoutMs = DEFAULT_TIMEOUT_MS } = opts;
22482
- return new Promise((resolve8, reject) => {
22503
+ return new Promise((resolve9, reject) => {
22483
22504
  const child = spawn3("/bin/bash", [script], { cwd, env: resolveMiseEnv(cwd), stdio: ["ignore", "pipe", "pipe"] });
22484
22505
  let stdout = "";
22485
22506
  let stderr = "";
@@ -22514,7 +22535,7 @@ function runScriptAutomation(opts) {
22514
22535
  } else if (code !== 0) {
22515
22536
  reject(new Error(`script exited with code ${code}: ${stderr.trim()}`));
22516
22537
  } else {
22517
- resolve8();
22538
+ resolve9();
22518
22539
  }
22519
22540
  });
22520
22541
  });
@@ -23284,8 +23305,8 @@ var MessageQueue = class {
23284
23305
  const chains = Array.from(this.chains.values());
23285
23306
  if (chains.length === 0) return true;
23286
23307
  let timer;
23287
- const timeout = new Promise((resolve8) => {
23288
- timer = setTimeout(() => resolve8(false), timeoutMs);
23308
+ const timeout = new Promise((resolve9) => {
23309
+ timer = setTimeout(() => resolve9(false), timeoutMs);
23289
23310
  });
23290
23311
  const done = Promise.all(chains).then(() => true);
23291
23312
  const result = await Promise.race([done, timeout]);
@@ -23974,7 +23995,7 @@ function secretsMatch(a, b) {
23974
23995
  }
23975
23996
 
23976
23997
  // ../api/src/mcp/oauth.ts
23977
- import { createHash as createHash3, randomBytes as randomBytes2 } from "crypto";
23998
+ import { createHash as createHash4, randomBytes as randomBytes2 } from "crypto";
23978
23999
  var RESERVED_AUTHORIZE_PARAMS = /* @__PURE__ */ new Set([
23979
24000
  "client_id",
23980
24001
  "redirect_uri",
@@ -23992,7 +24013,7 @@ function createStateToken() {
23992
24013
  }
23993
24014
  function createPkcePair() {
23994
24015
  const verifier = base64url(randomBytes2(32));
23995
- const challenge = base64url(createHash3("sha256").update(verifier).digest());
24016
+ const challenge = base64url(createHash4("sha256").update(verifier).digest());
23996
24017
  return { verifier, challenge };
23997
24018
  }
23998
24019
  function clientEnvName(providerSlug, suffix) {
@@ -24361,7 +24382,7 @@ function needsRefresh(expiresAt, now = Date.now()) {
24361
24382
  if (!expiresAt) return false;
24362
24383
  return new Date(expiresAt).getTime() - now < REFRESH_SKEW_MS;
24363
24384
  }
24364
- var sleep = (ms) => new Promise((resolve8) => setTimeout(resolve8, ms));
24385
+ var sleep = (ms) => new Promise((resolve9) => setTimeout(resolve9, ms));
24365
24386
  async function refreshConnection(params) {
24366
24387
  const { workspaceId, connection, provider } = params;
24367
24388
  const deps = params.deps ?? {};
@@ -24562,10 +24583,10 @@ async function withMcpConfig(profile, connectionIds, fn, extraServers = {}) {
24562
24583
 
24563
24584
  // ../api/src/version.ts
24564
24585
  import { readFileSync as readFileSync7 } from "fs";
24565
- var CLI_VERSION = true ? "0.1.52" : devVersion();
24586
+ var CLI_VERSION = true ? "0.1.53" : devVersion();
24566
24587
  function isOlderVersion(a, b) {
24567
- const parse = (v) => v.replace(/^v/, "").split("-")[0].split(".").map(Number);
24568
- const [pa, pb] = [parse(a), parse(b)];
24588
+ const parse2 = (v) => v.replace(/^v/, "").split("-")[0].split(".").map(Number);
24589
+ const [pa, pb] = [parse2(a), parse2(b)];
24569
24590
  if (pa.length !== 3 || pb.length !== 3 || [...pa, ...pb].some(Number.isNaN)) return false;
24570
24591
  for (let i = 0; i < 3; i++) if (pa[i] !== pb[i]) return pa[i] < pb[i];
24571
24592
  return false;
@@ -24688,14 +24709,14 @@ function handleHostDbResult(id, res) {
24688
24709
  }
24689
24710
  function whenConnected() {
24690
24711
  if (sender) return Promise.resolve(sender);
24691
- return new Promise((resolve8, reject) => {
24712
+ return new Promise((resolve9, reject) => {
24692
24713
  const timer = setTimeout(() => {
24693
24714
  onSender = onSender.filter((w) => w !== wake);
24694
24715
  reject(new Error("Host is not connected to the Data API"));
24695
24716
  }, REQUEST_TIMEOUT_MS);
24696
24717
  const wake = () => {
24697
24718
  clearTimeout(timer);
24698
- resolve8(sender);
24719
+ resolve9(sender);
24699
24720
  };
24700
24721
  onSender.push(wake);
24701
24722
  });
@@ -24703,12 +24724,12 @@ function whenConnected() {
24703
24724
  async function requestHostDb(req) {
24704
24725
  const send = await whenConnected();
24705
24726
  const id = randomUUID2();
24706
- return new Promise((resolve8, reject) => {
24727
+ return new Promise((resolve9, reject) => {
24707
24728
  const timer = setTimeout(() => {
24708
24729
  pending.delete(id);
24709
24730
  reject(new Error("Data API did not answer in time"));
24710
24731
  }, REQUEST_TIMEOUT_MS);
24711
- pending.set(id, { resolve: resolve8, reject, timer });
24732
+ pending.set(id, { resolve: resolve9, reject, timer });
24712
24733
  send({ type: "db", id, req });
24713
24734
  });
24714
24735
  }
@@ -24720,14 +24741,14 @@ function handleAttachmentUrlResult(id, url) {
24720
24741
  async function requestAttachmentUrl(key) {
24721
24742
  const send = await whenConnected();
24722
24743
  const id = randomUUID2();
24723
- return new Promise((resolve8, reject) => {
24744
+ return new Promise((resolve9, reject) => {
24724
24745
  const timer = setTimeout(() => {
24725
24746
  pendingUrls.delete(id);
24726
24747
  reject(new Error("Data API did not answer in time"));
24727
24748
  }, REQUEST_TIMEOUT_MS);
24728
24749
  pendingUrls.set(id, (url) => {
24729
24750
  clearTimeout(timer);
24730
- resolve8(url);
24751
+ resolve9(url);
24731
24752
  });
24732
24753
  send({ type: "attachment-url", id, key });
24733
24754
  });
@@ -25393,7 +25414,7 @@ import { join as join14 } from "path";
25393
25414
 
25394
25415
  // ../api/src/dashboard/profile-config.ts
25395
25416
  import { homedir as homedir7 } from "os";
25396
- import { join as join13 } from "path";
25417
+ import { join as join13, parse, resolve as resolve7 } from "path";
25397
25418
 
25398
25419
  // ../api/src/dashboard/profile-config-cache.ts
25399
25420
  var cache2 = /* @__PURE__ */ new Map();
@@ -25420,6 +25441,10 @@ function profileOauthToken() {
25420
25441
  if (env["CLAUDE_CONFIG_DIR"]) return void 0;
25421
25442
  return process.env["CLAUDE_CODE_OAUTH_TOKEN"] || void 0;
25422
25443
  }
25444
+ function isUnsafeCwd(cwd) {
25445
+ const p = resolve7(cwd);
25446
+ return p === parse(p).root || p === resolve7(homedir7());
25447
+ }
25423
25448
  function defaultClaudeCwd() {
25424
25449
  return profileEnv("CLAUDE_CWD") ?? process.cwd();
25425
25450
  }
@@ -25432,8 +25457,13 @@ function defaultEffort() {
25432
25457
  }
25433
25458
  function resolveChannelConfig(channelId) {
25434
25459
  const channel = findChannel(channelId);
25460
+ const profile = channel?.profile ?? getProfile();
25461
+ const cwd = channel?.cwd ?? defaultClaudeCwd();
25435
25462
  return {
25436
- cwd: channel?.cwd ?? defaultClaudeCwd(),
25463
+ // Never hand an agent or the Docs pane the filesystem root or $HOME (a
25464
+ // Host running as a launchd/systemd service has process.cwd() === '/').
25465
+ // Fall back to a per-channel logical folder instead of exposing the disk.
25466
+ cwd: isUnsafeCwd(cwd) ? resolveLogicalCwd(channel?.dmKey ? dmCwd(channel.dmKey, profile) : `${profile}/${channelId}`) : cwd,
25437
25467
  model: channel?.model?.trim() || defaultModel(),
25438
25468
  effort: channel?.effort ?? defaultEffort(),
25439
25469
  runtime: channel?.runtime ?? "host",
@@ -25444,7 +25474,7 @@ function resolveChannelConfig(channelId) {
25444
25474
  claudeConfigDir: profileClaudeConfigDir(),
25445
25475
  claudeCodeOauthToken: profileOauthToken(),
25446
25476
  agentName: channel?.agentName ?? null,
25447
- profile: channel?.profile ?? getProfile(),
25477
+ profile,
25448
25478
  mcpConnections: channel?.mcpConnections ?? []
25449
25479
  };
25450
25480
  }
@@ -25518,9 +25548,9 @@ ${req.user}`,
25518
25548
  };
25519
25549
  }
25520
25550
  function run(inv, cwd) {
25521
- return new Promise((resolve8) => {
25551
+ return new Promise((resolve9) => {
25522
25552
  if (!existsSync15(cwd)) {
25523
- resolve8({ ok: false, error: `the channel folder ${cwd} does not exist on this Host` });
25553
+ resolve9({ ok: false, error: `the channel folder ${cwd} does not exist on this Host` });
25524
25554
  return;
25525
25555
  }
25526
25556
  const child = spawn4(inv.command, inv.args, {
@@ -25538,7 +25568,7 @@ function run(inv, cwd) {
25538
25568
  child.on("error", (err) => {
25539
25569
  clearTimeout(timer);
25540
25570
  console.error(`[memory-extraction] ${inv.command} failed to start:`, err.message);
25541
- resolve8({ ok: false, error: `${inv.command} failed to start: ${err.message}` });
25571
+ resolve9({ ok: false, error: `${inv.command} failed to start: ${err.message}` });
25542
25572
  });
25543
25573
  child.on("close", (code) => {
25544
25574
  clearTimeout(timer);
@@ -25546,7 +25576,7 @@ function run(inv, cwd) {
25546
25576
  const detail = (stderr || stdout).trim().split("\n").at(-1) ?? "";
25547
25577
  const error = `${inv.command} exited ${code ?? "on timeout"}: ${detail.slice(0, 200)}`;
25548
25578
  console.error(`[memory-extraction] ${error}`);
25549
- resolve8({ ok: false, error });
25579
+ resolve9({ ok: false, error });
25550
25580
  return;
25551
25581
  }
25552
25582
  let raw = stdout;
@@ -25557,7 +25587,7 @@ function run(inv, cwd) {
25557
25587
  raw = "";
25558
25588
  }
25559
25589
  }
25560
- resolve8({ ok: true, raw });
25590
+ resolve9({ ok: true, raw });
25561
25591
  });
25562
25592
  child.stdin.end(inv.stdin);
25563
25593
  });
@@ -26375,7 +26405,7 @@ ${input}`
26375
26405
  }
26376
26406
  }
26377
26407
  function runPrint(command, args, env) {
26378
- return new Promise((resolve8, reject) => {
26408
+ return new Promise((resolve9, reject) => {
26379
26409
  const child = spawn5(command, args, {
26380
26410
  // A stateless rewrite touches no files — tmpdir keeps it that way and
26381
26411
  // avoids picking up an unrelated project's own CLAUDE.md/AGENTS.md,
@@ -26405,7 +26435,7 @@ function runPrint(command, args, env) {
26405
26435
  reject(new Error(`${command} summary exited with code ${code}: ${stderr.trim()}`));
26406
26436
  return;
26407
26437
  }
26408
- resolve8(stdout);
26438
+ resolve9(stdout);
26409
26439
  });
26410
26440
  });
26411
26441
  }
@@ -26759,7 +26789,7 @@ import {
26759
26789
  writeFileSync as writeFileSync7
26760
26790
  } from "fs";
26761
26791
  import { Readable } from "stream";
26762
- import { basename as basename5, dirname as dirname3, extname as extname2, join as join20, relative as relative2, resolve as resolve7, sep as sep4 } from "path";
26792
+ import { basename as basename5, dirname as dirname3, extname as extname2, join as join20, relative as relative2, resolve as resolve8, sep as sep4 } from "path";
26763
26793
  import { Hono as Hono4 } from "hono";
26764
26794
  import { streamSSE } from "hono/streaming";
26765
26795
 
@@ -26967,7 +26997,7 @@ async function putDocTranslation(input) {
26967
26997
  }
26968
26998
 
26969
26999
  // ../api/src/dashboard/share-translate.ts
26970
- import { createHash as createHash4 } from "crypto";
27000
+ import { createHash as createHash5 } from "crypto";
26971
27001
 
26972
27002
  // ../api/src/store/doc-share-store.ts
26973
27003
  function rowToKind(value) {
@@ -27277,7 +27307,7 @@ function languageName(lang) {
27277
27307
  return BY_CODE.get(lang)?.name ?? null;
27278
27308
  }
27279
27309
  function translationHash(title, content) {
27280
- return createHash4("sha256").update(`${RECIPE_VERSION}
27310
+ return createHash5("sha256").update(`${RECIPE_VERSION}
27281
27311
  ${title}
27282
27312
  ${content}`).digest("hex");
27283
27313
  }
@@ -27433,7 +27463,7 @@ async function clearStaleDocAudios(channelId, sourcePath, lang, exceptHash) {
27433
27463
  }
27434
27464
 
27435
27465
  // ../api/src/dashboard/share-audio.ts
27436
- import { createHash as createHash5 } from "crypto";
27466
+ import { createHash as createHash6 } from "crypto";
27437
27467
  import { DeleteObjectCommand, PutObjectCommand as PutObjectCommand2 } from "@aws-sdk/client-s3";
27438
27468
 
27439
27469
  // ../api/src/dashboard/tts-routes.ts
@@ -27632,7 +27662,7 @@ Pacing \u2014 the engine has NO pause control, so rhythm has to be built into th
27632
27662
  Output plain text ONLY. No tags of any kind, no angle brackets, no Markdown, no quotation wrapping. Any tag you emit will be deleted before synthesis, so it buys nothing and costs meaning.`;
27633
27663
  }
27634
27664
  function articleAudioHash(title, content) {
27635
- return createHash5("sha256").update(`v${RECIPE_VERSION2}
27665
+ return createHash6("sha256").update(`v${RECIPE_VERSION2}
27636
27666
  ${title}
27637
27667
 
27638
27668
  ${content}`).digest("hex").slice(0, 32);
@@ -27755,7 +27785,7 @@ function truncationNotice(lang, voice) {
27755
27785
  if (lang === "en" || lang.startsWith("en-")) return TRUNCATION_NOTICE.en;
27756
27786
  return null;
27757
27787
  }
27758
- var sleep2 = (ms) => new Promise((resolve8) => setTimeout(resolve8, ms));
27788
+ var sleep2 = (ms) => new Promise((resolve9) => setTimeout(resolve9, ms));
27759
27789
  async function synthesizeWithRetry(script, voice) {
27760
27790
  let lastError;
27761
27791
  for (let attempt = 1; attempt <= SYNTH_ATTEMPTS; attempt += 1) {
@@ -27859,7 +27889,7 @@ function queueShareAudio(share) {
27859
27889
  var PENDING_STALE_MS = 30 * 60 * 1e3;
27860
27890
  var FAILED_RETRY_MS = 10 * 60 * 1e3;
27861
27891
  function langAudioHash(title, content, lang) {
27862
- return createHash5("sha256").update(`v${RECIPE_VERSION2}
27892
+ return createHash6("sha256").update(`v${RECIPE_VERSION2}
27863
27893
  ${lang}
27864
27894
  ${translationHash(title, content)}`).digest("hex").slice(0, 32);
27865
27895
  }
@@ -28233,7 +28263,8 @@ function createFeatureFlagsRouter() {
28233
28263
  if (auth.role !== "admin") return c.json({ error: "admin access required" }, 403);
28234
28264
  const flagId = c.req.param("flagId") ?? "";
28235
28265
  if (!isFeatureFlagId(flagId)) return c.json({ error: "unknown feature flag" }, 404);
28236
- if (!isFeatureVisible(featureFlags[flagId].stage, isDevHost(c))) {
28266
+ const stage = featureFlags[flagId].stage;
28267
+ if (stage !== "setting" && !isFeatureVisible(stage, isDevHost(c))) {
28237
28268
  return c.json({ error: "this feature flag cannot be changed here" }, 403);
28238
28269
  }
28239
28270
  if (enabled) await enableFeatureFlag(auth.workspaceId, flagId, auth.userId);
@@ -28453,7 +28484,7 @@ function injectShareHead(html, head) {
28453
28484
  }
28454
28485
 
28455
28486
  // ../api/src/dashboard/app-icon.ts
28456
- import { createHash as createHash6 } from "crypto";
28487
+ import { createHash as createHash7 } from "crypto";
28457
28488
  import { existsSync as existsSync18, readFileSync as readFileSync14 } from "fs";
28458
28489
  import { join as join18 } from "path";
28459
28490
  import sharp2 from "sharp";
@@ -28532,7 +28563,7 @@ async function renderAppIcon({
28532
28563
  size,
28533
28564
  maskable ? "maskable" : "std",
28534
28565
  plain ? "plain" : "badged",
28535
- logo ? createHash6("sha1").update(logo).digest("hex").slice(0, 12) : transparent ? "stock-transparent" : "stock"
28566
+ logo ? createHash7("sha1").update(logo).digest("hex").slice(0, 12) : transparent ? "stock-transparent" : "stock"
28536
28567
  ].join(":");
28537
28568
  const hit = cache4.get(key);
28538
28569
  if (hit) return hit;
@@ -28563,7 +28594,7 @@ async function composeIcon(logo, size, maskable, plain) {
28563
28594
  }
28564
28595
 
28565
28596
  // ../api/src/dashboard/share-og.ts
28566
- import { createHash as createHash7 } from "crypto";
28597
+ import { createHash as createHash8 } from "crypto";
28567
28598
  import sharp3 from "sharp";
28568
28599
  var WIDTH = 1200;
28569
28600
  var HEIGHT = 630;
@@ -28741,7 +28772,7 @@ function cacheKey(input) {
28741
28772
  input.logo ?? "",
28742
28773
  input.theme ?? ""
28743
28774
  ];
28744
- return createHash7("sha1").update(parts.join("\0")).digest("hex");
28775
+ return createHash8("sha1").update(parts.join("\0")).digest("hex");
28745
28776
  }
28746
28777
  async function renderShareOgImage(input) {
28747
28778
  const key = cacheKey(input);
@@ -28756,7 +28787,7 @@ async function renderShareOgImage(input) {
28756
28787
  }
28757
28788
 
28758
28789
  // ../api/src/dashboard/share-ask.ts
28759
- import { createHash as createHash8 } from "crypto";
28790
+ import { createHash as createHash9 } from "crypto";
28760
28791
  var MAX_ARTICLE_CHARS3 = 24e3;
28761
28792
  var MAX_QUESTION_CHARS = 500;
28762
28793
  var SUGGESTION_COUNT = 4;
@@ -28821,7 +28852,7 @@ function parseSuggestions(raw) {
28821
28852
  var CACHE_LIMIT = 200;
28822
28853
  var suggestionCache = /* @__PURE__ */ new Map();
28823
28854
  function articleHash(title, content, lang) {
28824
- return createHash8("sha256").update(`${lang ?? ""}
28855
+ return createHash9("sha256").update(`${lang ?? ""}
28825
28856
  ${title}
28826
28857
 
28827
28858
  ${content}`).digest("hex").slice(0, 32);
@@ -29545,7 +29576,7 @@ function extractTitle(absPath, kind) {
29545
29576
  }
29546
29577
  function resolveDirPath(root, rel) {
29547
29578
  if (rel.includes("\0")) return null;
29548
- const abs = resolve7(root, rel);
29579
+ const abs = resolve8(root, rel);
29549
29580
  if (abs !== root && !abs.startsWith(root + sep4)) return null;
29550
29581
  return abs;
29551
29582
  }
@@ -29598,7 +29629,7 @@ function readGitBranch(dir) {
29598
29629
  const pointer = readFileSync17(gitDir, "utf8").trim();
29599
29630
  const match = pointer.match(/^gitdir:\s*(.+)$/);
29600
29631
  if (!match) return void 0;
29601
- gitDir = resolve7(dir, match[1]);
29632
+ gitDir = resolve8(dir, match[1]);
29602
29633
  }
29603
29634
  const head = readFileSync17(join20(gitDir, "HEAD"), "utf8").trim();
29604
29635
  const branchMatch = head.match(/^ref:\s*refs\/heads\/(.+)$/);
@@ -29685,7 +29716,7 @@ function flatDocs(root, {
29685
29716
  }
29686
29717
  function resolveDocPath(root, rel) {
29687
29718
  if (!rel || rel.includes("\0")) return null;
29688
- const abs = resolve7(root, rel);
29719
+ const abs = resolve8(root, rel);
29689
29720
  if (abs !== root && !abs.startsWith(root + sep4)) return null;
29690
29721
  const ext = extname2(abs).toLowerCase();
29691
29722
  if (!(ext in DOC_EXTENSIONS) && !(ext in CODE_EXTENSIONS)) return null;
@@ -29712,7 +29743,7 @@ function writeDocContent(root, rel, content, baseMtime) {
29712
29743
  }
29713
29744
  function resolveRawPath(root, rel) {
29714
29745
  if (!rel || rel.includes("\0")) return null;
29715
- const abs = resolve7(root, rel);
29746
+ const abs = resolve8(root, rel);
29716
29747
  if (abs !== root && !abs.startsWith(root + sep4)) return null;
29717
29748
  const contentType = MEDIA_EXTENSIONS[extname2(abs).toLowerCase()];
29718
29749
  if (!contentType) return null;
@@ -29720,14 +29751,14 @@ function resolveRawPath(root, rel) {
29720
29751
  }
29721
29752
  function resolveHtmlPath(root, rel) {
29722
29753
  if (!rel || rel.includes("\0")) return null;
29723
- const abs = resolve7(root, rel);
29754
+ const abs = resolve8(root, rel);
29724
29755
  if (abs !== root && !abs.startsWith(root + sep4)) return null;
29725
29756
  if (DOC_EXTENSIONS[extname2(abs).toLowerCase()] !== "html") return null;
29726
29757
  return abs;
29727
29758
  }
29728
29759
  function resolveDownloadPath(root, rel) {
29729
29760
  if (!rel || rel.includes("\0")) return null;
29730
- const abs = resolve7(root, rel);
29761
+ const abs = resolve8(root, rel);
29731
29762
  if (abs !== root && !abs.startsWith(root + sep4)) return null;
29732
29763
  if (!isListableFile(basename5(abs))) return null;
29733
29764
  const contentType = MEDIA_EXTENSIONS[extname2(abs).toLowerCase()] ?? "application/octet-stream";
@@ -29815,7 +29846,7 @@ function createDocFile(root, relDir, name, content) {
29815
29846
  }
29816
29847
  function moveDocEntry(root, from, to) {
29817
29848
  if (!from || !to || from.includes("\0") || to.includes("\0")) return { status: "not-found" };
29818
- const absFrom = resolve7(root, from);
29849
+ const absFrom = resolve8(root, from);
29819
29850
  if (!absFrom.startsWith(root + sep4)) return { status: "not-found" };
29820
29851
  let stat;
29821
29852
  try {
@@ -29825,7 +29856,7 @@ function moveDocEntry(root, from, to) {
29825
29856
  }
29826
29857
  const isDir = stat.isDirectory();
29827
29858
  if (!isDir && !stat.isFile()) return { status: "not-found" };
29828
- const absTo = resolve7(root, to);
29859
+ const absTo = resolve8(root, to);
29829
29860
  if (!absTo.startsWith(root + sep4)) return { status: "bad-target" };
29830
29861
  const name = sanitizeUploadName(basename5(absTo));
29831
29862
  if (!name) return { status: "bad-target" };
@@ -29855,7 +29886,7 @@ function moveDocEntry(root, from, to) {
29855
29886
  }
29856
29887
  function deleteDocEntry(root, path) {
29857
29888
  if (!path || path.includes("\0")) return { status: "not-found" };
29858
- const abs = resolve7(root, path);
29889
+ const abs = resolve8(root, path);
29859
29890
  if (!abs.startsWith(root + sep4)) return { status: "not-found" };
29860
29891
  let stat;
29861
29892
  try {
@@ -31220,9 +31251,13 @@ var ChatAgent = class {
31220
31251
  return this.queue.drain(timeoutMs);
31221
31252
  }
31222
31253
  async run(msg) {
31223
- const { data: thread, error } = await this.supabase().from("threads").select("id, channel_id, title, channels(external_channel_id)").eq("id", msg.threadId).single();
31254
+ const { data: thread, error } = await this.supabase().from("threads").select("id, channel_id, title").eq("id", msg.threadId).single();
31224
31255
  if (error || !thread) {
31225
31256
  console.error(`[chat-agent] thread ${msg.threadId} not found:`, error?.message);
31257
+ await this.postReply(
31258
+ msg.threadId,
31259
+ `\u26A0\uFE0F I couldn't start this run: failed to load the thread (${error?.message ?? "not found"}).`
31260
+ );
31226
31261
  return;
31227
31262
  }
31228
31263
  const notify = this.openThinkingNotifier(msg.threadId);
@@ -31298,11 +31333,11 @@ var ChatAgent = class {
31298
31333
  ...isHumanAuthor(msg.author) ? { senderHandle: msg.author } : {}
31299
31334
  });
31300
31335
  if (memory.enabled) channelConfig = { ...channelConfig, disableAutoMemory: true };
31336
+ const { data: channelRow } = await this.supabase().from("channels").select("external_channel_id").eq("id", thread.channel_id).maybeSingle();
31301
31337
  channelConfig = {
31302
31338
  ...channelConfig,
31303
31339
  permissionThread: { threadId: msg.threadId, channelId: thread.channel_id },
31304
- // Typed as an array, but a many-to-one embed returns a single row.
31305
- slackBound: !![thread.channels].flat()[0]?.external_channel_id
31340
+ slackBound: !!channelRow?.external_channel_id
31306
31341
  };
31307
31342
  if (memory.memoryPrompt) channelConfig = { ...channelConfig, memoryPrompt: memory.memoryPrompt };
31308
31343
  const store = this.openSessionStore();
@@ -31610,22 +31645,22 @@ ${msg.body}` : expandSkillCommand(channelConfig.claudeConfigDir, channelConfig.c
31610
31645
  let ready;
31611
31646
  try {
31612
31647
  channel = this.supabase().channel(`agent-thinking:${threadId}`);
31613
- ready = new Promise((resolve8) => {
31648
+ ready = new Promise((resolve9) => {
31614
31649
  const timeout = setTimeout(() => {
31615
31650
  console.error(`[chat-agent] thinking-channel ${threadId}: subscribe timed out after 10s`);
31616
- resolve8(false);
31651
+ resolve9(false);
31617
31652
  }, 1e4);
31618
31653
  channel.subscribe((status, err) => {
31619
31654
  if (status === "SUBSCRIBED") {
31620
31655
  clearTimeout(timeout);
31621
- resolve8(true);
31656
+ resolve9(true);
31622
31657
  } else if (status === "CHANNEL_ERROR" || status === "TIMED_OUT" || status === "CLOSED") {
31623
31658
  console.error(
31624
31659
  `[chat-agent] thinking-channel ${threadId}: ${status}`,
31625
31660
  err?.message ?? ""
31626
31661
  );
31627
31662
  clearTimeout(timeout);
31628
- resolve8(false);
31663
+ resolve9(false);
31629
31664
  }
31630
31665
  });
31631
31666
  });
@@ -31672,19 +31707,19 @@ ${msg.body}` : expandSkillCommand(channelConfig.claudeConfigDir, channelConfig.c
31672
31707
  let ready;
31673
31708
  try {
31674
31709
  channel = this.supabase().channel("channel-activity");
31675
- ready = new Promise((resolve8) => {
31710
+ ready = new Promise((resolve9) => {
31676
31711
  const timeout = setTimeout(() => {
31677
31712
  console.error("[chat-agent] channel-activity: subscribe timed out after 10s");
31678
- resolve8(false);
31713
+ resolve9(false);
31679
31714
  }, 1e4);
31680
31715
  channel.subscribe((status, err) => {
31681
31716
  if (status === "SUBSCRIBED") {
31682
31717
  clearTimeout(timeout);
31683
- resolve8(true);
31718
+ resolve9(true);
31684
31719
  } else if (status === "CHANNEL_ERROR" || status === "TIMED_OUT" || status === "CLOSED") {
31685
31720
  console.error(`[chat-agent] channel-activity: ${status}`, err?.message ?? "");
31686
31721
  clearTimeout(timeout);
31687
- resolve8(false);
31722
+ resolve9(false);
31688
31723
  }
31689
31724
  });
31690
31725
  });
@@ -34087,13 +34122,13 @@ async function recoverStaleReactions(client, reactionStore) {
34087
34122
  var ts2 = () => (/* @__PURE__ */ new Date()).toISOString();
34088
34123
  var POWER_POLL_MS = 3e4;
34089
34124
  function isOnACPower() {
34090
- return new Promise((resolve8) => {
34125
+ return new Promise((resolve9) => {
34091
34126
  execFile2("pmset", ["-g", "ps"], { timeout: 2e3 }, (err, stdout) => {
34092
34127
  if (err) {
34093
- resolve8(true);
34128
+ resolve9(true);
34094
34129
  return;
34095
34130
  }
34096
- resolve8(stdout.includes("'AC Power'"));
34131
+ resolve9(stdout.includes("'AC Power'"));
34097
34132
  });
34098
34133
  });
34099
34134
  }
@@ -34294,6 +34329,7 @@ export {
34294
34329
  MEMORY_TYPES,
34295
34330
  isMemoryType,
34296
34331
  validateMemoryInput,
34332
+ rowToMemory,
34297
34333
  listMemories,
34298
34334
  getMemory,
34299
34335
  saveMemory,