opencode-queue 0.12.1 → 0.12.2
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 +1 -1
- package/index.ts +3 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -113,7 +113,7 @@ When the session is idle:
|
|
|
113
113
|
/queue clear 2 3
|
|
114
114
|
```
|
|
115
115
|
|
|
116
|
-
Queues are scoped to the current project and session. They are stored in OpenCode's user data directory and restored after OpenCode restarts or crashes. A send interrupted by a crash remains queued because the plugin cannot know whether OpenCode accepted it before exiting
|
|
116
|
+
Queues are scoped to the current project and session. They are stored in OpenCode's user data directory and restored with their previous running or stopped state after OpenCode restarts or crashes. Restored queues do not replay just because the session starts idle; a running queue resumes after the session becomes busy and then finishes successfully. A send interrupted by a crash remains queued because the plugin cannot know whether OpenCode accepted it before exiting.
|
|
117
117
|
|
|
118
118
|
## Notes
|
|
119
119
|
|
package/index.ts
CHANGED
|
@@ -33,7 +33,7 @@ type EntryOp =
|
|
|
33
33
|
| { kind: "compact"; source: string }
|
|
34
34
|
| { kind: "shell"; source: string; shell: string }
|
|
35
35
|
|
|
36
|
-
type Activity = { kind: "idle" } | { kind: "busy" } | { kind: "sending"; idle: boolean; items: Item[] }
|
|
36
|
+
type Activity = { kind: "idle" } | { kind: "restored" } | { kind: "busy" } | { kind: "sending"; idle: boolean; items: Item[] }
|
|
37
37
|
type State = { items: Item[]; activity: Activity; stopped: boolean; failed: boolean; hidden: Set<string> }
|
|
38
38
|
type Durable = Pick<State, "items" | "stopped" | "hidden">
|
|
39
39
|
type Store = { version: 1; projectID: string; sessions: Record<string, { items: Item[]; stopped: boolean; hidden: string[] }> }
|
|
@@ -215,9 +215,8 @@ export const QueuePlugin: Plugin = async ({ client, project, directory }) => {
|
|
|
215
215
|
const validHidden = Array.isArray(value.hidden) && value.hidden.every((id) => typeof id === "string")
|
|
216
216
|
if (!validHidden) console.warn("QueuePlugin skipped invalid stored hidden messages", sid)
|
|
217
217
|
const hidden = new Set(validHidden ? (value.hidden as string[]) : [])
|
|
218
|
-
const
|
|
219
|
-
if (items.length
|
|
220
|
-
if (items.length || stopped || hidden.size) sessions.set(sid, { items, activity: { kind: "idle" }, stopped, failed: false, hidden })
|
|
218
|
+
const activity: Activity = { kind: items.length && !value.stopped ? "restored" : "idle" }
|
|
219
|
+
if (items.length || value.stopped || hidden.size) sessions.set(sid, { items, activity, stopped: value.stopped, failed: false, hidden })
|
|
221
220
|
}
|
|
222
221
|
}
|
|
223
222
|
} catch (error) {
|
|
@@ -708,7 +707,6 @@ export const QueuePlugin: Plugin = async ({ client, project, directory }) => {
|
|
|
708
707
|
},
|
|
709
708
|
}
|
|
710
709
|
|
|
711
|
-
for (const [sid, current] of sessions) if (current.items.length && !current.stopped) setTimeout(() => advance(sid), 0)
|
|
712
710
|
return hooks
|
|
713
711
|
}
|
|
714
712
|
|
package/package.json
CHANGED