@max10240/opencode-plugin-delayed-queue 0.0.0-stage → 1.0.35

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/README.md CHANGED
@@ -1,3 +1,67 @@
1
- # Temporary Holding Version
1
+ # opencode-plugin-delayed-queue
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Queue a message now, run it later: only when the session is truly idle and its
4
+ background work has finished.
5
+
6
+ The official queue delivers at the next turn boundary and does not inspect background work. Delayed Queue keeps its
7
+ messages in the plugin until `experimental.idle` reports that the session is about to go idle with no relevant
8
+ background shell, subagent, image, video, or code-mode job. Work owned by a descendant session is rechecked until that
9
+ descendant is quiet.
10
+
11
+ ## Usage
12
+
13
+ - `/delayed-queue <message>` or `/delay <message>` adds a message to the current session's delayed queue.
14
+ - The pending bar appears above the composer, in the same place and style as the official queued-prompt bar.
15
+ - Click the bar, or run `/delayed-queue` with no message, to open the management panel.
16
+ - In the panel, press `enter` or `ctrl+s` to steer now, `ctrl+d` twice to delete, and `ctrl+p` to pause or resume the whole queue. Typing letters stays in the search field.
17
+
18
+ A delayed message is delivered as a normal user prompt, so it appears in the transcript like an official queued
19
+ message. The queue is stored per session and survives hot reloads and server restarts; a restarted process restores it
20
+ paused.
21
+
22
+ ## Trigger rules
23
+
24
+ Delivers when all of these are true:
25
+
26
+ - the session completed a turn normally, or the session is already idle and a new message was queued;
27
+ - no relevant background job owned by the session is running;
28
+ - no relevant background job owned by a descendant is still running (optional, on by default);
29
+ - the queue is not paused.
30
+
31
+ Does not deliver:
32
+
33
+ - while the session is running;
34
+ - while a watched background job is running;
35
+ - after a user interrupt or an execution failure, until the next normal user prompt or an explicit resume;
36
+ - for control-only idle boundaries such as a manual compaction;
37
+ - when the message was already delivered; interrupting that turn does not restore it to the queue.
38
+
39
+ ## Options
40
+
41
+ ```jsonc
42
+ {
43
+ "delayedQueue": {
44
+ "enabled": true,
45
+ "keybind": "<leader>d",
46
+ "queueKeybind": "f9",
47
+ "recheckMs": 5000,
48
+ "waitKinds": ["shell", "subagent", "image", "video", "codemode"],
49
+ "waitDescendants": true,
50
+ "pauseOnInterrupt": true,
51
+ "pauseOnFailure": true
52
+ },
53
+ "features": { "delayedQueue": false }
54
+ }
55
+ ```
56
+
57
+ - `keybind`: opens the management panel. `queueKeybind`: queues the composer text. Set either to `false` to disable it. The slash command and dock still work.
58
+ - `recheckMs`: how often descendant-owned background work is re-evaluated.
59
+ - `waitKinds`: background kinds that block delivery.
60
+ - `waitDescendants`: also wait for work owned by child sessions.
61
+ - `pauseOnInterrupt` / `pauseOnFailure`: pause the queue after a user interrupt or execution failure.
62
+
63
+ ## Notes
64
+
65
+ - Uses the experimental `experimental.idle` session hook. On versions without it, the plugin disables itself.
66
+ - The plugin does not hold the idle hook open while waiting; it returns and lets the runner wake it again.
67
+ - A daemon that never exits keeps its queue waiting. Delete the message or steer it now from the panel.
@@ -0,0 +1,64 @@
1
+ # opencode-plugin-delayed-queue
2
+
3
+ 现在先入队,真正执行要等到会话空闲且后台工作结束。
4
+
5
+ 官方 Queue 在当前轮结束时就会投递,并不检查后台任务。Delayed Queue 会把消息留在插件队列里,直到
6
+ `experimental.idle` 确认会话即将空闲,并且没有相关的后台 shell、subagent、图片、视频或 code-mode 任务。
7
+ 后代会话拥有的后台工作会持续 recheck,直到后代也安静下来。
8
+
9
+ ## 使用
10
+
11
+ - `/delayed-queue <消息>` 或 `/delay <消息>`:把消息加入当前会话的延迟队列。
12
+ - 输入框上方会出现待投递栏,位置和样式与官方 queued prompt 栏一致。
13
+ - 点击该栏,或不带消息运行 `/delayed-queue`,打开管理面板。
14
+ - 面板中 `enter` 或 `ctrl+s` 立即 steer,`ctrl+d` 连按两次删除,`ctrl+p` 暂停/恢复整个队列;字母输入始终进入搜索框。
15
+
16
+ 延迟消息最终以普通 user prompt 投递,因此会像官方 queued prompt 一样出现在 transcript 中。队列按会话持久化,
17
+ 热重载和服务重启后会保留;重启恢复的队列默认暂停。
18
+
19
+ ## 触发规则
20
+
21
+ 满足以下条件才投递:
22
+
23
+ - 会话正常完成一轮,或会话已经空闲时新入队;
24
+ - 当前会话没有相关的后台任务;
25
+ - 后代会话没有相关的后台任务(默认开启);
26
+ - 队列未暂停。
27
+
28
+ 以下情况不投递:
29
+
30
+ - 会话正在运行;
31
+ - 被监听的后台任务仍在运行;
32
+ - 用户手动打断或执行失败后,直到下一条普通用户消息或显式恢复;
33
+ - manual compaction 等 control-only 的空闲边界;
34
+ - 消息已经投递过;打断那一轮不会把它恢复到队列。
35
+
36
+ ## 选项
37
+
38
+ ```jsonc
39
+ {
40
+ "delayedQueue": {
41
+ "enabled": true,
42
+ "keybind": "<leader>d",
43
+ "queueKeybind": "f9",
44
+ "recheckMs": 5000,
45
+ "waitKinds": ["shell", "subagent", "image", "video", "codemode"],
46
+ "waitDescendants": true,
47
+ "pauseOnInterrupt": true,
48
+ "pauseOnFailure": true
49
+ },
50
+ "features": { "delayedQueue": false }
51
+ }
52
+ ```
53
+
54
+ - `keybind`:打开管理面板;`queueKeybind`:把输入框内容加入延迟队列;设为 `false` 可禁用。斜杠命令和待投递栏仍可用。
55
+ - `recheckMs`:后代后台任务的 recheck 间隔。
56
+ - `waitKinds`:会阻塞投递的后台类型。
57
+ - `waitDescendants`:是否也等待子会话拥有的后台工作。
58
+ - `pauseOnInterrupt` / `pauseOnFailure`:用户打断或执行失败后暂停队列。
59
+
60
+ ## 说明
61
+
62
+ - 依赖实验性的 `experimental.idle` session hook;运行时不提供该 hook 会自动禁用。
63
+ - hook 内不会一直等待后台任务;插件直接返回,让 runner 在后台完成 notice 后再次触发。
64
+ - 永不退出的后台进程会让队列一直等待;可以在面板中删除消息或立即 steer。
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { default, setupDelayedQueue } from "./src/index.js";
2
+ export { DEFAULT_KEYBIND, DEFAULT_QUEUE_KEYBIND, DEFAULT_RECHECK_MS, delayedQueueEnabled, parseDelayedQueueOptions, WAIT_KINDS, } from "./src/options.js";