oasis_test 0.1.48 → 0.1.50

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.
Files changed (2) hide show
  1. package/dist/index.js +43 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -38755,10 +38755,26 @@ var init_codex = __esm({
38755
38755
  if (stdoutErrorLines.length > 10) stdoutErrorLines.shift();
38756
38756
  }
38757
38757
  };
38758
+ const streamErrorMessages = [];
38759
+ const pushStreamErrorLine = (line) => {
38760
+ let obj;
38761
+ try {
38762
+ obj = JSON.parse(line);
38763
+ } catch {
38764
+ return;
38765
+ }
38766
+ if (obj?.type === "error" && typeof obj.message === "string") {
38767
+ streamErrorMessages.push(obj.message);
38768
+ } else if (obj?.type === "turn.failed" && typeof obj.error?.message === "string") {
38769
+ streamErrorMessages.push(obj.error.message);
38770
+ }
38771
+ if (streamErrorMessages.length > 5) streamErrorMessages.shift();
38772
+ };
38758
38773
  const rl = readline2.createInterface({ input: child.stdout });
38759
38774
  rl.on("line", (line) => {
38760
38775
  out.write(line + "\n");
38761
38776
  pushStdoutErrorLine(line);
38777
+ pushStreamErrorLine(line);
38762
38778
  emitNormalized(normalizeCodexStreamLine(line, normalizeState));
38763
38779
  });
38764
38780
  const errRl = readline2.createInterface({ input: child.stderr });
@@ -38806,11 +38822,13 @@ var init_codex = __esm({
38806
38822
  const telemetry = scanCodexTelemetry(dir, startedAtMs);
38807
38823
  const model = telemetry.model ?? job.model ?? this.opts.model;
38808
38824
  const runtimeSessionId = telemetry.sessionId ?? (job.resumeRuntimeSession ? job.runtimeSessionId : void 0);
38809
- const isError = !killedByUs && typeof code === "number" && code !== 0;
38810
- const errorMessage = isError ? [...stdoutErrorLines, ...stderrTail].join("\n").trim().slice(-4e3) || void 0 : void 0;
38825
+ const sawStreamError = streamErrorMessages.length > 0;
38826
+ const isError = !killedByUs && (typeof code === "number" && code !== 0 || sawStreamError);
38827
+ const errorMessage = isError ? [...streamErrorMessages, ...stdoutErrorLines, ...stderrTail].join("\n").trim().slice(-4e3) || void 0 : void 0;
38828
+ const reason = killedByUs ? "timeout" : sawStreamError ? "error" : code === 0 ? "clean" : "error";
38811
38829
  finish({
38812
38830
  code: killedByUs ? null : code,
38813
- reason: killedByUs ? "timeout" : code === 0 ? "clean" : "error",
38831
+ reason,
38814
38832
  transcriptRef,
38815
38833
  ...telemetry.usage ? { usage: telemetry.usage } : {},
38816
38834
  ...model ? { model } : {},
@@ -56164,13 +56182,29 @@ async function startServe(opts) {
56164
56182
  });
56165
56183
  }
56166
56184
  });
56167
- if (info.code === 0) resolve4();
56185
+ const failed = info.code !== 0 || info.reason !== void 0 && info.reason !== "clean";
56186
+ if (!failed) resolve4();
56168
56187
  else {
56169
- const detail = info.errorMessage?.trim();
56170
- const generic = `runtime exited with code ${info.code ?? "null"}${info.reason ? ` (${info.reason})` : ""}`;
56171
- reject(new Error(detail ? `${generic}
56188
+ const genericLine = `runtime exited with code ${info.code ?? "null"}${info.reason ? ` (${info.reason})` : ""}`;
56189
+ let detail = info.errorMessage?.trim() ?? "";
56190
+ if (!detail && info.transcriptRef) {
56191
+ try {
56192
+ const stat3 = fs18.statSync(info.transcriptRef);
56193
+ const size = Math.min(stat3.size, 4e3);
56194
+ const buf = Buffer.alloc(size);
56195
+ const fd = fs18.openSync(info.transcriptRef, "r");
56196
+ try {
56197
+ fs18.readSync(fd, buf, 0, size, Math.max(0, stat3.size - size));
56198
+ } finally {
56199
+ fs18.closeSync(fd);
56200
+ }
56201
+ detail = buf.toString("utf8").trim();
56202
+ } catch {
56203
+ }
56204
+ }
56205
+ reject(new Error(detail ? `${genericLine}
56172
56206
 
56173
- ${detail}` : generic));
56207
+ ${detail}` : genericLine));
56174
56208
  }
56175
56209
  });
56176
56210
  });
@@ -58771,7 +58805,7 @@ ${res.warning}`);
58771
58805
  }
58772
58806
 
58773
58807
  // src/index.ts
58774
- var PKG_VERSION = true ? "0.1.48" : "dev";
58808
+ var PKG_VERSION = true ? "0.1.50" : "dev";
58775
58809
  var OASIS_DIR = path19.join(os11.homedir(), ".oasis");
58776
58810
  var CONFIG_FILE = path19.join(OASIS_DIR, "node-config.json");
58777
58811
  var PID_FILE = path19.join(OASIS_DIR, "node.pid");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oasis_test",
3
- "version": "0.1.48",
3
+ "version": "0.1.50",
4
4
  "description": "Oasis node daemon + CLI — background daemon, auto-start, full server CLI",
5
5
  "bin": {
6
6
  "oasis": "./dist/index.js"