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 2bff196c5c961185f4c0b714370c3f54ad5a7029
parent 931ecf52acb42d069701f15035f59de5c97f964f
Author: Henry Unite <unitehenry@gmail.com>
Date:   Sat, 24 Oct 2026 23:09:55 +0000

refactor(context): rename createCleanup to initCleanup returning Cleanup with execute

- Cleanup type changed from function to { execute: (sessionID) => Promise<void> }
- createCleanup → initCleanup
- Updated OpenpodContext to use Cleanup type
- All call sites now use .execute(sessionID)
- Consistent with Logger / initLogger pattern

Diffstat:
Mcommand.ts | 2+-
Mcontext/cleanup.ts | 12++++++++----
Mcontext/index.ts | 6+++---
Mcontroller.ts | 2+-
4 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/command.ts b/command.ts @@ -18,7 +18,7 @@ export async function clearAllOpenpod(deps: OpenpodContext): Promise<void> { for (const entry of entries) { if (entry.isDirectory()) { const sessionID = entry.name; - await deps.cleanup(sessionID); + await deps.cleanup.execute(sessionID); } } diff --git a/context/cleanup.ts b/context/cleanup.ts @@ -4,13 +4,15 @@ import * as path from "node:path"; import type { Logger } from "./log"; -export type Cleanup = (sessionID: string) => Promise<void>; +export type Cleanup = { + execute: (sessionID: string) => Promise<void>; +}; -export function createCleanup( +export function initCleanup( openpodRoot: string, logger: Logger, ): Cleanup { - return async function cleanup(sessionID: string): Promise<void> { + async function execute(sessionID: string): Promise<void> { if (!sessionID || typeof sessionID !== "string") return; const limaName = sessionID; @@ -49,5 +51,7 @@ export function createCleanup( } catch (err) { logger.log(`[cleanup] failed to remove ${podDir}: ${err}`); } - }; + } + + return { execute }; } diff --git a/context/index.ts b/context/index.ts @@ -3,19 +3,19 @@ import * as path from "node:path"; import { initLogger, type Logger } from "./log"; import { isCommandAvailable } from "./command"; -import { createCleanup } from "./cleanup"; +import { initCleanup, type Cleanup } from "./cleanup"; export type OpenpodContext = { logger: Logger; openpodRoot: string; - cleanup: (sessionID: string) => Promise<void>; + cleanup: Cleanup; }; export async function init(): Promise<OpenpodContext> { const openpodRoot = path.join(os.homedir(), ".local", "share", "openpod"); const logger = initLogger(openpodRoot); - const cleanup = createCleanup(openpodRoot, logger); + const cleanup = initCleanup(openpodRoot, logger); if (!isCommandAvailable("limactl")) { logger.log( diff --git a/controller.ts b/controller.ts @@ -24,7 +24,7 @@ export async function registerController( // eslint-disable-next-line @typescript-eslint/no-explicit-any (ev as any).sessionID; if (sessionID) { - void deps.cleanup(sessionID); + void deps.cleanup.execute(sessionID); } } }