nightralph 0.0.25 → 0.0.29

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/meta.json CHANGED
@@ -105,7 +105,7 @@
105
105
  "format": "esm"
106
106
  },
107
107
  "src/display.ts": {
108
- "bytes": 11996,
108
+ "bytes": 12060,
109
109
  "imports": [
110
110
  {
111
111
  "path": "<runtime>",
@@ -142,7 +142,7 @@
142
142
  "format": "esm"
143
143
  },
144
144
  "src/orchestrator.ts": {
145
- "bytes": 57999,
145
+ "bytes": 59570,
146
146
  "imports": [
147
147
  {
148
148
  "path": "node:child_process",
@@ -234,7 +234,7 @@
234
234
  "format": "esm"
235
235
  },
236
236
  "src/index.ts": {
237
- "bytes": 10043,
237
+ "bytes": 10237,
238
238
  "imports": [
239
239
  {
240
240
  "path": "node:fs",
@@ -305,7 +305,7 @@
305
305
  "imports": [],
306
306
  "exports": [],
307
307
  "inputs": {},
308
- "bytes": 164887
308
+ "bytes": 167652
309
309
  },
310
310
  "dist/index.js": {
311
311
  "imports": [
@@ -462,13 +462,13 @@
462
462
  "entryPoint": "src/index.ts",
463
463
  "inputs": {
464
464
  "src/index.ts": {
465
- "bytesInOutput": 6748
465
+ "bytesInOutput": 6851
466
466
  },
467
467
  "src/setup.ts": {
468
468
  "bytesInOutput": 4265
469
469
  },
470
470
  "src/orchestrator.ts": {
471
- "bytesInOutput": 40993
471
+ "bytesInOutput": 42025
472
472
  },
473
473
  "src/worktree.ts": {
474
474
  "bytesInOutput": 3788
@@ -480,7 +480,7 @@
480
480
  "bytesInOutput": 4995
481
481
  },
482
482
  "src/display.ts": {
483
- "bytesInOutput": 7877
483
+ "bytesInOutput": 7931
484
484
  },
485
485
  "src/testcmd.ts": {
486
486
  "bytesInOutput": 1911
@@ -489,7 +489,7 @@
489
489
  "bytesInOutput": 1937
490
490
  }
491
491
  },
492
- "bytes": 77379
492
+ "bytes": 78568
493
493
  }
494
494
  }
495
495
  }
@@ -318,7 +318,32 @@ function getProviderArgs(cmd) {
318
318
  return PROVIDER_ARGS[name] ?? [];
319
319
  }
320
320
  __name(getProviderArgs, "getProviderArgs");
321
- const THINKING_LEVELS = [
321
+ const EFFORT_LADDERS = {
322
+ pi: [
323
+ "off",
324
+ "minimal",
325
+ "low",
326
+ "medium",
327
+ "high",
328
+ "xhigh",
329
+ "max"
330
+ ],
331
+ claude: [
332
+ "low",
333
+ "medium",
334
+ "high",
335
+ "xhigh",
336
+ "max"
337
+ ],
338
+ codex: [
339
+ "minimal",
340
+ "low",
341
+ "medium",
342
+ "high",
343
+ "xhigh"
344
+ ]
345
+ };
346
+ const ALL_EFFORT_LEVELS = [
322
347
  "off",
323
348
  "minimal",
324
349
  "low",
@@ -327,12 +352,14 @@ const THINKING_LEVELS = [
327
352
  "xhigh",
328
353
  "max"
329
354
  ];
330
- function escalateThinking(level) {
355
+ function escalateEffort(provider, level) {
331
356
  if (!level) return "high";
332
- const i = THINKING_LEVELS.indexOf(level);
333
- return THINKING_LEVELS[Math.min(i + 1, THINKING_LEVELS.length - 1)];
357
+ const ladder = EFFORT_LADDERS[provider];
358
+ const i = ladder.indexOf(level);
359
+ if (i === -1) return level;
360
+ return ladder[Math.min(i + 1, ladder.length - 1)];
334
361
  }
335
- __name(escalateThinking, "escalateThinking");
362
+ __name(escalateEffort, "escalateEffort");
336
363
  function formatStreamLine(line) {
337
364
  let obj;
338
365
  try {
@@ -474,8 +501,21 @@ function spawnAgent(opts) {
474
501
  const providerName = basename(opts.agentCmd);
475
502
  const isClaude = providerName === "claude";
476
503
  const isPi = providerName === "pi";
477
- if (isPi && opts.thinking) {
478
- args.push("--thinking", opts.thinking);
504
+ if (opts.effort && providerName in EFFORT_LADDERS) {
505
+ const ladder = EFFORT_LADDERS[providerName];
506
+ if (!ladder.includes(opts.effort)) {
507
+ if (opts.onLine) {
508
+ opts.onLine(
509
+ `Warning: effort '${opts.effort}' not supported by ${providerName}, skipping`
510
+ );
511
+ }
512
+ } else if (isPi) {
513
+ args.push("--thinking", opts.effort);
514
+ } else if (isClaude) {
515
+ args.push("--effort", opts.effort);
516
+ } else if (providerName === "codex") {
517
+ args.push("-e", opts.effort);
518
+ }
479
519
  }
480
520
  const prefix = opts.label ? ` [${opts.label}] ` : " ";
481
521
  let promptFile = null;
@@ -706,7 +746,7 @@ Prompt for first ready ticket (${firstReady[0].filename}):
706
746
  Test command: ${opts.testCmd ?? "(none)"}`
707
747
  );
708
748
  console.log(
709
- `Thinking: ${opts.thinking ?? "(provider default)"}`
749
+ `Effort: ${opts.effort ?? "(provider default)"}`
710
750
  );
711
751
  console.log(
712
752
  `Retries: ${opts.retries ?? DEFAULT_RETRIES}`
@@ -835,7 +875,7 @@ async function respawnAndRetryMerge(opts) {
835
875
  return mergeResult.success;
836
876
  }
837
877
  __name(respawnAndRetryMerge, "respawnAndRetryMerge");
838
- const DEFAULT_RETRIES = 2;
878
+ const DEFAULT_RETRIES = 3;
839
879
  const DEFAULT_RETRY_DELAY = 30;
840
880
  function retryDelayFor(base, attempt) {
841
881
  return base * 2 ** (attempt - 2);
@@ -883,7 +923,7 @@ async function runTicketAttempt(opts) {
883
923
  cwd: worktree.worktreePath,
884
924
  label: ticket.filename.replace(/\.md$/, ""),
885
925
  maxTurns: opts.maxTurns,
886
- thinking: opts.thinking,
926
+ effort: opts.effort,
887
927
  onLine: /* @__PURE__ */ __name((line) => d.log(line), "onLine")
888
928
  });
889
929
  if (agentResult.timedOut) {
@@ -962,8 +1002,9 @@ __name(runTicketAttempt, "runTicketAttempt");
962
1002
  async function runTicketAttempts(opts) {
963
1003
  const { ticket, d } = opts;
964
1004
  const maxAttempts = opts.retries + 1;
965
- const isPi = basename(opts.agentCmd) === "pi";
966
- let thinking = opts.thinking;
1005
+ const providerName = basename(opts.agentCmd);
1006
+ const isKnown = providerName in EFFORT_LADDERS;
1007
+ let effort = opts.effort;
967
1008
  let outcome = {
968
1009
  kind: "no-commits",
969
1010
  worktreePath: "",
@@ -973,10 +1014,15 @@ async function runTicketAttempts(opts) {
973
1014
  if (attempt === 1) {
974
1015
  d.log(` Starting ${ticket.filename}`);
975
1016
  } else {
976
- thinking = escalateThinking(thinking);
1017
+ if (isKnown) {
1018
+ effort = escalateEffort(
1019
+ providerName,
1020
+ effort
1021
+ );
1022
+ }
977
1023
  const delay = retryDelayFor(opts.retryDelay, attempt);
978
1024
  d.log(
979
- ` ${ticket.filename}: retrying (attempt ${attempt}/${maxAttempts}` + (isPi ? `, thinking ${thinking}` : "") + (delay > 0 ? `, waiting ${delay}s` : "") + ")"
1025
+ ` ${ticket.filename}: retrying (attempt ${attempt}/${maxAttempts}` + (isKnown && effort ? `, effort ${effort}` : "") + (delay > 0 ? `, waiting ${delay}s` : "") + ")"
980
1026
  );
981
1027
  if (delay > 0) await sleep(delay * 1e3);
982
1028
  }
@@ -984,7 +1030,7 @@ async function runTicketAttempts(opts) {
984
1030
  outcome = await runTicketAttempt({
985
1031
  ...opts,
986
1032
  attempt,
987
- thinking
1033
+ effort
988
1034
  });
989
1035
  } catch (error) {
990
1036
  d.log(
@@ -1017,12 +1063,13 @@ function runProgress(tickets) {
1017
1063
  };
1018
1064
  }
1019
1065
  __name(runProgress, "runProgress");
1020
- async function runWaves(tickets, specBody, agentCmd, model, timeout, logsDir, display, maxTurns, thinking, retries, retryDelay) {
1066
+ async function runWaves(tickets, specBody, agentCmd, model, timeout, logsDir, display, maxTurns, effort, retries, retryDelay) {
1021
1067
  mkdirSync(logsDir, { recursive: true });
1022
1068
  const d = display ?? createDisplay();
1023
1069
  const maxAttempts = (retries ?? DEFAULT_RETRIES) + 1;
1024
1070
  const delayBase = retryDelay ?? 0;
1025
- const isPi = basename(agentCmd) === "pi";
1071
+ const providerName = basename(agentCmd);
1072
+ const isKnown = providerName in EFFORT_LADDERS;
1026
1073
  let totalWaves = 0;
1027
1074
  for (const _ of simulateWaves(tickets)) totalWaves++;
1028
1075
  let totalCompleted = 0;
@@ -1060,7 +1107,7 @@ async function runWaves(tickets, specBody, agentCmd, model, timeout, logsDir, di
1060
1107
  );
1061
1108
  d.setTicketStatus(t.num, "in-progress");
1062
1109
  d.log(` Starting ${t.filename}`);
1063
- let level = thinking;
1110
+ let level = effort;
1064
1111
  let result = await spawnAgent({
1065
1112
  prompt,
1066
1113
  agentCmd,
@@ -1069,14 +1116,19 @@ async function runWaves(tickets, specBody, agentCmd, model, timeout, logsDir, di
1069
1116
  logPath: attemptLogPath(logsDir, t, 1, ".log"),
1070
1117
  label,
1071
1118
  maxTurns,
1072
- thinking: level,
1119
+ effort: level,
1073
1120
  onLine: /* @__PURE__ */ __name((line) => d.log(line), "onLine")
1074
1121
  });
1075
1122
  for (let attempt = 2; result.exitCode !== 0 && !result.timedOut && attempt <= maxAttempts; attempt++) {
1076
- level = escalateThinking(level);
1123
+ if (isKnown) {
1124
+ level = escalateEffort(
1125
+ providerName,
1126
+ level
1127
+ );
1128
+ }
1077
1129
  const delay = retryDelayFor(delayBase, attempt);
1078
1130
  d.log(
1079
- ` ${t.filename}: agent exited ${result.exitCode}; retrying (attempt ${attempt}/${maxAttempts}` + (isPi ? `, thinking ${level}` : "") + (delay > 0 ? `, waiting ${delay}s` : "") + ")"
1131
+ ` ${t.filename}: agent exited ${result.exitCode}; retrying (attempt ${attempt}/${maxAttempts}` + (isKnown && level ? `, effort ${level}` : "") + (delay > 0 ? `, waiting ${delay}s` : "") + ")"
1080
1132
  );
1081
1133
  if (delay > 0) await sleep(delay * 1e3);
1082
1134
  result = await spawnAgent({
@@ -1092,7 +1144,7 @@ async function runWaves(tickets, specBody, agentCmd, model, timeout, logsDir, di
1092
1144
  ),
1093
1145
  label,
1094
1146
  maxTurns,
1095
- thinking: level,
1147
+ effort: level,
1096
1148
  onLine: /* @__PURE__ */ __name((line) => d.log(line), "onLine")
1097
1149
  });
1098
1150
  }
@@ -1210,7 +1262,7 @@ async function runWavesIsolated(opts) {
1210
1262
  logsDir: opts.logsDir,
1211
1263
  testCmd: opts.testCmd,
1212
1264
  maxTurns: opts.maxTurns,
1213
- thinking: opts.thinking,
1265
+ effort: opts.effort,
1214
1266
  retries,
1215
1267
  retryDelay,
1216
1268
  d
@@ -1473,17 +1525,18 @@ Finished: ${totalCompleted} completed` + (remaining.length > 0 ? `, ${remaining.
1473
1525
  }
1474
1526
  __name(runWavesIsolated, "runWavesIsolated");
1475
1527
  export {
1528
+ ALL_EFFORT_LEVELS,
1476
1529
  COMPLETED_RE,
1477
1530
  DEFAULT_RETRIES,
1478
1531
  DEFAULT_RETRY_DELAY,
1479
- THINKING_LEVELS,
1532
+ EFFORT_LADDERS,
1480
1533
  TICKET_RE,
1481
1534
  TOOL_USE_RE,
1482
1535
  checkItems,
1483
1536
  createPiStreamFormatter,
1484
1537
  dryRun,
1485
1538
  dryRunIsolated,
1486
- escalateThinking,
1539
+ escalateEffort,
1487
1540
  findReadyTickets,
1488
1541
  formatErrorMessage,
1489
1542
  formatStreamLine,