dsh-memory-domains 0.2.0 → 0.2.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 (2) hide show
  1. package/client.js +12 -1
  2. package/package.json +1 -1
package/client.js CHANGED
@@ -473,6 +473,7 @@ window.__ModuleLoader__.load({
473
473
  if (reviewJob) { toast('整理进行中…'); return; }
474
474
  post(API + '/review', { session: sid }).then(function (j) {
475
475
  if (!j.ok) { toast('启动失败:' + (j.error || '')); return; }
476
+ pollReview.fails = 0;
476
477
  reviewJob = j.job;
477
478
  reviewSessionId = sid;
478
479
  toast('AI 正在回顾会话…(可能 1-2 分钟)');
@@ -484,7 +485,17 @@ window.__ModuleLoader__.load({
484
485
  function pollReview(job) {
485
486
  clearTimeout(reviewTimer);
486
487
  api(API + '/review/status?job=' + encodeURIComponent(job)).then(function (j) {
487
- if (!j || !j.ok) { reviewJob = null; return; }
488
+ if (!j || !j.ok) {
489
+ // job 可能被 TTL 清掉/宿主重启/瞬时抖动——重试几次再放弃,且放弃时必须重渲染
490
+ pollReview.fails = (pollReview.fails || 0) + 1;
491
+ if (pollReview.fails < 5) { reviewTimer = setTimeout(function () { pollReview(job); }, 2000); return; }
492
+ pollReview.fails = 0;
493
+ reviewJob = null; reviewSessionId = null;
494
+ syncBar(); renderBody();
495
+ toast('整理状态丢失(可能宿主重启过)——草稿若已生成请查看待审区');
496
+ return;
497
+ }
498
+ pollReview.fails = 0;
488
499
  if (j.state === 'running') { reviewTimer = setTimeout(function () { pollReview(job); }, 2000); return; }
489
500
  var sid = reviewSessionId;
490
501
  reviewJob = null; reviewSessionId = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-memory-domains",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "exports": {