opencode-supertask 0.1.37 → 0.1.38

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/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  All notable user-facing changes are recorded here. This project follows semantic versioning while it is in the `0.x` development series.
4
4
 
5
+ ## [0.1.38] - 2026-07-18
6
+
7
+ ### Fixed
8
+
9
+ - `supertask doctor` now reads large resolved OpenCode configurations through a private temporary file, avoiding truncated JSON when OpenCode exits before a captured stdout pipe is fully drained.
10
+ - Successful runs no longer label truncated or unstructured JSONL fragments as failure reasons in task details and execution logs.
11
+
12
+ [0.1.38]: https://github.com/vbgate/opencode-supertask/compare/v0.1.37...v0.1.38
13
+
5
14
  ## [0.1.37] - 2026-07-18
6
15
 
7
16
  ### Fixed
package/dist/cli/index.js CHANGED
@@ -22229,8 +22229,18 @@ __export(update_exports, {
22229
22229
  updateGlobalCli: () => updateGlobalCli
22230
22230
  });
22231
22231
  import { spawnSync as spawnSync3 } from "child_process";
22232
- import { existsSync as existsSync6, readFileSync as readFileSync4, readdirSync, realpathSync } from "fs";
22233
- import { homedir as homedir4 } from "os";
22232
+ import {
22233
+ chmodSync as chmodSync3,
22234
+ closeSync,
22235
+ existsSync as existsSync6,
22236
+ mkdtempSync,
22237
+ openSync,
22238
+ readFileSync as readFileSync4,
22239
+ readdirSync,
22240
+ realpathSync,
22241
+ rmSync as rmSync2
22242
+ } from "fs";
22243
+ import { homedir as homedir4, tmpdir as tmpdir2 } from "os";
22234
22244
  import { dirname as dirname7, join as join5, resolve as resolve4 } from "path";
22235
22245
  function pluginAt(packageDir) {
22236
22246
  const packageJson = join5(packageDir, "package.json");
@@ -22467,11 +22477,6 @@ function resolveConfiguredPluginSpec(value) {
22467
22477
  };
22468
22478
  }
22469
22479
  function getOpenCodePluginDiagnostic() {
22470
- const result = spawnSync3(opencodeBin(), ["debug", "config", "--pure"], {
22471
- encoding: "utf8",
22472
- env: process.env,
22473
- timeout: 3e4
22474
- });
22475
22480
  const failed = (message) => ({
22476
22481
  ok: false,
22477
22482
  spec: "",
@@ -22481,51 +22486,77 @@ function getOpenCodePluginDiagnostic() {
22481
22486
  packageDir: null,
22482
22487
  error: message
22483
22488
  });
22484
- if (result.error) {
22485
- return failed(`[supertask] \u65E0\u6CD5\u8BFB\u53D6 OpenCode \u6700\u7EC8\u914D\u7F6E: ${result.error.message}`);
22486
- }
22487
- if (result.status !== 0) {
22488
- const detail = `${result.stderr ?? ""}`.trim();
22489
- return failed(`[supertask] \u65E0\u6CD5\u8BFB\u53D6 OpenCode \u6700\u7EC8\u914D\u7F6E: ${detail || `\u9000\u51FA\u7801 ${result.status}`}`);
22490
- }
22491
- let config;
22492
- try {
22493
- config = JSON.parse(`${result.stdout ?? ""}`);
22494
- } catch {
22495
- return failed("[supertask] OpenCode \u6700\u7EC8\u914D\u7F6E\u4E0D\u662F\u6709\u6548 JSON");
22496
- }
22497
- let configured;
22489
+ let outputDirectory = null;
22490
+ let outputFd = null;
22498
22491
  try {
22499
- configured = resolveConfiguredPluginSpec(config);
22500
- } catch (error) {
22501
- return failed(error instanceof Error ? error.message : String(error));
22502
- }
22503
- if (!configured.exact || configured.version === null) {
22504
- return {
22505
- ok: false,
22506
- ...configured,
22507
- cachedVersion: null,
22508
- packageDir: null,
22509
- error: `[supertask] OpenCode \u63D2\u4EF6\u5FC5\u987B\u56FA\u5B9A\u7CBE\u786E\u7248\u672C\uFF0C\u4E0D\u80FD\u4F7F\u7528 ${configured.spec}`
22510
- };
22511
- }
22512
- try {
22513
- const installed = resolveInstalledPluginVersion(configured.version);
22514
- return {
22515
- ok: true,
22516
- ...configured,
22517
- cachedVersion: installed.version,
22518
- packageDir: installed.packageDir,
22519
- error: null
22520
- };
22492
+ outputDirectory = mkdtempSync(join5(tmpdir2(), "opencode-supertask-config-"));
22493
+ chmodSync3(outputDirectory, 448);
22494
+ const outputPath = join5(outputDirectory, "resolved-config.json");
22495
+ outputFd = openSync(outputPath, "w", 384);
22496
+ const result = spawnSync3(opencodeBin(), ["debug", "config", "--pure"], {
22497
+ encoding: "utf8",
22498
+ env: process.env,
22499
+ timeout: 3e4,
22500
+ stdio: ["ignore", outputFd, "pipe"]
22501
+ });
22502
+ closeSync(outputFd);
22503
+ outputFd = null;
22504
+ if (result.error) {
22505
+ return failed(`[supertask] \u65E0\u6CD5\u8BFB\u53D6 OpenCode \u6700\u7EC8\u914D\u7F6E: ${result.error.message}`);
22506
+ }
22507
+ if (result.status !== 0) {
22508
+ const detail = `${result.stderr ?? ""}`.trim();
22509
+ return failed(`[supertask] \u65E0\u6CD5\u8BFB\u53D6 OpenCode \u6700\u7EC8\u914D\u7F6E: ${detail || `\u9000\u51FA\u7801 ${result.status}`}`);
22510
+ }
22511
+ let config;
22512
+ try {
22513
+ config = JSON.parse(readFileSync4(outputPath, "utf8"));
22514
+ } catch {
22515
+ return failed("[supertask] OpenCode \u6700\u7EC8\u914D\u7F6E\u4E0D\u662F\u6709\u6548 JSON");
22516
+ }
22517
+ let configured;
22518
+ try {
22519
+ configured = resolveConfiguredPluginSpec(config);
22520
+ } catch (error) {
22521
+ return failed(error instanceof Error ? error.message : String(error));
22522
+ }
22523
+ if (!configured.exact || configured.version === null) {
22524
+ return {
22525
+ ok: false,
22526
+ ...configured,
22527
+ cachedVersion: null,
22528
+ packageDir: null,
22529
+ error: `[supertask] OpenCode \u63D2\u4EF6\u5FC5\u987B\u56FA\u5B9A\u7CBE\u786E\u7248\u672C\uFF0C\u4E0D\u80FD\u4F7F\u7528 ${configured.spec}`
22530
+ };
22531
+ }
22532
+ try {
22533
+ const installed = resolveInstalledPluginVersion(configured.version);
22534
+ return {
22535
+ ok: true,
22536
+ ...configured,
22537
+ cachedVersion: installed.version,
22538
+ packageDir: installed.packageDir,
22539
+ error: null
22540
+ };
22541
+ } catch (error) {
22542
+ return {
22543
+ ok: false,
22544
+ ...configured,
22545
+ cachedVersion: null,
22546
+ packageDir: null,
22547
+ error: error instanceof Error ? error.message : String(error)
22548
+ };
22549
+ }
22521
22550
  } catch (error) {
22522
- return {
22523
- ok: false,
22524
- ...configured,
22525
- cachedVersion: null,
22526
- packageDir: null,
22527
- error: error instanceof Error ? error.message : String(error)
22528
- };
22551
+ return failed(`[supertask] \u65E0\u6CD5\u8BFB\u53D6 OpenCode \u6700\u7EC8\u914D\u7F6E: ${error instanceof Error ? error.message : String(error)}`);
22552
+ } finally {
22553
+ if (outputFd !== null) {
22554
+ try {
22555
+ closeSync(outputFd);
22556
+ } catch {
22557
+ }
22558
+ }
22559
+ if (outputDirectory !== null) rmSync2(outputDirectory, { recursive: true, force: true });
22529
22560
  }
22530
22561
  }
22531
22562
  function installPluginVersion(version2) {
@@ -27740,7 +27771,7 @@ function shellQuote(value) {
27740
27771
  if (/^[A-Za-z0-9_./:@%+=,-]+$/.test(value)) return value;
27741
27772
  return `'${value.replace(/'/g, `'"'"'`)}'`;
27742
27773
  }
27743
- function presentRunLog(log) {
27774
+ function presentRunLog(log, includeErrors = true) {
27744
27775
  let command = null;
27745
27776
  const textParts = [];
27746
27777
  const errors = [];
@@ -27752,7 +27783,7 @@ function presentRunLog(log) {
27752
27783
  try {
27753
27784
  parsed = recordValue(JSON.parse(trimmed));
27754
27785
  } catch {
27755
- errors.push(line);
27786
+ if (includeErrors) errors.push(line);
27756
27787
  continue;
27757
27788
  }
27758
27789
  if (!parsed) continue;
@@ -27776,7 +27807,7 @@ function presentRunLog(log) {
27776
27807
  const tool = typeof part?.tool === "string" ? part.tool : typeof parsed.tool === "string" ? parsed.tool : null;
27777
27808
  if (tool && (eventType === "tool_use" || partType === "tool")) tools.push(tool);
27778
27809
  const error = typeof parsed.error === "string" ? parsed.error : typeof part?.error === "string" ? part.error : null;
27779
- if (error) errors.push(error);
27810
+ if (error && includeErrors) errors.push(error);
27780
27811
  }
27781
27812
  return {
27782
27813
  command,
@@ -27785,8 +27816,8 @@ function presentRunLog(log) {
27785
27816
  tools
27786
27817
  };
27787
27818
  }
27788
- function renderRunLog(runId, taskName, log, locale) {
27789
- const presentation = presentRunLog(log);
27819
+ function renderRunLog(runId, taskName, log, locale, includeErrors) {
27820
+ const presentation = presentRunLog(log, includeErrors);
27790
27821
  const command = presentation.command ? `<div class="run-command"><div class="log-section-head"><strong>${t(locale, "logs.command")}</strong><button type="button" class="btn" onclick="copyRunCommand(${runId})">${icon("copy")}${t(locale, "action.copyCommand")}</button></div><div class="command-cwd">${esc(presentation.command.cwd)}</div><pre id="command-${runId}">${esc(presentation.command.command)}</pre></div>` : "";
27791
27822
  const errors = presentation.errors.length > 0 ? `<div class="run-error"><strong>${t(locale, "logs.error")}</strong><pre>${esc(presentation.errors.join("\n"))}</pre></div>` : "";
27792
27823
  const tools = presentation.tools.length > 0 ? `<div class="run-tools"><strong>${t(locale, "logs.tools")}</strong><div class="actions">${presentation.tools.map((tool) => `<span class="tag">${esc(tool)}</span>`).join("")}</div></div>` : "";
@@ -28234,7 +28265,7 @@ var init_web = __esm({
28234
28265
  const rows = runs.map((run) => {
28235
28266
  const status = safeStatus(run.status);
28236
28267
  const resumable = isValidSessionId(run.sessionId);
28237
- const log = run.log ? renderRunLog(run.id, run.taskName, run.log, locale) : "";
28268
+ const log = run.log ? renderRunLog(run.id, run.taskName, run.log, locale, run.status !== "done") : "";
28238
28269
  return `<tr class="run-summary-row">
28239
28270
  <td class="faint" data-label="${t(locale, "table.run")}">#${run.id}</td>
28240
28271
  <td data-primary data-label="${t(locale, "table.task")}"><div class="task-name">${esc(run.taskName)} <span class="faint">#${run.taskId}</span></div>${run.model ? `<div style="margin-top:4px"><span class="tag">${esc(run.model)}</span></div>` : ""}</td>
@@ -28365,7 +28396,7 @@ var init_web = __esm({
28365
28396
  const runs = await TaskRunService.listByTaskId(id);
28366
28397
  return c.json({
28367
28398
  ...task,
28368
- _resultPresentation: task.resultLog ? presentRunLog(task.resultLog) : null,
28399
+ _resultPresentation: task.resultLog ? presentRunLog(task.resultLog, task.status !== "done") : null,
28369
28400
  _runs: runs
28370
28401
  });
28371
28402
  });