Add a command-line cline powered by deno

This commit is contained in:
Matt Rubens
2024-11-20 23:21:38 -05:00
parent e55696e247
commit 1c471bd3cb
12 changed files with 1103 additions and 0 deletions

43
cli/types.d.ts vendored Normal file
View File

@@ -0,0 +1,43 @@
export interface ApiHandler {
sendMessage(message: string): Promise<string>;
createMessage(systemPrompt: string, history: Message[]): AsyncIterable<MessageChunk>;
}
export interface AgentConfig {
api: ApiHandler;
systemPrompt: string;
workingDir: string;
debug?: boolean;
}
export type ToolResponse = string;
export interface Message {
role: "user" | "assistant";
content: TextBlock[];
}
export interface TextBlock {
type: "text";
text: string;
}
export interface ToolResult {
tool: string;
params: Record<string, string>;
output: string;
}
export interface MessageChunk {
type: "text";
text: string;
}
export interface UsageBlock {
type: "usage";
usage: {
prompt_tokens: number;
completion_tokens: number;
total_tokens: number;
};
}