dsh-ide-window 0.3.4 → 0.3.6
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/AGENTS.md +85 -28
- package/CHANGELOG.md +31 -0
- package/client.js +7179 -3579
- package/index.js +63 -1
- package/locale/en.json +86 -2
- package/locale/zh.json +86 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -47,6 +47,7 @@ const ROUTE_DIAG = '/dsh-ide/diagnostics'
|
|
|
47
47
|
const ROUTE_THEME = '/dsh-ide/theme'
|
|
48
48
|
const ROUTE_SCREENSHOT = '/dsh-ide/screenshot'
|
|
49
49
|
const ROUTE_SCREEN_PERMISSION = '/dsh-ide/screen-permission'
|
|
50
|
+
const ROUTE_CHANGES = '/dsh-ide/changes'
|
|
50
51
|
|
|
51
52
|
/** Where this file lives: the themes sit next to it, not in the profile. */
|
|
52
53
|
const PLUGIN_ROOT = fileURLToPath(new URL('.', import.meta.url))
|
|
@@ -1474,7 +1475,7 @@ function createHandler(ctx) {
|
|
|
1474
1475
|
return
|
|
1475
1476
|
}
|
|
1476
1477
|
pathname = new URL(request.url ?? '/', 'http://dsh-ide.internal').pathname
|
|
1477
|
-
if (pathname !== ROUTE_LSP && pathname !== ROUTE_GREP && pathname !== ROUTE_DIFF && pathname !== ROUTE_JAR && pathname !== ROUTE_STATUS && pathname !== ROUTE_BLAME && pathname !== ROUTE_DOCTOR && pathname !== ROUTE_KINDS && pathname !== ROUTE_LOG && pathname !== ROUTE_REFS && pathname !== ROUTE_PATCH && pathname !== ROUTE_TEXT && pathname !== ROUTE_LICENSE && pathname !== ROUTE_DIAG && pathname !== ROUTE_SCREENSHOT && pathname !== ROUTE_SCREEN_PERMISSION) {
|
|
1478
|
+
if (pathname !== ROUTE_LSP && pathname !== ROUTE_GREP && pathname !== ROUTE_DIFF && pathname !== ROUTE_JAR && pathname !== ROUTE_STATUS && pathname !== ROUTE_BLAME && pathname !== ROUTE_DOCTOR && pathname !== ROUTE_KINDS && pathname !== ROUTE_LOG && pathname !== ROUTE_REFS && pathname !== ROUTE_PATCH && pathname !== ROUTE_TEXT && pathname !== ROUTE_LICENSE && pathname !== ROUTE_DIAG && pathname !== ROUTE_SCREENSHOT && pathname !== ROUTE_SCREEN_PERMISSION && pathname !== ROUTE_CHANGES) {
|
|
1478
1479
|
writeJson(response, 404, { ok: false, error: { code: 'not-found', message: 'unknown route' } })
|
|
1479
1480
|
return
|
|
1480
1481
|
}
|
|
@@ -1514,6 +1515,8 @@ function createHandler(ctx) {
|
|
|
1514
1515
|
? await captureScreen(payload)
|
|
1515
1516
|
: pathname === ROUTE_SCREEN_PERMISSION
|
|
1516
1517
|
? await openScreenPermission()
|
|
1518
|
+
: pathname === ROUTE_CHANGES
|
|
1519
|
+
? await changesOfSession(ctx, payload)
|
|
1517
1520
|
: await query(ctx, payload)
|
|
1518
1521
|
writeJson(response, 200, { ok: true, value })
|
|
1519
1522
|
} catch (error) {
|
|
@@ -1525,6 +1528,60 @@ function createHandler(ctx) {
|
|
|
1525
1528
|
}
|
|
1526
1529
|
}
|
|
1527
1530
|
|
|
1531
|
+
/**
|
|
1532
|
+
* The changed files of one Session's newest turn.
|
|
1533
|
+
*
|
|
1534
|
+
* The client never sees `workspace/changes` (the retained event window keeps
|
|
1535
|
+
* messages only) and the Host's summary route sits behind its own authenticated
|
|
1536
|
+
* fence, so this plugin answers from the same source the conversation card
|
|
1537
|
+
* uses: `sessionQuery.readSession` finds the announcement's sequence, and
|
|
1538
|
+
* `workspaceChanges.summary` turns it into files with line counts.
|
|
1539
|
+
*
|
|
1540
|
+
* @param ctx - host context carrying the session and change services.
|
|
1541
|
+
* @param payload - `{session}`: the Session whose last turn is asked about.
|
|
1542
|
+
* @returns `{turn, files, added, deleted, total}`; empty when nothing changed.
|
|
1543
|
+
*/
|
|
1544
|
+
async function changesOfSession(ctx, payload) {
|
|
1545
|
+
const sessionId = typeof payload?.session === 'string' ? payload.session : ''
|
|
1546
|
+
if (sessionId === '') throw new RouteError(400, 'invalid-session', 'session is required')
|
|
1547
|
+
const sessionQuery = ctx.get('sessionQuery')
|
|
1548
|
+
const workspaceChanges = ctx.get('workspaceChanges')
|
|
1549
|
+
if (sessionQuery === undefined || workspaceChanges === undefined) return { turn: 0, files: [], added: 0, deleted: 0, total: 0 }
|
|
1550
|
+
let snapshot
|
|
1551
|
+
try {
|
|
1552
|
+
snapshot = await sessionQuery.readSession(sessionId)
|
|
1553
|
+
} catch (error) {
|
|
1554
|
+
logEvent('warn', 'changes', 'session read failed', error?.message ?? String(error))
|
|
1555
|
+
snapshot = undefined
|
|
1556
|
+
}
|
|
1557
|
+
let seq
|
|
1558
|
+
for (const event of snapshot?.events ?? []) {
|
|
1559
|
+
if (event?.type !== 'workspace/changes') continue
|
|
1560
|
+
if (typeof event.seq !== 'number') continue
|
|
1561
|
+
seq = event.seq
|
|
1562
|
+
}
|
|
1563
|
+
const empty = { turn: 0, files: [], added: 0, deleted: 0, total: 0 }
|
|
1564
|
+
// A summary only exists for a live turn of this Host process. Once it is gone
|
|
1565
|
+
// (restart, cold Session) the card must vanish with it: it describes one turn,
|
|
1566
|
+
// not whatever is uncommitted in the working tree.
|
|
1567
|
+
if (seq === undefined) return empty
|
|
1568
|
+
const summary = workspaceChanges.summary(sessionId, seq)
|
|
1569
|
+
if (summary === undefined) return empty
|
|
1570
|
+
const files = (summary.files ?? []).map((file) => ({
|
|
1571
|
+
path: file.path,
|
|
1572
|
+
added: Number.isFinite(file.added) ? file.added : 0,
|
|
1573
|
+
deleted: Number.isFinite(file.deleted) ? file.deleted : 0,
|
|
1574
|
+
binary: file.binary === true,
|
|
1575
|
+
}))
|
|
1576
|
+
return {
|
|
1577
|
+
turn: summary.turn ?? 0,
|
|
1578
|
+
files,
|
|
1579
|
+
added: Number.isFinite(summary.added) ? summary.added : 0,
|
|
1580
|
+
deleted: Number.isFinite(summary.deleted) ? summary.deleted : 0,
|
|
1581
|
+
total: Number.isFinite(summary.total) ? summary.total : files.length,
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1528
1585
|
export function apply(ctx) {
|
|
1529
1586
|
logEvent('info', 'host', 'plugin loaded', { platform: platform.name, node: process.versions.node })
|
|
1530
1587
|
const handler = createHandler(ctx)
|
|
@@ -1593,6 +1650,11 @@ export function apply(ctx) {
|
|
|
1593
1650
|
path: ROUTE_LICENSE,
|
|
1594
1651
|
handler,
|
|
1595
1652
|
}), 'dsh-ide-window: language server licence route')
|
|
1653
|
+
ctx.effect(() => ctx.webServer.register({
|
|
1654
|
+
kind: 'prefix',
|
|
1655
|
+
path: ROUTE_CHANGES,
|
|
1656
|
+
handler,
|
|
1657
|
+
}), 'dsh-ide-window: changed files route')
|
|
1596
1658
|
ctx.effect(() => ctx.webServer.register({
|
|
1597
1659
|
kind: 'prefix',
|
|
1598
1660
|
path: ROUTE_DIAG,
|
package/locale/en.json
CHANGED
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"noSourceInJar": "No sources in that jar",
|
|
94
94
|
"shortcutToggle": "Code workspace: open / close",
|
|
95
95
|
"shortcutBackToChat": "Code workspace: back to conversation",
|
|
96
|
-
"gestureSection": "
|
|
96
|
+
"gestureSection": "Shortcuts",
|
|
97
97
|
"gestureSectionHint": "Every shortcut of this plugin, viewable and editable here (kept out of DSH's own list)",
|
|
98
98
|
"gestureEdit": "View",
|
|
99
99
|
"gestureClose": "Close",
|
|
@@ -247,5 +247,89 @@
|
|
|
247
247
|
"shotUndo": "Undo",
|
|
248
248
|
"shotTextPlaceholder": "Type, then press Enter",
|
|
249
249
|
"shotCopy": "Capture",
|
|
250
|
-
"shotJump": "Capture and open chat"
|
|
250
|
+
"shotJump": "Capture and open chat",
|
|
251
|
+
"settingsNav": "Code workspace",
|
|
252
|
+
"settingsCollapse": "Collapse",
|
|
253
|
+
"treeOpenInDataWindow": "Open table in data window",
|
|
254
|
+
"symbolMenuOpenInDataWindow": "Open SQL in data window",
|
|
255
|
+
"dataWindowNoTableName": "This file has no @TableName",
|
|
256
|
+
"dataWindowNoWorkspace": "No workspace is open",
|
|
257
|
+
"dataWindowNoSql": "No Mapper SQL found for this method",
|
|
258
|
+
"dataWindowNotInstalled": "The data window plugin is not installed",
|
|
259
|
+
"dataWindowTimeout": "The data window did not respond",
|
|
260
|
+
"dataWindowNoDatasource": "No datasource was resolved for this workspace",
|
|
261
|
+
"dataWindowNoTable": "The table was not found",
|
|
262
|
+
"dataWindowOpened": "Opened in the data window",
|
|
263
|
+
"dataWindowOpening": "Opening the data window…",
|
|
264
|
+
"dataWindowQueryFailed": "The data window query failed",
|
|
265
|
+
"dataWindowFailed": "Opening the data window failed",
|
|
266
|
+
"symbolMenuOpenTableInDataWindow": "Open table in data window",
|
|
267
|
+
"shortcutCopyReference": "Copy reference to chat",
|
|
268
|
+
"shortcutOpenTable": "Open table in data window",
|
|
269
|
+
"shortcutNeedsFile": "Open a file in the code workspace first",
|
|
270
|
+
"shortcutJarNoReference": "A dependency source is not a workspace file, so it cannot be referenced",
|
|
271
|
+
"floatModel": "session model",
|
|
272
|
+
"floatModelHint": "Uses the model of the current session; nothing is re-selected",
|
|
273
|
+
"floatCollapse": "Collapse",
|
|
274
|
+
"floatExpand": "Expand assistant",
|
|
275
|
+
"floatEmpty": "Ask something; the answer lands in this session",
|
|
276
|
+
"floatNoSession": "No session bound yet",
|
|
277
|
+
"floatNoWorkspace": "no workspace",
|
|
278
|
+
"floatPlaceholder": "Ask something… (Enter to send, Shift+Enter for a newline)",
|
|
279
|
+
"floatSend": "Send",
|
|
280
|
+
"floatSending": "Sending…",
|
|
281
|
+
"floatFailed": "Send failed",
|
|
282
|
+
"floatYou": "You",
|
|
283
|
+
"floatAssistant": "Assistant",
|
|
284
|
+
"floatRunning": "Answering…",
|
|
285
|
+
"floatAttach": "Add content",
|
|
286
|
+
"floatAttachReference": "Reference the open file",
|
|
287
|
+
"floatNeedsFile": "Open a file first",
|
|
288
|
+
"floatPermission": "Permission",
|
|
289
|
+
"floatPermissionReadOnly": "Read only",
|
|
290
|
+
"floatPermissionWorkspace": "Workspace write",
|
|
291
|
+
"floatPermissionFull": "Full access",
|
|
292
|
+
"floatPermissionFailed": "The permission preset was not switched",
|
|
293
|
+
"floatModelEmpty": "The model catalog is not loaded yet",
|
|
294
|
+
"floatModelFailed": "Switching the model failed",
|
|
295
|
+
"floatStop": "Stop",
|
|
296
|
+
"floatStopFailed": "Stopping failed",
|
|
297
|
+
"floatResize": "Drag to resize",
|
|
298
|
+
"floatSessions": "Sessions",
|
|
299
|
+
"floatNewSession": "New session",
|
|
300
|
+
"floatSessionEmpty": "No other sessions yet",
|
|
301
|
+
"floatSessionFailed": "Switching the session failed",
|
|
302
|
+
"floatCurrentWorkspace": "current",
|
|
303
|
+
"settingsFloat": "Floating assistant",
|
|
304
|
+
"settingsFloatHint": "When off, the floating card no longer opens in the code workspace",
|
|
305
|
+
"settingsOn": "On",
|
|
306
|
+
"settingsOff": "Off",
|
|
307
|
+
"floatClose": "Close until DSH restarts",
|
|
308
|
+
"floatRemove": "Remove",
|
|
309
|
+
"floatImageLimit": "At most 4 images",
|
|
310
|
+
"floatImageTooLarge": "Image is larger than 8 MB",
|
|
311
|
+
"floatEffort": "Reasoning effort",
|
|
312
|
+
"floatEffortDefault": "Default",
|
|
313
|
+
"floatCode": "Code",
|
|
314
|
+
"floatCopy": "Copy",
|
|
315
|
+
"floatCopied": "Copied",
|
|
316
|
+
"floatFiles": "Files",
|
|
317
|
+
"settingsFloatSize": "Floating card size",
|
|
318
|
+
"settingsFloatSizeHint": "Initial size of the floating card; dragging the card changes only the current size.",
|
|
319
|
+
"settingsFloatWidth": "Width",
|
|
320
|
+
"settingsFloatHeight": "Height",
|
|
321
|
+
"floatOpenFailed": "Cannot open in the workspace",
|
|
322
|
+
"floatCopyImage": "Copy image",
|
|
323
|
+
"floatImageCopied": "Image copied",
|
|
324
|
+
"floatCopyImageFailed": "Copying the image failed",
|
|
325
|
+
"floatCopyImageUnsupported": "Copying images is not supported here",
|
|
326
|
+
"mdPreview": "Preview",
|
|
327
|
+
"mdSource": "Source",
|
|
328
|
+
"floatPreviewImage": "Click to view the image",
|
|
329
|
+
"floatCloseViewer": "Close",
|
|
330
|
+
"floatChangesTitle": "Edited",
|
|
331
|
+
"floatChangesUnit": "files",
|
|
332
|
+
"floatChangesBinary": "binary",
|
|
333
|
+
"floatChangesAll": "All",
|
|
334
|
+
"floatChangesLess": "Collapse"
|
|
251
335
|
}
|
package/locale/zh.json
CHANGED
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"noSourceInJar": "该 jar 没有源码",
|
|
94
94
|
"shortcutToggle": "代码工作区: 打开 / 关闭",
|
|
95
95
|
"shortcutBackToChat": "代码工作区: 返回对话",
|
|
96
|
-
"gestureSection": "
|
|
96
|
+
"gestureSection": "快捷键",
|
|
97
97
|
"gestureSectionHint": "本插件的全部快捷键,就在这里查看与修改(不占用 DSH 自己的快捷键列表)",
|
|
98
98
|
"gestureEdit": "查看",
|
|
99
99
|
"gestureClose": "关闭",
|
|
@@ -247,5 +247,89 @@
|
|
|
247
247
|
"shotUndo": "撤销",
|
|
248
248
|
"shotTextPlaceholder": "输入文字后回车",
|
|
249
249
|
"shotCopy": "截图",
|
|
250
|
-
"shotJump": "截图并跳转会话"
|
|
250
|
+
"shotJump": "截图并跳转会话",
|
|
251
|
+
"settingsNav": "代码工作区",
|
|
252
|
+
"settingsCollapse": "收起",
|
|
253
|
+
"treeOpenInDataWindow": "在数据窗口打开表",
|
|
254
|
+
"symbolMenuOpenInDataWindow": "在数据窗口打开 SQL",
|
|
255
|
+
"dataWindowNoTableName": "当前文件没有 @TableName",
|
|
256
|
+
"dataWindowNoWorkspace": "当前没有工作区",
|
|
257
|
+
"dataWindowNoSql": "未找到对应的 Mapper SQL",
|
|
258
|
+
"dataWindowNotInstalled": "数据窗口插件未安装",
|
|
259
|
+
"dataWindowTimeout": "数据窗口没有响应",
|
|
260
|
+
"dataWindowNoDatasource": "工作区没有解析到数据源",
|
|
261
|
+
"dataWindowNoTable": "没有找到这张表",
|
|
262
|
+
"dataWindowOpened": "已在数据窗口打开",
|
|
263
|
+
"dataWindowOpening": "正在打开数据窗口…",
|
|
264
|
+
"dataWindowQueryFailed": "在数据窗口执行失败",
|
|
265
|
+
"dataWindowFailed": "数据窗口跳转失败",
|
|
266
|
+
"symbolMenuOpenTableInDataWindow": "在数据窗口打开表",
|
|
267
|
+
"shortcutCopyReference": "复制引用回对话",
|
|
268
|
+
"shortcutOpenTable": "在数据窗口打开表",
|
|
269
|
+
"shortcutNeedsFile": "先在代码工作区打开一个文件",
|
|
270
|
+
"shortcutJarNoReference": "依赖源码不是工作区文件,无法生成引用",
|
|
271
|
+
"floatModel": "跟随会话模型",
|
|
272
|
+
"floatModelHint": "使用当前会话的模型,不单独选择",
|
|
273
|
+
"floatCollapse": "收起",
|
|
274
|
+
"floatExpand": "展开助手",
|
|
275
|
+
"floatEmpty": "问点什么,回答会出现在当前会话里",
|
|
276
|
+
"floatNoSession": "还没有绑定会话",
|
|
277
|
+
"floatNoWorkspace": "未选择工作区",
|
|
278
|
+
"floatPlaceholder": "问点什么…(Enter 发送,Shift+Enter 换行)",
|
|
279
|
+
"floatSend": "发送",
|
|
280
|
+
"floatSending": "发送中…",
|
|
281
|
+
"floatFailed": "发送失败",
|
|
282
|
+
"floatYou": "你",
|
|
283
|
+
"floatAssistant": "助手",
|
|
284
|
+
"floatRunning": "正在回答…",
|
|
285
|
+
"floatAttach": "添加内容",
|
|
286
|
+
"floatAttachReference": "引用当前文件",
|
|
287
|
+
"floatNeedsFile": "先打开一个文件",
|
|
288
|
+
"floatPermission": "权限",
|
|
289
|
+
"floatPermissionReadOnly": "仅可查看",
|
|
290
|
+
"floatPermissionWorkspace": "工作区内修改",
|
|
291
|
+
"floatPermissionFull": "完全权限",
|
|
292
|
+
"floatPermissionFailed": "没有切换权限",
|
|
293
|
+
"floatModelEmpty": "模型列表还没加载出来",
|
|
294
|
+
"floatModelFailed": "切换模型失败",
|
|
295
|
+
"floatStop": "停止",
|
|
296
|
+
"floatStopFailed": "停止失败",
|
|
297
|
+
"floatResize": "拖动调整大小",
|
|
298
|
+
"floatSessions": "会话",
|
|
299
|
+
"floatNewSession": "新建会话",
|
|
300
|
+
"floatSessionEmpty": "还没有其他会话",
|
|
301
|
+
"floatSessionFailed": "切换会话失败",
|
|
302
|
+
"floatCurrentWorkspace": "当前",
|
|
303
|
+
"settingsFloat": "悬浮助手卡",
|
|
304
|
+
"settingsFloatHint": "关掉后进入代码工作区不再自动弹出悬浮卡",
|
|
305
|
+
"settingsOn": "已启用",
|
|
306
|
+
"settingsOff": "已关闭",
|
|
307
|
+
"floatClose": "关闭悬浮卡(重启 DSH 后恢复)",
|
|
308
|
+
"floatRemove": "移除",
|
|
309
|
+
"floatImageLimit": "最多 4 张图片",
|
|
310
|
+
"floatImageTooLarge": "图片超过 8 MB",
|
|
311
|
+
"floatEffort": "思考等级",
|
|
312
|
+
"floatEffortDefault": "默认",
|
|
313
|
+
"floatCode": "代码",
|
|
314
|
+
"floatCopy": "复制",
|
|
315
|
+
"floatCopied": "已复制",
|
|
316
|
+
"floatFiles": "文件",
|
|
317
|
+
"settingsFloatSize": "悬浮框默认大小",
|
|
318
|
+
"settingsFloatSizeHint": "打开代码工作区时悬浮框的初始大小;拖动卡片只改当前大小,不改这里。",
|
|
319
|
+
"settingsFloatWidth": "宽度",
|
|
320
|
+
"settingsFloatHeight": "高度",
|
|
321
|
+
"floatOpenFailed": "无法在工作区打开",
|
|
322
|
+
"floatCopyImage": "复制图片",
|
|
323
|
+
"floatImageCopied": "图片已复制",
|
|
324
|
+
"floatCopyImageFailed": "复制图片失败",
|
|
325
|
+
"floatCopyImageUnsupported": "当前环境不支持复制图片",
|
|
326
|
+
"mdPreview": "预览",
|
|
327
|
+
"mdSource": "源码",
|
|
328
|
+
"floatPreviewImage": "点击预览图片",
|
|
329
|
+
"floatCloseViewer": "关闭",
|
|
330
|
+
"floatChangesTitle": "已编辑",
|
|
331
|
+
"floatChangesUnit": "个文件",
|
|
332
|
+
"floatChangesBinary": "二进制",
|
|
333
|
+
"floatChangesAll": "全部",
|
|
334
|
+
"floatChangesLess": "收起"
|
|
251
335
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-ide-window",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "IDEA-style code workspace for DeepSeek Harness: a centre panel with a workspace file tree, editor tabs and live-updating source, while the left navigation column hides.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"icon": "icon.svg",
|