episoda 0.2.75 → 0.2.76

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.
@@ -2741,7 +2741,7 @@ var require_package = __commonJS({
2741
2741
  "package.json"(exports2, module2) {
2742
2742
  module2.exports = {
2743
2743
  name: "episoda",
2744
- version: "0.2.75",
2744
+ version: "0.2.76",
2745
2745
  description: "CLI tool for Episoda local development workflow orchestration",
2746
2746
  main: "dist/index.js",
2747
2747
  types: "dist/index.d.ts",
@@ -4187,6 +4187,27 @@ async function clearTunnelUrl(moduleUid) {
4187
4187
  }
4188
4188
  }
4189
4189
 
4190
+ // src/daemon/mode-config.ts
4191
+ var CLOUD_CONFIG = {
4192
+ mode: "cloud",
4193
+ portAllocation: "fixed",
4194
+ fixedPort: 3e3,
4195
+ orphanTunnelCleanup: false,
4196
+ orphanWorktreeCleanup: false,
4197
+ maxConcurrentModules: 1
4198
+ };
4199
+ var LOCAL_CONFIG = {
4200
+ mode: "local",
4201
+ portAllocation: "dynamic",
4202
+ orphanTunnelCleanup: true,
4203
+ orphanWorktreeCleanup: true,
4204
+ maxConcurrentModules: Infinity
4205
+ };
4206
+ function getDaemonModeConfig() {
4207
+ const mode = process.env.EPISODA_MODE;
4208
+ return mode === "cloud" ? CLOUD_CONFIG : LOCAL_CONFIG;
4209
+ }
4210
+
4190
4211
  // src/tunnel/tunnel-manager.ts
4191
4212
  var TUNNEL_PID_DIR = path7.join(os2.homedir(), ".episoda", "tunnels");
4192
4213
  var TUNNEL_TIMEOUTS = {
@@ -4386,8 +4407,9 @@ var TunnelManager = class extends import_events.EventEmitter {
4386
4407
  */
4387
4408
  async cleanupOrphanedProcesses() {
4388
4409
  const cleaned = [];
4389
- if (process.env.EPISODA_MODE === "cloud") {
4390
- console.log("[Tunnel] EP1111: Skipping orphan cleanup in cloud mode (supervisord manages cloudflared)");
4410
+ const modeConfig = getDaemonModeConfig();
4411
+ if (!modeConfig.orphanTunnelCleanup) {
4412
+ console.log(`[Tunnel] EP1115: Skipping orphan cleanup (mode: ${modeConfig.mode}, orphanTunnelCleanup: false)`);
4391
4413
  return { cleaned: 0, pids: [] };
4392
4414
  }
4393
4415
  try {
@@ -8103,6 +8125,15 @@ var Daemon = class _Daemon {
8103
8125
  this.startHealthCheckPolling();
8104
8126
  this.setupShutdownHandlers();
8105
8127
  console.log("[Daemon] Daemon started successfully");
8128
+ const modeConfig = getDaemonModeConfig();
8129
+ console.log("[Daemon] EP1115: Mode config:", {
8130
+ mode: modeConfig.mode,
8131
+ portAllocation: modeConfig.portAllocation,
8132
+ fixedPort: modeConfig.fixedPort,
8133
+ orphanTunnelCleanup: modeConfig.orphanTunnelCleanup,
8134
+ orphanWorktreeCleanup: modeConfig.orphanWorktreeCleanup,
8135
+ maxConcurrentModules: modeConfig.maxConcurrentModules
8136
+ });
8106
8137
  this.checkAndNotifyUpdates();
8107
8138
  }
8108
8139
  /**
@@ -8593,8 +8624,16 @@ var Daemon = class _Daemon {
8593
8624
  return;
8594
8625
  }
8595
8626
  console.log(`[Daemon] EP1024: Using worktree path ${worktree.path} for ${cmd.moduleUid}`);
8596
- const port = cmd.port || allocatePort(cmd.moduleUid);
8597
- console.log(`[Daemon] EP1038: Allocated port ${port} for ${cmd.moduleUid}`);
8627
+ const modeConfig = getDaemonModeConfig();
8628
+ let port;
8629
+ if (cmd.port) {
8630
+ port = cmd.port;
8631
+ } else if (modeConfig.portAllocation === "fixed" && modeConfig.fixedPort) {
8632
+ port = modeConfig.fixedPort;
8633
+ } else {
8634
+ port = allocatePort(cmd.moduleUid);
8635
+ }
8636
+ console.log(`[Daemon] EP1115: Using port ${port} for ${cmd.moduleUid} (mode: ${modeConfig.mode})`);
8598
8637
  const devConfig = await (0, import_core12.loadConfig)();
8599
8638
  const customCommand = devConfig?.project_settings?.worktree_dev_server_script;
8600
8639
  const startResult = await previewManager.startPreview({