hanseol-dev 5.0.2-dev.0 → 5.0.2-dev.2
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/agents/browser/browser-profile-manager.d.ts +16 -0
- package/dist/agents/browser/browser-profile-manager.d.ts.map +1 -0
- package/dist/agents/browser/browser-profile-manager.js +149 -0
- package/dist/agents/browser/browser-profile-manager.js.map +1 -0
- package/dist/agents/browser/browser-sub-agent.d.ts +22 -0
- package/dist/agents/browser/browser-sub-agent.d.ts.map +1 -0
- package/dist/agents/browser/browser-sub-agent.js +165 -0
- package/dist/agents/browser/browser-sub-agent.js.map +1 -0
- package/dist/agents/browser/confluence-agent.d.ts +3 -0
- package/dist/agents/browser/confluence-agent.d.ts.map +1 -0
- package/dist/agents/browser/confluence-agent.js +35 -0
- package/dist/agents/browser/confluence-agent.js.map +1 -0
- package/dist/agents/browser/index.d.ts +4 -0
- package/dist/agents/browser/index.d.ts.map +1 -0
- package/dist/agents/browser/index.js +4 -0
- package/dist/agents/browser/index.js.map +1 -0
- package/dist/agents/browser/jira-agent.d.ts +3 -0
- package/dist/agents/browser/jira-agent.d.ts.map +1 -0
- package/dist/agents/browser/jira-agent.js +35 -0
- package/dist/agents/browser/jira-agent.js.map +1 -0
- package/dist/agents/browser/prompts.d.ts +4 -0
- package/dist/agents/browser/prompts.d.ts.map +1 -0
- package/dist/agents/browser/prompts.js +241 -0
- package/dist/agents/browser/prompts.js.map +1 -0
- package/dist/agents/browser/search-agent.d.ts +3 -0
- package/dist/agents/browser/search-agent.d.ts.map +1 -0
- package/dist/agents/browser/search-agent.js +31 -0
- package/dist/agents/browser/search-agent.js.map +1 -0
- package/dist/agents/common/complete-tool.d.ts +3 -0
- package/dist/agents/common/complete-tool.d.ts.map +1 -0
- package/dist/agents/common/complete-tool.js +18 -0
- package/dist/agents/common/complete-tool.js.map +1 -0
- package/dist/agents/common/index.d.ts +3 -0
- package/dist/agents/common/index.d.ts.map +1 -0
- package/dist/agents/common/index.js +3 -0
- package/dist/agents/common/index.js.map +1 -0
- package/dist/agents/common/sub-agent.d.ts +21 -0
- package/dist/agents/common/sub-agent.d.ts.map +1 -0
- package/dist/agents/common/sub-agent.js +127 -0
- package/dist/agents/common/sub-agent.js.map +1 -0
- package/dist/agents/index.d.ts +3 -2
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +3 -2
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/office/excel-agent.d.ts.map +1 -1
- package/dist/agents/office/excel-agent.js +5 -5
- package/dist/agents/office/excel-agent.js.map +1 -1
- package/dist/agents/office/index.d.ts +2 -2
- package/dist/agents/office/index.d.ts.map +1 -1
- package/dist/agents/office/index.js +2 -2
- package/dist/agents/office/index.js.map +1 -1
- package/dist/agents/office/powerpoint-agent.d.ts.map +1 -1
- package/dist/agents/office/powerpoint-agent.js +5 -5
- package/dist/agents/office/powerpoint-agent.js.map +1 -1
- package/dist/agents/office/prompts.d.ts +3 -3
- package/dist/agents/office/prompts.d.ts.map +1 -1
- package/dist/agents/office/prompts.js +287 -143
- package/dist/agents/office/prompts.js.map +1 -1
- package/dist/agents/office/word-agent.d.ts.map +1 -1
- package/dist/agents/office/word-agent.js +5 -5
- package/dist/agents/office/word-agent.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/prompts/agents/planning.d.ts.map +1 -1
- package/dist/prompts/agents/planning.js +60 -29
- package/dist/prompts/agents/planning.js.map +1 -1
- package/dist/prompts/shared/tool-usage.d.ts.map +1 -1
- package/dist/prompts/shared/tool-usage.js +9 -4
- package/dist/prompts/shared/tool-usage.js.map +1 -1
- package/dist/prompts/system/plan-execute.d.ts.map +1 -1
- package/dist/prompts/system/plan-execute.js +30 -9
- package/dist/prompts/system/plan-execute.js.map +1 -1
- package/dist/tools/browser/browser-client.d.ts +3 -0
- package/dist/tools/browser/browser-client.d.ts.map +1 -1
- package/dist/tools/browser/browser-client.js +22 -6
- package/dist/tools/browser/browser-client.js.map +1 -1
- package/dist/tools/browser/browser-tools.d.ts +1 -0
- package/dist/tools/browser/browser-tools.d.ts.map +1 -1
- package/dist/tools/browser/browser-tools.js +15 -0
- package/dist/tools/browser/browser-tools.js.map +1 -1
- package/dist/tools/llm/simple/planning-tools.js +1 -1
- package/dist/tools/llm/simple/planning-tools.js.map +1 -1
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +4 -0
- package/dist/tools/registry.js.map +1 -1
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
const BROWSER_BASE_PROMPT = `You are an elite browser automation agent.
|
|
2
|
+
Execute the user's instruction using the available browser tools.
|
|
3
|
+
When the task is complete, you MUST call the "complete" tool with a detailed summary.
|
|
4
|
+
Call only one tool at a time. After each tool result, decide the next step.
|
|
5
|
+
Always respond in the same language as the user's instruction.
|
|
6
|
+
|
|
7
|
+
═══ TOOL USAGE ═══
|
|
8
|
+
• browser_navigate: Navigate to a URL
|
|
9
|
+
• browser_click: Click an element by CSS selector
|
|
10
|
+
• browser_fill: Fill a value into an input field
|
|
11
|
+
• browser_type: Type text character by character
|
|
12
|
+
• browser_get_text: Get text from page/element (omit selector for full page)
|
|
13
|
+
• browser_get_html: Get the page HTML
|
|
14
|
+
• browser_get_page_info: Get current URL, title, and basic info
|
|
15
|
+
• browser_screenshot: Take a screenshot (for debugging)
|
|
16
|
+
• browser_execute_script: Execute JavaScript (DOM manipulation, data extraction)
|
|
17
|
+
• browser_wait: Wait until a CSS selector appears
|
|
18
|
+
• browser_press_key: Press a keyboard key (Enter, Tab, Escape, etc.)
|
|
19
|
+
• browser_focus: Focus the browser window
|
|
20
|
+
• browser_send: Send a raw CDP command
|
|
21
|
+
|
|
22
|
+
═══ NAVIGATION STRATEGY ═══
|
|
23
|
+
1. If [Target URL] is provided, use that URL as the starting point
|
|
24
|
+
2. After page load, always check current state with browser_get_page_info
|
|
25
|
+
3. For dynamic pages, use browser_wait to wait for element loading before proceeding
|
|
26
|
+
4. In SPAs (Single Page Apps), DOM may change without URL change → verify with browser_get_text/get_html
|
|
27
|
+
|
|
28
|
+
═══ SELECTOR STRATEGY ═══
|
|
29
|
+
CSS selector priority:
|
|
30
|
+
1. [data-testid="..."], [data-test="..."] — Test attributes (most stable)
|
|
31
|
+
2. #id — ID selectors
|
|
32
|
+
3. [aria-label="..."], [role="..."] — Accessibility attributes
|
|
33
|
+
4. .className — Classes (may change with frameworks)
|
|
34
|
+
5. Tag combinations — div > span:nth-child(2) (last resort)
|
|
35
|
+
If page structure is unknown, check with browser_get_html first.
|
|
36
|
+
|
|
37
|
+
═══ ERROR RECOVERY ═══
|
|
38
|
+
1. Click/input fails → use browser_wait for element, then retry
|
|
39
|
+
2. Selector not found → use browser_get_html to inspect actual DOM, then fix selector
|
|
40
|
+
3. Page not loaded → check URL with browser_get_page_info → re-navigate if needed
|
|
41
|
+
4. Try at least 2 different approaches before reporting failure`;
|
|
42
|
+
export const CONFLUENCE_SYSTEM_PROMPT = `${BROWSER_BASE_PROMPT}
|
|
43
|
+
|
|
44
|
+
═══ CONFLUENCE EXPERT ═══
|
|
45
|
+
You are a Confluence automation specialist.
|
|
46
|
+
|
|
47
|
+
═══ COMMON CONFLUENCE URLS ═══
|
|
48
|
+
• Main page: {baseUrl}/wiki/spaces/{spaceKey}/overview
|
|
49
|
+
• View page: {baseUrl}/wiki/spaces/{spaceKey}/pages/{pageId}
|
|
50
|
+
• Create page: {baseUrl}/wiki/spaces/{spaceKey}/pages/create
|
|
51
|
+
• Search: {baseUrl}/wiki/search?text={query}
|
|
52
|
+
• Space list: {baseUrl}/wiki/spaces
|
|
53
|
+
|
|
54
|
+
═══ PAGE VIEWING ═══
|
|
55
|
+
STEP 1: browser_navigate → target page URL
|
|
56
|
+
STEP 2: browser_wait → "#content" or ".wiki-content" (wait for page content to load)
|
|
57
|
+
STEP 3: browser_get_text → "#content" or "#main-content" (extract body text)
|
|
58
|
+
STEP 4: complete → return organized content
|
|
59
|
+
|
|
60
|
+
═══ PAGE EDITING ═══
|
|
61
|
+
STEP 1: browser_navigate → page URL
|
|
62
|
+
STEP 2: Click edit button: browser_click → "#editPageLink" or "button[aria-label='Edit']" or "a[href*='editpage']"
|
|
63
|
+
⚠ Confluence Cloud: ".css-1vdy7v" or "[data-testid='edit-button']"
|
|
64
|
+
⚠ Confluence Server: "#editPageLink"
|
|
65
|
+
STEP 3: Wait for editor: browser_wait → ".ProseMirror" or "#tinymce" or "#wysiwygTextarea"
|
|
66
|
+
STEP 4: Modify content:
|
|
67
|
+
• Confluence Cloud (ProseMirror editor):
|
|
68
|
+
- browser_click → ".ProseMirror" (focus editor)
|
|
69
|
+
- browser_execute_script → document.querySelector('.ProseMirror').innerHTML to check current content
|
|
70
|
+
- browser_type or browser_execute_script to modify content
|
|
71
|
+
• Confluence Server (TinyMCE):
|
|
72
|
+
- browser_execute_script → tinymce.activeEditor.getContent() to check current content
|
|
73
|
+
- browser_execute_script → tinymce.activeEditor.setContent(html) to set content
|
|
74
|
+
STEP 5: Save:
|
|
75
|
+
• browser_click → "#rte-button-publish" or "[data-testid='publish-button']" or "button:has-text('Publish')"
|
|
76
|
+
• or browser_press_key → "Control+s" (shortcut)
|
|
77
|
+
STEP 6: Verify save, then complete
|
|
78
|
+
|
|
79
|
+
═══ PAGE CREATION ═══
|
|
80
|
+
STEP 1: browser_navigate → {baseUrl}/wiki/spaces/{spaceKey}/pages/create
|
|
81
|
+
or "+" button: browser_click → "[data-testid='create-button']"
|
|
82
|
+
STEP 2: Wait for editor: browser_wait → ".ProseMirror" or "#tinymce"
|
|
83
|
+
STEP 3: Enter title: browser_fill → "[data-testid='title-text-area']" or "#content-title"
|
|
84
|
+
STEP 4: Write body (same as EDITING STEP 4)
|
|
85
|
+
STEP 5: Save (same as EDITING STEP 5)
|
|
86
|
+
|
|
87
|
+
═══ SEARCH ═══
|
|
88
|
+
browser_navigate → {baseUrl}/wiki/search?text={encodedQuery}
|
|
89
|
+
browser_wait → ".search-results" or "[data-testid='search-results']"
|
|
90
|
+
browser_get_text → search results area
|
|
91
|
+
|
|
92
|
+
═══ COMMENT ═══
|
|
93
|
+
Page bottom comment area:
|
|
94
|
+
browser_click → "#comments-section-title" or "button:has-text('Add comment')"
|
|
95
|
+
browser_wait → wait for comment editor to load
|
|
96
|
+
browser_type → comment content
|
|
97
|
+
browser_click → save button
|
|
98
|
+
|
|
99
|
+
═══ IMPORTANT ═══
|
|
100
|
+
• Confluence Cloud vs Server have different DOM structures → check with browser_get_html first
|
|
101
|
+
• Editor content may be inside an iframe → use browser_execute_script to access iframe content
|
|
102
|
+
• After saving, always verify the page displays correctly → check URL with browser_get_page_info`;
|
|
103
|
+
export const JIRA_SYSTEM_PROMPT = `${BROWSER_BASE_PROMPT}
|
|
104
|
+
|
|
105
|
+
═══ JIRA EXPERT ═══
|
|
106
|
+
You are a Jira automation specialist.
|
|
107
|
+
|
|
108
|
+
═══ COMMON JIRA URLS ═══
|
|
109
|
+
• Issue detail: {baseUrl}/browse/{issueKey} (e.g., PROJ-1234)
|
|
110
|
+
• Board: {baseUrl}/jira/software/projects/{projectKey}/board
|
|
111
|
+
• Backlog: {baseUrl}/jira/software/projects/{projectKey}/backlog
|
|
112
|
+
• JQL search: {baseUrl}/issues/?jql={encodedJQL}
|
|
113
|
+
• Create issue: {baseUrl}/secure/CreateIssue!default.jspa
|
|
114
|
+
• Dashboard: {baseUrl}/jira/dashboards
|
|
115
|
+
|
|
116
|
+
═══ ISSUE VIEWING ═══
|
|
117
|
+
STEP 1: browser_navigate → {baseUrl}/browse/{issueKey}
|
|
118
|
+
STEP 2: browser_wait → "#summary-val" or "[data-testid='issue.views.issue-base.foundation.summary.heading']"
|
|
119
|
+
STEP 3: Collect information:
|
|
120
|
+
• Title: browser_get_text → "#summary-val" or "h1[data-testid*='summary']"
|
|
121
|
+
• Status: browser_get_text → "#status-val" or "[data-testid='issue.views.issue-base.foundation.status.status-field-wrapper']"
|
|
122
|
+
• Assignee: browser_get_text → "#assignee-val" or "[data-testid*='assignee']"
|
|
123
|
+
• Description: browser_get_text → "#description-val" or "[data-testid*='description']"
|
|
124
|
+
• Comments: browser_get_text → "#activitymodule" or ".issue-body-content"
|
|
125
|
+
STEP 4: complete → return organized information
|
|
126
|
+
|
|
127
|
+
═══ JQL SEARCH ═══
|
|
128
|
+
STEP 1: browser_navigate → {baseUrl}/issues/?jql={encodedJQL}
|
|
129
|
+
• e.g.: status="In Progress" AND assignee=currentUser()
|
|
130
|
+
• e.g.: project=PROJ AND type=Bug AND status!=Done
|
|
131
|
+
STEP 2: browser_wait → ".issue-list" or "[data-testid='issue-navigator']"
|
|
132
|
+
STEP 3: browser_get_text → search results area
|
|
133
|
+
or browser_execute_script to extract structured table data
|
|
134
|
+
STEP 4: complete → organize results
|
|
135
|
+
|
|
136
|
+
═══ ISSUE CREATION ═══
|
|
137
|
+
STEP 1: browser_navigate → {baseUrl}/secure/CreateIssue!default.jspa
|
|
138
|
+
or browser_click → "[data-testid='global-create-button']" or "#create-menu"
|
|
139
|
+
STEP 2: browser_wait → "#create-issue-dialog" or "[data-testid='create-issue-dialog']"
|
|
140
|
+
STEP 3: Fill fields:
|
|
141
|
+
• Project: browser_fill or browser_click → project selector
|
|
142
|
+
• Issue type: browser_fill → "#issuetype-field" or dropdown
|
|
143
|
+
• Summary: browser_fill → "#summary" or "[data-testid*='summary']"
|
|
144
|
+
• Description: browser_fill/type → "#description" or editor area
|
|
145
|
+
• Assignee: browser_fill → "#assignee-field"
|
|
146
|
+
• Priority: browser_fill → "#priority-field"
|
|
147
|
+
STEP 4: browser_click → "#create-issue-submit" or "button:has-text('Create')"
|
|
148
|
+
STEP 5: Verify creation → complete
|
|
149
|
+
|
|
150
|
+
═══ ISSUE EDITING ═══
|
|
151
|
+
Inline editing on issue detail page:
|
|
152
|
+
• Edit summary: click title → editor activates → edit → Enter/check button
|
|
153
|
+
• Edit description: click description area → editor → edit → save
|
|
154
|
+
• Change status: click status button → select transition
|
|
155
|
+
• Change assignee: click assignee field → search → select
|
|
156
|
+
|
|
157
|
+
═══ COMMENT ═══
|
|
158
|
+
STEP 1: browser_navigate → {baseUrl}/browse/{issueKey}
|
|
159
|
+
STEP 2: Scroll to comment area: browser_click → "#footer-comment-button" or "button:has-text('Add a comment')"
|
|
160
|
+
STEP 3: browser_wait → wait for comment editor to load
|
|
161
|
+
STEP 4: browser_type → comment content
|
|
162
|
+
STEP 5: browser_click → save button
|
|
163
|
+
STEP 6: Verify save → complete
|
|
164
|
+
|
|
165
|
+
═══ STATUS TRANSITION ═══
|
|
166
|
+
STEP 1: Click status button on issue detail page
|
|
167
|
+
browser_click → "#action_id_*" or "[data-testid*='status']" or ".aui-lozenge"
|
|
168
|
+
STEP 2: If transition dialog appears, fill required fields
|
|
169
|
+
STEP 3: browser_click → confirm/transition button
|
|
170
|
+
|
|
171
|
+
═══ IMPORTANT ═══
|
|
172
|
+
• Jira Cloud vs Server/Data Center have different DOM structures → check with browser_get_html first
|
|
173
|
+
• Next-gen (Team-managed) vs Classic (Company-managed) projects have different UIs
|
|
174
|
+
• Inline editing: Escape to cancel, Enter/checkmark to save
|
|
175
|
+
• Special characters in JQL need URL encoding`;
|
|
176
|
+
export const SEARCH_SYSTEM_PROMPT = `${BROWSER_BASE_PROMPT}
|
|
177
|
+
|
|
178
|
+
═══ SEARCH EXPERT ═══
|
|
179
|
+
You are a web search and information extraction specialist.
|
|
180
|
+
|
|
181
|
+
═══ SEARCH ENGINES ═══
|
|
182
|
+
|
|
183
|
+
Google:
|
|
184
|
+
• URL: https://www.google.com/search?q={encodedQuery}
|
|
185
|
+
• Result selector: "#search .g" or "[data-header-feature]"
|
|
186
|
+
• Links: ".g a[href]"
|
|
187
|
+
• Titles: ".g h3"
|
|
188
|
+
• Snippets: ".g .VwiC3b" or ".g [data-sncf]"
|
|
189
|
+
• Next page: "#pnnext"
|
|
190
|
+
|
|
191
|
+
StackOverflow:
|
|
192
|
+
• URL: https://stackoverflow.com/search?q={encodedQuery}
|
|
193
|
+
• Result selector: ".s-post-summary"
|
|
194
|
+
• Title: ".s-post-summary--content-title a"
|
|
195
|
+
• Excerpt: ".s-post-summary--content-excerpt"
|
|
196
|
+
• Vote count: ".s-post-summary--stats-item-number"
|
|
197
|
+
• Answer page: click link, then ".answercell .s-prose" or "#answers .answer"
|
|
198
|
+
|
|
199
|
+
Naver:
|
|
200
|
+
• URL: https://search.naver.com/search.naver?query={encodedQuery}
|
|
201
|
+
• Blog results: ".api_txt_lines"
|
|
202
|
+
• Knowledge Q&A: ".question_text"
|
|
203
|
+
• Web documents: ".total_area"
|
|
204
|
+
|
|
205
|
+
═══ SEARCH WORKFLOW ═══
|
|
206
|
+
STEP 1: browser_navigate → search URL (query URL-encoded)
|
|
207
|
+
STEP 2: browser_wait → wait for results to load (refer to selectors above)
|
|
208
|
+
STEP 3: browser_get_text → collect text from search results area
|
|
209
|
+
or browser_execute_script for structured data extraction:
|
|
210
|
+
\`\`\`javascript
|
|
211
|
+
// Google result extraction example
|
|
212
|
+
Array.from(document.querySelectorAll('#search .g')).slice(0, 10).map(el => ({
|
|
213
|
+
title: el.querySelector('h3')?.textContent || '',
|
|
214
|
+
url: el.querySelector('a')?.href || '',
|
|
215
|
+
snippet: el.querySelector('.VwiC3b')?.textContent || ''
|
|
216
|
+
}))
|
|
217
|
+
\`\`\`
|
|
218
|
+
STEP 4: If detailed info is needed, visit individual links:
|
|
219
|
+
browser_navigate → result URL
|
|
220
|
+
browser_get_text → page body
|
|
221
|
+
STEP 5: complete → return organized search results
|
|
222
|
+
|
|
223
|
+
═══ STACKOVERFLOW DEEP SEARCH ═══
|
|
224
|
+
For coding-related questions:
|
|
225
|
+
STEP 1: Search StackOverflow
|
|
226
|
+
STEP 2: Click the most relevant question (considering vote count)
|
|
227
|
+
STEP 3: browser_get_text → collect question + accepted answer
|
|
228
|
+
STEP 4: Collect other answers if needed
|
|
229
|
+
STEP 5: complete → organize questions/answers cleanly
|
|
230
|
+
|
|
231
|
+
═══ MULTI-ENGINE SEARCH ═══
|
|
232
|
+
If no specific engine is mentioned in the instruction, default to Google.
|
|
233
|
+
User may specify engine in their language (e.g., "search on Naver", "search on StackOverflow").
|
|
234
|
+
When combining results from multiple engines: search each engine sequentially → merge results.
|
|
235
|
+
|
|
236
|
+
═══ IMPORTANT ═══
|
|
237
|
+
• Google may trigger automation detection (CAPTCHA) → report in complete if detected
|
|
238
|
+
• Exclude ads/sponsored results when extracting search results
|
|
239
|
+
• Collect at most 10 results (avoid excessive scrolling)
|
|
240
|
+
• Korean text in search queries must be URL-encoded`;
|
|
241
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../src/agents/browser/prompts.ts"],"names":[],"mappings":"AAOA,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gEAwCoC,CAAC;AAEjE,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iGA4DmC,CAAC;AAElG,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8CAwEV,CAAC;AAE/C,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDAgEN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-agent.d.ts","sourceRoot":"","sources":["../../../src/agents/browser/search-agent.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAKpD,wBAAgB,uBAAuB,IAAI,YAAY,CAiCtD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BROWSER_SUB_AGENT_TOOLS } from '../../tools/browser/browser-tools.js';
|
|
2
|
+
import { BrowserSubAgent } from './browser-sub-agent.js';
|
|
3
|
+
import { SEARCH_SYSTEM_PROMPT } from './prompts.js';
|
|
4
|
+
export function createSearchRequestTool() {
|
|
5
|
+
return {
|
|
6
|
+
definition: {
|
|
7
|
+
type: 'function',
|
|
8
|
+
function: {
|
|
9
|
+
name: 'search_request',
|
|
10
|
+
description: 'Delegate a task to the web search specialist agent. Searches Google, StackOverflow, Naver, etc. for information and collects results. Describe what to search for in natural language.',
|
|
11
|
+
parameters: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
instruction: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'Natural language instruction for the search (can specify engine: "on Google", "on Naver", "on StackOverflow")',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
required: ['instruction'],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
execute: async (args, llmClient) => {
|
|
24
|
+
const agent = new BrowserSubAgent(llmClient, 'search', BROWSER_SUB_AGENT_TOOLS, SEARCH_SYSTEM_PROMPT, { requiresAuth: false, serviceType: 'search' });
|
|
25
|
+
return agent.run(args['instruction']);
|
|
26
|
+
},
|
|
27
|
+
categories: ['llm-agent'],
|
|
28
|
+
requiresSubLLM: true,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=search-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-agent.js","sourceRoot":"","sources":["../../../src/agents/browser/search-agent.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD,MAAM,UAAU,uBAAuB;IACrC,OAAO;QACL,UAAU,EAAE;YACV,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE;gBACR,IAAI,EAAE,gBAAgB;gBACtB,WAAW,EACT,wLAAwL;gBAC1L,UAAU,EAAE;oBACV,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,WAAW,EAAE;4BACX,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,+GAA+G;yBAC7H;qBACF;oBACD,QAAQ,EAAE,CAAC,aAAa,CAAC;iBAC1B;aACF;SACF;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;YACjC,MAAM,KAAK,GAAG,IAAI,eAAe,CAC/B,SAAS,EACT,QAAQ,EACR,uBAAuB,EACvB,oBAAoB,EACpB,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,CAC/C,CAAC;YACF,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAW,CAAC,CAAC;QAClD,CAAC;QACD,UAAU,EAAE,CAAC,WAAW,CAAC;QACzB,cAAc,EAAE,IAAI;KACrB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"complete-tool.d.ts","sourceRoot":"","sources":["../../../src/agents/common/complete-tool.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,eAAO,MAAM,wBAAwB,EAAE,cAiBtC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const COMPLETE_TOOL_DEFINITION = {
|
|
2
|
+
type: 'function',
|
|
3
|
+
function: {
|
|
4
|
+
name: 'complete',
|
|
5
|
+
description: 'Call when the task is complete. Returns a summary of the work performed. You MUST call this tool after finishing all tasks.',
|
|
6
|
+
parameters: {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {
|
|
9
|
+
summary: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
description: 'Summary of the work performed (what was done to which file/document)',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
required: ['summary'],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=complete-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"complete-tool.js","sourceRoot":"","sources":["../../../src/agents/common/complete-tool.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,MAAM,wBAAwB,GAAmB;IACtD,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE;QACR,IAAI,EAAE,UAAU;QAChB,WAAW,EACT,6HAA6H;QAC/H,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,sEAAsE;iBACpF;aACF;YACD,QAAQ,EAAE,CAAC,SAAS,CAAC;SACtB;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agents/common/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/agents/common/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,QAAQ,EAAuB,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LLMClient } from '../../core/llm/llm-client.js';
|
|
2
|
+
import { LLMSimpleTool, ToolResult } from '../../tools/types.js';
|
|
3
|
+
export interface SubAgentConfig {
|
|
4
|
+
maxIterations?: number;
|
|
5
|
+
temperature?: number;
|
|
6
|
+
maxTokens?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare class SubAgent {
|
|
9
|
+
private llmClient;
|
|
10
|
+
private appName;
|
|
11
|
+
private tools;
|
|
12
|
+
private toolMap;
|
|
13
|
+
private systemPrompt;
|
|
14
|
+
private maxIterations;
|
|
15
|
+
private temperature;
|
|
16
|
+
private maxTokens;
|
|
17
|
+
constructor(llmClient: LLMClient, appName: string, tools: LLMSimpleTool[], systemPrompt: string, config?: SubAgentConfig);
|
|
18
|
+
run(instruction: string): Promise<ToolResult>;
|
|
19
|
+
private buildResult;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=sub-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sub-agent.d.ts","sourceRoot":"","sources":["../../../src/agents/common/sub-agent.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAIjE,MAAM,WAAW,cAAc;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,QAAQ;IACnB,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAAkB;IAC/B,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,SAAS,CAAS;gBAGxB,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,aAAa,EAAE,EACtB,YAAY,EAAE,MAAM,EACpB,MAAM,CAAC,EAAE,cAAc;IAqBnB,GAAG,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAyHnD,OAAO,CAAC,WAAW;CAiBpB"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { COMPLETE_TOOL_DEFINITION } from './complete-tool.js';
|
|
2
|
+
import { logger } from '../../utils/logger.js';
|
|
3
|
+
export class SubAgent {
|
|
4
|
+
llmClient;
|
|
5
|
+
appName;
|
|
6
|
+
tools;
|
|
7
|
+
toolMap;
|
|
8
|
+
systemPrompt;
|
|
9
|
+
maxIterations;
|
|
10
|
+
temperature;
|
|
11
|
+
maxTokens;
|
|
12
|
+
constructor(llmClient, appName, tools, systemPrompt, config) {
|
|
13
|
+
this.llmClient = llmClient;
|
|
14
|
+
this.appName = appName;
|
|
15
|
+
this.tools = tools;
|
|
16
|
+
this.systemPrompt = systemPrompt;
|
|
17
|
+
this.maxIterations = config?.maxIterations ?? 15;
|
|
18
|
+
this.temperature = config?.temperature ?? 0.3;
|
|
19
|
+
this.maxTokens = config?.maxTokens ?? 4000;
|
|
20
|
+
this.toolMap = new Map();
|
|
21
|
+
for (const tool of tools) {
|
|
22
|
+
this.toolMap.set(tool.definition.function.name, tool);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
async run(instruction) {
|
|
26
|
+
const startTime = Date.now();
|
|
27
|
+
let iterations = 0;
|
|
28
|
+
let totalToolCalls = 0;
|
|
29
|
+
logger.enter(`SubAgent[${this.appName}].run`);
|
|
30
|
+
logger.info(`Sub-agent starting`, {
|
|
31
|
+
appName: this.appName,
|
|
32
|
+
toolCount: this.tools.length,
|
|
33
|
+
instruction: instruction.slice(0, 100),
|
|
34
|
+
});
|
|
35
|
+
const toolDefinitions = [
|
|
36
|
+
...this.tools.map((t) => t.definition),
|
|
37
|
+
COMPLETE_TOOL_DEFINITION,
|
|
38
|
+
];
|
|
39
|
+
const messages = [
|
|
40
|
+
{ role: 'system', content: this.systemPrompt },
|
|
41
|
+
{ role: 'user', content: instruction },
|
|
42
|
+
];
|
|
43
|
+
while (iterations < this.maxIterations) {
|
|
44
|
+
iterations++;
|
|
45
|
+
logger.flow(`SubAgent[${this.appName}] iteration ${iterations}`);
|
|
46
|
+
const response = await this.llmClient.chatCompletion({
|
|
47
|
+
messages,
|
|
48
|
+
tools: toolDefinitions,
|
|
49
|
+
temperature: this.temperature,
|
|
50
|
+
max_tokens: this.maxTokens,
|
|
51
|
+
});
|
|
52
|
+
const assistantMessage = response.choices[0]?.message;
|
|
53
|
+
if (!assistantMessage) {
|
|
54
|
+
return this.buildResult(false, undefined, 'No response from Sub-LLM', iterations, totalToolCalls, startTime);
|
|
55
|
+
}
|
|
56
|
+
messages.push(assistantMessage);
|
|
57
|
+
if (!assistantMessage.tool_calls || assistantMessage.tool_calls.length === 0) {
|
|
58
|
+
const content = assistantMessage.content || '';
|
|
59
|
+
logger.flow(`SubAgent[${this.appName}] completed with text response`);
|
|
60
|
+
return this.buildResult(true, content, undefined, iterations, totalToolCalls, startTime);
|
|
61
|
+
}
|
|
62
|
+
for (const toolCall of assistantMessage.tool_calls) {
|
|
63
|
+
const toolName = toolCall.function.name;
|
|
64
|
+
let args;
|
|
65
|
+
try {
|
|
66
|
+
args = JSON.parse(toolCall.function.arguments);
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
messages.push({
|
|
70
|
+
role: 'tool',
|
|
71
|
+
content: 'Error: Invalid JSON in tool arguments.',
|
|
72
|
+
tool_call_id: toolCall.id,
|
|
73
|
+
});
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (toolName === 'complete') {
|
|
77
|
+
const summary = args['summary'] || 'Task completed.';
|
|
78
|
+
logger.flow(`SubAgent[${this.appName}] completed via complete tool`);
|
|
79
|
+
return this.buildResult(true, summary, undefined, iterations, totalToolCalls, startTime);
|
|
80
|
+
}
|
|
81
|
+
const tool = this.toolMap.get(toolName);
|
|
82
|
+
if (!tool) {
|
|
83
|
+
messages.push({
|
|
84
|
+
role: 'tool',
|
|
85
|
+
content: `Error: Unknown tool "${toolName}". Use only the provided tools.`,
|
|
86
|
+
tool_call_id: toolCall.id,
|
|
87
|
+
});
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
totalToolCalls++;
|
|
91
|
+
logger.info(`SubAgent[${this.appName}] executing tool`, { toolName, iteration: iterations });
|
|
92
|
+
try {
|
|
93
|
+
const result = await tool.execute(args);
|
|
94
|
+
const resultText = result.success
|
|
95
|
+
? result.result || '(success, no output)'
|
|
96
|
+
: `Error: ${result.error || 'Unknown error'}`;
|
|
97
|
+
messages.push({
|
|
98
|
+
role: 'tool',
|
|
99
|
+
content: resultText,
|
|
100
|
+
tool_call_id: toolCall.id,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
105
|
+
messages.push({
|
|
106
|
+
role: 'tool',
|
|
107
|
+
content: `Error executing ${toolName}: ${errorMsg}`,
|
|
108
|
+
tool_call_id: toolCall.id,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
logger.warn(`SubAgent[${this.appName}] max iterations reached`, { maxIterations: this.maxIterations });
|
|
114
|
+
return this.buildResult(true, `Sub-agent completed after ${this.maxIterations} iterations. ${totalToolCalls} tool calls executed.`, undefined, iterations, totalToolCalls, startTime);
|
|
115
|
+
}
|
|
116
|
+
buildResult(success, result, error, iterations, toolCalls, startTime) {
|
|
117
|
+
const duration = Date.now() - startTime;
|
|
118
|
+
logger.exit(`SubAgent[${this.appName}].run`, { success, iterations, toolCalls, duration });
|
|
119
|
+
return {
|
|
120
|
+
success,
|
|
121
|
+
result,
|
|
122
|
+
error,
|
|
123
|
+
metadata: { iterations, toolCalls, duration },
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=sub-agent.js.map
|
|
@@ -0,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,OAAO,0BAA0B,EAAE,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;QACvG,OAAO,IAAI,CAAC,WAAW,CACrB,IAAI,EACJ,6BAA6B,IAAI,CAAC,aAAa,gBAAgB,cAAc,uBAAuB,EACpG,SAAS,EACT,UAAU,EACV,cAAc,EACd,SAAS,CACV,CAAC;IACJ,CAAC;IAEO,WAAW,CACjB,OAAgB,EAChB,MAA0B,EAC1B,KAAyB,EACzB,UAAkB,EAClB,SAAiB,EACjB,SAAiB;QAEjB,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;QACxC,MAAM,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,OAAO,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC3F,OAAO;YACL,OAAO;YACP,MAAM;YACN,KAAK;YACL,QAAQ,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE;SAC9C,CAAC;IACJ,CAAC;CACF"}
|
package/dist/agents/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { SubAgent, type SubAgentConfig, } from './common/index.js';
|
|
2
|
+
export { SubAgent as OfficeSubAgent } from './common/index.js';
|
|
2
3
|
export { PlanningLLM, } from './planner/index.js';
|
|
3
|
-
export {
|
|
4
|
+
export { createWordWorkRequestTool, createExcelWorkRequestTool, createPowerPointWorkRequestTool, } from './office/index.js';
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,EACR,KAAK,cAAc,GACpB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAG/D,OAAO,EACL,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,+BAA+B,GAChC,MAAM,mBAAmB,CAAC"}
|
package/dist/agents/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { SubAgent, } from './common/index.js';
|
|
2
|
+
export { SubAgent as OfficeSubAgent } from './common/index.js';
|
|
2
3
|
export { PlanningLLM, } from './planner/index.js';
|
|
3
|
-
export {
|
|
4
|
+
export { createWordWorkRequestTool, createExcelWorkRequestTool, createPowerPointWorkRequestTool, } from './office/index.js';
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
package/dist/agents/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,QAAQ,GAET,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAG/D,OAAO,EACL,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,yBAAyB,EACzB,0BAA0B,EAC1B,+BAA+B,GAChC,MAAM,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"excel-agent.d.ts","sourceRoot":"","sources":["../../../src/agents/office/excel-agent.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAKpD,wBAAgB,0BAA0B,IAAI,YAAY,
|
|
1
|
+
{"version":3,"file":"excel-agent.d.ts","sourceRoot":"","sources":["../../../src/agents/office/excel-agent.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAKpD,wBAAgB,0BAA0B,IAAI,YAAY,CA4BzD"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { EXCEL_TOOLS } from '../../tools/office/excel-tools.js';
|
|
2
|
-
import {
|
|
2
|
+
import { SubAgent } from '../common/sub-agent.js';
|
|
3
3
|
import { EXCEL_SYSTEM_PROMPT } from './prompts.js';
|
|
4
4
|
export function createExcelWorkRequestTool() {
|
|
5
5
|
return {
|
|
6
6
|
definition: {
|
|
7
7
|
type: 'function',
|
|
8
8
|
function: {
|
|
9
|
-
name: '
|
|
10
|
-
description: 'Microsoft Excel
|
|
9
|
+
name: 'excel_agent',
|
|
10
|
+
description: 'Autonomous Microsoft Excel specialist agent. Creates professional spreadsheets with formatted headers, data tables, formulas (SUM, averages, percentages), conditional formatting, charts, and beautiful color schemes — all automatically. Give it data requirements or a rough description and it will produce a polished, enterprise-grade Excel workbook. Also capable of editing existing .xlsx files. The agent runs independently with its own tools and returns the completed result.',
|
|
11
11
|
parameters: {
|
|
12
12
|
type: 'object',
|
|
13
13
|
properties: {
|
|
14
14
|
instruction: {
|
|
15
15
|
type: 'string',
|
|
16
|
-
description: '
|
|
16
|
+
description: 'Detailed instruction for the Excel agent. Include: data structure (columns, rows), sample data or data source, desired formulas/calculations, chart requirements, and save path. The more detail you provide, the better the result. The agent will autonomously create a professional spreadsheet.',
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
19
|
required: ['instruction'],
|
|
@@ -21,7 +21,7 @@ export function createExcelWorkRequestTool() {
|
|
|
21
21
|
},
|
|
22
22
|
},
|
|
23
23
|
execute: async (args, llmClient) => {
|
|
24
|
-
const agent = new
|
|
24
|
+
const agent = new SubAgent(llmClient, 'excel', EXCEL_TOOLS, EXCEL_SYSTEM_PROMPT, { maxIterations: 40 });
|
|
25
25
|
return agent.run(args['instruction']);
|
|
26
26
|
},
|
|
27
27
|
categories: ['llm-agent'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"excel-agent.js","sourceRoot":"","sources":["../../../src/agents/office/excel-agent.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"excel-agent.js","sourceRoot":"","sources":["../../../src/agents/office/excel-agent.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,UAAU,0BAA0B;IACxC,OAAO;QACL,UAAU,EAAE;YACV,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE;gBACR,IAAI,EAAE,aAAa;gBACnB,WAAW,EACT,+dAA+d;gBACje,UAAU,EAAE;oBACV,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,WAAW,EAAE;4BACX,IAAI,EAAE,QAAQ;4BACd,WAAW,EACT,qSAAqS;yBACxS;qBACF;oBACD,QAAQ,EAAE,CAAC,aAAa,CAAC;iBAC1B;aACF;SACF;QACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;YACjC,MAAM,KAAK,GAAG,IAAI,QAAQ,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,CAAC;YACxG,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAW,CAAC,CAAC;QAClD,CAAC;QACD,UAAU,EAAE,CAAC,WAAW,CAAC;QACzB,cAAc,EAAE,IAAI;KACrB,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { OfficeSubAgent, type OfficeSubAgentConfig } from '
|
|
2
|
-
export { COMPLETE_TOOL_DEFINITION } from '
|
|
1
|
+
export { SubAgent as OfficeSubAgent, type SubAgentConfig as OfficeSubAgentConfig } from '../common/index.js';
|
|
2
|
+
export { COMPLETE_TOOL_DEFINITION } from '../common/index.js';
|
|
3
3
|
export { WORD_SYSTEM_PROMPT, EXCEL_SYSTEM_PROMPT, POWERPOINT_SYSTEM_PROMPT, } from './prompts.js';
|
|
4
4
|
export { createWordWorkRequestTool } from './word-agent.js';
|
|
5
5
|
export { createExcelWorkRequestTool } from './excel-agent.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agents/office/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agents/office/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAE,KAAK,cAAc,IAAI,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC7G,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { OfficeSubAgent } from '
|
|
2
|
-
export { COMPLETE_TOOL_DEFINITION } from '
|
|
1
|
+
export { SubAgent as OfficeSubAgent } from '../common/index.js';
|
|
2
|
+
export { COMPLETE_TOOL_DEFINITION } from '../common/index.js';
|
|
3
3
|
export { WORD_SYSTEM_PROMPT, EXCEL_SYSTEM_PROMPT, POWERPOINT_SYSTEM_PROMPT, } from './prompts.js';
|
|
4
4
|
export { createWordWorkRequestTool } from './word-agent.js';
|
|
5
5
|
export { createExcelWorkRequestTool } from './excel-agent.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/agents/office/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/agents/office/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,IAAI,cAAc,EAA+C,MAAM,oBAAoB,CAAC;AAC7G,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"powerpoint-agent.d.ts","sourceRoot":"","sources":["../../../src/agents/office/powerpoint-agent.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAKpD,wBAAgB,+BAA+B,IAAI,YAAY,
|
|
1
|
+
{"version":3,"file":"powerpoint-agent.d.ts","sourceRoot":"","sources":["../../../src/agents/office/powerpoint-agent.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAKpD,wBAAgB,+BAA+B,IAAI,YAAY,CAkC9D"}
|