dsh-gufa-code 1.3.108 → 1.3.109

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/client.js CHANGED
@@ -16,7 +16,7 @@ const GUFA_NS = 'gufa-code'
16
16
  const G = {}
17
17
  G.NS = GUFA_NS
18
18
  /** 客户端构建标记(排查页面是否加载了新代码时看标题栏) */
19
- G.BUILD = '1.3.108'
19
+ G.BUILD = '1.3.109'
20
20
  G.PANEL_ID = 'gufa-code'
21
21
  /** 从哪个工作区点进来的(工作区菜单/节点按钮写入,App 启动时消费)。 */
22
22
  G.pendingEntryWorkspace = null
@@ -13140,6 +13140,7 @@ G.GufaApp = function GufaApp(props) {
13140
13140
  const consumeExitStateRef = useRef(false)
13141
13141
  useEffect(() => {
13142
13142
  if (G.isFloatMode()) return undefined
13143
+ if (G.instanceBoot === true) return undefined
13143
13144
  let running = false
13144
13145
  const consume = async () => {
13145
13146
  if (running) return
@@ -13297,6 +13298,11 @@ G.GufaApp = function GufaApp(props) {
13297
13298
  const entryWorkspaceSyncedRef = useRef(false)
13298
13299
  useEffect(() => {
13299
13300
  if (entryWorkspaceSyncedRef.current) return
13301
+ /* 实例窗口:保持空工作区,不跟随主窗口/DSH 当前会话自动打开项目 */
13302
+ if (G.instanceBoot === true) {
13303
+ entryWorkspaceSyncedRef.current = true
13304
+ return
13305
+ }
13300
13306
  /* 悬浮层(摸鱼):项目/会话由主窗口状态注入,不做「入口工作区」同步 */
13301
13307
  if (G.isFloatMode()) {
13302
13308
  entryWorkspaceSyncedRef.current = true
@@ -13621,6 +13627,11 @@ G.GufaApp = function GufaApp(props) {
13621
13627
  const lastSessionCwdRef = useRef(null)
13622
13628
  useEffect(() => {
13623
13629
  if (sessionPinnedRef.current === true) return
13630
+ /* 实例窗口:不跟随会话 cwd 自动打开项目 */
13631
+ if (G.instanceBoot === true) {
13632
+ lastSessionCwdRef.current = sessionCwd
13633
+ return
13634
+ }
13624
13635
  /* 悬浮层里项目由主窗口状态注入,不跟随(Web 版客户端自己的)会话 cwd 切换 */
13625
13636
  if (G.isFloatMode()) {
13626
13637
  lastSessionCwdRef.current = sessionCwd
@@ -7,8 +7,8 @@
7
7
  <key>CFBundleDisplayName</key><string>古法编程悬浮层</string>
8
8
  <key>CFBundleExecutable</key><string>gufa-float</string>
9
9
  <key>CFBundlePackageType</key><string>APPL</string>
10
- <key>CFBundleShortVersionString</key><string>1.3.108</string>
11
- <key>CFBundleVersion</key><string>1.3.108</string>
10
+ <key>CFBundleShortVersionString</key><string>1.3.109</string>
11
+ <key>CFBundleVersion</key><string>1.3.109</string>
12
12
  <key>LSUIElement</key><true/>
13
13
  <key>NSHighResolutionCapable</key><true/>
14
14
  <key>NSPrincipalClass</key><string>NSApplication</string>
@@ -59,7 +59,7 @@
59
59
  - 实现:复用插件自带的原生 helper(`desktop/float/GufaFloat.m`),payload 传 `{full:true, authUrl, appUrl}` —— helper 建普通标题栏窗口、Regular 激活策略、跳过摸鱼 localStorage/隐藏主窗/吸附,加载同一个 DSH Web GUI;鉴权复用它已有的 `connection.authenticatedUrl()` token 流程。
60
60
  - 客户端 ⌘⇧N 必须先调 Host `app.newWindow`,失败才回退 `window.open`(Electron 的 setWindowOpenHandler 会 deny 并用外部浏览器打开 http(s),不是应用内窗口)。
61
61
  - 新窗口与 Electron 主窗口共享的是 **同一个 Host/服务端**,但 UI 进程独立(WKWebView,不走 Electron preload);所以别让新窗口依赖 `window.dshDesktop` 之类的 Electron preload API。
62
- - **实例窗口不继承主窗口项目**(用户明确要求新窗口用来操作别的工作区):helper full 模式只清空 localStorage 里的 `gufa-code:float/float-state/project/ui/tabs/mode`,URL 带 `?gufa-instance=1`;客户端 boot 时反复调 `G.enterGufa()` 直到 `.gufa-overlay-root` 挂载,并通过 `G.instanceBoot` 跳过 App 的 `sessionCwd` 自动打开项目分支,最终停在「尚打开项目 / 打开项目 / 新建项目」空状态。
62
+ - **实例窗口不继承主窗口项目**(用户明确要求新窗口用来操作别的工作区):helper full 模式只清空 localStorage 里的 `gufa-code:float/float-state/project/ui/tabs/mode`,URL 带 `?gufa-instance=1`;客户端 boot 时反复调 `G.enterGufa()` 直到 `.gufa-overlay-root` 挂载。`G.instanceBoot` 必须同时挡住**所有**会自动打开项目的 effect:boot 的 sessionCwd 分支、入口工作区同步、会话 cwd 跟随(`lastSessionCwdRef`)、`float.consumeExitState`,否则 DSH 恢复当前会话后会把工作区带进新窗口。
63
63
  - helper 的 WKWebView data store 与摸鱼悬浮层共享;full 模式必须清残留标记,否则新窗口会误进摸鱼 UI 或恢复上次项目。
64
64
  - **全屏继承**:客户端用 `innerWidth/innerHeight` 对比 `screen.width/height` 和 `screen.availWidth/availHeight` 判断当前是否全屏,payload 传 `fullscreen:true`,helper 在窗口显示后 `toggleFullScreen`;不要依赖 Electron preload 或 AX 查询(Host 在 Node 模式进程里拿不到 Electron)。
65
65
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-gufa-code",
3
- "version": "1.3.108",
3
+ "version": "1.3.109",
4
4
  "description": "古法编程 · AI 辅助:一键把 DSH 主面板变成 VS Code 风格 IDE(Monaco 编辑器、文件树、Git、SSH、真实终端 + 右侧官方会话);主张亲手写、每个改动心中有数,AI 是助理、你是第一责任人",
5
5
  "icon": "icon.svg",
6
6
  "keywords": [
@@ -1290,6 +1290,7 @@ G.GufaApp = function GufaApp(props) {
1290
1290
  const consumeExitStateRef = useRef(false)
1291
1291
  useEffect(() => {
1292
1292
  if (G.isFloatMode()) return undefined
1293
+ if (G.instanceBoot === true) return undefined
1293
1294
  let running = false
1294
1295
  const consume = async () => {
1295
1296
  if (running) return
@@ -1447,6 +1448,11 @@ G.GufaApp = function GufaApp(props) {
1447
1448
  const entryWorkspaceSyncedRef = useRef(false)
1448
1449
  useEffect(() => {
1449
1450
  if (entryWorkspaceSyncedRef.current) return
1451
+ /* 实例窗口:保持空工作区,不跟随主窗口/DSH 当前会话自动打开项目 */
1452
+ if (G.instanceBoot === true) {
1453
+ entryWorkspaceSyncedRef.current = true
1454
+ return
1455
+ }
1450
1456
  /* 悬浮层(摸鱼):项目/会话由主窗口状态注入,不做「入口工作区」同步 */
1451
1457
  if (G.isFloatMode()) {
1452
1458
  entryWorkspaceSyncedRef.current = true
@@ -1771,6 +1777,11 @@ G.GufaApp = function GufaApp(props) {
1771
1777
  const lastSessionCwdRef = useRef(null)
1772
1778
  useEffect(() => {
1773
1779
  if (sessionPinnedRef.current === true) return
1780
+ /* 实例窗口:不跟随会话 cwd 自动打开项目 */
1781
+ if (G.instanceBoot === true) {
1782
+ lastSessionCwdRef.current = sessionCwd
1783
+ return
1784
+ }
1774
1785
  /* 悬浮层里项目由主窗口状态注入,不跟随(Web 版客户端自己的)会话 cwd 切换 */
1775
1786
  if (G.isFloatMode()) {
1776
1787
  lastSessionCwdRef.current = sessionCwd