dsh-inbox-bridge 2.19.3 → 2.20.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/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 2.20.1
2
+
3
+ - 修复「谁来接」在多会话工作区里不可用:以前同一仓库有多个会话又没指定负责者时谁都不唤醒,而两个会话的标题与目录完全一样,面板上并列两个同名项、也没法知道谁在接。现在每个会话都带会话 id 末四位,面板标出实际会接的那一个;默认负责者改成「最近跟你说话的那个会话」,显式指定的仍然优先且不会被绕过。
4
+ ## 2.20.0
5
+
6
+ - **谁来接这一轮。** 同一仓库有多个会话在看时,谁都不唤醒,直到你在面板上指定负责的那个;只剩一个会话时它自动负责。判定放在唤醒的五道门里,测试覆盖「两个会话谁都没被叫」与「指定之后只叫指定的那个」。
7
+ - **节奏可以直接调。** 面板上的「空闲多久」(1 / 5 / 15 分钟)与「每小时次数」(1 / 2 / 4)写进覆盖层,不必改插件配置。
8
+ - **定时任务说得清自己。** 由 `schedule` 触发的运行失败时标为 `[Scheduled]`,恢复时同样标为定时任务,不再和「最后一次推送失败」混成一件事。
9
+ - **评审意见本身成为事实。** 我自己 PR 上别人写的评审评论会被报出来(文件:行号 + 首行);推了新提交、评论被代码回答之后它自动收口——GitHub 的评论没有「完成」状态,代码就是唯一的收口。
10
+ - **日志里的话要对得上。** 轮询间隔按整分钟或秒如实说(90 000 ms 是「90 秒」,不再是「2 分钟」);`sweep --json` 回答 `ok: true` 时即使进程退出码非零也按成功记,不再误报 `sweep failed`。
1
11
  ## 2.19.3
2
12
 
3
13
  - 唤醒只差「会话还不够空闲」这一步时,事件不再被注入掉,而是继续留在队列里等空闲窗口。之前的顺序是:此刻不满足唤醒条件,就把它塞进下一轮对话——于是那条消息被用掉了,唤醒永远等不到它。现在只有真的叫不动(角色不对、多人看同一个仓库、预算用完)才退回注入,纯粹的「再等一会儿」会把事件留给它本来要开的那一轮。
package/README.en.md CHANGED
@@ -27,6 +27,7 @@ That is also why it only reads: its job is to make the agent aware. The work hap
27
27
  - **It reads repositories, not the notification inbox.** GitHub's notification inbox pushes per account and cannot tell one session or repository from another; querying repository state directly keeps two repositories on the same account apart.
28
28
  - **Polling follows turns.** Once when a session starts, every minute while a turn runs, once when it ends; an idle session makes no request. Only with `delivery: wakeup` does it also read on that interval while idle — without that it could never wake you while you are away.
29
29
  - **It also watches security and merge state.** Open Dependabot and code-scanning alerts, and a pull request of yours that conflicts with the base branch or is behind it, matter as much as a red check.
30
+ - **The run that happens at night counts too.** A scheduled workflow that fails says it was scheduled, instead of reading as the last push failing; a review comment on your own pull request is reported as itself, and a push that answers it closes it.
30
31
  - **It goes into the context, and opens a turn only when it has to.** By default a notice arrives at the next safe injection point and does not interrupt the tool loop; with `delivery: wakeup` it opens a turn only for a listed `wakeOn` role, in the one session responsible for that repository (or the one you named), idle for 15 minutes, at most 3 times in a row per session, and at most 2 times an hour — anything else keeps queueing. A notice is marked `delivered`, and unhandled events come back once after six hours.
31
32
 
32
33
  ## What you will see
@@ -39,7 +40,7 @@ At the top of a turn:
39
40
  >
40
41
  > Act only where it affects the current work; when done, run `node "...\dsh-inbox-bridge\scripts\inbox-bridge.mjs" ack --done -- <key>`.
41
42
 
42
- `[Dependabot]` is an open dependency advisory and `[Code scanning]` an open code-scanning alert. The rest of the bracket states the relation to that identity: `reviewer` means it waits for your review, `author` means you opened it, `assignee` means it is assigned to you, `mention` means a comment mentions you. Run the `ack` command when you are done; an unacknowledged event is repeated after six hours rather than piling up.
43
+ `[Dependabot]` is an open dependency advisory, `[Code scanning]` an open code-scanning alert, `[Scheduled]` a scheduled run that failed, and `[Review]` a review comment on your own pull request (with file and line). The rest of the bracket states the relation to that identity: `reviewer` means it waits for your review, `author` means you opened it, `assignee` means it is assigned to you, `mention` means a comment mentions you. Run the `ack` command when you are done; an unacknowledged event is repeated after six hours rather than piling up.
43
44
 
44
45
  ## The panel
45
46
 
@@ -47,7 +48,7 @@ The status row under the composer carries a chip: when something is waiting, a b
47
48
 
48
49
  - the events: role, repository, title (link), time;
49
50
  - the identity and the last poll;
50
- - three controls: delivery (queue only / may wake), message clearing (off / mark read / archive to Done — one choice), and which repositories this session subscribes to (paste a repository link or type `owner/name`; one list per session).
51
+ - four controls: delivery (queue only / may wake), who takes it (when several sessions watch the same repository, each is listed with the short id tail that tells same-named twins apart, and the one that would take the wakeup is marked — the default is whichever you spoke to last, one click pins another), the rhythm (how idle is idle: 1 / 5 / 15 minutes; wakes per hour: 1 / 2 / 4), message clearing (off / mark read / archive to Done — one choice), and which repositories this session subscribes to (paste a repository link or type `owner/name`; one list per session).
51
52
 
52
53
  Each control explains itself on hover. Changes apply immediately and are stored in `<cwd>/.work/inbox-bridge/prefs.json`; they do not rewrite the DSH plugin configuration, and a reset returns to the configured values. The panel is per session: switching sessions shows that session's repositories, and says so plainly when they are not subscribed.
53
54
 
package/README.md CHANGED
@@ -27,7 +27,8 @@
27
27
  - **只看仓库,不看通知箱。** GitHub 的通知箱(`/notifications`)按账号推送,无法区分是哪个会话、哪个仓库;这里直接查仓库状态,因此同一个账号下的两个仓库互不干扰。
28
28
  - **轮询跟随回合。** 会话开始时一次、进行中每 1 分钟一次、结束时一次,空闲会话不发请求;开启 `delivery: wakeup` 后空闲时也按同一间隔读一次,否则它没机会在你不在时叫醒你。
29
29
  - **也看安全与合并状态。** 开着的 Dependabot 告警、code scanning 告警,以及我这些 PR 与基分支的冲突或落后,和 CI 失败一样是要紧的事。
30
- - **送进上下文,必要时才开一轮。** 默认只在这一轮的下一次安全注入点进入会话,不打断工具循环;开启 `delivery: wakeup` 后,只有命中 `wakeOn` 的角色、这个仓库只有它一个会话在看(或被你指定负责)、会话空闲满 15 分钟、每会话连续不超过 3 次、每小时不超过 2 次时才主动开一轮,其余情况仍然排队。送达后标为 `delivered`,未处理的 6 小时后重新提醒一次。
30
+ - **夜里跑的那次也算。** 定时工作流(`schedule`)失败时标明是定时任务,不与「最后一次推送失败」混在一起;我自己的 PR 收到评审意见时把那条意见本身报出来,推了新提交、意见被代码回答之后自然收口。
31
+ - **送进上下文,必要时才开一轮。** 默认只在这一轮的下一次安全注入点进入会话,不打断工具循环;开启 `delivery: wakeup` 后,只有命中 `wakeOn` 的角色、这个仓库的负责会话就是它、会话空闲满 15 分钟、每会话连续不超过 3 次、每小时不超过 2 次时才主动开一轮,其余情况仍然排队。负责会话默认是你最近说话的那个;在面板里指定一个之后就固定为它。送达后标为 `delivered`,未处理的 6 小时后重新提醒一次。
31
32
 
32
33
  ## 你会看到什么
33
34
 
@@ -39,7 +40,7 @@
39
40
  >
40
41
  > 只在它影响当前工作时处理;处理完运行 `node "...\dsh-inbox-bridge\scripts\inbox-bridge.mjs" ack --done -- <key>` 标记完成。
41
42
 
42
- `[Dependabot]` 表示一条开着的依赖告警,`[Code scanning]` 表示一条开着的代码告警。方括号里其余部分是该事件与该身份的关系:`reviewer` 表示你是评审人,`author` 表示你是作者,`assignee` 表示指派给你,`mention` 表示评论中提到你。处理完执行提示里的 `ack` 命令;未 ack 的事件在 6 小时后重新提示,不会重复累积。
43
+ `[Dependabot]` 表示一条开着的依赖告警,`[Code scanning]` 表示一条开着的代码告警,`[Scheduled]` 表示定时任务跑了并失败,`[Review]` 表示你自己的 PR 收到了评审意见(后面跟着文件:行号)。方括号里其余部分是该事件与该身份的关系:`reviewer` 表示你是评审人,`author` 表示你是作者,`assignee` 表示指派给你,`mention` 表示评论中提到你。处理完执行提示里的 `ack` 命令;未 ack 的事件在 6 小时后重新提示,不会重复累积。
43
44
 
44
45
  ## 界面
45
46
 
@@ -47,7 +48,7 @@
47
48
 
48
49
  - 事件列表:角色、仓库、标题(可点开)、时间。
49
50
  - 身份、上次轮询时间。
50
- - 三组开关:提醒方式(仅注入 / 主动唤醒)、消息清理(关闭 / 已读 / 归档,一档三态)、订阅仓库(粘贴仓库链接或写 `owner/name` 添加,每个会话各有一份)。
51
+ - 四组开关:提醒方式(仅注入 / 主动唤醒)、谁来接(同一仓库有多个会话在看时,列出每个会话并标出它会接的那一个——名字后面跟一段 id 尾号,同名的两个会话也能分清;默认是最近跟你说话的那个,点一下固定成别的会话)、节奏(空闲多久算空闲:1 / 5 / 15 分钟;每小时最多几次:1 / 2 / 4)、消息清理(关闭 / 已读 / 归档,一档三态)、订阅仓库(粘贴仓库链接或写 `owner/name` 添加,每个会话各有一份)。
51
52
 
52
53
  每个按钮的悬停提示写明了它的作用。改动立即生效,记录在 `<cwd>/.work/inbox-bridge/prefs.json`,不修改 DSH 的插件配置;重置后回到配置里的值。面板按会话取数:切换会话显示该会话订阅的仓库;仓库未订阅时直接说明。
53
54
 
package/client.js CHANGED
@@ -110,7 +110,7 @@ window.__ModuleLoader__.load({
110
110
  none: "未配置仓库",
111
111
  open: "打开收件箱",
112
112
  more: (n) => `还有 ${n} 条`,
113
- kinds: { Dependabot: "依赖告警", "Code scanning": "代码告警" },
113
+ kinds: { Dependabot: "依赖告警", "Code scanning": "代码告警", Scheduled: "定时任务", Review: "评审意见" },
114
114
  roles: { author: "作者", reviewer: "评审", assignee: "指派", mention: "提及", ci: "CI", any: "" },
115
115
  ago: { now: "刚刚", minutes: (n) => `${n} 分钟前`, hours: (n) => `${n} 小时前`, days: (n) => `${n} 天前` },
116
116
  pick: {
@@ -132,6 +132,19 @@ window.__ModuleLoader__.load({
132
132
  signInWaiting: "已打开登录窗口,登录后自动生效。",
133
133
  signInOpen: "打开登录窗口",
134
134
  signInTip: "在插件自己的浏览器配置里登录一次;之后归档会自动运行,失效时会再打开这个窗口。",
135
+ owner: "谁来接",
136
+ ownerTip: "已指定:这个仓库的唤醒只落到这一个会话。再点一次交回默认。",
137
+ ownerAutoTip: "没有指定:由最近跟你说话的那个会话接;点一下可以固定成别的会话。",
138
+ ownerReleaseTip: "再点一次取消指定",
139
+ ownerTakesTip: "现在由它接",
140
+ ownerCurrent: "你正在这个会话里",
141
+ idle: "空闲多久",
142
+ idleTip: "会话安静满这么长时间,才允许唤醒;否则只把事件留下等下一轮。",
143
+ minute1: "1 分钟",
144
+ minute5: "5 分钟",
145
+ minute15: "15 分钟",
146
+ budget: "每小时",
147
+ budgetTip: "这个实例每小时最多唤醒几次,用完后只排队。",
135
148
  subscribe: "订阅仓库",
136
149
  subscribeTip: "此会话关注的 GitHub 仓库;事件只按这里的仓库投递。",
137
150
  typeRepo: "owner/repo 或链接",
@@ -166,7 +179,7 @@ window.__ModuleLoader__.load({
166
179
  none: "no repositories configured",
167
180
  open: "open the inbox",
168
181
  more: (n) => `${n} more`,
169
- kinds: { Dependabot: "Dependabot", "Code scanning": "Code scan" },
182
+ kinds: { Dependabot: "Dependabot", "Code scanning": "Code scan", Scheduled: "scheduled", Review: "review" },
170
183
  roles: { author: "author", reviewer: "reviewer", assignee: "assignee", mention: "mention", ci: "CI", any: "" },
171
184
  ago: { now: "just now", minutes: (n) => `${n}m ago`, hours: (n) => `${n}h ago`, days: (n) => `${n}d ago` },
172
185
  pick: {
@@ -188,6 +201,19 @@ window.__ModuleLoader__.load({
188
201
  signInWaiting: "The sign-in window is open; archiving resumes when you finish.",
189
202
  signInOpen: "open sign-in",
190
203
  signInTip: "Sign in once in this plugin's own browser profile; afterwards archiving runs on its own and reopens this window if the session expires.",
204
+ owner: "who takes it",
205
+ ownerTip: "Pinned: a wakeup for this repository reaches only this session. Click again to hand it back.",
206
+ ownerAutoTip: "Not pinned: the session you spoke to most recently takes it. Click to fix another one.",
207
+ ownerReleaseTip: "click again to clear",
208
+ ownerTakesTip: "takes it now",
209
+ ownerCurrent: "this is the session you are in",
210
+ idle: "quiet for",
211
+ idleTip: "A session must be this quiet before a wakeup may open a turn; otherwise the event waits for a later poll.",
212
+ minute1: "1 min",
213
+ minute5: "5 min",
214
+ minute15: "15 min",
215
+ budget: "per hour",
216
+ budgetTip: "How many wakeups this instance may spend each hour; past that, events only queue.",
191
217
  subscribe: "repositories",
192
218
  subscribeTip: "The repositories this session follows; events are delivered only for them.",
193
219
  typeRepo: "owner/repo or link",
@@ -442,6 +468,14 @@ window.__ModuleLoader__.load({
442
468
  textOverflow: "ellipsis",
443
469
  whiteSpace: "nowrap",
444
470
  },
471
+ ownerList: {
472
+ display: "flex",
473
+ alignItems: "center",
474
+ flexWrap: "wrap",
475
+ gap: "4px",
476
+ minWidth: 0,
477
+ justifyContent: "flex-end",
478
+ },
445
479
  metaValue: {
446
480
  color: "var(--dsw-alias-label-secondary)",
447
481
  textAlign: "right",
@@ -500,6 +534,13 @@ window.__ModuleLoader__.load({
500
534
  background: "var(--dsw-specific-menu, var(--dsw-alias-interactive-bg-hover))",
501
535
  color: "var(--dsw-alias-label-primary)",
502
536
  },
537
+ // A pinned owner is a decision, not a default: say so with a weight the
538
+ // hover-only background cannot express.
539
+ segPinned: {
540
+ fontWeight: 600,
541
+ textDecoration: "underline",
542
+ textUnderlineOffset: "3px",
543
+ },
503
544
  repos: {
504
545
  display: "flex",
505
546
  flexWrap: "wrap",
@@ -688,15 +729,18 @@ window.__ModuleLoader__.load({
688
729
  * One change at a time, through the host's own route. The token is the one
689
730
  * this process handed out with the status, so another page cannot do this.
690
731
  */
691
- async function change(status, set, value) {
732
+ async function change(status, set, value, target) {
692
733
  const token = status?.token;
693
734
  if (!token) return { ok: false, error: "no token" };
694
735
  const session = status?.sessionId
695
736
  ? `&session=${encodeURIComponent(status.sessionId)}`
696
737
  : "";
738
+ // A claim names the session that should own a repository, which need not be
739
+ // the session this page belongs to.
740
+ const named = target ? `&target=${encodeURIComponent(target)}` : "";
697
741
  const url = `/inbox-bridge/prefs?token=${encodeURIComponent(token)}&set=${encodeURIComponent(
698
742
  set,
699
- )}&value=${encodeURIComponent(value)}${session}`;
743
+ )}&value=${encodeURIComponent(value)}${session}${named}`;
700
744
  try {
701
745
  const response = await fetch(url, { cache: "no-store" });
702
746
  return await response.json();
@@ -717,11 +761,11 @@ window.__ModuleLoader__.load({
717
761
  const [error, setError] = React.useState(null);
718
762
  const [draft, setDraft] = React.useState("");
719
763
  const pick = text.pick;
720
- const send = async (set, value) => {
764
+ const send = async (set, value, target) => {
721
765
  if (busy) return;
722
766
  setBusy(true);
723
767
  setError(null);
724
- const result = await change(status, set, value);
768
+ const result = await change(status, set, value, target);
725
769
  setBusy(false);
726
770
  if (!result.ok) {
727
771
  setError(result.error ?? "failed");
@@ -777,6 +821,95 @@ window.__ModuleLoader__.load({
777
821
  "mode",
778
822
  ),
779
823
  ),
824
+ // A wakeup has to reach one session. Two sessions in the same workspace look
825
+ // alike — same title, same folder — so every name carries the four
826
+ // characters of its id that differ, and the one that would take the wakeup
827
+ // right now is marked. Clicking pins a different one; clicking the pinned
828
+ // one hands the choice back to "whoever you spoke to last".
829
+ status.delivery === "wakeup" && sessionRepo && (status.wake?.viewers?.length ?? 0) > 0
830
+ ? h(
831
+ "div",
832
+ { style: styles.controlRow },
833
+ h(
834
+ "span",
835
+ {
836
+ style: styles.controlLabel,
837
+ title: status.wake?.primary ? pick.ownerTip : pick.ownerAutoTip,
838
+ },
839
+ pick.owner,
840
+ ),
841
+ h(
842
+ "div",
843
+ { style: styles.ownerList },
844
+ status.wake.viewers.map((viewer) =>
845
+ h(
846
+ "button",
847
+ {
848
+ key: viewer.id,
849
+ type: "button",
850
+ disabled: busy,
851
+ "aria-pressed": Boolean(viewer.primary),
852
+ title: [
853
+ `${viewer.label} · ${viewer.tag}`,
854
+ viewer.current ? pick.ownerCurrent : "",
855
+ viewer.primary ? pick.ownerReleaseTip : "",
856
+ viewer.owner ? pick.ownerTakesTip : "",
857
+ ]
858
+ .filter(Boolean)
859
+ .join(" — "),
860
+ onClick: () =>
861
+ void send("primary", viewer.primary ? "" : sessionRepo, viewer.id),
862
+ style: {
863
+ ...styles.seg,
864
+ ...(viewer.owner ? styles.segOn : {}),
865
+ ...(viewer.primary ? styles.segPinned : {}),
866
+ },
867
+ },
868
+ `${viewer.label} · ${viewer.tag}`,
869
+ ),
870
+ ),
871
+ ),
872
+ )
873
+ : null,
874
+ // How patient the wakeup is: quiet at least this long, at most this many
875
+ // times an hour. Both were file-only settings until a session could ask
876
+ // for them from here.
877
+ status.delivery === "wakeup"
878
+ ? h(
879
+ "div",
880
+ { style: styles.controlRow },
881
+ h("span", { style: styles.controlLabel, title: pick.idleTip }, pick.idle),
882
+ seg(
883
+ pick.idle,
884
+ [
885
+ [1, pick.minute1, pick.idleTip],
886
+ [5, pick.minute5, pick.idleTip],
887
+ [15, pick.minute15, pick.idleTip],
888
+ ],
889
+ Math.round((status.wake?.idleMs ?? 900000) / 60000),
890
+ "idle",
891
+ "idle",
892
+ ),
893
+ )
894
+ : null,
895
+ status.delivery === "wakeup"
896
+ ? h(
897
+ "div",
898
+ { style: styles.controlRow },
899
+ h("span", { style: styles.controlLabel, title: pick.budgetTip }, pick.budget),
900
+ seg(
901
+ pick.budget,
902
+ [
903
+ [1, "1", pick.budgetTip],
904
+ [2, "2", pick.budgetTip],
905
+ [4, "4", pick.budgetTip],
906
+ ],
907
+ status.wake?.perHour ?? 2,
908
+ "budget",
909
+ "budget",
910
+ ),
911
+ )
912
+ : null,
780
913
  h(
781
914
  "div",
782
915
  { style: styles.controlRow },
package/docs/DETAIL.md CHANGED
@@ -17,7 +17,7 @@ That is also why it only reads: its job is to make the agent aware. The work hap
17
17
  - **Relevance comes from your identity.** It queries the repositories as your local `gh` login (or a configured App identity) and keeps only events where you are the author, the reviewer, the assignee, or are mentioned.
18
18
  - **It reads repositories, not the notification inbox.** The notification inbox pushes per account and cannot tell sessions or repositories apart; querying repository state keeps two repositories on the same account apart.
19
19
  - **Polling follows turns.** Once at the start, every minute while a turn runs, once at the end; an idle session makes no request.
20
- - **The panel is editable.** The chip shows a blue dot and a count when something waits; hovering opens the events and three controls: delivery, message clearing (off / mark read / archive to Done — one choice), and which repositories this session subscribes to (paste a link or type `owner/name`).
20
+ - **The panel is editable.** The chip shows a blue dot and a count when something waits; hovering opens the events and a few controls: delivery, who takes a wakeup (when several sessions watch one repository), the rhythm (how idle is idle, wakes per hour), message clearing (off / mark read / archive to Done — one choice), and which repositories this session subscribes to (paste a link or type `owner/name`).
21
21
 
22
22
  ## Install
23
23
 
package/docs/DETAIL.zh.md CHANGED
@@ -17,7 +17,7 @@
17
17
  - **按身份判断相关性。** 用本机 `gh` 的登录身份(或配置的 App 身份)查询仓库,只保留以你为作者、评审人、指派对象或提及对象的事件。
18
18
  - **只看仓库,不看通知箱。** 通知箱按账号推送,分不清会话与仓库;这里直接查仓库状态,同一账号下两个仓库互不干扰。
19
19
  - **轮询跟随回合。** 会话开始一次、进行中每 1 分钟一次、结束一次;空闲不发请求。
20
- - **面板可改。** 状态行胶囊在有未处理事件时显示蓝点与数量;悬停展开事件列表与三组开关:提醒方式、消息清理(关闭 / 已读 / 归档,一档三态)、订阅哪些仓库(粘贴仓库链接或写 `owner/name`)。
20
+ - **面板可改。** 状态行胶囊在有未处理事件时显示蓝点与数量;悬停展开事件列表与几组开关:提醒方式、谁来接(同仓库多会话时指定负责唤醒的那个)、节奏(空闲多久、每小时几次)、消息清理(关闭 / 已读 / 归档,一档三态)、订阅哪些仓库(粘贴仓库链接或写 `owner/name`)。
21
21
 
22
22
  ## 安装
23
23
 
@@ -18,7 +18,7 @@ DSH 的插件配置里,一个 `dsh-inbox-bridge` 条目即可;等价写法
18
18
 
19
19
  ## 在页面上改(覆盖层)
20
20
 
21
- 输入框下面那颗胶囊浮出来的卡片里,可以直接改三件事:提醒方式、消息清理、订阅哪些仓库。这些改动不写回 DSH 的插件配置,而是记在插件自己的覆盖层里:
21
+ 输入框下面那颗胶囊浮出来的卡片里,可以直接改这几件事:提醒方式、谁来接这个仓库的唤醒、节奏(空闲多久、每小时几次)、消息清理、订阅哪些仓库。这些改动不写回 DSH 的插件配置,而是记在插件自己的覆盖层里:
22
22
 
23
23
  ```text
24
24
  <cwd>/.work/inbox-bridge/prefs.json
@@ -65,6 +65,7 @@ GitHub 的 Done 只有网页端点,所以归档要用插件自己的浏览器
65
65
  | `wakeAfterIdleMs` | `900000`(15 分钟) | 会话静默多久后才允许唤醒 |
66
66
  | `wakesPerHour` | `2` | 滚动一小时内最多唤醒几次;0 = 关闭 |
67
67
  | `maxConsecutiveWakes` | `3` | 一个会话在你下次发言前最多被唤醒几次,之后只排队 |
68
+ | `primary` | `{}` | 哪个会话负责哪个仓库的唤醒:`{ "owner/name": "<sessionId>" }`。没写的仓库由最近跟你说话的那个会话负责;写了就固定为写下的那个。面板上的「谁来接」写的就是这个键 |
68
69
  | `identity` | `{ kind: "user" }` | 用哪个身份读 GitHub,见下 |
69
70
  | `roles` | `[]` | 只接收这些角色的事件;空 = 全收 |
70
71
  | `clear` | `"repo"` | 把这一轮读过的通知线程标为已读:`repo` 只清订阅的仓库,`off` 不碰收件箱。整个账号不在范围内——清别人的仓库属于人的决定,不是后台轮询的决定。旧配置里的 `"all"` 按 `"repo"` 载入。GitHub 没有「完成」API,所以清的是未读角标,历史仍在收件箱里 |
@@ -74,7 +75,7 @@ GitHub 的 Done 只有网页端点,所以归档要用插件自己的浏览器
74
75
  | `poll` | 插件自带 CLI 的 `poll` | 换掉抓取命令:`{ command, args }`,只要能输出约定的 JSON,来源可以不是 GitHub |
75
76
  | `ack` | 插件自带 CLI 的 `ack` | 同上,换掉收口命令 |
76
77
 
77
- 启动时会校验明显写错的组合:`identity.kind: "app"` 没给 `token`/`tokenEnv`、`intervalMs < 5000`、`wakeOn` 非空却选了 `quiet`、`wakeOn` 不是字符串数组——都会直接报错并指出是哪一项,而不是悄悄用默认值。
78
+ 启动时会校验明显写错的组合:`identity.kind: "app"` 没给 `token`/`tokenEnv`、`intervalMs < 5000`、`wakeOn` 不是字符串数组、`primary` 的键不是 `owner/name`——都会直接报错并指出是哪一项,而不是悄悄用默认值。`wakeOn` 非空却选了 `quiet` 不报错:那是「先写好白名单、还没打开唤醒」的正常写法,启动行会说明这些角色只排队。
78
79
 
79
80
  ## 身份
80
81
 
@@ -93,7 +94,7 @@ identity:
93
94
 
94
95
  区别在能看到什么:`user` 能看到账号的 `/notifications`(别人把事推给你),`app` 没有用户收件箱,只读仓库状态(PR、检查、评审请求、issue、评论)。两种都能判断「这件事跟我有关吗」,因为判断依据是仓库里的关系,不是通知流。
95
96
 
96
- 谁来接这一轮:一个仓库只有一个会话在看时,那个会话就是负责的;同一仓库被多个会话看着(同一工作区开多个会话就会这样)时,谁都不叫,直到你在面板里把某个会话指定为负责——插件没有资格替你挑谈话对象。
97
+ 谁来接这一轮:一个仓库只有一个会话在看时,那个会话就是负责的;同一工作区开多个会话、它们都看着这个仓库时,默认由最近跟你说话的那个接——你走开前正在用的就是它;想固定成别的会话,在面板的「谁来接」里点一下就行(名字后面的四位是会话 id 尾号,同名会话靠它区分)。
97
98
 
98
99
  `roles` 与事件里的角色一致:`author`(你提交的)、`reviewer`(请你评审)、`assignee`(派给你的)、`mention`(@你)、`ci`(默认分支)。`wakeOn` 用同一套名字。
99
100
 
@@ -51,7 +51,9 @@ DSH 插件 (index.js) 调度与投递:什么时候去取、取回来给
51
51
  - 内容只有:盯着的仓库、身份、投递方式、队列三种状态的数量、未收口的 20 条(标题与链接来自本轮真实看到的事件)、每个仓库上次轮询的时间。
52
52
  - 它不写回任何状态,也不替你 ack;读的就是 `scripts/inbox-bridge.mjs status` 那份事实。
53
53
  - 客户端代码是在页面里执行的:更新插件后要**重新打开一次应用**(桌面版没有刷新键),胶囊才会重新装上;在那之前它会先消失(不是坏了,是没有执行者)。
54
- - 卡片里的三组开关(提醒方式、消息清理、订阅)也走同源路由:`GET /inbox-bridge/prefs?token=…&set=…&value=…`。改动写进插件自己的覆盖层 `<cwd>/.work/inbox-bridge/prefs.json`,然后重新读一遍状态——显示的就是下一次轮询真要执行的东西,不做乐观更新。token 每次进程启动重新生成,随状态一起下发,防止别的本地页面替你改设置。
54
+ - 卡片里的开关(提醒方式、谁来接、节奏、消息清理、订阅)也走同源路由:`GET /inbox-bridge/prefs?token=…&set=…&value=…`(指定负责会话时多带 `&target=<sessionId>`)。改动写进插件自己的覆盖层 `<cwd>/.work/inbox-bridge/prefs.json`,然后重新读一遍状态——显示的就是下一次轮询真要执行的东西,不做乐观更新。token 每次进程启动重新生成,随状态一起下发,防止别的本地页面替你改设置。
55
+ - 「谁来接」列出这个仓库的所有会话(名字后面跟会话 id 的末四位——同一工作区开两个会话时它们的标题和目录都一样,只有这段尾号能区分),并标出现在会接的那一个:有指定就是指定的那个,没有指定就是最近跟你说话的那个。点一下固定成某个会话,再点一下交回默认。只有一个会话在看时它就是负责的,不需要设置。
56
+ - 「节奏」里的空闲时长与每小时次数就是 `wakeAfterIdleMs` 与 `wakesPerHour` 的现值,点一下写进覆盖层,不必去改插件配置。
55
57
  - 「消息清理」选到归档时,插件会把缺的那次登录替你补上:它自己起一个可见的浏览器窗口等你在插件的浏览器配置里登录,登录完归档接着跑。会话失效而选项还停在归档上时,下一次归档失败会再开一次窗口(至少间隔 `signInCooldownMs`);还没登录时卡片里会写「归档还没登录 GitHub」,旁边是「打开登录窗口」。
56
58
  - 页面第一次挂载时会往 `GET /inbox-bridge/client-log?m=…` 报一行容器尺寸,写进 `plugin.log`(`client: …`)。宿主的资源只应答 GET/HEAD,POST 会变成 405,所以诊断改走查询串。它只在排查「为什么浮层位置不对」时有用,平常不用管。
57
59
 
@@ -69,6 +71,8 @@ DSH 插件 (index.js) 调度与投递:什么时候去取、取回来给
69
71
  | 基础设施失败 | 只提醒一次,因为再改代码也修不好它 |
70
72
  | 安全告警 | 开着的 Dependabot 与 code scanning 告警;每个来源合成一条(条数与严重度分布),修完最后一条后下一次轮询就收口 |
71
73
  | PR 变脏 | 我是作者或指派人,且 PR 与基分支冲突或落后;评审人不算,合并是作者的事 |
74
+ | 定时任务 | 由 `schedule` 触发的那次运行失败了,标为 `[Scheduled]` 而不是 `[CI]`,免得把夜里的失败读成最后一次推送的失败;下一次成功时给一条「已恢复」 |
75
+ | 评审意见 | 我自己的 PR 上有别人写的评审评论。GitHub 的评论没有「完成」状态,唯一的收口是代码:评论写在某个 commit 上,分支推过那个 commit 之后它就不再报出,队列随之收口 |
72
76
 
73
77
  同一条事实不会因为检查状态变来变去就变成好几条通知:key 只由「需要你处理的状态」构成,`QUEUED → IN_PROGRESS → SUCCESS` 全程同一个 key。
74
78
 
@@ -85,7 +89,7 @@ DSH 插件 (index.js) 调度与投递:什么时候去取、取回来给
85
89
  `delivery: quiet` 时插件永远不替你开一轮,只排队。改成 `wakeup` 后,要同时满足五道门才会开一轮:
86
90
 
87
91
  1. `wakeOn` 列了这个角色(默认空 = 永不);
88
- 2. 这个仓库只有一个会话在看,或者被指定的那个会话正是它(同一仓库多个会话时默认谁都不叫);
92
+ 2. 这个仓库的负责会话正是它:被指定负责的那个,或者——没人指定时——最近跟你说话的那个;
89
93
  2. 会话已经静默 `wakeAfterIdleMs`(默认 15 分钟)——所以这个模式在空闲时也按 `intervalMs` 取数,否则永远等不到这一刻;
90
94
  3. 这个会话自你上次发言起被唤醒不足 `maxConsecutiveWakes` 次;
91
95
  4. 滚动一小时内总唤醒数没超过 `wakesPerHour`(默认 2)。
package/docs/index.json CHANGED
@@ -50,12 +50,12 @@
50
50
  },
51
51
  "versions": [
52
52
  {
53
- "version": "2.19.3",
54
- "publishTimestamp": 1794920339,
53
+ "version": "2.20.1",
54
+ "publishTimestamp": 1794924600,
55
55
  "source": {
56
56
  "type": "git",
57
57
  "url": "https://github.com/c3115644151/dsh-inbox-bridge",
58
- "commit": "5bb3c88ae0c3cbf425b3ec6de46c8804a69d5950"
58
+ "commit": "4f916e3dc5d0c58895f91fb0bc5dad2dc4f861d6"
59
59
  },
60
60
  "engines": {
61
61
  "dsh": ">=0.1.0"