flyspace-cli 0.1.16 → 0.1.18

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  getSupabaseClient
4
- } from "./chunk-ZBMYF5LX.js";
4
+ } from "./chunk-L3I3BPLP.js";
5
5
 
6
6
  // src/store/chat-admin-store.ts
7
7
  async function listChannels(profile) {
@@ -157,6 +157,9 @@ function setSupabaseClient(replacement) {
157
157
  function hasSupabaseCredentials() {
158
158
  return !!process.env["SUPABASE_URL"] && !!process.env["SUPABASE_SECRET_KEY"];
159
159
  }
160
+ function databaseReachable() {
161
+ return !!client || hasSupabaseCredentials();
162
+ }
160
163
  function getSupabaseClient() {
161
164
  if (client) return client;
162
165
  const url = process.env["SUPABASE_URL"];
@@ -319,7 +322,7 @@ function deriveThreadTitle(text) {
319
322
  }
320
323
  async function syncPostToDashboard(opts) {
321
324
  const { channelId, ts, threadTs, text } = opts;
322
- if (!process.env["SUPABASE_URL"] || !process.env["SUPABASE_SECRET_KEY"]) {
325
+ if (!databaseReachable()) {
323
326
  console.warn("[dashboard-sync] Supabase not configured \u2014 skipping dashboard sync");
324
327
  return;
325
328
  }
@@ -430,6 +433,7 @@ export {
430
433
  sweepScratchDir,
431
434
  setSupabaseClient,
432
435
  hasSupabaseCredentials,
436
+ databaseReachable,
433
437
  getSupabaseClient,
434
438
  AGENT_AUTHOR,
435
439
  SYNCED_BOT_AUTHOR,
@@ -2,6 +2,7 @@
2
2
  import {
3
3
  AGENT_AUTHOR,
4
4
  SYNCED_BOT_AUTHOR,
5
+ databaseReachable,
5
6
  ensureDirs,
6
7
  getProfile,
7
8
  getR2Bucket,
@@ -12,7 +13,7 @@ import {
12
13
  runWithProfile,
13
14
  sweepScratchDir,
14
15
  syncPostToDashboard
15
- } from "./chunk-ZBMYF5LX.js";
16
+ } from "./chunk-L3I3BPLP.js";
16
17
 
17
18
  // src/index.ts
18
19
  import { execFile, spawn as spawn4 } from "child_process";
@@ -2619,9 +2620,6 @@ async function setWorkspaceStripeSubscription(workspaceId, fields) {
2619
2620
  }).eq("id", workspaceId);
2620
2621
  if (error) throw new Error(`setWorkspaceStripeSubscription(${workspaceId}): ${error.message}`);
2621
2622
  }
2622
- async function markWorkspaceAgentConnected(workspaceId) {
2623
- await stampOnce(workspaceId, "agent_connected_at");
2624
- }
2625
2623
  async function markWorkspaceProjectsSetup(workspaceId) {
2626
2624
  await stampOnce(workspaceId, "projects_setup_at");
2627
2625
  }
@@ -5514,7 +5512,7 @@ async function ownIdentityFor(client) {
5514
5512
  return own;
5515
5513
  }
5516
5514
  async function mirrorIncomingMessage(client, msg) {
5517
- if (!process.env["SUPABASE_URL"] || !process.env["SUPABASE_SECRET_KEY"]) return;
5515
+ if (!databaseReachable()) return;
5518
5516
  if (msg.subtype && SKIP_SUBTYPES.has(msg.subtype)) return;
5519
5517
  if (msg.subtype === "message_changed" || msg.subtype === "message_deleted") return;
5520
5518
  try {
@@ -8544,7 +8542,7 @@ function startUsageSync(store, workspace, options = {}) {
8544
8542
 
8545
8543
  // src/store/usage-recording.ts
8546
8544
  function installUsageRecording(dbPath, options = {}) {
8547
- const { sync = Boolean(process.env["SUPABASE_URL"] && process.env["SUPABASE_SECRET_KEY"]) } = options;
8545
+ const { sync = databaseReachable() } = options;
8548
8546
  const stores = /* @__PURE__ */ new Map();
8549
8547
  const stopSyncs = [];
8550
8548
  const storeFor = (profile) => {
@@ -8804,10 +8802,7 @@ async function startServer() {
8804
8802
  const store = new SessionStore(paths.DB_FILE);
8805
8803
  const runStore = new AutomationRunStore(paths.DB_FILE);
8806
8804
  installUsageRecording();
8807
- const hasSupabaseCreds = Boolean(
8808
- process.env["SUPABASE_URL"] && process.env["SUPABASE_SECRET_KEY"]
8809
- );
8810
- const stopRunSync = hasSupabaseCreds ? startAutomationRunSync(runStore, getProfile(), {
8805
+ const stopRunSync = databaseReachable() ? startAutomationRunSync(runStore, getProfile(), {
8811
8806
  onError: (error) => console.error(`[${ts2()}] [flyspace] automation run sync:`, error)
8812
8807
  }) : void 0;
8813
8808
  const reactionStore = new ReactionStore(paths.DB_FILE);
@@ -8872,7 +8867,6 @@ export {
8872
8867
  getChannelRegistry,
8873
8868
  getProfileChannelRegistry,
8874
8869
  findChannelById,
8875
- findChannelByAgentName,
8876
8870
  findChannel,
8877
8871
  startChannelRegistryPolling,
8878
8872
  isCwdUsable,
@@ -8949,7 +8943,6 @@ export {
8949
8943
  createWorkspace,
8950
8944
  deleteWorkspace,
8951
8945
  setWorkspaceStripeSubscription,
8952
- markWorkspaceAgentConnected,
8953
8946
  markWorkspaceProjectsSetup,
8954
8947
  markWorkspaceGreeted,
8955
8948
  getWorkspaceGreetedAt,
@@ -8979,12 +8972,10 @@ export {
8979
8972
  getAgentPaused,
8980
8973
  setAgentPaused,
8981
8974
  loadAgentMemory,
8982
- DEFAULT_TITLE_RULES,
8983
8975
  extractCategories,
8984
8976
  buildAutoTitle,
8985
8977
  BRANDING_DEFAULTS,
8986
8978
  getWorkspaceBranding,
8987
- localDefaults,
8988
8979
  loadDashboardSettings,
8989
8980
  saveDashboardSettings,
8990
8981
  loadWorkspaceBranding,