@midscene/shared 1.9.8-beta-20260618091332.0 → 1.10.0

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.
Files changed (75) hide show
  1. package/dist/es/{mcp → agent-tools}/base-tools.mjs +1 -8
  2. package/dist/es/{mcp → agent-tools}/chrome-path.mjs +14 -3
  3. package/dist/es/{mcp → agent-tools}/index.mjs +0 -3
  4. package/dist/es/{mcp → agent-tools}/tool-generator.mjs +3 -3
  5. package/dist/es/cli/cli-runner.mjs +1 -1
  6. package/dist/es/env/parse-model-config.mjs +1 -1
  7. package/dist/es/env/types.mjs +3 -5
  8. package/dist/es/utils.mjs +2 -6
  9. package/dist/lib/{mcp → agent-tools}/base-tools.js +1 -8
  10. package/dist/lib/{mcp → agent-tools}/chrome-path.js +13 -2
  11. package/dist/lib/{mcp → agent-tools}/index.js +16 -37
  12. package/dist/lib/{mcp → agent-tools}/tool-generator.js +3 -3
  13. package/dist/lib/cli/cli-runner.js +1 -1
  14. package/dist/lib/env/parse-model-config.js +1 -1
  15. package/dist/lib/env/types.js +5 -10
  16. package/dist/lib/utils.js +8 -15
  17. package/dist/types/{mcp → agent-tools}/base-tools.d.ts +7 -13
  18. package/dist/types/{mcp → agent-tools}/index.d.ts +0 -3
  19. package/dist/types/{mcp → agent-tools}/init-arg-utils.d.ts +3 -3
  20. package/dist/types/{mcp → agent-tools}/tool-defaults.d.ts +5 -6
  21. package/dist/types/{mcp → agent-tools}/tool-generator.d.ts +1 -1
  22. package/dist/types/{mcp → agent-tools}/types.d.ts +4 -9
  23. package/dist/types/cli/cli-args.d.ts +1 -1
  24. package/dist/types/cli/cli-runner.d.ts +2 -2
  25. package/dist/types/env/types.d.ts +8 -6
  26. package/dist/types/key-alias-utils.d.ts +2 -2
  27. package/dist/types/utils.d.ts +0 -1
  28. package/package.json +16 -9
  29. package/src/{mcp → agent-tools}/base-tools.ts +8 -33
  30. package/src/{mcp → agent-tools}/chrome-path.ts +20 -3
  31. package/src/{mcp → agent-tools}/index.ts +0 -3
  32. package/src/{mcp → agent-tools}/init-arg-utils.ts +3 -3
  33. package/src/{mcp → agent-tools}/tool-defaults.ts +5 -6
  34. package/src/{mcp → agent-tools}/tool-generator.ts +6 -6
  35. package/src/{mcp → agent-tools}/types.ts +4 -9
  36. package/src/cli/cli-args.ts +1 -1
  37. package/src/cli/cli-runner.ts +4 -4
  38. package/src/env/types.ts +5 -5
  39. package/src/key-alias-utils.ts +2 -2
  40. package/src/utils.ts +1 -10
  41. package/dist/es/mcp/base-server.mjs +0 -295
  42. package/dist/es/mcp/inject-report-html-plugin.mjs +0 -53
  43. package/dist/es/mcp/launcher-helper.mjs +0 -52
  44. package/dist/lib/mcp/base-server.js +0 -345
  45. package/dist/lib/mcp/inject-report-html-plugin.js +0 -98
  46. package/dist/lib/mcp/launcher-helper.js +0 -86
  47. package/dist/types/mcp/base-server.d.ts +0 -106
  48. package/dist/types/mcp/inject-report-html-plugin.d.ts +0 -18
  49. package/dist/types/mcp/launcher-helper.d.ts +0 -94
  50. package/src/mcp/base-server.ts +0 -529
  51. package/src/mcp/inject-report-html-plugin.ts +0 -119
  52. package/src/mcp/launcher-helper.ts +0 -200
  53. /package/dist/es/{mcp → agent-tools}/agent-behavior-init-args.mjs +0 -0
  54. /package/dist/es/{mcp → agent-tools}/cli-report-session.mjs +0 -0
  55. /package/dist/es/{mcp → agent-tools}/error-formatter.mjs +0 -0
  56. /package/dist/es/{mcp → agent-tools}/init-arg-utils.mjs +0 -0
  57. /package/dist/es/{mcp → agent-tools}/tool-defaults.mjs +0 -0
  58. /package/dist/es/{mcp → agent-tools}/types.mjs +0 -0
  59. /package/dist/es/{mcp → agent-tools}/user-prompt.mjs +0 -0
  60. /package/dist/lib/{mcp → agent-tools}/agent-behavior-init-args.js +0 -0
  61. /package/dist/lib/{mcp → agent-tools}/cli-report-session.js +0 -0
  62. /package/dist/lib/{mcp → agent-tools}/error-formatter.js +0 -0
  63. /package/dist/lib/{mcp → agent-tools}/init-arg-utils.js +0 -0
  64. /package/dist/lib/{mcp → agent-tools}/tool-defaults.js +0 -0
  65. /package/dist/lib/{mcp → agent-tools}/types.js +0 -0
  66. /package/dist/lib/{mcp → agent-tools}/user-prompt.js +0 -0
  67. /package/dist/types/{mcp → agent-tools}/agent-behavior-init-args.d.ts +0 -0
  68. /package/dist/types/{mcp → agent-tools}/chrome-path.d.ts +0 -0
  69. /package/dist/types/{mcp → agent-tools}/cli-report-session.d.ts +0 -0
  70. /package/dist/types/{mcp → agent-tools}/error-formatter.d.ts +0 -0
  71. /package/dist/types/{mcp → agent-tools}/user-prompt.d.ts +0 -0
  72. /package/src/{mcp → agent-tools}/agent-behavior-init-args.ts +0 -0
  73. /package/src/{mcp → agent-tools}/cli-report-session.ts +0 -0
  74. /package/src/{mcp → agent-tools}/error-formatter.ts +0 -0
  75. /package/src/{mcp → agent-tools}/user-prompt.ts +0 -0
@@ -15,7 +15,7 @@ function _define_property(obj, key, value) {
15
15
  else obj[key] = value;
16
16
  return obj;
17
17
  }
18
- const debug = getDebug('mcp:base-tools');
18
+ const debug = getDebug('agent-tools:base-tools');
19
19
  class BaseMidsceneTools {
20
20
  getInitArgKeys() {
21
21
  return this.initArgSpec ? Object.keys(this.initArgSpec.shape) : [];
@@ -104,12 +104,6 @@ class BaseMidsceneTools {
104
104
  this.toolDefinitions.push(...actionTools, ...commonTools);
105
105
  debug('Total tools prepared:', this.toolDefinitions.length);
106
106
  }
107
- attachToServer(server) {
108
- this.mcpServer = server;
109
- if (0 === this.toolDefinitions.length) debug('Warning: No tools to register. Tools may be initialized lazily.');
110
- for (const toolDef of this.toolDefinitions)this.mcpServer.tool(toolDef.name, toolDef.description, toolDef.schema, toolDef.handler);
111
- debug('Registered', this.toolDefinitions.length, 'tools');
112
- }
113
107
  async destroy() {
114
108
  await this.agent?.destroy?.();
115
109
  }
@@ -155,7 +149,6 @@ class BaseMidsceneTools {
155
149
  };
156
150
  }
157
151
  constructor(){
158
- _define_property(this, "mcpServer", void 0);
159
152
  _define_property(this, "agent", void 0);
160
153
  _define_property(this, "toolDefinitions", []);
161
154
  _define_property(this, "toolDefaults", {});
@@ -1,5 +1,10 @@
1
1
  import { existsSync } from "node:fs";
2
- import { MIDSCENE_MCP_CHROME_PATH, globalConfigManager } from "../env/index.mjs";
2
+ import { MIDSCENE_CHROME_PATH, MIDSCENE_MCP_CHROME_PATH, globalConfigManager } from "../env/index.mjs";
3
+ import { getDebug } from "../logger.mjs";
4
+ const warnChromePath = getDebug('agent-tools:chrome-path', {
5
+ console: true
6
+ });
7
+ let hasWarnedLegacyChromePath = false;
3
8
  function getSystemChromePath() {
4
9
  const platform = process.platform;
5
10
  const chromePaths = {
@@ -26,10 +31,16 @@ function getSystemChromePath() {
26
31
  return paths.find((p)=>existsSync(p));
27
32
  }
28
33
  function resolveChromePath() {
29
- const envPath = globalConfigManager.getEnvConfigValue(MIDSCENE_MCP_CHROME_PATH);
34
+ const primaryEnvPath = globalConfigManager.getEnvConfigValue(MIDSCENE_CHROME_PATH);
35
+ const legacyEnvPath = globalConfigManager.getEnvConfigValue(MIDSCENE_MCP_CHROME_PATH);
36
+ const envPath = primaryEnvPath || legacyEnvPath;
37
+ if (!primaryEnvPath && legacyEnvPath && !hasWarnedLegacyChromePath) {
38
+ warnChromePath('MIDSCENE_MCP_CHROME_PATH is deprecated. Use MIDSCENE_CHROME_PATH instead.');
39
+ hasWarnedLegacyChromePath = true;
40
+ }
30
41
  if (envPath && 'auto' !== envPath && existsSync(envPath)) return envPath;
31
42
  const systemPath = getSystemChromePath();
32
43
  if (systemPath) return systemPath;
33
- throw new Error('Chrome not found. Install Google Chrome or set MIDSCENE_MCP_CHROME_PATH environment variable.');
44
+ throw new Error('Chrome not found. Install Google Chrome or set MIDSCENE_CHROME_PATH environment variable.');
34
45
  }
35
46
  export { getSystemChromePath, resolveChromePath };
@@ -1,4 +1,3 @@
1
- export * from "./base-server.mjs";
2
1
  export * from "./base-tools.mjs";
3
2
  export * from "./tool-defaults.mjs";
4
3
  export * from "./agent-behavior-init-args.mjs";
@@ -6,6 +5,4 @@ export * from "./init-arg-utils.mjs";
6
5
  export * from "./error-formatter.mjs";
7
6
  export * from "./tool-generator.mjs";
8
7
  export * from "./types.mjs";
9
- export * from "./inject-report-html-plugin.mjs";
10
- export * from "./launcher-helper.mjs";
11
8
  export * from "./chrome-path.mjs";
@@ -3,7 +3,7 @@ import { z } from "zod";
3
3
  import { getZodDescription, getZodTypeName, isMidsceneLocatorField, unwrapZodField } from "../zod-schema-utils.mjs";
4
4
  import { getErrorMessage } from "./error-formatter.mjs";
5
5
  import { composeUserPrompt, promptInputExtraSchema } from "./user-prompt.mjs";
6
- function describeActionForMCP(action) {
6
+ function describeActionForTool(action) {
7
7
  const actionDesc = action.description || `Execute ${action.name} action`;
8
8
  if (!action.paramSchema) return `${action.name} action, ${actionDesc}`;
9
9
  const shape = getZodObjectShape(action.paramSchema);
@@ -75,7 +75,7 @@ function extractActionSchema(paramSchema, actionName) {
75
75
  const shape = getZodObjectShape(paramSchema);
76
76
  if (!shape) {
77
77
  const typeName = paramSchema?._def?.typeName ?? 'unknown';
78
- throw new Error(`Action "${actionName}" declared a non-object paramSchema (${typeName}). CLI and MCP tool schemas must be a ZodObject (e.g. z.object({ uri: z.string() })) or undefined. Wrap primitive fields in an object schema.`);
78
+ throw new Error(`Action "${actionName}" declared a non-object paramSchema (${typeName}). CLI tool schemas must be a ZodObject (e.g. z.object({ uri: z.string() })) or undefined. Wrap primitive fields in an object schema.`);
79
79
  }
80
80
  return Object.fromEntries(Object.entries(shape).map(([key, value])=>transformSchemaField(key, value)));
81
81
  }
@@ -327,7 +327,7 @@ function generateToolsFromActionSpace(actionSpace, getAgent, sanitizeArgs = (arg
327
327
  };
328
328
  return {
329
329
  name: action.name,
330
- description: describeActionForMCP(action),
330
+ description: describeActionForTool(action),
331
331
  schema,
332
332
  cli: initArgCliMetadata,
333
333
  handler: async (args)=>{
@@ -2,8 +2,8 @@ import { existsSync, writeFileSync } from "node:fs";
2
2
  import { tmpdir } from "node:os";
3
3
  import { join } from "node:path";
4
4
  import dotenv from "dotenv";
5
+ import { stripBehaviorFlags } from "../agent-tools/tool-defaults.mjs";
5
6
  import { getDebug } from "../logger.mjs";
6
- import { stripBehaviorFlags } from "../mcp/tool-defaults.mjs";
7
7
  import { canonicalizeCliArgKeys, formatCliValidationError, getCliOptionDisplay, parseCliArgs, parseValue } from "./cli-args.mjs";
8
8
  import { CLIError, reportCLIError } from "./cli-error.mjs";
9
9
  const debug = getDebug('cli-runner');
@@ -5,7 +5,7 @@ import { assert } from "../utils.mjs";
5
5
  import { maskConfig, parseJson } from "./helper.mjs";
6
6
  import { initDebugConfig } from "./init-debug.mjs";
7
7
  const MODEL_CONFIG_DOC_URL = 'https://midscenejs.com/model-common-config.html';
8
- const getCurrentVersion = ()=>"1.9.8-beta-20260618091332.0";
8
+ const getCurrentVersion = ()=>"1.10.0";
9
9
  const getInvalidModelFamilyMessage = (modelFamily)=>`Invalid MIDSCENE_MODEL_FAMILY value: ${modelFamily}. Current version v${getCurrentVersion()} accepts the following model families: ${MODEL_FAMILY_VALUES.join(', ')}. You can also visit ${MODEL_CONFIG_DOC_URL} for the latest configuration information.`;
10
10
  const KEYS_MAP = {
11
11
  insight: INSIGHT_MODEL_CONFIG_KEYS,
@@ -5,9 +5,8 @@ const MIDSCENE_DEBUG_MODEL_PROFILE = 'MIDSCENE_DEBUG_MODEL_PROFILE';
5
5
  const MIDSCENE_DEBUG_MODEL_RESPONSE = 'MIDSCENE_DEBUG_MODEL_RESPONSE';
6
6
  const MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG = 'MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG';
7
7
  const MIDSCENE_DEBUG_MODE = 'MIDSCENE_DEBUG_MODE';
8
- const MIDSCENE_MCP_USE_PUPPETEER_MODE = 'MIDSCENE_MCP_USE_PUPPETEER_MODE';
8
+ const MIDSCENE_CHROME_PATH = 'MIDSCENE_CHROME_PATH';
9
9
  const MIDSCENE_MCP_CHROME_PATH = 'MIDSCENE_MCP_CHROME_PATH';
10
- const MIDSCENE_MCP_ANDROID_MODE = 'MIDSCENE_MCP_ANDROID_MODE';
11
10
  const DOCKER_CONTAINER = 'DOCKER_CONTAINER';
12
11
  const MIDSCENE_LANGSMITH_DEBUG = 'MIDSCENE_LANGSMITH_DEBUG';
13
12
  const MIDSCENE_LANGFUSE_DEBUG = 'MIDSCENE_LANGFUSE_DEBUG';
@@ -90,8 +89,6 @@ const BASIC_ENV_KEYS = [
90
89
  ];
91
90
  const BOOLEAN_ENV_KEYS = [
92
91
  MIDSCENE_CACHE,
93
- MIDSCENE_MCP_USE_PUPPETEER_MODE,
94
- MIDSCENE_MCP_ANDROID_MODE,
95
92
  MIDSCENE_LANGSMITH_DEBUG,
96
93
  MIDSCENE_LANGFUSE_DEBUG,
97
94
  MIDSCENE_REPORT_QUIET
@@ -110,6 +107,7 @@ const STRING_ENV_KEYS = [
110
107
  MIDSCENE_REPORT_TAG_NAME,
111
108
  MIDSCENE_PREFERRED_LANGUAGE,
112
109
  MATCH_BY_POSITION,
110
+ MIDSCENE_CHROME_PATH,
113
111
  MIDSCENE_MCP_CHROME_PATH,
114
112
  DOCKER_CONTAINER
115
113
  ];
@@ -208,4 +206,4 @@ var types_UITarsModelVersion = /*#__PURE__*/ function(UITarsModelVersion) {
208
206
  UITarsModelVersion["DOUBAO_1_5_20B"] = "doubao-1.5-20B";
209
207
  return UITarsModelVersion;
210
208
  }({});
211
- export { ALL_ENV_KEYS, BASIC_ENV_KEYS, BOOLEAN_ENV_KEYS, DOCKER_CONTAINER, GLOBAL_ENV_KEYS, MATCH_BY_POSITION, MIDSCENE_ADB_PATH, MIDSCENE_ADB_REMOTE_HOST, MIDSCENE_ADB_REMOTE_PORT, MIDSCENE_ANDROID_IME_STRATEGY, MIDSCENE_CACHE, MIDSCENE_CACHE_MAX_FILENAME_LENGTH, MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG, MIDSCENE_DEBUG_MODE, MIDSCENE_DEBUG_MODEL_PROFILE, MIDSCENE_DEBUG_MODEL_RESPONSE, MIDSCENE_INSIGHT_MODEL_API_KEY, MIDSCENE_INSIGHT_MODEL_BASE_URL, MIDSCENE_INSIGHT_MODEL_EXTRA_BODY_JSON, MIDSCENE_INSIGHT_MODEL_FAMILY, MIDSCENE_INSIGHT_MODEL_HTTP_PROXY, MIDSCENE_INSIGHT_MODEL_INIT_CONFIG_JSON, MIDSCENE_INSIGHT_MODEL_NAME, MIDSCENE_INSIGHT_MODEL_REASONING_BUDGET, MIDSCENE_INSIGHT_MODEL_REASONING_EFFORT, MIDSCENE_INSIGHT_MODEL_REASONING_ENABLED, MIDSCENE_INSIGHT_MODEL_RETRY_COUNT, MIDSCENE_INSIGHT_MODEL_RETRY_INTERVAL, MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY, MIDSCENE_INSIGHT_MODEL_TEMPERATURE, MIDSCENE_INSIGHT_MODEL_TIMEOUT, MIDSCENE_IOS_DEVICE_CLASS_OVERRIDE, MIDSCENE_IOS_DEVICE_UDID, MIDSCENE_IOS_SIMULATOR_UDID, MIDSCENE_LANGFUSE_DEBUG, MIDSCENE_LANGSMITH_DEBUG, MIDSCENE_MCP_ANDROID_MODE, MIDSCENE_MCP_CHROME_PATH, MIDSCENE_MCP_USE_PUPPETEER_MODE, MIDSCENE_MODEL_API_KEY, MIDSCENE_MODEL_BASE_URL, MIDSCENE_MODEL_EXTRA_BODY_JSON, MIDSCENE_MODEL_FAMILY, MIDSCENE_MODEL_HTTP_PROXY, MIDSCENE_MODEL_INIT_CONFIG_JSON, MIDSCENE_MODEL_NAME, MIDSCENE_MODEL_REASONING_BUDGET, MIDSCENE_MODEL_REASONING_EFFORT, MIDSCENE_MODEL_REASONING_ENABLED, MIDSCENE_MODEL_RETRY_COUNT, MIDSCENE_MODEL_RETRY_INTERVAL, MIDSCENE_MODEL_SOCKS_PROXY, MIDSCENE_MODEL_TEMPERATURE, MIDSCENE_MODEL_TIMEOUT, MIDSCENE_OPENAI_HTTP_PROXY, MIDSCENE_OPENAI_INIT_CONFIG_JSON, MIDSCENE_OPENAI_SOCKS_PROXY, MIDSCENE_PLANNING_MODEL_API_KEY, MIDSCENE_PLANNING_MODEL_BASE_URL, MIDSCENE_PLANNING_MODEL_EXTRA_BODY_JSON, MIDSCENE_PLANNING_MODEL_FAMILY, MIDSCENE_PLANNING_MODEL_HTTP_PROXY, MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON, MIDSCENE_PLANNING_MODEL_NAME, MIDSCENE_PLANNING_MODEL_REASONING_BUDGET, MIDSCENE_PLANNING_MODEL_REASONING_EFFORT, MIDSCENE_PLANNING_MODEL_REASONING_ENABLED, MIDSCENE_PLANNING_MODEL_RETRY_COUNT, MIDSCENE_PLANNING_MODEL_RETRY_INTERVAL, MIDSCENE_PLANNING_MODEL_SOCKS_PROXY, MIDSCENE_PLANNING_MODEL_TEMPERATURE, MIDSCENE_PLANNING_MODEL_TIMEOUT, MIDSCENE_PREFERRED_LANGUAGE, MIDSCENE_REPLANNING_CYCLE_LIMIT, MIDSCENE_REPORT_QUIET, MIDSCENE_REPORT_TAG_NAME, MIDSCENE_RUN_DIR, MIDSCENE_USE_DOUBAO_VISION, MIDSCENE_USE_GEMINI, MIDSCENE_USE_QWEN3_VL, MIDSCENE_USE_QWEN_VL, MIDSCENE_USE_VLM_UI_TARS, MIDSCENE_USE_VL_MODEL, MODEL_ENV_KEYS, MODEL_FAMILY_VALUES, NUMBER_ENV_KEYS, OPENAI_API_KEY, OPENAI_BASE_URL, STRING_ENV_KEYS, types_UITarsModelVersion as UITarsModelVersion, UNUSED_ENV_KEYS };
209
+ export { ALL_ENV_KEYS, BASIC_ENV_KEYS, BOOLEAN_ENV_KEYS, DOCKER_CONTAINER, GLOBAL_ENV_KEYS, MATCH_BY_POSITION, MIDSCENE_ADB_PATH, MIDSCENE_ADB_REMOTE_HOST, MIDSCENE_ADB_REMOTE_PORT, MIDSCENE_ANDROID_IME_STRATEGY, MIDSCENE_CACHE, MIDSCENE_CACHE_MAX_FILENAME_LENGTH, MIDSCENE_CHROME_PATH, MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG, MIDSCENE_DEBUG_MODE, MIDSCENE_DEBUG_MODEL_PROFILE, MIDSCENE_DEBUG_MODEL_RESPONSE, MIDSCENE_INSIGHT_MODEL_API_KEY, MIDSCENE_INSIGHT_MODEL_BASE_URL, MIDSCENE_INSIGHT_MODEL_EXTRA_BODY_JSON, MIDSCENE_INSIGHT_MODEL_FAMILY, MIDSCENE_INSIGHT_MODEL_HTTP_PROXY, MIDSCENE_INSIGHT_MODEL_INIT_CONFIG_JSON, MIDSCENE_INSIGHT_MODEL_NAME, MIDSCENE_INSIGHT_MODEL_REASONING_BUDGET, MIDSCENE_INSIGHT_MODEL_REASONING_EFFORT, MIDSCENE_INSIGHT_MODEL_REASONING_ENABLED, MIDSCENE_INSIGHT_MODEL_RETRY_COUNT, MIDSCENE_INSIGHT_MODEL_RETRY_INTERVAL, MIDSCENE_INSIGHT_MODEL_SOCKS_PROXY, MIDSCENE_INSIGHT_MODEL_TEMPERATURE, MIDSCENE_INSIGHT_MODEL_TIMEOUT, MIDSCENE_IOS_DEVICE_CLASS_OVERRIDE, MIDSCENE_IOS_DEVICE_UDID, MIDSCENE_IOS_SIMULATOR_UDID, MIDSCENE_LANGFUSE_DEBUG, MIDSCENE_LANGSMITH_DEBUG, MIDSCENE_MCP_CHROME_PATH, MIDSCENE_MODEL_API_KEY, MIDSCENE_MODEL_BASE_URL, MIDSCENE_MODEL_EXTRA_BODY_JSON, MIDSCENE_MODEL_FAMILY, MIDSCENE_MODEL_HTTP_PROXY, MIDSCENE_MODEL_INIT_CONFIG_JSON, MIDSCENE_MODEL_NAME, MIDSCENE_MODEL_REASONING_BUDGET, MIDSCENE_MODEL_REASONING_EFFORT, MIDSCENE_MODEL_REASONING_ENABLED, MIDSCENE_MODEL_RETRY_COUNT, MIDSCENE_MODEL_RETRY_INTERVAL, MIDSCENE_MODEL_SOCKS_PROXY, MIDSCENE_MODEL_TEMPERATURE, MIDSCENE_MODEL_TIMEOUT, MIDSCENE_OPENAI_HTTP_PROXY, MIDSCENE_OPENAI_INIT_CONFIG_JSON, MIDSCENE_OPENAI_SOCKS_PROXY, MIDSCENE_PLANNING_MODEL_API_KEY, MIDSCENE_PLANNING_MODEL_BASE_URL, MIDSCENE_PLANNING_MODEL_EXTRA_BODY_JSON, MIDSCENE_PLANNING_MODEL_FAMILY, MIDSCENE_PLANNING_MODEL_HTTP_PROXY, MIDSCENE_PLANNING_MODEL_INIT_CONFIG_JSON, MIDSCENE_PLANNING_MODEL_NAME, MIDSCENE_PLANNING_MODEL_REASONING_BUDGET, MIDSCENE_PLANNING_MODEL_REASONING_EFFORT, MIDSCENE_PLANNING_MODEL_REASONING_ENABLED, MIDSCENE_PLANNING_MODEL_RETRY_COUNT, MIDSCENE_PLANNING_MODEL_RETRY_INTERVAL, MIDSCENE_PLANNING_MODEL_SOCKS_PROXY, MIDSCENE_PLANNING_MODEL_TEMPERATURE, MIDSCENE_PLANNING_MODEL_TIMEOUT, MIDSCENE_PREFERRED_LANGUAGE, MIDSCENE_REPLANNING_CYCLE_LIMIT, MIDSCENE_REPORT_QUIET, MIDSCENE_REPORT_TAG_NAME, MIDSCENE_RUN_DIR, MIDSCENE_USE_DOUBAO_VISION, MIDSCENE_USE_GEMINI, MIDSCENE_USE_QWEN3_VL, MIDSCENE_USE_QWEN_VL, MIDSCENE_USE_VLM_UI_TARS, MIDSCENE_USE_VL_MODEL, MODEL_ENV_KEYS, MODEL_FAMILY_VALUES, NUMBER_ENV_KEYS, OPENAI_API_KEY, OPENAI_BASE_URL, STRING_ENV_KEYS, types_UITarsModelVersion as UITarsModelVersion, UNUSED_ENV_KEYS };
package/dist/es/utils.mjs CHANGED
@@ -34,12 +34,8 @@ function generateHashId(rect, content = '') {
34
34
  function assert(condition, message) {
35
35
  if (!condition) throw new Error(message || 'Assertion failed');
36
36
  }
37
- let isMcp = false;
38
- function setIsMcp(value) {
39
- isMcp = value;
40
- }
41
37
  function logMsg(...message) {
42
- if (!isMcp) console.log(...message);
38
+ console.log(...message);
43
39
  }
44
40
  async function repeat(times, fn) {
45
41
  for(let i = 0; i < times; i++)await fn(i);
@@ -69,4 +65,4 @@ function mergeAndNormalizeAppNameMapping(defaultMapping, userMapping) {
69
65
  if (userMapping) for (const [key, value] of Object.entries(userMapping))result[normalizeForComparison(key)] = value;
70
66
  return result;
71
67
  }
72
- export { antiEscapeScriptTag, assert, escapeScriptTag, generateHashId, ifInBrowser, ifInNode, ifInWorker, isPlainObject, logMsg, mergeAndNormalizeAppNameMapping, normalizeForComparison, repeat, replaceIllegalPathCharsAndSpace, setIsMcp, uuid };
68
+ export { antiEscapeScriptTag, assert, escapeScriptTag, generateHashId, ifInBrowser, ifInNode, ifInWorker, isPlainObject, logMsg, mergeAndNormalizeAppNameMapping, normalizeForComparison, repeat, replaceIllegalPathCharsAndSpace, uuid };
@@ -43,7 +43,7 @@ function _define_property(obj, key, value) {
43
43
  else obj[key] = value;
44
44
  return obj;
45
45
  }
46
- const debug = (0, logger_namespaceObject.getDebug)('mcp:base-tools');
46
+ const debug = (0, logger_namespaceObject.getDebug)('agent-tools:base-tools');
47
47
  class BaseMidsceneTools {
48
48
  getInitArgKeys() {
49
49
  return this.initArgSpec ? Object.keys(this.initArgSpec.shape) : [];
@@ -132,12 +132,6 @@ class BaseMidsceneTools {
132
132
  this.toolDefinitions.push(...actionTools, ...commonTools);
133
133
  debug('Total tools prepared:', this.toolDefinitions.length);
134
134
  }
135
- attachToServer(server) {
136
- this.mcpServer = server;
137
- if (0 === this.toolDefinitions.length) debug('Warning: No tools to register. Tools may be initialized lazily.');
138
- for (const toolDef of this.toolDefinitions)this.mcpServer.tool(toolDef.name, toolDef.description, toolDef.schema, toolDef.handler);
139
- debug('Registered', this.toolDefinitions.length, 'tools');
140
- }
141
135
  async destroy() {
142
136
  await this.agent?.destroy?.();
143
137
  }
@@ -183,7 +177,6 @@ class BaseMidsceneTools {
183
177
  };
184
178
  }
185
179
  constructor(){
186
- _define_property(this, "mcpServer", void 0);
187
180
  _define_property(this, "agent", void 0);
188
181
  _define_property(this, "toolDefinitions", []);
189
182
  _define_property(this, "toolDefaults", {});
@@ -29,6 +29,11 @@ __webpack_require__.d(__webpack_exports__, {
29
29
  });
30
30
  const external_node_fs_namespaceObject = require("node:fs");
31
31
  const index_js_namespaceObject = require("../env/index.js");
32
+ const external_logger_js_namespaceObject = require("../logger.js");
33
+ const warnChromePath = (0, external_logger_js_namespaceObject.getDebug)('agent-tools:chrome-path', {
34
+ console: true
35
+ });
36
+ let hasWarnedLegacyChromePath = false;
32
37
  function getSystemChromePath() {
33
38
  const platform = process.platform;
34
39
  const chromePaths = {
@@ -55,11 +60,17 @@ function getSystemChromePath() {
55
60
  return paths.find((p)=>(0, external_node_fs_namespaceObject.existsSync)(p));
56
61
  }
57
62
  function resolveChromePath() {
58
- const envPath = index_js_namespaceObject.globalConfigManager.getEnvConfigValue(index_js_namespaceObject.MIDSCENE_MCP_CHROME_PATH);
63
+ const primaryEnvPath = index_js_namespaceObject.globalConfigManager.getEnvConfigValue(index_js_namespaceObject.MIDSCENE_CHROME_PATH);
64
+ const legacyEnvPath = index_js_namespaceObject.globalConfigManager.getEnvConfigValue(index_js_namespaceObject.MIDSCENE_MCP_CHROME_PATH);
65
+ const envPath = primaryEnvPath || legacyEnvPath;
66
+ if (!primaryEnvPath && legacyEnvPath && !hasWarnedLegacyChromePath) {
67
+ warnChromePath('MIDSCENE_MCP_CHROME_PATH is deprecated. Use MIDSCENE_CHROME_PATH instead.');
68
+ hasWarnedLegacyChromePath = true;
69
+ }
59
70
  if (envPath && 'auto' !== envPath && (0, external_node_fs_namespaceObject.existsSync)(envPath)) return envPath;
60
71
  const systemPath = getSystemChromePath();
61
72
  if (systemPath) return systemPath;
62
- throw new Error('Chrome not found. Install Google Chrome or set MIDSCENE_MCP_CHROME_PATH environment variable.');
73
+ throw new Error('Chrome not found. Install Google Chrome or set MIDSCENE_CHROME_PATH environment variable.');
63
74
  }
64
75
  exports.getSystemChromePath = __webpack_exports__.getSystemChromePath;
65
76
  exports.resolveChromePath = __webpack_exports__.resolveChromePath;
@@ -3,9 +3,6 @@ var __webpack_modules__ = {
3
3
  "./agent-behavior-init-args" (module) {
4
4
  module.exports = require("./agent-behavior-init-args.js");
5
5
  },
6
- "./base-server" (module) {
7
- module.exports = require("./base-server.js");
8
- },
9
6
  "./base-tools" (module) {
10
7
  module.exports = require("./base-tools.js");
11
8
  },
@@ -18,12 +15,6 @@ var __webpack_modules__ = {
18
15
  "./init-arg-utils" (module) {
19
16
  module.exports = require("./init-arg-utils.js");
20
17
  },
21
- "./inject-report-html-plugin" (module) {
22
- module.exports = require("./inject-report-html-plugin.js");
23
- },
24
- "./launcher-helper" (module) {
25
- module.exports = require("./launcher-helper.js");
26
- },
27
18
  "./tool-defaults" (module) {
28
19
  module.exports = require("./tool-defaults.js");
29
20
  },
@@ -77,49 +68,37 @@ function __webpack_require__(moduleId) {
77
68
  var __webpack_exports__ = {};
78
69
  (()=>{
79
70
  __webpack_require__.r(__webpack_exports__);
80
- var _base_server__rspack_import_0 = __webpack_require__("./base-server");
81
- var __rspack_reexport = {};
82
- for(const __rspack_import_key in _base_server__rspack_import_0)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_base_server__rspack_import_0[__rspack_import_key];
83
- __webpack_require__.d(__webpack_exports__, __rspack_reexport);
84
- var _base_tools__rspack_import_1 = __webpack_require__("./base-tools");
85
- var __rspack_reexport = {};
86
- for(const __rspack_import_key in _base_tools__rspack_import_1)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_base_tools__rspack_import_1[__rspack_import_key];
87
- __webpack_require__.d(__webpack_exports__, __rspack_reexport);
88
- var _tool_defaults__rspack_import_2 = __webpack_require__("./tool-defaults");
89
- var __rspack_reexport = {};
90
- for(const __rspack_import_key in _tool_defaults__rspack_import_2)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_tool_defaults__rspack_import_2[__rspack_import_key];
91
- __webpack_require__.d(__webpack_exports__, __rspack_reexport);
92
- var _agent_behavior_init_args__rspack_import_3 = __webpack_require__("./agent-behavior-init-args");
71
+ var _base_tools__rspack_import_0 = __webpack_require__("./base-tools");
93
72
  var __rspack_reexport = {};
94
- for(const __rspack_import_key in _agent_behavior_init_args__rspack_import_3)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_agent_behavior_init_args__rspack_import_3[__rspack_import_key];
73
+ for(const __rspack_import_key in _base_tools__rspack_import_0)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_base_tools__rspack_import_0[__rspack_import_key];
95
74
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
96
- var _init_arg_utils__rspack_import_4 = __webpack_require__("./init-arg-utils");
75
+ var _tool_defaults__rspack_import_1 = __webpack_require__("./tool-defaults");
97
76
  var __rspack_reexport = {};
98
- for(const __rspack_import_key in _init_arg_utils__rspack_import_4)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_init_arg_utils__rspack_import_4[__rspack_import_key];
77
+ for(const __rspack_import_key in _tool_defaults__rspack_import_1)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_tool_defaults__rspack_import_1[__rspack_import_key];
99
78
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
100
- var _error_formatter__rspack_import_5 = __webpack_require__("./error-formatter");
79
+ var _agent_behavior_init_args__rspack_import_2 = __webpack_require__("./agent-behavior-init-args");
101
80
  var __rspack_reexport = {};
102
- for(const __rspack_import_key in _error_formatter__rspack_import_5)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_error_formatter__rspack_import_5[__rspack_import_key];
81
+ for(const __rspack_import_key in _agent_behavior_init_args__rspack_import_2)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_agent_behavior_init_args__rspack_import_2[__rspack_import_key];
103
82
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
104
- var _tool_generator__rspack_import_6 = __webpack_require__("./tool-generator");
83
+ var _init_arg_utils__rspack_import_3 = __webpack_require__("./init-arg-utils");
105
84
  var __rspack_reexport = {};
106
- for(const __rspack_import_key in _tool_generator__rspack_import_6)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_tool_generator__rspack_import_6[__rspack_import_key];
85
+ for(const __rspack_import_key in _init_arg_utils__rspack_import_3)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_init_arg_utils__rspack_import_3[__rspack_import_key];
107
86
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
108
- var _types__rspack_import_7 = __webpack_require__("./types");
87
+ var _error_formatter__rspack_import_4 = __webpack_require__("./error-formatter");
109
88
  var __rspack_reexport = {};
110
- for(const __rspack_import_key in _types__rspack_import_7)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_types__rspack_import_7[__rspack_import_key];
89
+ for(const __rspack_import_key in _error_formatter__rspack_import_4)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_error_formatter__rspack_import_4[__rspack_import_key];
111
90
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
112
- var _inject_report_html_plugin__rspack_import_8 = __webpack_require__("./inject-report-html-plugin");
91
+ var _tool_generator__rspack_import_5 = __webpack_require__("./tool-generator");
113
92
  var __rspack_reexport = {};
114
- for(const __rspack_import_key in _inject_report_html_plugin__rspack_import_8)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_inject_report_html_plugin__rspack_import_8[__rspack_import_key];
93
+ for(const __rspack_import_key in _tool_generator__rspack_import_5)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_tool_generator__rspack_import_5[__rspack_import_key];
115
94
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
116
- var _launcher_helper__rspack_import_9 = __webpack_require__("./launcher-helper");
95
+ var _types__rspack_import_6 = __webpack_require__("./types");
117
96
  var __rspack_reexport = {};
118
- for(const __rspack_import_key in _launcher_helper__rspack_import_9)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_launcher_helper__rspack_import_9[__rspack_import_key];
97
+ for(const __rspack_import_key in _types__rspack_import_6)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_types__rspack_import_6[__rspack_import_key];
119
98
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
120
- var _chrome_path__rspack_import_10 = __webpack_require__("./chrome-path");
99
+ var _chrome_path__rspack_import_7 = __webpack_require__("./chrome-path");
121
100
  var __rspack_reexport = {};
122
- for(const __rspack_import_key in _chrome_path__rspack_import_10)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_chrome_path__rspack_import_10[__rspack_import_key];
101
+ for(const __rspack_import_key in _chrome_path__rspack_import_7)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_chrome_path__rspack_import_7[__rspack_import_key];
123
102
  __webpack_require__.d(__webpack_exports__, __rspack_reexport);
124
103
  })();
125
104
  for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
@@ -33,7 +33,7 @@ const external_zod_namespaceObject = require("zod");
33
33
  const external_zod_schema_utils_js_namespaceObject = require("../zod-schema-utils.js");
34
34
  const external_error_formatter_js_namespaceObject = require("./error-formatter.js");
35
35
  const external_user_prompt_js_namespaceObject = require("./user-prompt.js");
36
- function describeActionForMCP(action) {
36
+ function describeActionForTool(action) {
37
37
  const actionDesc = action.description || `Execute ${action.name} action`;
38
38
  if (!action.paramSchema) return `${action.name} action, ${actionDesc}`;
39
39
  const shape = getZodObjectShape(action.paramSchema);
@@ -105,7 +105,7 @@ function extractActionSchema(paramSchema, actionName) {
105
105
  const shape = getZodObjectShape(paramSchema);
106
106
  if (!shape) {
107
107
  const typeName = paramSchema?._def?.typeName ?? 'unknown';
108
- throw new Error(`Action "${actionName}" declared a non-object paramSchema (${typeName}). CLI and MCP tool schemas must be a ZodObject (e.g. z.object({ uri: z.string() })) or undefined. Wrap primitive fields in an object schema.`);
108
+ throw new Error(`Action "${actionName}" declared a non-object paramSchema (${typeName}). CLI tool schemas must be a ZodObject (e.g. z.object({ uri: z.string() })) or undefined. Wrap primitive fields in an object schema.`);
109
109
  }
110
110
  return Object.fromEntries(Object.entries(shape).map(([key, value])=>transformSchemaField(key, value)));
111
111
  }
@@ -357,7 +357,7 @@ function generateToolsFromActionSpace(actionSpace, getAgent, sanitizeArgs = (arg
357
357
  };
358
358
  return {
359
359
  name: action.name,
360
- description: describeActionForMCP(action),
360
+ description: describeActionForTool(action),
361
361
  schema,
362
362
  cli: initArgCliMetadata,
363
363
  handler: async (args)=>{
@@ -45,8 +45,8 @@ const external_node_os_namespaceObject = require("node:os");
45
45
  const external_node_path_namespaceObject = require("node:path");
46
46
  const external_dotenv_namespaceObject = require("dotenv");
47
47
  var external_dotenv_default = /*#__PURE__*/ __webpack_require__.n(external_dotenv_namespaceObject);
48
+ const tool_defaults_js_namespaceObject = require("../agent-tools/tool-defaults.js");
48
49
  const external_logger_js_namespaceObject = require("../logger.js");
49
- const tool_defaults_js_namespaceObject = require("../mcp/tool-defaults.js");
50
50
  const external_cli_args_js_namespaceObject = require("./cli-args.js");
51
51
  const external_cli_error_js_namespaceObject = require("./cli-error.js");
52
52
  const debug = (0, external_logger_js_namespaceObject.getDebug)('cli-runner');
@@ -37,7 +37,7 @@ const external_utils_js_namespaceObject = require("../utils.js");
37
37
  const external_helper_js_namespaceObject = require("./helper.js");
38
38
  const external_init_debug_js_namespaceObject = require("./init-debug.js");
39
39
  const MODEL_CONFIG_DOC_URL = 'https://midscenejs.com/model-common-config.html';
40
- const getCurrentVersion = ()=>"1.9.8-beta-20260618091332.0";
40
+ const getCurrentVersion = ()=>"1.10.0";
41
41
  const getInvalidModelFamilyMessage = (modelFamily)=>`Invalid MIDSCENE_MODEL_FAMILY value: ${modelFamily}. Current version v${getCurrentVersion()} accepts the following model families: ${external_types_js_namespaceObject.MODEL_FAMILY_VALUES.join(', ')}. You can also visit ${MODEL_CONFIG_DOC_URL} for the latest configuration information.`;
42
42
  const KEYS_MAP = {
43
43
  insight: external_constants_js_namespaceObject.INSIGHT_MODEL_CONFIG_KEYS,
@@ -36,6 +36,7 @@ __webpack_require__.d(__webpack_exports__, {
36
36
  MIDSCENE_ANDROID_IME_STRATEGY: ()=>MIDSCENE_ANDROID_IME_STRATEGY,
37
37
  MIDSCENE_CACHE: ()=>MIDSCENE_CACHE,
38
38
  MIDSCENE_CACHE_MAX_FILENAME_LENGTH: ()=>MIDSCENE_CACHE_MAX_FILENAME_LENGTH,
39
+ MIDSCENE_CHROME_PATH: ()=>MIDSCENE_CHROME_PATH,
39
40
  MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG: ()=>MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG,
40
41
  MIDSCENE_DEBUG_MODE: ()=>MIDSCENE_DEBUG_MODE,
41
42
  MIDSCENE_DEBUG_MODEL_PROFILE: ()=>MIDSCENE_DEBUG_MODEL_PROFILE,
@@ -60,9 +61,7 @@ __webpack_require__.d(__webpack_exports__, {
60
61
  MIDSCENE_IOS_SIMULATOR_UDID: ()=>MIDSCENE_IOS_SIMULATOR_UDID,
61
62
  MIDSCENE_LANGFUSE_DEBUG: ()=>MIDSCENE_LANGFUSE_DEBUG,
62
63
  MIDSCENE_LANGSMITH_DEBUG: ()=>MIDSCENE_LANGSMITH_DEBUG,
63
- MIDSCENE_MCP_ANDROID_MODE: ()=>MIDSCENE_MCP_ANDROID_MODE,
64
64
  MIDSCENE_MCP_CHROME_PATH: ()=>MIDSCENE_MCP_CHROME_PATH,
65
- MIDSCENE_MCP_USE_PUPPETEER_MODE: ()=>MIDSCENE_MCP_USE_PUPPETEER_MODE,
66
65
  MIDSCENE_MODEL_API_KEY: ()=>MIDSCENE_MODEL_API_KEY,
67
66
  MIDSCENE_MODEL_BASE_URL: ()=>MIDSCENE_MODEL_BASE_URL,
68
67
  MIDSCENE_MODEL_EXTRA_BODY_JSON: ()=>MIDSCENE_MODEL_EXTRA_BODY_JSON,
@@ -123,9 +122,8 @@ const MIDSCENE_DEBUG_MODEL_PROFILE = 'MIDSCENE_DEBUG_MODEL_PROFILE';
123
122
  const MIDSCENE_DEBUG_MODEL_RESPONSE = 'MIDSCENE_DEBUG_MODEL_RESPONSE';
124
123
  const MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG = 'MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG';
125
124
  const MIDSCENE_DEBUG_MODE = 'MIDSCENE_DEBUG_MODE';
126
- const MIDSCENE_MCP_USE_PUPPETEER_MODE = 'MIDSCENE_MCP_USE_PUPPETEER_MODE';
125
+ const MIDSCENE_CHROME_PATH = 'MIDSCENE_CHROME_PATH';
127
126
  const MIDSCENE_MCP_CHROME_PATH = 'MIDSCENE_MCP_CHROME_PATH';
128
- const MIDSCENE_MCP_ANDROID_MODE = 'MIDSCENE_MCP_ANDROID_MODE';
129
127
  const DOCKER_CONTAINER = 'DOCKER_CONTAINER';
130
128
  const MIDSCENE_LANGSMITH_DEBUG = 'MIDSCENE_LANGSMITH_DEBUG';
131
129
  const MIDSCENE_LANGFUSE_DEBUG = 'MIDSCENE_LANGFUSE_DEBUG';
@@ -208,8 +206,6 @@ const BASIC_ENV_KEYS = [
208
206
  ];
209
207
  const BOOLEAN_ENV_KEYS = [
210
208
  MIDSCENE_CACHE,
211
- MIDSCENE_MCP_USE_PUPPETEER_MODE,
212
- MIDSCENE_MCP_ANDROID_MODE,
213
209
  MIDSCENE_LANGSMITH_DEBUG,
214
210
  MIDSCENE_LANGFUSE_DEBUG,
215
211
  MIDSCENE_REPORT_QUIET
@@ -228,6 +224,7 @@ const STRING_ENV_KEYS = [
228
224
  MIDSCENE_REPORT_TAG_NAME,
229
225
  MIDSCENE_PREFERRED_LANGUAGE,
230
226
  MATCH_BY_POSITION,
227
+ MIDSCENE_CHROME_PATH,
231
228
  MIDSCENE_MCP_CHROME_PATH,
232
229
  DOCKER_CONTAINER
233
230
  ];
@@ -338,6 +335,7 @@ exports.MIDSCENE_ADB_REMOTE_PORT = __webpack_exports__.MIDSCENE_ADB_REMOTE_PORT;
338
335
  exports.MIDSCENE_ANDROID_IME_STRATEGY = __webpack_exports__.MIDSCENE_ANDROID_IME_STRATEGY;
339
336
  exports.MIDSCENE_CACHE = __webpack_exports__.MIDSCENE_CACHE;
340
337
  exports.MIDSCENE_CACHE_MAX_FILENAME_LENGTH = __webpack_exports__.MIDSCENE_CACHE_MAX_FILENAME_LENGTH;
338
+ exports.MIDSCENE_CHROME_PATH = __webpack_exports__.MIDSCENE_CHROME_PATH;
341
339
  exports.MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG = __webpack_exports__.MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG;
342
340
  exports.MIDSCENE_DEBUG_MODE = __webpack_exports__.MIDSCENE_DEBUG_MODE;
343
341
  exports.MIDSCENE_DEBUG_MODEL_PROFILE = __webpack_exports__.MIDSCENE_DEBUG_MODEL_PROFILE;
@@ -362,9 +360,7 @@ exports.MIDSCENE_IOS_DEVICE_UDID = __webpack_exports__.MIDSCENE_IOS_DEVICE_UDID;
362
360
  exports.MIDSCENE_IOS_SIMULATOR_UDID = __webpack_exports__.MIDSCENE_IOS_SIMULATOR_UDID;
363
361
  exports.MIDSCENE_LANGFUSE_DEBUG = __webpack_exports__.MIDSCENE_LANGFUSE_DEBUG;
364
362
  exports.MIDSCENE_LANGSMITH_DEBUG = __webpack_exports__.MIDSCENE_LANGSMITH_DEBUG;
365
- exports.MIDSCENE_MCP_ANDROID_MODE = __webpack_exports__.MIDSCENE_MCP_ANDROID_MODE;
366
363
  exports.MIDSCENE_MCP_CHROME_PATH = __webpack_exports__.MIDSCENE_MCP_CHROME_PATH;
367
- exports.MIDSCENE_MCP_USE_PUPPETEER_MODE = __webpack_exports__.MIDSCENE_MCP_USE_PUPPETEER_MODE;
368
364
  exports.MIDSCENE_MODEL_API_KEY = __webpack_exports__.MIDSCENE_MODEL_API_KEY;
369
365
  exports.MIDSCENE_MODEL_BASE_URL = __webpack_exports__.MIDSCENE_MODEL_BASE_URL;
370
366
  exports.MIDSCENE_MODEL_EXTRA_BODY_JSON = __webpack_exports__.MIDSCENE_MODEL_EXTRA_BODY_JSON;
@@ -430,6 +426,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
430
426
  "MIDSCENE_ANDROID_IME_STRATEGY",
431
427
  "MIDSCENE_CACHE",
432
428
  "MIDSCENE_CACHE_MAX_FILENAME_LENGTH",
429
+ "MIDSCENE_CHROME_PATH",
433
430
  "MIDSCENE_DANGEROUSLY_PRINT_ALL_CONFIG",
434
431
  "MIDSCENE_DEBUG_MODE",
435
432
  "MIDSCENE_DEBUG_MODEL_PROFILE",
@@ -454,9 +451,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
454
451
  "MIDSCENE_IOS_SIMULATOR_UDID",
455
452
  "MIDSCENE_LANGFUSE_DEBUG",
456
453
  "MIDSCENE_LANGSMITH_DEBUG",
457
- "MIDSCENE_MCP_ANDROID_MODE",
458
454
  "MIDSCENE_MCP_CHROME_PATH",
459
- "MIDSCENE_MCP_USE_PUPPETEER_MODE",
460
455
  "MIDSCENE_MODEL_API_KEY",
461
456
  "MIDSCENE_MODEL_BASE_URL",
462
457
  "MIDSCENE_MODEL_EXTRA_BODY_JSON",
package/dist/lib/utils.js CHANGED
@@ -24,20 +24,19 @@ var __webpack_require__ = {};
24
24
  var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
- uuid: ()=>uuid,
28
- isPlainObject: ()=>isPlainObject,
29
- ifInBrowser: ()=>ifInBrowser,
30
- repeat: ()=>repeat,
31
- mergeAndNormalizeAppNameMapping: ()=>mergeAndNormalizeAppNameMapping,
32
- ifInNode: ()=>ifInNode,
33
- assert: ()=>assert,
34
27
  escapeScriptTag: ()=>escapeScriptTag,
35
28
  logMsg: ()=>logMsg,
29
+ isPlainObject: ()=>isPlainObject,
36
30
  replaceIllegalPathCharsAndSpace: ()=>replaceIllegalPathCharsAndSpace,
31
+ uuid: ()=>uuid,
32
+ ifInBrowser: ()=>ifInBrowser,
37
33
  generateHashId: ()=>generateHashId,
38
34
  normalizeForComparison: ()=>normalizeForComparison,
35
+ mergeAndNormalizeAppNameMapping: ()=>mergeAndNormalizeAppNameMapping,
36
+ ifInNode: ()=>ifInNode,
39
37
  ifInWorker: ()=>ifInWorker,
40
- setIsMcp: ()=>setIsMcp,
38
+ repeat: ()=>repeat,
39
+ assert: ()=>assert,
41
40
  antiEscapeScriptTag: ()=>antiEscapeScriptTag
42
41
  });
43
42
  const external_js_sha256_namespaceObject = require("js-sha256");
@@ -76,12 +75,8 @@ function generateHashId(rect, content = '') {
76
75
  function assert(condition, message) {
77
76
  if (!condition) throw new Error(message || 'Assertion failed');
78
77
  }
79
- let isMcp = false;
80
- function setIsMcp(value) {
81
- isMcp = value;
82
- }
83
78
  function logMsg(...message) {
84
- if (!isMcp) console.log(...message);
79
+ console.log(...message);
85
80
  }
86
81
  async function repeat(times, fn) {
87
82
  for(let i = 0; i < times; i++)await fn(i);
@@ -124,7 +119,6 @@ exports.mergeAndNormalizeAppNameMapping = __webpack_exports__.mergeAndNormalizeA
124
119
  exports.normalizeForComparison = __webpack_exports__.normalizeForComparison;
125
120
  exports.repeat = __webpack_exports__.repeat;
126
121
  exports.replaceIllegalPathCharsAndSpace = __webpack_exports__.replaceIllegalPathCharsAndSpace;
127
- exports.setIsMcp = __webpack_exports__.setIsMcp;
128
122
  exports.uuid = __webpack_exports__.uuid;
129
123
  for(var __rspack_i in __webpack_exports__)if (-1 === [
130
124
  "antiEscapeScriptTag",
@@ -140,7 +134,6 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
140
134
  "normalizeForComparison",
141
135
  "repeat",
142
136
  "replaceIllegalPathCharsAndSpace",
143
- "setIsMcp",
144
137
  "uuid"
145
138
  ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
146
139
  Object.defineProperty(exports, '__esModule', {
@@ -1,4 +1,3 @@
1
- import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
1
  import type { z } from 'zod';
3
2
  import { type CliReportSession } from './cli-report-session';
4
3
  import { type ToolDefaults } from './tool-defaults';
@@ -11,11 +10,11 @@ import type { BaseAgent, BaseDevice, IMidsceneTools, ToolCliMetadata, ToolDefini
11
10
  export interface InitArgSpec<TInitParam> {
12
11
  /** Arg namespace, e.g. `android`, `ios`. */
13
12
  namespace: string;
14
- /** Zod shape describing the init args. Field names drive the MCP schema. */
13
+ /** Zod shape describing the init args. Field names drive the tool schema. */
15
14
  shape: Record<string, z.ZodTypeAny>;
16
15
  /**
17
16
  * Optional CLI presentation hints. These affect `--help` output for
18
- * single-platform CLIs but do not alter MCP/YAML protocol keys.
17
+ * single-platform CLIs but do not alter YAML protocol keys.
19
18
  */
20
19
  cli?: {
21
20
  /** Prefer bare `--device-id`-style options in platform CLI help output. */
@@ -30,24 +29,23 @@ export interface InitArgSpec<TInitParam> {
30
29
  adapt?: (extracted: Record<string, unknown> | undefined) => TInitParam | undefined;
31
30
  }
32
31
  /**
33
- * Base class for platform-specific MCP tools.
32
+ * Base class for platform-specific Midscene tools.
34
33
  * @typeParam TAgent - Platform-specific agent type.
35
34
  * @typeParam TInitParam - Platform-specific init parameter consumed by
36
35
  * `ensureAgent`. Defaults to `undefined` for platforms that take no args.
37
36
  */
38
37
  export declare abstract class BaseMidsceneTools<TAgent extends BaseAgent = BaseAgent, TInitParam = unknown> implements IMidsceneTools {
39
- protected mcpServer?: McpServer;
40
38
  protected agent?: TAgent;
41
39
  protected toolDefinitions: ToolDefinition[];
42
40
  /**
43
41
  * Default options injected into every generated tool call (e.g. forced deep
44
- * locate / deep think). Set from server/CLI behavior flags before
42
+ * locate / deep think). Set from startup/CLI behavior flags before
45
43
  * `initTools()` so they are baked into the generated tool handlers.
46
44
  * See https://github.com/web-infra-dev/midscene/issues/2446.
47
45
  */
48
46
  protected toolDefaults: ToolDefaults;
49
47
  /**
50
- * Declarative init-arg spec. Subclasses that accept CLI/MCP init args should
48
+ * Declarative init-arg spec. Subclasses that accept CLI init args should
51
49
  * set this once and get `extractAgentInitParam` / `sanitizeToolArgs` /
52
50
  * `getAgentInitArgSchema` auto-implemented.
53
51
  *
@@ -66,7 +64,7 @@ export declare abstract class BaseMidsceneTools<TAgent extends BaseAgent = BaseA
66
64
  protected abstract ensureAgent(initParam?: TInitParam): Promise<TAgent>;
67
65
  private getInitArgKeys;
68
66
  /**
69
- * Extract a platform-specific agent init parameter from CLI/MCP tool args.
67
+ * Extract a platform-specific agent init parameter from CLI tool args.
70
68
  */
71
69
  protected extractAgentInitParam(args: Record<string, unknown>): TInitParam | undefined;
72
70
  /**
@@ -82,7 +80,7 @@ export declare abstract class BaseMidsceneTools<TAgent extends BaseAgent = BaseA
82
80
  * show ergonomic bare flags while the underlying schema stays namespaced.
83
81
  * When `preferBareKeys` is enabled, single-platform CLIs only accept the
84
82
  * bare spellings; namespaced dotted spellings remain available through the
85
- * MCP/YAML schema instead of the platform CLI surface.
83
+ * YAML schema instead of the platform CLI surface.
86
84
  */
87
85
  protected getAgentInitArgCliMetadata(): ToolCliMetadata | undefined;
88
86
  /**
@@ -109,10 +107,6 @@ export declare abstract class BaseMidsceneTools<TAgent extends BaseAgent = BaseA
109
107
  * 2. Create temporary device instance to read actionSpace (always succeeds)
110
108
  */
111
109
  initTools(): Promise<void>;
112
- /**
113
- * Attach to MCP server and register all tools
114
- */
115
- attachToServer(server: McpServer): void;
116
110
  /**
117
111
  * Cleanup method - destroy agent and release resources
118
112
  */
@@ -1,4 +1,3 @@
1
- export * from './base-server';
2
1
  export * from './base-tools';
3
2
  export * from './tool-defaults';
4
3
  export * from './agent-behavior-init-args';
@@ -6,6 +5,4 @@ export * from './init-arg-utils';
6
5
  export * from './error-formatter';
7
6
  export * from './tool-generator';
8
7
  export * from './types';
9
- export * from './inject-report-html-plugin';
10
- export * from './launcher-helper';
11
8
  export * from './chrome-path';
@@ -3,11 +3,11 @@ import type { ToolSchema } from './types';
3
3
  export declare function extractNamespacedArgs<TFieldName extends string, TArgs extends Record<string, unknown> = Record<string, unknown>>(args: Record<string, unknown>, namespace: string, keys: readonly TFieldName[]): TArgs | undefined;
4
4
  export declare function sanitizeNamespacedArgs(args: Record<string, unknown>, namespace: string, keys: readonly string[]): Record<string, unknown>;
5
5
  /**
6
- * Build a flat MCP tool schema whose keys are dotted `"<namespace>.<field>"`.
6
+ * Build a flat tool schema whose keys are dotted `"<namespace>.<field>"`.
7
7
  *
8
8
  * We intentionally stay flat (rather than `{ namespace: z.object({...}) }`) so
9
- * that CLI (`--android.device-id`), MCP clients, and `--help` output all share
10
- * the same spelling. `readNamespacedArg` understands all three input shapes:
9
+ * that CLI (`--android.device-id`) and `--help` output share the same spelling.
10
+ * `readNamespacedArg` understands all three input shapes:
11
11
  * nested namespace object, dotted flat key, and bare key fallback.
12
12
  */
13
13
  export declare function createNamespacedInitArgSchema(namespace: string, shape: Record<string, z.ZodTypeAny>): ToolSchema;