dsh-as-aistudio 0.5.11 → 0.5.12

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
@@ -4,6 +4,11 @@
4
4
 
5
5
  ## 中文
6
6
 
7
+ **0.5.12** —— 跟进 dsh-rerun-turn 0.2.10(行增长节流 + 传输层重试)。
8
+
9
+ - 内嵌 rerun 半部:行数增长改成 20 秒节流的尾随刷新,`Failed to fetch` 静默重试 3 次;
10
+ 大会话里不再一次回答就排队几十次 `/state`。
11
+
7
12
  **0.5.11** —— 跟进 dsh-log-trim 0.7.0(worker 扫描 + 异步裁剪 + 用量账本)。
8
13
 
9
14
  - 内嵌 log-trim 升到 0.7.0:开机扫描在 worker 里跑(`src/vendor/host/dsh-log-trim.worker.mjs`),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-as-aistudio",
3
- "version": "0.5.11",
3
+ "version": "0.5.12",
4
4
  "description": "Google-AI-Studio-style turn controls for DeepSeek Harness, in one install: edit a prompt and re-run it, re-run a reply in place, delete a turn from the model context, render sent prompts as Markdown, and trim idle session logs on boot. Self-contained: the plugin list shows this one row, and the five components (four actions + one maintenance) are vendored inside it - installing the studio installs nothing else.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/client.js CHANGED
@@ -5530,7 +5530,7 @@ window.__ModuleLoader__.load({
5530
5530
  const ROUTE_PREFIX = '/dsh-rerun-turn'
5531
5531
 
5532
5532
  /** Keep in sync with package.json and lib/index.js. */
5533
- const PLUGIN_VERSION = '0.2.9'
5533
+ const PLUGIN_VERSION = '0.2.10'
5534
5534
 
5535
5535
  // --- copy -----------------------------------------------------------------
5536
5536
 
@@ -5835,6 +5835,17 @@ window.__ModuleLoader__.load({
5835
5835
  })
5836
5836
  }
5837
5837
 
5838
+ // 行增长触发的最短刷新间隔。20 秒足够跟上一次回答的节奏,又不会把
5839
+ // 大会话的 /state 请求排成一串(单次要 35 s 的那种会话尤其明显)。
5840
+ const ROW_REFRESH_MIN_MS = (typeof process !== 'undefined' && process.env && process.env.DSH_RERUN_ROW_REFRESH_MS)
5841
+ ? Math.max(1, Number(process.env.DSH_RERUN_ROW_REFRESH_MS))
5842
+ : 20000
5843
+ // 传输层失败最多试几次(1 s / 2 s / 4 s),之后才把错误显示出来。
5844
+ const LOAD_RETRIES = 3
5845
+ const RETRY_BASE_MS = (typeof process !== 'undefined' && process.env && process.env.DSH_RERUN_RETRY_MS)
5846
+ ? Math.max(1, Number(process.env.DSH_RERUN_RETRY_MS))
5847
+ : 1000
5848
+
5838
5849
  // --- controller -----------------------------------------------------------
5839
5850
 
5840
5851
  class RerunController {
@@ -5844,6 +5855,13 @@ window.__ModuleLoader__.load({
5844
5855
  this.inflight = null
5845
5856
  this.pollTimer = null
5846
5857
  this.rowCount = -1
5858
+ // 行数增长不再“每加一行就重拉一次”:大会话的 /state 要几十秒,
5859
+ // 一次回答里能看到几十次增长,旧逻辑等于把宿主按死。
5860
+ this.rowTimer = null
5861
+ this.lastRowRefreshAt = 0
5862
+ // 传输层失败(Failed to fetch):静默重试几次,别一断就把错误钉在界面上。
5863
+ this.loadAttempts = 0
5864
+ this.retryTimer = null
5847
5865
  this.confirmTarget = null
5848
5866
  // Set by dispose(): a listener that outlives the apply (an adopted
5849
5867
  // button still carries the previous instance's click handler) must not
@@ -5901,6 +5919,36 @@ window.__ModuleLoader__.load({
5901
5919
  window.clearInterval(this.pollTimer)
5902
5920
  this.pollTimer = null
5903
5921
  }
5922
+ if (this.rowTimer !== null) {
5923
+ window.clearTimeout(this.rowTimer)
5924
+ this.rowTimer = null
5925
+ }
5926
+ if (this.retryTimer !== null) {
5927
+ window.clearTimeout(this.retryTimer)
5928
+ this.retryTimer = null
5929
+ }
5930
+ }
5931
+
5932
+ /**
5933
+ * 行数增长后请求一次刷新,但两次之间至少隔 `ROW_REFRESH_MIN_MS`。
5934
+ * 增长本身不重要,重要的是“这轮回答结束后要有一条新数据”。
5935
+ */
5936
+ requestRowRefresh() {
5937
+ if (this.disposed === true) return
5938
+ if (this.rowTimer !== null) return
5939
+ const now = Date.now()
5940
+ const wait = ROW_REFRESH_MIN_MS - (now - this.lastRowRefreshAt)
5941
+ if (wait <= 0) {
5942
+ this.lastRowRefreshAt = now
5943
+ this.load(true)
5944
+ return
5945
+ }
5946
+ this.rowTimer = setTimeout(() => {
5947
+ this.rowTimer = null
5948
+ if (this.disposed === true) return
5949
+ this.lastRowRefreshAt = Date.now()
5950
+ this.load(true)
5951
+ }, wait)
5904
5952
  }
5905
5953
 
5906
5954
  load(force) {
@@ -5981,6 +6029,7 @@ window.__ModuleLoader__.load({
5981
6029
  }
5982
6030
  }
5983
6031
  hostConfirm = Boolean(data.config && data.config.confirm)
6032
+ this.loadAttempts = 0
5984
6033
  this.publish({
5985
6034
  hidden,
5986
6035
  replies,
@@ -6003,6 +6052,17 @@ window.__ModuleLoader__.load({
6003
6052
  else this.stopPolling()
6004
6053
  })
6005
6054
  .catch((error) => {
6055
+ // 传输层失败(断网、宿主重启、请求被掐)不该一断就钉死错误:
6056
+ // 先静默重试 1 s / 2 s / 4 s,仍失败才把原因显示出来。
6057
+ this.loadAttempts = (this.loadAttempts || 0) + 1
6058
+ if (this.loadAttempts <= LOAD_RETRIES) {
6059
+ const delay = RETRY_BASE_MS * 2 ** (this.loadAttempts - 1)
6060
+ this.retryTimer = setTimeout(() => {
6061
+ this.retryTimer = null
6062
+ if (this.disposed !== true) this.load(true)
6063
+ }, delay)
6064
+ return
6065
+ }
6006
6066
  // The host says WHY (`invalid session id`, `no session log for this
6007
6067
  // id`, a 500, a network failure). Swallowing it left the panel with
6008
6068
  // "状态加载失败,稍后重试。" for every cause alike - including the
@@ -6286,7 +6346,11 @@ window.__ModuleLoader__.load({
6286
6346
  controller.rowCount = rowCount
6287
6347
  // Only new rows can add edit targets / a fresh turn; shrink churn (the
6288
6348
  // host rebuilding its list) does not need a refresh.
6289
- if (grew) controller.load(true)
6349
+ if (grew) {
6350
+ // 真实控制器有节流;测试里的轻量替身只有 load(),退回旧行为。
6351
+ if (typeof controller.requestRowRefresh === 'function') controller.requestRowRefresh()
6352
+ else controller.load(true)
6353
+ }
6290
6354
  }
6291
6355
 
6292
6356
  function applyDom(snapshot, view, controller, t) {
@@ -10104,7 +10168,7 @@ window.__ModuleLoader__.load({
10104
10168
  const NS = 'dsh-as-aistudio'
10105
10169
 
10106
10170
  /** Keep in sync with package.json and src/components.js. */
10107
- const PLUGIN_VERSION = '0.5.11'
10171
+ const PLUGIN_VERSION = '0.5.12'
10108
10172
 
10109
10173
  /** Presence marker the live verifier reads. */
10110
10174
  const DEBUG_KEY = '__DSH_AS_AISTUDIO__'
package/src/components.js CHANGED
@@ -26,7 +26,7 @@
26
26
  export const STUDIO_ID = 'dsh-as-aistudio'
27
27
 
28
28
  /** Keep in sync with package.json and src/client.js. */
29
- export const STUDIO_VERSION = '0.5.11'
29
+ export const STUDIO_VERSION = '0.5.12'
30
30
 
31
31
  /**
32
32
  * The AI Studio action strip this studio composes, in the order the user meets
@@ -1,6 +1,6 @@
1
1
  // dsh-edit-turn host half (dsh-edit-turn.js), VENDORED by tools/vendor.mjs - DO NOT EDIT.
2
2
  //
3
- // Source: ../dsh-edit-turn/lib/index.js (v0.5.16, sha256 3b2f76b4ef352e73)
3
+ // Source: ../dsh-edit-turn/lib/index.js (v0.5.18, sha256 3a2e3a4008b8c061)
4
4
  // Regenerate with `npm run vendor`; test/sync.test.js fails when this is stale.
5
5
  //
6
6
  // src/shell.js imports the copy named after the component, which is why the
@@ -85,7 +85,7 @@ export const PLUGIN_ID = 'dsh-edit-turn'
85
85
  export const name = PLUGIN_ID
86
86
 
87
87
  /** Keep in sync with package.json and lib/client.js. */
88
- export const PLUGIN_VERSION = '0.5.16'
88
+ export const PLUGIN_VERSION = '0.5.18'
89
89
 
90
90
  // A ring of the last few requests, answering "did the browser half even ask, and
91
91
  // what did it get?" without needing its console. Read-only diagnostics: the
@@ -1,6 +1,6 @@
1
1
  // dsh-edit-turn host half (dsh-edit-turn.patch.js), VENDORED by tools/vendor.mjs - DO NOT EDIT.
2
2
  //
3
- // Source: ../dsh-edit-turn/lib/patch.js (v0.5.16, sha256 5e1e8cce1d168f6c)
3
+ // Source: ../dsh-edit-turn/lib/patch.js (v0.5.18, sha256 5e1e8cce1d168f6c)
4
4
  // Regenerate with `npm run vendor`; test/sync.test.js fails when this is stale.
5
5
  //
6
6
  // src/shell.js imports the copy named after the component, which is why the
@@ -1,6 +1,6 @@
1
1
  // dsh-rerun-turn host half (dsh-rerun-turn.js), VENDORED by tools/vendor.mjs - DO NOT EDIT.
2
2
  //
3
- // Source: ../dsh-rerun-turn/lib/index.js (v0.2.9, sha256 60fce2958ddc3d13)
3
+ // Source: ../dsh-rerun-turn/lib/index.js (v0.2.10, sha256 60fce2958ddc3d13)
4
4
  // Regenerate with `npm run vendor`; test/sync.test.js fails when this is stale.
5
5
  //
6
6
  // src/shell.js imports the copy named after the component, which is why the
@@ -1,6 +1,6 @@
1
1
  {
2
- "dsh-edit-turn": "0.5.16",
3
- "dsh-rerun-turn": "0.2.9",
2
+ "dsh-edit-turn": "0.5.18",
3
+ "dsh-rerun-turn": "0.2.10",
4
4
  "dsh-delete-turn": "0.2.4",
5
5
  "dsh-markdown-bubble": "0.1.5",
6
6
  "dsh-log-trim": "0.7.0"