flyspace-cli 0.1.19 → 0.1.21

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.
@@ -652,7 +652,7 @@ async function ensureChannelProvisioned(externalChannelId, opts = {}) {
652
652
  async function upsertChannelByAgentName(input) {
653
653
  const { data, error } = await getSupabaseClient().from("channels").upsert(
654
654
  { ...toRow(input), profile: getProfile(), updated_at: (/* @__PURE__ */ new Date()).toISOString() },
655
- { onConflict: "agent_name" }
655
+ { onConflict: "profile,agent_name" }
656
656
  ).select().single();
657
657
  if (error) throw new Error(error.message);
658
658
  await refreshChannelRegistry();
@@ -2634,6 +2634,13 @@ async function markWorkspaceProjectsSetup(workspaceId) {
2634
2634
  async function markWorkspaceGreeted(workspaceId) {
2635
2635
  await stampOnce(workspaceId, "greeted_at");
2636
2636
  }
2637
+ async function resetWorkspaceOnboarding(workspaceId) {
2638
+ const { error } = await getSupabaseClient().from("workspaces").update({ projects_setup_at: null, greeted_at: null }).eq("id", workspaceId);
2639
+ if (error) throw new Error(`resetWorkspaceOnboarding(${workspaceId}): ${error.message}`);
2640
+ for (const [slug, entry] of workspaceCache) {
2641
+ if (entry.workspace?.id === workspaceId) workspaceCache.delete(slug);
2642
+ }
2643
+ }
2637
2644
  async function getWorkspaceGreetedAt(workspaceId) {
2638
2645
  const { data, error } = await getSupabaseClient().from("workspaces").select("greeted_at").eq("id", workspaceId).maybeSingle();
2639
2646
  if (error) throw new Error(`getWorkspaceGreetedAt(${workspaceId}): ${error.message}`);
@@ -9021,6 +9028,7 @@ export {
9021
9028
  setWorkspaceStripeSubscription,
9022
9029
  markWorkspaceProjectsSetup,
9023
9030
  markWorkspaceGreeted,
9031
+ resetWorkspaceOnboarding,
9024
9032
  getWorkspaceGreetedAt,
9025
9033
  getWorkspaceByStripeCustomerId,
9026
9034
  getWorkspaceBilling,
package/dist/cli.js CHANGED
@@ -134,6 +134,7 @@ import {
134
134
  refreshChannelRegistry,
135
135
  refreshUserCache,
136
136
  requireSlackBotToken,
137
+ resetWorkspaceOnboarding,
137
138
  resetWorkspacePrompt,
138
139
  resolveChannelId,
139
140
  resolveChannelPrompt,
@@ -183,7 +184,7 @@ import {
183
184
  warnOnBrokenChannelCwds,
184
185
  workspaceSkillsDir,
185
186
  writeSkillFile
186
- } from "./chunk-GDPYN4HT.js";
187
+ } from "./chunk-GHGQCED7.js";
187
188
  import {
188
189
  firstReplyBody,
189
190
  getThread,
@@ -1448,6 +1449,9 @@ function linkProjectFolders(slug, items) {
1448
1449
  } catch {
1449
1450
  exists = false;
1450
1451
  }
1452
+ if (exists && item.name === "general" && !item.path) {
1453
+ cpSync(GENERAL_TEMPLATE_DIR, dest, { recursive: true, force: false });
1454
+ }
1451
1455
  if (!exists) {
1452
1456
  if (item.path) {
1453
1457
  const target = resolve3(item.path);
@@ -1773,7 +1777,7 @@ async function runAuthCmd(args) {
1773
1777
  }
1774
1778
 
1775
1779
  // ../api/src/version.ts
1776
- var CLI_VERSION = true ? "0.1.19" : null;
1780
+ var CLI_VERSION = true ? "0.1.21" : null;
1777
1781
  function isOlderVersion(a, b) {
1778
1782
  const parse = (v) => v.replace(/^v/, "").split("-")[0].split(".").map(Number);
1779
1783
  const [pa, pb] = [parse(a), parse(b)];
@@ -2343,7 +2347,7 @@ function npmEnv() {
2343
2347
  return home ? { ...process.env, PATH: `${join11(home, "node", "bin")}:${process.env.PATH ?? ""}` } : process.env;
2344
2348
  }
2345
2349
  async function runUpgrade() {
2346
- const current = "0.1.19";
2350
+ const current = "0.1.21";
2347
2351
  console.log(`Current version: ${current}`);
2348
2352
  console.log("Checking for updates...\n");
2349
2353
  try {
@@ -12937,11 +12941,8 @@ function createOnboardingRouter(agent) {
12937
12941
  const unknown = folders.find((f) => !offered.has(f));
12938
12942
  if (unknown) return c.json({ error: "folder was not offered by the scan" }, 400);
12939
12943
  const taken = new Set(getProfileChannelRegistry().map((ch) => ch.name));
12940
- const items = [];
12941
- if (!taken.has("general")) {
12942
- taken.add("general");
12943
- items.push({ name: "general" });
12944
- }
12944
+ taken.add("general");
12945
+ const items = [{ name: "general" }];
12945
12946
  for (const path of folders) items.push({ name: uniqueChannelName(offered.get(path).name, taken), path });
12946
12947
  const linked = await agent.linkProjectFolders?.(getProfile(), items);
12947
12948
  if (!linked) return c.json({ error: "host offline" }, 503);
@@ -12957,6 +12958,14 @@ function createOnboardingRouter(agent) {
12957
12958
  await markWorkspaceProjectsSetup(ctx.workspaceId);
12958
12959
  return c.json({ channels: created.map((ch) => ({ id: ch.id, name: ch.name })) }, 201);
12959
12960
  });
12961
+ app.post("/reset", async (c) => {
12962
+ const ctx = await resolveAuthContext(c);
12963
+ if (ctx?.role !== "admin") return c.json({ error: "admin access required" }, 403);
12964
+ const { error: error2 } = await getSupabaseClient().from("threads").delete().eq("client_key", ctx.workspaceId);
12965
+ if (error2) return c.json({ error: error2.message }, 500);
12966
+ await resetWorkspaceOnboarding(ctx.workspaceId);
12967
+ return c.json({ ok: true });
12968
+ });
12960
12969
  app.get("/greeting", async (c) => {
12961
12970
  const ctx = await resolveAuthContext(c);
12962
12971
  if (ctx?.role !== "admin") return c.json({ pending: false });
@@ -13146,6 +13155,7 @@ function registerDataRoutes(api, agent = {}) {
13146
13155
  memberEmails: ch.memberEmails,
13147
13156
  agentName: ch.agentName,
13148
13157
  dmKey: ch.dmKey,
13158
+ isDefault: ch.isDefault,
13149
13159
  archived: !!ch.archivedAt
13150
13160
  }));
13151
13161
  return c.json({
@@ -19564,7 +19574,7 @@ async function main() {
19564
19574
  break;
19565
19575
  case "-v":
19566
19576
  case "--version":
19567
- printRaw("0.1.19");
19577
+ printRaw("0.1.21");
19568
19578
  break;
19569
19579
  case "-h":
19570
19580
  case "--help":
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  startServer
4
- } from "./chunk-GDPYN4HT.js";
4
+ } from "./chunk-GHGQCED7.js";
5
5
  import "./chunk-GYHCSGMJ.js";
6
6
  export {
7
7
  startServer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flyspace-cli",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
4
4
  "description": "AI-native headless community OS",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "private": false,