dsh-session-superagent 0.9.174 → 0.9.176
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +77 -0
- package/README.md +2 -2
- package/client.js +10 -3
- package/lib/index.js +38 -3
- package/lib/watch.js +11 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,83 @@
|
|
|
2
2
|
|
|
3
3
|
格式参照 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),版本号遵循 [语义化版本](https://semver.org/lang/zh-CN/)。
|
|
4
4
|
|
|
5
|
+
## [0.9.176] - 2026-11-04 —— 凭证页出图核对 + 历史 Release 补了一批
|
|
6
|
+
|
|
7
|
+
### 真机界面(本轮出图核对)
|
|
8
|
+
「设置 → 凭证」新增的「gh 账号」一行与「gh 账号目录」输入框已渲染正确:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
GitHub token 已配置
|
|
12
|
+
SSH 私钥 未配置(当前版本不使用)
|
|
13
|
+
gh 账号 宿主当前登录的账号
|
|
14
|
+
|
|
15
|
+
Token [ghp_… / github_pat_…(留空不改)]
|
|
16
|
+
gh 账号目录 [绝对路径(留空 = 用宿主账号)]
|
|
17
|
+
[保存凭证]
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
顺手把占位文案从「绝对路径;只想让它用自己的账号时填(留空 = 用宿主账号)」
|
|
21
|
+
缩到「绝对路径(留空 = 用宿主账号)」—— 窄面板里原来会被截断,说明挪到底下的 Hint 里。
|
|
22
|
+
|
|
23
|
+
### 历史 Release 补批
|
|
24
|
+
`release-gh.mjs` 新增 `--limit N`(按 CHANGELOG 顺序只处理前 N 个,避免一次造几百个):
|
|
25
|
+
```
|
|
26
|
+
node scripts/release-gh.mjs --limit 40
|
|
27
|
+
→ 新建 7 个(v0.9.139–v0.9.143 等),跳过 31 个已存在
|
|
28
|
+
→ 现共 47 个 Release;0.9.153 / 0.9.137 找不到对应 commit,已跳过并记录
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 证据
|
|
32
|
+
```
|
|
33
|
+
node --test → 274/274
|
|
34
|
+
出图:shot-creds.png(深色 · 设置/凭证,760×760)
|
|
35
|
+
preview 场景新增「设置(凭证)」(之前只有来源/诊断/更新,凭证页从没出过图)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## [0.9.175] - 2026-11-04 —— 吸收 PR #7 的好设计:`ghConfigDir`(去掉其中会漏路径的部分)
|
|
39
|
+
|
|
40
|
+
> 作者 **@ysl289** 一天多没回(无新提交、无新评论)。按你的意思,**我们自己吸收好的部分**,
|
|
41
|
+
> 不合并他的分支(那分支还基于 0.9.165,且有一处必须改)。
|
|
42
|
+
|
|
43
|
+
### 他做对了什么(保留)
|
|
44
|
+
`gh` 的登录态按平台存在各自配置目录里,不指定时插件用的是**跑 DSH 这个人的账号** ——
|
|
45
|
+
替团队干活的守,每条评论都挂在操作者名下。把 `GH_CONFIG_DIR` 指向一个只登录了智能体账号的目录,
|
|
46
|
+
就能换成智能体身份,而且那个目录没登录时 `gh` 会直接失败(fail-closed),不会悄悄退回操作者。
|
|
47
|
+
|
|
48
|
+
### 我改掉的那一处
|
|
49
|
+
他原本把**绝对路径**直接拼进唤醒消息:
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
`请同样带上 GH_CONFIG_DIR=${options.ghConfigDir},否则 push 与提交会落到操作者账号上。`
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
唤醒消息会进模型上下文、进对话记录、可能被后续总结引用 —— 带上 `C:\Users\<用户名>\AppData\...`
|
|
56
|
+
就等于把本机用户名和目录结构一并带出去。现在只说:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
【提交身份】本插件的 gh 已绑定单独的智能体账号。你在会话里执行 git / git push 时如需一致身份,
|
|
60
|
+
请向用户索取该账号的 gh 配置目录并设 GH_CONFIG_DIR;否则提交会落到操作者账号上。
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
路径由用户在需要时给出(他本来就知道)。
|
|
64
|
+
|
|
65
|
+
### 落地清单
|
|
66
|
+
| 位置 | 改动 |
|
|
67
|
+
|---|---|
|
|
68
|
+
| `lib/index.js` `ghEnv()` | 带上 `GH_CONFIG_DIR`;面板配置的 token 仍优先 |
|
|
69
|
+
| `lib/index.js` `secretsSummary()` | 只回 `configured` / `none`,**不回路径** |
|
|
70
|
+
| `POST /credentials` | 接受 `ghConfigDir`;非绝对路径 400;空串清除 |
|
|
71
|
+
| `watch_doctor` | 新增「gh 账号」一项:未绑定 / 目录不存在 / 缺 `hosts.yml`(没登录过)/ 正常 |
|
|
72
|
+
| `formatWatchText` | 【提交身份】提示,**不含路径** |
|
|
73
|
+
| 面板「设置 → 凭证」 | 显示当前状态 + 一个新输入框(hook 追加在末尾,fixture 同步) |
|
|
74
|
+
|
|
75
|
+
### 证据
|
|
76
|
+
```
|
|
77
|
+
node --test → 274/274(新增 3 条:路由只收绝对路径 / 摘要不回显路径 / 唤醒消息提身份但不带路径)
|
|
78
|
+
preflight --fast → 全绿
|
|
79
|
+
真机:formatWatchText({identityBound:true}) 含「【提交身份】」且不含 GH_CONFIG_DIR= 与 AppData
|
|
80
|
+
```
|
|
81
|
+
|
|
5
82
|
## [0.9.174] - 2026-11-04 —— 首次同步不该说「有 N 条新动态」
|
|
6
83
|
|
|
7
84
|
### 现场(本轮唤醒)
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<img src="assets/icon-180.png" width="88" height="88" alt="">
|
|
4
4
|
|
|
5
5
|
[](LICENSE)
|
|
6
|
-
[](https://github.com/MYCF711/dsh-session-superagent/releases)
|
|
7
7
|
[](https://www.npmjs.com/package/dsh-session-superagent)
|
|
8
8
|
[](https://github.com/topics/dsh-plugin)
|
|
9
9
|
|
|
@@ -123,7 +123,7 @@ dsh plugin install /path/to/dsh-session-superagent
|
|
|
123
123
|
## 开发
|
|
124
124
|
|
|
125
125
|
```sh
|
|
126
|
-
node --test #
|
|
126
|
+
node --test # 274 项单测
|
|
127
127
|
```
|
|
128
128
|
|
|
129
129
|
### 工具输出:文本给人和 agent,JSON 给程序
|
package/client.js
CHANGED
|
@@ -14,7 +14,7 @@ window.__ModuleLoader__.load({
|
|
|
14
14
|
const { useCallback, useEffect, useRef, useState } = React
|
|
15
15
|
|
|
16
16
|
// 客户端版本探针:每次模块加载写一次,用来确认浏览器里跑的是哪一版
|
|
17
|
-
const CLIENT_VERSION = '0.9.
|
|
17
|
+
const CLIENT_VERSION = '0.9.176'
|
|
18
18
|
let BASE = '/session-superagent'
|
|
19
19
|
/**
|
|
20
20
|
* 挑「最新的那个服务端实例」。
|
|
@@ -988,6 +988,8 @@ window.__ModuleLoader__.load({
|
|
|
988
988
|
const [problemsOnly, setProblemsOnly] = useState(false)
|
|
989
989
|
// 统计条筛选:点「异常」只看异常。放在 hook 列表末尾,避免打乱既有下标(测试桩按位置取值)
|
|
990
990
|
const [stateFilter, setStateFilter] = useState(null)
|
|
991
|
+
// gh 账号配置目录(只收绝对路径;留空 = 用宿主当前登录的账号)
|
|
992
|
+
const [ghDir, setGhDir] = useState('')
|
|
991
993
|
// 建议规则弹层:给"叫醒了没回音"一个下一步动作(只提供可复制的规则,不替客户写仓库文件)
|
|
992
994
|
|
|
993
995
|
// 「我现在手上有没有能渲染的数据」。判断依据必须是**当前 snap**,不是"以前拿到过一次" ——
|
|
@@ -1126,8 +1128,11 @@ window.__ModuleLoader__.load({
|
|
|
1126
1128
|
const saveCredentials = () => run(async () => {
|
|
1127
1129
|
const payload = {}
|
|
1128
1130
|
if (token.trim()) payload.token = token.trim()
|
|
1131
|
+
if (ghDir.trim()) payload.ghConfigDir = ghDir.trim()
|
|
1132
|
+
else if (ghDir === '') payload.ghConfigDir = '' // 显式清空 = 回到宿主账号
|
|
1129
1133
|
await call('/credentials', { method: 'POST', body: JSON.stringify(payload) })
|
|
1130
1134
|
setToken('')
|
|
1135
|
+
setGhDir('')
|
|
1131
1136
|
}, '凭证已保存')
|
|
1132
1137
|
|
|
1133
1138
|
const saveGoal = () => run(async () => {
|
|
@@ -1712,10 +1717,12 @@ window.__ModuleLoader__.load({
|
|
|
1712
1717
|
+ '(合计 ' + bytesText(body.isolation.totalBytes) + ')'],
|
|
1713
1718
|
] })),
|
|
1714
1719
|
h(Section, { key: 'creds', title: '凭证' },
|
|
1715
|
-
h(KeyValues, { rows: [['GitHub token', credentials.token === 'none' ? '未配置(回退到已登录的 gh CLI)' : '已配置'], ['SSH 私钥', credentials.sshKeyPath === 'none' ? '未配置(当前版本不使用)' : '已配置']
|
|
1720
|
+
h(KeyValues, { rows: [['GitHub token', credentials.token === 'none' ? '未配置(回退到已登录的 gh CLI)' : '已配置'], ['SSH 私钥', credentials.sshKeyPath === 'none' ? '未配置(当前版本不使用)' : '已配置'],
|
|
1721
|
+
['gh 账号', credentials.ghConfigDir === 'configured' ? '已绑定独立配置目录(评论挂智能体账号)' : '宿主当前登录的账号']] }),
|
|
1716
1722
|
field('Token', h(Input, { type: 'password', value: token, placeholder: 'ghp_… / github_pat_…(留空不改)', onChange: (e) => setToken(e.target.value) })),
|
|
1723
|
+
field('gh 账号目录', h(Input, { value: ghDir, placeholder: '绝对路径(留空 = 用宿主账号)', onChange: (e) => setGhDir(e.target.value) })),
|
|
1717
1724
|
h('div', { className: 'dt-actions' }, h(Btn, { variant: 'primary', onClick: saveCredentials }, '保存凭证')),
|
|
1718
|
-
h(Hint, null, '不填也能用:插件直接复用已登录的 gh CLI
|
|
1725
|
+
h(Hint, null, '不填也能用:插件直接复用已登录的 gh CLI。填了 gh 账号目录,插件就用那个目录里的账号发言(git push 仍用会话自己的身份,唤醒消息里会提醒会话)。')),
|
|
1719
1726
|
h(Section, { key: 'update', title: '版本与更新' },
|
|
1720
1727
|
h(KeyValues, { rows: [
|
|
1721
1728
|
['当前版本', (update && update.current) || CLIENT_VERSION],
|
package/lib/index.js
CHANGED
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
|
|
41
41
|
export const name = 'dsh-session-superagent'
|
|
42
42
|
/** 服务端版本:随 package.json 同步(meta 测试守着)。客户端据此挑「最新的那个实例」。 */
|
|
43
|
-
export const SERVER_VERSION = '0.9.
|
|
43
|
+
export const SERVER_VERSION = '0.9.176'
|
|
44
44
|
export const inject = ['tools', 'agents', 'webServer']
|
|
45
45
|
/** 一条会话每小时最多被唤醒几次(跨所有守累计)。单守上限挡不住多守叠加。 */
|
|
46
46
|
// 本进程启动时刻:用来区分「刚重启还没轮到」与「定时器真的丢了」
|
|
@@ -223,6 +223,9 @@ function secretsSummary() {
|
|
|
223
223
|
sshKeyPath: s.sshKeyPath ? 'configured' : 'none',
|
|
224
224
|
// 从不在面板回显路径(Windows 路径里的反斜杠曾让掩码整段漏出)
|
|
225
225
|
sshKeyHint: null,
|
|
226
|
+
// 「用哪个 gh 账号」同理:只回配没配,不回路径(取自 PR #7 的设计)
|
|
227
|
+
ghConfigDir: s.ghConfigDir ? 'configured' : 'none',
|
|
228
|
+
ghConfigDirHint: null,
|
|
226
229
|
updatedAt: s.updatedAt ?? null,
|
|
227
230
|
}
|
|
228
231
|
}
|
|
@@ -320,8 +323,16 @@ function goalView(ctx, sessionId) {
|
|
|
320
323
|
/** Environment for every gh call: a panel token wins over the CLI login. */
|
|
321
324
|
function ghEnv() {
|
|
322
325
|
const s = readSecrets()
|
|
323
|
-
|
|
324
|
-
|
|
326
|
+
const env = { ...process.env }
|
|
327
|
+
// 为什么要 GH_CONFIG_DIR:`gh` 的登录态按平台存在各自配置目录里
|
|
328
|
+
// (Windows 在 %APPDATA%\GitHub CLI,POSIX 在 ~/.config/gh)。不指定时插件用的是
|
|
329
|
+
// 「跑 DSH 这个人的账号」—— 替团队干活的守,每条评论都会挂在操作者名下。
|
|
330
|
+
// 指向一个只登录了智能体账号的目录即可换身份;该目录没登录时 gh 直接失败(fail-closed)。
|
|
331
|
+
// 设计取自 PR #7(@ysl289)。
|
|
332
|
+
if (s.ghConfigDir) env.GH_CONFIG_DIR = String(s.ghConfigDir)
|
|
333
|
+
// 面板里显式配的 token 优先级最高:它就是要覆盖目录里可能存在的登录态。
|
|
334
|
+
if (s.token) env.GH_TOKEN = String(s.token)
|
|
335
|
+
return env
|
|
325
336
|
}
|
|
326
337
|
|
|
327
338
|
/**
|
|
@@ -1181,6 +1192,9 @@ async function pollOnce(ctx, entry, baseMs) {
|
|
|
1181
1192
|
isolation,
|
|
1182
1193
|
// entry.goal 之前只写不读:现在真的进唤醒消息
|
|
1183
1194
|
goal: entry.goal || '',
|
|
1195
|
+
// 只传「绑没绑智能体账号」这个布尔量:**不把路径写进唤醒消息**(会进模型上下文与对话记录,
|
|
1196
|
+
// 顺带把本机用户名和目录结构带出去)。路径由用户在需要时自己给。
|
|
1197
|
+
identityBound: Boolean(readSecrets().ghConfigDir),
|
|
1184
1198
|
// 只读仓库要在任务书里直说,否则会话会去试写然后吃 403
|
|
1185
1199
|
access: accessNote(entry.repoAccess),
|
|
1186
1200
|
// 完成标准要可观测(Given-When-Then 的思路):三件事缺一不算完成
|
|
@@ -1706,6 +1720,14 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
|
|
|
1706
1720
|
else if (!isAbsolute(keyPath)) return json(res, 400, { error: 'sshKeyPath must be absolute' })
|
|
1707
1721
|
else next.sshKeyPath = keyPath
|
|
1708
1722
|
}
|
|
1723
|
+
// 「用哪个 gh 账号」:指向只登录了智能体账号的配置目录;空串 = 回到宿主当前账号。
|
|
1724
|
+
// 只收绝对路径:相对路径会随 cwd 漂移,把设置指向一个不存在的地方。
|
|
1725
|
+
if (typeof body.ghConfigDir === 'string') {
|
|
1726
|
+
const dir = body.ghConfigDir.trim()
|
|
1727
|
+
if (dir === '') delete next.ghConfigDir
|
|
1728
|
+
else if (!isAbsolute(dir)) return json(res, 400, { error: 'ghConfigDir must be absolute' })
|
|
1729
|
+
else next.ghConfigDir = dir
|
|
1730
|
+
}
|
|
1709
1731
|
next.updatedAt = new Date().toISOString()
|
|
1710
1732
|
writeSecrets(next)
|
|
1711
1733
|
json(res, 200, { credentials: secretsSummary() })
|
|
@@ -2117,6 +2139,19 @@ const UPDATE_CACHE_MS = 10 * 60 * 1000
|
|
|
2117
2139
|
lines.push(`FAIL ${entry.repo} 不可访问:${why.hint}`)
|
|
2118
2140
|
}
|
|
2119
2141
|
|
|
2142
|
+
// 2b. gh 账号配置目录:设了但目录不可读 / 没登录时,客户看到的只是「一直失败」
|
|
2143
|
+
{
|
|
2144
|
+
const dir = readSecrets().ghConfigDir
|
|
2145
|
+
if (!dir) {
|
|
2146
|
+
lines.push('OK gh 账号:使用宿主当前登录的账号(未绑定独立配置目录)')
|
|
2147
|
+
} else if (!existsSync(dir)) {
|
|
2148
|
+
lines.push('FAIL gh 账号:绑定的配置目录不存在(检查设置里的路径)')
|
|
2149
|
+
} else if (!existsSync(join(dir, 'hosts.yml'))) {
|
|
2150
|
+
lines.push('FAIL gh 账号:配置目录里没有 hosts.yml(该目录还没登录过:先在那个目录下跑 gh auth login)')
|
|
2151
|
+
} else {
|
|
2152
|
+
lines.push('OK gh 账号:已绑定独立配置目录(hosts.yml 存在)')
|
|
2153
|
+
}
|
|
2154
|
+
}
|
|
2120
2155
|
// 3. ack 标签是否存在
|
|
2121
2156
|
const label = entry.ackLabel || DEFAULT_ACK_LABEL
|
|
2122
2157
|
const labRes = await run('gh', ['api', `repos/${entry.repo}/labels/${encodeURIComponent(label)}`, '--jq', '.name'], { env: ghEnv() })
|
package/lib/watch.js
CHANGED
|
@@ -153,6 +153,16 @@ export function formatWatchText(repo, fresh, options = {}) {
|
|
|
153
153
|
const goalLine = options.goal
|
|
154
154
|
? `${String.fromCharCode(10)}本条目主理目标:${String(options.goal).split(String.fromCharCode(13)).join(' ').split(String.fromCharCode(10)).join(' ').slice(0, 200)}`
|
|
155
155
|
: ''
|
|
156
|
+
// 身份说明:插件调 gh 用的是它绑定的账号,会话里跑的 git push 用的是会话自己的环境。
|
|
157
|
+
// 不说明的话,gh 评论挂智能体名下、git 提交挂操作者名下 —— 一次改动两个作者。
|
|
158
|
+
//
|
|
159
|
+
// 注意:**这里不写路径**(PR #7 原本把 GH_CONFIG_DIR=<绝对路径> 塞进来)。唤醒消息会进模型上下文、
|
|
160
|
+
// 进对话记录、可能被后续总结引用;带路径就等于把本机用户目录一并带出去。
|
|
161
|
+
// 会话只要知道「该问用户」就够了 —— 用户本来就知道自己的路径。
|
|
162
|
+
const identityLine = options.identityBound
|
|
163
|
+
? String.fromCharCode(10) + '【提交身份】本插件的 gh 已绑定单独的智能体账号。你在会话里执行 git / git push 时如需一致身份,'
|
|
164
|
+
+ '请向用户索取该账号的 gh 配置目录并设 GH_CONFIG_DIR;否则提交会落到操作者账号上。'
|
|
165
|
+
: ''
|
|
156
166
|
const moreLine = more > 0
|
|
157
167
|
? `\n(另有 ${more} 条:${rest},处理完这批再看)`
|
|
158
168
|
: ''
|
|
@@ -196,6 +206,7 @@ export function formatWatchText(repo, fresh, options = {}) {
|
|
|
196
206
|
moreLine +
|
|
197
207
|
isoLine +
|
|
198
208
|
goalLine +
|
|
209
|
+
identityLine +
|
|
199
210
|
accessLine +
|
|
200
211
|
criteriaLine +
|
|
201
212
|
'\n\n接下来:' +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-session-superagent",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.176",
|
|
4
4
|
"description": "Session-level superagent for DeepSeek Harness: watch a GitHub repository and wake a session when something needs doing. Credentials never reach the model.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|