@episoda/cli 0.2.209 → 0.2.211

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.
@@ -3051,7 +3051,7 @@ var require_package = __commonJS({
3051
3051
  "package.json"(exports2, module2) {
3052
3052
  module2.exports = {
3053
3053
  name: "@episoda/cli",
3054
- version: "0.2.209",
3054
+ version: "0.2.211",
3055
3055
  description: "CLI tool for Episoda local development workflow orchestration",
3056
3056
  main: "dist/index.js",
3057
3057
  types: "dist/index.d.ts",
@@ -12989,8 +12989,26 @@ var fs31 = __toESM(require("fs"));
12989
12989
  var os14 = __toESM(require("os"));
12990
12990
  var path31 = __toESM(require("path"));
12991
12991
  var INACTIVITY_TIMEOUT_MS3 = 30 * 60 * 1e3;
12992
- var CODEX_READINESS_SIGNAL = /OpenAI Codex/i;
12992
+ var CODEX_READINESS_SIGNAL = /(?:\d+% left ·|\bmodel:\s+gpt-)/i;
12993
+ var ANSI_ESCAPE_CODE_REGEX = /\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g;
12993
12994
  var sessions = /* @__PURE__ */ new Map();
12995
+ function killPtySessionsForModule(moduleUid) {
12996
+ const killedRunIds = [];
12997
+ for (const [id, session] of sessions.entries()) {
12998
+ if (session.moduleUid !== moduleUid) {
12999
+ continue;
13000
+ }
13001
+ if (session.watchdogTimer) clearTimeout(session.watchdogTimer);
13002
+ try {
13003
+ session.pty.kill();
13004
+ killedRunIds.push(id);
13005
+ } catch {
13006
+ cleanupCredentialDirs(session.credentialDirs);
13007
+ sessions.delete(id);
13008
+ }
13009
+ }
13010
+ return killedRunIds;
13011
+ }
12994
13012
  async function handlePtySpawn(payload, client) {
12995
13013
  const {
12996
13014
  moduleUid,
@@ -13275,7 +13293,8 @@ function maybeSeedBufferedInitialPrompt(session, data) {
13275
13293
  if (!startup.readinessObserved) {
13276
13294
  startup.earlyOutput += data;
13277
13295
  }
13278
- if (!startup.readinessObserved && CODEX_READINESS_SIGNAL.test(startup.earlyOutput)) {
13296
+ const normalizedEarlyOutput = startup.earlyOutput.replace(ANSI_ESCAPE_CODE_REGEX, "");
13297
+ if (!startup.readinessObserved && CODEX_READINESS_SIGNAL.test(normalizedEarlyOutput)) {
13279
13298
  startup.readinessObserved = true;
13280
13299
  startup.earlyOutput = "";
13281
13300
  }
@@ -16164,6 +16183,10 @@ var Daemon = class _Daemon {
16164
16183
  client.updateActivity();
16165
16184
  let result;
16166
16185
  try {
16186
+ const killedRunIds = killPtySessionsForModule(cmd.moduleUid);
16187
+ if (killedRunIds.length > 0) {
16188
+ console.log(`[Daemon] EP1500: Killed ${killedRunIds.length} PTY session(s) for done module ${cmd.moduleUid}`);
16189
+ }
16167
16190
  const projectRootPath = await findProjectRoot(cmd.worktreePath);
16168
16191
  if (!projectRootPath) {
16169
16192
  console.warn(`[Daemon] EP1035: Cannot find project root for ${cmd.worktreePath}`);