@lobehub/market-sdk 0.23.6 → 0.24.0-beta.1
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/dist/index.d.mts +296 -4
- package/dist/index.mjs +127 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -1040,6 +1040,180 @@ interface PluginQueryParams {
|
|
|
1040
1040
|
tags?: string;
|
|
1041
1041
|
}
|
|
1042
1042
|
|
|
1043
|
+
/**
|
|
1044
|
+
* Available tool names for Code Interpreter
|
|
1045
|
+
* Note: Session management (createSession, destroySession, getSessionInfo) is handled
|
|
1046
|
+
* internally by the server - sessions are automatically created when needed and
|
|
1047
|
+
* recreated if expired.
|
|
1048
|
+
*/
|
|
1049
|
+
type CodeInterpreterToolName = 'editLocalFile' | 'getCommandOutput' | 'globLocalFiles' | 'grepContent' | 'killCommand' | 'listLocalFiles' | 'moveLocalFiles' | 'readLocalFile' | 'renameLocalFile' | 'runCommand' | 'searchLocalFiles' | 'writeLocalFile';
|
|
1050
|
+
/**
|
|
1051
|
+
* Request for RunBuildInTools API
|
|
1052
|
+
*/
|
|
1053
|
+
interface RunBuildInToolsRequest {
|
|
1054
|
+
/** Tool-specific parameters */
|
|
1055
|
+
params: Record<string, any>;
|
|
1056
|
+
/** Tool name to execute */
|
|
1057
|
+
toolName: CodeInterpreterToolName;
|
|
1058
|
+
/** Topic/conversation ID for session isolation */
|
|
1059
|
+
topicId: string;
|
|
1060
|
+
/** User ID for session isolation */
|
|
1061
|
+
userId: string;
|
|
1062
|
+
}
|
|
1063
|
+
/**
|
|
1064
|
+
* Success response data from RunBuildInTools
|
|
1065
|
+
*/
|
|
1066
|
+
interface RunBuildInToolsSuccessData {
|
|
1067
|
+
/** Tool execution result */
|
|
1068
|
+
result: any;
|
|
1069
|
+
/** Indicates if the session was expired and recreated */
|
|
1070
|
+
sessionExpiredAndRecreated: boolean;
|
|
1071
|
+
/** Name of the executed tool */
|
|
1072
|
+
toolName: string;
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* Error response data from RunBuildInTools
|
|
1076
|
+
*/
|
|
1077
|
+
interface RunBuildInToolsError {
|
|
1078
|
+
/** Error code */
|
|
1079
|
+
code: string;
|
|
1080
|
+
/** Additional error details */
|
|
1081
|
+
details?: any;
|
|
1082
|
+
/** Human-readable error message */
|
|
1083
|
+
message: string;
|
|
1084
|
+
}
|
|
1085
|
+
/**
|
|
1086
|
+
* Response from RunBuildInTools API
|
|
1087
|
+
*/
|
|
1088
|
+
interface RunBuildInToolsResponse {
|
|
1089
|
+
/** Success data (present when success=true) */
|
|
1090
|
+
data?: RunBuildInToolsSuccessData;
|
|
1091
|
+
/** Error data (present when success=false) */
|
|
1092
|
+
error?: RunBuildInToolsError;
|
|
1093
|
+
/** Whether the operation succeeded */
|
|
1094
|
+
success: boolean;
|
|
1095
|
+
}
|
|
1096
|
+
/** Parameters for runCommand tool */
|
|
1097
|
+
interface RunCommandParams {
|
|
1098
|
+
/** Whether to run in background */
|
|
1099
|
+
background?: boolean;
|
|
1100
|
+
/** Command to execute */
|
|
1101
|
+
command: string;
|
|
1102
|
+
/** Timeout in milliseconds */
|
|
1103
|
+
timeout?: number;
|
|
1104
|
+
}
|
|
1105
|
+
/** Parameters for getCommandOutput tool */
|
|
1106
|
+
interface GetCommandOutputParams {
|
|
1107
|
+
/** Background command ID */
|
|
1108
|
+
commandId: string;
|
|
1109
|
+
}
|
|
1110
|
+
/** Parameters for killCommand tool */
|
|
1111
|
+
interface KillCommandParams {
|
|
1112
|
+
/** Command ID to terminate */
|
|
1113
|
+
commandId: string;
|
|
1114
|
+
}
|
|
1115
|
+
/** Parameters for readLocalFile tool */
|
|
1116
|
+
interface ReadLocalFileParams {
|
|
1117
|
+
/** End line number (1-based, inclusive) */
|
|
1118
|
+
endLine?: number;
|
|
1119
|
+
/** File path to read */
|
|
1120
|
+
path: string;
|
|
1121
|
+
/** Start line number (1-based) */
|
|
1122
|
+
startLine?: number;
|
|
1123
|
+
}
|
|
1124
|
+
/** Parameters for writeLocalFile tool */
|
|
1125
|
+
interface WriteLocalFileParams {
|
|
1126
|
+
/** Content to write */
|
|
1127
|
+
content: string;
|
|
1128
|
+
/** Whether to create parent directories */
|
|
1129
|
+
createDirectories?: boolean;
|
|
1130
|
+
/** File path to write */
|
|
1131
|
+
path: string;
|
|
1132
|
+
}
|
|
1133
|
+
/** Parameters for editLocalFile tool */
|
|
1134
|
+
interface EditLocalFileParams {
|
|
1135
|
+
/** Replace all occurrences (default: false) */
|
|
1136
|
+
all?: boolean;
|
|
1137
|
+
/** File path to edit */
|
|
1138
|
+
path: string;
|
|
1139
|
+
/** String to replace with */
|
|
1140
|
+
replace: string;
|
|
1141
|
+
/** String to search for */
|
|
1142
|
+
search: string;
|
|
1143
|
+
}
|
|
1144
|
+
/** Parameters for listLocalFiles tool */
|
|
1145
|
+
interface ListLocalFilesParams {
|
|
1146
|
+
/** Directory path to list */
|
|
1147
|
+
directoryPath: string;
|
|
1148
|
+
}
|
|
1149
|
+
/** Parameters for globLocalFiles tool */
|
|
1150
|
+
interface GlobLocalFilesParams {
|
|
1151
|
+
/** Base directory (default: current directory) */
|
|
1152
|
+
directory?: string;
|
|
1153
|
+
/** Glob pattern (e.g., "**\/*.ts") */
|
|
1154
|
+
pattern: string;
|
|
1155
|
+
}
|
|
1156
|
+
/** Parameters for searchLocalFiles tool */
|
|
1157
|
+
interface SearchLocalFilesParams {
|
|
1158
|
+
/** Directory to search */
|
|
1159
|
+
directory: string;
|
|
1160
|
+
/** File type/extension filter */
|
|
1161
|
+
fileType?: string;
|
|
1162
|
+
/** Filename keyword filter */
|
|
1163
|
+
keyword?: string;
|
|
1164
|
+
/** Modified time upper bound (ISO date string) */
|
|
1165
|
+
modifiedAfter?: string;
|
|
1166
|
+
/** Modified time lower bound (ISO date string) */
|
|
1167
|
+
modifiedBefore?: string;
|
|
1168
|
+
}
|
|
1169
|
+
/** Parameters for grepContent tool */
|
|
1170
|
+
interface GrepContentParams {
|
|
1171
|
+
/** Directory to search */
|
|
1172
|
+
directory: string;
|
|
1173
|
+
/** File name pattern filter (e.g., "*.ts") */
|
|
1174
|
+
filePattern?: string;
|
|
1175
|
+
/** Regex pattern to search */
|
|
1176
|
+
pattern: string;
|
|
1177
|
+
/** Whether to search recursively (default: true) */
|
|
1178
|
+
recursive?: boolean;
|
|
1179
|
+
}
|
|
1180
|
+
/** Move operation for moveLocalFiles tool */
|
|
1181
|
+
interface MoveOperation {
|
|
1182
|
+
/** Destination path */
|
|
1183
|
+
destination: string;
|
|
1184
|
+
/** Source path */
|
|
1185
|
+
source: string;
|
|
1186
|
+
}
|
|
1187
|
+
/** Parameters for moveLocalFiles tool */
|
|
1188
|
+
interface MoveLocalFilesParams {
|
|
1189
|
+
/** Move operations to perform */
|
|
1190
|
+
operations: MoveOperation[];
|
|
1191
|
+
}
|
|
1192
|
+
/** Parameters for renameLocalFile tool */
|
|
1193
|
+
interface RenameLocalFileParams {
|
|
1194
|
+
/** New name (filename only, not full path) */
|
|
1195
|
+
newName: string;
|
|
1196
|
+
/** Original file/directory path */
|
|
1197
|
+
oldPath: string;
|
|
1198
|
+
}
|
|
1199
|
+
/**
|
|
1200
|
+
* Map of tool names to their parameter types
|
|
1201
|
+
*/
|
|
1202
|
+
interface CodeInterpreterToolParams {
|
|
1203
|
+
editLocalFile: EditLocalFileParams;
|
|
1204
|
+
getCommandOutput: GetCommandOutputParams;
|
|
1205
|
+
globLocalFiles: GlobLocalFilesParams;
|
|
1206
|
+
grepContent: GrepContentParams;
|
|
1207
|
+
killCommand: KillCommandParams;
|
|
1208
|
+
listLocalFiles: ListLocalFilesParams;
|
|
1209
|
+
moveLocalFiles: MoveLocalFilesParams;
|
|
1210
|
+
readLocalFile: ReadLocalFileParams;
|
|
1211
|
+
renameLocalFile: RenameLocalFileParams;
|
|
1212
|
+
runCommand: RunCommandParams;
|
|
1213
|
+
searchLocalFiles: SearchLocalFilesParams;
|
|
1214
|
+
writeLocalFile: WriteLocalFileParams;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1043
1217
|
/**
|
|
1044
1218
|
* User-related type definitions for LobeHub Market SDK
|
|
1045
1219
|
*
|
|
@@ -2569,6 +2743,124 @@ declare class PluginsService extends BaseSDK {
|
|
|
2569
2743
|
* ```
|
|
2570
2744
|
*/
|
|
2571
2745
|
callCloudGateway(request: CloudGatewayRequest, options?: globalThis.RequestInit): Promise<CloudGatewayResponse>;
|
|
2746
|
+
/**
|
|
2747
|
+
* Execute a built-in tool via AWS Bedrock AgentCore Code Interpreter
|
|
2748
|
+
*
|
|
2749
|
+
* This method provides access to file operations, command execution, and session management
|
|
2750
|
+
* tools running in an isolated sandbox environment. Sessions are automatically managed
|
|
2751
|
+
* per user/topic combination.
|
|
2752
|
+
*
|
|
2753
|
+
* @param toolName - Name of the tool to execute
|
|
2754
|
+
* @param params - Tool-specific parameters
|
|
2755
|
+
* @param context - User and topic context for session isolation
|
|
2756
|
+
* @param options - Optional request options
|
|
2757
|
+
* @returns Promise resolving to the tool execution result
|
|
2758
|
+
*
|
|
2759
|
+
* @example
|
|
2760
|
+
* ```typescript
|
|
2761
|
+
* // Run a shell command
|
|
2762
|
+
* const result = await sdk.plugins.runBuildInTool(
|
|
2763
|
+
* 'runCommand',
|
|
2764
|
+
* { command: 'ls -la' },
|
|
2765
|
+
* { userId: 'user-123', topicId: 'topic-456' }
|
|
2766
|
+
* );
|
|
2767
|
+
*
|
|
2768
|
+
* // Read a file
|
|
2769
|
+
* const fileResult = await sdk.plugins.runBuildInTool(
|
|
2770
|
+
* 'readLocalFile',
|
|
2771
|
+
* { path: '/tmp/example.txt' },
|
|
2772
|
+
* { userId: 'user-123', topicId: 'topic-456' }
|
|
2773
|
+
* );
|
|
2774
|
+
* ```
|
|
2775
|
+
*/
|
|
2776
|
+
runBuildInTool<T extends CodeInterpreterToolName>(toolName: T, params: CodeInterpreterToolParams[T], context: {
|
|
2777
|
+
topicId: string;
|
|
2778
|
+
userId: string;
|
|
2779
|
+
}, options?: globalThis.RequestInit): Promise<RunBuildInToolsResponse>;
|
|
2780
|
+
/**
|
|
2781
|
+
* Execute a shell command in the Code Interpreter sandbox
|
|
2782
|
+
*
|
|
2783
|
+
* @param command - Shell command to execute
|
|
2784
|
+
* @param context - User and topic context
|
|
2785
|
+
* @param options - Additional options (background, timeout)
|
|
2786
|
+
* @returns Promise resolving to command execution result
|
|
2787
|
+
*/
|
|
2788
|
+
runCommand(command: string, context: {
|
|
2789
|
+
topicId: string;
|
|
2790
|
+
userId: string;
|
|
2791
|
+
}, options?: {
|
|
2792
|
+
background?: boolean;
|
|
2793
|
+
timeout?: number;
|
|
2794
|
+
}): Promise<RunBuildInToolsResponse>;
|
|
2795
|
+
/**
|
|
2796
|
+
* Read a file from the Code Interpreter sandbox
|
|
2797
|
+
*
|
|
2798
|
+
* @param path - File path to read
|
|
2799
|
+
* @param context - User and topic context
|
|
2800
|
+
* @param options - Line range options (startLine, endLine)
|
|
2801
|
+
* @returns Promise resolving to file content
|
|
2802
|
+
*/
|
|
2803
|
+
readFile(path: string, context: {
|
|
2804
|
+
topicId: string;
|
|
2805
|
+
userId: string;
|
|
2806
|
+
}, options?: {
|
|
2807
|
+
endLine?: number;
|
|
2808
|
+
startLine?: number;
|
|
2809
|
+
}): Promise<RunBuildInToolsResponse>;
|
|
2810
|
+
/**
|
|
2811
|
+
* Write content to a file in the Code Interpreter sandbox
|
|
2812
|
+
*
|
|
2813
|
+
* @param path - File path to write
|
|
2814
|
+
* @param content - Content to write
|
|
2815
|
+
* @param context - User and topic context
|
|
2816
|
+
* @param options - Additional options (createDirectories)
|
|
2817
|
+
* @returns Promise resolving to write result
|
|
2818
|
+
*/
|
|
2819
|
+
writeFile(path: string, content: string, context: {
|
|
2820
|
+
topicId: string;
|
|
2821
|
+
userId: string;
|
|
2822
|
+
}, options?: {
|
|
2823
|
+
createDirectories?: boolean;
|
|
2824
|
+
}): Promise<RunBuildInToolsResponse>;
|
|
2825
|
+
/**
|
|
2826
|
+
* List files in a directory in the Code Interpreter sandbox
|
|
2827
|
+
*
|
|
2828
|
+
* @param directoryPath - Directory path to list
|
|
2829
|
+
* @param context - User and topic context
|
|
2830
|
+
* @returns Promise resolving to directory listing
|
|
2831
|
+
*/
|
|
2832
|
+
listFiles(directoryPath: string, context: {
|
|
2833
|
+
topicId: string;
|
|
2834
|
+
userId: string;
|
|
2835
|
+
}): Promise<RunBuildInToolsResponse>;
|
|
2836
|
+
/**
|
|
2837
|
+
* Search for files matching a glob pattern
|
|
2838
|
+
*
|
|
2839
|
+
* @param pattern - Glob pattern (e.g., "**\/*.ts")
|
|
2840
|
+
* @param context - User and topic context
|
|
2841
|
+
* @param directory - Base directory (optional)
|
|
2842
|
+
* @returns Promise resolving to matching files
|
|
2843
|
+
*/
|
|
2844
|
+
globFiles(pattern: string, context: {
|
|
2845
|
+
topicId: string;
|
|
2846
|
+
userId: string;
|
|
2847
|
+
}, directory?: string): Promise<RunBuildInToolsResponse>;
|
|
2848
|
+
/**
|
|
2849
|
+
* Search file contents using regex pattern
|
|
2850
|
+
*
|
|
2851
|
+
* @param pattern - Regex pattern to search
|
|
2852
|
+
* @param directory - Directory to search
|
|
2853
|
+
* @param context - User and topic context
|
|
2854
|
+
* @param options - Additional options (filePattern, recursive)
|
|
2855
|
+
* @returns Promise resolving to grep results
|
|
2856
|
+
*/
|
|
2857
|
+
grepContent(pattern: string, directory: string, context: {
|
|
2858
|
+
topicId: string;
|
|
2859
|
+
userId: string;
|
|
2860
|
+
}, options?: {
|
|
2861
|
+
filePattern?: string;
|
|
2862
|
+
recursive?: boolean;
|
|
2863
|
+
}): Promise<RunBuildInToolsResponse>;
|
|
2572
2864
|
}
|
|
2573
2865
|
|
|
2574
2866
|
/**
|
|
@@ -2579,17 +2871,17 @@ declare class PluginsService extends BaseSDK {
|
|
|
2579
2871
|
*/
|
|
2580
2872
|
declare class UserService extends BaseSDK {
|
|
2581
2873
|
/**
|
|
2582
|
-
* Retrieves user information by account ID
|
|
2874
|
+
* Retrieves user information by account ID or userName
|
|
2583
2875
|
*
|
|
2584
2876
|
* Returns user profile along with their published public agents.
|
|
2585
2877
|
* This is a public endpoint that doesn't require authentication.
|
|
2586
2878
|
*
|
|
2587
|
-
* @param
|
|
2879
|
+
* @param idOrUserName - The account ID (number) or userName (string)
|
|
2588
2880
|
* @param params - Query parameters for locale
|
|
2589
2881
|
* @param options - Optional request options
|
|
2590
2882
|
* @returns Promise resolving to the user info response
|
|
2591
2883
|
*/
|
|
2592
|
-
getUserInfo(
|
|
2884
|
+
getUserInfo(idOrUserName: number | string, params?: UserInfoQuery, options?: globalThis.RequestInit): Promise<UserInfoResponse>;
|
|
2593
2885
|
/**
|
|
2594
2886
|
* Updates the authenticated user's profile information
|
|
2595
2887
|
*
|
|
@@ -2668,4 +2960,4 @@ declare class MarketSDK extends BaseSDK {
|
|
|
2668
2960
|
registerClient(request: ClientRegistrationRequest): Promise<ClientRegistrationResponse>;
|
|
2669
2961
|
}
|
|
2670
2962
|
|
|
2671
|
-
export { type AccountMeta, type AdminListQueryParams, type AdminListResponse, type AdminPluginParams, type AgentCreateRequest, type AgentCreateResponse, type AgentDetailQuery, type AgentExtension, type AgentInstallCountRequest, type AgentInstallCountResponse, type AgentInterface, type AgentItemDetail, type AgentListQuery, type AgentListResponse, type AgentModifyRequest, type AgentModifyResponse, type AgentSecurityRequirement, type AgentSecurityScheme, type AgentSkill, type AgentStatus, type AgentStatusChangeResponse, type AgentUploadRequest, type AgentUploadResponse, type AgentUploadVersion, type AgentVersionCreateRequest, type AgentVersionCreateResponse, type AgentVersionLocalization, type AgentVersionModifyRequest, type AgentVersionModifyResponse, type AuthorizationCodeTokenRequest, type ClientRegistrationError, type ClientRegistrationRequest, type ClientRegistrationResponse, type DiscoveryDocument, MarketAdmin, MarketSDK, type MarketSDKOptions, type OAuthTokenResponse, type OwnAgentListQuery, type PluginI18nImportParams, type PluginI18nImportResponse, type PluginItem, type PluginListResponse, type PluginLocalization, type PluginQueryParams, type PluginUpdateParams, type PluginVersionCreateParams, type PluginVersionUpdateParams, type RefreshTokenRequest, type ReviewStatus, ReviewStatusEnumSchema, type SharedTokenState, StatusEnumSchema, type UnclaimedPluginItem, type UpdateUserInfoRequest, type UpdateUserInfoResponse, type UserAgentItem, type UserInfoQuery, type UserInfoResponse, type UserProfile, VisibilityEnumSchema };
|
|
2963
|
+
export { type AccountMeta, type AdminListQueryParams, type AdminListResponse, type AdminPluginParams, type AgentCreateRequest, type AgentCreateResponse, type AgentDetailQuery, type AgentExtension, type AgentInstallCountRequest, type AgentInstallCountResponse, type AgentInterface, type AgentItemDetail, type AgentListQuery, type AgentListResponse, type AgentModifyRequest, type AgentModifyResponse, type AgentSecurityRequirement, type AgentSecurityScheme, type AgentSkill, type AgentStatus, type AgentStatusChangeResponse, type AgentUploadRequest, type AgentUploadResponse, type AgentUploadVersion, type AgentVersionCreateRequest, type AgentVersionCreateResponse, type AgentVersionLocalization, type AgentVersionModifyRequest, type AgentVersionModifyResponse, type AuthorizationCodeTokenRequest, type ClientRegistrationError, type ClientRegistrationRequest, type ClientRegistrationResponse, type CodeInterpreterToolName, type CodeInterpreterToolParams, type DiscoveryDocument, type EditLocalFileParams, type GetCommandOutputParams, type GlobLocalFilesParams, type GrepContentParams, type KillCommandParams, type ListLocalFilesParams, MarketAdmin, MarketSDK, type MarketSDKOptions, type MoveLocalFilesParams, type MoveOperation, type OAuthTokenResponse, type OwnAgentListQuery, type PluginI18nImportParams, type PluginI18nImportResponse, type PluginItem, type PluginListResponse, type PluginLocalization, type PluginQueryParams, type PluginUpdateParams, type PluginVersionCreateParams, type PluginVersionUpdateParams, type ReadLocalFileParams, type RefreshTokenRequest, type RenameLocalFileParams, type ReviewStatus, ReviewStatusEnumSchema, type RunBuildInToolsError, type RunBuildInToolsRequest, type RunBuildInToolsResponse, type RunBuildInToolsSuccessData, type RunCommandParams, type SearchLocalFilesParams, type SharedTokenState, StatusEnumSchema, type UnclaimedPluginItem, type UpdateUserInfoRequest, type UpdateUserInfoResponse, type UserAgentItem, type UserInfoQuery, type UserInfoResponse, type UserProfile, VisibilityEnumSchema, type WriteLocalFileParams };
|
package/dist/index.mjs
CHANGED
|
@@ -2221,6 +2221,127 @@ var PluginsService = class extends BaseSDK {
|
|
|
2221
2221
|
});
|
|
2222
2222
|
return result;
|
|
2223
2223
|
}
|
|
2224
|
+
// ============================================================================
|
|
2225
|
+
// Code Interpreter / RunBuildInTools Methods
|
|
2226
|
+
// ============================================================================
|
|
2227
|
+
/**
|
|
2228
|
+
* Execute a built-in tool via AWS Bedrock AgentCore Code Interpreter
|
|
2229
|
+
*
|
|
2230
|
+
* This method provides access to file operations, command execution, and session management
|
|
2231
|
+
* tools running in an isolated sandbox environment. Sessions are automatically managed
|
|
2232
|
+
* per user/topic combination.
|
|
2233
|
+
*
|
|
2234
|
+
* @param toolName - Name of the tool to execute
|
|
2235
|
+
* @param params - Tool-specific parameters
|
|
2236
|
+
* @param context - User and topic context for session isolation
|
|
2237
|
+
* @param options - Optional request options
|
|
2238
|
+
* @returns Promise resolving to the tool execution result
|
|
2239
|
+
*
|
|
2240
|
+
* @example
|
|
2241
|
+
* ```typescript
|
|
2242
|
+
* // Run a shell command
|
|
2243
|
+
* const result = await sdk.plugins.runBuildInTool(
|
|
2244
|
+
* 'runCommand',
|
|
2245
|
+
* { command: 'ls -la' },
|
|
2246
|
+
* { userId: 'user-123', topicId: 'topic-456' }
|
|
2247
|
+
* );
|
|
2248
|
+
*
|
|
2249
|
+
* // Read a file
|
|
2250
|
+
* const fileResult = await sdk.plugins.runBuildInTool(
|
|
2251
|
+
* 'readLocalFile',
|
|
2252
|
+
* { path: '/tmp/example.txt' },
|
|
2253
|
+
* { userId: 'user-123', topicId: 'topic-456' }
|
|
2254
|
+
* );
|
|
2255
|
+
* ```
|
|
2256
|
+
*/
|
|
2257
|
+
async runBuildInTool(toolName, params, context, options) {
|
|
2258
|
+
log12("Running built-in tool: %s for user %s, topic %s", toolName, context.userId, context.topicId);
|
|
2259
|
+
const result = await this.request("/v1/plugins/run-buildin-tools", {
|
|
2260
|
+
body: JSON.stringify({
|
|
2261
|
+
params,
|
|
2262
|
+
toolName,
|
|
2263
|
+
topicId: context.topicId,
|
|
2264
|
+
userId: context.userId
|
|
2265
|
+
}),
|
|
2266
|
+
headers: {
|
|
2267
|
+
"Content-Type": "application/json"
|
|
2268
|
+
},
|
|
2269
|
+
method: "POST",
|
|
2270
|
+
...options
|
|
2271
|
+
});
|
|
2272
|
+
log12("Built-in tool execution completed: %O", {
|
|
2273
|
+
success: result.success,
|
|
2274
|
+
toolName
|
|
2275
|
+
});
|
|
2276
|
+
return result;
|
|
2277
|
+
}
|
|
2278
|
+
/**
|
|
2279
|
+
* Execute a shell command in the Code Interpreter sandbox
|
|
2280
|
+
*
|
|
2281
|
+
* @param command - Shell command to execute
|
|
2282
|
+
* @param context - User and topic context
|
|
2283
|
+
* @param options - Additional options (background, timeout)
|
|
2284
|
+
* @returns Promise resolving to command execution result
|
|
2285
|
+
*/
|
|
2286
|
+
async runCommand(command, context, options) {
|
|
2287
|
+
return this.runBuildInTool("runCommand", { command, ...options }, context);
|
|
2288
|
+
}
|
|
2289
|
+
/**
|
|
2290
|
+
* Read a file from the Code Interpreter sandbox
|
|
2291
|
+
*
|
|
2292
|
+
* @param path - File path to read
|
|
2293
|
+
* @param context - User and topic context
|
|
2294
|
+
* @param options - Line range options (startLine, endLine)
|
|
2295
|
+
* @returns Promise resolving to file content
|
|
2296
|
+
*/
|
|
2297
|
+
async readFile(path, context, options) {
|
|
2298
|
+
return this.runBuildInTool("readLocalFile", { path, ...options }, context);
|
|
2299
|
+
}
|
|
2300
|
+
/**
|
|
2301
|
+
* Write content to a file in the Code Interpreter sandbox
|
|
2302
|
+
*
|
|
2303
|
+
* @param path - File path to write
|
|
2304
|
+
* @param content - Content to write
|
|
2305
|
+
* @param context - User and topic context
|
|
2306
|
+
* @param options - Additional options (createDirectories)
|
|
2307
|
+
* @returns Promise resolving to write result
|
|
2308
|
+
*/
|
|
2309
|
+
async writeFile(path, content, context, options) {
|
|
2310
|
+
return this.runBuildInTool("writeLocalFile", { content, path, ...options }, context);
|
|
2311
|
+
}
|
|
2312
|
+
/**
|
|
2313
|
+
* List files in a directory in the Code Interpreter sandbox
|
|
2314
|
+
*
|
|
2315
|
+
* @param directoryPath - Directory path to list
|
|
2316
|
+
* @param context - User and topic context
|
|
2317
|
+
* @returns Promise resolving to directory listing
|
|
2318
|
+
*/
|
|
2319
|
+
async listFiles(directoryPath, context) {
|
|
2320
|
+
return this.runBuildInTool("listLocalFiles", { directoryPath }, context);
|
|
2321
|
+
}
|
|
2322
|
+
/**
|
|
2323
|
+
* Search for files matching a glob pattern
|
|
2324
|
+
*
|
|
2325
|
+
* @param pattern - Glob pattern (e.g., "**\/*.ts")
|
|
2326
|
+
* @param context - User and topic context
|
|
2327
|
+
* @param directory - Base directory (optional)
|
|
2328
|
+
* @returns Promise resolving to matching files
|
|
2329
|
+
*/
|
|
2330
|
+
async globFiles(pattern, context, directory) {
|
|
2331
|
+
return this.runBuildInTool("globLocalFiles", { directory, pattern }, context);
|
|
2332
|
+
}
|
|
2333
|
+
/**
|
|
2334
|
+
* Search file contents using regex pattern
|
|
2335
|
+
*
|
|
2336
|
+
* @param pattern - Regex pattern to search
|
|
2337
|
+
* @param directory - Directory to search
|
|
2338
|
+
* @param context - User and topic context
|
|
2339
|
+
* @param options - Additional options (filePattern, recursive)
|
|
2340
|
+
* @returns Promise resolving to grep results
|
|
2341
|
+
*/
|
|
2342
|
+
async grepContent(pattern, directory, context, options) {
|
|
2343
|
+
return this.runBuildInTool("grepContent", { directory, pattern, ...options }, context);
|
|
2344
|
+
}
|
|
2224
2345
|
};
|
|
2225
2346
|
|
|
2226
2347
|
// src/market/services/UserService.ts
|
|
@@ -2228,26 +2349,26 @@ import debug13 from "debug";
|
|
|
2228
2349
|
var log13 = debug13("lobe-market-sdk:user");
|
|
2229
2350
|
var UserService = class extends BaseSDK {
|
|
2230
2351
|
/**
|
|
2231
|
-
* Retrieves user information by account ID
|
|
2352
|
+
* Retrieves user information by account ID or userName
|
|
2232
2353
|
*
|
|
2233
2354
|
* Returns user profile along with their published public agents.
|
|
2234
2355
|
* This is a public endpoint that doesn't require authentication.
|
|
2235
2356
|
*
|
|
2236
|
-
* @param
|
|
2357
|
+
* @param idOrUserName - The account ID (number) or userName (string)
|
|
2237
2358
|
* @param params - Query parameters for locale
|
|
2238
2359
|
* @param options - Optional request options
|
|
2239
2360
|
* @returns Promise resolving to the user info response
|
|
2240
2361
|
*/
|
|
2241
|
-
async getUserInfo(
|
|
2362
|
+
async getUserInfo(idOrUserName, params = {}, options) {
|
|
2242
2363
|
const locale = params.locale || this.defaultLocale;
|
|
2243
2364
|
const queryParams = { locale };
|
|
2244
2365
|
const queryString = this.buildQueryString(queryParams);
|
|
2245
|
-
log13("Getting user info: %O", {
|
|
2366
|
+
log13("Getting user info: %O", { idOrUserName, ...params });
|
|
2246
2367
|
const result = await this.request(
|
|
2247
|
-
`/v1/user/info/${
|
|
2368
|
+
`/v1/user/info/${idOrUserName}${queryString}`,
|
|
2248
2369
|
options
|
|
2249
2370
|
);
|
|
2250
|
-
log13("User info successfully retrieved for
|
|
2371
|
+
log13("User info successfully retrieved for: %s", idOrUserName);
|
|
2251
2372
|
return result;
|
|
2252
2373
|
}
|
|
2253
2374
|
/**
|