@episoda/cli 0.2.217 → 0.2.219

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.217",
3054
+ version: "0.2.219",
3055
3055
  description: "CLI tool for Episoda local development workflow orchestration",
3056
3056
  main: "dist/index.js",
3057
3057
  types: "dist/index.d.ts",
@@ -4896,7 +4896,7 @@ function generateCodexAuthJson(credentials) {
4896
4896
  id_token: credentials.idToken || credentials.accessToken,
4897
4897
  // Fallback to access_token if no id_token
4898
4898
  access_token: credentials.accessToken,
4899
- refresh_token: ""
4899
+ refresh_token: credentials.refreshToken || ""
4900
4900
  };
4901
4901
  if (credentials.accountId) {
4902
4902
  tokens.account_id = credentials.accountId;
@@ -13087,6 +13087,19 @@ var CODEX_BANNER_SIGNAL = /(openai codex|\bmodel:)/i;
13087
13087
  var CODEX_PROMPT_SIGNAL = /(?:^|\n)\s*(?:>|❯)\s*$/m;
13088
13088
  var MAX_CODEX_STARTUP_READY_TIMEOUT_MS = 3e4;
13089
13089
  var sessions = /* @__PURE__ */ new Map();
13090
+ function bestEffortTerminateProcessGroup(session) {
13091
+ if (process.platform === "win32") {
13092
+ return;
13093
+ }
13094
+ const pid = session.pty.pid;
13095
+ if (!pid || pid <= 0) {
13096
+ return;
13097
+ }
13098
+ try {
13099
+ process.kill(-pid, "SIGTERM");
13100
+ } catch {
13101
+ }
13102
+ }
13090
13103
  function killPtySessionsForModule(moduleUid) {
13091
13104
  const killedRunIds = [];
13092
13105
  for (const [id, session] of sessions.entries()) {
@@ -13095,6 +13108,7 @@ function killPtySessionsForModule(moduleUid) {
13095
13108
  }
13096
13109
  if (session.watchdogTimer) clearTimeout(session.watchdogTimer);
13097
13110
  try {
13111
+ bestEffortTerminateProcessGroup(session);
13098
13112
  session.pty.kill();
13099
13113
  killedRunIds.push(id);
13100
13114
  } catch {
@@ -13221,6 +13235,7 @@ async function handlePtySpawn(payload, client) {
13221
13235
  if (session.watchdogTimer) clearTimeout(session.watchdogTimer);
13222
13236
  console.log(`[PTY] Process exited for ${agent_run_id} with code ${exitCode} after ${durationMs}ms`);
13223
13237
  sessions.delete(agent_run_id);
13238
+ bestEffortTerminateProcessGroup(session);
13224
13239
  client.send({
13225
13240
  type: "pty_exit",
13226
13241
  moduleUid,
@@ -13277,6 +13292,7 @@ function handlePtyKill(payload) {
13277
13292
  return;
13278
13293
  }
13279
13294
  try {
13295
+ bestEffortTerminateProcessGroup(session);
13280
13296
  session.pty.kill();
13281
13297
  console.log(`[PTY] Kill signal sent for session ${agent_run_id}`);
13282
13298
  } catch {
@@ -13338,6 +13354,7 @@ function createCredentialBootstrap(payload, agentRunId) {
13338
13354
  const trustedProjectRoot = resolveCodexTrustedProjectRoot(payload);
13339
13355
  const configFiles = generateCodexConfig({
13340
13356
  accessToken: bootstrap.oauth.access_token,
13357
+ refreshToken: bootstrap.oauth.refresh_token,
13341
13358
  idToken: bootstrap.oauth.id_token,
13342
13359
  accountId: bootstrap.oauth.account_id
13343
13360
  }, trustedProjectRoot);