agor-live 0.4.6 → 0.4.8

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.
@@ -22,6 +22,10 @@ declare class Init extends Command {
22
22
  * Detect if running in GitHub Codespaces
23
23
  */
24
24
  private isCodespaces;
25
+ /**
26
+ * Detect if running in dev mode (from source) vs agor-live (npm package)
27
+ */
28
+ private isDevMode;
25
29
  run(): Promise<void>;
26
30
  /**
27
31
  * Clean up existing installation
@@ -78,6 +78,13 @@ var Init = class _Init extends Command {
78
78
  isCodespaces() {
79
79
  return process.env.CODESPACES === "true" || process.env.CODESPACE_NAME !== void 0;
80
80
  }
81
+ /**
82
+ * Detect if running in dev mode (from source) vs agor-live (npm package)
83
+ */
84
+ async isDevMode() {
85
+ const corePackagePath = join(process.cwd(), "packages", "core");
86
+ return this.pathExists(corePackagePath);
87
+ }
81
88
  async run() {
82
89
  const { flags } = await this.parse(_Init);
83
90
  this.log("\u2728 Initializing Agor...\n");
@@ -252,20 +259,31 @@ var Init = class _Init extends Command {
252
259
  const host = config.daemon?.host || "localhost";
253
260
  const port = config.daemon?.port || 3030;
254
261
  const daemonRunning = await isDaemonRunning(`http://${host}:${port}`);
262
+ const isDevMode = await this.isDevMode();
255
263
  this.log(chalk.bold("Next steps:"));
256
264
  if (daemonRunning) {
257
265
  this.log(chalk.yellow(" \u26A0\uFE0F Daemon is currently running with old configuration"));
258
266
  this.log(chalk.yellow(" Please restart the daemon to apply changes:"));
259
267
  this.log("");
260
268
  this.log(" 1. Stop the daemon (Ctrl+C in the daemon terminal)");
261
- this.log(" 2. Restart: cd apps/agor-daemon && pnpm dev");
262
- this.log(" 3. Or: pnpm agor daemon");
269
+ if (isDevMode) {
270
+ this.log(" 2. Restart: cd apps/agor-daemon && pnpm dev");
271
+ } else {
272
+ this.log(" 2. Restart: agor daemon start");
273
+ }
263
274
  } else {
264
- this.log(" - Start the daemon: pnpm agor daemon");
265
- this.log(" - Or in dev mode: cd apps/agor-daemon && pnpm dev");
275
+ if (isDevMode) {
276
+ this.log(" - Start the daemon: cd apps/agor-daemon && pnpm dev");
277
+ } else {
278
+ this.log(" - Start the daemon: agor daemon start");
279
+ }
266
280
  }
267
281
  this.log("");
268
- this.log(" - View sessions: pnpm agor session list");
282
+ if (isDevMode) {
283
+ this.log(" - View sessions: pnpm agor session list");
284
+ } else {
285
+ this.log(" - View sessions: agor session list");
286
+ }
269
287
  this.log("");
270
288
  }
271
289
  /**
@@ -704,6 +704,9 @@ var init_routes = __esm({
704
704
 
705
705
  // src/index.ts
706
706
  import "dotenv/config";
707
+ import { readFile as readFile2 } from "fs/promises";
708
+ import { dirname as dirname2, join as join3 } from "path";
709
+ import { fileURLToPath } from "url";
707
710
  import { loadConfig as loadConfig3 } from "@agor/core/config";
708
711
  import {
709
712
  createDatabase,
@@ -730,7 +733,6 @@ import { registerHandlebarsHelpers } from "@agor/core/templates/handlebars-helpe
730
733
  import { ClaudeTool, CodexTool, GeminiTool } from "@agor/core/tools";
731
734
  import { SessionStatus as SessionStatus2, TaskStatus as TaskStatus2 } from "@agor/core/types";
732
735
  import { homedir as homedir2 } from "os";
733
- import { join as join3 } from "path";
734
736
  import cors from "cors";
735
737
  import express from "express";
736
738
  import swagger from "feathers-swagger";
@@ -2915,17 +2917,24 @@ var AnonymousStrategy = class extends AuthenticationBaseStrategy {
2915
2917
  // src/index.ts
2916
2918
  var DAEMON_VERSION = "0.0.0";
2917
2919
  try {
2918
- let pkgPath = new URL("../package.json", import.meta.url);
2919
- let pkg;
2920
+ const __dirname2 = dirname2(fileURLToPath(import.meta.url));
2921
+ let pkgPath = join3(__dirname2, "../package.json");
2922
+ let pkgData;
2920
2923
  try {
2921
- pkg = await import(pkgPath.href);
2924
+ pkgData = await readFile2(pkgPath, "utf-8");
2922
2925
  } catch {
2923
- pkgPath = new URL("../../package.json", import.meta.url);
2924
- pkg = await import(pkgPath.href);
2926
+ pkgPath = join3(__dirname2, "../../package.json");
2927
+ try {
2928
+ pkgData = await readFile2(pkgPath, "utf-8");
2929
+ } catch {
2930
+ }
2931
+ }
2932
+ if (pkgData) {
2933
+ const pkg = JSON.parse(pkgData);
2934
+ DAEMON_VERSION = pkg.version || DAEMON_VERSION;
2925
2935
  }
2926
- DAEMON_VERSION = pkg?.default?.version || DAEMON_VERSION;
2927
- } catch {
2928
- console.warn("\u26A0\uFE0F Could not read package.json for version - using fallback 0.0.0");
2936
+ } catch (err) {
2937
+ console.warn("\u26A0\uFE0F Could not read package.json for version - using fallback 0.0.0", err);
2929
2938
  }
2930
2939
  function isPaginated(result) {
2931
2940
  return !Array.isArray(result) && "data" in result && "total" in result;
@@ -2976,10 +2985,10 @@ async function main() {
2976
2985
  const isProduction = process.env.NODE_ENV === "production";
2977
2986
  if (isProduction) {
2978
2987
  const path = await import("path");
2979
- const { fileURLToPath } = await import("url");
2988
+ const { fileURLToPath: fileURLToPath2 } = await import("url");
2980
2989
  const { existsSync } = await import("fs");
2981
- const dirname2 = typeof __dirname !== "undefined" ? __dirname : path.dirname(fileURLToPath(import.meta.url));
2982
- const uiPath = path.resolve(dirname2, "../ui");
2990
+ const dirname3 = typeof __dirname !== "undefined" ? __dirname : path.dirname(fileURLToPath2(import.meta.url));
2991
+ const uiPath = path.resolve(dirname3, "../ui");
2983
2992
  if (existsSync(uiPath)) {
2984
2993
  console.log(`\u{1F4C2} Serving UI from: ${uiPath}`);
2985
2994
  app.use("/ui", express.static(uiPath));