@midscene/core 1.3.7 → 1.3.8-beta-20260206024209.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 (39) hide show
  1. package/dist/es/agent/agent.mjs +1 -1
  2. package/dist/es/agent/agent.mjs.map +1 -1
  3. package/dist/es/agent/utils.mjs +1 -1
  4. package/dist/es/ai-model/conversation-history.mjs +34 -5
  5. package/dist/es/ai-model/conversation-history.mjs.map +1 -1
  6. package/dist/es/ai-model/inspect.mjs +2 -2
  7. package/dist/es/ai-model/inspect.mjs.map +1 -1
  8. package/dist/es/ai-model/llm-planning.mjs +1 -0
  9. package/dist/es/ai-model/llm-planning.mjs.map +1 -1
  10. package/dist/es/ai-model/prompt/llm-planning.mjs +19 -3
  11. package/dist/es/ai-model/prompt/llm-planning.mjs.map +1 -1
  12. package/dist/es/ai-model/service-caller/index.mjs +6 -2
  13. package/dist/es/ai-model/service-caller/index.mjs.map +1 -1
  14. package/dist/es/service/index.mjs +1 -5
  15. package/dist/es/service/index.mjs.map +1 -1
  16. package/dist/es/types.mjs.map +1 -1
  17. package/dist/es/utils.mjs +2 -2
  18. package/dist/lib/agent/agent.js +1 -1
  19. package/dist/lib/agent/agent.js.map +1 -1
  20. package/dist/lib/agent/utils.js +1 -1
  21. package/dist/lib/ai-model/conversation-history.js +34 -5
  22. package/dist/lib/ai-model/conversation-history.js.map +1 -1
  23. package/dist/lib/ai-model/inspect.js +2 -2
  24. package/dist/lib/ai-model/inspect.js.map +1 -1
  25. package/dist/lib/ai-model/llm-planning.js +1 -0
  26. package/dist/lib/ai-model/llm-planning.js.map +1 -1
  27. package/dist/lib/ai-model/prompt/llm-planning.js +19 -3
  28. package/dist/lib/ai-model/prompt/llm-planning.js.map +1 -1
  29. package/dist/lib/ai-model/service-caller/index.js +6 -2
  30. package/dist/lib/ai-model/service-caller/index.js.map +1 -1
  31. package/dist/lib/service/index.js +1 -5
  32. package/dist/lib/service/index.js.map +1 -1
  33. package/dist/lib/types.js.map +1 -1
  34. package/dist/lib/utils.js +2 -2
  35. package/dist/types/ai-model/conversation-history.d.ts +13 -4
  36. package/dist/types/ai-model/inspect.d.ts +1 -2
  37. package/dist/types/service/index.d.ts +0 -3
  38. package/dist/types/types.d.ts +1 -0
  39. package/package.json +2 -2
@@ -28,12 +28,14 @@ export declare class ConversationHistory {
28
28
  */
29
29
  setSubGoals(subGoals: SubGoal[]): void;
30
30
  /**
31
- * Update a single sub-goal by index
31
+ * Update a single sub-goal by index.
32
+ * Clears logs if status or description actually changes.
32
33
  * @returns true if the sub-goal was found and updated, false otherwise
33
34
  */
34
35
  updateSubGoal(index: number, updates: Partial<Omit<SubGoal, 'index'>>): boolean;
35
36
  /**
36
- * Mark the first pending sub-goal as running
37
+ * Mark the first pending sub-goal as running.
38
+ * Clears logs since status changes.
37
39
  */
38
40
  markFirstPendingAsRunning(): void;
39
41
  /**
@@ -43,11 +45,18 @@ export declare class ConversationHistory {
43
45
  */
44
46
  markSubGoalFinished(index: number): boolean;
45
47
  /**
46
- * Mark all sub-goals as finished
48
+ * Mark all sub-goals as finished.
49
+ * Clears logs for any goal whose status actually changes.
47
50
  */
48
51
  markAllSubGoalsFinished(): void;
49
52
  /**
50
- * Convert sub-goals to text representation
53
+ * Append a log entry to the currently running sub-goal.
54
+ * The log describes an action performed while working on the sub-goal.
55
+ */
56
+ appendSubGoalLog(log: string): void;
57
+ /**
58
+ * Convert sub-goals to text representation.
59
+ * Includes actions performed (logs) for the current sub-goal.
51
60
  */
52
61
  subGoalsToText(): string;
53
62
  /**
@@ -1,4 +1,4 @@
1
- import type { AIDataExtractionResponse, AIElementResponse, AIUsageInfo, Rect, ServiceExtractOption, UIContext } from '../types';
1
+ import type { AIDataExtractionResponse, AIUsageInfo, Rect, ServiceExtractOption, UIContext } from '../types';
2
2
  import type { IModelConfig } from '@midscene/shared/env';
3
3
  import type { LocateResultElement } from '@midscene/shared/types';
4
4
  import type { ChatCompletionSystemMessageParam, ChatCompletionUserMessageParam } from 'openai/resources/index';
@@ -11,7 +11,6 @@ export type AIArgs = [
11
11
  export declare function AiLocateElement(options: {
12
12
  context: UIContext;
13
13
  targetElementDescription: TUserPrompt;
14
- callAIFn: typeof callAIWithObjectResponse<AIElementResponse | [number, number]>;
15
14
  searchConfig?: Awaited<ReturnType<typeof AiLocateSection>>;
16
15
  modelConfig: IModelConfig;
17
16
  }): Promise<{
@@ -1,4 +1,3 @@
1
- import { callAIWithObjectResponse } from '../ai-model/index';
2
1
  import type { AIDescribeElementResponse, DetailedLocateParam, LocateResultWithDump, Rect, ServiceExtractOption, ServiceExtractParam, ServiceExtractResult, ServiceTaskInfo, UIContext } from '../types';
3
2
  import { type IModelConfig } from '@midscene/shared/env';
4
3
  import type { TMultimodalPrompt } from '../common';
@@ -10,11 +9,9 @@ export type AnyValue<T> = {
10
9
  };
11
10
  interface ServiceOptions {
12
11
  taskInfo?: Omit<ServiceTaskInfo, 'durationMs'>;
13
- aiVendorFn?: typeof callAIWithObjectResponse;
14
12
  }
15
13
  export default class Service {
16
14
  contextRetrieverFn: () => Promise<UIContext> | UIContext;
17
- aiVendorFn: Exclude<ServiceOptions['aiVendorFn'], undefined>;
18
15
  taskInfo?: Omit<ServiceTaskInfo, 'durationMs'>;
19
16
  constructor(context: UIContext | (() => Promise<UIContext> | UIContext), opt?: ServiceOptions);
20
17
  locate(query: DetailedLocateParam, opt: LocateOpts, modelConfig: IModelConfig): Promise<LocateResultWithDump>;
@@ -174,6 +174,7 @@ export interface SubGoal {
174
174
  index: number;
175
175
  status: SubGoalStatus;
176
176
  description: string;
177
+ logs?: string[];
177
178
  }
178
179
  export interface RawResponsePlanningAIResponse {
179
180
  action: PlanningAction;
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.3.7",
4
+ "version": "1.3.8-beta-20260206024209.0",
5
5
  "repository": "https://github.com/web-infra-dev/midscene",
6
6
  "homepage": "https://midscenejs.com/",
7
7
  "main": "./dist/lib/index.js",
@@ -89,7 +89,7 @@
89
89
  "semver": "7.5.2",
90
90
  "undici": "^6.0.0",
91
91
  "zod": "3.24.3",
92
- "@midscene/shared": "1.3.7"
92
+ "@midscene/shared": "1.3.8-beta-20260206024209.0"
93
93
  },
94
94
  "devDependencies": {
95
95
  "@rslib/core": "^0.18.3",