@opentiny/next-remoter 0.2.4 → 0.2.6-beta.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 - present OpenTiny Authors.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,6 +1,6 @@
1
1
  import { TrSender, PluginInfo } from '@opentiny/tiny-robot';
2
2
  import { STATUS } from '@opentiny/tiny-robot-kit';
3
- import { Ref, ComponentInstance } from 'vue';
3
+ import { Ref, ComponentInstance, VNode } from 'vue';
4
4
  import { ICustomAgentModelProviderLlmConfig } from '../types/type';
5
5
  import { MenuItemConfig, McpServerConfig } from '@opentiny/next-sdk';
6
6
  import { UnifiedModelConfig } from '../types/model-config';
@@ -60,6 +60,21 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
60
60
  AILogoUrl: {
61
61
  type: StringConstructor;
62
62
  };
63
+ /** 角色user,assistant的头像配置, 值为 VNode, 比如: h(IconUser, { style: { fontSize: '32px' } }) */
64
+ roleAvatar: {
65
+ type: () => {
66
+ user: VNode;
67
+ assistant: VNode;
68
+ };
69
+ default: () => {
70
+ user: VNode<import('vue').RendererNode, import('vue').RendererElement, {
71
+ [key: string]: any;
72
+ }>;
73
+ assistant: VNode<import('vue').RendererNode, import('vue').RendererElement, {
74
+ [key: string]: any;
75
+ }>;
76
+ };
77
+ };
63
78
  /** 展示模式: 'remoter' | 'chat-dialog'
64
79
  * 遥控器模式: 自动在右下角显示一个AI图标,点击展开多个菜单项。
65
80
  * 对话框模式: 直接显示一个对话框界面
@@ -116,7 +131,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
116
131
  /** 大模型代理 */
117
132
  agent: import('@opentiny/next-sdk').AgentModelProvider;
118
133
  /** 欢迎图标 */
119
- welcomeIcon: import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
134
+ welcomeIcon: VNode<import('vue').RendererNode, import('vue').RendererElement, {
120
135
  [key: string]: any;
121
136
  }>;
122
137
  /** 对话消息 */
@@ -131,7 +146,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
131
146
  assistant: {
132
147
  type: string;
133
148
  placement: string;
134
- avatar: import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
149
+ avatar: VNode<import('vue').RendererNode, import('vue').RendererElement, {
135
150
  [key: string]: any;
136
151
  }>;
137
152
  maxWidth: string;
@@ -139,14 +154,14 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
139
154
  slots: {
140
155
  footer: ({ index }: {
141
156
  index: number;
142
- }) => "" | import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
157
+ }) => "" | VNode<import('vue').RendererNode, import('vue').RendererElement, {
143
158
  [key: string]: any;
144
159
  }>;
145
160
  };
146
161
  };
147
162
  user: {
148
163
  placement: string;
149
- avatar: import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
164
+ avatar: VNode<import('vue').RendererNode, import('vue').RendererElement, {
150
165
  [key: string]: any;
151
166
  }>;
152
167
  maxWidth: string;
@@ -182,6 +197,48 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
182
197
  } | null>;
183
198
  /** 添加消息 */
184
199
  addMessage: (message: import('@opentiny/tiny-robot-kit').ChatMessage | import('@opentiny/tiny-robot-kit').ChatMessage[]) => void;
200
+ /** 已安装的插件 */
201
+ installedPlugins: Ref<{
202
+ id: string;
203
+ name: string;
204
+ icon: string;
205
+ description: string;
206
+ enabled: boolean;
207
+ expanded?: boolean | undefined;
208
+ tools: {
209
+ id: string;
210
+ name: string;
211
+ description: string;
212
+ enabled: boolean;
213
+ }[];
214
+ addState?: import('@opentiny/tiny-robot').PluginAddState | undefined;
215
+ category?: string | undefined;
216
+ }[], PluginInfo[] | {
217
+ id: string;
218
+ name: string;
219
+ icon: string;
220
+ description: string;
221
+ enabled: boolean;
222
+ expanded?: boolean | undefined;
223
+ tools: {
224
+ id: string;
225
+ name: string;
226
+ description: string;
227
+ enabled: boolean;
228
+ }[];
229
+ addState?: import('@opentiny/tiny-robot').PluginAddState | undefined;
230
+ category?: string | undefined;
231
+ }[]>;
232
+ /** 添加插件核心方法 */
233
+ addPluginCore: (config: {
234
+ pluginId: string;
235
+ name: string;
236
+ description: string;
237
+ icon?: string;
238
+ mcpServer: McpServerConfig;
239
+ }) => Promise<boolean>;
240
+ /** 删除插件核心方法 */
241
+ deletePlugin: (plugin: PluginInfo) => Promise<void>;
185
242
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
186
243
  fullscreen: import('vue').PropType<any>;
187
244
  show: import('vue').PropType<any>;
@@ -226,6 +283,21 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
226
283
  AILogoUrl: {
227
284
  type: StringConstructor;
228
285
  };
286
+ /** 角色user,assistant的头像配置, 值为 VNode, 比如: h(IconUser, { style: { fontSize: '32px' } }) */
287
+ roleAvatar: {
288
+ type: () => {
289
+ user: VNode;
290
+ assistant: VNode;
291
+ };
292
+ default: () => {
293
+ user: VNode<import('vue').RendererNode, import('vue').RendererElement, {
294
+ [key: string]: any;
295
+ }>;
296
+ assistant: VNode<import('vue').RendererNode, import('vue').RendererElement, {
297
+ [key: string]: any;
298
+ }>;
299
+ };
300
+ };
229
301
  /** 展示模式: 'remoter' | 'chat-dialog'
230
302
  * 遥控器模式: 自动在右下角显示一个AI图标,点击展开多个菜单项。
231
303
  * 对话框模式: 直接显示一个对话框界面
@@ -287,6 +359,10 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
287
359
  mcpServers: Record<string, McpServerConfig>;
288
360
  agentRoot: string;
289
361
  locale: string;
362
+ roleAvatar: {
363
+ user: VNode;
364
+ assistant: VNode;
365
+ };
290
366
  inBrowserExt: boolean;
291
367
  genUiComponents: Record<string, any>;
292
368
  customMarketMcpServers: PluginInfo[];
@@ -3,13 +3,14 @@ import { Ref } from 'vue';
3
3
  import { AgentModelProvider } from '@opentiny/next-sdk';
4
4
  import { ICustomAgentModelProviderLlmConfig } from '../types/type';
5
5
  import { ProviderV2 } from '@ai-sdk/provider';
6
+ import { PromptManager } from './promptManager';
6
7
 
7
8
  /** Tiny-robot 所需要的自定义大语言的Provider */
8
9
  export declare class CustomAgentModelProvider extends BaseModelProvider {
9
10
  transport: any;
10
11
  /** 一个 ai-sdk agent 封装 */
11
12
  agent: AgentModelProvider;
12
- systemPrompt: string;
13
+ promptManager: PromptManager;
13
14
  llmConfig: ICustomAgentModelProviderLlmConfig;
14
15
  /** 生成式UI启用状态 */
15
16
  isGenuiEnabled?: Ref<boolean>;
@@ -23,14 +24,22 @@ export declare class CustomAgentModelProvider extends BaseModelProvider {
23
24
  * @param providerType 提供商类型
24
25
  * @param useReActMode 是否使用 ReAct 模式
25
26
  */
26
- updateLLMConfig({ modelId, baseURL, apiKey, providerType, useReActMode, llm }: {
27
+ updateLLMConfig({ modelId, baseURL, apiKey, providerType, useReActMode, llm, providerOptions, headers }: {
27
28
  modelId: string;
28
29
  baseURL?: string;
29
30
  apiKey?: string;
30
31
  providerType?: 'deepseek' | 'openai' | ((options: any) => ProviderV2);
31
32
  useReActMode?: boolean;
32
33
  llm?: ProviderV2;
34
+ /** 自定义请求体字段,会合并到 AI SDK streamText 的 providerOptions 中 */
35
+ providerOptions?: Record<string, any>;
36
+ /** 自定义请求 Header,透传给 ai-sdk Provider 实例 */
37
+ headers?: Record<string, string>;
33
38
  }): void;
39
+ /**
40
+ * 清理消息数组中的 get-skill-content 工具调用结果
41
+ */
42
+ cleanGetSkillContentToolResult(messages: any[]): void;
34
43
  /**
35
44
  * 清理消息数组中的旧快照消息,只保留最新的快照
36
45
  * @param messages 消息数组
@@ -0,0 +1,18 @@
1
+ export declare class PromptManager {
2
+ /** 固定系统提示词 */
3
+ private staticPrompt;
4
+ /** 元数据提示词 */
5
+ private skillMetaPrompt;
6
+ /** 临时系统提示词,比如: get-skill-content的返回值 */
7
+ private tempPrompt;
8
+ /** 返回全量的提示词 */
9
+ getSystemPrompt(): string;
10
+ /** 设置常驻提示词 */
11
+ setStatic(prompt: string): void;
12
+ /** 设置技能元数据提示词 */
13
+ setSkillMeta(prompt: string): void;
14
+ /** 设置临时值, 清除时传入空字符串即可,不再提供clearTemp */
15
+ setTemp(prompt: string): void;
16
+ /** 累增临时值,为多agent时预留 */
17
+ appendTemp(prompt: string): void;
18
+ }
@@ -1,29 +1,29 @@
1
- import { Ref } from 'vue';
1
+ import { Ref, VNode } from 'vue';
2
2
 
3
3
  /**
4
4
  * 消息角色 UI 配置 Composable
5
5
  * 用于定义消息气泡的外观、头像、操作按钮等 UI 配置
6
6
  */
7
7
  export declare function useMessageRoles(options: {
8
+ props: {
9
+ roleAvatar: {
10
+ user: VNode;
11
+ assistant: VNode;
12
+ };
13
+ };
8
14
  messages: Ref<any[]>;
9
15
  messageState: any;
10
16
  inputMessage: Ref<string>;
11
17
  handleSendMessage: (inputValue: string, attachmentsContent?: any[]) => Promise<boolean>;
12
18
  }): {
13
- aiAvatar: import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
14
- [key: string]: any;
15
- }>;
16
- userAvatar: import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
17
- [key: string]: any;
18
- }>;
19
- welcomeIcon: import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
19
+ welcomeIcon: VNode<import('vue').RendererNode, import('vue').RendererElement, {
20
20
  [key: string]: any;
21
21
  }>;
22
22
  roles: {
23
23
  assistant: {
24
24
  type: string;
25
25
  placement: string;
26
- avatar: import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
26
+ avatar: VNode<import('vue').RendererNode, import('vue').RendererElement, {
27
27
  [key: string]: any;
28
28
  }>;
29
29
  maxWidth: string;
@@ -31,14 +31,14 @@ export declare function useMessageRoles(options: {
31
31
  slots: {
32
32
  footer: ({ index }: {
33
33
  index: number;
34
- }) => "" | import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
34
+ }) => "" | VNode<import('vue').RendererNode, import('vue').RendererElement, {
35
35
  [key: string]: any;
36
36
  }>;
37
37
  };
38
38
  };
39
39
  user: {
40
40
  placement: string;
41
- avatar: import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
41
+ avatar: VNode<import('vue').RendererNode, import('vue').RendererElement, {
42
42
  [key: string]: any;
43
43
  }>;
44
44
  maxWidth: string;
@@ -74,6 +74,13 @@ export declare function usePlugin(agent: any, enabledTools: Ref<Record<string, b
74
74
  togglePlugin: (plugin: PluginInfo, enabled: boolean) => void;
75
75
  toggleTool: (plugin: PluginInfo, toolId: string, enabled: boolean) => void;
76
76
  deletePlugin: (plugin: PluginInfo) => Promise<void>;
77
+ addPluginCore: (config: {
78
+ pluginId: string;
79
+ name: string;
80
+ description: string;
81
+ icon?: string;
82
+ mcpServer: McpServerConfig;
83
+ }) => Promise<boolean>;
77
84
  addPluginFromMarket: (plugin: PluginInfo) => Promise<void>;
78
85
  addPluginFromScan: (sessionId: string, agentRoot: string) => Promise<boolean>;
79
86
  handleClientDisconnected: (serverName: string) => Promise<{
@@ -4,8 +4,6 @@ import { SkillMeta } from '@opentiny/next-sdk';
4
4
  export interface UseSkillWithToolsOptions {
5
5
  /** 用户层传入的 skill .md 模块(key 路径,value 内容),由 next-sdk 处理;大模型通过 get_skill_content 自动识别并加载技能 */
6
6
  skillsRef?: Ref<Record<string, string> | undefined>;
7
- /** 基础系统提示词 */
8
- systemPrompt: string;
9
7
  /** CustomAgentModelProvider 实例,用于写 systemPrompt、合并 extraTools */
10
8
  customAgentProvider: any;
11
9
  }