diff --git a/ai/TOOLS.md b/ai/TOOLS.md index c89ffbc31..d761e821c 100644 --- a/ai/TOOLS.md +++ b/ai/TOOLS.md @@ -7,11 +7,11 @@ This document lists all available tools that AlphaHuman can use to interact with AlphaHuman has access to **25 tools** across **1 integrations**. **Quick Statistics:** + - **Notion**: 25 tools ## Available Tools - ### Notion Tools This skill provides 25 tools for notion integration. @@ -21,19 +21,18 @@ This skill provides 25 tools for notion integration. **Description**: Append child blocks to a page or block. Supports various block types. **Parameters**: + - **block_id** (string) **(required)**: The parent page or block ID - **blocks** (string) **(required)**: JSON string of blocks array. Example: [{"type":"paragraph","paragraph":{"rich_text":[{"text":{"content":"Hello"}}]}}] **Usage Context**: Available in all environments **Example**: + ```json { "tool": "append-blocks", - "parameters": { - "block_id": "example_block_id", - "blocks": "example_blocks" - } + "parameters": { "block_id": "example_block_id", "blocks": "example_blocks" } } ``` @@ -44,6 +43,7 @@ This skill provides 25 tools for notion integration. **Description**: Append text content to a page or block. Use the page id (or block_id) from list-all-pages or get-page. Creates paragraph blocks with the given text. **Parameters**: + - **block_id** (string): The page or block ID to append to (use page id from list-all-pages) - **content** (string): Alias for text — the content to append to the page - **page_id** (string): Alias for block_id when appending to a page (same as block_id) @@ -52,6 +52,7 @@ This skill provides 25 tools for notion integration. **Usage Context**: Available in all environments **Example**: + ```json { "tool": "append-text", @@ -71,6 +72,7 @@ This skill provides 25 tools for notion integration. **Description**: Create a comment on a page or block, or reply to a discussion. Provide either page_id (new comment on page) or discussion_id (reply). Requires Notion integration to have insert comment capability. **Parameters**: + - **block_id** (string): Block ID to comment on (optional, use instead of page_id) - **discussion_id** (string): Discussion ID to reply to an existing thread (use instead of page_id) - **page_id** (string): Page ID to create a comment on (new discussion) @@ -79,6 +81,7 @@ This skill provides 25 tools for notion integration. **Usage Context**: Available in all environments **Example**: + ```json { "tool": "create-comment", @@ -98,6 +101,7 @@ This skill provides 25 tools for notion integration. **Description**: Create a new database in Notion. Specify parent page_id and title. Optionally provide properties schema as JSON. **Parameters**: + - **parent_page_id** (string) **(required)**: Parent page ID where the database will be created - **properties** (string): JSON string of properties schema. Example: {"Name":{"title":{}},"Status":{"select":{"options":[{"name":"Todo"},{"name":"Done"}]}}} - **title** (string) **(required)**: Database title @@ -105,6 +109,7 @@ This skill provides 25 tools for notion integration. **Usage Context**: Available in all environments **Example**: + ```json { "tool": "create-database", @@ -123,6 +128,7 @@ This skill provides 25 tools for notion integration. **Description**: Create a new page in Notion. Parent can be another page or a database. For database parents, properties must match the database schema. **Parameters**: + - **content** (string): Initial text content (creates a paragraph block) - **parent_id** (string) **(required)**: Parent page ID or database ID - **parent_type** (string): Type of parent (default: page_id) @@ -132,6 +138,7 @@ This skill provides 25 tools for notion integration. **Usage Context**: Available in all environments **Example**: + ```json { "tool": "create-page", @@ -152,18 +159,15 @@ This skill provides 25 tools for notion integration. **Description**: Delete a block. Permanently removes the block from Notion. **Parameters**: + - **block_id** (string) **(required)**: The block ID to delete **Usage Context**: Available in all environments **Example**: + ```json -{ - "tool": "delete-block", - "parameters": { - "block_id": "example_block_id" - } -} +{ "tool": "delete-block", "parameters": { "block_id": "example_block_id" } } ``` --- @@ -173,18 +177,15 @@ This skill provides 25 tools for notion integration. **Description**: Delete (archive) a page. Archived pages can be restored from Notion's trash. **Parameters**: + - **page_id** (string) **(required)**: The page ID to delete/archive **Usage Context**: Available in all environments **Example**: + ```json -{ - "tool": "delete-page", - "parameters": { - "page_id": "example_page_id" - } -} +{ "tool": "delete-page", "parameters": { "page_id": "example_page_id" } } ``` --- @@ -194,18 +195,15 @@ This skill provides 25 tools for notion integration. **Description**: Get a block by its ID. Returns the block's type and content. **Parameters**: + - **block_id** (string) **(required)**: The block ID **Usage Context**: Available in all environments **Example**: + ```json -{ - "tool": "get-block", - "parameters": { - "block_id": "example_block_id" - } -} +{ "tool": "get-block", "parameters": { "block_id": "example_block_id" } } ``` --- @@ -215,20 +213,16 @@ This skill provides 25 tools for notion integration. **Description**: Get the children blocks of a block or page. **Parameters**: + - **block_id** (string) **(required)**: The parent block or page ID - **page_size** (number): Number of blocks (default 50, max 100) **Usage Context**: Available in all environments **Example**: + ```json -{ - "tool": "get-block-children", - "parameters": { - "block_id": "example_block_id", - "page_size": 10 - } -} +{ "tool": "get-block-children", "parameters": { "block_id": "example_block_id", "page_size": 10 } } ``` --- @@ -238,18 +232,15 @@ This skill provides 25 tools for notion integration. **Description**: Get a database's schema and metadata. Shows all properties and their types. **Parameters**: + - **database_id** (string) **(required)**: The database ID **Usage Context**: Available in all environments **Example**: + ```json -{ - "tool": "get-database", - "parameters": { - "database_id": "example_database_id" - } -} +{ "tool": "get-database", "parameters": { "database_id": "example_database_id" } } ``` --- @@ -259,18 +250,15 @@ This skill provides 25 tools for notion integration. **Description**: Get a page's metadata and properties by its ID. Use notion-get-page-content to get the actual content/blocks. **Parameters**: + - **page_id** (string) **(required)**: The page ID (UUID format, with or without dashes) **Usage Context**: Available in all environments **Example**: + ```json -{ - "tool": "get-page", - "parameters": { - "page_id": "example_page_id" - } -} +{ "tool": "get-page", "parameters": { "page_id": "example_page_id" } } ``` --- @@ -280,6 +268,7 @@ This skill provides 25 tools for notion integration. **Description**: Get the content blocks of a page. Returns the text and structure of the page. Use recursive=true to also get nested blocks. **Parameters**: + - **page_id** (string) **(required)**: The page ID to get content from - **page_size** (number): Number of blocks to return (default 50, max 100) - **recursive** (string): Whether to fetch nested blocks (default: false) @@ -287,14 +276,11 @@ This skill provides 25 tools for notion integration. **Usage Context**: Available in all environments **Example**: + ```json { "tool": "get-page-content", - "parameters": { - "page_id": "example_page_id", - "page_size": 10, - "recursive": "example_recursive" - } + "parameters": { "page_id": "example_page_id", "page_size": 10, "recursive": "example_recursive" } } ``` @@ -305,18 +291,15 @@ This skill provides 25 tools for notion integration. **Description**: Get a user by their ID. **Parameters**: + - **user_id** (string) **(required)**: The user ID **Usage Context**: Available in all environments **Example**: + ```json -{ - "tool": "get-user", - "parameters": { - "user_id": "example_user_id" - } -} +{ "tool": "get-user", "parameters": { "user_id": "example_user_id" } } ``` --- @@ -326,18 +309,15 @@ This skill provides 25 tools for notion integration. **Description**: List all databases in the workspace that the integration has access to. **Parameters**: + - **page_size** (number): Number of results (default 20, max 100) **Usage Context**: Available in all environments **Example**: + ```json -{ - "tool": "list-all-databases", - "parameters": { - "page_size": 10 - } -} +{ "tool": "list-all-databases", "parameters": { "page_size": 10 } } ``` --- @@ -347,18 +327,15 @@ This skill provides 25 tools for notion integration. **Description**: List pages in the workspace (from last sync). Returns synced pages; run a sync in Settings to refresh. **Parameters**: + - **page_size** (number): Number of results to return (default 20, max 100) **Usage Context**: Available in all environments **Example**: + ```json -{ - "tool": "list-all-pages", - "parameters": { - "page_size": 10 - } -} +{ "tool": "list-all-pages", "parameters": { "page_size": 10 } } ``` --- @@ -368,20 +345,16 @@ This skill provides 25 tools for notion integration. **Description**: List comments on a block or page. **Parameters**: + - **block_id** (string) **(required)**: Block or page ID to get comments for - **page_size** (number): Number of results (default 20, max 100) **Usage Context**: Available in all environments **Example**: + ```json -{ - "tool": "list-comments", - "parameters": { - "block_id": "example_block_id", - "page_size": 10 - } -} +{ "tool": "list-comments", "parameters": { "block_id": "example_block_id", "page_size": 10 } } ``` --- @@ -391,18 +364,15 @@ This skill provides 25 tools for notion integration. **Description**: List all users in the workspace that the integration can see. **Parameters**: + - **page_size** (number): Number of results (default 20, max 100) **Usage Context**: Available in all environments **Example**: + ```json -{ - "tool": "list-users", - "parameters": { - "page_size": 10 - } -} +{ "tool": "list-users", "parameters": { "page_size": 10 } } ``` --- @@ -412,6 +382,7 @@ This skill provides 25 tools for notion integration. **Description**: Query a database with optional filters and sorts. Returns database rows/pages. Automatically handles API version compatibility. **Parameters**: + - **database_id** (string) **(required)**: The database ID to query. Can be either a legacy database ID or a new data source ID - the tool will handle both automatically - **filter** (string): JSON string of filter object (Notion filter syntax) - **page_size** (number): Number of results (default 20, max 100) @@ -420,6 +391,7 @@ This skill provides 25 tools for notion integration. **Usage Context**: Available in all environments **Example**: + ```json { "tool": "query-database", @@ -439,6 +411,7 @@ This skill provides 25 tools for notion integration. **Description**: Search for pages and databases in your Notion workspace. Supports query, filter by object type (page or database), and sort by last_edited_time. **Parameters**: + - **filter** (string): Filter results by type: page or database - **page_size** (number): Number of results to return (default 20, max 100) - **query** (string): Search query (optional, returns recent if empty) @@ -447,6 +420,7 @@ This skill provides 25 tools for notion integration. **Usage Context**: Available in all environments **Example**: + ```json { "tool": "search", @@ -465,16 +439,14 @@ This skill provides 25 tools for notion integration. **Description**: AI summarization of Notion pages is now handled by the backend server. Synced page content is submitted to the server which runs summarization. -**Parameters**: *None* +**Parameters**: _None_ **Usage Context**: Available in all environments **Example**: + ```json -{ - "tool": "summarize-pages", - "parameters": {} -} +{ "tool": "summarize-pages", "parameters": {} } ``` --- @@ -483,16 +455,14 @@ This skill provides 25 tools for notion integration. **Description**: Trigger an immediate Notion sync to refresh local data. Returns sync results including counts of synced pages and databases. -**Parameters**: *None* +**Parameters**: _None_ **Usage Context**: Available in all environments **Example**: + ```json -{ - "tool": "sync-now", - "parameters": {} -} +{ "tool": "sync-now", "parameters": {} } ``` --- @@ -501,16 +471,14 @@ This skill provides 25 tools for notion integration. **Description**: Get the current Notion sync status including last sync time, total synced pages/databases, sync progress, and any errors. -**Parameters**: *None* +**Parameters**: _None_ **Usage Context**: Available in all environments **Example**: + ```json -{ - "tool": "sync-status", - "parameters": {} -} +{ "tool": "sync-status", "parameters": {} } ``` --- @@ -520,6 +488,7 @@ This skill provides 25 tools for notion integration. **Description**: Update a block's content. The structure depends on the block type. **Parameters**: + - **archived** (string): Set to true to archive the block - **block_id** (string) **(required)**: The block ID to update - **content** (string): JSON string of the block type content. Example for paragraph: {"paragraph":{"rich_text":[{"text":{"content":"Updated text"}}]}} @@ -527,6 +496,7 @@ This skill provides 25 tools for notion integration. **Usage Context**: Available in all environments **Example**: + ```json { "tool": "update-block", @@ -545,6 +515,7 @@ This skill provides 25 tools for notion integration. **Description**: Update a database's title or properties schema. **Parameters**: + - **database_id** (string) **(required)**: The database ID to update - **properties** (string): JSON string of properties to add or update - **title** (string): New title (optional) @@ -552,6 +523,7 @@ This skill provides 25 tools for notion integration. **Usage Context**: Available in all environments **Example**: + ```json { "tool": "update-database", @@ -570,6 +542,7 @@ This skill provides 25 tools for notion integration. **Description**: Update a page's properties. Can update title and other properties. Use notion-append-text to add content blocks. **Parameters**: + - **archived** (string): Set to true to archive the page - **page_id** (string) **(required)**: The page ID to update - **properties** (string): JSON string of properties to update @@ -578,6 +551,7 @@ This skill provides 25 tools for notion integration. **Usage Context**: Available in all environments **Example**: + ```json { "tool": "update-page", @@ -592,28 +566,31 @@ This skill provides 25 tools for notion integration. --- - ## Tool Usage Guidelines ### Authentication + - All tools require proper authentication setup through the Skills system - OAuth credentials are managed securely and refreshed automatically - API keys are stored encrypted in the application keychain ### Rate Limiting + - Tools automatically respect API rate limits of external services - Intelligent retry logic handles temporary failures with exponential backoff ### Error Handling + - All tools return structured error responses with detailed information - Network failures trigger automatic retry with configurable attempts --- **Tool Statistics** + - Total Tools: 25 - Active Skills: 1 - Last Updated: 2026-03-17T17:02:14.087Z -*This file was automatically generated when the app loaded.* -*Tools are discovered from the running V8 skills runtime.* \ No newline at end of file +_This file was automatically generated when the app loaded._ +_Tools are discovered from the running V8 skills runtime._ diff --git a/src/pages/Conversations.tsx b/src/pages/Conversations.tsx index f43fbce55..297ea8c6c 100644 --- a/src/pages/Conversations.tsx +++ b/src/pages/Conversations.tsx @@ -18,6 +18,7 @@ import { type ModelInfo, type Tool, } from '../services/api/inferenceApi'; +import { type TeamUsage, creditsApi } from '../services/api/creditsApi'; import { useAppDispatch, useAppSelector } from '../store/hooks'; import type { NotionPageSummary, NotionSummary, NotionUserProfile } from '../store/notionSlice'; import { @@ -141,6 +142,10 @@ const Conversations = () => { const [isLoadingModels, setIsLoadingModels] = useState(false); const [isSending, setIsSending] = useState(false); const [sendError, setSendError] = useState(null); + // Budget state + const [teamUsage, setTeamUsage] = useState(null); + const [isLoadingBudget, setIsLoadingBudget] = useState(false); + const isDragging = useRef(false); const messagesEndRef = useRef(null); const lastPanelWidthRef = useRef(panelWidth); @@ -219,6 +224,18 @@ const Conversations = () => { .finally(() => setIsLoadingModels(false)); }, []); + // Fetch inference budget on mount + useEffect(() => { + setIsLoadingBudget(true); + creditsApi + .getTeamUsage() + .then(data => setTeamUsage(data)) + .catch(() => { + // Budget unavailable — silently ignore + }) + .finally(() => setIsLoadingBudget(false)); + }, []); + // Remove thread fetching - threads are now loaded from Redux persist // Sync URL → Redux: when URL has a threadId param, select that thread @@ -995,6 +1012,34 @@ const Conversations = () => { {/* Message Input */}
+ {/* Budget depleted banner — show top-up CTA */} + {teamUsage && teamUsage.remainingUsd <= 0 && ( +
+
+ + + +

+ Daily inference budget exhausted. Top up to continue. +

+
+ +
+ )} + {/* Show warning if another thread is active */} {activeThreadId && activeThreadId !== selectedThreadId && (
@@ -1004,7 +1049,7 @@ const Conversations = () => {

)} - {/* Model selector */} + {/* Model selector + budget indicator */}
{isLoadingModels ? ( Loading models… @@ -1030,6 +1075,48 @@ const Conversations = () => { )} +
+ {/* Budget indicator — circular */} + {(isLoadingBudget || teamUsage) && (() => { + const size = 22; + const r = 9; + const circ = 2 * Math.PI * r; + const pct = teamUsage + ? Math.min(1, teamUsage.remainingUsd / teamUsage.cycleBudgetUsd) + : 0; + const dash = pct * circ; + return ( +
+ + + {teamUsage ? ( + + ) : ( + + )} + + {teamUsage && ( + + ${teamUsage.remainingUsd.toFixed(2)} + + )} +
+ ); + })()}
{sendError && (
diff --git a/src/pages/onboarding/Onboarding.tsx b/src/pages/onboarding/Onboarding.tsx index 7d53f9060..8bbf56bf8 100644 --- a/src/pages/onboarding/Onboarding.tsx +++ b/src/pages/onboarding/Onboarding.tsx @@ -8,7 +8,6 @@ import { setOnboardedForUser } from '../../store/authSlice'; import { useAppDispatch, useAppSelector } from '../../store/hooks'; import FeaturesStep from './steps/FeaturesStep'; import GetStartedStep from './steps/GetStartedStep'; -import InviteCodeStep from './steps/InviteCodeStep'; import PrivacyStep from './steps/PrivacyStep'; const Onboarding = () => { @@ -16,14 +15,13 @@ const Onboarding = () => { const dispatch = useAppDispatch(); const user = useAppSelector(state => state.user.user); const [currentStep, setCurrentStep] = useState(0); - const totalSteps = 4; + const totalSteps = 3; // Lottie animation files for each step const stepAnimations = [ - '/lottie/trophy.json', // Step 1 - Invite Code - '/lottie/wave.json', // Step 2 - Features - '/lottie/safe3.json', // Step 3 - Privacy - '/lottie/trophy.json', // Step 4 - Get Started + '/lottie/wave.json', // Step 1 - Features + '/lottie/safe3.json', // Step 2 - Privacy + '/lottie/trophy.json', // Step 3 - Get Started ]; const handleNext = () => { @@ -54,15 +52,11 @@ const Onboarding = () => { const renderStep = () => { switch (currentStep) { case 1: - return ; - case 2: - return ; - case 3: return ; - case 4: + case 2: return ; default: - return ; + return ; } };