openpod

An opencode plugin that spins up a dedicated virtual machine for each session to isolate agent work.
git clone https://unitehenry.com/git/openpod.git
Log | Files | Refs | README

commit 950ee04ba3c24e21fdcede9f6c07371ac99a59fe
parent 8a4ac0e14cae4cfa2b620ce5c4128c1de156a295
Author: Henry Unite <unitehenry@gmail.com>
Date:   Sat, 24 Oct 2026 23:41:27 +0000

refactor(controller): move to /controller directory

- Move controller.ts to controller/index.ts
- Update internal import to use ../context
- registerController remains the public export
- Import in root index.ts continues to work via ./controller

Diffstat:
Dcontroller.ts | 40----------------------------------------
Acontroller/index.ts | 40++++++++++++++++++++++++++++++++++++++++
2 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/controller.ts b/controller.ts @@ -1,40 +0,0 @@ -import type { Plugin } from "@opencode/plugin"; - -import type { OpenpodContext } from "./context"; - -export async function registerController( - ctx: Plugin.Context, - deps: OpenpodContext, -): Promise<() => void> { - // Listen for session removal (via events, since there is no ctx.session.hook("remove")) - // and clean up the corresponding openpod directory + lima instance. - const controller = new AbortController(); - void (async () => { - try { - for await (const ev of ctx.event.subscribe({ - signal: controller.signal, - })) { - if (ev.type === "session.deleted") { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const props: any = (ev as any).properties ?? ev; - const sessionID: string | undefined = - props.sessionID ?? - props.id ?? - props.info?.id ?? - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (ev as any).sessionID; - if (sessionID) { - void deps.cleanup.execute(sessionID); - } - } - } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - } catch (err: any) { - if (err?.name !== "AbortError") { - deps.logger.log(`event subscription error: ${err}`); - } - } - })(); - - return () => controller.abort(); -} diff --git a/controller/index.ts b/controller/index.ts @@ -0,0 +1,40 @@ +import type { Plugin } from "@opencode/plugin"; + +import type { OpenpodContext } from "../context"; + +export async function registerController( + ctx: Plugin.Context, + deps: OpenpodContext, +): Promise<() => void> { + // Listen for session removal (via events, since there is no ctx.session.hook("remove")) + // and clean up the corresponding openpod directory + lima instance. + const controller = new AbortController(); + void (async () => { + try { + for await (const ev of ctx.event.subscribe({ + signal: controller.signal, + })) { + if (ev.type === "session.deleted") { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const props: any = (ev as any).properties ?? ev; + const sessionID: string | undefined = + props.sessionID ?? + props.id ?? + props.info?.id ?? + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (ev as any).sessionID; + if (sessionID) { + void deps.cleanup.execute(sessionID); + } + } + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + } catch (err: any) { + if (err?.name !== "AbortError") { + deps.logger.log(`event subscription error: ${err}`); + } + } + })(); + + return () => controller.abort(); +}