Sign Up

InterpreterContext

Properties:

  • id string
  • language string
  • sandboxId string
  • #transport HttpTransport
  • #executionQueue ContextExecutionQueue
  • #onClose () => Promise<void>

Constructors

Constructor

new InterpreterContext(
   transport: HttpTransport,
   sandboxId: string,
   id: string,
   language: string,
   executionQueue: ContextExecutionQueue,
   onClose: () => Promise<void>): InterpreterContext;

Parameters:

  • transport HttpTransport
  • sandboxId string
  • id string
  • language string
  • executionQueue ContextExecutionQueue
  • onClose () = > Promise<void>

Returns:

  • InterpreterContext

Methods

close()

close(): Promise<void>;

Returns:

  • Promise<void>

run()

run(
   code: string,
   options: Omit<InterpreterRunOptions, 'sessionId' | 'language' | 'isolated' | 'context'> = {}): Promise<InterpreterResult>;

Execute code inside this explicit interpreter context. If the named context vanished, the daemon's typed SESSION_NOT_FOUND error surfaces unchanged so the caller can recreate the context and decide what code, if any, is safe to rerun.

Parameters:

  • code string
  • options Omit<InterpreterRunOptions, 'sessionId' | 'language' | 'isolated' | 'context'> = {}

Returns:

  • Promise<InterpreterResult>

toJSON()

toJSON(): InterpreterContextJSON;

Returns:

  • InterpreterContextJSON

InterpreterService

Constructors

Constructor

new InterpreterService(
   transport: HttpTransport,
   process: ProcessService): InterpreterService;

Parameters:

  • transport HttpTransport
  • process ProcessService

Returns:

  • InterpreterService

Methods

connectContext()

connectContext(sessionId: string, language: string): InterpreterContext;

Parameters:

  • sessionId string
  • language string

Returns:

  • InterpreterContext

connectContext()

connectContext(context: InterpreterContextJSON): InterpreterContext;

Parameters:

  • context InterpreterContextJSON

Returns:

  • InterpreterContext

connectContext()

connectContext(
   sessionIdOrContext: string | InterpreterContextJSON,
   language?: string): InterpreterContext;

Parameters:

  • sessionIdOrContext string | InterpreterContextJSON
  • language? string

Returns:

  • InterpreterContext

createContext()

createContext(options: InterpreterContextOptions): Promise<InterpreterContext>;

Parameters:

  • options InterpreterContextOptions

Returns:

  • Promise<InterpreterContext>

deleteContext()

deleteContext(
   sessionIdOrContext: string | InterpreterContext | InterpreterContextJSON): Promise<void>;

Parameters:

  • sessionIdOrContext string | InterpreterContext | InterpreterContextJSON

Returns:

  • Promise<void>

listContexts()

listContexts(): Promise<InterpreterContext[]>;

Returns:

  • Promise<InterpreterContext[]>

run()

run(code: string, options: InterpreterRunOptions = {}): Promise<InterpreterResult>;

Execute code and return the parsed interpreter result. Rehydrated kind:'code' process handles can replay logs and wait/kill, but they do not recreate this decomposed result on another worker. A vanished explicit context surfaces the daemon's typed SESSION_NOT_FOUND error; callers decide whether to recreate the context and what to rerun.

Parameters:

  • code string
  • options InterpreterRunOptions = {}

Returns:

  • Promise<InterpreterResult>

InterpreterError

Properties:

  • name string
  • value string
  • traceback string[]

InterpreterLogs

Properties:

  • stdout string
  • stderr string

InterpreterOutput

Properties:

  • data Record<string, unknown>
  • isMainResult boolean
  • text? string
  • html? string
  • png? string
  • svg? string
  • json? unknown

InterpreterProcess

type InterpreterProcess = WaitResult & {
  processId: string
}

InterpreterRunOptions

Properties:

  • language? 'python' | 'typescript' | 'javascript' | string
  • sessionId? string
  • context? InterpreterContextReference | InterpreterContextJSON
  • isolated? boolean
  • cwd? string
  • env? Record<string, string>
  • timeout? number - Caller wait budget in milliseconds; 0 waits unbounded.

InterpreterContextJSON

Properties:

  • sandboxId string
  • contextId string
  • language string

InterpreterContextOptions

Properties:

  • id? string
  • language 'python' | 'typescript' | 'javascript' | string
  • cwd? string
  • env? Record<string, string>
  • shell? string
  • login? boolean

InterpreterContextReference

Properties:

  • sandboxId string
  • id string
  • language string

InterpreterResult

Properties:

  • process InterpreterProcess
  • results InterpreterOutput[]
  • logs InterpreterLogs
  • error? InterpreterError