zames_pro 2.82.34 → 2.82.36
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 +12 -0
- package/dist/checkpoint.js +42 -2
- package/dist/provider-handoff.js +40 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.82.36] - 2026-10-22
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- **handoff:** keep a pending handoff of another workdir
|
|
15
|
+
|
|
16
|
+
## [2.82.35] - 2026-10-22
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
|
|
20
|
+
- **checkpoint:** rebuild the index when index.json is corrupt
|
|
21
|
+
|
|
10
22
|
## [2.82.34] - 2026-10-22
|
|
11
23
|
|
|
12
24
|
### Fixed
|
package/dist/checkpoint.js
CHANGED
|
@@ -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
|
-
|
|
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/dist/provider-handoff.js
CHANGED
|
@@ -46,10 +46,31 @@ export function buildHandoffText(h) {
|
|
|
46
46
|
export function saveProviderHandoff(h) {
|
|
47
47
|
try {
|
|
48
48
|
fs.mkdirSync(ZAMES_HOME, { recursive: true });
|
|
49
|
+
// There is ONE handoff file for all projects, and save used to overwrite
|
|
50
|
+
// it unconditionally: switching providers in project B silently dropped
|
|
51
|
+
// the UNCONSUMED handoff of project A. A pending handoff for another
|
|
52
|
+
// workdir is kept in a per-workdir side file so both survive.
|
|
53
|
+
let pending = null;
|
|
54
|
+
try {
|
|
55
|
+
pending = JSON.parse(fs.readFileSync(HANDOFF_FILE, 'utf-8'));
|
|
56
|
+
}
|
|
57
|
+
catch { }
|
|
58
|
+
if (pending && typeof pending.summary === 'string') {
|
|
59
|
+
if (sameDir(pending.workdir, h.workdir)) {
|
|
60
|
+
writeJsonAtomic(HANDOFF_FILE, h);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
writeJsonAtomic(sideHandoffFile(pending.workdir), pending);
|
|
64
|
+
}
|
|
49
65
|
writeJsonAtomic(HANDOFF_FILE, h);
|
|
50
66
|
}
|
|
51
67
|
catch { }
|
|
52
68
|
}
|
|
69
|
+
/** A per-workdir copy of a handoff displaced from the global file. */
|
|
70
|
+
function sideHandoffFile(workdir) {
|
|
71
|
+
const key = Buffer.from(String(workdir || '')).toString('base64url');
|
|
72
|
+
return path.join(ZAMES_HOME, 'provider-handoff-' + key + '.json');
|
|
73
|
+
}
|
|
53
74
|
/**
|
|
54
75
|
* Read the pending handoff, but ONLY when it targets `provider` and `workdir`:
|
|
55
76
|
* a handoff for a different provider or project must not be posted into the
|
|
@@ -63,14 +84,31 @@ export function readProviderHandoff(provider, workdir) {
|
|
|
63
84
|
}
|
|
64
85
|
if (raw.provider !== provider)
|
|
65
86
|
return null;
|
|
66
|
-
if (!sameDir(raw.workdir, workdir))
|
|
67
|
-
|
|
87
|
+
if (!sameDir(raw.workdir, workdir)) {
|
|
88
|
+
// The global file may hold another project's handoff; this project's
|
|
89
|
+
// own one (displaced by a later switch) lives in its side file.
|
|
90
|
+
return readSideHandoff(provider, workdir);
|
|
91
|
+
}
|
|
68
92
|
return raw;
|
|
69
93
|
}
|
|
70
94
|
catch {
|
|
71
95
|
return null;
|
|
72
96
|
}
|
|
73
97
|
}
|
|
98
|
+
function readSideHandoff(provider, workdir) {
|
|
99
|
+
try {
|
|
100
|
+
const raw = JSON.parse(fs.readFileSync(sideHandoffFile(workdir), 'utf-8'));
|
|
101
|
+
if (!raw || typeof raw.summary !== 'string' || !raw.summary.trim()) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
if (raw.provider !== provider)
|
|
105
|
+
return null;
|
|
106
|
+
return sameDir(raw.workdir, workdir) ? raw : null;
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
74
112
|
// Two paths that denote the SAME directory must match: the handoff is consumed
|
|
75
113
|
// by the NEXT launch in that directory, and the path there is not guaranteed to
|
|
76
114
|
// be byte-identical — a trailing separator (a `/cd sub/` leaves one) or a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zames_pro",
|
|
3
|
-
"version": "2.82.
|
|
3
|
+
"version": "2.82.36",
|
|
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": {
|