import { buildClockStandardToolAppendOperationsWithNative, buildClockToolAppendOperationsWithNative } from '../../../router/virtual-router/engine-selection/native-chat-process-clock-tool-schema-semantics.js';
const CLOCK_PARAMETERS = {
    type: 'object',
    properties: {
        action: {
            type: 'string',
            enum: ['get', 'schedule', 'update', 'list', 'cancel', 'clear'],
            description: 'Get current time, or schedule/update/list/cancel/clear session-scoped reminders. If waiting longer than 2 minutes is required, use action="schedule" immediately.'
        },
        items: {
            type: 'array',
            description: 'For schedule/update: list of reminder payloads. update uses items[0] as patch source.',
            items: {
                type: 'object',
                properties: {
                    dueAt: {
                        type: 'string',
                        description: 'ISO8601 datetime with timezone (e.g. 2026-01-21T20:30:00-08:00).'
                    },
                    task: {
                        type: 'string',
                        description: 'Reminder text that states the exact action to execute on wake-up (no vague placeholders).'
                    },
                    tool: {
                        type: 'string',
                        description: 'Optional suggested tool name (hint only).'
                    },
                    arguments: {
                        type: 'string',
                        description: 'Optional suggested tool arguments as a JSON string (hint only). Use "{}" when unsure.'
                    }
                },
                required: ['dueAt', 'task', 'tool', 'arguments'],
                additionalProperties: false
            }
        },
        taskId: {
            type: 'string',
            description: 'For cancel/update: target taskId.'
        }
    },
    required: ['action', 'items', 'taskId'],
    additionalProperties: false
};
const CLOCK_TOOL = {
    type: 'function',
    function: {
        name: 'clock',
        description: 'Time + Alarm for this session. If waiting longer than 2 minutes is required, MUST call clock.schedule now (never promise to wait without scheduling). Format example: {"action":"schedule","items":[{"dueAt":"<ISO8601>","task":"<exact follow-up action>","tool":"<tool-name-or-empty>","arguments":"<json-string-or-{}>"}],"taskId":""}. Use get/schedule/update/list/cancel/clear. Scheduled reminders are injected into future requests.',
        parameters: CLOCK_PARAMETERS,
        strict: true
    }
};
const CLOCK_STANDARD_TOOLS = [
    {
        type: 'function',
        function: {
            name: 'clock',
            description: 'Time + Alarm for this session. If waiting longer than 2 minutes is required, call clock.schedule now. Format example: {"action":"schedule","items":[{"dueAt":"<ISO8601>","task":"<exact follow-up action>","tool":"<tool-name-or-empty>","arguments":"<json-string-or-{}>"}],"taskId":""}. Use schedule/update/list/cancel/clear.',
            parameters: {
                type: 'object',
                properties: {
                    action: {
                        type: 'string',
                        enum: ['get', 'schedule', 'update', 'list', 'cancel', 'clear']
                    },
                    items: {
                        type: 'array',
                        items: {
                            type: 'object',
                            properties: {
                                dueAt: { type: 'string' },
                                task: { type: 'string' },
                                tool: { type: 'string' },
                                arguments: { type: 'string' }
                            },
                            required: ['dueAt', 'task', 'tool', 'arguments'],
                            additionalProperties: false
                        }
                    },
                    taskId: { type: 'string' }
                },
                required: ['action', 'items', 'taskId'],
                additionalProperties: false
            }
        }
    },
    {
        type: 'function',
        function: {
            name: 'shell',
            description: 'Runs a shell command and returns its output.',
            parameters: {
                type: 'object',
                properties: {
                    command: { oneOf: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }] },
                    workdir: { type: 'string' }
                },
                required: ['command'],
                additionalProperties: false
            }
        }
    },
    {
        type: 'function',
        function: {
            name: 'exec_command',
            description: 'Execute a command in a PTY and return output.',
            parameters: {
                type: 'object',
                properties: {
                    cmd: { type: 'string' },
                    workdir: { type: 'string' },
                    timeout_ms: { type: 'number' },
                    max_output_tokens: { type: 'number' },
                    yield_time_ms: { type: 'number' }
                },
                required: ['cmd'],
                additionalProperties: false
            }
        }
    },
    {
        type: 'function',
        function: {
            name: 'apply_patch',
            description: 'Apply a patch to repository files.',
            parameters: {
                type: 'object',
                properties: {
                    patch: { type: 'string' }
                },
                required: ['patch'],
                additionalProperties: false
            }
        }
    },
    {
        type: 'function',
        function: {
            name: 'update_plan',
            description: 'Update the task plan.',
            parameters: {
                type: 'object',
                properties: {
                    explanation: { type: 'string' },
                    plan: {
                        type: 'array',
                        items: {
                            type: 'object',
                            properties: {
                                step: { type: 'string' },
                                status: { type: 'string' }
                            },
                            required: ['step', 'status'],
                            additionalProperties: false
                        }
                    }
                },
                required: ['plan'],
                additionalProperties: false
            }
        }
    },
    {
        type: 'function',
        function: {
            name: 'view_image',
            description: 'View a local image by file path.',
            parameters: {
                type: 'object',
                properties: {
                    path: { type: 'string' }
                },
                required: ['path'],
                additionalProperties: false
            }
        }
    },
    {
        type: 'function',
        function: {
            name: 'list_mcp_resources',
            description: 'List resources exposed by MCP servers.',
            parameters: {
                type: 'object',
                properties: {
                    server: { type: 'string' },
                    filter: { type: 'string' },
                    root: { type: 'string' }
                },
                additionalProperties: false
            }
        }
    },
    {
        type: 'function',
        function: {
            name: 'list_mcp_resource_templates',
            description: 'List resource templates exposed by MCP servers.',
            parameters: {
                type: 'object',
                properties: {
                    server: { type: 'string' },
                    cursor: { type: 'string' }
                },
                additionalProperties: false
            }
        }
    },
    {
        type: 'function',
        function: {
            name: 'read_mcp_resource',
            description: 'Read a specific MCP resource by { server, uri }.',
            parameters: {
                type: 'object',
                properties: {
                    server: { type: 'string' },
                    uri: { type: 'string' }
                },
                required: ['server', 'uri'],
                additionalProperties: false
            }
        }
    }
];
export function buildClockToolAppendOperations(hasSessionId) {
    return buildClockToolAppendOperationsWithNative(hasSessionId, CLOCK_TOOL);
}
export function buildClockStandardToolAppendOperations() {
    return buildClockStandardToolAppendOperationsWithNative(CLOCK_STANDARD_TOOLS);
}
