flyspace-cli 0.1.62 → 0.1.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20392,7 +20392,7 @@ function interpretCliOutcome(result, resumeSessionId, maxBudgetUsd, model, using
20392
20392
  }
20393
20393
  var DEFAULT_IDLE_TIMEOUT_SECONDS = 300;
20394
20394
  var DEFAULT_MAX_DURATION_SECONDS = 600;
20395
- var DEFAULT_STREAMING_MAX_DURATION_SECONDS = 1800;
20395
+ var DEFAULT_STREAMING_MAX_DURATION_SECONDS = 7200;
20396
20396
  var KILL_GRACE_MS = 1e4;
20397
20397
  function envSeconds(name, defaultSeconds) {
20398
20398
  const raw = process.env[name];
@@ -20704,6 +20704,7 @@ function runCli(prompt, cwd, botName, options, claudeConfigDir, resumeSessionId,
20704
20704
  let liveSessionId;
20705
20705
  const streamedText = [];
20706
20706
  let killedTool = false;
20707
+ let mcpNeedsAuth = [];
20707
20708
  const onLine = options.onActivity ? createLineSplitter((line) => {
20708
20709
  let event;
20709
20710
  try {
@@ -20712,6 +20713,9 @@ function runCli(prompt, cwd, botName, options, claudeConfigDir, resumeSessionId,
20712
20713
  return;
20713
20714
  }
20714
20715
  if (event.session_id) liveSessionId = event.session_id;
20716
+ if (event.mcp_servers) {
20717
+ mcpNeedsAuth = event.mcp_servers.filter((server) => server.status === "needs-auth" && server.name).map((server) => server.name);
20718
+ }
20715
20719
  if (event.type === "result") streamResultLine = line;
20716
20720
  if (pluginUi) {
20717
20721
  pluginUi.onEvent(event);
@@ -20823,7 +20827,11 @@ function runCli(prompt, cwd, botName, options, claudeConfigDir, resumeSessionId,
20823
20827
  stderrTail: stderrTail(stderr),
20824
20828
  message: (result.result ?? "").slice(0, 500)
20825
20829
  }
20826
- } : killedTool ? { ...response, killedTool } : response
20830
+ } : {
20831
+ ...response,
20832
+ ...killedTool ? { killedTool } : {},
20833
+ ...mcpNeedsAuth.length ? { mcpNeedsAuth } : {}
20834
+ }
20827
20835
  );
20828
20836
  } catch {
20829
20837
  const fallback = onLine ? "" : stdout.trim();
@@ -24648,7 +24656,8 @@ async function ownIdentityFor(client) {
24648
24656
  async function mirrorIncomingMessage(client, msg) {
24649
24657
  if (!databaseReachable()) return;
24650
24658
  if (msg.subtype && SKIP_SUBTYPES.has(msg.subtype)) return;
24651
- if (msg.subtype === "message_changed" || msg.subtype === "message_deleted") return;
24659
+ if (msg.subtype === "message_deleted") return;
24660
+ if (msg.subtype === "message_changed") return mirrorEditedMessage(client, msg);
24652
24661
  try {
24653
24662
  await ensureUsersCached(client, mentionedUserIds(msg));
24654
24663
  const body = bodyTextFor(msg);
@@ -24744,6 +24753,19 @@ async function mirrorIncomingMessage(client, msg) {
24744
24753
  );
24745
24754
  }
24746
24755
  }
24756
+ async function mirrorEditedMessage(client, msg) {
24757
+ try {
24758
+ await ensureUsersCached(client, mentionedUserIds(msg));
24759
+ const body = bodyTextFor(msg);
24760
+ if (!body) return;
24761
+ const { error } = await getSupabaseClient().from("thread_replies").update({ body }).eq("external_thread_replies_id", `${msg.channel}:${msg.ts}`);
24762
+ if (error) throw new Error(error.message);
24763
+ } catch (err) {
24764
+ console.warn(
24765
+ `[live-mirror] edit ${msg.channel}:${msg.ts}: ${err instanceof Error ? err.message : String(err)}`
24766
+ );
24767
+ }
24768
+ }
24747
24769
 
24748
24770
  // src/slack/thread-summary.ts
24749
24771
  function buildSummaryPrompt(transcript) {
@@ -25483,7 +25505,7 @@ async function withMcpConfig(profile, connectionIds, fn, extraServers = {}) {
25483
25505
 
25484
25506
  // ../api/src/version.ts
25485
25507
  import { readFileSync as readFileSync8 } from "fs";
25486
- var CLI_VERSION = true ? "0.1.62" : devVersion();
25508
+ var CLI_VERSION = true ? "0.1.63" : devVersion();
25487
25509
  function isOlderVersion(a, b) {
25488
25510
  const parse2 = (v) => v.replace(/^v/, "").split("-")[0].split(".").map(Number);
25489
25511
  const [pa, pb] = [parse2(a), parse2(b)];
@@ -32248,7 +32270,11 @@ ${msg.body}` : expandSkillCommand(channelConfig.claudeConfigDir, channelConfig.c
32248
32270
  )) {
32249
32271
  return;
32250
32272
  }
32251
- await this.postReply(msg.threadId, response.text || "No response", activities);
32273
+ await this.postReply(
32274
+ msg.threadId,
32275
+ withMcpRetryButton(response.text || "No response", response.mcpNeedsAuth),
32276
+ activities
32277
+ );
32252
32278
  if (response.killedTool) {
32253
32279
  void this.continueAfterKilledTool(
32254
32280
  msg.threadId,
@@ -32787,6 +32813,12 @@ ${lines}
32787
32813
  }
32788
32814
  }
32789
32815
  };
32816
+ function withMcpRetryButton(text, needsAuth) {
32817
+ if (!needsAuth?.length || /\[BUTTONS:/i.test(text)) return text;
32818
+ return `${text}
32819
+
32820
+ [BUTTONS: \u{1F504} Signed in to ${needsAuth.join(", ")}, retry]`;
32821
+ }
32790
32822
 
32791
32823
  // src/slack/commands.ts
32792
32824
  var SKILL_SELECT_ACTION_ID = "custie_skill_select";
@@ -33418,6 +33450,11 @@ ${trimmedDetail.slice(0, 1500)}
33418
33450
  return;
33419
33451
  }
33420
33452
  const askOptions = {
33453
+ // Stream mode, even though Slack shows no live activity: it puts the
33454
+ // turn under the idle watchdog, so a busy turn keeps running instead
33455
+ // of hitting the short plain-json wall-clock cap.
33456
+ onActivity: () => {
33457
+ },
33421
33458
  model: effectiveModel2,
33422
33459
  effort: effectiveEffort,
33423
33460
  maxBudgetUsd,
@@ -33710,6 +33747,18 @@ retry: ${retryDetail}`);
33710
33747
  });
33711
33748
  });
33712
33749
  app.event("message", async ({ event, client }) => {
33750
+ if (event.subtype === "message_changed") {
33751
+ const edited = event.message;
33752
+ if (!edited.ts) return;
33753
+ await mirrorIncomingMessage(client, {
33754
+ channel: event.channel,
33755
+ ts: edited.ts,
33756
+ subtype: "message_changed",
33757
+ text: typeof edited.text === "string" ? edited.text : void 0,
33758
+ blocks: Array.isArray(edited.blocks) ? edited.blocks : void 0
33759
+ });
33760
+ return;
33761
+ }
33713
33762
  await mirrorIncomingMessage(client, {
33714
33763
  channel: event.channel,
33715
33764
  ts: event.ts,
package/dist/cli.js CHANGED
@@ -281,7 +281,7 @@ import {
281
281
  workspaceHostname,
282
282
  workspaceSkillsDir,
283
283
  writeSkillFile
284
- } from "./chunk-BDUA5N6B.js";
284
+ } from "./chunk-SBNBTJKW.js";
285
285
  import {
286
286
  checkPermissionAction,
287
287
  createThreadAction,
@@ -2207,7 +2207,7 @@ function npmEnv(target) {
2207
2207
  return nodeBin ? { ...process.env, PATH: `${nodeBin}:${process.env.PATH ?? ""}` } : process.env;
2208
2208
  }
2209
2209
  async function runUpgrade() {
2210
- const current = "0.1.62";
2210
+ const current = "0.1.63";
2211
2211
  console.log(`Current version: ${current}`);
2212
2212
  console.log("Checking for updates...\n");
2213
2213
  try {
@@ -12895,7 +12895,7 @@ function registerDataRoutes(api, agent = {}) {
12895
12895
  const paused = await getAgentPaused(auth.workspaceId);
12896
12896
  const cliVersion = agent.getHostCliVersion?.(getProfile()) ?? null;
12897
12897
  const latest = cliVersion ? await latestCliVersion() : null;
12898
- const outdated = !!(cliVersion && latest && isOlderVersion(cliVersion, latest));
12898
+ const outdated = !!(cliVersion && !cliVersion.endsWith("-dev") && latest && isOlderVersion(cliVersion, latest));
12899
12899
  const selfUpgrade = !!cliVersion && !isOlderVersion(cliVersion, SELF_UPGRADE_MIN_VERSION);
12900
12900
  return c.json({
12901
12901
  online: !paused,
@@ -15169,7 +15169,7 @@ import { mkdirSync as mkdirSync10, openSync as openSync3 } from "fs";
15169
15169
  import { join as join16 } from "path";
15170
15170
  var running = false;
15171
15171
  function startHostUpgrade() {
15172
- if (running) return { started: false };
15172
+ if (running || CLI_VERSION?.endsWith("-dev")) return { started: false };
15173
15173
  if (process.env.FLY_MACHINE_ID) {
15174
15174
  running = true;
15175
15175
  setTimeout(() => process.exit(0), 1e3);
@@ -16220,7 +16220,7 @@ async function main() {
16220
16220
  break;
16221
16221
  case "-v":
16222
16222
  case "--version":
16223
- printRaw("0.1.62");
16223
+ printRaw("0.1.63");
16224
16224
  break;
16225
16225
  case "-h":
16226
16226
  case "--help":
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { createRequire as __flyspaceCreateRequire } from 'node:module';
3
3
  const require = __flyspaceCreateRequire(import.meta.url);
4
4
  import {
5
5
  startServer
6
- } from "./chunk-BDUA5N6B.js";
6
+ } from "./chunk-SBNBTJKW.js";
7
7
  import "./chunk-UZMHXV4D.js";
8
8
  export {
9
9
  startServer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flyspace-cli",
3
- "version": "0.1.62",
3
+ "version": "0.1.63",
4
4
  "description": "AI-native headless community OS",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "private": false,
@@ -51,10 +51,11 @@ Some background tasks DO finish on their own: a build, a deploy, a test suite, a
51
51
  Instead, bake the notification into the command itself so the task pushes the result back when it finishes. You already know the current channel ID and thread id from the `[context: ...]` header at the top of the message — use those literal values, and pick the right command for where you are: `flyspace chat wake --thread <THREAD_ID>` when the context says `chat channel=...` (a Workspace/dashboard thread — see Flyspace Workspace Tools below), or `flyspace slack post --channel <CHANNEL_ID> --thread <THREAD_TS>` when it's a Slack thread:
52
52
 
53
53
  ```bash
54
- nohup bash -c 'if pnpm build; then S="✅ build 好了"; else S="❌ build 失敗,看 /tmp/build.log"; fi; flyspace chat wake --thread <THREAD_ID> --about "pnpm build" --text "$S"' > /tmp/build.log 2>&1 & disown
54
+ nohup bash -c 'export LANG=en_US.UTF-8; if pnpm build; then S="✅ build 好了"; else rc=$?; S="❌ build 失敗(exit ${rc}),看 /tmp/build.log"; fi; flyspace chat wake --thread <THREAD_ID> --about "pnpm build" --text "$S"' > /tmp/build.log 2>&1 & disown
55
55
  ```
56
56
 
57
57
  - The task does not need to know Flyspace exists. YOU append the callback to the command you launch. The `--thread` value routes it back to this exact thread; multiple concurrent tasks each carry their own destination, so they never collide.
58
+ - Always brace shell variables inside `--text` (`${rc}`, `${dir}`, never `$rc`), and start the command with `export LANG=en_US.UTF-8`. Otherwise a variable followed directly by a CJK character (`$rc,`) swallows part of that character, expands to nothing and posts garbled `��` text.
58
59
  - Report both success and failure — capture the exit status and post a different message for each. Include the log path on failure.
59
60
  - `chat wake` (Workspace threads only) posts the result AND starts a new turn for you in this thread with the result as its prompt, resuming this session, so you can carry on with the next step (fix the failure, continue the plan) without the user coming back. Write the `--text` so your future self can act on it: what finished, pass or fail, and where the log is. Slack threads have no wake: `flyspace slack post` only posts. Wakes are capped at 5 in a row without a human message.
60
61
  - Always pass `--about "<what it waits for>"` (a few words, in the user's language, no quotes inside): the thread shows it as "Waiting on: <about>" while the job runs. Every `chat wake` in the same job uses the same `--about`.