dsh-inbox-bridge 2.19.0 → 2.19.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 +5 -0
- package/docs/how-it-works.md +1 -1
- package/docs/index.json +3 -3
- package/index.js +1 -0
- package/package.json +1 -1
- package/scripts/inbox-bridge.mjs +5 -0
- package/scripts/inbox-bridge.test.mjs +28 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
## 2.19.1
|
|
2
|
+
|
|
3
|
+
- 一件还没告诉过任何人的事不再被「来源不再报出」直接收口。issue 与评论是只报一次的事实:某个会话正忙时事件被留下,下一次轮询本来就取不到第二次,原来的收口逻辑正好把它丢掉——于是事件永远等不到那个愿意叫人的时刻,唤醒也就永远不会发生。现在只有已经投递过的 key 才会因为事实不再成立而收口。
|
|
4
|
+
- `wakePlan` 的 `primary` 也会写进 `runtime.json`,`doctor` 与面板读到的是同一份事实。
|
|
5
|
+
- 回归测试:`a fact nobody was told about is not closed by the source going quiet`(去掉判定后该用例立刻红)。
|
|
1
6
|
## 2.19.0
|
|
2
7
|
|
|
3
8
|
- 唤醒要先说清「谁负责」:同一个工作区里可以开多个会话,它们看的是同一个仓库,于是「这个仓库的会话」不再是一个确定的答案。现在一个仓库只有一个会话在看时,它就是负责的那个;有多个时,谁都不叫,直到你在面板里指定某一个负责(`primary`)。插件没有资格替你挑谈话对象。
|
package/docs/how-it-works.md
CHANGED
|
@@ -31,7 +31,7 @@ DSH 插件 (index.js) 调度与投递:什么时候去取、取回来给
|
|
|
31
31
|
2. 判断「跟我有关吗」——这是插件的核心判断,见下一节。
|
|
32
32
|
3. 给每个事件一个 key(`owner/name#pr:23:reviewer:review-requested` 这样),同一件事在多次轮询里是同一个 key。
|
|
33
33
|
4. 队列里已有记录的 key 不重复投递;已经投出去但没有人收口的,6 小时后重提**一次**,再之后就当作已经说过了。
|
|
34
|
-
5. 上一次轮询能报出、这一次报不出的 key,说明这条事实已经不再成立(检查变绿、PR 合了、issue
|
|
34
|
+
5. 上一次轮询能报出、这一次报不出的 key,说明这条事实已经不再成立(检查变绿、PR 合了、issue 关了),直接收口——队列里只留「此刻仍然成立」的事。还没有告诉过任何人的事件不收口:issue 与评论这类只报一次的事实,一旦在「会话正忙」时被留下,下一次轮询就没有第二次机会了,收口等于把它丢掉。
|
|
35
35
|
6. 按会话分组:会话自己的仓库 + 自己的角色都匹配,才进它那份。
|
|
36
36
|
7. 投递:`quiet` 时注入给空闲的会话、等它下一轮;`wakeup` 时先过五道门。
|
|
37
37
|
8. 只把**真正投出去**的 key 标 delivered。没投出去的下次还有机会,不会被误标。
|
package/docs/index.json
CHANGED
|
@@ -50,12 +50,12 @@
|
|
|
50
50
|
},
|
|
51
51
|
"versions": [
|
|
52
52
|
{
|
|
53
|
-
"version": "2.19.
|
|
54
|
-
"publishTimestamp":
|
|
53
|
+
"version": "2.19.1",
|
|
54
|
+
"publishTimestamp": 1794919046,
|
|
55
55
|
"source": {
|
|
56
56
|
"type": "git",
|
|
57
57
|
"url": "https://github.com/c3115644151/dsh-inbox-bridge",
|
|
58
|
-
"commit": "
|
|
58
|
+
"commit": "293b2f1b80a8f4ebbd3d8e1bf51d6661843df9e7"
|
|
59
59
|
},
|
|
60
60
|
"engines": {
|
|
61
61
|
"dsh": ">=0.1.0"
|
package/index.js
CHANGED
|
@@ -421,6 +421,7 @@ export function apply(ctx, config) {
|
|
|
421
421
|
clear: options.clear,
|
|
422
422
|
sweep: options.sweep ? options.sweep.when : null,
|
|
423
423
|
wakeOn: options.wakeOn,
|
|
424
|
+
primary: options.primary ?? {},
|
|
424
425
|
wakeAfterIdleMs: options.wakeAfterIdleMs,
|
|
425
426
|
wakesPerHour: options.wakesPerHour,
|
|
426
427
|
maxConsecutiveWakes: options.maxConsecutiveWakes,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-inbox-bridge",
|
|
3
|
-
"version": "2.19.
|
|
3
|
+
"version": "2.19.1",
|
|
4
4
|
"displayName": "GitHub inbox",
|
|
5
5
|
"description": "DSH 插件:让 agent 像维护者一样盯着你的仓库——按会话订阅仓库,取回与你有关、需要你处理的事件(失败的 CI、待评审的 PR、指派给你的 issue、@你的评论、开着的安全告警),在自己的回合送进上下文;会话空闲又遇到要紧的事时也能主动开一轮,让 agent 自己去修、去审、去接。",
|
|
6
6
|
"type": "module",
|
package/scripts/inbox-bridge.mjs
CHANGED
|
@@ -176,6 +176,11 @@ export function closeResolved(state, events, { at, repos = [] } = {}) {
|
|
|
176
176
|
const repo = hash > 0 ? key.slice(0, hash).toLowerCase() : null;
|
|
177
177
|
if (!repo || !covered.has(repo)) continue;
|
|
178
178
|
if (live.has(key)) continue;
|
|
179
|
+
// Never told anyone about it: a fact we have not reported yet is not
|
|
180
|
+
// settled by the source going quiet. Issues and comments are reported once,
|
|
181
|
+
// so closing a held one would drop exactly the news a wakeup was waiting
|
|
182
|
+
// for.
|
|
183
|
+
if (entry.status === "pending" && (entry.attempts ?? 0) === 0) continue;
|
|
179
184
|
events_[key] = { ...entry, status: "done", at };
|
|
180
185
|
marked.push(key);
|
|
181
186
|
}
|
|
@@ -100,6 +100,34 @@ test("a fact the repository no longer reports is closed", () => {
|
|
|
100
100
|
assert.equal(closed.state.events["other/r#run:3"].status, "delivered");
|
|
101
101
|
});
|
|
102
102
|
|
|
103
|
+
test("a fact nobody was told about is not closed by the source going quiet", () => {
|
|
104
|
+
// An issue is reported once. If a poll finds a session busy, the event is
|
|
105
|
+
// held; the next poll has nothing to report, and closing it there would drop
|
|
106
|
+
// the very news a wakeup was waiting on.
|
|
107
|
+
const state = {
|
|
108
|
+
events: {
|
|
109
|
+
"o/r#issue:4:author:2026-11-17T12:25:51Z": {
|
|
110
|
+
status: "pending",
|
|
111
|
+
at: AT,
|
|
112
|
+
kind: "issue",
|
|
113
|
+
attempts: 0,
|
|
114
|
+
},
|
|
115
|
+
"o/r#issue:3:author:2026-11-16T19:30:22Z": {
|
|
116
|
+
status: "pending",
|
|
117
|
+
at: AT,
|
|
118
|
+
kind: "issue",
|
|
119
|
+
attempts: 1,
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
const closed = closeResolved(state, [], { at: AT, repos: ["o/r"] });
|
|
124
|
+
assert.deepEqual(closed.marked, ["o/r#issue:3:author:2026-11-16T19:30:22Z"]);
|
|
125
|
+
assert.equal(
|
|
126
|
+
closed.state.events["o/r#issue:4:author:2026-11-17T12:25:51Z"].status,
|
|
127
|
+
"pending",
|
|
128
|
+
);
|
|
129
|
+
});
|
|
130
|
+
|
|
103
131
|
test("classify splits events by the state they carry", () => {
|
|
104
132
|
const events = [
|
|
105
133
|
{ key: "ci:1", kind: "ci" },
|