GeminiCliSdk.Configuration (gemini_cli_sdk v0.2.0)

Copy Markdown View Source

Centralized numeric constants and compatibility defaults.

After the common runtime replatform, Gemini's streaming/session lane runs on cli_subprocess_core. This module therefore keeps Gemini-owned defaults for stream lifecycle management, synchronous command execution, public option defaults, and preserved compatibility knobs.

Override any value via Application configuration:

# config/config.exs
config :gemini_cli_sdk,
  stream_timeout_ms: 600_000,
  max_buffer_size: 2_097_152

Timeouts

KeyDefaultUsed ByDescription
:command_timeout_ms60,000CommandSynchronous command timeout
:stream_timeout_ms300,000StreamStream receive timeout
:default_timeout_ms300,000OptionsDefault user-facing timeout
:transport_call_timeout_ms5,000Legacy compatibility docsPreserved legacy timeout
:transport_force_close_timeout_ms500Legacy compatibility docsPreserved legacy timeout
:transport_headless_timeout_ms5,000Legacy compatibility docsPreserved legacy timeout
:transport_close_grace_ms2,000StreamClose grace period
:transport_kill_grace_ms250StreamKill/demonitor grace period
:command_stop_wait_ms200CommandWait after SIGTERM
:command_kill_wait_ms500CommandWait after SIGKILL
:finalize_delay_ms25Legacy compatibility docsPreserved legacy delay

Buffer Sizes

KeyDefaultUsed ByDescription
:max_buffer_size1,048,576Legacy compatibility docsPreserved legacy stdout buffer (1 MB)
:max_stderr_buffer_size262,144Options, StreamDefault stderr buffer (256 KB)

Limits

KeyDefaultUsed ByDescription
:max_lines_per_batch200Legacy compatibility docsPreserved legacy batch size
:max_include_directories5OptionsMax include directories

Compile-Time vs Runtime

Constants consumed via module attributes (for example in Stream) are evaluated at compile time. Changing these via Application.put_env/3 at runtime requires recompilation of the consuming module. Constants consumed via direct function calls (for example in Command.run/2) pick up runtime changes immediately.

Summary

Functions

Returns all configuration keys and their current values.

Returns the configured value for command_kill_wait_ms (default: 500).

Returns the configured value for command_stop_wait_ms (default: 200).

Returns the configured value for command_timeout_ms (default: 60000).

Returns the configured value for default_timeout_ms (default: 300000).

Returns the configured value for finalize_delay_ms (default: 25).

Returns the configured value for max_buffer_size (default: 1048576).

Returns the configured value for max_include_directories (default: 5).

Returns the configured value for max_lines_per_batch (default: 200).

Returns the configured value for max_stderr_buffer_size (default: 262144).

Returns the configured value for stream_timeout_ms (default: 300000).

Returns the configured value for transport_call_timeout_ms (default: 5000).

Returns the configured value for transport_close_grace_ms (default: 2000).

Returns the configured value for transport_force_close_timeout_ms (default: 500).

Returns the configured value for transport_headless_timeout_ms (default: 5000).

Returns the configured value for transport_kill_grace_ms (default: 250).

Functions

all()

@spec all() :: keyword(pos_integer())

Returns all configuration keys and their current values.

command_kill_wait_ms()

@spec command_kill_wait_ms() :: pos_integer()

Returns the configured value for command_kill_wait_ms (default: 500).

command_stop_wait_ms()

@spec command_stop_wait_ms() :: pos_integer()

Returns the configured value for command_stop_wait_ms (default: 200).

command_timeout_ms()

@spec command_timeout_ms() :: pos_integer()

Returns the configured value for command_timeout_ms (default: 60000).

default_timeout_ms()

@spec default_timeout_ms() :: pos_integer()

Returns the configured value for default_timeout_ms (default: 300000).

finalize_delay_ms()

@spec finalize_delay_ms() :: pos_integer()

Returns the configured value for finalize_delay_ms (default: 25).

max_buffer_size()

@spec max_buffer_size() :: pos_integer()

Returns the configured value for max_buffer_size (default: 1048576).

max_include_directories()

@spec max_include_directories() :: pos_integer()

Returns the configured value for max_include_directories (default: 5).

max_lines_per_batch()

@spec max_lines_per_batch() :: pos_integer()

Returns the configured value for max_lines_per_batch (default: 200).

max_stderr_buffer_size()

@spec max_stderr_buffer_size() :: pos_integer()

Returns the configured value for max_stderr_buffer_size (default: 262144).

stream_timeout_ms()

@spec stream_timeout_ms() :: pos_integer()

Returns the configured value for stream_timeout_ms (default: 300000).

transport_call_timeout_ms()

@spec transport_call_timeout_ms() :: pos_integer()

Returns the configured value for transport_call_timeout_ms (default: 5000).

transport_close_grace_ms()

@spec transport_close_grace_ms() :: pos_integer()

Returns the configured value for transport_close_grace_ms (default: 2000).

transport_force_close_timeout_ms()

@spec transport_force_close_timeout_ms() :: pos_integer()

Returns the configured value for transport_force_close_timeout_ms (default: 500).

transport_headless_timeout_ms()

@spec transport_headless_timeout_ms() :: pos_integer()

Returns the configured value for transport_headless_timeout_ms (default: 5000).

transport_kill_grace_ms()

@spec transport_kill_grace_ms() :: pos_integer()

Returns the configured value for transport_kill_grace_ms (default: 250).