oblien 1.0.7 → 1.1.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/README.md +387 -408
- package/agents.js +14 -0
- package/credits.js +11 -0
- package/icons.js +11 -0
- package/index.d.ts +261 -0
- package/index.js +23 -0
- package/namespaces.js +12 -0
- package/package.json +13 -2
- package/sandbox.js +12 -0
- package/search.js +11 -0
- package/src/agents/agent.js +229 -0
- package/src/agents/index.js +212 -0
- package/src/agents/settings.js +100 -0
- package/src/agents/tools.js +155 -0
- package/src/client.js +18 -0
- package/src/credits/index.js +299 -0
- package/src/icons/index.js +185 -0
- package/src/namespaces/index.js +225 -0
- package/src/namespaces/namespace.js +274 -0
- package/src/sandbox/index.js +185 -0
- package/src/sandbox/sandbox.js +124 -0
- package/src/search/index.js +191 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agents Module
|
|
3
|
+
* Manages AI agents, their settings, and operations
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { Agent } from './agent.js';
|
|
7
|
+
import { Tools } from './tools.js';
|
|
8
|
+
|
|
9
|
+
export class OblienAgents {
|
|
10
|
+
/**
|
|
11
|
+
* @param {import('../client.js').OblienClient} client - Oblien client instance
|
|
12
|
+
*/
|
|
13
|
+
constructor(client) {
|
|
14
|
+
if (!client) {
|
|
15
|
+
throw new Error('Oblien client is required');
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
this.client = client;
|
|
19
|
+
this._tools = null;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Get tools manager
|
|
24
|
+
* @returns {Tools} Tools manager instance
|
|
25
|
+
*/
|
|
26
|
+
get tools() {
|
|
27
|
+
if (!this._tools) {
|
|
28
|
+
this._tools = new Tools(this.client);
|
|
29
|
+
}
|
|
30
|
+
return this._tools;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Create a new agent
|
|
35
|
+
* @param {Object} options - Agent options
|
|
36
|
+
* @param {string} options.name - Agent name (required)
|
|
37
|
+
* @param {Object} options.prompts - Agent prompts/configuration (required)
|
|
38
|
+
* @param {string} [options.description] - Agent description
|
|
39
|
+
* @param {string} [options.namespace] - Namespace for organization
|
|
40
|
+
* @param {Array<string>} [options.collectionIds] - Collection IDs
|
|
41
|
+
* @param {Object} [options.settings] - Agent settings
|
|
42
|
+
* @returns {Promise<Object>} Created agent data
|
|
43
|
+
*/
|
|
44
|
+
async create(options) {
|
|
45
|
+
const agent = new Agent({ client: this.client });
|
|
46
|
+
return await agent.create(options);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Get agent by ID
|
|
51
|
+
* @param {string} agentId - Agent ID
|
|
52
|
+
* @param {string} [section] - Optional section to retrieve
|
|
53
|
+
* @returns {Promise<Object>} Agent data
|
|
54
|
+
*/
|
|
55
|
+
async get(agentId, section = null) {
|
|
56
|
+
const agent = new Agent({ client: this.client, agentId });
|
|
57
|
+
return await agent.get(section);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* List all agents with filtering and pagination
|
|
62
|
+
* @param {Object} [options] - Query options
|
|
63
|
+
* @param {number} [options.limit] - Max results (default: 50, max: 100)
|
|
64
|
+
* @param {number} [options.offset] - Offset for pagination
|
|
65
|
+
* @param {string} [options.namespace] - Filter by namespace
|
|
66
|
+
* @returns {Promise<Object>} Agents data with pagination info
|
|
67
|
+
*/
|
|
68
|
+
async list(options = {}) {
|
|
69
|
+
const response = await this.client.get('ai/agents/list', options);
|
|
70
|
+
return response;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Search agents
|
|
75
|
+
* @param {string} query - Search query
|
|
76
|
+
* @param {Object} [options] - Query options
|
|
77
|
+
* @param {number} [options.limit] - Max results (default: 20)
|
|
78
|
+
* @param {string} [options.namespace] - Filter by namespace
|
|
79
|
+
* @returns {Promise<Object>} Search results
|
|
80
|
+
*/
|
|
81
|
+
async search(query, options = {}) {
|
|
82
|
+
const response = await this.client.get('ai/agents/search', {
|
|
83
|
+
q: query,
|
|
84
|
+
...options
|
|
85
|
+
});
|
|
86
|
+
return response;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Update agent
|
|
91
|
+
* @param {string} agentId - Agent ID
|
|
92
|
+
* @param {Object} updates - Fields to update
|
|
93
|
+
* @param {string} [updates.name] - Agent name
|
|
94
|
+
* @param {string} [updates.description] - Description
|
|
95
|
+
* @param {Object} [updates.prompts] - Prompts
|
|
96
|
+
* @param {Object} [updates.settings] - Settings
|
|
97
|
+
* @param {string} [updates.namespace] - Namespace (for validation)
|
|
98
|
+
* @returns {Promise<Object>} Update result
|
|
99
|
+
*/
|
|
100
|
+
async update(agentId, updates) {
|
|
101
|
+
const agent = new Agent({ client: this.client, agentId });
|
|
102
|
+
return await agent.update(updates);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Delete agent
|
|
107
|
+
* @param {string} agentId - Agent ID
|
|
108
|
+
* @param {Object} [options] - Delete options
|
|
109
|
+
* @param {string} [options.namespace] - Namespace for validation
|
|
110
|
+
* @returns {Promise<Object>} Delete result
|
|
111
|
+
*/
|
|
112
|
+
async delete(agentId, options = {}) {
|
|
113
|
+
const agent = new Agent({ client: this.client, agentId });
|
|
114
|
+
return await agent.delete(options);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Get agent overview/analytics
|
|
119
|
+
* @param {string} agentId - Agent ID
|
|
120
|
+
* @param {Object} [options] - Query options
|
|
121
|
+
* @param {number} [options.days=7] - Number of days for activity data
|
|
122
|
+
* @returns {Promise<Object>} Analytics data
|
|
123
|
+
*/
|
|
124
|
+
async getOverview(agentId, options = {}) {
|
|
125
|
+
const agent = new Agent({ client: this.client, agentId });
|
|
126
|
+
return await agent.getOverview(options);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Get agent sessions
|
|
131
|
+
* @param {string} agentId - Agent ID
|
|
132
|
+
* @param {Object} [options] - Query options
|
|
133
|
+
* @param {number} [options.limit] - Max results
|
|
134
|
+
* @param {number} [options.offset] - Offset for pagination
|
|
135
|
+
* @param {string} [options.search] - Search term
|
|
136
|
+
* @param {string} [options.sortBy] - Sort by field
|
|
137
|
+
* @param {string} [options.sortOrder] - Sort order (asc/desc)
|
|
138
|
+
* @returns {Promise<Object>} Sessions data
|
|
139
|
+
*/
|
|
140
|
+
async getSessions(agentId, options = {}) {
|
|
141
|
+
const agent = new Agent({ client: this.client, agentId });
|
|
142
|
+
return await agent.getSessions(options);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Get agent bans
|
|
147
|
+
* @param {string} agentId - Agent ID
|
|
148
|
+
* @param {Object} [options] - Query options
|
|
149
|
+
* @returns {Promise<Array>} Bans data
|
|
150
|
+
*/
|
|
151
|
+
async getBans(agentId, options = {}) {
|
|
152
|
+
const agent = new Agent({ client: this.client, agentId });
|
|
153
|
+
return await agent.getBans(options);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Get platform stats
|
|
158
|
+
* @returns {Promise<Object>} Platform statistics
|
|
159
|
+
*/
|
|
160
|
+
async getStats() {
|
|
161
|
+
return await this.client.get('ai/agents/stats');
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Get agent users
|
|
167
|
+
* @param {string} agentId - Agent ID
|
|
168
|
+
* @param {Object} [options] - Query options
|
|
169
|
+
* @returns {Promise<Array>} Agent users data
|
|
170
|
+
*/
|
|
171
|
+
async getUsers(agentId, options = {}) {
|
|
172
|
+
const agent = new Agent({ client: this.client, agentId });
|
|
173
|
+
return await agent.getUsers(options);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Get specific agent user
|
|
178
|
+
* @param {string} agentId - Agent ID
|
|
179
|
+
* @param {string} userId - User ID
|
|
180
|
+
* @returns {Promise<Object>} User data
|
|
181
|
+
*/
|
|
182
|
+
async getUser(agentId, userId) {
|
|
183
|
+
const agent = new Agent({ client: this.client, agentId });
|
|
184
|
+
return await agent.getUser(userId);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Reset user limits
|
|
189
|
+
* @param {string} agentId - Agent ID
|
|
190
|
+
* @param {string} userId - User ID
|
|
191
|
+
* @returns {Promise<Object>} Reset result
|
|
192
|
+
*/
|
|
193
|
+
async resetUserLimits(agentId, userId) {
|
|
194
|
+
const agent = new Agent({ client: this.client, agentId });
|
|
195
|
+
return await agent.resetUserLimits(userId);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Create an Agent instance for chaining operations
|
|
200
|
+
* @param {string} [agentId] - Agent ID
|
|
201
|
+
* @returns {Agent} Agent instance
|
|
202
|
+
*/
|
|
203
|
+
agent(agentId) {
|
|
204
|
+
return new Agent({ client: this.client, agentId });
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export { Agent };
|
|
209
|
+
export { Tools } from './tools.js';
|
|
210
|
+
export { AgentSettings } from './settings.js';
|
|
211
|
+
export default OblienAgents;
|
|
212
|
+
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Settings Class
|
|
3
|
+
* Manages all agent settings with proper sections
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export class AgentSettings {
|
|
7
|
+
/**
|
|
8
|
+
* @param {Object} options
|
|
9
|
+
* @param {import('../client.js').OblienClient} options.client - Oblien client instance
|
|
10
|
+
* @param {string} options.agentId - Agent ID
|
|
11
|
+
*/
|
|
12
|
+
constructor({ client, agentId }) {
|
|
13
|
+
if (!client) {
|
|
14
|
+
throw new Error('Oblien client is required');
|
|
15
|
+
}
|
|
16
|
+
if (!agentId) {
|
|
17
|
+
throw new Error('Agent ID is required');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
this.client = client;
|
|
21
|
+
this.agentId = agentId;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Update boolean switches
|
|
26
|
+
* @param {Object} switches - Switch values
|
|
27
|
+
* @param {boolean} [switches.enable_memory] - Enable conversation memory
|
|
28
|
+
* @param {boolean} [switches.allow_thinking] - Allow thinking process
|
|
29
|
+
* @param {boolean} [switches.allow_images] - Allow image uploads
|
|
30
|
+
* @param {boolean} [switches.allow_videos] - Allow video uploads
|
|
31
|
+
* @param {boolean} [switches.allow_audio] - Allow audio uploads
|
|
32
|
+
* @param {boolean} [switches.allow_documents] - Allow document uploads
|
|
33
|
+
* @param {boolean} [switches.allow_built_in] - Allow built-in tools
|
|
34
|
+
* @returns {Promise<Object>} Update result
|
|
35
|
+
*/
|
|
36
|
+
async updateSwitches(switches) {
|
|
37
|
+
return await this.client.put(`ai/agents/${this.agentId}/switches`, switches);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Update model configuration
|
|
42
|
+
* @param {Object} config - Model configuration
|
|
43
|
+
* @param {string} [config.model] - Model name (e.g., 'oblien-master')
|
|
44
|
+
* @param {number} [config.temperature] - Temperature 0-2 (default: 1)
|
|
45
|
+
* @param {number} [config.max_tokens] - Max tokens 1-200000 (default: 2000)
|
|
46
|
+
* @param {number} [config.top_p] - Top P 0-1 (default: 1)
|
|
47
|
+
* @returns {Promise<Object>} Update result
|
|
48
|
+
*/
|
|
49
|
+
async updateModelConfig(config) {
|
|
50
|
+
return await this.client.put(`ai/agents/${this.agentId}/model-config`, config);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Update tools array
|
|
55
|
+
* @param {Array<string>} tools - Array of tool slugs
|
|
56
|
+
* @returns {Promise<Object>} Update result
|
|
57
|
+
*/
|
|
58
|
+
async updateTools(tools) {
|
|
59
|
+
return await this.client.put(`ai/agents/${this.agentId}/tools`, { tools });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Update guest limits
|
|
64
|
+
* @param {Object} limits - Guest limit configuration
|
|
65
|
+
* @param {boolean} [limits.enabled] - Enable guest limits
|
|
66
|
+
* @param {number} [limits.max_requests_per_minute] - Max requests per minute (1-1000)
|
|
67
|
+
* @param {number} [limits.max_messages_per_hour] - Max messages per hour (1-10000)
|
|
68
|
+
* @param {number} [limits.max_messages_per_day] - Max messages per day (1-50000)
|
|
69
|
+
* @param {number} [limits.max_total_tokens_per_day] - Max total tokens per day (1000-10000000)
|
|
70
|
+
* @param {number} [limits.max_input_tokens_per_day] - Max input tokens per day (1000-10000000)
|
|
71
|
+
* @param {number} [limits.max_output_tokens_per_day] - Max output tokens per day (1000-10000000)
|
|
72
|
+
* @returns {Promise<Object>} Update result
|
|
73
|
+
*/
|
|
74
|
+
async updateGuestLimits(limits) {
|
|
75
|
+
return await this.client.put(`ai/agents/${this.agentId}/guest-limits`, limits);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Update context settings
|
|
80
|
+
* @param {Object} context - Context configuration
|
|
81
|
+
* @param {number} [context.max_history_messages] - Max history messages
|
|
82
|
+
* @param {number} [context.history_token_limit] - History token limit
|
|
83
|
+
* @returns {Promise<Object>} Update result
|
|
84
|
+
*/
|
|
85
|
+
async updateContext(context) {
|
|
86
|
+
return await this.client.put(`ai/agents/${this.agentId}/context`, context);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Get all settings sections
|
|
91
|
+
* @returns {Promise<Object>} All settings
|
|
92
|
+
*/
|
|
93
|
+
async getAll() {
|
|
94
|
+
const agent = await this.client.get(`ai/agents/${this.agentId}`);
|
|
95
|
+
return agent.agent?.settings || agent.settings || {};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export default AgentSettings;
|
|
100
|
+
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tools Class
|
|
3
|
+
* Manages AI tools - listing, searching, creating, and getting tool details
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export class Tools {
|
|
7
|
+
/**
|
|
8
|
+
* @param {import('../client.js').OblienClient} client - Oblien client instance
|
|
9
|
+
*/
|
|
10
|
+
constructor(client) {
|
|
11
|
+
if (!client) {
|
|
12
|
+
throw new Error('Oblien client is required');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
this.client = client;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* List all available tools with optional filters
|
|
20
|
+
* @param {Object} [options] - Filter options
|
|
21
|
+
* @param {string} [options.type] - Filter by type: 'client' | 'server' | 'hybrid'
|
|
22
|
+
* @param {string} [options.category] - Filter by category: 'custom' | 'file' | 'search' | 'terminal' | 'browser' | 'project' | 'web'
|
|
23
|
+
* @param {boolean} [options.requireEnvironment] - Filter by environment requirement
|
|
24
|
+
* @param {boolean} [options.myCustomTools] - Show only user's custom tools
|
|
25
|
+
* @returns {Promise<Object>} List of tools
|
|
26
|
+
*/
|
|
27
|
+
async list(options = {}) {
|
|
28
|
+
const params = {};
|
|
29
|
+
|
|
30
|
+
if (options.type) params.type = options.type;
|
|
31
|
+
if (options.category) params.category = options.category;
|
|
32
|
+
if (options.requireEnvironment !== undefined) {
|
|
33
|
+
params.require_environment = String(options.requireEnvironment);
|
|
34
|
+
}
|
|
35
|
+
if (options.myCustomTools) params.my_custom_tools = 'true';
|
|
36
|
+
|
|
37
|
+
const response = await this.client.get('ai/tools', params);
|
|
38
|
+
return response;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Search tools by query
|
|
43
|
+
* @param {string} query - Search query
|
|
44
|
+
* @param {Object} [options] - Filter options
|
|
45
|
+
* @param {string} [options.type] - Filter by type
|
|
46
|
+
* @param {string} [options.category] - Filter by category
|
|
47
|
+
* @param {boolean} [options.myCustomTools] - Show only user's custom tools
|
|
48
|
+
* @returns {Promise<Object>} Search results
|
|
49
|
+
*/
|
|
50
|
+
async search(query, options = {}) {
|
|
51
|
+
const params = { q: query };
|
|
52
|
+
|
|
53
|
+
if (options.type) params.type = options.type;
|
|
54
|
+
if (options.category) params.category = options.category;
|
|
55
|
+
if (options.myCustomTools) params.my_custom_tools = 'true';
|
|
56
|
+
|
|
57
|
+
const response = await this.client.get('ai/tools/search', params);
|
|
58
|
+
return response;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Get tool by slug
|
|
63
|
+
* @param {string} slug - Tool slug/ID
|
|
64
|
+
* @returns {Promise<Object>} Tool details
|
|
65
|
+
*/
|
|
66
|
+
async get(slug) {
|
|
67
|
+
if (!slug) {
|
|
68
|
+
throw new Error('Tool slug is required');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const response = await this.client.get(`ai/tools/${slug}`);
|
|
72
|
+
return response;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Create a custom tool (client-side tool)
|
|
77
|
+
* @param {Object} toolData - Tool configuration
|
|
78
|
+
* @param {string} toolData.slug - Unique tool slug/ID
|
|
79
|
+
* @param {string} toolData.tool_name - Tool name
|
|
80
|
+
* @param {string} toolData.tool_description - Tool description
|
|
81
|
+
* @param {string} [toolData.icon] - Tool icon
|
|
82
|
+
* @param {string} [toolData.type='client'] - Tool type: 'client' | 'server' | 'hybrid'
|
|
83
|
+
* @param {string} [toolData.category='custom'] - Tool category
|
|
84
|
+
* @param {Object} [toolData.input_scheme] - Input schema/parameters
|
|
85
|
+
* @param {Object} [toolData.output_scheme] - Output schema
|
|
86
|
+
* @param {string} [toolData.prompt] - Tool prompt/instructions
|
|
87
|
+
* @param {boolean} [toolData.require_environment=false] - Requires context/environment
|
|
88
|
+
* @param {string} [toolData.context_type] - Context type if required
|
|
89
|
+
* @returns {Promise<Object>} Created tool
|
|
90
|
+
*/
|
|
91
|
+
async create(toolData) {
|
|
92
|
+
const {
|
|
93
|
+
slug,
|
|
94
|
+
tool_name,
|
|
95
|
+
tool_description,
|
|
96
|
+
icon,
|
|
97
|
+
type = 'client',
|
|
98
|
+
category = 'custom',
|
|
99
|
+
input_scheme,
|
|
100
|
+
output_scheme,
|
|
101
|
+
prompt,
|
|
102
|
+
require_environment = false,
|
|
103
|
+
context_type
|
|
104
|
+
} = toolData;
|
|
105
|
+
|
|
106
|
+
if (!slug || !tool_name || !tool_description) {
|
|
107
|
+
throw new Error('slug, tool_name, and tool_description are required');
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const payload = {
|
|
111
|
+
slug,
|
|
112
|
+
tool_name,
|
|
113
|
+
tool_description,
|
|
114
|
+
icon,
|
|
115
|
+
type,
|
|
116
|
+
category,
|
|
117
|
+
input_scheme,
|
|
118
|
+
output_scheme,
|
|
119
|
+
prompt,
|
|
120
|
+
require_environment,
|
|
121
|
+
context_type
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const response = await this.client.post('ai/tools', payload);
|
|
125
|
+
return response;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Validate tool IDs
|
|
130
|
+
* @param {Array<string>} toolIds - Array of tool slugs to validate
|
|
131
|
+
* @returns {Promise<Object>} Validation result
|
|
132
|
+
*/
|
|
133
|
+
async validate(toolIds) {
|
|
134
|
+
if (!Array.isArray(toolIds)) {
|
|
135
|
+
throw new Error('toolIds must be an array');
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Get all tools and check which ones exist
|
|
139
|
+
const allTools = await this.list();
|
|
140
|
+
const existingSlugs = allTools.tools.map(t => t.slug);
|
|
141
|
+
|
|
142
|
+
const validIds = toolIds.filter(id => existingSlugs.includes(id));
|
|
143
|
+
const invalidIds = toolIds.filter(id => !existingSlugs.includes(id));
|
|
144
|
+
|
|
145
|
+
return {
|
|
146
|
+
valid: invalidIds.length === 0,
|
|
147
|
+
validIds,
|
|
148
|
+
invalidIds,
|
|
149
|
+
error: invalidIds.length > 0 ? `Invalid tool IDs: ${invalidIds.join(', ')}` : null
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export default Tools;
|
|
155
|
+
|
package/src/client.js
CHANGED
|
@@ -107,6 +107,24 @@ export class OblienClient {
|
|
|
107
107
|
return this._handleResponse(response);
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
/**
|
|
111
|
+
* Make PATCH request
|
|
112
|
+
* @param {string} path - API path
|
|
113
|
+
* @param {Object} [body] - Request body
|
|
114
|
+
* @returns {Promise<any>} Response data
|
|
115
|
+
*/
|
|
116
|
+
async patch(path, body = {}) {
|
|
117
|
+
const headers = this.getAuthHeaders();
|
|
118
|
+
|
|
119
|
+
const response = await fetch(this._buildURL(path), {
|
|
120
|
+
method: 'PATCH',
|
|
121
|
+
headers,
|
|
122
|
+
body: JSON.stringify(body),
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
return this._handleResponse(response);
|
|
126
|
+
}
|
|
127
|
+
|
|
110
128
|
/**
|
|
111
129
|
* Make DELETE request
|
|
112
130
|
* @param {string} path - API path
|