flyspace-cli 0.1.39 → 0.1.40

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.
Files changed (2) hide show
  1. package/dist/cli.js +34 -8
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -19486,7 +19486,7 @@ async function runAuthCmd(args) {
19486
19486
  }
19487
19487
 
19488
19488
  // ../api/src/version.ts
19489
- var CLI_VERSION = true ? "0.1.39" : null;
19489
+ var CLI_VERSION = true ? "0.1.40" : null;
19490
19490
  function isOlderVersion(a, b) {
19491
19491
  const parse = (v) => v.replace(/^v/, "").split("-")[0].split(".").map(Number);
19492
19492
  const [pa, pb] = [parse(a), parse(b)];
@@ -19637,10 +19637,12 @@ ${BOLD2}Flyspace Setup${RESET2}
19637
19637
  if (!isHostServiceInstalled() || serviceBinaryMissing(hostServiceFile())) {
19638
19638
  hostRunning = await installHostService();
19639
19639
  if (hostRunning) ok(`Host running in the background ${DIM2}logs: ${tilde2(paths.LOG_DIR)}/host.log${RESET2}`);
19640
+ } else if (args.includes("--restart")) {
19641
+ hostRunning = await installHostService();
19642
+ restartHostServices(workspaces);
19640
19643
  } else {
19641
19644
  hostRunning = true;
19642
- if (args.includes("--restart")) restartHostServices(workspaces);
19643
- else ok("Host service already installed");
19645
+ ok("Host service already installed");
19644
19646
  }
19645
19647
  }
19646
19648
  console.log("\n Next:");
@@ -20106,7 +20108,7 @@ function npmEnv(target) {
20106
20108
  return nodeBin ? { ...process.env, PATH: `${nodeBin}:${process.env.PATH ?? ""}` } : process.env;
20107
20109
  }
20108
20110
  async function runUpgrade() {
20109
- const current = "0.1.39";
20111
+ const current = "0.1.40";
20110
20112
  console.log(`Current version: ${current}`);
20111
20113
  console.log("Checking for updates...\n");
20112
20114
  try {
@@ -29793,6 +29795,8 @@ import { Hono as Hono19 } from "hono";
29793
29795
  var GROQ_API_URL8 = "https://api.groq.com/openai/v1/chat/completions";
29794
29796
  var MODEL2 = "openai/gpt-oss-20b";
29795
29797
  var MAX_BEFORE_CHARS = 2e3;
29798
+ var MAX_THREAD_CHARS = 1500;
29799
+ var THREAD_TAIL_REPLIES = 5;
29796
29800
  var RULES2 = "You autocomplete a chat message as the user types. Output ONLY the next few words that continue the draft (at most one short sentence), with no quotes or explanation. Match the draft's language and tone. Start with a space if the continuation needs one. If no confident continuation exists, output nothing.";
29797
29801
  function createAutocompleteRouter() {
29798
29802
  const app = new Hono19();
@@ -29805,9 +29809,11 @@ function createAutocompleteRouter() {
29805
29809
  const before = typeof body?.before === "string" ? body.before.slice(-MAX_BEFORE_CHARS) : "";
29806
29810
  if (before.trim().length < 3) return c.json({ text: "" });
29807
29811
  const channel = typeof body?.channelId === "string" ? getChannelRegistry().find((ch) => ch.id === body.channelId) : void 0;
29808
- const context = channel ? `Channel: #${channel.name}${channel.prompt ? `
29809
- Channel instructions: ${channel.prompt.slice(0, 500)}` : ""}
29810
-
29812
+ const visible = channel && canSeeChannel(channel, c.get("auth")) ? channel : void 0;
29813
+ const thread = visible && typeof body?.threadId === "string" ? await threadContext(visible, body.threadId) : "";
29814
+ const context = visible ? `Channel: #${visible.name}${visible.prompt ? `
29815
+ Channel instructions: ${visible.prompt.slice(0, 500)}` : ""}
29816
+ ${thread}
29811
29817
  ` : "";
29812
29818
  const res = await fetch(GROQ_API_URL8, {
29813
29819
  method: "POST",
@@ -29834,6 +29840,26 @@ ${before}` }
29834
29840
  });
29835
29841
  return app;
29836
29842
  }
29843
+ async function threadContext(channel, threadId) {
29844
+ const supabase = getSupabaseClient();
29845
+ const replies = () => supabase.from("thread_replies").select("id, author, body").eq("thread_id", threadId).is("archived_at", null);
29846
+ const [thread, opener, tail] = await Promise.all([
29847
+ supabase.from("threads").select("channel_id, title").eq("id", threadId).maybeSingle(),
29848
+ replies().order("created_at", { ascending: true }).limit(1),
29849
+ replies().order("created_at", { ascending: false }).limit(THREAD_TAIL_REPLIES)
29850
+ ]);
29851
+ const channelId = thread.data?.channel_id;
29852
+ if (!channelId || channelId !== channel.id && channelId !== channel.externalChannelId) return "";
29853
+ const rows = [...opener.data ?? []];
29854
+ for (const r of (tail.data ?? []).reverse())
29855
+ if (!rows.some((x) => x.id === r.id)) rows.push(r);
29856
+ const text = rows.map((r) => `${r.author}: ${r.body}`).join("\n\n").slice(-MAX_THREAD_CHARS);
29857
+ const title = thread.data?.title ? `Thread title: ${thread.data.title}
29858
+ ` : "";
29859
+ return text ? `${title}Conversation so far:
29860
+ ${text}
29861
+ ` : title;
29862
+ }
29837
29863
 
29838
29864
  // ../api/src/dashboard/avatars-routes.ts
29839
29865
  import { createHash as createHash9, randomUUID as randomUUID4 } from "crypto";
@@ -38703,7 +38729,7 @@ async function main() {
38703
38729
  break;
38704
38730
  case "-v":
38705
38731
  case "--version":
38706
- printRaw("0.1.39");
38732
+ printRaw("0.1.40");
38707
38733
  break;
38708
38734
  case "-h":
38709
38735
  case "--help":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flyspace-cli",
3
- "version": "0.1.39",
3
+ "version": "0.1.40",
4
4
  "description": "AI-native headless community OS",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "private": false,