Spike: PTY-based Claude Code integration with multi-agent concurrency
Proves that spawning `claude -p` in a pseudo-terminal from Rust gets Max subscription billing (apiKeySource: "none", rateLimitType: "five_hour") instead of per-token API charges. Concurrent agents run in parallel PTY sessions with session resumption via --resume for multi-turn conversations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -226,7 +226,7 @@ export class ChatWebSocket {
|
||||
|
||||
const protocol = window.location.protocol === "https:" ? "wss" : "ws";
|
||||
const wsHost = import.meta.env.DEV
|
||||
? "127.0.0.1:3001"
|
||||
? "127.0.0.1:3002"
|
||||
: window.location.host;
|
||||
const wsUrl = `${protocol}://${wsHost}${wsPath}`;
|
||||
|
||||
|
||||
@@ -406,7 +406,8 @@ export function Chat({ projectPath, onCloseProject }: ChatProps) {
|
||||
const messageToSend = messageOverride ?? input;
|
||||
if (!messageToSend.trim() || loading) return;
|
||||
|
||||
if (model.startsWith("claude-")) {
|
||||
const isClaudeCode = model === "claude-code-pty";
|
||||
if (!isClaudeCode && model.startsWith("claude-")) {
|
||||
const hasKey = await api.getAnthropicApiKeyExists();
|
||||
if (!hasKey) {
|
||||
pendingMessageRef.current = messageToSend;
|
||||
@@ -426,8 +427,13 @@ export function Chat({ projectPath, onCloseProject }: ChatProps) {
|
||||
setStreamingContent("");
|
||||
|
||||
try {
|
||||
const provider = isClaudeCode
|
||||
? "claude-code"
|
||||
: model.startsWith("claude-")
|
||||
? "anthropic"
|
||||
: "ollama";
|
||||
const config: ProviderConfig = {
|
||||
provider: model.startsWith("claude-") ? "anthropic" : "ollama",
|
||||
provider,
|
||||
model,
|
||||
base_url: "http://localhost:11434",
|
||||
enable_tools: enableTools,
|
||||
|
||||
@@ -175,6 +175,11 @@ export function ChatHeader({
|
||||
backgroundSize: "10px",
|
||||
}}
|
||||
>
|
||||
<optgroup label="Claude Code (PTY)">
|
||||
<option value="claude-code-pty">
|
||||
claude-code-pty
|
||||
</option>
|
||||
</optgroup>
|
||||
{(claudeModels.length > 0 || !hasAnthropicKey) && (
|
||||
<optgroup label="Anthropic">
|
||||
{claudeModels.length > 0 ? (
|
||||
|
||||
@@ -5,8 +5,9 @@ import { defineConfig } from "vite";
|
||||
export default defineConfig(() => ({
|
||||
plugins: [react()],
|
||||
server: {
|
||||
port: 5174,
|
||||
proxy: {
|
||||
"/api": "http://127.0.0.1:3001",
|
||||
"/api": "http://127.0.0.1:3002",
|
||||
},
|
||||
},
|
||||
build: {
|
||||
|
||||
Reference in New Issue
Block a user