dsh-as-aistudio 0.5.6 → 0.5.8

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,10 @@
4
4
 
5
5
  ## 中文
6
6
 
7
+ **0.5.8** —— 跟进 dsh-log-trim 0.6.1(扫描崩溃修复、`/run` 后台执行)。
8
+
9
+ **0.5.7** —— 跟进 dsh-delete-turn 0.2.4(多选条「取消」)。
10
+
7
11
  **0.5.6** —— 组件设置里补上「会话日志裁剪」的卡片。
8
12
 
9
13
  - `CONFIG_CARDS` 之前只列了 edit / rerun / delete,log-trim 的 `ConfigCard` 虽然已导出却没被渲染,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-as-aistudio",
3
- "version": "0.5.6",
3
+ "version": "0.5.8",
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, and render sent prompts as Markdown. Self-contained: the plugin list shows this one row, and the four components 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
@@ -7150,7 +7150,7 @@ window.__ModuleLoader__.load({
7150
7150
  'select.count': '已选',
7151
7151
  'select.unit': '项',
7152
7152
  'select.delete': '删除选中',
7153
- 'select.cancel': '退出多选',
7153
+ 'select.cancel': '取消',
7154
7154
  'config.ask': '删除时询问',
7155
7155
  'config.hint.ask': '每次删除前都会弹出确认框。',
7156
7156
  'config.hint.auto': '删除会直接执行,不再询问。',
@@ -7198,7 +7198,7 @@ window.__ModuleLoader__.load({
7198
7198
  'select.count': 'Selected',
7199
7199
  'select.unit': '',
7200
7200
  'select.delete': 'Delete selected',
7201
- 'select.cancel': 'Exit multi-select',
7201
+ 'select.cancel': 'Cancel',
7202
7202
  'config.ask': 'Ask before deleting',
7203
7203
  'config.hint.ask': 'Show a confirmation dialog before every deletion.',
7204
7204
  'config.hint.auto': 'Delete right away without asking.',
@@ -9578,7 +9578,7 @@ window.__ModuleLoader__.load({
9578
9578
  const react = require('react')
9579
9579
  const { jsx, jsxs } = require('react/jsx-runtime')
9580
9580
 
9581
- const PLUGIN_VERSION = '0.6.0'
9581
+ const PLUGIN_VERSION = '0.6.1'
9582
9582
  const ROUTE_PREFIX = '/api/dsh-log-trim'
9583
9583
 
9584
9584
  /** The knobs this card edits, in the order they are drawn. */
@@ -9891,9 +9891,24 @@ window.__ModuleLoader__.load({
9891
9891
  setNote('')
9892
9892
  try {
9893
9893
  const data = await call('/run', {})
9894
- setStatus({ last: data.result })
9895
- const last = data.result || {}
9896
- setNote(`扫了 ${last.scanned || 0} 个会话:裁 ${(last.trimmed || []).length},跳过 ${(last.skipped || []).length},失败 ${(last.failed || []).length}`)
9894
+ if (data.started === false) setNote('已经在扫了,等它跑完…')
9895
+ // 扫描在后台跑:轮询 /status,直到 running 变回 false。
9896
+ let last = data.result || null
9897
+ for (let attempt = 0; attempt < 240; attempt += 1) {
9898
+ await new Promise((resolve) => setTimeout(resolve, 500))
9899
+ const state = await call('/status')
9900
+ setStatus(state)
9901
+ if (state.error) {
9902
+ setError(`扫描失败:${state.error}`)
9903
+ return
9904
+ }
9905
+ if (state.running !== true) {
9906
+ last = state.last || last
9907
+ break
9908
+ }
9909
+ }
9910
+ const scanned = last || {}
9911
+ setNote(`扫了 ${scanned.scanned || 0} 个会话:裁 ${(scanned.trimmed || []).length},跳过 ${(scanned.skipped || []).length},失败 ${(scanned.failed || []).length}`)
9897
9912
  void loadBackups()
9898
9913
  } catch (failure) {
9899
9914
  setError(String(failure.message || failure))
@@ -10089,7 +10104,7 @@ window.__ModuleLoader__.load({
10089
10104
  const NS = 'dsh-as-aistudio'
10090
10105
 
10091
10106
  /** Keep in sync with package.json and src/components.js. */
10092
- const PLUGIN_VERSION = '0.5.6'
10107
+ const PLUGIN_VERSION = '0.5.8'
10093
10108
 
10094
10109
  /** Presence marker the live verifier reads. */
10095
10110
  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.6'
29
+ export const STUDIO_VERSION = '0.5.8'
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-delete-turn host half (dsh-delete-turn.js), VENDORED by tools/vendor.mjs - DO NOT EDIT.
2
2
  //
3
- // Source: ../dsh-delete-turn/src/index.js (v0.2.3, sha256 5dfc53e5c47750f5)
3
+ // Source: ../dsh-delete-turn/src/index.js (v0.2.4, sha256 5dfc53e5c47750f5)
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-delete-turn host half (dsh-delete-turn.logic.js), VENDORED by tools/vendor.mjs - DO NOT EDIT.
2
2
  //
3
- // Source: ../dsh-delete-turn/src/logic.js (v0.2.3, sha256 6da16435446356ca)
3
+ // Source: ../dsh-delete-turn/src/logic.js (v0.2.4, sha256 6da16435446356ca)
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-log-trim host half (dsh-log-trim.flatten.js), VENDORED by tools/vendor.mjs - DO NOT EDIT.
2
2
  //
3
- // Source: ../dsh-log-trim/lib/flatten.js (v0.6.0, sha256 3aa1fdcbb120ab06)
3
+ // Source: ../dsh-log-trim/lib/flatten.js (v0.6.1, sha256 3aa1fdcbb120ab06)
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-log-trim host half (dsh-log-trim.host-libs.mjs), VENDORED by tools/vendor.mjs - DO NOT EDIT.
2
2
  //
3
- // Source: ../dsh-log-trim/lib/host-libs.mjs (v0.6.0, sha256 5ebed01988b5bfcf)
3
+ // Source: ../dsh-log-trim/lib/host-libs.mjs (v0.6.1, sha256 5ebed01988b5bfcf)
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-log-trim host half (dsh-log-trim.js), VENDORED by tools/vendor.mjs - DO NOT EDIT.
2
2
  //
3
- // Source: ../dsh-log-trim/lib/index.js (v0.6.0, sha256 1ef6710b85f69330)
3
+ // Source: ../dsh-log-trim/lib/index.js (v0.6.1, sha256 6716b35e8747d594)
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
@@ -43,7 +43,7 @@ import { readLedger, recordFor } from './dsh-log-trim.ledger.js'
43
43
 
44
44
  export const name = 'dsh-log-trim'
45
45
  export const PLUGIN_ID = name
46
- export const PLUGIN_VERSION = '0.6.0'
46
+ export const PLUGIN_VERSION = '0.6.1'
47
47
  export const ROUTE_PREFIX = '/api/dsh-log-trim'
48
48
 
49
49
  /**
@@ -846,8 +846,9 @@ export async function runScan(config, logger = {}) {
846
846
  }
847
847
  // 先折叠:edit/rerun/delete 的载体是“注释行”,落成正文后日志才是“本来如此”。
848
848
  // 折叠完继续往下走,于是同一份日志还能顺带被裁窗口(两步都各自验过才写)。
849
+ // 这个计数跨两个分支用(折叠要不要跑、清理已遮蔽要不要跳过),必须在外层声明。
850
+ let carriers = 0
849
851
  if (config.flattenOnBoot !== false) {
850
- let carriers = 0
851
852
  try {
852
853
  carriers = carriersIn(logFile)
853
854
  } catch {
@@ -1158,9 +1159,14 @@ export function apply(ctx, config = {}) {
1158
1159
  const run = async () => {
1159
1160
  if (state.running) return state.last
1160
1161
  state.running = true
1162
+ state.error = null
1161
1163
  try {
1162
1164
  state.last = await runScan(resolved, ctx.logger ?? {})
1163
1165
  return state.last
1166
+ } catch (error) {
1167
+ // 扫描失败要能在 /status 里看到,否则界面只会一直转圈。
1168
+ state.error = error instanceof Error ? error.message : String(error)
1169
+ throw error
1164
1170
  } finally {
1165
1171
  state.running = false
1166
1172
  }
@@ -1228,7 +1234,7 @@ export function apply(ctx, config = {}) {
1228
1234
  return
1229
1235
  }
1230
1236
  res.setHeader('content-type', 'application/json; charset=utf-8')
1231
- res.end(JSON.stringify({ ok: true, version: PLUGIN_VERSION, config: resolved, running: state.running, last: state.last, duplicateStudio: duplicate }, null, 2))
1237
+ res.end(JSON.stringify({ ok: true, version: PLUGIN_VERSION, config: resolved, running: state.running, last: state.last, error: state.error ?? null, duplicateStudio: duplicate }, null, 2))
1232
1238
  },
1233
1239
  }),
1234
1240
  )
@@ -1247,9 +1253,18 @@ export function apply(ctx, config = {}) {
1247
1253
  res.end('POST only')
1248
1254
  return
1249
1255
  }
1250
- const result = await run()
1256
+ // 一次扫描可能要几十秒(169 份日志 / 62 MB),不能把 HTTP 请求挂在那里。
1257
+ // 启动后台扫描并立刻返回,客户端轮询 /status 拿 running / last / error。
1258
+ if (state.running) {
1259
+ res.setHeader('content-type', 'application/json; charset=utf-8')
1260
+ res.end(JSON.stringify({ ok: true, started: false, busy: true }, null, 2))
1261
+ return
1262
+ }
1263
+ void run().catch((error) => {
1264
+ if (typeof ctx.logger?.warn === 'function') ctx.logger.warn(`[dsh-log-trim] 扫描失败:${error instanceof Error ? error.message : String(error)}`)
1265
+ })
1251
1266
  res.setHeader('content-type', 'application/json; charset=utf-8')
1252
- res.end(JSON.stringify({ ok: true, result }, null, 2))
1267
+ res.end(JSON.stringify({ ok: true, started: true }, null, 2))
1253
1268
  },
1254
1269
  }),
1255
1270
  )
@@ -1,6 +1,6 @@
1
1
  // dsh-log-trim host half (dsh-log-trim.ledger.js), VENDORED by tools/vendor.mjs - DO NOT EDIT.
2
2
  //
3
- // Source: ../dsh-log-trim/lib/ledger.js (v0.6.0, sha256 1b391592e0cc0fbf)
3
+ // Source: ../dsh-log-trim/lib/ledger.js (v0.6.1, sha256 1b391592e0cc0fbf)
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-log-trim host half (dsh-log-trim.lossless.js), VENDORED by tools/vendor.mjs - DO NOT EDIT.
2
2
  //
3
- // Source: ../dsh-log-trim/lib/lossless.js (v0.6.0, sha256 a35a99d4fe824689)
3
+ // Source: ../dsh-log-trim/lib/lossless.js (v0.6.1, sha256 a35a99d4fe824689)
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-log-trim host half (dsh-log-trim.roots.js), VENDORED by tools/vendor.mjs - DO NOT EDIT.
2
2
  //
3
- // Source: ../dsh-log-trim/lib/roots.js (v0.6.0, sha256 028d9c12a395aaab)
3
+ // Source: ../dsh-log-trim/lib/roots.js (v0.6.1, sha256 028d9c12a395aaab)
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-log-trim host half (dsh-log-trim.vendor.compact-session.mjs), VENDORED by tools/vendor.mjs - DO NOT EDIT.
2
2
  //
3
- // Source: ../dsh-log-trim/lib/vendor.compact-session.mjs (v0.6.0, sha256 2c1c819e732c9649)
3
+ // Source: ../dsh-log-trim/lib/vendor.compact-session.mjs (v0.6.1, sha256 2c1c819e732c9649)
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-log-trim host half (dsh-log-trim.verify-session-log.mjs), VENDORED by tools/vendor.mjs - DO NOT EDIT.
2
2
  //
3
- // Source: ../dsh-log-trim/lib/verify-session-log.mjs (v0.6.0, sha256 6a0527e8483fb252)
3
+ // Source: ../dsh-log-trim/lib/verify-session-log.mjs (v0.6.1, sha256 6a0527e8483fb252)
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,7 +1,7 @@
1
1
  {
2
2
  "dsh-edit-turn": "0.5.16",
3
3
  "dsh-rerun-turn": "0.2.9",
4
- "dsh-delete-turn": "0.2.3",
4
+ "dsh-delete-turn": "0.2.4",
5
5
  "dsh-markdown-bubble": "0.1.5",
6
- "dsh-log-trim": "0.6.0"
6
+ "dsh-log-trim": "0.6.1"
7
7
  }