@ui-tars-test/agent-sdk 0.3.14 → 0.3.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"ToolCallEngine.d.ts","sourceRoot":"","sources":["../src/ToolCallEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,IAAI,EACJ,mCAAmC,EACnC,0BAA0B,EAC1B,mCAAmC,EACnC,mBAAmB,EACnB,wBAAwB,EACxB,gBAAgB,EAChB,0BAA0B,EAE1B,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,qCAAqC,CAAC;AAK7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAKhE;;;;;;;;;GASG;AACH,qBAAa,sBAAuB,SAAQ,cAAc;IACxD,OAAO,CAAC,kBAAkB,CAAC,CAAqB;gBAEpC,kBAAkB,CAAC,EAAE,kBAAkB;IAKnD;;OAEG;IACH,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM;IAI1D;;;;OAIG;IACH,cAAc,CAAC,OAAO,EAAE,mCAAmC,GAAG,0BAA0B;IAiBxF;;;;OAIG;IACH,yBAAyB,IAAI,qBAAqB;IASlD;;;;OAIG;IACH,qBAAqB,CACnB,KAAK,EAAE,mBAAmB,EAC1B,KAAK,EAAE,qBAAqB,GAC3B,iBAAiB;IA0BpB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAI1B;;OAEG;IACH,wBAAwB,CAAC,KAAK,EAAE,qBAAqB,GAAG,mBAAmB;IA2J3E;;;;;OAKG;IACH,+BAA+B,CAC7B,yBAAyB,EAAE,gBAAgB,CAAC,qBAAqB,GAChE,mCAAmC;IAOtC;;;;;OAKG;IACH,qCAAqC,CACnC,eAAe,EAAE,wBAAwB,EAAE,GAC1C,0BAA0B,EAAE;CAchC"}
1
+ {"version":3,"file":"ToolCallEngine.d.ts","sourceRoot":"","sources":["../src/ToolCallEngine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,IAAI,EACJ,mCAAmC,EACnC,0BAA0B,EAC1B,mCAAmC,EACnC,mBAAmB,EACnB,wBAAwB,EACxB,gBAAgB,EAChB,0BAA0B,EAE1B,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,qCAAqC,CAAC;AAK7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAKhE;;;;;;;;;GASG;AACH,qBAAa,sBAAuB,SAAQ,cAAc;IACxD,OAAO,CAAC,kBAAkB,CAAC,CAAqB;gBAEpC,kBAAkB,CAAC,EAAE,kBAAkB;IAKnD;;OAEG;IACH,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,MAAM;IAI1D;;;;OAIG;IACH,cAAc,CAAC,OAAO,EAAE,mCAAmC,GAAG,0BAA0B;IAiBxF;;;;OAIG;IACH,yBAAyB,IAAI,qBAAqB;IASlD;;;;OAIG;IACH,qBAAqB,CACnB,KAAK,EAAE,mBAAmB,EAC1B,KAAK,EAAE,qBAAqB,GAC3B,iBAAiB;IA0BpB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAI1B;;OAEG;IACH,wBAAwB,CAAC,KAAK,EAAE,qBAAqB,GAAG,mBAAmB;IAkL3E;;;;;OAKG;IACH,+BAA+B,CAC7B,yBAAyB,EAAE,gBAAgB,CAAC,qBAAqB,GAChE,mCAAmC;IAOtC;;;;;OAKG;IACH,qCAAqC,CACnC,eAAe,EAAE,wBAAwB,EAAE,GAC1C,0BAA0B,EAAE;CAchC"}
@@ -114,7 +114,31 @@ class GUIAgentToolCallEngine extends tarko_agent_interface_namespaceObject.ToolC
114
114
  const args = {};
115
115
  const paramRegex = /<parameter_[^=>]*=([a-zA-Z0-9_]+)>([\s\S]*?)<\/parameter_[^>]*>/g;
116
116
  let paramMatch;
117
- while(null !== (paramMatch = paramRegex.exec(innerContent)))args[paramMatch[1]] = paramMatch[2].trim();
117
+ while(null !== (paramMatch = paramRegex.exec(innerContent))){
118
+ const key = paramMatch[1];
119
+ let value = paramMatch[2].trim();
120
+ if ([
121
+ 'point',
122
+ 'start_point',
123
+ 'end_point',
124
+ 'start',
125
+ 'end'
126
+ ].includes(key) && 'string' == typeof value) {
127
+ value = value.replace(/^<[^>]+>([\s\S]*?)<\/[^>]+>$/, '$1').trim();
128
+ const coordsMatch = value.match(/(\d+)[, ]+(\d+)/);
129
+ if (coordsMatch) {
130
+ const x = parseInt(coordsMatch[1], 10);
131
+ const y = parseInt(coordsMatch[2], 10);
132
+ value = {
133
+ raw: {
134
+ x,
135
+ y
136
+ }
137
+ };
138
+ }
139
+ }
140
+ args[key] = value;
141
+ }
118
142
  actions.push({
119
143
  type: actionName,
120
144
  inputs: args,
@@ -1 +1 @@
1
- {"version":3,"file":"ToolCallEngine.js","sources":["webpack://@ui-tars-test/agent-sdk/webpack/runtime/define_property_getters","webpack://@ui-tars-test/agent-sdk/webpack/runtime/has_own_property","webpack://@ui-tars-test/agent-sdk/webpack/runtime/make_namespace_object","webpack://@ui-tars-test/agent-sdk/./src/ToolCallEngine.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import {\n ToolCallEngine,\n Tool,\n ToolCallEnginePrepareRequestContext,\n ChatCompletionCreateParams,\n ChatCompletionAssistantMessageParam,\n ChatCompletionChunk,\n MultimodalToolCallResult,\n AgentEventStream,\n ChatCompletionMessageParam,\n ChatCompletionMessageToolCall,\n ParsedModelResponse,\n StreamProcessingState,\n StreamChunkResult,\n} from '@ui-tars-test/tarko-agent-interface';\nimport { DefaultActionParser } from '@ui-tars-test/action-parser';\nimport { GUI_ADAPTED_TOOL_NAME } from './constants';\nimport { ConsoleLogger, LogLevel } from '@agent-infra/logger';\nimport { serializeAction } from '@ui-tars-test/shared/utils';\nimport { CustomActionParser } from '@ui-tars-test/shared/types';\n\nconst defaultParser = new DefaultActionParser();\nconst defaultLogger = new ConsoleLogger('[GUIAgent:ToolCallEngine]', LogLevel.DEBUG);\n\n/**\n * GUIAgentToolCallEngine - Minimal prompt engineering tool call engine\n *\n * This is the simplest possible implementation of a tool call engine that:\n * 1. Uses prompt engineering to instruct the LLM to output tool calls in a specific format\n * 2. Parses tool calls from LLM response text using simple regex matching\n * 3. Does not support streaming (focuses on core functionality only)\n *\n * Format used: <tool_call>{\"name\": \"tool_name\", \"arguments\": {...}}</tool_call>\n */\nexport class GUIAgentToolCallEngine extends ToolCallEngine {\n private customActionParser?: CustomActionParser;\n\n constructor(customActionParser?: CustomActionParser) {\n super();\n this.customActionParser = customActionParser;\n }\n\n /**\n * Prepare system prompt with tool information and instructions\n */\n preparePrompt(instructions: string, tools: Tool[]): string {\n return instructions;\n }\n\n /**\n * Prepare request parameters for the LLM\n *\n * FIXME: move to base tool call engine.\n */\n prepareRequest(context: ToolCallEnginePrepareRequestContext): ChatCompletionCreateParams {\n defaultLogger.log(\n \"【New Sys Prompt'】 System Prompt:\",\n JSON.stringify(context.messages.find((m) => m.role === 'system')?.content || ''),\n );\n return {\n model: context.model,\n messages: context.messages,\n temperature: context.temperature || 0.7,\n stream: true,\n // When tools are undefined (disabled), tool_choice MUST also be undefined\n // Otherwise OpenAI/Azure will return 400 Bad Request\n tool_choice: undefined,\n tools: undefined,\n };\n }\n\n /**\n * Initialize processing state (minimal implementation)\n *\n * FIXME: move to base tool call engine.\n */\n initStreamProcessingState(): StreamProcessingState {\n return {\n contentBuffer: '',\n toolCalls: [],\n reasoningBuffer: '',\n finishReason: null,\n };\n }\n\n /**\n * Process streaming chunks - simply accumulate content\n *\n * FIXME: make it optional\n */\n processStreamingChunk(\n chunk: ChatCompletionChunk,\n state: StreamProcessingState,\n ): StreamChunkResult {\n // For non-streaming requests, the entire response comes in one chunk\n const delta = chunk.choices[0]?.delta;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const message = (chunk.choices[0] as any)?.message;\n\n // Accumulate content from delta (streaming) or message (non-streaming)\n const content = delta?.content || message?.content || '';\n if (content) {\n state.contentBuffer += content;\n }\n\n // Record finish reason\n if (chunk.choices[0]?.finish_reason) {\n state.finishReason = chunk.choices[0].finish_reason;\n }\n\n // Return incremental content without tool call detection during streaming\n return {\n content: content,\n reasoningContent: '',\n hasToolCallUpdate: false,\n toolCalls: [],\n };\n }\n\n /**\n * Generate a tool call ID\n */\n private generateToolCallId(): string {\n return `call_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;\n }\n\n /**\n * Extract tool calls from complete response text\n */\n finalizeStreamProcessing(state: StreamProcessingState): ParsedModelResponse {\n const fullContent = state.contentBuffer;\n console.log('[DEBUG] Full content length:', fullContent.length);\n console.log('[DEBUG] Full content prefix:', fullContent.slice(0, 100));\n console.log('[DEBUG] Full content suffix:', fullContent.slice(-100));\n defaultLogger.log(\"【New Sys Prompt'】 Model Response:\", fullContent);\n defaultLogger.log('[finalizeStreamProcessing] fullContent', fullContent);\n\n // Add explicit log to confirm XML parsing intent\n console.log('[CLI DEBUG] [ToolCallEngine] Full model response received:', fullContent);\n\n // Try custom action parser first if available\n let parsedGUIResponse = null;\n if (this.customActionParser) {\n parsedGUIResponse = this.customActionParser(fullContent);\n defaultLogger.log('[finalizeStreamProcessing] Using custom action parser');\n console.log('[CLI DEBUG] [ToolCallEngine] Using custom action parser');\n }\n\n // Priority: Custom Regex Parser > Default Parser\n // Check if the content contains the specific XML format with dynamic suffixes\n if (/<seed:tool_call_never_used_/.test(fullContent)) {\n console.log(\n '[CLI DEBUG] [ToolCallEngine] Detected custom XML format. Attempting custom regex parser.',\n );\n try {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const actions: any[] = [];\n // Regex to match <function_...=name>...</function...>\n // Handles dynamic suffixes like _never_used_...\n const functionRegex = /<function_[^=>]*=([a-zA-Z0-9_]+)>([\\s\\S]*?)<\\/function_[^>]*>/g;\n let match;\n\n while ((match = functionRegex.exec(fullContent)) !== null) {\n const actionName = match[1];\n const innerContent = match[2];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const args: any = {};\n\n // Regex to match <parameter_...=key>value</parameter...>\n const paramRegex = /<parameter_[^=>]*=([a-zA-Z0-9_]+)>([\\s\\S]*?)<\\/parameter_[^>]*>/g;\n let paramMatch;\n while ((paramMatch = paramRegex.exec(innerContent)) !== null) {\n args[paramMatch[1]] = paramMatch[2].trim();\n }\n\n actions.push({\n type: actionName,\n inputs: args,\n thought: '',\n });\n }\n\n // Also try to extract thought from <think_...>...</think_...>\n const thoughtRegex = /<think_[^>]*>([\\s\\S]*?)<\\/think_[^>]*>/g;\n const thoughtMatch = thoughtRegex.exec(fullContent);\n const thoughtContent = thoughtMatch ? thoughtMatch[1].trim() : '';\n\n if (actions.length > 0) {\n console.log(\n `[CLI DEBUG] [ToolCallEngine] Custom regex parser found ${actions.length} actions.`,\n );\n parsedGUIResponse = {\n errorMessage: '',\n rawContent: fullContent,\n actions: actions,\n reasoningContent: thoughtContent,\n };\n }\n } catch (e) {\n console.error('[CLI DEBUG] [ToolCallEngine] Custom regex parser error:', e);\n }\n }\n\n // Fall back to default parser if regex parser didn't produce results\n if (!parsedGUIResponse) {\n console.log('[CLI DEBUG] [ToolCallEngine] Using default action parser (XML parser)');\n parsedGUIResponse = defaultParser.parsePrediction(fullContent);\n defaultLogger.log('[finalizeStreamProcessing] Using default action parser');\n }\n\n if (parsedGUIResponse) {\n console.log(\n '[CLI DEBUG] [ToolCallEngine] Parsed response:',\n JSON.stringify(parsedGUIResponse, null, 2),\n );\n } else {\n console.log('[CLI DEBUG] [ToolCallEngine] Parsing failed or returned null');\n }\n\n if (!parsedGUIResponse || parsedGUIResponse.errorMessage) {\n return {\n content: '',\n rawContent: fullContent,\n toolCalls: [\n {\n id: this.generateToolCallId(),\n type: 'function',\n function: {\n name: GUI_ADAPTED_TOOL_NAME,\n arguments: JSON.stringify({\n action: '',\n step: '',\n thought: '',\n operator_action: null,\n errorMessage:\n parsedGUIResponse?.errorMessage ?? 'Failed to parse GUI Action from output',\n }),\n },\n },\n ],\n finishReason: 'tool_calls',\n };\n }\n\n const toolCalls: ChatCompletionMessageToolCall[] = [];\n\n let finished = false;\n let finishMessage: string | null = null;\n for (const action of parsedGUIResponse.actions) {\n if (action.type === 'finished') {\n finished = true;\n finishMessage = action.inputs?.content ?? null;\n continue;\n }\n toolCalls.push({\n id: this.generateToolCallId(),\n type: 'function',\n function: {\n name: GUI_ADAPTED_TOOL_NAME,\n arguments: JSON.stringify({\n action: serializeAction(action),\n step: '',\n thought: parsedGUIResponse.reasoningContent ?? '',\n operator_action: action,\n }),\n },\n });\n }\n\n const content = finishMessage ?? '';\n const reasoningContent = parsedGUIResponse.reasoningContent ?? '';\n const contentForWebUI = content.replace(/\\\\n|\\n/g, '<br>');\n const reasoningContentForWebUI = reasoningContent.replace(/\\\\n|\\n/g, '<br>');\n\n // No tool calls found - return regular response\n return {\n content: contentForWebUI,\n rawContent: fullContent,\n reasoningContent: reasoningContentForWebUI,\n toolCalls,\n finishReason: toolCalls.length > 0 && !finished ? 'tool_calls' : 'stop',\n };\n }\n\n /**\n * Build assistant message for conversation history\n * For PE engines, we preserve the raw content including tool call markup\n *\n * FIXME: move to base tool call engine.\n */\n buildHistoricalAssistantMessage(\n currentLoopAssistantEvent: AgentEventStream.AssistantMessageEvent,\n ): ChatCompletionAssistantMessageParam {\n return {\n role: 'assistant',\n content: currentLoopAssistantEvent.rawContent || currentLoopAssistantEvent.content,\n };\n }\n\n /**\n * Build tool result messages as user messages\n * PE engines format tool results as user input for next iteration\n *\n * FIXME: move to base tool call engine.\n */\n buildHistoricalToolCallResultMessages(\n toolCallResults: MultimodalToolCallResult[],\n ): ChatCompletionMessageParam[] {\n return toolCallResults.map((result) => {\n // Extract text content from multimodal result\n const textContent = result.content\n .filter((part) => part.type === 'text')\n .map((part) => (part as { text: string }).text)\n .join('');\n\n return {\n role: 'user',\n content: `Tool \"${result.toolName}\" result:\\n${textContent}`,\n };\n });\n }\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","defaultParser","DefaultActionParser","defaultLogger","ConsoleLogger","LogLevel","GUIAgentToolCallEngine","ToolCallEngine","instructions","tools","context","_context_messages_find","JSON","m","undefined","chunk","state","_chunk_choices_","_chunk_choices_1","_chunk_choices_2","delta","message","content","Date","Math","fullContent","console","parsedGUIResponse","actions","functionRegex","match","actionName","innerContent","args","paramRegex","paramMatch","thoughtRegex","thoughtMatch","thoughtContent","e","GUI_ADAPTED_TOOL_NAME","toolCalls","finished","finishMessage","action","_action_inputs","serializeAction","reasoningContent","contentForWebUI","reasoningContentForWebUI","currentLoopAssistantEvent","toolCallResults","result","textContent","part","customActionParser"],"mappings":";;;;;;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,eAAlB,OAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG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ACC;YAE1B,MAAMC,cAAcD,OAAO,OAAO,CAC/B,MAAM,CAAC,CAACE,OAASA,AAAc,WAAdA,KAAK,IAAI,EAC1B,GAAG,CAAC,CAACA,OAAUA,KAA0B,IAAI,EAC7C,IAAI,CAAC;YAER,OAAO;gBACL,MAAM;gBACN,SAAS,CAAC,MAAM,EAAEF,OAAO,QAAQ,CAAC,WAAW,EAAEC,aAAa;YAC9D;QACF;IACF;IA3RA,YAAYE,kBAAuC,CAAE;QACnD,KAAK,IAHP,uBAAQ,sBAAR;QAIE,IAAI,CAAC,kBAAkB,GAAGA;IAC5B;AAyRF"}
1
+ {"version":3,"file":"ToolCallEngine.js","sources":["webpack://@ui-tars-test/agent-sdk/webpack/runtime/define_property_getters","webpack://@ui-tars-test/agent-sdk/webpack/runtime/has_own_property","webpack://@ui-tars-test/agent-sdk/webpack/runtime/make_namespace_object","webpack://@ui-tars-test/agent-sdk/./src/ToolCallEngine.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import {\n ToolCallEngine,\n Tool,\n ToolCallEnginePrepareRequestContext,\n ChatCompletionCreateParams,\n ChatCompletionAssistantMessageParam,\n ChatCompletionChunk,\n MultimodalToolCallResult,\n AgentEventStream,\n ChatCompletionMessageParam,\n ChatCompletionMessageToolCall,\n ParsedModelResponse,\n StreamProcessingState,\n StreamChunkResult,\n} from '@ui-tars-test/tarko-agent-interface';\nimport { DefaultActionParser } from '@ui-tars-test/action-parser';\nimport { GUI_ADAPTED_TOOL_NAME } from './constants';\nimport { ConsoleLogger, LogLevel } from '@agent-infra/logger';\nimport { serializeAction } from '@ui-tars-test/shared/utils';\nimport { CustomActionParser } from '@ui-tars-test/shared/types';\n\nconst defaultParser = new DefaultActionParser();\nconst defaultLogger = new ConsoleLogger('[GUIAgent:ToolCallEngine]', LogLevel.DEBUG);\n\n/**\n * GUIAgentToolCallEngine - Minimal prompt engineering tool call engine\n *\n * This is the simplest possible implementation of a tool call engine that:\n * 1. Uses prompt engineering to instruct the LLM to output tool calls in a specific format\n * 2. Parses tool calls from LLM response text using simple regex matching\n * 3. Does not support streaming (focuses on core functionality only)\n *\n * Format used: <tool_call>{\"name\": \"tool_name\", \"arguments\": {...}}</tool_call>\n */\nexport class GUIAgentToolCallEngine extends ToolCallEngine {\n private customActionParser?: CustomActionParser;\n\n constructor(customActionParser?: CustomActionParser) {\n super();\n this.customActionParser = customActionParser;\n }\n\n /**\n * Prepare system prompt with tool information and instructions\n */\n preparePrompt(instructions: string, tools: Tool[]): string {\n return instructions;\n }\n\n /**\n * Prepare request parameters for the LLM\n *\n * FIXME: move to base tool call engine.\n */\n prepareRequest(context: ToolCallEnginePrepareRequestContext): ChatCompletionCreateParams {\n defaultLogger.log(\n \"【New Sys Prompt'】 System Prompt:\",\n JSON.stringify(context.messages.find((m) => m.role === 'system')?.content || ''),\n );\n return {\n model: context.model,\n messages: context.messages,\n temperature: context.temperature || 0.7,\n stream: true,\n // When tools are undefined (disabled), tool_choice MUST also be undefined\n // Otherwise OpenAI/Azure will return 400 Bad Request\n tool_choice: undefined,\n tools: undefined,\n };\n }\n\n /**\n * Initialize processing state (minimal implementation)\n *\n * FIXME: move to base tool call engine.\n */\n initStreamProcessingState(): StreamProcessingState {\n return {\n contentBuffer: '',\n toolCalls: [],\n reasoningBuffer: '',\n finishReason: null,\n };\n }\n\n /**\n * Process streaming chunks - simply accumulate content\n *\n * FIXME: make it optional\n */\n processStreamingChunk(\n chunk: ChatCompletionChunk,\n state: StreamProcessingState,\n ): StreamChunkResult {\n // For non-streaming requests, the entire response comes in one chunk\n const delta = chunk.choices[0]?.delta;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const message = (chunk.choices[0] as any)?.message;\n\n // Accumulate content from delta (streaming) or message (non-streaming)\n const content = delta?.content || message?.content || '';\n if (content) {\n state.contentBuffer += content;\n }\n\n // Record finish reason\n if (chunk.choices[0]?.finish_reason) {\n state.finishReason = chunk.choices[0].finish_reason;\n }\n\n // Return incremental content without tool call detection during streaming\n return {\n content: content,\n reasoningContent: '',\n hasToolCallUpdate: false,\n toolCalls: [],\n };\n }\n\n /**\n * Generate a tool call ID\n */\n private generateToolCallId(): string {\n return `call_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;\n }\n\n /**\n * Extract tool calls from complete response text\n */\n finalizeStreamProcessing(state: StreamProcessingState): ParsedModelResponse {\n const fullContent = state.contentBuffer;\n console.log('[DEBUG] Full content length:', fullContent.length);\n console.log('[DEBUG] Full content prefix:', fullContent.slice(0, 100));\n console.log('[DEBUG] Full content suffix:', fullContent.slice(-100));\n defaultLogger.log(\"【New Sys Prompt'】 Model Response:\", fullContent);\n defaultLogger.log('[finalizeStreamProcessing] fullContent', fullContent);\n\n // Add explicit log to confirm XML parsing intent\n console.log('[CLI DEBUG] [ToolCallEngine] Full model response received:', fullContent);\n\n // Try custom action parser first if available\n let parsedGUIResponse = null;\n if (this.customActionParser) {\n parsedGUIResponse = this.customActionParser(fullContent);\n defaultLogger.log('[finalizeStreamProcessing] Using custom action parser');\n console.log('[CLI DEBUG] [ToolCallEngine] Using custom action parser');\n }\n\n // Priority: Custom Regex Parser > Default Parser\n // Check if the content contains the specific XML format with dynamic suffixes\n if (/<seed:tool_call_never_used_/.test(fullContent)) {\n console.log(\n '[CLI DEBUG] [ToolCallEngine] Detected custom XML format. Attempting custom regex parser.',\n );\n try {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const actions: any[] = [];\n // Regex to match <function_...=name>...</function...>\n // Handles dynamic suffixes like _never_used_...\n const functionRegex = /<function_[^=>]*=([a-zA-Z0-9_]+)>([\\s\\S]*?)<\\/function_[^>]*>/g;\n let match;\n\n while ((match = functionRegex.exec(fullContent)) !== null) {\n const actionName = match[1];\n const innerContent = match[2];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const args: any = {};\n\n // Regex to match <parameter_...=key>value</parameter...>\n const paramRegex = /<parameter_[^=>]*=([a-zA-Z0-9_]+)>([\\s\\S]*?)<\\/parameter_[^>]*>/g;\n let paramMatch;\n while ((paramMatch = paramRegex.exec(innerContent)) !== null) {\n const key = paramMatch[1];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let value: any = paramMatch[2].trim();\n\n // Special handling for coordinate parameters (point, start_point, end_point)\n // Convert string \"x y\" to { raw: { x, y } } object structure expected by Operators\n if (\n ['point', 'start_point', 'end_point', 'start', 'end'].includes(key) &&\n typeof value === 'string'\n ) {\n // Remove potential wrapping tags like <point>...</point>\n value = value.replace(/^<[^>]+>([\\s\\S]*?)<\\/[^>]+>$/, '$1').trim();\n\n // Match coordinates pattern: digits followed by comma or space followed by digits\n // Supports: \"100 200\", \"100, 200\", \"(100, 200)\"\n const coordsMatch = value.match(/(\\d+)[, ]+(\\d+)/);\n if (coordsMatch) {\n const x = parseInt(coordsMatch[1], 10);\n const y = parseInt(coordsMatch[2], 10);\n value = { raw: { x, y } };\n }\n }\n\n args[key] = value;\n }\n\n actions.push({\n type: actionName,\n inputs: args,\n thought: '',\n });\n }\n\n // Also try to extract thought from <think_...>...</think_...>\n const thoughtRegex = /<think_[^>]*>([\\s\\S]*?)<\\/think_[^>]*>/g;\n const thoughtMatch = thoughtRegex.exec(fullContent);\n const thoughtContent = thoughtMatch ? thoughtMatch[1].trim() : '';\n\n if (actions.length > 0) {\n console.log(\n `[CLI DEBUG] [ToolCallEngine] Custom regex parser found ${actions.length} actions.`,\n );\n parsedGUIResponse = {\n errorMessage: '',\n rawContent: fullContent,\n actions: actions,\n reasoningContent: thoughtContent,\n };\n }\n } catch (e) {\n console.error('[CLI DEBUG] [ToolCallEngine] Custom regex parser error:', e);\n }\n }\n\n // Fall back to default parser if regex parser didn't produce results\n if (!parsedGUIResponse) {\n console.log('[CLI DEBUG] [ToolCallEngine] Using default action parser (XML parser)');\n parsedGUIResponse = defaultParser.parsePrediction(fullContent);\n defaultLogger.log('[finalizeStreamProcessing] Using default action parser');\n }\n\n if (parsedGUIResponse) {\n console.log(\n '[CLI DEBUG] [ToolCallEngine] Parsed response:',\n JSON.stringify(parsedGUIResponse, null, 2),\n );\n } else {\n console.log('[CLI DEBUG] [ToolCallEngine] Parsing failed or returned null');\n }\n\n if (!parsedGUIResponse || parsedGUIResponse.errorMessage) {\n return {\n content: '',\n rawContent: fullContent,\n toolCalls: [\n {\n id: this.generateToolCallId(),\n type: 'function',\n function: {\n name: GUI_ADAPTED_TOOL_NAME,\n arguments: JSON.stringify({\n action: '',\n step: '',\n thought: '',\n operator_action: null,\n errorMessage:\n parsedGUIResponse?.errorMessage ?? 'Failed to parse GUI Action from output',\n }),\n },\n },\n ],\n finishReason: 'tool_calls',\n };\n }\n\n const toolCalls: ChatCompletionMessageToolCall[] = [];\n\n let finished = false;\n let finishMessage: string | null = null;\n for (const action of parsedGUIResponse.actions) {\n if (action.type === 'finished') {\n finished = true;\n finishMessage = action.inputs?.content ?? null;\n continue;\n }\n toolCalls.push({\n id: this.generateToolCallId(),\n type: 'function',\n function: {\n name: GUI_ADAPTED_TOOL_NAME,\n arguments: JSON.stringify({\n action: serializeAction(action),\n step: '',\n thought: parsedGUIResponse.reasoningContent ?? '',\n operator_action: action,\n }),\n },\n });\n }\n\n const content = finishMessage ?? '';\n const reasoningContent = parsedGUIResponse.reasoningContent ?? '';\n const contentForWebUI = content.replace(/\\\\n|\\n/g, '<br>');\n const reasoningContentForWebUI = reasoningContent.replace(/\\\\n|\\n/g, '<br>');\n\n // No tool calls found - return regular response\n return {\n content: contentForWebUI,\n rawContent: fullContent,\n reasoningContent: reasoningContentForWebUI,\n toolCalls,\n finishReason: toolCalls.length > 0 && !finished ? 'tool_calls' : 'stop',\n };\n }\n\n /**\n * Build assistant message for conversation history\n * For PE engines, we preserve the raw content including tool call markup\n *\n * FIXME: move to base tool call engine.\n */\n buildHistoricalAssistantMessage(\n currentLoopAssistantEvent: AgentEventStream.AssistantMessageEvent,\n ): ChatCompletionAssistantMessageParam {\n return {\n role: 'assistant',\n content: currentLoopAssistantEvent.rawContent || currentLoopAssistantEvent.content,\n };\n }\n\n /**\n * Build tool result messages as user messages\n * PE engines format tool results as user input for next iteration\n *\n * FIXME: move to base tool call engine.\n */\n buildHistoricalToolCallResultMessages(\n toolCallResults: MultimodalToolCallResult[],\n ): ChatCompletionMessageParam[] {\n return toolCallResults.map((result) => {\n // Extract text content from multimodal result\n const textContent = result.content\n .filter((part) => part.type === 'text')\n .map((part) => (part as { text: string }).text)\n .join('');\n\n return {\n role: 'user',\n content: `Tool \"${result.toolName}\" result:\\n${textContent}`,\n };\n });\n }\n}\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","defaultParser","DefaultActionParser","defaultLogger","ConsoleLogger","LogLevel","GUIAgentToolCallEngine","ToolCallEngine","instructions","tools","context","_context_messages_find","JSON","m","undefined","chunk","state","_chunk_choices_","_chunk_choices_1","_chunk_choices_2","delta","message","content","Date","Math","fullContent","console","parsedGUIResponse","actions","functionRegex","match","actionName","innerContent","args","paramRegex","paramMatch","value","coordsMatch","x","parseInt","y","thoughtRegex","thoughtMatch","thoughtContent","e","GUI_ADAPTED_TOOL_NAME","toolCalls","finished","finishMessage","action","_action_inputs","serializeAction","reasoningContent","contentForWebUI","reasoningContentForWebUI","currentLoopAssistantEvent","toolCallResults","result","textContent","part","customActionParser"],"mappings":";;;;;;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,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{
86
86
  const args = {};
87
87
  const paramRegex = /<parameter_[^=>]*=([a-zA-Z0-9_]+)>([\s\S]*?)<\/parameter_[^>]*>/g;
88
88
  let paramMatch;
89
- while(null !== (paramMatch = paramRegex.exec(innerContent)))args[paramMatch[1]] = paramMatch[2].trim();
89
+ while(null !== (paramMatch = paramRegex.exec(innerContent))){
90
+ const key = paramMatch[1];
91
+ let value = paramMatch[2].trim();
92
+ if ([
93
+ 'point',
94
+ 'start_point',
95
+ 'end_point',
96
+ 'start',
97
+ 'end'
98
+ ].includes(key) && 'string' == typeof value) {
99
+ value = value.replace(/^<[^>]+>([\s\S]*?)<\/[^>]+>$/, '$1').trim();
100
+ const coordsMatch = value.match(/(\d+)[, ]+(\d+)/);
101
+ if (coordsMatch) {
102
+ const x = parseInt(coordsMatch[1], 10);
103
+ const y = parseInt(coordsMatch[2], 10);
104
+ value = {
105
+ raw: {
106
+ x,
107
+ y
108
+ }
109
+ };
110
+ }
111
+ }
112
+ args[key] = value;
113
+ }
90
114
  actions.push({
91
115
  type: actionName,
92
116
  inputs: args,
@@ -1 +1 @@
1
- {"version":3,"file":"ToolCallEngine.mjs","sources":["webpack://@ui-tars-test/agent-sdk/./src/ToolCallEngine.ts"],"sourcesContent":["import {\n ToolCallEngine,\n Tool,\n ToolCallEnginePrepareRequestContext,\n ChatCompletionCreateParams,\n ChatCompletionAssistantMessageParam,\n ChatCompletionChunk,\n MultimodalToolCallResult,\n AgentEventStream,\n ChatCompletionMessageParam,\n ChatCompletionMessageToolCall,\n ParsedModelResponse,\n StreamProcessingState,\n StreamChunkResult,\n} from '@ui-tars-test/tarko-agent-interface';\nimport { DefaultActionParser } from '@ui-tars-test/action-parser';\nimport { GUI_ADAPTED_TOOL_NAME } from './constants';\nimport { ConsoleLogger, LogLevel } from '@agent-infra/logger';\nimport { serializeAction } from '@ui-tars-test/shared/utils';\nimport { CustomActionParser } from '@ui-tars-test/shared/types';\n\nconst defaultParser = new DefaultActionParser();\nconst defaultLogger = new ConsoleLogger('[GUIAgent:ToolCallEngine]', LogLevel.DEBUG);\n\n/**\n * GUIAgentToolCallEngine - Minimal prompt engineering tool call engine\n *\n * This is the simplest possible implementation of a tool call engine that:\n * 1. Uses prompt engineering to instruct the LLM to output tool calls in a specific format\n * 2. Parses tool calls from LLM response text using simple regex matching\n * 3. Does not support streaming (focuses on core functionality only)\n *\n * Format used: <tool_call>{\"name\": \"tool_name\", \"arguments\": {...}}</tool_call>\n */\nexport class GUIAgentToolCallEngine extends ToolCallEngine {\n private customActionParser?: CustomActionParser;\n\n constructor(customActionParser?: CustomActionParser) {\n super();\n this.customActionParser = customActionParser;\n }\n\n /**\n * Prepare system prompt with tool information and instructions\n */\n preparePrompt(instructions: string, tools: Tool[]): string {\n return instructions;\n }\n\n /**\n * Prepare request parameters for the LLM\n *\n * FIXME: move to base tool call engine.\n */\n prepareRequest(context: ToolCallEnginePrepareRequestContext): ChatCompletionCreateParams {\n defaultLogger.log(\n \"【New Sys Prompt'】 System Prompt:\",\n JSON.stringify(context.messages.find((m) => m.role === 'system')?.content || ''),\n );\n return {\n model: context.model,\n messages: context.messages,\n temperature: context.temperature || 0.7,\n stream: true,\n // When tools are undefined (disabled), tool_choice MUST also be undefined\n // Otherwise OpenAI/Azure will return 400 Bad Request\n tool_choice: undefined,\n tools: undefined,\n };\n }\n\n /**\n * Initialize processing state (minimal implementation)\n *\n * FIXME: move to base tool call engine.\n */\n initStreamProcessingState(): StreamProcessingState {\n return {\n contentBuffer: '',\n toolCalls: [],\n reasoningBuffer: '',\n finishReason: null,\n };\n }\n\n /**\n * Process streaming chunks - simply accumulate content\n *\n * FIXME: make it optional\n */\n processStreamingChunk(\n chunk: ChatCompletionChunk,\n state: StreamProcessingState,\n ): StreamChunkResult {\n // For non-streaming requests, the entire response comes in one chunk\n const delta = chunk.choices[0]?.delta;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const message = (chunk.choices[0] as any)?.message;\n\n // Accumulate content from delta (streaming) or message (non-streaming)\n const content = delta?.content || message?.content || '';\n if (content) {\n state.contentBuffer += content;\n }\n\n // Record finish reason\n if (chunk.choices[0]?.finish_reason) {\n state.finishReason = chunk.choices[0].finish_reason;\n }\n\n // Return incremental content without tool call detection during streaming\n return {\n content: content,\n reasoningContent: '',\n hasToolCallUpdate: false,\n toolCalls: [],\n };\n }\n\n /**\n * Generate a tool call ID\n */\n private generateToolCallId(): string {\n return `call_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;\n }\n\n /**\n * Extract tool calls from complete response text\n */\n finalizeStreamProcessing(state: StreamProcessingState): ParsedModelResponse {\n const fullContent = state.contentBuffer;\n console.log('[DEBUG] Full content length:', fullContent.length);\n console.log('[DEBUG] Full content prefix:', fullContent.slice(0, 100));\n console.log('[DEBUG] Full content suffix:', fullContent.slice(-100));\n defaultLogger.log(\"【New Sys Prompt'】 Model Response:\", fullContent);\n defaultLogger.log('[finalizeStreamProcessing] fullContent', fullContent);\n\n // Add explicit log to confirm XML parsing intent\n console.log('[CLI DEBUG] [ToolCallEngine] Full model response received:', fullContent);\n\n // Try custom action parser first if available\n let parsedGUIResponse = null;\n if (this.customActionParser) {\n parsedGUIResponse = this.customActionParser(fullContent);\n defaultLogger.log('[finalizeStreamProcessing] Using custom action parser');\n console.log('[CLI DEBUG] [ToolCallEngine] Using custom action parser');\n }\n\n // Priority: Custom Regex Parser > Default Parser\n // Check if the content contains the specific XML format with dynamic suffixes\n if (/<seed:tool_call_never_used_/.test(fullContent)) {\n console.log(\n '[CLI DEBUG] [ToolCallEngine] Detected custom XML format. Attempting custom regex parser.',\n );\n try {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const actions: any[] = [];\n // Regex to match <function_...=name>...</function...>\n // Handles dynamic suffixes like _never_used_...\n const functionRegex = /<function_[^=>]*=([a-zA-Z0-9_]+)>([\\s\\S]*?)<\\/function_[^>]*>/g;\n let match;\n\n while ((match = functionRegex.exec(fullContent)) !== null) {\n const actionName = match[1];\n const innerContent = match[2];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const args: any = {};\n\n // Regex to match <parameter_...=key>value</parameter...>\n const paramRegex = /<parameter_[^=>]*=([a-zA-Z0-9_]+)>([\\s\\S]*?)<\\/parameter_[^>]*>/g;\n let paramMatch;\n while ((paramMatch = paramRegex.exec(innerContent)) !== null) {\n args[paramMatch[1]] = paramMatch[2].trim();\n }\n\n actions.push({\n type: actionName,\n inputs: args,\n thought: '',\n });\n }\n\n // Also try to extract thought from <think_...>...</think_...>\n const thoughtRegex = /<think_[^>]*>([\\s\\S]*?)<\\/think_[^>]*>/g;\n const thoughtMatch = thoughtRegex.exec(fullContent);\n const thoughtContent = thoughtMatch ? thoughtMatch[1].trim() : '';\n\n if (actions.length > 0) {\n console.log(\n `[CLI DEBUG] [ToolCallEngine] Custom regex parser found ${actions.length} actions.`,\n );\n parsedGUIResponse = {\n errorMessage: '',\n rawContent: fullContent,\n actions: actions,\n reasoningContent: thoughtContent,\n };\n }\n } catch (e) {\n console.error('[CLI DEBUG] [ToolCallEngine] Custom regex parser error:', e);\n }\n }\n\n // Fall back to default parser if regex parser didn't produce results\n if (!parsedGUIResponse) {\n console.log('[CLI DEBUG] [ToolCallEngine] Using default action parser (XML parser)');\n parsedGUIResponse = defaultParser.parsePrediction(fullContent);\n defaultLogger.log('[finalizeStreamProcessing] Using default action parser');\n }\n\n if (parsedGUIResponse) {\n console.log(\n '[CLI DEBUG] [ToolCallEngine] Parsed response:',\n JSON.stringify(parsedGUIResponse, null, 2),\n );\n } else {\n console.log('[CLI DEBUG] [ToolCallEngine] Parsing failed or returned null');\n }\n\n if (!parsedGUIResponse || parsedGUIResponse.errorMessage) {\n return {\n content: '',\n rawContent: fullContent,\n toolCalls: [\n {\n id: this.generateToolCallId(),\n type: 'function',\n function: {\n name: GUI_ADAPTED_TOOL_NAME,\n arguments: JSON.stringify({\n action: '',\n step: '',\n thought: '',\n operator_action: null,\n errorMessage:\n parsedGUIResponse?.errorMessage ?? 'Failed to parse GUI Action from output',\n }),\n },\n },\n ],\n finishReason: 'tool_calls',\n };\n }\n\n const toolCalls: ChatCompletionMessageToolCall[] = [];\n\n let finished = false;\n let finishMessage: string | null = null;\n for (const action of parsedGUIResponse.actions) {\n if (action.type === 'finished') {\n finished = true;\n finishMessage = action.inputs?.content ?? null;\n continue;\n }\n toolCalls.push({\n id: this.generateToolCallId(),\n type: 'function',\n function: {\n name: GUI_ADAPTED_TOOL_NAME,\n arguments: JSON.stringify({\n action: serializeAction(action),\n step: '',\n thought: parsedGUIResponse.reasoningContent ?? '',\n operator_action: action,\n }),\n },\n });\n }\n\n const content = finishMessage ?? '';\n const reasoningContent = parsedGUIResponse.reasoningContent ?? '';\n const contentForWebUI = content.replace(/\\\\n|\\n/g, '<br>');\n const reasoningContentForWebUI = reasoningContent.replace(/\\\\n|\\n/g, '<br>');\n\n // No tool calls found - return regular response\n return {\n content: contentForWebUI,\n rawContent: fullContent,\n reasoningContent: reasoningContentForWebUI,\n toolCalls,\n finishReason: toolCalls.length > 0 && !finished ? 'tool_calls' : 'stop',\n };\n }\n\n /**\n * Build assistant message for conversation history\n * For PE engines, we preserve the raw content including tool call markup\n *\n * FIXME: move to base tool call engine.\n */\n buildHistoricalAssistantMessage(\n currentLoopAssistantEvent: AgentEventStream.AssistantMessageEvent,\n ): ChatCompletionAssistantMessageParam {\n return {\n role: 'assistant',\n content: currentLoopAssistantEvent.rawContent || currentLoopAssistantEvent.content,\n };\n }\n\n /**\n * Build tool result messages as user messages\n * PE engines format tool results as user input for next iteration\n *\n * FIXME: move to base tool call engine.\n */\n buildHistoricalToolCallResultMessages(\n toolCallResults: MultimodalToolCallResult[],\n ): ChatCompletionMessageParam[] {\n return toolCallResults.map((result) => {\n // Extract text content from multimodal result\n const textContent = result.content\n .filter((part) => part.type === 'text')\n .map((part) => (part as { text: string }).text)\n .join('');\n\n return {\n role: 'user',\n content: `Tool \"${result.toolName}\" result:\\n${textContent}`,\n };\n });\n }\n}\n"],"names":["defaultParser","DefaultActionParser","defaultLogger","ConsoleLogger","LogLevel","GUIAgentToolCallEngine","ToolCallEngine","instructions","tools","context","_context_messages_find","JSON","m","undefined","chunk","state","_chunk_choices_","_chunk_choices_1","_chunk_choices_2","delta","message","content","Date","Math","fullContent","console","parsedGUIResponse","actions","functionRegex","match","actionName","innerContent","args","paramRegex","paramMatch","thoughtRegex","thoughtMatch","thoughtContent","e","GUI_ADAPTED_TOOL_NAME","toolCalls","finished","finishMessage","action","_action_inputs","serializeAction","reasoningContent","contentForWebUI","reasoningContentForWebUI","currentLoopAssistantEvent","toolCallResults","result","textContent","part","customActionParser"],"mappings":";;;;;;;;;;;;;;;;;;;AAqBA,MAAMA,gBAAgB,IAAIC;AAC1B,MAAMC,gBAAgB,IAAIC,cAAc,6BAA6BC,SAAS,KAAK;AAY5E,MAAMC,+BAA+BC;IAW1C,cAAcC,YAAoB,EAAEC,KAAa,EAAU;QACzD,OAAOD;IACT;IAOA,eAAeE,OAA4C,EAA8B;YAGtEC;QAFjBR,cAAc,GAAG,CACf,8CACAS,KAAK,SAAS,CAACD,AAAAA,SAAAA,CAAAA,yBAAAA,QAAQ,QAAQ,CAAC,IAAI,CAAC,CAACE,IAAMA,AAAW,aAAXA,EAAE,IAAI,CAAa,IAAhDF,KAAAA,IAAAA,uBAAmD,OAAO,AAAD,KAAK;QAE/E,OAAO;YACL,OAAOD,QAAQ,KAAK;YACpB,UAAUA,QAAQ,QAAQ;YAC1B,aAAaA,QAAQ,WAAW,IAAI;YACpC,QAAQ;YAGR,aAAaI;YACb,OAAOA;QACT;IACF;IAOA,4BAAmD;QACjD,OAAO;YACL,eAAe;YACf,WAAW,EAAE;YACb,iBAAiB;YACjB,cAAc;QAChB;IACF;IAOA,sBACEC,KAA0B,EAC1BC,KAA4B,EACT;YAELC,iBAEGC,kBASbC;QAXJ,MAAMC,QAAQ,QAAAH,CAAAA,kBAAAA,MAAM,OAAO,CAAC,EAAE,AAAD,IAAfA,KAAAA,IAAAA,gBAAkB,KAAK;QAErC,M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YACL,MAAM;YACN,SAASA,0BAA0B,UAAU,IAAIA,0BAA0B,OAAO;QACpF;IACF;IAQA,sCACEC,eAA2C,EACb;QAC9B,OAAOA,gBAAgB,GAAG,CAAC,CAACC;YAE1B,MAAMC,cAAcD,OAAO,OAAO,CAC/B,MAAM,CAAC,CAACE,OAASA,AAAc,WAAdA,KAAK,IAAI,EAC1B,GAAG,CAAC,CAACA,OAAUA,KAA0B,IAAI,EAC7C,IAAI,CAAC;YAER,OAAO;gBACL,MAAM;gBACN,SAAS,CAAC,MAAM,EAAEF,OAAO,QAAQ,CAAC,WAAW,EAAEC,aAAa;YAC9D;QACF;IACF;IA3RA,YAAYE,kBAAuC,CAAE;QACnD,KAAK,IAHP,uBAAQ,sBAAR;QAIE,IAAI,CAAC,kBAAkB,GAAGA;IAC5B;AAyRF"}
1
+ {"version":3,"file":"ToolCallEngine.mjs","sources":["webpack://@ui-tars-test/agent-sdk/./src/ToolCallEngine.ts"],"sourcesContent":["import {\n ToolCallEngine,\n Tool,\n ToolCallEnginePrepareRequestContext,\n ChatCompletionCreateParams,\n ChatCompletionAssistantMessageParam,\n ChatCompletionChunk,\n MultimodalToolCallResult,\n AgentEventStream,\n ChatCompletionMessageParam,\n ChatCompletionMessageToolCall,\n ParsedModelResponse,\n StreamProcessingState,\n StreamChunkResult,\n} from '@ui-tars-test/tarko-agent-interface';\nimport { DefaultActionParser } from '@ui-tars-test/action-parser';\nimport { GUI_ADAPTED_TOOL_NAME } from './constants';\nimport { ConsoleLogger, LogLevel } from '@agent-infra/logger';\nimport { serializeAction } from '@ui-tars-test/shared/utils';\nimport { CustomActionParser } from '@ui-tars-test/shared/types';\n\nconst defaultParser = new DefaultActionParser();\nconst defaultLogger = new ConsoleLogger('[GUIAgent:ToolCallEngine]', LogLevel.DEBUG);\n\n/**\n * GUIAgentToolCallEngine - Minimal prompt engineering tool call engine\n *\n * This is the simplest possible implementation of a tool call engine that:\n * 1. Uses prompt engineering to instruct the LLM to output tool calls in a specific format\n * 2. Parses tool calls from LLM response text using simple regex matching\n * 3. Does not support streaming (focuses on core functionality only)\n *\n * Format used: <tool_call>{\"name\": \"tool_name\", \"arguments\": {...}}</tool_call>\n */\nexport class GUIAgentToolCallEngine extends ToolCallEngine {\n private customActionParser?: CustomActionParser;\n\n constructor(customActionParser?: CustomActionParser) {\n super();\n this.customActionParser = customActionParser;\n }\n\n /**\n * Prepare system prompt with tool information and instructions\n */\n preparePrompt(instructions: string, tools: Tool[]): string {\n return instructions;\n }\n\n /**\n * Prepare request parameters for the LLM\n *\n * FIXME: move to base tool call engine.\n */\n prepareRequest(context: ToolCallEnginePrepareRequestContext): ChatCompletionCreateParams {\n defaultLogger.log(\n \"【New Sys Prompt'】 System Prompt:\",\n JSON.stringify(context.messages.find((m) => m.role === 'system')?.content || ''),\n );\n return {\n model: context.model,\n messages: context.messages,\n temperature: context.temperature || 0.7,\n stream: true,\n // When tools are undefined (disabled), tool_choice MUST also be undefined\n // Otherwise OpenAI/Azure will return 400 Bad Request\n tool_choice: undefined,\n tools: undefined,\n };\n }\n\n /**\n * Initialize processing state (minimal implementation)\n *\n * FIXME: move to base tool call engine.\n */\n initStreamProcessingState(): StreamProcessingState {\n return {\n contentBuffer: '',\n toolCalls: [],\n reasoningBuffer: '',\n finishReason: null,\n };\n }\n\n /**\n * Process streaming chunks - simply accumulate content\n *\n * FIXME: make it optional\n */\n processStreamingChunk(\n chunk: ChatCompletionChunk,\n state: StreamProcessingState,\n ): StreamChunkResult {\n // For non-streaming requests, the entire response comes in one chunk\n const delta = chunk.choices[0]?.delta;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const message = (chunk.choices[0] as any)?.message;\n\n // Accumulate content from delta (streaming) or message (non-streaming)\n const content = delta?.content || message?.content || '';\n if (content) {\n state.contentBuffer += content;\n }\n\n // Record finish reason\n if (chunk.choices[0]?.finish_reason) {\n state.finishReason = chunk.choices[0].finish_reason;\n }\n\n // Return incremental content without tool call detection during streaming\n return {\n content: content,\n reasoningContent: '',\n hasToolCallUpdate: false,\n toolCalls: [],\n };\n }\n\n /**\n * Generate a tool call ID\n */\n private generateToolCallId(): string {\n return `call_${Date.now()}_${Math.random().toString(36).substring(2, 11)}`;\n }\n\n /**\n * Extract tool calls from complete response text\n */\n finalizeStreamProcessing(state: StreamProcessingState): ParsedModelResponse {\n const fullContent = state.contentBuffer;\n console.log('[DEBUG] Full content length:', fullContent.length);\n console.log('[DEBUG] Full content prefix:', fullContent.slice(0, 100));\n console.log('[DEBUG] Full content suffix:', fullContent.slice(-100));\n defaultLogger.log(\"【New Sys Prompt'】 Model Response:\", fullContent);\n defaultLogger.log('[finalizeStreamProcessing] fullContent', fullContent);\n\n // Add explicit log to confirm XML parsing intent\n console.log('[CLI DEBUG] [ToolCallEngine] Full model response received:', fullContent);\n\n // Try custom action parser first if available\n let parsedGUIResponse = null;\n if (this.customActionParser) {\n parsedGUIResponse = this.customActionParser(fullContent);\n defaultLogger.log('[finalizeStreamProcessing] Using custom action parser');\n console.log('[CLI DEBUG] [ToolCallEngine] Using custom action parser');\n }\n\n // Priority: Custom Regex Parser > Default Parser\n // Check if the content contains the specific XML format with dynamic suffixes\n if (/<seed:tool_call_never_used_/.test(fullContent)) {\n console.log(\n '[CLI DEBUG] [ToolCallEngine] Detected custom XML format. Attempting custom regex parser.',\n );\n try {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const actions: any[] = [];\n // Regex to match <function_...=name>...</function...>\n // Handles dynamic suffixes like _never_used_...\n const functionRegex = /<function_[^=>]*=([a-zA-Z0-9_]+)>([\\s\\S]*?)<\\/function_[^>]*>/g;\n let match;\n\n while ((match = functionRegex.exec(fullContent)) !== null) {\n const actionName = match[1];\n const innerContent = match[2];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const args: any = {};\n\n // Regex to match <parameter_...=key>value</parameter...>\n const paramRegex = /<parameter_[^=>]*=([a-zA-Z0-9_]+)>([\\s\\S]*?)<\\/parameter_[^>]*>/g;\n let paramMatch;\n while ((paramMatch = paramRegex.exec(innerContent)) !== null) {\n const key = paramMatch[1];\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let value: any = paramMatch[2].trim();\n\n // Special handling for coordinate parameters (point, start_point, end_point)\n // Convert string \"x y\" to { raw: { x, y } } object structure expected by Operators\n if (\n ['point', 'start_point', 'end_point', 'start', 'end'].includes(key) &&\n typeof value === 'string'\n ) {\n // Remove potential wrapping tags like <point>...</point>\n value = value.replace(/^<[^>]+>([\\s\\S]*?)<\\/[^>]+>$/, '$1').trim();\n\n // Match coordinates pattern: digits followed by comma or space followed by digits\n // Supports: \"100 200\", \"100, 200\", \"(100, 200)\"\n const coordsMatch = value.match(/(\\d+)[, ]+(\\d+)/);\n if (coordsMatch) {\n const x = parseInt(coordsMatch[1], 10);\n const y = parseInt(coordsMatch[2], 10);\n value = { raw: { x, y } };\n }\n }\n\n args[key] = value;\n }\n\n actions.push({\n type: actionName,\n inputs: args,\n thought: '',\n });\n }\n\n // Also try to extract thought from <think_...>...</think_...>\n const thoughtRegex = /<think_[^>]*>([\\s\\S]*?)<\\/think_[^>]*>/g;\n const thoughtMatch = thoughtRegex.exec(fullContent);\n const thoughtContent = thoughtMatch ? thoughtMatch[1].trim() : '';\n\n if (actions.length > 0) {\n console.log(\n `[CLI DEBUG] [ToolCallEngine] Custom regex parser found ${actions.length} actions.`,\n );\n parsedGUIResponse = {\n errorMessage: '',\n rawContent: fullContent,\n actions: actions,\n reasoningContent: thoughtContent,\n };\n }\n } catch (e) {\n console.error('[CLI DEBUG] [ToolCallEngine] Custom regex parser error:', e);\n }\n }\n\n // Fall back to default parser if regex parser didn't produce results\n if (!parsedGUIResponse) {\n console.log('[CLI DEBUG] [ToolCallEngine] Using default action parser (XML parser)');\n parsedGUIResponse = defaultParser.parsePrediction(fullContent);\n defaultLogger.log('[finalizeStreamProcessing] Using default action parser');\n }\n\n if (parsedGUIResponse) {\n console.log(\n '[CLI DEBUG] [ToolCallEngine] Parsed response:',\n JSON.stringify(parsedGUIResponse, null, 2),\n );\n } else {\n console.log('[CLI DEBUG] [ToolCallEngine] Parsing failed or returned null');\n }\n\n if (!parsedGUIResponse || parsedGUIResponse.errorMessage) {\n return {\n content: '',\n rawContent: fullContent,\n toolCalls: [\n {\n id: this.generateToolCallId(),\n type: 'function',\n function: {\n name: GUI_ADAPTED_TOOL_NAME,\n arguments: JSON.stringify({\n action: '',\n step: '',\n thought: '',\n operator_action: null,\n errorMessage:\n parsedGUIResponse?.errorMessage ?? 'Failed to parse GUI Action from output',\n }),\n },\n },\n ],\n finishReason: 'tool_calls',\n };\n }\n\n const toolCalls: ChatCompletionMessageToolCall[] = [];\n\n let finished = false;\n let finishMessage: string | null = null;\n for (const action of parsedGUIResponse.actions) {\n if (action.type === 'finished') {\n finished = true;\n finishMessage = action.inputs?.content ?? null;\n continue;\n }\n toolCalls.push({\n id: this.generateToolCallId(),\n type: 'function',\n function: {\n name: GUI_ADAPTED_TOOL_NAME,\n arguments: JSON.stringify({\n action: serializeAction(action),\n step: '',\n thought: parsedGUIResponse.reasoningContent ?? '',\n operator_action: action,\n }),\n },\n });\n }\n\n const content = finishMessage ?? '';\n const reasoningContent = parsedGUIResponse.reasoningContent ?? '';\n const contentForWebUI = content.replace(/\\\\n|\\n/g, '<br>');\n const reasoningContentForWebUI = reasoningContent.replace(/\\\\n|\\n/g, '<br>');\n\n // No tool calls found - return regular response\n return {\n content: contentForWebUI,\n rawContent: fullContent,\n reasoningContent: reasoningContentForWebUI,\n toolCalls,\n finishReason: toolCalls.length > 0 && !finished ? 'tool_calls' : 'stop',\n };\n }\n\n /**\n * Build assistant message for conversation history\n * For PE engines, we preserve the raw content including tool call markup\n *\n * FIXME: move to base tool call engine.\n */\n buildHistoricalAssistantMessage(\n currentLoopAssistantEvent: AgentEventStream.AssistantMessageEvent,\n ): ChatCompletionAssistantMessageParam {\n return {\n role: 'assistant',\n content: currentLoopAssistantEvent.rawContent || currentLoopAssistantEvent.content,\n };\n }\n\n /**\n * Build tool result messages as user messages\n * PE engines format tool results as user input for next iteration\n *\n * FIXME: move to base tool call engine.\n */\n buildHistoricalToolCallResultMessages(\n toolCallResults: MultimodalToolCallResult[],\n ): ChatCompletionMessageParam[] {\n return toolCallResults.map((result) => {\n // Extract text content from multimodal result\n const textContent = result.content\n .filter((part) => part.type === 'text')\n .map((part) => (part as { text: string }).text)\n .join('');\n\n return {\n role: 'user',\n content: `Tool \"${result.toolName}\" result:\\n${textContent}`,\n };\n });\n }\n}\n"],"names":["defaultParser","DefaultActionParser","defaultLogger","ConsoleLogger","LogLevel","GUIAgentToolCallEngine","ToolCallEngine","instructions","tools","context","_context_messages_find","JSON","m","undefined","chunk","state","_chunk_choices_","_chunk_choices_1","_chunk_choices_2","delta","message","content","Date","Math","fullContent","console","parsedGUIResponse","actions","functionRegex","match","actionName","innerContent","args","paramRegex","paramMatch","key","value","coordsMatch","x","parseInt","y","thoughtRegex","thoughtMatch","thoughtContent","e","GUI_ADAPTED_TOOL_NAME","toolCalls","finished","finishMessage","action","_action_inputs","serializeAction","reasoningContent","contentForWebUI","reasoningContentForWebUI","currentLoopAssistantEvent","toolCallResults","result","textContent","part","customActionParser"],"mappings":";;;;;;;;;;;;;;;;;;;AAqBA,MAAMA,gBAAgB,IAAIC;AAC1B,MAAMC,gBAAgB,IAAIC,cAAc,6BAA6BC,SAAS,KAAK;AAY5E,MAAMC,+BAA+BC;IAW1C,cAAcC,YAAoB,EAAEC,KAAa,EAAU;QACzD,OAAOD;IACT;IAOA,eAAeE,OAA4C,EAA8B;YAGtEC;QAFjBR,cAAc,GAAG,CACf,8CACAS,KAAK,SAAS,CAACD,AAAAA,SAAAA,CAAAA,yBAAAA,QAAQ,QAAQ,CAAC,IAAI,CAAC,CAACE,IAAMA,AAAW,aAAXA,EAAE,IAAI,CAAa,IAAhDF,KAAAA,IAAAA,uBAAmD,OAAO,AAAD,KAAK;QAE/E,OAAO;YACL,OAAOD,QAAQ,KAAK;YACpB,UAAUA,QAAQ,QAAQ;YAC1B,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CAAE;QACnD,KAAK,IAHP,uBAAQ,sBAAR;QAIE,IAAI,CAAC,kBAAkB,GAAGA;IAC5B;AAgTF"}
@@ -1 +1 @@
1
- {"version":3,"file":"defaultImpls.d.ts","sourceRoot":"","sources":["../src/defaultImpls.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AAEpC;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,EAAE,oBAYpC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,qBAgBrC,CAAC"}
1
+ {"version":3,"file":"defaultImpls.d.ts","sourceRoot":"","sources":["../src/defaultImpls.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,4BAA4B,CAAC;AAEpC;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,EAAE,oBAapC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,qBAgBrC,CAAC"}
@@ -35,11 +35,12 @@ const defaultNormalizeCoords = (rawCoords)=>{
35
35
  if (!rawCoords.raw) return {
36
36
  normalized: rawCoords
37
37
  };
38
+ const clamp01 = (value)=>Math.min(1, Math.max(0, value));
38
39
  const normalizedCoords = {
39
40
  ...rawCoords,
40
41
  normalized: {
41
- x: rawCoords.raw.x / 1000,
42
- y: rawCoords.raw.y / 1000
42
+ x: clamp01(rawCoords.raw.x / 1000),
43
+ y: clamp01(rawCoords.raw.y / 1000)
43
44
  }
44
45
  };
45
46
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"defaultImpls.js","sources":["webpack://@ui-tars-test/agent-sdk/webpack/runtime/define_property_getters","webpack://@ui-tars-test/agent-sdk/webpack/runtime/has_own_property","webpack://@ui-tars-test/agent-sdk/webpack/runtime/make_namespace_object","webpack://@ui-tars-test/agent-sdk/./src/defaultImpls.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/*\n * Copyright (c) 2025 Bytedance, Inc. and its affiliates.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n Coordinates,\n ImageDetailCalculator,\n NormalizeCoordinates,\n} from '@ui-tars-test/shared/types';\n\n/**\n * Default coordinate normalization function\n * Normalizes raw coordinates by dividing by 1000 (simple scaling)\n * @param rawCoords - The raw coordinates to normalize\n * @returns Object containing normalized coordinates\n */\nexport const defaultNormalizeCoords: NormalizeCoordinates = (rawCoords: Coordinates) => {\n if (!rawCoords.raw) {\n return { normalized: rawCoords };\n }\n const normalizedCoords = {\n ...rawCoords,\n normalized: {\n x: rawCoords.raw.x / 1000,\n y: rawCoords.raw.y / 1000,\n },\n };\n return { normalized: normalizedCoords };\n};\n\n/**\n * Default implementation for detail calculation based on pixel count\n * detail:low mode: 1,048,576 px (1024×1024)\n * detail:high mode: 4,014,080 px (2048×1960)\n */\nexport const defaultDetailCalculator: ImageDetailCalculator = (\n width: number,\n height: number,\n): 'low' | 'high' | 'auto' => {\n const LOW_DETAIL_THRESHOLD = 1024 * 1024; // 1,048,576 px\n const HIGH_DETAIL_THRESHOLD = 2048 * 1960; // 4,014,080 px\n\n const pixelCount = width * height;\n if (pixelCount <= LOW_DETAIL_THRESHOLD) {\n return 'low';\n } else if (pixelCount <= HIGH_DETAIL_THRESHOLD) {\n return 'high';\n } else {\n // For images larger than high detail threshold, use high detail\n return 'auto';\n }\n};\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","defaultNormalizeCoords","rawCoords","normalizedCoords","defaultDetailCalculator","width","height","LOW_DETAIL_THRESHOLD","HIGH_DETAIL_THRESHOLD","pixelCount"],"mappings":";;;;;;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,eAAlB,OAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D;;;;;;;;ACUO,MAAMI,yBAA+C,CAACC;IAC3D,IAAI,CAACA,UAAU,GAAG,EAChB,OAAO;QAAE,YAAYA;IAAU;IAEjC,MAAMC,mBAAmB;QACvB,GAAGD,SAAS;QACZ,YAAY;YACV,GAAGA,UAAU,GAAG,CAAC,CAAC,GAAG;YACrB,GAAGA,UAAU,GAAG,CAAC,CAAC,GAAG;QACvB;IACF;IACA,OAAO;QAAE,YAAYC;IAAiB;AACxC;AAOO,MAAMC,0BAAiD,CAC5DC,OACAC;IAEA,MAAMC,uBAAuB;IAC7B,MAAMC,wBAAwB;IAE9B,MAAMC,aAAaJ,QAAQC;IAC3B,IAAIG,cAAcF,sBAChB,OAAO;IACF,IAAIE,cAAcD,uBACvB,OAAO;IAGP,OAAO;AAEX"}
1
+ {"version":3,"file":"defaultImpls.js","sources":["webpack://@ui-tars-test/agent-sdk/webpack/runtime/define_property_getters","webpack://@ui-tars-test/agent-sdk/webpack/runtime/has_own_property","webpack://@ui-tars-test/agent-sdk/webpack/runtime/make_namespace_object","webpack://@ui-tars-test/agent-sdk/./src/defaultImpls.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/*\n * Copyright (c) 2025 Bytedance, Inc. and its affiliates.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n Coordinates,\n ImageDetailCalculator,\n NormalizeCoordinates,\n} from '@ui-tars-test/shared/types';\n\n/**\n * Default coordinate normalization function\n * Normalizes raw coordinates by dividing by 1000 (simple scaling)\n * @param rawCoords - The raw coordinates to normalize\n * @returns Object containing normalized coordinates\n */\nexport const defaultNormalizeCoords: NormalizeCoordinates = (rawCoords: Coordinates) => {\n if (!rawCoords.raw) {\n return { normalized: rawCoords };\n }\n const clamp01 = (value: number): number => Math.min(1, Math.max(0, value));\n const normalizedCoords = {\n ...rawCoords,\n normalized: {\n x: clamp01(rawCoords.raw.x / 1000),\n y: clamp01(rawCoords.raw.y / 1000),\n },\n };\n return { normalized: normalizedCoords };\n};\n\n/**\n * Default implementation for detail calculation based on pixel count\n * detail:low mode: 1,048,576 px (1024×1024)\n * detail:high mode: 4,014,080 px (2048×1960)\n */\nexport const defaultDetailCalculator: ImageDetailCalculator = (\n width: number,\n height: number,\n): 'low' | 'high' | 'auto' => {\n const LOW_DETAIL_THRESHOLD = 1024 * 1024; // 1,048,576 px\n const HIGH_DETAIL_THRESHOLD = 2048 * 1960; // 4,014,080 px\n\n const pixelCount = width * height;\n if (pixelCount <= LOW_DETAIL_THRESHOLD) {\n return 'low';\n } else if (pixelCount <= HIGH_DETAIL_THRESHOLD) {\n return 'high';\n } else {\n // For images larger than high detail threshold, use high detail\n return 'auto';\n }\n};\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","defaultNormalizeCoords","rawCoords","clamp01","value","Math","normalizedCoords","defaultDetailCalculator","width","height","LOW_DETAIL_THRESHOLD","HIGH_DETAIL_THRESHOLD","pixelCount"],"mappings":";;;;;;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,eAAlB,OAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D;;;;;;;;ACUO,MAAMI,yBAA+C,CAACC;IAC3D,IAAI,CAACA,UAAU,GAAG,EAChB,OAAO;QAAE,YAAYA;IAAU;IAEjC,MAAMC,UAAU,CAACC,QAA0BC,KAAK,GAAG,CAAC,GAAGA,KAAK,GAAG,CAAC,GAAGD;IACnE,MAAME,mBAAmB;QACvB,GAAGJ,SAAS;QACZ,YAAY;YACV,GAAGC,QAAQD,UAAU,GAAG,CAAC,CAAC,GAAG;YAC7B,GAAGC,QAAQD,UAAU,GAAG,CAAC,CAAC,GAAG;QAC/B;IACF;IACA,OAAO;QAAE,YAAYI;IAAiB;AACxC;AAOO,MAAMC,0BAAiD,CAC5DC,OACAC;IAEA,MAAMC,uBAAuB;IAC7B,MAAMC,wBAAwB;IAE9B,MAAMC,aAAaJ,QAAQC;IAC3B,IAAIG,cAAcF,sBAChB,OAAO;IACF,IAAIE,cAAcD,uBACvB,OAAO;IAGP,OAAO;AAEX"}
@@ -6,11 +6,12 @@ const defaultNormalizeCoords = (rawCoords)=>{
6
6
  if (!rawCoords.raw) return {
7
7
  normalized: rawCoords
8
8
  };
9
+ const clamp01 = (value)=>Math.min(1, Math.max(0, value));
9
10
  const normalizedCoords = {
10
11
  ...rawCoords,
11
12
  normalized: {
12
- x: rawCoords.raw.x / 1000,
13
- y: rawCoords.raw.y / 1000
13
+ x: clamp01(rawCoords.raw.x / 1000),
14
+ y: clamp01(rawCoords.raw.y / 1000)
14
15
  }
15
16
  };
16
17
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"defaultImpls.mjs","sources":["webpack://@ui-tars-test/agent-sdk/./src/defaultImpls.ts"],"sourcesContent":["/*\n * Copyright (c) 2025 Bytedance, Inc. and its affiliates.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n Coordinates,\n ImageDetailCalculator,\n NormalizeCoordinates,\n} from '@ui-tars-test/shared/types';\n\n/**\n * Default coordinate normalization function\n * Normalizes raw coordinates by dividing by 1000 (simple scaling)\n * @param rawCoords - The raw coordinates to normalize\n * @returns Object containing normalized coordinates\n */\nexport const defaultNormalizeCoords: NormalizeCoordinates = (rawCoords: Coordinates) => {\n if (!rawCoords.raw) {\n return { normalized: rawCoords };\n }\n const normalizedCoords = {\n ...rawCoords,\n normalized: {\n x: rawCoords.raw.x / 1000,\n y: rawCoords.raw.y / 1000,\n },\n };\n return { normalized: normalizedCoords };\n};\n\n/**\n * Default implementation for detail calculation based on pixel count\n * detail:low mode: 1,048,576 px (1024×1024)\n * detail:high mode: 4,014,080 px (2048×1960)\n */\nexport const defaultDetailCalculator: ImageDetailCalculator = (\n width: number,\n height: number,\n): 'low' | 'high' | 'auto' => {\n const LOW_DETAIL_THRESHOLD = 1024 * 1024; // 1,048,576 px\n const HIGH_DETAIL_THRESHOLD = 2048 * 1960; // 4,014,080 px\n\n const pixelCount = width * height;\n if (pixelCount <= LOW_DETAIL_THRESHOLD) {\n return 'low';\n } else if (pixelCount <= HIGH_DETAIL_THRESHOLD) {\n return 'high';\n } else {\n // For images larger than high detail threshold, use high detail\n return 'auto';\n }\n};\n"],"names":["defaultNormalizeCoords","rawCoords","normalizedCoords","defaultDetailCalculator","width","height","LOW_DETAIL_THRESHOLD","HIGH_DETAIL_THRESHOLD","pixelCount"],"mappings":";;;;AAgBO,MAAMA,yBAA+C,CAACC;IAC3D,IAAI,CAACA,UAAU,GAAG,EAChB,OAAO;QAAE,YAAYA;IAAU;IAEjC,MAAMC,mBAAmB;QACvB,GAAGD,SAAS;QACZ,YAAY;YACV,GAAGA,UAAU,GAAG,CAAC,CAAC,GAAG;YACrB,GAAGA,UAAU,GAAG,CAAC,CAAC,GAAG;QACvB;IACF;IACA,OAAO;QAAE,YAAYC;IAAiB;AACxC;AAOO,MAAMC,0BAAiD,CAC5DC,OACAC;IAEA,MAAMC,uBAAuB;IAC7B,MAAMC,wBAAwB;IAE9B,MAAMC,aAAaJ,QAAQC;IAC3B,IAAIG,cAAcF,sBAChB,OAAO;IACF,IAAIE,cAAcD,uBACvB,OAAO;IAGP,OAAO;AAEX"}
1
+ {"version":3,"file":"defaultImpls.mjs","sources":["webpack://@ui-tars-test/agent-sdk/./src/defaultImpls.ts"],"sourcesContent":["/*\n * Copyright (c) 2025 Bytedance, Inc. and its affiliates.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport {\n Coordinates,\n ImageDetailCalculator,\n NormalizeCoordinates,\n} from '@ui-tars-test/shared/types';\n\n/**\n * Default coordinate normalization function\n * Normalizes raw coordinates by dividing by 1000 (simple scaling)\n * @param rawCoords - The raw coordinates to normalize\n * @returns Object containing normalized coordinates\n */\nexport const defaultNormalizeCoords: NormalizeCoordinates = (rawCoords: Coordinates) => {\n if (!rawCoords.raw) {\n return { normalized: rawCoords };\n }\n const clamp01 = (value: number): number => Math.min(1, Math.max(0, value));\n const normalizedCoords = {\n ...rawCoords,\n normalized: {\n x: clamp01(rawCoords.raw.x / 1000),\n y: clamp01(rawCoords.raw.y / 1000),\n },\n };\n return { normalized: normalizedCoords };\n};\n\n/**\n * Default implementation for detail calculation based on pixel count\n * detail:low mode: 1,048,576 px (1024×1024)\n * detail:high mode: 4,014,080 px (2048×1960)\n */\nexport const defaultDetailCalculator: ImageDetailCalculator = (\n width: number,\n height: number,\n): 'low' | 'high' | 'auto' => {\n const LOW_DETAIL_THRESHOLD = 1024 * 1024; // 1,048,576 px\n const HIGH_DETAIL_THRESHOLD = 2048 * 1960; // 4,014,080 px\n\n const pixelCount = width * height;\n if (pixelCount <= LOW_DETAIL_THRESHOLD) {\n return 'low';\n } else if (pixelCount <= HIGH_DETAIL_THRESHOLD) {\n return 'high';\n } else {\n // For images larger than high detail threshold, use high detail\n return 'auto';\n }\n};\n"],"names":["defaultNormalizeCoords","rawCoords","clamp01","value","Math","normalizedCoords","defaultDetailCalculator","width","height","LOW_DETAIL_THRESHOLD","HIGH_DETAIL_THRESHOLD","pixelCount"],"mappings":";;;;AAgBO,MAAMA,yBAA+C,CAACC;IAC3D,IAAI,CAACA,UAAU,GAAG,EAChB,OAAO;QAAE,YAAYA;IAAU;IAEjC,MAAMC,UAAU,CAACC,QAA0BC,KAAK,GAAG,CAAC,GAAGA,KAAK,GAAG,CAAC,GAAGD;IACnE,MAAME,mBAAmB;QACvB,GAAGJ,SAAS;QACZ,YAAY;YACV,GAAGC,QAAQD,UAAU,GAAG,CAAC,CAAC,GAAG;YAC7B,GAAGC,QAAQD,UAAU,GAAG,CAAC,CAAC,GAAG;QAC/B;IACF;IACA,OAAO;QAAE,YAAYI;IAAiB;AACxC;AAOO,MAAMC,0BAAiD,CAC5DC,OACAC;IAEA,MAAMC,uBAAuB;IAC7B,MAAMC,wBAAwB;IAE9B,MAAMC,aAAaJ,QAAQC;IAC3B,IAAIG,cAAcF,sBAChB,OAAO;IACF,IAAIE,cAAcD,uBACvB,OAAO;IAGP,OAAO;AAEX"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ui-tars-test/agent-sdk",
3
- "version": "0.3.14",
3
+ "version": "0.3.15",
4
4
  "description": "GUI Agent",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",