@iyulab/chat-components 0.4.0 → 0.5.1
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/CHANGELOG.md +83 -52
- package/README.md +133 -16
- package/dist/_virtual/_@oxc-project_runtime@0.124.0/helpers/decorate.js +9 -0
- package/dist/_virtual/_@oxc-project_runtime@0.124.0/helpers/decorateMetadata.js +6 -0
- package/dist/_virtual/_glob-assets_raw/intent-prompt.md.1907474e.js +4 -0
- package/dist/_virtual/_glob-assets_raw/view-prompt.md.e0dbcffe.js +4 -0
- package/dist/components/blocks/UCodeBlock.d.ts +24 -2
- package/dist/components/blocks/UCodeBlock.js +65 -2
- package/dist/components/blocks/UCodeBlock.styles.js +4 -4
- package/dist/components/blocks/UFileBlock.d.ts +33 -0
- package/dist/components/blocks/UFileBlock.js +154 -0
- package/dist/components/blocks/{UFilesBlock.styles.js → UFileBlock.styles.js} +12 -90
- package/dist/components/blocks/UJsonBlock.d.ts +44 -2
- package/dist/components/blocks/UJsonBlock.js +128 -3
- package/dist/components/blocks/UJsonBlock.styles.js +4 -4
- package/dist/components/blocks/UMarkedBlock.d.ts +44 -2
- package/dist/components/blocks/UMarkedBlock.js +154 -4
- package/dist/components/blocks/UMarkedBlock.styles.js +4 -4
- package/dist/components/blocks/URefBlock.d.ts +16 -2
- package/dist/components/blocks/URefBlock.js +58 -3
- package/dist/components/blocks/URefBlock.styles.js +4 -4
- package/dist/components/blocks/UTableBlock.d.ts +47 -2
- package/dist/components/blocks/UTableBlock.js +197 -4
- package/dist/components/blocks/UTableBlock.styles.js +4 -5
- package/dist/components/blocks/UTextBlock.d.ts +36 -2
- package/dist/components/blocks/UTextBlock.js +94 -4
- package/dist/components/blocks/UTextBlock.styles.js +4 -4
- package/dist/components/blocks/UThinkBlock.d.ts +30 -2
- package/dist/components/blocks/UThinkBlock.js +86 -4
- package/dist/components/blocks/UThinkBlock.styles.js +4 -4
- package/dist/components/blocks/UToolBlock.d.ts +19 -2
- package/dist/components/blocks/UToolBlock.js +68 -3
- package/dist/components/blocks/UToolBlock.styles.js +4 -4
- package/dist/components/buttons/UAttachButton.d.ts +21 -2
- package/dist/components/buttons/UAttachButton.js +61 -3
- package/dist/components/buttons/UAttachButton.styles.js +4 -4
- package/dist/components/buttons/UCopyButton.d.ts +19 -2
- package/dist/components/buttons/UCopyButton.js +57 -3
- package/dist/components/buttons/UCopyButton.styles.js +4 -4
- package/dist/components/buttons/UVoteButton.d.ts +14 -3
- package/dist/components/buttons/UVoteButton.js +62 -3
- package/dist/components/buttons/UVoteButton.styles.js +4 -4
- package/dist/components/{actions/UQuestionAction.component.d.ts → intents/UQuestionIntent.d.ts} +6 -2
- package/dist/components/intents/UQuestionIntent.js +41 -0
- package/dist/components/{actions/UQuestionAction.styles.js → intents/UQuestionIntent.styles.js} +4 -6
- package/dist/components/message/UMessage.d.ts +18 -2
- package/dist/components/message/UMessage.js +47 -2
- package/dist/components/message/UMessage.styles.js +4 -4
- package/dist/components/prompt/UPrompt.d.ts +37 -2
- package/dist/components/prompt/UPrompt.js +139 -2
- package/dist/components/prompt/UPrompt.styles.js +15 -5
- package/dist/components/references/URefCard.d.ts +30 -2
- package/dist/components/references/URefCard.js +97 -2
- package/dist/components/references/URefCard.styles.js +4 -4
- package/dist/components/references/URefCardGroup.d.ts +25 -2
- package/dist/components/references/URefCardGroup.js +69 -4
- package/dist/components/references/URefCardGroup.styles.js +4 -4
- package/dist/components/references/URefTag.d.ts +12 -2
- package/dist/components/references/URefTag.js +37 -2
- package/dist/components/references/URefTag.styles.js +4 -4
- package/dist/components/{widgets/UChartWidget.component.d.ts → views/UChartView.d.ts} +7 -4
- package/dist/components/views/UChartView.js +167 -0
- package/dist/components/{widgets/UChartWidget.styles.js → views/UChartView.styles.js} +4 -4
- package/dist/components/{widgets/UImagesWidget.component.d.ts → views/UImagesView.d.ts} +7 -4
- package/dist/components/views/UImagesView.js +144 -0
- package/dist/components/{widgets/UImagesWidget.styles.js → views/UImagesView.styles.js} +6 -5
- package/dist/components/{widgets/UMapWidget.component.d.ts → views/UMapView.d.ts} +7 -3
- package/dist/components/views/UMapView.js +45 -0
- package/dist/components/{widgets/UMapWidget.styles.js → views/UMapView.styles.js} +4 -4
- package/dist/components/{widgets/UVideoWidget.component.d.ts → views/UVideoView.d.ts} +7 -3
- package/dist/components/views/UVideoView.js +81 -0
- package/dist/components/{widgets/UVideoWidget.styles.js → views/UVideoView.styles.js} +4 -4
- package/dist/components/{widgets/UWidget.component.d.ts → views/UView.d.ts} +8 -5
- package/dist/components/views/UView.js +113 -0
- package/dist/components/{widgets/UWidget.styles.js → views/UView.styles.js} +4 -4
- package/dist/events/AttachEvent.d.ts +9 -0
- package/dist/events/ChoiceEvent.d.ts +9 -0
- package/dist/events/SendEvent.d.ts +21 -0
- package/dist/events/StopEvent.d.ts +17 -0
- package/dist/index.d.ts +13 -16
- package/dist/index.js +28 -56
- package/dist/react/UAttachButton.d.ts +11 -0
- package/dist/react/UAttachButton.js +12 -0
- package/dist/react/UChartView.d.ts +9 -0
- package/dist/react/UChartView.js +10 -0
- package/dist/react/UCodeBlock.d.ts +9 -0
- package/dist/react/UCodeBlock.js +10 -0
- package/dist/react/UCopyButton.d.ts +9 -0
- package/dist/react/UCopyButton.js +10 -0
- package/dist/react/UFileBlock.d.ts +11 -0
- package/dist/react/UFileBlock.js +12 -0
- package/dist/react/UImagesView.d.ts +9 -0
- package/dist/react/UImagesView.js +10 -0
- package/dist/react/UJsonBlock.d.ts +9 -0
- package/dist/react/UJsonBlock.js +10 -0
- package/dist/react/UMapView.d.ts +9 -0
- package/dist/react/UMapView.js +10 -0
- package/dist/react/UMarkedBlock.d.ts +9 -0
- package/dist/react/UMarkedBlock.js +10 -0
- package/dist/react/UMessage.d.ts +9 -0
- package/dist/react/UMessage.js +10 -0
- package/dist/react/UPrompt.d.ts +13 -0
- package/dist/react/UPrompt.js +13 -0
- package/dist/react/UQuestionIntent.d.ts +11 -0
- package/dist/react/UQuestionIntent.js +12 -0
- package/dist/react/URefBlock.d.ts +9 -0
- package/dist/react/URefBlock.js +10 -0
- package/dist/react/URefCard.d.ts +9 -0
- package/dist/react/URefCard.js +10 -0
- package/dist/react/URefCardGroup.d.ts +9 -0
- package/dist/react/URefCardGroup.js +10 -0
- package/dist/react/URefTag.d.ts +9 -0
- package/dist/react/URefTag.js +10 -0
- package/dist/react/UTableBlock.d.ts +9 -0
- package/dist/react/UTableBlock.js +10 -0
- package/dist/react/UTextBlock.d.ts +9 -0
- package/dist/react/UTextBlock.js +10 -0
- package/dist/react/UThinkBlock.d.ts +9 -0
- package/dist/react/UThinkBlock.js +10 -0
- package/dist/react/UToolBlock.d.ts +9 -0
- package/dist/react/UToolBlock.js +10 -0
- package/dist/react/UVideoView.d.ts +9 -0
- package/dist/react/UVideoView.js +10 -0
- package/dist/react/UView.d.ts +9 -0
- package/dist/react/UView.js +10 -0
- package/dist/react/UVoteButton.d.ts +9 -0
- package/dist/react/UVoteButton.js +10 -0
- package/dist/react/index.d.ts +23 -0
- package/dist/react/index.js +23 -0
- package/dist/types/BlockItem.d.ts +21 -32
- package/dist/types/Intents.d.ts +26 -0
- package/dist/types/Intents.js +30 -0
- package/dist/types/{Widgets.d.ts → Views.d.ts} +8 -8
- package/dist/types/Views.js +150 -0
- package/dist/utilities/IntentPromptBuilder.d.ts +40 -0
- package/dist/utilities/IntentPromptBuilder.js +95 -0
- package/dist/utilities/ViewPromptBuilder.d.ts +28 -0
- package/dist/utilities/ViewPromptBuilder.js +76 -0
- package/dist/utilities/dom-agent/DOMAgent.d.ts +74 -0
- package/dist/utilities/dom-agent/DOMController.d.ts +78 -0
- package/dist/utilities/dom-agent/DOMPromptBuilder.d.ts +54 -0
- package/dist/utilities/dom-agent/DOMScanner.d.ts +83 -0
- package/dist/utilities/dom-agent/index.d.ts +9 -0
- package/dist/utilities/dom-agent/types.d.ts +209 -0
- package/package.json +33 -16
- package/skills/iyulab-chat-components/SKILL.md +107 -0
- package/skills/iyulab-chat-components/references/components/attach-button.md +69 -0
- package/skills/iyulab-chat-components/references/components/chart-view.md +65 -0
- package/skills/iyulab-chat-components/references/components/code-block.md +42 -0
- package/skills/iyulab-chat-components/references/components/copy-button.md +46 -0
- package/skills/iyulab-chat-components/references/components/file-block.md +64 -0
- package/skills/iyulab-chat-components/references/components/images-view.md +63 -0
- package/skills/iyulab-chat-components/references/components/json-block.md +41 -0
- package/skills/iyulab-chat-components/references/components/map-view.md +54 -0
- package/skills/iyulab-chat-components/references/components/marked-block.md +53 -0
- package/skills/iyulab-chat-components/references/components/message.md +60 -0
- package/skills/iyulab-chat-components/references/components/prompt.md +102 -0
- package/skills/iyulab-chat-components/references/components/question-intent.md +75 -0
- package/skills/iyulab-chat-components/references/components/ref-block.md +45 -0
- package/skills/iyulab-chat-components/references/components/ref-card-group.md +41 -0
- package/skills/iyulab-chat-components/references/components/ref-card.md +48 -0
- package/skills/iyulab-chat-components/references/components/ref-tag.md +40 -0
- package/skills/iyulab-chat-components/references/components/table-block.md +63 -0
- package/skills/iyulab-chat-components/references/components/text-block.md +59 -0
- package/skills/iyulab-chat-components/references/components/think-block.md +48 -0
- package/skills/iyulab-chat-components/references/components/tool-block.md +57 -0
- package/skills/iyulab-chat-components/references/components/video-view.md +55 -0
- package/skills/iyulab-chat-components/references/components/view.md +51 -0
- package/skills/iyulab-chat-components/references/components/vote-button.md +60 -0
- package/skills/iyulab-chat-components/references/types.md +115 -0
- package/skills/iyulab-chat-components/references/usage.md +254 -0
- package/skills/iyulab-chat-components/references/utilities/intent-prompt-builder.md +123 -0
- package/skills/iyulab-chat-components/references/utilities/view-prompt-builder.md +112 -0
- package/dist/assets/action-prompt.md.js +0 -3
- package/dist/assets/widget-prompt.md.js +0 -3
- package/dist/components/actions/UQuestionAction.component.js +0 -58
- package/dist/components/actions/UQuestionAction.d.ts +0 -7
- package/dist/components/actions/UQuestionAction.js +0 -5
- package/dist/components/blocks/UCodeBlock.component.d.ts +0 -25
- package/dist/components/blocks/UCodeBlock.component.js +0 -88
- package/dist/components/blocks/UFilesBlock.component.d.ts +0 -22
- package/dist/components/blocks/UFilesBlock.component.js +0 -192
- package/dist/components/blocks/UFilesBlock.d.ts +0 -7
- package/dist/components/blocks/UFilesBlock.js +0 -5
- package/dist/components/blocks/UJsonBlock.component.d.ts +0 -45
- package/dist/components/blocks/UJsonBlock.component.js +0 -140
- package/dist/components/blocks/UMarkedBlock.component.d.ts +0 -40
- package/dist/components/blocks/UMarkedBlock.component.js +0 -159
- package/dist/components/blocks/URefBlock.component.d.ts +0 -17
- package/dist/components/blocks/URefBlock.component.js +0 -73
- package/dist/components/blocks/UTableBlock.component.d.ts +0 -49
- package/dist/components/blocks/UTableBlock.component.js +0 -228
- package/dist/components/blocks/UTextBlock.component.d.ts +0 -37
- package/dist/components/blocks/UTextBlock.component.js +0 -123
- package/dist/components/blocks/UThinkBlock.component.d.ts +0 -23
- package/dist/components/blocks/UThinkBlock.component.js +0 -90
- package/dist/components/blocks/UToolBlock.component.d.ts +0 -20
- package/dist/components/blocks/UToolBlock.component.js +0 -80
- package/dist/components/buttons/UAttachButton.component.d.ts +0 -22
- package/dist/components/buttons/UAttachButton.component.js +0 -89
- package/dist/components/buttons/UCopyButton.component.d.ts +0 -20
- package/dist/components/buttons/UCopyButton.component.js +0 -81
- package/dist/components/buttons/UReportButton.component.d.ts +0 -9
- package/dist/components/buttons/UReportButton.component.js +0 -36
- package/dist/components/buttons/UReportButton.d.ts +0 -7
- package/dist/components/buttons/UReportButton.js +0 -5
- package/dist/components/buttons/UReportButton.styles.js +0 -14
- package/dist/components/buttons/URetryButton.component.d.ts +0 -11
- package/dist/components/buttons/URetryButton.component.js +0 -53
- package/dist/components/buttons/URetryButton.d.ts +0 -7
- package/dist/components/buttons/URetryButton.js +0 -5
- package/dist/components/buttons/URetryButton.styles.js +0 -26
- package/dist/components/buttons/UShareButton.component.d.ts +0 -9
- package/dist/components/buttons/UShareButton.component.js +0 -36
- package/dist/components/buttons/UShareButton.d.ts +0 -7
- package/dist/components/buttons/UShareButton.js +0 -5
- package/dist/components/buttons/UShareButton.styles.js +0 -14
- package/dist/components/buttons/UVoteButton.component.d.ts +0 -15
- package/dist/components/buttons/UVoteButton.component.js +0 -73
- package/dist/components/message/UMessage.component.d.ts +0 -19
- package/dist/components/message/UMessage.component.js +0 -56
- package/dist/components/prompt/UPrompt.component.d.ts +0 -25
- package/dist/components/prompt/UPrompt.component.js +0 -113
- package/dist/components/references/URefCard.component.d.ts +0 -27
- package/dist/components/references/URefCard.component.js +0 -109
- package/dist/components/references/URefCardGroup.component.d.ts +0 -26
- package/dist/components/references/URefCardGroup.component.js +0 -88
- package/dist/components/references/URefTag.component.d.ts +0 -13
- package/dist/components/references/URefTag.component.js +0 -54
- package/dist/components/widgets/UChartWidget.component.js +0 -180
- package/dist/components/widgets/UChartWidget.d.ts +0 -7
- package/dist/components/widgets/UChartWidget.js +0 -5
- package/dist/components/widgets/UImagesWidget.component.js +0 -164
- package/dist/components/widgets/UImagesWidget.d.ts +0 -7
- package/dist/components/widgets/UImagesWidget.js +0 -5
- package/dist/components/widgets/UMapWidget.component.js +0 -65
- package/dist/components/widgets/UMapWidget.d.ts +0 -7
- package/dist/components/widgets/UMapWidget.js +0 -5
- package/dist/components/widgets/UMapWidget.styles.d.ts +0 -1
- package/dist/components/widgets/UVideoWidget.component.js +0 -106
- package/dist/components/widgets/UVideoWidget.d.ts +0 -7
- package/dist/components/widgets/UVideoWidget.js +0 -5
- package/dist/components/widgets/UVideoWidget.styles.d.ts +0 -1
- package/dist/components/widgets/UWidget.component.js +0 -140
- package/dist/components/widgets/UWidget.d.ts +0 -7
- package/dist/components/widgets/UWidget.js +0 -5
- package/dist/components/widgets/UWidget.styles.d.ts +0 -1
- package/dist/events/UCancelEvent.d.ts +0 -6
- package/dist/events/USubmitEvent.d.ts +0 -6
- package/dist/types/Actions.d.ts +0 -24
- package/dist/types/Actions.js +0 -34
- package/dist/types/Widgets.js +0 -115
- package/dist/utilities/ActionPromptBuilder.d.ts +0 -40
- package/dist/utilities/ActionPromptBuilder.js +0 -93
- package/dist/utilities/WidgetPromptBuilder.d.ts +0 -28
- package/dist/utilities/WidgetPromptBuilder.js +0 -87
- package/dist/utilities/converters.d.ts +0 -9
- package/dist/utilities/converters.js +0 -19
- /package/dist/components/{actions/UQuestionAction.styles.d.ts → blocks/UFileBlock.styles.d.ts} +0 -0
- /package/dist/components/{blocks/UFilesBlock.styles.d.ts → intents/UQuestionIntent.styles.d.ts} +0 -0
- /package/dist/components/{buttons/UReportButton.styles.d.ts → views/UChartView.styles.d.ts} +0 -0
- /package/dist/components/{buttons/URetryButton.styles.d.ts → views/UImagesView.styles.d.ts} +0 -0
- /package/dist/components/{buttons/UShareButton.styles.d.ts → views/UMapView.styles.d.ts} +0 -0
- /package/dist/components/{widgets/UChartWidget.styles.d.ts → views/UVideoView.styles.d.ts} +0 -0
- /package/dist/components/{widgets/UImagesWidget.styles.d.ts → views/UView.styles.d.ts} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { JsonSchema } from './JsonSchema.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* View를 정의하는 구조체
|
|
4
4
|
*/
|
|
5
|
-
export interface
|
|
5
|
+
export interface ViewDefinition {
|
|
6
6
|
/** 등록할 커스텀 엘리먼트 클래스 */
|
|
7
7
|
element: CustomElementConstructor;
|
|
8
8
|
/** 등록할 커스텀 엘리먼트 태그명 */
|
|
@@ -15,9 +15,9 @@ export interface WidgetDefinition {
|
|
|
15
15
|
required?: string[];
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* 프리셋
|
|
18
|
+
* 프리셋 View 비트 플래그
|
|
19
19
|
*/
|
|
20
|
-
export declare enum
|
|
20
|
+
export declare enum PresetView {
|
|
21
21
|
Images = 1,
|
|
22
22
|
Video = 2,
|
|
23
23
|
Map = 8,
|
|
@@ -25,10 +25,10 @@ export declare enum PresetWidget {
|
|
|
25
25
|
All = 27
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
* 전체 프리셋
|
|
28
|
+
* 전체 프리셋 View 플래그 목록
|
|
29
29
|
*/
|
|
30
|
-
export declare const
|
|
30
|
+
export declare const PRESET_VIEW_LIST: readonly [PresetView.Images, PresetView.Video, PresetView.Map, PresetView.Chart];
|
|
31
31
|
/**
|
|
32
|
-
* 프리셋
|
|
32
|
+
* 프리셋 View 정의
|
|
33
33
|
*/
|
|
34
|
-
export declare const
|
|
34
|
+
export declare const PRESET_VIEW_DEFINITIONS: Map<PresetView, ViewDefinition>;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { UImagesView } from "../components/views/UImagesView.js";
|
|
2
|
+
import { UVideoView } from "../components/views/UVideoView.js";
|
|
3
|
+
import { UMapView } from "../components/views/UMapView.js";
|
|
4
|
+
import { UChartView } from "../components/views/UChartView.js";
|
|
5
|
+
//#region src/types/Views.ts
|
|
6
|
+
/**
|
|
7
|
+
* 프리셋 View 비트 플래그
|
|
8
|
+
*/
|
|
9
|
+
var PresetView = /* @__PURE__ */ function(PresetView) {
|
|
10
|
+
PresetView[PresetView["Images"] = 1] = "Images";
|
|
11
|
+
PresetView[PresetView["Video"] = 2] = "Video";
|
|
12
|
+
PresetView[PresetView["Map"] = 8] = "Map";
|
|
13
|
+
PresetView[PresetView["Chart"] = 16] = "Chart";
|
|
14
|
+
PresetView[PresetView["All"] = 27] = "All";
|
|
15
|
+
return PresetView;
|
|
16
|
+
}({});
|
|
17
|
+
/**
|
|
18
|
+
* 전체 프리셋 View 플래그 목록
|
|
19
|
+
*/
|
|
20
|
+
var PRESET_VIEW_LIST = [
|
|
21
|
+
PresetView.Images,
|
|
22
|
+
PresetView.Video,
|
|
23
|
+
PresetView.Map,
|
|
24
|
+
PresetView.Chart
|
|
25
|
+
];
|
|
26
|
+
/**
|
|
27
|
+
* 프리셋 View 정의
|
|
28
|
+
*/
|
|
29
|
+
var PRESET_VIEW_DEFINITIONS = new Map([
|
|
30
|
+
[PresetView.Images, {
|
|
31
|
+
element: UImagesView,
|
|
32
|
+
tag: "u-images-view",
|
|
33
|
+
description: "Display multiple images in a scrollable gallery",
|
|
34
|
+
properties: { items: {
|
|
35
|
+
type: "array",
|
|
36
|
+
items: {
|
|
37
|
+
type: "object",
|
|
38
|
+
properties: {
|
|
39
|
+
src: {
|
|
40
|
+
type: "string",
|
|
41
|
+
description: "Image URL"
|
|
42
|
+
},
|
|
43
|
+
alt: {
|
|
44
|
+
type: "string",
|
|
45
|
+
description: "Alt text for accessibility"
|
|
46
|
+
},
|
|
47
|
+
caption: {
|
|
48
|
+
type: "string",
|
|
49
|
+
description: "Image caption"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
required: ["src"]
|
|
53
|
+
},
|
|
54
|
+
minItems: 1,
|
|
55
|
+
description: "Array of image objects"
|
|
56
|
+
} },
|
|
57
|
+
required: ["items"]
|
|
58
|
+
}],
|
|
59
|
+
[PresetView.Video, {
|
|
60
|
+
element: UVideoView,
|
|
61
|
+
tag: "u-video-view",
|
|
62
|
+
description: "Embed video from YouTube, Vimeo, or Others. Provide a direct video file URL or a platform URL.",
|
|
63
|
+
properties: {
|
|
64
|
+
src: {
|
|
65
|
+
type: "string",
|
|
66
|
+
description: "Video URL (YouTube, Vimeo, or direct video file URL)"
|
|
67
|
+
},
|
|
68
|
+
poster: {
|
|
69
|
+
type: "string",
|
|
70
|
+
description: "Poster image URL"
|
|
71
|
+
},
|
|
72
|
+
ratio: {
|
|
73
|
+
type: "string",
|
|
74
|
+
enum: [
|
|
75
|
+
"16:9",
|
|
76
|
+
"4:3",
|
|
77
|
+
"1:1"
|
|
78
|
+
],
|
|
79
|
+
default: "16:9",
|
|
80
|
+
description: "Video aspect ratio"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
required: ["src"]
|
|
84
|
+
}],
|
|
85
|
+
[PresetView.Map, {
|
|
86
|
+
element: UMapView,
|
|
87
|
+
tag: "u-map-view",
|
|
88
|
+
description: "Display a map showing a single location",
|
|
89
|
+
properties: {
|
|
90
|
+
lat: {
|
|
91
|
+
type: "number",
|
|
92
|
+
description: "Latitude coordinate"
|
|
93
|
+
},
|
|
94
|
+
lng: {
|
|
95
|
+
type: "number",
|
|
96
|
+
description: "Longitude coordinate"
|
|
97
|
+
},
|
|
98
|
+
zoom: {
|
|
99
|
+
type: "integer",
|
|
100
|
+
minimum: 1,
|
|
101
|
+
maximum: 20,
|
|
102
|
+
default: 15,
|
|
103
|
+
description: "Map zoom level"
|
|
104
|
+
},
|
|
105
|
+
label: {
|
|
106
|
+
type: "string",
|
|
107
|
+
description: "Location title"
|
|
108
|
+
},
|
|
109
|
+
description: {
|
|
110
|
+
type: "string",
|
|
111
|
+
description: "Location description"
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
required: ["lat", "lng"]
|
|
115
|
+
}],
|
|
116
|
+
[PresetView.Chart, {
|
|
117
|
+
element: UChartView,
|
|
118
|
+
tag: "u-chart-view",
|
|
119
|
+
description: "Display charts using Chart.js v4 format. Use standard Chart.js configuration (type, data, options). The View accepts the exact same structure as Chart.js - no conversion needed.",
|
|
120
|
+
properties: {
|
|
121
|
+
type: {
|
|
122
|
+
type: "string",
|
|
123
|
+
enum: [
|
|
124
|
+
"bar",
|
|
125
|
+
"line",
|
|
126
|
+
"pie",
|
|
127
|
+
"doughnut",
|
|
128
|
+
"radar",
|
|
129
|
+
"polarArea",
|
|
130
|
+
"bubble",
|
|
131
|
+
"scatter"
|
|
132
|
+
],
|
|
133
|
+
description: "Chart.js chart type"
|
|
134
|
+
},
|
|
135
|
+
data: {
|
|
136
|
+
type: "object",
|
|
137
|
+
description: "Chart.js data configuration",
|
|
138
|
+
additionalProperties: true
|
|
139
|
+
},
|
|
140
|
+
options: {
|
|
141
|
+
type: "object",
|
|
142
|
+
description: "Chart.js options configuration (optional)",
|
|
143
|
+
additionalProperties: true
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
required: ["type", "data"]
|
|
147
|
+
}]
|
|
148
|
+
]);
|
|
149
|
+
//#endregion
|
|
150
|
+
export { PRESET_VIEW_DEFINITIONS, PRESET_VIEW_LIST, PresetView };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { PresetIntent, IntentDefinition, IntentSchema } from '../types/Intents.js';
|
|
2
|
+
/**
|
|
3
|
+
* Intent 등록, LLM 인스트럭션 빌드, 텍스트 추출을 통합 제공하는 유틸리티
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* IntentPromptBuilder.use(PresetIntent.All);
|
|
7
|
+
* const prompt = IntentPromptBuilder.buildPrompt();
|
|
8
|
+
* const [clean, templates] = IntentPromptBuilder.extractPrompt(llmText);
|
|
9
|
+
*/
|
|
10
|
+
export declare class IntentPromptBuilder {
|
|
11
|
+
private static _instance;
|
|
12
|
+
private intents;
|
|
13
|
+
/**
|
|
14
|
+
* 싱글톤 인스턴스를 반환합니다. 최초 호출 시 인스턴스가 생성됩니다.
|
|
15
|
+
*/
|
|
16
|
+
static get instance(): IntentPromptBuilder;
|
|
17
|
+
/**
|
|
18
|
+
* Intent 정의를 등록합니다. 같은 type이 이미 등록되어 있으면 에러를 던집니다.
|
|
19
|
+
* @throws {Error} 같은 type의 intent가 이미 등록된 경우
|
|
20
|
+
*/
|
|
21
|
+
add(definition: IntentDefinition): IntentPromptBuilder;
|
|
22
|
+
/**
|
|
23
|
+
* 미리 정의된 프리셋 Intent를 등록합니다.
|
|
24
|
+
* @example
|
|
25
|
+
* IntentPromptBuilder.use(PresetIntent.Questions);
|
|
26
|
+
* IntentPromptBuilder.use(PresetIntent.All);
|
|
27
|
+
*/
|
|
28
|
+
use(flags: PresetIntent): IntentPromptBuilder;
|
|
29
|
+
/**
|
|
30
|
+
* 등록된 intent들에 대한 LLM 시스템 프롬프트 인스트럭션을 생성합니다.
|
|
31
|
+
*/
|
|
32
|
+
build(): string;
|
|
33
|
+
/**
|
|
34
|
+
* LLM 응답 텍스트에서 `intent-json` 코드블록을 추출합니다.
|
|
35
|
+
*
|
|
36
|
+
* @param value - LLM 응답 텍스트
|
|
37
|
+
* @returns `[intents, rest]` — intents는 파싱된 JSON 객체 배열, rest는 블록이 제거된 나머지 텍스트
|
|
38
|
+
*/
|
|
39
|
+
parse(value: string): [IntentSchema[], string];
|
|
40
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { PRESET_INTENT_DEFINITIONS, PRESET_INTENT_LIST } from "../types/Intents.js";
|
|
2
|
+
import intent_prompt_md_default from "../_virtual/_glob-assets_raw/intent-prompt.md.1907474e.js";
|
|
3
|
+
//#region src/utilities/IntentPromptBuilder.ts
|
|
4
|
+
/**
|
|
5
|
+
* Intent 등록, LLM 인스트럭션 빌드, 텍스트 추출을 통합 제공하는 유틸리티
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* IntentPromptBuilder.use(PresetIntent.All);
|
|
9
|
+
* const prompt = IntentPromptBuilder.buildPrompt();
|
|
10
|
+
* const [clean, templates] = IntentPromptBuilder.extractPrompt(llmText);
|
|
11
|
+
*/
|
|
12
|
+
var IntentPromptBuilder = class IntentPromptBuilder {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.intents = /* @__PURE__ */ new Map();
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 싱글톤 인스턴스를 반환합니다. 최초 호출 시 인스턴스가 생성됩니다.
|
|
18
|
+
*/
|
|
19
|
+
static get instance() {
|
|
20
|
+
if (!this._instance) this._instance = new IntentPromptBuilder();
|
|
21
|
+
return this._instance;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Intent 정의를 등록합니다. 같은 type이 이미 등록되어 있으면 에러를 던집니다.
|
|
25
|
+
* @throws {Error} 같은 type의 intent가 이미 등록된 경우
|
|
26
|
+
*/
|
|
27
|
+
add(definition) {
|
|
28
|
+
if (this.intents.has(definition.type)) throw new Error(`Intent with type "${definition.type}" is already registered.`);
|
|
29
|
+
this.intents.set(definition.type, definition);
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 미리 정의된 프리셋 Intent를 등록합니다.
|
|
34
|
+
* @example
|
|
35
|
+
* IntentPromptBuilder.use(PresetIntent.Questions);
|
|
36
|
+
* IntentPromptBuilder.use(PresetIntent.All);
|
|
37
|
+
*/
|
|
38
|
+
use(flags) {
|
|
39
|
+
for (const flag of PRESET_INTENT_LIST) if (flags & flag) {
|
|
40
|
+
const definition = PRESET_INTENT_DEFINITIONS.get(flag);
|
|
41
|
+
if (definition && !this.intents.has(definition.type)) this.intents.set(definition.type, definition);
|
|
42
|
+
}
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 등록된 intent들에 대한 LLM 시스템 프롬프트 인스트럭션을 생성합니다.
|
|
47
|
+
*/
|
|
48
|
+
build() {
|
|
49
|
+
if (this.intents.size === 0) return "";
|
|
50
|
+
const docs = Array.from(this.intents.values()).map((def) => {
|
|
51
|
+
return [
|
|
52
|
+
`### ${def.type}`,
|
|
53
|
+
"",
|
|
54
|
+
"**JSON Schema:**",
|
|
55
|
+
"```intent-json",
|
|
56
|
+
JSON.stringify({
|
|
57
|
+
type: "object",
|
|
58
|
+
description: def.description,
|
|
59
|
+
properties: {
|
|
60
|
+
type: {
|
|
61
|
+
type: "string",
|
|
62
|
+
enum: [def.type]
|
|
63
|
+
},
|
|
64
|
+
properties: {
|
|
65
|
+
type: "object",
|
|
66
|
+
properties: def.properties || {},
|
|
67
|
+
required: def.required || []
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
required: ["type"]
|
|
71
|
+
}, null, 2),
|
|
72
|
+
"```"
|
|
73
|
+
].join("\n");
|
|
74
|
+
}).join("\n\n---\n\n");
|
|
75
|
+
return intent_prompt_md_default.replace("{{INTENT_DOCS}}", docs);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* LLM 응답 텍스트에서 `intent-json` 코드블록을 추출합니다.
|
|
79
|
+
*
|
|
80
|
+
* @param value - LLM 응답 텍스트
|
|
81
|
+
* @returns `[intents, rest]` — intents는 파싱된 JSON 객체 배열, rest는 블록이 제거된 나머지 텍스트
|
|
82
|
+
*/
|
|
83
|
+
parse(value) {
|
|
84
|
+
const pattern = /```(?:intent-json)\s*([\s\S]*?)```/g;
|
|
85
|
+
const intents = [];
|
|
86
|
+
return [intents, value.replace(pattern, (_, json) => {
|
|
87
|
+
try {
|
|
88
|
+
intents.push(JSON.parse(json.trim()));
|
|
89
|
+
} catch {}
|
|
90
|
+
return "";
|
|
91
|
+
}).trim()];
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
//#endregion
|
|
95
|
+
export { IntentPromptBuilder };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PresetView, ViewDefinition } from '../types/Views.js';
|
|
2
|
+
/**
|
|
3
|
+
* 뷰 등록, LLM 인스트럭션 빌드, HTML 렌더링을 통합 제공하는 유틸리티
|
|
4
|
+
*/
|
|
5
|
+
export declare class ViewPromptBuilder {
|
|
6
|
+
private static _instance;
|
|
7
|
+
private views;
|
|
8
|
+
/**
|
|
9
|
+
* 싱글톤 인스턴스를 반환합니다. 최초 호출 시 인스턴스가 생성됩니다.
|
|
10
|
+
*/
|
|
11
|
+
static get instance(): ViewPromptBuilder;
|
|
12
|
+
/**
|
|
13
|
+
* 뷰 정의를 등록합니다. 같은 이름의 뷰이 이미 등록되어 있으면 에러를 던집니다.
|
|
14
|
+
* @throws {Error} 같은 이름의 뷰이 이미 등록된 경우 또는 같은 태그의 커스텀 요소가 다른 클래스에 의해 정의된 경우
|
|
15
|
+
*/
|
|
16
|
+
add(definition: ViewDefinition): ViewPromptBuilder;
|
|
17
|
+
/**
|
|
18
|
+
* 미리 정의된 프리셋 뷰을 사용합니다.
|
|
19
|
+
* @example
|
|
20
|
+
* ViewRegistry.use(View.Images | View.Chart);
|
|
21
|
+
* ViewRegistry.use(View.All);
|
|
22
|
+
*/
|
|
23
|
+
use(flags: PresetView): ViewPromptBuilder;
|
|
24
|
+
/**
|
|
25
|
+
* 등록된 뷰들에 대한 LLM 인스트럭션 문자열을 생성합니다.
|
|
26
|
+
*/
|
|
27
|
+
build(): string;
|
|
28
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { PRESET_VIEW_DEFINITIONS, PRESET_VIEW_LIST } from "../types/Views.js";
|
|
2
|
+
import view_prompt_md_default from "../_virtual/_glob-assets_raw/view-prompt.md.e0dbcffe.js";
|
|
3
|
+
//#region src/utilities/ViewPromptBuilder.ts
|
|
4
|
+
/**
|
|
5
|
+
* 뷰 등록, LLM 인스트럭션 빌드, HTML 렌더링을 통합 제공하는 유틸리티
|
|
6
|
+
*/
|
|
7
|
+
var ViewPromptBuilder = class ViewPromptBuilder {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.views = /* @__PURE__ */ new Map();
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 싱글톤 인스턴스를 반환합니다. 최초 호출 시 인스턴스가 생성됩니다.
|
|
13
|
+
*/
|
|
14
|
+
static get instance() {
|
|
15
|
+
if (!this._instance) this._instance = new ViewPromptBuilder();
|
|
16
|
+
return this._instance;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 뷰 정의를 등록합니다. 같은 이름의 뷰이 이미 등록되어 있으면 에러를 던집니다.
|
|
20
|
+
* @throws {Error} 같은 이름의 뷰이 이미 등록된 경우 또는 같은 태그의 커스텀 요소가 다른 클래스에 의해 정의된 경우
|
|
21
|
+
*/
|
|
22
|
+
add(definition) {
|
|
23
|
+
if (this.views.has(definition.tag)) throw new Error(`View with tag "${definition.tag}" is already registered.`);
|
|
24
|
+
const constructor = customElements.get(definition.tag);
|
|
25
|
+
if (constructor && constructor !== definition.element) throw new Error(`Custom element with tag "${definition.tag}" is already defined to a different class.`);
|
|
26
|
+
this.views.set(definition.tag, definition);
|
|
27
|
+
return this;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* 미리 정의된 프리셋 뷰을 사용합니다.
|
|
31
|
+
* @example
|
|
32
|
+
* ViewRegistry.use(View.Images | View.Chart);
|
|
33
|
+
* ViewRegistry.use(View.All);
|
|
34
|
+
*/
|
|
35
|
+
use(flags) {
|
|
36
|
+
for (const flag of PRESET_VIEW_LIST) if (flags & flag) {
|
|
37
|
+
const definition = PRESET_VIEW_DEFINITIONS.get(flag);
|
|
38
|
+
if (definition) this.add(definition);
|
|
39
|
+
}
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 등록된 뷰들에 대한 LLM 인스트럭션 문자열을 생성합니다.
|
|
44
|
+
*/
|
|
45
|
+
build() {
|
|
46
|
+
if (this.views.size === 0) return "";
|
|
47
|
+
const docs = Array.from(this.views.values()).map((def) => {
|
|
48
|
+
return [
|
|
49
|
+
`### ${def.tag}`,
|
|
50
|
+
"",
|
|
51
|
+
"**JSON Schema:**",
|
|
52
|
+
"```view-json",
|
|
53
|
+
JSON.stringify({
|
|
54
|
+
type: "object",
|
|
55
|
+
description: def.description,
|
|
56
|
+
properties: {
|
|
57
|
+
tag: {
|
|
58
|
+
type: "string",
|
|
59
|
+
enum: [def.tag]
|
|
60
|
+
},
|
|
61
|
+
properties: {
|
|
62
|
+
type: "object",
|
|
63
|
+
properties: def.properties || {},
|
|
64
|
+
required: def.required || []
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
required: ["tag"]
|
|
68
|
+
}, null, 2),
|
|
69
|
+
"```"
|
|
70
|
+
].join("\n");
|
|
71
|
+
}).join("\n\n---\n\n");
|
|
72
|
+
return view_prompt_md_default.replace("{{VIEW_DOCS}}", docs);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
//#endregion
|
|
76
|
+
export { ViewPromptBuilder };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { DOMScanner } from './DOMScanner.js';
|
|
2
|
+
import { DOMController } from './DOMController.js';
|
|
3
|
+
import { ScanResult, ScanOptions, DOMCommand, ExecutionResult, HistoryItem, AutomationOptions, LLMCallback, ScanDiff } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* DOM Agent 통합 오케스트레이터
|
|
6
|
+
* Scanner와 Controller를 조합하여 전체 워크플로우 관리
|
|
7
|
+
*/
|
|
8
|
+
export declare class DOMAgent extends EventTarget {
|
|
9
|
+
private scanner;
|
|
10
|
+
private controller;
|
|
11
|
+
private history;
|
|
12
|
+
private currentScan;
|
|
13
|
+
private lastScanRoot;
|
|
14
|
+
constructor();
|
|
15
|
+
/**
|
|
16
|
+
* 초기 스캔 및 세션 시작
|
|
17
|
+
*/
|
|
18
|
+
start(root?: Element | ShadowRoot, options?: ScanOptions & {
|
|
19
|
+
includeScreenshot?: boolean;
|
|
20
|
+
}): Promise<ScanResult>;
|
|
21
|
+
/**
|
|
22
|
+
* 명령 실행 후 재스캔
|
|
23
|
+
*/
|
|
24
|
+
executeAndRescan(commands: DOMCommand | DOMCommand[], options?: ScanOptions & {
|
|
25
|
+
includeScreenshot?: boolean;
|
|
26
|
+
}): Promise<{
|
|
27
|
+
execution: ExecutionResult[];
|
|
28
|
+
scan: ScanResult;
|
|
29
|
+
}>;
|
|
30
|
+
/**
|
|
31
|
+
* 현재 상태 가져오기
|
|
32
|
+
*/
|
|
33
|
+
getCurrentState(): ScanResult | null;
|
|
34
|
+
/**
|
|
35
|
+
* 히스토리 조회
|
|
36
|
+
*/
|
|
37
|
+
getHistory(): HistoryItem[];
|
|
38
|
+
/**
|
|
39
|
+
* 히스토리 초기화
|
|
40
|
+
*/
|
|
41
|
+
clearHistory(): void;
|
|
42
|
+
/**
|
|
43
|
+
* 자동 모드: LLM 콜백과 함께 반복 실행
|
|
44
|
+
*/
|
|
45
|
+
automate(llmCallback: LLMCallback, options?: AutomationOptions): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* 특정 요소 스캔
|
|
48
|
+
*/
|
|
49
|
+
scanElement(elementId: string, options?: ScanOptions): Promise<ScanResult>;
|
|
50
|
+
/**
|
|
51
|
+
* 에러 이벤트 발생
|
|
52
|
+
*/
|
|
53
|
+
private dispatchError;
|
|
54
|
+
/**
|
|
55
|
+
* 스크린샷 캡처 (html2canvas 사용)
|
|
56
|
+
*/
|
|
57
|
+
private captureScreenshot;
|
|
58
|
+
/**
|
|
59
|
+
* Scanner 인스턴스 가져오기 (고급 사용)
|
|
60
|
+
*/
|
|
61
|
+
getScanner(): DOMScanner;
|
|
62
|
+
/**
|
|
63
|
+
* Controller 인스턴스 가져오기 (고급 사용)
|
|
64
|
+
*/
|
|
65
|
+
getController(): DOMController;
|
|
66
|
+
/**
|
|
67
|
+
* 이전 스캔과 현재 스캔 비교 (Diff)
|
|
68
|
+
*/
|
|
69
|
+
scanDiff(previousScan: ScanResult, currentScan: ScanResult): ScanDiff;
|
|
70
|
+
/**
|
|
71
|
+
* 요소 변경 여부 확인
|
|
72
|
+
*/
|
|
73
|
+
private isElementModified;
|
|
74
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { DOMCommand, ExecutionResult } from './types.js';
|
|
2
|
+
import { DOMScanner } from './DOMScanner.js';
|
|
3
|
+
/**
|
|
4
|
+
* DOM 명령 실행 엔진
|
|
5
|
+
* LLM의 명령을 파싱하고 실제 DOM 조작 수행
|
|
6
|
+
*/
|
|
7
|
+
export declare class DOMController {
|
|
8
|
+
private scanner;
|
|
9
|
+
constructor(scanner: DOMScanner);
|
|
10
|
+
/**
|
|
11
|
+
* 단일 명령 실행
|
|
12
|
+
*/
|
|
13
|
+
execute(command: DOMCommand): Promise<ExecutionResult>;
|
|
14
|
+
/**
|
|
15
|
+
* 여러 명령 순차 실행
|
|
16
|
+
*/
|
|
17
|
+
executeMany(commands: DOMCommand[]): Promise<ExecutionResult[]>;
|
|
18
|
+
/**
|
|
19
|
+
* 명령 실행 (내부)
|
|
20
|
+
*/
|
|
21
|
+
private executeCommand;
|
|
22
|
+
/**
|
|
23
|
+
* 클릭 이벤트 실행
|
|
24
|
+
*/
|
|
25
|
+
private click;
|
|
26
|
+
/**
|
|
27
|
+
* 텍스트 입력 (자연스러운 타이핑 시뮬레이션)
|
|
28
|
+
*/
|
|
29
|
+
private input;
|
|
30
|
+
/**
|
|
31
|
+
* 옵션 선택
|
|
32
|
+
*/
|
|
33
|
+
private selectOption;
|
|
34
|
+
/**
|
|
35
|
+
* 포커스
|
|
36
|
+
*/
|
|
37
|
+
private focus;
|
|
38
|
+
/**
|
|
39
|
+
* 블러 (포커스 해제)
|
|
40
|
+
*/
|
|
41
|
+
private blur;
|
|
42
|
+
/**
|
|
43
|
+
* 스크롤
|
|
44
|
+
*/
|
|
45
|
+
private scroll;
|
|
46
|
+
/**
|
|
47
|
+
* 요소로 스크롤
|
|
48
|
+
*/
|
|
49
|
+
private scrollTo;
|
|
50
|
+
/**
|
|
51
|
+
* 마우스 오버 (호버)
|
|
52
|
+
*/
|
|
53
|
+
private hover;
|
|
54
|
+
/**
|
|
55
|
+
* 입력 필드 초기화
|
|
56
|
+
*/
|
|
57
|
+
private clear;
|
|
58
|
+
/**
|
|
59
|
+
* 체크박스/라디오 토글
|
|
60
|
+
*/
|
|
61
|
+
private check;
|
|
62
|
+
/**
|
|
63
|
+
* 대기
|
|
64
|
+
*/
|
|
65
|
+
private wait;
|
|
66
|
+
/**
|
|
67
|
+
* 페이지 네비게이션 대기
|
|
68
|
+
*/
|
|
69
|
+
private waitForNavigation;
|
|
70
|
+
/**
|
|
71
|
+
* 사람처럼 보이는 랜덤 딜레이
|
|
72
|
+
*/
|
|
73
|
+
private simulateHumanDelay;
|
|
74
|
+
/**
|
|
75
|
+
* ID로 요소 가져오기 (Scanner의 매핑 활용)
|
|
76
|
+
*/
|
|
77
|
+
private getElement;
|
|
78
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ScanResult, DOMCommand } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* DOMPromptBuilder
|
|
4
|
+
* ScanResult를 LLM이 이해하기 쉬운 프롬프트로 변환하고, LLM 응답에서 명령을 추출합니다.
|
|
5
|
+
*/
|
|
6
|
+
export declare class DOMPromptBuilder {
|
|
7
|
+
private template;
|
|
8
|
+
constructor(template?: string);
|
|
9
|
+
/**
|
|
10
|
+
* 기본 프롬프트 템플릿
|
|
11
|
+
*/
|
|
12
|
+
private getDefaultTemplate;
|
|
13
|
+
/**
|
|
14
|
+
* LLM 프롬프트 생성
|
|
15
|
+
*/
|
|
16
|
+
buildPrompt(scan: ScanResult, options?: {
|
|
17
|
+
maxElements?: number;
|
|
18
|
+
includeInvisible?: boolean;
|
|
19
|
+
contextHint?: string;
|
|
20
|
+
template?: string;
|
|
21
|
+
}): string;
|
|
22
|
+
/**
|
|
23
|
+
* LLM 응답에서 명령 추출
|
|
24
|
+
*/
|
|
25
|
+
extractCommands(llmResponse: string): DOMCommand[];
|
|
26
|
+
/**
|
|
27
|
+
* 명령 객체 정규화
|
|
28
|
+
*/
|
|
29
|
+
private normalizeCommand;
|
|
30
|
+
/**
|
|
31
|
+
* 요소 리스트를 LLM 친화적 텍스트로 변환
|
|
32
|
+
*/
|
|
33
|
+
private summarizeElements;
|
|
34
|
+
/**
|
|
35
|
+
* 단일 요소를 텍스트로 표현
|
|
36
|
+
*/
|
|
37
|
+
private elementToText;
|
|
38
|
+
/**
|
|
39
|
+
* 스크린샷을 멀티모달 메시지로 변환 (Anthropic Claude, OpenAI GPT-4V 형식)
|
|
40
|
+
*/
|
|
41
|
+
formatMultimodalMessage(scan: ScanResult, options?: {
|
|
42
|
+
maxElements?: number;
|
|
43
|
+
contextHint?: string;
|
|
44
|
+
screenshotFormat?: 'anthropic' | 'openai';
|
|
45
|
+
}): any;
|
|
46
|
+
/**
|
|
47
|
+
* 템플릿 변경
|
|
48
|
+
*/
|
|
49
|
+
setTemplate(template: string): void;
|
|
50
|
+
/**
|
|
51
|
+
* 현재 템플릿 가져오기
|
|
52
|
+
*/
|
|
53
|
+
getTemplate(): string;
|
|
54
|
+
}
|