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

index.ts (737B)


      1 import type { Plugin } from "@opencode/plugin";
      2 
      3 import type { OpenpodContext } from "../context";
      4 
      5 import { handle } from "./handle";
      6 
      7 export async function registerPrompt(
      8   ctx: Plugin.Context,
      9   deps: OpenpodContext,
     10 ): Promise<void> {
     11   const { logger } = deps;
     12 
     13   logger.log("registering prompt");
     14 
     15   await ctx.session.hook("prompt", async (event) => {
     16     const session = await ctx.session.get({ sessionID: event.sessionID });
     17     const dir = session.location.directory;
     18 
     19     const params = {
     20       ctx: deps,
     21       sessionId: event.sessionID,
     22       dir,
     23       move: (sessionId: string, directory: string) => {
     24         void ctx.session.move({ sessionID: sessionId, directory });
     25       },
     26     };
     27 
     28     await handle(params);
     29   });
     30 }