truememory-mirror 1.0.7 → 1.0.9
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/bin/mirror.js +67 -45
- package/package.json +1 -1
package/bin/mirror.js
CHANGED
|
@@ -99,37 +99,46 @@ function clearLine() {
|
|
|
99
99
|
if (!_jsonMode) process.stderr.write('\r\x1b[K');
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
const
|
|
103
|
-
'scanning cognitive patterns',
|
|
104
|
-
'indexing conversation fragments',
|
|
105
|
-
'parsing behavioral signals',
|
|
106
|
-
'extracting reasoning signatures',
|
|
107
|
-
'profiling communication style',
|
|
108
|
-
'detecting stress responses',
|
|
109
|
-
'measuring risk tolerance curves',
|
|
110
|
-
'mapping decision architecture',
|
|
111
|
-
'isolating personality markers',
|
|
112
|
-
'tracing collaboration fingerprint',
|
|
113
|
-
'decoding problem-solving heuristics',
|
|
114
|
-
'analyzing delegation patterns',
|
|
115
|
-
'triangulating identity vectors',
|
|
116
|
-
'calibrating behavioral model',
|
|
117
|
-
'resolving cognitive tensions',
|
|
118
|
-
'consolidating trait matrix',
|
|
119
|
-
'building predictive scaffolding',
|
|
120
|
-
'running scenario simulations',
|
|
121
|
-
'stress-testing edge cases',
|
|
122
|
-
'computing confidence intervals',
|
|
123
|
-
'rendering identity surface',
|
|
124
|
-
'locking archetype match',
|
|
125
|
-
'sealing behavioral predictions',
|
|
126
|
-
'finalizing your mirror',
|
|
102
|
+
const PROGRESS_PHRASES = [
|
|
103
|
+
[0, 'scanning cognitive patterns'],
|
|
104
|
+
[4, 'indexing conversation fragments'],
|
|
105
|
+
[8, 'parsing behavioral signals'],
|
|
106
|
+
[12, 'extracting reasoning signatures'],
|
|
107
|
+
[16, 'profiling communication style'],
|
|
108
|
+
[20, 'detecting stress responses'],
|
|
109
|
+
[25, 'measuring risk tolerance curves'],
|
|
110
|
+
[30, 'mapping decision architecture'],
|
|
111
|
+
[35, 'isolating personality markers'],
|
|
112
|
+
[40, 'tracing collaboration fingerprint'],
|
|
113
|
+
[45, 'decoding problem-solving heuristics'],
|
|
114
|
+
[50, 'analyzing delegation patterns'],
|
|
115
|
+
[55, 'triangulating identity vectors'],
|
|
116
|
+
[60, 'calibrating behavioral model'],
|
|
117
|
+
[65, 'resolving cognitive tensions'],
|
|
118
|
+
[70, 'consolidating trait matrix'],
|
|
119
|
+
[75, 'building predictive scaffolding'],
|
|
120
|
+
[80, 'running scenario simulations'],
|
|
121
|
+
[84, 'stress-testing edge cases'],
|
|
122
|
+
[88, 'computing confidence intervals'],
|
|
123
|
+
[91, 'rendering identity surface'],
|
|
124
|
+
[94, 'locking archetype match'],
|
|
125
|
+
[97, 'sealing behavioral predictions'],
|
|
126
|
+
[99, 'finalizing your mirror'],
|
|
127
127
|
];
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
function phraseForProgress(pct) {
|
|
130
|
+
let phrase = PROGRESS_PHRASES[0][1];
|
|
131
|
+
for (const [threshold, text] of PROGRESS_PHRASES) {
|
|
132
|
+
if (pct >= threshold) phrase = text;
|
|
133
|
+
else break;
|
|
134
|
+
}
|
|
135
|
+
return phrase;
|
|
136
|
+
}
|
|
130
137
|
|
|
131
|
-
|
|
132
|
-
|
|
138
|
+
let _scanPhraseIndex = 0;
|
|
139
|
+
function nextScanPhrase() {
|
|
140
|
+
const scanPhrases = PROGRESS_PHRASES.slice(0, 3);
|
|
141
|
+
return scanPhrases[_scanPhraseIndex++ % scanPhrases.length][1];
|
|
133
142
|
}
|
|
134
143
|
|
|
135
144
|
function progressBar(pct, width = 30) {
|
|
@@ -168,10 +177,10 @@ async function main() {
|
|
|
168
177
|
// --- Scan & parse with rotating status ---
|
|
169
178
|
const spinTimer = setInterval(() => {
|
|
170
179
|
clearLine();
|
|
171
|
-
write(` ${DIM}${
|
|
180
|
+
write(` ${DIM}${nextScanPhrase()}...${R}`);
|
|
172
181
|
}, 3750);
|
|
173
182
|
|
|
174
|
-
write(` ${DIM}${
|
|
183
|
+
write(` ${DIM}${nextScanPhrase()}...${R}`);
|
|
175
184
|
const sources = await scan(args.source);
|
|
176
185
|
|
|
177
186
|
let claudeSessions = [];
|
|
@@ -233,31 +242,44 @@ async function main() {
|
|
|
233
242
|
process.exit(1);
|
|
234
243
|
}
|
|
235
244
|
|
|
236
|
-
// --- Poll with
|
|
237
|
-
let
|
|
238
|
-
let
|
|
245
|
+
// --- Poll with smooth interpolation ---
|
|
246
|
+
let serverPct = 0;
|
|
247
|
+
let displayPct = 0;
|
|
248
|
+
let done = false;
|
|
239
249
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
250
|
+
function renderProgress() {
|
|
251
|
+
const pct = Math.min(Math.round(displayPct), 99);
|
|
252
|
+
clearLine();
|
|
253
|
+
write(` ${progressBar(pct / 100)} ${WHITE}${pct}%${R} ${DIM}${phraseForProgress(pct)}...${R}`);
|
|
254
|
+
}
|
|
245
255
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
256
|
+
const smoothTimer = setInterval(() => {
|
|
257
|
+
if (done) return;
|
|
258
|
+
if (displayPct < serverPct) {
|
|
259
|
+
displayPct += Math.max(1, (serverPct - displayPct) * 0.3);
|
|
260
|
+
} else if (displayPct < 95) {
|
|
261
|
+
displayPct += 0.4;
|
|
262
|
+
}
|
|
263
|
+
displayPct = Math.min(displayPct, 99);
|
|
264
|
+
renderProgress();
|
|
265
|
+
}, 600);
|
|
250
266
|
|
|
251
|
-
|
|
252
|
-
|
|
267
|
+
try {
|
|
268
|
+
await pollStatus(result.profile_id, args.apiUrl, (status) => {
|
|
269
|
+
serverPct = Math.round((status.progress || 0) * 100);
|
|
270
|
+
if (serverPct > displayPct) renderProgress();
|
|
253
271
|
});
|
|
254
272
|
} catch (err) {
|
|
273
|
+
done = true;
|
|
274
|
+
clearInterval(smoothTimer);
|
|
255
275
|
write(`\n\n ✗ extraction failed: ${err.message}\n\n`);
|
|
256
276
|
process.exit(1);
|
|
257
277
|
}
|
|
258
278
|
|
|
279
|
+
done = true;
|
|
280
|
+
clearInterval(smoothTimer);
|
|
259
281
|
clearLine();
|
|
260
|
-
write(` ${progressBar(1.0)} ${WHITE}100%${R}\n\n`);
|
|
282
|
+
write(` ${progressBar(1.0)} ${WHITE}100%${R} ${DIM}finalizing your mirror...${R}\n\n`);
|
|
261
283
|
write(` ${G}✓${R} your mirror is ready\n`);
|
|
262
284
|
write(` ${G}→${R} ${result.url}\n\n`);
|
|
263
285
|
|