@episoda/cli 0.2.203 → 0.2.205

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.
package/dist/index.js CHANGED
@@ -3046,7 +3046,7 @@ var require_package = __commonJS({
3046
3046
  "package.json"(exports2, module2) {
3047
3047
  module2.exports = {
3048
3048
  name: "@episoda/cli",
3049
- version: "0.2.203",
3049
+ version: "0.2.205",
3050
3050
  description: "CLI tool for Episoda local development workflow orchestration",
3051
3051
  main: "dist/index.js",
3052
3052
  types: "dist/index.d.ts",
@@ -13926,7 +13926,18 @@ var path34 = __toESM(require("path"));
13926
13926
  var INACTIVITY_TIMEOUT_MS3 = 30 * 60 * 1e3;
13927
13927
  var sessions = /* @__PURE__ */ new Map();
13928
13928
  async function handlePtySpawn(payload, client) {
13929
- const { moduleUid, agent_run_id, command, args, stdin, env, cwd, cols = 220, rows = 50 } = payload;
13929
+ const {
13930
+ moduleUid,
13931
+ agent_run_id,
13932
+ run_type = "one_shot",
13933
+ command,
13934
+ args,
13935
+ stdin,
13936
+ env,
13937
+ cwd,
13938
+ cols = 220,
13939
+ rows = 50
13940
+ } = payload;
13930
13941
  if (sessions.has(agent_run_id)) {
13931
13942
  console.warn(`[PTY] Session already exists for agent_run_id ${agent_run_id}, ignoring spawn`);
13932
13943
  return { success: false, error: "PTY session already exists for this agent run." };
@@ -13968,6 +13979,7 @@ async function handlePtySpawn(payload, client) {
13968
13979
  pty: proc,
13969
13980
  moduleUid,
13970
13981
  agent_run_id,
13982
+ runType: run_type,
13971
13983
  startedAt: Date.now(),
13972
13984
  lastOutputAt: Date.now(),
13973
13985
  watchdogTimer: null,
@@ -13999,7 +14011,7 @@ async function handlePtySpawn(payload, client) {
13999
14011
  });
14000
14012
  });
14001
14013
  if (typeof stdin === "string" && stdin.trim().length > 0) {
14002
- proc.write(`${stdin.replace(/\n/g, "\r")}\r`);
14014
+ proc.write(`${stdin}\r`);
14003
14015
  }
14004
14016
  proc.onExit(({ exitCode }) => {
14005
14017
  const durationMs = Date.now() - session.startedAt;
@@ -14059,7 +14071,14 @@ function handlePtyStdin(payload) {
14059
14071
  return { success: false, error: `PTY session ${agent_run_id} belongs to ${target.moduleUid}, not ${module_uid}` };
14060
14072
  }
14061
14073
  try {
14062
- target.pty.write(`${text.replace(/\n/g, "\r")}\r`);
14074
+ if (text.length === 0) {
14075
+ return { success: true };
14076
+ }
14077
+ if (target.runType === "persistent" && text.trim() === "SHUTDOWN") {
14078
+ target.pty.kill();
14079
+ return { success: true };
14080
+ }
14081
+ target.pty.write(`${text}\r`);
14063
14082
  return { success: true };
14064
14083
  } catch (error) {
14065
14084
  return { success: false, error: error?.message || "Failed to write PTY stdin" };