1xOps Command Center

v0.4.2
io.github.1xOps/command-center Checked 14 hours ago Published 16 days ago

Persistent terminal sessions, processes and text-file tools under one folder and command policy

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

start_process Start process

Runs a command in the configured shell as a persistent session and returns its first output. The session keeps running after the call returns; use its pid with interact_with_process, read_process_output and force_terminate.

ParameterTypeDescription
command *stringCommand line, for example "npm test" or "python3 -i"
cwdstringWorking directory; defaults to the server process directory
timeout_msintegerMilliseconds to wait for output before returning

interact_with_process Send input to a process

Writes a line of input to a running session (a shell, REPL or prompt) and returns the output that follows, including anything not yet read.

ParameterTypeDescription
input *string
pid *integer
timeout_msintegerMilliseconds to wait for output before returning

read_process_output Read process output

Returns output produced since the last read, waiting up to timeout_ms for new output when there is none.

ParameterTypeDescription
pid *integer
timeout_msintegerMilliseconds to wait for output before returning

force_terminate Stop process

Stops a session and its child processes (SIGTERM, then SIGKILL after 2 s) and returns its last output.

ParameterTypeDescription
pid *integer

list_sessions List sessions

Lists the sessions this server started, running or finished, with unread output counts.

read_file Read file

Reads a text file by lines (offset is 0-based; a negative offset reads from the end, e.g. -100 for the last 100 lines) or returns an image (png, jpg, gif, webp). Other binary files are refused.

ParameterTypeDescription
path *string
lengthintegerLines to return; capped at fileReadLineLimit
offsetinteger

read_multiple_files Read several files

Reads up to 20 text files from the start (up to fileReadLineLimit lines each). A file that cannot be read is reported without failing the others.

ParameterTypeDescription
paths *array

write_file Write file

Writes text to a file (mode "rewrite" replaces it, "append" adds to the end), creating parent folders. Content over fileWriteLineLimit lines is refused: write it in chunks with "append".

ParameterTypeDescription
content *string
path *string
modestring

edit_block Edit text in a file

Replaces old_string with new_string when it occurs exactly expected_replacements times. Otherwise nothing changes and the reply shows the count, or the closest passage when there is no exact match.

ParameterTypeDescription
file_path *string
new_string *string
old_string *string
expected_replacementsinteger

list_directory List directory

Lists a folder recursively to the given depth, marking [DIR], [FILE] and [LINK]; stops at 1000 entries.

ParameterTypeDescription
path *string
depthinteger

get_file_info File information

Returns type, size, times, permissions and, for text files, the line count.

ParameterTypeDescription
path *string

create_directory Create directory

Creates a folder and any missing parents; an existing folder is left as it is.

ParameterTypeDescription
path *string

move_file Move or rename

Moves or renames a file or folder. Refuses when the destination already exists.

ParameterTypeDescription
destination *string
source *string

get_more_search_results Next page of a search

Returns results offset..offset+length of a search started with start_search, waiting up to wait_ms for them while it is still running.

ParameterTypeDescription
id *string
lengthinteger
offsetinteger
wait_msinteger

list_processes List system processes

Lists the operating system's processes (pid, parent pid, name, memory), largest memory first. Read-only; stop a session this server started with force_terminate.

ParameterTypeDescription
filterstringOnly processes whose name contains this text (case-insensitive)
limitinteger

get_config Show settings

Shows the active settings and the file they come from.

set_config_value Change a setting

Changes fileReadLineLimit or fileWriteLineLimit. allowedDirectories, blockedCommands and defaultShell are refused: only a person can change them, in the config file.

ParameterTypeDescription
key *string
value *New value, e.g. 2000 for a line limit