reasonix 0.45.0 → 0.45.1

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 (68) hide show
  1. package/dist/cli/{acp-HLOS6JRX.js → acp-LGBLHBKY.js} +7 -7
  2. package/dist/cli/{chat-LVAGFEEU.js → chat-I7UTQO5L.js} +13 -13
  3. package/dist/cli/{chunk-WKMYJG2Y.js → chunk-4HCP2UQW.js} +2 -2
  4. package/dist/cli/{chunk-B5S22SJT.js → chunk-5ACMUK4Q.js} +57 -20
  5. package/dist/cli/chunk-5ACMUK4Q.js.map +1 -0
  6. package/dist/cli/{chunk-GYKQCQ5U.js → chunk-5I2C4JEO.js} +2 -2
  7. package/dist/cli/{chunk-QNUR4ZEJ.js → chunk-A3TSSDS2.js} +2 -2
  8. package/dist/cli/{chunk-NEO7DPMV.js → chunk-CBIQWMS6.js} +2 -2
  9. package/dist/cli/{chunk-TKVXTQ3T.js → chunk-CXVWUPA3.js} +26 -26
  10. package/dist/cli/chunk-CXVWUPA3.js.map +1 -0
  11. package/dist/cli/{chunk-4XUPJNVN.js → chunk-GTZTQNX5.js} +4 -4
  12. package/dist/cli/{chunk-BYACG5XE.js → chunk-HKWSPKMU.js} +4 -4
  13. package/dist/cli/{chunk-4YS2FQSV.js → chunk-HVUZWNSP.js} +2 -2
  14. package/dist/cli/{chunk-3GACC4QX.js → chunk-IJ7JA32V.js} +5 -3
  15. package/dist/cli/chunk-IJ7JA32V.js.map +1 -0
  16. package/dist/cli/{chunk-KQBNRLFZ.js → chunk-OLLQ76U6.js} +10156 -10050
  17. package/dist/cli/chunk-OLLQ76U6.js.map +1 -0
  18. package/dist/cli/{chunk-E7KJX6OB.js → chunk-QJDDIK3Z.js} +2 -2
  19. package/dist/cli/{chunk-RVJ77WZC.js → chunk-W7YGWUWU.js} +2 -2
  20. package/dist/cli/{chunk-7CH5XJ4S.js → chunk-WL6SNQ5T.js} +19 -6
  21. package/dist/cli/chunk-WL6SNQ5T.js.map +1 -0
  22. package/dist/cli/{code-3BC5F5DE.js → code-D7V2TQX2.js} +14 -14
  23. package/dist/cli/{desktop-DNDQ2N3L.js → desktop-ZCUG7LMF.js} +8 -8
  24. package/dist/cli/{diff-5A7BSBUS.js → diff-66B2KWOJ.js} +3 -3
  25. package/dist/cli/{doctor-BMBRJTOY.js → doctor-Y73CPPRZ.js} +5 -5
  26. package/dist/cli/{events-I2VE2YEY.js → events-NGZ2OJYH.js} +3 -3
  27. package/dist/cli/index.js +20 -20
  28. package/dist/cli/{prune-sessions-IMY2LKY7.js → prune-sessions-OJEYYLHY.js} +2 -2
  29. package/dist/cli/{replay-3VXJP64L.js → replay-HIQYWBEK.js} +4 -4
  30. package/dist/cli/{run-6FCF6M62.js → run-5DPQFSP6.js} +6 -6
  31. package/dist/cli/{server-PPJQ7YU7.js → server-TQ2IHYQJ.js} +6 -6
  32. package/dist/cli/{sessions-2EXOOZDC.js → sessions-KY54NG45.js} +5 -5
  33. package/dist/cli/{setup-ROM6O4ME.js → setup-DDNOMMAB.js} +2 -2
  34. package/dist/cli/{stats-YYUAUDPA.js → stats-X2VTWKNS.js} +3 -3
  35. package/dist/cli/{version-PR7BMKLS.js → version-7O6A5T7Q.js} +5 -5
  36. package/dist/index.d.ts +1 -0
  37. package/dist/index.js +75 -23
  38. package/dist/index.js.map +1 -1
  39. package/package.json +6 -6
  40. package/dist/cli/chunk-3GACC4QX.js.map +0 -1
  41. package/dist/cli/chunk-7CH5XJ4S.js.map +0 -1
  42. package/dist/cli/chunk-B5S22SJT.js.map +0 -1
  43. package/dist/cli/chunk-KQBNRLFZ.js.map +0 -1
  44. package/dist/cli/chunk-TKVXTQ3T.js.map +0 -1
  45. /package/dist/cli/{acp-HLOS6JRX.js.map → acp-LGBLHBKY.js.map} +0 -0
  46. /package/dist/cli/{chat-LVAGFEEU.js.map → chat-I7UTQO5L.js.map} +0 -0
  47. /package/dist/cli/{chunk-WKMYJG2Y.js.map → chunk-4HCP2UQW.js.map} +0 -0
  48. /package/dist/cli/{chunk-GYKQCQ5U.js.map → chunk-5I2C4JEO.js.map} +0 -0
  49. /package/dist/cli/{chunk-QNUR4ZEJ.js.map → chunk-A3TSSDS2.js.map} +0 -0
  50. /package/dist/cli/{chunk-NEO7DPMV.js.map → chunk-CBIQWMS6.js.map} +0 -0
  51. /package/dist/cli/{chunk-4XUPJNVN.js.map → chunk-GTZTQNX5.js.map} +0 -0
  52. /package/dist/cli/{chunk-BYACG5XE.js.map → chunk-HKWSPKMU.js.map} +0 -0
  53. /package/dist/cli/{chunk-4YS2FQSV.js.map → chunk-HVUZWNSP.js.map} +0 -0
  54. /package/dist/cli/{chunk-E7KJX6OB.js.map → chunk-QJDDIK3Z.js.map} +0 -0
  55. /package/dist/cli/{chunk-RVJ77WZC.js.map → chunk-W7YGWUWU.js.map} +0 -0
  56. /package/dist/cli/{code-3BC5F5DE.js.map → code-D7V2TQX2.js.map} +0 -0
  57. /package/dist/cli/{desktop-DNDQ2N3L.js.map → desktop-ZCUG7LMF.js.map} +0 -0
  58. /package/dist/cli/{diff-5A7BSBUS.js.map → diff-66B2KWOJ.js.map} +0 -0
  59. /package/dist/cli/{doctor-BMBRJTOY.js.map → doctor-Y73CPPRZ.js.map} +0 -0
  60. /package/dist/cli/{events-I2VE2YEY.js.map → events-NGZ2OJYH.js.map} +0 -0
  61. /package/dist/cli/{prune-sessions-IMY2LKY7.js.map → prune-sessions-OJEYYLHY.js.map} +0 -0
  62. /package/dist/cli/{replay-3VXJP64L.js.map → replay-HIQYWBEK.js.map} +0 -0
  63. /package/dist/cli/{run-6FCF6M62.js.map → run-5DPQFSP6.js.map} +0 -0
  64. /package/dist/cli/{server-PPJQ7YU7.js.map → server-TQ2IHYQJ.js.map} +0 -0
  65. /package/dist/cli/{sessions-2EXOOZDC.js.map → sessions-KY54NG45.js.map} +0 -0
  66. /package/dist/cli/{setup-ROM6O4ME.js.map → setup-DDNOMMAB.js.map} +0 -0
  67. /package/dist/cli/{stats-YYUAUDPA.js.map → stats-X2VTWKNS.js.map} +0 -0
  68. /package/dist/cli/{version-PR7BMKLS.js.map → version-7O6A5T7Q.js.map} +0 -0
package/dist/index.js CHANGED
@@ -1610,7 +1610,8 @@ var EN = {
1610
1610
  checkpointSaved: "\u26C1 checkpoint saved \xB7 {id} \xB7 {count} file{s} \xB7 /restore {id} to roll back this step",
1611
1611
  continuingAfter: "\u25B8 continuing after {label}{counter}",
1612
1612
  planStoppedAt: "\u25B8 plan stopped at {label}{counter}",
1613
- revisingAfter: "\u25B8 revising after {label} \u2014 {feedback}"
1613
+ revisingAfter: "\u25B8 revising after {label} \u2014 {feedback}",
1614
+ historyScrollHint: " \u2191 reading history \xB7 End / PgDn returns to bottom \xB7 \u2193 advances one line"
1614
1615
  },
1615
1616
  hooks: {
1616
1617
  head: "hook {tag} `{cmd}` {decision}{truncTag}",
@@ -3036,7 +3037,8 @@ var zhCN = {
3036
3037
  checkpointSaved: "\u26C1 \u5DF2\u4FDD\u5B58\u68C0\u67E5\u70B9 \xB7 {id} \xB7 {count} \u4E2A\u6587\u4EF6 \xB7 /restore {id} \u53EF\u56DE\u6EDA\u6B64\u6B65",
3037
3038
  continuingAfter: "\u25B8 \u5728 {label}{counter} \u4E4B\u540E\u7EE7\u7EED",
3038
3039
  planStoppedAt: "\u25B8 \u8BA1\u5212\u5728 {label}{counter} \u5904\u505C\u6B62",
3039
- revisingAfter: "\u25B8 \u5728 {label} \u4E4B\u540E\u4FEE\u8BA2 \u2014 {feedback}"
3040
+ revisingAfter: "\u25B8 \u5728 {label} \u4E4B\u540E\u4FEE\u8BA2 \u2014 {feedback}",
3041
+ historyScrollHint: " \u2191 \u6B63\u5728\u67E5\u770B\u5386\u53F2 \xB7 End / PgDn \u8FD4\u56DE\u5E95\u90E8 \xB7 \u2193 \u5411\u4E0B\u6EDA\u52A8\u4E00\u884C"
3040
3042
  },
3041
3043
  hooks: {
3042
3044
  head: "\u94A9\u5B50 {tag} `{cmd}` {decision}{truncTag}",
@@ -5040,6 +5042,7 @@ import { execFileSync } from "child_process";
5040
5042
  import {
5041
5043
  appendFileSync,
5042
5044
  chmodSync as chmodSync2,
5045
+ copyFileSync,
5043
5046
  existsSync as existsSync3,
5044
5047
  mkdirSync as mkdirSync2,
5045
5048
  readFileSync as readFileSync4,
@@ -5051,6 +5054,13 @@ import {
5051
5054
  } from "fs";
5052
5055
  import { homedir as homedir3 } from "os";
5053
5056
  import { dirname as dirname3, join as join4, posix as posixPath, win32 as win32Path } from "path";
5057
+ var SESSION_SIDECAR_EXTS = [
5058
+ ".events.jsonl",
5059
+ ".meta.json",
5060
+ ".pending.json",
5061
+ ".plan.json",
5062
+ ".jsonl.bak"
5063
+ ];
5054
5064
  function sessionsDir() {
5055
5065
  return join4(homedir3(), ".reasonix", "sessions");
5056
5066
  }
@@ -5067,22 +5077,29 @@ function timestampSuffix() {
5067
5077
  function loadSessionMessages(name) {
5068
5078
  const path2 = sessionPath(name);
5069
5079
  if (!existsSync3(path2)) return [];
5080
+ const live = readSessionMessages(path2);
5081
+ if (live && (live.messages.length > 0 || !live.hadContent)) return live.messages;
5082
+ const backup = readSessionMessages(sessionBackupPath(path2));
5083
+ return backup?.messages ?? live?.messages ?? [];
5084
+ }
5085
+ function readSessionMessages(path2) {
5086
+ let raw;
5070
5087
  try {
5071
- const raw = readFileSync4(path2, "utf8");
5072
- const out = [];
5073
- for (const line of raw.split(/\r?\n/)) {
5074
- const trimmed = line.trim();
5075
- if (!trimmed) continue;
5076
- try {
5077
- const msg = JSON.parse(trimmed);
5078
- if (msg && typeof msg === "object" && "role" in msg) out.push(msg);
5079
- } catch {
5080
- }
5081
- }
5082
- return out;
5088
+ raw = readFileSync4(path2, "utf8");
5083
5089
  } catch {
5084
- return [];
5090
+ return null;
5091
+ }
5092
+ const out = [];
5093
+ for (const line of raw.split(/\r?\n/)) {
5094
+ const trimmed = line.trim();
5095
+ if (!trimmed) continue;
5096
+ try {
5097
+ const msg = JSON.parse(trimmed);
5098
+ if (msg && typeof msg === "object" && "role" in msg) out.push(msg);
5099
+ } catch {
5100
+ }
5085
5101
  }
5102
+ return { messages: out, hadContent: raw.trim().length > 0 };
5086
5103
  }
5087
5104
  function appendSessionMessage(name, message) {
5088
5105
  const path2 = sessionPath(name);
@@ -5140,7 +5157,7 @@ function renameSession(oldName, newName) {
5140
5157
  const newJsonl = sessionPath(newName);
5141
5158
  if (!existsSync3(oldJsonl) || existsSync3(newJsonl)) return false;
5142
5159
  renameSync(oldJsonl, newJsonl);
5143
- for (const ext of [".events.jsonl", ".meta.json", ".pending.json", ".plan.json"]) {
5160
+ for (const ext of SESSION_SIDECAR_EXTS) {
5144
5161
  const oldP = oldJsonl.replace(/\.jsonl$/, ext);
5145
5162
  const newP = newJsonl.replace(/\.jsonl$/, ext);
5146
5163
  if (existsSync3(oldP)) {
@@ -5156,7 +5173,7 @@ function deleteSession(name) {
5156
5173
  const path2 = sessionPath(name);
5157
5174
  try {
5158
5175
  unlinkSync(path2);
5159
- for (const ext of [".events.jsonl", ".pending.json", ".meta.json", ".plan.json"]) {
5176
+ for (const ext of SESSION_SIDECAR_EXTS) {
5160
5177
  const sidecar = path2.replace(/\.jsonl$/, ext);
5161
5178
  try {
5162
5179
  unlinkSync(sidecar);
@@ -5172,11 +5189,24 @@ function rewriteSession(name, messages) {
5172
5189
  const path2 = sessionPath(name);
5173
5190
  mkdirSync2(dirname3(path2), { recursive: true });
5174
5191
  const body = messages.map((m) => JSON.stringify(m)).join("\n");
5175
- writeFileSync2(path2, body ? `${body}
5176
- ` : "", "utf8");
5192
+ const tmp = `${path2}.${process.pid}.${Date.now()}.${Math.random().toString(36).slice(2)}.tmp`;
5177
5193
  try {
5178
- chmodSync2(path2, 384);
5179
- } catch {
5194
+ writeFileSync2(tmp, body ? `${body}
5195
+ ` : "", "utf8");
5196
+ chmodPrivate(tmp);
5197
+ if (existsSync3(path2) && statSync(path2).size > 0) {
5198
+ const backup = sessionBackupPath(path2);
5199
+ copyFileSync(path2, backup);
5200
+ chmodPrivate(backup);
5201
+ }
5202
+ renameSync(tmp, path2);
5203
+ chmodPrivate(path2);
5204
+ } catch (err) {
5205
+ try {
5206
+ unlinkSync(tmp);
5207
+ } catch {
5208
+ }
5209
+ throw err;
5180
5210
  }
5181
5211
  }
5182
5212
  function archiveSession(name) {
@@ -5201,6 +5231,15 @@ function countLines(path2) {
5201
5231
  return 0;
5202
5232
  }
5203
5233
  }
5234
+ function sessionBackupPath(path2) {
5235
+ return `${path2}.bak`;
5236
+ }
5237
+ function chmodPrivate(path2) {
5238
+ try {
5239
+ chmodSync2(path2, 384);
5240
+ } catch {
5241
+ }
5242
+ }
5204
5243
 
5205
5244
  // src/telemetry/stats.ts
5206
5245
  var DEEPSEEK_PRICING = {
@@ -6702,11 +6741,24 @@ ${reason}`
6702
6741
  }
6703
6742
  _inflightCounter = 0;
6704
6743
  buildMessages(pendingUser) {
6705
- const healed = healLoadedMessages(this.log.toMessages(), DEFAULT_MAX_RESULT_CHARS);
6706
- const msgs = [...this.prefix.toMessages(), ...healed.messages];
6744
+ const healedMessages = this.healActiveLogBeforeSend();
6745
+ const msgs = [...this.prefix.toMessages(), ...healedMessages];
6707
6746
  if (pendingUser !== null) msgs.push({ role: "user", content: pendingUser });
6708
6747
  return msgs;
6709
6748
  }
6749
+ healActiveLogBeforeSend() {
6750
+ const current = this.log.toMessages();
6751
+ const healed = healLoadedMessages(current, DEFAULT_MAX_RESULT_CHARS);
6752
+ if (healed.healedCount === 0) return current;
6753
+ this.log.compactInPlace(healed.messages);
6754
+ if (this.sessionName) {
6755
+ try {
6756
+ rewriteSession(this.sessionName, healed.messages);
6757
+ } catch {
6758
+ }
6759
+ }
6760
+ return healed.messages;
6761
+ }
6710
6762
  abort() {
6711
6763
  this._turnAbort.abort();
6712
6764
  }