@mondaydotcomorg/atp-runtime
Version:
Runtime SDK injected into sandbox for Agent Tool Protocol
299 lines (294 loc) • 8.6 kB
text/typescript
/**
* AUTO-GENERATED - DO NOT EDIT
* Generated by scripts/generate-metadata.ts
*
* Hybrid approach:
* - ts-json-schema-generator (OSS) for most types
* - ts-morph fallback for types OSS can't handle (generics)
*/
import type { RuntimeAPIMetadata } from './types';
export const GENERATED_METADATA: RuntimeAPIMetadata[] = [
{
"name": "approval",
"description": "Approval API - Request explicit human approval for sensitive operations",
"methods": [
{
"name": "request",
"description": "Request approval from a human",
"params": [
{
"name": "message",
"type": "string",
"description": "The message to display to the user",
"optional": false
},
{
"name": "context",
"type": "Record<string, unknown>",
"description": "Optional context information about what needs approval",
"optional": true
}
],
"returns": "Promise<ApprovalResponse>"
}
]
},
{
"name": "cache",
"description": "Cache API - Store and retrieve data with optional TTL",
"methods": [
{
"name": "get",
"description": "Get a value from cache by key",
"params": [
{
"name": "key",
"type": "string",
"description": "Cache key",
"optional": false
}
],
"returns": "Promise<T | null>"
},
{
"name": "set",
"description": "Set a value in cache with optional TTL",
"params": [
{
"name": "key",
"type": "string",
"description": "Cache key",
"optional": false
},
{
"name": "value",
"type": "unknown",
"description": "Value to cache",
"optional": false
},
{
"name": "ttl",
"type": "number",
"description": "Time to live in seconds",
"optional": true
}
],
"returns": "Promise<void>"
},
{
"name": "delete",
"description": "Delete a value from cache",
"params": [
{
"name": "key",
"type": "string",
"description": "Cache key to delete",
"optional": false
}
],
"returns": "Promise<void>"
},
{
"name": "has",
"description": "Check if a key exists in cache",
"params": [
{
"name": "key",
"type": "string",
"description": "Cache key to check",
"optional": false
}
],
"returns": "Promise<boolean>"
},
{
"name": "clear",
"description": "Clear all cache entries",
"params": [],
"returns": "Promise<void>"
}
]
},
{
"name": "embedding",
"description": "Embedding API - Client-side embedding with server-side vector storage",
"methods": [
{
"name": "embed",
"description": "Request client to generate and store embeddings",
"params": [
{
"name": "input",
"type": "string | string[]",
"description": "Text(s) to embed",
"optional": false
},
{
"name": "metadata",
"type": "Record<string, unknown>",
"description": "Optional metadata to store with embeddings",
"optional": true
}
],
"returns": "Promise<string | string[]>"
},
{
"name": "search",
"description": "Search stored embeddings by similarity",
"params": [
{
"name": "query",
"type": "string",
"description": "Search query text (will be embedded by client)",
"optional": false
},
{
"name": "options",
"type": "Omit<SearchOptions, 'query'>",
"description": "Search options (topK, minSimilarity, filter)",
"optional": true
}
],
"returns": "Promise<SearchResult[]>"
},
{
"name": "similarity",
"description": "Calculate cosine similarity between two embedding vectors",
"params": [
{
"name": "embedding1",
"type": "number[]",
"description": "First embedding vector",
"optional": false
},
{
"name": "embedding2",
"type": "number[]",
"description": "Second embedding vector",
"optional": false
}
],
"returns": "number"
},
{
"name": "getAll",
"description": "Get all stored embeddings",
"params": [],
"returns": "EmbeddingRecord[]"
},
{
"name": "count",
"description": "Get count of stored embeddings",
"params": [],
"returns": "number"
}
]
},
{
"name": "llm",
"description": "LLM API - Large Language Model calls using client-provided LLM (requires client.provideLLM())",
"methods": [
{
"name": "call",
"description": "Make an LLM call with a prompt",
"params": [
{
"name": "options",
"type": "LLMCallOptions",
"description": "LLM call options including prompt",
"optional": false
}
],
"returns": "Promise<string>"
},
{
"name": "extract",
"description": "Extract structured data from text using an LLM",
"params": [
{
"name": "options",
"type": "LLMExtractOptions",
"description": "Extraction options with JSON schema",
"optional": false
}
],
"returns": "Promise<T>"
},
{
"name": "classify",
"description": "Classify text into one of the provided categories",
"params": [
{
"name": "options",
"type": "LLMClassifyOptions",
"description": "Classification options with categories",
"optional": false
}
],
"returns": "Promise<string>"
}
]
},
{
"name": "progress",
"description": "Progress API - Report execution progress to clients",
"methods": [
{
"name": "report",
"description": "Report progress with message and completion fraction",
"params": [
{
"name": "message",
"type": "string",
"description": "Progress message",
"optional": false
},
{
"name": "fraction",
"type": "number",
"description": "Completion fraction (0-1)",
"optional": false
}
],
"returns": "void"
}
]
}
];
/**
* Runtime API names - specific literal types for type-safe API filtering
*/
export type RuntimeAPIName = 'approval' | 'cache' | 'embedding' | 'llm' | 'progress';
/**
* Type definitions extracted using ts-json-schema-generator
*/
export const TYPE_REGISTRY = [
{
"name": "ApprovalResponse",
"definition": "export interface ApprovalResponse<T = unknown> {\n\tapproved: boolean;\n\tresponse?: T;\n\ttimestamp: number;\n}"
},
{
"name": "SearchOptions",
"definition": "interface SearchOptions {\n query: string;\n topK?: number;\n minSimilarity?: number;\n filter?: Record<string, unknown>;\n}"
},
{
"name": "SearchResult",
"definition": "interface SearchResult {\n id: string;\n text: string;\n similarity: number;\n metadata?: Record<string, unknown>;\n}"
},
{
"name": "EmbeddingRecord",
"definition": "interface EmbeddingRecord {\n id: string;\n text: string;\n embedding: number[];\n metadata?: Record<string, unknown>;\n}"
},
{
"name": "LLMCallOptions",
"definition": "interface LLMCallOptions {\n prompt: string;\n context?: Record<string, unknown>;\n model?: string;\n maxTokens?: number;\n temperature?: number;\n systemPrompt?: string;\n}"
},
{
"name": "LLMExtractOptions",
"definition": "interface LLMExtractOptions {\n prompt: string;\n context?: Record<string, unknown>;\n schema: unknown;\n}"
},
{
"name": "LLMClassifyOptions",
"definition": "interface LLMClassifyOptions {\n text: string;\n categories: string[];\n context?: Record<string, unknown>;\n}"
}
];