@neriros/ralphy 3.10.1 → 3.10.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/mcp/index.js CHANGED
@@ -24063,6 +24063,7 @@ var HistoryEntrySchema = exports_external.object({
24063
24063
  engine: exports_external.string(),
24064
24064
  model: exports_external.string(),
24065
24065
  result: exports_external.string(),
24066
+ appVersion: exports_external.string().optional(),
24066
24067
  usage: IterationUsageSchema.partial().optional()
24067
24068
  });
24068
24069
  var StateSchema = exports_external.object({
@@ -18928,8 +18928,8 @@ import { readFileSync } from "fs";
18928
18928
  import { resolve } from "path";
18929
18929
  function getVersion() {
18930
18930
  try {
18931
- if ("3.10.1")
18932
- return "3.10.1";
18931
+ if ("3.10.2")
18932
+ return "3.10.2";
18933
18933
  } catch {}
18934
18934
  const dirsToTry = [];
18935
18935
  try {
@@ -84163,7 +84163,7 @@ function projectLayout(root) {
84163
84163
  stateFile: (name) => join6(statesDir, name, STATE_FILE)
84164
84164
  };
84165
84165
  }
84166
- var STATE_FILE = ".ralph-state.json";
84166
+ var STATE_FILE = ".ralph-state.json", GAVEUP_COUNT_FILE = ".ralph-gaveup-count";
84167
84167
  var init_layout = __esm(() => {
84168
84168
  init_context();
84169
84169
  });
@@ -88862,6 +88862,7 @@ var init_types2 = __esm(() => {
88862
88862
  engine: exports_external2.string(),
88863
88863
  model: exports_external2.string(),
88864
88864
  result: exports_external2.string(),
88865
+ appVersion: exports_external2.string().optional(),
88865
88866
  usage: IterationUsageSchema.partial().optional()
88866
88867
  });
88867
88868
  StateSchema = exports_external2.object({
@@ -99629,6 +99630,7 @@ function updateStateIteration(stateDir, result2, startedAt, engine, model, usage
99629
99630
  engine,
99630
99631
  model,
99631
99632
  result: result2,
99633
+ appVersion: VERSION,
99632
99634
  usage: usage ? {
99633
99635
  cost_usd: usage.cost_usd,
99634
99636
  duration_ms: usage.duration_ms,
@@ -99690,6 +99692,7 @@ function mergeUsage(base2, resumed) {
99690
99692
  }
99691
99693
  var STEERING_MAX_LINES = 20;
99692
99694
  var init_loop = __esm(() => {
99695
+ init_version();
99693
99696
  init_state();
99694
99697
  init_context();
99695
99698
  init_tasks_md();
@@ -100427,7 +100430,7 @@ import { join as join16, dirname as dirname7 } from "path";
100427
100430
  import { homedir as homedir4 } from "os";
100428
100431
  import { mkdir as mkdir5 } from "fs/promises";
100429
100432
  function fmt(type, text) {
100430
- return `[${new Date().toISOString()}] [${type}] ${text}
100433
+ return `[${new Date().toISOString()}] [v${VERSION}] [${type}] ${text}
100431
100434
  `;
100432
100435
  }
100433
100436
  function write(path, line) {
@@ -100469,6 +100472,7 @@ async function initWorkerLog(logFile) {
100469
100472
  }
100470
100473
  var jsonLogChains, ANSI_RE, AGENT_LOG_PATH;
100471
100474
  var init_log = __esm(() => {
100475
+ init_version();
100472
100476
  jsonLogChains = new Map;
100473
100477
  ANSI_RE = /\x1b(?:\[[0-9;]*[A-Za-z]|\][^\x07\x1b]*(?:\x07|\x1b\\)|.)/g;
100474
100478
  AGENT_LOG_PATH = join16(homedir4(), ".ralph", "agent-mode.log");
@@ -103303,7 +103307,7 @@ function emitFeatureSkipped(bus, id, reason) {
103303
103307
  var init_run_feature = () => {};
103304
103308
 
103305
103309
  // apps/agent/src/agent/post-task.ts
103306
- import { join as join21 } from "path";
103310
+ import { join as join21, dirname as dirname9 } from "path";
103307
103311
  function summarizeUncommittedStatus(stdout) {
103308
103312
  const lines = stdout.split(`
103309
103313
  `).filter((line) => line.length > 0);
@@ -103945,6 +103949,17 @@ async function runValidateOnlyPhase(input, deps) {
103945
103949
  await reactivateState(stateFilePath, log3, changeName);
103946
103950
  return respawnWorker();
103947
103951
  }
103952
+ async function recordGaveUp(stateFilePath, log3, changeName) {
103953
+ const path = join21(dirname9(stateFilePath), GAVEUP_COUNT_FILE);
103954
+ try {
103955
+ const file2 = Bun.file(path);
103956
+ const current = await file2.exists() ? Number.parseInt(await file2.text(), 10) || 0 : 0;
103957
+ await Bun.write(path, String(current + 1) + `
103958
+ `);
103959
+ } catch (err) {
103960
+ log3(`! could not record gave-up for ${changeName}: ${err.message}`, "yellow");
103961
+ }
103962
+ }
103948
103963
  async function runPostTask(input, deps) {
103949
103964
  const { log: log3, cmd, git: git2, runScript } = deps;
103950
103965
  const emit3 = (phase, detail) => deps.onPhase?.(phase, detail);
@@ -103988,6 +104003,8 @@ async function runPostTask(input, deps) {
103988
104003
  respawnWorker
103989
104004
  });
103990
104005
  emit3(effectiveCode === 0 ? "done" : "gave-up", effectiveCode !== 0 ? `exit ${effectiveCode}` : undefined);
104006
+ if (effectiveCode !== 0)
104007
+ await recordGaveUp(stateFilePath, log3, changeName);
103991
104008
  await runWorktreeCleanupPhase({ changeName, cwd: cwd2, projectRoot, useWorktree, effectiveCode, cfg }, { git: git2, log: log3, emit: emit3 });
103992
104009
  await runTeardownPhase({ cwd: cwd2, teardownScript: cfg.teardownScript }, { runScript, log: log3, emit: emit3 });
103993
104010
  return effectiveCode;
@@ -104062,6 +104079,8 @@ async function runPostTask(input, deps) {
104062
104079
  }
104063
104080
  const succeeded = effectiveCode === 0 || effectiveCode === NO_CHANGES_EXIT;
104064
104081
  emit3(succeeded ? "done" : "gave-up", succeeded ? undefined : `exit ${effectiveCode}`);
104082
+ if (!succeeded)
104083
+ await recordGaveUp(stateFilePath, log3, changeName);
104065
104084
  await runWorktreeCleanupPhase({ changeName, cwd: cwd2, projectRoot, useWorktree, effectiveCode, cfg }, { git: git2, log: log3, emit: emit3 });
104066
104085
  await runTeardownPhase({ cwd: cwd2, teardownScript: cfg.teardownScript }, { runScript, log: log3, emit: emit3 });
104067
104086
  return effectiveCode;
@@ -104079,6 +104098,7 @@ var CI_FAILED_EXIT = 70, PR_FAILED_EXIT = 71, NO_CHANGES_EXIT = 72, repoAutoMerg
104079
104098
  return { exitCode: proc.exitCode ?? 1, output };
104080
104099
  };
104081
104100
  var init_post_task = __esm(() => {
104101
+ init_layout();
104082
104102
  init_tasks_md();
104083
104103
  init_fs_change();
104084
104104
  init_git2();
@@ -105187,7 +105207,7 @@ var init_detections = __esm(() => {
105187
105207
  });
105188
105208
 
105189
105209
  // apps/agent/src/features/confirmation/state.ts
105190
- import { dirname as dirname9, join as join23 } from "path";
105210
+ import { dirname as dirname10, join as join23 } from "path";
105191
105211
  import { mkdir as mkdir8 } from "fs/promises";
105192
105212
  async function readConfirmationState(statePath) {
105193
105213
  const f2 = Bun.file(statePath);
@@ -105212,7 +105232,7 @@ async function readConfirmationState(statePath) {
105212
105232
  return { stateObj, confirmation };
105213
105233
  }
105214
105234
  async function writeConfirmationState(statePath, stateObj, confirmation) {
105215
- await mkdir8(dirname9(statePath), { recursive: true });
105235
+ await mkdir8(dirname10(statePath), { recursive: true });
105216
105236
  await Bun.write(statePath, JSON.stringify({ ...stateObj, confirmation }, null, 2) + `
105217
105237
  `);
105218
105238
  }
@@ -105454,7 +105474,7 @@ var init_inspect = __esm(() => {
105454
105474
  });
105455
105475
 
105456
105476
  // apps/agent/src/features/confirmation/awaiting.ts
105457
- import { join as join24, dirname as dirname10 } from "path";
105477
+ import { join as join24, dirname as dirname11 } from "path";
105458
105478
  import { mkdir as mkdir9 } from "fs/promises";
105459
105479
  async function resolveChangeCwdForIssue(issue2, changeName, deps) {
105460
105480
  const tracked = deps.cwdOf(changeName);
@@ -105516,7 +105536,7 @@ async function postPlanReadyCommentOnce(issue2, statePath, changeName, deps) {
105516
105536
  rounds: confirmation?.rounds ?? 0
105517
105537
  };
105518
105538
  try {
105519
- await mkdir9(dirname10(statePath), { recursive: true });
105539
+ await mkdir9(dirname11(statePath), { recursive: true });
105520
105540
  await Bun.write(statePath, JSON.stringify({ ...stateObj, confirmation: nextConfirmation }, null, 2) + `
105521
105541
  `);
105522
105542
  } catch (err) {
@@ -106523,17 +106543,17 @@ var init_pr_discovery = __esm(() => {
106523
106543
  });
106524
106544
 
106525
106545
  // apps/agent/src/features/review-followup/scan.ts
106526
- import { dirname as dirname11, join as join26 } from "path";
106546
+ import { dirname as dirname12, join as join26 } from "path";
106527
106547
  async function resolveReviewStateDir(changeName, deps) {
106528
106548
  const root = deps.cwdOf(changeName);
106529
106549
  if (root)
106530
- return dirname11(projectLayout(root).stateFile(changeName));
106550
+ return dirname12(projectLayout(root).stateFile(changeName));
106531
106551
  if (!deps.useWorktree)
106532
- return dirname11(projectLayout(deps.projectRoot).stateFile(changeName));
106552
+ return dirname12(projectLayout(deps.projectRoot).stateFile(changeName));
106533
106553
  const wtPath = join26(worktreesDir2(deps.projectRoot), changeName);
106534
106554
  const statePath = projectLayout(wtPath).stateFile(changeName);
106535
106555
  if (await Bun.file(statePath).exists())
106536
- return dirname11(statePath);
106556
+ return dirname12(statePath);
106537
106557
  return null;
106538
106558
  }
106539
106559
  async function readReviewWatermark(stateDir) {
@@ -107571,7 +107591,7 @@ var init_linear_sync = __esm(() => {
107571
107591
  });
107572
107592
 
107573
107593
  // apps/agent/src/agent/linear-sync/comment-sync.ts
107574
- import { dirname as dirname12, join as join30 } from "path";
107594
+ import { dirname as dirname13, join as join30 } from "path";
107575
107595
  import { mkdir as mkdir11, rename, unlink as unlink2 } from "fs/promises";
107576
107596
  async function readStateJson(statePath) {
107577
107597
  const file2 = Bun.file(statePath);
@@ -107584,7 +107604,7 @@ async function readStateJson(statePath) {
107584
107604
  }
107585
107605
  }
107586
107606
  async function writeStateJson(statePath, state) {
107587
- await mkdir11(dirname12(statePath), { recursive: true });
107607
+ await mkdir11(dirname13(statePath), { recursive: true });
107588
107608
  const tmp = `${statePath}.tmp-${process.pid}-${writeStateSeq++}`;
107589
107609
  try {
107590
107610
  await Bun.write(tmp, JSON.stringify(state, null, 2) + `
@@ -260014,7 +260034,7 @@ var init_render_pdf = __esm(() => {
260014
260034
  });
260015
260035
 
260016
260036
  // apps/agent/src/agent/linear-sync/spec-attachments.ts
260017
- import { dirname as dirname13, join as join31 } from "path";
260037
+ import { dirname as dirname14, join as join31 } from "path";
260018
260038
  function describeLinearError(err) {
260019
260039
  const e = err;
260020
260040
  const parts = [e.message ?? String(err)];
@@ -260029,7 +260049,7 @@ function describeLinearError(err) {
260029
260049
  return parts.join(" ");
260030
260050
  }
260031
260051
  function stateDirOf(statePath) {
260032
- return dirname13(statePath);
260052
+ return dirname14(statePath);
260033
260053
  }
260034
260054
  async function readRawState(statePath) {
260035
260055
  const file2 = Bun.file(statePath);
@@ -260739,7 +260759,19 @@ function buildAgentCoordinator(input) {
260739
260759
  pollInterval,
260740
260760
  getWorkerCwd: (changeName) => cwdByChange.get(changeName),
260741
260761
  syncTasksEnabled: commentSync.enabled,
260742
- runBaselineGate: runBaselineGateOnce
260762
+ runBaselineGate: runBaselineGateOnce,
260763
+ getGaveUpTotal: async () => {
260764
+ let total = 0;
260765
+ for (const [changeName, root] of cwdByChange) {
260766
+ const file2 = Bun.file(join33(projectLayout(root).taskStateDir(changeName), GAVEUP_COUNT_FILE));
260767
+ if (!await file2.exists())
260768
+ continue;
260769
+ try {
260770
+ total += Number.parseInt(await file2.text(), 10) || 0;
260771
+ } catch {}
260772
+ }
260773
+ return total;
260774
+ }
260743
260775
  };
260744
260776
  }
260745
260777
  var init_wire = __esm(() => {
@@ -260765,19 +260797,19 @@ var init_wire = __esm(() => {
260765
260797
 
260766
260798
  // apps/agent/src/agent/json-log/json-log-file.ts
260767
260799
  import { mkdir as mkdir12, appendFile as appendFile2 } from "fs/promises";
260768
- import { dirname as dirname14 } from "path";
260800
+ import { dirname as dirname15 } from "path";
260769
260801
  function createJsonLogFileSink(path) {
260770
260802
  if (!path)
260771
260803
  return { emit: () => {} };
260772
260804
  let chain2 = (async () => {
260773
260805
  try {
260774
- await mkdir12(dirname14(path), { recursive: true });
260806
+ await mkdir12(dirname15(path), { recursive: true });
260775
260807
  await Bun.write(path, "");
260776
260808
  } catch {}
260777
260809
  })();
260778
260810
  return {
260779
260811
  emit(event) {
260780
- const line = JSON.stringify({ ts: Date.now(), ...event }) + `
260812
+ const line = JSON.stringify({ ts: Date.now(), v: VERSION, ...event }) + `
260781
260813
  `;
260782
260814
  chain2 = chain2.then(async () => {
260783
260815
  try {
@@ -260787,7 +260819,9 @@ function createJsonLogFileSink(path) {
260787
260819
  }
260788
260820
  };
260789
260821
  }
260790
- var init_json_log_file = () => {};
260822
+ var init_json_log_file = __esm(() => {
260823
+ init_version();
260824
+ });
260791
260825
 
260792
260826
  // apps/agent/src/runtime/shutdown.ts
260793
260827
  async function waitForActiveWorkers(deps) {
@@ -261365,6 +261399,7 @@ function AgentMode({
261365
261399
  const [focusedIdx, setFocusedIdx] = import_react62.useState(0);
261366
261400
  const [showPendingTasks, setShowPendingTasks] = import_react62.useState(false);
261367
261401
  const [showAllSubtasks, setShowAllSubtasks] = import_react62.useState(false);
261402
+ const [gaveUpCount, setGaveUpCount] = import_react62.useState(0);
261368
261403
  const coordRef = import_react62.useRef(null);
261369
261404
  const workerMetaRef = import_react62.useRef(new Map);
261370
261405
  const gatedTicketsRef = import_react62.useRef(new Map);
@@ -261415,7 +261450,7 @@ function AgentMode({
261415
261450
  }, 100);
261416
261451
  return;
261417
261452
  }
261418
- const { coord: coord2, filterDesc, concurrency, pollInterval, runBaselineGate: runBaselineGate2 } = buildCoordinator({
261453
+ const { coord: coord2, filterDesc, concurrency, pollInterval, runBaselineGate: runBaselineGate2, getGaveUpTotal } = buildCoordinator({
261419
261454
  args,
261420
261455
  cfg: cfg2,
261421
261456
  projectRoot,
@@ -261561,6 +261596,12 @@ function AgentMode({
261561
261596
  if (cancelled)
261562
261597
  return;
261563
261598
  fileEmit({ type: "poll_done", found, added, buckets, prStatus });
261599
+ getGaveUpTotal().then((total) => {
261600
+ if (!cancelled)
261601
+ setGaveUpCount(total);
261602
+ }).catch(() => {
261603
+ return;
261604
+ });
261564
261605
  if (added > 0) {
261565
261606
  appendLog(` ${added} new issue${added === 1 ? "" : "s"} queued (found ${found} open)`);
261566
261607
  }
@@ -261872,7 +261913,14 @@ function AgentMode({
261872
261913
  cfg.useWorktree && /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
261873
261914
  color: "green",
261874
261915
  children: " \u25CF worktree"
261875
- }, undefined, false, undefined, this)
261916
+ }, undefined, false, undefined, this),
261917
+ gaveUpCount > 0 && /* @__PURE__ */ jsx_dev_runtime11.jsxDEV(Text, {
261918
+ color: "red",
261919
+ children: [
261920
+ " \u2502 gave-up \xD7",
261921
+ gaveUpCount
261922
+ ]
261923
+ }, undefined, true, undefined, this)
261876
261924
  ]
261877
261925
  }, undefined, true, undefined, this)
261878
261926
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neriros/ralphy",
3
- "version": "3.10.1",
3
+ "version": "3.10.2",
4
4
  "description": "An iterative AI task execution framework. Orchestrates multi-phase autonomous work using Claude or Codex engines.",
5
5
  "keywords": [
6
6
  "agent",