Skip to content

Commit 672d028

Browse files
committed
Add Claude Rust SDK integration with feature flag
Add experimental support for using the Rust SDK (claude-agent-sdk-rs) instead of spawning the Claude binary. The SDK implementation handles session management, MCP server configuration, system prompts, streaming responses, and user cancellation. A toggle in project Agent Settings controls which backend is used. save 3
1 parent e8d5cc4 commit 672d028

File tree

12 files changed

+826
-73
lines changed

12 files changed

+826
-73
lines changed

Cargo.lock

Lines changed: 82 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/desktop/src/components/projectSettings/AgentSettings.svelte

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
let dangerouslyAllowAllPermissions = $state(false);
1515
let autoCommitAfterCompletion = $state(true);
1616
let useConfiguredModel = $state(false);
17+
let useRustSdk = $state(false);
1718
1819
// Initialize Claude settings from store
1920
$effect(() => {
@@ -23,6 +24,7 @@
2324
dangerouslyAllowAllPermissions = $settingsStore.claude.dangerouslyAllowAllPermissions;
2425
autoCommitAfterCompletion = $settingsStore.claude.autoCommitAfterCompletion;
2526
useConfiguredModel = $settingsStore.claude.useConfiguredModel;
27+
useRustSdk = $settingsStore.claude.useRustSdk;
2628
}
2729
});
2830
@@ -50,6 +52,11 @@
5052
useConfiguredModel = value;
5153
await settingsService.updateClaude({ useConfiguredModel: value });
5254
}
55+
56+
async function updateUseRustSdk(value: boolean) {
57+
useRustSdk = value;
58+
await settingsService.updateClaude({ useRustSdk: value });
59+
}
5360
</script>
5461

5562
<CardGroup.Item standalone>
@@ -98,6 +105,18 @@
98105
{/snippet}
99106
</CardGroup.Item>
100107

108+
<CardGroup.Item standalone labelFor="useRustSdk">
109+
{#snippet title()}
110+
Use Claude Rust SDK
111+
{/snippet}
112+
{#snippet caption()}
113+
Use the Rust SDK instead of spawning the Claude binary. (Experimental)
114+
{/snippet}
115+
{#snippet actions()}
116+
<Toggle id="useRustSdk" checked={useRustSdk} onchange={updateUseRustSdk} />
117+
{/snippet}
118+
</CardGroup.Item>
119+
101120
<CardGroup.Item standalone labelFor="newlineOnEnter">
102121
{#snippet title()}
103122
Newline on Enter

crates/but-claude/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,5 @@ tracing.workspace = true
4343
nix = { version = "0.30.1", features = ["signal"] }
4444
notify-rust = { workspace = true }
4545
url.workspace = true
46+
futures.workspace = true
47+
claude-agent-sdk-rs = "0.6"

0 commit comments

Comments
 (0)