dsh-inbox-bridge 2.20.0 → 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 +3 -0
- package/README.en.md +1 -1
- package/README.md +2 -2
- package/client.js +45 -11
- package/docs/configuration.md +2 -2
- package/docs/how-it-works.md +2 -2
- package/docs/index.json +3 -3
- package/index.js +66 -17
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
## 2.20.1
|
|
2
|
+
|
|
3
|
+
- 修复「谁来接」在多会话工作区里不可用:以前同一仓库有多个会话又没指定负责者时谁都不唤醒,而两个会话的标题与目录完全一样,面板上并列两个同名项、也没法知道谁在接。现在每个会话都带会话 id 末四位,面板标出实际会接的那一个;默认负责者改成「最近跟你说话的那个会话」,显式指定的仍然优先且不会被绕过。
|
|
1
4
|
## 2.20.0
|
|
2
5
|
|
|
3
6
|
- **谁来接这一轮。** 同一仓库有多个会话在看时,谁都不唤醒,直到你在面板上指定负责的那个;只剩一个会话时它自动负责。判定放在唤醒的五道门里,测试覆盖「两个会话谁都没被叫」与「指定之后只叫指定的那个」。
|
package/README.en.md
CHANGED
|
@@ -48,7 +48,7 @@ The status row under the composer carries a chip: when something is waiting, a b
|
|
|
48
48
|
|
|
49
49
|
- the events: role, repository, title (link), time;
|
|
50
50
|
- the identity and the last poll;
|
|
51
|
-
- four controls: delivery (queue only / may wake), who takes it (when several sessions watch the same repository,
|
|
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).
|
|
52
52
|
|
|
53
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.
|
|
54
54
|
|
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
- **轮询跟随回合。** 会话开始时一次、进行中每 1 分钟一次、结束时一次,空闲会话不发请求;开启 `delivery: wakeup` 后空闲时也按同一间隔读一次,否则它没机会在你不在时叫醒你。
|
|
29
29
|
- **也看安全与合并状态。** 开着的 Dependabot 告警、code scanning 告警,以及我这些 PR 与基分支的冲突或落后,和 CI 失败一样是要紧的事。
|
|
30
30
|
- **夜里跑的那次也算。** 定时工作流(`schedule`)失败时标明是定时任务,不与「最后一次推送失败」混在一起;我自己的 PR 收到评审意见时把那条意见本身报出来,推了新提交、意见被代码回答之后自然收口。
|
|
31
|
-
- **送进上下文,必要时才开一轮。** 默认只在这一轮的下一次安全注入点进入会话,不打断工具循环;开启 `delivery: wakeup` 后,只有命中 `wakeOn`
|
|
31
|
+
- **送进上下文,必要时才开一轮。** 默认只在这一轮的下一次安全注入点进入会话,不打断工具循环;开启 `delivery: wakeup` 后,只有命中 `wakeOn` 的角色、这个仓库的负责会话就是它、会话空闲满 15 分钟、每会话连续不超过 3 次、每小时不超过 2 次时才主动开一轮,其余情况仍然排队。负责会话默认是你最近说话的那个;在面板里指定一个之后就固定为它。送达后标为 `delivered`,未处理的 6 小时后重新提醒一次。
|
|
32
32
|
|
|
33
33
|
## 你会看到什么
|
|
34
34
|
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
|
|
49
49
|
- 事件列表:角色、仓库、标题(可点开)、时间。
|
|
50
50
|
- 身份、上次轮询时间。
|
|
51
|
-
- 四组开关:提醒方式(仅注入 /
|
|
51
|
+
- 四组开关:提醒方式(仅注入 / 主动唤醒)、谁来接(同一仓库有多个会话在看时,列出每个会话并标出它会接的那一个——名字后面跟一段 id 尾号,同名的两个会话也能分清;默认是最近跟你说话的那个,点一下固定成别的会话)、节奏(空闲多久算空闲:1 / 5 / 15 分钟;每小时最多几次:1 / 2 / 4)、消息清理(关闭 / 已读 / 归档,一档三态)、订阅仓库(粘贴仓库链接或写 `owner/name` 添加,每个会话各有一份)。
|
|
52
52
|
|
|
53
53
|
每个按钮的悬停提示写明了它的作用。改动立即生效,记录在 `<cwd>/.work/inbox-bridge/prefs.json`,不修改 DSH 的插件配置;重置后回到配置里的值。面板按会话取数:切换会话显示该会话订阅的仓库;仓库未订阅时直接说明。
|
|
54
54
|
|
package/client.js
CHANGED
|
@@ -133,8 +133,11 @@ window.__ModuleLoader__.load({
|
|
|
133
133
|
signInOpen: "打开登录窗口",
|
|
134
134
|
signInTip: "在插件自己的浏览器配置里登录一次;之后归档会自动运行,失效时会再打开这个窗口。",
|
|
135
135
|
owner: "谁来接",
|
|
136
|
-
ownerTip: "
|
|
136
|
+
ownerTip: "已指定:这个仓库的唤醒只落到这一个会话。再点一次交回默认。",
|
|
137
|
+
ownerAutoTip: "没有指定:由最近跟你说话的那个会话接;点一下可以固定成别的会话。",
|
|
137
138
|
ownerReleaseTip: "再点一次取消指定",
|
|
139
|
+
ownerTakesTip: "现在由它接",
|
|
140
|
+
ownerCurrent: "你正在这个会话里",
|
|
138
141
|
idle: "空闲多久",
|
|
139
142
|
idleTip: "会话安静满这么长时间,才允许唤醒;否则只把事件留下等下一轮。",
|
|
140
143
|
minute1: "1 分钟",
|
|
@@ -199,8 +202,11 @@ window.__ModuleLoader__.load({
|
|
|
199
202
|
signInOpen: "open sign-in",
|
|
200
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.",
|
|
201
204
|
owner: "who takes it",
|
|
202
|
-
ownerTip: "
|
|
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.",
|
|
203
207
|
ownerReleaseTip: "click again to clear",
|
|
208
|
+
ownerTakesTip: "takes it now",
|
|
209
|
+
ownerCurrent: "this is the session you are in",
|
|
204
210
|
idle: "quiet for",
|
|
205
211
|
idleTip: "A session must be this quiet before a wakeup may open a turn; otherwise the event waits for a later poll.",
|
|
206
212
|
minute1: "1 min",
|
|
@@ -528,6 +534,13 @@ window.__ModuleLoader__.load({
|
|
|
528
534
|
background: "var(--dsw-specific-menu, var(--dsw-alias-interactive-bg-hover))",
|
|
529
535
|
color: "var(--dsw-alias-label-primary)",
|
|
530
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
|
+
},
|
|
531
544
|
repos: {
|
|
532
545
|
display: "flex",
|
|
533
546
|
flexWrap: "wrap",
|
|
@@ -808,14 +821,23 @@ window.__ModuleLoader__.load({
|
|
|
808
821
|
"mode",
|
|
809
822
|
),
|
|
810
823
|
),
|
|
811
|
-
// A wakeup has to reach one session.
|
|
812
|
-
//
|
|
813
|
-
//
|
|
814
|
-
|
|
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
|
|
815
830
|
? h(
|
|
816
831
|
"div",
|
|
817
832
|
{ style: styles.controlRow },
|
|
818
|
-
h(
|
|
833
|
+
h(
|
|
834
|
+
"span",
|
|
835
|
+
{
|
|
836
|
+
style: styles.controlLabel,
|
|
837
|
+
title: status.wake?.primary ? pick.ownerTip : pick.ownerAutoTip,
|
|
838
|
+
},
|
|
839
|
+
pick.owner,
|
|
840
|
+
),
|
|
819
841
|
h(
|
|
820
842
|
"div",
|
|
821
843
|
{ style: styles.ownerList },
|
|
@@ -827,11 +849,23 @@ window.__ModuleLoader__.load({
|
|
|
827
849
|
type: "button",
|
|
828
850
|
disabled: busy,
|
|
829
851
|
"aria-pressed": Boolean(viewer.primary),
|
|
830
|
-
title:
|
|
831
|
-
|
|
832
|
-
|
|
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
|
+
},
|
|
833
867
|
},
|
|
834
|
-
viewer.label
|
|
868
|
+
`${viewer.label} · ${viewer.tag}`,
|
|
835
869
|
),
|
|
836
870
|
),
|
|
837
871
|
),
|
package/docs/configuration.md
CHANGED
|
@@ -65,7 +65,7 @@ GitHub 的 Done 只有网页端点,所以归档要用插件自己的浏览器
|
|
|
65
65
|
| `wakeAfterIdleMs` | `900000`(15 分钟) | 会话静默多久后才允许唤醒 |
|
|
66
66
|
| `wakesPerHour` | `2` | 滚动一小时内最多唤醒几次;0 = 关闭 |
|
|
67
67
|
| `maxConsecutiveWakes` | `3` | 一个会话在你下次发言前最多被唤醒几次,之后只排队 |
|
|
68
|
-
| `primary` | `{}` | 哪个会话负责哪个仓库的唤醒:`{ "owner/name": "<sessionId>" }
|
|
68
|
+
| `primary` | `{}` | 哪个会话负责哪个仓库的唤醒:`{ "owner/name": "<sessionId>" }`。没写的仓库由最近跟你说话的那个会话负责;写了就固定为写下的那个。面板上的「谁来接」写的就是这个键 |
|
|
69
69
|
| `identity` | `{ kind: "user" }` | 用哪个身份读 GitHub,见下 |
|
|
70
70
|
| `roles` | `[]` | 只接收这些角色的事件;空 = 全收 |
|
|
71
71
|
| `clear` | `"repo"` | 把这一轮读过的通知线程标为已读:`repo` 只清订阅的仓库,`off` 不碰收件箱。整个账号不在范围内——清别人的仓库属于人的决定,不是后台轮询的决定。旧配置里的 `"all"` 按 `"repo"` 载入。GitHub 没有「完成」API,所以清的是未读角标,历史仍在收件箱里 |
|
|
@@ -94,7 +94,7 @@ identity:
|
|
|
94
94
|
|
|
95
95
|
区别在能看到什么:`user` 能看到账号的 `/notifications`(别人把事推给你),`app` 没有用户收件箱,只读仓库状态(PR、检查、评审请求、issue、评论)。两种都能判断「这件事跟我有关吗」,因为判断依据是仓库里的关系,不是通知流。
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
谁来接这一轮:一个仓库只有一个会话在看时,那个会话就是负责的;同一工作区开多个会话、它们都看着这个仓库时,默认由最近跟你说话的那个接——你走开前正在用的就是它;想固定成别的会话,在面板的「谁来接」里点一下就行(名字后面的四位是会话 id 尾号,同名会话靠它区分)。
|
|
98
98
|
|
|
99
99
|
`roles` 与事件里的角色一致:`author`(你提交的)、`reviewer`(请你评审)、`assignee`(派给你的)、`mention`(@你)、`ci`(默认分支)。`wakeOn` 用同一套名字。
|
|
100
100
|
|
package/docs/how-it-works.md
CHANGED
|
@@ -52,7 +52,7 @@ DSH 插件 (index.js) 调度与投递:什么时候去取、取回来给
|
|
|
52
52
|
- 它不写回任何状态,也不替你 ack;读的就是 `scripts/inbox-bridge.mjs status` 那份事实。
|
|
53
53
|
- 客户端代码是在页面里执行的:更新插件后要**重新打开一次应用**(桌面版没有刷新键),胶囊才会重新装上;在那之前它会先消失(不是坏了,是没有执行者)。
|
|
54
54
|
- 卡片里的开关(提醒方式、谁来接、节奏、消息清理、订阅)也走同源路由:`GET /inbox-bridge/prefs?token=…&set=…&value=…`(指定负责会话时多带 `&target=<sessionId>`)。改动写进插件自己的覆盖层 `<cwd>/.work/inbox-bridge/prefs.json`,然后重新读一遍状态——显示的就是下一次轮询真要执行的东西,不做乐观更新。token 每次进程启动重新生成,随状态一起下发,防止别的本地页面替你改设置。
|
|
55
|
-
-
|
|
55
|
+
- 「谁来接」列出这个仓库的所有会话(名字后面跟会话 id 的末四位——同一工作区开两个会话时它们的标题和目录都一样,只有这段尾号能区分),并标出现在会接的那一个:有指定就是指定的那个,没有指定就是最近跟你说话的那个。点一下固定成某个会话,再点一下交回默认。只有一个会话在看时它就是负责的,不需要设置。
|
|
56
56
|
- 「节奏」里的空闲时长与每小时次数就是 `wakeAfterIdleMs` 与 `wakesPerHour` 的现值,点一下写进覆盖层,不必去改插件配置。
|
|
57
57
|
- 「消息清理」选到归档时,插件会把缺的那次登录替你补上:它自己起一个可见的浏览器窗口等你在插件的浏览器配置里登录,登录完归档接着跑。会话失效而选项还停在归档上时,下一次归档失败会再开一次窗口(至少间隔 `signInCooldownMs`);还没登录时卡片里会写「归档还没登录 GitHub」,旁边是「打开登录窗口」。
|
|
58
58
|
- 页面第一次挂载时会往 `GET /inbox-bridge/client-log?m=…` 报一行容器尺寸,写进 `plugin.log`(`client: …`)。宿主的资源只应答 GET/HEAD,POST 会变成 405,所以诊断改走查询串。它只在排查「为什么浮层位置不对」时有用,平常不用管。
|
|
@@ -89,7 +89,7 @@ DSH 插件 (index.js) 调度与投递:什么时候去取、取回来给
|
|
|
89
89
|
`delivery: quiet` 时插件永远不替你开一轮,只排队。改成 `wakeup` 后,要同时满足五道门才会开一轮:
|
|
90
90
|
|
|
91
91
|
1. `wakeOn` 列了这个角色(默认空 = 永不);
|
|
92
|
-
2.
|
|
92
|
+
2. 这个仓库的负责会话正是它:被指定负责的那个,或者——没人指定时——最近跟你说话的那个;
|
|
93
93
|
2. 会话已经静默 `wakeAfterIdleMs`(默认 15 分钟)——所以这个模式在空闲时也按 `intervalMs` 取数,否则永远等不到这一刻;
|
|
94
94
|
3. 这个会话自你上次发言起被唤醒不足 `maxConsecutiveWakes` 次;
|
|
95
95
|
4. 滚动一小时内总唤醒数没超过 `wakesPerHour`(默认 2)。
|
package/docs/index.json
CHANGED
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
},
|
|
51
51
|
"versions": [
|
|
52
52
|
{
|
|
53
|
-
"version": "2.20.
|
|
54
|
-
"publishTimestamp":
|
|
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": "
|
|
58
|
+
"commit": "4f916e3dc5d0c58895f91fb0bc5dad2dc4f861d6"
|
|
59
59
|
},
|
|
60
60
|
"engines": {
|
|
61
61
|
"dsh": ">=0.1.0"
|
package/index.js
CHANGED
|
@@ -401,13 +401,22 @@ export function apply(ctx, config) {
|
|
|
401
401
|
}
|
|
402
402
|
: null;
|
|
403
403
|
// A repository can be watched by several sessions in the same directory, and
|
|
404
|
-
// a wakeup has to reach the one the person
|
|
405
|
-
//
|
|
404
|
+
// a wakeup has to reach the one the person means. Two sessions in one
|
|
405
|
+
// workspace have the same title and the same folder, so each name carries the
|
|
406
|
+
// last four characters of its id — the only thing that really tells them
|
|
407
|
+
// apart — and the page marks which one is asking and which one would take a
|
|
408
|
+
// wakeup right now.
|
|
406
409
|
const viewers = repo
|
|
407
410
|
? [...agents.entries()]
|
|
408
|
-
.map(([id, each]) => ({
|
|
411
|
+
.map(([id, each]) => ({
|
|
412
|
+
id,
|
|
413
|
+
label: sessionLabel(each),
|
|
414
|
+
tag: sessionTag(each),
|
|
415
|
+
repo: repoOf(each),
|
|
416
|
+
recent: lastActive.get(each) ?? 0,
|
|
417
|
+
current: id === sessionId,
|
|
418
|
+
}))
|
|
409
419
|
.filter((entry) => entry.repo && entry.repo.toLowerCase() === repo.toLowerCase())
|
|
410
|
-
.map(({ id, label }) => ({ id, label }))
|
|
411
420
|
: [];
|
|
412
421
|
return {
|
|
413
422
|
...buildUiPayload({
|
|
@@ -1067,8 +1076,9 @@ export function wakePlan(batches, options, state = {}) {
|
|
|
1067
1076
|
// Opening a turn is expensive and public: whoever gets it suddenly starts
|
|
1068
1077
|
// working. Several sessions can share one workspace, and then they all watch
|
|
1069
1078
|
// the same repository, so "the session on this repository" is not an answer.
|
|
1070
|
-
//
|
|
1071
|
-
//
|
|
1079
|
+
// Every repository therefore has exactly one owner: the one you claimed in the
|
|
1080
|
+
// page, or — when nothing is claimed — the session you spoke to most recently,
|
|
1081
|
+
// which is the one you were working in when you walked away.
|
|
1072
1082
|
const watchers = new Map();
|
|
1073
1083
|
for (const [agent, events] of batches ?? []) {
|
|
1074
1084
|
for (const event of events) {
|
|
@@ -1078,6 +1088,22 @@ export function wakePlan(batches, options, state = {}) {
|
|
|
1078
1088
|
}
|
|
1079
1089
|
}
|
|
1080
1090
|
|
|
1091
|
+
const ownerOf = (repo) => {
|
|
1092
|
+
const claimed = primary[repo] ?? null;
|
|
1093
|
+
if (claimed) return claimed;
|
|
1094
|
+
let best = null;
|
|
1095
|
+
let bestAt = -1;
|
|
1096
|
+
for (const watcher of watchers.get(repo) ?? []) {
|
|
1097
|
+
const at = lastActive.get(watcher) ?? 0;
|
|
1098
|
+
const name = keyOf(watcher) ?? "";
|
|
1099
|
+
if (at > bestAt || (at === bestAt && best && name < (keyOf(best) ?? ""))) {
|
|
1100
|
+
best = watcher;
|
|
1101
|
+
bestAt = at;
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
return best ? (keyOf(best) ?? null) : null;
|
|
1105
|
+
};
|
|
1106
|
+
|
|
1081
1107
|
const recentWakes = wakes.filter((at) => now - at < 60 * 60 * 1000).length;
|
|
1082
1108
|
let considered = 0;
|
|
1083
1109
|
let why = "no-match";
|
|
@@ -1087,14 +1113,13 @@ export function wakePlan(batches, options, state = {}) {
|
|
|
1087
1113
|
if (!wakeOn.includes(role)) continue;
|
|
1088
1114
|
considered += 1;
|
|
1089
1115
|
const repo = event.repo ?? "";
|
|
1090
|
-
const owner = primary[repo] ?? null;
|
|
1091
1116
|
const key = keyOf(agent);
|
|
1117
|
+
const owner = ownerOf(repo);
|
|
1092
1118
|
if (owner && key !== owner) {
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
why = "ambiguous";
|
|
1119
|
+
// An explicit claim is a decision the operator made; falling back to
|
|
1120
|
+
// "most recent" silently would break it. The default is not a decision,
|
|
1121
|
+
// so it is allowed to move as you move between sessions.
|
|
1122
|
+
why = primary[repo] ? "not-primary" : "not-recent";
|
|
1098
1123
|
continue;
|
|
1099
1124
|
}
|
|
1100
1125
|
if (recentWakes >= perHour) {
|
|
@@ -1118,7 +1143,12 @@ export function wakePlan(batches, options, state = {}) {
|
|
|
1118
1143
|
/** A stable, human-readable name for a session in the log. */
|
|
1119
1144
|
export function sessionLabel(agent) {
|
|
1120
1145
|
const header = agent?.session?.header ?? {};
|
|
1121
|
-
|
|
1146
|
+
// The title is what the session list shows ("主维护", "本地修复"); a workspace
|
|
1147
|
+
// path is a fallback, and two sessions in one workspace then read the same —
|
|
1148
|
+
// which is why the page adds a short id to every name it offers.
|
|
1149
|
+
const title = typeof header.title === "string" ? header.title.trim() : "";
|
|
1150
|
+
if (title.length > 0) return title;
|
|
1151
|
+
const cwd = header.cwd ?? null;
|
|
1122
1152
|
if (typeof cwd === "string" && cwd.length > 0) {
|
|
1123
1153
|
const parts = cwd.replace(/[\\/]+$/u, "").split(/[\\/]/u);
|
|
1124
1154
|
return parts[parts.length - 1] || cwd;
|
|
@@ -1126,6 +1156,12 @@ export function sessionLabel(agent) {
|
|
|
1126
1156
|
return agent?.session?.id ?? "session";
|
|
1127
1157
|
}
|
|
1128
1158
|
|
|
1159
|
+
/** The last four characters of a session id: enough to tell twins apart. */
|
|
1160
|
+
export function sessionTag(agent) {
|
|
1161
|
+
const id = keyOf(agent) ?? "";
|
|
1162
|
+
return id.length > 4 ? id.slice(-4) : id;
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1129
1165
|
/** `owner/name` a session workspace points at, cached for a short while. */
|
|
1130
1166
|
export function repoOf(agent, options, cache = new Map(), now = Date.now()) {
|
|
1131
1167
|
const hit = cache.get(agent);
|
|
@@ -1572,6 +1608,16 @@ export function buildUiPayload({
|
|
|
1572
1608
|
return hit ? claims[hit] : null;
|
|
1573
1609
|
};
|
|
1574
1610
|
const sessionRepo = scoped ? (session.repo ?? repos[0] ?? null) : null;
|
|
1611
|
+
// The session that would receive a wakeup for this repository right now: the
|
|
1612
|
+
// claimed one, or — with nothing claimed — the one you spoke to most recently.
|
|
1613
|
+
// The page shows both facts so "nobody is woken" is never a mystery.
|
|
1614
|
+
const watchers = (viewers ?? []).filter((entry) => entry?.id);
|
|
1615
|
+
const claimed = ownerOf(sessionRepo);
|
|
1616
|
+
const recentViewer = watchers.reduce(
|
|
1617
|
+
(best, entry) => ((entry.recent ?? 0) > (best?.recent ?? -1) ? entry : best),
|
|
1618
|
+
null,
|
|
1619
|
+
);
|
|
1620
|
+
const effectiveOwner = claimed ?? recentViewer?.id ?? null;
|
|
1575
1621
|
return {
|
|
1576
1622
|
at: new Date(now).toISOString(),
|
|
1577
1623
|
label: options.label ?? DEFAULTS.label,
|
|
@@ -1597,11 +1643,14 @@ export function buildUiPayload({
|
|
|
1597
1643
|
on: options.wakeOn ?? [],
|
|
1598
1644
|
idleMs: options.wakeAfterIdleMs ?? DEFAULTS.wakeAfterIdleMs,
|
|
1599
1645
|
perHour: options.wakesPerHour ?? DEFAULTS.wakesPerHour,
|
|
1600
|
-
primary:
|
|
1601
|
-
|
|
1602
|
-
|
|
1646
|
+
primary: claimed,
|
|
1647
|
+
owner: effectiveOwner,
|
|
1648
|
+
// Who is watching this repository, which of them would take a wakeup, and
|
|
1649
|
+
// which one is asking the question.
|
|
1650
|
+
viewers: watchers.map((entry) => ({
|
|
1603
1651
|
...entry,
|
|
1604
|
-
primary:
|
|
1652
|
+
primary: claimed === entry.id,
|
|
1653
|
+
owner: effectiveOwner === entry.id,
|
|
1605
1654
|
})),
|
|
1606
1655
|
},
|
|
1607
1656
|
queue: counts,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-inbox-bridge",
|
|
3
|
-
"version": "2.20.
|
|
3
|
+
"version": "2.20.1",
|
|
4
4
|
"displayName": "GitHub inbox",
|
|
5
5
|
"description": "DSH 插件:让 agent 像维护者一样盯着你的仓库——按会话订阅仓库,取回与你有关、需要你处理的事件(失败的 CI、待评审的 PR、指派给你的 issue、@你的评论、开着的安全告警),在自己的回合送进上下文;会话空闲又遇到要紧的事时也能主动开一轮,让 agent 自己去修、去审、去接。",
|
|
6
6
|
"type": "module",
|