@ui-tars/sdk
Version:
A powerful cross-platform(ANY device/platform) toolkit for building GUI automation agents for UI-TARS
1 lines • 3.38 kB
Source Map (JSON)
{"version":3,"file":"constants.mjs","sources":["webpack://@ui-tars/sdk/./src/constants.ts"],"sourcesContent":["/*\n * Copyright (c) 2025 Bytedance, Inc. and its affiliates.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport type { AgentContext } from './types';\n\nexport type Factors = [number, number];\n\nexport const MAX_SNAPSHOT_ERR_CNT = 10;\nexport const DEFAULT_FACTORS: Factors = [1000, 1000];\nexport const MAX_PIXELS = 1350 * 28 * 28;\nexport const SYSTEM_PROMPT = `You are a GUI agent. You are given a task and your action history, with screenshots. You need to perform the next action to complete the task.\n\n## Output Format\n\\`\\`\\`\nThought: ...\nAction: ...\n\\`\\`\\`\n\n## Action Space\nclick(start_box='[x1, y1, x2, y2]')\nleft_double(start_box='[x1, y1, x2, y2]')\nright_single(start_box='[x1, y1, x2, y2]')\ndrag(start_box='[x1, y1, x2, y2]', end_box='[x3, y3, x4, y4]')\nhotkey(key='')\ntype(content='') #If you want to submit your input, use \"\\\\n\" at the end of \\`content\\`.\nscroll(start_box='[x1, y1, x2, y2]', direction='down or up or right or left')\nwait() #Sleep for 5s and take a screenshot to check for any changes.\nfinished()\ncall_user() # Submit the task and call the user when the task is unsolvable, or when you need the user's help.\n\n## Note\n- Write a small plan and finally summarize your next action (with its target element) in one sentence in \\`Thought\\` part.\n\n## User Instruction\n`;\n\nexport const SYSTEM_PROMPT_TEMPLATE = `You are a GUI agent. You are given a task and your action history, with screenshots. You need to perform the next action to complete the task.\n\n## Output Format\n\\`\\`\\`\nThought: ...\nAction: ...\n\\`\\`\\`\n\n## Action Space\n{{action_spaces_holder}}\n\n## Note\n- Write a small plan and finally summarize your next action (with its target element) in one sentence in \\`Thought\\` part.\n\n## User Instruction\n`;\n\nexport const DEFAULT_ACTION_SPACES = `\nclick(start_box='[x1, y1, x2, y2]')\nleft_double(start_box='[x1, y1, x2, y2]')\nright_single(start_box='[x1, y1, x2, y2]')\ndrag(start_box='[x1, y1, x2, y2]', end_box='[x3, y3, x4, y4]')\nhotkey(key='')\ntype(content='') #If you want to submit your input, use \"\\\\n\" at the end of \\`content\\`.\nscroll(start_box='[x1, y1, x2, y2]', direction='down or up or right or left')\nwait() #Sleep for 5s and take a screenshot to check for any changes.\nfinished()\ncall_user() # Submit the task and call the user when the task is unsolvable, or when you need the user's help.\n`;\n\nexport const DEFAULT_CONTEXT = {\n logger: console,\n factors: DEFAULT_FACTORS,\n systemPrompt: SYSTEM_PROMPT,\n} satisfies Partial<AgentContext>;\n\nexport enum INTERNAL_ACTION_SPACES_ENUM {\n CALL_USER = 'call_user',\n MAX_LOOP = 'max_loop',\n ERROR_ENV = 'error_env',\n FINISHED = 'finished',\n}\n"],"names":["MAX_SNAPSHOT_ERR_CNT","DEFAULT_FACTORS","MAX_PIXELS","SYSTEM_PROMPT","SYSTEM_PROMPT_TEMPLATE","DEFAULT_ACTION_SPACES","DEFAULT_CONTEXT","console","INTERNAL_ACTION_SPACES_ENUM"],"mappings":";;;;AAQO,MAAMA,uBAAuB;AAC7B,MAAMC,kBAA2B;IAAC;IAAM;CAAK;AAC7C,MAAMC,aAAa;AACnB,MAAMC,gBAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;AAwB9B,CAAC;AAEM,MAAMC,yBAAyB,CAAC;;;;;;;;;;;;;;;AAevC,CAAC;AAEM,MAAMC,wBAAwB,CAAC;;;;;;;;;;;AAWtC,CAAC;AAEM,MAAMC,kBAAkB;IAC7B,QAAQC;IACR,SAASN;IACT,cAAcE;AAChB;AAEO,IAAKK,wCAA2BA,WAAAA,GAAAA,SAA3BA,2BAA2B;;;;;WAA3BA"}