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

@@ -1,3 +1,4 @@
pub mod agents;
pub mod anthropic;
pub mod assets;
pub mod chat;
@@ -10,6 +11,7 @@ pub mod workflow;
pub mod project;
pub mod ws;
use agents::AgentsApi;
use anthropic::AnthropicApi;
use chat::ChatApi;
use context::AppContext;
@@ -45,6 +47,7 @@ type ApiTuple = (
IoApi,
ChatApi,
WorkflowApi,
AgentsApi,
);
type ApiService = OpenApiService<ApiTuple, ()>;
@@ -58,10 +61,11 @@ pub fn build_openapi_service(ctx: Arc<AppContext>) -> (ApiService, ApiService) {
IoApi { ctx: ctx.clone() },
ChatApi { ctx: ctx.clone() },
WorkflowApi { ctx: ctx.clone() },
AgentsApi { ctx: ctx.clone() },
);
let api_service =
OpenApiService::new(api, "Story Kit API", "1.0").server("http://127.0.0.1:3001/api");
OpenApiService::new(api, "Story Kit API", "1.0").server("http://127.0.0.1:3002/api");
let docs_api = (
ProjectApi { ctx: ctx.clone() },
@@ -69,11 +73,12 @@ pub fn build_openapi_service(ctx: Arc<AppContext>) -> (ApiService, ApiService) {
AnthropicApi::new(ctx.clone()),
IoApi { ctx: ctx.clone() },
ChatApi { ctx: ctx.clone() },
WorkflowApi { ctx },
WorkflowApi { ctx: ctx.clone() },
AgentsApi { ctx },
);
let docs_service =
OpenApiService::new(docs_api, "Story Kit API", "1.0").server("http://127.0.0.1:3001/api");
OpenApiService::new(docs_api, "Story Kit API", "1.0").server("http://127.0.0.1:3002/api");
(api_service, docs_service)
}