@agentrun/sdk 0.0.1-test.21dd786
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 +201 -0
- package/README.md +225 -0
- package/dist/add.d.ts +2 -0
- package/dist/add.d.ts.map +1 -0
- package/dist/agent-runtime/api/control.d.ts +190 -0
- package/dist/agent-runtime/api/control.d.ts.map +1 -0
- package/dist/agent-runtime/api/data.d.ts +38 -0
- package/dist/agent-runtime/api/data.d.ts.map +1 -0
- package/dist/agent-runtime/api/index.d.ts +5 -0
- package/dist/agent-runtime/api/index.d.ts.map +1 -0
- package/dist/agent-runtime/client.d.ts +146 -0
- package/dist/agent-runtime/client.d.ts.map +1 -0
- package/dist/agent-runtime/endpoint.d.ts +132 -0
- package/dist/agent-runtime/endpoint.d.ts.map +1 -0
- package/dist/agent-runtime/index.d.ts +12 -0
- package/dist/agent-runtime/index.d.ts.map +1 -0
- package/dist/agent-runtime/model.d.ts +327 -0
- package/dist/agent-runtime/model.d.ts.map +1 -0
- package/dist/agent-runtime/runtime.d.ts +206 -0
- package/dist/agent-runtime/runtime.d.ts.map +1 -0
- package/dist/credential/api/control.d.ts +90 -0
- package/dist/credential/api/control.d.ts.map +1 -0
- package/dist/credential/api/index.d.ts +5 -0
- package/dist/credential/api/index.d.ts.map +1 -0
- package/dist/credential/client.d.ts +57 -0
- package/dist/credential/client.d.ts.map +1 -0
- package/dist/credential/credential.d.ts +68 -0
- package/dist/credential/credential.d.ts.map +1 -0
- package/dist/credential/index.d.ts +9 -0
- package/dist/credential/index.d.ts.map +1 -0
- package/dist/credential/model.d.ts +132 -0
- package/dist/credential/model.d.ts.map +1 -0
- package/dist/index.cjs +7498 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7493 -0
- package/dist/integration/adapter.d.ts +128 -0
- package/dist/integration/adapter.d.ts.map +1 -0
- package/dist/integration/index.d.ts +14 -0
- package/dist/integration/index.d.ts.map +1 -0
- package/dist/integration/mastra/adapter.d.ts +112 -0
- package/dist/integration/mastra/adapter.d.ts.map +1 -0
- package/dist/integration/mastra/index.d.ts +15 -0
- package/dist/integration/mastra/index.d.ts.map +1 -0
- package/dist/integration/mastra/types.d.ts +62 -0
- package/dist/integration/mastra/types.d.ts.map +1 -0
- package/dist/model/api/control.d.ts +162 -0
- package/dist/model/api/control.d.ts.map +1 -0
- package/dist/model/client.d.ts +91 -0
- package/dist/model/client.d.ts.map +1 -0
- package/dist/model/index.d.ts +10 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model/model-proxy.d.ts +186 -0
- package/dist/model/model-proxy.d.ts.map +1 -0
- package/dist/model/model-service.d.ts +185 -0
- package/dist/model/model-service.d.ts.map +1 -0
- package/dist/model/model.d.ts +227 -0
- package/dist/model/model.d.ts.map +1 -0
- package/dist/sandbox/aio-sandbox.d.ts +258 -0
- package/dist/sandbox/aio-sandbox.d.ts.map +1 -0
- package/dist/sandbox/api/aio-data.d.ts +53 -0
- package/dist/sandbox/api/aio-data.d.ts.map +1 -0
- package/dist/sandbox/api/browser-data.d.ts +85 -0
- package/dist/sandbox/api/browser-data.d.ts.map +1 -0
- package/dist/sandbox/api/code-interpreter-data.d.ts +189 -0
- package/dist/sandbox/api/code-interpreter-data.d.ts.map +1 -0
- package/dist/sandbox/api/control.d.ts +146 -0
- package/dist/sandbox/api/control.d.ts.map +1 -0
- package/dist/sandbox/api/sandbox-data.d.ts +168 -0
- package/dist/sandbox/api/sandbox-data.d.ts.map +1 -0
- package/dist/sandbox/browser-sandbox.d.ts +98 -0
- package/dist/sandbox/browser-sandbox.d.ts.map +1 -0
- package/dist/sandbox/client.d.ts +122 -0
- package/dist/sandbox/client.d.ts.map +1 -0
- package/dist/sandbox/code-interpreter-sandbox.d.ts +238 -0
- package/dist/sandbox/code-interpreter-sandbox.d.ts.map +1 -0
- package/dist/sandbox/index.d.ts +16 -0
- package/dist/sandbox/index.d.ts.map +1 -0
- package/dist/sandbox/model.d.ts +231 -0
- package/dist/sandbox/model.d.ts.map +1 -0
- package/dist/sandbox/sandbox.d.ts +90 -0
- package/dist/sandbox/sandbox.d.ts.map +1 -0
- package/dist/sandbox/template.d.ts +118 -0
- package/dist/sandbox/template.d.ts.map +1 -0
- package/dist/server/agui-protocol.d.ts +127 -0
- package/dist/server/agui-protocol.d.ts.map +1 -0
- package/dist/server/index.d.ts +8 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/model.d.ts +150 -0
- package/dist/server/model.d.ts.map +1 -0
- package/dist/server/server.d.ts +66 -0
- package/dist/server/server.d.ts.map +1 -0
- package/dist/toolset/api/control.d.ts +74 -0
- package/dist/toolset/api/control.d.ts.map +1 -0
- package/dist/toolset/api/index.d.ts +10 -0
- package/dist/toolset/api/index.d.ts.map +1 -0
- package/dist/toolset/api/mcp.d.ts +85 -0
- package/dist/toolset/api/mcp.d.ts.map +1 -0
- package/dist/toolset/client.d.ts +65 -0
- package/dist/toolset/client.d.ts.map +1 -0
- package/dist/toolset/index.d.ts +15 -0
- package/dist/toolset/index.d.ts.map +1 -0
- package/dist/toolset/model.d.ts +246 -0
- package/dist/toolset/model.d.ts.map +1 -0
- package/dist/toolset/openapi.d.ts +174 -0
- package/dist/toolset/openapi.d.ts.map +1 -0
- package/dist/toolset/toolset.d.ts +161 -0
- package/dist/toolset/toolset.d.ts.map +1 -0
- package/dist/utils/config.d.ts +124 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/control-api.d.ts +24 -0
- package/dist/utils/control-api.d.ts.map +1 -0
- package/dist/utils/data-api.d.ts +163 -0
- package/dist/utils/data-api.d.ts.map +1 -0
- package/dist/utils/exception.d.ts +67 -0
- package/dist/utils/exception.d.ts.map +1 -0
- package/dist/utils/helper.d.ts +2 -0
- package/dist/utils/helper.d.ts.map +1 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/log.d.ts +25 -0
- package/dist/utils/log.d.ts.map +1 -0
- package/dist/utils/model.d.ts +77 -0
- package/dist/utils/model.d.ts.map +1 -0
- package/dist/utils/resource.d.ts +72 -0
- package/dist/utils/resource.d.ts.map +1 -0
- package/package.json +98 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapter Interface Definition
|
|
3
|
+
*
|
|
4
|
+
* 定义统一的适配器接口,所有框架适配器都实现这些接口。
|
|
5
|
+
* Defines unified adapter interfaces that all framework adapters implement.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* 标准消息格式 (OpenAI 兼容)
|
|
9
|
+
* Canonical message format (OpenAI compatible)
|
|
10
|
+
*/
|
|
11
|
+
export interface CanonicalMessage {
|
|
12
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
13
|
+
content: string | null;
|
|
14
|
+
name?: string;
|
|
15
|
+
toolCalls?: ToolCall[];
|
|
16
|
+
toolCallId?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 工具调用
|
|
20
|
+
* Tool call
|
|
21
|
+
*/
|
|
22
|
+
export interface ToolCall {
|
|
23
|
+
id: string;
|
|
24
|
+
type: "function";
|
|
25
|
+
function: {
|
|
26
|
+
name: string;
|
|
27
|
+
arguments: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* 标准工具定义
|
|
32
|
+
* Canonical tool definition
|
|
33
|
+
*/
|
|
34
|
+
export interface CanonicalTool {
|
|
35
|
+
name: string;
|
|
36
|
+
description: string;
|
|
37
|
+
parameters?: Record<string, unknown>;
|
|
38
|
+
func?: (...args: unknown[]) => unknown | Promise<unknown>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 通用模型配置
|
|
42
|
+
* Common model configuration
|
|
43
|
+
*/
|
|
44
|
+
export interface CommonModelConfig {
|
|
45
|
+
/** 模型端点 URL */
|
|
46
|
+
endpoint?: string;
|
|
47
|
+
/** API Key */
|
|
48
|
+
apiKey?: string;
|
|
49
|
+
/** 模型名称 */
|
|
50
|
+
modelName?: string;
|
|
51
|
+
/** 温度参数 */
|
|
52
|
+
temperature?: number;
|
|
53
|
+
/** 最大 tokens */
|
|
54
|
+
maxTokens?: number;
|
|
55
|
+
/** 超时时间 (毫秒) */
|
|
56
|
+
timeout?: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* 消息适配器接口
|
|
60
|
+
* Message adapter interface
|
|
61
|
+
*
|
|
62
|
+
* 用于在不同框架消息格式之间进行转换。
|
|
63
|
+
* Used to convert between different framework message formats.
|
|
64
|
+
*/
|
|
65
|
+
export interface MessageAdapter<TFrameworkMessage = unknown> {
|
|
66
|
+
/**
|
|
67
|
+
* 将框架消息转换为标准格式
|
|
68
|
+
* Convert framework messages to canonical format
|
|
69
|
+
*/
|
|
70
|
+
toCanonical(messages: TFrameworkMessage[]): CanonicalMessage[];
|
|
71
|
+
/**
|
|
72
|
+
* 将标准消息转换为框架格式
|
|
73
|
+
* Convert canonical messages to framework format
|
|
74
|
+
*/
|
|
75
|
+
fromCanonical(messages: CanonicalMessage[]): TFrameworkMessage[];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* 工具适配器接口
|
|
79
|
+
* Tool adapter interface
|
|
80
|
+
*
|
|
81
|
+
* 用于将标准工具定义转换为框架特定格式。
|
|
82
|
+
* Used to convert canonical tool definitions to framework-specific format.
|
|
83
|
+
*/
|
|
84
|
+
export interface ToolAdapter<TFrameworkTool = unknown> {
|
|
85
|
+
/**
|
|
86
|
+
* 将标准工具转换为框架格式
|
|
87
|
+
* Convert canonical tools to framework format
|
|
88
|
+
*/
|
|
89
|
+
fromCanonical(tools: CanonicalTool[]): TFrameworkTool[];
|
|
90
|
+
/**
|
|
91
|
+
* 将框架工具转换为标准格式 (可选)
|
|
92
|
+
* Convert framework tools to canonical format (optional)
|
|
93
|
+
*/
|
|
94
|
+
toCanonical?(tools: TFrameworkTool[]): CanonicalTool[];
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* 模型适配器接口
|
|
98
|
+
* Model adapter interface
|
|
99
|
+
*
|
|
100
|
+
* 用于包装框架模型,使其能够与 AgentRun 协同工作。
|
|
101
|
+
* Used to wrap framework models to work with AgentRun.
|
|
102
|
+
*/
|
|
103
|
+
export interface ModelAdapter<TFrameworkModel = unknown> {
|
|
104
|
+
/**
|
|
105
|
+
* 使用 AgentRun 模型配置创建框架模型
|
|
106
|
+
* Create framework model with AgentRun model configuration
|
|
107
|
+
*/
|
|
108
|
+
createModel(config: CommonModelConfig): TFrameworkModel;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* 框架集成适配器
|
|
112
|
+
* Framework integration adapter
|
|
113
|
+
*
|
|
114
|
+
* 组合消息、工具和模型适配器的完整框架集成。
|
|
115
|
+
* Complete framework integration combining message, tool, and model adapters.
|
|
116
|
+
*/
|
|
117
|
+
export interface FrameworkAdapter<TMessage = unknown, TTool = unknown, TModel = unknown> {
|
|
118
|
+
name: string;
|
|
119
|
+
message: MessageAdapter<TMessage>;
|
|
120
|
+
tool: ToolAdapter<TTool>;
|
|
121
|
+
model: ModelAdapter<TModel>;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* 将 JSON Schema 类型转换为 TypeScript 类型
|
|
125
|
+
* Convert JSON Schema type to TypeScript type
|
|
126
|
+
*/
|
|
127
|
+
export declare function schemaToType(schema: Record<string, unknown>): string;
|
|
128
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../src/integration/adapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;IAC/C,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,IAAI,CAAC,EAAE,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CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,cAAc,EAAE,CAAC;IAExD;;;OAGG;IACH,WAAW,CAAC,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,aAAa,EAAE,CAAC;CACxD;AAED;;;;;;GAMG;AACH,MAAM,WAAW,YAAY,CAAC,eAAe,GAAG,OAAO;IACrD;;;OAGG;IACH,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,eAAe,CAAC;CACzD;AAED;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB,CAC/B,QAAQ,GAAG,OAAO,EAClB,KAAK,GAAG,OAAO,EACf,MAAM,GAAG,OAAO;IAEhB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IACzB,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CA6BpE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration Module
|
|
3
|
+
*
|
|
4
|
+
* 提供与主流 AI 框架的集成适配器。
|
|
5
|
+
* Provides integration adapters for mainstream AI frameworks.
|
|
6
|
+
*
|
|
7
|
+
* 支持的框架 / Supported Frameworks:
|
|
8
|
+
* - Mastra: 现代 TypeScript AI Agent 框架 / Modern TypeScript AI agent framework
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
export * from "./adapter";
|
|
13
|
+
export * from "./mastra";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/integration/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mastra Adapter
|
|
3
|
+
*
|
|
4
|
+
* Mastra 框架的集成适配器。
|
|
5
|
+
* Integration adapter for Mastra framework.
|
|
6
|
+
*/
|
|
7
|
+
import { CanonicalMessage, CanonicalTool, CommonModelConfig, FrameworkAdapter, MessageAdapter, ModelAdapter, ToolAdapter } from "../adapter";
|
|
8
|
+
import { MastraAgentConfig, MastraMessage, MastraModelConfig, MastraTool } from "./types";
|
|
9
|
+
/**
|
|
10
|
+
* Mastra 消息适配器
|
|
11
|
+
* Mastra message adapter
|
|
12
|
+
*/
|
|
13
|
+
export declare class MastraMessageAdapter implements MessageAdapter<MastraMessage> {
|
|
14
|
+
/**
|
|
15
|
+
* 将 Mastra 消息转换为标准格式
|
|
16
|
+
*/
|
|
17
|
+
toCanonical(messages: MastraMessage[]): CanonicalMessage[];
|
|
18
|
+
/**
|
|
19
|
+
* 将标准消息转换为 Mastra 格式
|
|
20
|
+
*/
|
|
21
|
+
fromCanonical(messages: CanonicalMessage[]): MastraMessage[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Mastra 工具适配器
|
|
25
|
+
* Mastra tool adapter
|
|
26
|
+
*/
|
|
27
|
+
export declare class MastraToolAdapter implements ToolAdapter<MastraTool> {
|
|
28
|
+
/**
|
|
29
|
+
* 将标准工具转换为 Mastra 格式
|
|
30
|
+
*/
|
|
31
|
+
fromCanonical(tools: CanonicalTool[]): MastraTool[];
|
|
32
|
+
/**
|
|
33
|
+
* 将 Mastra 工具转换为标准格式
|
|
34
|
+
*/
|
|
35
|
+
toCanonical(tools: MastraTool[]): CanonicalTool[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Mastra 模型适配器
|
|
39
|
+
* Mastra model adapter
|
|
40
|
+
*/
|
|
41
|
+
export declare class MastraModelAdapter implements ModelAdapter<MastraModelConfig> {
|
|
42
|
+
/**
|
|
43
|
+
* 使用 AgentRun 配置创建 Mastra 模型配置
|
|
44
|
+
*/
|
|
45
|
+
createModel(config: CommonModelConfig): MastraModelConfig;
|
|
46
|
+
/**
|
|
47
|
+
* 检测模型提供商
|
|
48
|
+
*/
|
|
49
|
+
private detectProvider;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Mastra 完整框架适配器
|
|
53
|
+
* Mastra complete framework adapter
|
|
54
|
+
*/
|
|
55
|
+
export declare class MastraAdapter implements FrameworkAdapter<MastraMessage, MastraTool, MastraModelConfig> {
|
|
56
|
+
readonly name = "mastra";
|
|
57
|
+
readonly message: MastraMessageAdapter;
|
|
58
|
+
readonly tool: MastraToolAdapter;
|
|
59
|
+
readonly model: MastraModelAdapter;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* 创建 Mastra 适配器实例
|
|
63
|
+
* Create Mastra adapter instance
|
|
64
|
+
*/
|
|
65
|
+
export declare function createMastraAdapter(): MastraAdapter;
|
|
66
|
+
/**
|
|
67
|
+
* 将 AgentRun 工具包装为 Mastra 工具
|
|
68
|
+
* Wrap AgentRun tools as Mastra tools
|
|
69
|
+
*/
|
|
70
|
+
export declare function wrapTools(tools: CanonicalTool[]): MastraTool[];
|
|
71
|
+
/**
|
|
72
|
+
* 将 AgentRun 模型配置转换为 Mastra 模型配置
|
|
73
|
+
* Convert AgentRun model config to Mastra model config
|
|
74
|
+
*/
|
|
75
|
+
export declare function wrapModel(config: CommonModelConfig): MastraModelConfig;
|
|
76
|
+
/**
|
|
77
|
+
* Agent 包装器配置参数
|
|
78
|
+
* Agent wrapper configuration parameters
|
|
79
|
+
*/
|
|
80
|
+
export interface WrapAgentParams {
|
|
81
|
+
/** Agent 名称 */
|
|
82
|
+
name: string;
|
|
83
|
+
/** Agent 指令/系统提示词 */
|
|
84
|
+
instructions?: string;
|
|
85
|
+
/** 模型配置 */
|
|
86
|
+
modelConfig: CommonModelConfig;
|
|
87
|
+
/** 工具列表 */
|
|
88
|
+
tools?: CanonicalTool[];
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* 将 AgentRun 组件包装为完整的 Mastra Agent 配置
|
|
92
|
+
* Wrap AgentRun components as complete Mastra agent configuration
|
|
93
|
+
*
|
|
94
|
+
* @param params - Agent 包装器配置参数
|
|
95
|
+
* @returns Mastra Agent 配置对象
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```typescript
|
|
99
|
+
* const agentConfig = wrapAgent({
|
|
100
|
+
* name: "MyAssistant",
|
|
101
|
+
* instructions: "You are a helpful assistant",
|
|
102
|
+
* modelConfig: {
|
|
103
|
+
* endpoint: "https://api.openai.com/v1",
|
|
104
|
+
* apiKey: "sk-...",
|
|
105
|
+
* modelName: "gpt-4"
|
|
106
|
+
* },
|
|
107
|
+
* tools: [calculatorTool, weatherTool]
|
|
108
|
+
* });
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
export declare function wrapAgent(params: WrapAgentParams): MastraAgentConfig;
|
|
112
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/integration/mastra/adapter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,WAAW,EACZ,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,UAAU,EAEX,MAAM,SAAS,CAAC;AAEjB;;;GAGG;AACH,qBAAa,oBAAqB,YAAW,cAAc,CAAC,aAAa,CAAC;IACxE;;OAEG;IACH,WAAW,CAAC,QAAQ,EAAE,aAAa,EAAE,GAAG,gBAAgB,EAAE;IAc1D;;OAEG;IACH,aAAa,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,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
|
+
/**
|
|
2
|
+
* Mastra Integration
|
|
3
|
+
*
|
|
4
|
+
* 提供与 Mastra AI 框架的集成。
|
|
5
|
+
* Provides integration with the Mastra AI framework.
|
|
6
|
+
*
|
|
7
|
+
* Mastra 是一个现代化的 TypeScript AI Agent 框架,
|
|
8
|
+
* 支持 LLM、向量存储、RAG、工具等功能。
|
|
9
|
+
*
|
|
10
|
+
* @see https://mastra.ai
|
|
11
|
+
* @packageDocumentation
|
|
12
|
+
*/
|
|
13
|
+
export * from "./adapter";
|
|
14
|
+
export * from "./types";
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/integration/mastra/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mastra Types
|
|
3
|
+
*
|
|
4
|
+
* Mastra 框架相关的类型定义。
|
|
5
|
+
* Type definitions for Mastra framework.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Mastra 消息格式
|
|
9
|
+
* Mastra message format
|
|
10
|
+
*/
|
|
11
|
+
export interface MastraMessage {
|
|
12
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
13
|
+
content: string | null;
|
|
14
|
+
name?: string;
|
|
15
|
+
tool_call_id?: string;
|
|
16
|
+
tool_calls?: MastraToolCall[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Mastra 工具调用
|
|
20
|
+
* Mastra tool call
|
|
21
|
+
*/
|
|
22
|
+
export interface MastraToolCall {
|
|
23
|
+
id: string;
|
|
24
|
+
type: "function";
|
|
25
|
+
function: {
|
|
26
|
+
name: string;
|
|
27
|
+
arguments: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Mastra 工具定义
|
|
32
|
+
* Mastra tool definition
|
|
33
|
+
*/
|
|
34
|
+
export interface MastraTool {
|
|
35
|
+
name: string;
|
|
36
|
+
description: string;
|
|
37
|
+
inputSchema?: Record<string, unknown>;
|
|
38
|
+
execute?: (...args: unknown[]) => Promise<unknown>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Mastra 模型配置
|
|
42
|
+
* Mastra model configuration
|
|
43
|
+
*/
|
|
44
|
+
export interface MastraModelConfig {
|
|
45
|
+
provider: string;
|
|
46
|
+
modelId: string;
|
|
47
|
+
apiKey?: string;
|
|
48
|
+
baseUrl?: string;
|
|
49
|
+
temperature?: number;
|
|
50
|
+
maxTokens?: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Mastra Agent 配置
|
|
54
|
+
* Mastra agent configuration
|
|
55
|
+
*/
|
|
56
|
+
export interface MastraAgentConfig {
|
|
57
|
+
name: string;
|
|
58
|
+
instructions?: string;
|
|
59
|
+
model: MastraModelConfig;
|
|
60
|
+
tools?: MastraTool[];
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/integration/mastra/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;IAC/C,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;CAC/B;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,OAAO,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CACpD;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,iBAAiB,CAAC;IACzB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;CACtB"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is auto generated by the code generation script.
|
|
3
|
+
* Do not modify this file manually.
|
|
4
|
+
* Use the `bun run codegen` command to regenerate.
|
|
5
|
+
*
|
|
6
|
+
* 当前文件为自动生成的控制 API 客户端代码。请勿手动修改此文件。
|
|
7
|
+
* 使用 `bun run codegen` 命令重新生成。
|
|
8
|
+
*/
|
|
9
|
+
import * as $AgentRun from "@alicloud/agentrun20250910";
|
|
10
|
+
import { Config } from "../../utils/config";
|
|
11
|
+
import { ControlAPI } from "../../utils/control-api";
|
|
12
|
+
/**
|
|
13
|
+
* Model Control API
|
|
14
|
+
*/
|
|
15
|
+
export declare class ModelControlAPI extends ControlAPI {
|
|
16
|
+
constructor(config?: Config);
|
|
17
|
+
/**
|
|
18
|
+
* Create model service
|
|
19
|
+
*
|
|
20
|
+
* @param params - Method parameters
|
|
21
|
+
* @param params.input - Model service configuration
|
|
22
|
+
* @param params.headers - Custom request headers
|
|
23
|
+
* @param params.config - Optional config override
|
|
24
|
+
* @returns Created model service object
|
|
25
|
+
*/
|
|
26
|
+
createModelService: (params: {
|
|
27
|
+
input: $AgentRun.CreateModelServiceInput;
|
|
28
|
+
headers?: Record<string, string>;
|
|
29
|
+
config?: Config;
|
|
30
|
+
}) => Promise<$AgentRun.ModelService>;
|
|
31
|
+
/**
|
|
32
|
+
* Delete model service
|
|
33
|
+
*
|
|
34
|
+
* @param params - Method parameters
|
|
35
|
+
* @param params.modelServiceName - Model service name
|
|
36
|
+
* @param params.headers - Custom request headers
|
|
37
|
+
* @param params.config - Optional config override
|
|
38
|
+
* @returns Deleted model service object
|
|
39
|
+
*/
|
|
40
|
+
deleteModelService: (params: {
|
|
41
|
+
modelServiceName: string;
|
|
42
|
+
headers?: Record<string, string>;
|
|
43
|
+
config?: Config;
|
|
44
|
+
}) => Promise<$AgentRun.ModelService>;
|
|
45
|
+
/**
|
|
46
|
+
* Update model service
|
|
47
|
+
*
|
|
48
|
+
* @param params - Method parameters
|
|
49
|
+
* @param params.modelServiceName - Model service name
|
|
50
|
+
* @param params.input - Model service configuration
|
|
51
|
+
* @param params.headers - Custom request headers
|
|
52
|
+
* @param params.config - Optional config override
|
|
53
|
+
* @returns Updated model service object
|
|
54
|
+
*/
|
|
55
|
+
updateModelService: (params: {
|
|
56
|
+
modelServiceName: string;
|
|
57
|
+
input: $AgentRun.UpdateModelServiceInput;
|
|
58
|
+
headers?: Record<string, string>;
|
|
59
|
+
config?: Config;
|
|
60
|
+
}) => Promise<$AgentRun.ModelService>;
|
|
61
|
+
/**
|
|
62
|
+
* Get model service
|
|
63
|
+
*
|
|
64
|
+
* @param params - Method parameters
|
|
65
|
+
* @param params.modelServiceName - Model service name
|
|
66
|
+
* @param params.headers - Custom request headers
|
|
67
|
+
* @param params.config - Optional config override
|
|
68
|
+
* @returns Model service object
|
|
69
|
+
*/
|
|
70
|
+
getModelService: (params: {
|
|
71
|
+
modelServiceName: string;
|
|
72
|
+
headers?: Record<string, string>;
|
|
73
|
+
config?: Config;
|
|
74
|
+
}) => Promise<$AgentRun.ModelService>;
|
|
75
|
+
/**
|
|
76
|
+
* List model services
|
|
77
|
+
*
|
|
78
|
+
* @param params - Method parameters
|
|
79
|
+
* @param params.input - List options
|
|
80
|
+
* @param params.headers - Custom request headers
|
|
81
|
+
* @param params.config - Optional config override
|
|
82
|
+
* @returns List of model service objects
|
|
83
|
+
*/
|
|
84
|
+
listModelServices: (params: {
|
|
85
|
+
input: $AgentRun.ListModelServicesRequest;
|
|
86
|
+
headers?: Record<string, string>;
|
|
87
|
+
config?: Config;
|
|
88
|
+
}) => Promise<$AgentRun.ListModelServicesOutput>;
|
|
89
|
+
/**
|
|
90
|
+
* Create model proxy
|
|
91
|
+
*
|
|
92
|
+
* @param params - Method parameters
|
|
93
|
+
* @param params.input - Model proxy configuration
|
|
94
|
+
* @param params.headers - Custom request headers
|
|
95
|
+
* @param params.config - Optional config override
|
|
96
|
+
* @returns Created model proxy object
|
|
97
|
+
*/
|
|
98
|
+
createModelProxy: (params: {
|
|
99
|
+
input: $AgentRun.CreateModelProxyInput;
|
|
100
|
+
headers?: Record<string, string>;
|
|
101
|
+
config?: Config;
|
|
102
|
+
}) => Promise<$AgentRun.ModelProxy>;
|
|
103
|
+
/**
|
|
104
|
+
* Delete model proxy
|
|
105
|
+
*
|
|
106
|
+
* @param params - Method parameters
|
|
107
|
+
* @param params.modelProxyName - Model proxy name
|
|
108
|
+
* @param params.headers - Custom request headers
|
|
109
|
+
* @param params.config - Optional config override
|
|
110
|
+
* @returns Deleted model proxy object
|
|
111
|
+
*/
|
|
112
|
+
deleteModelProxy: (params: {
|
|
113
|
+
modelProxyName: string;
|
|
114
|
+
headers?: Record<string, string>;
|
|
115
|
+
config?: Config;
|
|
116
|
+
}) => Promise<$AgentRun.ModelProxy>;
|
|
117
|
+
/**
|
|
118
|
+
* Update model proxy
|
|
119
|
+
*
|
|
120
|
+
* @param params - Method parameters
|
|
121
|
+
* @param params.modelProxyName - Model proxy name
|
|
122
|
+
* @param params.input - Model proxy configuration
|
|
123
|
+
* @param params.headers - Custom request headers
|
|
124
|
+
* @param params.config - Optional config override
|
|
125
|
+
* @returns Updated model proxy object
|
|
126
|
+
*/
|
|
127
|
+
updateModelProxy: (params: {
|
|
128
|
+
modelProxyName: string;
|
|
129
|
+
input: $AgentRun.UpdateModelProxyInput;
|
|
130
|
+
headers?: Record<string, string>;
|
|
131
|
+
config?: Config;
|
|
132
|
+
}) => Promise<$AgentRun.ModelProxy>;
|
|
133
|
+
/**
|
|
134
|
+
* Get model proxy
|
|
135
|
+
*
|
|
136
|
+
* @param params - Method parameters
|
|
137
|
+
* @param params.modelProxyName - Model proxy name
|
|
138
|
+
* @param params.headers - Custom request headers
|
|
139
|
+
* @param params.config - Optional config override
|
|
140
|
+
* @returns Model proxy object
|
|
141
|
+
*/
|
|
142
|
+
getModelProxy: (params: {
|
|
143
|
+
modelProxyName: string;
|
|
144
|
+
headers?: Record<string, string>;
|
|
145
|
+
config?: Config;
|
|
146
|
+
}) => Promise<$AgentRun.ModelProxy>;
|
|
147
|
+
/**
|
|
148
|
+
* List model proxies
|
|
149
|
+
*
|
|
150
|
+
* @param params - Method parameters
|
|
151
|
+
* @param params.input - List options
|
|
152
|
+
* @param params.headers - Custom request headers
|
|
153
|
+
* @param params.config - Optional config override
|
|
154
|
+
* @returns List of model proxy objects
|
|
155
|
+
*/
|
|
156
|
+
listModelProxies: (params: {
|
|
157
|
+
input: $AgentRun.ListModelProxiesRequest;
|
|
158
|
+
headers?: Record<string, string>;
|
|
159
|
+
config?: Config;
|
|
160
|
+
}) => Promise<$AgentRun.ListModelProxiesOutput>;
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=control.d.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AAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAAG,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,CAiC1I;IAEF;;;;;;;;OAQG;IACH,gBAAgB,GAAU,QAAQ;QAAE,KAAK,EAAE,SAAS,CAAC,uBAAuB,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAAG,OAAO,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAiC3K;CAEH"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model Service 客户端 / Model Service Client
|
|
3
|
+
*
|
|
4
|
+
* 此模块提供模型服务和模型代理的客户端API。
|
|
5
|
+
* This module provides the client API for model services and model proxies.
|
|
6
|
+
*/
|
|
7
|
+
import { Config } from '../utils/config';
|
|
8
|
+
import { BackendType, ModelProxyCreateInput, ModelProxyListInput, ModelProxyUpdateInput, ModelServiceCreateInput, ModelServiceListInput, ModelServiceUpdateInput } from './model';
|
|
9
|
+
import { ModelProxy } from './model-proxy';
|
|
10
|
+
import { ModelService } from './model-service';
|
|
11
|
+
/**
|
|
12
|
+
* Model Service 客户端 / Model Service Client
|
|
13
|
+
*
|
|
14
|
+
* 提供模型服务和模型代理的创建、删除、更新和查询功能。
|
|
15
|
+
* Provides create, delete, update and query functions for model services and model proxies.
|
|
16
|
+
*/
|
|
17
|
+
export declare class ModelClient {
|
|
18
|
+
private controlApi;
|
|
19
|
+
private config?;
|
|
20
|
+
/**
|
|
21
|
+
* 初始化客户端 / Initialize client
|
|
22
|
+
*
|
|
23
|
+
* @param config - 配置对象,可选 / Configuration object, optional
|
|
24
|
+
*/
|
|
25
|
+
constructor(config?: Config);
|
|
26
|
+
/**
|
|
27
|
+
* 创建模型服务
|
|
28
|
+
* Create model service
|
|
29
|
+
*
|
|
30
|
+
* @param params - 参数 / Parameters
|
|
31
|
+
* @returns 创建的对象 / Created object
|
|
32
|
+
*/
|
|
33
|
+
create: (params: {
|
|
34
|
+
input: ModelServiceCreateInput | ModelProxyCreateInput;
|
|
35
|
+
config?: Config;
|
|
36
|
+
}) => Promise<ModelService | ModelProxy>;
|
|
37
|
+
/**
|
|
38
|
+
* 删除模型服务
|
|
39
|
+
* Delete model service
|
|
40
|
+
*
|
|
41
|
+
* @param params - 参数 / Parameters
|
|
42
|
+
* @returns 删除的对象 / Deleted object
|
|
43
|
+
*
|
|
44
|
+
* @throws ResourceNotExistError - 模型服务不存在 / Model service does not exist
|
|
45
|
+
*/
|
|
46
|
+
delete: (params: {
|
|
47
|
+
name: string;
|
|
48
|
+
backendType?: BackendType;
|
|
49
|
+
config?: Config;
|
|
50
|
+
}) => Promise<ModelService | ModelProxy>;
|
|
51
|
+
/**
|
|
52
|
+
* 更新模型服务
|
|
53
|
+
* Update model service
|
|
54
|
+
*
|
|
55
|
+
* @param params - 参数 / Parameters
|
|
56
|
+
* @returns 更新后的模型服务对象 / Updated model service object
|
|
57
|
+
*
|
|
58
|
+
* @throws ResourceNotExistError - 模型服务不存在 / Model service does not exist
|
|
59
|
+
*/
|
|
60
|
+
update: (params: {
|
|
61
|
+
name: string;
|
|
62
|
+
input: ModelServiceUpdateInput | ModelProxyUpdateInput;
|
|
63
|
+
config?: Config;
|
|
64
|
+
}) => Promise<ModelService | ModelProxy>;
|
|
65
|
+
/**
|
|
66
|
+
* 获取模型服务
|
|
67
|
+
* Get model service
|
|
68
|
+
*
|
|
69
|
+
* @param params - 参数 / Parameters
|
|
70
|
+
* @returns 模型服务对象 / Model service object
|
|
71
|
+
*
|
|
72
|
+
* @throws ResourceNotExistError - 模型服务不存在 / Model service does not exist
|
|
73
|
+
*/
|
|
74
|
+
get: (params: {
|
|
75
|
+
name: string;
|
|
76
|
+
backendType?: BackendType;
|
|
77
|
+
config?: Config;
|
|
78
|
+
}) => Promise<ModelService | ModelProxy>;
|
|
79
|
+
/**
|
|
80
|
+
* 列出模型服务
|
|
81
|
+
* List model services
|
|
82
|
+
*
|
|
83
|
+
* @param params - 参数 / Parameters
|
|
84
|
+
* @returns 模型服务列表 / Model service list
|
|
85
|
+
*/
|
|
86
|
+
list: (params: {
|
|
87
|
+
input: ModelServiceListInput | ModelProxyListInput;
|
|
88
|
+
config?: Config;
|
|
89
|
+
}) => Promise<ModelService[] | ModelProxy[]>;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/model/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAIzC,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAClL,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;;GAKG;AACH,qBAAa,WAAW;IACtB,OAAO,CAAC,UAAU,CAAkB;IACpC,OAAO,CAAC,MAAM,CAAC,CAAS;IAExB;;;;OAIG;gBACS,MAAM,CAAC,EAAE,MAAM;IAK3B;;;;;;OAMG;IACH,MAAM,GAAU,QAAQ;QAAE,KAAK,EAAE,uBAAuB,GAAG,qBAAqB,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAAG,OAAO,CAAC,YAAY,GAAG,UAAU,CAAC,CAmEtI;IAEF;;;;;;;;OAQG;IACH,MAAM,GAAU,QAAQ;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,WAAW,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAAG,OAAO,CAAC,YAAY,GAAG,UAAU,CAAC,CA4CvH;IAEF;;;;;;;;OAQG;IACH,MAAM,GAAU,QAAQ;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,uBAAuB,GAAG,qBAAqB,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAAG,OAAO,CAAC,YAAY,GAAG,UAAU,CAAC,CA2DpJ;IAEF;;;;;;;;OAQG;IACH,GAAG,GAAU,QAAQ;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,WAAW,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAAG,OAAO,CAAC,YAAY,GAAG,UAAU,CAAC,CA4CpH;IAEF;;;;;;OAMG;IACH,IAAI,GAAU,QAAQ;QAAE,KAAK,EAAE,qBAAqB,GAAG,mBAAmB,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAAG,OAAO,CAAC,YAAY,EAAE,GAAG,UAAU,EAAE,CAAC,CA6CpI;CACH"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model module exports
|
|
3
|
+
*/
|
|
4
|
+
export { ModelClient } from "./client";
|
|
5
|
+
export { ModelService } from "./model-service";
|
|
6
|
+
export { ModelProxy } from "./model-proxy";
|
|
7
|
+
export { ControlAPI as ModelControlAPI } from "../utils/control-api";
|
|
8
|
+
export { BackendType, ModelType, Provider } from "./model";
|
|
9
|
+
export type { ProviderSettings, ModelFeatures, ModelProperties, ModelParameterRule, ModelInfoConfig, ModelServiceCreateInput, ModelServiceUpdateInput, ModelServiceListInput, ModelServiceData, ProxyConfigEndpoint, ProxyConfigFallback, ProxyConfigPolicies, ProxyConfig, ModelProxyCreateInput, ModelProxyUpdateInput, ModelProxyListInput, ModelProxyData, } from "./model";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,EAAE,UAAU,IAAI,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAErE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE3D,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,GACf,MAAM,SAAS,CAAC"}
|