truememory-mirror 1.0.13 → 1.0.14

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 CHANGED
@@ -272,14 +272,13 @@ async function main() {
272
272
 
273
273
  const smoothTimer = setInterval(() => {
274
274
  if (done) return;
275
+ const ceiling = Math.min(serverPct + 5, 99);
275
276
  if (displayPct < serverPct) {
276
- displayPct += Math.max(0.5, (serverPct - displayPct) * 0.15);
277
- } else {
278
- const remaining = 99 - displayPct;
279
- const crawl = remaining * 0.008;
280
- if (crawl > 0.05) displayPct += crawl;
277
+ displayPct += Math.max(0.3, (serverPct - displayPct) * 0.12);
278
+ } else if (displayPct < ceiling) {
279
+ displayPct += 0.15;
281
280
  }
282
- displayPct = Math.min(displayPct, 99);
281
+ displayPct = Math.min(displayPct, ceiling);
283
282
  renderProgress();
284
283
  }, 500);
285
284
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "truememory-mirror",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "Behavioral prediction engine for how you think, decide, and react",
5
5
  "bin": {
6
6
  "truememory-mirror": "./bin/mirror.js"
package/src/api-client.js CHANGED
@@ -1,4 +1,5 @@
1
1
  const POLL_INTERVAL_MS = 3000;
2
+ const MAX_POLL_RETRIES = 3;
2
3
 
3
4
  export async function submitForExtraction(payload, apiUrl) {
4
5
  const body = JSON.stringify(payload);
@@ -17,12 +18,26 @@ export async function submitForExtraction(payload, apiUrl) {
17
18
  }
18
19
 
19
20
  export async function pollStatus(profileId, apiUrl, onUpdate) {
21
+ let retries = 0;
20
22
  while (true) {
21
- const response = await fetch(`${apiUrl}/api/profile/${profileId}/status`);
23
+ let response;
24
+ try {
25
+ response = await fetch(`${apiUrl}/api/profile/${profileId}/status`);
26
+ } catch {
27
+ retries++;
28
+ if (retries > MAX_POLL_RETRIES) throw new Error('Lost connection to server');
29
+ await new Promise(resolve => setTimeout(resolve, POLL_INTERVAL_MS * 2));
30
+ continue;
31
+ }
32
+
22
33
  if (!response.ok) {
23
- throw new Error(`Status check failed (${response.status})`);
34
+ retries++;
35
+ if (retries > MAX_POLL_RETRIES) throw new Error(`Status check failed (${response.status})`);
36
+ await new Promise(resolve => setTimeout(resolve, POLL_INTERVAL_MS * 2));
37
+ continue;
24
38
  }
25
39
 
40
+ retries = 0;
26
41
  const status = await response.json();
27
42
  if (onUpdate) onUpdate(status);
28
43