@midscene/core 1.9.4 → 1.9.5-beta-20260611033424.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.
- package/dist/es/agent/tasks.mjs +17 -2
- package/dist/es/agent/tasks.mjs.map +1 -1
- package/dist/es/agent/utils.mjs +1 -1
- package/dist/es/ai-model/prompt/llm-planning.mjs +17 -2
- package/dist/es/ai-model/prompt/llm-planning.mjs.map +1 -1
- package/dist/es/device/index.mjs +1 -1
- package/dist/es/device/index.mjs.map +1 -1
- package/dist/es/types.mjs.map +1 -1
- package/dist/es/utils.mjs +2 -2
- package/dist/lib/agent/tasks.js +17 -2
- package/dist/lib/agent/tasks.js.map +1 -1
- package/dist/lib/agent/utils.js +1 -1
- package/dist/lib/ai-model/prompt/llm-planning.js +17 -2
- package/dist/lib/ai-model/prompt/llm-planning.js.map +1 -1
- package/dist/lib/device/index.js +1 -1
- package/dist/lib/device/index.js.map +1 -1
- package/dist/lib/types.js.map +1 -1
- package/dist/lib/utils.js +2 -2
- package/dist/types/agent/tasks.d.ts +13 -0
- package/dist/types/device/index.d.ts +2 -2
- package/dist/types/types.d.ts +6 -1
- package/package.json +2 -2
|
@@ -44,6 +44,19 @@ export declare class TaskExecutor {
|
|
|
44
44
|
});
|
|
45
45
|
private createExecutionSession;
|
|
46
46
|
private getActionSpace;
|
|
47
|
+
/**
|
|
48
|
+
* Set the pending feedback message consumed by the next planning round.
|
|
49
|
+
* The message is always prefixed with the current time. When a body is
|
|
50
|
+
* provided it is appended after the timestamp; otherwise only the time
|
|
51
|
+
* context is recorded. This is the single entry point for writing
|
|
52
|
+
* `pendingFeedbackMessage` so the time prefix stays consistent.
|
|
53
|
+
*/
|
|
54
|
+
private setPendingFeedbackMessage;
|
|
55
|
+
/**
|
|
56
|
+
* Collect feedback produced by executed tasks for the next planning round.
|
|
57
|
+
* Returns undefined when no task reported feedback.
|
|
58
|
+
*/
|
|
59
|
+
private collectPlanningFeedback;
|
|
47
60
|
/**
|
|
48
61
|
* Get a readable time string. When device time is enabled, use the
|
|
49
62
|
* device-formatted wall-clock time directly so host timezone formatting does
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ModelRuntime } from '../ai-model/models';
|
|
2
|
-
import type { ActionScrollParam, DeviceAction, LocateResultElement } from '../types';
|
|
2
|
+
import type { ActionScrollParam, DeviceAction, ExecutorContext, LocateResultElement } from '../types';
|
|
3
3
|
import type { ElementNode } from '@midscene/shared/extractor';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import type { ElementCacheFeature, Rect, Size } from '../types';
|
|
@@ -173,7 +173,7 @@ export declare const defineAction: <TSchema extends z.ZodType | undefined = unde
|
|
|
173
173
|
description: string;
|
|
174
174
|
interfaceAlias?: string;
|
|
175
175
|
paramSchema?: TSchema;
|
|
176
|
-
call: (param: TRuntime) => Promise<TReturn> | TReturn;
|
|
176
|
+
call: (param: TRuntime, context?: ExecutorContext) => Promise<TReturn> | TReturn;
|
|
177
177
|
} & Partial<Omit<DeviceAction<TRuntime, TReturn>, "name" | "description" | "interfaceAlias" | "paramSchema" | "call">>) => DeviceAction<TRuntime, TReturn>;
|
|
178
178
|
export declare const actionTapParamSchema: z.ZodObject<{
|
|
179
179
|
locate: z.ZodObject<{
|
package/dist/types/types.d.ts
CHANGED
|
@@ -319,6 +319,11 @@ export interface ExecutionTaskReturn<TaskOutput = unknown, TaskLog = unknown> {
|
|
|
319
319
|
export type ExecutionTask<E extends ExecutionTaskApply<any, any, any> = ExecutionTaskApply<any, any, any>> = E & ExecutionTaskReturn<E extends ExecutionTaskApply<any, any, infer TaskOutput, any> ? TaskOutput : unknown, E extends ExecutionTaskApply<any, any, any, infer TaskLog> ? TaskLog : unknown> & {
|
|
320
320
|
taskId: string;
|
|
321
321
|
status: 'pending' | 'running' | 'finished' | 'failed' | 'cancelled';
|
|
322
|
+
/**
|
|
323
|
+
* Optional feedback produced by a task for the next planning round.
|
|
324
|
+
* This is execution metadata, not part of the action return value.
|
|
325
|
+
*/
|
|
326
|
+
planningFeedback?: string;
|
|
322
327
|
error?: Error;
|
|
323
328
|
errorMessage?: string;
|
|
324
329
|
errorStack?: string;
|
|
@@ -464,7 +469,7 @@ export interface DeviceAction<TParam = any, TReturn = any> {
|
|
|
464
469
|
description?: string;
|
|
465
470
|
interfaceAlias?: string;
|
|
466
471
|
paramSchema?: z.ZodType<TParam>;
|
|
467
|
-
call: (param: TParam, context
|
|
472
|
+
call: (param: TParam, context?: ExecutorContext) => Promise<TReturn> | TReturn;
|
|
468
473
|
delayBeforeRunner?: number;
|
|
469
474
|
delayAfterRunner?: number;
|
|
470
475
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/core",
|
|
3
3
|
"description": "Automate browser actions, extract data, and perform assertions using AI. It offers JavaScript SDK, Chrome extension, and support for scripting in YAML. See https://midscenejs.com/ for details.",
|
|
4
|
-
"version": "1.9.
|
|
4
|
+
"version": "1.9.5-beta-20260611033424.0",
|
|
5
5
|
"repository": "https://github.com/web-infra-dev/midscene",
|
|
6
6
|
"homepage": "https://midscenejs.com/",
|
|
7
7
|
"main": "./dist/lib/index.js",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"semver": "7.5.2",
|
|
100
100
|
"undici": "^6.0.0",
|
|
101
101
|
"zod": "^3.25.1",
|
|
102
|
-
"@midscene/shared": "1.9.
|
|
102
|
+
"@midscene/shared": "1.9.5-beta-20260611033424.0"
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
105
|
"@rslib/core": "^0.18.3",
|