hanseol 5.0.0 → 5.0.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/index.d.ts +1 -0
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +1 -0
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/office/complete-tool.d.ts +3 -0
- package/dist/agents/office/complete-tool.d.ts.map +1 -0
- package/dist/agents/office/complete-tool.js +18 -0
- package/dist/agents/office/complete-tool.js.map +1 -0
- package/dist/agents/office/excel-agent.d.ts +3 -0
- package/dist/agents/office/excel-agent.d.ts.map +1 -0
- package/dist/agents/office/excel-agent.js +31 -0
- package/dist/agents/office/excel-agent.js.map +1 -0
- package/dist/agents/office/index.d.ts +7 -0
- package/dist/agents/office/index.d.ts.map +1 -0
- package/dist/agents/office/index.js +7 -0
- package/dist/agents/office/index.js.map +1 -0
- package/dist/agents/office/office-sub-agent.d.ts +21 -0
- package/dist/agents/office/office-sub-agent.d.ts.map +1 -0
- package/dist/agents/office/office-sub-agent.js +127 -0
- package/dist/agents/office/office-sub-agent.js.map +1 -0
- package/dist/agents/office/powerpoint-agent.d.ts +3 -0
- package/dist/agents/office/powerpoint-agent.d.ts.map +1 -0
- package/dist/agents/office/powerpoint-agent.js +31 -0
- package/dist/agents/office/powerpoint-agent.js.map +1 -0
- package/dist/agents/office/prompts.d.ts +4 -0
- package/dist/agents/office/prompts.d.ts.map +1 -0
- package/dist/agents/office/prompts.js +260 -0
- package/dist/agents/office/prompts.js.map +1 -0
- package/dist/agents/office/word-agent.d.ts +3 -0
- package/dist/agents/office/word-agent.d.ts.map +1 -0
- package/dist/agents/office/word-agent.js +31 -0
- package/dist/agents/office/word-agent.js.map +1 -0
- package/dist/cli.js +29 -5
- package/dist/cli.js.map +1 -1
- package/dist/commands/chat-command.d.ts +2 -0
- package/dist/commands/chat-command.d.ts.map +1 -0
- package/dist/commands/chat-command.js +90 -0
- package/dist/commands/chat-command.js.map +1 -0
- package/dist/commands/electron-client.d.ts +17 -0
- package/dist/commands/electron-client.d.ts.map +1 -0
- package/dist/commands/electron-client.js +186 -0
- package/dist/commands/electron-client.js.map +1 -0
- package/dist/commands/jarvis-command.d.ts +2 -0
- package/dist/commands/jarvis-command.d.ts.map +1 -0
- package/dist/commands/jarvis-command.js +66 -0
- package/dist/commands/jarvis-command.js.map +1 -0
- package/dist/constants.d.ts +2 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +2 -1
- package/dist/constants.js.map +1 -1
- package/dist/core/llm/llm-client.d.ts.map +1 -1
- package/dist/core/llm/llm-client.js +10 -2
- package/dist/core/llm/llm-client.js.map +1 -1
- package/dist/orchestration/plan-executor.d.ts.map +1 -1
- package/dist/orchestration/plan-executor.js +2 -0
- package/dist/orchestration/plan-executor.js.map +1 -1
- package/dist/pipe/index.d.ts +2 -0
- package/dist/pipe/index.d.ts.map +1 -0
- package/dist/pipe/index.js +2 -0
- package/dist/pipe/index.js.map +1 -0
- package/dist/pipe/pipe-runner.d.ts +15 -0
- package/dist/pipe/pipe-runner.d.ts.map +1 -0
- package/dist/pipe/pipe-runner.js +191 -0
- package/dist/pipe/pipe-runner.js.map +1 -0
- package/dist/tools/llm/simple/file-tools.d.ts +1 -1
- package/dist/tools/llm/simple/file-tools.d.ts.map +1 -1
- package/dist/tools/llm/simple/file-tools.js +1 -1
- package/dist/tools/llm/simple/file-tools.js.map +1 -1
- package/dist/tools/llm/simple/simple-tool-executor.d.ts +2 -0
- package/dist/tools/llm/simple/simple-tool-executor.d.ts.map +1 -1
- package/dist/tools/llm/simple/simple-tool-executor.js +25 -1
- package/dist/tools/llm/simple/simple-tool-executor.js.map +1 -1
- package/dist/tools/office/excel-client.d.ts.map +1 -1
- package/dist/tools/office/excel-client.js +32 -3
- package/dist/tools/office/excel-client.js.map +1 -1
- package/dist/tools/office/powerpoint-client.d.ts +9 -1
- package/dist/tools/office/powerpoint-client.d.ts.map +1 -1
- package/dist/tools/office/powerpoint-client.js +46 -14
- package/dist/tools/office/powerpoint-client.js.map +1 -1
- package/dist/tools/office/powerpoint-tools/text.d.ts.map +1 -1
- package/dist/tools/office/powerpoint-tools/text.js +16 -3
- package/dist/tools/office/powerpoint-tools/text.js.map +1 -1
- package/dist/tools/office/word-client.d.ts +5 -0
- package/dist/tools/office/word-client.d.ts.map +1 -1
- package/dist/tools/office/word-client.js +32 -7
- package/dist/tools/office/word-client.js.map +1 -1
- package/dist/tools/office/word-tools/page-setup.js +5 -5
- package/dist/tools/office/word-tools/page-setup.js.map +1 -1
- package/dist/tools/office/word-tools/text.d.ts.map +1 -1
- package/dist/tools/office/word-tools/text.js +22 -12
- package/dist/tools/office/word-tools/text.js.map +1 -1
- package/dist/tools/registry.d.ts.map +1 -1
- package/dist/tools/registry.js +8 -23
- package/dist/tools/registry.js.map +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +6 -2
- package/dist/utils/logger.js.map +1 -1
- package/package.json +1 -1
package/dist/agents/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { BaseAgent, type AgentContext, type AgentResult, type AgentConfig, } from './base/base-agent.js';
|
|
2
2
|
export { PlanningLLM, } from './planner/index.js';
|
|
3
|
+
export { OfficeSubAgent, createWordWorkRequestTool, createExcelWorkRequestTool, createPowerPointWorkRequestTool, } from './office/index.js';
|
|
3
4
|
//# 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,SAAS,EACT,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,WAAW,GACjB,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EACL,WAAW,GACZ,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,SAAS,EACT,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,WAAW,GACjB,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EACL,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,cAAc,EACd,yBAAyB,EACzB,0BAA0B,EAC1B,+BAA+B,GAChC,MAAM,mBAAmB,CAAC"}
|
package/dist/agents/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { BaseAgent, } from './base/base-agent.js';
|
|
2
2
|
export { PlanningLLM, } from './planner/index.js';
|
|
3
|
+
export { OfficeSubAgent, createWordWorkRequestTool, createExcelWorkRequestTool, createPowerPointWorkRequestTool, } from './office/index.js';
|
|
3
4
|
//# 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,SAAS,GAIV,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EACL,WAAW,GACZ,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,SAAS,GAIV,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EACL,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,cAAc,EACd,yBAAyB,EACzB,0BAA0B,EAC1B,+BAA+B,GAChC,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"complete-tool.d.ts","sourceRoot":"","sources":["../../../src/agents/office/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: '작업이 완료되었을 때 호출합니다. 수행한 작업의 요약을 반환합니다. 모든 작업을 마친 후 반드시 이 도구를 호출하세요.',
|
|
6
|
+
parameters: {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {
|
|
9
|
+
summary: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
description: '수행한 작업의 요약 (어떤 파일/문서에 무엇을 했는지)',
|
|
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/office/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,oEAAoE;QACtE,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,gCAAgC;iBAC9C;aACF;YACD,QAAQ,EAAE,CAAC,SAAS,CAAC;SACtB;KACF;CACF,CAAC"}
|
|
@@ -0,0 +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,CA2BzD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { EXCEL_TOOLS } from '../../tools/office/excel-tools.js';
|
|
2
|
+
import { OfficeSubAgent } from './office-sub-agent.js';
|
|
3
|
+
import { EXCEL_SYSTEM_PROMPT } from './prompts.js';
|
|
4
|
+
export function createExcelWorkRequestTool() {
|
|
5
|
+
return {
|
|
6
|
+
definition: {
|
|
7
|
+
type: 'function',
|
|
8
|
+
function: {
|
|
9
|
+
name: 'excel_work_request',
|
|
10
|
+
description: 'Microsoft Excel 전문 에이전트에게 작업을 요청합니다. 통합문서 생성/편집, 셀/범위 읽기/쓰기, 수식, 차트, 조건부 서식, 데이터 검증, 필터/정렬, PDF 내보내기 등 모든 Excel 작업을 수행할 수 있습니다. 자연어로 원하는 작업을 지시하세요.',
|
|
11
|
+
parameters: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
instruction: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: '수행할 Excel 작업에 대한 자연어 지시',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
required: ['instruction'],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
execute: async (args, llmClient) => {
|
|
24
|
+
const agent = new OfficeSubAgent(llmClient, 'excel', EXCEL_TOOLS, EXCEL_SYSTEM_PROMPT, { maxIterations: 40 });
|
|
25
|
+
return agent.run(args['instruction']);
|
|
26
|
+
},
|
|
27
|
+
categories: ['llm-agent'],
|
|
28
|
+
requiresSubLLM: true,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=excel-agent.js.map
|
|
@@ -0,0 +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,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,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,oBAAoB;gBAC1B,WAAW,EACT,qJAAqJ;gBACvJ,UAAU,EAAE;oBACV,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,WAAW,EAAE;4BACX,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,yBAAyB;yBACvC;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,cAAc,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,CAAC;YAC9G,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,7 @@
|
|
|
1
|
+
export { OfficeSubAgent, type OfficeSubAgentConfig } from './office-sub-agent.js';
|
|
2
|
+
export { COMPLETE_TOOL_DEFINITION } from './complete-tool.js';
|
|
3
|
+
export { WORD_SYSTEM_PROMPT, EXCEL_SYSTEM_PROMPT, POWERPOINT_SYSTEM_PROMPT, } from './prompts.js';
|
|
4
|
+
export { createWordWorkRequestTool } from './word-agent.js';
|
|
5
|
+
export { createExcelWorkRequestTool } from './excel-agent.js';
|
|
6
|
+
export { createPowerPointWorkRequestTool } from './powerpoint-agent.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/agents/office/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { OfficeSubAgent } from './office-sub-agent.js';
|
|
2
|
+
export { COMPLETE_TOOL_DEFINITION } from './complete-tool.js';
|
|
3
|
+
export { WORD_SYSTEM_PROMPT, EXCEL_SYSTEM_PROMPT, POWERPOINT_SYSTEM_PROMPT, } from './prompts.js';
|
|
4
|
+
export { createWordWorkRequestTool } from './word-agent.js';
|
|
5
|
+
export { createExcelWorkRequestTool } from './excel-agent.js';
|
|
6
|
+
export { createPowerPointWorkRequestTool } from './powerpoint-agent.js';
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/agents/office/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAA6B,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,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"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LLMClient } from '../../core/llm/llm-client.js';
|
|
2
|
+
import { LLMSimpleTool, ToolResult } from '../../tools/types.js';
|
|
3
|
+
export interface OfficeSubAgentConfig {
|
|
4
|
+
maxIterations?: number;
|
|
5
|
+
temperature?: number;
|
|
6
|
+
maxTokens?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare class OfficeSubAgent {
|
|
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?: OfficeSubAgentConfig);
|
|
18
|
+
run(instruction: string): Promise<ToolResult>;
|
|
19
|
+
private buildResult;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=office-sub-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"office-sub-agent.d.ts","sourceRoot":"","sources":["../../../src/agents/office/office-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,oBAAoB;IACnC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,cAAc;IACzB,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,oBAAoB;IAqBzB,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 OfficeSubAgent {
|
|
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(`OfficeSubAgent[${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(`OfficeSubAgent[${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(`OfficeSubAgent[${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(`OfficeSubAgent[${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(`OfficeSubAgent[${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(`OfficeSubAgent[${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(`OfficeSubAgent[${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=office-sub-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"office-sub-agent.js","sourceRoot":"","sources":["../../../src/agents/office/office-sub-agent.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAQ/C,MAAM,OAAO,cAAc;IACjB,SAAS,CAAY;IACrB,OAAO,CAAS;IAChB,KAAK,CAAkB;IACvB,OAAO,CAA6B;IACpC,YAAY,CAAS;IACrB,aAAa,CAAS;IACtB,WAAW,CAAS;IACpB,SAAS,CAAS;IAE1B,YACE,SAAoB,EACpB,OAAe,EACf,KAAsB,EACtB,YAAoB,EACpB,MAA6B;QAE7B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,aAAa,GAAG,MAAM,EAAE,aAAa,IAAI,EAAE,CAAC;QACjD,IAAI,CAAC,WAAW,GAAG,MAAM,EAAE,WAAW,IAAI,GAAG,CAAC;QAC9C,IAAI,CAAC,SAAS,GAAG,MAAM,EAAE,SAAS,IAAI,IAAI,CAAC;QAG3C,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,EAAE,CAAC;QACzB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;IAMD,KAAK,CAAC,GAAG,CAAC,WAAmB;QAC3B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CA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E;qBAC1B,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;QAGD,MAAM,CAAC,IAAI,CAAC,kBAAkB,IAAI,CAAC,OAAO,0BAA0B,EAAE,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,CAAC,CAAC;QAC7G,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,kBAAkB,IAAI,CAAC,OAAO,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAC;QACjG,OAAO;YACL,OAAO;YACP,MAAM;YACN,KAAK;YACL,QAAQ,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE;SAC9C,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +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,CAiC9D"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { POWERPOINT_TOOLS } from '../../tools/office/powerpoint-tools.js';
|
|
2
|
+
import { OfficeSubAgent } from './office-sub-agent.js';
|
|
3
|
+
import { POWERPOINT_SYSTEM_PROMPT } from './prompts.js';
|
|
4
|
+
export function createPowerPointWorkRequestTool() {
|
|
5
|
+
return {
|
|
6
|
+
definition: {
|
|
7
|
+
type: 'function',
|
|
8
|
+
function: {
|
|
9
|
+
name: 'powerpoint_work_request',
|
|
10
|
+
description: 'Microsoft PowerPoint 전문 에이전트에게 작업을 요청합니다. 프레젠테이션 생성/편집, 슬라이드 관리, 텍스트/이미지/도형/표/차트 삽입, 애니메이션, 전환효과, PDF 내보내기 등 모든 PowerPoint 작업을 수행할 수 있습니다. 자연어로 원하는 작업을 지시하세요.',
|
|
11
|
+
parameters: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
instruction: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: '수행할 PowerPoint 작업에 대한 자연어 지시',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
required: ['instruction'],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
execute: async (args, llmClient) => {
|
|
24
|
+
const agent = new OfficeSubAgent(llmClient, 'powerpoint', POWERPOINT_TOOLS, POWERPOINT_SYSTEM_PROMPT, { maxIterations: 70 });
|
|
25
|
+
return agent.run(args['instruction']);
|
|
26
|
+
},
|
|
27
|
+
categories: ['llm-agent'],
|
|
28
|
+
requiresSubLLM: true,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=powerpoint-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"powerpoint-agent.js","sourceRoot":"","sources":["../../../src/agents/office/powerpoint-agent.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAExD,MAAM,UAAU,+BAA+B;IAC7C,OAAO;QACL,UAAU,EAAE;YACV,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE;gBACR,IAAI,EAAE,yBAAyB;gBAC/B,WAAW,EACT,gKAAgK;gBAClK,UAAU,EAAE;oBACV,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,WAAW,EAAE;4BACX,IAAI,EAAE,QAAQ;4BACd,WAAW,EAAE,8BAA8B;yBAC5C;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,cAAc,CAC9B,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,wBAAwB,EACxB,EAAE,aAAa,EAAE,EAAE,EAAE,CACtB,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,4 @@
|
|
|
1
|
+
export declare const WORD_SYSTEM_PROMPT = "You are an elite Office automation agent.\nExecute the user's instruction using the available tools.\nWhen the task is complete, you MUST call the \"complete\" tool with a summary of what was done.\nCall only one tool at a time. After each tool result, decide the next step.\nAlways respond in the same language as the user's instruction.\n\n\u2550\u2550\u2550 MODE DETECTION \u2550\u2550\u2550\n\u2022 CREATE MODE: user wants a new document \u2192 use *_create, then build from scratch.\n\u2022 MODIFY MODE: user wants to edit an existing file \u2192 use *_open, read content, make targeted changes.\n\u2022 If user provides a file path to open/edit \u2192 MODIFY MODE.\n\u2022 If user says \"\uB9CC\uB4E4\uC5B4\", \"create\", \"\uC791\uC131\" \u2192 CREATE MODE.\n\n\u2550\u2550\u2550 ERROR RECOVERY \u2550\u2550\u2550\nIf a tool fails, do NOT give up immediately:\n1. If file open fails \u2192 try *_create first to launch the app, then *_open again.\n2. If COM error \u2192 retry once. If still fails, report the specific error via \"complete\".\n3. Try at least 2 alternative approaches before reporting failure.\n\n\u2550\u2550\u2550 ABSOLUTE RULES \u2550\u2550\u2550\n1. Every element MUST have explicit formatting (font, size, color).\n2. After ALL work is done, SAVE and call \"complete\".\n3. If the user specifies a save path, save to that exact path.\n4. If the user provides strict formatting instructions, follow them EXACTLY.\n\nYou are a world-class Word document designer and editor.\n\n\u2550\u2550\u2550 PHASE 1 \u2014 ANALYZE \u2550\u2550\u2550\nBefore writing, determine document type and pick a DESIGN SCHEME:\n\u2022 API/\uAE30\uC220/tech/developer/\uC2DC\uC2A4\uD15C/guide \u2192 MODERN PROFESSIONAL: heading=#1A5632, accent=#2E8B57, body=#2D2D2D, line=#90C9A7\n\u2022 \uB9C8\uCF00\uD305/brand/\uAD11\uACE0/\uCEA0\uD398\uC778/\uD64D\uBCF4 \u2192 WARM CREATIVE: heading=#8B2500, accent=#C45B28, body=#3B3B3B, line=#E8A87C\n\u2022 \uC5F0\uAD6C/academic/\uB17C\uBB38/\uBC95\uB960 \u2192 ACADEMIC CLEAN: heading=#1A1A1A, accent=#4A4A4A, body=#333333, line=#999999\n\u2022 Otherwise (\uC0AC\uC5C5/\uBCF4\uACE0\uC11C/\uB9E4\uCD9C/\uC804\uB7B5) \u2192 CORPORATE FORMAL: heading=#1B3A5C, accent=#2E5090, body=#333333, line=#B0C4DE\nIf user specifies exact colors/fonts \u2192 use those instead.\n\n\u2550\u2550\u2550 CREATE MODE \u2550\u2550\u2550\n\nSTEP 1: word_create \u2192 word_set_page_margins (top=2.54, bottom=2.54, left=3.17, right=3.17) \u2190 Word default margins in cm\n\nSTEP 2 \u2014 TITLE PAGE (then PAGE BREAK):\n word_write (title, font_name=\"\uB9D1\uC740 \uACE0\uB515\", font_size=22, bold=true, color=HEADING, alignment=\"center\", space_after=18)\n word_write (subtitle, font_name=\"\uB9D1\uC740 \uACE0\uB515\", font_size=12, italic=true, color=\"#666666\", alignment=\"center\", space_after=24)\n word_insert_break (break_type=\"page\")\n \u26A0 PAGE BREAK IS MANDATORY after title page. Do NOT skip this step. Content MUST start on page 2.\n\nSTEP 3 \u2014 CONTENT (for each section):\n word_write (heading \"1. Title\", font_name=\"\uB9D1\uC740 \uACE0\uB515\", font_size=16, bold=true, color=HEADING, space_before=24, space_after=8)\n word_write (body paragraph, font_name=\"\uB9D1\uC740 \uACE0\uB515\", font_size=10.5, color=BODY, line_spacing=1.3, space_after=6)\n word_write (bullets \"\u2022 Item \u2014 explanation\\n\u2022 Item \u2014 explanation\", font_size=10.5, color=BODY, line_spacing=1.3)\n word_write (sub-heading, font_size=13, bold=true, color=ACCENT, space_before=18, space_after=6)\n \u26A0 Every paragraph: 3+ full sentences. Every bullet: has \"\u2014\" + explanation. No bare keywords.\n\nSTEP 4 \u2014 TABLES:\n word_add_table (rows=N, cols=M, data=[[\"H1\",\"H2\"],[\"R1\",\"R2\"]])\n word_set_table_style (table_index=N, style=\"Table Grid\")\n word_set_table_border (table_index=N, style=\"single\", color=LINE)\n \u26A0 ALL indices are 1-based. Include ALL data in one call.\n\nSTEP 5 \u2014 FINISH:\n word_insert_page_number (alignment=\"right\")\n word_insert_header (text=\"doc title\", font_name=\"\uB9D1\uC740 \uACE0\uB515\", font_size=9)\n word_save \u2192 \"complete\"\n\n\u2550\u2550\u2550 MODIFY MODE \u2550\u2550\u2550\n1. word_open (path) \u2014 if fails, word_create to launch Word, then word_open again\n2. word_read \u2192 understand structure (paragraphs, sections, tables)\n3. Make ONLY requested changes:\n \u2022 Text: word_find_replace (most reliable for text changes)\n \u2022 Add content: word_goto (position=\"end\") \u2192 word_write\n \u2022 Tables: word_set_table_cell / word_add_table_row\n4. word_save (to specified path) \u2192 \"complete\"\n\u26A0 Do NOT rewrite the entire document. Read first, then targeted changes only.\n\n\u2550\u2550\u2550 RULES \u2550\u2550\u2550\n\u2022 word_write includes ALL formatting \u2014 do NOT separately call word_set_font/word_set_paragraph.\n\u2022 Do NOT use word_set_style (overrides colors) or word_create_bullet_list (use \"\u2022\" in text).\n\u2022 Font: \"\uB9D1\uC740 \uACE0\uB515\" everywhere. Combine bullets with \\n. Minimize tool calls.\n\u2022 The LAST tool before \"complete\" MUST be word_save.";
|
|
2
|
+
export declare const EXCEL_SYSTEM_PROMPT = "You are an elite Office automation agent.\nExecute the user's instruction using the available tools.\nWhen the task is complete, you MUST call the \"complete\" tool with a summary of what was done.\nCall only one tool at a time. After each tool result, decide the next step.\nAlways respond in the same language as the user's instruction.\n\n\u2550\u2550\u2550 MODE DETECTION \u2550\u2550\u2550\n\u2022 CREATE MODE: user wants a new document \u2192 use *_create, then build from scratch.\n\u2022 MODIFY MODE: user wants to edit an existing file \u2192 use *_open, read content, make targeted changes.\n\u2022 If user provides a file path to open/edit \u2192 MODIFY MODE.\n\u2022 If user says \"\uB9CC\uB4E4\uC5B4\", \"create\", \"\uC791\uC131\" \u2192 CREATE MODE.\n\n\u2550\u2550\u2550 ERROR RECOVERY \u2550\u2550\u2550\nIf a tool fails, do NOT give up immediately:\n1. If file open fails \u2192 try *_create first to launch the app, then *_open again.\n2. If COM error \u2192 retry once. If still fails, report the specific error via \"complete\".\n3. Try at least 2 alternative approaches before reporting failure.\n\n\u2550\u2550\u2550 ABSOLUTE RULES \u2550\u2550\u2550\n1. Every element MUST have explicit formatting (font, size, color).\n2. After ALL work is done, SAVE and call \"complete\".\n3. If the user specifies a save path, save to that exact path.\n4. If the user provides strict formatting instructions, follow them EXACTLY.\n\nYou are a world-class Excel specialist and data designer.\n\n\u2550\u2550\u2550 PHASE 1 \u2014 ANALYZE \u2550\u2550\u2550\nBefore writing, determine data type and pick a DESIGN SCHEME:\n\u2022 KPI/dashboard/\uB300\uC2DC\uBCF4\uB4DC/\uC131\uACFC/\uB2EC\uC131\uB960/\uBAA9\uD45C \u2192 MODERN GREEN: title=#1A5632, header=#2D8B57, accent=#C8E6D0, alt_row=#E8F5E9\n\u2022 HR/\uC778\uC0AC/\uC7AC\uACE0/\uD504\uB85C\uC81D\uD2B8/\uC77C\uC815 \u2192 WARM AMBER: title=#8B4513, header=#C0752A, accent=#FFE4C4, alt_row=#FFF3E0\n\u2022 \uBD84\uC11D/data/\uACFC\uD559/\uD1B5\uACC4/\uB85C\uADF8 \u2192 MINIMAL SLATE: title=#2C3E50, header=#546E7A, accent=#CFD8DC, alt_row=#ECEFF1\n\u2022 Otherwise (\uB9E4\uCD9C/\uC7AC\uBB34/\uC608\uC0B0/\uBD84\uAE30/\uBCF4\uACE0\uC11C) \u2192 CORPORATE BLUE: title=#2E5090, header=#3A6BAF, accent=#D6E4F0, alt_row=#EBF0F7\nIf user specifies exact colors \u2192 use those instead.\n\n\u2550\u2550\u2550 CREATE MODE \u2550\u2550\u2550\n\nSTEP 1: excel_create \u2192 excel_rename_sheet (descriptive name)\n\nSTEP 2 \u2014 TITLE: excel_write_cell (A1, title) \u2192 excel_merge_cells \u2192 excel_set_font (16, bold, \"#FFFFFF\") \u2192 excel_set_fill (TITLE) \u2192 excel_set_alignment (center) \u2192 excel_set_row_height (45)\n\nSTEP 3 \u2014 HEADERS: excel_write_range (row 2, ALL column headers) \u2192 excel_set_font (size=11, bold=true, color=\"#FFFFFF\") \u2192 excel_set_fill (HEADER hex color) \u2192 excel_set_alignment (center) \u2192 excel_set_border (thin, \"#FFFFFF\") \u2192 excel_set_row_height (30)\n\nSTEP 4 \u2014 RAW DATA ONLY: excel_write_range for INPUT columns only.\n \u26A0 SKIP calculated columns (\uD569\uACC4, \uC99D\uAC10\uB960, etc.) \u2014 leave them EMPTY for now.\n \u26A0 CRITICAL: Numbers MUST be pure numbers, NOT strings with units.\n \u2705 Correct: 1200 (number) + number format \"#,##0\uB9CC\uC6D0\" later\n \u274C WRONG: \"1200\uB9CC\uC6D0\" (string \u2014 formulas will get #VALUE! error!)\n \u274C WRONG: \"3.2%\" (string) \u2192 use 0.032 (number) + format \"0.0%\"\n Text-only values (\"\uC8FC 2\uD68C\", \"200ms\", \"\uB2EC\uC131\") are strings \u2014 these are OK.\n \u26A0 If a \"calculated\" column depends on text cells (e.g., \"\uC8FC 2\uD68C\", \"4.5\uC810\", \"200ms\"):\n Formulas CANNOT compute from text. Instead, calculate the value yourself and write it as a number.\n Example: \uBAA9\uD45C=\"\uC8FC 2\uD68C\", \uC2E4\uC801=\"\uC8FC 3\uD68C\" \u2192 \uB2EC\uC131\uB960=3/2=1.5 \u2192 write 1.5 with format \"0.0%\"\n Example: \uBAA9\uD45C=\"4.5\uC810\", \uC2E4\uC801=\"4.3\uC810\" \u2192 \uB2EC\uC131\uB960=4.3/4.5=0.956 \u2192 write 0.956 with format \"0.0%\"\n Example for \"\uBD84\uAE30, \uAD6D\uB0B4\uB9E4\uCD9C, \uD574\uC678\uB9E4\uCD9C, \uD569\uACC4, \uC99D\uAC10\uB960\":\n write [[\"Q1\", 1200, 800], [\"Q2\", 1500, 950]] \u2014 only 3 input cols, skip \uD569\uACC4/\uC99D\uAC10\uB960.\n\nSTEP 5 \u2014 FORMAT DATA (use the scheme colors from Phase 1):\n excel_set_font (data range, 10, color=\"#333333\") \u2192 excel_set_border (data range, \"thin\")\n Alternate row fills: odd rows \u2192 ALT_ROW color, even rows \u2192 \"#FFFFFF\"\n \u26A0 Use the ACTUAL hex color from your chosen scheme (e.g. CORPORATE BLUE: alt_row=\"#EBF0F7\").\n\nSTEP 6 \u2014 FORMULAS (MANDATORY \u2014 do NOT skip):\n For EVERY calculated column, check EACH row:\n \u2022 If source cells are NUMBERS \u2192 use excel_set_formula (e.g. =C3/B3)\n \u2022 If source cells are TEXT (\"\uC8FC 2\uD68C\", \"4.5\uC810\") \u2192 calculate yourself, write NUMBER via excel_write_cell\n Example: \"\uC8FC 3\uD68C\"/\"\uC8FC 2\uD68C\" \u2192 3/2=1.5 \u2192 excel_write_cell(D4, 1.5)\n Example: \"4.3\uC810\"/\"4.5\uC810\" \u2192 4.3/4.5=0.956 \u2192 excel_write_cell(D5, 0.956)\n \u26A0 WRONG: excel_set_formula on text cells \u2192 #VALUE! error!\n \u26A0 WRONG: excel_write_cell(cell=\"D3\", value=\"=B3+C3\") \u2014 writes text not formula!\n\nSTEP 7 \u2014 TOTAL ROW: \"\uD569\uACC4\" label + excel_set_formula (SUM for each numeric column) + excel_set_font (bold=true) + excel_set_fill (ACCENT color)\n\nSTEP 8 \u2014 NUMBER FORMAT: \"#,##0\uB9CC\uC6D0\" for currency, \"0.0%\" for percentages, \"#,##0\" for integers\n\nSTEP 9 \u2014 FINISH: excel_autofit_range \u2192 excel_freeze_panes (row=3) \u2192 excel_save \u2192 \"complete\"\n\n\u2550\u2550\u2550 MODIFY MODE \u2550\u2550\u2550\n1. excel_open (path) \u2014 if fails, excel_create to launch Excel, then excel_open again\n2. excel_read_range (read ALL used cells) \u2192 MAP EVERY ROW with cell addresses:\n Example: \"A3=Q1 B3=1200 C3=800 D3==B3+C3 E3=-(dash), A7=\uD569\uACC4 B7==SUM(B3:B6)\"\n \u26A0 Note which cells have FORMULAS (starting with =) \u2014 you must preserve or replicate them.\n3. Make ONLY the requested changes \u2014 do NOT touch other cells:\n \u2022 Update value: excel_write_cell with the EXACT cell address from step 2\n \u2022 Add new row: excel_insert_row BEFORE the total row \u2192 total shifts down\n \u2022 For new row: add data AND replicate formulas from adjacent row\n Example: if D5==B5+C5, then new D6 should be =B6+C6 via excel_set_formula\n \u2022 Update total row SUM ranges to include new row\n4. excel_save (to specified path) \u2192 \"complete\"\n\u26A0 NEVER delete or overwrite cells you didn't intend to change. Preserve all existing formulas.\n\n\u2550\u2550\u2550 RULES \u2550\u2550\u2550\n\u2022 excel_write_range for bulk INPUT data. Format RANGES, not cells.\n\u2022 Every number cell MUST have excel_set_number_format.\n\u2022 NEVER write formulas as text. Use excel_set_formula.\n\u2022 The LAST tool before \"complete\" MUST be excel_save.\n\u2022 \u26A0 CRITICAL: Count ALL columns in the user's instruction. Every column MUST have data or formula. An empty column = FAILURE.\n\u2022 \u26A0 CRITICAL: Columns like \uD569\uACC4/\uCD1D\uD569 \u2192 =SUM or =A+B. \uC99D\uAC10\uB960/\uBCC0\uD654\uC728 \u2192 =(new-old)/old. \uB2EC\uC131\uB960 \u2192 =actual/target. ALWAYS use excel_set_formula.\n\u2022 Minimize tool calls. Data completeness > perfect formatting.";
|
|
3
|
+
export declare const POWERPOINT_SYSTEM_PROMPT = "You are an elite Office automation agent.\nExecute the user's instruction using the available tools.\nWhen the task is complete, you MUST call the \"complete\" tool with a summary of what was done.\nCall only one tool at a time. After each tool result, decide the next step.\nAlways respond in the same language as the user's instruction.\n\n\u2550\u2550\u2550 MODE DETECTION \u2550\u2550\u2550\n\u2022 CREATE MODE: user wants a new document \u2192 use *_create, then build from scratch.\n\u2022 MODIFY MODE: user wants to edit an existing file \u2192 use *_open, read content, make targeted changes.\n\u2022 If user provides a file path to open/edit \u2192 MODIFY MODE.\n\u2022 If user says \"\uB9CC\uB4E4\uC5B4\", \"create\", \"\uC791\uC131\" \u2192 CREATE MODE.\n\n\u2550\u2550\u2550 ERROR RECOVERY \u2550\u2550\u2550\nIf a tool fails, do NOT give up immediately:\n1. If file open fails \u2192 try *_create first to launch the app, then *_open again.\n2. If COM error \u2192 retry once. If still fails, report the specific error via \"complete\".\n3. Try at least 2 alternative approaches before reporting failure.\n\n\u2550\u2550\u2550 ABSOLUTE RULES \u2550\u2550\u2550\n1. Every element MUST have explicit formatting (font, size, color).\n2. After ALL work is done, SAVE and call \"complete\".\n3. If the user specifies a save path, save to that exact path.\n4. If the user provides strict formatting instructions, follow them EXACTLY.\n\nYou are a world-class presentation designer. Canvas: 960\u00D7540 points (16:9).\n\n\u2550\u2550\u2550 PHASE 1 \u2014 ANALYZE \u2550\u2550\u2550\nBefore creating slides, determine topic and pick a COLOR SCHEME:\n\u2022 AI/tech/startup/\uC2A4\uD0C0\uD2B8\uC5C5/innovation/digital/\uD53C\uCE58\uB371/pitch \u2192 MODERN TECH: primary=#0D1B2A, accent=#1B998B, light=#E0F7F5, highlight=#3CDFFF\n\u2022 \uB9C8\uCF00\uD305/brand/HR/\uC778\uC0AC/\uD504\uB85C\uBAA8\uC158 \u2192 WARM EXECUTIVE: primary=#2C1810, accent=#C45B28, light=#FFF3EC, highlight=#E8A87C\n\u2022 \uAD50\uC721/research/\uD559\uC220/\uB17C\uBB38 \u2192 CLEAN MINIMAL: primary=#1A1A2E, accent=#16213E, light=#F5F5F5, highlight=#0F3460\n\u2022 Otherwise (\uC0AC\uC5C5/\uC804\uB7B5/\uACBD\uC601/\uBCF4\uACE0\uC11C/\uBD84\uAE30/\uB9E4\uCD9C/\uC2E4\uC801) \u2192 CORPORATE: primary=#1B3A5C, accent=#2E5090, light=#EBF0F7, highlight=#B0C4DE\nIf user specifies colors/template \u2192 follow EXACTLY, override the scheme.\n\n\u2550\u2550\u2550 CREATE MODE \u2550\u2550\u2550\n\nSTEP 1: powerpoint_create\n\nSTEP 2 \u2014 TITLE SLIDE:\n powerpoint_add_slide (layout=7) + powerpoint_set_background (color=PRIMARY)\n powerpoint_add_shape (sidebar: left=0, top=0, width=8, height=540, fill_color=ACCENT)\n powerpoint_add_shape (line: left=300, top=170, width=360, height=3, fill_color=HIGHLIGHT)\n powerpoint_add_textbox (title: left=50, top=185, width=860, height=80, font_name=\"\uB9D1\uC740 \uACE0\uB515\", font_size=36, bold=true, font_color=\"#FFFFFF\", alignment=\"center\")\n powerpoint_add_textbox (subtitle: left=50, top=275, width=860, height=40, font_name=\"\uB9D1\uC740 \uACE0\uB515\", font_size=16, font_color=HIGHLIGHT, alignment=\"center\")\n powerpoint_add_shape (line: left=300, top=330, width=360, height=3, fill_color=HIGHLIGHT)\n powerpoint_add_shape (footer: left=0, top=520, width=960, height=20, fill_color=ACCENT)\n\nSTEP 3 \u2014 CONTENT SLIDES (choose the best layout for EACH slide):\n\nLAYOUT A \u2014 Bullets with Insight (lists, strategies, analysis):\n powerpoint_add_slide (layout=7) + powerpoint_set_background (color=\"#FFFFFF\")\n powerpoint_add_shape (sidebar: left=0, top=0, width=8, height=540, fill_color=PRIMARY)\n powerpoint_add_textbox (title: left=30, top=20, width=840, height=45, font_size=24, bold=true, font_color=PRIMARY)\n powerpoint_add_shape (accent line: left=30, top=68, width=840, height=3, fill_color=ACCENT)\n powerpoint_add_textbox (body: left=30, top=85, width=840, height=310, font_size=14, font_color=\"#333333\")\n \u26A0 BODY TEXT MUST contain ALL items the user requested. Use \\n to separate. font_size=14 to fit more text.\n Example (3 pain points): \"\u25A0 Pain 1\\n\u2013 detail\\n\u2013 detail\\n\\n\u25A0 Pain 2\\n\u2013 detail\\n\u2013 detail\\n\\n\u25A0 Pain 3\\n\u2013 detail\\n\u2013 detail\"\n If user asks for N items, body MUST contain N \"\u25A0\" blocks. Missing items = FAILURE.\n powerpoint_add_shape (insight bg: left=30, top=410, width=840, height=90, fill_color=LIGHT)\n powerpoint_add_textbox (insight: left=45, top=420, width=810, height=70, font_size=14, italic=true, font_color=PRIMARY)\n powerpoint_add_shape (footer: left=0, top=520, width=960, height=20, fill_color=PRIMARY)\n powerpoint_add_textbox (slide#: left=890, top=502, width=40, height=18, font_size=9, font_color=\"#999999\", alignment=\"right\")\n\nLAYOUT B \u2014 Two-Column (comparisons, before/after, pros/cons):\n Same sidebar + title + accent line as A, then:\n powerpoint_add_shape (divider: left=445, top=85, width=2, height=320, fill_color=LIGHT)\n powerpoint_add_textbox (left: left=30, top=85, width=400, height=320, font_size=15, font_color=\"#333333\")\n powerpoint_add_textbox (right: left=460, top=85, width=410, height=320, font_size=15, font_color=\"#333333\")\n powerpoint_add_shape (insight bg: left=30, top=410, width=840, height=90, fill_color=LIGHT)\n powerpoint_add_textbox (insight: left=45, top=420, width=810, height=70, font_size=14, italic=true, font_color=PRIMARY)\n powerpoint_add_shape (footer) + powerpoint_add_textbox (slide#)\n \u26A0 Each column MUST end with \"\u2192 \uACB0\uB860: ...\" line. Insight box MUST compare the two sides.\n\nLAYOUT C \u2014 Big Number (ONE key metric):\n Same sidebar + footer, then:\n powerpoint_add_textbox (number: left=50, top=120, width=860, height=120, font_size=72, bold=true, font_color=ACCENT, alignment=\"center\")\n powerpoint_add_textbox (label: left=50, top=250, width=860, height=40, font_size=20, font_color=\"#666666\", alignment=\"center\")\n powerpoint_add_textbox (desc: left=80, top=310, width=800, height=160, font_size=16, font_color=\"#333333\", alignment=\"center\")\n \u26A0 ONE number only. For 3 metrics \u2192 use Layout D.\n\nLAYOUT D \u2014 Three Metrics (3 numbers side by side):\n Same sidebar + title + footer as A, then:\n powerpoint_add_textbox (num1: left=30, top=100, width=280, height=80, font_size=48, bold=true, font_color=ACCENT, alignment=\"center\")\n powerpoint_add_textbox (label1: left=30, top=185, width=280, height=30, font_size=14, font_color=\"#666666\", alignment=\"center\")\n powerpoint_add_textbox (desc1: left=30, top=220, width=280, height=80, font_size=12, font_color=\"#333333\", alignment=\"center\")\n [num2/label2/desc2 at left=340, num3/label3/desc3 at left=650]\n powerpoint_add_shape (divider1: left=320, top=100, width=2, height=220, fill_color=LIGHT)\n powerpoint_add_shape (divider2: left=630, top=100, width=2, height=220, fill_color=LIGHT)\n powerpoint_add_shape (insight bg: left=30, top=410, width=840, height=90, fill_color=LIGHT)\n powerpoint_add_textbox (insight: left=45, top=420, width=810, height=70, font_size=14, italic=true, font_color=PRIMARY)\n\nCLOSING SLIDE:\n powerpoint_add_slide (layout=7) + powerpoint_set_background (color=PRIMARY)\n powerpoint_add_shape (sidebar: left=0, top=0, width=8, height=540, fill_color=ACCENT)\n powerpoint_add_textbox (\"\uAC10\uC0AC\uD569\uB2C8\uB2E4\": left=50, top=200, width=860, height=80, font_size=42, bold=true, font_color=\"#FFFFFF\", alignment=\"center\")\n powerpoint_add_textbox (subtitle: left=50, top=290, width=860, height=40, font_size=16, font_color=HIGHLIGHT, alignment=\"center\")\n powerpoint_add_shape (footer: left=0, top=520, width=960, height=20, fill_color=ACCENT)\n\n\u2550\u2550\u2550 MODIFY MODE \u2550\u2550\u2550\n1. powerpoint_open (path) \u2014 if fails, powerpoint_create first, then open again\n2. powerpoint_get_slide_count \u2192 powerpoint_read_slide (each target slide) \u2192 MAP shapes:\n Read EVERY shape's text and size. The shape with the LARGEST text and wide width is the body/content.\n The shape with bold/large font near the top is the TITLE.\n Narrow shapes (width < 20pt) are sidebars/decorations \u2014 NEVER write text to these.\n \u26A0 Match shape to its ROLE by text content + position, not just index.\n3. Make ONLY requested changes:\n \u2022 Change existing text: powerpoint_write_text (slide, shape_index, new_text) \u2014 use the CORRECT shape_index from step 2\n \u2022 Find/replace across slides: powerpoint_find_replace_text\n \u2022 Add new content to existing slide: powerpoint_add_textbox/powerpoint_add_shape\n \u2022 Add/remove slides: powerpoint_add_slide / powerpoint_delete_slide\n4. powerpoint_save (to specified path) \u2192 \"complete\"\n\u26A0 NEVER write text to sidebar/decoration shapes. Only write to content shapes (title, body, insight).\n\u26A0 Read target slides first. Map shape indices by role. Do NOT rebuild from scratch.\n\n\u2550\u2550\u2550 CONTENT DENSITY \u2550\u2550\u2550\nInsight boxes: \"\u25B6 \" + 2 data-rich sentences.\nLAYOUT B: Each column = \u25A0 heading + 4-5 bullets + sub-details + \"\u2192 \uACB0\uB860: ...\"\nLAYOUT C: ONE number (e.g. \"300%\u2191\"). 2-3 sentence description.\nLAYOUT D: 3 short bold numbers + labels + 1-2 line descriptions. Insight summarizes all three.\n\n\u2550\u2550\u2550 RULES \u2550\u2550\u2550\n1. EVERY textbox: font_name=\"\uB9D1\uC740 \uACE0\uB515\", font_size, font_color, bold, alignment.\n2. ALWAYS layout=7 (blank). NEVER layout=1 or 2.\n3. The LAST tool before \"complete\" MUST be powerpoint_save.\n4. Slide numbers on all content slides (not slide 1).\n5. ALL user-requested content MUST be included. Content must FILL the slide.\n6. ONE textbox per area. Use \\n for line breaks. Minimize tool calls.";
|
|
4
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/agents/office/prompts.ts"],"names":[],"mappings":"AAgCA,eAAO,MAAM,kBAAkB,kjKAsDsB,CAAC;AAEtD,eAAO,MAAM,mBAAmB,83OA2E+B,CAAC;AAEhE,eAAO,MAAM,wBAAwB,unTAwGkC,CAAC"}
|