@lobehub/market-sdk 0.23.6 → 0.23.8
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 +345 -4
- package/dist/index.mjs +155 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1040,6 +1040,200 @@ 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' | 'executeCode' | 'exportFile' | '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
|
+
/**
|
|
1097
|
+
* Supported programming languages for code execution
|
|
1098
|
+
*/
|
|
1099
|
+
type ProgrammingLanguage = 'javascript' | 'python' | 'typescript';
|
|
1100
|
+
/** Parameters for executeCode tool */
|
|
1101
|
+
interface ExecuteCodeParams {
|
|
1102
|
+
/** Code to execute */
|
|
1103
|
+
code: string;
|
|
1104
|
+
/** Programming language (default: python) */
|
|
1105
|
+
language?: ProgrammingLanguage;
|
|
1106
|
+
}
|
|
1107
|
+
/** Parameters for runCommand tool */
|
|
1108
|
+
interface RunCommandParams {
|
|
1109
|
+
/** Whether to run in background */
|
|
1110
|
+
background?: boolean;
|
|
1111
|
+
/** Command to execute */
|
|
1112
|
+
command: string;
|
|
1113
|
+
/** Timeout in milliseconds */
|
|
1114
|
+
timeout?: number;
|
|
1115
|
+
}
|
|
1116
|
+
/** Parameters for getCommandOutput tool */
|
|
1117
|
+
interface GetCommandOutputParams {
|
|
1118
|
+
/** Background command ID */
|
|
1119
|
+
commandId: string;
|
|
1120
|
+
}
|
|
1121
|
+
/** Parameters for killCommand tool */
|
|
1122
|
+
interface KillCommandParams {
|
|
1123
|
+
/** Command ID to terminate */
|
|
1124
|
+
commandId: string;
|
|
1125
|
+
}
|
|
1126
|
+
/** Parameters for readLocalFile tool */
|
|
1127
|
+
interface ReadLocalFileParams {
|
|
1128
|
+
/** End line number (1-based, inclusive) */
|
|
1129
|
+
endLine?: number;
|
|
1130
|
+
/** File path to read */
|
|
1131
|
+
path: string;
|
|
1132
|
+
/** Start line number (1-based) */
|
|
1133
|
+
startLine?: number;
|
|
1134
|
+
}
|
|
1135
|
+
/** Parameters for writeLocalFile tool */
|
|
1136
|
+
interface WriteLocalFileParams {
|
|
1137
|
+
/** Content to write */
|
|
1138
|
+
content: string;
|
|
1139
|
+
/** Whether to create parent directories */
|
|
1140
|
+
createDirectories?: boolean;
|
|
1141
|
+
/** File path to write */
|
|
1142
|
+
path: string;
|
|
1143
|
+
}
|
|
1144
|
+
/** Parameters for editLocalFile tool */
|
|
1145
|
+
interface EditLocalFileParams {
|
|
1146
|
+
/** Replace all occurrences (default: false) */
|
|
1147
|
+
all?: boolean;
|
|
1148
|
+
/** File path to edit */
|
|
1149
|
+
path: string;
|
|
1150
|
+
/** String to replace with */
|
|
1151
|
+
replace: string;
|
|
1152
|
+
/** String to search for */
|
|
1153
|
+
search: string;
|
|
1154
|
+
}
|
|
1155
|
+
/** Parameters for listLocalFiles tool */
|
|
1156
|
+
interface ListLocalFilesParams {
|
|
1157
|
+
/** Directory path to list */
|
|
1158
|
+
directoryPath: string;
|
|
1159
|
+
}
|
|
1160
|
+
/** Parameters for globLocalFiles tool */
|
|
1161
|
+
interface GlobLocalFilesParams {
|
|
1162
|
+
/** Base directory (default: current directory) */
|
|
1163
|
+
directory?: string;
|
|
1164
|
+
/** Glob pattern (e.g., "**\/*.ts") */
|
|
1165
|
+
pattern: string;
|
|
1166
|
+
}
|
|
1167
|
+
/** Parameters for searchLocalFiles tool */
|
|
1168
|
+
interface SearchLocalFilesParams {
|
|
1169
|
+
/** Directory to search */
|
|
1170
|
+
directory: string;
|
|
1171
|
+
/** File type/extension filter */
|
|
1172
|
+
fileType?: string;
|
|
1173
|
+
/** Filename keyword filter */
|
|
1174
|
+
keyword?: string;
|
|
1175
|
+
/** Modified time upper bound (ISO date string) */
|
|
1176
|
+
modifiedAfter?: string;
|
|
1177
|
+
/** Modified time lower bound (ISO date string) */
|
|
1178
|
+
modifiedBefore?: string;
|
|
1179
|
+
}
|
|
1180
|
+
/** Parameters for grepContent tool */
|
|
1181
|
+
interface GrepContentParams {
|
|
1182
|
+
/** Directory to search */
|
|
1183
|
+
directory: string;
|
|
1184
|
+
/** File name pattern filter (e.g., "*.ts") */
|
|
1185
|
+
filePattern?: string;
|
|
1186
|
+
/** Regex pattern to search */
|
|
1187
|
+
pattern: string;
|
|
1188
|
+
/** Whether to search recursively (default: true) */
|
|
1189
|
+
recursive?: boolean;
|
|
1190
|
+
}
|
|
1191
|
+
/** Move operation for moveLocalFiles tool */
|
|
1192
|
+
interface MoveOperation {
|
|
1193
|
+
/** Destination path */
|
|
1194
|
+
destination: string;
|
|
1195
|
+
/** Source path */
|
|
1196
|
+
source: string;
|
|
1197
|
+
}
|
|
1198
|
+
/** Parameters for moveLocalFiles tool */
|
|
1199
|
+
interface MoveLocalFilesParams {
|
|
1200
|
+
/** Move operations to perform */
|
|
1201
|
+
operations: MoveOperation[];
|
|
1202
|
+
}
|
|
1203
|
+
/** Parameters for renameLocalFile tool */
|
|
1204
|
+
interface RenameLocalFileParams {
|
|
1205
|
+
/** New name (filename only, not full path) */
|
|
1206
|
+
newName: string;
|
|
1207
|
+
/** Original file/directory path */
|
|
1208
|
+
oldPath: string;
|
|
1209
|
+
}
|
|
1210
|
+
/** Parameters for exportFile tool */
|
|
1211
|
+
interface ExportFileParams {
|
|
1212
|
+
/** File path in sandbox to export */
|
|
1213
|
+
path: string;
|
|
1214
|
+
/** Pre-signed upload URL to upload the file to */
|
|
1215
|
+
uploadUrl: string;
|
|
1216
|
+
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Map of tool names to their parameter types
|
|
1219
|
+
*/
|
|
1220
|
+
interface CodeInterpreterToolParams {
|
|
1221
|
+
editLocalFile: EditLocalFileParams;
|
|
1222
|
+
executeCode: ExecuteCodeParams;
|
|
1223
|
+
exportFile: ExportFileParams;
|
|
1224
|
+
getCommandOutput: GetCommandOutputParams;
|
|
1225
|
+
globLocalFiles: GlobLocalFilesParams;
|
|
1226
|
+
grepContent: GrepContentParams;
|
|
1227
|
+
killCommand: KillCommandParams;
|
|
1228
|
+
listLocalFiles: ListLocalFilesParams;
|
|
1229
|
+
moveLocalFiles: MoveLocalFilesParams;
|
|
1230
|
+
readLocalFile: ReadLocalFileParams;
|
|
1231
|
+
renameLocalFile: RenameLocalFileParams;
|
|
1232
|
+
runCommand: RunCommandParams;
|
|
1233
|
+
searchLocalFiles: SearchLocalFilesParams;
|
|
1234
|
+
writeLocalFile: WriteLocalFileParams;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1043
1237
|
/**
|
|
1044
1238
|
* User-related type definitions for LobeHub Market SDK
|
|
1045
1239
|
*
|
|
@@ -2569,6 +2763,153 @@ declare class PluginsService extends BaseSDK {
|
|
|
2569
2763
|
* ```
|
|
2570
2764
|
*/
|
|
2571
2765
|
callCloudGateway(request: CloudGatewayRequest, options?: globalThis.RequestInit): Promise<CloudGatewayResponse>;
|
|
2766
|
+
/**
|
|
2767
|
+
* Execute a built-in tool via AWS Bedrock AgentCore Code Interpreter
|
|
2768
|
+
*
|
|
2769
|
+
* This method provides access to file operations, command execution, and session management
|
|
2770
|
+
* tools running in an isolated sandbox environment. Sessions are automatically managed
|
|
2771
|
+
* per user/topic combination.
|
|
2772
|
+
*
|
|
2773
|
+
* @param toolName - Name of the tool to execute
|
|
2774
|
+
* @param params - Tool-specific parameters
|
|
2775
|
+
* @param context - User and topic context for session isolation
|
|
2776
|
+
* @param options - Optional request options
|
|
2777
|
+
* @returns Promise resolving to the tool execution result
|
|
2778
|
+
*
|
|
2779
|
+
* @example
|
|
2780
|
+
* ```typescript
|
|
2781
|
+
* // Run a shell command
|
|
2782
|
+
* const result = await sdk.plugins.runBuildInTool(
|
|
2783
|
+
* 'runCommand',
|
|
2784
|
+
* { command: 'ls -la' },
|
|
2785
|
+
* { userId: 'user-123', topicId: 'topic-456' }
|
|
2786
|
+
* );
|
|
2787
|
+
*
|
|
2788
|
+
* // Read a file
|
|
2789
|
+
* const fileResult = await sdk.plugins.runBuildInTool(
|
|
2790
|
+
* 'readLocalFile',
|
|
2791
|
+
* { path: '/tmp/example.txt' },
|
|
2792
|
+
* { userId: 'user-123', topicId: 'topic-456' }
|
|
2793
|
+
* );
|
|
2794
|
+
* ```
|
|
2795
|
+
*/
|
|
2796
|
+
runBuildInTool<T extends CodeInterpreterToolName>(toolName: T, params: CodeInterpreterToolParams[T], context: {
|
|
2797
|
+
topicId: string;
|
|
2798
|
+
userId: string;
|
|
2799
|
+
}, options?: globalThis.RequestInit): Promise<RunBuildInToolsResponse>;
|
|
2800
|
+
/**
|
|
2801
|
+
* Execute a shell command in the Code Interpreter sandbox
|
|
2802
|
+
*
|
|
2803
|
+
* @param command - Shell command to execute
|
|
2804
|
+
* @param context - User and topic context
|
|
2805
|
+
* @param options - Additional options (background, timeout)
|
|
2806
|
+
* @returns Promise resolving to command execution result
|
|
2807
|
+
*/
|
|
2808
|
+
runCommand(command: string, context: {
|
|
2809
|
+
topicId: string;
|
|
2810
|
+
userId: string;
|
|
2811
|
+
}, options?: {
|
|
2812
|
+
background?: boolean;
|
|
2813
|
+
timeout?: number;
|
|
2814
|
+
}): Promise<RunBuildInToolsResponse>;
|
|
2815
|
+
/**
|
|
2816
|
+
* Read a file from the Code Interpreter sandbox
|
|
2817
|
+
*
|
|
2818
|
+
* @param path - File path to read
|
|
2819
|
+
* @param context - User and topic context
|
|
2820
|
+
* @param options - Line range options (startLine, endLine)
|
|
2821
|
+
* @returns Promise resolving to file content
|
|
2822
|
+
*/
|
|
2823
|
+
readFile(path: string, context: {
|
|
2824
|
+
topicId: string;
|
|
2825
|
+
userId: string;
|
|
2826
|
+
}, options?: {
|
|
2827
|
+
endLine?: number;
|
|
2828
|
+
startLine?: number;
|
|
2829
|
+
}): Promise<RunBuildInToolsResponse>;
|
|
2830
|
+
/**
|
|
2831
|
+
* Write content to a file in the Code Interpreter sandbox
|
|
2832
|
+
*
|
|
2833
|
+
* @param path - File path to write
|
|
2834
|
+
* @param content - Content to write
|
|
2835
|
+
* @param context - User and topic context
|
|
2836
|
+
* @param options - Additional options (createDirectories)
|
|
2837
|
+
* @returns Promise resolving to write result
|
|
2838
|
+
*/
|
|
2839
|
+
writeFile(path: string, content: string, context: {
|
|
2840
|
+
topicId: string;
|
|
2841
|
+
userId: string;
|
|
2842
|
+
}, options?: {
|
|
2843
|
+
createDirectories?: boolean;
|
|
2844
|
+
}): Promise<RunBuildInToolsResponse>;
|
|
2845
|
+
/**
|
|
2846
|
+
* List files in a directory in the Code Interpreter sandbox
|
|
2847
|
+
*
|
|
2848
|
+
* @param directoryPath - Directory path to list
|
|
2849
|
+
* @param context - User and topic context
|
|
2850
|
+
* @returns Promise resolving to directory listing
|
|
2851
|
+
*/
|
|
2852
|
+
listFiles(directoryPath: string, context: {
|
|
2853
|
+
topicId: string;
|
|
2854
|
+
userId: string;
|
|
2855
|
+
}): Promise<RunBuildInToolsResponse>;
|
|
2856
|
+
/**
|
|
2857
|
+
* Search for files matching a glob pattern
|
|
2858
|
+
*
|
|
2859
|
+
* @param pattern - Glob pattern (e.g., "**\/*.ts")
|
|
2860
|
+
* @param context - User and topic context
|
|
2861
|
+
* @param directory - Base directory (optional)
|
|
2862
|
+
* @returns Promise resolving to matching files
|
|
2863
|
+
*/
|
|
2864
|
+
globFiles(pattern: string, context: {
|
|
2865
|
+
topicId: string;
|
|
2866
|
+
userId: string;
|
|
2867
|
+
}, directory?: string): Promise<RunBuildInToolsResponse>;
|
|
2868
|
+
/**
|
|
2869
|
+
* Search file contents using regex pattern
|
|
2870
|
+
*
|
|
2871
|
+
* @param pattern - Regex pattern to search
|
|
2872
|
+
* @param directory - Directory to search
|
|
2873
|
+
* @param context - User and topic context
|
|
2874
|
+
* @param options - Additional options (filePattern, recursive)
|
|
2875
|
+
* @returns Promise resolving to grep results
|
|
2876
|
+
*/
|
|
2877
|
+
grepContent(pattern: string, directory: string, context: {
|
|
2878
|
+
topicId: string;
|
|
2879
|
+
userId: string;
|
|
2880
|
+
}, options?: {
|
|
2881
|
+
filePattern?: string;
|
|
2882
|
+
recursive?: boolean;
|
|
2883
|
+
}): Promise<RunBuildInToolsResponse>;
|
|
2884
|
+
/**
|
|
2885
|
+
* Export a file from the Code Interpreter sandbox to a pre-signed URL
|
|
2886
|
+
*
|
|
2887
|
+
* This method uploads a file from the sandbox to an external storage location
|
|
2888
|
+
* via a pre-signed URL (e.g., S3 pre-signed URL). The upload is performed
|
|
2889
|
+
* using Python code execution within the sandbox.
|
|
2890
|
+
*
|
|
2891
|
+
* @param path - File path in sandbox to export
|
|
2892
|
+
* @param uploadUrl - Pre-signed URL to upload the file to
|
|
2893
|
+
* @param context - User and topic context
|
|
2894
|
+
* @returns Promise resolving to export result with success status and file info
|
|
2895
|
+
*
|
|
2896
|
+
* @example
|
|
2897
|
+
* ```typescript
|
|
2898
|
+
* const result = await sdk.plugins.exportFile(
|
|
2899
|
+
* './output/result.csv',
|
|
2900
|
+
* 'https://s3.amazonaws.com/bucket/key?X-Amz-Signature=...',
|
|
2901
|
+
* { userId: 'user-123', topicId: 'topic-456' }
|
|
2902
|
+
* );
|
|
2903
|
+
*
|
|
2904
|
+
* if (result.success && result.data?.result.success) {
|
|
2905
|
+
* console.log('File exported:', result.data.result.size, 'bytes');
|
|
2906
|
+
* }
|
|
2907
|
+
* ```
|
|
2908
|
+
*/
|
|
2909
|
+
exportFile(path: string, uploadUrl: string, context: {
|
|
2910
|
+
topicId: string;
|
|
2911
|
+
userId: string;
|
|
2912
|
+
}): Promise<RunBuildInToolsResponse>;
|
|
2572
2913
|
}
|
|
2573
2914
|
|
|
2574
2915
|
/**
|
|
@@ -2579,17 +2920,17 @@ declare class PluginsService extends BaseSDK {
|
|
|
2579
2920
|
*/
|
|
2580
2921
|
declare class UserService extends BaseSDK {
|
|
2581
2922
|
/**
|
|
2582
|
-
* Retrieves user information by account ID
|
|
2923
|
+
* Retrieves user information by account ID or userName
|
|
2583
2924
|
*
|
|
2584
2925
|
* Returns user profile along with their published public agents.
|
|
2585
2926
|
* This is a public endpoint that doesn't require authentication.
|
|
2586
2927
|
*
|
|
2587
|
-
* @param
|
|
2928
|
+
* @param idOrUserName - The account ID (number) or userName (string)
|
|
2588
2929
|
* @param params - Query parameters for locale
|
|
2589
2930
|
* @param options - Optional request options
|
|
2590
2931
|
* @returns Promise resolving to the user info response
|
|
2591
2932
|
*/
|
|
2592
|
-
getUserInfo(
|
|
2933
|
+
getUserInfo(idOrUserName: number | string, params?: UserInfoQuery, options?: globalThis.RequestInit): Promise<UserInfoResponse>;
|
|
2593
2934
|
/**
|
|
2594
2935
|
* Updates the authenticated user's profile information
|
|
2595
2936
|
*
|
|
@@ -2668,4 +3009,4 @@ declare class MarketSDK extends BaseSDK {
|
|
|
2668
3009
|
registerClient(request: ClientRegistrationRequest): Promise<ClientRegistrationResponse>;
|
|
2669
3010
|
}
|
|
2670
3011
|
|
|
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 };
|
|
3012
|
+
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 ExecuteCodeParams, type ExportFileParams, 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 ProgrammingLanguage, 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,155 @@ 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
|
+
}
|
|
2345
|
+
/**
|
|
2346
|
+
* Export a file from the Code Interpreter sandbox to a pre-signed URL
|
|
2347
|
+
*
|
|
2348
|
+
* This method uploads a file from the sandbox to an external storage location
|
|
2349
|
+
* via a pre-signed URL (e.g., S3 pre-signed URL). The upload is performed
|
|
2350
|
+
* using Python code execution within the sandbox.
|
|
2351
|
+
*
|
|
2352
|
+
* @param path - File path in sandbox to export
|
|
2353
|
+
* @param uploadUrl - Pre-signed URL to upload the file to
|
|
2354
|
+
* @param context - User and topic context
|
|
2355
|
+
* @returns Promise resolving to export result with success status and file info
|
|
2356
|
+
*
|
|
2357
|
+
* @example
|
|
2358
|
+
* ```typescript
|
|
2359
|
+
* const result = await sdk.plugins.exportFile(
|
|
2360
|
+
* './output/result.csv',
|
|
2361
|
+
* 'https://s3.amazonaws.com/bucket/key?X-Amz-Signature=...',
|
|
2362
|
+
* { userId: 'user-123', topicId: 'topic-456' }
|
|
2363
|
+
* );
|
|
2364
|
+
*
|
|
2365
|
+
* if (result.success && result.data?.result.success) {
|
|
2366
|
+
* console.log('File exported:', result.data.result.size, 'bytes');
|
|
2367
|
+
* }
|
|
2368
|
+
* ```
|
|
2369
|
+
*/
|
|
2370
|
+
async exportFile(path, uploadUrl, context) {
|
|
2371
|
+
return this.runBuildInTool("exportFile", { path, uploadUrl }, context);
|
|
2372
|
+
}
|
|
2224
2373
|
};
|
|
2225
2374
|
|
|
2226
2375
|
// src/market/services/UserService.ts
|
|
@@ -2228,26 +2377,26 @@ import debug13 from "debug";
|
|
|
2228
2377
|
var log13 = debug13("lobe-market-sdk:user");
|
|
2229
2378
|
var UserService = class extends BaseSDK {
|
|
2230
2379
|
/**
|
|
2231
|
-
* Retrieves user information by account ID
|
|
2380
|
+
* Retrieves user information by account ID or userName
|
|
2232
2381
|
*
|
|
2233
2382
|
* Returns user profile along with their published public agents.
|
|
2234
2383
|
* This is a public endpoint that doesn't require authentication.
|
|
2235
2384
|
*
|
|
2236
|
-
* @param
|
|
2385
|
+
* @param idOrUserName - The account ID (number) or userName (string)
|
|
2237
2386
|
* @param params - Query parameters for locale
|
|
2238
2387
|
* @param options - Optional request options
|
|
2239
2388
|
* @returns Promise resolving to the user info response
|
|
2240
2389
|
*/
|
|
2241
|
-
async getUserInfo(
|
|
2390
|
+
async getUserInfo(idOrUserName, params = {}, options) {
|
|
2242
2391
|
const locale = params.locale || this.defaultLocale;
|
|
2243
2392
|
const queryParams = { locale };
|
|
2244
2393
|
const queryString = this.buildQueryString(queryParams);
|
|
2245
|
-
log13("Getting user info: %O", {
|
|
2394
|
+
log13("Getting user info: %O", { idOrUserName, ...params });
|
|
2246
2395
|
const result = await this.request(
|
|
2247
|
-
`/v1/user/info/${
|
|
2396
|
+
`/v1/user/info/${idOrUserName}${queryString}`,
|
|
2248
2397
|
options
|
|
2249
2398
|
);
|
|
2250
|
-
log13("User info successfully retrieved for
|
|
2399
|
+
log13("User info successfully retrieved for: %s", idOrUserName);
|
|
2251
2400
|
return result;
|
|
2252
2401
|
}
|
|
2253
2402
|
/**
|