mirror of
https://github.com/KeygraphHQ/shannon.git
synced 2026-05-20 07:54:47 +02:00
8e4fafba99
- Delete unused src/cli/ui.ts, remove zod dependency, drop 4 dead functions (logError, handleToolError, getRetryDelay, displayTimingSummary) - Remove 8 unused types/interfaces and 3 duplicate formatting utils from audit/utils.ts - Narrow export surface: make 7 message-handler functions private, remove unused audit re-exports, unexport AgentDefinition and path constants - Remove unused runClaudePrompt params (sessionMetadata, attemptNumber) and update caller - Enable tsconfig noUnusedLocals, noUnusedParameters, noImplicitReturns, noImplicitOverride, noFallthroughCasesInSwitch
109 lines
2.1 KiB
TypeScript
109 lines
2.1 KiB
TypeScript
// Copyright (C) 2025 Keygraph, Inc.
|
|
//
|
|
// This program is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Affero General Public License version 3
|
|
// as published by the Free Software Foundation.
|
|
|
|
// Type definitions for Claude executor message processing pipeline
|
|
|
|
export interface ExecutionContext {
|
|
isParallelExecution: boolean;
|
|
useCleanOutput: boolean;
|
|
agentType: string;
|
|
agentKey: string;
|
|
}
|
|
|
|
export interface AssistantResult {
|
|
content: string;
|
|
cleanedContent: string;
|
|
apiErrorDetected: boolean;
|
|
shouldThrow?: Error;
|
|
logData: {
|
|
turn: number;
|
|
content: string;
|
|
timestamp: string;
|
|
};
|
|
}
|
|
|
|
export interface ResultData {
|
|
result: string | null;
|
|
cost: number;
|
|
duration_ms: number;
|
|
subtype?: string;
|
|
stop_reason?: string | null;
|
|
permissionDenials: number;
|
|
}
|
|
|
|
export interface ToolUseData {
|
|
toolName: string;
|
|
parameters: Record<string, unknown>;
|
|
timestamp: string;
|
|
}
|
|
|
|
export interface ToolResultData {
|
|
content: unknown;
|
|
displayContent: string;
|
|
timestamp: string;
|
|
}
|
|
|
|
export interface ContentBlock {
|
|
type?: string;
|
|
text?: string;
|
|
}
|
|
|
|
export type SDKAssistantMessageError =
|
|
| 'authentication_failed'
|
|
| 'billing_error'
|
|
| 'rate_limit'
|
|
| 'invalid_request'
|
|
| 'server_error'
|
|
| 'max_output_tokens'
|
|
| 'unknown';
|
|
|
|
export interface AssistantMessage {
|
|
type: 'assistant';
|
|
error?: SDKAssistantMessageError;
|
|
message: {
|
|
content: ContentBlock[] | string;
|
|
};
|
|
}
|
|
|
|
export interface ResultMessage {
|
|
type: 'result';
|
|
result?: string;
|
|
total_cost_usd?: number;
|
|
duration_ms?: number;
|
|
subtype?: string;
|
|
stop_reason?: string | null;
|
|
permission_denials?: unknown[];
|
|
}
|
|
|
|
export interface ToolUseMessage {
|
|
type: 'tool_use';
|
|
name: string;
|
|
input?: Record<string, unknown>;
|
|
}
|
|
|
|
export interface ToolResultMessage {
|
|
type: 'tool_result';
|
|
content?: unknown;
|
|
}
|
|
|
|
export interface ApiErrorDetection {
|
|
detected: boolean;
|
|
shouldThrow?: Error;
|
|
}
|
|
|
|
export interface SystemInitMessage {
|
|
type: 'system';
|
|
subtype: 'init';
|
|
model?: string;
|
|
permissionMode?: string;
|
|
mcp_servers?: Array<{ name: string; status: string }>;
|
|
}
|
|
|
|
export interface UserMessage {
|
|
type: 'user';
|
|
}
|
|
|