Skip to content

Commit 9533caf

Browse files
authored
Merge pull request #459 from Extra-Chill/fix/workspace-tools-sandbox-mode
Expose workspace tools in sandbox mode
2 parents c496d9d + 0ec2a2e commit 9533caf

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

inc/Tools/WorkspaceTools.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ public function check_configuration( $configured, $tool_id )
7676
*/
7777
public function __construct()
7878
{
79-
$contexts = array( 'chat', 'pipeline' );
80-
$policy_contexts = array( 'chat', 'pipeline' );
79+
$contexts = array( 'chat', 'pipeline', 'sandbox' );
80+
$policy_contexts = array( 'chat', 'pipeline', 'sandbox' );
8181
$policy_meta = array( 'requires_opt_in' => true );
8282
$this->registerTool('workspace_path', array( $this, 'getPathDefinition' ), $contexts, array( 'ability' => 'datamachine/workspace-path' ));
8383
$this->registerTool('workspace_capabilities', array( $this, 'getCapabilitiesDefinition' ), $contexts, array( 'ability' => 'datamachine/workspace-capabilities' ));

inc/Workspace/RemoteWorkspaceBackend.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ class RemoteWorkspaceBackend {
2222
* Whether the remote backend should handle workspace operations.
2323
*/
2424
public static function should_handle(): bool {
25-
return ! \DataMachineCode\Support\GitRunner::is_available();
25+
$should_handle = ! \DataMachineCode\Support\GitRunner::is_available();
26+
return function_exists('apply_filters')
27+
? (bool) apply_filters('datamachine_code_remote_workspace_backend_should_handle', $should_handle)
28+
: $should_handle;
2629
}
2730

2831
/**

tests/smoke-workspace-policy-tools.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static function ( array $tools ) use ( $tool_id, $definition_callback, $contexts
9191
);
9292

9393
foreach ( $default_pipeline_tools as $tool ) {
94-
$assert("{$tool} remains default pipeline-visible", array( 'chat', 'pipeline' ) === ( $tools[ $tool ]['modes'] ?? null ));
94+
$assert("{$tool} remains default pipeline-visible and sandbox-visible", array( 'chat', 'pipeline', 'sandbox' ) === ( $tools[ $tool ]['modes'] ?? null ));
9595
}
9696

9797
$show_definition = $workspace_tools->getShowDefinition();
@@ -123,7 +123,7 @@ static function ( array $tools ) use ( $tool_id, $definition_callback, $contexts
123123
);
124124

125125
foreach ( $policy_tools as $tool ) {
126-
$assert("{$tool} is available in real chat and pipeline modes", array( 'chat', 'pipeline' ) === ( $tools[ $tool ]['modes'] ?? null ));
126+
$assert("{$tool} is available in real chat, pipeline, and sandbox modes", array( 'chat', 'pipeline', 'sandbox' ) === ( $tools[ $tool ]['modes'] ?? null ));
127127
$assert("{$tool} requires explicit opt-in for pipeline use", true === ( $tools[ $tool ]['requires_opt_in'] ?? null ));
128128
}
129129

0 commit comments

Comments
 (0)