zames_pro 2.82.34 → 2.82.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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.82.35] - 2026-10-22
11
+
12
+ ### Fixed
13
+
14
+ - **checkpoint:** rebuild the index when index.json is corrupt
15
+
10
16
  ## [2.82.34] - 2026-10-22
11
17
 
12
18
  ### Fixed
@@ -121,13 +121,53 @@ export class CheckpointStore {
121
121
  await fs.mkdir(this.dir, { recursive: true });
122
122
  }
123
123
  async _readIndex() {
124
+ let raw;
124
125
  try {
125
- const data = JSON.parse(await fs.readFile(this.indexFile, 'utf-8'));
126
- return Array.isArray(data) ? data : [];
126
+ raw = await fs.readFile(this.indexFile, 'utf-8');
127
127
  }
128
128
  catch {
129
129
  return [];
130
130
  }
131
+ try {
132
+ const data = JSON.parse(raw);
133
+ if (Array.isArray(data))
134
+ return data;
135
+ }
136
+ catch {
137
+ // A CORRUPT index must not hide the archives that are still on disk:
138
+ // /rewind would say "nothing to rewind" and the next create() would
139
+ // start a fresh index, leaving the orphans unprunable forever.
140
+ }
141
+ return await this._rebuildIndexFromDisk();
142
+ }
143
+ /**
144
+ * Reconstruct the index from archive file names (`<stamp>-<uniq>.tgz`) when
145
+ * index.json is missing or corrupt. The workdir cannot be recovered from an
146
+ * archive name, so a rebuilt record carries the checkpoint DIR as a last
147
+ * resort — restore() extracts the archive itself, and a wrong workdir only
148
+ * affects the label /checkpoints shows.
149
+ */
150
+ async _rebuildIndexFromDisk() {
151
+ const out = [];
152
+ let files;
153
+ try {
154
+ files = await fs.readdir(this.dir);
155
+ }
156
+ catch {
157
+ return out;
158
+ }
159
+ for (const f of files) {
160
+ const m = /^(\d+)-[0-9a-f]+\.tgz$/.exec(f);
161
+ if (!m)
162
+ continue;
163
+ out.push({
164
+ stamp: Number(m[1]),
165
+ file: path.join(this.dir, f),
166
+ workdir: this.dir,
167
+ });
168
+ }
169
+ out.sort((a, b) => a.stamp - b.stamp);
170
+ return out;
131
171
  }
132
172
  /**
133
173
  * Snapshot `workdir` into a tarball. Best-effort: a missing tar, an
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zames_pro",
3
- "version": "2.82.34",
3
+ "version": "2.82.35",
4
4
  "description": "Terminal coding agent that drives a real browser to chat with DeepSeek, Qwen and other web LLMs — no API key required. Reads and edits files, runs commands, commits to git, like Claude Code / Codex CLI.",
5
5
  "type": "module",
6
6
  "bin": {