@staff0rd/assist 0.404.1 → 0.404.2

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
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@staff0rd/assist",
9
- version: "0.404.1",
9
+ version: "0.404.2",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -24121,6 +24121,7 @@ function toSessionInfo({
24121
24121
  cwd,
24122
24122
  restored,
24123
24123
  error,
24124
+ errorOutput,
24124
24125
  activity: activity2,
24125
24126
  autoRun,
24126
24127
  autoAdvance,
@@ -24145,6 +24146,7 @@ function toSessionInfo({
24145
24146
  cwd,
24146
24147
  restored,
24147
24148
  error,
24149
+ errorOutput,
24148
24150
  activity: activity2,
24149
24151
  autoRun,
24150
24152
  autoAdvance,
@@ -24782,6 +24784,26 @@ function recordSessionUsage(sessions, claudeSessionId, transcriptPath, usedPct,
24782
24784
  return false;
24783
24785
  }
24784
24786
 
24787
+ // src/commands/sessions/daemon/errorTail.ts
24788
+ var ESC4 = String.fromCharCode(27);
24789
+ var CSI = String.fromCharCode(155);
24790
+ var BEL = String.fromCharCode(7);
24791
+ var ANSI = new RegExp(
24792
+ String.raw`[${ESC4}${CSI}][[\]()#;?]*(?:(?:[a-zA-Z\d]*(?:;[a-zA-Z\d]*)*)?${BEL}|(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-ntqry=><~])`,
24793
+ "g"
24794
+ );
24795
+ var MAX_TAIL_LINES = 40;
24796
+ var MAX_TAIL_CHARS = 4e3;
24797
+ function stripAnsi(text17) {
24798
+ return text17.replace(ANSI, "");
24799
+ }
24800
+ function errorTail(scrollback) {
24801
+ const clean = stripAnsi(scrollback).replace(/\r\n?/g, "\n").replace(/[ \t]+\n/g, "\n").trimEnd();
24802
+ if (clean.length === 0) return "";
24803
+ const tail = clean.split("\n").slice(-MAX_TAIL_LINES).join("\n");
24804
+ return tail.length > MAX_TAIL_CHARS ? tail.slice(-MAX_TAIL_CHARS) : tail;
24805
+ }
24806
+
24785
24807
  // src/commands/sessions/daemon/watchActivity.ts
24786
24808
  import { existsSync as existsSync54, mkdirSync as mkdirSync24, watch } from "fs";
24787
24809
  import { dirname as dirname29 } from "path";
@@ -24895,7 +24917,18 @@ function handlePtyExit(session, exitCode, onStatusChange) {
24895
24917
  return;
24896
24918
  }
24897
24919
  const priorStatus = session.status;
24898
- const unexpected = priorStatus === "waiting" || exitCode !== 0;
24920
+ if (exitCode !== 0) {
24921
+ const tail = errorTail(session.scrollback);
24922
+ session.error = `process exited with code ${exitCode}`;
24923
+ session.errorOutput = tail || void 0;
24924
+ daemonLog(
24925
+ `session ${session.id} ("${session.name}") pty exited with code ${exitCode} from status "${priorStatus}" \u2014 unexpected exit, marking error; error output:
24926
+ ${tail || "(no output captured)"}`
24927
+ );
24928
+ onStatusChange(session, "error", exitCode);
24929
+ return;
24930
+ }
24931
+ const unexpected = priorStatus === "waiting";
24899
24932
  daemonLog(
24900
24933
  `session ${session.id} ("${session.name}") pty exited with code ${exitCode} from status "${priorStatus}" (${session.scrollback.length} bytes of output) \u2014 ${unexpected ? "unexpected exit, process died mid-session" : "expected completion"}; marking done`
24901
24934
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.404.1",
3
+ "version": "0.404.2",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {