opencode-queue 0.10.1 → 0.11.0
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 -0
- package/index.ts +8 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -79,6 +79,7 @@ When the session is busy:
|
|
|
79
79
|
|
|
80
80
|
- Queued entries are hidden from the transcript and from the running agent.
|
|
81
81
|
- The current agent run keeps using its original agent, model, and thinking variant.
|
|
82
|
+
- Each queued entry replays with the agent, model, and thinking variant selected when it was queued.
|
|
82
83
|
- Queued entries replay in order after the session completes normally and becomes idle.
|
|
83
84
|
- `/queue front ...` puts an entry before the existing queued entries.
|
|
84
85
|
- Only one queued entry is sent per idle transition, so queued work runs one item at a time.
|
package/index.ts
CHANGED
|
@@ -10,10 +10,9 @@ const TUI_COMPACT = "session_compact"
|
|
|
10
10
|
|
|
11
11
|
type InputPart = TextPartInput | FilePartInput | AgentPartInput | SubtaskPartInput
|
|
12
12
|
type Model = { providerID: string; modelID: string }
|
|
13
|
-
type Meta = { variant?: string; controls?: string[]; fast?: boolean }
|
|
14
13
|
type Run = { agent: string; model?: Model }
|
|
15
|
-
type Info = { agent: string; model: Model
|
|
16
|
-
type Msg = { info: { role: string; agent?: string; mode?: string; model?: Model; providerID?: string; modelID?: string
|
|
14
|
+
type Info = { agent: string; model: Model; variant?: string }
|
|
15
|
+
type Msg = { info: { role: string; agent?: string; mode?: string; model?: Model; providerID?: string; modelID?: string; variant?: string } }
|
|
17
16
|
type Ask = { type: string; properties: { id: string; sessionID: string; questions: { question: string; header: string }[] } }
|
|
18
17
|
type Post = (input: { url: string; path?: Record<string, string>; body?: unknown; headers?: Record<string, string> }) => Promise<{ response?: Response; error?: unknown } | undefined>
|
|
19
18
|
type QueueInput = { body: string; front: boolean }
|
|
@@ -207,9 +206,9 @@ export const QueuePlugin: Plugin = async ({ client }) => {
|
|
|
207
206
|
})
|
|
208
207
|
|
|
209
208
|
return ([...(Array.isArray(result) ? result : (result.data ?? []))].reverse() as Msg[]).flatMap((msg): Info[] => {
|
|
210
|
-
if (msg.info.role === "user" && msg.info.agent && msg.info.model) return [{ agent: msg.info.agent, model: msg.info.model, variant: msg.info.variant
|
|
209
|
+
if (msg.info.role === "user" && msg.info.agent && msg.info.model) return [{ agent: msg.info.agent, model: msg.info.model, variant: msg.info.variant }]
|
|
211
210
|
if (msg.info.role === "assistant" && (msg.info.agent || msg.info.mode) && msg.info.providerID && msg.info.modelID) {
|
|
212
|
-
return [{ agent: msg.info.agent ?? msg.info.mode!, model: { providerID: msg.info.providerID, modelID: msg.info.modelID }, variant: msg.info.variant
|
|
211
|
+
return [{ agent: msg.info.agent ?? msg.info.mode!, model: { providerID: msg.info.providerID, modelID: msg.info.modelID }, variant: msg.info.variant }]
|
|
213
212
|
}
|
|
214
213
|
return []
|
|
215
214
|
})[0]
|
|
@@ -222,7 +221,7 @@ export const QueuePlugin: Plugin = async ({ client }) => {
|
|
|
222
221
|
return { agent: "build" }
|
|
223
222
|
}
|
|
224
223
|
|
|
225
|
-
const opts = (info: Info) => ({ agent: info.agent, model: info.model, variant: info.variant
|
|
224
|
+
const opts = (info: Info) => ({ agent: info.agent, model: info.model, variant: info.variant })
|
|
226
225
|
|
|
227
226
|
const shell = (sid: string, command: string, info: Run) => client.session.shell({ path: { id: sid }, body: { agent: info.agent, model: info.model, command } })
|
|
228
227
|
// TUI command events target the focused session; queued replay must target the original session.
|
|
@@ -441,7 +440,7 @@ export const QueuePlugin: Plugin = async ({ client }) => {
|
|
|
441
440
|
const current = state(sid)
|
|
442
441
|
const parts = files(output.parts)
|
|
443
442
|
const op = parse(request, parts.length)
|
|
444
|
-
const
|
|
443
|
+
const info = { agent: input.agent ?? output.message.agent, model: input.model ?? output.message.model, variant: input.variant }
|
|
445
444
|
|
|
446
445
|
if (control(op)) {
|
|
447
446
|
hide(output.message.id, text)
|
|
@@ -459,19 +458,18 @@ export const QueuePlugin: Plugin = async ({ client }) => {
|
|
|
459
458
|
if (op.kind === "command") return
|
|
460
459
|
if (op.kind === "compact") {
|
|
461
460
|
hide(output.message.id, text)
|
|
462
|
-
await compact(sid,
|
|
461
|
+
await compact(sid, info)
|
|
463
462
|
return
|
|
464
463
|
}
|
|
465
464
|
if (op.kind === "shell") {
|
|
466
465
|
hide(output.message.id, text)
|
|
467
|
-
await shell(sid, op.shell,
|
|
466
|
+
await shell(sid, op.shell, info)
|
|
468
467
|
return
|
|
469
468
|
}
|
|
470
469
|
text.text = request.body
|
|
471
470
|
return
|
|
472
471
|
}
|
|
473
472
|
|
|
474
|
-
const info = { agent: output.message.agent, model: { ...output.message.model }, variant: meta.variant, controls: meta.controls, fast: meta.fast }
|
|
475
473
|
const prior = await latest(sid)
|
|
476
474
|
if (prior) Object.assign(output.message, opts(prior))
|
|
477
475
|
else console.warn("QueuePlugin could not neutralize queued placeholder metadata because the session has no previous message context")
|
package/package.json
CHANGED