@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.
@@ -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<{
@@ -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: ExecutorContext) => Promise<TReturn> | TReturn;
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",
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.4"
102
+ "@midscene/shared": "1.9.5-beta-20260611033424.0"
103
103
  },
104
104
  "devDependencies": {
105
105
  "@rslib/core": "^0.18.3",