@rpascene/core 0.30.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/LICENSE +21 -0
- package/README.md +9 -0
- package/dist/es/agent/agent.mjs +636 -0
- package/dist/es/agent/agent.mjs.map +1 -0
- package/dist/es/agent/common.mjs +0 -0
- package/dist/es/agent/index.mjs +6 -0
- package/dist/es/agent/task-cache.mjs +184 -0
- package/dist/es/agent/task-cache.mjs.map +1 -0
- package/dist/es/agent/tasks.mjs +666 -0
- package/dist/es/agent/tasks.mjs.map +1 -0
- package/dist/es/agent/ui-utils.mjs +72 -0
- package/dist/es/agent/ui-utils.mjs.map +1 -0
- package/dist/es/agent/utils.mjs +162 -0
- package/dist/es/agent/utils.mjs.map +1 -0
- package/dist/es/ai-model/action-executor.mjs +129 -0
- package/dist/es/ai-model/action-executor.mjs.map +1 -0
- package/dist/es/ai-model/common.mjs +355 -0
- package/dist/es/ai-model/common.mjs.map +1 -0
- package/dist/es/ai-model/conversation-history.mjs +58 -0
- package/dist/es/ai-model/conversation-history.mjs.map +1 -0
- package/dist/es/ai-model/index.mjs +11 -0
- package/dist/es/ai-model/inspect.mjs +286 -0
- package/dist/es/ai-model/inspect.mjs.map +1 -0
- package/dist/es/ai-model/llm-planning.mjs +140 -0
- package/dist/es/ai-model/llm-planning.mjs.map +1 -0
- package/dist/es/ai-model/prompt/assertion.mjs +31 -0
- package/dist/es/ai-model/prompt/assertion.mjs.map +1 -0
- package/dist/es/ai-model/prompt/common.mjs +7 -0
- package/dist/es/ai-model/prompt/common.mjs.map +1 -0
- package/dist/es/ai-model/prompt/describe.mjs +44 -0
- package/dist/es/ai-model/prompt/describe.mjs.map +1 -0
- package/dist/es/ai-model/prompt/extraction.mjs +140 -0
- package/dist/es/ai-model/prompt/extraction.mjs.map +1 -0
- package/dist/es/ai-model/prompt/llm-locator.mjs +275 -0
- package/dist/es/ai-model/prompt/llm-locator.mjs.map +1 -0
- package/dist/es/ai-model/prompt/llm-planning.mjs +367 -0
- package/dist/es/ai-model/prompt/llm-planning.mjs.map +1 -0
- package/dist/es/ai-model/prompt/llm-section-locator.mjs +47 -0
- package/dist/es/ai-model/prompt/llm-section-locator.mjs.map +1 -0
- package/dist/es/ai-model/prompt/playwright-generator.mjs +117 -0
- package/dist/es/ai-model/prompt/playwright-generator.mjs.map +1 -0
- package/dist/es/ai-model/prompt/ui-tars-locator.mjs +34 -0
- package/dist/es/ai-model/prompt/ui-tars-locator.mjs.map +1 -0
- package/dist/es/ai-model/prompt/ui-tars-planning.mjs +36 -0
- package/dist/es/ai-model/prompt/ui-tars-planning.mjs.map +1 -0
- package/dist/es/ai-model/prompt/util.mjs +124 -0
- package/dist/es/ai-model/prompt/util.mjs.map +1 -0
- package/dist/es/ai-model/prompt/yaml-generator.mjs +219 -0
- package/dist/es/ai-model/prompt/yaml-generator.mjs.map +1 -0
- package/dist/es/ai-model/service-caller/index.mjs +537 -0
- package/dist/es/ai-model/service-caller/index.mjs.map +1 -0
- package/dist/es/ai-model/ui-tars-planning.mjs +201 -0
- package/dist/es/ai-model/ui-tars-planning.mjs.map +1 -0
- package/dist/es/device/index.mjs +152 -0
- package/dist/es/device/index.mjs.map +1 -0
- package/dist/es/image/index.mjs +2 -0
- package/dist/es/index.mjs +11 -0
- package/dist/es/index.mjs.map +1 -0
- package/dist/es/insight/index.mjs +233 -0
- package/dist/es/insight/index.mjs.map +1 -0
- package/dist/es/insight/utils.mjs +15 -0
- package/dist/es/insight/utils.mjs.map +1 -0
- package/dist/es/report.mjs +88 -0
- package/dist/es/report.mjs.map +1 -0
- package/dist/es/tree.mjs +2 -0
- package/dist/es/types.mjs +11 -0
- package/dist/es/types.mjs.map +1 -0
- package/dist/es/utils.mjs +204 -0
- package/dist/es/utils.mjs.map +1 -0
- package/dist/es/yaml/builder.mjs +13 -0
- package/dist/es/yaml/builder.mjs.map +1 -0
- package/dist/es/yaml/index.mjs +3 -0
- package/dist/es/yaml/player.mjs +372 -0
- package/dist/es/yaml/player.mjs.map +1 -0
- package/dist/es/yaml/utils.mjs +73 -0
- package/dist/es/yaml/utils.mjs.map +1 -0
- package/dist/es/yaml.mjs +0 -0
- package/dist/lib/agent/agent.js +683 -0
- package/dist/lib/agent/agent.js.map +1 -0
- package/dist/lib/agent/common.js +5 -0
- package/dist/lib/agent/index.js +81 -0
- package/dist/lib/agent/index.js.map +1 -0
- package/dist/lib/agent/task-cache.js +236 -0
- package/dist/lib/agent/task-cache.js.map +1 -0
- package/dist/lib/agent/tasks.js +703 -0
- package/dist/lib/agent/tasks.js.map +1 -0
- package/dist/lib/agent/ui-utils.js +121 -0
- package/dist/lib/agent/ui-utils.js.map +1 -0
- package/dist/lib/agent/utils.js +233 -0
- package/dist/lib/agent/utils.js.map +1 -0
- package/dist/lib/ai-model/action-executor.js +163 -0
- package/dist/lib/ai-model/action-executor.js.map +1 -0
- package/dist/lib/ai-model/common.js +461 -0
- package/dist/lib/ai-model/common.js.map +1 -0
- package/dist/lib/ai-model/conversation-history.js +92 -0
- package/dist/lib/ai-model/conversation-history.js.map +1 -0
- package/dist/lib/ai-model/index.js +131 -0
- package/dist/lib/ai-model/index.js.map +1 -0
- package/dist/lib/ai-model/inspect.js +326 -0
- package/dist/lib/ai-model/inspect.js.map +1 -0
- package/dist/lib/ai-model/llm-planning.js +174 -0
- package/dist/lib/ai-model/llm-planning.js.map +1 -0
- package/dist/lib/ai-model/prompt/assertion.js +65 -0
- package/dist/lib/ai-model/prompt/assertion.js.map +1 -0
- package/dist/lib/ai-model/prompt/common.js +41 -0
- package/dist/lib/ai-model/prompt/common.js.map +1 -0
- package/dist/lib/ai-model/prompt/describe.js +78 -0
- package/dist/lib/ai-model/prompt/describe.js.map +1 -0
- package/dist/lib/ai-model/prompt/extraction.js +180 -0
- package/dist/lib/ai-model/prompt/extraction.js.map +1 -0
- package/dist/lib/ai-model/prompt/llm-locator.js +315 -0
- package/dist/lib/ai-model/prompt/llm-locator.js.map +1 -0
- package/dist/lib/ai-model/prompt/llm-planning.js +407 -0
- package/dist/lib/ai-model/prompt/llm-planning.js.map +1 -0
- package/dist/lib/ai-model/prompt/llm-section-locator.js +84 -0
- package/dist/lib/ai-model/prompt/llm-section-locator.js.map +1 -0
- package/dist/lib/ai-model/prompt/playwright-generator.js +178 -0
- package/dist/lib/ai-model/prompt/playwright-generator.js.map +1 -0
- package/dist/lib/ai-model/prompt/ui-tars-locator.js +68 -0
- package/dist/lib/ai-model/prompt/ui-tars-locator.js.map +1 -0
- package/dist/lib/ai-model/prompt/ui-tars-planning.js +73 -0
- package/dist/lib/ai-model/prompt/ui-tars-planning.js.map +1 -0
- package/dist/lib/ai-model/prompt/util.js +176 -0
- package/dist/lib/ai-model/prompt/util.js.map +1 -0
- package/dist/lib/ai-model/prompt/yaml-generator.js +280 -0
- package/dist/lib/ai-model/prompt/yaml-generator.js.map +1 -0
- package/dist/lib/ai-model/service-caller/index.js +623 -0
- package/dist/lib/ai-model/service-caller/index.js.map +1 -0
- package/dist/lib/ai-model/ui-tars-planning.js +238 -0
- package/dist/lib/ai-model/ui-tars-planning.js.map +1 -0
- package/dist/lib/device/index.js +255 -0
- package/dist/lib/device/index.js.map +1 -0
- package/dist/lib/image/index.js +56 -0
- package/dist/lib/image/index.js.map +1 -0
- package/dist/lib/index.js +103 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/insight/index.js +267 -0
- package/dist/lib/insight/index.js.map +1 -0
- package/dist/lib/insight/utils.js +49 -0
- package/dist/lib/insight/utils.js.map +1 -0
- package/dist/lib/report.js +122 -0
- package/dist/lib/report.js.map +1 -0
- package/dist/lib/tree.js +44 -0
- package/dist/lib/tree.js.map +1 -0
- package/dist/lib/types.js +82 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/utils.js +283 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/yaml/builder.js +57 -0
- package/dist/lib/yaml/builder.js.map +1 -0
- package/dist/lib/yaml/index.js +80 -0
- package/dist/lib/yaml/index.js.map +1 -0
- package/dist/lib/yaml/player.js +406 -0
- package/dist/lib/yaml/player.js.map +1 -0
- package/dist/lib/yaml/utils.js +126 -0
- package/dist/lib/yaml/utils.js.map +1 -0
- package/dist/lib/yaml.js +20 -0
- package/dist/lib/yaml.js.map +1 -0
- package/dist/types/agent/agent.d.ts +156 -0
- package/dist/types/agent/common.d.ts +0 -0
- package/dist/types/agent/index.d.ts +9 -0
- package/dist/types/agent/task-cache.d.ts +48 -0
- package/dist/types/agent/tasks.d.ts +48 -0
- package/dist/types/agent/ui-utils.d.ts +7 -0
- package/dist/types/agent/utils.d.ts +52 -0
- package/dist/types/ai-model/action-executor.d.ts +19 -0
- package/dist/types/ai-model/common.d.ts +569 -0
- package/dist/types/ai-model/conversation-history.d.ts +18 -0
- package/dist/types/ai-model/index.d.ts +13 -0
- package/dist/types/ai-model/inspect.d.ts +46 -0
- package/dist/types/ai-model/llm-planning.d.ts +11 -0
- package/dist/types/ai-model/prompt/assertion.d.ts +2 -0
- package/dist/types/ai-model/prompt/common.d.ts +2 -0
- package/dist/types/ai-model/prompt/describe.d.ts +1 -0
- package/dist/types/ai-model/prompt/extraction.d.ts +4 -0
- package/dist/types/ai-model/prompt/llm-locator.d.ts +9 -0
- package/dist/types/ai-model/prompt/llm-planning.d.ts +9 -0
- package/dist/types/ai-model/prompt/llm-section-locator.d.ts +6 -0
- package/dist/types/ai-model/prompt/playwright-generator.d.ts +26 -0
- package/dist/types/ai-model/prompt/ui-tars-locator.d.ts +1 -0
- package/dist/types/ai-model/prompt/ui-tars-planning.d.ts +2 -0
- package/dist/types/ai-model/prompt/util.d.ts +47 -0
- package/dist/types/ai-model/prompt/yaml-generator.d.ts +100 -0
- package/dist/types/ai-model/service-caller/index.d.ts +48 -0
- package/dist/types/ai-model/ui-tars-planning.d.ts +59 -0
- package/dist/types/device/index.d.ts +2158 -0
- package/dist/types/image/index.d.ts +1 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/insight/index.d.ts +31 -0
- package/dist/types/insight/utils.d.ts +2 -0
- package/dist/types/report.d.ts +12 -0
- package/dist/types/tree.d.ts +1 -0
- package/dist/types/types.d.ts +414 -0
- package/dist/types/utils.d.ts +40 -0
- package/dist/types/yaml/builder.d.ts +2 -0
- package/dist/types/yaml/index.d.ts +3 -0
- package/dist/types/yaml/player.d.ts +34 -0
- package/dist/types/yaml/utils.d.ts +9 -0
- package/dist/types/yaml.d.ts +178 -0
- package/package.json +108 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DeviceAction } from '../../types';
|
|
2
|
+
import type { TVlModeTypes } from '@rpascene/shared/env';
|
|
3
|
+
import type { ResponseFormatJSONSchema } from 'openai/resources/index';
|
|
4
|
+
export declare const descriptionForAction: (action: DeviceAction<any>, locatorSchemaTypeDescription: string) => string;
|
|
5
|
+
export declare function systemPromptToTaskPlanning({ actionSpace, vlMode, }: {
|
|
6
|
+
actionSpace: DeviceAction<any>[];
|
|
7
|
+
vlMode: TVlModeTypes | undefined;
|
|
8
|
+
}): Promise<string>;
|
|
9
|
+
export declare const planSchema: ResponseFormatJSONSchema;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PromptTemplate } from '@langchain/core/prompts';
|
|
2
|
+
import type { TVlModeTypes } from '@rpascene/shared/env';
|
|
3
|
+
export declare function systemPromptToLocateSection(vlMode: TVlModeTypes | undefined): string;
|
|
4
|
+
export declare const sectionLocatorInstruction: PromptTemplate<{
|
|
5
|
+
sectionDescription: any;
|
|
6
|
+
}, any>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { StreamingAIResponse, StreamingCodeGenerationOptions } from '../../types';
|
|
2
|
+
import type { IModelConfig } from '@rpascene/shared/env';
|
|
3
|
+
import { type ChromeRecordedEvent, type EventCounts, type EventSummary, type InputDescription, type ProcessedEvent, createEventCounts, createMessageContent, extractInputDescriptions, filterEventsByType, getScreenshotsForLLM, prepareEventSummary, processEventsForLLM, validateEvents } from './yaml-generator';
|
|
4
|
+
export interface PlaywrightGenerationOptions {
|
|
5
|
+
testName?: string;
|
|
6
|
+
includeScreenshots?: boolean;
|
|
7
|
+
includeTimestamps?: boolean;
|
|
8
|
+
maxScreenshots?: number;
|
|
9
|
+
description?: string;
|
|
10
|
+
viewportSize?: {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
};
|
|
14
|
+
waitForNetworkIdle?: boolean;
|
|
15
|
+
waitForNetworkIdleTimeout?: number;
|
|
16
|
+
}
|
|
17
|
+
export type { ChromeRecordedEvent, EventCounts, InputDescription, ProcessedEvent, EventSummary, };
|
|
18
|
+
export { getScreenshotsForLLM, filterEventsByType, createEventCounts, extractInputDescriptions, processEventsForLLM, prepareEventSummary, createMessageContent, validateEvents, };
|
|
19
|
+
/**
|
|
20
|
+
* Generates Playwright test code from recorded events
|
|
21
|
+
*/
|
|
22
|
+
export declare const generatePlaywrightTest: (events: ChromeRecordedEvent[], options: PlaywrightGenerationOptions, modelConfig: IModelConfig) => Promise<string>;
|
|
23
|
+
/**
|
|
24
|
+
* Generates Playwright test code from recorded events with streaming support
|
|
25
|
+
*/
|
|
26
|
+
export declare const generatePlaywrightTestStream: (events: ChromeRecordedEvent[], options: PlaywrightGenerationOptions & StreamingCodeGenerationOptions, modelConfig: IModelConfig) => Promise<StreamingAIResponse>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function systemPromptToLocateElementPosition(): string;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { BaseElement, ElementTreeNode, Size, UIContext } from '../../types';
|
|
2
|
+
import type { TVlModeTypes } from '@rpascene/shared/env';
|
|
3
|
+
export declare function describeSize(size: Size): string;
|
|
4
|
+
export declare function describeElement(elements: (Pick<BaseElement, 'rect' | 'content'> & {
|
|
5
|
+
id: string;
|
|
6
|
+
})[]): string;
|
|
7
|
+
export declare const distanceThreshold = 16;
|
|
8
|
+
export declare function elementByPositionWithElementInfo(treeRoot: ElementTreeNode<BaseElement>, position: {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
}, options?: {
|
|
12
|
+
requireStrictDistance?: boolean;
|
|
13
|
+
filterPositionElements?: boolean;
|
|
14
|
+
}): BaseElement | undefined;
|
|
15
|
+
export declare function distance(point1: {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
}, point2: {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
}): number;
|
|
22
|
+
export declare const samplePageDescription = "\nAnd the page is described as follows:\n====================\nThe size of the page: 1280 x 720\nSome of the elements are marked with a rectangle in the screenshot corresponding to the markerId, some are not.\n\nDescription of all the elements in screenshot:\n<div id=\"969f1637\" markerId=\"1\" left=\"100\" top=\"100\" width=\"100\" height=\"100\"> // The markerId indicated by the rectangle label in the screenshot\n <h4 id=\"b211ecb2\" markerId=\"5\" left=\"150\" top=\"150\" width=\"90\" height=\"60\">\n The username is accepted\n </h4>\n ...many more\n</div>\n====================\n";
|
|
23
|
+
export declare function describeUserPage<ElementType extends BaseElement = BaseElement>(context: Omit<UIContext<ElementType>, 'describer'>, opt: {
|
|
24
|
+
truncateTextLength?: number;
|
|
25
|
+
filterNonTextContent?: boolean;
|
|
26
|
+
domIncluded?: boolean | 'visible-only';
|
|
27
|
+
visibleOnly?: boolean;
|
|
28
|
+
vlMode: TVlModeTypes | undefined;
|
|
29
|
+
}): Promise<{
|
|
30
|
+
description: string;
|
|
31
|
+
elementById(idOrIndexId: string): ElementType;
|
|
32
|
+
elementByPosition(position: {
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
}, size: {
|
|
36
|
+
width: number;
|
|
37
|
+
height: number;
|
|
38
|
+
}): BaseElement | undefined;
|
|
39
|
+
insertElementByPosition(position: {
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
}): ElementType;
|
|
43
|
+
size: {
|
|
44
|
+
width: number;
|
|
45
|
+
height: number;
|
|
46
|
+
};
|
|
47
|
+
}>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { StreamingAIResponse, StreamingCodeGenerationOptions } from '../../types';
|
|
2
|
+
import type { IModelConfig } from '@rpascene/shared/env';
|
|
3
|
+
export interface EventCounts {
|
|
4
|
+
navigation: number;
|
|
5
|
+
click: number;
|
|
6
|
+
input: number;
|
|
7
|
+
scroll: number;
|
|
8
|
+
total: number;
|
|
9
|
+
}
|
|
10
|
+
export interface InputDescription {
|
|
11
|
+
description: string;
|
|
12
|
+
value: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ProcessedEvent {
|
|
15
|
+
type: string;
|
|
16
|
+
timestamp: number;
|
|
17
|
+
url?: string;
|
|
18
|
+
title?: string;
|
|
19
|
+
elementDescription?: string;
|
|
20
|
+
value?: string;
|
|
21
|
+
pageInfo?: any;
|
|
22
|
+
elementRect?: any;
|
|
23
|
+
}
|
|
24
|
+
export interface EventSummary {
|
|
25
|
+
testName: string;
|
|
26
|
+
startUrl: string;
|
|
27
|
+
eventCounts: EventCounts;
|
|
28
|
+
urls: string[];
|
|
29
|
+
clickDescriptions: string[];
|
|
30
|
+
inputDescriptions: InputDescription[];
|
|
31
|
+
events: ProcessedEvent[];
|
|
32
|
+
}
|
|
33
|
+
export interface ChromeRecordedEvent {
|
|
34
|
+
type: string;
|
|
35
|
+
timestamp: number;
|
|
36
|
+
url?: string;
|
|
37
|
+
title?: string;
|
|
38
|
+
elementDescription?: string;
|
|
39
|
+
value?: string;
|
|
40
|
+
pageInfo?: any;
|
|
41
|
+
elementRect?: any;
|
|
42
|
+
screenshotBefore?: string;
|
|
43
|
+
screenshotAfter?: string;
|
|
44
|
+
screenshotWithBox?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface YamlGenerationOptions {
|
|
47
|
+
testName?: string;
|
|
48
|
+
includeTimestamps?: boolean;
|
|
49
|
+
maxScreenshots?: number;
|
|
50
|
+
description?: string;
|
|
51
|
+
}
|
|
52
|
+
export interface FilteredEvents {
|
|
53
|
+
navigationEvents: ChromeRecordedEvent[];
|
|
54
|
+
clickEvents: ChromeRecordedEvent[];
|
|
55
|
+
inputEvents: ChromeRecordedEvent[];
|
|
56
|
+
scrollEvents: ChromeRecordedEvent[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Get screenshots from events for LLM context
|
|
60
|
+
*/
|
|
61
|
+
export declare const getScreenshotsForLLM: (events: ChromeRecordedEvent[], maxScreenshots?: number) => string[];
|
|
62
|
+
/**
|
|
63
|
+
* Filter events by type for easier processing
|
|
64
|
+
*/
|
|
65
|
+
export declare const filterEventsByType: (events: ChromeRecordedEvent[]) => FilteredEvents;
|
|
66
|
+
/**
|
|
67
|
+
* Create event counts summary
|
|
68
|
+
*/
|
|
69
|
+
export declare const createEventCounts: (filteredEvents: FilteredEvents, totalEvents: number) => EventCounts;
|
|
70
|
+
/**
|
|
71
|
+
* Extract input descriptions from input events
|
|
72
|
+
*/
|
|
73
|
+
export declare const extractInputDescriptions: (inputEvents: ChromeRecordedEvent[]) => InputDescription[];
|
|
74
|
+
/**
|
|
75
|
+
* Process events for LLM consumption
|
|
76
|
+
*/
|
|
77
|
+
export declare const processEventsForLLM: (events: ChromeRecordedEvent[]) => ProcessedEvent[];
|
|
78
|
+
/**
|
|
79
|
+
* Prepare comprehensive event summary for LLM
|
|
80
|
+
*/
|
|
81
|
+
export declare const prepareEventSummary: (events: ChromeRecordedEvent[], options?: {
|
|
82
|
+
testName?: string;
|
|
83
|
+
maxScreenshots?: number;
|
|
84
|
+
}) => EventSummary;
|
|
85
|
+
/**
|
|
86
|
+
* Create message content for LLM with optional screenshots
|
|
87
|
+
*/
|
|
88
|
+
export declare const createMessageContent: (promptText: string, screenshots?: string[], includeScreenshots?: boolean) => any[];
|
|
89
|
+
/**
|
|
90
|
+
* Validate events before processing
|
|
91
|
+
*/
|
|
92
|
+
export declare const validateEvents: (events: ChromeRecordedEvent[]) => void;
|
|
93
|
+
/**
|
|
94
|
+
* Generates YAML test configuration from recorded events using AI
|
|
95
|
+
*/
|
|
96
|
+
export declare const generateYamlTest: (events: ChromeRecordedEvent[], options: YamlGenerationOptions, modelConfig: IModelConfig) => Promise<string>;
|
|
97
|
+
/**
|
|
98
|
+
* Generates YAML test configuration from recorded events using AI with streaming support
|
|
99
|
+
*/
|
|
100
|
+
export declare const generateYamlTestStream: (events: ChromeRecordedEvent[], options: YamlGenerationOptions & StreamingCodeGenerationOptions, modelConfig: IModelConfig) => Promise<StreamingAIResponse>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type AIUsageInfo } from '../../types';
|
|
2
|
+
import type { StreamingCallback } from '../../types';
|
|
3
|
+
import { type IModelConfig, type TVlModeTypes } from '@rpascene/shared/env';
|
|
4
|
+
import OpenAI from 'openai';
|
|
5
|
+
import type { ChatCompletionMessageParam } from 'openai/resources/index';
|
|
6
|
+
import { AIActionType, type AIArgs } from '../common';
|
|
7
|
+
export interface AIServiceConfig {
|
|
8
|
+
domain: string;
|
|
9
|
+
yht_access_token: string;
|
|
10
|
+
chatType: number;
|
|
11
|
+
model?: string;
|
|
12
|
+
modelCategory: number;
|
|
13
|
+
stream?: number;
|
|
14
|
+
temperature?: number;
|
|
15
|
+
top_p?: number;
|
|
16
|
+
extraParams?: Record<string, any>;
|
|
17
|
+
topic?: string;
|
|
18
|
+
baseURL: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const defaultYhtConfig: AIServiceConfig;
|
|
21
|
+
export declare function callAIOld(messages: ChatCompletionMessageParam[], AIActionTypeValue: AIActionType, modelConfig: IModelConfig, options?: {
|
|
22
|
+
stream?: boolean;
|
|
23
|
+
onChunk?: StreamingCallback;
|
|
24
|
+
}): Promise<{
|
|
25
|
+
content: string;
|
|
26
|
+
usage?: AIUsageInfo;
|
|
27
|
+
isStreamed: boolean;
|
|
28
|
+
}>;
|
|
29
|
+
export declare const getResponseFormat: (modelName: string, AIActionTypeValue: AIActionType) => OpenAI.ChatCompletionCreateParams["response_format"] | OpenAI.ResponseFormatJSONObject;
|
|
30
|
+
export declare function callAIWithObjectResponse<T>(messages: ChatCompletionMessageParam[], AIActionTypeValue: AIActionType, modelConfig: IModelConfig): Promise<{
|
|
31
|
+
content: T;
|
|
32
|
+
usage?: AIUsageInfo;
|
|
33
|
+
}>;
|
|
34
|
+
export declare function callAIWithStringResponse(msgs: AIArgs, AIActionTypeValue: AIActionType, modelConfig: IModelConfig): Promise<{
|
|
35
|
+
content: string;
|
|
36
|
+
usage?: AIUsageInfo;
|
|
37
|
+
}>;
|
|
38
|
+
export declare function extractJSONFromCodeBlock(response: string): string;
|
|
39
|
+
export declare function preprocessDoubaoBboxJson(input: string): string;
|
|
40
|
+
export declare function safeParseJson(input: string, vlMode: TVlModeTypes | undefined): any;
|
|
41
|
+
export declare function callAI(messages: ChatCompletionMessageParam[], AIActionTypeValue: AIActionType, modelConfig: IModelConfig, options?: {
|
|
42
|
+
stream?: boolean;
|
|
43
|
+
onChunk?: StreamingCallback;
|
|
44
|
+
}): Promise<{
|
|
45
|
+
content: string;
|
|
46
|
+
usage?: AIUsageInfo;
|
|
47
|
+
isStreamed: boolean;
|
|
48
|
+
}>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { PlanningAIResponse, Size, UIContext } from '../types';
|
|
2
|
+
import { type IModelConfig, UITarsModelVersion } from '@rpascene/shared/env';
|
|
3
|
+
import type { ConversationHistory } from './conversation-history';
|
|
4
|
+
type ActionType = 'click' | 'drag' | 'type' | 'hotkey' | 'finished' | 'scroll' | 'wait';
|
|
5
|
+
export declare function uiTarsPlanning(userInstruction: string, options: {
|
|
6
|
+
conversationHistory: ConversationHistory;
|
|
7
|
+
context: UIContext;
|
|
8
|
+
modelConfig: IModelConfig;
|
|
9
|
+
}): Promise<PlanningAIResponse>;
|
|
10
|
+
interface BaseAction {
|
|
11
|
+
action_type: ActionType;
|
|
12
|
+
action_inputs: Record<string, any>;
|
|
13
|
+
reflection: string | null;
|
|
14
|
+
thought: string | null;
|
|
15
|
+
}
|
|
16
|
+
interface ClickAction extends BaseAction {
|
|
17
|
+
action_type: 'click';
|
|
18
|
+
action_inputs: {
|
|
19
|
+
start_box: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
interface DragAction extends BaseAction {
|
|
23
|
+
action_type: 'drag';
|
|
24
|
+
action_inputs: {
|
|
25
|
+
start_box: string;
|
|
26
|
+
end_box: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
interface WaitAction extends BaseAction {
|
|
30
|
+
action_type: 'wait';
|
|
31
|
+
action_inputs: {
|
|
32
|
+
time: string;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
interface TypeAction extends BaseAction {
|
|
36
|
+
action_type: 'type';
|
|
37
|
+
action_inputs: {
|
|
38
|
+
content: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
interface HotkeyAction extends BaseAction {
|
|
42
|
+
action_type: 'hotkey';
|
|
43
|
+
action_inputs: {
|
|
44
|
+
key: string;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
interface ScrollAction extends BaseAction {
|
|
48
|
+
action_type: 'scroll';
|
|
49
|
+
action_inputs: {
|
|
50
|
+
direction: 'up' | 'down';
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
interface FinishedAction extends BaseAction {
|
|
54
|
+
action_type: 'finished';
|
|
55
|
+
action_inputs: Record<string, never>;
|
|
56
|
+
}
|
|
57
|
+
export type Action = ClickAction | DragAction | TypeAction | HotkeyAction | ScrollAction | FinishedAction | WaitAction;
|
|
58
|
+
export declare function resizeImageForUiTars(imageBase64: string, size: Size, uiTarsVersion: UITarsModelVersion | undefined): Promise<string>;
|
|
59
|
+
export {};
|