dsh-gufa-code 1.1.0 → 1.1.2

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/README.md CHANGED
@@ -18,6 +18,21 @@
18
18
  从哪个工作区点进来,IDE 就打开哪个工作区,右侧也自动是你在这个工作区正在聊的那个会话。
19
19
 
20
20
 
21
+ ## 作者的话:给程序员的几点忠告
22
+
23
+ > 这一节不代表任何组织,只代表我个人。你可以不同意,但请对自己的代码负责。
24
+
25
+ 1. **一定要坚持「古法编程」。** AI 该是工程师的助理,不是替身。代码可以让它起草、你来回改,但阅读、判断、调试、为结果兜底的能力必须留在自己身上——工具让人变快,不该让人变空。
26
+ 2. **每一个改动都要心中有数。** 看不懂的 diff 不要合,讲不清的调用链不要信,跑不通的「魔法」不要上线。心中没数就问到有数为止;这一步省掉的,都会在故障复盘时加倍还回来。
27
+ 3. **你是软件的第一责任人。** 署名是你,背锅也是你。过度崇信 AI 带来的线上事故、数据错误、安全漏洞,责任不会因为「是模型写的」而转移;把 review、测试、上线判断全部外包出去,等于把责任也一起放了。
28
+ 4. **不要变蠢。** 把记忆外包给搜索、把思考外包给模型,短期很爽,长期是把吃饭的本事一点点交出去。刻意保留手写、读源码、自己定位问题的习惯——那才是 AI 加速器的底座。
29
+ 5. **不要沉迷「AI 工作流组合」。** 堆提示词、拼 Agent 编排、把工程问题包装成流程问题,看起来像进步,其实是在开 AI 的历史倒车:真正难的是理解问题、定义边界、验证结果,而不是把同一个请求转手几次。工具的复杂度,不该替代思考的深度。
30
+ 6. **工具越强,判断力越贵。** AI 把「写」的成本压到极低,抬高的恰恰是「选什么写、写得对不对、值不值得写」的价钱。能自己验证、能自己回退、能自己解释——这三件事决定你是使用者,还是被使用者。
31
+ 7. **好的 AI 工具要看得见、可回退、可审计。** 这也是古法编程的设计底线:每个动作落在你眼前,每处改动可 diff、可撤销,右侧就是官方 DSH 会话本体——AI 在明处干活,你在明处验收。
32
+ 8. **DeepSeek 是历史上、也是将来最好的 AI。** 这不是客套:它把最强的推理能力做成了最可负担的价格,把一个可控、可信、可长期依赖的助手交到普通工程师手里。以上是个人观点,也是一次明确站队。
33
+
34
+ > 愿我们都能用 AI 把自己变得更强,而不是更懒。
35
+
21
36
  ## 安装
22
37
 
23
38
  ```sh
package/client.js CHANGED
@@ -9967,13 +9967,15 @@ G.GufaApp = function GufaApp(props) {
9967
9967
 
9968
9968
  /* 「仅切换 IDE 项目」:项目固定为用户手动打开的目录,不跟随 DSH 会话/工作区 */
9969
9969
  const projectPinnedRef = useRef(false)
9970
+ /* 会话弹窗里选了别的工作区的会话:右侧会话保持不动,不再自动把 IDE 项目切过去 */
9971
+ const sessionPinnedRef = useRef(false)
9970
9972
 
9971
9973
  /* ── 右侧 AI 面板与当前工作区保持一致 ─────────────────────────────────
9972
9974
  * ChatDock 停靠的是 DSH「主视图会话」,但主视图会话可能属于别的工作区
9973
9975
  * (重启恢复、手动切换会话后常见)。项目根变化时自动切到当前工作区的会话。 */
9974
9976
  const dockSyncRef = useRef('')
9975
9977
  useEffect(() => {
9976
- if (projectPinnedRef.current === true) return undefined
9978
+ if (projectPinnedRef.current === true || sessionPinnedRef.current === true) return undefined
9977
9979
  if (project === null || typeof project.root !== 'string' || project.root === '') return undefined
9978
9980
  if (dockSyncRef.current === project.root) return undefined
9979
9981
  if (typeof sessionCwd === 'string' && sessionCwd !== '' && sessionCwd === project.root) {
@@ -10226,6 +10228,7 @@ G.GufaApp = function GufaApp(props) {
10226
10228
  const switchWorkspace = useCallback(async (workspace) => {
10227
10229
  if (workspace === null || workspace === undefined) return
10228
10230
  projectPinnedRef.current = false
10231
+ sessionPinnedRef.current = false
10229
10232
  const service = workspaceService()
10230
10233
  try {
10231
10234
  if (service !== undefined && service !== null && typeof service.openWorkspace === 'function' && typeof workspace.id === 'string') {
@@ -10266,6 +10269,7 @@ G.GufaApp = function GufaApp(props) {
10266
10269
  if (workspace === null || workspace === undefined || typeof workspace.path !== 'string' || workspace.path === '') return
10267
10270
  try {
10268
10271
  projectPinnedRef.current = true
10272
+ sessionPinnedRef.current = false
10269
10273
  await openProjectPath(workspace.path)
10270
10274
  closeWorkspaceDialog()
10271
10275
  showBanner('已切换 IDE 项目(当前会话保持不变)', 'success')
@@ -10349,6 +10353,7 @@ G.GufaApp = function GufaApp(props) {
10349
10353
  /* 经典界面里切换工作区时:当前主视图会话的 cwd 变化 → 跟随打开对应项目 */
10350
10354
  const lastSessionCwdRef = useRef(null)
10351
10355
  useEffect(() => {
10356
+ if (sessionPinnedRef.current === true) return
10352
10357
  if (typeof sessionCwd !== 'string' || sessionCwd === '') return
10353
10358
  const previous = lastSessionCwdRef.current
10354
10359
  lastSessionCwdRef.current = sessionCwd
@@ -10499,30 +10504,22 @@ G.GufaApp = function GufaApp(props) {
10499
10504
 
10500
10505
  /* 从会话弹窗打开会话:可同时切换到该会话所属工作区的项目 */
10501
10506
  const openSessionInWorkspace = useCallback((sessionId, workspacePath) => {
10502
- projectPinnedRef.current = false
10503
10507
  const service = workspaceService()
10504
10508
  const path = typeof workspacePath === 'string' ? workspacePath : ''
10505
- void (async () => {
10506
- try {
10507
- if (service !== undefined && service !== null && typeof service.openSession === 'function') service.openSession(sessionId)
10508
- else setBanner('当前界面不支持切换会话')
10509
- } catch (error) {
10510
- setBanner(G.errorText(error))
10511
- }
10512
- if (path !== '' && project !== null && project.root !== path) {
10513
- try {
10514
- await openProjectPath(path)
10515
- setBanner('')
10516
- } catch (error) {
10517
- setBanner(G.errorText(error))
10518
- }
10519
- }
10520
- })()
10521
- }, [project, openProjectPath])
10509
+ /* 只切右侧会话:选了别的工作区的会话时,左侧项目/工作区保持不动 */
10510
+ sessionPinnedRef.current = path !== '' && project !== null && path !== project.root
10511
+ lastSessionCwdRef.current = null
10512
+ try {
10513
+ if (service !== undefined && service !== null && typeof service.openSession === 'function') service.openSession(sessionId)
10514
+ else setBanner('当前界面不支持切换会话')
10515
+ setBanner('')
10516
+ } catch (error) {
10517
+ setBanner(G.errorText(error))
10518
+ }
10519
+ }, [project])
10522
10520
 
10523
10521
  /* 从会话弹窗新建会话:在弹窗选中的工作区里新建,并切换 IDE 项目 */
10524
10522
  const startNewSessionInWorkspace = useCallback((workspacePath) => {
10525
- projectPinnedRef.current = false
10526
10523
  const service = workspaceService()
10527
10524
  const path = typeof workspacePath === 'string' ? workspacePath : ''
10528
10525
  void (async () => {
@@ -10537,19 +10534,19 @@ G.GufaApp = function GufaApp(props) {
10537
10534
  }
10538
10535
  try {
10539
10536
  if (service !== undefined && service !== null && typeof service.startSession === 'function') {
10537
+ /* 只新建会话,不切左侧项目;跨工作区时 pin 住避免自动同步 */
10538
+ sessionPinnedRef.current = path !== '' && project !== null && path !== project.root
10540
10539
  if (workspaceId !== null) service.startSession(workspaceId)
10541
10540
  else service.startSession()
10541
+ setBanner('')
10542
10542
  } else {
10543
10543
  setBanner('当前界面不支持新建会话')
10544
- return
10545
10544
  }
10546
- if (path !== '' && project !== null && project.root !== path) await openProjectPath(path)
10547
- setBanner('')
10548
10545
  } catch (error) {
10549
10546
  setBanner(G.errorText(error))
10550
10547
  }
10551
10548
  })()
10552
- }, [project, openProjectPath])
10549
+ }, [project])
10553
10550
 
10554
10551
  const activeFileForChat = useMemo(() => {
10555
10552
  if (activeTab === null || activeTab.kind === 'diff' || activeTab.kind === 'graph') return null
@@ -15,8 +15,8 @@ url: https://github.com/liujiangnanchenjbguo/dsh-gufa-code
15
15
  name: liujiangnanchenjbguo/dsh-gufa-code
16
16
  category: ui
17
17
  description:
18
- en: Cursor-style IDE mode for DeepSeek Harness — one click on a workspace menu turns the main panel into a VS Code-like workbench with a Monaco editor, file tree, Git panel (commit graph, push/pull, per-file revert), SSH hosts and a real PTY terminal on the left, while the official DSH conversation stays docked on the right so tool calls, file edits, approvals and session history keep working as you code.
19
- zh: 给 DeepSeek Harness 的 IDE 模式:点工作区「…」菜单一键把主面板变成 VS Code 风格工作台——左侧 Monaco 编辑器、文件树、Git 面板(提交图/推送/拉取/逐文件还原)、SSH 主机与真实 PTY 终端,右侧原样停靠官方 DSH 会话,写代码时工具调用、自动改文件、审批与会话历史照常可用。
18
+ en: Cursor-style IDE mode for DeepSeek Harness — one click on a workspace menu turns the main panel into a VS Code-like workbench with a Monaco editor, file tree, Git panel (commit graph, push/pull, per-file revert), SSH hosts and a real PTY terminal on the left, while the official DSH conversation stays docked on the right so tool calls, file edits, approvals and session history keep working as you code. Built on a craft-first belief: write it by hand, understand every change, treat AI as an assistant and stay the first owner of your software.
19
+ zh: 给 DeepSeek Harness 的 IDE 模式:点工作区「…」菜单一键把主面板变成 VS Code 风格工作台——左侧 Monaco 编辑器、文件树、Git 面板(提交图/推送/拉取/逐文件还原)、SSH 主机与真实 PTY 终端,右侧原样停靠官方 DSH 会话,写代码时工具调用、自动改文件、审批与会话历史照常可用。作者主张「古法编程」:亲手写、每个改动心中有数,AI 是助理,你是软件的第一责任人。
20
20
  ```
21
21
 
22
22
  ## 硬性要求(当前状态)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-gufa-code",
3
- "version": "1.1.0",
4
- "description": "古法编程 · AI 辅助:在 DSH Web 界面一键进入 VS Code 风格 IDE(Monaco 编辑器、文件树、Git、SSH、真实终端与右侧 AI 聊天)",
3
+ "version": "1.1.2",
4
+ "description": "古法编程 · AI 辅助:一键把 DSH 主面板变成 VS Code 风格 IDE(Monaco 编辑器、文件树、Git、SSH、真实终端 + 右侧官方会话);主张亲手写、每个改动心中有数,AI 是助理、你是第一责任人",
5
5
  "icon": "icon.svg",
6
6
  "keywords": [
7
7
  "dsh",
@@ -789,13 +789,15 @@ G.GufaApp = function GufaApp(props) {
789
789
 
790
790
  /* 「仅切换 IDE 项目」:项目固定为用户手动打开的目录,不跟随 DSH 会话/工作区 */
791
791
  const projectPinnedRef = useRef(false)
792
+ /* 会话弹窗里选了别的工作区的会话:右侧会话保持不动,不再自动把 IDE 项目切过去 */
793
+ const sessionPinnedRef = useRef(false)
792
794
 
793
795
  /* ── 右侧 AI 面板与当前工作区保持一致 ─────────────────────────────────
794
796
  * ChatDock 停靠的是 DSH「主视图会话」,但主视图会话可能属于别的工作区
795
797
  * (重启恢复、手动切换会话后常见)。项目根变化时自动切到当前工作区的会话。 */
796
798
  const dockSyncRef = useRef('')
797
799
  useEffect(() => {
798
- if (projectPinnedRef.current === true) return undefined
800
+ if (projectPinnedRef.current === true || sessionPinnedRef.current === true) return undefined
799
801
  if (project === null || typeof project.root !== 'string' || project.root === '') return undefined
800
802
  if (dockSyncRef.current === project.root) return undefined
801
803
  if (typeof sessionCwd === 'string' && sessionCwd !== '' && sessionCwd === project.root) {
@@ -1048,6 +1050,7 @@ G.GufaApp = function GufaApp(props) {
1048
1050
  const switchWorkspace = useCallback(async (workspace) => {
1049
1051
  if (workspace === null || workspace === undefined) return
1050
1052
  projectPinnedRef.current = false
1053
+ sessionPinnedRef.current = false
1051
1054
  const service = workspaceService()
1052
1055
  try {
1053
1056
  if (service !== undefined && service !== null && typeof service.openWorkspace === 'function' && typeof workspace.id === 'string') {
@@ -1088,6 +1091,7 @@ G.GufaApp = function GufaApp(props) {
1088
1091
  if (workspace === null || workspace === undefined || typeof workspace.path !== 'string' || workspace.path === '') return
1089
1092
  try {
1090
1093
  projectPinnedRef.current = true
1094
+ sessionPinnedRef.current = false
1091
1095
  await openProjectPath(workspace.path)
1092
1096
  closeWorkspaceDialog()
1093
1097
  showBanner('已切换 IDE 项目(当前会话保持不变)', 'success')
@@ -1171,6 +1175,7 @@ G.GufaApp = function GufaApp(props) {
1171
1175
  /* 经典界面里切换工作区时:当前主视图会话的 cwd 变化 → 跟随打开对应项目 */
1172
1176
  const lastSessionCwdRef = useRef(null)
1173
1177
  useEffect(() => {
1178
+ if (sessionPinnedRef.current === true) return
1174
1179
  if (typeof sessionCwd !== 'string' || sessionCwd === '') return
1175
1180
  const previous = lastSessionCwdRef.current
1176
1181
  lastSessionCwdRef.current = sessionCwd
@@ -1321,30 +1326,22 @@ G.GufaApp = function GufaApp(props) {
1321
1326
 
1322
1327
  /* 从会话弹窗打开会话:可同时切换到该会话所属工作区的项目 */
1323
1328
  const openSessionInWorkspace = useCallback((sessionId, workspacePath) => {
1324
- projectPinnedRef.current = false
1325
1329
  const service = workspaceService()
1326
1330
  const path = typeof workspacePath === 'string' ? workspacePath : ''
1327
- void (async () => {
1328
- try {
1329
- if (service !== undefined && service !== null && typeof service.openSession === 'function') service.openSession(sessionId)
1330
- else setBanner('当前界面不支持切换会话')
1331
- } catch (error) {
1332
- setBanner(G.errorText(error))
1333
- }
1334
- if (path !== '' && project !== null && project.root !== path) {
1335
- try {
1336
- await openProjectPath(path)
1337
- setBanner('')
1338
- } catch (error) {
1339
- setBanner(G.errorText(error))
1340
- }
1341
- }
1342
- })()
1343
- }, [project, openProjectPath])
1331
+ /* 只切右侧会话:选了别的工作区的会话时,左侧项目/工作区保持不动 */
1332
+ sessionPinnedRef.current = path !== '' && project !== null && path !== project.root
1333
+ lastSessionCwdRef.current = null
1334
+ try {
1335
+ if (service !== undefined && service !== null && typeof service.openSession === 'function') service.openSession(sessionId)
1336
+ else setBanner('当前界面不支持切换会话')
1337
+ setBanner('')
1338
+ } catch (error) {
1339
+ setBanner(G.errorText(error))
1340
+ }
1341
+ }, [project])
1344
1342
 
1345
1343
  /* 从会话弹窗新建会话:在弹窗选中的工作区里新建,并切换 IDE 项目 */
1346
1344
  const startNewSessionInWorkspace = useCallback((workspacePath) => {
1347
- projectPinnedRef.current = false
1348
1345
  const service = workspaceService()
1349
1346
  const path = typeof workspacePath === 'string' ? workspacePath : ''
1350
1347
  void (async () => {
@@ -1359,19 +1356,19 @@ G.GufaApp = function GufaApp(props) {
1359
1356
  }
1360
1357
  try {
1361
1358
  if (service !== undefined && service !== null && typeof service.startSession === 'function') {
1359
+ /* 只新建会话,不切左侧项目;跨工作区时 pin 住避免自动同步 */
1360
+ sessionPinnedRef.current = path !== '' && project !== null && path !== project.root
1362
1361
  if (workspaceId !== null) service.startSession(workspaceId)
1363
1362
  else service.startSession()
1363
+ setBanner('')
1364
1364
  } else {
1365
1365
  setBanner('当前界面不支持新建会话')
1366
- return
1367
1366
  }
1368
- if (path !== '' && project !== null && project.root !== path) await openProjectPath(path)
1369
- setBanner('')
1370
1367
  } catch (error) {
1371
1368
  setBanner(G.errorText(error))
1372
1369
  }
1373
1370
  })()
1374
- }, [project, openProjectPath])
1371
+ }, [project])
1375
1372
 
1376
1373
  const activeFileForChat = useMemo(() => {
1377
1374
  if (activeTab === null || activeTab.kind === 'diff' || activeTab.kind === 'graph') return null