dsh-github-studio 0.6.7 → 0.7.1

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
@@ -2,7 +2,7 @@
2
2
 
3
3
  **面向 DeepSeek Harness 的 GitHub 连接与发布插件。** 在聊天中读取项目、准备代码提交,在设置页管理仓库、生成项目介绍并发布程序版本。
4
4
 
5
- > 第三方开源项目,非 DeepSeek 或 GitHub 官方产品。适用于 Windows 上的 DeepSeek Harness;不适用于普通的 `chat.deepseek.com` 聊天网页。
5
+ > 面向 Windows 和 macOS 上的 DeepSeek Harness,以及 Android 版 DSH Go 的第三方开源插件。
6
6
 
7
7
  ![DeepSeek GitHub Studio:仓库管理与发布入口](docs/images/01-cover.webp)
8
8
 
@@ -16,7 +16,7 @@ DeepSeek GitHub Studio 将 GitHub 仓库操作集成到 Harness 的工具调用
16
16
 
17
17
  | 模块 | 能力 |
18
18
  | --- | --- |
19
- | GitHub 连接 | OAuth Device Flow 登录;本机 Windows DPAPI 加密保存令牌 |
19
+ | GitHub 连接 | OAuth Device Flow 登录和自动续期,使用 Windows DPAPI、macOS 钥匙串或 DSH Go 主机凭据服务 |
20
20
  | 仓库浏览 | 浏览已授权仓库、目录和文本文件,查看版本及附件链接 |
21
21
  | 聊天工具 | 搜索公开仓库和代码、读取文件、准备建库及提交操作 |
22
22
  | 官网搜索 | 仓库/代码分类,高级筛选,直接在浏览器打开 GitHub 原生搜索 |
@@ -54,7 +54,7 @@ DeepSeek GitHub Studio 将 GitHub 仓库操作集成到 Harness 的工具调用
54
54
 
55
55
  ### 环境要求
56
56
 
57
- - Windows;登录凭据保护依赖 Windows DPAPI CurrentUser。
57
+ - Windows、macOS 或 Android 版 DSH Go 本机引擎。macOS 兼容 Apple Silicon 和 Intel。
58
58
  - DeepSeek Harness。开发基线为 `0.2.2-rc.1`,其他版本的插件接口可能存在差异。
59
59
  - 网络能访问 GitHub 登录页、`api.github.com` 和 `uploads.github.com`。
60
60
  - 使用 AI 介绍时,需在 Harness 中配置可用默认模型。
@@ -71,7 +71,7 @@ https://github.com/zhaohaix/DeepSeek-GitHub
71
71
 
72
72
  ### 使用本地源码或安装包
73
73
 
74
- 也可以克隆项目后,在“添加插件”中输入本地项目目录。若使用构建好的 `.tgz`,按当前 Harness 插件管理器支持的本地包方式安装;项目附带 Windows 安装脚本,运行前需完全退出客户端。
74
+ 也可以克隆项目后,在“添加插件”中输入本地项目目录,或选择构建好的 `.tgz`。Windows 还可在完全退出 Harness 后运行随附安装脚本。macOS 直接通过插件管理器添加安装包。
75
75
 
76
76
  ```sh
77
77
  git clone https://github.com/zhaohaix/DeepSeek-GitHub.git
@@ -80,15 +80,29 @@ npm ci
80
80
  npm run verify
81
81
  ```
82
82
 
83
+ ### Android 版 DSH Go
84
+
85
+ 先安装并启动 DSH Go 的本机引擎。将对应版本的 `.tgz` 放到手机的下载目录,在 DSH Go 设置中打开「访问手机文件」,然后在 DSH Go 的本机终端运行:
86
+
87
+ ```sh
88
+ dsh plugin --profile web add /sdcard/Download/dsh-github-studio-0.7.1.tgz
89
+ ```
90
+
91
+ 按提示重启引擎。可以在「全部功能 → 插件 → GitHub」打开原生面板,保存 OAuth App Client ID、获取设备码、打开授权页和查看登录状态。在 DSH Go 的「网页版 → 设置 → GitHub」可浏览仓库、生成介绍、上传附件、发布以及预览和确认写入。两个界面使用同一个登录状态。
92
+
93
+ 远程使用时,插件和凭据都在所选的 Harness 主机上。SSH 和中转模式的界面能力取决于 DSH Go 的连接方式。此版适配目标是 Android 的本机引擎。
94
+
83
95
  ## 配置 GitHub 登录
84
96
 
85
97
  **公开版本没有预置个人 OAuth App Client ID。** 首次登录前需配置自己的 GitHub OAuth App:
86
98
 
87
- 1. 在 GitHub 的 **Settings → Developer settings → OAuth Apps** 创建应用。
88
- 2. 填写自己的应用名称及主页信息,并在应用设置中启用 **Device Flow**。
89
- 3. 将公开的 **Client ID** 填入插件“设置 → GitHub”的登录应用配置。
99
+ 1. [打开 GitHub OAuth App 注册页](https://github.com/settings/applications/new),登录自己的 GitHub 账号。
100
+ 2. 应用名称可填 `DeepSeek GitHub Studio`。主页 URL 和重定向 URI 都填 `https://github.com/zhaohaix/DeepSeek-GitHub`。应用描述可留空,通配符保持关闭。勾选 **启用设备流(Enable Device Flow)**,再注册应用。
101
+ 3. 将应用详情里的 **Client ID** 粘贴到插件「设置 → GitHub」并保存。已有启用了设备流的 OAuth App 可直接复用 Client ID。
90
102
  4. 点击“登录 GitHub”,打开 GitHub 官方设备授权页,输入显示的设备代码并授权。
91
103
 
104
+ 如果从 Windows 换到 Mac,在 Mac 上授权一次即可建立本机钥匙串凭据。若系统提示无法访问凭据,请在“钥匙串访问”中解锁登录钥匙串后重试。
105
+
92
106
  此流程不要求在插件中填写 Client Secret。不要把访问令牌、Client Secret 或本机配置上传到仓库。
93
107
 
94
108
  | 配置状态 | 可使用范围 |
@@ -125,8 +139,9 @@ npm run verify
125
139
 
126
140
  ## 隐私与安全边界
127
141
 
128
- - 本机数据默认保存在用户主目录下 `.dsh/github-connect`,包括加密令牌、暂存文件、诊断日志和文案工作区。
129
- - 令牌使用 Windows DPAPI CurrentUser 加密,不通过普通页面状态接口返回。
142
+ - 暂存文件、诊断日志和文案工作区默认保存在用户主目录下的 `.dsh/github-connect`。
143
+ - Windows 使用 DPAPI CurrentUser 加密本地令牌,macOS 将令牌保存到系统钥匙串。两种凭据都随系统账户隔离。
144
+ - Android 本机引擎使用 Harness 管理的凭据记录,由 DSH Go 的应用私有环境和文件权限保护。默认的文件型提供方没有钥匙串式加密,和引擎同一账户运行的工具可以访问这一存储。
130
145
  - 本地 API 限定宿主浏览器身份及本机访问;本项目面向个人桌面环境,不适合作为公开多租户服务。
131
146
  - ZIP 只读取符合限制的文本,不运行其中的程序;会跳过依赖目录、部分构建产物和明显凭据文件。启发式筛选不能保证发现所有敏感信息。
132
147
  - AI 将所选文本发送给 Harness 配置的模型服务,生成结果需审阅,不能视为已验证的软件功能或测试结论。
@@ -152,9 +167,10 @@ npm ci
152
167
  npm run verify
153
168
  npm run release:check
154
169
  npm pack
155
- npm run release:source
156
170
  ```
157
171
 
172
+ Windows 可以另运行 `npm run release:source` 生成源码 ZIP。
173
+
158
174
  公开打包检查要求预置 Client ID 为空,并排除个人运行资料、日志、浏览器缓存与凭据。请勿将整个本机开发目录直接上传。欢迎通过 Issue 报告可复现问题;提交截图或日志前请去除个人信息与秘密值。
159
175
 
160
176
  本项目使用 MIT License。第三方依赖遵循各自许可证;不附带或重新分发 DeepSeek Harness 宿主运行时。
@@ -164,7 +180,7 @@ npm run release:source
164
180
 
165
181
  登录的临时网络错误会自动重试;设备码有效期内轮询失败会保留设备码并退避,界面可取消本次登录。证书错误会立即给出提示,不会通过关闭 HTTPS 校验来绕过。建库、提交、发布和上传不会自动重放。
166
182
 
167
- 插件网络连接使用 Node 内置 CA、Windows 系统信任证书以及启动时配置的额外 CA,只影响本插件。Steam++ 等证书接管模式需先正确安装其证书,再彻底退出并重开 Harness;线路不可用仍需切换或关闭 GitHub 加速。
183
+ 插件网络连接使用 Node 内置 CA、系统信任证书以及启动时配置的额外 CA。使用 Steam++ 等证书接管模式时,配置好系统信任后请彻底退出并重开 Harness。线路不可用时可切换线路或关闭 GitHub 加速。
168
184
 
169
185
  如需明确指定 HTTP/HTTPS 代理,可在启动 Harness 前设置本机环境变量 `DSH_GITHUB_PROXY`(例如 `http://127.0.0.1:7890`,端口以加速器实际配置为准)。也支持 `HTTP_PROXY`、`HTTPS_PROXY`、`NO_PROXY` 及小写形式;插件专用代理优先。暂不支持 SOCKS 地址、Windows PAC 或自动发现系统代理。不要把含账号密码的代理配置提交到仓库。
170
186
 
package/lib/client.js CHANGED
@@ -139,6 +139,10 @@ function mergeConnectionState(previous3, next) {
139
139
  return transient && previous3?.user ? { ...next, user: previous3.user } : next;
140
140
  }
141
141
 
142
+ // src/oauth-setup.mjs
143
+ var oauthRegistrationUrl = "https://github.com/settings/applications/new";
144
+ var oauthHomepage = "https://github.com/zhaohaix/DeepSeek-GitHub";
145
+
142
146
  // src/release-editor.jsx
143
147
  var import_react3 = __toESM(require("react"), 1);
144
148
 
@@ -13885,7 +13889,7 @@ function ReleaseEditor({ repo, apiCall, onBusyChange }) {
13885
13889
  }
13886
13890
 
13887
13891
  // src/style.css
13888
- var style_default = '.dsh-github{font:14px/1.6 -apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei",sans-serif;color:var(--text-primary,#1f2328);width:100%;padding:2px 0 24px;box-sizing:border-box;--gh-line:#e6e9ef;--gh-soft:#f6f7f9;--gh-muted:#68717f;--gh-blue:#4169e1}\n.dsh-github *{box-sizing:border-box}.dsh-github h2,.dsh-github h3,.dsh-github p{margin:0}.dsh-github h2{font-size:22px;font-weight:600}.dsh-github h3{font-size:15px;font-weight:600;margin:16px 0 10px}.gh-header,.gh-row,.gh-title,.gh-actions,.gh-account,.gh-attachment{display:flex;align-items:center;gap:10px}.gh-header,.gh-row,.gh-attachment{justify-content:space-between}.gh-title{gap:12px}.gh-intro{color:var(--gh-muted);margin:10px 0 22px!important}.dsh-github button,.gh-upload{font:inherit;cursor:pointer;border:1px solid var(--gh-line);background:transparent;color:inherit;border-radius:8px;padding:7px 13px;transition:background .15s}.dsh-github button:hover,.gh-upload:hover{background:var(--gh-soft)}.dsh-github button:disabled,.gh-disabled{opacity:.5;cursor:not-allowed}.dsh-github .gh-primary{background:var(--gh-blue);border-color:var(--gh-blue);color:#fff}.dsh-github .gh-primary:hover{background:#3159cd}.dsh-github button:focus-visible,.dsh-github input:focus-visible,.dsh-github select:focus-visible,.dsh-github textarea:focus-visible,.gh-upload:focus-within{outline:2px solid var(--gh-blue);outline-offset:3px}.dsh-github a{color:var(--gh-blue);text-decoration:none;overflow-wrap:anywhere}.dsh-github a:hover{text-decoration:underline}.gh-account{padding:16px 0 20px;border-bottom:1px solid var(--gh-line)}.gh-account img{width:42px;height:42px;border-radius:50%}.gh-account>div{flex:1}.gh-account strong,.gh-account span{display:block}.gh-account span{color:var(--gh-muted);font-size:12px}.gh-account i{display:inline-block;width:6px;height:6px;border-radius:50%;background:#26834a;margin:0 4px 1px}.gh-connect{background:var(--gh-soft);padding:20px;border-radius:10px;margin-bottom:20px}.gh-connect p{color:var(--gh-muted);margin-top:6px}.gh-device{margin-top:14px;display:flex;flex-direction:column;align-items:flex-start;gap:6px}.gh-device>strong{font:600 22px/1.7 Consolas,monospace;letter-spacing:3px;color:var(--text-primary,#1f2328)}.gh-tabs{display:flex;border-bottom:1px solid var(--gh-line);gap:22px;margin-top:14px}.gh-tabs button{border:0;border-radius:0;color:var(--gh-muted);padding:12px 0;border-bottom:2px solid transparent}.gh-tabs button[aria-current]{color:var(--gh-blue);border-bottom-color:var(--gh-blue)}.gh-tabs button:hover{background:transparent;color:var(--gh-blue)}.gh-pending{width:100%;text-align:left;background:#f0f4ff!important;color:#3255af!important;margin-top:14px}.gh-empty{padding:42px 14px;text-align:center;display:flex;flex-direction:column;align-items:center;gap:10px;color:var(--gh-muted)}.gh-empty strong{color:var(--text-primary,#1f2328);font-weight:500}.gh-empty p{max-width:340px;font-size:13px}.gh-empty svg{opacity:.45;margin-bottom:4px}.gh-section-title{margin:14px 0}.gh-section-title h3{margin:0}.gh-repositories{display:grid;gap:10px}.dsh-github .gh-repo{width:100%;text-align:left;padding:15px 16px}.gh-repo strong{font-weight:600;color:var(--gh-blue)}.gh-repo p{color:var(--gh-muted);margin:5px 0;font-size:13px}.gh-repo small{color:var(--gh-muted)}.gh-badge{border:1px solid var(--gh-line);border-radius:20px;font-size:11px;color:var(--gh-muted);padding:1px 8px;white-space:nowrap}.gh-success{color:#22733e;background:#eef8f0;border-color:#d4e8d9}.gh-failed{color:#b42318;background:#fff3f1;border-color:#f4d8d3}.gh-form{display:grid;gap:13px;padding:16px 0 20px;border-bottom:1px solid var(--gh-line)}.gh-field{display:grid;gap:5px}.gh-field>span{font-size:13px;color:var(--gh-muted)}.dsh-github input:not([type=checkbox]):not([type=file]),.dsh-github select,.dsh-github textarea{font:inherit;width:100%;padding:8px 10px;border:1px solid var(--gh-line);border-radius:7px;background:var(--input-background,transparent);color:inherit}.dsh-github textarea{resize:vertical;min-height:90px}.gh-check{display:flex;align-items:center;gap:7px;font-size:13px}.gh-check input{accent-color:var(--gh-blue)}.gh-form>.gh-primary{justify-self:start}.gh-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.dsh-github .gh-back{border:0;padding:4px 0;margin-bottom:12px;color:var(--gh-muted)}.gh-repo-heading{display:flex;align-items:center;gap:10px}.gh-branch{display:flex;align-items:center;gap:8px;margin:14px 0}.gh-branch label{display:flex;align-items:center;gap:8px;flex:1}.gh-branch input{flex:1;min-width:0}.gh-breadcrumb{display:flex;justify-content:space-between;align-items:center;background:var(--gh-soft);padding:8px 12px;overflow-wrap:anywhere;border-radius:6px}.gh-breadcrumb button{font-size:12px;padding:2px 7px}.gh-files{display:grid;margin-top:7px}.gh-files button{display:flex;align-items:center;text-align:left;gap:10px;border:0;border-bottom:1px solid var(--gh-line);border-radius:0;padding:10px 8px}.gh-files button>span:nth-child(2){flex:1;overflow-wrap:anywhere}.gh-files small{color:var(--gh-muted);font-size:11px}.gh-code,.gh-operation pre{font:12px/1.7 Consolas,"Cascadia Mono",monospace;white-space:pre-wrap;overflow-wrap:anywhere;max-height:440px;overflow:auto;padding:13px;background:var(--gh-soft);border-radius:6px}.gh-operation{padding:17px 0;border-bottom:1px solid var(--gh-line)}.gh-operation .gh-target{font-size:15px;font-weight:500;margin:7px 0;overflow-wrap:anywhere}.gh-operation p{font-size:13px;margin:8px 0;color:var(--gh-muted)}.gh-operation .gh-actions{margin-top:13px}.gh-operation details{margin:9px 0}.gh-operation summary{cursor:pointer;font-size:13px;overflow-wrap:anywhere}.gh-release{padding:14px 0;border-bottom:1px solid var(--gh-line);display:grid;gap:6px}.gh-release>small{color:var(--gh-muted)}.gh-download{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:13px}.gh-asset-publish{display:flex;gap:8px;margin-top:8px}.gh-asset-publish select{min-width:0;flex:1}.gh-asset-publish button{white-space:nowrap}.gh-attachments{margin-top:16px}.gh-upload{font-size:13px;white-space:nowrap}.gh-upload input{display:none}.gh-attachment{border-bottom:1px solid var(--gh-line);padding:12px 0}.gh-attachment>div{min-width:0}.gh-attachment strong{font-size:13px;font-weight:500;overflow-wrap:anywhere}.gh-attachment small{display:block;color:var(--gh-muted);font-size:12px}.gh-muted{color:var(--gh-muted);font-size:12px;margin:10px 0!important}.gh-errorbox{display:flex;justify-content:space-between;align-items:flex-start;color:#b42318;background:#fff3f1;border-radius:8px;padding:10px 12px;margin:12px 0;overflow-wrap:anywhere}.gh-errorbox button{border:0;padding:0 5px;margin-left:8px}.dsh-github .gh-error{color:#b42318}.gh-working{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--gh-blue);margin-top:16px}.gh-working>span{width:10px;height:10px;border:2px solid #c2cef5;border-top-color:var(--gh-blue);border-radius:50%;animation:gh-spin .7s linear infinite}.gh-footer{font-size:11px;color:var(--gh-muted);margin-top:28px;border-top:1px solid var(--gh-line);padding-top:13px}@keyframes gh-spin{to{transform:rotate(360deg)}}@media(prefers-color-scheme:dark){.dsh-github{--gh-line:#3c414b;--gh-soft:#252931;--gh-muted:#a1a8b4;color:var(--text-primary,#e6e8ed)}.gh-empty strong,.gh-device>strong{color:var(--text-primary,#e6e8ed)}.dsh-github select option{background:#252931;color:#e6e8ed}}@media(max-width:520px){.gh-header{flex-wrap:wrap}.gh-grid{grid-template-columns:1fr}.gh-tabs{gap:16px}.gh-account{flex-wrap:wrap}.gh-asset-publish{flex-wrap:wrap}.gh-actions{flex-wrap:wrap}}@media(prefers-reduced-motion:reduce){.dsh-github *{animation:none!important;transition:none!important}}\n\n.gh-tabs .gh-refresh-repos{margin-left:auto;align-self:center;white-space:nowrap;padding:5px 10px;border:1px solid var(--gh-line);border-radius:7px;font-size:12px;line-height:1.5;min-width:68px;margin-bottom:6px;color:var(--gh-muted)}.gh-tabs .gh-refresh-repos:hover{background:var(--gh-soft)}\n.gh-browser-search{margin:18px 0 8px;padding:0 0 12px;border-bottom:1px solid var(--gh-line)}.gh-search-row{display:flex;gap:8px;align-items:center}.gh-search-row>select{width:84px!important;flex:none}.gh-search-row>input{min-width:0;flex:1}.gh-search-row>button{flex:none;white-space:nowrap}.gh-search-advanced>summary,.gh-search-preview>summary{cursor:pointer;color:var(--gh-muted);font-size:12px}.gh-search-fields{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;margin:12px 0}.gh-search-fields .gh-field{min-width:0}.gh-search-preview{margin-top:8px}.gh-search-preview code{display:block;overflow-wrap:anywhere;white-space:pre-wrap;font-size:12px;background:var(--gh-soft);padding:8px;margin-top:6px}.gh-reset-search{font-size:12px!important}.gh-search-row input{font-size:13px!important}@media(max-width:520px){.gh-search-row{flex-wrap:wrap}.gh-search-row>select{width:72px!important}.gh-search-row>button{margin-left:auto}.gh-search-fields{grid-template-columns:minmax(0,1fr)}}\n\n.dsh-github .gh-delete-repo{margin-left:auto;flex-shrink:0;color:#b42318;border-color:#f0cdca;font-size:12px;white-space:nowrap}.dsh-github .gh-delete-repo:hover{background:#fff3f1}.gh-delete-dialog{box-sizing:border-box;border:1px solid var(--gh-line);border-radius:12px;background:var(--modal-background,#fff);color:inherit;width:min(460px,calc(100vw - 32px));max-height:calc(100vh - 48px);overflow:auto;padding:22px;font:inherit;box-shadow:0 16px 48px #0003}.gh-delete-dialog::backdrop{background:#0006}.gh-delete-dialog h3{margin:0 0 12px!important;font-size:17px!important}.gh-delete-dialog p{margin:10px 0!important;line-height:1.7}.gh-delete-target{font-weight:600;overflow-wrap:anywhere}.gh-delete-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px;flex-wrap:wrap}.dsh-github .gh-delete-continue{background:#b42318;color:white;border-radius:8px;padding:7px 13px;text-decoration:none}.dsh-github .gh-delete-continue:hover{background:#971d14;text-decoration:none}.gh-delete-continue:focus-visible{outline:2px solid #b42318;outline-offset:3px}@media(prefers-color-scheme:dark){.gh-delete-dialog{background:var(--modal-background,#252931)}}\n.gh-imported-files{margin:2px 0 0;border-top:1px solid var(--gh-line)}.gh-ai-label{display:flex;justify-content:space-between;align-items:center;gap:12px;color:var(--gh-muted);font-size:13px}.gh-ai-label button:disabled{color:var(--gh-muted)}.gh-ai-label button:disabled:hover{background:transparent}.gh-ai-label button{font-size:12px;padding:5px 9px;color:var(--gh-blue)}.gh-markdown-toolbar{display:flex;gap:6px;flex-wrap:wrap}.gh-markdown-toolbar button{font-size:12px;padding:4px 8px}.gh-image-insert{display:flex;gap:6px}.gh-image-insert input{min-width:0;flex:1}.gh-image-insert button{white-space:nowrap}.gh-markdown-preview{border:1px solid var(--gh-line);border-radius:8px;padding:14px;max-height:500px;overflow:auto;line-height:1.7}.gh-markdown-preview img{max-width:100%;height:auto}.gh-markdown-preview h1,.gh-markdown-preview h2,.gh-markdown-preview h3{margin:12px 0}.gh-markdown-preview p{margin:8px 0}.gh-markdown-preview blockquote{border-left:3px solid var(--gh-line);margin:8px 0;padding-left:12px;color:var(--gh-muted)}.gh-copy-code{position:relative;margin:10px 0;background:var(--gh-soft);border-radius:7px}.gh-copy-code>button{position:absolute;right:6px;top:6px;font-size:11px;padding:3px 7px}.gh-copy-code pre{padding:36px 12px 12px;white-space:pre-wrap;overflow-wrap:anywhere;overflow:auto;font:12px/1.7 Consolas,monospace}.gh-markdown-preview table{border-collapse:collapse}.gh-markdown-preview td,.gh-markdown-preview th{border:1px solid var(--gh-line);padding:5px 9px}@media(max-width:520px){.gh-ai-label{flex-wrap:wrap}.gh-image-insert{flex-wrap:wrap}}\n.dsh-github .gh-muted{overflow-wrap:anywhere}\n\n';
13892
+ var style_default = '.dsh-github{font:14px/1.6 -apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei",sans-serif;color:var(--text-primary,#1f2328);width:100%;padding:2px 0 24px;box-sizing:border-box;--gh-line:#e6e9ef;--gh-soft:#f6f7f9;--gh-muted:#68717f;--gh-blue:#4169e1}\n.dsh-github *{box-sizing:border-box}.dsh-github h2,.dsh-github h3,.dsh-github p{margin:0}.dsh-github h2{font-size:22px;font-weight:600}.dsh-github h3{font-size:15px;font-weight:600;margin:16px 0 10px}.gh-header,.gh-row,.gh-title,.gh-actions,.gh-account,.gh-attachment{display:flex;align-items:center;gap:10px}.gh-header,.gh-row,.gh-attachment{justify-content:space-between}.gh-title{gap:12px}.gh-intro{color:var(--gh-muted);margin:10px 0 22px!important}.dsh-github button,.gh-upload{font:inherit;cursor:pointer;border:1px solid var(--gh-line);background:transparent;color:inherit;border-radius:8px;padding:7px 13px;transition:background .15s}.dsh-github button:hover,.gh-upload:hover{background:var(--gh-soft)}.dsh-github button:disabled,.gh-disabled{opacity:.5;cursor:not-allowed}.dsh-github .gh-primary{background:var(--gh-blue);border-color:var(--gh-blue);color:#fff}.dsh-github .gh-primary:hover{background:#3159cd}.dsh-github button:focus-visible,.dsh-github input:focus-visible,.dsh-github select:focus-visible,.dsh-github textarea:focus-visible,.gh-upload:focus-within{outline:2px solid var(--gh-blue);outline-offset:3px}.dsh-github a{color:var(--gh-blue);text-decoration:none;overflow-wrap:anywhere}.dsh-github a:hover{text-decoration:underline}.gh-account{padding:16px 0 20px;border-bottom:1px solid var(--gh-line)}.gh-account img{width:42px;height:42px;border-radius:50%}.gh-account>div{flex:1}.gh-account strong,.gh-account span{display:block}.gh-account span{color:var(--gh-muted);font-size:12px}.gh-account i{display:inline-block;width:6px;height:6px;border-radius:50%;background:#26834a;margin:0 4px 1px}.gh-connect{background:var(--gh-soft);padding:20px;border-radius:10px;margin-bottom:20px}.gh-connect p{color:var(--gh-muted);margin-top:6px}.gh-device{margin-top:14px;display:flex;flex-direction:column;align-items:flex-start;gap:6px}.gh-device>strong{font:600 22px/1.7 Consolas,monospace;letter-spacing:3px;color:var(--text-primary,#1f2328)}.gh-tabs{display:flex;border-bottom:1px solid var(--gh-line);gap:22px;margin-top:14px}.gh-tabs button{border:0;border-radius:0;color:var(--gh-muted);padding:12px 0;border-bottom:2px solid transparent}.gh-tabs button[aria-current]{color:var(--gh-blue);border-bottom-color:var(--gh-blue)}.gh-tabs button:hover{background:transparent;color:var(--gh-blue)}.gh-pending{width:100%;text-align:left;background:#f0f4ff!important;color:#3255af!important;margin-top:14px}.gh-empty{padding:42px 14px;text-align:center;display:flex;flex-direction:column;align-items:center;gap:10px;color:var(--gh-muted)}.gh-empty strong{color:var(--text-primary,#1f2328);font-weight:500}.gh-empty p{max-width:340px;font-size:13px}.gh-empty svg{opacity:.45;margin-bottom:4px}.gh-section-title{margin:14px 0}.gh-section-title h3{margin:0}.gh-repositories{display:grid;gap:10px}.dsh-github .gh-repo{width:100%;text-align:left;padding:15px 16px}.gh-repo strong{font-weight:600;color:var(--gh-blue)}.gh-repo p{color:var(--gh-muted);margin:5px 0;font-size:13px}.gh-repo small{color:var(--gh-muted)}.gh-badge{border:1px solid var(--gh-line);border-radius:20px;font-size:11px;color:var(--gh-muted);padding:1px 8px;white-space:nowrap}.gh-success{color:#22733e;background:#eef8f0;border-color:#d4e8d9}.gh-failed{color:#b42318;background:#fff3f1;border-color:#f4d8d3}.gh-form{display:grid;gap:13px;padding:16px 0 20px;border-bottom:1px solid var(--gh-line)}.gh-field{display:grid;gap:5px}.gh-field>span{font-size:13px;color:var(--gh-muted)}.dsh-github input:not([type=checkbox]):not([type=file]),.dsh-github select,.dsh-github textarea{font:inherit;width:100%;padding:8px 10px;border:1px solid var(--gh-line);border-radius:7px;background:var(--input-background,transparent);color:inherit}.dsh-github textarea{resize:vertical;min-height:90px}.gh-check{display:flex;align-items:center;gap:7px;font-size:13px}.gh-check input{accent-color:var(--gh-blue)}.gh-form>.gh-primary{justify-self:start}.gh-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.dsh-github .gh-back{border:0;padding:4px 0;margin-bottom:12px;color:var(--gh-muted)}.gh-repo-heading{display:flex;align-items:center;gap:10px}.gh-branch{display:flex;align-items:center;gap:8px;margin:14px 0}.gh-branch label{display:flex;align-items:center;gap:8px;flex:1}.gh-branch input{flex:1;min-width:0}.gh-breadcrumb{display:flex;justify-content:space-between;align-items:center;background:var(--gh-soft);padding:8px 12px;overflow-wrap:anywhere;border-radius:6px}.gh-breadcrumb button{font-size:12px;padding:2px 7px}.gh-files{display:grid;margin-top:7px}.gh-files button{display:flex;align-items:center;text-align:left;gap:10px;border:0;border-bottom:1px solid var(--gh-line);border-radius:0;padding:10px 8px}.gh-files button>span:nth-child(2){flex:1;overflow-wrap:anywhere}.gh-files small{color:var(--gh-muted);font-size:11px}.gh-code,.gh-operation pre{font:12px/1.7 Consolas,"Cascadia Mono",monospace;white-space:pre-wrap;overflow-wrap:anywhere;max-height:440px;overflow:auto;padding:13px;background:var(--gh-soft);border-radius:6px}.gh-operation{padding:17px 0;border-bottom:1px solid var(--gh-line)}.gh-operation .gh-target{font-size:15px;font-weight:500;margin:7px 0;overflow-wrap:anywhere}.gh-operation p{font-size:13px;margin:8px 0;color:var(--gh-muted)}.gh-operation .gh-actions{margin-top:13px}.gh-operation details{margin:9px 0}.gh-operation summary{cursor:pointer;font-size:13px;overflow-wrap:anywhere}.gh-release{padding:14px 0;border-bottom:1px solid var(--gh-line);display:grid;gap:6px}.gh-release>small{color:var(--gh-muted)}.gh-download{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:13px}.gh-asset-publish{display:flex;gap:8px;margin-top:8px}.gh-asset-publish select{min-width:0;flex:1}.gh-asset-publish button{white-space:nowrap}.gh-attachments{margin-top:16px}.gh-upload{font-size:13px;white-space:nowrap}.gh-upload input{display:none}.gh-attachment{border-bottom:1px solid var(--gh-line);padding:12px 0}.gh-attachment>div{min-width:0}.gh-attachment strong{font-size:13px;font-weight:500;overflow-wrap:anywhere}.gh-attachment small{display:block;color:var(--gh-muted);font-size:12px}.gh-muted{color:var(--gh-muted);font-size:12px;margin:10px 0!important}.gh-errorbox{display:flex;justify-content:space-between;align-items:flex-start;color:#b42318;background:#fff3f1;border-radius:8px;padding:10px 12px;margin:12px 0;overflow-wrap:anywhere}.gh-errorbox button{border:0;padding:0 5px;margin-left:8px}.dsh-github .gh-error{color:#b42318}.gh-working{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--gh-blue);margin-top:16px}.gh-working>span{width:10px;height:10px;border:2px solid #c2cef5;border-top-color:var(--gh-blue);border-radius:50%;animation:gh-spin .7s linear infinite}.gh-footer{font-size:11px;color:var(--gh-muted);margin-top:28px;border-top:1px solid var(--gh-line);padding-top:13px}@keyframes gh-spin{to{transform:rotate(360deg)}}@media(prefers-color-scheme:dark){.dsh-github{--gh-line:#3c414b;--gh-soft:#252931;--gh-muted:#a1a8b4;color:var(--text-primary,#e6e8ed)}.gh-empty strong,.gh-device>strong{color:var(--text-primary,#e6e8ed)}.dsh-github select option{background:#252931;color:#e6e8ed}}@media(max-width:520px){.gh-header{flex-wrap:wrap}.gh-grid{grid-template-columns:1fr}.gh-tabs{gap:16px}.gh-account{flex-wrap:wrap}.gh-asset-publish{flex-wrap:wrap}.gh-actions{flex-wrap:wrap}}@media(prefers-reduced-motion:reduce){.dsh-github *{animation:none!important;transition:none!important}}\n\n.gh-tabs .gh-refresh-repos{margin-left:auto;align-self:center;white-space:nowrap;padding:5px 10px;border:1px solid var(--gh-line);border-radius:7px;font-size:12px;line-height:1.5;min-width:68px;margin-bottom:6px;color:var(--gh-muted)}.gh-tabs .gh-refresh-repos:hover{background:var(--gh-soft)}\n.gh-browser-search{margin:18px 0 8px;padding:0 0 12px;border-bottom:1px solid var(--gh-line)}.gh-search-row{display:flex;gap:8px;align-items:center}.gh-search-row>select{width:84px!important;flex:none}.gh-search-row>input{min-width:0;flex:1}.gh-search-row>button{flex:none;white-space:nowrap}.gh-search-advanced>summary,.gh-search-preview>summary{cursor:pointer;color:var(--gh-muted);font-size:12px}.gh-search-fields{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;margin:12px 0}.gh-search-fields .gh-field{min-width:0}.gh-search-preview{margin-top:8px}.gh-search-preview code{display:block;overflow-wrap:anywhere;white-space:pre-wrap;font-size:12px;background:var(--gh-soft);padding:8px;margin-top:6px}.gh-reset-search{font-size:12px!important}.gh-search-row input{font-size:13px!important}@media(max-width:520px){.gh-search-row{flex-wrap:wrap}.gh-search-row>select{width:72px!important}.gh-search-row>button{margin-left:auto}.gh-search-fields{grid-template-columns:minmax(0,1fr)}}\n\n.dsh-github .gh-delete-repo{margin-left:auto;flex-shrink:0;color:#b42318;border-color:#f0cdca;font-size:12px;white-space:nowrap}.dsh-github .gh-delete-repo:hover{background:#fff3f1}.gh-delete-dialog{box-sizing:border-box;border:1px solid var(--gh-line);border-radius:12px;background:var(--modal-background,#fff);color:inherit;width:min(460px,calc(100vw - 32px));max-height:calc(100vh - 48px);overflow:auto;padding:22px;font:inherit;box-shadow:0 16px 48px #0003}.gh-delete-dialog::backdrop{background:#0006}.gh-delete-dialog h3{margin:0 0 12px!important;font-size:17px!important}.gh-delete-dialog p{margin:10px 0!important;line-height:1.7}.gh-delete-target{font-weight:600;overflow-wrap:anywhere}.gh-delete-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:20px;flex-wrap:wrap}.dsh-github .gh-delete-continue{background:#b42318;color:white;border-radius:8px;padding:7px 13px;text-decoration:none}.dsh-github .gh-delete-continue:hover{background:#971d14;text-decoration:none}.gh-delete-continue:focus-visible{outline:2px solid #b42318;outline-offset:3px}@media(prefers-color-scheme:dark){.gh-delete-dialog{background:var(--modal-background,#252931)}}\n.gh-imported-files{margin:2px 0 0;border-top:1px solid var(--gh-line)}.gh-ai-label{display:flex;justify-content:space-between;align-items:center;gap:12px;color:var(--gh-muted);font-size:13px}.gh-ai-label button:disabled{color:var(--gh-muted)}.gh-ai-label button:disabled:hover{background:transparent}.gh-ai-label button{font-size:12px;padding:5px 9px;color:var(--gh-blue)}.gh-markdown-toolbar{display:flex;gap:6px;flex-wrap:wrap}.gh-markdown-toolbar button{font-size:12px;padding:4px 8px}.gh-image-insert{display:flex;gap:6px}.gh-image-insert input{min-width:0;flex:1}.gh-image-insert button{white-space:nowrap}.gh-markdown-preview{border:1px solid var(--gh-line);border-radius:8px;padding:14px;max-height:500px;overflow:auto;line-height:1.7}.gh-markdown-preview img{max-width:100%;height:auto}.gh-markdown-preview h1,.gh-markdown-preview h2,.gh-markdown-preview h3{margin:12px 0}.gh-markdown-preview p{margin:8px 0}.gh-markdown-preview blockquote{border-left:3px solid var(--gh-line);margin:8px 0;padding-left:12px;color:var(--gh-muted)}.gh-copy-code{position:relative;margin:10px 0;background:var(--gh-soft);border-radius:7px}.gh-copy-code>button{position:absolute;right:6px;top:6px;font-size:11px;padding:3px 7px}.gh-copy-code pre{padding:36px 12px 12px;white-space:pre-wrap;overflow-wrap:anywhere;overflow:auto;font:12px/1.7 Consolas,monospace}.gh-markdown-preview table{border-collapse:collapse}.gh-markdown-preview td,.gh-markdown-preview th{border:1px solid var(--gh-line);padding:5px 9px}@media(max-width:520px){.gh-ai-label{flex-wrap:wrap}.gh-image-insert{flex-wrap:wrap}}\n.dsh-github .gh-muted{overflow-wrap:anywhere}\n.gh-oauth-setup summary { cursor: pointer; font-weight: 600; }\n.gh-oauth-setup > p { margin-top: 10px; }\n.gh-oauth-steps { margin: 12px 0; padding-inline-start: 1.4em; }\n.gh-oauth-steps > li + li { margin-top: 10px; }\n.gh-oauth-steps ul { margin: 6px 0; padding-inline-start: 1.2em; list-style: disc; }\n.gh-oauth-steps ul li + li { margin-top: 4px; }\n.gh-oauth-steps code { overflow-wrap: anywhere; }\n.gh-oauth-value { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin: 4px 0 8px; }\n.gh-oauth-value code { min-width: 0; user-select: text; }\n.dsh-github .gh-oauth-value button { font-size: 12px; padding: 4px 8px; }\n\n@media (max-width: 520px) {\n .dsh-github { padding: 16px; }\n .dsh-github .gh-tabs { gap: 10px; flex-wrap: wrap; }\n .dsh-github .gh-search-row > input { flex-basis: 140px; }\n .dsh-github .gh-branch { flex-wrap: wrap; }\n .dsh-github .gh-branch label, .dsh-github .gh-asset-publish select { min-width: 0; }\n .dsh-github .gh-repo-heading a { overflow-wrap: anywhere; }\n}\n\n';
13889
13893
 
13890
13894
  // src/browser-search.jsx
13891
13895
  var import_react4 = __toESM(require("react"), 1);
@@ -14138,6 +14142,34 @@ var sizeLabel = (n) => n >= 1024 ** 2 ? (n / 1024 ** 2).toFixed(1) + " MB" : n >
14138
14142
  function Field({ label, children }) {
14139
14143
  return /* @__PURE__ */ import_react8.default.createElement("label", { className: "gh-field" }, /* @__PURE__ */ import_react8.default.createElement("span", null, label), children);
14140
14144
  }
14145
+ function OAuthSetup({ clientId, busy, onSave }) {
14146
+ const [copyStatus, setCopyStatus] = (0, import_react8.useState)("");
14147
+ async function copy(label, value) {
14148
+ try {
14149
+ await navigator.clipboard.writeText(value);
14150
+ setCopyStatus(label + "\u5DF2\u590D\u5236");
14151
+ } catch {
14152
+ setCopyStatus("\u81EA\u52A8\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u957F\u6309\u6216\u9009\u4E2D\u5730\u5740\u624B\u52A8\u590D\u5236\u3002");
14153
+ }
14154
+ }
14155
+ return /* @__PURE__ */ import_react8.default.createElement("details", { open: !clientId, className: "gh-connect gh-oauth-setup" }, /* @__PURE__ */ import_react8.default.createElement("summary", null, clientId ? "GitHub \u767B\u5F55\u914D\u7F6E\uFF08\u5DF2\u914D\u7F6E\uFF09" : "\u9996\u6B21\u767B\u5F55\uFF1F\u914D\u7F6E\u4F60\u7684 GitHub OAuth App"), /* @__PURE__ */ import_react8.default.createElement("p", null, "\u9996\u6B21\u4F7F\u7528\u8BF7\u5728\u81EA\u5DF1\u7684 GitHub \u8D26\u53F7\u4E0B\u6CE8\u518C\u4E00\u6B21\u3002\u5DF2\u7ECF\u6709\u542F\u7528\u4E86\u8BBE\u5907\u6D41\u7684 OAuth App\uFF1F\u76F4\u63A5\u7528\u539F\u6765\u7684 Client ID\uFF0C\u540C\u4E00\u4E2A ID \u53EF\u5728\u7535\u8111\u548C\u624B\u673A\u4E0A\u4F7F\u7528\u3002"), /* @__PURE__ */ import_react8.default.createElement("ol", { className: "gh-oauth-steps" }, /* @__PURE__ */ import_react8.default.createElement("li", null, /* @__PURE__ */ import_react8.default.createElement("a", { href: oauthRegistrationUrl, target: "_blank", rel: "noreferrer" }, "\u6253\u5F00 GitHub OAuth App \u6CE8\u518C\u9875"), "\uFF0C\u767B\u5F55\u4F60\u7684 GitHub \u8D26\u53F7\u3002"), /* @__PURE__ */ import_react8.default.createElement("li", null, "\u6309\u4E0B\u9762\u7684\u793A\u4F8B\u586B\u5199\u8868\u5355\uFF0C\u518D\u70B9\u51FB GitHub \u7684\u300C\u6CE8\u518C\u5E94\u7528\u300D\u3002", /* @__PURE__ */ import_react8.default.createElement("ul", null, /* @__PURE__ */ import_react8.default.createElement("li", null, /* @__PURE__ */ import_react8.default.createElement("strong", null, "\u5E94\u7528\u540D\u79F0"), "\u53EF\u586B ", /* @__PURE__ */ import_react8.default.createElement("code", null, "DeepSeek GitHub Studio"), "\uFF0C\u4E5F\u53EF\u4EE5\u53D6\u81EA\u5DF1\u7684\u540D\u5B57\u3002"), /* @__PURE__ */ import_react8.default.createElement("li", null, /* @__PURE__ */ import_react8.default.createElement("strong", null, "\u4E3B\u9875 URL"), "\u586B\u63D2\u4EF6\u7684\u4ED3\u5E93\u5730\u5740\u3002", /* @__PURE__ */ import_react8.default.createElement("div", { className: "gh-oauth-value" }, /* @__PURE__ */ import_react8.default.createElement("code", null, oauthHomepage), /* @__PURE__ */ import_react8.default.createElement("button", { type: "button", onClick: () => copy("\u4E3B\u9875 URL", oauthHomepage) }, "\u590D\u5236\u4E3B\u9875 URL"))), /* @__PURE__ */ import_react8.default.createElement("li", null, /* @__PURE__ */ import_react8.default.createElement("strong", null, "\u5E94\u7528\u63CF\u8FF0"), "\u53EF\u7559\u7A7A\u3002"), /* @__PURE__ */ import_react8.default.createElement("li", null, /* @__PURE__ */ import_react8.default.createElement("strong", null, "\u91CD\u5B9A\u5411 URI"), "\u586B\u548C\u4E3B\u9875 URL \u4E00\u6837\u7684\u4ED3\u5E93\u5730\u5740\u3002\u901A\u914D\u7B26\u5339\u914D\u4FDD\u6301\u5173\u95ED\u3002", /* @__PURE__ */ import_react8.default.createElement("div", { className: "gh-oauth-value" }, /* @__PURE__ */ import_react8.default.createElement("code", null, oauthHomepage), /* @__PURE__ */ import_react8.default.createElement("button", { type: "button", onClick: () => copy("\u91CD\u5B9A\u5411 URI", oauthHomepage) }, "\u590D\u5236\u91CD\u5B9A\u5411 URI"))), /* @__PURE__ */ import_react8.default.createElement("li", null, "\u52FE\u9009", /* @__PURE__ */ import_react8.default.createElement("strong", null, "\u542F\u7528\u8BBE\u5907\u6D41\uFF08Enable Device Flow\uFF09"), "\u3002"))), /* @__PURE__ */ import_react8.default.createElement("li", null, "\u6CE8\u518C\u540E\uFF0C\u5728 GitHub \u5E94\u7528\u8BE6\u60C5\u91CC\u590D\u5236 ", /* @__PURE__ */ import_react8.default.createElement("strong", null, "Client ID"), "\uFF0C\u7C98\u8D34\u5230\u4E0B\u65B9\u5E76\u4FDD\u5B58\u3002\u518D\u70B9\u300C\u767B\u5F55 GitHub\u300D\uFF0C\u5728 GitHub \u6388\u6743\u9875\u8F93\u5165\u63D2\u4EF6\u663E\u793A\u7684\u8BBE\u5907\u7801\u5E76\u786E\u8BA4\u3002")), copyStatus && /* @__PURE__ */ import_react8.default.createElement("p", { role: "status" }, copyStatus), /* @__PURE__ */ import_react8.default.createElement("p", null, "\u53EA\u9700\u586B\u5199 Client ID\uFF0C\u65E0\u9700\u751F\u6210 Client Secret\u3002"), /* @__PURE__ */ import_react8.default.createElement("form", { className: "gh-form", onSubmit: (event) => {
14156
+ event.preventDefault();
14157
+ const form = new FormData(event.currentTarget);
14158
+ onSave(form.get("clientId").trim());
14159
+ } }, /* @__PURE__ */ import_react8.default.createElement(Field, { label: "OAuth App Client ID" }, /* @__PURE__ */ import_react8.default.createElement(
14160
+ "input",
14161
+ {
14162
+ name: "clientId",
14163
+ required: true,
14164
+ maxLength: 120,
14165
+ defaultValue: clientId ?? "",
14166
+ autoCapitalize: "none",
14167
+ autoComplete: "off",
14168
+ spellCheck: false,
14169
+ placeholder: "\u7C98\u8D34\u4F60\u7684 Client ID"
14170
+ }
14171
+ )), /* @__PURE__ */ import_react8.default.createElement("button", { disabled: busy }, "\u4FDD\u5B58\u5E94\u7528\u914D\u7F6E")));
14172
+ }
14141
14173
  function Empty({ title, children }) {
14142
14174
  return /* @__PURE__ */ import_react8.default.createElement("div", { className: "gh-empty" }, /* @__PURE__ */ import_react8.default.createElement(GitHubIcon, { size: 30 }), /* @__PURE__ */ import_react8.default.createElement("strong", null, title), /* @__PURE__ */ import_react8.default.createElement("p", null, children));
14143
14175
  }
@@ -14233,11 +14265,14 @@ function GitHubSettings() {
14233
14265
  if (result.status === "failed") throw Error(result.error);
14234
14266
  if (selected) await loadReleases();
14235
14267
  });
14236
- return /* @__PURE__ */ import_react8.default.createElement("div", { className: "dsh-github" }, /* @__PURE__ */ import_react8.default.createElement("style", null, style_default), /* @__PURE__ */ import_react8.default.createElement("header", { className: "gh-header" }, /* @__PURE__ */ import_react8.default.createElement("div", { className: "gh-title" }, /* @__PURE__ */ import_react8.default.createElement(GitHubIcon, { size: 26 }), /* @__PURE__ */ import_react8.default.createElement("h2", null, "GitHub")), !logged && /* @__PURE__ */ import_react8.default.createElement("button", { className: "gh-primary", disabled: !!busy || ["preparing", "waiting"].includes(login.state), onClick: () => act("\u6B63\u5728\u8FDE\u63A5", () => post2("auth/start")) }, login.state === "preparing" ? "\u6B63\u5728\u51C6\u5907\u767B\u5F55\u2026" : login.state === "waiting" ? "\u7B49\u5F85\u6388\u6743\u2026" : "\u767B\u5F55 GitHub")), /* @__PURE__ */ import_react8.default.createElement("p", { className: "gh-intro" }, "\u8FDE\u63A5\u4F60\u7684\u8D26\u53F7\uFF0C\u5728\u804A\u5929\u4E2D\u6D4F\u89C8\u4ED3\u5E93\u3001\u63D0\u4EA4\u4EE3\u7801\u548C\u53D1\u5E03\u7A0B\u5E8F\u3002"), state && !logged && /* @__PURE__ */ import_react8.default.createElement("details", { open: !state.clientId, className: "gh-connect" }, /* @__PURE__ */ import_react8.default.createElement("summary", null, "\u767B\u5F55\u5E94\u7528\u914D\u7F6E", state.clientId ? "\uFF08\u5DF2\u914D\u7F6E\uFF09" : "\uFF08\u53D1\u5E03\u8005\u9996\u6B21\u914D\u7F6E\uFF09"), /* @__PURE__ */ import_react8.default.createElement("p", null, "\u63D2\u4EF6\u53D1\u5E03\u8005\u53EA\u9700\u6CE8\u518C\u4E00\u6B21 GitHub OAuth App\uFF0C\u5E76\u542F\u7528 Device Flow\u3002\u6700\u7EC8\u7528\u6237\u4F7F\u7528\u540C\u4E00\u4E2A Client ID \u767B\u5F55\uFF0C\u4E0D\u9700\u8981 Client Secret\u3002"), /* @__PURE__ */ import_react8.default.createElement("a", { href: "https://github.com/settings/applications/new", target: "_blank", rel: "noreferrer" }, "\u6253\u5F00 GitHub \u5E94\u7528\u6CE8\u518C\u9875\u9762"), /* @__PURE__ */ import_react8.default.createElement("form", { className: "gh-form", onSubmit: (e) => {
14237
- e.preventDefault();
14238
- const f = new FormData(e.currentTarget);
14239
- act("\u6B63\u5728\u4FDD\u5B58", () => post2("auth/configure", { clientId: f.get("clientId") }));
14240
- } }, /* @__PURE__ */ import_react8.default.createElement(Field, { label: "OAuth App Client ID" }, /* @__PURE__ */ import_react8.default.createElement("input", { name: "clientId", required: true, defaultValue: state.clientId ?? "", placeholder: "\u586B\u5199\u53D1\u5E03\u8005\u7684 Client ID" })), /* @__PURE__ */ import_react8.default.createElement("button", { disabled: !!busy }, "\u4FDD\u5B58\u5E94\u7528\u914D\u7F6E"))), error && /* @__PURE__ */ import_react8.default.createElement("div", { role: "alert", className: "gh-errorbox" }, error, /* @__PURE__ */ import_react8.default.createElement("button", { "aria-label": "\u5173\u95ED\u63D0\u793A", onClick: () => setError("") }, "\xD7")), state?.user && state.errorKind && state.errorKind !== "auth" && /* @__PURE__ */ import_react8.default.createElement("p", { role: "status", className: "gh-muted" }, "GitHub \u6682\u65F6\u4E0D\u53EF\u7528\uFF08", state.error, "\uFF09\uFF0C\u5DF2\u4FDD\u7559\u5F53\u524D\u754C\u9762\u72B6\u6001\u5E76\u81EA\u52A8\u91CD\u8BD5\u3002"), state?.hasCredential && !logged && /* @__PURE__ */ import_react8.default.createElement("button", { disabled: !!busy, onClick: () => act("\u6B63\u5728\u6E05\u9664\u672C\u5730\u8FDE\u63A5", () => post2("auth/logout")) }, "\u6E05\u9664\u672C\u5730\u8FDE\u63A5"), !state && /* @__PURE__ */ import_react8.default.createElement("p", { role: "status", className: "gh-muted" }, "\u6B63\u5728\u68C0\u67E5\u8FDE\u63A5\u2026"), logged ? /* @__PURE__ */ import_react8.default.createElement("section", { className: "gh-account" }, /* @__PURE__ */ import_react8.default.createElement("img", { src: state.user.avatar_url, alt: "" }), /* @__PURE__ */ import_react8.default.createElement("div", null, /* @__PURE__ */ import_react8.default.createElement("strong", null, state.user.name || state.user.login), /* @__PURE__ */ import_react8.default.createElement("span", null, "@", state.user.login, " ", /* @__PURE__ */ import_react8.default.createElement("i", null), " \u5DF2\u8FDE\u63A5")), /* @__PURE__ */ import_react8.default.createElement("button", { disabled: !!busy, onClick: () => act("\u6B63\u5728\u65AD\u5F00", () => post2("auth/logout")) }, "\u65AD\u5F00\u8FDE\u63A5")) : /* @__PURE__ */ import_react8.default.createElement("section", { className: "gh-connect" }, /* @__PURE__ */ import_react8.default.createElement("strong", null, "\u8FDE\u63A5\u4F60\u7684 GitHub \u8D26\u53F7"), /* @__PURE__ */ import_react8.default.createElement("p", null, "\u70B9\u51FB\u53F3\u4E0A\u65B9\u767B\u5F55\uFF0C\u5728 GitHub \u5B98\u65B9\u9875\u9762\u5B8C\u6210\u6388\u6743\u3002\u8BF7\u5728 GitHub \u5B98\u65B9\u6388\u6743\u9875\u8F93\u5165\u8BBE\u5907\u4EE3\u7801\u3002"), login.state === "waiting" && /* @__PURE__ */ import_react8.default.createElement("div", { className: "gh-device" }, /* @__PURE__ */ import_react8.default.createElement("span", null, "\u5728\u6388\u6743\u9875\u9762\u8F93\u5165\u8BBE\u5907\u4EE3\u7801"), /* @__PURE__ */ import_react8.default.createElement("strong", null, login.code || "\u6B63\u5728\u83B7\u53D6\u2026"), /* @__PURE__ */ import_react8.default.createElement("a", { href: "https://github.com/login/device", target: "_blank", rel: "noreferrer" }, "\u6253\u5F00 GitHub \u6388\u6743\u9875\u9762")), ["preparing", "waiting"].includes(login.state) && /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, /* @__PURE__ */ import_react8.default.createElement("p", { role: "status", className: "gh-muted" }, login.message || "\u6388\u6743\u6709\u6548\u671F\u5185\u9047\u5230\u77ED\u6682\u7F51\u7EDC\u6545\u969C\u4F1A\u81EA\u52A8\u91CD\u8BD5\u3002"), /* @__PURE__ */ import_react8.default.createElement("button", { disabled: !!busy, onClick: () => act("\u6B63\u5728\u53D6\u6D88\u767B\u5F55", () => post2("auth/cancel")) }, "\u53D6\u6D88\u672C\u6B21\u767B\u5F55")), login.state === "preparing" && /* @__PURE__ */ import_react8.default.createElement("p", { role: "status" }, "\u6B63\u5728\u8BF7\u6C42 GitHub \u8BBE\u5907\u6388\u6743\uFF0C\u8BF7\u7A0D\u5019\u2026"), state?.error && !logged && !["preparing", "waiting", "error"].includes(login.state) && /* @__PURE__ */ import_react8.default.createElement("p", { className: "gh-error" }, state.error), login.state === "error" && /* @__PURE__ */ import_react8.default.createElement("p", { className: "gh-error" }, login.message)), /* @__PURE__ */ import_react8.default.createElement(BrowserSearch, null), pending > 0 && tab2 !== "operations" && /* @__PURE__ */ import_react8.default.createElement("button", { className: "gh-pending", onClick: () => setTab("operations") }, pending, " \u9879\u64CD\u4F5C\u7B49\u5F85\u786E\u8BA4\uFF0C\u70B9\u51FB\u9884\u89C8"), /* @__PURE__ */ import_react8.default.createElement("nav", { className: "gh-tabs", "aria-label": "GitHub \u529F\u80FD" }, [["repos", "\u4ED3\u5E93"], ["releases", "\u7A0B\u5E8F\u53D1\u5E03"], ["operations", `\u64CD\u4F5C\u8BB0\u5F55${pending ? " (" + pending + ")" : ""}`]].map(([id, label]) => /* @__PURE__ */ import_react8.default.createElement("button", { key: id, "aria-current": tab2 === id ? "page" : void 0, onClick: () => {
14268
+ return /* @__PURE__ */ import_react8.default.createElement("div", { className: "dsh-github" }, /* @__PURE__ */ import_react8.default.createElement("style", null, style_default), /* @__PURE__ */ import_react8.default.createElement("header", { className: "gh-header" }, /* @__PURE__ */ import_react8.default.createElement("div", { className: "gh-title" }, /* @__PURE__ */ import_react8.default.createElement(GitHubIcon, { size: 26 }), /* @__PURE__ */ import_react8.default.createElement("h2", null, "GitHub")), !logged && /* @__PURE__ */ import_react8.default.createElement("button", { className: "gh-primary", disabled: !!busy || ["preparing", "waiting"].includes(login.state), onClick: () => act("\u6B63\u5728\u8FDE\u63A5", () => post2("auth/start")) }, login.state === "preparing" ? "\u6B63\u5728\u51C6\u5907\u767B\u5F55\u2026" : login.state === "waiting" ? "\u7B49\u5F85\u6388\u6743\u2026" : "\u767B\u5F55 GitHub")), /* @__PURE__ */ import_react8.default.createElement("p", { className: "gh-intro" }, "\u8FDE\u63A5\u4F60\u7684\u8D26\u53F7\uFF0C\u5728\u804A\u5929\u4E2D\u6D4F\u89C8\u4ED3\u5E93\u3001\u63D0\u4EA4\u4EE3\u7801\u548C\u53D1\u5E03\u7A0B\u5E8F\u3002"), state && !logged && /* @__PURE__ */ import_react8.default.createElement(
14269
+ OAuthSetup,
14270
+ {
14271
+ clientId: state.clientId,
14272
+ busy: !!busy,
14273
+ onSave: (clientId) => act("\u6B63\u5728\u4FDD\u5B58", () => post2("auth/configure", { clientId }))
14274
+ }
14275
+ ), error && /* @__PURE__ */ import_react8.default.createElement("div", { role: "alert", className: "gh-errorbox" }, error, /* @__PURE__ */ import_react8.default.createElement("button", { "aria-label": "\u5173\u95ED\u63D0\u793A", onClick: () => setError("") }, "\xD7")), state?.user && state.errorKind && state.errorKind !== "auth" && /* @__PURE__ */ import_react8.default.createElement("p", { role: "status", className: "gh-muted" }, "GitHub \u6682\u65F6\u4E0D\u53EF\u7528\uFF08", state.error, "\uFF09\uFF0C\u5DF2\u4FDD\u7559\u5F53\u524D\u754C\u9762\u72B6\u6001\u5E76\u81EA\u52A8\u91CD\u8BD5\u3002"), state?.hasCredential && !logged && /* @__PURE__ */ import_react8.default.createElement("button", { disabled: !!busy, onClick: () => act("\u6B63\u5728\u6E05\u9664\u672C\u5730\u8FDE\u63A5", () => post2("auth/logout")) }, "\u6E05\u9664\u672C\u5730\u8FDE\u63A5"), !state && /* @__PURE__ */ import_react8.default.createElement("p", { role: "status", className: "gh-muted" }, "\u6B63\u5728\u68C0\u67E5\u8FDE\u63A5\u2026"), logged ? /* @__PURE__ */ import_react8.default.createElement("section", { className: "gh-account" }, /* @__PURE__ */ import_react8.default.createElement("img", { src: state.user.avatar_url, alt: "" }), /* @__PURE__ */ import_react8.default.createElement("div", null, /* @__PURE__ */ import_react8.default.createElement("strong", null, state.user.name || state.user.login), /* @__PURE__ */ import_react8.default.createElement("span", null, "@", state.user.login, " ", /* @__PURE__ */ import_react8.default.createElement("i", null), " \u5DF2\u8FDE\u63A5")), /* @__PURE__ */ import_react8.default.createElement("button", { disabled: !!busy, onClick: () => act("\u6B63\u5728\u65AD\u5F00", () => post2("auth/logout")) }, "\u65AD\u5F00\u8FDE\u63A5")) : /* @__PURE__ */ import_react8.default.createElement("section", { className: "gh-connect" }, /* @__PURE__ */ import_react8.default.createElement("strong", null, "\u8FDE\u63A5\u4F60\u7684 GitHub \u8D26\u53F7"), /* @__PURE__ */ import_react8.default.createElement("p", null, "\u70B9\u51FB\u53F3\u4E0A\u65B9\u767B\u5F55\uFF0C\u5728 GitHub \u5B98\u65B9\u9875\u9762\u5B8C\u6210\u6388\u6743\u3002\u8BF7\u5728 GitHub \u5B98\u65B9\u6388\u6743\u9875\u8F93\u5165\u8BBE\u5907\u4EE3\u7801\u3002"), login.state === "waiting" && /* @__PURE__ */ import_react8.default.createElement("div", { className: "gh-device" }, /* @__PURE__ */ import_react8.default.createElement("span", null, "\u5728\u6388\u6743\u9875\u9762\u8F93\u5165\u8BBE\u5907\u4EE3\u7801"), /* @__PURE__ */ import_react8.default.createElement("strong", null, login.code || "\u6B63\u5728\u83B7\u53D6\u2026"), /* @__PURE__ */ import_react8.default.createElement("a", { href: "https://github.com/login/device", target: "_blank", rel: "noreferrer" }, "\u6253\u5F00 GitHub \u6388\u6743\u9875\u9762")), ["preparing", "waiting"].includes(login.state) && /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, /* @__PURE__ */ import_react8.default.createElement("p", { role: "status", className: "gh-muted" }, login.message || "\u6388\u6743\u6709\u6548\u671F\u5185\u9047\u5230\u77ED\u6682\u7F51\u7EDC\u6545\u969C\u4F1A\u81EA\u52A8\u91CD\u8BD5\u3002"), /* @__PURE__ */ import_react8.default.createElement("button", { disabled: !!busy, onClick: () => act("\u6B63\u5728\u53D6\u6D88\u767B\u5F55", () => post2("auth/cancel")) }, "\u53D6\u6D88\u672C\u6B21\u767B\u5F55")), login.state === "preparing" && /* @__PURE__ */ import_react8.default.createElement("p", { role: "status" }, "\u6B63\u5728\u8BF7\u6C42 GitHub \u8BBE\u5907\u6388\u6743\uFF0C\u8BF7\u7A0D\u5019\u2026"), state?.error && !logged && !["preparing", "waiting", "error"].includes(login.state) && /* @__PURE__ */ import_react8.default.createElement("p", { className: "gh-error" }, state.error), login.state === "error" && /* @__PURE__ */ import_react8.default.createElement("p", { className: "gh-error" }, login.message)), /* @__PURE__ */ import_react8.default.createElement(BrowserSearch, null), pending > 0 && tab2 !== "operations" && /* @__PURE__ */ import_react8.default.createElement("button", { className: "gh-pending", onClick: () => setTab("operations") }, pending, " \u9879\u64CD\u4F5C\u7B49\u5F85\u786E\u8BA4\uFF0C\u70B9\u51FB\u9884\u89C8"), /* @__PURE__ */ import_react8.default.createElement("nav", { className: "gh-tabs", "aria-label": "GitHub \u529F\u80FD" }, [["repos", "\u4ED3\u5E93"], ["releases", "\u7A0B\u5E8F\u53D1\u5E03"], ["operations", `\u64CD\u4F5C\u8BB0\u5F55${pending ? " (" + pending + ")" : ""}`]].map(([id, label]) => /* @__PURE__ */ import_react8.default.createElement("button", { key: id, "aria-current": tab2 === id ? "page" : void 0, onClick: () => {
14241
14276
  setTab(id);
14242
14277
  if (id === "releases" && selected) act("\u6B63\u5728\u8BFB\u53D6\u7248\u672C", () => loadReleases());
14243
14278
  } }, label)), /* @__PURE__ */ import_react8.default.createElement("button", { className: "gh-refresh-repos", disabled: !logged || !!busy, onClick: () => act("\u6B63\u5728\u5237\u65B0\u4ED3\u5E93", () => listRepos(1)) }, busy === "\u6B63\u5728\u5237\u65B0\u4ED3\u5E93" ? "\u5237\u65B0\u4E2D\u2026" : "\u5237\u65B0\u5E93")), tab2 === "repos" && (!logged ? /* @__PURE__ */ import_react8.default.createElement(Empty, { title: "\u767B\u5F55\u540E\u67E5\u770B\u4ED3\u5E93" }, "\u9009\u62E9\u4F60\u7684\u9879\u76EE\uFF0C\u8BA9 DeepSeek \u9605\u8BFB\u548C\u5206\u6790\u4EE3\u7801\u3002") : /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, /* @__PURE__ */ import_react8.default.createElement("div", { className: "gh-row gh-section-title" }, /* @__PURE__ */ import_react8.default.createElement("h3", null, selected ? "\u4ED3\u5E93\u6587\u4EF6" : "\u6211\u7684\u4ED3\u5E93"), /* @__PURE__ */ import_react8.default.createElement("div", { className: "gh-actions" }, /* @__PURE__ */ import_react8.default.createElement("button", { disabled: !!busy, onClick: () => act("\u6B63\u5728\u5237\u65B0", () => listRepos()) }, "\u5237\u65B0"), /* @__PURE__ */ import_react8.default.createElement("button", { onClick: () => setCreate(!create2) }, "\u65B0\u5EFA\u4ED3\u5E93"))), create2 && /* @__PURE__ */ import_react8.default.createElement(NewRepositoryForm, { busy: !!busy, apiCall: post2, upload: (file) => call("upload", { method: "POST", body: file, headers: { "x-file-name": encodeURIComponent(file.name), "x-file-purpose": "intro", "Content-Type": "application/octet-stream" } }), onPrepare: (args) => act("\u6B63\u5728\u51C6\u5907\u4ED3\u5E93", () => prepare("create_repository", args)) }), selected ? /* @__PURE__ */ import_react8.default.createElement(import_react8.default.Fragment, null, /* @__PURE__ */ import_react8.default.createElement("button", { className: "gh-back", onClick: () => {
@@ -0,0 +1,174 @@
1
+ import {spawn} from 'node:child_process';
2
+ import {createHash,randomUUID} from 'node:crypto';
3
+ import {mkdir,readFile,rename,stat,unlink,writeFile} from 'node:fs/promises';
4
+ import path from 'node:path';
5
+
6
+ export function command(executable, args, {input = '', timeout = 30000} = {}) {
7
+ return new Promise((resolve, reject) => {
8
+ const child = spawn(executable, args, {windowsHide: true, stdio: ['pipe', 'pipe', 'ignore']});
9
+ let stdout = '';
10
+ child.stdout.setEncoding('utf8');
11
+ child.stdout.on('data', chunk => { stdout += chunk; });
12
+ let timedOut = false;
13
+ const timer = setTimeout(() => {
14
+ timedOut = true;
15
+ child.kill('SIGKILL');
16
+ }, timeout);
17
+ child.on('error', error => { clearTimeout(timer); reject(error); });
18
+ child.on('close', code => {
19
+ clearTimeout(timer);
20
+ if (timedOut) reject(Error('凭据操作超时。'));
21
+ else resolve({code, stdout});
22
+ });
23
+ child.stdin.on('error', () => {});
24
+ child.stdin.end(input);
25
+ });
26
+ }
27
+
28
+ export async function windowsSeal(action, value) {
29
+ if (process.platform !== 'win32') throw Error('DPAPI 仅在 Windows 上可用。');
30
+ const operation = action === 'protect' ? 'Protect' : 'Unprotect';
31
+ const script = `$ErrorActionPreference='Stop'; Add-Type -AssemblyName System.Security; $b=[Convert]::FromBase64String([Console]::In.ReadToEnd().Trim()); $r=[Security.Cryptography.ProtectedData]::${operation}($b,$null,[Security.Cryptography.DataProtectionScope]::CurrentUser); [Console]::Write([Convert]::ToBase64String($r))`;
32
+ const result = await command('powershell.exe', ['-NoProfile','-NonInteractive','-Command',script], {
33
+ input: action === 'protect' ? Buffer.from(value, 'utf8').toString('base64') : value
34
+ });
35
+ if (result.code !== 0) throw Error('Windows 凭据保护操作失败。');
36
+ return action === 'protect' ? result.stdout.trim() : Buffer.from(result.stdout.trim(), 'base64').toString('utf8');
37
+ }
38
+
39
+ export function fileCredentialStore(root, seal = windowsSeal) {
40
+ const filename = path.join(root, 'credential.dpapi');
41
+ return {
42
+ async exists() {
43
+ try { return (await stat(filename)).isFile(); }
44
+ catch (error) { if (error.code === 'ENOENT') return false; throw error; }
45
+ },
46
+ async read() {
47
+ let encrypted;
48
+ try { encrypted = await readFile(filename, 'utf8'); }
49
+ catch (error) { if (error.code === 'ENOENT') return null; throw error; }
50
+ try { return await seal('unprotect', encrypted); }
51
+ catch {
52
+ throw Object.assign(Error('本机 GitHub 凭据无法解密,请重新连接。'), {
53
+ status: 401, reason: 'decrypt_failed', hasCredential: true
54
+ });
55
+ }
56
+ },
57
+ async write(plain, beforeCommit = () => {}) {
58
+ const encrypted = await seal('protect', plain);
59
+ await mkdir(root, {recursive: true});
60
+ const temp = path.join(root, 'credential-' + randomUUID() + '.tmp');
61
+ try {
62
+ await writeFile(temp, encrypted, {mode: 0o600, flag: 'wx'});
63
+ beforeCommit();
64
+ await rename(temp, filename);
65
+ } finally { await unlink(temp).catch(() => {}); }
66
+ },
67
+ async remove() {
68
+ try { await unlink(filename); }
69
+ catch (error) { if (error.code !== 'ENOENT') throw error; }
70
+ }
71
+ };
72
+ }
73
+
74
+ // The security tool returns the low byte of errSecItemNotFound (-25300).
75
+ const itemNotFound = 44;
76
+ const keychainError = () => Object.assign(
77
+ Error('无法访问 macOS 钥匙串。请确认登录钥匙串已解锁,并允许访问 DeepSeek GitHub Studio 的凭据。'),
78
+ {status: 503, reason: 'keychain_unavailable'}
79
+ );
80
+
81
+ export function macCredentialStore(root, {run = command, keychain} = {}) {
82
+ const service = 'DeepSeek GitHub Studio';
83
+ // Different DSH_HOME directories must not share a Keychain item.
84
+ const account = createHash('sha256').update(path.resolve(root)).digest('hex');
85
+ const identity = ['-s', service, '-a', account];
86
+ const keychains = keychain ? [keychain] : [];
87
+ async function security(args, options) {
88
+ try { return await run('/usr/bin/security', args, options); }
89
+ catch { throw keychainError(); }
90
+ }
91
+ async function find(passwordOnly) {
92
+ const flags = passwordOnly ? ['-w'] : [];
93
+ const result = await security(['find-generic-password', ...flags, ...identity, ...keychains]);
94
+ if (result.code === itemNotFound) return null;
95
+ if (result.code !== 0) throw keychainError();
96
+ return result.stdout;
97
+ }
98
+ return {
99
+ async exists() { return (await find(false)) !== null; },
100
+ async read() {
101
+ const result = await find(true);
102
+ if (result === null) return null;
103
+ const encoded = result.trim();
104
+ if (!/^v1\.[A-Za-z0-9+/]+={0,2}$/.test(encoded)) {
105
+ throw Object.assign(Error('钥匙串中的 GitHub 凭据格式无效,请重新登录。'), {
106
+ status: 401, reason: 'invalid_local', hasCredential: true
107
+ });
108
+ }
109
+ return Buffer.from(encoded.slice(3), 'base64').toString('utf8');
110
+ },
111
+ async write(plain, beforeCommit = () => {}) {
112
+ // Pass the credential through a pipe, never through the process arguments.
113
+ const encoded = 'v1.' + Buffer.from(plain, 'utf8').toString('base64');
114
+ const args = [...identity, '-U', '-w', encoded, ...keychains];
115
+ if (args.some(arg => /[\r\n\0]/.test(arg))) throw keychainError();
116
+ const quoted = args.map(arg => '"' + arg.replace(/["\\]/g, '\\$&') + '"');
117
+ const input = 'add-generic-password ' + quoted.join(' ') + '\n';
118
+ if (Buffer.byteLength(input) >= 4095) throw Error('GitHub 凭据过长,无法保存到 macOS 钥匙串。');
119
+ beforeCommit();
120
+ const result = await security(['-q', '-i'], {input});
121
+ if (result.code !== 0) throw keychainError();
122
+ },
123
+ async remove() {
124
+ const result = await security(['delete-generic-password', ...identity, ...keychains]);
125
+ if (result.code !== 0 && result.code !== itemNotFound) throw keychainError();
126
+ }
127
+ };
128
+ }
129
+
130
+ // The Android guest runs Linux and exposes Harness's managed credential provider.
131
+ // Keep its record separate from model credentials and desktop credential stores.
132
+ const harnessCredentialKey = 'github-connect/github-oauth';
133
+
134
+ export function harnessCredentialStore(getProvider) {
135
+ function provider() {
136
+ const service = getProvider();
137
+ if (!service || ['describeRecord', 'readRecord', 'modifyRecord', 'deleteRecord'].some(
138
+ method => typeof service[method] !== 'function'
139
+ )) {
140
+ throw Object.assign(Error('Harness 凭据服务不可用,请检查当前主机或重启引擎。'), {status: 503});
141
+ }
142
+ return service;
143
+ }
144
+ return {
145
+ async exists() {
146
+ return (await provider().describeRecord(harnessCredentialKey)).configured === true;
147
+ },
148
+ async read() {
149
+ const record = await provider().readRecord(harnessCredentialKey);
150
+ if (record === undefined) return null;
151
+ if (record.kind !== 'grant' || typeof record.payload?.access_token !== 'string') {
152
+ throw Object.assign(Error('GitHub 登录记录无效,请重新授权。'), {
153
+ status: 401, reason: 'invalid_local', hasCredential: true
154
+ });
155
+ }
156
+ return JSON.stringify(record.payload);
157
+ },
158
+ async write(plain, beforeCommit = () => {}) {
159
+ const payload = JSON.parse(plain);
160
+ await provider().modifyRecord(harnessCredentialKey, async () => {
161
+ beforeCommit();
162
+ return {kind: 'grant', payload};
163
+ });
164
+ },
165
+ async remove() { await provider().deleteRecord(harnessCredentialKey); }
166
+ };
167
+ }
168
+
169
+ export function credentialStore(root, seal) {
170
+ if (seal || process.platform === 'win32') return fileCredentialStore(root, seal);
171
+ if (process.platform === 'darwin') return macCredentialStore(root);
172
+ const unsupported = () => { throw Error('此主机缺少受支持的 GitHub 凭据存储。'); };
173
+ return {exists: async () => false, read: unsupported, write: unsupported, remove: unsupported};
174
+ }
@@ -0,0 +1,174 @@
1
+ import {spawn} from 'node:child_process';
2
+ import {createHash,randomUUID} from 'node:crypto';
3
+ import {mkdir,readFile,rename,stat,unlink,writeFile} from 'node:fs/promises';
4
+ import path from 'node:path';
5
+
6
+ export function command(executable, args, {input = '', timeout = 30000} = {}) {
7
+ return new Promise((resolve, reject) => {
8
+ const child = spawn(executable, args, {windowsHide: true, stdio: ['pipe', 'pipe', 'ignore']});
9
+ let stdout = '';
10
+ child.stdout.setEncoding('utf8');
11
+ child.stdout.on('data', chunk => { stdout += chunk; });
12
+ let timedOut = false;
13
+ const timer = setTimeout(() => {
14
+ timedOut = true;
15
+ child.kill('SIGKILL');
16
+ }, timeout);
17
+ child.on('error', error => { clearTimeout(timer); reject(error); });
18
+ child.on('close', code => {
19
+ clearTimeout(timer);
20
+ if (timedOut) reject(Error('凭据操作超时。'));
21
+ else resolve({code, stdout});
22
+ });
23
+ child.stdin.on('error', () => {});
24
+ child.stdin.end(input);
25
+ });
26
+ }
27
+
28
+ export async function windowsSeal(action, value) {
29
+ if (process.platform !== 'win32') throw Error('DPAPI 仅在 Windows 上可用。');
30
+ const operation = action === 'protect' ? 'Protect' : 'Unprotect';
31
+ const script = `$ErrorActionPreference='Stop'; Add-Type -AssemblyName System.Security; $b=[Convert]::FromBase64String([Console]::In.ReadToEnd().Trim()); $r=[Security.Cryptography.ProtectedData]::${operation}($b,$null,[Security.Cryptography.DataProtectionScope]::CurrentUser); [Console]::Write([Convert]::ToBase64String($r))`;
32
+ const result = await command('powershell.exe', ['-NoProfile','-NonInteractive','-Command',script], {
33
+ input: action === 'protect' ? Buffer.from(value, 'utf8').toString('base64') : value
34
+ });
35
+ if (result.code !== 0) throw Error('Windows 凭据保护操作失败。');
36
+ return action === 'protect' ? result.stdout.trim() : Buffer.from(result.stdout.trim(), 'base64').toString('utf8');
37
+ }
38
+
39
+ export function fileCredentialStore(root, seal = windowsSeal) {
40
+ const filename = path.join(root, 'credential.dpapi');
41
+ return {
42
+ async exists() {
43
+ try { return (await stat(filename)).isFile(); }
44
+ catch (error) { if (error.code === 'ENOENT') return false; throw error; }
45
+ },
46
+ async read() {
47
+ let encrypted;
48
+ try { encrypted = await readFile(filename, 'utf8'); }
49
+ catch (error) { if (error.code === 'ENOENT') return null; throw error; }
50
+ try { return await seal('unprotect', encrypted); }
51
+ catch {
52
+ throw Object.assign(Error('本机 GitHub 凭据无法解密,请重新连接。'), {
53
+ status: 401, reason: 'decrypt_failed', hasCredential: true
54
+ });
55
+ }
56
+ },
57
+ async write(plain, beforeCommit = () => {}) {
58
+ const encrypted = await seal('protect', plain);
59
+ await mkdir(root, {recursive: true});
60
+ const temp = path.join(root, 'credential-' + randomUUID() + '.tmp');
61
+ try {
62
+ await writeFile(temp, encrypted, {mode: 0o600, flag: 'wx'});
63
+ beforeCommit();
64
+ await rename(temp, filename);
65
+ } finally { await unlink(temp).catch(() => {}); }
66
+ },
67
+ async remove() {
68
+ try { await unlink(filename); }
69
+ catch (error) { if (error.code !== 'ENOENT') throw error; }
70
+ }
71
+ };
72
+ }
73
+
74
+ // The security tool returns the low byte of errSecItemNotFound (-25300).
75
+ const itemNotFound = 44;
76
+ const keychainError = () => Object.assign(
77
+ Error('无法访问 macOS 钥匙串。请确认登录钥匙串已解锁,并允许访问 DeepSeek GitHub Studio 的凭据。'),
78
+ {status: 503, reason: 'keychain_unavailable'}
79
+ );
80
+
81
+ export function macCredentialStore(root, {run = command, keychain} = {}) {
82
+ const service = 'DeepSeek GitHub Studio';
83
+ // Different DSH_HOME directories must not share a Keychain item.
84
+ const account = createHash('sha256').update(path.resolve(root)).digest('hex');
85
+ const identity = ['-s', service, '-a', account];
86
+ const keychains = keychain ? [keychain] : [];
87
+ async function security(args, options) {
88
+ try { return await run('/usr/bin/security', args, options); }
89
+ catch { throw keychainError(); }
90
+ }
91
+ async function find(passwordOnly) {
92
+ const flags = passwordOnly ? ['-w'] : [];
93
+ const result = await security(['find-generic-password', ...flags, ...identity, ...keychains]);
94
+ if (result.code === itemNotFound) return null;
95
+ if (result.code !== 0) throw keychainError();
96
+ return result.stdout;
97
+ }
98
+ return {
99
+ async exists() { return (await find(false)) !== null; },
100
+ async read() {
101
+ const result = await find(true);
102
+ if (result === null) return null;
103
+ const encoded = result.trim();
104
+ if (!/^v1\.[A-Za-z0-9+/]+={0,2}$/.test(encoded)) {
105
+ throw Object.assign(Error('钥匙串中的 GitHub 凭据格式无效,请重新登录。'), {
106
+ status: 401, reason: 'invalid_local', hasCredential: true
107
+ });
108
+ }
109
+ return Buffer.from(encoded.slice(3), 'base64').toString('utf8');
110
+ },
111
+ async write(plain, beforeCommit = () => {}) {
112
+ // Pass the credential through a pipe, never through the process arguments.
113
+ const encoded = 'v1.' + Buffer.from(plain, 'utf8').toString('base64');
114
+ const args = [...identity, '-U', '-w', encoded, ...keychains];
115
+ if (args.some(arg => /[\r\n\0]/.test(arg))) throw keychainError();
116
+ const quoted = args.map(arg => '"' + arg.replace(/["\\]/g, '\\$&') + '"');
117
+ const input = 'add-generic-password ' + quoted.join(' ') + '\n';
118
+ if (Buffer.byteLength(input) >= 4095) throw Error('GitHub 凭据过长,无法保存到 macOS 钥匙串。');
119
+ beforeCommit();
120
+ const result = await security(['-q', '-i'], {input});
121
+ if (result.code !== 0) throw keychainError();
122
+ },
123
+ async remove() {
124
+ const result = await security(['delete-generic-password', ...identity, ...keychains]);
125
+ if (result.code !== 0 && result.code !== itemNotFound) throw keychainError();
126
+ }
127
+ };
128
+ }
129
+
130
+ // The Android guest runs Linux and exposes Harness's managed credential provider.
131
+ // Keep its record separate from model credentials and desktop credential stores.
132
+ const harnessCredentialKey = 'github-connect/github-oauth';
133
+
134
+ export function harnessCredentialStore(getProvider) {
135
+ function provider() {
136
+ const service = getProvider();
137
+ if (!service || ['describeRecord', 'readRecord', 'modifyRecord', 'deleteRecord'].some(
138
+ method => typeof service[method] !== 'function'
139
+ )) {
140
+ throw Object.assign(Error('Harness 凭据服务不可用,请检查当前主机或重启引擎。'), {status: 503});
141
+ }
142
+ return service;
143
+ }
144
+ return {
145
+ async exists() {
146
+ return (await provider().describeRecord(harnessCredentialKey)).configured === true;
147
+ },
148
+ async read() {
149
+ const record = await provider().readRecord(harnessCredentialKey);
150
+ if (record === undefined) return null;
151
+ if (record.kind !== 'grant' || typeof record.payload?.access_token !== 'string') {
152
+ throw Object.assign(Error('GitHub 登录记录无效,请重新授权。'), {
153
+ status: 401, reason: 'invalid_local', hasCredential: true
154
+ });
155
+ }
156
+ return JSON.stringify(record.payload);
157
+ },
158
+ async write(plain, beforeCommit = () => {}) {
159
+ const payload = JSON.parse(plain);
160
+ await provider().modifyRecord(harnessCredentialKey, async () => {
161
+ beforeCommit();
162
+ return {kind: 'grant', payload};
163
+ });
164
+ },
165
+ async remove() { await provider().deleteRecord(harnessCredentialKey); }
166
+ };
167
+ }
168
+
169
+ export function credentialStore(root, seal) {
170
+ if (seal || process.platform === 'win32') return fileCredentialStore(root, seal);
171
+ if (process.platform === 'darwin') return macCredentialStore(root);
172
+ const unsupported = () => { throw Error('此主机缺少受支持的 GitHub 凭据存储。'); };
173
+ return {exists: async () => false, read: unsupported, write: unsupported, remove: unsupported};
174
+ }
@@ -2,7 +2,7 @@ import {mkdirSync,appendFileSync,statSync,readFileSync,writeFileSync} from 'node
2
2
  import path from 'node:path';
3
3
  const events=new Set(['plugin_started','plugin_stopped','credential_read','credential_saved','logout','oauth_started','oauth_waiting','oauth_retry','oauth_failed','api_response','api_failure']);
4
4
  const categories=new Set(['account','search','repository','upload','authorization']);
5
- const reasons=new Set(['ok','missing','read_failed','decrypt_failed','invalid_local','invalid_credentials','forbidden','rate_limited','server_error','tls_error','dns_error','connection_error','network_error','timeout','authorization_failed','access_denied','expired_token','device_flow_disabled','incorrect_client_credentials','incorrect_device_code','unsupported_grant_type','oauth_error','local_disconnect']);
5
+ const reasons=new Set(['ok','missing','read_failed','decrypt_failed','keychain_unavailable','invalid_local','invalid_credentials','forbidden','rate_limited','server_error','tls_error','dns_error','connection_error','network_error','timeout','authorization_failed','access_denied','expired_token','device_flow_disabled','incorrect_client_credentials','incorrect_device_code','unsupported_grant_type','oauth_error','local_disconnect']);
6
6
  /** Allowlisted metadata only. Never accept messages, URLs, queries or tokens. */
7
7
  export function createDiagnostics(root,{now=Date.now}={}){
8
8
  const file=path.join(root,'diagnostics.jsonl'),last=new Map();
@@ -2,7 +2,7 @@ import {mkdirSync,appendFileSync,statSync,readFileSync,writeFileSync} from 'node
2
2
  import path from 'node:path';
3
3
  const events=new Set(['plugin_started','plugin_stopped','credential_read','credential_saved','logout','oauth_started','oauth_waiting','oauth_retry','oauth_failed','api_response','api_failure']);
4
4
  const categories=new Set(['account','search','repository','upload','authorization']);
5
- const reasons=new Set(['ok','missing','read_failed','decrypt_failed','invalid_local','invalid_credentials','forbidden','rate_limited','server_error','tls_error','dns_error','connection_error','network_error','timeout','authorization_failed','access_denied','expired_token','device_flow_disabled','incorrect_client_credentials','incorrect_device_code','unsupported_grant_type','oauth_error','local_disconnect']);
5
+ const reasons=new Set(['ok','missing','read_failed','decrypt_failed','keychain_unavailable','invalid_local','invalid_credentials','forbidden','rate_limited','server_error','tls_error','dns_error','connection_error','network_error','timeout','authorization_failed','access_denied','expired_token','device_flow_disabled','incorrect_client_credentials','incorrect_device_code','unsupported_grant_type','oauth_error','local_disconnect']);
6
6
  /** Allowlisted metadata only. Never accept messages, URLs, queries or tokens. */
7
7
  export function createDiagnostics(root,{now=Date.now}={}){
8
8
  const file=path.join(root,'diagnostics.jsonl'),last=new Map();
package/lib/dsh-go.js ADDED
@@ -0,0 +1,148 @@
1
+ import {oauthRegistrationUrl,oauthHomepage} from './oauth-setup.mjs';
2
+
3
+ const panelId = 'github-account';
4
+ const activeLogin = login => login.state === 'preparing' || login.state === 'waiting';
5
+ const toast = text => ({type: 'toast', text});
6
+
7
+ export function githubMobileView() {
8
+ return {
9
+ v: 2, type: 'stack', title: 'GitHub',
10
+ children: [
11
+ {type: 'text', text: {$: 'data.status'}},
12
+ {type: 'collapsible', label: '首次登录?配置 GitHub OAuth App', children: [
13
+ {type: 'text', text: '已有启用了设备流的 OAuth App?直接用原来的 Client ID,同一个 ID 可用于电脑和手机。'},
14
+ {type: 'actions', items: [{label: '打开 OAuth App 注册页', action: 'register-app'}]},
15
+ {type: 'text', text: '应用名称可填 DeepSeek GitHub Studio。应用描述可留空。'},
16
+ {type: 'text', text: '主页 URL 填 ' + oauthHomepage},
17
+ {type: 'text', text: '重定向 URI 填和主页 URL 一样的仓库地址。通配符保持关闭。'},
18
+ {type: 'actions', items: [
19
+ {label: '复制主页 URL', action: 'copy-homepage'},
20
+ {label: '复制重定向 URI', action: 'copy-redirect'}
21
+ ]},
22
+ {type: 'text', text: '勾选「启用设备流」后注册。复制应用详情里的 Client ID,粘贴到下方并保存。无需 Client Secret。'},
23
+ {type: 'text', text: '点「登录 GitHub」获取设备码,再打开授权页,输入设备码并确认。'}
24
+ ]},
25
+ {type: 'form', submit: 'configure', submitLabel: '保存 Client ID', children: [
26
+ {type: 'textField', label: 'OAuth App Client ID', bind: 'data.form.clientId',
27
+ placeholder: '粘贴你的 Client ID', minLength: 5, maxLength: 120, required: true}
28
+ ]},
29
+ {type: 'actions', items: [
30
+ {label: '登录 GitHub', action: 'login'},
31
+ {label: '打开授权页', action: 'authorize'}
32
+ ]},
33
+ {type: 'actions', items: [
34
+ {label: '复制设备码', action: 'copy-code'},
35
+ {label: '取消登录', action: 'cancel'},
36
+ {label: '刷新状态', action: 'refresh'}
37
+ ]},
38
+ {type: 'confirm', id: 'disconnect', text: '断开当前 GitHub 连接?',
39
+ confirmLabel: '断开连接', cancelLabel: '取消'},
40
+ {type: 'text', tone: 'muted', text: '浏览仓库、发布版本和确认写入,请在 DSH Go 的网页版打开「设置 → GitHub」。'}
41
+ ]
42
+ };
43
+ }
44
+
45
+ export function registerMobilePanel(ctx, {auth, api, ops}) {
46
+ const listeners = new Set();
47
+ let account = '', error = '', clientId = '', version = 0, timer;
48
+ let checking;
49
+ const status = () => {
50
+ const {state, code, message} = auth.login;
51
+ if (state === 'waiting') return '设备码:' + code + (message ? '\n' + message : '');
52
+ if (state === 'preparing') return message || '正在请求 GitHub 设备码…';
53
+ if (state === 'error') return message || 'GitHub 授权失败';
54
+ return error || (account ? '已连接 @' + account : '尚未连接 GitHub');
55
+ };
56
+ const snapshot = () => ({status: status().slice(0, 400), form: {clientId}});
57
+ const publish = () => { for (const emit of listeners) emit(snapshot()); };
58
+ const refresh = () => {
59
+ if (checking) return checking;
60
+ const generation = version;
61
+ checking = (async () => {
62
+ const id = await auth.clientId();
63
+ let user = '', failure = '';
64
+ if (!activeLogin(auth.login) && await auth.hasCredential()) {
65
+ try { user = (await api.me()).login; }
66
+ catch (e) { failure = e.message; }
67
+ }
68
+ if (generation === version) {
69
+ clientId = id || '';
70
+ account = user || '';
71
+ error = failure;
72
+ publish();
73
+ }
74
+ })().finally(() => { checking = undefined; });
75
+ return checking;
76
+ };
77
+ const refreshInBackground = () => refresh().catch(() => {});
78
+ const background = action => ({
79
+ pending: {label: 'GitHub', timeoutMs: 30000},
80
+ async result() {
81
+ try { return await action(); }
82
+ catch (e) { return toast(e.message.slice(0, 40)); }
83
+ }
84
+ });
85
+ ctx.dshGo.panel(panelId, {
86
+ view: githubMobileView,
87
+ data(_scope, emit) {
88
+ listeners.add(emit);
89
+ emit(snapshot());
90
+ if (!timer) {
91
+ refreshInBackground();
92
+ let last = auth.login.state;
93
+ timer = setInterval(() => {
94
+ publish();
95
+ const state = auth.login.state;
96
+ if (state !== last && !activeLogin(auth.login)) refreshInBackground();
97
+ last = state;
98
+ }, 2000);
99
+ timer.unref?.();
100
+ }
101
+ return () => {
102
+ listeners.delete(emit);
103
+ if (!listeners.size) { clearInterval(timer); timer = undefined; }
104
+ };
105
+ },
106
+ actions: {
107
+ 'register-app': () => ({type: 'link', url: oauthRegistrationUrl}),
108
+ 'copy-homepage': () => ({type: 'copy', text: oauthHomepage}),
109
+ 'copy-redirect': () => ({type: 'copy', text: oauthHomepage}),
110
+ configure: (_scope, event) => background(async () => {
111
+ const value = event.value?.values?.['data.form.clientId'];
112
+ if (typeof value !== 'string') return toast('请输入 Client ID');
113
+ await auth.configure(value.trim());
114
+ version++;
115
+ clientId = value.trim();
116
+ publish();
117
+ return toast('Client ID 已保存');
118
+ }),
119
+ async login() {
120
+ try {
121
+ await auth.start();
122
+ publish();
123
+ auth.task?.then(refreshInBackground);
124
+ } catch (e) { publish(); return toast(e.message.slice(0, 40)); }
125
+ },
126
+ authorize: () => auth.login.state === 'waiting'
127
+ ? {type: 'link', url: 'https://github.com/login/device'} : toast('请先获取设备码'),
128
+ 'copy-code': () => auth.login.state === 'waiting' && auth.login.code
129
+ ? {type: 'copy', text: auth.login.code} : toast('暂无设备码'),
130
+ cancel() {
131
+ if (activeLogin(auth.login)) { auth.cancel(); publish(); }
132
+ },
133
+ refresh: () => background(async () => { await refresh(); return toast('状态已刷新'); }),
134
+ disconnect: (_scope, event) => {
135
+ if (event.value?.confirmed !== true) return;
136
+ return background(async () => {
137
+ await auth.logout();
138
+ ops.clearPending();
139
+ version++;
140
+ account = '';
141
+ error = '';
142
+ publish();
143
+ return toast('已断开 GitHub 连接');
144
+ });
145
+ }
146
+ }
147
+ });
148
+ }
package/lib/dsh-go.mjs ADDED
@@ -0,0 +1,148 @@
1
+ import {oauthRegistrationUrl,oauthHomepage} from './oauth-setup.mjs';
2
+
3
+ const panelId = 'github-account';
4
+ const activeLogin = login => login.state === 'preparing' || login.state === 'waiting';
5
+ const toast = text => ({type: 'toast', text});
6
+
7
+ export function githubMobileView() {
8
+ return {
9
+ v: 2, type: 'stack', title: 'GitHub',
10
+ children: [
11
+ {type: 'text', text: {$: 'data.status'}},
12
+ {type: 'collapsible', label: '首次登录?配置 GitHub OAuth App', children: [
13
+ {type: 'text', text: '已有启用了设备流的 OAuth App?直接用原来的 Client ID,同一个 ID 可用于电脑和手机。'},
14
+ {type: 'actions', items: [{label: '打开 OAuth App 注册页', action: 'register-app'}]},
15
+ {type: 'text', text: '应用名称可填 DeepSeek GitHub Studio。应用描述可留空。'},
16
+ {type: 'text', text: '主页 URL 填 ' + oauthHomepage},
17
+ {type: 'text', text: '重定向 URI 填和主页 URL 一样的仓库地址。通配符保持关闭。'},
18
+ {type: 'actions', items: [
19
+ {label: '复制主页 URL', action: 'copy-homepage'},
20
+ {label: '复制重定向 URI', action: 'copy-redirect'}
21
+ ]},
22
+ {type: 'text', text: '勾选「启用设备流」后注册。复制应用详情里的 Client ID,粘贴到下方并保存。无需 Client Secret。'},
23
+ {type: 'text', text: '点「登录 GitHub」获取设备码,再打开授权页,输入设备码并确认。'}
24
+ ]},
25
+ {type: 'form', submit: 'configure', submitLabel: '保存 Client ID', children: [
26
+ {type: 'textField', label: 'OAuth App Client ID', bind: 'data.form.clientId',
27
+ placeholder: '粘贴你的 Client ID', minLength: 5, maxLength: 120, required: true}
28
+ ]},
29
+ {type: 'actions', items: [
30
+ {label: '登录 GitHub', action: 'login'},
31
+ {label: '打开授权页', action: 'authorize'}
32
+ ]},
33
+ {type: 'actions', items: [
34
+ {label: '复制设备码', action: 'copy-code'},
35
+ {label: '取消登录', action: 'cancel'},
36
+ {label: '刷新状态', action: 'refresh'}
37
+ ]},
38
+ {type: 'confirm', id: 'disconnect', text: '断开当前 GitHub 连接?',
39
+ confirmLabel: '断开连接', cancelLabel: '取消'},
40
+ {type: 'text', tone: 'muted', text: '浏览仓库、发布版本和确认写入,请在 DSH Go 的网页版打开「设置 → GitHub」。'}
41
+ ]
42
+ };
43
+ }
44
+
45
+ export function registerMobilePanel(ctx, {auth, api, ops}) {
46
+ const listeners = new Set();
47
+ let account = '', error = '', clientId = '', version = 0, timer;
48
+ let checking;
49
+ const status = () => {
50
+ const {state, code, message} = auth.login;
51
+ if (state === 'waiting') return '设备码:' + code + (message ? '\n' + message : '');
52
+ if (state === 'preparing') return message || '正在请求 GitHub 设备码…';
53
+ if (state === 'error') return message || 'GitHub 授权失败';
54
+ return error || (account ? '已连接 @' + account : '尚未连接 GitHub');
55
+ };
56
+ const snapshot = () => ({status: status().slice(0, 400), form: {clientId}});
57
+ const publish = () => { for (const emit of listeners) emit(snapshot()); };
58
+ const refresh = () => {
59
+ if (checking) return checking;
60
+ const generation = version;
61
+ checking = (async () => {
62
+ const id = await auth.clientId();
63
+ let user = '', failure = '';
64
+ if (!activeLogin(auth.login) && await auth.hasCredential()) {
65
+ try { user = (await api.me()).login; }
66
+ catch (e) { failure = e.message; }
67
+ }
68
+ if (generation === version) {
69
+ clientId = id || '';
70
+ account = user || '';
71
+ error = failure;
72
+ publish();
73
+ }
74
+ })().finally(() => { checking = undefined; });
75
+ return checking;
76
+ };
77
+ const refreshInBackground = () => refresh().catch(() => {});
78
+ const background = action => ({
79
+ pending: {label: 'GitHub', timeoutMs: 30000},
80
+ async result() {
81
+ try { return await action(); }
82
+ catch (e) { return toast(e.message.slice(0, 40)); }
83
+ }
84
+ });
85
+ ctx.dshGo.panel(panelId, {
86
+ view: githubMobileView,
87
+ data(_scope, emit) {
88
+ listeners.add(emit);
89
+ emit(snapshot());
90
+ if (!timer) {
91
+ refreshInBackground();
92
+ let last = auth.login.state;
93
+ timer = setInterval(() => {
94
+ publish();
95
+ const state = auth.login.state;
96
+ if (state !== last && !activeLogin(auth.login)) refreshInBackground();
97
+ last = state;
98
+ }, 2000);
99
+ timer.unref?.();
100
+ }
101
+ return () => {
102
+ listeners.delete(emit);
103
+ if (!listeners.size) { clearInterval(timer); timer = undefined; }
104
+ };
105
+ },
106
+ actions: {
107
+ 'register-app': () => ({type: 'link', url: oauthRegistrationUrl}),
108
+ 'copy-homepage': () => ({type: 'copy', text: oauthHomepage}),
109
+ 'copy-redirect': () => ({type: 'copy', text: oauthHomepage}),
110
+ configure: (_scope, event) => background(async () => {
111
+ const value = event.value?.values?.['data.form.clientId'];
112
+ if (typeof value !== 'string') return toast('请输入 Client ID');
113
+ await auth.configure(value.trim());
114
+ version++;
115
+ clientId = value.trim();
116
+ publish();
117
+ return toast('Client ID 已保存');
118
+ }),
119
+ async login() {
120
+ try {
121
+ await auth.start();
122
+ publish();
123
+ auth.task?.then(refreshInBackground);
124
+ } catch (e) { publish(); return toast(e.message.slice(0, 40)); }
125
+ },
126
+ authorize: () => auth.login.state === 'waiting'
127
+ ? {type: 'link', url: 'https://github.com/login/device'} : toast('请先获取设备码'),
128
+ 'copy-code': () => auth.login.state === 'waiting' && auth.login.code
129
+ ? {type: 'copy', text: auth.login.code} : toast('暂无设备码'),
130
+ cancel() {
131
+ if (activeLogin(auth.login)) { auth.cancel(); publish(); }
132
+ },
133
+ refresh: () => background(async () => { await refresh(); return toast('状态已刷新'); }),
134
+ disconnect: (_scope, event) => {
135
+ if (event.value?.confirmed !== true) return;
136
+ return background(async () => {
137
+ await auth.logout();
138
+ ops.clearPending();
139
+ version++;
140
+ account = '';
141
+ error = '';
142
+ publish();
143
+ return toast('已断开 GitHub 连接');
144
+ });
145
+ }
146
+ }
147
+ });
148
+ }
package/lib/gh.js CHANGED
@@ -1,25 +1,31 @@
1
1
  import {setTimeout as delay} from 'node:timers/promises';
2
- import {randomUUID} from 'node:crypto';
3
2
  import {networkFailure} from './network.mjs';
4
- import {spawn} from 'node:child_process';
5
- import {mkdir,readFile,writeFile,unlink,rename} from 'node:fs/promises';
3
+ import {credentialStore as platformCredentialStore} from './credential-store.mjs';
4
+ import {mkdir,readFile,writeFile} from 'node:fs/promises';
6
5
  import path from 'node:path';
7
- export function command(exe,args,{input='',timeout=30000}={}){return new Promise((resolve,reject)=>{const child=spawn(exe,args,{windowsHide:true,stdio:['pipe','pipe','pipe']});let stdout='';const timer=setTimeout(()=>{child.kill();reject(Error('凭据操作超时。'));},timeout);child.on('error',e=>{clearTimeout(timer);reject(e);});child.stdout.on('data',b=>stdout+=b);child.stderr.resume();child.on('close',code=>{clearTimeout(timer);resolve({code,stdout});});child.stdin.on('error',()=>{});child.stdin.end(input);});}
8
- export async function windowsSeal(action,value){if(process.platform!=='win32')throw Error('本版凭据保护仅支持 Windows。');const operation=action==='protect'?'Protect':'Unprotect';const script=`Add-Type -AssemblyName System.Security; $b=[Convert]::FromBase64String([Console]::In.ReadToEnd().Trim()); $r=[Security.Cryptography.ProtectedData]::${operation}($b,$null,[Security.Cryptography.DataProtectionScope]::CurrentUser); [Console]::Write([Convert]::ToBase64String($r))`;const r=await command('powershell.exe',['-NoProfile','-NonInteractive','-Command',script],{input:action==='protect'?Buffer.from(value,'utf8').toString('base64'):value});if(r.code!==0)throw Error('Windows 凭据加密失败。');return action==='protect'?r.stdout.trim():Buffer.from(r.stdout.trim(),'base64').toString('utf8');}
6
+ export {command,windowsSeal} from './credential-store.mjs';
9
7
 
10
8
  export class GhAuth{
11
- constructor(root,{fetchImpl=fetch,seal=windowsSeal,sleep=(ms,signal)=>delay(ms,undefined,{signal}),diagnostics=()=>{},now=Date.now}={}){
12
- Object.assign(this,{root,fetch:fetchImpl,seal,sleep,diagnostics,now});this.login={state:'idle'};this.epoch=0;
9
+ constructor(root,{fetchImpl=fetch,seal,credentialStore=platformCredentialStore(root,seal),sleep=(ms,signal)=>delay(ms,undefined,{signal}),diagnostics=()=>{},now=Date.now}={}){
10
+ Object.assign(this,{root,fetch:fetchImpl,credentialStore,sleep,diagnostics,now});this.login={state:'idle'};this.epoch=0;
13
11
  }
14
12
  async clientId(){try{return JSON.parse(await readFile(path.join(this.root,'oauth.json'),'utf8')).clientId;}catch{if(process.env.DSH_GITHUB_CLIENT_ID)return process.env.DSH_GITHUB_CLIENT_ID;try{return JSON.parse(await readFile(new URL('./publisher.json',import.meta.url),'utf8')).clientId??'';}catch{return '';}}}
15
13
  async configure(clientId){if(!/^[A-Za-z0-9_.-]{5,120}$/.test(clientId))throw Error('请输入有效的 OAuth App Client ID。');if(['preparing','waiting'].includes(this.login.state))throw Error('请先完成或取消当前登录。');await mkdir(this.root,{recursive:true});await writeFile(path.join(this.root,'oauth.json'),JSON.stringify({clientId}));}
16
- async hasCredential(){try{await readFile(path.join(this.root,'credential.dpapi'));return true;}catch{return false;}}
14
+ async hasCredential(){try{return await this.credentialStore.exists();}catch{return false;}}
17
15
  async credential(){
18
- let encrypted;try{encrypted=await readFile(path.join(this.root,'credential.dpapi'),'utf8');}catch(e){this.diagnostics('credential_read',{reason:e.code==='ENOENT'?'missing':'read_failed',hasCredential:false});throw Object.assign(Error('请先在设置 → GitHub 中登录。'),{status:401});}
19
- let plain;try{plain=await this.seal('unprotect',encrypted);}catch{this.diagnostics('credential_read',{reason:'decrypt_failed',hasCredential:true});throw Object.assign(Error('本机 GitHub 凭据无法解密,请重新连接。'),{status:401});}
16
+ let plain;
17
+ try { plain = await this.credentialStore.read(); }
18
+ catch (error) {
19
+ this.diagnostics('credential_read',{reason:error.reason??'read_failed',hasCredential:error.hasCredential});
20
+ throw error.status ? error : Object.assign(Error('无法读取本机 GitHub 凭据。'),{status:503});
21
+ }
22
+ if(plain===null){
23
+ this.diagnostics('credential_read',{reason:'missing',hasCredential:false});
24
+ throw Object.assign(Error('请先在设置 → GitHub 中登录。'),{status:401});
25
+ }
20
26
  if(typeof plain!=='string'||!plain.trim()){this.diagnostics('credential_read',{reason:'invalid_local',hasCredential:true});throw Object.assign(Error('本机 GitHub 凭据为空,请重新连接。'),{status:401});}
21
27
  let data;if(plain.startsWith('{')){try{data=JSON.parse(plain);}catch{throw Object.assign(Error('本机 GitHub 凭据损坏,请重新连接。'),{status:401});}}else data={access_token:plain};
22
- if(typeof data.access_token!=='string'||!data.access_token.trim())throw Object.assign(Error('本机 GitHub 凭据无效,请重新连接。'),{status:401});
28
+ if(typeof data?.access_token!=='string'||!data.access_token.trim())throw Object.assign(Error('本机 GitHub 凭据无效,请重新连接。'),{status:401});
23
29
  this.diagnostics('credential_read',{reason:'ok',hasCredential:true});return data;
24
30
  }
25
31
  async save(r,epoch,clientId){
@@ -27,8 +33,13 @@ export class GhAuth{
27
33
  const data={access_token:r.access_token,clientId,...(typeof r.refresh_token==='string'?{refresh_token:r.refresh_token}:{}),
28
34
  ...(Number(r.expires_in)>0?{expiresAt:this.now()+Number(r.expires_in)*1000}:{}),
29
35
  ...(Number(r.refresh_token_expires_in)>0?{refreshExpiresAt:this.now()+Number(r.refresh_token_expires_in)*1000}:{})};
30
- await mkdir(this.root,{recursive:true});const temp=path.join(this.root,'credential-'+randomUUID()+'.tmp');
31
- try{await writeFile(temp,await this.seal('protect',JSON.stringify(data)),{mode:0o600});await this.mutate(async()=>{if(epoch!==this.epoch)throw new DOMException('登录已取消。','AbortError');await rename(temp,path.join(this.root,'credential.dpapi'));});}finally{await unlink(temp).catch(()=>{});}
36
+ const checkCurrent = ()=>{
37
+ if(epoch!==this.epoch)throw new DOMException('登录已取消。','AbortError');
38
+ };
39
+ await this.mutate(async()=>{
40
+ checkCurrent();
41
+ await this.credentialStore.write(JSON.stringify(data),checkCurrent);
42
+ });
32
43
  this.diagnostics('credential_saved',{reason:'ok',hasCredential:true});return data.access_token;
33
44
  }
34
45
  async token(){const d=await this.credential();if(!['preparing','waiting'].includes(this.login.state)&&d.refresh_token&&d.expiresAt&&this.now()>=d.expiresAt-60000)return this.refresh(d);return d.access_token;}
@@ -92,7 +103,7 @@ export class GhAuth{
92
103
  }
93
104
  cancel(){++this.epoch;this.controller?.abort();this.refreshController?.abort();this.login={state:'idle'};}
94
105
  mutate(fn){const task=(this.mutation??Promise.resolve()).catch(()=>{}).then(fn);this.mutation=task;return task;}
95
- async logout(){this.cancel();await this.mutate(()=>unlink(path.join(this.root,'credential.dpapi')).catch(e=>{if(e.code!=='ENOENT')throw e;}));this.diagnostics('logout',{reason:'local_disconnect',hasCredential:false});}
106
+ async logout(){this.cancel();await this.mutate(()=>this.credentialStore.remove());this.diagnostics('logout',{reason:'local_disconnect',hasCredential:false});}
96
107
  dispose(){this.cancel();}
97
108
  }
98
109
 
package/lib/gh.mjs CHANGED
@@ -1,25 +1,31 @@
1
1
  import {setTimeout as delay} from 'node:timers/promises';
2
- import {randomUUID} from 'node:crypto';
3
2
  import {networkFailure} from './network.mjs';
4
- import {spawn} from 'node:child_process';
5
- import {mkdir,readFile,writeFile,unlink,rename} from 'node:fs/promises';
3
+ import {credentialStore as platformCredentialStore} from './credential-store.mjs';
4
+ import {mkdir,readFile,writeFile} from 'node:fs/promises';
6
5
  import path from 'node:path';
7
- export function command(exe,args,{input='',timeout=30000}={}){return new Promise((resolve,reject)=>{const child=spawn(exe,args,{windowsHide:true,stdio:['pipe','pipe','pipe']});let stdout='';const timer=setTimeout(()=>{child.kill();reject(Error('凭据操作超时。'));},timeout);child.on('error',e=>{clearTimeout(timer);reject(e);});child.stdout.on('data',b=>stdout+=b);child.stderr.resume();child.on('close',code=>{clearTimeout(timer);resolve({code,stdout});});child.stdin.on('error',()=>{});child.stdin.end(input);});}
8
- export async function windowsSeal(action,value){if(process.platform!=='win32')throw Error('本版凭据保护仅支持 Windows。');const operation=action==='protect'?'Protect':'Unprotect';const script=`Add-Type -AssemblyName System.Security; $b=[Convert]::FromBase64String([Console]::In.ReadToEnd().Trim()); $r=[Security.Cryptography.ProtectedData]::${operation}($b,$null,[Security.Cryptography.DataProtectionScope]::CurrentUser); [Console]::Write([Convert]::ToBase64String($r))`;const r=await command('powershell.exe',['-NoProfile','-NonInteractive','-Command',script],{input:action==='protect'?Buffer.from(value,'utf8').toString('base64'):value});if(r.code!==0)throw Error('Windows 凭据加密失败。');return action==='protect'?r.stdout.trim():Buffer.from(r.stdout.trim(),'base64').toString('utf8');}
6
+ export {command,windowsSeal} from './credential-store.mjs';
9
7
 
10
8
  export class GhAuth{
11
- constructor(root,{fetchImpl=fetch,seal=windowsSeal,sleep=(ms,signal)=>delay(ms,undefined,{signal}),diagnostics=()=>{},now=Date.now}={}){
12
- Object.assign(this,{root,fetch:fetchImpl,seal,sleep,diagnostics,now});this.login={state:'idle'};this.epoch=0;
9
+ constructor(root,{fetchImpl=fetch,seal,credentialStore=platformCredentialStore(root,seal),sleep=(ms,signal)=>delay(ms,undefined,{signal}),diagnostics=()=>{},now=Date.now}={}){
10
+ Object.assign(this,{root,fetch:fetchImpl,credentialStore,sleep,diagnostics,now});this.login={state:'idle'};this.epoch=0;
13
11
  }
14
12
  async clientId(){try{return JSON.parse(await readFile(path.join(this.root,'oauth.json'),'utf8')).clientId;}catch{if(process.env.DSH_GITHUB_CLIENT_ID)return process.env.DSH_GITHUB_CLIENT_ID;try{return JSON.parse(await readFile(new URL('./publisher.json',import.meta.url),'utf8')).clientId??'';}catch{return '';}}}
15
13
  async configure(clientId){if(!/^[A-Za-z0-9_.-]{5,120}$/.test(clientId))throw Error('请输入有效的 OAuth App Client ID。');if(['preparing','waiting'].includes(this.login.state))throw Error('请先完成或取消当前登录。');await mkdir(this.root,{recursive:true});await writeFile(path.join(this.root,'oauth.json'),JSON.stringify({clientId}));}
16
- async hasCredential(){try{await readFile(path.join(this.root,'credential.dpapi'));return true;}catch{return false;}}
14
+ async hasCredential(){try{return await this.credentialStore.exists();}catch{return false;}}
17
15
  async credential(){
18
- let encrypted;try{encrypted=await readFile(path.join(this.root,'credential.dpapi'),'utf8');}catch(e){this.diagnostics('credential_read',{reason:e.code==='ENOENT'?'missing':'read_failed',hasCredential:false});throw Object.assign(Error('请先在设置 → GitHub 中登录。'),{status:401});}
19
- let plain;try{plain=await this.seal('unprotect',encrypted);}catch{this.diagnostics('credential_read',{reason:'decrypt_failed',hasCredential:true});throw Object.assign(Error('本机 GitHub 凭据无法解密,请重新连接。'),{status:401});}
16
+ let plain;
17
+ try { plain = await this.credentialStore.read(); }
18
+ catch (error) {
19
+ this.diagnostics('credential_read',{reason:error.reason??'read_failed',hasCredential:error.hasCredential});
20
+ throw error.status ? error : Object.assign(Error('无法读取本机 GitHub 凭据。'),{status:503});
21
+ }
22
+ if(plain===null){
23
+ this.diagnostics('credential_read',{reason:'missing',hasCredential:false});
24
+ throw Object.assign(Error('请先在设置 → GitHub 中登录。'),{status:401});
25
+ }
20
26
  if(typeof plain!=='string'||!plain.trim()){this.diagnostics('credential_read',{reason:'invalid_local',hasCredential:true});throw Object.assign(Error('本机 GitHub 凭据为空,请重新连接。'),{status:401});}
21
27
  let data;if(plain.startsWith('{')){try{data=JSON.parse(plain);}catch{throw Object.assign(Error('本机 GitHub 凭据损坏,请重新连接。'),{status:401});}}else data={access_token:plain};
22
- if(typeof data.access_token!=='string'||!data.access_token.trim())throw Object.assign(Error('本机 GitHub 凭据无效,请重新连接。'),{status:401});
28
+ if(typeof data?.access_token!=='string'||!data.access_token.trim())throw Object.assign(Error('本机 GitHub 凭据无效,请重新连接。'),{status:401});
23
29
  this.diagnostics('credential_read',{reason:'ok',hasCredential:true});return data;
24
30
  }
25
31
  async save(r,epoch,clientId){
@@ -27,8 +33,13 @@ export class GhAuth{
27
33
  const data={access_token:r.access_token,clientId,...(typeof r.refresh_token==='string'?{refresh_token:r.refresh_token}:{}),
28
34
  ...(Number(r.expires_in)>0?{expiresAt:this.now()+Number(r.expires_in)*1000}:{}),
29
35
  ...(Number(r.refresh_token_expires_in)>0?{refreshExpiresAt:this.now()+Number(r.refresh_token_expires_in)*1000}:{})};
30
- await mkdir(this.root,{recursive:true});const temp=path.join(this.root,'credential-'+randomUUID()+'.tmp');
31
- try{await writeFile(temp,await this.seal('protect',JSON.stringify(data)),{mode:0o600});await this.mutate(async()=>{if(epoch!==this.epoch)throw new DOMException('登录已取消。','AbortError');await rename(temp,path.join(this.root,'credential.dpapi'));});}finally{await unlink(temp).catch(()=>{});}
36
+ const checkCurrent = ()=>{
37
+ if(epoch!==this.epoch)throw new DOMException('登录已取消。','AbortError');
38
+ };
39
+ await this.mutate(async()=>{
40
+ checkCurrent();
41
+ await this.credentialStore.write(JSON.stringify(data),checkCurrent);
42
+ });
32
43
  this.diagnostics('credential_saved',{reason:'ok',hasCredential:true});return data.access_token;
33
44
  }
34
45
  async token(){const d=await this.credential();if(!['preparing','waiting'].includes(this.login.state)&&d.refresh_token&&d.expiresAt&&this.now()>=d.expiresAt-60000)return this.refresh(d);return d.access_token;}
@@ -92,7 +103,7 @@ export class GhAuth{
92
103
  }
93
104
  cancel(){++this.epoch;this.controller?.abort();this.refreshController?.abort();this.login={state:'idle'};}
94
105
  mutate(fn){const task=(this.mutation??Promise.resolve()).catch(()=>{}).then(fn);this.mutation=task;return task;}
95
- async logout(){this.cancel();await this.mutate(()=>unlink(path.join(this.root,'credential.dpapi')).catch(e=>{if(e.code!=='ENOENT')throw e;}));this.diagnostics('logout',{reason:'local_disconnect',hasCredential:false});}
106
+ async logout(){this.cancel();await this.mutate(()=>this.credentialStore.remove());this.diagnostics('logout',{reason:'local_disconnect',hasCredential:false});}
96
107
  dispose(){this.cancel();}
97
108
  }
98
109
 
package/lib/index.js CHANGED
@@ -2,6 +2,8 @@ import os from 'node:os';
2
2
  import path from 'node:path';
3
3
  import {createTransport} from './network.mjs';
4
4
  import {GhAuth} from './gh.mjs';
5
+ import {harnessCredentialStore} from './credential-store.mjs';
6
+ import {registerMobilePanel} from './dsh-go.mjs';
5
7
  import {GitHub,Operations} from './core.mjs';
6
8
  import {routes} from './http.mjs';
7
9
  import {definitions,localAgent} from './tools.mjs';
@@ -15,11 +17,14 @@ export function apply(ctx){
15
17
  const root=path.join(process.env.DSH_HOME??path.join(os.homedir(),'.dsh'),'github-connect');
16
18
  const diagnostics=createDiagnostics(root);diagnostics('plugin_started');
17
19
  const transport=createTransport();
18
- const auth=new GhAuth(root,{diagnostics,fetchImpl:transport.fetch}),api=new GitHub({auth,diagnostics,fetchImpl:transport.fetch}),ops=new Operations(api,{root});await ops.init();
20
+ // Read the live service so Linux does not depend on plugin startup order.
21
+ const credentialStore=process.platform==='linux'?harnessCredentialStore(()=>host.get('credentials')):undefined;
22
+ const auth=new GhAuth(root,{diagnostics,fetchImpl:transport.fetch,credentialStore}),api=new GitHub({auth,diagnostics,fetchImpl:transport.fetch}),ops=new Operations(api,{root});await ops.init();
19
23
  const releaseCopy=new ReleaseCopy({api,ctx:host,root,ops});
20
24
  const drafts=new Drafts({root});
21
25
  for(const route of routes({api,ops,auth,root,releaseCopy,drafts,connection:()=>host.get('connection')}))host.effect(()=>host.webServer.register(route));
22
26
  for(const definition of definitions(api,ops))host.effect(()=>host.tools.register(definition,{when:({agent})=>localAgent(agent)}));
27
+ host.inject?.(['dshGo'],mobile=>registerMobilePanel(mobile,{auth,api,ops}));
23
28
  host.on('dispose',()=>{diagnostics('plugin_stopped');auth.dispose();transport.close().catch(()=>{});ops.clearPending();});
24
29
  });
25
30
  }
package/lib/network.js CHANGED
@@ -2,7 +2,7 @@ import tls from 'node:tls';
2
2
  import {EnvHttpProxyAgent,fetch as undiciFetch} from 'undici';
3
3
 
4
4
  const messages={
5
- tls_error:'GitHub HTTPS 证书校验失败。请检查加速器证书是否已正确安装到 Windows 信任证书库,或暂时关闭 GitHub 加速。',
5
+ tls_error:'GitHub HTTPS 证书校验失败。请检查加速器证书是否已加入系统信任证书,或暂时关闭 GitHub 加速。',
6
6
  dns_error:'无法解析 GitHub 地址,请检查 DNS 或加速器的域名接管。',
7
7
  timeout:'连接 GitHub 超时,请检查网络或代理线路。',
8
8
  connection_error:'GitHub 连接中断或代理端口不可用,请检查加速器和代理设置。',
package/lib/network.mjs CHANGED
@@ -2,7 +2,7 @@ import tls from 'node:tls';
2
2
  import {EnvHttpProxyAgent,fetch as undiciFetch} from 'undici';
3
3
 
4
4
  const messages={
5
- tls_error:'GitHub HTTPS 证书校验失败。请检查加速器证书是否已正确安装到 Windows 信任证书库,或暂时关闭 GitHub 加速。',
5
+ tls_error:'GitHub HTTPS 证书校验失败。请检查加速器证书是否已加入系统信任证书,或暂时关闭 GitHub 加速。',
6
6
  dns_error:'无法解析 GitHub 地址,请检查 DNS 或加速器的域名接管。',
7
7
  timeout:'连接 GitHub 超时,请检查网络或代理线路。',
8
8
  connection_error:'GitHub 连接中断或代理端口不可用,请检查加速器和代理设置。',
@@ -0,0 +1,2 @@
1
+ export const oauthRegistrationUrl = 'https://github.com/settings/applications/new';
2
+ export const oauthHomepage = 'https://github.com/zhaohaix/DeepSeek-GitHub';
@@ -0,0 +1,2 @@
1
+ export const oauthRegistrationUrl = 'https://github.com/settings/applications/new';
2
+ export const oauthHomepage = 'https://github.com/zhaohaix/DeepSeek-GitHub';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-github-studio",
3
- "version": "0.6.7",
3
+ "version": "0.7.1",
4
4
  "description": "DeepSeek Harness GitHub 工作台:账号连接、仓库工具、AI 项目介绍与 Release 发布",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -28,6 +28,24 @@
28
28
  "platform": "web"
29
29
  }
30
30
  },
31
+ "dshGo": {
32
+ "v": 1,
33
+ "title": "GitHub Studio",
34
+ "icon": "code",
35
+ "contributes": {
36
+ "panels": [
37
+ {
38
+ "id": "github-account",
39
+ "title": "GitHub",
40
+ "icon": "code",
41
+ "placement": [
42
+ "plugin",
43
+ "features"
44
+ ]
45
+ }
46
+ ]
47
+ }
48
+ },
31
49
  "author": "zhaohaix",
32
50
  "homepage": "https://github.com/zhaohaix/DeepSeek-GitHub#readme",
33
51
  "repository": {