mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-30 01:02:02 +00:00
fix(core): forward plugin interrupt options (#45632)
This commit is contained in:
parent
0123fed65d
commit
87f21a301d
3 changed files with 36 additions and 1 deletions
5
.changeset/plugin-interrupt-options.md
Normal file
5
.changeset/plugin-interrupt-options.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@opencode-ai/core": patch
|
||||
---
|
||||
|
||||
Forward plugin Session interrupt options so continuation requests reach the Session service.
|
||||
|
|
@ -76,7 +76,7 @@ export const layerWithCell = (cell: Cell) =>
|
|||
resume: (sessionID) => require(cell, (runtime) => runtime.session.resume(sessionID)),
|
||||
switchAgent: (input) => require(cell, (runtime) => runtime.session.switchAgent(input)),
|
||||
switchModel: (input) => require(cell, (runtime) => runtime.session.switchModel(input)),
|
||||
interrupt: (sessionID) => require(cell, (runtime) => runtime.session.interrupt(sessionID)),
|
||||
interrupt: (sessionID, options) => require(cell, (runtime) => runtime.session.interrupt(sessionID, options)),
|
||||
synthetic: (input) => require(cell, (runtime) => runtime.session.synthetic(input)),
|
||||
wait: (sessionID) => require(cell, (runtime) => runtime.session.wait(sessionID)),
|
||||
context: (sessionID) => require(cell, (runtime) => runtime.session.context(sessionID)),
|
||||
|
|
|
|||
|
|
@ -113,6 +113,36 @@ describe("Plugin", () => {
|
|||
}),
|
||||
)
|
||||
|
||||
it.effect("forwards session interrupt options through the runtime cell", () =>
|
||||
Effect.gen(function* () {
|
||||
const plugins = yield* Plugin.Service
|
||||
const fallback = yield* PluginRuntime.Service
|
||||
const cell = PluginRuntime.makeCell()
|
||||
const sessionID = Session.ID.create()
|
||||
const calls: Array<{ sessionID: Session.ID; options: { continue?: boolean } | undefined }> = []
|
||||
cell.runtime = {
|
||||
...fallback,
|
||||
session: {
|
||||
...fallback.session,
|
||||
interrupt: (id, options) =>
|
||||
Effect.sync(() => {
|
||||
calls.push({ sessionID: id, options })
|
||||
return true
|
||||
}),
|
||||
},
|
||||
}
|
||||
const runtime = yield* PluginRuntime.Service.pipe(Effect.provide(PluginRuntime.layerWithCell(cell)))
|
||||
const host = yield* PluginHost.make(plugins).pipe(Effect.provideService(PluginRuntime.Service, runtime))
|
||||
|
||||
expect(yield* runtime.session.interrupt(sessionID)).toBe(true)
|
||||
expect(yield* host.session.interrupt({ sessionID, continue: true })).toEqual({ interrupted: true })
|
||||
expect(calls).toEqual([
|
||||
{ sessionID, options: undefined },
|
||||
{ sessionID, options: { continue: true } },
|
||||
])
|
||||
}),
|
||||
)
|
||||
|
||||
it.effect("registers and removes scoped VCS providers", () =>
|
||||
Effect.gen(function* () {
|
||||
const plugins = yield* Plugin.Service
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue