@vectorx/agent-simulator 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -0
- package/bin/agent.js +55 -0
- package/lib/index.js +5 -0
- package/lib/simulator.js +224 -0
- package/lib/types.js +2 -0
- package/lib/utils.js +7 -0
- package/lib/webview-ui/Agent.js +16 -0
- package/lib/webview-ui/App.js +359 -0
- package/lib/webview-ui/ErrorBoundary.js +57 -0
- package/lib/webview-ui/components/KnowledgeBaseSearchBlock.js +62 -0
- package/lib/webview-ui/components/KnowledgeBaseSearchResult.js +37 -0
- package/lib/webview-ui/components/MarkdownRenderer.js +27 -0
- package/lib/webview-ui/components/MessageRenderer.js +36 -0
- package/lib/webview-ui/components/ThinkingBlock.js +105 -0
- package/lib/webview-ui/components/ToolUseBlock.js +20 -0
- package/lib/webview-ui/components/ToolUseBlockHeader.js +48 -0
- package/lib/webview-ui/components/index.js +23 -0
- package/lib/webview-ui/constants.js +24 -0
- package/lib/webview-ui/contexts/ThemeContext.js +50 -0
- package/lib/webview-ui/hooks/useAgentStatus.js +96 -0
- package/lib/webview-ui/index.js +17 -0
- package/lib/webview-ui/services/agent-service.js +33 -0
- package/lib/webview-ui/services/logger-service.js +51 -0
- package/lib/webview-ui/styles/copilot.js +118 -0
- package/lib/webview-ui/styles/workarea.js +72 -0
- package/lib/webview-ui/types/index.js +2 -0
- package/lib/webview-ui/types.js +2 -0
- package/lib/webview-ui/widgets/BubbleComponents.js +114 -0
- package/lib/webview-ui/widgets/LogPanel.js +66 -0
- package/lib/webview-ui/widgets/SystemLogs.js +404 -0
- package/lib/webview-ui/widgets/ToolBar.js +109 -0
- package/lib/webview-ui/widgets/index.js +20 -0
- package/package.json +79 -0
- package/public/assets/index-j_rEEDWU.js +93 -0
- package/public/assets/main.js +580 -0
- package/public/assets/style.css +1 -0
- package/public/index.html +15 -0
- package/types/index.d.ts +3 -0
- package/types/simulator.d.ts +15 -0
- package/types/types.d.ts +6 -0
- package/types/utils.d.ts +1 -0
- package/types/webview-ui/Agent.d.ts +3 -0
- package/types/webview-ui/App.d.ts +3 -0
- package/types/webview-ui/ErrorBoundary.d.ts +18 -0
- package/types/webview-ui/components/KnowledgeBaseSearchBlock.d.ts +19 -0
- package/types/webview-ui/components/KnowledgeBaseSearchResult.d.ts +8 -0
- package/types/webview-ui/components/MarkdownRenderer.d.ts +6 -0
- package/types/webview-ui/components/MessageRenderer.d.ts +6 -0
- package/types/webview-ui/components/ThinkingBlock.d.ts +7 -0
- package/types/webview-ui/components/ToolUseBlock.d.ts +9 -0
- package/types/webview-ui/components/ToolUseBlockHeader.d.ts +9 -0
- package/types/webview-ui/components/index.d.ts +7 -0
- package/types/webview-ui/constants.d.ts +17 -0
- package/types/webview-ui/contexts/ThemeContext.d.ts +11 -0
- package/types/webview-ui/hooks/useAgentStatus.d.ts +11 -0
- package/types/webview-ui/index.d.ts +2 -0
- package/types/webview-ui/services/agent-service.d.ts +27 -0
- package/types/webview-ui/services/logger-service.d.ts +29 -0
- package/types/webview-ui/styles/copilot.d.ts +13 -0
- package/types/webview-ui/styles/workarea.d.ts +10 -0
- package/types/webview-ui/types/index.d.ts +20 -0
- package/types/webview-ui/types.d.ts +48 -0
- package/types/webview-ui/widgets/BubbleComponents.d.ts +12 -0
- package/types/webview-ui/widgets/LogPanel.d.ts +14 -0
- package/types/webview-ui/widgets/SystemLogs.d.ts +23 -0
- package/types/webview-ui/widgets/ToolBar.d.ts +13 -0
- package/types/webview-ui/widgets/index.d.ts +4 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--primary-color: #1677ff;--secondary-color: #36cfc9;--text-color: #333;--light-text: #666;--border-color: #e0e0e0;--bg-light: #f5f5f5;--bg-white: #fff;--shadow: 0 2px 8px rgba(0, 0, 0, .1);--radius: 8px;--user-msg-bg: #e6f4ff;--assistant-msg-bg: #f9f9f9;--error-color: #ff4d4f;--success-color: #52c41a;--warning-color: #faad14;--header-height: 64px;--footer-height: 48px}body{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif;margin:0;padding:0;background-color:var(--bg-light);color:var(--text-color)}.app-container{display:flex;flex-direction:column;min-height:100vh;max-width:1200px;margin:0 auto;padding:0}.app-header{display:flex;justify-content:space-between;align-items:center;padding:12px 20px;margin-bottom:0;height:var(--header-height);box-sizing:border-box;position:sticky;top:0;z-index:100;flex-wrap:wrap}.agent-info{display:flex;align-items:center;flex:1}.agent-avatar{width:40px;height:40px;border-radius:8px;overflow:hidden;margin-right:12px}.agent-avatar img{width:100%;height:100%;object-fit:cover}.agent-details{display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;width:100%;min-width:0;gap:4px}.agent-info-left{flex:0 0 auto;min-width:0;width:100%}.agent-info-right{flex:0 0 auto;display:flex;justify-content:flex-start;min-width:0;margin-left:0;width:100%}.agent-name{font-size:16px;font-weight:600;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:300px}.agent-id-container{display:flex;align-items:center;gap:4px;min-width:0}.agent-id-label{font-size:11px;color:var(--light-text);font-weight:700;white-space:nowrap}.agent-id-value{font-size:11px;font-weight:600;font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:400px;cursor:default}.copy-icon{font-size:11px;color:var(--light-text);cursor:pointer;padding:2px;border-radius:2px;transition:all .2s;flex-shrink:0;margin-top:-3px}.agent-id{font-size:12px;color:var(--light-text);margin-top:2px}.debug-controls{display:flex;align-items:center;flex:2;justify-content:flex-end}.debug-status{display:flex;align-items:center;margin-right:20px}.status-label{font-size:16px;margin-right:8px}.status-indicator{font-size:14px;font-weight:500;padding:2px 8px;border-radius:10px;display:inline-block}.status-indicator.normal{background-color:#52c41a1a;color:var(--success-color)}.status-indicator.stopped{background-color:#faad141a;color:var(--warning-color)}.status-indicator.error{background-color:#ff4d4f1a;color:var(--error-color)}.status-indicator.connecting{background-color:#1890ff1a;color:#1890ff;animation:pulse 1.5s ease-in-out infinite}.status-indicator.timeout{background-color:#faad141a;color:var(--warning-color)}.debug-buttons{display:flex;gap:8px}.debug-button{background-color:transparent;border:1px solid #d9d9d9;border-radius:4px;padding:4px 8px;font-size:12px;cursor:pointer;display:flex;align-items:center;transition:all .3s}.debug-button .button-text{margin-left:0;font-weight:500}.debug-button .debug-icon{flex-shrink:0}.debug-button:hover{background-color:var(--bg-light)}.debug-button.active{background-color:var(--primary-color);color:#fff;border-color:var(--primary-color)}.debug-button.restart:hover{background-color:#52c41a1a;border-color:var(--success-color);color:var(--success-color)}.debug-button.clear:hover{background-color:#faad141a;border-color:var(--warning-color);color:var(--warning-color)}.debug-button.logs.active{background-color:var(--secondary-color);border-color:var(--secondary-color);color:#fff}.server-status{display:flex;align-items:center;font-size:12px;color:var(--light-text);white-space:nowrap}.status-dot{display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:8px;background-color:#d9d9d9}.status-dot.active{background-color:var(--success-color)}.status-dot.connecting{background-color:#1890ff;animation:pulse 1.5s ease-in-out infinite}.status-dot.error{background-color:#ff4d4f}@keyframes pulse{0%{opacity:1}50%{opacity:.5}to{opacity:1}}.app-main{flex:1;padding:8px;display:flex;flex-direction:column}.system-logs{border-radius:var(--radius);box-shadow:var(--shadow);padding:8px;height:600px;overflow:auto}.logs-title{font-size:16px;font-weight:600;margin-top:0;margin-bottom:16px;color:var(--text-color)}.logs-content{background-color:#282c34;color:#abb2bf;padding:16px;border-radius:4px;overflow:auto;height:calc(100% - 60px);font-family:SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace}.logs-content pre{margin:0;white-space:pre-wrap;word-break:break-all;line-height:1.6}.app-footer{text-align:center;color:var(--light-text);padding:12px 0;font-size:12px;background-color:var(--bg-white);border-top:1px solid var(--border-color);height:var(--footer-height);box-sizing:border-box}.app-footer a{color:var(--primary-color);text-decoration:none}.app-footer a:hover{text-decoration:underline}.chatbox{display:flex;flex-direction:column;height:600px;max-width:800px;margin:0 auto;border:1px solid var(--border-color);border-radius:var(--radius);background-color:var(--bg-white);box-shadow:var(--shadow);overflow:hidden;width:100%}.chatbox-header{display:flex;justify-content:space-between;align-items:center;padding:10px 16px;border-bottom:1px solid var(--border-color);background-color:var(--bg-white)}.chatbox-title{margin:0;font-size:16px;font-weight:600;color:var(--text-color)}.chatbox-toolbar{display:flex;gap:8px}.toolbar-button{background:none;border:none;font-size:16px;cursor:pointer;padding:4px 8px;border-radius:var(--radius)}.toolbar-button:hover{background-color:var(--bg-light)}.chat-history{flex:1;padding:16px;overflow-y:auto;background-color:var(--bg-light)}.empty-chat{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;color:var(--light-text)}.empty-icon{font-size:48px;margin-bottom:16px}.message{display:flex;margin-bottom:16px}.message-avatar{width:32px;height:32px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:16px;margin-right:12px;flex-shrink:0}.message-content{flex:1;border-radius:var(--radius);padding:12px;overflow-wrap:break-word}.message.user .message-content{background-color:var(--user-msg-bg)}.message.assistant .message-content{background-color:var(--assistant-msg-bg)}.message-header{display:flex;justify-content:space-between;margin-bottom:8px}.message-role{font-weight:600;font-size:14px}.message-time{font-size:12px;color:var(--light-text)}.message-text{line-height:1.5;white-space:pre-wrap}.message-markdown{line-height:1.6}.message-markdown pre{background-color:#f8f8f8;padding:12px;border-radius:4px;overflow-x:auto}.message-markdown code{font-family:SFMono-Regular,Consolas,Monaco,Andale Mono,monospace;font-size:.9em;padding:2px 4px;background-color:#0000000d;border-radius:3px}.message-error{margin-top:8px;display:flex;align-items:center;gap:8px;color:var(--error-color);font-size:12px}.retry-button{background-color:transparent;border:1px solid var(--error-color);color:var(--error-color);border-radius:4px;padding:2px 8px;font-size:12px;cursor:pointer}.retry-button:hover{background-color:var(--error-color);color:#fff}.chat-input{display:flex;padding:12px 16px;border-top:1px solid var(--border-color);background-color:var(--bg-white)}.input-textarea{flex:1;min-height:24px;max-height:200px;padding:8px 12px;border:1px solid var(--border-color);border-radius:var(--radius);resize:none;outline:none;font-family:inherit;font-size:14px;line-height:1.5}.input-textarea:focus{border-color:var(--primary-color);box-shadow:0 0 0 2px #1890ff33}.input-textarea.disabled{background-color:var(--bg-light);color:var(--light-text);cursor:not-allowed}.send-button{margin-left:12px;padding:8px 16px;background-color:var(--primary-color);color:#fff;border:none;border-radius:var(--radius);font-size:14px;cursor:pointer;transition:background-color .2s}.send-button:hover{background-color:#1668dc}.send-button.disabled{background-color:#d9d9d9;color:#00000040;cursor:not-allowed}.message-markdown h1,.message-markdown h2,.message-markdown h3,.message-markdown h4,.message-markdown h5,.message-markdown h6{margin-top:16px;margin-bottom:8px}.message-markdown p{margin-bottom:12px}.message-markdown ul,.message-markdown ol{padding-left:20px;margin-bottom:12px}.message-markdown li{margin-bottom:4px}.message-markdown table{border-collapse:collapse;width:100%;margin-bottom:12px}.message-markdown th,.message-markdown td{border:1px solid var(--border-color);padding:8px;text-align:left}.message-markdown th{background-color:var(--bg-light)}.hljs{display:block;overflow-x:auto;padding:16px;background:#f8f8f8;border-radius:4px}.hljs-keyword,.hljs-selector-tag,.hljs-title,.hljs-section,.hljs-built_in,.hljs-doctag,.hljs-type,.hljs-name,.hljs-selector-id,.hljs-selector-class,.hljs-strong{color:#0e6eb8}.hljs-string,.hljs-title.class_.inherited__,.hljs-symbol,.hljs-bullet,.hljs-attribute,.hljs-template-tag,.hljs-template-variable,.hljs-code,.hljs-addition,.hljs-meta .hljs-string{color:#22863a}.hljs-comment,.hljs-quote,.hljs-deletion{color:#6a737d}@media (max-width: 768px){.app-header{flex-direction:column;height:auto;padding:12px 16px;align-items:stretch;gap:12px}.agent-info{margin-bottom:0;width:100%;padding-bottom:12px;order:0}.agent-details{flex:1;flex-direction:column;align-items:flex-start;gap:4px}.agent-info-left{width:100%}.agent-info-right{width:100%;margin-left:0;justify-content:flex-start}.agent-name{font-size:15px;max-width:none}.agent-id-label{font-size:10px}.agent-id-value{font-size:10px;max-width:280px}.copy-icon{font-size:10px}.debug-controls{order:1;flex-direction:row;align-items:center;justify-content:space-between;width:100%;margin:0;gap:12px;padding:10px 16px;border-radius:8px;min-height:44px}.debug-status{margin-bottom:0;margin-right:0;padding:0;justify-content:flex-start;text-align:left;order:0;flex-shrink:0}.status-label{font-size:14px;font-weight:500}.status-indicator{font-size:12px;color:#52c41a;background:#ffffff1a;padding:2px 8px;border-radius:12px;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}.debug-buttons{flex-wrap:nowrap;justify-content:end;gap:8px;order:1;flex:1;display:flex;align-items:center}.debug-button{flex:0 0 auto;justify-content:center;padding:6px 12px;font-size:12px;text-align:center;min-height:28px;background:#ffffff1a;border:1px solid rgba(255,255,255,.2);color:var(--text-color);border-radius:6px;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);transition:all .2s ease}.debug-button:hover{background:#fff3;border-color:#ffffff4d;transform:translateY(-1px)}.debug-button.active{background:#ff6b6be6;border-color:#ff6b6b;color:#fff;box-shadow:0 2px 8px #ff6b6b4d}.debug-button.retry:hover{background:#52c41ae6;border-color:#52c41a;color:#fff}.debug-button .debug-icon{margin-right:4px;font-size:11px}.debug-button .button-text{margin-left:0;font-weight:500}.app-main{padding:8px}.chatbox{height:calc(100vh - 140px)}.chat-suggestions{padding:12px}.suggestions-title{font-size:13px}.suggestion-item{padding:10px 12px;font-size:13px;border-radius:12px}}@media (max-width: 380px){.debug-button .button-text{display:none}.debug-button .debug-icon{margin:0}.debug-button{padding:8px;min-width:36px}.agent-name{font-size:13px;max-width:200px}.agent-id-label{font-size:9px}.agent-id-value{font-size:9px;max-width:160px}.copy-icon{font-size:9px}}.chat-suggestions{display:flex;flex-direction:column;padding:16px;background-color:#1677ff0d;border-top:1px solid var(--border-color)}.suggestions-title{font-size:14px;font-weight:500;color:var(--light-text);margin-bottom:12px}.suggestions-list{display:flex;flex-direction:column;gap:8px}.suggestion-item{text-align:left;padding:8px 16px;background-color:#fff;border:1px solid var(--border-color);border-radius:16px;font-size:14px;cursor:pointer;transition:all .2s;color:var(--text-color)}.suggestion-item:hover{background-color:var(--primary-color);color:#fff;border-color:var(--primary-color)}.suggestion-item:disabled{opacity:.5;cursor:not-allowed;background-color:var(--bg-light)}.clear-button:hover{color:var(--error-color)}.simulator-selector{display:flex;flex-direction:column;align-items:center;justify-content:center;height:100vh;background-color:#f5f5f5;padding:2rem}.simulator-selector h1{color:#1890ff;margin-bottom:2rem;font-size:2.5rem;text-align:center}.mode-buttons{display:flex;gap:1.5rem;flex-wrap:wrap;justify-content:center}.mode-button{padding:1rem 2rem;font-size:1.1rem;border:none;border-radius:4px;background-color:#1890ff;color:#fff;cursor:pointer;transition:all .3s;min-width:200px}.mode-button:hover{background-color:#40a9ff;transform:translateY(-2px);box-shadow:0 2px 8px #1890ff80}.mode-button:active{background-color:#096dd9;transform:translateY(0);box-shadow:none}.reasoning-content{background-color:#00000005;border-radius:8px;padding:12px;margin-bottom:8px}.reasoning-title{color:#8c8c8c;font-size:12px;margin-bottom:4px}.reasoning-text{color:#595959;font-size:14px;line-height:1.6}@media (max-width: 500px){.app-header{padding:10px 12px;gap:10px}.agent-info{padding-bottom:10px}.agent-name{font-size:14px;max-width:250px}.agent-id-label{font-size:10px}.agent-id-value{font-size:10px;max-width:200px}.copy-icon{font-size:10px}.debug-controls{gap:8px;padding:6px 8px;min-height:36px}.debug-status{font-size:11px}.status-label{font-size:14px}.status-indicator{font-size:11px;padding:1px 4px}.debug-button{padding:3px 6px;font-size:10px;min-height:20px}.debug-button .debug-icon{font-size:9px}.chatbox{height:calc(100vh - 120px)}}.ant-bubble-content{width:100%;background-color:#f5f5f5}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
+
<title>VectorX Agent 模拟器</title>
|
|
7
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/highlight.js@11.9.0/styles/github.min.css">
|
|
8
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/antd@5.12.2/dist/reset.css">
|
|
9
|
+
<script type="module" crossorigin src="/assets/main.js"></script>
|
|
10
|
+
<link rel="stylesheet" crossorigin href="/assets/style.css">
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<div id="root"></div>
|
|
14
|
+
</body>
|
|
15
|
+
</html>
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SimulatorOptions } from "./types";
|
|
2
|
+
export declare class AgentSimulator {
|
|
3
|
+
private app;
|
|
4
|
+
private options;
|
|
5
|
+
private server;
|
|
6
|
+
private agentStatus;
|
|
7
|
+
private parsedServerUrl;
|
|
8
|
+
constructor(options: SimulatorOptions);
|
|
9
|
+
start(): Promise<void>;
|
|
10
|
+
stop(): Promise<void>;
|
|
11
|
+
private setupProxy;
|
|
12
|
+
private setupRoutes;
|
|
13
|
+
private getAgentSimulatorInfo;
|
|
14
|
+
private transformToAgentSimulatorInfo;
|
|
15
|
+
}
|
package/types/types.d.ts
ADDED
package/types/utils.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const generateId: () => string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare class ErrorBoundary extends React.Component<{
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}, {
|
|
5
|
+
hasError: boolean;
|
|
6
|
+
error?: Error;
|
|
7
|
+
}> {
|
|
8
|
+
constructor(props: {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
});
|
|
11
|
+
static getDerivedStateFromError(error: Error): {
|
|
12
|
+
hasError: boolean;
|
|
13
|
+
error: Error;
|
|
14
|
+
};
|
|
15
|
+
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
|
|
16
|
+
render(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode>;
|
|
17
|
+
}
|
|
18
|
+
export { ErrorBoundary };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface Chunk {
|
|
3
|
+
id: string;
|
|
4
|
+
score: number;
|
|
5
|
+
detail: string;
|
|
6
|
+
}
|
|
7
|
+
interface KnowledgeBaseSearchBlockProps {
|
|
8
|
+
query?: string;
|
|
9
|
+
score_threshold?: number;
|
|
10
|
+
knowledge_search_mode?: string;
|
|
11
|
+
content_type?: "text" | "table";
|
|
12
|
+
chunks?: Chunk[];
|
|
13
|
+
knowledge_base_id?: string;
|
|
14
|
+
isResponse?: boolean;
|
|
15
|
+
reason_msg?: string;
|
|
16
|
+
has_result?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare const KnowledgeBaseSearchBlock: React.FC<KnowledgeBaseSearchBlockProps>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface ToolUseBlockHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
toolName: string;
|
|
4
|
+
isExpanded: boolean;
|
|
5
|
+
onToggleExpand: () => void;
|
|
6
|
+
icon?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare const ToolUseBlockHeader: React.FC<ToolUseBlockHeaderProps>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./ThinkingBlock";
|
|
2
|
+
export * from "./KnowledgeBaseSearchBlock";
|
|
3
|
+
export * from "./ToolUseBlock";
|
|
4
|
+
export * from "./MarkdownRenderer";
|
|
5
|
+
export * from "./MessageRenderer";
|
|
6
|
+
export * from "./ToolUseBlockHeader";
|
|
7
|
+
export * from "./KnowledgeBaseSearchResult";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const MOCK_SUGGESTIONS: ({
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
icon?: undefined;
|
|
5
|
+
children?: undefined;
|
|
6
|
+
} | {
|
|
7
|
+
label: string;
|
|
8
|
+
value: string;
|
|
9
|
+
icon: string;
|
|
10
|
+
children: {
|
|
11
|
+
label: string;
|
|
12
|
+
value: string;
|
|
13
|
+
}[];
|
|
14
|
+
})[];
|
|
15
|
+
export declare const MOCK_QUESTIONS: string[];
|
|
16
|
+
export declare const AGENT_PLACEHOLDER = "Generating content, please wait...";
|
|
17
|
+
export declare const LOG_PANEL_HEIGHT = 480;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
interface ThemeContextType {
|
|
3
|
+
isDark: boolean;
|
|
4
|
+
}
|
|
5
|
+
interface ThemeProviderProps {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
isDark: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const ThemeProvider: React.FC<ThemeProviderProps>;
|
|
10
|
+
export declare const useThemeHook: () => ThemeContextType;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type AgentSimulatorInfo } from "../services/agent-service";
|
|
2
|
+
export type DebugStatusType = "normal" | "stopped" | "error" | "connecting" | "timeout";
|
|
3
|
+
interface UseAgentStatusReturn {
|
|
4
|
+
agentSimulatorInfo: AgentSimulatorInfo | null;
|
|
5
|
+
debugStatus: DebugStatusType;
|
|
6
|
+
isConnecting: boolean;
|
|
7
|
+
error: string | null;
|
|
8
|
+
retryConnection: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const useAgentStatus: (pollInterval?: number) => UseAgentStatusReturn;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface AgentInfo {
|
|
2
|
+
agent_icon: string;
|
|
3
|
+
agent_id: string;
|
|
4
|
+
agent_name: string;
|
|
5
|
+
}
|
|
6
|
+
export interface AgentSimulatorInfo {
|
|
7
|
+
agentInfo: AgentInfo;
|
|
8
|
+
agentServerUrl: string;
|
|
9
|
+
}
|
|
10
|
+
export interface AgentStatus {
|
|
11
|
+
status: "normal" | "error";
|
|
12
|
+
health?: any;
|
|
13
|
+
message?: string;
|
|
14
|
+
timestamp: number;
|
|
15
|
+
agentServerUrl: string;
|
|
16
|
+
parsedUrl: {
|
|
17
|
+
hostname: string;
|
|
18
|
+
port: string;
|
|
19
|
+
baseUrl: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
declare class ApiService {
|
|
23
|
+
getAgentInfo(): Promise<AgentSimulatorInfo>;
|
|
24
|
+
getAgentStatus(): Promise<AgentStatus>;
|
|
25
|
+
}
|
|
26
|
+
export declare const apiService: ApiService;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface LoggerOptions {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
}
|
|
4
|
+
export interface LogEntry {
|
|
5
|
+
"@timestamp": string;
|
|
6
|
+
level: string;
|
|
7
|
+
eventId: string;
|
|
8
|
+
message: string;
|
|
9
|
+
method?: string;
|
|
10
|
+
url?: string;
|
|
11
|
+
status?: number;
|
|
12
|
+
duration?: number;
|
|
13
|
+
error?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface LogResponse {
|
|
16
|
+
success: boolean;
|
|
17
|
+
data: LogEntry[];
|
|
18
|
+
error?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare enum LogType {
|
|
21
|
+
ACCESS = "ACCESS",
|
|
22
|
+
USERCODE = "USERCODE"
|
|
23
|
+
}
|
|
24
|
+
export declare class LoggerService {
|
|
25
|
+
private baseUrl;
|
|
26
|
+
constructor(options: LoggerOptions);
|
|
27
|
+
getLogs(type: LogType): Promise<LogResponse>;
|
|
28
|
+
formatLogEntry(entry: LogEntry): string;
|
|
29
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const useCopilotStyle: (props?: unknown) => import("antd-style").ReturnStyles<{
|
|
2
|
+
copilotChat: import("antd-style").SerializedStyles;
|
|
3
|
+
headerTitle: import("antd-style").SerializedStyles;
|
|
4
|
+
headerButton: import("antd-style").SerializedStyles;
|
|
5
|
+
conversations: import("antd-style").SerializedStyles;
|
|
6
|
+
chatList: import("antd-style").SerializedStyles;
|
|
7
|
+
chatWelcome: import("antd-style").SerializedStyles;
|
|
8
|
+
loadingMessage: import("antd-style").SerializedStyles;
|
|
9
|
+
chatSend: import("antd-style").SerializedStyles;
|
|
10
|
+
sendAction: import("antd-style").SerializedStyles;
|
|
11
|
+
speechButton: import("antd-style").SerializedStyles;
|
|
12
|
+
markdownContent: import("antd-style").SerializedStyles;
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const useWorkareaStyle: (props?: unknown) => import("antd-style").ReturnStyles<{
|
|
2
|
+
copilotWrapper: import("antd-style").SerializedStyles;
|
|
3
|
+
workarea: import("antd-style").SerializedStyles;
|
|
4
|
+
workareaHeader: import("antd-style").SerializedStyles;
|
|
5
|
+
headerTitle: import("antd-style").SerializedStyles;
|
|
6
|
+
headerButton: import("antd-style").SerializedStyles;
|
|
7
|
+
workareaBody: import("antd-style").SerializedStyles;
|
|
8
|
+
bodyContent: import("antd-style").SerializedStyles;
|
|
9
|
+
bodyText: import("antd-style").SerializedStyles;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ChatMessage {
|
|
2
|
+
id: string;
|
|
3
|
+
type: 'function_call' | 'function_call_response' | 'knowledge_base_search' | 'knowledge_base_search_response' | 'answer' | 'thinking' | 'timeout' | 'interrupted' | 'uiDiscard';
|
|
4
|
+
content?: string;
|
|
5
|
+
isThinking?: boolean;
|
|
6
|
+
isTimeout?: boolean;
|
|
7
|
+
isInterrupted?: boolean;
|
|
8
|
+
isUiDiscard?: boolean;
|
|
9
|
+
tool_name?: string;
|
|
10
|
+
tool_args?: Record<string, any>;
|
|
11
|
+
result?: any;
|
|
12
|
+
knowledge_retrieval?: Array<{
|
|
13
|
+
title: string;
|
|
14
|
+
content: string;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}>;
|
|
17
|
+
reasoning_content?: string;
|
|
18
|
+
timestamp?: number;
|
|
19
|
+
role?: 'user' | 'assistant' | 'system';
|
|
20
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export interface ChatMessage {
|
|
2
|
+
id: string;
|
|
3
|
+
type: "function_call" | "function_call_response" | "knowledge_base_search" | "knowledge_base_search_response" | "answer" | "thinking" | "timeout" | "interrupted" | "uiDiscard";
|
|
4
|
+
content: string;
|
|
5
|
+
isThinking?: boolean;
|
|
6
|
+
isTimeout?: boolean;
|
|
7
|
+
isFinished?: boolean;
|
|
8
|
+
isInterrupted?: boolean;
|
|
9
|
+
isUiDiscard?: boolean;
|
|
10
|
+
tool_name?: string;
|
|
11
|
+
tool_args?: Record<string, any>;
|
|
12
|
+
result?: any;
|
|
13
|
+
knowledge_retrieval?: Array<{
|
|
14
|
+
title: string;
|
|
15
|
+
content: string;
|
|
16
|
+
[key: string]: any;
|
|
17
|
+
}>;
|
|
18
|
+
reasoningContent?: string;
|
|
19
|
+
uiTimeStr?: string;
|
|
20
|
+
timestamp?: number;
|
|
21
|
+
role: "user" | "assistant" | "system";
|
|
22
|
+
cards?: Array<{
|
|
23
|
+
type: string;
|
|
24
|
+
content: string;
|
|
25
|
+
[key: string]: any;
|
|
26
|
+
}>;
|
|
27
|
+
}
|
|
28
|
+
export interface ChatHistoryProps {
|
|
29
|
+
messages: ChatMessage[];
|
|
30
|
+
onRetry?: (messageId: string) => void;
|
|
31
|
+
}
|
|
32
|
+
export interface ChatInputProps {
|
|
33
|
+
onSend: (message: string) => void;
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
placeholder?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface ChatboxProps {
|
|
38
|
+
messages: ChatMessage[];
|
|
39
|
+
onSend: (message: string) => void;
|
|
40
|
+
onRetry?: (messageId: string) => void;
|
|
41
|
+
inputDisabled?: boolean;
|
|
42
|
+
inputPlaceholder?: string;
|
|
43
|
+
title?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface MessageProps {
|
|
46
|
+
message: ChatMessage;
|
|
47
|
+
onRetry?: (messageId: string) => void;
|
|
48
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare const ReasoningCard: React.FC<{
|
|
3
|
+
content: string;
|
|
4
|
+
}>;
|
|
5
|
+
export declare const CustomMarkdown: React.FC<{
|
|
6
|
+
content: string | any;
|
|
7
|
+
}>;
|
|
8
|
+
export declare const formatOpenAIResponse: (chunk: any) => {
|
|
9
|
+
content: any;
|
|
10
|
+
reasoningContent: any;
|
|
11
|
+
role: any;
|
|
12
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AgentSimulatorInfo } from "../services/agent-service";
|
|
3
|
+
import type { DebugStatusType } from "./ToolBar";
|
|
4
|
+
interface LogPanelProps {
|
|
5
|
+
open: boolean;
|
|
6
|
+
activeTab: string;
|
|
7
|
+
onTabChange: (tab: string) => void;
|
|
8
|
+
onClose: () => void;
|
|
9
|
+
agentSimulatorInfo: AgentSimulatorInfo | null;
|
|
10
|
+
height: number;
|
|
11
|
+
debugStatus: DebugStatusType;
|
|
12
|
+
}
|
|
13
|
+
export declare const LogPanel: React.FC<LogPanelProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { LogType } from "../services/logger-service";
|
|
3
|
+
import type { DebugStatusType } from "./ToolBar";
|
|
4
|
+
interface SystemLogsProps {
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
agentName: string;
|
|
7
|
+
debugStatus: DebugStatusType;
|
|
8
|
+
isOpen?: boolean;
|
|
9
|
+
logType?: LogType;
|
|
10
|
+
}
|
|
11
|
+
export declare enum AgentType {
|
|
12
|
+
AI_SDK_REQUEST_START = "AI_SDK_REQUEST_START",
|
|
13
|
+
AI_SDK_REQUEST_SUCCESS = "AI_SDK_REQUEST_SUCCESS",
|
|
14
|
+
AI_SDK_REQUEST_ERROR = "AI_SDK_REQUEST_ERROR",
|
|
15
|
+
AI_SDK_CREATE_MODEL = "AI_SDK_CREATE_MODEL",
|
|
16
|
+
AI_SDK_CREATE_RECORD_PAIR = "AI_SDK_CREATE_RECORD_PAIR",
|
|
17
|
+
AI_SDK_GET_HISTORY_MESSAGES = "AI_SDK_GET_HISTORY_MESSAGES",
|
|
18
|
+
AI_SDK_GET_CONVERSATIONS = "AI_SDK_GET_CONVERSATIONS",
|
|
19
|
+
SERVER_REQUEST_START = "SERVER_REQUEST_START",
|
|
20
|
+
SERVER_REQUEST_END = "SERVER_REQUEST_END"
|
|
21
|
+
}
|
|
22
|
+
export declare const SystemLogs: React.FC<SystemLogsProps>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AgentSimulatorInfo } from "../services/agent-service";
|
|
3
|
+
export type DebugStatusType = "normal" | "stopped" | "error" | "connecting" | "timeout";
|
|
4
|
+
export interface ToolBarProps {
|
|
5
|
+
agentSimulatorInfo: AgentSimulatorInfo | null;
|
|
6
|
+
debugStatus: DebugStatusType;
|
|
7
|
+
showSystemLogs: boolean;
|
|
8
|
+
isConnecting?: boolean;
|
|
9
|
+
onRetryConnection: () => void;
|
|
10
|
+
onClearChat: () => void;
|
|
11
|
+
onToggleLogs: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const ToolBar: React.FC<ToolBarProps>;
|