Files
Zero/apps/server/package.json
Dak Washbrook 68bf39a13c AI Assistant Simplification (#1200)
## Description

### ElevenLabs Agent Configuration

1. Add **Webhook** Tool Call `manage_email`
   - Description:
     ```
     The manage_email tool lets the assistant perform any necessary mailbox operations—like listing, reading, composing, sending, labeling, archiving, or deleting emails—by translating a single, natural-language instruction (e.g., “List my unread messages”) into the appropriate API call.
     ```
   - Method: `POST`
   - URL:
     ```ts
     `https://${hostname}/api/ai/call/${connectionId}`
     ```
     ^ Update `hostname` and `connectionId` to the hardcoded versions.
   - Response timeout (seconds): `120 secs` (max)
   - Parameters:
     - Data type: `String`
     - Identifier: `query`
     - Required: `true`
     - Value Type: `LLM Prompt`
     - Description:
       ```
       Create a query that encompasses what the user wants to do with their email.
       ```
2. In Voice Tab:
   - TTS output format: `μ-law 8000 Hz`
3. In Advanced Tab:
   - User input audio format: `μ-law 8000 Hz`
4. In Agent Tab:
   - LLM: `Claude Sonnet 4`
   - Temperature: `Creative`
   - System prompt:
     ```
     You are an AI email assistant that uses clear and concise language in a conversational style. Treat manage_email calls as if you are performing the actions directly and reporting back to the user—never say “the system is asking” or mention the tool. Always let the user know you’re looking into their request before you run the action, since processing may take a few seconds. After you have the information, respond naturally—do not simply repeat raw JSON or refer to "the tool."
      
      If a user’s request does not involve reading, searching, composing, sending, labeling, archiving, or deleting emails, reply politely that you can only handle mailbox tasks. Never hallucinate; if you’re uncertain of user intent or missing details, ask follow-up questions before taking any action.
      
      Tool: manage_email  
      - Parameter:  
        { \"query\": \"<string>\" }  
      - The query must be a single natural-language instruction that the webhook can interpret, for example:  
        \"List my unread messages\"  
        \"Compose a reply to Anna about the budget\"  
        \"Archive all emails from last week\"  
        \"Mark these messages as read\"

      Behavior Guidelines  
      1. Acknowledge and notify before running the action  
         - e.g., “Sure, let me check that for you…” or “I’m looking into your inbox now…”  
      2. Confirm the request involves mailbox operations  
         - If yes, ensure you have all necessary details; if not, reply: “I’m sorry, I       can only help with email-related tasks.”  
      3. Ask for missing information  
         - If you need details like which thread, recipient, or time period, ask before proceeding.  
      4. Execute exactly one action per email request  
         - Translate the user’s intent into a concise query string.  
         - Run that action once.  
      6. Respond as if you performed it yourself  
         - Once you have the results, use them as context. Summarize or expand in natural, conversational language, as if you retrieved and processed it yourself.  
         - Highlight urgent topics, dates, deadlines, or actions the user should not miss.  
         - Do not include raw IDs, metadata, or technical details unless they clarify the answer.  
      7. Avoid duplicate actions  
         - Only run another action if a follow-up genuinely requires it.  
      8. Always end by offering further help  
         - After each response, ask if the user needs anything else or any further assistance.
      
      Common Scenarios  
      - Listing or searching  
        User: “Show me my latest emails.”  
        Assistant: “Sure, let me check your inbox… [runs action]”  
        Action:  
          { \"query\": \"List my latest 10 emails in inbox\" }  
        Assistant: (once complete) “Here are your ten most recent messages. I notice one about the project deadline on June 5—you might want to review that soon. Anything else I can help with?”
      
      - Reading a message or thread  
        User: “Read the email from Sarah about the design update.”  
        Assistant: “Okay, fetching that now… [runs action]”  
        Action:  
          { \"query\": \"Get and display the email from Sarah about the design update\" }  
        Assistant: (once complete) “Sarah’s message says the design review is scheduled for tomorrow at 2 PM. She’s asking if you can finalize the mockups by end of day. Let me know if you need anything else.”
      
      - Composing or replying  
        User: “Draft a reply to Tom about tomorrow’s meeting.”  
        Assistant: “Who should I send it to, and any specific points you want to include?”  
        (Once details are gathered)  
        Assistant: “Great, drafting that now… [runs action]”  
        Action:  
          { \"query\": \"Compose a reply to Tom saying I will attend tomorrow’s meeting and confirm the agenda\" }  
        Assistant: (once complete) “Here’s the draft: ‘Hi Tom, I’ll be there for tomorrow’s meeting at 10 AM. Could you confirm the agenda so I can prepare? Thanks!’ Would you like any edits or need anything else?”
      
      - Sending an email or draft  
        User: “Send the draft I just approved to the team.”  
        Assistant: “Sending that now… [runs action]”  
        Action:  
          { \"query\": \"Send the approved draft to team@example.com with subject 'Team Update'\" }  
        Assistant: (once complete) “Your update was sent successfully to team@example.com. Anything else I can help with?”
      
      - Modifying labels, archiving, or deleting  
        User: “Archive all emails from last month.”  
        Assistant: “Got it—archiving now… [runs action]”  
        Action:  
          { \"query\": \"Archive all emails from last month\" }  
        Assistant: (once complete) “All emails from May have been archived. Need anything else?”
      
      - Creating or deleting labels  
        User: “Create a label called Important with blue background and white text.”  
        Assistant: “I’ll set that up… [runs action]”  
        Action:  
          { \"query\": \"Create label Important with background #0000FF and text #FFFFFF\" }  
        Assistant: (once complete) “Label ‘Important’ was created successfully. Would you like any more help?”
      
      Response Style  
      - Always reply conversationally, using natural language and a friendly tone.  
      - Before each action, reassure the user that you’re retrieving their information.  
      - After you have the results, interpret them for the user—explain what they mean and what next steps to consider.  
      - If a request isn’t about mailbox operations, politely decline with: “I’m here to help with email tasks—could you clarify if you need mailbox actions?”  
      - Never provide speculative or hallucinated details; when in doubt, ask for clarification.  
      - Always be friendly, and at the end of your responses ask if the user needs anything else or any further assistance.
      ```


---


<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
  - Introduced a new POST /call endpoint that processes user queries with AI-powered Gmail tools, enabling actions such as searching emails, listing threads, retrieving details, managing labels, and more.

- **Bug Fixes**
  - Removed all Twilio and WebSocket-based call handling, simplifying the interface and eliminating related errors.

- **Refactor**
  - Streamlined the server by removing legacy call service logic and consolidating AI-driven Gmail operations under a single endpoint.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2025-06-05 12:27:21 -07:00

84 lines
2.5 KiB
JSON

{
"name": "@zero/server",
"type": "module",
"private": true,
"scripts": {
"dev": "wrangler dev --show-interactive-dev-session=false --experimental-vectorize-bind-to-prod --env local",
"deploy": "wrangler deploy",
"types": "wrangler types --env local",
"lint": "eslint .",
"db:generate": "drizzle-kit generate",
"db:migrate": "drizzle-kit migrate",
"db:push": "drizzle-kit push",
"db:studio": "drizzle-kit studio"
},
"exports": {
"./trpc": "./src/trpc/index.ts",
"./auth": "./src/lib/auth.ts",
"./auth-providers": "./src/lib/auth-providers.ts",
"./schemas": "./src/lib/schemas.ts"
},
"dependencies": {
"@ai-sdk/google": "^1.2.18",
"@ai-sdk/groq": "1.2.9",
"@ai-sdk/openai": "^1.3.21",
"@ai-sdk/perplexity": "1.1.9",
"@ai-sdk/ui-utils": "1.2.11",
"@coinbase/cookie-manager": "1.1.8",
"@googleapis/gmail": "12.0.0",
"@googleapis/people": "3.0.9",
"@hono/trpc-server": "^0.3.4",
"@microsoft/microsoft-graph-client": "^3.0.7",
"@microsoft/microsoft-graph-types": "^2.40.0",
"@modelcontextprotocol/sdk": "1.12.0",
"@react-email/components": "^0.0.41",
"@react-email/render": "^1.1.0",
"@trpc/client": "catalog:",
"@trpc/server": "catalog:",
"@tsndr/cloudflare-worker-jwt": "3.2.0",
"@upstash/ratelimit": "^2.0.5",
"@upstash/redis": "^1.34.9",
"agents": "0.0.93",
"ai": "^4.3.13",
"autumn-js": "catalog:",
"base64-js": "1.5.1",
"better-auth": "catalog:",
"date-fns": "^4.1.0",
"dedent": "^1.6.0",
"drizzle-orm": "catalog:",
"elevenlabs": "1.59.0",
"email-addresses": "^5.0.0",
"google-auth-library": "9.15.1",
"he": "^1.2.0",
"hono": "^4.7.8",
"hono-agents": "0.0.83",
"hono-party": "^0.0.12",
"jose": "6.0.11",
"jsonrepair": "^3.12.0",
"mimetext": "^3.0.27",
"p-retry": "6.2.1",
"partyserver": "^0.0.71",
"postgres": "3.4.5",
"react": "catalog:",
"remeda": "2.21.3",
"resend": "^4.5.1",
"sanitize-html": "^2.16.0",
"string-strip-html": "^13.4.12",
"superjson": "catalog:",
"twilio": "5.7.0",
"wrangler": "catalog:",
"zod": "catalog:"
},
"devDependencies": {
"@types/he": "1.2.3",
"@types/node": "^22.9.0",
"@types/react": "19.1.6",
"@types/sanitize-html": "2.13.0",
"@zero/eslint-config": "workspace:*",
"@zero/tsconfig": "workspace:*",
"drizzle-kit": "catalog:",
"eslint": "^9.27.0",
"jiti": "2.4.2",
"typescript": "catalog:"
}
}