episoda 0.2.91 → 0.2.93

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.
@@ -2786,7 +2786,7 @@ var require_package = __commonJS({
2786
2786
  "package.json"(exports2, module2) {
2787
2787
  module2.exports = {
2788
2788
  name: "episoda",
2789
- version: "0.2.91",
2789
+ version: "0.2.93",
2790
2790
  description: "CLI tool for Episoda local development workflow orchestration",
2791
2791
  main: "dist/index.js",
2792
2792
  types: "dist/index.d.ts",
@@ -6637,19 +6637,14 @@ var PreviewManager = class extends import_events3.EventEmitter {
6637
6637
  *
6638
6638
  * Must be called before starting any previews.
6639
6639
  * Initializes the tunnel manager (ensures cloudflared, cleans orphans).
6640
- * EP1119: Skips tunnel initialization in cloud mode - supervisord manages cloudflared there.
6640
+ * EP1148: TunnelManager initializes in both local and cloud modes for unified behavior.
6641
6641
  */
6642
6642
  async initialize() {
6643
6643
  if (this.initialized) {
6644
6644
  return;
6645
6645
  }
6646
6646
  console.log("[PreviewManager] Initializing...");
6647
- const modeConfig = getDaemonModeConfig();
6648
- if (modeConfig.mode === "cloud") {
6649
- console.log("[PreviewManager] EP1119: Skipping TunnelManager init in cloud mode");
6650
- } else {
6651
- await this.tunnel.initialize();
6652
- }
6647
+ await this.tunnel.initialize();
6653
6648
  this.initialized = true;
6654
6649
  console.log("[PreviewManager] Initialized");
6655
6650
  }
@@ -6666,7 +6661,7 @@ var PreviewManager = class extends import_events3.EventEmitter {
6666
6661
  * @returns Result with success status and preview URL
6667
6662
  */
6668
6663
  async startPreview(config) {
6669
- const { moduleUid, worktreePath, port = DEFAULT_PORT, customCommand, skipTunnel } = config;
6664
+ const { moduleUid, worktreePath, port = DEFAULT_PORT, customCommand } = config;
6670
6665
  if (!worktreePath) {
6671
6666
  return { success: false, error: "Worktree path is required" };
6672
6667
  }
@@ -6730,17 +6725,6 @@ var PreviewManager = class extends import_events3.EventEmitter {
6730
6725
  state.state = "running";
6731
6726
  this.emitStateChange(moduleUid, "running");
6732
6727
  console.log(`[PreviewManager] Dev server running on port ${port}`);
6733
- if (skipTunnel) {
6734
- console.log(`[PreviewManager] EP1119: Skipping tunnel management for ${moduleUid} (cloud mode)`);
6735
- state.state = "live";
6736
- this.emitStateChange(moduleUid, "live");
6737
- this.startingModules.delete(moduleUid);
6738
- return {
6739
- success: true,
6740
- previewUrl: void 0
6741
- // URL comes from Cloudflare Named Tunnel, not local
6742
- };
6743
- }
6744
6728
  console.log(`[PreviewManager] Starting Named Tunnel for ${moduleUid}...`);
6745
6729
  state.state = "tunneling";
6746
6730
  this.emitStateChange(moduleUid, "tunneling");
@@ -8259,6 +8243,10 @@ ${message}`;
8259
8243
  "--verbose"
8260
8244
  // Required for stream-json with --print
8261
8245
  ];
8246
+ if (session.credentials.preferredModel) {
8247
+ args.push("--model", session.credentials.preferredModel);
8248
+ console.log(`[AgentManager] EP1152: Using user preferred model: ${session.credentials.preferredModel}`);
8249
+ }
8262
8250
  if (isFirstMessage && session.systemPrompt) {
8263
8251
  args.push("--system-prompt", session.systemPrompt);
8264
8252
  }
@@ -9846,9 +9834,7 @@ var Daemon = class _Daemon {
9846
9834
  moduleUid: cmd.moduleUid,
9847
9835
  worktreePath: worktree.path,
9848
9836
  port,
9849
- customCommand,
9850
- skipTunnel: modeConfig.mode === "cloud"
9851
- // EP1119: Cloud mode - supervisord handles cloudflared
9837
+ customCommand
9852
9838
  });
9853
9839
  if (startResult.success) {
9854
9840
  console.log(`[Daemon] EP1024: Preview started for ${cmd.moduleUid}: ${startResult.previewUrl}`);
@@ -10818,27 +10804,25 @@ var Daemon = class _Daemon {
10818
10804
  );
10819
10805
  const modeConfig = getDaemonModeConfig();
10820
10806
  if (modeConfig.mode === "cloud") {
10821
- console.log(`[Daemon] EP1122: Cloud mode - auto-starting dev server for ${moduleUid}`);
10807
+ console.log(`[Daemon] EP1148: Cloud mode - auto-starting preview for ${moduleUid}`);
10822
10808
  try {
10823
10809
  const previewManager = getPreviewManager();
10824
10810
  const customCommand = setupConfig?.worktree_dev_server_script;
10825
- const port = modeConfig.fixedPort || 3e3;
10811
+ const port = allocatePort(moduleUid);
10826
10812
  const startResult = await previewManager.startPreview({
10827
10813
  moduleUid,
10828
10814
  worktreePath,
10829
10815
  port,
10830
- customCommand,
10831
- skipTunnel: true
10832
- // Cloud mode - supervisord manages cloudflared
10816
+ customCommand
10833
10817
  });
10834
10818
  if (startResult.success) {
10835
- console.log(`[Daemon] EP1122: Dev server started on port ${port} for ${moduleUid}`);
10819
+ console.log(`[Daemon] EP1148: Preview started on port ${port} for ${moduleUid}: ${startResult.previewUrl}`);
10836
10820
  } else {
10837
- console.warn(`[Daemon] EP1122: Dev server start failed (non-fatal): ${startResult.error}`);
10821
+ console.warn(`[Daemon] EP1148: Preview start failed (non-fatal): ${startResult.error}`);
10838
10822
  }
10839
10823
  } catch (previewError) {
10840
10824
  const errMsg = previewError instanceof Error ? previewError.message : String(previewError);
10841
- console.warn(`[Daemon] EP1122: Dev server auto-start error (non-fatal): ${errMsg}`);
10825
+ console.warn(`[Daemon] EP1148: Preview auto-start error (non-fatal): ${errMsg}`);
10842
10826
  }
10843
10827
  }
10844
10828
  return {