Core
Core utilities, built-in tools, and types
Core utilities, built-in tools, and shared types.
npm install @yourgpt/copilot-sdk/coreBuilt-in Tools
import { builtinTools } from '@yourgpt/copilot-sdk/core';
// Available tools
builtinTools.capture_screenshot // Screenshot tool
builtinTools.capture_console // Console logs toolTypes
UIMessage
interface UIMessage {
id: string;
role: 'user' | 'assistant' | 'tool' | 'system';
content: string;
createdAt: Date;
toolCalls?: ToolCall[];
toolCallId?: string;
thinking?: string;
attachments?: Attachment[];
}ToolExecution
interface ToolExecution {
id: string;
name: string;
args: Record<string, unknown>;
status: 'pending' | 'executing' | 'completed' | 'error' | 'failed' | 'rejected';
result?: unknown;
error?: string;
approvalStatus?: 'required' | 'approved' | 'rejected';
}| Status | Description |
|---|---|
pending | Waiting to start |
executing | Currently running |
completed | Finished successfully |
error | Failed with error |
failed | Handler threw exception |
rejected | User rejected approval |
ToolDefinition
interface ToolDefinition {
name: string;
description: string;
parameters: ZodSchema;
handler: (params: any) => Promise<any>;
requiresApproval?: boolean;
}Attachment
interface Attachment {
id: string;
type: 'image' | 'file' | 'audio' | 'video';
name: string;
url?: string;
base64?: string;
mimeType: string;
size?: number;
}ToolCall
interface ToolCall {
id: string;
type: 'function';
function: {
name: string;
arguments: string; // JSON string
};
}Recorded voice exports
import {
VoiceRecorder,
transcribeRecording,
type VoiceRecorderOptions,
type VoiceRecordingState,
type VoiceRecording,
type VoiceTranscript,
} from '@yourgpt/copilot-sdk/core';VoiceRecorder exposes state, start(), stop(), cancel(), and dispose(). stop() returns a VoiceRecording; transcribeRecording(recording, options) returns a VoiceTranscript from your server. See recorded voice input for the complete API, recording limits, cancellation, and a working integration.