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:
Dave
2026-02-19 15:25:22 +00:00
parent 8f0bc971bf
commit 68a19c393e
17 changed files with 1159 additions and 22 deletions

View File

@@ -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}`;

View File

@@ -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,

View File

@@ -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 ? (

View File

@@ -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: {