generated from nhcarrigan/template
feat: initial prototype
Security Scan and Upload / Security & DefectDojo Upload (push) Successful in 47s
Security Scan and Upload / Security & DefectDojo Upload (push) Successful in 47s
This commit is contained in:
@@ -0,0 +1,120 @@
|
||||
export interface SystemInitMessage {
|
||||
type: "system";
|
||||
subtype: "init";
|
||||
session_id: string;
|
||||
cwd: string;
|
||||
tools: string[];
|
||||
mcp_servers?: string[];
|
||||
model?: string;
|
||||
}
|
||||
|
||||
export interface SystemCompactMessage {
|
||||
type: "system";
|
||||
subtype: "compact_boundary";
|
||||
}
|
||||
|
||||
export type SystemMessage = SystemInitMessage | SystemCompactMessage;
|
||||
|
||||
export interface TextContentBlock {
|
||||
type: "text";
|
||||
text: string;
|
||||
}
|
||||
|
||||
export interface ThinkingContentBlock {
|
||||
type: "thinking";
|
||||
thinking: string;
|
||||
}
|
||||
|
||||
export interface ToolUseContentBlock {
|
||||
type: "tool_use";
|
||||
id: string;
|
||||
name: string;
|
||||
input: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface ToolResultContentBlock {
|
||||
type: "tool_result";
|
||||
tool_use_id: string;
|
||||
content: string;
|
||||
is_error?: boolean;
|
||||
}
|
||||
|
||||
export type ContentBlock =
|
||||
| TextContentBlock
|
||||
| ThinkingContentBlock
|
||||
| ToolUseContentBlock
|
||||
| ToolResultContentBlock;
|
||||
|
||||
export interface AssistantMessage {
|
||||
type: "assistant";
|
||||
message: {
|
||||
content: ContentBlock[];
|
||||
model?: string;
|
||||
stop_reason?: string;
|
||||
};
|
||||
parent_tool_use_id?: string;
|
||||
}
|
||||
|
||||
export interface UserMessage {
|
||||
type: "user";
|
||||
message: {
|
||||
content: ContentBlock[];
|
||||
};
|
||||
}
|
||||
|
||||
export interface StreamEvent {
|
||||
type: "stream_event";
|
||||
event: {
|
||||
type: string;
|
||||
index?: number;
|
||||
content_block?: ContentBlock;
|
||||
delta?: {
|
||||
type: string;
|
||||
text?: string;
|
||||
thinking?: string;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export interface PermissionDenial {
|
||||
tool_name: string;
|
||||
tool_use_id: string;
|
||||
tool_input: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface ResultMessage {
|
||||
type: "result";
|
||||
subtype: "success" | "error_max_turns" | "error_tool" | "error_api" | "error_unknown";
|
||||
result?: string;
|
||||
duration_ms?: number;
|
||||
num_turns?: number;
|
||||
total_cost_usd?: number;
|
||||
usage?: {
|
||||
input_tokens: number;
|
||||
output_tokens: number;
|
||||
};
|
||||
permission_denials?: PermissionDenial[];
|
||||
}
|
||||
|
||||
export type ClaudeStreamMessage =
|
||||
| SystemMessage
|
||||
| AssistantMessage
|
||||
| UserMessage
|
||||
| StreamEvent
|
||||
| ResultMessage;
|
||||
|
||||
export interface PermissionRequest {
|
||||
id: string;
|
||||
tool: string;
|
||||
description: string;
|
||||
input: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface PermissionPromptEvent {
|
||||
id: string;
|
||||
tool_name: string;
|
||||
tool_input: Record<string, unknown>;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export type ConnectionStatus = "disconnected" | "connecting" | "connected" | "error";
|
||||
@@ -0,0 +1,74 @@
|
||||
export type CharacterState =
|
||||
| "idle"
|
||||
| "thinking"
|
||||
| "typing"
|
||||
| "searching"
|
||||
| "coding"
|
||||
| "mcp"
|
||||
| "permission"
|
||||
| "success"
|
||||
| "error";
|
||||
|
||||
export interface CharacterStateInfo {
|
||||
state: CharacterState;
|
||||
label: string;
|
||||
description: string;
|
||||
spriteFile: string;
|
||||
}
|
||||
|
||||
export const CHARACTER_STATES: Record<CharacterState, CharacterStateInfo> = {
|
||||
idle: {
|
||||
state: "idle",
|
||||
label: "Ready",
|
||||
description: "Waiting for your command~",
|
||||
spriteFile: "idle.png",
|
||||
},
|
||||
thinking: {
|
||||
state: "thinking",
|
||||
label: "Thinking",
|
||||
description: "Hmm, let me think about this...",
|
||||
spriteFile: "thinking.png",
|
||||
},
|
||||
typing: {
|
||||
state: "typing",
|
||||
label: "Typing",
|
||||
description: "Writing response...",
|
||||
spriteFile: "typing.png",
|
||||
},
|
||||
searching: {
|
||||
state: "searching",
|
||||
label: "Searching",
|
||||
description: "Looking through files...",
|
||||
spriteFile: "searching.png",
|
||||
},
|
||||
coding: {
|
||||
state: "coding",
|
||||
label: "Coding",
|
||||
description: "Writing some code!",
|
||||
spriteFile: "coding.png",
|
||||
},
|
||||
mcp: {
|
||||
state: "mcp",
|
||||
label: "Using Tools",
|
||||
description: "Connecting to external tools...",
|
||||
spriteFile: "mcp.png",
|
||||
},
|
||||
permission: {
|
||||
state: "permission",
|
||||
label: "Permission Needed",
|
||||
description: "May I do this?",
|
||||
spriteFile: "permission.png",
|
||||
},
|
||||
success: {
|
||||
state: "success",
|
||||
label: "Done!",
|
||||
description: "Task completed successfully!",
|
||||
spriteFile: "success.png",
|
||||
},
|
||||
error: {
|
||||
state: "error",
|
||||
label: "Oops",
|
||||
description: "Something went wrong...",
|
||||
spriteFile: "error.png",
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user