Files
clawdbot/apps/macos/Sources/Clawdis/Resources/WebChat/prompts/prompts.d.ts
2025-12-06 05:01:28 +01:00

11 lines
4.5 KiB
TypeScript

/**
* Centralized tool prompts/descriptions.
* Each prompt is either a string constant or a template function.
*/
export declare const JAVASCRIPT_REPL_TOOL_DESCRIPTION: (runtimeProviderDescriptions: string[]) => string;
export declare const ARTIFACTS_TOOL_DESCRIPTION: (runtimeProviderDescriptions: string[]) => string;
export declare const ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RW = "\n### Artifacts Storage\n\nCreate, read, update, and delete files in artifacts storage.\n\n#### When to Use\n- Store intermediate results between tool calls\n- Save generated files (images, CSVs, processed data) for user to view and download\n\n#### Do NOT Use For\n- Content you author directly, like summaries of content you read (use artifacts tool instead)\n\n#### Functions\n- listArtifacts() - List all artifact filenames, returns Promise<string[]>\n- getArtifact(filename) - Read artifact content, returns Promise<string | object>. JSON files auto-parse to objects, binary files return base64 string\n- createOrUpdateArtifact(filename, content, mimeType?) - Create or update artifact, returns Promise<void>. JSON files auto-stringify objects, binary requires base64 string with mimeType\n- deleteArtifact(filename) - Delete artifact, returns Promise<void>\n\n#### Example\nJSON workflow:\n```javascript\n// Fetch and save\nconst response = await fetch('https://api.example.com/products');\nconst products = await response.json();\nawait createOrUpdateArtifact('products.json', products);\n\n// Later: read and filter\nconst all = await getArtifact('products.json');\nconst cheap = all.filter(p => p.price < 100);\nawait createOrUpdateArtifact('cheap.json', cheap);\n```\n\nBinary file (image):\n```javascript\nconst canvas = document.createElement('canvas');\ncanvas.width = 800; canvas.height = 600;\nconst ctx = canvas.getContext('2d');\nctx.fillStyle = 'blue';\nctx.fillRect(0, 0, 800, 600);\n// Remove data:image/png;base64, prefix\nconst base64 = canvas.toDataURL().split(',')[1];\nawait createOrUpdateArtifact('chart.png', base64, 'image/png');\n```\n";
export declare const ARTIFACTS_RUNTIME_PROVIDER_DESCRIPTION_RO = "\n### Artifacts Storage\n\nRead files from artifacts storage.\n\n#### When to Use\n- Read artifacts created by REPL or artifacts tool\n- Access data from other HTML artifacts\n- Load configuration or data files\n\n#### Do NOT Use For\n- Creating new artifacts (not available in HTML artifacts)\n- Modifying artifacts (read-only access)\n\n#### Functions\n- listArtifacts() - List all artifact filenames, returns Promise<string[]>\n- getArtifact(filename) - Read artifact content, returns Promise<string | object>. JSON files auto-parse to objects, binary files return base64 string\n\n#### Example\nJSON data:\n```javascript\nconst products = await getArtifact('products.json');\nconst html = products.map(p => `<div>${p.name}: $${p.price}</div>`).join('');\ndocument.body.innerHTML = html;\n```\n\nBinary image:\n```javascript\nconst base64 = await getArtifact('chart.png');\nconst img = document.createElement('img');\nimg.src = 'data:image/png;base64,' + base64;\ndocument.body.appendChild(img);\n```\n";
export declare const ATTACHMENTS_RUNTIME_DESCRIPTION = "\n### User Attachments\n\nRead files the user uploaded to the conversation.\n\n#### When to Use\n- Process user-uploaded files (CSV, JSON, Excel, images, PDFs)\n\n#### Functions\n- listAttachments() - List all attachments, returns array of {id, fileName, mimeType, size}\n- readTextAttachment(id) - Read attachment as text, returns string\n- readBinaryAttachment(id) - Read attachment as binary data, returns Uint8Array\n\n#### Example\nCSV file:\n```javascript\nconst files = listAttachments();\nconst csvFile = files.find(f => f.fileName.endsWith('.csv'));\nconst csvData = readTextAttachment(csvFile.id);\nconst rows = csvData.split('\\n').map(row => row.split(','));\n```\n\nExcel file:\n```javascript\nconst XLSX = await import('https://esm.run/xlsx');\nconst files = listAttachments();\nconst xlsxFile = files.find(f => f.fileName.endsWith('.xlsx'));\nconst bytes = readBinaryAttachment(xlsxFile.id);\nconst workbook = XLSX.read(bytes);\nconst data = XLSX.utils.sheet_to_json(workbook.Sheets[workbook.SheetNames[0]]);\n```\n";
export declare const EXTRACT_DOCUMENT_DESCRIPTION = "# Extract Document\n\nExtract plain text from documents on the web (PDF, DOCX, XLSX, PPTX).\n\n## When to Use\nUser wants you to read a document at a URL.\n\n## Input\n- { url: \"https://example.com/document.pdf\" } - URL to PDF, DOCX, XLSX, or PPTX\n\n## Returns\nStructured plain text with page/sheet/slide delimiters.";
//# sourceMappingURL=prompts.d.ts.map