@opentiny/next-remoter 0.2.3 → 0.2.5

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.
@@ -0,0 +1,15 @@
1
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
2
+ content: string;
3
+ }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
4
+ content: string;
5
+ }>>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
6
+ export default _default;
7
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
8
+ type __VLS_TypePropsToRuntimeProps<T> = {
9
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
10
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
11
+ } : {
12
+ type: import('vue').PropType<T[K]>;
13
+ required: true;
14
+ };
15
+ };
@@ -1,8 +1,8 @@
1
- import { TrSender, PluginInfo, MentionItem } from '@opentiny/tiny-robot';
1
+ import { TrSender, PluginInfo } from '@opentiny/tiny-robot';
2
2
  import { STATUS } from '@opentiny/tiny-robot-kit';
3
3
  import { Ref, ComponentInstance } from 'vue';
4
4
  import { ICustomAgentModelProviderLlmConfig } from '../types/type';
5
- import { MenuItemConfig } from '@opentiny/next-sdk';
5
+ import { MenuItemConfig, McpServerConfig } from '@opentiny/next-sdk';
6
6
  import { UnifiedModelConfig } from '../types/model-config';
7
7
 
8
8
  declare function __VLS_template(): Readonly<{
@@ -84,19 +84,28 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
84
84
  type: ObjectConstructor;
85
85
  default: () => {};
86
86
  };
87
- /** 自定义 MCP 市场服务列表 */
87
+ /** 自定义 MCP 市场服务列表一般是后台的mcp工具常驻存在 */
88
88
  customMarketMcpServers: {
89
89
  type: () => PluginInfo[];
90
90
  default: () => never[];
91
91
  };
92
+ /** MCP 服务器配置:业界格式 { "服务器名称": McpServerConfig },name 即对象的 key */
93
+ mcpServers: {
94
+ type: () => Record<string, McpServerConfig>;
95
+ default: undefined;
96
+ };
92
97
  /** LLM 配置数组,每一项基于 llmConfig 格式,额外包含 id、label、icon、isDefault、useReActMode 字段 */
93
98
  llmConfigs: {
94
99
  type: () => UnifiedModelConfig[];
95
100
  default: undefined;
96
101
  };
102
+ /**
103
+ * 用户层传入的 skill .md 模块(Record<path, content>,如 Vite import.meta.glob 得到的结果),
104
+ * 由 remoter 调用 next-sdk 的 skill 能力处理:生成 systemPrompt 技能说明、内置 get_skill_content 工具,大模型可自动识别并加载技能
105
+ */
97
106
  skills: {
98
- type: () => MentionItem[];
99
- default: () => never[];
107
+ type: () => Record<string, string>;
108
+ default: undefined;
100
109
  };
101
110
  /** 布局模式:支持所有 CSS position 属性值 'static' | 'relative' | 'absolute' | 'fixed' | 'sticky' */
102
111
  layoutMode: {
@@ -129,7 +138,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
129
138
  customContentField: string;
130
139
  slots: {
131
140
  footer: ({ index }: {
132
- index: any;
141
+ index: number;
133
142
  }) => "" | import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
134
143
  [key: string]: any;
135
144
  }>;
@@ -141,6 +150,7 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
141
150
  [key: string]: any;
142
151
  }>;
143
152
  maxWidth: string;
153
+ customContentField: string;
144
154
  };
145
155
  };
146
156
  /** 输入框的文本 */
@@ -152,7 +162,24 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
152
162
  /** 发送消息 */
153
163
  sendMessage: (content?: import('@opentiny/tiny-robot-kit').ChatMessage["content"], clearInput?: boolean) => Promise<void>;
154
164
  /** 向插件市场添加一个server */
155
- loadMcpServerToPlugin: (serverName: string, mcpServer: import('@opentiny/next-sdk').McpServerConfig) => Promise<void>;
165
+ loadMcpServerToPlugin: (serverName: string, mcpServer: McpServerConfig) => Promise<void>;
166
+ /** 处理客户端断开连接 */
167
+ handleClientDisconnected: (serverName: string) => Promise<{
168
+ id: string;
169
+ name: string;
170
+ icon: string;
171
+ description: string;
172
+ enabled: boolean;
173
+ expanded?: boolean | undefined;
174
+ tools: {
175
+ id: string;
176
+ name: string;
177
+ description: string;
178
+ enabled: boolean;
179
+ }[];
180
+ addState?: import('@opentiny/tiny-robot').PluginAddState | undefined;
181
+ category?: string | undefined;
182
+ } | null>;
156
183
  /** 添加消息 */
157
184
  addMessage: (message: import('@opentiny/tiny-robot-kit').ChatMessage | import('@opentiny/tiny-robot-kit').ChatMessage[]) => void;
158
185
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
@@ -223,19 +250,28 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
223
250
  type: ObjectConstructor;
224
251
  default: () => {};
225
252
  };
226
- /** 自定义 MCP 市场服务列表 */
253
+ /** 自定义 MCP 市场服务列表一般是后台的mcp工具常驻存在 */
227
254
  customMarketMcpServers: {
228
255
  type: () => PluginInfo[];
229
256
  default: () => never[];
230
257
  };
258
+ /** MCP 服务器配置:业界格式 { "服务器名称": McpServerConfig },name 即对象的 key */
259
+ mcpServers: {
260
+ type: () => Record<string, McpServerConfig>;
261
+ default: undefined;
262
+ };
231
263
  /** LLM 配置数组,每一项基于 llmConfig 格式,额外包含 id、label、icon、isDefault、useReActMode 字段 */
232
264
  llmConfigs: {
233
265
  type: () => UnifiedModelConfig[];
234
266
  default: undefined;
235
267
  };
268
+ /**
269
+ * 用户层传入的 skill .md 模块(Record<path, content>,如 Vite import.meta.glob 得到的结果),
270
+ * 由 remoter 调用 next-sdk 的 skill 能力处理:生成 systemPrompt 技能说明、内置 get_skill_content 工具,大模型可自动识别并加载技能
271
+ */
236
272
  skills: {
237
- type: () => MentionItem[];
238
- default: () => never[];
273
+ type: () => Record<string, string>;
274
+ default: undefined;
239
275
  };
240
276
  /** 布局模式:支持所有 CSS position 属性值 'static' | 'relative' | 'absolute' | 'fixed' | 'sticky' */
241
277
  layoutMode: {
@@ -248,13 +284,14 @@ declare const __VLS_component: import('vue').DefineComponent<import('vue').Extra
248
284
  mode: string;
249
285
  sessionId: string;
250
286
  llmConfig: ICustomAgentModelProviderLlmConfig | undefined;
287
+ mcpServers: Record<string, McpServerConfig>;
251
288
  agentRoot: string;
252
- skills: MentionItem[];
253
289
  locale: string;
254
290
  inBrowserExt: boolean;
255
291
  genUiComponents: Record<string, any>;
256
292
  customMarketMcpServers: PluginInfo[];
257
293
  llmConfigs: UnifiedModelConfig[];
294
+ skills: Record<string, string>;
258
295
  layoutMode: "absolute" | "fixed" | "static" | "relative" | "sticky";
259
296
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
260
297
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
@@ -3,32 +3,44 @@ import { PropType } from 'vue';
3
3
  declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
4
4
  usage: {
5
5
  type: PropType<{
6
- cachedInputTokens: number;
7
6
  inputTokens: number;
8
- reasoningTokens: number;
9
7
  outputTokens: number;
10
8
  totalTokens: number;
9
+ inputTokenDetails?: {
10
+ cacheReadTokens?: number;
11
+ };
12
+ outputTokenDetails?: {
13
+ reasoningTokens?: number;
14
+ };
11
15
  }>;
12
16
  default: string;
13
17
  };
14
18
  }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
15
19
  usage: {
16
20
  type: PropType<{
17
- cachedInputTokens: number;
18
21
  inputTokens: number;
19
- reasoningTokens: number;
20
22
  outputTokens: number;
21
23
  totalTokens: number;
24
+ inputTokenDetails?: {
25
+ cacheReadTokens?: number;
26
+ };
27
+ outputTokenDetails?: {
28
+ reasoningTokens?: number;
29
+ };
22
30
  }>;
23
31
  default: string;
24
32
  };
25
33
  }>> & Readonly<{}>, {
26
34
  usage: {
27
- cachedInputTokens: number;
28
35
  inputTokens: number;
29
- reasoningTokens: number;
30
36
  outputTokens: number;
31
37
  totalTokens: number;
38
+ inputTokenDetails?: {
39
+ cacheReadTokens?: number;
40
+ };
41
+ outputTokenDetails?: {
42
+ reasoningTokens?: number;
43
+ };
32
44
  };
33
45
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
34
46
  export default _default;
@@ -23,36 +23,16 @@ export declare class CustomAgentModelProvider extends BaseModelProvider {
23
23
  * @param providerType 提供商类型
24
24
  * @param useReActMode 是否使用 ReAct 模式
25
25
  */
26
- updateLLMConfig({ modelId, baseURL, apiKey, providerType, useReActMode, llm }: {
26
+ updateLLMConfig({ modelId, baseURL, apiKey, providerType, useReActMode, llm, providerOptions }: {
27
27
  modelId: string;
28
28
  baseURL?: string;
29
29
  apiKey?: string;
30
30
  providerType?: 'deepseek' | 'openai' | ((options: any) => ProviderV2);
31
31
  useReActMode?: boolean;
32
32
  llm?: ProviderV2;
33
+ /** 自定义请求体字段,会合并到 AI SDK streamText 的 providerOptions 中 */
34
+ providerOptions?: Record<string, any>;
33
35
  }): void;
34
- /**
35
- * 处理文本流数据
36
- * @param part 流数据部分
37
- * @param handler 流处理器
38
- * @param textId 文本ID
39
- * @returns 更新后的文本ID
40
- */
41
- private handleTextStream;
42
- /**
43
- * 处理工具流数据
44
- * @param part 流数据部分
45
- * @param handler 流处理器
46
- */
47
- private handleToolStream;
48
- /**
49
- * 处理文本流数据
50
- * @param part 流数据部分
51
- * @param handler 流处理器
52
- * @param textId 文本ID
53
- * @returns 更新后的文本ID
54
- */
55
- private handleReasonStream;
56
36
  /**
57
37
  * 清理消息数组中的旧快照消息,只保留最新的快照
58
38
  * @param messages 消息数组
@@ -0,0 +1,75 @@
1
+ import { FinishReason, LanguageModelRequestMetadata, LanguageModelUsage, StreamTextResult } from 'ai';
2
+
3
+ export interface StreamVisitorOption {
4
+ debug?: boolean;
5
+ onStart?: (content: StartContent) => void;
6
+ onStep?: (content: StepContent) => void;
7
+ onReasoning?: (content: ReasoningContent) => void;
8
+ onText?: (content: TextContent) => void;
9
+ onTool?: (content: ToolContent) => void;
10
+ onFinish?: () => void;
11
+ }
12
+ export interface StartContent {
13
+ running: boolean;
14
+ steps: StepContent[];
15
+ finishReason?: FinishReason;
16
+ totalUsage?: LanguageModelUsage;
17
+ /** 工具内部异常的错误信息 */
18
+ error?: any;
19
+ }
20
+ export interface StepContent {
21
+ running: boolean;
22
+ contents: (TextContent | ReasoningContent | ToolContent)[];
23
+ finishReason?: FinishReason;
24
+ /** 本轮对话的消耗 */
25
+ usage?: LanguageModelUsage;
26
+ /** 包含本轮对话的请求体 */
27
+ request: LanguageModelRequestMetadata;
28
+ }
29
+ export interface TextContent {
30
+ type: 'text';
31
+ id: string;
32
+ running: boolean;
33
+ text: string;
34
+ }
35
+ export interface ReasoningContent {
36
+ type: 'reasoning';
37
+ id: string;
38
+ running: boolean;
39
+ text: string;
40
+ }
41
+ export interface ToolContent {
42
+ type: 'tool';
43
+ id: string;
44
+ running: boolean;
45
+ toolCallId: string;
46
+ title: string;
47
+ toolName: string;
48
+ /** 不确定输入参数的工具调用 */
49
+ dynamic: boolean | undefined;
50
+ /** 生成tool 调用参数的动态字符串, 在调用 tool 之前,会保存json结果到input属性中 */
51
+ inputStr: string;
52
+ /** 工具参数对象 */
53
+ input: any;
54
+ /** 工具返回值对象 */
55
+ output: any;
56
+ /** 工具内部异常的错误信息 */
57
+ error?: any;
58
+ }
59
+ /** ai-sdk@v6 的流消息访问者, 暴露响应式的数据,它随着流消息到来逐渐的变化
60
+ * @example
61
+ * const stream = await toolLoopAgent.stream({prompt:'xxxx'})
62
+ * const visitor= new StreamVisitor({
63
+ * onStart(content){
64
+ * -- 保存这个content
65
+ * }
66
+ * })
67
+ *
68
+ * await visitor.traverse(stream)
69
+ * const result = await visitor.traverse(stream) // 或者保存此处的 result 的Ref响应数据
70
+ */
71
+ export declare class StreamVisitor {
72
+ option: StreamVisitorOption;
73
+ constructor(option?: StreamVisitorOption);
74
+ traverse(stream: StreamTextResult<{}, never>): Promise<import('vue').Ref<StartContent | undefined, StartContent | undefined>>;
75
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * 会话历史管理 Composable
3
+ * 用于管理历史会话的创建、切换、更新、删除等操作
4
+ */
5
+ export declare function useConversationHistory(options: {
6
+ createConversation: () => void;
7
+ switchConversation: (id: string) => void;
8
+ deleteConversation: (id: string) => void;
9
+ getCurrentConversation: () => any;
10
+ abortRequest: () => void;
11
+ conversationState: any;
12
+ customAgentProvider: any;
13
+ }): {
14
+ showHistory: import('vue').Ref<boolean, boolean>;
15
+ handleCreateConversation: () => void;
16
+ handleHistorySelect: (item: {
17
+ id: string;
18
+ }) => void;
19
+ handleHistoryUpdateTitle: (title: string, item: any) => void;
20
+ handleHistoryDelete: (action: any, item: {
21
+ id: string;
22
+ }) => void;
23
+ scrollToBottom: () => void;
24
+ };
@@ -0,0 +1,54 @@
1
+ import { Ref } from 'vue';
2
+
3
+ /**
4
+ * 消息角色 UI 配置 Composable
5
+ * 用于定义消息气泡的外观、头像、操作按钮等 UI 配置
6
+ */
7
+ export declare function useMessageRoles(options: {
8
+ messages: Ref<any[]>;
9
+ messageState: any;
10
+ inputMessage: Ref<string>;
11
+ handleSendMessage: (inputValue: string, attachmentsContent?: any[]) => Promise<boolean>;
12
+ }): {
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, {
20
+ [key: string]: any;
21
+ }>;
22
+ roles: {
23
+ assistant: {
24
+ type: string;
25
+ placement: string;
26
+ avatar: import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
27
+ [key: string]: any;
28
+ }>;
29
+ maxWidth: string;
30
+ customContentField: string;
31
+ slots: {
32
+ footer: ({ index }: {
33
+ index: number;
34
+ }) => "" | import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
35
+ [key: string]: any;
36
+ }>;
37
+ };
38
+ };
39
+ user: {
40
+ placement: string;
41
+ avatar: import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
42
+ [key: string]: any;
43
+ }>;
44
+ maxWidth: string;
45
+ customContentField: string;
46
+ };
47
+ };
48
+ copyingStates: Ref<Record<string, boolean>, Record<string, boolean>>;
49
+ isProcessing: import('vue').ComputedRef<boolean>;
50
+ latestAssistantMessageIndex: import('vue').ComputedRef<any>;
51
+ copyTooltipContent: (messageIndex?: number) => "复制" | "复制成功";
52
+ copyMessageToClipboard: (index: number) => Promise<void>;
53
+ regenerateMessage: (index: number) => Promise<void>;
54
+ };
@@ -0,0 +1,25 @@
1
+ import { Ref } from 'vue';
2
+ import { MenuItemConfig } from '@opentiny/next-sdk';
3
+
4
+ /**
5
+ * 插件会话管理 Composable
6
+ * 用于处理 sessionId 相关的所有逻辑:扫码添加插件、识别码输入、遥控器初始化等
7
+ */
8
+ export declare function usePluginSession(options: {
9
+ sessionId: Ref<string>;
10
+ agentRoot: string;
11
+ mode: string;
12
+ qrCodeUrl?: string;
13
+ remoteUrl?: string;
14
+ menuItems?: MenuItemConfig[];
15
+ AILogoUrl?: string;
16
+ show: Ref<boolean>;
17
+ addPluginFromScan: (sessionId: string, agentRoot: string) => Promise<boolean>;
18
+ inputMessage: Ref<string>;
19
+ }): {
20
+ handleScanSuccess: (sessionIdValue: string) => Promise<void>;
21
+ handleSessionIdInput: (input: string) => Promise<boolean>;
22
+ initialize: () => void;
23
+ initializeRemoter: () => void;
24
+ watchSessionIdChanges: () => void;
25
+ };
@@ -1,25 +1,24 @@
1
- import { SkillOption } from '../components/SkillSelector.vue';
1
+ import { Ref } from 'vue';
2
+ import { SkillMeta } from '@opentiny/next-sdk';
2
3
 
3
- export declare function useSkill(inputMessage: any, senderRef: any, props: any): {
4
- templateData: import('vue').Ref<any[], any[]>;
5
- showSkillSelector: import('vue').Ref<boolean, boolean>;
6
- skillSelectorPosition: import('vue').Ref<{
7
- top: number;
8
- left: number;
9
- }, {
10
- top: number;
11
- left: number;
12
- } | {
13
- top: number;
14
- left: number;
4
+ export interface UseSkillWithToolsOptions {
5
+ /** 用户层传入的 skill .md 模块(key 路径,value 内容),由 next-sdk 处理;大模型通过 get_skill_content 自动识别并加载技能 */
6
+ skillsRef?: Ref<Record<string, string> | undefined>;
7
+ /** 基础系统提示词 */
8
+ systemPrompt: string;
9
+ /** CustomAgentModelProvider 实例,用于写 systemPrompt、合并 extraTools */
10
+ customAgentProvider: any;
11
+ }
12
+ /**
13
+ * Skills 与工具组合 Composable(仅最新方案)
14
+ * 基于 skills + next-sdk:拼入 systemPrompt 技能说明、注入 get_skill_content 工具,无 @ 提及
15
+ */
16
+ export declare function useSkillWithTools(options: UseSkillWithToolsOptions): {
17
+ processSkillMentions: () => Promise<{
18
+ shouldBlock: boolean;
19
+ skillItems: never[];
15
20
  }>;
16
- filterText: import('vue').Ref<string, string>;
17
- skillSelectorRef: import('vue').Ref<null, null>;
18
- handleTriggerChar: (char: string, position: {
19
- top: number;
20
- left: number;
21
- }) => void;
22
- selectSkill: (skill: SkillOption) => void;
23
- closeSkillSelector: () => void;
24
- handleKeyDown: (e: KeyboardEvent) => void;
21
+ skillPromptPart: import('vue').ComputedRef<string>;
22
+ skillTools: import('vue').ComputedRef<import('@opentiny/next-sdk').SkillToolsSet>;
23
+ skillOverviews: import('vue').ComputedRef<SkillMeta[]>;
25
24
  };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * 多模态消息功能导出
3
+ */
4
+ export { useMultimodal, useMultimodalWithModel, convertAttachmentsToContent } from './useMultimodal';
5
+ export type { MultimodalConfig, MultimodalOptionsWithModel } from './useMultimodal';
6
+ export { fileToBase64, isImageFile, validateFileSize } from './utils';