Skip to content

system

Functions

screenshot

ts
screenshot(filepath: string, x: number, y: number, width: number, height: number)

A tool for taking a screenshot and saving it to a file. Optionally specify x, y, width, and height to capture a specific region.

@param filepath - Path to save the screenshot @param x - X coordinate of capture region @param y - Y coordinate of capture region @param width - Width of capture region @param height - Height of capture region

Parameters:

NameTypeDefault
filepathstring
xnumber-1
ynumber-1
widthnumber-1
heightnumber-1

Throws: std::screenshot

(source)

exit

ts
exit(code: number)

Terminate the process immediately with the given exit code. Use with caution — this skips any cleanup or pending operations. @param code - Exit code (0 for success, non-zero for failure)

Parameters:

NameTypeDefault
codenumber0

Throws: std::exit

(source)

args

ts
args(): string[]

Return the command-line arguments passed to the Agency program (excluding the node executable and script path).

Returns: string[]

(source)

cwd

ts
cwd(): string

Return the absolute path of the current working directory of the Agency process.

Returns: string

(source)

env

ts
env(name: string): string | null

Read an environment variable. Returns null if the variable is not set.

Parameters:

NameTypeDefault
namestring

Returns: string | null

(source)

setEnv

ts
setEnv(name: string, value: string): Result

Set an environment variable in the current process. Fails if the name is empty or contains '='. The change is visible to child processes spawned afterward but does not persist outside the current process.

@param name - The environment variable name @param value - The value to set

Parameters:

NameTypeDefault
namestring
valuestring

Returns: Result

Throws: std::setEnv

(source)

openUrl

ts
openUrl(url: string): Result

Open a URL in the user's default browser. Currently macOS-only.

Parameters:

NameTypeDefault
urlstring

Returns: Result

Throws: std::openUrl

(source)