This commit is contained in:
seb
2026-10-11 13:10:13 +02:00
parent 0621416aa8
commit 663589a450

View File

@@ -9,13 +9,13 @@ import { listSkillFiles } from './skill.js';
*/
export const TOOL_DESCRIPTIONS = {
dashback_request:
'Call Dashback REST API. Paths are root-relative (e.g. "/article/2").',
'Call the Dashback (QuixPOS) REST API with GET, POST, PUT, PATCH or DELETE. Paths are root-relative (e.g. "/article/2").',
ask_user:
'Prompt user for clarification or decision with concise question and up to 3 options.',
'Prompt user for missing decisions or parameters with a concise question and up to 3 options. Pauses the run until the user answers.',
javascript_execute:
'Execute JS in an isolated worker sandbox using either inline `code` or a VFS applet. Provide exactly one of `code` and `appletvfsfile`. ' +
'Execute JS in an isolated worker sandbox using either inline `code` or a VFS applet. Use for computation, binary I/O and aggregation. Provide exactly one of `code` and `appletvfsfile`. ' +
'Applets are the preferred method when the first execution may throw: save a `.applet.js` file in the VFS so it can be inspected and further edited with `patch`, then call it by VFS path. ' +
'Applet files must start with `// @applet-input-schema {JSON Schema}` on line 1 and `// @applet-output-schema <columns>` on line 2. ' +
'The input schema describes the GUI form passed as `applet_input`. The output line declares the RESULT COLUMNS as typed CSV: `name:type` pairs separated by `;` (e.g. `id:integer;name:string;active:boolean`); a bare `name` defaults to string, and the allowed types are string, integer, number, boolean and date. ' +
@@ -31,12 +31,12 @@ export const TOOL_DESCRIPTIONS = {
'Set skills=true to list root-level "<slug>.SKILL" files (reusable instructions exempt from reset_vfs; read via read_file).',
read_file:
'Read text file from VFS. Root-relative forward-slash paths. ' +
'Read text file (text, CSV, JSON, markdown, …) from VFS. Root-relative forward-slash paths. ' +
'SKILL files return parsed title and markdown content. ' +
'Windowed via seek/limit (0-indexed lines). Binary files not supported (use analyze_image for images).',
patch:
'Create, overwrite, or search-and-replace text in VFS files. Operations apply in order. ' +
'Create, overwrite, or search-and-replace text in VFS files (the only write path for text files). Operations apply in order. ' +
'Mode: search null/omitted = create or overwrite (directories auto-created). ' +
'search provided = replace first verbatim occurrence (read file with read_file first). ' +
'SKILL files: root-only "<slug>.SKILL" (line 1 is title, or provide title field).',
@@ -45,7 +45,7 @@ export const TOOL_DESCRIPTIONS = {
'Search Google Images and download candidates to VFS as AVIF. Returns VFS paths for inspection via analyze_image.',
analyze_image:
'Inspect 1-9 images via vision model. Multiple paths render as a labelled comparison grid. ' +
'Inspect 1-9 images via vision model. Always evaluate images with this tool before using them. Multiple paths render as a labelled comparison grid. ' +
'Paths: VFS-relative ("images/foo.avif") or DB ("image/<hash>"). Returns model evaluation.',
web_search:
@@ -55,7 +55,7 @@ export const TOOL_DESCRIPTIONS = {
'Fetch and scrape web page content via Serper Scrape (text, markdown, metadata).',
pdf_read:
'Read and convert PDF/text documents to text or VFS PNG images (stored in "images/").',
'Read PDF/text documents as layout text ("txt") or render pages to VFS PNG images ("png", stored in "images/").',
reset_vfs:
'Clear VFS files, images, and artifacts. Preserves SKILL files by default.',
@@ -84,7 +84,7 @@ export const TOOL_DESCRIPTIONS = {
'Computes 2-decimal rounded display values and 6-decimal high-precision net values for API article creation.',
set_user_route:
'Navigate the user to a frontend route. Use this when the user says "show me the article" or asks to see, open, or view a specific page or entity (e.g. an article detail page, orders, quotes, deliveries, or customer). Refer to the User Perspective Route Construction Matrix for valid route patterns.',
'Navigate the user to a frontend route. Use this when the user says "show me the article" or asks to see, open, or view a specific page or entity (e.g. an article detail page, orders, quotes, deliveries, or customer). Use a path from the ROUTE MATRIX in the system prompt.',
};
// #region Tool Parameter Descriptions
@@ -252,32 +252,6 @@ export const ANALYZE_IMAGE_VISION_DESCRIBE_PROMPT =
// #region System Prompt Components
/**
* Concise tool listing included directly in the system prompt.
*/
export const SYSTEM_PROMPT_TOOLS = [
'TOOLS:',
'1. dashback_request: HTTP requests (GET, POST, PUT, PATCH, DELETE) to QuixPOS API.',
'2. ask_user: Prompt user for missing decisions or parameters; pauses until answered.',
'3. javascript_execute: Sandboxed Node env for computation, binary I/O, aggregation. Assign module.exports. Has fetch("/path"), vfs, sharp, ExcelJS.',
'4. find_files: List VFS files (skills=true for SKILL files).',
'5. read_file: Read VFS text/CSV/JSON files (seek/limit windowed).',
'6. patch: Create/overwrite/replace text in VFS files, incl. SKILL files (only text write path).',
'7. search_images: Search Google Images; downloads AVIF candidates to VFS.',
'8. analyze_image: Vision analysis of up to 9 images (VFS paths or "image/<hash>"). Always evaluate images with this tool.',
'9. web_search: Google web search (timePeriod: "day"|"week" for current events).',
'10. url_get: Fetch/scrape web page as markdown.',
'11. pdf_read: Convert PDF to layout text ("txt") or VFS page images ("png").',
'12. reset_vfs: Delete all non-SKILL VFS files.',
'13. rm: Delete a single VFS file (including SKILL files).',
'14. apisuggestionsorissues: Report API bugs or missing endpoints.',
'15. search_articles: Search by name, brand, EAN, SKU, supplier SKU. Returns full articles window (default 3, max 20), offset, total.',
'16. edit_image: Generate/edit images with the company image model (modelslugimage). Supports attachments (low/high quality), sizes 1K/2K/4K, ratios 1:1/4:3/3:4. Output: AVIF in VFS.',
'17. ean_checksum: Validate or generate barcode check digits (EAN-13, EAN-8, UPC-A, GTIN-14).',
'18. net_gross_calc: Convert gross/net with VAT (default 19%). Returns 2-decimal display values and high-precision net for the API.',
'19. set-user-route: Navigate the UI (e.g. "show me the article", "open quote 1001") using the Route Matrix.',
].join('\n');
export const SYSTEM_PROMPT_VFS_RULES = [
'VFS & SKILLS:',
'- Persistent per-company VFS; root-relative forward-slash paths (e.g. "labels/sheet1.png"). Can host a static website.',
@@ -413,7 +387,6 @@ export async function buildSystemPrompt(vfsRoot, googleAuthId) {
'QuixPOS Article Management System API Assistant',
`Date: ${today}`,
'[TESTSYSTEM, destructive commands are allowed, main purpose of this system is to find bugs]',
SYSTEM_PROMPT_TOOLS,
'',
SYSTEM_PROMPT_VFS_RULES,
'',