adachsoft / ssh-tool
SSH integration for AdachSoft AiToolCall — login, remote command execution and session management for pluggable AI tool actions.
v0.1.0
2026-04-23 07:41 UTC
Requires
- php: ^8.1
- adachsoft/ai-tool-call: ^2.0.1
- adachsoft/ssh-gate: ^0.1
- guzzlehttp/guzzle: ^7.8
Requires (Dev)
- adachsoft/command-executor-lib: ^2.0
- adachsoft/php-code-style: ^0.4.3
- friendsofphp/php-cs-fixer: ^3.95
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^13.1
- rector/rector: ^2.4
- symfony/dotenv: ^8.0
This package is not auto-updated.
Last update: 2026-04-24 12:08:20 UTC
README
SSH Tool is a bridge between AdachSoft AiToolCall and SSH operations. It implements the ToolInterface and uses the Strategy pattern to provide clean, testable SSH actions (login, logout, command execution, account management, etc.).
Features
- Full SSH session management (login/logout)
- Remote command execution with stdout/stderr/exit code handling
- Account listing and details retrieval
- Strategy/Command pattern for easy extension
- Strict type safety and comprehensive error handling
- PHPUnit tests (unit + functional)
Installation
composer require adachsoft/ssh-tool
Usage
1. Configuration
use AdachSoft\AiToolCall\SPI\Collection\ConfigMap;
use AdachSoft\SshTool\Config\SshToolConfigKeyEnum;
$config = new ConfigMap([
SshToolConfigKeyEnum::JSON_REPOSITORY_FILE_PATH->value => '/path/to/accounts.json',
SshToolConfigKeyEnum::SSH_API_BASE_URL->value => 'https://your-ssh-api.example.com',
]);
2. Registering the Tool
use AdachSoft\AiToolCall\PublicApi\Builder\AiToolCallFacadeBuilder;
use AdachSoft\SshTool\Factory\SshToolFactory;
$facade = AiToolCallFacadeBuilder::new()
->withSpiFactories([new SshToolFactory()])
->withToolConfigs(['ssh' => $config])
->build();
3. Available Actions
The tool supports the following actions via the action parameter:
login– Authenticates and returns a session tokenlogout– Ends an active SSH sessionexecuteCommand– Runs a command on a remote hostgetAccount– Retrieves details of a specific accountlistAccounts– Lists all configured accounts (without passwords)listSessions– Lists active sessions
Example call:
$result = $facade->callTool(new ToolCallRequestDto(
'ssh',
new KeyValueMap([
'action' => 'executeCommand',
'sessionToken' => 'abc123',
'command' => 'ls -la',
])
));
echo $result->result->get('stdout');
Development
Running Tests
# Unit + Functional tests
vendor/bin/phpunit
# Production/end-to-end tests (if available)
vendor/bin/phpunit --group production
Code Quality
vendor/bin/rector process --config=rector.php
vendor/bin/php-cs-fixer fix
vendor/bin/phpstan analyse src tests
Architecture
SshTool– thin router/delegatorSshActionInterface+ concrete*Actionclasses – each action is a separate, testable strategySshToolFactory– creates facade and injects actions- All public documentation is in English per project rules.
License
MIT License – see the LICENSE file for details.
Part of the AdachSoft ecosystem. For more information see adachsoft.com.