dsh-as-aistudio 0.5.18 → 0.5.20
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 +4 -0
- package/package.json +1 -1
- package/src/client.js +2 -2
- package/src/components.js +1 -1
- package/src/vendor/host/dsh-edit-turn.js +2 -2
- package/src/vendor/host/dsh-edit-turn.patch.js +1 -1
- package/src/vendor/host/dsh-log-trim.flatten.js +1 -1
- package/src/vendor/host/dsh-log-trim.goal-repair.js +1 -1
- package/src/vendor/host/dsh-log-trim.host-libs.mjs +1 -1
- package/src/vendor/host/dsh-log-trim.js +17 -10
- 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 +5 -2
- package/src/vendor/host/dsh-log-trim.verify-session-log.mjs +1 -1
- package/src/vendor/host/dsh-log-trim.worker.mjs +1 -1
- package/src/vendor/versions.json +2 -2
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.20",
|
|
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
|
@@ -9642,7 +9642,7 @@ window.__ModuleLoader__.load({
|
|
|
9642
9642
|
const react = require('react')
|
|
9643
9643
|
const { jsx, jsxs } = require('react/jsx-runtime')
|
|
9644
9644
|
|
|
9645
|
-
const PLUGIN_VERSION = '0.7.
|
|
9645
|
+
const PLUGIN_VERSION = '0.7.7'
|
|
9646
9646
|
const ROUTE_PREFIX = '/api/dsh-log-trim'
|
|
9647
9647
|
|
|
9648
9648
|
/** The knobs this card edits, in the order they are drawn. */
|
|
@@ -10168,7 +10168,7 @@ window.__ModuleLoader__.load({
|
|
|
10168
10168
|
const NS = 'dsh-as-aistudio'
|
|
10169
10169
|
|
|
10170
10170
|
/** Keep in sync with package.json and src/components.js. */
|
|
10171
|
-
const PLUGIN_VERSION = '0.5.
|
|
10171
|
+
const PLUGIN_VERSION = '0.5.20'
|
|
10172
10172
|
|
|
10173
10173
|
/** Presence marker the live verifier reads. */
|
|
10174
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.
|
|
29
|
+
export const STUDIO_VERSION = '0.5.20'
|
|
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.
|
|
3
|
+
// Source: ../dsh-edit-turn/lib/index.js (v0.5.23, sha256 d7b898199cac0386)
|
|
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.
|
|
88
|
+
export const PLUGIN_VERSION = '0.5.23'
|
|
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.
|
|
3
|
+
// Source: ../dsh-edit-turn/lib/patch.js (v0.5.23, 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-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.7.
|
|
3
|
+
// Source: ../dsh-log-trim/lib/flatten.js (v0.7.7, 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.goal-repair.js), VENDORED by tools/vendor.mjs - DO NOT EDIT.
|
|
2
2
|
//
|
|
3
|
-
// Source: ../dsh-log-trim/lib/goal-repair.js (v0.7.
|
|
3
|
+
// Source: ../dsh-log-trim/lib/goal-repair.js (v0.7.7, sha256 0801a28f35667ee7)
|
|
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.7.
|
|
3
|
+
// Source: ../dsh-log-trim/lib/host-libs.mjs (v0.7.7, 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.7.
|
|
3
|
+
// Source: ../dsh-log-trim/lib/index.js (v0.7.7, sha256 9c7bc26a51828b7b)
|
|
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
|
|
@@ -37,14 +37,14 @@ import { discoverRoots, isCurrentLog, listLegacy } from './dsh-log-trim.roots.js
|
|
|
37
37
|
import fs from 'node:fs'
|
|
38
38
|
import os from 'node:os'
|
|
39
39
|
import path from 'node:path'
|
|
40
|
-
import { applyTrim, commitTrim, encodeLogAsync, foldSurface, isSessionLocked, keepLastWindows, readLogAsync, renumber, windowsOf } from './dsh-log-trim.vendor.compact-session.mjs'
|
|
40
|
+
import { applyTrim, commitTrim, dropShadowedPrefix, encodeLogAsync, foldSurface, isSessionLocked, keepLastWindows, readLogAsync, renumber, windowsOf } from './dsh-log-trim.vendor.compact-session.mjs'
|
|
41
41
|
import { applyFlatten, applyLossless, applyStreamOnly, planLossless, applyRebuild } from './dsh-log-trim.lossless.js'
|
|
42
42
|
import { orphanGoalRounds, stripOrphanGoalSources } from './dsh-log-trim.goal-repair.js'
|
|
43
43
|
import { readLedger, recordFor } from './dsh-log-trim.ledger.js'
|
|
44
44
|
|
|
45
45
|
export const name = 'dsh-log-trim'
|
|
46
46
|
export const PLUGIN_ID = name
|
|
47
|
-
export const PLUGIN_VERSION = '0.7.
|
|
47
|
+
export const PLUGIN_VERSION = '0.7.7'
|
|
48
48
|
export const ROUTE_PREFIX = '/api/dsh-log-trim'
|
|
49
49
|
|
|
50
50
|
/**
|
|
@@ -623,7 +623,7 @@ export const DEFAULTS = {
|
|
|
623
623
|
repairOnBoot: true,
|
|
624
624
|
keepWindows: 2,
|
|
625
625
|
minDroppableEvents: 500,
|
|
626
|
-
minBytes:
|
|
626
|
+
minBytes: 262144,
|
|
627
627
|
minRatio: 0.2,
|
|
628
628
|
requireModelUnchanged: true,
|
|
629
629
|
dryRun: false,
|
|
@@ -893,13 +893,17 @@ export async function estimate(logFile, keepWindows) {
|
|
|
893
893
|
// that the host then accepted verbatim.
|
|
894
894
|
const after =
|
|
895
895
|
trimmed.cutSeq === null ? before : foldSurface(renumber(trimmed.events).events).visible.length
|
|
896
|
+
// 只丢被遮蔽的前缀不改表面,模型视图必须逐条不变。
|
|
897
|
+
// 「窗口不用裁」不等于「没活干」:最后一窗的 checkpoint 会把前面一整段历史遮蔽掉,
|
|
898
|
+
// 那些行模型和界面都看不到,丢掉它们同样是裁剪(窗口页还会把它算成一窗)。
|
|
899
|
+
const shadowed = trimmed.cutSeq === null ? dropShadowedPrefix(trimmed.events) : { dropped: 0 }
|
|
896
900
|
return {
|
|
897
901
|
title: titleOf(log.events),
|
|
898
902
|
events: log.events.length,
|
|
899
903
|
bytes: log.compressedBytes,
|
|
900
904
|
windows: trimmed.windows,
|
|
901
905
|
cutSeq: trimmed.cutSeq,
|
|
902
|
-
droppable: trimmed.dropped,
|
|
906
|
+
droppable: trimmed.dropped + shadowed.dropped,
|
|
903
907
|
modelBefore: before,
|
|
904
908
|
modelAfter: after,
|
|
905
909
|
sessionId: log.header?.id ?? path.basename(path.dirname(logFile)),
|
|
@@ -1000,9 +1004,10 @@ export async function runScan(config, logger = {}) {
|
|
|
1000
1004
|
continue
|
|
1001
1005
|
}
|
|
1002
1006
|
}
|
|
1003
|
-
// A log smaller than `minBytes`
|
|
1004
|
-
//
|
|
1005
|
-
//
|
|
1007
|
+
// A log smaller than `minBytes` is not worth decoding: reading it out is the
|
|
1008
|
+
// expensive half of a scan. It used to be 1 MB on the assumption that four
|
|
1009
|
+
// windows cannot fit below that - but three windows fit in 775 KB, so the
|
|
1010
|
+
// gate now sits at 256 KB.
|
|
1006
1011
|
let bytes = 0
|
|
1007
1012
|
try {
|
|
1008
1013
|
bytes = fs.statSync(logFile).size
|
|
@@ -1011,7 +1016,7 @@ export async function runScan(config, logger = {}) {
|
|
|
1011
1016
|
continue
|
|
1012
1017
|
}
|
|
1013
1018
|
if (bytes < config.minBytes) {
|
|
1014
|
-
summary.skipped.push({ sessionId, reason: `只有 ${Math.round(bytes / 1024)} KB
|
|
1019
|
+
summary.skipped.push({ sessionId, reason: `只有 ${Math.round(bytes / 1024)} KB,低于最小体积阈值 ${Math.round(config.minBytes / 1024)} KB` })
|
|
1015
1020
|
continue
|
|
1016
1021
|
}
|
|
1017
1022
|
let mtimeMs = 0
|
|
@@ -1111,7 +1116,9 @@ export async function runScan(config, logger = {}) {
|
|
|
1111
1116
|
mtimeMs = stat.mtimeMs
|
|
1112
1117
|
}
|
|
1113
1118
|
} catch (error) {
|
|
1114
|
-
|
|
1119
|
+
const text = error instanceof Error ? error.message : String(error)
|
|
1120
|
+
if (text.includes('不需要裁')) summary.skipped.push({ sessionId, reason: text })
|
|
1121
|
+
else summary.failed.push({ sessionId, reason: `清理失败:${text}` })
|
|
1115
1122
|
continue
|
|
1116
1123
|
}
|
|
1117
1124
|
}
|
|
@@ -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.7.
|
|
3
|
+
// Source: ../dsh-log-trim/lib/ledger.js (v0.7.7, sha256 5ca2460b42a3a776)
|
|
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.7.
|
|
3
|
+
// Source: ../dsh-log-trim/lib/lossless.js (v0.7.7, sha256 7e8478a2fd2ec10b)
|
|
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.7.
|
|
3
|
+
// Source: ../dsh-log-trim/lib/roots.js (v0.7.7, 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.7.
|
|
3
|
+
// Source: ../dsh-log-trim/lib/vendor.compact-session.mjs (v0.7.7, sha256 69e33224d92c2157)
|
|
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
|
|
@@ -2154,7 +2154,7 @@ export function repairLateToolResults(events) {
|
|
|
2154
2154
|
* @param {object[]} events - 候选保留事件(keepLastWindows 的结果)。
|
|
2155
2155
|
* @returns {{ events: object[], dropped: number }} 结果。
|
|
2156
2156
|
*/
|
|
2157
|
-
function dropShadowedPrefix(events) {
|
|
2157
|
+
export function dropShadowedPrefix(events) {
|
|
2158
2158
|
const checkpoints = events.filter((event) => event.type === 'user/message' && event.data?.source?.kind === 'compact-checkpoint')
|
|
2159
2159
|
const last = checkpoints[checkpoints.length - 1]
|
|
2160
2160
|
const shadowEnd = last !== undefined && typeof last.surfaceOp?.endSeq === 'number' ? last.surfaceOp.endSeq : null
|
|
@@ -2301,6 +2301,9 @@ export async function applyTrim(logFile, keep, options = {}) {
|
|
|
2301
2301
|
if (retried.ok) return commitTrim(staged, logFile)
|
|
2302
2302
|
fs.rmSync(staged.staging, { force: true })
|
|
2303
2303
|
const bad = retried.checks.filter((check) => !check.ok).map((check) => `${check.name} ${check.detail}`).join(';')
|
|
2304
|
+
// 两次都不过:如果退回后本来就“不需要裁”,那是这份日志结构不适合丢前缀,
|
|
2305
|
+
// 当成跳过而不是失败(扫描不该因为收益型优化失败而报错)。
|
|
2306
|
+
if (String(bad).includes('不需要裁')) throw new Error('不需要裁(前缀清理在这份日志上过不了宿主校验)')
|
|
2304
2307
|
throw new Error(`裁剪结果没通过宿主校验,未写入:${bad}`)
|
|
2305
2308
|
}
|
|
2306
2309
|
const bad = result.checks.filter((check) => !check.ok).map((check) => `${check.name} ${check.detail}`).join(';')
|
|
@@ -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.7.
|
|
3
|
+
// Source: ../dsh-log-trim/lib/verify-session-log.mjs (v0.7.7, sha256 7cf835c053942961)
|
|
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.worker.mjs), VENDORED by tools/vendor.mjs - DO NOT EDIT.
|
|
2
2
|
//
|
|
3
|
-
// Source: ../dsh-log-trim/lib/worker.mjs (v0.7.
|
|
3
|
+
// Source: ../dsh-log-trim/lib/worker.mjs (v0.7.7, sha256 675a759a767b7e38)
|
|
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
|