opencode-immune 1.0.33 → 1.0.35

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/plugin.js +43 -6
  2. package/package.json +1 -1
package/dist/plugin.js CHANGED
@@ -278,7 +278,14 @@ function isRetryableApiError(error) {
278
278
  message.includes("econnrefused") ||
279
279
  message.includes("econnreset") ||
280
280
  message.includes("etimedout") ||
281
- message.includes("fetch failed")) {
281
+ message.includes("fetch failed") ||
282
+ message.includes("timed out") ||
283
+ message.includes("timeout") ||
284
+ message.includes("sse read") ||
285
+ message.includes("stream error") ||
286
+ message.includes("connection reset") ||
287
+ message.includes("socket hang up") ||
288
+ message.includes("aborted")) {
282
289
  return true;
283
290
  }
284
291
  return false;
@@ -1316,10 +1323,41 @@ async function archiveProgress(directory) {
1316
1323
  }
1317
1324
  }
1318
1325
  }
1326
+ /**
1327
+ * Build a descriptive commit message from tasks.md context + diff stat.
1328
+ * Format: "feat(ultrawork): <task-name-short> [L<level>]"
1329
+ * Body: diff stat + phase info
1330
+ */
1331
+ async function buildCommitMessage(directory, diffStat) {
1332
+ try {
1333
+ const ctx = await parseTasksFile(directory);
1334
+ if (ctx) {
1335
+ // Truncate task name to ~45 chars for subject line
1336
+ let taskShort = ctx.task;
1337
+ if (taskShort.length > 45) {
1338
+ taskShort = taskShort.slice(0, 42) + "...";
1339
+ }
1340
+ const subject = `feat(ultrawork): ${taskShort}`;
1341
+ const parts = [];
1342
+ parts.push(`- Level: ${ctx.level}`);
1343
+ if (ctx.intent)
1344
+ parts.push(`- Intent: ${ctx.intent}`);
1345
+ if (ctx.category)
1346
+ parts.push(`- Category: ${ctx.category}`);
1347
+ parts.push(`- Phase: ${ctx.phase}`);
1348
+ if (diffStat)
1349
+ parts.push("", diffStat);
1350
+ return `${subject}\n\n${parts.join("\n")}`;
1351
+ }
1352
+ }
1353
+ catch { /* fallback below */ }
1354
+ // Fallback: no tasks.md or parse failed
1355
+ const body = diffStat ? `\n\n${diffStat}` : "";
1356
+ return `chore(ultrawork): cycle auto-commit${body}`;
1357
+ }
1319
1358
  /**
1320
1359
  * Helper: run git add + diff-stat + commit with descriptive message.
1321
- * Builds commit body from `git diff --cached --stat` so the commit
1322
- * is not an opaque "auto-commit" but shows what changed.
1360
+ * Reads tasks.md to build a meaningful commit subject from task context.
1323
1361
  * Returns true if commit succeeded (or nothing to commit), false on error.
1324
1362
  */
1325
1363
  function runGitCommit(directory) {
@@ -1332,10 +1370,9 @@ function runGitCommit(directory) {
1332
1370
  return;
1333
1371
  }
1334
1372
  // Get diff stat for commit body
1335
- (0, child_process_1.execFile)("git", ["diff", "--cached", "--stat"], { cwd: directory }, (_diffErr, diffOut) => {
1373
+ (0, child_process_1.execFile)("git", ["diff", "--cached", "--stat"], { cwd: directory }, async (_diffErr, diffOut) => {
1336
1374
  const stat = (diffOut ?? "").trim();
1337
- const body = stat ? `\n\n${stat}` : "";
1338
- const message = `chore: ultrawork cycle auto-commit${body}`;
1375
+ const message = await buildCommitMessage(directory, stat);
1339
1376
  (0, child_process_1.execFile)("git", ["commit", "-m", message], { cwd: directory }, (commitErr, stdout, stderr) => {
1340
1377
  if (commitErr) {
1341
1378
  if (stderr?.includes("nothing to commit") || stdout?.includes("nothing to commit")) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-immune",
3
- "version": "1.0.33",
3
+ "version": "1.0.35",
4
4
  "description": "OpenCode plugin: session recovery, auto-retry, multi-cycle automation, context monitoring",
5
5
  "exports": {
6
6
  "./server": "./dist/plugin.js"