@agentrun/sdk 0.0.3 → 0.0.4

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.
Files changed (130) hide show
  1. package/README.md +20 -15
  2. package/dist/agent-runtime/api/index.cjs +907 -0
  3. package/dist/agent-runtime/api/index.cjs.map +1 -0
  4. package/dist/agent-runtime/api/index.d.cts +193 -0
  5. package/dist/agent-runtime/api/index.d.ts +193 -0
  6. package/dist/agent-runtime/api/index.js +882 -0
  7. package/dist/agent-runtime/api/index.js.map +1 -0
  8. package/dist/agent-runtime/index.cjs +2528 -0
  9. package/dist/agent-runtime/index.cjs.map +1 -0
  10. package/dist/agent-runtime/index.d.cts +778 -0
  11. package/dist/agent-runtime/index.d.ts +778 -0
  12. package/dist/agent-runtime/index.js +2496 -0
  13. package/dist/agent-runtime/index.js.map +1 -0
  14. package/dist/base-K1GMfJbH.d.ts +59 -0
  15. package/dist/base-xcWt5bua.d.cts +59 -0
  16. package/dist/client-DHXxjuo3.d.ts +58 -0
  17. package/dist/client-DPUTs69s.d.cts +58 -0
  18. package/dist/config-07gMelJP.d.cts +125 -0
  19. package/dist/config-07gMelJP.d.ts +125 -0
  20. package/dist/control-api-BWD4eua5.d.cts +27 -0
  21. package/dist/control-api-d-82Sgpr.d.ts +27 -0
  22. package/dist/credential/api/index.cjs +655 -0
  23. package/dist/credential/api/index.cjs.map +1 -0
  24. package/dist/credential/api/index.d.cts +93 -0
  25. package/dist/credential/api/index.d.ts +93 -0
  26. package/dist/credential/api/index.js +630 -0
  27. package/dist/credential/api/index.js.map +1 -0
  28. package/dist/credential/index.cjs +1286 -0
  29. package/dist/credential/index.cjs.map +1 -0
  30. package/dist/credential/index.d.cts +246 -0
  31. package/dist/credential/index.d.ts +246 -0
  32. package/dist/credential/index.js +1263 -0
  33. package/dist/credential/index.js.map +1 -0
  34. package/dist/data-api-B-4h9_Vf.d.ts +166 -0
  35. package/dist/data-api-DsG-8JRQ.d.cts +166 -0
  36. package/dist/exception-DM9H2Rpo.d.cts +68 -0
  37. package/dist/exception-DM9H2Rpo.d.ts +68 -0
  38. package/dist/index.cjs +29281 -1427
  39. package/dist/index.cjs.map +1 -1
  40. package/dist/index.d.cts +38 -4485
  41. package/dist/index.d.ts +38 -4485
  42. package/dist/index.js +29259 -1426
  43. package/dist/index.js.map +1 -1
  44. package/dist/integration/builtin/index.cjs +9399 -0
  45. package/dist/integration/builtin/index.cjs.map +1 -0
  46. package/dist/integration/builtin/index.d.cts +692 -0
  47. package/dist/integration/builtin/index.d.ts +692 -0
  48. package/dist/integration/builtin/index.js +9363 -0
  49. package/dist/integration/builtin/index.js.map +1 -0
  50. package/dist/integration/index.cjs +9524 -0
  51. package/dist/integration/index.cjs.map +1 -0
  52. package/dist/integration/index.d.cts +98 -0
  53. package/dist/integration/index.d.ts +98 -0
  54. package/dist/integration/index.js +9481 -0
  55. package/dist/integration/index.js.map +1 -0
  56. package/dist/integration/mastra/index.cjs +9383 -0
  57. package/dist/integration/mastra/index.cjs.map +1 -0
  58. package/dist/integration/mastra/index.d.cts +186 -0
  59. package/dist/integration/mastra/index.d.ts +186 -0
  60. package/dist/integration/mastra/index.js +9348 -0
  61. package/dist/integration/mastra/index.js.map +1 -0
  62. package/dist/model/index.cjs +2392 -0
  63. package/dist/model/index.cjs.map +1 -0
  64. package/dist/model/index.d.cts +97 -0
  65. package/dist/model/index.d.ts +97 -0
  66. package/dist/model/index.js +2368 -0
  67. package/dist/model/index.js.map +1 -0
  68. package/dist/model--I90nCqy.d.cts +66 -0
  69. package/dist/model--I90nCqy.d.ts +66 -0
  70. package/dist/model-BV7A6Trb.d.cts +512 -0
  71. package/dist/model-DGBy-o_L.d.cts +176 -0
  72. package/dist/model-DGBy-o_L.d.ts +176 -0
  73. package/dist/model-RiiiZnou.d.ts +512 -0
  74. package/dist/model-service-D-P2FZNi.d.ts +540 -0
  75. package/dist/model-service-VpzBb7rV.d.cts +540 -0
  76. package/dist/resource-CQovFUeh.d.cts +44 -0
  77. package/dist/resource-DnE_DEka.d.ts +44 -0
  78. package/dist/sandbox/index.cjs +3557 -0
  79. package/dist/sandbox/index.cjs.map +1 -0
  80. package/dist/sandbox/index.d.cts +1598 -0
  81. package/dist/sandbox/index.d.ts +1598 -0
  82. package/dist/sandbox/index.js +3532 -0
  83. package/dist/sandbox/index.js.map +1 -0
  84. package/dist/server/adapter/index.cjs +24886 -0
  85. package/dist/server/adapter/index.cjs.map +1 -0
  86. package/dist/server/adapter/index.d.cts +68 -0
  87. package/dist/server/adapter/index.d.ts +68 -0
  88. package/dist/server/adapter/index.js +24883 -0
  89. package/dist/server/adapter/index.js.map +1 -0
  90. package/dist/server/core/index.cjs +313 -0
  91. package/dist/server/core/index.cjs.map +1 -0
  92. package/dist/server/core/index.d.cts +58 -0
  93. package/dist/server/core/index.d.ts +58 -0
  94. package/dist/server/core/index.js +309 -0
  95. package/dist/server/core/index.js.map +1 -0
  96. package/dist/server/index.cjs +25098 -0
  97. package/dist/server/index.cjs.map +1 -0
  98. package/dist/server/index.d.cts +73 -0
  99. package/dist/server/index.d.ts +73 -0
  100. package/dist/server/index.js +25067 -0
  101. package/dist/server/index.js.map +1 -0
  102. package/dist/server/protocol/index.cjs +1057 -0
  103. package/dist/server/protocol/index.cjs.map +1 -0
  104. package/dist/server/protocol/index.d.cts +135 -0
  105. package/dist/server/protocol/index.d.ts +135 -0
  106. package/dist/server/protocol/index.js +1053 -0
  107. package/dist/server/protocol/index.js.map +1 -0
  108. package/dist/tool-CG0LY-ov.d.cts +155 -0
  109. package/dist/tool-JJHam0ms.d.ts +155 -0
  110. package/dist/toolset/api/index.cjs +754 -0
  111. package/dist/toolset/api/index.cjs.map +1 -0
  112. package/dist/toolset/api/index.d.cts +207 -0
  113. package/dist/toolset/api/index.d.ts +207 -0
  114. package/dist/toolset/api/index.js +727 -0
  115. package/dist/toolset/api/index.js.map +1 -0
  116. package/dist/toolset/index.cjs +1945 -0
  117. package/dist/toolset/index.cjs.map +1 -0
  118. package/dist/toolset/index.d.cts +182 -0
  119. package/dist/toolset/index.d.ts +182 -0
  120. package/dist/toolset/index.js +1920 -0
  121. package/dist/toolset/index.js.map +1 -0
  122. package/dist/toolset-BYDvhwRp.d.cts +394 -0
  123. package/dist/toolset-CSRsJxCb.d.ts +394 -0
  124. package/dist/utils/index.cjs +994 -0
  125. package/dist/utils/index.cjs.map +1 -0
  126. package/dist/utils/index.d.cts +30 -0
  127. package/dist/utils/index.d.ts +30 -0
  128. package/dist/utils/index.js +951 -0
  129. package/dist/utils/index.js.map +1 -0
  130. package/package.json +65 -13
@@ -0,0 +1,182 @@
1
+ export { T as ToolSetClient } from '../client-DHXxjuo3.js';
2
+ export { M as MCPToolMeta, k as ToolInfo, l as ToolSchema, T as ToolSet, a as ToolSetAuthorization, b as ToolSetCreateInput, c as ToolSetData, d as ToolSetListInput, e as ToolSetSchema, f as ToolSetSchemaType, g as ToolSetSpec, h as ToolSetStatus, i as ToolSetStatusOutputs, j as ToolSetUpdateInput } from '../toolset-CSRsJxCb.js';
3
+ import { C as Config } from '../config-07gMelJP.js';
4
+ export { MCPSession, MCPToolSet, ToolControlAPI } from './api/index.js';
5
+ import '../model--I90nCqy.js';
6
+ import '@alicloud/devs20230714';
7
+
8
+ /**
9
+ * OpenAPI Protocol Handler
10
+ *
11
+ * 处理 OpenAPI 规范的工具解析和调用。
12
+ * Handles tool parsing and invocation for OpenAPI specification.
13
+ */
14
+
15
+ /**
16
+ * Tool parameter schema
17
+ */
18
+ interface ToolParameterSchema {
19
+ type?: string;
20
+ description?: string;
21
+ properties?: Record<string, ToolParameterSchema>;
22
+ required?: string[];
23
+ items?: ToolParameterSchema;
24
+ enum?: unknown[];
25
+ default?: unknown;
26
+ format?: string;
27
+ minimum?: number;
28
+ maximum?: number;
29
+ minLength?: number;
30
+ maxLength?: number;
31
+ pattern?: string;
32
+ }
33
+ /**
34
+ * Tool information
35
+ */
36
+ interface ToolInfo {
37
+ name: string;
38
+ description?: string;
39
+ parameters?: ToolParameterSchema;
40
+ operationId?: string;
41
+ method?: string;
42
+ path?: string;
43
+ }
44
+ /**
45
+ * Invoke result
46
+ */
47
+ interface InvokeResult {
48
+ status_code: number;
49
+ headers?: Record<string, string>;
50
+ body?: unknown;
51
+ error?: string;
52
+ }
53
+ /**
54
+ * OpenAPI handler options
55
+ */
56
+ interface OpenAPIOptions {
57
+ /** OpenAPI schema (JSON string or object) */
58
+ schema: string | Record<string, unknown>;
59
+ /** Base URL for API calls */
60
+ baseUrl?: string;
61
+ /** Default headers for all requests */
62
+ headers?: Record<string, string>;
63
+ /** Default query parameters */
64
+ queryParams?: Record<string, string>;
65
+ /** Configuration */
66
+ config?: Config;
67
+ }
68
+ /**
69
+ * OpenAPI Handler class
70
+ *
71
+ * Parses OpenAPI schema and provides tool invocation capabilities.
72
+ */
73
+ declare class OpenAPI {
74
+ private _schema;
75
+ private _baseUrl;
76
+ private _defaultHeaders;
77
+ private _defaultQueryParams;
78
+ private _config?;
79
+ private _tools;
80
+ constructor(options: OpenAPIOptions);
81
+ /**
82
+ * Get the parsed schema
83
+ */
84
+ get schema(): Record<string, unknown>;
85
+ /**
86
+ * Get all parsed tools
87
+ */
88
+ get tools(): ToolInfo[];
89
+ /**
90
+ * Get a specific tool by name
91
+ */
92
+ getTool(name: string): ToolInfo | undefined;
93
+ /**
94
+ * Invoke a tool
95
+ */
96
+ invokeToolAsync: (name: string, args?: Record<string, unknown>, _config?: Config) => Promise<InvokeResult>;
97
+ /**
98
+ * Synchronous invoke (wrapper for async)
99
+ */
100
+ invokeToolSync(_name: string, _args?: Record<string, unknown>): InvokeResult;
101
+ invoke_tool: (name: string, args?: Record<string, unknown>, _config?: Config) => Promise<InvokeResult>;
102
+ /**
103
+ * Extract base URL from schema
104
+ */
105
+ private _extractBaseUrl;
106
+ /**
107
+ * Resolve all $ref references in the schema
108
+ */
109
+ private _resolveAllRefs;
110
+ /**
111
+ * Recursively resolve $ref references
112
+ */
113
+ private _resolveRefs;
114
+ /**
115
+ * Resolve a single $ref path
116
+ */
117
+ private _resolveRef;
118
+ /**
119
+ * Parse tools from OpenAPI paths
120
+ */
121
+ private _parseTools;
122
+ /**
123
+ * Parse operation parameters into a schema
124
+ */
125
+ private _parseParameters;
126
+ }
127
+ /**
128
+ * ApiSet class for unified tool invocation
129
+ * 统一的工具集接口,支持 OpenAPI 和 MCP 工具
130
+ */
131
+ declare class ApiSet {
132
+ private _tools;
133
+ private _invoker;
134
+ private _baseUrl?;
135
+ private _defaultHeaders;
136
+ private _defaultQueryParams;
137
+ private _baseConfig?;
138
+ constructor(tools: ToolInfo[], invoker: any, baseUrl?: string, headers?: Record<string, string>, queryParams?: Record<string, unknown>, config?: Config);
139
+ /**
140
+ * Invoke a tool by name
141
+ * 调用指定的工具
142
+ */
143
+ invoke: (name: string, args?: Record<string, unknown>, config?: Config) => Promise<Record<string, unknown>>;
144
+ /**
145
+ * Get all tools
146
+ * 返回所有工具列表
147
+ */
148
+ get tools(): ToolInfo[];
149
+ /**
150
+ * Get a specific tool
151
+ * 获取指定名称的工具
152
+ */
153
+ getTool(name: string): ToolInfo | undefined;
154
+ /**
155
+ * Convert arguments from framework-specific types to native JavaScript types
156
+ * 将常见框架类型转换为 JavaScript 原生类型
157
+ *
158
+ * Purpose: Ensure we send JSON-serializable data to OpenAPI
159
+ * 目的:确保我们发送到 OpenAPI 的 JSON body 是可以被序列化的
160
+ */
161
+ private _convertToNative;
162
+ /**
163
+ * Convert arguments dictionary
164
+ * 转换参数字典
165
+ */
166
+ private _convertArguments;
167
+ /**
168
+ * Create ApiSet from MCP tools
169
+ * 从 MCP tools 创建 ApiSet
170
+ *
171
+ * @param tools - MCP tools list or single tool / MCP tools 列表或单个工具
172
+ * @param mcpClient - MCP client (MCPToolSet instance) / MCP 客户端(MCPToolSet 实例)
173
+ * @param config - Configuration object / 配置对象
174
+ */
175
+ static fromMCPTools(params: {
176
+ tools: unknown;
177
+ mcpClient: any;
178
+ config?: Config;
179
+ }): ApiSet;
180
+ }
181
+
182
+ export { ApiSet, type InvokeResult, OpenAPI, type OpenAPIOptions, type ToolParameterSchema };