@agent-compose/sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +152 -0
- package/dist/agent/agent-loop.d.ts +27 -0
- package/dist/agent/protocol.d.ts +7 -0
- package/dist/agent/run-agent.d.ts +58 -0
- package/dist/client.d.ts +110 -0
- package/dist/errors.d.ts +5 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.js +1114 -0
- package/dist/runtimes/claude.d.ts +63 -0
- package/dist/runtimes/openai-desktop.d.ts +22 -0
- package/dist/runtimes/openai-desktop.js +1197 -0
- package/dist/sandbox.d.ts +126 -0
- package/dist/types/events.d.ts +80 -0
- package/dist/types/protocol.d.ts +56 -0
- package/dist/types/runtime.d.ts +48 -0
- package/dist/types/sandbox-environment.d.ts +48 -0
- package/dist/types/sandbox.d.ts +50 -0
- package/dist/types/workflow.d.ts +109 -0
- package/dist/utils/bundler.d.ts +26 -0
- package/dist/utils/discovery.d.ts +2 -0
- package/dist/utils/errors.d.ts +2 -0
- package/dist/utils/schemas.d.ts +8 -0
- package/dist/utils/source-loader.d.ts +6 -0
- package/dist/workflows/engine.d.ts +50 -0
- package/package.json +60 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude CLI runtime — drives agents via the Claude CLI inside a sandbox.
|
|
3
|
+
*
|
|
4
|
+
* Works with any SandboxProvider (E2B, Vercel, etc.) — the provider is
|
|
5
|
+
* selected via SANDBOX_PROVIDER env var, not the runtime definition.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* import { createClaudeRuntime } from "@agent-compose/sdk";
|
|
9
|
+
* export default createClaudeRuntime({ claudeMdContent: "..." }); // optional global instructions
|
|
10
|
+
*/
|
|
11
|
+
import type { SandboxProvider, AgentMessage, ModelExecutionContract, RuntimeOptions } from "../index.js";
|
|
12
|
+
export declare class ClaudeRunner implements ModelExecutionContract {
|
|
13
|
+
private sandbox;
|
|
14
|
+
private options;
|
|
15
|
+
private claudeMdContent;
|
|
16
|
+
private configEnv;
|
|
17
|
+
private configModel?;
|
|
18
|
+
private configMcpServers?;
|
|
19
|
+
private claudeMdWritten;
|
|
20
|
+
private homeDir;
|
|
21
|
+
private label;
|
|
22
|
+
constructor(sandbox: SandboxProvider, options?: RuntimeOptions, claudeMdContent?: string, configEnv?: Record<string, string>, configModel?: string | undefined, configMcpServers?: Record<string, {
|
|
23
|
+
command: string;
|
|
24
|
+
args?: string[];
|
|
25
|
+
env?: Record<string, string>;
|
|
26
|
+
}> | undefined);
|
|
27
|
+
private getHomeDir;
|
|
28
|
+
private deployGlobalConfig;
|
|
29
|
+
/** Stream one CLI invocation, yielding AgentMessages. Resolves when the process exits. */
|
|
30
|
+
private _runCli;
|
|
31
|
+
sendMessage(opts: {
|
|
32
|
+
prompt: string;
|
|
33
|
+
sessionId?: string;
|
|
34
|
+
signal?: AbortSignal;
|
|
35
|
+
}): AsyncGenerator<AgentMessage>;
|
|
36
|
+
}
|
|
37
|
+
export interface ClaudeRuntimeConfig {
|
|
38
|
+
/** Global instructions written to ~/.claude/CLAUDE.md in every sandbox. */
|
|
39
|
+
claudeMdContent?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Environment variables set before each CLI invocation.
|
|
42
|
+
* Use to configure API provider routing (e.g. OpenRouter):
|
|
43
|
+
* env: { ANTHROPIC_BASE_URL: "https://openrouter.ai/api", ANTHROPIC_AUTH_TOKEN: "$OPENROUTER_API_KEY", ANTHROPIC_API_KEY: "" }
|
|
44
|
+
*/
|
|
45
|
+
env?: Record<string, string>;
|
|
46
|
+
/** Model to use (e.g. "claude-opus-4-6", "anthropic/claude-sonnet-4-6"). */
|
|
47
|
+
model?: string;
|
|
48
|
+
/** MCP servers to configure in the sandbox. Written to ~/.claude.json before the first iteration. */
|
|
49
|
+
mcpServers?: Record<string, {
|
|
50
|
+
command: string;
|
|
51
|
+
args?: string[];
|
|
52
|
+
env?: Record<string, string>;
|
|
53
|
+
}>;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Create a Claude CLI runtime.
|
|
57
|
+
*
|
|
58
|
+
* Encapsulates everything about how the Claude CLI runs in a sandbox:
|
|
59
|
+
* API provider routing, MCP server configuration, and global instructions.
|
|
60
|
+
*/
|
|
61
|
+
export declare function createClaudeRuntime(config?: ClaudeRuntimeConfig): import("../index.js").AgentRuntime<SandboxProvider>;
|
|
62
|
+
declare const _default: import("../index.js").AgentRuntime<SandboxProvider>;
|
|
63
|
+
export default _default;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAI Desktop Runner — ModelExecutionContract implementation using computer-use-preview.
|
|
3
|
+
*
|
|
4
|
+
* Works against DesktopSandboxProvider — no E2B SDK dependency here.
|
|
5
|
+
* The action→screenshot loop runs until the model emits text, then yields it.
|
|
6
|
+
*/
|
|
7
|
+
import type { DesktopSandboxProvider, AgentMessage, ModelExecutionContract, RuntimeOptions } from "../index.js";
|
|
8
|
+
export interface OpenAIDesktopRunnerOptions extends RuntimeOptions {
|
|
9
|
+
openaiKey: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class OpenAIDesktopRunner implements ModelExecutionContract {
|
|
12
|
+
private sandbox;
|
|
13
|
+
private openai;
|
|
14
|
+
private label;
|
|
15
|
+
constructor(sandbox: DesktopSandboxProvider, opts: OpenAIDesktopRunnerOptions);
|
|
16
|
+
sendMessage(opts: {
|
|
17
|
+
prompt: string;
|
|
18
|
+
sessionId?: string;
|
|
19
|
+
}): AsyncGenerator<AgentMessage>;
|
|
20
|
+
}
|
|
21
|
+
declare const _default: import("../index.js").AgentRuntime<DesktopSandboxProvider>;
|
|
22
|
+
export default _default;
|