episoda 0.2.111 → 0.2.113

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.
@@ -2815,7 +2815,7 @@ var require_package = __commonJS({
2815
2815
  "package.json"(exports2, module2) {
2816
2816
  module2.exports = {
2817
2817
  name: "episoda",
2818
- version: "0.2.110",
2818
+ version: "0.2.112",
2819
2819
  description: "CLI tool for Episoda local development workflow orchestration",
2820
2820
  main: "dist/index.js",
2821
2821
  types: "dist/index.d.ts",
@@ -8639,8 +8639,24 @@ var AgentManager = class {
8639
8639
  */
8640
8640
  async startSession(options) {
8641
8641
  const { sessionId, moduleId, moduleUid, projectPath, provider = "claude", autonomousMode = true, canWrite = true, readOnlyReason, message, credentials, systemPrompt, onChunk, onComplete, onError } = options;
8642
- if (this.sessions.has(sessionId)) {
8643
- return { success: false, error: "Session already exists" };
8642
+ const existingSession = this.sessions.get(sessionId);
8643
+ if (existingSession) {
8644
+ if (existingSession.provider === provider && existingSession.moduleId === moduleId) {
8645
+ console.log(`[AgentManager] EP1232: Session ${sessionId} already exists, treating start as message (idempotent)`);
8646
+ return this.sendMessage({
8647
+ sessionId,
8648
+ message,
8649
+ isFirstMessage: false,
8650
+ // Not first since session exists
8651
+ canWrite,
8652
+ readOnlyReason,
8653
+ onChunk,
8654
+ onComplete,
8655
+ onError
8656
+ });
8657
+ }
8658
+ console.log(`[AgentManager] EP1232: Session ${sessionId} exists with incompatible config - provider: ${existingSession.provider} vs ${provider}, module: ${existingSession.moduleId} vs ${moduleId}`);
8659
+ return { success: false, error: "Session already exists with incompatible configuration" };
8644
8660
  }
8645
8661
  const oauthToken = credentials?.oauthToken;
8646
8662
  const apiKey = credentials?.apiKey;
@@ -10626,19 +10642,14 @@ var Daemon = class _Daemon {
10626
10642
  }
10627
10643
  } else if (cmd.sessionContext === "project_root") {
10628
10644
  if (cmd.workspaceSlug && cmd.projectSlug) {
10629
- const resolvedProjectPath = path24.join(
10630
- process.env.HOME || projectPath,
10631
- "episoda",
10632
- cmd.workspaceSlug,
10633
- cmd.projectSlug
10634
- );
10645
+ const resolvedProjectPath = getProjectPath(cmd.workspaceSlug, cmd.projectSlug);
10635
10646
  if (resolvedProjectPath !== projectPath) {
10636
10647
  try {
10637
10648
  await fs23.promises.access(resolvedProjectPath);
10638
10649
  agentWorkingDir = resolvedProjectPath;
10639
- console.log(`[Daemon] EP1227: Agent for ${cmd.moduleUid || "project"} in resolved project path: ${agentWorkingDir}`);
10650
+ console.log(`[Daemon] EP1230: Agent for ${cmd.moduleUid || "project"} in resolved project path: ${agentWorkingDir}`);
10640
10651
  } catch {
10641
- console.log(`[Daemon] EP1227: Resolved project path not found, using projectPath: ${projectPath}`);
10652
+ console.log(`[Daemon] EP1230: Resolved project path not found, using projectPath: ${projectPath}`);
10642
10653
  }
10643
10654
  }
10644
10655
  } else {
@@ -11345,14 +11356,14 @@ var Daemon = class _Daemon {
11345
11356
  await tunnelManager.initialize();
11346
11357
  const moduleStatuses = [];
11347
11358
  const expectedModuleUids = new Set(modules.map((m) => m.uid));
11348
- for (const module2 of modules) {
11349
- const moduleUid = module2.uid;
11359
+ for (const mod of modules) {
11360
+ const moduleUid = mod.uid;
11350
11361
  const worktree = await getWorktreeInfoForModule(moduleUid);
11351
11362
  const tunnelRunning = tunnelManager.hasTunnel(moduleUid);
11352
11363
  const tunnelInfo = tunnelManager.getTunnel(moduleUid);
11353
11364
  const status = {
11354
11365
  moduleUid,
11355
- moduleState: module2.state,
11366
+ moduleState: mod.state,
11356
11367
  worktreeExists: worktree?.exists || false,
11357
11368
  worktreePath: worktree?.path,
11358
11369
  tunnelRunning,
@@ -11702,9 +11713,9 @@ var Daemon = class _Daemon {
11702
11713
  if (response.ok) {
11703
11714
  const data = await response.json();
11704
11715
  if (data.modules && Array.isArray(data.modules)) {
11705
- for (const module2 of data.modules) {
11706
- if (module2.uid) {
11707
- activeModuleUids.push(module2.uid);
11716
+ for (const mod of data.modules) {
11717
+ if (mod.uid) {
11718
+ activeModuleUids.push(mod.uid);
11708
11719
  }
11709
11720
  }
11710
11721
  }