@opentiny/next-remoter 0.2.0 → 0.2.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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  目前是提供给`Vue的开发用户`的一个开箱即用的组件。
4
4
 
5
- 核心代码在 `components, composable` 中, `tiny-robot-chat.vue` 是真正的组件
5
+ 核心代码在 `components, composable` 中, `TinyRobotChat.vue` 是真正的组件
6
6
 
7
7
  1. `index.ts` 是用于导出 Vue 组件的包,供用户使用
8
8
  2. `App.vue` 是部署在服务器上,扫码访问的页面
@@ -0,0 +1,6 @@
1
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
2
+ genuiEnabled: import('vue').PropType<boolean>;
3
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
4
+ genuiEnabled: import('vue').PropType<boolean>;
5
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
6
+ export default _default;
@@ -1,2 +1,15 @@
1
- declare const _default: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
1
+ import { Ref } from 'vue';
2
+ import { UnifiedModelConfig } from '../types/model-config';
3
+
4
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
5
+ selectedModelId: import('vue').PropType<string>;
6
+ modelConfigs: {
7
+ type: import('vue').PropType<UnifiedModelConfig[] | Ref<UnifiedModelConfig[], UnifiedModelConfig[]>>;
8
+ };
9
+ }>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
10
+ selectedModelId: import('vue').PropType<string>;
11
+ modelConfigs: {
12
+ type: import('vue').PropType<UnifiedModelConfig[] | Ref<UnifiedModelConfig[], UnifiedModelConfig[]>>;
13
+ };
14
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
2
15
  export default _default;
@@ -23,20 +23,14 @@ export declare class CustomAgentModelProvider extends BaseModelProvider {
23
23
  * @param providerType 提供商类型
24
24
  * @param useReActMode 是否使用 ReAct 模式
25
25
  */
26
- updateLLMConfig({ modelId, apiUrl, apiKey, providerType, useReActMode }: {
26
+ updateLLMConfig({ modelId, baseURL, apiKey, providerType, useReActMode, llm }: {
27
27
  modelId: string;
28
- apiUrl: string;
29
- apiKey: string;
30
- providerType: 'deepseek' | 'openai' | ((options: any) => ProviderV2);
28
+ baseURL?: string;
29
+ apiKey?: string;
30
+ providerType?: 'deepseek' | 'openai' | ((options: any) => ProviderV2);
31
31
  useReActMode?: boolean;
32
+ llm?: ProviderV2;
32
33
  }): void;
33
- /**
34
- * 创建MCP服务器配置
35
- * @param sessionId 会话ID,支持逗号分隔的多个ID
36
- * @param agentRoot 代理根路径
37
- * @returns MCP服务器配置对象,键为服务器名称,值为配置对象
38
- */
39
- private createMcpServers;
40
34
  /**
41
35
  * 处理文本流数据
42
36
  * @param part 流数据部分
@@ -1,14 +1,16 @@
1
+ import { Ref } from 'vue';
1
2
  import { UnifiedModelConfig } from '../types/model-config';
2
3
 
3
4
  /**
4
5
  * 统一的模型管理 composable
5
6
  * 提供模型选择和配置管理功能
6
- * Unified model management composable
7
- * Provides model selection and configuration management
7
+ * @param modelConfigs 外部传入的模型配置列表(必需)
8
+ * @param initialModelId 初始模型 ID(可选,从外部传入,支持 Ref<string | undefined>)
9
+ * @param onModelChange 模型变化回调函数(可选,用于通知外部)
8
10
  */
9
- export default function useModel(): {
11
+ export default function useModel(modelConfigs?: Ref<UnifiedModelConfig[]> | UnifiedModelConfig[], initialModelId?: Ref<string | undefined> | Ref<string> | string, onModelChange?: (modelId: string) => void): {
10
12
  /** 当前选中的模型 ID Current selected model ID */
11
- selectedModelId: import('vue').Ref<string, string>;
13
+ selectedModelId: Ref<string, string>;
12
14
  /** 当前选中的完整模型配置 Current selected model configuration */
13
15
  selectedModel: import('vue').ComputedRef<UnifiedModelConfig | undefined>;
14
16
  /** 所有可用的模型配置列表 All available model configurations */
@@ -0,0 +1,96 @@
1
+ import { Ref } from 'vue';
2
+ import { PluginInfo } from '@opentiny/tiny-robot';
3
+ import { McpServerConfig } from '@opentiny/next-sdk';
4
+
5
+ /**
6
+ * 插件管理 Composable
7
+ * 统一管理插件的增删改查逻辑
8
+ */
9
+ export declare function usePlugin(agent: any, enabledTools: Ref<Record<string, boolean> | undefined>, defaultPluginSrc: string): {
10
+ installedPlugins: Ref<{
11
+ id: string;
12
+ name: string;
13
+ icon: string;
14
+ description: string;
15
+ enabled: boolean;
16
+ expanded?: boolean | undefined;
17
+ tools: {
18
+ id: string;
19
+ name: string;
20
+ description: string;
21
+ enabled: boolean;
22
+ }[];
23
+ addState?: import('@opentiny/tiny-robot').PluginAddState | undefined;
24
+ category?: string | undefined;
25
+ }[], PluginInfo[] | {
26
+ id: string;
27
+ name: string;
28
+ icon: string;
29
+ description: string;
30
+ enabled: boolean;
31
+ expanded?: boolean | undefined;
32
+ tools: {
33
+ id: string;
34
+ name: string;
35
+ description: string;
36
+ enabled: boolean;
37
+ }[];
38
+ addState?: import('@opentiny/tiny-robot').PluginAddState | undefined;
39
+ category?: string | undefined;
40
+ }[]>;
41
+ marketPlugins: Ref<{
42
+ id: string;
43
+ name: string;
44
+ icon: string;
45
+ description: string;
46
+ enabled: boolean;
47
+ expanded?: boolean | undefined;
48
+ tools: {
49
+ id: string;
50
+ name: string;
51
+ description: string;
52
+ enabled: boolean;
53
+ }[];
54
+ addState?: import('@opentiny/tiny-robot').PluginAddState | undefined;
55
+ category?: string | undefined;
56
+ }[], PluginInfo[] | {
57
+ id: string;
58
+ name: string;
59
+ icon: string;
60
+ description: string;
61
+ enabled: boolean;
62
+ expanded?: boolean | undefined;
63
+ tools: {
64
+ id: string;
65
+ name: string;
66
+ description: string;
67
+ enabled: boolean;
68
+ }[];
69
+ addState?: import('@opentiny/tiny-robot').PluginAddState | undefined;
70
+ category?: string | undefined;
71
+ }[]>;
72
+ pluginVisible: Ref<boolean, boolean>;
73
+ loadMcpServerToPlugin: (serverName: string, mcpServer: McpServerConfig) => Promise<void>;
74
+ togglePlugin: (plugin: PluginInfo, enabled: boolean) => void;
75
+ toggleTool: (plugin: PluginInfo, toolId: string, enabled: boolean) => void;
76
+ deletePlugin: (plugin: PluginInfo) => Promise<void>;
77
+ addPluginFromMarket: (plugin: PluginInfo) => Promise<void>;
78
+ addPluginFromScan: (sessionId: string, agentRoot: string) => Promise<boolean>;
79
+ handleClientDisconnected: (serverName: string) => Promise<{
80
+ id: string;
81
+ name: string;
82
+ icon: string;
83
+ description: string;
84
+ enabled: boolean;
85
+ expanded?: boolean | undefined;
86
+ tools: {
87
+ id: string;
88
+ name: string;
89
+ description: string;
90
+ enabled: boolean;
91
+ }[];
92
+ addState?: import('@opentiny/tiny-robot').PluginAddState | undefined;
93
+ category?: string | undefined;
94
+ } | null>;
95
+ searchPlugin: (query: string, item: PluginInfo) => boolean;
96
+ };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,7 @@
1
- import { default as TinyRemoter } from './components/tiny-robot-chat.vue';
1
+ import { default as TinyRemoter } from './components/TinyRobotChat.vue';
2
2
  import { useNextAgent } from './composable/useNextAgent';
3
3
 
4
4
  export * from './types/type';
5
5
  export * from './types/model-config';
6
- export * from './config/model-config';
7
6
  export { default as useModel } from './composable/useModel';
8
- export { StorageManager, getStorageManager, createStorageManager, storage } from './utils/storage-manager';
9
- export { StorageKeys, type StorageKey } from './utils/storage-keys';
10
- export type { IStorageAdapter, StorageManagerConfig } from './utils/storage-manager';
11
7
  export { TinyRemoter, useNextAgent };