agent-tool-chat 1.0.0 → 1.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/types.d.ts CHANGED
@@ -50,6 +50,8 @@ export interface FileAttachment {
50
50
  size: number;
51
51
  type: string;
52
52
  data: string;
53
+ /** 原始文件 Blob 引用(仅运行时有效,JSON 序列化后不可用) */
54
+ blob?: Blob;
53
55
  }
54
56
  export type MessageRole = 'system' | 'user' | 'assistant' | 'tool';
55
57
  export interface ChatMessage {
@@ -89,9 +91,13 @@ export interface ChatSettings {
89
91
  proxyUrl: string;
90
92
  }
91
93
  export declare const DEFAULT_SETTINGS: ChatSettings;
94
+ export interface ChatCommand {
95
+ label: string;
96
+ text: string;
97
+ }
92
98
  export interface AgentChatOptions {
93
99
  toolPackages: ToolPackage[];
94
- onToolCall: (call: ToolCallEvent) => Promise<any>;
100
+ onToolCall?: (call: ToolCallEvent) => Promise<any>;
95
101
  provider?: any;
96
102
  providerConfig?: Partial<LLMProviderConfig>;
97
103
  systemPrompt?: string;
@@ -100,6 +106,10 @@ export interface AgentChatOptions {
100
106
  sendFileToLLM?: boolean;
101
107
  /** 业务事件驱动配置 */
102
108
  businessEvents?: BusinessEventsConfig;
109
+ /** 空状态快捷命令(点击即发送 text 指令),非必传 */
110
+ suggestedCommands?: ChatCommand[];
111
+ /** 内置工具开关:true=全启用(默认) / string[]=按工具名启用 / false=关闭 */
112
+ builtInTools?: boolean | string[];
103
113
  }
104
114
  export interface BusinessEvent {
105
115
  type: string;
@@ -0,0 +1,3 @@
1
+ import { FileAttachment } from '../types';
2
+ export declare function isTifFile(name: string): boolean;
3
+ export declare function blobFromAttachment(f: FileAttachment): Blob | null;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * ✅ 主方法:合并数组为 FeatureCollection
3
+ */
4
+ export declare function mergeToGeoJSON(arr: any): {
5
+ type: string;
6
+ features: any[];
7
+ };
@@ -0,0 +1 @@
1
+ export declare function renderMarkdown(text: string): string;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "agent-tool-chat",
3
3
  "description": "An agent-driven chat plugin with ToolPackage architecture and host-controlled execution",
4
4
  "author": "kangjinrui <1092014304@qq.com>",
5
- "version": "1.0.0",
5
+ "version": "1.0.2",
6
6
  "license": "MIT",
7
7
  "private": false,
8
8
  "type": "module",
@@ -15,7 +15,7 @@
15
15
  "import": "./dist/index.js",
16
16
  "require": "./dist/index.cjs"
17
17
  },
18
- "./dist/style.css": "./dist/agent-tool-chat.css",
18
+ "./dist/*": "./dist/*",
19
19
  "./package.json": "./package.json"
20
20
  },
21
21
  "sideEffects": [
@@ -25,20 +25,25 @@
25
25
  "dist"
26
26
  ],
27
27
  "scripts": {
28
- "build": "vite build",
28
+ "build": "vite build && .\\copy-mp.bat",
29
29
  "dev": "vite build --watch",
30
30
  "prepublishOnly": "npm run build"
31
31
  },
32
32
  "peerDependencies": {
33
- "vue": "^3.4",
34
- "element-plus": "^2.0"
33
+ "element-plus": "^2.0",
34
+ "vue": "^3.4"
35
35
  },
36
36
  "devDependencies": {
37
+ "@types/markdown-it": "^14.2.0",
37
38
  "@vitejs/plugin-vue": "^5.2.0",
38
39
  "typescript": "^5.7.0",
39
40
  "vite": "^6.0.0",
40
41
  "vite-plugin-dts": "^4.5.0",
41
42
  "vue": "^3.4.5",
42
43
  "vue-tsc": "^2.2.0"
44
+ },
45
+ "dependencies": {
46
+ "dompurify": "^3.4.13",
47
+ "markdown-it": "^15.0.0"
43
48
  }
44
49
  }