dsh-as-aistudio 0.5.7 → 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 +2 -0
- package/package.json +1 -1
- package/src/client.js +20 -5
- package/src/components.js +1 -1
- package/src/vendor/host/dsh-log-trim.flatten.js +1 -1
- package/src/vendor/host/dsh-log-trim.host-libs.mjs +1 -1
- package/src/vendor/host/dsh-log-trim.js +21 -6
- package/src/vendor/host/dsh-log-trim.ledger.js +1 -1
- package/src/vendor/host/dsh-log-trim.lossless.js +1 -1
- package/src/vendor/host/dsh-log-trim.roots.js +1 -1
- package/src/vendor/host/dsh-log-trim.vendor.compact-session.mjs +1 -1
- package/src/vendor/host/dsh-log-trim.verify-session-log.mjs +1 -1
- package/src/vendor/versions.json +1 -1
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-as-aistudio",
|
|
3
|
-
"version": "0.5.
|
|
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
|
@@ -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.
|
|
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
|
-
|
|
9895
|
-
|
|
9896
|
-
|
|
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.
|
|
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.
|
|
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-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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
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,
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
package/src/vendor/versions.json
CHANGED