Arcane OS Docs Development only

Reference

Arcane.terminal.resize()

Updates the session dimensions. The current hosts record an emulated resize rather than claiming a native pseudo-terminal resize.

  • Reference

This focused page is derived from the mechanically checked full member inventory.

Syntax

Arcane.terminal.resize(sessionId, columns, rows)

Parameters

sessionId; columns: 20–500; rows: 5–200

Return value

Promise<{sessionId,columns,rows,accepted:true,emulated:true}>

Description

Updates the session dimensions. The current hosts record an emulated resize rather than claiming a native pseudo-terminal resize.

Overview

Arcane.terminal.resize(sessionId, columns, rows) updates the bounded dimensions recorded for a running app-owned session. The current host contract reports this as an emulated resize. It updates Arcane's terminal-session dimensions but does not promise a native pseudoterminal resize or emit a resize event.

Dimensions

Parameter Type Contract
sessionId string Opaque id returned by start() or list(), no longer than 128 characters.
columns safe integer From 20 through 500.
rows safe integer From 5 through 200.

The wrapper converts both dimensions with Number(). Fractions, non-finite values, and out-of-range values do not satisfy the checked method contract.

Acceptance result

The method resolves to this exact object:

const result = {
    sessionId: 'term-example',
    columns: 100,
    rows: 30,
    accepted: true,
    emulated: true
};

The returned dimensions are the accepted values. emulated: true distinguishes this session metadata update from a guarantee that the operating system resized a native pseudoterminal.

Errors and recovery

Invalid dimensions are rejected as METHOD_CONTRACT_INPUT_INVALID. An invalid or retired id produces TERMINAL_SESSION_INVALID or TERMINAL_SESSION_NOT_FOUND. Use list() to refresh current app-owned sessions; do not reuse an id after exit.

Example

const terminal = globalThis.Arcane?.terminal;

if (!terminal?.resize || !terminal?.list) {
    throw new Error('Terminal resize is unavailable.');
}

const {sessions} = await terminal.list();
const session = sessions[0];

if (!session) {
    throw new Error('Start a terminal session before resizing it.');
}

try {
    const result = await terminal.resize(session.id, 100, 30);
    console.log(
        `Recorded ${result.columns}x${result.rows}`,
        `emulated=${result.emulated}`
    );
} catch (error) {
    if (error instanceof Arcane.Error) {
        console.error(error.code, error.message, error.resolution);
    } else {
        throw error;
    }
}

Reference group

Applications, terminal, and capabilities

Repository and reviewed source access