dsh-as-aistudio 0.4.3 → 0.4.5
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 +12 -0
- package/package.json +1 -1
- package/src/client.js +33 -5
- package/src/components.js +1 -1
- package/src/vendor/host/dsh-edit-turn.js +10 -4
- package/src/vendor/host/dsh-edit-turn.patch.js +1 -1
- package/src/vendor/versions.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
## 中文
|
|
6
6
|
|
|
7
|
+
**0.4.5** —— `/state` 再提速(跟进 `dsh-edit-turn` 0.5.11)。
|
|
8
|
+
|
|
9
|
+
- **组件跟进**:`dsh-edit-turn` **0.5.11**、`dsh-rerun-turn` 0.2.6、`dsh-delete-turn` 0.1.15、`dsh-markdown-bubble` 0.1.5。
|
|
10
|
+
|
|
11
|
+
- 回复列表不再构建分块:同一个会话 **2,227 ms → 29 ms**(中间数据 22.4 MB → 1.1 MB)。编辑笔的出现不再等这一下。
|
|
12
|
+
|
|
13
|
+
**0.4.4** —— 复制失败的诊断(跟进 `dsh-edit-turn` 0.5.10)。
|
|
14
|
+
|
|
15
|
+
- **组件跟进**:`dsh-edit-turn` **0.5.10**(另三个不变:`dsh-rerun-turn` 0.2.6、`dsh-delete-turn` 0.1.15、`dsh-markdown-bubble` 0.1.5)。
|
|
16
|
+
|
|
17
|
+
- 复制仍拿到改写前的原文时,浏览器**标签页标题**会显示 `[复制诊断] <原因>`,用来定位是哪一环没接管;接管成功时标题自动恢复。
|
|
18
|
+
|
|
7
19
|
**0.4.3** —— 编辑入口不再"等半天才出现"(`/state` 从 25 MB 降到几百 KB)。
|
|
8
20
|
|
|
9
21
|
- **组件跟进**:`dsh-edit-turn` **0.5.9**(另三个不变:`dsh-rerun-turn` 0.2.6、`dsh-delete-turn` 0.1.15、`dsh-markdown-bubble` 0.1.5)。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-as-aistudio",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
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
|
@@ -43,7 +43,7 @@ window.__ModuleLoader__.load({
|
|
|
43
43
|
const RERUN_PREFIX = '/dsh-rerun-turn'
|
|
44
44
|
|
|
45
45
|
/** Keep in sync with package.json and lib/index.js. */
|
|
46
|
-
const PLUGIN_VERSION = '0.5.
|
|
46
|
+
const PLUGIN_VERSION = '0.5.11'
|
|
47
47
|
|
|
48
48
|
// --- copy -----------------------------------------------------------------
|
|
49
49
|
|
|
@@ -1998,6 +1998,25 @@ window.__ModuleLoader__.load({
|
|
|
1998
1998
|
return created
|
|
1999
1999
|
})()
|
|
2000
2000
|
const rowCopyText = copyRegistry.text
|
|
2001
|
+
|
|
2002
|
+
// TEMP DIAG (删除时机:复制修好后). 复制按下没被接管时,把原因写进标签页标题:
|
|
2003
|
+
// 不污染剪贴板、不改页面内容,用户念一眼标题即可;成功接管时自动恢复原标题。
|
|
2004
|
+
const copyDiag = (page) => {
|
|
2005
|
+
try {
|
|
2006
|
+
if (page.__dshetTitle === undefined) page.__dshetTitle = document.title
|
|
2007
|
+
const base = String(page.__dshetTitle ?? '')
|
|
2008
|
+
const show = (reason) => {
|
|
2009
|
+
document.title = `[复制诊断] ${reason}${base === '' ? '' : ' · ' + base}`
|
|
2010
|
+
}
|
|
2011
|
+
const clear = () => {
|
|
2012
|
+
if (String(document.title).startsWith('[复制诊断]')) document.title = base
|
|
2013
|
+
}
|
|
2014
|
+
return { show, clear }
|
|
2015
|
+
} catch {
|
|
2016
|
+
return { show: () => {}, clear: () => {} }
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
const titleDiag = typeof globalThis !== 'undefined' ? copyDiag(globalThis) : { show: () => {}, clear: () => {} }
|
|
2001
2020
|
const rowHostText = copyRegistry.host
|
|
2002
2021
|
|
|
2003
2022
|
/**
|
|
@@ -2129,6 +2148,11 @@ window.__ModuleLoader__.load({
|
|
|
2129
2148
|
const native = clipboard.writeText.bind(clipboard)
|
|
2130
2149
|
const wrapped = (value) => {
|
|
2131
2150
|
const rewritten = rewriteCopiedText(String(value ?? ''))
|
|
2151
|
+
if (rewritten === null && rowCopyText.size > 0) {
|
|
2152
|
+
titleDiag.show(`写入没匹配上(登记 ${rowCopyText.size} 行,长度 ${String(value ?? '').length})`)
|
|
2153
|
+
} else if (rewritten !== null) {
|
|
2154
|
+
titleDiag.clear()
|
|
2155
|
+
}
|
|
2132
2156
|
return rewritten === null ? native(value) : native(rewritten)
|
|
2133
2157
|
}
|
|
2134
2158
|
wrapped[CLIPBOARD_WRAPPED] = true
|
|
@@ -4969,11 +4993,15 @@ window.__ModuleLoader__.load({
|
|
|
4969
4993
|
// Our own buttons sit in the same bar: theirs is not this press.
|
|
4970
4994
|
if (pluginOwned(button)) return
|
|
4971
4995
|
const row = button.closest('[data-chat-flow-key]')
|
|
4972
|
-
if (row === null) return
|
|
4996
|
+
if (row === null) { titleDiag.show('按钮不在行内'); return }
|
|
4973
4997
|
const key = row.getAttribute('data-chat-flow-key')
|
|
4974
|
-
if (typeof key !== 'string' || key === '') return
|
|
4998
|
+
if (typeof key !== 'string' || key === '') { titleDiag.show('行没有 key'); return }
|
|
4975
4999
|
const text = rowCopyText.get(key)
|
|
4976
|
-
if (typeof text !== 'string')
|
|
5000
|
+
if (typeof text !== 'string') {
|
|
5001
|
+
titleDiag.show(`这一行没登记文本(登记 ${rowCopyText.size} 行)`)
|
|
5002
|
+
return
|
|
5003
|
+
}
|
|
5004
|
+
titleDiag.clear()
|
|
4977
5005
|
const write = primitives !== null && primitives !== undefined && typeof primitives.writeClipboard === 'function'
|
|
4978
5006
|
? primitives.writeClipboard
|
|
4979
5007
|
: null
|
|
@@ -9196,7 +9224,7 @@ window.__ModuleLoader__.load({
|
|
|
9196
9224
|
const NS = 'dsh-as-aistudio'
|
|
9197
9225
|
|
|
9198
9226
|
/** Keep in sync with package.json and src/components.js. */
|
|
9199
|
-
const PLUGIN_VERSION = '0.4.
|
|
9227
|
+
const PLUGIN_VERSION = '0.4.5'
|
|
9200
9228
|
|
|
9201
9229
|
/** Presence marker the live verifier reads. */
|
|
9202
9230
|
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.4.
|
|
29
|
+
export const STUDIO_VERSION = '0.4.5'
|
|
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.11, sha256 bd1a9f8f275c3c0f)
|
|
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.11'
|
|
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
|
|
@@ -1312,6 +1312,11 @@ export function editableReplies(events, surfaceNodes, options = {}) {
|
|
|
1312
1312
|
const head = surfaceNodes[0]
|
|
1313
1313
|
const patches = options.patches instanceof Map ? options.patches : new Map()
|
|
1314
1314
|
const patch = options.patch === true
|
|
1315
|
+
// `/state` publishes identities only, so the blocks never leave this function.
|
|
1316
|
+
// Skipping them also skips the per-turn widening below, which walks every reply
|
|
1317
|
+
// of the same turn for every reply: that widening is what made one refresh of a
|
|
1318
|
+
// long session take seconds.
|
|
1319
|
+
const light = options.light === true
|
|
1315
1320
|
const out = []
|
|
1316
1321
|
for (const event of events) {
|
|
1317
1322
|
if (!isAssistantReply(event)) continue
|
|
@@ -1331,7 +1336,7 @@ export function editableReplies(events, surfaceNodes, options = {}) {
|
|
|
1331
1336
|
// text of that turn is offered, each annotated with the seq it lives in.
|
|
1332
1337
|
let listed = blocks.map((block) => ({ ...block, seq: event.seq }))
|
|
1333
1338
|
const carriesAnswer = blocks.some((block) => block.kind === 'text' && block.text.trim() !== '')
|
|
1334
|
-
if (patch && carriesAnswer && typeof turn === 'number') {
|
|
1339
|
+
if (!light && patch && carriesAnswer && typeof turn === 'number') {
|
|
1335
1340
|
const acrossTurn = []
|
|
1336
1341
|
for (const other of events) {
|
|
1337
1342
|
if (!isAssistantReply(other) || turnOf.get(other.seq) !== turn) continue
|
|
@@ -1345,6 +1350,7 @@ export function editableReplies(events, surfaceNodes, options = {}) {
|
|
|
1345
1350
|
if (acrossTurn.length > listed.length) listed = acrossTurn
|
|
1346
1351
|
}
|
|
1347
1352
|
out.push({
|
|
1353
|
+
...(light ? {} : { blocks: listed }),
|
|
1348
1354
|
seq: event.seq,
|
|
1349
1355
|
turn: typeof turn === 'number' ? turn : null,
|
|
1350
1356
|
messageId: messageIdOf(event) ?? null,
|
|
@@ -1785,7 +1791,7 @@ async function stateOf(ctx, sessionId, config) {
|
|
|
1785
1791
|
// editor promising to keep blocks the host would have to drop.
|
|
1786
1792
|
const store = resolveAttachmentStore(ctx)
|
|
1787
1793
|
const turns = editableTurns(events, folded.nodes, { preview: canPreviewAttachments(store) })
|
|
1788
|
-
const replies = editableReplies(events, folded.nodes, { patches, patch: config.patch === true }).map(lightReply)
|
|
1794
|
+
const replies = editableReplies(events, folded.nodes, { patches, patch: config.patch === true, light: true }).map(lightReply)
|
|
1789
1795
|
noteRequest({
|
|
1790
1796
|
kind: 'state',
|
|
1791
1797
|
sessionId,
|
|
@@ -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.11, 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
|
package/src/vendor/versions.json
CHANGED