Spaces:
Sleeping
Sleeping
| // ─── Agent action tools — remember, recall, propose_action, get_datetime, generate_qr, send_notification, schedule_task ─────────────────────────────────────────────────────────── | |
| // P3-4 split da toolDefinitions.ts — DO NOT edit toolDefinitions.ts directly | |
| // Tools (7): remember, recall, propose_action, get_datetime, generate_qr, send_notification, schedule_task | |
| import type { ChatCompletionTool } from "openai/resources/chat/completions"; | |
| export const AGENT_ACTION_TOOLS: (ChatCompletionTool | undefined)[] = [ | |
| { | |
| type: "function", | |
| function: { | |
| name: "remember", | |
| description: "Salva informazioni in memoria persistente tra sessioni (localStorage).", | |
| parameters: { type: "object", properties: { key: { type: "string" }, value: { type: "string" }, category: { type: "string", description: "Categoria (default: general)" } }, required: ["key","value"] } | |
| } | |
| }, | |
| { | |
| type: "function", | |
| function: { | |
| name: "recall", | |
| description: "Recupera informazioni dalla memoria persistente.", | |
| parameters: { type: "object", properties: { key: { type: "string", description: "Chiave specifica" }, category: { type: "string", description: "Categoria" } } } | |
| } | |
| }, | |
| { | |
| type: "function", | |
| function: { | |
| name: "propose_action", | |
| description: "Proponi all'utente un'azione concreta da eseguire come step successivo (mostra bottone Procedi).", | |
| parameters: { type: "object", properties: { label: { type: "string", description: "Label breve (es. 'Crea README.md')" }, prompt: { type: "string", description: "Prompt completo che l'AI riceverà su click" }, preview: { type: "string", description: "Anteprima breve" } }, required: ["label","prompt"] } | |
| } | |
| }, | |
| { | |
| type: "function", | |
| function: { | |
| name: "get_datetime", | |
| description: "Restituisce la data e ora correnti con fuso orario. Usa quando l'utente chiede che ora è, che giorno è, la data di oggi.", | |
| parameters: { type: "object", properties: { timezone: { type: "string", description: "Fuso orario IANA (es. 'Europe/Rome', 'America/New_York'). Default: Europe/Rome" } } } | |
| } | |
| }, | |
| { | |
| type: "function", | |
| function: { | |
| name: "generate_qr", | |
| description: "Genera un QR code da testo o URL e lo mostra inline nella chat (qrserver.com, gratis).", | |
| parameters: { | |
| type: "object", | |
| properties: { | |
| text: { type: "string", description: "Testo o URL da codificare nel QR" }, | |
| size: { type: "number", description: "Dimensione in pixel (default 250, max 500)" } | |
| }, | |
| required: ["text"] | |
| } | |
| } | |
| }, | |
| { | |
| type: "function", | |
| function: { | |
| name: "send_notification", | |
| description: "Invia una notifica push nativa del browser all'utente. Utile per segnalare il completamento di task lunghi.", | |
| parameters: { | |
| type: "object", | |
| properties: { | |
| title: { type: "string", description: "Titolo della notifica" }, | |
| body: { type: "string", description: "Testo del corpo (opzionale)" } | |
| }, | |
| required: ["title"] | |
| } | |
| } | |
| }, | |
| { | |
| type: 'function', | |
| function: { | |
| name: 'schedule_task', | |
| description: | |
| "Pianifica un task che l'agente eseguirà automaticamente in futuro. " + | |
| "Usa quando l'utente chiede 'ricordami di...', 'ogni giorno fai...', " + | |
| "'alle 8 di mattina controlla...', 'tra 2 ore cerca...'. " + | |
| 'Il task viene salvato in modo persistente e sopravvive alla chiusura dell\'app.', | |
| parameters: { | |
| type: 'object', | |
| properties: { | |
| label: { | |
| type: 'string', | |
| description: 'Nome breve del task (es. "Notizie del mattino", "Reminder meteo")', | |
| }, | |
| goal: { | |
| type: 'string', | |
| description: | |
| "Il task che l'agente dovrà eseguire, scritto come se fosse un messaggio utente. " + | |
| 'Es. "Cerca le notizie di oggi e riassumile in 5 punti" oppure ' + | |
| '"Controlla il meteo a Milano e avvisami se piove".', | |
| }, | |
| when: { | |
| type: 'string', | |
| description: | |
| 'Quando eseguire il task, in linguaggio naturale italiano. ' + | |
| 'Esempi: "ogni giorno alle 8:00", "tra 2 ore", "ogni 30 minuti", ' + | |
| '"al prossimo avvio", "domani alle 9:30".', | |
| }, | |
| notify: { | |
| type: 'boolean', | |
| description: 'Se true, invia una notifica push al completamento (default: true).', | |
| }, | |
| }, | |
| required: ['label', 'goal', 'when'], | |
| }, | |
| }, | |
| }, | |
| ]; | |