instantcode
Version:
AI-powered web inspection tool - Pick elements and get instant AI assistance
423 lines (422 loc) • 15.4 kB
TypeScript
import { z } from 'zod';
export declare const ElementDataSchema: z.ZodObject<{
index: z.ZodNumber;
tagName: z.ZodString;
xpath: z.ZodString;
cssSelector: z.ZodString;
textContent: z.ZodString;
attributes: z.ZodRecord<z.ZodString, z.ZodString>;
children: z.ZodArray<z.ZodAny>;
imagePath: z.ZodOptional<z.ZodString>;
computedStyles: z.ZodOptional<z.ZodObject<{
width: z.ZodNumber;
height: z.ZodNumber;
fontSize: z.ZodString;
fontFamily: z.ZodString;
color: z.ZodOptional<z.ZodString>;
backgroundColor: z.ZodOptional<z.ZodString>;
display: z.ZodOptional<z.ZodString>;
position: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>;
componentData: z.ZodOptional<z.ZodObject<{
componentLocation: z.ZodString;
componentName: z.ZodOptional<z.ZodString>;
elementLocation: z.ZodOptional<z.ZodObject<{
file: z.ZodString;
line: z.ZodNumber;
column: z.ZodNumber;
endLine: z.ZodOptional<z.ZodNumber>;
endColumn: z.ZodOptional<z.ZodNumber>;
source: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>;
framework: z.ZodOptional<z.ZodEnum<{
vue: "vue";
react: "react";
angular: "angular";
svelte: "svelte";
vanilla: "vanilla";
}>>;
sourceMap: z.ZodOptional<z.ZodObject<{
originalLine: z.ZodNumber;
originalColumn: z.ZodNumber;
originalSource: z.ZodString;
originalName: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>;
sourceHierarchy: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>;
}, z.core.$strip>;
export declare const PageInfoSchema: z.ZodObject<{
url: z.ZodString;
title: z.ZodString;
}, z.core.$strip>;
export declare const SendMessageSchema: z.ZodObject<{
userPrompt: z.ZodString;
selectedElements: z.ZodArray<z.ZodObject<{
index: z.ZodNumber;
tagName: z.ZodString;
xpath: z.ZodString;
cssSelector: z.ZodString;
textContent: z.ZodString;
attributes: z.ZodRecord<z.ZodString, z.ZodString>;
children: z.ZodArray<z.ZodAny>;
imagePath: z.ZodOptional<z.ZodString>;
computedStyles: z.ZodOptional<z.ZodObject<{
width: z.ZodNumber;
height: z.ZodNumber;
fontSize: z.ZodString;
fontFamily: z.ZodString;
color: z.ZodOptional<z.ZodString>;
backgroundColor: z.ZodOptional<z.ZodString>;
display: z.ZodOptional<z.ZodString>;
position: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>;
componentData: z.ZodOptional<z.ZodObject<{
componentLocation: z.ZodString;
componentName: z.ZodOptional<z.ZodString>;
elementLocation: z.ZodOptional<z.ZodObject<{
file: z.ZodString;
line: z.ZodNumber;
column: z.ZodNumber;
endLine: z.ZodOptional<z.ZodNumber>;
endColumn: z.ZodOptional<z.ZodNumber>;
source: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>;
framework: z.ZodOptional<z.ZodEnum<{
vue: "vue";
react: "react";
angular: "angular";
svelte: "svelte";
vanilla: "vanilla";
}>>;
sourceMap: z.ZodOptional<z.ZodObject<{
originalLine: z.ZodNumber;
originalColumn: z.ZodNumber;
originalSource: z.ZodString;
originalName: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>;
sourceHierarchy: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>;
}, z.core.$strip>>;
pageInfo: z.ZodObject<{
url: z.ZodString;
title: z.ZodString;
}, z.core.$strip>;
cwd: z.ZodOptional<z.ZodString>;
sessionId: z.ZodOptional<z.ZodString>;
consoleErrors: z.ZodOptional<z.ZodArray<z.ZodString>>;
consoleWarnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
consoleInfo: z.ZodOptional<z.ZodArray<z.ZodString>>;
}, z.core.$strip>;
export declare const ApiKeySourceSchema: z.ZodEnum<{
user: "user";
project: "project";
org: "org";
temporary: "temporary";
}>;
export declare const PermissionModeSchema: z.ZodEnum<{
default: "default";
acceptEdits: "acceptEdits";
bypassPermissions: "bypassPermissions";
plan: "plan";
}>;
export declare const UsageSchema: z.ZodObject<{
input_tokens: z.ZodNumber;
cache_creation_input_tokens: z.ZodNumber;
cache_read_input_tokens: z.ZodNumber;
output_tokens: z.ZodNumber;
}, z.core.$strip>;
export declare const PermissionDenialSchema: z.ZodObject<{
tool_name: z.ZodString;
tool_use_id: z.ZodString;
tool_input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
}, z.core.$strip>;
export declare const SDKSystemMessageSchema: z.ZodObject<{
type: z.ZodLiteral<"system">;
subtype: z.ZodLiteral<"init">;
apiKeySource: z.ZodEnum<{
user: "user";
project: "project";
org: "org";
temporary: "temporary";
}>;
cwd: z.ZodString;
session_id: z.ZodString;
tools: z.ZodArray<z.ZodString>;
mcp_servers: z.ZodArray<z.ZodObject<{
name: z.ZodString;
status: z.ZodString;
}, z.core.$strip>>;
model: z.ZodString;
permissionMode: z.ZodEnum<{
default: "default";
acceptEdits: "acceptEdits";
bypassPermissions: "bypassPermissions";
plan: "plan";
}>;
slash_commands: z.ZodArray<z.ZodString>;
}, z.core.$strip>;
export declare const SDKAssistantMessageSchema: z.ZodObject<{
type: z.ZodLiteral<"assistant">;
message: z.ZodObject<{
id: z.ZodString;
type: z.ZodLiteral<"message">;
role: z.ZodLiteral<"assistant">;
model: z.ZodString;
content: z.ZodArray<z.ZodObject<{
type: z.ZodString;
text: z.ZodOptional<z.ZodString>;
id: z.ZodOptional<z.ZodString>;
name: z.ZodOptional<z.ZodString>;
input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
}, z.core.$strip>>;
stop_reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
stop_sequence: z.ZodOptional<z.ZodNullable<z.ZodString>>;
usage: z.ZodOptional<z.ZodObject<{
input_tokens: z.ZodNumber;
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
output_tokens: z.ZodNumber;
}, z.core.$strip>>;
}, z.core.$strip>;
parent_tool_use_id: z.ZodNullable<z.ZodString>;
session_id: z.ZodString;
}, z.core.$strip>;
export declare const SDKUserMessageSchema: z.ZodObject<{
type: z.ZodLiteral<"user">;
message: z.ZodObject<{
role: z.ZodLiteral<"user">;
content: z.ZodArray<z.ZodObject<{
type: z.ZodString;
content: z.ZodOptional<z.ZodString>;
tool_use_id: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>;
}, z.core.$strip>;
parent_tool_use_id: z.ZodNullable<z.ZodString>;
session_id: z.ZodString;
}, z.core.$strip>;
export declare const SDKResultSuccessSchema: z.ZodObject<{
type: z.ZodLiteral<"result">;
subtype: z.ZodLiteral<"success">;
duration_ms: z.ZodNumber;
duration_api_ms: z.ZodNumber;
is_error: z.ZodLiteral<false>;
num_turns: z.ZodNumber;
result: z.ZodString;
session_id: z.ZodString;
total_cost_usd: z.ZodNumber;
usage: z.ZodObject<{
input_tokens: z.ZodNumber;
cache_creation_input_tokens: z.ZodNumber;
cache_read_input_tokens: z.ZodNumber;
output_tokens: z.ZodNumber;
}, z.core.$strip>;
permission_denials: z.ZodArray<z.ZodObject<{
tool_name: z.ZodString;
tool_use_id: z.ZodString;
tool_input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
}, z.core.$strip>>;
}, z.core.$strip>;
export declare const SDKResultErrorSchema: z.ZodObject<{
type: z.ZodLiteral<"result">;
subtype: z.ZodEnum<{
error_max_turns: "error_max_turns";
error_during_execution: "error_during_execution";
}>;
duration_ms: z.ZodNumber;
duration_api_ms: z.ZodNumber;
is_error: z.ZodLiteral<true>;
num_turns: z.ZodNumber;
session_id: z.ZodString;
total_cost_usd: z.ZodNumber;
usage: z.ZodObject<{
input_tokens: z.ZodNumber;
cache_creation_input_tokens: z.ZodNumber;
cache_read_input_tokens: z.ZodNumber;
output_tokens: z.ZodNumber;
}, z.core.$strip>;
permission_denials: z.ZodArray<z.ZodObject<{
tool_name: z.ZodString;
tool_use_id: z.ZodString;
tool_input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
}, z.core.$strip>>;
}, z.core.$strip>;
export declare const ServerErrorSchema: z.ZodObject<{
type: z.ZodLiteral<"result">;
subtype: z.ZodLiteral<"error">;
is_error: z.ZodLiteral<true>;
duration_ms: z.ZodNumber;
duration_api_ms: z.ZodNumber;
result: z.ZodString;
session_id: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
export declare const SDKResultMessageSchema: z.ZodUnion<readonly [z.ZodObject<{
type: z.ZodLiteral<"result">;
subtype: z.ZodLiteral<"success">;
duration_ms: z.ZodNumber;
duration_api_ms: z.ZodNumber;
is_error: z.ZodLiteral<false>;
num_turns: z.ZodNumber;
result: z.ZodString;
session_id: z.ZodString;
total_cost_usd: z.ZodNumber;
usage: z.ZodObject<{
input_tokens: z.ZodNumber;
cache_creation_input_tokens: z.ZodNumber;
cache_read_input_tokens: z.ZodNumber;
output_tokens: z.ZodNumber;
}, z.core.$strip>;
permission_denials: z.ZodArray<z.ZodObject<{
tool_name: z.ZodString;
tool_use_id: z.ZodString;
tool_input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
}, z.core.$strip>>;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"result">;
subtype: z.ZodEnum<{
error_max_turns: "error_max_turns";
error_during_execution: "error_during_execution";
}>;
duration_ms: z.ZodNumber;
duration_api_ms: z.ZodNumber;
is_error: z.ZodLiteral<true>;
num_turns: z.ZodNumber;
session_id: z.ZodString;
total_cost_usd: z.ZodNumber;
usage: z.ZodObject<{
input_tokens: z.ZodNumber;
cache_creation_input_tokens: z.ZodNumber;
cache_read_input_tokens: z.ZodNumber;
output_tokens: z.ZodNumber;
}, z.core.$strip>;
permission_denials: z.ZodArray<z.ZodObject<{
tool_name: z.ZodString;
tool_use_id: z.ZodString;
tool_input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
}, z.core.$strip>>;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"result">;
subtype: z.ZodLiteral<"error">;
is_error: z.ZodLiteral<true>;
duration_ms: z.ZodNumber;
duration_api_ms: z.ZodNumber;
result: z.ZodString;
session_id: z.ZodOptional<z.ZodString>;
}, z.core.$strip>]>;
export declare const SendMessageResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
type: z.ZodLiteral<"system">;
subtype: z.ZodLiteral<"init">;
apiKeySource: z.ZodEnum<{
user: "user";
project: "project";
org: "org";
temporary: "temporary";
}>;
cwd: z.ZodString;
session_id: z.ZodString;
tools: z.ZodArray<z.ZodString>;
mcp_servers: z.ZodArray<z.ZodObject<{
name: z.ZodString;
status: z.ZodString;
}, z.core.$strip>>;
model: z.ZodString;
permissionMode: z.ZodEnum<{
default: "default";
acceptEdits: "acceptEdits";
bypassPermissions: "bypassPermissions";
plan: "plan";
}>;
slash_commands: z.ZodArray<z.ZodString>;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"assistant">;
message: z.ZodObject<{
id: z.ZodString;
type: z.ZodLiteral<"message">;
role: z.ZodLiteral<"assistant">;
model: z.ZodString;
content: z.ZodArray<z.ZodObject<{
type: z.ZodString;
text: z.ZodOptional<z.ZodString>;
id: z.ZodOptional<z.ZodString>;
name: z.ZodOptional<z.ZodString>;
input: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
}, z.core.$strip>>;
stop_reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
stop_sequence: z.ZodOptional<z.ZodNullable<z.ZodString>>;
usage: z.ZodOptional<z.ZodObject<{
input_tokens: z.ZodNumber;
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
output_tokens: z.ZodNumber;
}, z.core.$strip>>;
}, z.core.$strip>;
parent_tool_use_id: z.ZodNullable<z.ZodString>;
session_id: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"user">;
message: z.ZodObject<{
role: z.ZodLiteral<"user">;
content: z.ZodArray<z.ZodObject<{
type: z.ZodString;
content: z.ZodOptional<z.ZodString>;
tool_use_id: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>;
}, z.core.$strip>;
parent_tool_use_id: z.ZodNullable<z.ZodString>;
session_id: z.ZodString;
}, z.core.$strip>, z.ZodUnion<readonly [z.ZodObject<{
type: z.ZodLiteral<"result">;
subtype: z.ZodLiteral<"success">;
duration_ms: z.ZodNumber;
duration_api_ms: z.ZodNumber;
is_error: z.ZodLiteral<false>;
num_turns: z.ZodNumber;
result: z.ZodString;
session_id: z.ZodString;
total_cost_usd: z.ZodNumber;
usage: z.ZodObject<{
input_tokens: z.ZodNumber;
cache_creation_input_tokens: z.ZodNumber;
cache_read_input_tokens: z.ZodNumber;
output_tokens: z.ZodNumber;
}, z.core.$strip>;
permission_denials: z.ZodArray<z.ZodObject<{
tool_name: z.ZodString;
tool_use_id: z.ZodString;
tool_input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
}, z.core.$strip>>;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"result">;
subtype: z.ZodEnum<{
error_max_turns: "error_max_turns";
error_during_execution: "error_during_execution";
}>;
duration_ms: z.ZodNumber;
duration_api_ms: z.ZodNumber;
is_error: z.ZodLiteral<true>;
num_turns: z.ZodNumber;
session_id: z.ZodString;
total_cost_usd: z.ZodNumber;
usage: z.ZodObject<{
input_tokens: z.ZodNumber;
cache_creation_input_tokens: z.ZodNumber;
cache_read_input_tokens: z.ZodNumber;
output_tokens: z.ZodNumber;
}, z.core.$strip>;
permission_denials: z.ZodArray<z.ZodObject<{
tool_name: z.ZodString;
tool_use_id: z.ZodString;
tool_input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
}, z.core.$strip>>;
}, z.core.$strip>, z.ZodObject<{
type: z.ZodLiteral<"result">;
subtype: z.ZodLiteral<"error">;
is_error: z.ZodLiteral<true>;
duration_ms: z.ZodNumber;
duration_api_ms: z.ZodNumber;
result: z.ZodString;
session_id: z.ZodOptional<z.ZodString>;
}, z.core.$strip>]>]>;
export type ElementData = z.infer<typeof ElementDataSchema>;
export type PageInfo = z.infer<typeof PageInfoSchema>;
export type SendMessage = z.infer<typeof SendMessageSchema>;
export type SendMessageResponse = z.infer<typeof SendMessageResponseSchema>;