- Implement tests for random ID generation, ensuring preference for crypto.randomUUID. - Create tests for runtime context capabilities, validating the injection of enabled skill capabilities. - Add tests for skill capability parsing, including classification and command example extraction. - Introduce tests for the skill planner, verifying tool call planning based on user requests and attachment requirements. - Establish tests for UV setup, ensuring proper handling of Python installation scenarios and environment checks.
144 lines
3.1 KiB
TypeScript
144 lines
3.1 KiB
TypeScript
export interface AttachedFileMeta {
|
|
fileName: string;
|
|
mimeType: string;
|
|
fileSize: number;
|
|
preview: string | null;
|
|
filePath?: string;
|
|
source?: 'user-upload' | 'tool-result' | 'tool-artifact' | 'message-ref';
|
|
}
|
|
|
|
export type ToolLifecycleStatus = 'running' | 'completed' | 'error';
|
|
|
|
export type ToolArtifactKind =
|
|
| 'file'
|
|
| 'image'
|
|
| 'table'
|
|
| 'url'
|
|
| 'json'
|
|
| 'text'
|
|
| 'unknown';
|
|
|
|
export interface ToolArtifact {
|
|
kind?: ToolArtifactKind;
|
|
name?: string;
|
|
label?: string;
|
|
description?: string;
|
|
mimeType?: string;
|
|
uri?: string;
|
|
filePath?: string;
|
|
preview?: string | null;
|
|
metadata?: Record<string, unknown>;
|
|
}
|
|
|
|
export interface ToolErrorInfo {
|
|
code?: string;
|
|
message: string;
|
|
details?: unknown;
|
|
}
|
|
|
|
export interface ToolRenderHints {
|
|
card?:
|
|
| 'generic'
|
|
| 'document-analysis'
|
|
| 'search-results'
|
|
| 'browser-step'
|
|
| 'command-output'
|
|
| 'skill-install';
|
|
preferredView?: 'summary' | 'table' | 'log' | 'artifact-list';
|
|
skillType?: string;
|
|
metadata?: Record<string, unknown>;
|
|
}
|
|
|
|
export interface ToolResultPayload {
|
|
ok?: boolean;
|
|
summary?: string;
|
|
structuredData?: unknown;
|
|
files?: AttachedFileMeta[];
|
|
artifacts?: ToolArtifact[];
|
|
logs?: Array<string | Record<string, unknown>>;
|
|
error?: string | ToolErrorInfo;
|
|
retryable?: boolean;
|
|
skillType?: string;
|
|
renderHints?: ToolRenderHints;
|
|
raw?: unknown;
|
|
}
|
|
|
|
export interface ToolCallPayload {
|
|
id?: string;
|
|
name?: string;
|
|
input?: unknown;
|
|
arguments?: unknown;
|
|
summary?: string;
|
|
}
|
|
|
|
export interface ContentBlockSource {
|
|
type: string;
|
|
media_type?: string;
|
|
data?: string;
|
|
url?: string;
|
|
}
|
|
|
|
export interface ContentBlock {
|
|
type: 'text' | 'image' | 'thinking' | 'tool_use' | 'tool_result' | 'toolCall' | 'toolResult';
|
|
text?: string;
|
|
thinking?: string;
|
|
source?: ContentBlockSource;
|
|
data?: string;
|
|
mimeType?: string;
|
|
id?: string;
|
|
name?: string;
|
|
toolCallId?: string;
|
|
input?: unknown;
|
|
arguments?: unknown;
|
|
content?: string | ContentBlock[];
|
|
result?: ToolResultPayload | unknown;
|
|
summary?: string;
|
|
ok?: boolean;
|
|
error?: string | ToolErrorInfo;
|
|
artifacts?: ToolArtifact[];
|
|
renderHints?: ToolRenderHints;
|
|
metadata?: Record<string, unknown>;
|
|
}
|
|
|
|
export type RawMessageRole = 'user' | 'assistant' | 'system' | 'toolresult' | 'tool_result';
|
|
|
|
export interface RawMessage {
|
|
role: RawMessageRole;
|
|
content: string | ContentBlock[];
|
|
timestamp?: number;
|
|
id?: string;
|
|
toolCallId?: string;
|
|
toolName?: string;
|
|
details?: unknown;
|
|
isError?: boolean;
|
|
question?: string[];
|
|
toolCall?: ToolCallPayload | Record<string, unknown> | null;
|
|
toolResult?: ToolResultPayload | null;
|
|
_attachedFiles?: AttachedFileMeta[];
|
|
_toolStatuses?: ToolStatus[];
|
|
}
|
|
|
|
export interface ToolStatus {
|
|
id?: string;
|
|
toolCallId?: string;
|
|
name: string;
|
|
status: ToolLifecycleStatus;
|
|
durationMs?: number;
|
|
summary?: string;
|
|
updatedAt: number;
|
|
input?: unknown;
|
|
result?: ToolResultPayload | unknown;
|
|
error?: string | ToolErrorInfo;
|
|
artifacts?: ToolArtifact[];
|
|
renderHints?: ToolRenderHints;
|
|
}
|
|
|
|
export interface ChatSession {
|
|
key: string;
|
|
label?: string;
|
|
displayName?: string;
|
|
thinkingLevel?: string;
|
|
model?: string;
|
|
updatedAt?: number;
|
|
}
|