dsh-inbox-bridge 2.18.2 → 2.18.3

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 CHANGED
@@ -1,3 +1,7 @@
1
+ ## 2.18.3
2
+
3
+ - 登录一次就够:归档结束后让浏览器自己关掉,等它真的退出(Chromium 只在退出时把 cookie 写进磁盘),而不是 1.5 秒后强杀。以前每次运行都丢掉刚登录的会话,于是看起来「才登录过又要登录」。
4
+ - 修掉文档里一句错话:GitHub 的 `user_session` 带约两周有效期,不是会话级 cookie;真正的原因是强杀进程。
1
5
  ## 2.18.2
2
6
 
3
7
  - 归档再加一道行级防护:每行都按它自己的链接核对仓库,明确属于别的仓库的行一律不动;一行都认不出来时宁可什么都不归档,也不会把整个账号的收件箱带走。搜索视图的 `repo:` 限定不再是唯一保险。
@@ -6,7 +10,7 @@
6
10
  - 归档只碰订阅的仓库:按仓库逐个打开 GitHub 的通知搜索视图(`repo:owner/name`),只归档这些视图里的线程。以前它选中整个收件箱,会把账号里其它仓库的通知一起归档。
7
11
  - 没有订阅时不再归档任何东西(`--all` 才动整个收件箱),所以后台轮询不会替别人做决定。
8
12
  - 登录窗口结束后的那次归档也带上同一份订阅。
9
- - 登录现在能留住:GitHub 的会话 cookie 是会话级的,插件在浏览器配置里打开「恢复上次会话」,不再一次运行后就被登出。
13
+ - 登录不再一次运行后就丢:会话写在浏览器配置里,退出时落盘,下次直接可用。
10
14
  - `--check` 与 `doctor` 的登录痕迹改看 `Default/Network/Cookies`(Chromium 96 之后的位置)。
11
15
  ## 2.18.0
12
16
 
@@ -44,7 +44,7 @@ GitHub 的 Done 只有网页端点,所以归档要用插件自己的浏览器
44
44
 
45
45
  窗口是独立进程,宿主的轮询不会被它挡住。命令行里 `scripts/clear-inbox.mjs --check` 只回答「登录了没」(没登录时退出码 2),`--login` 打开窗口等你登录,`--dry-run` 只报数量,`--repo owner/name`(可重复,插件通过 `INBOX_REPO` 传)指定范围,`--all` 才是整个收件箱。
46
46
 
47
- 登录状态能活下来,靠的是插件在浏览器配置里打开「恢复上次会话」——GitHub 的会话 cookie 本身是会话级的,Chromium 默认在关闭时丢掉它。
47
+ 登录状态能活下来,靠的是插件让浏览器自己关掉:Chromium 在退出时才把 cookie 写进磁盘,强行结束进程会丢掉刚登录的会话——这正是「刚登录过又让我登录」的原因。GitHub 的 `user_session` 本身带约两周的有效期,每次归档都会续上。
48
48
 
49
49
  ## 全部配置项
50
50
 
package/docs/index.json CHANGED
@@ -50,12 +50,12 @@
50
50
  },
51
51
  "versions": [
52
52
  {
53
- "version": "2.18.2",
54
- "publishTimestamp": 1794916295,
53
+ "version": "2.18.3",
54
+ "publishTimestamp": 1794916776,
55
55
  "source": {
56
56
  "type": "git",
57
57
  "url": "https://github.com/c3115644151/dsh-inbox-bridge",
58
- "commit": "3a01898a1cbaa3b043fd674aa6c4ba91c7accd0a"
58
+ "commit": "a927124d858a2b1c23f9a9f2686a0a06560f11ad"
59
59
  },
60
60
  "engines": {
61
61
  "dsh": ">=0.1.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-inbox-bridge",
3
- "version": "2.18.2",
3
+ "version": "2.18.3",
4
4
  "displayName": "GitHub inbox",
5
5
  "description": "DSH 插件:让 agent 像维护者一样盯着你的仓库——按会话订阅仓库,取回与你有关、需要你处理的事件(失败的 CI、待评审的 PR、指派给你的 issue、@你的评论、开着的安全告警),在自己的回合送进上下文;会话空闲又遇到要紧的事时也能主动开一轮,让 agent 自己去修、去审、去接。",
6
6
  "type": "module",
@@ -312,8 +312,28 @@ async function main(argv) {
312
312
  "about:blank",
313
313
  ];
314
314
  const child = spawn(browser, args, { detached: false, stdio: "ignore" });
315
- const cleanup = () => {
315
+ // Chromium writes the cookie database on the way out. Killing it mid-run loses
316
+ // the GitHub session, which is what made every archive look like it had been
317
+ // signed out again. So the browser is asked to close and given time to finish;
318
+ // only a browser that refuses to go is killed, and that case is reported.
319
+ const stillRunning = () => child.exitCode === null && child.signalCode === null;
320
+ // The child process is not the browser itself — Edge/Chrome hand off to a new
321
+ // process — so the honest signal that the browser is gone is the DevTools
322
+ // endpoint no longer answering.
323
+ const browserGone = async () => {
324
+ try {
325
+ await fetch(`${base}/json/version`, { signal: AbortSignal.timeout(1000) });
326
+ return false;
327
+ } catch {
328
+ return true;
329
+ }
330
+ };
331
+ const cleanup = async () => {
316
332
  if (options.keepOpen) return;
333
+ for (let waited = 0; waited < 40; waited += 1) {
334
+ if (await browserGone()) return;
335
+ await sleep(250);
336
+ }
317
337
  try {
318
338
  child.kill();
319
339
  } catch {
@@ -503,7 +523,7 @@ async function main(argv) {
503
523
  }
504
524
  await sleep(1500);
505
525
  }
506
- cleanup();
526
+ await cleanup();
507
527
  if (!options.keepOpen) {
508
528
  // A graceful close removes the lock; a kill can leave it behind.
509
529
  try {