export { Turbopuffer } from '@turbopuffer/turbopuffer'; import { DistanceMetric, Vector, AttributeSchema, Row } from '@turbopuffer/turbopuffer/resources/namespaces.js'; export { AttributeSchema, AttributeSchemaConfig, DistanceMetric, NamespaceQueryParams, NamespaceQueryResponse, NamespaceWriteParams, NamespaceWriteResponse, Row, Vector } from '@turbopuffer/turbopuffer/resources/namespaces.js'; import { z } from 'zod'; /** * TurboPuffer schema for tool lookup/search system */ /** * TurboPuffer attribute schema configuration for tool documents * This is the source of truth for the tool schema */ declare const TOOL_SCHEMA: { readonly text: { readonly type: "string"; readonly full_text_search: true; }; readonly toolkit_name: { readonly type: "string"; readonly filterable: true; }; readonly normalized_name: { readonly type: "string"; readonly full_text_search: true; readonly filterable: true; }; readonly purpose_line: { readonly type: "string"; readonly full_text_search: true; }; readonly aliases: { readonly type: "[]string"; readonly full_text_search: true; }; readonly vector: { readonly type: "[1024]f16"; readonly ann: true; }; readonly featured: { readonly type: "bool"; readonly filterable: true; }; readonly no_auth: { readonly type: "bool"; readonly filterable: true; }; readonly use_case: { readonly type: "string"; readonly full_text_search: false; }; readonly tool_slug: { readonly type: "string"; readonly filterable: true; }; readonly display_name: { readonly type: "string"; }; readonly description: { readonly type: "string"; }; readonly toolkit_description: { readonly type: "string"; }; readonly related_tools_json: { readonly type: "string"; }; }; /** * Schema for related tool entries in sidecar data * Note: input_schema_json is NOT included - look up by tool_slug in tools map if needed */ declare const RelatedToolSchema: z.ZodObject<{ tool_slug: z.ZodString; description: z.ZodString; display_name: z.ZodString; toolkit_name: z.ZodString; relevance_score: z.ZodNumber; relationship_type: z.ZodEnum<["prerequisite", "fallback", "next_step"]>; }, "strip", z.ZodTypeAny, { toolkit_name: string; tool_slug: string; display_name: string; description: string; relevance_score: number; relationship_type: "prerequisite" | "fallback" | "next_step"; }, { toolkit_name: string; tool_slug: string; display_name: string; description: string; relevance_score: number; relationship_type: "prerequisite" | "fallback" | "next_step"; }>; /** * Schema for tool payload in the deduplicated sidecar export format * Matches the ToolPayload interface from the embeddings system * * Note: tool_slug is added during file loading (not in the raw file payload) */ declare const ToolSchemaSidecar: z.ZodObject<{ tool_slug: z.ZodString; display_name: z.ZodString; normalized_name: z.ZodString; description: z.ZodString; toolkit_description: z.ZodString; purpose_line: z.ZodString; action: z.ZodString; aliases: z.ZodArray; related_tools: z.ZodArray; }, "strip", z.ZodTypeAny, { toolkit_name: string; tool_slug: string; display_name: string; description: string; relevance_score: number; relationship_type: "prerequisite" | "fallback" | "next_step"; }, { toolkit_name: string; tool_slug: string; display_name: string; description: string; relevance_score: number; relationship_type: "prerequisite" | "fallback" | "next_step"; }>, "many">; }, "strip", z.ZodTypeAny, { normalized_name: string; purpose_line: string; aliases: string[]; tool_slug: string; display_name: string; description: string; toolkit_description: string; action: string; related_tools: { toolkit_name: string; tool_slug: string; display_name: string; description: string; relevance_score: number; relationship_type: "prerequisite" | "fallback" | "next_step"; }[]; }, { normalized_name: string; purpose_line: string; aliases: string[]; tool_slug: string; display_name: string; description: string; toolkit_description: string; action: string; related_tools: { toolkit_name: string; tool_slug: string; display_name: string; description: string; relevance_score: number; relationship_type: "prerequisite" | "fallback" | "next_step"; }[]; }>; /** * Distance metric used for vector similarity * Using cosine distance (1 - cosine_similarity), range 0-2, lower is better */ declare const TOOL_DISTANCE_METRIC: DistanceMetric; /** * Helper type to infer TypeScript types from TurboPuffer attribute types */ type InferAttributeType = T extends 'string' ? string : T extends 'int' | 'uint' ? number : T extends 'bool' ? boolean : T extends 'uuid' ? string : T extends 'datetime' ? string : T extends `[]string` ? Array : T extends `[${number}]f16` | `[${number}]f32` ? number[] : unknown; /** * Extract attribute types from schema */ type SchemaToAttributes> = { [K in keyof T]: T[K] extends { type: infer Type extends string; } ? InferAttributeType : T[K] extends string ? InferAttributeType : unknown; }; /** * Schema for tool documents stored in TurboPuffer * Derived from TOOL_SCHEMA - this is the single source of truth */ type ToolDocumentSchema = { /** Tool slug - used as ID for upsert semantics (updates existing tools) */ id: string; /** Embedding vector (1024 dimensions from cohere embed-v4.0) */ vector: Vector; } & SchemaToAttributes; /** * Tool document as returned from TurboPuffer queries * Extends base Row type with our schema attributes */ type ToolRow = Row & SchemaToAttributes; /** * Featured toolkits - used to mark tools from these toolkits as featured in the index */ declare const FEATURED_TOOLKITS: readonly ["gmail", "composio", "composio_search", "github", "googlecalendar", "notion", "googlesheets", "google_analytics", "slack", "supabase", "outlook", "perplexityai", "twitter", "linkedin", "youtube", "googledrive", "googledocs", "hubspot", "linear", "airtable", "gemini", "instagram", "tiktok", "figma", "clickup", "todoist", "seat_geek", "yelp", "jira", "confluence", "firecrawl", "tavily", "slackbot", "canvas", "bitbucket", "googletasks", "discord", "reddit", "cal", "wrike", "exa", "sentry", "snowflake", "hackernews", "elevenlabs", "microsoft_teams", "asana", "peopledatalabs", "shopify", "serpapi", "google_maps", "one_drive", "docusign", "discordbot", "salesforce", "calendly", "heygen", "trello", "apollo", "semrush", "mem0", "neon", "weathermap", "brightdata", "brex", "posthog", "brevo", "stripe", "klaviyo", "mailchimp", "attio", "googlemeet", "text_to_pdf", "zoho", "fireflies", "dropbox", "mixpanel", "amplitude", "googlebigquery", "monday", "sendgrid", "binance", "pipedrive", "bamboohr", "zendesk", "googlephotos", "lmnt", "metaads", "browser_tool", "zoom", "openai", "googleads", "pagerduty", "miro", "share_point", "breezy_hr", "launch_darkly", "ably", "survey_monkey", "zoho_mail", "zoho_inventory", "zoho_invoice", "adobe", "facebook", "webex", "brandfetch", "canva", "digicert", "factorial", "box", "atlassian", "tinyurl", "bitwarden", "gong", "cloudflare", "rippling", "intercom", "stack_exchange", "twitch", "datadog", "telegram", "twitter_media", "v0", "vercel", "openrouter", "excel", "gitlab", "ticktick"]; type FeaturedToolkit = (typeof FEATURED_TOOLKITS)[number]; /** * Cohere embedding configuration */ declare const EMBED_MODEL = "embed-v4.0"; declare const EMBED_INPUT_TYPE = "search_document"; declare const EMBED_BATCH_SIZE = 96; /*** * is semantic text, this is vectorized and used for semantic search * * this is like baby english that a model could understand */ declare const formatSemanticText: ({ normalizedName, detailedDescription, toolkitDescription, toolkitName, }: { normalizedName: string; detailedDescription: string; toolkitDescription: string; toolkitName: string; }) => string; /** * this is full text search text, this is used for bm25 search * this is a keyword search. not semantic english text with meaning. */ declare const formatSearchText: ({ normalizedName, purposeLine, aliases, action, toolkitPurposeLine, toolkitAliases, toolkitCapabilities, }: { normalizedName: string; purposeLine: string; aliases: string[]; action: string; toolkitPurposeLine: string; toolkitAliases: string[]; toolkitCapabilities: string[]; }) => string; /** * this is reranker text, this is semantic */ declare const formatRerankText: ({ normalizedName, purposeLine, toolkitName, useCase, }: { normalizedName: string; purposeLine: string; toolkitPurposeLine: string; toolkitName: string; useCase?: string; }) => string; declare const slugToIdHash: (slug: string) => string; export { EMBED_BATCH_SIZE, EMBED_INPUT_TYPE, EMBED_MODEL, FEATURED_TOOLKITS, type FeaturedToolkit, RelatedToolSchema, TOOL_DISTANCE_METRIC, TOOL_SCHEMA, type ToolDocumentSchema, type ToolRow, ToolSchemaSidecar, formatRerankText, formatSearchText, formatSemanticText, slugToIdHash };