@midscene/shared 1.10.8-beta-20260724035136.0 → 1.10.8
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.
- package/dist/es/agent-tools/tool-generator.mjs +10 -1
- package/dist/es/env/parse-model-config.mjs +1 -1
- package/dist/es/env/types.mjs +1 -0
- package/dist/lib/agent-tools/tool-generator.js +10 -1
- package/dist/lib/env/parse-model-config.js +1 -1
- package/dist/lib/env/types.js +1 -0
- package/dist/types/agent-tools/types.d.ts +5 -4
- package/dist/types/env/types.d.ts +1 -1
- package/dist/types/types/index.d.ts +5 -0
- package/package.json +1 -1
- package/src/agent-tools/tool-generator.ts +17 -1
- package/src/agent-tools/types.ts +5 -4
- package/src/env/types.ts +2 -0
- package/src/types/index.ts +5 -0
|
@@ -417,6 +417,8 @@ function generateCommonTools(getAgent, initArgSchema = {}, initArgCliMetadata, t
|
|
|
417
417
|
prompt: z.string().describe('Natural language description of the action to perform, e.g. "press Command+Space, type Safari, press Enter"'),
|
|
418
418
|
deepLocate: z.boolean().optional().describe('Use deep locate for every element this action targets. Improves precision for small or ambiguous targets at the cost of speed. Defaults to the server --deep-locate setting.'),
|
|
419
419
|
deepThink: z.boolean().optional().describe('Plan this action with deep thinking (richer context and sub-goal decomposition). Helps with complex multi-step instructions at the cost of speed. Defaults to the server --deep-think setting.'),
|
|
420
|
+
fileChooserAllowedDir: z.string().optional().describe('Directory that model-planned file uploads may access. Required when the prompt asks the model to upload files.'),
|
|
421
|
+
...promptInputExtraSchema,
|
|
420
422
|
...initArgSchema
|
|
421
423
|
},
|
|
422
424
|
cli: mergeToolCliMetadata(void 0, initArgCliMetadata),
|
|
@@ -439,7 +441,14 @@ function generateCommonTools(getAgent, initArgSchema = {}, initArgCliMetadata, t
|
|
|
439
441
|
};
|
|
440
442
|
if (void 0 !== args.deepLocate) actOptions.deepLocate = args.deepLocate;
|
|
441
443
|
if (void 0 !== args.deepThink) actOptions.deepThink = args.deepThink;
|
|
442
|
-
|
|
444
|
+
if (void 0 !== args.fileChooserAllowedDir) actOptions.fileChooserAllowedDir = args.fileChooserAllowedDir;
|
|
445
|
+
const userPrompt = composeUserPrompt({
|
|
446
|
+
prompt,
|
|
447
|
+
image: args.image,
|
|
448
|
+
imageName: args.imageName,
|
|
449
|
+
convertHttpImage2Base64: args.convertHttpImage2Base64
|
|
450
|
+
});
|
|
451
|
+
const result = await agent.aiAction(userPrompt, actOptions);
|
|
443
452
|
return await captureScreenshotResult(agent, 'act', result);
|
|
444
453
|
} finally{
|
|
445
454
|
unsubscribeVerbose();
|
|
@@ -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.10.8
|
|
8
|
+
const getCurrentVersion = ()=>"1.10.8";
|
|
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,
|
package/dist/es/env/types.mjs
CHANGED
|
@@ -447,6 +447,8 @@ function generateCommonTools(getAgent, initArgSchema = {}, initArgCliMetadata, t
|
|
|
447
447
|
prompt: external_zod_namespaceObject.z.string().describe('Natural language description of the action to perform, e.g. "press Command+Space, type Safari, press Enter"'),
|
|
448
448
|
deepLocate: external_zod_namespaceObject.z.boolean().optional().describe('Use deep locate for every element this action targets. Improves precision for small or ambiguous targets at the cost of speed. Defaults to the server --deep-locate setting.'),
|
|
449
449
|
deepThink: external_zod_namespaceObject.z.boolean().optional().describe('Plan this action with deep thinking (richer context and sub-goal decomposition). Helps with complex multi-step instructions at the cost of speed. Defaults to the server --deep-think setting.'),
|
|
450
|
+
fileChooserAllowedDir: external_zod_namespaceObject.z.string().optional().describe('Directory that model-planned file uploads may access. Required when the prompt asks the model to upload files.'),
|
|
451
|
+
...external_user_prompt_js_namespaceObject.promptInputExtraSchema,
|
|
450
452
|
...initArgSchema
|
|
451
453
|
},
|
|
452
454
|
cli: mergeToolCliMetadata(void 0, initArgCliMetadata),
|
|
@@ -469,7 +471,14 @@ function generateCommonTools(getAgent, initArgSchema = {}, initArgCliMetadata, t
|
|
|
469
471
|
};
|
|
470
472
|
if (void 0 !== args.deepLocate) actOptions.deepLocate = args.deepLocate;
|
|
471
473
|
if (void 0 !== args.deepThink) actOptions.deepThink = args.deepThink;
|
|
472
|
-
|
|
474
|
+
if (void 0 !== args.fileChooserAllowedDir) actOptions.fileChooserAllowedDir = args.fileChooserAllowedDir;
|
|
475
|
+
const userPrompt = (0, external_user_prompt_js_namespaceObject.composeUserPrompt)({
|
|
476
|
+
prompt,
|
|
477
|
+
image: args.image,
|
|
478
|
+
imageName: args.imageName,
|
|
479
|
+
convertHttpImage2Base64: args.convertHttpImage2Base64
|
|
480
|
+
});
|
|
481
|
+
const result = await agent.aiAction(userPrompt, actOptions);
|
|
473
482
|
return await captureScreenshotResult(agent, 'act', result);
|
|
474
483
|
} finally{
|
|
475
484
|
unsubscribeVerbose();
|
|
@@ -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.10.8
|
|
40
|
+
const getCurrentVersion = ()=>"1.10.8";
|
|
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,
|
package/dist/lib/env/types.js
CHANGED
|
@@ -81,9 +81,10 @@ export interface ActionSpaceItem {
|
|
|
81
81
|
* Structural shape compatible with @midscene/core `TUserPrompt`.
|
|
82
82
|
* Declared locally to avoid a circular dep on `@midscene/core` from `@midscene/shared`.
|
|
83
83
|
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
84
|
+
* Consumed by the `assert` and `act` tools in `generateCommonTools`, both of
|
|
85
|
+
* which forward reference images to core (`aiAssert` / `aiAct`). `aiWaitFor`
|
|
86
|
+
* stays string-only at the CLI surface because the tools generator does not
|
|
87
|
+
* yet expose a multimodal entry point for it.
|
|
87
88
|
*/
|
|
88
89
|
export type UserPromptLike = string | {
|
|
89
90
|
prompt: string;
|
|
@@ -131,7 +132,7 @@ export interface BaseAgent {
|
|
|
131
132
|
addProgressListener?: (listener: (event: BaseAgentProgressEvent) => void) => () => void;
|
|
132
133
|
recordToReport?: (title?: string, opt?: RecordToReportOptions) => Promise<void>;
|
|
133
134
|
callActionInActionSpace?: (actionName: string, params?: unknown) => Promise<unknown>;
|
|
134
|
-
aiAction?: (description:
|
|
135
|
+
aiAction?: (description: UserPromptLike, params?: Record<string, unknown>) => Promise<unknown>;
|
|
135
136
|
aiWaitFor?: (assertion: string, options: Record<string, unknown>) => Promise<unknown>;
|
|
136
137
|
aiAssert?: (assertion: UserPromptLike, msg?: string, options?: Record<string, unknown>) => Promise<unknown>;
|
|
137
138
|
}
|
|
@@ -131,7 +131,7 @@ export type TGlobalConfig = Record<TEnvKeys, string | undefined>;
|
|
|
131
131
|
/**
|
|
132
132
|
* valid Model family types
|
|
133
133
|
*/
|
|
134
|
-
export type TModelFamily = 'qwen2.5-vl' | 'qwen3-vl' | 'qwen3' | 'qwen3.5' | 'qwen3.6' | 'doubao-vision' | 'doubao-seed' | 'gemini' | 'vlm-ui-tars' | 'vlm-ui-tars-doubao' | 'vlm-ui-tars-doubao-1.5' | 'glm-v' | 'auto-glm' | 'auto-glm-multilingual' | 'gpt-5' | 'kimi' | 'xiaomi-mimo';
|
|
134
|
+
export type TModelFamily = 'qwen2.5-vl' | 'qwen3-vl' | 'qwen3' | 'qwen3.5' | 'qwen3.6' | 'doubao-vision' | 'doubao-seed' | 'gemini' | 'vlm-ui-tars' | 'vlm-ui-tars-doubao' | 'vlm-ui-tars-doubao-1.5' | 'glm-v' | 'auto-glm' | 'auto-glm-multilingual' | 'gpt-5' | 'kimi' | 'kimi3' | 'xiaomi-mimo';
|
|
135
135
|
export declare const MODEL_FAMILY_VALUES: TModelFamily[];
|
|
136
136
|
export interface IModelConfigForInsight {
|
|
137
137
|
[MIDSCENE_INSIGHT_MODEL_NAME]: string;
|
|
@@ -31,4 +31,9 @@ export type LocateResultElement = {
|
|
|
31
31
|
description: string;
|
|
32
32
|
center: [number, number];
|
|
33
33
|
rect: Rect;
|
|
34
|
+
/**
|
|
35
|
+
* Web-only compatibility field returned by `Agent.aiLocate()`.
|
|
36
|
+
* It is the ratio between physical screenshot pixels and logical CSS pixels.
|
|
37
|
+
*/
|
|
38
|
+
dpr?: number;
|
|
34
39
|
};
|
package/package.json
CHANGED
|
@@ -712,6 +712,13 @@ export function generateCommonTools(
|
|
|
712
712
|
.describe(
|
|
713
713
|
'Plan this action with deep thinking (richer context and sub-goal decomposition). Helps with complex multi-step instructions at the cost of speed. Defaults to the server --deep-think setting.',
|
|
714
714
|
),
|
|
715
|
+
fileChooserAllowedDir: z
|
|
716
|
+
.string()
|
|
717
|
+
.optional()
|
|
718
|
+
.describe(
|
|
719
|
+
'Directory that model-planned file uploads may access. Required when the prompt asks the model to upload files.',
|
|
720
|
+
),
|
|
721
|
+
...promptInputExtraSchema,
|
|
715
722
|
...initArgSchema,
|
|
716
723
|
},
|
|
717
724
|
cli: mergeToolCliMetadata(undefined, initArgCliMetadata),
|
|
@@ -744,7 +751,16 @@ export function generateCommonTools(
|
|
|
744
751
|
if (args.deepThink !== undefined) {
|
|
745
752
|
actOptions.deepThink = args.deepThink;
|
|
746
753
|
}
|
|
747
|
-
|
|
754
|
+
if (args.fileChooserAllowedDir !== undefined) {
|
|
755
|
+
actOptions.fileChooserAllowedDir = args.fileChooserAllowedDir;
|
|
756
|
+
}
|
|
757
|
+
const userPrompt = composeUserPrompt({
|
|
758
|
+
prompt,
|
|
759
|
+
image: args.image,
|
|
760
|
+
imageName: args.imageName,
|
|
761
|
+
convertHttpImage2Base64: args.convertHttpImage2Base64,
|
|
762
|
+
});
|
|
763
|
+
const result = await agent.aiAction(userPrompt, actOptions);
|
|
748
764
|
return await captureScreenshotResult(agent, 'act', result);
|
|
749
765
|
} finally {
|
|
750
766
|
unsubscribeVerbose();
|
package/src/agent-tools/types.ts
CHANGED
|
@@ -84,9 +84,10 @@ export interface ActionSpaceItem {
|
|
|
84
84
|
* Structural shape compatible with @midscene/core `TUserPrompt`.
|
|
85
85
|
* Declared locally to avoid a circular dep on `@midscene/core` from `@midscene/shared`.
|
|
86
86
|
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
87
|
+
* Consumed by the `assert` and `act` tools in `generateCommonTools`, both of
|
|
88
|
+
* which forward reference images to core (`aiAssert` / `aiAct`). `aiWaitFor`
|
|
89
|
+
* stays string-only at the CLI surface because the tools generator does not
|
|
90
|
+
* yet expose a multimodal entry point for it.
|
|
90
91
|
*/
|
|
91
92
|
export type UserPromptLike =
|
|
92
93
|
| string
|
|
@@ -148,7 +149,7 @@ export interface BaseAgent {
|
|
|
148
149
|
params?: unknown,
|
|
149
150
|
) => Promise<unknown>;
|
|
150
151
|
aiAction?: (
|
|
151
|
-
description:
|
|
152
|
+
description: UserPromptLike,
|
|
152
153
|
params?: Record<string, unknown>,
|
|
153
154
|
) => Promise<unknown>;
|
|
154
155
|
aiWaitFor?: (
|
package/src/env/types.ts
CHANGED
|
@@ -310,6 +310,7 @@ export type TModelFamily =
|
|
|
310
310
|
| 'auto-glm-multilingual'
|
|
311
311
|
| 'gpt-5'
|
|
312
312
|
| 'kimi'
|
|
313
|
+
| 'kimi3'
|
|
313
314
|
| 'xiaomi-mimo';
|
|
314
315
|
|
|
315
316
|
export const MODEL_FAMILY_VALUES: TModelFamily[] = [
|
|
@@ -329,6 +330,7 @@ export const MODEL_FAMILY_VALUES: TModelFamily[] = [
|
|
|
329
330
|
'auto-glm-multilingual',
|
|
330
331
|
'gpt-5',
|
|
331
332
|
'kimi',
|
|
333
|
+
'kimi3',
|
|
332
334
|
'xiaomi-mimo',
|
|
333
335
|
];
|
|
334
336
|
|
package/src/types/index.ts
CHANGED
|
@@ -49,4 +49,9 @@ export type LocateResultElement = {
|
|
|
49
49
|
description: string; // the description of the element
|
|
50
50
|
center: [number, number];
|
|
51
51
|
rect: Rect;
|
|
52
|
+
/**
|
|
53
|
+
* Web-only compatibility field returned by `Agent.aiLocate()`.
|
|
54
|
+
* It is the ratio between physical screenshot pixels and logical CSS pixels.
|
|
55
|
+
*/
|
|
56
|
+
dpr?: number;
|
|
52
57
|
};
|