Skip to content
View as Markdown

Properties:

  • id string
  • language string
  • sandboxId string
  • #transport HttpTransport
  • #executionQueue ContextExecutionQueue
  • #onClose () => Promise<void>
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
close(): Promise<void>;

Returns:

  • Promise<void>
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(): InterpreterContextJSON;

Returns:

  • InterpreterContextJSON

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

Parameters:

  • transport HttpTransport
  • process ProcessService

Returns:

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

Parameters:

  • sessionId string
  • language string

Returns:

  • InterpreterContext
connectContext(context: InterpreterContextJSON): InterpreterContext;

Parameters:

  • context InterpreterContextJSON

Returns:

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

Parameters:

  • sessionIdOrContext string | InterpreterContextJSON
  • language? string

Returns:

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

Parameters:

  • options InterpreterContextOptions

Returns:

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

Parameters:

  • sessionIdOrContext string | InterpreterContext | InterpreterContextJSON

Returns:

  • Promise<void>
listContexts(): Promise<InterpreterContext[]>;

Returns:

  • Promise<InterpreterContext[]>
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>

Properties:

  • name string
  • value string
  • traceback string[]

Properties:

  • stdout string
  • stderr string

Properties:

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

type InterpreterProcess = WaitResult & {
processId: string
}

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.

Properties:

  • sandboxId string
  • contextId string
  • language string

Properties:

  • id? string
  • language ‘python’ | ‘typescript’ | ‘javascript’ | string
  • cwd? string
  • env? Record<string, string>

Properties:

  • sandboxId string
  • id string
  • language string

Properties:

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