Skip to content

@toolcog/repl

Toolcog read-eval-print loop

Classes

Repl

Constructors

new Repl()

new Repl(options?): Repl

Parameters

options?: ReplOptions

Returns

Repl

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:105

Accessors

breakCommand

get breakCommand(): ReplCommand

Returns

ReplCommand

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:1024

coreImports

get coreImports(): ReplImports

Returns

ReplImports

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:1190

exitCommand

get exitCommand(): ReplCommand

Returns

ReplCommand

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:1033

helpCommand

get helpCommand(): ReplCommand

Returns

ReplCommand

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:1181

imports

get imports(): readonly ReplImports[]

Returns

readonly ReplImports[]

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:299

input

get input(): ReadableStream

Returns

ReadableStream

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:271

output

get output(): WritableStream

Returns

WritableStream

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:275

outputCols

get outputCols(): undefined | number

Returns

undefined | number

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:285

outputRows

get outputRows(): undefined | number

Returns

undefined | number

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:279

preludeSource

get preludeSource(): string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:342

resetCommand

get resetCommand(): ReplCommand

Returns

ReplCommand

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:1015

runtimeImports

get runtimeImports(): ReplImports

Returns

ReplImports

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:1254

style

get style(): Style

Returns

Style

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:295

styled

get styled(): boolean

Returns

boolean

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:291

version

get version(): string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:267

Methods

continuationPrompt()

continuationPrompt(turn): string

Parameters

turn: number

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:316

defineCommand()

defineCommand(keyword, command): void

Parameters

keyword: string

command: undefined | ReplCommand

Returns

void

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:303

evalCode()

evalCode(input): Promise<Record<string, unknown>>

Parameters

input: string

Returns

Promise<Record<string, unknown>>

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:780

evalLang()

evalLang(input): Promise<unknown>

Parameters

input: string

Returns

Promise<unknown>

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:703

evalPrelude()

evalPrelude(): Promise<void>

Returns

Promise<void>

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:368

formatBanner()

formatBanner(): string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:320

formatError()

formatError(error): string

Parameters

error: Error

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:580

formatHelpMessage()

formatHelpMessage(): string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:1166

formatStack()

formatStack(stack): string

Parameters

stack: string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:589

formatStackFrame()

formatStackFrame(frame, cwd): undefined | string

Parameters

frame: string

cwd: string

Returns

undefined | string

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:597

formatValue()

formatValue(value): string

Parameters

value: unknown

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:767

initialPrompt()

initialPrompt(turn): string

Parameters

turn: number

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:312

printBanner()

printBanner(): void

Returns

void

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:338

printBindings()

printBindings(bindings): void

Parameters

bindings: Record<string, unknown>

Returns

void

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:758

printDiagnostics()

printDiagnostics(diagnostics): void

Parameters

diagnostics: readonly Diagnostic[]

Returns

void

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:771

printError()

printError(error): void

Parameters

error: unknown

Returns

void

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:562

reset()

reset(): Promise<void>

Resets the REPL to its initial state.

Returns

Promise<void>

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:999

run()

run(): Promise<void>

Returns

Promise<void>

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:412


ReplCompilerError

Extends

  • Error

Constructors

new ReplCompilerError()

new ReplCompilerError(message, diagnostics, options?): ReplCompilerError

Parameters

message: string

diagnostics: readonly Diagnostic[]

options?: ErrorOptions

Returns

ReplCompilerError

Overrides

Error.constructor

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:1290

Properties

cause?

optional cause: unknown

Inherited from

Error.cause

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2022.error.d.ts:24

diagnostics

readonly diagnostics: readonly Diagnostic[]

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:1288

message

message: string

Inherited from

Error.message

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1077

name

name: string

Inherited from

Error.name

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1076

stack?

optional stack: string

Inherited from

Error.stack

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1078

prepareStackTrace()?

static optional prepareStackTrace: (err, stackTraces) => any

Optional override for formatting stack traces

Parameters

err: Error

stackTraces: CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

Error.prepareStackTrace

Defined in

repos/toolcog/node_modules/.pnpm/@[email protected]/node_modules/@types/node/globals.d.ts:143

stackTraceLimit

static stackTraceLimit: number

Inherited from

Error.stackTraceLimit

Defined in

repos/toolcog/node_modules/.pnpm/@[email protected]/node_modules/@types/node/globals.d.ts:145

Methods

captureStackTrace()

static captureStackTrace(targetObject, constructorOpt?): void

Create .stack property on a target object

Parameters

targetObject: object

constructorOpt?: Function

Returns

void

Inherited from

Error.captureStackTrace

Defined in

repos/toolcog/node_modules/.pnpm/@[email protected]/node_modules/@types/node/globals.d.ts:136


ReplExitError

Extends

  • Error

Constructors

new ReplExitError()

new ReplExitError(message?): ReplExitError

Parameters

message?: string

Returns

ReplExitError

Inherited from

Error.constructor

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1082

new ReplExitError()

new ReplExitError(message?, options?): ReplExitError

Parameters

message?: string

options?: ErrorOptions

Returns

ReplExitError

Inherited from

Error.constructor

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1082

Properties

cause?

optional cause: unknown

Inherited from

Error.cause

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es2022.error.d.ts:24

message

message: string

Inherited from

Error.message

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1077

name

name: string

Inherited from

Error.name

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1076

stack?

optional stack: string

Inherited from

Error.stack

Defined in

node_modules/.pnpm/[email protected]/node_modules/typescript/lib/lib.es5.d.ts:1078

prepareStackTrace()?

static optional prepareStackTrace: (err, stackTraces) => any

Optional override for formatting stack traces

Parameters

err: Error

stackTraces: CallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

Error.prepareStackTrace

Defined in

repos/toolcog/node_modules/.pnpm/@[email protected]/node_modules/@types/node/globals.d.ts:143

stackTraceLimit

static stackTraceLimit: number

Inherited from

Error.stackTraceLimit

Defined in

repos/toolcog/node_modules/.pnpm/@[email protected]/node_modules/@types/node/globals.d.ts:145

Methods

captureStackTrace()

static captureStackTrace(targetObject, constructorOpt?): void

Create .stack property on a target object

Parameters

targetObject: object

constructorOpt?: Function

Returns

void

Inherited from

Error.captureStackTrace

Defined in

repos/toolcog/node_modules/.pnpm/@[email protected]/node_modules/@types/node/globals.d.ts:136

Interfaces

MarkdownTheme

Properties

blockquote()

readonly blockquote: (text) => string

Parameters

text: string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:19

bullet

readonly bullet: string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:10

checkbox()

readonly checkbox: (checked) => string

Parameters

checked: boolean

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:21

code()

readonly code: (text) => string

Parameters

text: string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:18

codespan()

readonly codespan: (text) => string

Parameters

text: string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:26

del()

readonly del: (text) => string

Parameters

text: string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:27

em()

readonly em: (text) => string

Parameters

text: string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:25

h1()

readonly h1: (text) => string

Parameters

text: string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:12

h2()

readonly h2: (text) => string

Parameters

text: string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:13

h3()

readonly h3: (text) => string

Parameters

text: string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:14

h4()

readonly h4: (text) => string

Parameters

text: string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:15

h5()

readonly h5: (text) => string

Parameters

text: string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:16

h6()

readonly h6: (text) => string

Parameters

text: string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:17

hr()

readonly hr: (text) => string

Parameters

text: string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:11

html()

readonly html: (text) => string

Parameters

text: string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:22

image()

readonly image: (text, url, title?) => string

Parameters

text: string

url: string

title?: string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:30

readonly link: (text, url, title?) => string

Parameters

text: string

url: string

title?: string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:29

linkDef()

readonly linkDef: (label, url) => string

Parameters

label: string

url: string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:31

paragraph()

readonly paragraph: (text) => string

Parameters

text: string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:23

point()

readonly point: (text) => string

Parameters

text: string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:20

sectionBreak

readonly sectionBreak: string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:9

strong()

readonly strong: (text) => string

Parameters

text: string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:24

text()

readonly text: (text) => string

Parameters

text: string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:32

url()

readonly url: (text) => string

Parameters

text: string

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:28


ReplCommand

Properties

action()

readonly action: (argument, repl) => void | Promise<void>

Parameters

argument: undefined | string

repl: Repl

Returns

void | Promise<void>

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:36

description?

readonly optional description: string

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:35


ReplImport

Properties

description?

readonly optional description: string

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:24

name

readonly name: string

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:22

type?

readonly optional type: string

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:23


ReplImports

Properties

description?

readonly optional description: string

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:29

module

readonly module: string

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:28

typeImports

readonly typeImports: readonly ReplImport[]

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:30

valueImports

readonly valueImports: readonly ReplImport[]

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:31


ReplOptions

Properties

commands?

optional commands: Record<string, ReplCommand>

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:51

compilerOptions?

optional compilerOptions: CompilerOptions

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:59

documentRegistry?

optional documentRegistry: DocumentRegistry

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:61

historyFile?

optional historyFile: string

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:53

historySize?

optional historySize: number

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:54

imports?

optional imports: ReplImports[]

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:49

input?

optional input: ReadableStream

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:43

languageVariant?

optional languageVariant: LanguageVariant

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:57

languageVersion?

optional languageVersion: ScriptTarget

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:56

output?

optional output: WritableStream

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:44

styled?

optional styled: boolean

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:47

terminal?

optional terminal: boolean

Defined in

repos/toolcog/packages/framework/repl/src/repl.ts:46

Variables

markdownTheme

const markdownTheme: MarkdownTheme

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:35

Functions

renderMarkdown()

renderMarkdown(tokens, theme, width, depth, top): string

Parameters

tokens: Token[] & object

theme: MarkdownTheme = markdownTheme

width: number = Infinity

depth: number = 0

top: boolean = true

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:86


renderMarkdownInline()

renderMarkdownInline(tokens, theme): string

Parameters

tokens: Token[]

theme: MarkdownTheme

Returns

string

Defined in

repos/toolcog/packages/framework/repl/src/markdown.ts:355