@agent-nexus/sdk 0.1.0
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 +21 -0
- package/README.md +260 -0
- package/dist/index.d.mts +3336 -0
- package/dist/index.d.ts +3336 -0
- package/dist/index.js +2182 -0
- package/dist/index.mjs +2129 -0
- package/package.json +56 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,3336 @@
|
|
|
1
|
+
/** Pagination query parameters accepted by list endpoints. */
|
|
2
|
+
interface PaginationParams {
|
|
3
|
+
/** Page number (1-based). */
|
|
4
|
+
page?: number;
|
|
5
|
+
/** Items per page. */
|
|
6
|
+
limit?: number;
|
|
7
|
+
}
|
|
8
|
+
/** Pagination metadata returned alongside list results. */
|
|
9
|
+
interface PaginationMeta {
|
|
10
|
+
/** Total number of items across all pages. */
|
|
11
|
+
total: number;
|
|
12
|
+
/** Current page number (1-based). */
|
|
13
|
+
page: number;
|
|
14
|
+
/** Whether more pages exist after the current one. */
|
|
15
|
+
hasMore: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** Paginated response wrapper returned by list methods. */
|
|
18
|
+
interface PageResponse<T> {
|
|
19
|
+
/** Items on the current page. */
|
|
20
|
+
data: T[];
|
|
21
|
+
/** Pagination metadata. */
|
|
22
|
+
meta: PaginationMeta;
|
|
23
|
+
}
|
|
24
|
+
/** Response returned after successfully deleting a resource. */
|
|
25
|
+
interface DeleteResponse {
|
|
26
|
+
/** ID of the deleted resource. */
|
|
27
|
+
id: string;
|
|
28
|
+
/** Always `true` on successful deletion. */
|
|
29
|
+
deleted: true;
|
|
30
|
+
}
|
|
31
|
+
/** Agent lifecycle status. `"ACTIVE"` agents are deployed; `"DRAFT"` agents are in development. */
|
|
32
|
+
type AgentStatus = "ACTIVE" | "DRAFT";
|
|
33
|
+
/** Model provider. */
|
|
34
|
+
type ModelProvider = "OPEN_AI" | "ANTHROPIC" | "GOOGLE_AI";
|
|
35
|
+
/**
|
|
36
|
+
* Model configuration — the modern way to set an agent's model.
|
|
37
|
+
*
|
|
38
|
+
* Use `client.models.list()` to get available models. The `modelId` from the
|
|
39
|
+
* response goes into `modelName`, and `provider` goes into `modelProvider`.
|
|
40
|
+
*/
|
|
41
|
+
interface ModelConfig {
|
|
42
|
+
/** Model ID from the catalog (e.g. "claude-sonnet-4-6", "gpt-4.1"). */
|
|
43
|
+
modelName: string;
|
|
44
|
+
/** Provider: "OPEN_AI", "ANTHROPIC", or "GOOGLE_AI". */
|
|
45
|
+
modelProvider: ModelProvider;
|
|
46
|
+
/** Anthropic thinking level: "fast", "detailed", or "extended". */
|
|
47
|
+
thinkingLevel?: "fast" | "detailed" | "extended";
|
|
48
|
+
/** OpenAI reasoning effort: "none", "auto", "low", "medium", "high", "xhigh". */
|
|
49
|
+
reasoningEffort?: "none" | "auto" | "low" | "medium" | "high" | "xhigh";
|
|
50
|
+
/** Google AI thinking level: "dynamic", "minimal", "low", "medium", "high". */
|
|
51
|
+
geminiThinkingLevel?: "dynamic" | "minimal" | "low" | "medium" | "high";
|
|
52
|
+
/** Sampling temperature (0-1). */
|
|
53
|
+
temperature?: number;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Valid agent model identifiers. These map to the `AgentModel` Prisma enum.
|
|
57
|
+
*
|
|
58
|
+
* Use `client.models.list()` to retrieve all enabled models from the database
|
|
59
|
+
* with their display names, providers, and capabilities.
|
|
60
|
+
*/
|
|
61
|
+
type AgentModel = "DEFAULT" | "GPT_4_TURBO" | "GPT_4" | "GPT_4_5" | "GPT_4_1" | "GPT_4_1_MINI" | "GPT_4_1_NANO" | "GPT_3_5_TURBO" | "GPT_3_5_TURBO_16K" | "MISTRAL_LARGE" | "OPENAI_O1" | "OPENAI_O1_MINI" | "OPENAI_O3_MINI" | "OPENAI_O3" | "OPENAI_O3_PRO" | "OPENAI_O4_MINI";
|
|
62
|
+
/**
|
|
63
|
+
* The type of tool configuration attached to an agent.
|
|
64
|
+
*
|
|
65
|
+
* - `"PLUGIN"` — Pipedream marketplace tool (external API integration).
|
|
66
|
+
* - `"WORKFLOW"` — An organization-owned automation workflow.
|
|
67
|
+
* - `"TASK"` — An organization-owned AI task.
|
|
68
|
+
* - `"COLLECTION"` — A knowledge collection the agent can query.
|
|
69
|
+
* - `"DOCUMENT_TEMPLATE"` — A document generation template.
|
|
70
|
+
*/
|
|
71
|
+
type AgentToolConfigType = "WORKFLOW" | "PLUGIN" | "TASK" | "COLLECTION" | "DOCUMENT_TEMPLATE";
|
|
72
|
+
/** Prompt version type. `"AUTO"` versions are created automatically on prompt changes; `"CHECKPOINT"` versions are manually named snapshots. */
|
|
73
|
+
type VersionType = "AUTO" | "CHECKPOINT";
|
|
74
|
+
|
|
75
|
+
/** Configuration options for the HTTP client. */
|
|
76
|
+
interface HttpClientOptions {
|
|
77
|
+
/** Base URL of the Nexus API (e.g. `"https://api.nexusgpt.io"`). */
|
|
78
|
+
baseUrl: string;
|
|
79
|
+
/** API key for authentication. */
|
|
80
|
+
apiKey: string;
|
|
81
|
+
/** Custom `fetch` implementation. Defaults to the global `fetch`. */
|
|
82
|
+
fetch?: typeof globalThis.fetch;
|
|
83
|
+
/** Additional headers sent with every request. */
|
|
84
|
+
defaultHeaders?: Record<string, string>;
|
|
85
|
+
/** Request timeout in milliseconds (default 30 000). */
|
|
86
|
+
timeout?: number;
|
|
87
|
+
}
|
|
88
|
+
/** Options for a single HTTP request. */
|
|
89
|
+
interface RequestOptions {
|
|
90
|
+
/** Request body (will be JSON-serialized unless it's a `FormData` instance). */
|
|
91
|
+
body?: unknown;
|
|
92
|
+
/** Query string parameters. `undefined` values are omitted. */
|
|
93
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
94
|
+
/** Additional headers for this request. */
|
|
95
|
+
headers?: Record<string, string>;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Low-level HTTP client for the Nexus Public API.
|
|
99
|
+
*
|
|
100
|
+
* Most users should use `NexusClient` instead, which provides typed resource
|
|
101
|
+
* methods. The `HttpClient` is exported for advanced use cases (e.g. calling
|
|
102
|
+
* endpoints not yet covered by the SDK).
|
|
103
|
+
*
|
|
104
|
+
* All requests are sent to `{baseUrl}/api/public/v1{path}` with the API key
|
|
105
|
+
* in the `api-key` header. Responses are expected to follow the envelope format:
|
|
106
|
+
* `{ success: true, data: T, meta?: PaginationMeta }`.
|
|
107
|
+
*/
|
|
108
|
+
declare class HttpClient {
|
|
109
|
+
private readonly baseUrl;
|
|
110
|
+
private readonly apiKey;
|
|
111
|
+
private readonly fetchFn;
|
|
112
|
+
private readonly defaultHeaders;
|
|
113
|
+
private readonly timeout;
|
|
114
|
+
constructor(opts: HttpClientOptions);
|
|
115
|
+
/**
|
|
116
|
+
* Make a request and return the unwrapped `data` field.
|
|
117
|
+
*
|
|
118
|
+
* @param method - HTTP method (GET, POST, PATCH, DELETE).
|
|
119
|
+
* @param path - API path relative to `/api/public/v1` (e.g. `"/agents"`).
|
|
120
|
+
* @param opts - Optional body, query params, and headers.
|
|
121
|
+
* @returns The response `data` field, typed as `T`.
|
|
122
|
+
* @throws {NexusAuthenticationError} On 401 responses.
|
|
123
|
+
* @throws {NexusApiError} On other error responses.
|
|
124
|
+
* @throws {NexusConnectionError} On network failures or timeouts.
|
|
125
|
+
*/
|
|
126
|
+
request<T>(method: string, path: string, opts?: RequestOptions): Promise<T>;
|
|
127
|
+
/**
|
|
128
|
+
* Make a request and return `{ data, meta }` (useful for paginated lists).
|
|
129
|
+
*
|
|
130
|
+
* @param method - HTTP method.
|
|
131
|
+
* @param path - API path relative to `/api/public/v1`.
|
|
132
|
+
* @param opts - Optional body, query params, and headers.
|
|
133
|
+
* @returns The response `data` and optional pagination `meta`.
|
|
134
|
+
* @throws {NexusAuthenticationError} On 401 responses.
|
|
135
|
+
* @throws {NexusApiError} On other error responses.
|
|
136
|
+
* @throws {NexusConnectionError} On network failures or timeouts.
|
|
137
|
+
*/
|
|
138
|
+
requestWithMeta<T>(method: string, path: string, opts?: RequestOptions): Promise<{
|
|
139
|
+
data: T;
|
|
140
|
+
meta?: PaginationMeta;
|
|
141
|
+
}>;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** Base class for all SDK resource classes. Provides access to the HTTP client. */
|
|
145
|
+
declare abstract class BaseResource {
|
|
146
|
+
protected readonly http: HttpClient;
|
|
147
|
+
constructor(http: HttpClient);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
declare class AgentCollectionsResource extends BaseResource {
|
|
151
|
+
list(agentId: string): Promise<any[]>;
|
|
152
|
+
attach(agentId: string, body: {
|
|
153
|
+
collectionIds: string[];
|
|
154
|
+
}): Promise<any>;
|
|
155
|
+
detach(agentId: string, body: {
|
|
156
|
+
collectionIds: string[];
|
|
157
|
+
}): Promise<any>;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** Agent summary returned by `client.agents.list()`. */
|
|
161
|
+
interface AgentSummary {
|
|
162
|
+
/** Unique agent UUID. */
|
|
163
|
+
id: string;
|
|
164
|
+
/** Agent's first name. */
|
|
165
|
+
firstName: string;
|
|
166
|
+
/** Agent's last name. */
|
|
167
|
+
lastName: string;
|
|
168
|
+
/** Agent's role or job title (e.g. "Customer Support Agent"). */
|
|
169
|
+
role: string;
|
|
170
|
+
/** Short biography displayed in agent cards. */
|
|
171
|
+
shortBio: string | null;
|
|
172
|
+
/** URL to the agent's profile picture. */
|
|
173
|
+
profilePicture: string | null;
|
|
174
|
+
/** Agent lifecycle status. */
|
|
175
|
+
status: AgentStatus;
|
|
176
|
+
/** Model identifier. Must be a valid `AgentModel` enum value (e.g. "GPT_4_1", "DEFAULT"). Use `client.models.list()` to get all available models. */
|
|
177
|
+
model: AgentModel | null;
|
|
178
|
+
/** ISO 8601 creation timestamp. */
|
|
179
|
+
createdAt: string;
|
|
180
|
+
/** ISO 8601 last-updated timestamp. */
|
|
181
|
+
updatedAt: string | null;
|
|
182
|
+
}
|
|
183
|
+
/** Full agent detail returned by `client.agents.get()` and `client.agents.create()`. */
|
|
184
|
+
interface AgentDetail extends AgentSummary {
|
|
185
|
+
/** Full biography / background information. */
|
|
186
|
+
bio: string | null;
|
|
187
|
+
/** The agent's objective or mission statement. */
|
|
188
|
+
objective: string | null;
|
|
189
|
+
/** Communication tone (e.g. "professional", "friendly"). */
|
|
190
|
+
tone: string | null;
|
|
191
|
+
/** Additional explanation or context for the agent. */
|
|
192
|
+
explanation: string | null;
|
|
193
|
+
/** Behaviour rules the agent must follow. */
|
|
194
|
+
behaviour: string[];
|
|
195
|
+
/** Comma-separated tags for categorization. */
|
|
196
|
+
tags: string | null;
|
|
197
|
+
/** Agent's gender (used for avatar/persona). */
|
|
198
|
+
gender: string | null;
|
|
199
|
+
/** Unified model configuration. Use `client.models.list()` to get available models. Preferred over legacy `model` field. */
|
|
200
|
+
modelConfig: ModelConfig | null;
|
|
201
|
+
/** Human-readable model name derived from modelConfig (e.g. "claude-sonnet-4-6"). */
|
|
202
|
+
modelName: string | null;
|
|
203
|
+
/** Model provider derived from modelConfig (e.g. "ANTHROPIC", "OPEN_AI"). */
|
|
204
|
+
modelProvider: string | null;
|
|
205
|
+
/** First message displayed when opening the agent playground. */
|
|
206
|
+
playgroundFirstMessage: string | null;
|
|
207
|
+
/** The agent's system prompt in markdown format. */
|
|
208
|
+
prompt: string | null;
|
|
209
|
+
}
|
|
210
|
+
/** Request body for `client.agents.create()`. */
|
|
211
|
+
interface CreateAgentBody {
|
|
212
|
+
/** Agent's first name (required). */
|
|
213
|
+
firstName: string;
|
|
214
|
+
/** Agent's last name (required). */
|
|
215
|
+
lastName: string;
|
|
216
|
+
/** Agent's role or job title (required). */
|
|
217
|
+
role: string;
|
|
218
|
+
/** Short biography displayed in agent cards. */
|
|
219
|
+
shortBio?: string;
|
|
220
|
+
/** Full biography / background information. */
|
|
221
|
+
bio?: string;
|
|
222
|
+
/** The agent's objective or mission statement. */
|
|
223
|
+
objective?: string;
|
|
224
|
+
/** Communication tone (e.g. "professional", "friendly"). */
|
|
225
|
+
tone?: string;
|
|
226
|
+
/** Additional explanation or context for the agent. */
|
|
227
|
+
explanation?: string;
|
|
228
|
+
/** Behaviour rules the agent must follow. */
|
|
229
|
+
behaviour?: string[];
|
|
230
|
+
/** Comma-separated tags for categorization. */
|
|
231
|
+
tags?: string;
|
|
232
|
+
/** Agent's gender (used for avatar/persona). */
|
|
233
|
+
gender?: string;
|
|
234
|
+
/** Legacy model enum field. Prefer `modelConfig` instead for full provider support (Claude, Gemini, etc.). */
|
|
235
|
+
model?: AgentModel;
|
|
236
|
+
/** Unified model configuration. Use `client.models.list()` to get available models. */
|
|
237
|
+
modelConfig?: ModelConfig;
|
|
238
|
+
/** Human-readable model name (e.g. "Claude Sonnet 4.5"). */
|
|
239
|
+
modelName?: string;
|
|
240
|
+
/** Model provider (e.g. "anthropic", "openai"). */
|
|
241
|
+
modelProvider?: string;
|
|
242
|
+
/** First message displayed when opening the agent playground. Set to `null` to clear. */
|
|
243
|
+
playgroundFirstMessage?: string | null;
|
|
244
|
+
}
|
|
245
|
+
/** Request body for `client.agents.update()`. All fields are optional — only provided fields are updated. */
|
|
246
|
+
interface UpdateAgentBody {
|
|
247
|
+
/** Agent's first name. */
|
|
248
|
+
firstName?: string;
|
|
249
|
+
/** Agent's last name. */
|
|
250
|
+
lastName?: string;
|
|
251
|
+
/** Agent's role or job title. */
|
|
252
|
+
role?: string;
|
|
253
|
+
/** Short biography displayed in agent cards. */
|
|
254
|
+
shortBio?: string;
|
|
255
|
+
/** Full biography / background information. */
|
|
256
|
+
bio?: string;
|
|
257
|
+
/** The agent's objective or mission statement. */
|
|
258
|
+
objective?: string;
|
|
259
|
+
/** Communication tone (e.g. "professional", "friendly"). */
|
|
260
|
+
tone?: string;
|
|
261
|
+
/** Additional explanation or context for the agent. */
|
|
262
|
+
explanation?: string;
|
|
263
|
+
/** Behaviour rules the agent must follow. */
|
|
264
|
+
behaviour?: string[];
|
|
265
|
+
/** Comma-separated tags for categorization. */
|
|
266
|
+
tags?: string;
|
|
267
|
+
/** Agent's gender (used for avatar/persona). */
|
|
268
|
+
gender?: string;
|
|
269
|
+
/** Legacy model enum field. Prefer `modelConfig` instead for full provider support (Claude, Gemini, etc.). */
|
|
270
|
+
model?: AgentModel;
|
|
271
|
+
/** Unified model configuration. Use `client.models.list()` to get available models. */
|
|
272
|
+
modelConfig?: ModelConfig;
|
|
273
|
+
/** Human-readable model name. */
|
|
274
|
+
modelName?: string;
|
|
275
|
+
/** Model provider. */
|
|
276
|
+
modelProvider?: string;
|
|
277
|
+
/** The agent's system prompt in markdown format. */
|
|
278
|
+
prompt?: string;
|
|
279
|
+
/** First message displayed when opening the agent playground. Set to `null` to clear. */
|
|
280
|
+
playgroundFirstMessage?: string | null;
|
|
281
|
+
}
|
|
282
|
+
/** Query parameters for `client.agents.list()`. */
|
|
283
|
+
interface ListAgentsParams {
|
|
284
|
+
/** Page number (1-based, default 1). */
|
|
285
|
+
page?: number;
|
|
286
|
+
/** Items per page (default 20). */
|
|
287
|
+
limit?: number;
|
|
288
|
+
/** Filter by agent status. */
|
|
289
|
+
status?: AgentStatus;
|
|
290
|
+
/** Free-text search across agent names and roles. */
|
|
291
|
+
search?: string;
|
|
292
|
+
}
|
|
293
|
+
/** Response from `client.agents.uploadProfilePicture()`. */
|
|
294
|
+
interface UploadProfilePictureResponse {
|
|
295
|
+
/** URL to the uploaded profile picture. */
|
|
296
|
+
profilePicture: string;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/** A tool configuration attached to an agent. Returned by `client.agents.tools.list()` and related methods. */
|
|
300
|
+
interface AgentToolConfig {
|
|
301
|
+
/** Unique tool config UUID. */
|
|
302
|
+
id: string;
|
|
303
|
+
/** Display name for the tool (e.g. "Gmail - Send Email"). */
|
|
304
|
+
label: string;
|
|
305
|
+
/** Description of what this tool does. */
|
|
306
|
+
description: string | null;
|
|
307
|
+
/** URL to the tool's icon. */
|
|
308
|
+
iconUrl: string | null;
|
|
309
|
+
/** Icon type identifier. */
|
|
310
|
+
iconType: string | null;
|
|
311
|
+
/**
|
|
312
|
+
* Tool type.
|
|
313
|
+
*
|
|
314
|
+
* - `"PLUGIN"` — Pipedream marketplace tool (use `client.tools` to discover and configure).
|
|
315
|
+
* - `"WORKFLOW"` — Organization workflow.
|
|
316
|
+
* - `"TASK"` — Organization AI task.
|
|
317
|
+
* - `"COLLECTION"` — Knowledge collection.
|
|
318
|
+
* - `"DOCUMENT_TEMPLATE"` — Document generation template.
|
|
319
|
+
*/
|
|
320
|
+
type: AgentToolConfigType;
|
|
321
|
+
/**
|
|
322
|
+
* JSON Schema defining the input the agent must provide when invoking this tool.
|
|
323
|
+
* For PLUGIN tools, this is typically auto-generated from the action's parameter schema.
|
|
324
|
+
*/
|
|
325
|
+
agentInputSchema: unknown | null;
|
|
326
|
+
/**
|
|
327
|
+
* Internal tool configuration. For PLUGIN tools this contains:
|
|
328
|
+
* - `toolId` — Marketplace tool ID
|
|
329
|
+
* - `toolCredentialId` — Credential UUID
|
|
330
|
+
* - `parametersSetup` — Pre-configured parameter values
|
|
331
|
+
* - Action selection and other provider-specific settings
|
|
332
|
+
*/
|
|
333
|
+
config: unknown | null;
|
|
334
|
+
/** Whether this tool is enabled. Disabled tools are not available to the agent at runtime. */
|
|
335
|
+
isActive: boolean;
|
|
336
|
+
/** ISO 8601 creation timestamp. */
|
|
337
|
+
createdAt: string;
|
|
338
|
+
/** ISO 8601 last-updated timestamp. */
|
|
339
|
+
updatedAt: string | null;
|
|
340
|
+
}
|
|
341
|
+
/** Request body for `client.agents.tools.create()`. */
|
|
342
|
+
interface CreateAgentToolBody {
|
|
343
|
+
/** Display name for the tool (required). */
|
|
344
|
+
label: string;
|
|
345
|
+
/** Description of what this tool does. */
|
|
346
|
+
description?: string;
|
|
347
|
+
/** URL to the tool's icon. */
|
|
348
|
+
iconUrl?: string;
|
|
349
|
+
/** Icon type identifier. */
|
|
350
|
+
iconType?: string;
|
|
351
|
+
/** Tool type (required). */
|
|
352
|
+
type: AgentToolConfigType;
|
|
353
|
+
/**
|
|
354
|
+
* JSON Schema defining the input the agent must provide when invoking this tool (required).
|
|
355
|
+
* Use `{ type: "object", properties: { ... } }` or `{}` if no input is needed.
|
|
356
|
+
*/
|
|
357
|
+
agentInputSchema: unknown;
|
|
358
|
+
/** Internal tool configuration (provider-specific). */
|
|
359
|
+
config?: unknown;
|
|
360
|
+
/** Whether this tool is enabled (default `true`). */
|
|
361
|
+
isActive?: boolean;
|
|
362
|
+
}
|
|
363
|
+
/** Request body for `client.agents.tools.attachCollection()`. */
|
|
364
|
+
interface AttachCollectionBody {
|
|
365
|
+
/** The collection's UUID (required). */
|
|
366
|
+
collectionId: string;
|
|
367
|
+
/** Display name for the tool. Defaults to the collection name if omitted. */
|
|
368
|
+
label?: string;
|
|
369
|
+
/** Description of what the tool does. Defaults to the collection description if omitted. */
|
|
370
|
+
description?: string;
|
|
371
|
+
/** Optional instructions for how the agent should use this collection. */
|
|
372
|
+
instructions?: string;
|
|
373
|
+
}
|
|
374
|
+
/** Request body for `client.agents.tools.update()`. All fields are optional. */
|
|
375
|
+
interface UpdateAgentToolBody {
|
|
376
|
+
/** Display name for the tool. */
|
|
377
|
+
label?: string;
|
|
378
|
+
/** Description of what this tool does. */
|
|
379
|
+
description?: string;
|
|
380
|
+
/** URL to the tool's icon. */
|
|
381
|
+
iconUrl?: string;
|
|
382
|
+
/** Icon type identifier. */
|
|
383
|
+
iconType?: string;
|
|
384
|
+
/** Tool type. */
|
|
385
|
+
type?: AgentToolConfigType;
|
|
386
|
+
/** JSON Schema defining the input the agent must provide when invoking this tool. */
|
|
387
|
+
agentInputSchema?: unknown;
|
|
388
|
+
/** Internal tool configuration (provider-specific). */
|
|
389
|
+
config?: unknown;
|
|
390
|
+
/** Whether this tool is enabled. */
|
|
391
|
+
isActive?: boolean;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Agent tool configuration resource. Accessed via `client.agents.tools`.
|
|
396
|
+
*
|
|
397
|
+
* Manages the tools attached to an agent. Each tool config represents a
|
|
398
|
+
* configured integration (e.g. "Gmail - Send Email" with saved credentials
|
|
399
|
+
* and parameter defaults).
|
|
400
|
+
*
|
|
401
|
+
* To discover available marketplace tools before creating a config, use
|
|
402
|
+
* `client.tools.search()` and `client.tools.get()`.
|
|
403
|
+
*/
|
|
404
|
+
declare class AgentToolsResource extends BaseResource {
|
|
405
|
+
/**
|
|
406
|
+
* List all tool configurations for an agent.
|
|
407
|
+
*
|
|
408
|
+
* @param agentId - Agent UUID.
|
|
409
|
+
* @returns Array of tool configurations.
|
|
410
|
+
*/
|
|
411
|
+
list(agentId: string): Promise<AgentToolConfig[]>;
|
|
412
|
+
/**
|
|
413
|
+
* Get a specific tool configuration.
|
|
414
|
+
*
|
|
415
|
+
* @param agentId - Agent UUID.
|
|
416
|
+
* @param toolId - Tool config UUID.
|
|
417
|
+
* @returns Tool configuration detail.
|
|
418
|
+
*/
|
|
419
|
+
get(agentId: string, toolId: string): Promise<AgentToolConfig>;
|
|
420
|
+
/**
|
|
421
|
+
* Add a new tool configuration to an agent.
|
|
422
|
+
*
|
|
423
|
+
* @param agentId - Agent UUID.
|
|
424
|
+
* @param body - Tool configuration. `label` and `type` are required.
|
|
425
|
+
* @returns The created tool configuration.
|
|
426
|
+
*/
|
|
427
|
+
create(agentId: string, body: CreateAgentToolBody): Promise<AgentToolConfig>;
|
|
428
|
+
/**
|
|
429
|
+
* Update an existing tool configuration. Only provided fields are updated.
|
|
430
|
+
*
|
|
431
|
+
* @param agentId - Agent UUID.
|
|
432
|
+
* @param toolId - Tool config UUID.
|
|
433
|
+
* @param body - Fields to update.
|
|
434
|
+
* @returns The updated tool configuration.
|
|
435
|
+
*/
|
|
436
|
+
update(agentId: string, toolId: string, body: UpdateAgentToolBody): Promise<AgentToolConfig>;
|
|
437
|
+
/**
|
|
438
|
+
* Remove a tool configuration from an agent.
|
|
439
|
+
*
|
|
440
|
+
* @param agentId - Agent UUID.
|
|
441
|
+
* @param toolId - Tool config UUID.
|
|
442
|
+
* @returns Confirmation with the deleted tool config's ID.
|
|
443
|
+
*/
|
|
444
|
+
delete(agentId: string, toolId: string): Promise<DeleteResponse>;
|
|
445
|
+
/**
|
|
446
|
+
* Attach a knowledge collection to an agent.
|
|
447
|
+
*
|
|
448
|
+
* Creates a COLLECTION-type tool that allows the agent to search the
|
|
449
|
+
* collection during conversations. If `label` is omitted, the collection
|
|
450
|
+
* name is used.
|
|
451
|
+
*
|
|
452
|
+
* @param agentId - Agent UUID.
|
|
453
|
+
* @param body - Collection ID and optional label/description/instructions.
|
|
454
|
+
* @returns The created tool configuration.
|
|
455
|
+
*
|
|
456
|
+
* @example
|
|
457
|
+
* ```ts
|
|
458
|
+
* const tool = await client.agents.tools.attachCollection("agent-uuid", {
|
|
459
|
+
* collectionId: "collection-uuid"
|
|
460
|
+
* });
|
|
461
|
+
* ```
|
|
462
|
+
*/
|
|
463
|
+
attachCollection(agentId: string, body: AttachCollectionBody): Promise<AgentToolConfig>;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/** The user who created a prompt version. */
|
|
467
|
+
interface VersionCreator {
|
|
468
|
+
/** User UUID. */
|
|
469
|
+
id: string;
|
|
470
|
+
/** User's first name. */
|
|
471
|
+
firstName: string | null;
|
|
472
|
+
/** User's last name. */
|
|
473
|
+
lastName: string | null;
|
|
474
|
+
}
|
|
475
|
+
/** Prompt version summary returned by `client.agents.versions.list()`. */
|
|
476
|
+
interface VersionSummary {
|
|
477
|
+
/** Unique version UUID. */
|
|
478
|
+
id: string;
|
|
479
|
+
/** Version type: `"AUTO"` (created on prompt changes) or `"CHECKPOINT"` (manually named snapshot). */
|
|
480
|
+
type: VersionType;
|
|
481
|
+
/** Version name (only set for checkpoints). */
|
|
482
|
+
name: string | null;
|
|
483
|
+
/** Version description. */
|
|
484
|
+
description: string | null;
|
|
485
|
+
/** Whether this version is currently deployed to production. */
|
|
486
|
+
isProduction: boolean;
|
|
487
|
+
/** ISO 8601 creation timestamp. */
|
|
488
|
+
createdAt: string;
|
|
489
|
+
/** User UUID who created this version. */
|
|
490
|
+
createdBy: string | null;
|
|
491
|
+
/** Creator's name details. */
|
|
492
|
+
creator: VersionCreator | null;
|
|
493
|
+
}
|
|
494
|
+
/** Full version detail including the prompt content. Returned by `client.agents.versions.get()`. */
|
|
495
|
+
interface VersionDetail extends VersionSummary {
|
|
496
|
+
/** The full agent system prompt at this version, in markdown format. */
|
|
497
|
+
prompt: string | null;
|
|
498
|
+
}
|
|
499
|
+
/** Query parameters for `client.agents.versions.list()`. */
|
|
500
|
+
interface ListVersionsParams {
|
|
501
|
+
/** Page number (1-based, default 1). */
|
|
502
|
+
page?: number;
|
|
503
|
+
/** Items per page (default 20). */
|
|
504
|
+
limit?: number;
|
|
505
|
+
/** Filter by version type. */
|
|
506
|
+
type?: VersionType;
|
|
507
|
+
}
|
|
508
|
+
/** Request body for `client.agents.versions.createCheckpoint()`. */
|
|
509
|
+
interface CreateCheckpointBody {
|
|
510
|
+
/** Checkpoint name (e.g. "v1.0", "before-refactor"). */
|
|
511
|
+
name?: string;
|
|
512
|
+
/** Description of what this checkpoint captures. */
|
|
513
|
+
description?: string;
|
|
514
|
+
}
|
|
515
|
+
/** Request body for `client.agents.versions.update()`. */
|
|
516
|
+
interface UpdateVersionBody {
|
|
517
|
+
/** New version name. */
|
|
518
|
+
name?: string;
|
|
519
|
+
/** New version description. */
|
|
520
|
+
description?: string;
|
|
521
|
+
}
|
|
522
|
+
/** Response from `client.agents.versions.restore()`. */
|
|
523
|
+
interface RestoreVersionResponse {
|
|
524
|
+
/** The restored prompt content. */
|
|
525
|
+
prompt: string | null;
|
|
526
|
+
/** Confirmation message. */
|
|
527
|
+
message: string;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Agent prompt version resource. Accessed via `client.agents.versions`.
|
|
532
|
+
*
|
|
533
|
+
* Versions track changes to an agent's system prompt over time.
|
|
534
|
+
* - `AUTO` versions are created automatically when the prompt changes.
|
|
535
|
+
* - `CHECKPOINT` versions are manually named snapshots (e.g. "v1.0").
|
|
536
|
+
*
|
|
537
|
+
* Use `restore()` to revert an agent's prompt to a previous version,
|
|
538
|
+
* and `publish()` to deploy a version to production.
|
|
539
|
+
*/
|
|
540
|
+
declare class VersionsResource extends BaseResource {
|
|
541
|
+
/**
|
|
542
|
+
* List prompt versions for an agent (paginated).
|
|
543
|
+
*
|
|
544
|
+
* @param agentId - Agent UUID.
|
|
545
|
+
* @param params - Optional type filter and pagination.
|
|
546
|
+
* @returns Paginated list of version summaries.
|
|
547
|
+
*/
|
|
548
|
+
list(agentId: string, params?: ListVersionsParams): Promise<PageResponse<VersionSummary>>;
|
|
549
|
+
/**
|
|
550
|
+
* Get detailed information about a specific version, including the full prompt content.
|
|
551
|
+
*
|
|
552
|
+
* @param agentId - Agent UUID.
|
|
553
|
+
* @param versionId - Version UUID.
|
|
554
|
+
* @returns Version detail with the prompt text.
|
|
555
|
+
*/
|
|
556
|
+
get(agentId: string, versionId: string): Promise<VersionDetail>;
|
|
557
|
+
/**
|
|
558
|
+
* Create a named checkpoint of the agent's current prompt.
|
|
559
|
+
*
|
|
560
|
+
* @param agentId - Agent UUID.
|
|
561
|
+
* @param body - Optional name and description for the checkpoint.
|
|
562
|
+
* @returns The created checkpoint version.
|
|
563
|
+
*/
|
|
564
|
+
createCheckpoint(agentId: string, body?: CreateCheckpointBody): Promise<VersionDetail>;
|
|
565
|
+
/**
|
|
566
|
+
* Update a version's metadata (name or description).
|
|
567
|
+
*
|
|
568
|
+
* @param agentId - Agent UUID.
|
|
569
|
+
* @param versionId - Version UUID.
|
|
570
|
+
* @param body - Fields to update.
|
|
571
|
+
* @returns The updated version detail.
|
|
572
|
+
*/
|
|
573
|
+
update(agentId: string, versionId: string, body: UpdateVersionBody): Promise<VersionDetail>;
|
|
574
|
+
/**
|
|
575
|
+
* Delete a prompt version. Cannot delete the current production version.
|
|
576
|
+
*
|
|
577
|
+
* @param agentId - Agent UUID.
|
|
578
|
+
* @param versionId - Version UUID.
|
|
579
|
+
* @returns Confirmation with the deleted version's ID.
|
|
580
|
+
*/
|
|
581
|
+
delete(agentId: string, versionId: string): Promise<DeleteResponse>;
|
|
582
|
+
/**
|
|
583
|
+
* Restore the agent's prompt to a specific version. This overwrites the
|
|
584
|
+
* agent's current prompt with the content from the specified version.
|
|
585
|
+
*
|
|
586
|
+
* @param agentId - Agent UUID.
|
|
587
|
+
* @param versionId - Version UUID to restore.
|
|
588
|
+
* @returns The restored prompt content and a confirmation message.
|
|
589
|
+
*/
|
|
590
|
+
restore(agentId: string, versionId: string): Promise<RestoreVersionResponse>;
|
|
591
|
+
/**
|
|
592
|
+
* Publish a version to production. This marks the version as the active
|
|
593
|
+
* production version for the agent.
|
|
594
|
+
*
|
|
595
|
+
* @param agentId - Agent UUID.
|
|
596
|
+
* @param versionId - Version UUID to publish.
|
|
597
|
+
* @returns The published version detail with `isProduction: true`.
|
|
598
|
+
*/
|
|
599
|
+
publish(agentId: string, versionId: string): Promise<VersionDetail>;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Agent management resource. Accessed via `client.agents`.
|
|
604
|
+
*
|
|
605
|
+
* Provides CRUD operations for agents plus sub-resources for
|
|
606
|
+
* tool configurations (`client.agents.tools`) and prompt versions
|
|
607
|
+
* (`client.agents.versions`).
|
|
608
|
+
*/
|
|
609
|
+
declare class AgentsResource extends BaseResource {
|
|
610
|
+
/** Sub-resource for managing agent tool configurations. */
|
|
611
|
+
readonly tools: AgentToolsResource;
|
|
612
|
+
/** Sub-resource for managing agent prompt versions. */
|
|
613
|
+
readonly versions: VersionsResource;
|
|
614
|
+
constructor(http: HttpClient);
|
|
615
|
+
/**
|
|
616
|
+
* List agents with optional filtering and pagination.
|
|
617
|
+
*
|
|
618
|
+
* @param params - Optional filters and pagination.
|
|
619
|
+
* @returns Paginated list of agent summaries.
|
|
620
|
+
*/
|
|
621
|
+
list(params?: ListAgentsParams): Promise<PageResponse<AgentSummary>>;
|
|
622
|
+
/**
|
|
623
|
+
* Get detailed information about a specific agent.
|
|
624
|
+
*
|
|
625
|
+
* @param agentId - Agent UUID.
|
|
626
|
+
* @returns Full agent detail including prompt, behaviour rules, and model configuration.
|
|
627
|
+
*/
|
|
628
|
+
get(agentId: string): Promise<AgentDetail>;
|
|
629
|
+
/**
|
|
630
|
+
* Create a new agent.
|
|
631
|
+
*
|
|
632
|
+
* @param body - Agent properties. `firstName`, `lastName`, and `role` are required.
|
|
633
|
+
* @returns The created agent detail.
|
|
634
|
+
*/
|
|
635
|
+
create(body: CreateAgentBody): Promise<AgentDetail>;
|
|
636
|
+
/**
|
|
637
|
+
* Update an existing agent's properties. Only provided fields are updated.
|
|
638
|
+
*
|
|
639
|
+
* @param agentId - Agent UUID.
|
|
640
|
+
* @param body - Fields to update.
|
|
641
|
+
* @returns The updated agent detail.
|
|
642
|
+
*/
|
|
643
|
+
update(agentId: string, body: UpdateAgentBody): Promise<AgentDetail>;
|
|
644
|
+
/**
|
|
645
|
+
* Permanently delete an agent and all its tool configurations and versions.
|
|
646
|
+
*
|
|
647
|
+
* @param agentId - Agent UUID.
|
|
648
|
+
* @returns Confirmation with the deleted agent's ID.
|
|
649
|
+
*/
|
|
650
|
+
delete(agentId: string): Promise<DeleteResponse>;
|
|
651
|
+
/**
|
|
652
|
+
* Create a copy of an existing agent, including its configuration and tools.
|
|
653
|
+
*
|
|
654
|
+
* @param agentId - Agent UUID to duplicate.
|
|
655
|
+
* @returns The newly created agent detail.
|
|
656
|
+
*/
|
|
657
|
+
duplicate(agentId: string): Promise<AgentDetail>;
|
|
658
|
+
/**
|
|
659
|
+
* Upload a profile picture for an agent.
|
|
660
|
+
*
|
|
661
|
+
* @param agentId - Agent UUID.
|
|
662
|
+
* @param file - Image file as a Blob or File.
|
|
663
|
+
* @returns URL to the uploaded profile picture.
|
|
664
|
+
*/
|
|
665
|
+
uploadProfilePicture(agentId: string, file: Blob | File): Promise<UploadProfilePictureResponse>;
|
|
666
|
+
/**
|
|
667
|
+
* Generate an AI profile picture for an agent using its name and role.
|
|
668
|
+
*
|
|
669
|
+
* @param agentId - Agent UUID.
|
|
670
|
+
* @param body - Optional custom prompt to guide image style.
|
|
671
|
+
* @returns URLs of the generated profile picture in multiple sizes.
|
|
672
|
+
*/
|
|
673
|
+
generateProfilePicture(agentId: string, body?: {
|
|
674
|
+
customPrompt?: string;
|
|
675
|
+
}): Promise<{
|
|
676
|
+
profilePicture: string;
|
|
677
|
+
sizes: Record<string, string>;
|
|
678
|
+
}>;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
declare class AnalyticsResource extends BaseResource {
|
|
682
|
+
getOverview(params?: {
|
|
683
|
+
timePeriod?: string;
|
|
684
|
+
deploymentId?: string;
|
|
685
|
+
}): Promise<any>;
|
|
686
|
+
exportCsv(params?: {
|
|
687
|
+
timePeriod?: string;
|
|
688
|
+
deploymentId?: string;
|
|
689
|
+
}): Promise<any>;
|
|
690
|
+
listFeedback(params?: {
|
|
691
|
+
timePeriod?: string;
|
|
692
|
+
deploymentId?: string;
|
|
693
|
+
score?: number;
|
|
694
|
+
page?: number;
|
|
695
|
+
limit?: number;
|
|
696
|
+
}): Promise<any>;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
declare class CloudImportsResource extends BaseResource {
|
|
700
|
+
googleDriveAuth(body: {
|
|
701
|
+
code: string;
|
|
702
|
+
redirectUri: string;
|
|
703
|
+
}): Promise<any>;
|
|
704
|
+
googleDriveRefresh(body: {
|
|
705
|
+
refreshToken: string;
|
|
706
|
+
}): Promise<any>;
|
|
707
|
+
listGoogleDriveFiles(params: {
|
|
708
|
+
accessToken: string;
|
|
709
|
+
folderId?: string;
|
|
710
|
+
pageToken?: string;
|
|
711
|
+
}): Promise<any>;
|
|
712
|
+
importGoogleDrive(body: {
|
|
713
|
+
accessToken: string;
|
|
714
|
+
fileIds: string[];
|
|
715
|
+
parentId?: string;
|
|
716
|
+
}): Promise<any>;
|
|
717
|
+
sharePointAuth(body: {
|
|
718
|
+
code: string;
|
|
719
|
+
redirectUri: string;
|
|
720
|
+
}): Promise<any>;
|
|
721
|
+
sharePointRefresh(body: {
|
|
722
|
+
refreshToken: string;
|
|
723
|
+
}): Promise<any>;
|
|
724
|
+
listSharePointSites(params: {
|
|
725
|
+
connectionId: string;
|
|
726
|
+
}): Promise<any>;
|
|
727
|
+
listSharePointFiles(params: {
|
|
728
|
+
connectionId: string;
|
|
729
|
+
siteId: string;
|
|
730
|
+
folderId?: string;
|
|
731
|
+
}): Promise<any>;
|
|
732
|
+
importSharePoint(body: {
|
|
733
|
+
connectionId: string;
|
|
734
|
+
siteId: string;
|
|
735
|
+
fileIds: string[];
|
|
736
|
+
parentId?: string;
|
|
737
|
+
}): Promise<any>;
|
|
738
|
+
notionAuth(body: {
|
|
739
|
+
code: string;
|
|
740
|
+
redirectUri: string;
|
|
741
|
+
}): Promise<any>;
|
|
742
|
+
searchNotion(params: {
|
|
743
|
+
connectionId: string;
|
|
744
|
+
query?: string;
|
|
745
|
+
filter?: string;
|
|
746
|
+
cursor?: string;
|
|
747
|
+
}): Promise<any>;
|
|
748
|
+
importNotion(body: {
|
|
749
|
+
connectionId: string;
|
|
750
|
+
pageIds?: string[];
|
|
751
|
+
databaseIds?: string[];
|
|
752
|
+
parentId?: string;
|
|
753
|
+
}): Promise<any>;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
declare class DeploymentFoldersResource extends BaseResource {
|
|
757
|
+
list(): Promise<any>;
|
|
758
|
+
create(body: {
|
|
759
|
+
name: string;
|
|
760
|
+
parentId?: string;
|
|
761
|
+
}): Promise<any>;
|
|
762
|
+
update(folderId: string, body: {
|
|
763
|
+
name?: string;
|
|
764
|
+
parentId?: string | null;
|
|
765
|
+
}): Promise<any>;
|
|
766
|
+
delete(folderId: string): Promise<any>;
|
|
767
|
+
assign(body: {
|
|
768
|
+
deploymentId: string;
|
|
769
|
+
folderId: string | null;
|
|
770
|
+
}): Promise<any>;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
declare class DeploymentsResource extends BaseResource {
|
|
774
|
+
list(params?: {
|
|
775
|
+
page?: number;
|
|
776
|
+
limit?: number;
|
|
777
|
+
search?: string;
|
|
778
|
+
type?: string;
|
|
779
|
+
isActive?: boolean;
|
|
780
|
+
}): Promise<PageResponse<any>>;
|
|
781
|
+
create(body: {
|
|
782
|
+
name: string;
|
|
783
|
+
type: string;
|
|
784
|
+
agentId?: string;
|
|
785
|
+
description?: string;
|
|
786
|
+
settings?: Record<string, unknown>;
|
|
787
|
+
}): Promise<any>;
|
|
788
|
+
get(deploymentId: string): Promise<any>;
|
|
789
|
+
update(deploymentId: string, body: {
|
|
790
|
+
name?: string;
|
|
791
|
+
description?: string | null;
|
|
792
|
+
agentId?: string | null;
|
|
793
|
+
settings?: Record<string, unknown>;
|
|
794
|
+
isActive?: boolean;
|
|
795
|
+
}): Promise<any>;
|
|
796
|
+
delete(deploymentId: string): Promise<any>;
|
|
797
|
+
duplicate(deploymentId: string): Promise<any>;
|
|
798
|
+
getStatistics(deploymentId: string): Promise<any>;
|
|
799
|
+
getEmbedConfig(deploymentId: string): Promise<any>;
|
|
800
|
+
updateEmbedConfig(deploymentId: string, body: Record<string, unknown>): Promise<any>;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
declare class DocumentTemplateFoldersResource extends BaseResource {
|
|
804
|
+
list(): Promise<any>;
|
|
805
|
+
create(body: {
|
|
806
|
+
name: string;
|
|
807
|
+
parentId?: string;
|
|
808
|
+
}): Promise<any>;
|
|
809
|
+
update(folderId: string, body: {
|
|
810
|
+
name?: string;
|
|
811
|
+
parentId?: string | null;
|
|
812
|
+
}): Promise<any>;
|
|
813
|
+
delete(folderId: string): Promise<any>;
|
|
814
|
+
assign(body: {
|
|
815
|
+
templateId: string;
|
|
816
|
+
folderId: string | null;
|
|
817
|
+
}): Promise<any>;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
/** A document returned from creation endpoints. */
|
|
821
|
+
interface DocumentInfo {
|
|
822
|
+
/** Unique document ID. */
|
|
823
|
+
id: string;
|
|
824
|
+
/** Document name. */
|
|
825
|
+
name: string;
|
|
826
|
+
/** Document type (e.g. "FILE", "TEXT", "WEBSITE", "GOOGLE_SHEET"). */
|
|
827
|
+
type: string;
|
|
828
|
+
/** Processing status (e.g. "PROCESSING", "READY", "ERROR"). */
|
|
829
|
+
status: string;
|
|
830
|
+
/** ISO 8601 creation timestamp. */
|
|
831
|
+
createdAt: string;
|
|
832
|
+
}
|
|
833
|
+
/** Detailed document information returned from the get endpoint. */
|
|
834
|
+
interface DocumentDetail {
|
|
835
|
+
/** Unique document ID. */
|
|
836
|
+
id: string;
|
|
837
|
+
/** Document name. */
|
|
838
|
+
name: string;
|
|
839
|
+
/** Optional description. */
|
|
840
|
+
description: string | null;
|
|
841
|
+
/** Document type (e.g. "FILE", "TEXT", "WEBSITE", "GOOGLE_SHEET"). */
|
|
842
|
+
type: string;
|
|
843
|
+
/** Source type (e.g. "UPLOAD", "CRAWL", "SITEMAP"). */
|
|
844
|
+
sourceType: string | null;
|
|
845
|
+
/** MIME type of the document. */
|
|
846
|
+
mimeType: string | null;
|
|
847
|
+
/** Processing status (e.g. "PROCESSING", "READY", "ERROR"). */
|
|
848
|
+
status: string;
|
|
849
|
+
/** Whether this document is a folder. */
|
|
850
|
+
isFolder: boolean;
|
|
851
|
+
/** Source URL (for websites or Google Sheets). */
|
|
852
|
+
sourceUrl: string | null;
|
|
853
|
+
/** File size in bytes. */
|
|
854
|
+
size: number | null;
|
|
855
|
+
/** Total number of child documents. */
|
|
856
|
+
totalChildren: number;
|
|
857
|
+
/** Number of children with READY status. */
|
|
858
|
+
readyChildren: number;
|
|
859
|
+
/** Number of children currently processing. */
|
|
860
|
+
processingChildren: number;
|
|
861
|
+
/** Number of children pending processing. */
|
|
862
|
+
pendingChildren: number;
|
|
863
|
+
/** Number of children with errors. */
|
|
864
|
+
errorChildren: number;
|
|
865
|
+
/** Processing progress (0-100). */
|
|
866
|
+
processingProgress: number;
|
|
867
|
+
/** Document tags. */
|
|
868
|
+
tags: string[];
|
|
869
|
+
/** ISO 8601 creation timestamp. */
|
|
870
|
+
createdAt: string;
|
|
871
|
+
/** ISO 8601 last update timestamp. */
|
|
872
|
+
updatedAt: string | null;
|
|
873
|
+
}
|
|
874
|
+
/** Result from creating a Google Sheet document. */
|
|
875
|
+
interface GoogleSheetResult {
|
|
876
|
+
/** The parent folder document. */
|
|
877
|
+
folder: DocumentInfo;
|
|
878
|
+
/** Individual sheet documents. */
|
|
879
|
+
sheets: DocumentInfo[];
|
|
880
|
+
/** Human-readable status message. */
|
|
881
|
+
message: string;
|
|
882
|
+
}
|
|
883
|
+
/** Body for `client.documents.createText()`. */
|
|
884
|
+
interface CreateTextDocumentBody {
|
|
885
|
+
/** Document name. */
|
|
886
|
+
name: string;
|
|
887
|
+
/** Text content. */
|
|
888
|
+
content: string;
|
|
889
|
+
/** Optional description. */
|
|
890
|
+
description?: string;
|
|
891
|
+
}
|
|
892
|
+
/** Body for `client.documents.addWebsite()`. */
|
|
893
|
+
interface AddWebsiteDocumentBody {
|
|
894
|
+
/** Website URL to crawl. */
|
|
895
|
+
url: string;
|
|
896
|
+
/** Crawl mode. */
|
|
897
|
+
mode: "sitemap" | "crawl";
|
|
898
|
+
/** Optional crawl configuration. */
|
|
899
|
+
config?: {
|
|
900
|
+
urls?: string[];
|
|
901
|
+
max_depth?: number;
|
|
902
|
+
max_pages?: number;
|
|
903
|
+
};
|
|
904
|
+
/** Optional description. */
|
|
905
|
+
description?: string;
|
|
906
|
+
}
|
|
907
|
+
/** Body for `client.documents.createGoogleSheet()`. */
|
|
908
|
+
interface CreateGoogleSheetDocumentBody {
|
|
909
|
+
/** Document name. */
|
|
910
|
+
name: string;
|
|
911
|
+
/** Google Sheet URL. */
|
|
912
|
+
url: string;
|
|
913
|
+
/** Optional metadata. */
|
|
914
|
+
metadata?: {
|
|
915
|
+
hasHeaderRow?: boolean;
|
|
916
|
+
};
|
|
917
|
+
}
|
|
918
|
+
/** Body for `client.skills.attachDocumentsToCollection()`. */
|
|
919
|
+
interface AttachCollectionDocumentsBody {
|
|
920
|
+
/** Array of document IDs to link to the collection. */
|
|
921
|
+
documentIds: string[];
|
|
922
|
+
}
|
|
923
|
+
/** Response from `client.skills.attachDocumentsToCollection()`. */
|
|
924
|
+
interface AttachCollectionDocumentsResponse {
|
|
925
|
+
/** Status message. */
|
|
926
|
+
message: string;
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
/**
|
|
930
|
+
* Document resource.
|
|
931
|
+
*
|
|
932
|
+
* Provides endpoints to retrieve, create documents via file upload, text,
|
|
933
|
+
* website crawling, or Google Sheet import. Documents can then be attached to
|
|
934
|
+
* knowledge collections using `client.skills.attachDocumentsToCollection()`.
|
|
935
|
+
*
|
|
936
|
+
* Accessed via `client.documents`.
|
|
937
|
+
*/
|
|
938
|
+
declare class DocumentsResource extends BaseResource {
|
|
939
|
+
/**
|
|
940
|
+
* Get a document by ID.
|
|
941
|
+
*
|
|
942
|
+
* @param documentId - The document's UUID.
|
|
943
|
+
* @returns Detailed document information.
|
|
944
|
+
*
|
|
945
|
+
* @example
|
|
946
|
+
* ```ts
|
|
947
|
+
* const doc = await client.documents.get("doc-uuid");
|
|
948
|
+
* console.log(doc.name, doc.status, doc.processingProgress);
|
|
949
|
+
* ```
|
|
950
|
+
*/
|
|
951
|
+
get(documentId: string): Promise<DocumentDetail>;
|
|
952
|
+
/**
|
|
953
|
+
* Upload a file as a new document.
|
|
954
|
+
*
|
|
955
|
+
* @param file - File as a `Blob`, `File`, or `Buffer`.
|
|
956
|
+
* @param fileName - File name (required when passing a `Blob` or `Buffer`).
|
|
957
|
+
* @param description - Optional description.
|
|
958
|
+
* @returns Created document info.
|
|
959
|
+
*
|
|
960
|
+
* @example
|
|
961
|
+
* ```ts
|
|
962
|
+
* import fs from "fs";
|
|
963
|
+
*
|
|
964
|
+
* const buffer = fs.readFileSync("report.pdf");
|
|
965
|
+
* const doc = await client.documents.uploadFile(
|
|
966
|
+
* new Blob([buffer]),
|
|
967
|
+
* "report.pdf",
|
|
968
|
+
* "Q4 financial report"
|
|
969
|
+
* );
|
|
970
|
+
* console.log(doc.id, doc.status);
|
|
971
|
+
* ```
|
|
972
|
+
*/
|
|
973
|
+
uploadFile(file: Blob, fileName?: string, description?: string): Promise<DocumentInfo>;
|
|
974
|
+
/**
|
|
975
|
+
* Create a new document from inline text content.
|
|
976
|
+
*
|
|
977
|
+
* @param body - Document name, content, and optional description.
|
|
978
|
+
* @returns Created document info.
|
|
979
|
+
*
|
|
980
|
+
* @example
|
|
981
|
+
* ```ts
|
|
982
|
+
* const doc = await client.documents.createText({
|
|
983
|
+
* name: "Meeting Notes",
|
|
984
|
+
* content: "Key decisions from today's meeting..."
|
|
985
|
+
* });
|
|
986
|
+
* ```
|
|
987
|
+
*/
|
|
988
|
+
createText(body: CreateTextDocumentBody): Promise<DocumentInfo>;
|
|
989
|
+
/**
|
|
990
|
+
* Crawl a website and create document(s) from the content.
|
|
991
|
+
*
|
|
992
|
+
* @param body - URL, crawl mode, optional config and description.
|
|
993
|
+
* @returns Created document info (folder for crawled pages).
|
|
994
|
+
*
|
|
995
|
+
* @example
|
|
996
|
+
* ```ts
|
|
997
|
+
* const doc = await client.documents.addWebsite({
|
|
998
|
+
* url: "https://docs.example.com",
|
|
999
|
+
* mode: "sitemap"
|
|
1000
|
+
* });
|
|
1001
|
+
* ```
|
|
1002
|
+
*/
|
|
1003
|
+
addWebsite(body: AddWebsiteDocumentBody): Promise<DocumentInfo>;
|
|
1004
|
+
/**
|
|
1005
|
+
* Import a Google Sheet as document(s).
|
|
1006
|
+
*
|
|
1007
|
+
* @param body - Sheet name, URL, and optional metadata.
|
|
1008
|
+
* @returns Folder document, individual sheet documents, and status message.
|
|
1009
|
+
*
|
|
1010
|
+
* @example
|
|
1011
|
+
* ```ts
|
|
1012
|
+
* const result = await client.documents.createGoogleSheet({
|
|
1013
|
+
* name: "Product Catalog",
|
|
1014
|
+
* url: "https://docs.google.com/spreadsheets/d/..."
|
|
1015
|
+
* });
|
|
1016
|
+
* console.log(result.folder.id, result.sheets.length);
|
|
1017
|
+
* ```
|
|
1018
|
+
*/
|
|
1019
|
+
createGoogleSheet(body: CreateGoogleSheetDocumentBody): Promise<GoogleSheetResult>;
|
|
1020
|
+
list(params?: {
|
|
1021
|
+
page?: number;
|
|
1022
|
+
limit?: number;
|
|
1023
|
+
type?: string;
|
|
1024
|
+
status?: string;
|
|
1025
|
+
parentId?: string;
|
|
1026
|
+
collectionId?: string;
|
|
1027
|
+
search?: string;
|
|
1028
|
+
isFolder?: boolean;
|
|
1029
|
+
}): Promise<PageResponse<any>>;
|
|
1030
|
+
update(documentId: string, body: {
|
|
1031
|
+
name?: string;
|
|
1032
|
+
description?: string;
|
|
1033
|
+
tags?: string[];
|
|
1034
|
+
}): Promise<any>;
|
|
1035
|
+
delete(documentId: string): Promise<any>;
|
|
1036
|
+
getDownloadUrl(documentId: string): Promise<{
|
|
1037
|
+
url: string;
|
|
1038
|
+
expiresAt?: string;
|
|
1039
|
+
}>;
|
|
1040
|
+
listChildren(documentId: string, params?: {
|
|
1041
|
+
page?: number;
|
|
1042
|
+
limit?: number;
|
|
1043
|
+
}): Promise<PageResponse<any>>;
|
|
1044
|
+
reprocess(documentId: string): Promise<any>;
|
|
1045
|
+
createFolder(body: {
|
|
1046
|
+
name: string;
|
|
1047
|
+
parentId?: string;
|
|
1048
|
+
}): Promise<any>;
|
|
1049
|
+
}
|
|
1050
|
+
|
|
1051
|
+
/** A participant in an emulator session. */
|
|
1052
|
+
interface EmulatorParticipant {
|
|
1053
|
+
id: string;
|
|
1054
|
+
identifier: string;
|
|
1055
|
+
displayName?: string;
|
|
1056
|
+
}
|
|
1057
|
+
/** File attached to an emulator message. */
|
|
1058
|
+
interface EmulatorMessageFile {
|
|
1059
|
+
id: string;
|
|
1060
|
+
url: string;
|
|
1061
|
+
name?: string;
|
|
1062
|
+
mimeType?: string;
|
|
1063
|
+
}
|
|
1064
|
+
/** A message within an emulator session. */
|
|
1065
|
+
interface EmulatorMessage {
|
|
1066
|
+
id: string;
|
|
1067
|
+
content: string | null;
|
|
1068
|
+
type: string | null;
|
|
1069
|
+
createdAt: string;
|
|
1070
|
+
participantId?: string;
|
|
1071
|
+
files?: EmulatorMessageFile[];
|
|
1072
|
+
}
|
|
1073
|
+
/** Summary of an emulator session (returned by list). */
|
|
1074
|
+
interface EmulatorSession {
|
|
1075
|
+
id: string;
|
|
1076
|
+
deploymentId: string;
|
|
1077
|
+
chatId: string | null;
|
|
1078
|
+
participants: EmulatorParticipant[];
|
|
1079
|
+
emulatedChannelType: string;
|
|
1080
|
+
createdAt: string;
|
|
1081
|
+
}
|
|
1082
|
+
/** Detailed emulator session with messages (returned by get). */
|
|
1083
|
+
interface EmulatorSessionDetail extends EmulatorSession {
|
|
1084
|
+
messages: EmulatorMessage[];
|
|
1085
|
+
}
|
|
1086
|
+
/** Debug information returned after sending a message. */
|
|
1087
|
+
interface EmulatorDebugInfo {
|
|
1088
|
+
agentId: string | null;
|
|
1089
|
+
modelUsed: string | null;
|
|
1090
|
+
tokensUsed: {
|
|
1091
|
+
input: number;
|
|
1092
|
+
output: number;
|
|
1093
|
+
total: number;
|
|
1094
|
+
};
|
|
1095
|
+
latencyMs: number;
|
|
1096
|
+
toolsInvoked: string[];
|
|
1097
|
+
traceId?: string;
|
|
1098
|
+
runId?: string;
|
|
1099
|
+
runStatus?: string;
|
|
1100
|
+
}
|
|
1101
|
+
/** Result of sending a message in an emulator session. */
|
|
1102
|
+
interface EmulatorSendMessageResult {
|
|
1103
|
+
chatId: string;
|
|
1104
|
+
messageId: string;
|
|
1105
|
+
sessionId: string;
|
|
1106
|
+
debug?: EmulatorDebugInfo;
|
|
1107
|
+
}
|
|
1108
|
+
/** Summary of a scenario (returned by list). */
|
|
1109
|
+
interface EmulatorScenario {
|
|
1110
|
+
id: string;
|
|
1111
|
+
name: string;
|
|
1112
|
+
description: string | null;
|
|
1113
|
+
deploymentId: string;
|
|
1114
|
+
messageCount: number;
|
|
1115
|
+
createdAt: string;
|
|
1116
|
+
}
|
|
1117
|
+
/** A message within a scenario. */
|
|
1118
|
+
interface EmulatorScenarioMessage {
|
|
1119
|
+
id: string;
|
|
1120
|
+
sequenceOrder: number;
|
|
1121
|
+
participantId: string;
|
|
1122
|
+
participantName: string | null;
|
|
1123
|
+
content: string;
|
|
1124
|
+
attachments: unknown;
|
|
1125
|
+
delayMs: number;
|
|
1126
|
+
}
|
|
1127
|
+
/** Detailed scenario with messages (returned by get). */
|
|
1128
|
+
interface EmulatorScenarioDetail extends EmulatorScenario {
|
|
1129
|
+
messages: EmulatorScenarioMessage[];
|
|
1130
|
+
}
|
|
1131
|
+
interface CreateEmulatorSessionBody {
|
|
1132
|
+
participants?: Array<{
|
|
1133
|
+
identifier?: string;
|
|
1134
|
+
displayName?: string;
|
|
1135
|
+
}>;
|
|
1136
|
+
}
|
|
1137
|
+
interface SendEmulatorMessageBody {
|
|
1138
|
+
content: string;
|
|
1139
|
+
participantId?: string;
|
|
1140
|
+
knowledgeIds?: string[];
|
|
1141
|
+
images?: string[];
|
|
1142
|
+
}
|
|
1143
|
+
interface SaveEmulatorScenarioBody {
|
|
1144
|
+
name: string;
|
|
1145
|
+
description?: string;
|
|
1146
|
+
sessionId: string;
|
|
1147
|
+
deploymentId: string;
|
|
1148
|
+
}
|
|
1149
|
+
interface ReplayEmulatorScenarioBody {
|
|
1150
|
+
deploymentId: string;
|
|
1151
|
+
}
|
|
1152
|
+
interface ListEmulatorScenariosParams {
|
|
1153
|
+
deploymentId?: string;
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
/**
|
|
1157
|
+
* Emulator resource. Accessed via `client.emulator`.
|
|
1158
|
+
*
|
|
1159
|
+
* Test deployments without real external channels by creating emulator sessions,
|
|
1160
|
+
* sending messages, and managing replayable scenarios.
|
|
1161
|
+
*/
|
|
1162
|
+
declare class EmulatorResource extends BaseResource {
|
|
1163
|
+
/** Create a new emulator session for a deployment. */
|
|
1164
|
+
createSession(deploymentId: string, body?: CreateEmulatorSessionBody): Promise<EmulatorSession>;
|
|
1165
|
+
/** List emulator sessions for a deployment. */
|
|
1166
|
+
listSessions(deploymentId: string): Promise<EmulatorSession[]>;
|
|
1167
|
+
/** Get detailed information about an emulator session, including messages. */
|
|
1168
|
+
getSession(deploymentId: string, sessionId: string): Promise<EmulatorSessionDetail>;
|
|
1169
|
+
/** Send a message in an emulator session. Returns debug info about agent execution. */
|
|
1170
|
+
sendMessage(deploymentId: string, sessionId: string, body: SendEmulatorMessageBody): Promise<EmulatorSendMessageResult>;
|
|
1171
|
+
/** Delete an emulator session. */
|
|
1172
|
+
deleteSession(deploymentId: string, sessionId: string): Promise<void>;
|
|
1173
|
+
/** Save a scenario from an existing emulator session. */
|
|
1174
|
+
saveScenario(body: SaveEmulatorScenarioBody): Promise<EmulatorScenario>;
|
|
1175
|
+
/** List scenarios, optionally filtered by deployment. */
|
|
1176
|
+
listScenarios(params?: ListEmulatorScenariosParams): Promise<EmulatorScenario[]>;
|
|
1177
|
+
/** Get detailed information about a scenario, including its messages. */
|
|
1178
|
+
getScenario(scenarioId: string): Promise<EmulatorScenarioDetail>;
|
|
1179
|
+
/** Replay a scenario against a deployment. Runs asynchronously. */
|
|
1180
|
+
replayScenario(scenarioId: string, body: ReplayEmulatorScenarioBody): Promise<unknown>;
|
|
1181
|
+
/** Delete a scenario. */
|
|
1182
|
+
deleteScenario(scenarioId: string): Promise<void>;
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
declare class EvaluationsResource extends BaseResource {
|
|
1186
|
+
createSession(taskId: string, body: {
|
|
1187
|
+
name: string;
|
|
1188
|
+
description?: string;
|
|
1189
|
+
}): Promise<any>;
|
|
1190
|
+
listSessions(taskId: string, params?: {
|
|
1191
|
+
page?: number;
|
|
1192
|
+
limit?: number;
|
|
1193
|
+
}): Promise<PageResponse<any>>;
|
|
1194
|
+
getSession(taskId: string, sessionId: string): Promise<any>;
|
|
1195
|
+
deleteSession(taskId: string, sessionId: string): Promise<any>;
|
|
1196
|
+
getDatasetRows(taskId: string, sessionId: string, params?: {
|
|
1197
|
+
page?: number;
|
|
1198
|
+
limit?: number;
|
|
1199
|
+
}): Promise<PageResponse<any>>;
|
|
1200
|
+
addDatasetRow(taskId: string, sessionId: string, body: {
|
|
1201
|
+
input: unknown;
|
|
1202
|
+
expectedOutput?: unknown;
|
|
1203
|
+
}): Promise<any>;
|
|
1204
|
+
execute(taskId: string, sessionId: string): Promise<any>;
|
|
1205
|
+
judge(taskId: string, sessionId: string, body?: {
|
|
1206
|
+
judgeModel?: string;
|
|
1207
|
+
judgePrompt?: string;
|
|
1208
|
+
}): Promise<any>;
|
|
1209
|
+
getResults(taskId: string, sessionId: string, params?: {
|
|
1210
|
+
page?: number;
|
|
1211
|
+
limit?: number;
|
|
1212
|
+
}): Promise<PageResponse<any>>;
|
|
1213
|
+
listFormats(): Promise<any[]>;
|
|
1214
|
+
listJudges(): Promise<any[]>;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
/** A folder for organizing agents. Folders can be nested via `parentId`. */
|
|
1218
|
+
interface AgentFolder {
|
|
1219
|
+
/** Unique folder UUID. */
|
|
1220
|
+
id: string;
|
|
1221
|
+
/** Folder display name. */
|
|
1222
|
+
name: string;
|
|
1223
|
+
/** URL to the folder's icon. */
|
|
1224
|
+
iconUrl: string | null;
|
|
1225
|
+
/** Parent folder ID for nesting, or `null` for root-level folders. */
|
|
1226
|
+
parentId: string | null;
|
|
1227
|
+
/** ISO 8601 creation timestamp. */
|
|
1228
|
+
createdAt: string;
|
|
1229
|
+
/** ISO 8601 last-updated timestamp. */
|
|
1230
|
+
updatedAt: string | null;
|
|
1231
|
+
}
|
|
1232
|
+
/** Represents an agent's assignment to a folder. */
|
|
1233
|
+
interface FolderAssignment {
|
|
1234
|
+
/** Agent UUID. */
|
|
1235
|
+
agentId: string;
|
|
1236
|
+
/** Folder UUID the agent is assigned to. */
|
|
1237
|
+
folderId: string;
|
|
1238
|
+
}
|
|
1239
|
+
/** Response from `client.folders.list()`. */
|
|
1240
|
+
interface ListFoldersResponse {
|
|
1241
|
+
/** All folders in the organization. */
|
|
1242
|
+
folders: AgentFolder[];
|
|
1243
|
+
/** All agent-to-folder assignments. */
|
|
1244
|
+
assignments: FolderAssignment[];
|
|
1245
|
+
}
|
|
1246
|
+
/** Request body for `client.folders.create()`. */
|
|
1247
|
+
interface CreateFolderBody {
|
|
1248
|
+
/** Folder display name (required). */
|
|
1249
|
+
name: string;
|
|
1250
|
+
/** Parent folder UUID for nesting. Omit for a root-level folder. */
|
|
1251
|
+
parentId?: string;
|
|
1252
|
+
}
|
|
1253
|
+
/** Request body for `client.folders.update()`. All fields are optional. */
|
|
1254
|
+
interface UpdateFolderBody {
|
|
1255
|
+
/** New folder display name. */
|
|
1256
|
+
name?: string;
|
|
1257
|
+
/** New parent folder UUID. Set to `null` to move to root level. */
|
|
1258
|
+
parentId?: string | null;
|
|
1259
|
+
}
|
|
1260
|
+
/** Request body for `client.folders.assignAgent()`. */
|
|
1261
|
+
interface AssignAgentToFolderBody {
|
|
1262
|
+
/** Agent UUID to assign. */
|
|
1263
|
+
agentId: string;
|
|
1264
|
+
/** Target folder UUID, or `null` to remove the agent from its folder. */
|
|
1265
|
+
folderId: string | null;
|
|
1266
|
+
}
|
|
1267
|
+
/** Response from `client.folders.assignAgent()`. */
|
|
1268
|
+
interface AssignAgentToFolderResponse {
|
|
1269
|
+
/** Agent UUID. */
|
|
1270
|
+
agentId: string;
|
|
1271
|
+
/** Folder UUID the agent was assigned to, or `null` if removed. */
|
|
1272
|
+
folderId: string | null;
|
|
1273
|
+
/** Whether the assignment was successful. */
|
|
1274
|
+
assigned: boolean;
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
/**
|
|
1278
|
+
* Folder management resource. Accessed via `client.folders`.
|
|
1279
|
+
*
|
|
1280
|
+
* Folders organize agents into groups. They support nesting via `parentId`.
|
|
1281
|
+
* Agents are assigned to folders via `assignAgent()`.
|
|
1282
|
+
*/
|
|
1283
|
+
declare class FoldersResource extends BaseResource {
|
|
1284
|
+
/**
|
|
1285
|
+
* List all folders and their agent assignments.
|
|
1286
|
+
*
|
|
1287
|
+
* @returns All folders and a flat list of agent-to-folder assignments.
|
|
1288
|
+
*/
|
|
1289
|
+
list(): Promise<ListFoldersResponse>;
|
|
1290
|
+
/**
|
|
1291
|
+
* Create a new folder for organizing agents.
|
|
1292
|
+
*
|
|
1293
|
+
* @param body - Folder properties. `name` is required. Set `parentId` for nesting.
|
|
1294
|
+
* @returns The created folder.
|
|
1295
|
+
*/
|
|
1296
|
+
create(body: CreateFolderBody): Promise<AgentFolder>;
|
|
1297
|
+
/**
|
|
1298
|
+
* Update a folder's properties.
|
|
1299
|
+
*
|
|
1300
|
+
* @param folderId - Folder UUID.
|
|
1301
|
+
* @param body - Fields to update. Set `parentId` to `null` to move to root level.
|
|
1302
|
+
* @returns The updated folder.
|
|
1303
|
+
*/
|
|
1304
|
+
update(folderId: string, body: UpdateFolderBody): Promise<AgentFolder>;
|
|
1305
|
+
/**
|
|
1306
|
+
* Delete a folder. Agents in the folder are unassigned, not deleted.
|
|
1307
|
+
*
|
|
1308
|
+
* @param folderId - Folder UUID.
|
|
1309
|
+
* @returns Confirmation with the deleted folder's ID.
|
|
1310
|
+
*/
|
|
1311
|
+
delete(folderId: string): Promise<DeleteResponse>;
|
|
1312
|
+
/**
|
|
1313
|
+
* Assign an agent to a folder, or remove from folder.
|
|
1314
|
+
*
|
|
1315
|
+
* @param body - Agent ID and target folder ID. Set `folderId` to `null` to remove the agent from its folder.
|
|
1316
|
+
* @returns Confirmation of the assignment.
|
|
1317
|
+
*/
|
|
1318
|
+
assignAgent(body: AssignAgentToFolderBody): Promise<AssignAgentToFolderResponse>;
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
/** Model summary returned by `client.models.list()`. */
|
|
1322
|
+
interface ModelSummary {
|
|
1323
|
+
/** Unique model UUID. */
|
|
1324
|
+
id: string;
|
|
1325
|
+
/** Model identifier used in agent create/update (e.g. "GPT_4_1"). */
|
|
1326
|
+
modelId: string;
|
|
1327
|
+
/** Model provider (e.g. "OPEN_AI", "ANTHROPIC", "GOOGLE_AI"). */
|
|
1328
|
+
provider: string;
|
|
1329
|
+
/** Human-readable display name (e.g. "GPT-4.1"). */
|
|
1330
|
+
displayName: string;
|
|
1331
|
+
/** API model name sent to the provider. */
|
|
1332
|
+
modelName: string;
|
|
1333
|
+
/** Context window size in tokens, or null if unknown. */
|
|
1334
|
+
contextSize: number | null;
|
|
1335
|
+
/** Whether the model supports streaming responses. */
|
|
1336
|
+
streaming: boolean;
|
|
1337
|
+
/** Whether the model supports Anthropic extended thinking. */
|
|
1338
|
+
supportsThinking: boolean;
|
|
1339
|
+
/** Whether the model supports OpenAI reasoning (o3, o4-mini, etc.). */
|
|
1340
|
+
supportsReasoning: boolean;
|
|
1341
|
+
/** Whether the model is deprecated. */
|
|
1342
|
+
deprecated: boolean;
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
/**
|
|
1346
|
+
* Models resource. Accessed via `client.models`.
|
|
1347
|
+
*
|
|
1348
|
+
* Provides read-only access to the available AI models that can be
|
|
1349
|
+
* used when creating or updating agents.
|
|
1350
|
+
*/
|
|
1351
|
+
declare class ModelsResource extends BaseResource {
|
|
1352
|
+
constructor(http: HttpClient);
|
|
1353
|
+
/**
|
|
1354
|
+
* List all enabled AI models available for agents.
|
|
1355
|
+
*
|
|
1356
|
+
* @returns Array of model summaries with identifiers, providers, and capabilities.
|
|
1357
|
+
*/
|
|
1358
|
+
list(): Promise<{
|
|
1359
|
+
models: ModelSummary[];
|
|
1360
|
+
}>;
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
interface PromptAssistantChatBody {
|
|
1364
|
+
message: string;
|
|
1365
|
+
threadId?: string;
|
|
1366
|
+
mode: "agent" | "ai-task";
|
|
1367
|
+
}
|
|
1368
|
+
interface PromptAssistantChatResponse {
|
|
1369
|
+
threadId: string;
|
|
1370
|
+
response: string;
|
|
1371
|
+
status: "in_progress" | "generating" | "completed" | "failed";
|
|
1372
|
+
}
|
|
1373
|
+
interface PromptAssistantThreadMessage {
|
|
1374
|
+
role: string;
|
|
1375
|
+
content: string;
|
|
1376
|
+
timestamp: string;
|
|
1377
|
+
}
|
|
1378
|
+
interface PromptResult {
|
|
1379
|
+
prompt: string;
|
|
1380
|
+
name: string;
|
|
1381
|
+
description: string;
|
|
1382
|
+
input?: {
|
|
1383
|
+
type: "json" | "text";
|
|
1384
|
+
schema?: Record<string, unknown>;
|
|
1385
|
+
};
|
|
1386
|
+
output?: {
|
|
1387
|
+
type: "json" | "text";
|
|
1388
|
+
schema?: Record<string, unknown>;
|
|
1389
|
+
};
|
|
1390
|
+
agentFields?: Record<string, unknown>;
|
|
1391
|
+
}
|
|
1392
|
+
interface PromptAssistantThreadResponse {
|
|
1393
|
+
threadId: string;
|
|
1394
|
+
status: "in_progress" | "generating" | "completed" | "failed";
|
|
1395
|
+
messages: PromptAssistantThreadMessage[];
|
|
1396
|
+
promptResult?: PromptResult;
|
|
1397
|
+
}
|
|
1398
|
+
declare class PromptAssistantResource extends BaseResource {
|
|
1399
|
+
chat(body: PromptAssistantChatBody): Promise<PromptAssistantChatResponse>;
|
|
1400
|
+
getThread(threadId: string): Promise<PromptAssistantThreadResponse>;
|
|
1401
|
+
deleteThread(threadId: string): Promise<{
|
|
1402
|
+
deleted: boolean;
|
|
1403
|
+
}>;
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
/** Common query parameters for all skills list endpoints. */
|
|
1407
|
+
interface ListSkillsCommonParams {
|
|
1408
|
+
/** Free-text search within names and descriptions. */
|
|
1409
|
+
search?: string;
|
|
1410
|
+
/** Max results to return (default 20, max 100). */
|
|
1411
|
+
limit?: number;
|
|
1412
|
+
/** Offset for pagination (default 0). */
|
|
1413
|
+
offset?: number;
|
|
1414
|
+
}
|
|
1415
|
+
/** A workflow (automation) that can be attached to an agent as a WORKFLOW tool. */
|
|
1416
|
+
interface WorkflowSummary {
|
|
1417
|
+
/** Unique workflow ID. */
|
|
1418
|
+
id: string;
|
|
1419
|
+
/** Display name. */
|
|
1420
|
+
name: string;
|
|
1421
|
+
/** Description of what the workflow does. */
|
|
1422
|
+
description: string | null;
|
|
1423
|
+
/** Workflow status: "DRAFT", "PUBLISHED", or "ARCHIVED". */
|
|
1424
|
+
status: string;
|
|
1425
|
+
/** Trigger type: "AGENT", "WEBHOOK", "SCHEDULE", or "UNDETERMINED". */
|
|
1426
|
+
triggerType: string;
|
|
1427
|
+
/** URL to the workflow's icon, if any. */
|
|
1428
|
+
iconUrl: string | null;
|
|
1429
|
+
/**
|
|
1430
|
+
* JSON Schema describing the input the agent must provide when triggering
|
|
1431
|
+
* this workflow. `null` if the workflow takes no structured input.
|
|
1432
|
+
*/
|
|
1433
|
+
agentInputSchema: unknown | null;
|
|
1434
|
+
/** ISO 8601 creation timestamp. */
|
|
1435
|
+
createdAt: string;
|
|
1436
|
+
/** ISO 8601 last-updated timestamp. */
|
|
1437
|
+
updatedAt: string;
|
|
1438
|
+
}
|
|
1439
|
+
/** Response from `client.skills.listWorkflows()`. */
|
|
1440
|
+
interface ListWorkflowsResponse {
|
|
1441
|
+
/** Matching workflows (paginated). */
|
|
1442
|
+
items: WorkflowSummary[];
|
|
1443
|
+
/** Total number of matching workflows. */
|
|
1444
|
+
total: number;
|
|
1445
|
+
}
|
|
1446
|
+
/** An AI task summary (list view). */
|
|
1447
|
+
interface TaskSummary {
|
|
1448
|
+
/** Unique task ID. */
|
|
1449
|
+
id: string;
|
|
1450
|
+
/** Display name. */
|
|
1451
|
+
name: string;
|
|
1452
|
+
/** Description of what the task does. */
|
|
1453
|
+
description: string | null;
|
|
1454
|
+
/** Task category (e.g. "GENERATION", "CLASSIFICATION", "EXTRACTION"). */
|
|
1455
|
+
category: string;
|
|
1456
|
+
/** Input format: "TEXT" or "JSON". */
|
|
1457
|
+
inputFormat: string;
|
|
1458
|
+
/** Output format: "TEXT", "JSON", or "TEMPLATE". */
|
|
1459
|
+
outputFormat: string;
|
|
1460
|
+
/** Model provider (e.g. "openai", "anthropic"). */
|
|
1461
|
+
modelProvider: string;
|
|
1462
|
+
/** Model name (e.g. "gpt-4o"). */
|
|
1463
|
+
modelName: string;
|
|
1464
|
+
/** ISO 8601 creation timestamp. */
|
|
1465
|
+
createdAt: string;
|
|
1466
|
+
/** ISO 8601 last-updated timestamp. */
|
|
1467
|
+
updatedAt: string;
|
|
1468
|
+
}
|
|
1469
|
+
/** Full AI task detail (extends summary with schemas). */
|
|
1470
|
+
interface TaskDetail extends TaskSummary {
|
|
1471
|
+
/**
|
|
1472
|
+
* JSON Schema describing the structured input when `inputFormat === "JSON"`.
|
|
1473
|
+
* `null` for text-only input tasks.
|
|
1474
|
+
*/
|
|
1475
|
+
jsonInputSchema: unknown | null;
|
|
1476
|
+
/**
|
|
1477
|
+
* JSON Schema describing the structured output when `outputFormat === "JSON"`.
|
|
1478
|
+
* `null` for text/template output tasks.
|
|
1479
|
+
*/
|
|
1480
|
+
jsonOutputSchema: unknown | null;
|
|
1481
|
+
/** Whether the task supports multimodal (image) input. */
|
|
1482
|
+
multimodal: boolean;
|
|
1483
|
+
/**
|
|
1484
|
+
* Document template ID when `outputFormat === "TEMPLATE"`.
|
|
1485
|
+
* `null` otherwise.
|
|
1486
|
+
*/
|
|
1487
|
+
documentTemplateId: string | null;
|
|
1488
|
+
}
|
|
1489
|
+
/** Response from `client.skills.listTasks()`. */
|
|
1490
|
+
interface ListTasksResponse {
|
|
1491
|
+
/** Matching AI tasks (paginated). */
|
|
1492
|
+
items: TaskSummary[];
|
|
1493
|
+
/** Total number of matching tasks. */
|
|
1494
|
+
total: number;
|
|
1495
|
+
}
|
|
1496
|
+
/** A knowledge collection summary (list view). */
|
|
1497
|
+
interface CollectionSummary {
|
|
1498
|
+
/** Unique collection ID. */
|
|
1499
|
+
id: string;
|
|
1500
|
+
/** Internal name. */
|
|
1501
|
+
name: string;
|
|
1502
|
+
/** Human-readable display name. */
|
|
1503
|
+
displayName: string | null;
|
|
1504
|
+
/** Description of the collection's contents. */
|
|
1505
|
+
description: string | null;
|
|
1506
|
+
/** Number of documents in the collection. */
|
|
1507
|
+
documentCount: number;
|
|
1508
|
+
/** Whether the collection is active. */
|
|
1509
|
+
isActive: boolean;
|
|
1510
|
+
/** ISO 8601 creation timestamp. */
|
|
1511
|
+
createdAt: string;
|
|
1512
|
+
/** ISO 8601 last-updated timestamp. */
|
|
1513
|
+
updatedAt: string;
|
|
1514
|
+
}
|
|
1515
|
+
/** Full collection detail (extends summary with retrieval settings). */
|
|
1516
|
+
interface CollectionDetail extends CollectionSummary {
|
|
1517
|
+
/** Number of chunks to retrieve per query. */
|
|
1518
|
+
k: number;
|
|
1519
|
+
/** Reranker model name, if configured. */
|
|
1520
|
+
reranker: string | null;
|
|
1521
|
+
/** Whether to use precise (exact) responses vs. generative answers. */
|
|
1522
|
+
preciseResponses: boolean;
|
|
1523
|
+
/** Whether to include document metadata in retrieval results. */
|
|
1524
|
+
includeMetadata: boolean;
|
|
1525
|
+
}
|
|
1526
|
+
/** Response from `client.skills.listCollections()`. */
|
|
1527
|
+
interface ListCollectionsResponse {
|
|
1528
|
+
/** Matching collections (paginated). */
|
|
1529
|
+
items: CollectionSummary[];
|
|
1530
|
+
/** Total number of matching collections. */
|
|
1531
|
+
total: number;
|
|
1532
|
+
}
|
|
1533
|
+
/** A document template summary (list view). */
|
|
1534
|
+
interface DocumentTemplateSummary {
|
|
1535
|
+
/** Unique template ID. */
|
|
1536
|
+
id: string;
|
|
1537
|
+
/** Display name. */
|
|
1538
|
+
name: string;
|
|
1539
|
+
/** Description of the template. */
|
|
1540
|
+
description: string | null;
|
|
1541
|
+
/** Template type: "WORD_FORMAT", "WORD_TEMPLATE", "POWERPOINT_TEMPLATE", etc. */
|
|
1542
|
+
type: string;
|
|
1543
|
+
/** Template status: "DRAFT" or "SAVED". */
|
|
1544
|
+
status: string;
|
|
1545
|
+
/** ISO 8601 creation timestamp. */
|
|
1546
|
+
createdAt: string;
|
|
1547
|
+
/** ISO 8601 last-updated timestamp. */
|
|
1548
|
+
updatedAt: string;
|
|
1549
|
+
}
|
|
1550
|
+
/** Full document template detail (extends summary with input schema). */
|
|
1551
|
+
interface DocumentTemplateDetail extends DocumentTemplateSummary {
|
|
1552
|
+
/** JSON schema describing the inputs needed to generate a document. */
|
|
1553
|
+
inputFormat: unknown | null;
|
|
1554
|
+
/** Per-slide input formats (for presentation templates). */
|
|
1555
|
+
slidesInputFormat: unknown[];
|
|
1556
|
+
/** URL to download the template file. */
|
|
1557
|
+
fileUrl: string | null;
|
|
1558
|
+
/** URL to preview the template. */
|
|
1559
|
+
previewFileUrl: string | null;
|
|
1560
|
+
}
|
|
1561
|
+
/** Response from `client.skills.listDocumentTemplates()`. */
|
|
1562
|
+
interface ListDocumentTemplatesResponse {
|
|
1563
|
+
/** Matching document templates (paginated). */
|
|
1564
|
+
items: DocumentTemplateSummary[];
|
|
1565
|
+
/** Total number of matching templates. */
|
|
1566
|
+
total: number;
|
|
1567
|
+
}
|
|
1568
|
+
/** Body for `client.skills.createDocumentTemplate()`. */
|
|
1569
|
+
interface CreateDocumentTemplateBody {
|
|
1570
|
+
/** Display name. */
|
|
1571
|
+
name: string;
|
|
1572
|
+
/** Description of the template. */
|
|
1573
|
+
description?: string;
|
|
1574
|
+
/** Template type. */
|
|
1575
|
+
type: "WORD_FORMAT" | "WORD_TEMPLATE" | "WORD_CONTENT" | "POWERPOINT_TEMPLATE" | "EXCEL_TEMPLATE";
|
|
1576
|
+
}
|
|
1577
|
+
/** Body for `client.skills.createTask()`. */
|
|
1578
|
+
interface CreateTaskBody {
|
|
1579
|
+
/** Display name. */
|
|
1580
|
+
name: string;
|
|
1581
|
+
/** Description of the task. */
|
|
1582
|
+
description?: string;
|
|
1583
|
+
/** Model name (must be a valid AI_MODELS key). */
|
|
1584
|
+
modelName: string;
|
|
1585
|
+
/** Model provider. */
|
|
1586
|
+
modelProvider: "OPEN_AI" | "ANTHROPIC" | "GOOGLE_AI";
|
|
1587
|
+
/** Prompt template. */
|
|
1588
|
+
prompt?: string;
|
|
1589
|
+
/** Temperature (0-2, default 0.7). */
|
|
1590
|
+
temperature?: number;
|
|
1591
|
+
/** Input format (default "text"). */
|
|
1592
|
+
inputFormat?: "text" | "json";
|
|
1593
|
+
/** Output format (default "text"). */
|
|
1594
|
+
outputFormat?: "text" | "json" | "template";
|
|
1595
|
+
/** Generation-specific settings (required). */
|
|
1596
|
+
generation: {
|
|
1597
|
+
/** Whether the task supports multimodal input. */
|
|
1598
|
+
multimodal?: boolean;
|
|
1599
|
+
/** Expected input description (required when inputFormat is "text"). */
|
|
1600
|
+
expectedInput?: string;
|
|
1601
|
+
/** JSON input schema (required when inputFormat is "json"). */
|
|
1602
|
+
jsonInputSchema?: unknown;
|
|
1603
|
+
/** Expected output description (required when outputFormat is "text"). */
|
|
1604
|
+
expectedOutput?: string;
|
|
1605
|
+
/** JSON output schema (required when outputFormat is "json"). */
|
|
1606
|
+
jsonOutputSchema?: unknown;
|
|
1607
|
+
/** Document template ID (required when outputFormat is "template"). */
|
|
1608
|
+
documentTemplateId?: string;
|
|
1609
|
+
};
|
|
1610
|
+
}
|
|
1611
|
+
/** Body for `client.skills.generateDocumentTemplate()`. */
|
|
1612
|
+
interface GenerateDocumentTemplateBody {
|
|
1613
|
+
/** Template variables to fill in. */
|
|
1614
|
+
variables: Record<string, unknown>;
|
|
1615
|
+
}
|
|
1616
|
+
/** Response from `client.skills.generateDocumentTemplate()`. */
|
|
1617
|
+
interface GenerateDocumentTemplateResponse {
|
|
1618
|
+
/** URL to the generated document. */
|
|
1619
|
+
url: string;
|
|
1620
|
+
}
|
|
1621
|
+
/** Body for `client.skills.executeTask()`. */
|
|
1622
|
+
interface ExecuteTaskBody {
|
|
1623
|
+
/** Input to the task — text string or structured JSON object. */
|
|
1624
|
+
input: string | Record<string, unknown>;
|
|
1625
|
+
}
|
|
1626
|
+
/** Response from `client.skills.executeTask()`. */
|
|
1627
|
+
interface ExecuteTaskResponse {
|
|
1628
|
+
/** Task output. */
|
|
1629
|
+
output: unknown;
|
|
1630
|
+
/** Output type (e.g. "TEXT", "JSON", "TEMPLATE"). */
|
|
1631
|
+
outputType: string;
|
|
1632
|
+
}
|
|
1633
|
+
/** An external tool (CUSTOM_MANIFEST) detail. */
|
|
1634
|
+
interface ExternalToolDetail {
|
|
1635
|
+
/** Unique external tool ID. */
|
|
1636
|
+
id: string;
|
|
1637
|
+
/** Display name. */
|
|
1638
|
+
name: string;
|
|
1639
|
+
/** Description. */
|
|
1640
|
+
description: string | null;
|
|
1641
|
+
/** Always "CUSTOM_MANIFEST". */
|
|
1642
|
+
type: "CUSTOM_MANIFEST";
|
|
1643
|
+
/** Base endpoint URL. */
|
|
1644
|
+
endpointUrl: string | null;
|
|
1645
|
+
/** Status (e.g. "PUBLISHED"). */
|
|
1646
|
+
status: string;
|
|
1647
|
+
/** Number of actions extracted from the OpenAPI spec. */
|
|
1648
|
+
actionsCount: number;
|
|
1649
|
+
/** Auth type (e.g. "none", "service_http", "oauth"). */
|
|
1650
|
+
authType: string;
|
|
1651
|
+
/** ISO 8601 creation timestamp. */
|
|
1652
|
+
createdAt: string;
|
|
1653
|
+
}
|
|
1654
|
+
/** Response from `client.skills.listExternalTools()`. */
|
|
1655
|
+
interface ListExternalToolsResponse {
|
|
1656
|
+
/** Matching external tools (paginated). */
|
|
1657
|
+
items: ExternalToolDetail[];
|
|
1658
|
+
/** Total number of matching external tools. */
|
|
1659
|
+
total: number;
|
|
1660
|
+
}
|
|
1661
|
+
/** Auth configuration for external tools (discriminated union on `type`). */
|
|
1662
|
+
type ExternalToolAuth = {
|
|
1663
|
+
type: "none";
|
|
1664
|
+
} | {
|
|
1665
|
+
type: "service_http";
|
|
1666
|
+
apiKey: string;
|
|
1667
|
+
authorization_type: "basic" | "bearer" | "custom";
|
|
1668
|
+
custom_header_name?: string;
|
|
1669
|
+
custom_header_prefix?: string;
|
|
1670
|
+
} | {
|
|
1671
|
+
type: "user_http";
|
|
1672
|
+
authorization_type: "basic" | "bearer" | "custom";
|
|
1673
|
+
custom_header_name?: string;
|
|
1674
|
+
custom_header_prefix?: string;
|
|
1675
|
+
} | {
|
|
1676
|
+
type: "oauth";
|
|
1677
|
+
grant_type: string;
|
|
1678
|
+
client_id: string;
|
|
1679
|
+
client_secret: string;
|
|
1680
|
+
client_url: string;
|
|
1681
|
+
authorization_url: string;
|
|
1682
|
+
scope?: string;
|
|
1683
|
+
tokenExchangeMethod?: string;
|
|
1684
|
+
} | {
|
|
1685
|
+
type: "user_oauth";
|
|
1686
|
+
grant_type: string;
|
|
1687
|
+
authorization_type?: "basic" | "bearer" | "custom";
|
|
1688
|
+
custom_header_name?: string;
|
|
1689
|
+
custom_header_prefix?: string;
|
|
1690
|
+
} | {
|
|
1691
|
+
type: "keys";
|
|
1692
|
+
};
|
|
1693
|
+
/** Body for `client.skills.createExternalTool()`. */
|
|
1694
|
+
interface CreateExternalToolBody {
|
|
1695
|
+
/** Display name. */
|
|
1696
|
+
name: string;
|
|
1697
|
+
/** Description. */
|
|
1698
|
+
description?: string;
|
|
1699
|
+
/** OpenAPI spec as a JSON or YAML string. */
|
|
1700
|
+
openApiSpec: string;
|
|
1701
|
+
/** Base endpoint URL. */
|
|
1702
|
+
endpointUrl: string;
|
|
1703
|
+
/** Auth configuration. */
|
|
1704
|
+
auth: ExternalToolAuth;
|
|
1705
|
+
}
|
|
1706
|
+
/** Body for `client.skills.testExternalTool()`. */
|
|
1707
|
+
interface TestExternalToolBody {
|
|
1708
|
+
/** Which action (operationId) to call. */
|
|
1709
|
+
operationId: string;
|
|
1710
|
+
/** Flat key-value input parameters. */
|
|
1711
|
+
input: Record<string, unknown>;
|
|
1712
|
+
/** Optional stored credential ID for auth. */
|
|
1713
|
+
toolCredentialId?: string;
|
|
1714
|
+
}
|
|
1715
|
+
/** Response from `client.skills.testExternalTool()`. */
|
|
1716
|
+
interface TestExternalToolResponse {
|
|
1717
|
+
/** Whether the execution succeeded or failed. */
|
|
1718
|
+
status: "success" | "error";
|
|
1719
|
+
/** Execution output (null on error). */
|
|
1720
|
+
output: unknown;
|
|
1721
|
+
/** Error message when status is "error". */
|
|
1722
|
+
error?: string;
|
|
1723
|
+
/** How long the execution took in milliseconds. */
|
|
1724
|
+
executionTimeMs: number;
|
|
1725
|
+
}
|
|
1726
|
+
/** Body for `client.skills.createCollection()`. */
|
|
1727
|
+
interface CreateCollectionBody {
|
|
1728
|
+
/** Internal name (unique per org). */
|
|
1729
|
+
name: string;
|
|
1730
|
+
/** Human-readable display name. */
|
|
1731
|
+
displayName?: string;
|
|
1732
|
+
/** Description of the collection. */
|
|
1733
|
+
description?: string;
|
|
1734
|
+
/** Number of chunks to retrieve per query (default 10). */
|
|
1735
|
+
k?: number;
|
|
1736
|
+
/** Reranker model name. */
|
|
1737
|
+
reranker?: string;
|
|
1738
|
+
/** Whether to use precise responses (default false). */
|
|
1739
|
+
preciseResponses?: boolean;
|
|
1740
|
+
/** Whether to include metadata (default false). */
|
|
1741
|
+
includeMetadata?: boolean;
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
/**
|
|
1745
|
+
* Skills discovery resource.
|
|
1746
|
+
*
|
|
1747
|
+
* Provides read-only access to the four skill types that can be attached
|
|
1748
|
+
* to agents: workflows, AI tasks, knowledge collections, and document
|
|
1749
|
+
* templates.
|
|
1750
|
+
*
|
|
1751
|
+
* ```
|
|
1752
|
+
* client.skills.listWorkflows() — List org's workflows
|
|
1753
|
+
* client.skills.getWorkflow(id) — Get workflow detail
|
|
1754
|
+
* client.skills.listTasks() — List org's AI tasks
|
|
1755
|
+
* client.skills.getTask(id) — Get task detail with schemas
|
|
1756
|
+
* client.skills.listCollections() — List org's knowledge collections
|
|
1757
|
+
* client.skills.getCollection(id) — Get collection detail
|
|
1758
|
+
* client.skills.listDocumentTemplates() — List org's document templates
|
|
1759
|
+
* client.skills.getDocumentTemplate(id) — Get template detail with inputFormat
|
|
1760
|
+
* ```
|
|
1761
|
+
*
|
|
1762
|
+
* Accessed via `client.skills`.
|
|
1763
|
+
*/
|
|
1764
|
+
declare class SkillsResource extends BaseResource {
|
|
1765
|
+
/**
|
|
1766
|
+
* List the organization's workflows.
|
|
1767
|
+
*
|
|
1768
|
+
* @param params - Optional search, limit, and offset.
|
|
1769
|
+
* @returns Matching workflows with `agentInputSchema` and total count.
|
|
1770
|
+
*
|
|
1771
|
+
* @example
|
|
1772
|
+
* ```ts
|
|
1773
|
+
* const { items, total } = await client.skills.listWorkflows({ search: "onboarding" });
|
|
1774
|
+
* for (const wf of items) {
|
|
1775
|
+
* console.log(`${wf.name} (${wf.status}) - trigger: ${wf.triggerType}`);
|
|
1776
|
+
* }
|
|
1777
|
+
* ```
|
|
1778
|
+
*/
|
|
1779
|
+
listWorkflows(params?: ListSkillsCommonParams): Promise<ListWorkflowsResponse>;
|
|
1780
|
+
/**
|
|
1781
|
+
* Get a single workflow by ID.
|
|
1782
|
+
*
|
|
1783
|
+
* @param workflowId - Workflow UUID.
|
|
1784
|
+
* @returns Full workflow detail including `agentInputSchema`.
|
|
1785
|
+
*
|
|
1786
|
+
* @example
|
|
1787
|
+
* ```ts
|
|
1788
|
+
* const wf = await client.skills.getWorkflow("workflow-uuid");
|
|
1789
|
+
* console.log(wf.agentInputSchema); // JSON Schema the agent fills
|
|
1790
|
+
* ```
|
|
1791
|
+
*/
|
|
1792
|
+
getWorkflow(workflowId: string): Promise<WorkflowSummary>;
|
|
1793
|
+
/**
|
|
1794
|
+
* List the organization's AI tasks.
|
|
1795
|
+
*
|
|
1796
|
+
* @param params - Optional search, limit, and offset.
|
|
1797
|
+
* @returns Matching tasks (summary view) and total count.
|
|
1798
|
+
*
|
|
1799
|
+
* @example
|
|
1800
|
+
* ```ts
|
|
1801
|
+
* const { items, total } = await client.skills.listTasks({ limit: 50 });
|
|
1802
|
+
* for (const task of items) {
|
|
1803
|
+
* console.log(`${task.name} (${task.category}) - ${task.inputFormat} → ${task.outputFormat}`);
|
|
1804
|
+
* }
|
|
1805
|
+
* ```
|
|
1806
|
+
*/
|
|
1807
|
+
listTasks(params?: ListSkillsCommonParams): Promise<ListTasksResponse>;
|
|
1808
|
+
/**
|
|
1809
|
+
* Get a single AI task by ID with full detail.
|
|
1810
|
+
*
|
|
1811
|
+
* Includes `jsonInputSchema` and `jsonOutputSchema` when the task uses
|
|
1812
|
+
* structured JSON input/output.
|
|
1813
|
+
*
|
|
1814
|
+
* @param taskId - AI Task UUID.
|
|
1815
|
+
* @returns Full task detail.
|
|
1816
|
+
*
|
|
1817
|
+
* @example
|
|
1818
|
+
* ```ts
|
|
1819
|
+
* const task = await client.skills.getTask("task-uuid");
|
|
1820
|
+
* if (task.jsonInputSchema) {
|
|
1821
|
+
* console.log("Input schema:", task.jsonInputSchema);
|
|
1822
|
+
* }
|
|
1823
|
+
* ```
|
|
1824
|
+
*/
|
|
1825
|
+
getTask(taskId: string): Promise<TaskDetail>;
|
|
1826
|
+
/**
|
|
1827
|
+
* List the organization's knowledge collections.
|
|
1828
|
+
*
|
|
1829
|
+
* @param params - Optional search, limit, and offset.
|
|
1830
|
+
* @returns Matching collections (summary view) and total count.
|
|
1831
|
+
*
|
|
1832
|
+
* @example
|
|
1833
|
+
* ```ts
|
|
1834
|
+
* const { items } = await client.skills.listCollections();
|
|
1835
|
+
* for (const col of items) {
|
|
1836
|
+
* console.log(`${col.name}: ${col.documentCount} documents`);
|
|
1837
|
+
* }
|
|
1838
|
+
* ```
|
|
1839
|
+
*/
|
|
1840
|
+
listCollections(params?: ListSkillsCommonParams): Promise<ListCollectionsResponse>;
|
|
1841
|
+
/**
|
|
1842
|
+
* Get a single knowledge collection by ID with retrieval settings.
|
|
1843
|
+
*
|
|
1844
|
+
* @param collectionId - Collection UUID.
|
|
1845
|
+
* @returns Full collection detail with `k`, `reranker`, etc.
|
|
1846
|
+
*
|
|
1847
|
+
* @example
|
|
1848
|
+
* ```ts
|
|
1849
|
+
* const col = await client.skills.getCollection("collection-uuid");
|
|
1850
|
+
* console.log(`k=${col.k}, reranker=${col.reranker}`);
|
|
1851
|
+
* ```
|
|
1852
|
+
*/
|
|
1853
|
+
getCollection(collectionId: string): Promise<CollectionDetail>;
|
|
1854
|
+
/**
|
|
1855
|
+
* List the organization's document templates.
|
|
1856
|
+
*
|
|
1857
|
+
* @param params - Optional search, limit, and offset.
|
|
1858
|
+
* @returns Matching templates (summary view) and total count.
|
|
1859
|
+
*
|
|
1860
|
+
* @example
|
|
1861
|
+
* ```ts
|
|
1862
|
+
* const { items } = await client.skills.listDocumentTemplates({ search: "invoice" });
|
|
1863
|
+
* for (const tpl of items) {
|
|
1864
|
+
* console.log(`${tpl.name} (${tpl.type}) - ${tpl.status}`);
|
|
1865
|
+
* }
|
|
1866
|
+
* ```
|
|
1867
|
+
*/
|
|
1868
|
+
listDocumentTemplates(params?: ListSkillsCommonParams): Promise<ListDocumentTemplatesResponse>;
|
|
1869
|
+
/**
|
|
1870
|
+
* Get a single document template by ID with full detail.
|
|
1871
|
+
*
|
|
1872
|
+
* Includes `inputFormat` (JSON schema of required inputs) and
|
|
1873
|
+
* `slidesInputFormat` (per-slide schemas for presentations).
|
|
1874
|
+
*
|
|
1875
|
+
* @param templateId - Document template UUID.
|
|
1876
|
+
* @returns Full template detail.
|
|
1877
|
+
*
|
|
1878
|
+
* @example
|
|
1879
|
+
* ```ts
|
|
1880
|
+
* const tpl = await client.skills.getDocumentTemplate("template-uuid");
|
|
1881
|
+
* console.log("Input format:", tpl.inputFormat);
|
|
1882
|
+
* ```
|
|
1883
|
+
*/
|
|
1884
|
+
getDocumentTemplate(templateId: string): Promise<DocumentTemplateDetail>;
|
|
1885
|
+
/**
|
|
1886
|
+
* Create a new document template (metadata only).
|
|
1887
|
+
*
|
|
1888
|
+
* Upload a file separately with `uploadDocumentTemplateFile`.
|
|
1889
|
+
*
|
|
1890
|
+
* @param body - Template name, optional description, and type.
|
|
1891
|
+
* @returns Created template detail.
|
|
1892
|
+
*
|
|
1893
|
+
* @example
|
|
1894
|
+
* ```ts
|
|
1895
|
+
* const tpl = await client.skills.createDocumentTemplate({
|
|
1896
|
+
* name: "Invoice",
|
|
1897
|
+
* type: "WORD_FORMAT"
|
|
1898
|
+
* });
|
|
1899
|
+
* ```
|
|
1900
|
+
*/
|
|
1901
|
+
createDocumentTemplate(body: CreateDocumentTemplateBody): Promise<DocumentTemplateDetail>;
|
|
1902
|
+
/**
|
|
1903
|
+
* Upload a file and link it to an existing document template.
|
|
1904
|
+
*
|
|
1905
|
+
* @param templateId - Document template UUID.
|
|
1906
|
+
* @param file - File as a `Blob`, `File`, or `Buffer`.
|
|
1907
|
+
* @param fileName - File name (required when passing a `Blob` or `Buffer`).
|
|
1908
|
+
* @returns Updated template detail with `fileUrl` populated.
|
|
1909
|
+
*
|
|
1910
|
+
* @example
|
|
1911
|
+
* ```ts
|
|
1912
|
+
* import fs from "fs";
|
|
1913
|
+
*
|
|
1914
|
+
* const buffer = fs.readFileSync("template.docx");
|
|
1915
|
+
* const tpl = await client.skills.uploadDocumentTemplateFile(
|
|
1916
|
+
* "template-uuid",
|
|
1917
|
+
* new Blob([buffer]),
|
|
1918
|
+
* "template.docx"
|
|
1919
|
+
* );
|
|
1920
|
+
* console.log(tpl.fileUrl);
|
|
1921
|
+
* ```
|
|
1922
|
+
*/
|
|
1923
|
+
uploadDocumentTemplateFile(templateId: string, file: Blob, fileName?: string): Promise<DocumentTemplateDetail>;
|
|
1924
|
+
/**
|
|
1925
|
+
* Create a new GENERATION AI task.
|
|
1926
|
+
*
|
|
1927
|
+
* The category is hardcoded to "GENERATION". The `modelName` is validated
|
|
1928
|
+
* against the available AI models — on invalid model, returns 400 with
|
|
1929
|
+
* the list of valid model names.
|
|
1930
|
+
*
|
|
1931
|
+
* @param body - Task definition.
|
|
1932
|
+
* @returns Created task detail.
|
|
1933
|
+
*
|
|
1934
|
+
* @example
|
|
1935
|
+
* ```ts
|
|
1936
|
+
* const task = await client.skills.createTask({
|
|
1937
|
+
* name: "Summarize Email",
|
|
1938
|
+
* modelName: "gpt-4o",
|
|
1939
|
+
* modelProvider: "OPEN_AI",
|
|
1940
|
+
* generation: {
|
|
1941
|
+
* expectedInput: "Raw email text",
|
|
1942
|
+
* expectedOutput: "A concise 2-sentence summary"
|
|
1943
|
+
* }
|
|
1944
|
+
* });
|
|
1945
|
+
* ```
|
|
1946
|
+
*/
|
|
1947
|
+
createTask(body: CreateTaskBody): Promise<TaskDetail>;
|
|
1948
|
+
/**
|
|
1949
|
+
* Create a new knowledge collection.
|
|
1950
|
+
*
|
|
1951
|
+
* @param body - Collection name and optional settings.
|
|
1952
|
+
* @returns Created collection detail.
|
|
1953
|
+
*
|
|
1954
|
+
* @example
|
|
1955
|
+
* ```ts
|
|
1956
|
+
* const col = await client.skills.createCollection({
|
|
1957
|
+
* name: "product-docs",
|
|
1958
|
+
* displayName: "Product Documentation",
|
|
1959
|
+
* k: 15
|
|
1960
|
+
* });
|
|
1961
|
+
* ```
|
|
1962
|
+
*/
|
|
1963
|
+
createCollection(body: CreateCollectionBody): Promise<CollectionDetail>;
|
|
1964
|
+
/**
|
|
1965
|
+
* List the organization's external tools (CUSTOM_MANIFEST).
|
|
1966
|
+
*
|
|
1967
|
+
* @param params - Optional search, limit, and offset.
|
|
1968
|
+
* @returns Matching external tools and total count.
|
|
1969
|
+
*
|
|
1970
|
+
* @example
|
|
1971
|
+
* ```ts
|
|
1972
|
+
* const { items, total } = await client.skills.listExternalTools({ search: "weather" });
|
|
1973
|
+
* for (const tool of items) {
|
|
1974
|
+
* console.log(`${tool.name} (${tool.actionsCount} actions) - auth: ${tool.authType}`);
|
|
1975
|
+
* }
|
|
1976
|
+
* ```
|
|
1977
|
+
*/
|
|
1978
|
+
listExternalTools(params?: ListSkillsCommonParams): Promise<ListExternalToolsResponse>;
|
|
1979
|
+
/**
|
|
1980
|
+
* Get a single external tool by ID.
|
|
1981
|
+
*
|
|
1982
|
+
* @param externalToolId - External tool UUID.
|
|
1983
|
+
* @returns Full external tool detail.
|
|
1984
|
+
*
|
|
1985
|
+
* @example
|
|
1986
|
+
* ```ts
|
|
1987
|
+
* const tool = await client.skills.getExternalTool("tool-uuid");
|
|
1988
|
+
* console.log(`${tool.name}: ${tool.actionsCount} actions, auth: ${tool.authType}`);
|
|
1989
|
+
* ```
|
|
1990
|
+
*/
|
|
1991
|
+
getExternalTool(externalToolId: string): Promise<ExternalToolDetail>;
|
|
1992
|
+
/**
|
|
1993
|
+
* Create a new external tool from an OpenAPI spec.
|
|
1994
|
+
*
|
|
1995
|
+
* Parses the provided OpenAPI spec (JSON or YAML), extracts actions,
|
|
1996
|
+
* and creates the tool with the specified auth configuration.
|
|
1997
|
+
*
|
|
1998
|
+
* @param body - Tool name, OpenAPI spec, endpoint URL, and auth config.
|
|
1999
|
+
* @returns Created external tool detail with `actionsCount`.
|
|
2000
|
+
*
|
|
2001
|
+
* @example
|
|
2002
|
+
* ```ts
|
|
2003
|
+
* const tool = await client.skills.createExternalTool({
|
|
2004
|
+
* name: "Weather API",
|
|
2005
|
+
* openApiSpec: '{"openapi":"3.0.0",...}',
|
|
2006
|
+
* endpointUrl: "https://api.weather.com",
|
|
2007
|
+
* auth: { type: "service_http", apiKey: "sk-...", authorization_type: "bearer" }
|
|
2008
|
+
* });
|
|
2009
|
+
* console.log(`Created: ${tool.name} with ${tool.actionsCount} actions`);
|
|
2010
|
+
* ```
|
|
2011
|
+
*/
|
|
2012
|
+
createExternalTool(body: CreateExternalToolBody): Promise<ExternalToolDetail>;
|
|
2013
|
+
/**
|
|
2014
|
+
* Test an external tool action by operationId with input parameters.
|
|
2015
|
+
*
|
|
2016
|
+
* Executes a specific action on an external tool and returns the result.
|
|
2017
|
+
* Optionally uses stored credentials for authentication.
|
|
2018
|
+
*
|
|
2019
|
+
* @param externalToolId - External tool UUID.
|
|
2020
|
+
* @param body - operationId, input params, and optional toolCredentialId.
|
|
2021
|
+
* @returns Execution result with status, output, and timing.
|
|
2022
|
+
*
|
|
2023
|
+
* @example
|
|
2024
|
+
* ```ts
|
|
2025
|
+
* const result = await client.skills.testExternalTool("tool-uuid", {
|
|
2026
|
+
* operationId: "getWeather",
|
|
2027
|
+
* input: { city: "London" }
|
|
2028
|
+
* });
|
|
2029
|
+
* console.log(`${result.status} in ${result.executionTimeMs}ms:`, result.output);
|
|
2030
|
+
* ```
|
|
2031
|
+
*/
|
|
2032
|
+
testExternalTool(externalToolId: string, body: TestExternalToolBody): Promise<TestExternalToolResponse>;
|
|
2033
|
+
/**
|
|
2034
|
+
* Attach existing documents to a knowledge collection.
|
|
2035
|
+
*
|
|
2036
|
+
* @param collectionId - Collection UUID.
|
|
2037
|
+
* @param body - Array of document IDs to link.
|
|
2038
|
+
* @returns Status message.
|
|
2039
|
+
*
|
|
2040
|
+
* @example
|
|
2041
|
+
* ```ts
|
|
2042
|
+
* await client.skills.attachDocumentsToCollection("collection-uuid", {
|
|
2043
|
+
* documentIds: ["doc-1", "doc-2"]
|
|
2044
|
+
* });
|
|
2045
|
+
* ```
|
|
2046
|
+
*/
|
|
2047
|
+
attachDocumentsToCollection(collectionId: string, body: AttachCollectionDocumentsBody): Promise<AttachCollectionDocumentsResponse>;
|
|
2048
|
+
/**
|
|
2049
|
+
* Generate a document from a template with variable values.
|
|
2050
|
+
*
|
|
2051
|
+
* @param templateId - Document template UUID.
|
|
2052
|
+
* @param body - Variables to fill in the template.
|
|
2053
|
+
* @returns URL to the generated document.
|
|
2054
|
+
*
|
|
2055
|
+
* @example
|
|
2056
|
+
* ```ts
|
|
2057
|
+
* const { url } = await client.skills.generateDocumentTemplate("template-uuid", {
|
|
2058
|
+
* variables: { name: "John", date: "2025-01-01" }
|
|
2059
|
+
* });
|
|
2060
|
+
* console.log("Generated document:", url);
|
|
2061
|
+
* ```
|
|
2062
|
+
*/
|
|
2063
|
+
generateDocumentTemplate(templateId: string, body: GenerateDocumentTemplateBody): Promise<GenerateDocumentTemplateResponse>;
|
|
2064
|
+
/**
|
|
2065
|
+
* Execute an AI task with input and get the output.
|
|
2066
|
+
*
|
|
2067
|
+
* @param taskId - AI Task UUID.
|
|
2068
|
+
* @param body - Input to the task.
|
|
2069
|
+
* @returns Task output and output type.
|
|
2070
|
+
*
|
|
2071
|
+
* @example
|
|
2072
|
+
* ```ts
|
|
2073
|
+
* const { output, outputType } = await client.skills.executeTask("task-uuid", {
|
|
2074
|
+
* input: "Summarize this document"
|
|
2075
|
+
* });
|
|
2076
|
+
* console.log(`Output (${outputType}):`, output);
|
|
2077
|
+
* ```
|
|
2078
|
+
*/
|
|
2079
|
+
executeTask(taskId: string, body: ExecuteTaskBody): Promise<ExecuteTaskResponse>;
|
|
2080
|
+
listCollectionDocuments(collectionId: string, params?: {
|
|
2081
|
+
page?: number;
|
|
2082
|
+
limit?: number;
|
|
2083
|
+
}): Promise<PageResponse<any>>;
|
|
2084
|
+
removeCollectionDocument(collectionId: string, documentId: string): Promise<any>;
|
|
2085
|
+
getCollectionStatistics(collectionId: string): Promise<any>;
|
|
2086
|
+
searchCollection(collectionId: string, body: {
|
|
2087
|
+
query: string;
|
|
2088
|
+
limit?: number;
|
|
2089
|
+
includeMetadata?: boolean;
|
|
2090
|
+
}): Promise<any>;
|
|
2091
|
+
searchMultipleCollections(body: {
|
|
2092
|
+
query: string;
|
|
2093
|
+
collectionIds: string[];
|
|
2094
|
+
limit?: number;
|
|
2095
|
+
}): Promise<any>;
|
|
2096
|
+
updateCollection(collectionId: string, body: {
|
|
2097
|
+
displayName?: string;
|
|
2098
|
+
description?: string;
|
|
2099
|
+
k?: number;
|
|
2100
|
+
reranker?: boolean;
|
|
2101
|
+
preciseResponses?: boolean;
|
|
2102
|
+
includeMetadata?: boolean;
|
|
2103
|
+
}): Promise<any>;
|
|
2104
|
+
deleteCollection(collectionId: string): Promise<any>;
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2107
|
+
type TicketType = "BUG" | "FEATURE_REQUEST" | "IMPROVEMENT";
|
|
2108
|
+
type TicketPriority = "NONE" | "URGENT" | "HIGH" | "MEDIUM" | "LOW";
|
|
2109
|
+
interface TicketContext {
|
|
2110
|
+
endpoint?: string;
|
|
2111
|
+
method?: string;
|
|
2112
|
+
statusCode?: number;
|
|
2113
|
+
errorCode?: string;
|
|
2114
|
+
requestBody?: string;
|
|
2115
|
+
responseBody?: string;
|
|
2116
|
+
reproductionSteps?: string;
|
|
2117
|
+
expectedBehavior?: string;
|
|
2118
|
+
actualBehavior?: string;
|
|
2119
|
+
environment?: string;
|
|
2120
|
+
sdkVersion?: string;
|
|
2121
|
+
agentId?: string;
|
|
2122
|
+
}
|
|
2123
|
+
interface TicketSummary {
|
|
2124
|
+
id: string;
|
|
2125
|
+
identifier: string;
|
|
2126
|
+
title: string;
|
|
2127
|
+
type: TicketType | null;
|
|
2128
|
+
priority: TicketPriority;
|
|
2129
|
+
status: string;
|
|
2130
|
+
url: string;
|
|
2131
|
+
createdAt: string;
|
|
2132
|
+
updatedAt: string | null;
|
|
2133
|
+
}
|
|
2134
|
+
interface TicketDetail extends TicketSummary {
|
|
2135
|
+
description: string | null;
|
|
2136
|
+
context: TicketContext | null;
|
|
2137
|
+
}
|
|
2138
|
+
interface TicketComment {
|
|
2139
|
+
id: string;
|
|
2140
|
+
body: string;
|
|
2141
|
+
authorName: string | null;
|
|
2142
|
+
createdAt: string;
|
|
2143
|
+
}
|
|
2144
|
+
interface CreateTicketBody {
|
|
2145
|
+
title: string;
|
|
2146
|
+
description?: string;
|
|
2147
|
+
type?: TicketType;
|
|
2148
|
+
priority?: TicketPriority;
|
|
2149
|
+
context?: TicketContext;
|
|
2150
|
+
}
|
|
2151
|
+
interface UpdateTicketBody {
|
|
2152
|
+
title?: string;
|
|
2153
|
+
description?: string;
|
|
2154
|
+
type?: TicketType;
|
|
2155
|
+
priority?: TicketPriority;
|
|
2156
|
+
}
|
|
2157
|
+
interface CreateTicketCommentBody {
|
|
2158
|
+
body: string;
|
|
2159
|
+
}
|
|
2160
|
+
interface ListTicketsParams {
|
|
2161
|
+
page?: number;
|
|
2162
|
+
limit?: number;
|
|
2163
|
+
type?: TicketType;
|
|
2164
|
+
priority?: TicketPriority;
|
|
2165
|
+
status?: string;
|
|
2166
|
+
search?: string;
|
|
2167
|
+
}
|
|
2168
|
+
interface TicketAttachment {
|
|
2169
|
+
id: string;
|
|
2170
|
+
filename: string;
|
|
2171
|
+
url: string;
|
|
2172
|
+
contentType: string | null;
|
|
2173
|
+
size: number | null;
|
|
2174
|
+
createdAt: string;
|
|
2175
|
+
}
|
|
2176
|
+
|
|
2177
|
+
declare class TicketsResource extends BaseResource {
|
|
2178
|
+
constructor(http: HttpClient);
|
|
2179
|
+
list(params?: ListTicketsParams): Promise<PageResponse<TicketSummary>>;
|
|
2180
|
+
get(ticketId: string): Promise<TicketDetail>;
|
|
2181
|
+
create(body: CreateTicketBody): Promise<TicketDetail>;
|
|
2182
|
+
update(ticketId: string, body: UpdateTicketBody): Promise<TicketDetail>;
|
|
2183
|
+
addComment(ticketId: string, body: CreateTicketCommentBody): Promise<TicketComment>;
|
|
2184
|
+
listComments(ticketId: string): Promise<{
|
|
2185
|
+
comments: TicketComment[];
|
|
2186
|
+
}>;
|
|
2187
|
+
uploadAttachment(ticketId: string, file: Blob | File): Promise<TicketAttachment>;
|
|
2188
|
+
listAttachments(ticketId: string): Promise<{
|
|
2189
|
+
attachments: TicketAttachment[];
|
|
2190
|
+
}>;
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2193
|
+
/** Body for connecting a tool via OAuth. */
|
|
2194
|
+
interface ConnectToolOAuthBody {
|
|
2195
|
+
authType: "oauth";
|
|
2196
|
+
service: string;
|
|
2197
|
+
}
|
|
2198
|
+
/** Body for connecting a tool via HTTP API key. */
|
|
2199
|
+
interface ConnectToolHttpBody {
|
|
2200
|
+
authType: "http";
|
|
2201
|
+
apiKey: string;
|
|
2202
|
+
name?: string;
|
|
2203
|
+
}
|
|
2204
|
+
/** Union body for connecting a tool (OAuth or HTTP). */
|
|
2205
|
+
type ConnectToolBody = ConnectToolOAuthBody | ConnectToolHttpBody;
|
|
2206
|
+
/** Response when initiating an OAuth connection flow. */
|
|
2207
|
+
interface ConnectToolOAuthResponse {
|
|
2208
|
+
authorizationUrl: string;
|
|
2209
|
+
handshakeId: string;
|
|
2210
|
+
expiresAt: string;
|
|
2211
|
+
}
|
|
2212
|
+
/** Response when creating an HTTP credential directly. */
|
|
2213
|
+
interface ConnectToolHttpResponse {
|
|
2214
|
+
id: string;
|
|
2215
|
+
name: string | null;
|
|
2216
|
+
type: string;
|
|
2217
|
+
status: string;
|
|
2218
|
+
createdAt: string;
|
|
2219
|
+
}
|
|
2220
|
+
/** Status of an OAuth handshake polling request. */
|
|
2221
|
+
interface HandshakeStatusResponse {
|
|
2222
|
+
status: "PENDING" | "COMPLETED" | "FAILED" | "EXPIRED";
|
|
2223
|
+
connectionId: string | null;
|
|
2224
|
+
errorMessage: string | null;
|
|
2225
|
+
expiresAt: string | null;
|
|
2226
|
+
}
|
|
2227
|
+
|
|
2228
|
+
/**
|
|
2229
|
+
* Tool connection resource. Accessed via `client.toolConnection`.
|
|
2230
|
+
*
|
|
2231
|
+
* Provides endpoints to connect marketplace tools via OAuth or HTTP
|
|
2232
|
+
* credentials, poll OAuth handshake status, and delete credentials.
|
|
2233
|
+
*
|
|
2234
|
+
* ```
|
|
2235
|
+
* // OAuth flow
|
|
2236
|
+
* const result = await client.toolConnection.connect(toolId, { authType: "oauth", service: "GOOGLE_SHEETS" });
|
|
2237
|
+
* console.log("Open:", result.authorizationUrl);
|
|
2238
|
+
* const status = await client.toolConnection.waitForConnection(result.handshakeId);
|
|
2239
|
+
*
|
|
2240
|
+
* // HTTP credential
|
|
2241
|
+
* const cred = await client.toolConnection.connect(toolId, { authType: "http", apiKey: "sk-..." });
|
|
2242
|
+
* ```
|
|
2243
|
+
*/
|
|
2244
|
+
declare class ToolConnectionResource extends BaseResource {
|
|
2245
|
+
/**
|
|
2246
|
+
* Initiate a tool connection via OAuth or create an HTTP credential directly.
|
|
2247
|
+
*
|
|
2248
|
+
* For OAuth, returns an `authorizationUrl` the user must visit, plus a
|
|
2249
|
+
* `handshakeId` for polling. For HTTP, creates the credential immediately.
|
|
2250
|
+
*
|
|
2251
|
+
* @param toolId - Marketplace tool ID.
|
|
2252
|
+
* @param body - Connection type and parameters.
|
|
2253
|
+
* @returns OAuth authorization details or the created HTTP credential.
|
|
2254
|
+
*/
|
|
2255
|
+
connect(toolId: string, body: ConnectToolBody): Promise<ConnectToolOAuthResponse | ConnectToolHttpResponse>;
|
|
2256
|
+
/**
|
|
2257
|
+
* Poll the status of an OAuth handshake.
|
|
2258
|
+
*
|
|
2259
|
+
* @param handshakeId - Handshake UUID returned by `connect()`.
|
|
2260
|
+
* @returns Current handshake status and connection ID if completed.
|
|
2261
|
+
*/
|
|
2262
|
+
pollStatus(handshakeId: string): Promise<HandshakeStatusResponse>;
|
|
2263
|
+
/**
|
|
2264
|
+
* Wait for an OAuth handshake to complete by polling at regular intervals.
|
|
2265
|
+
*
|
|
2266
|
+
* Resolves when the status changes from `PENDING` to any terminal state
|
|
2267
|
+
* (`COMPLETED`, `FAILED`, or `EXPIRED`), or when the timeout is reached.
|
|
2268
|
+
*
|
|
2269
|
+
* @param handshakeId - Handshake UUID returned by `connect()`.
|
|
2270
|
+
* @param opts - Optional timeout (default 5 min) and polling interval (default 2 s).
|
|
2271
|
+
* @returns Final handshake status.
|
|
2272
|
+
*/
|
|
2273
|
+
waitForConnection(handshakeId: string, opts?: {
|
|
2274
|
+
timeoutMs?: number;
|
|
2275
|
+
intervalMs?: number;
|
|
2276
|
+
}): Promise<HandshakeStatusResponse>;
|
|
2277
|
+
/**
|
|
2278
|
+
* Delete a credential (connected account) from a tool.
|
|
2279
|
+
*
|
|
2280
|
+
* @param toolId - Marketplace tool ID.
|
|
2281
|
+
* @param credentialId - Credential UUID to delete.
|
|
2282
|
+
*/
|
|
2283
|
+
deleteCredential(toolId: string, credentialId: string): Promise<void>;
|
|
2284
|
+
}
|
|
2285
|
+
|
|
2286
|
+
/** A marketplace tool summary returned from search results. */
|
|
2287
|
+
interface MarketplaceToolItem {
|
|
2288
|
+
/** Unique tool ID. Use with `client.tools.get(id)` for full details. */
|
|
2289
|
+
id: string;
|
|
2290
|
+
/** Display name of the tool (e.g. "Gmail", "Slack"). */
|
|
2291
|
+
name: string;
|
|
2292
|
+
/** Short description of what the tool does. */
|
|
2293
|
+
description: string;
|
|
2294
|
+
/** Tool type (e.g. "PLUGIN" for Pipedream-backed tools). */
|
|
2295
|
+
type: string;
|
|
2296
|
+
/** URL to the tool's icon/logo, if available. */
|
|
2297
|
+
imageUrl: string | null;
|
|
2298
|
+
/** Category for faceted filtering (e.g. "Communication", "Productivity"). */
|
|
2299
|
+
category: string | null;
|
|
2300
|
+
}
|
|
2301
|
+
/** Query parameters for `client.tools.search()`. */
|
|
2302
|
+
interface SearchMarketplaceToolsParams {
|
|
2303
|
+
/** Free-text search query (e.g. "gmail", "send email"). */
|
|
2304
|
+
q?: string;
|
|
2305
|
+
/** Filter by category (e.g. "Communication"). */
|
|
2306
|
+
category?: string;
|
|
2307
|
+
/** Filter by tool type (e.g. "PLUGIN"). */
|
|
2308
|
+
type?: string;
|
|
2309
|
+
/** Max results to return (default 20, max 100). */
|
|
2310
|
+
limit?: number;
|
|
2311
|
+
/** Offset for pagination (default 0). */
|
|
2312
|
+
offset?: number;
|
|
2313
|
+
}
|
|
2314
|
+
/** Response from `client.tools.search()`. */
|
|
2315
|
+
interface SearchMarketplaceToolsResponse {
|
|
2316
|
+
/** Matching tools (paginated). */
|
|
2317
|
+
tools: MarketplaceToolItem[];
|
|
2318
|
+
/** Category facets with counts for building filter UIs. */
|
|
2319
|
+
facets: {
|
|
2320
|
+
category: string;
|
|
2321
|
+
count: number;
|
|
2322
|
+
}[];
|
|
2323
|
+
/** Total number of matching tools across all pages. */
|
|
2324
|
+
total: number;
|
|
2325
|
+
}
|
|
2326
|
+
/**
|
|
2327
|
+
* A parameter on a tool action. Parameters describe the inputs an action accepts.
|
|
2328
|
+
*
|
|
2329
|
+
* When `remoteOptions` is `true`, the parameter's allowed values must be fetched
|
|
2330
|
+
* dynamically via `client.tools.resolveOptions()` — e.g. a Gmail label dropdown
|
|
2331
|
+
* whose values depend on the authenticated user's account.
|
|
2332
|
+
*/
|
|
2333
|
+
interface ToolActionParameter {
|
|
2334
|
+
/** Parameter name (used as the key in `configuredProps`). */
|
|
2335
|
+
name: string;
|
|
2336
|
+
/** Data type (e.g. "string", "boolean", "integer", "string[]"). */
|
|
2337
|
+
type: string;
|
|
2338
|
+
/** Human-readable label for the parameter. */
|
|
2339
|
+
label: string | null;
|
|
2340
|
+
/** Description of what this parameter controls. */
|
|
2341
|
+
description: string | null;
|
|
2342
|
+
/** Whether this parameter must be provided for the action to execute. */
|
|
2343
|
+
required: boolean;
|
|
2344
|
+
/** Default value, if any. */
|
|
2345
|
+
default: unknown;
|
|
2346
|
+
/**
|
|
2347
|
+
* If `true`, the allowed values for this parameter must be fetched at runtime
|
|
2348
|
+
* via `client.tools.resolveOptions(toolId, { componentId, propName, credentialId })`.
|
|
2349
|
+
* This is common for fields like "select a Gmail label" or "pick a Slack channel"
|
|
2350
|
+
* whose options depend on the user's connected account.
|
|
2351
|
+
*/
|
|
2352
|
+
remoteOptions: boolean;
|
|
2353
|
+
}
|
|
2354
|
+
/**
|
|
2355
|
+
* An action exposed by a marketplace tool. Each action represents a discrete operation
|
|
2356
|
+
* (e.g. "Send Email", "Create Draft", "List Labels").
|
|
2357
|
+
*/
|
|
2358
|
+
interface ToolAction {
|
|
2359
|
+
/**
|
|
2360
|
+
* Unique component key identifying this action (e.g. "gmail-send-email").
|
|
2361
|
+
* Use this as `componentId` when calling `client.tools.resolveOptions()`.
|
|
2362
|
+
*/
|
|
2363
|
+
key: string;
|
|
2364
|
+
/** Human-readable action name. */
|
|
2365
|
+
name: string;
|
|
2366
|
+
/** Description of what this action does. */
|
|
2367
|
+
description: string | null;
|
|
2368
|
+
/** Input parameters this action accepts. */
|
|
2369
|
+
parameters: ToolActionParameter[];
|
|
2370
|
+
}
|
|
2371
|
+
/** Query parameters for `client.tools.get()` to paginate/filter actions. */
|
|
2372
|
+
interface GetToolDetailParams {
|
|
2373
|
+
/** Max actions to return (1-200). Omit to return all. */
|
|
2374
|
+
actionsLimit?: number;
|
|
2375
|
+
/** Offset for action pagination (default 0). */
|
|
2376
|
+
actionsOffset?: number;
|
|
2377
|
+
/** Filter actions by key, name, or description (case-insensitive substring match). */
|
|
2378
|
+
actionsSearch?: string;
|
|
2379
|
+
}
|
|
2380
|
+
/**
|
|
2381
|
+
* Full marketplace tool detail including actions and their parameter schemas.
|
|
2382
|
+
* Returned by `client.tools.get(toolId)`.
|
|
2383
|
+
*/
|
|
2384
|
+
interface MarketplaceToolDetail {
|
|
2385
|
+
/** Unique tool ID. */
|
|
2386
|
+
id: string;
|
|
2387
|
+
/** Display name. */
|
|
2388
|
+
name: string | null;
|
|
2389
|
+
/** Description of the tool. */
|
|
2390
|
+
description: string;
|
|
2391
|
+
/** Tool type (e.g. "PLUGIN"). */
|
|
2392
|
+
type: string;
|
|
2393
|
+
/** URL to the tool's icon/logo. */
|
|
2394
|
+
imageUrl: string | null;
|
|
2395
|
+
/** Authentication type required (e.g. "oauth", "keys", "none"). */
|
|
2396
|
+
authType: string | null;
|
|
2397
|
+
/**
|
|
2398
|
+
* Actions (operations) this tool exposes. Each action has its own set of
|
|
2399
|
+
* parameters. For Pipedream tools, these are enriched with full parameter
|
|
2400
|
+
* schemas from the Pipedream component registry.
|
|
2401
|
+
*
|
|
2402
|
+
* May be paginated — check `totalActions` for the full count.
|
|
2403
|
+
*/
|
|
2404
|
+
actions: ToolAction[];
|
|
2405
|
+
/** Total number of actions available (before pagination). */
|
|
2406
|
+
totalActions: number;
|
|
2407
|
+
}
|
|
2408
|
+
/** An existing credential (connected account) for a marketplace tool. */
|
|
2409
|
+
interface ToolCredential {
|
|
2410
|
+
/**
|
|
2411
|
+
* Credential UUID. Pass this as `credentialId` to
|
|
2412
|
+
* `client.tools.resolveOptions()` or when configuring an agent tool.
|
|
2413
|
+
*/
|
|
2414
|
+
id: string;
|
|
2415
|
+
/** Display name of the credential (e.g. "john@company.com"). */
|
|
2416
|
+
name: string | null;
|
|
2417
|
+
/** Credential/auth type. */
|
|
2418
|
+
type: string | null;
|
|
2419
|
+
/** ISO 8601 creation timestamp. */
|
|
2420
|
+
createdAt: string;
|
|
2421
|
+
}
|
|
2422
|
+
/** Response from `client.tools.credentials(toolId)`. */
|
|
2423
|
+
interface ListToolCredentialsResponse {
|
|
2424
|
+
/** Existing credentials for this tool in the organization. */
|
|
2425
|
+
credentials: ToolCredential[];
|
|
2426
|
+
}
|
|
2427
|
+
/**
|
|
2428
|
+
* Request body for `client.tools.resolveOptions()`.
|
|
2429
|
+
*
|
|
2430
|
+
* This resolves dynamic dropdown values for a parameter that has `remoteOptions: true`.
|
|
2431
|
+
* For example, fetching the list of Gmail labels or Slack channels for the
|
|
2432
|
+
* authenticated user.
|
|
2433
|
+
*/
|
|
2434
|
+
interface ResolveRemoteOptionsBody {
|
|
2435
|
+
/**
|
|
2436
|
+
* The action's component key (from `ToolAction.key`),
|
|
2437
|
+
* e.g. "gmail-send-email".
|
|
2438
|
+
*/
|
|
2439
|
+
componentId: string;
|
|
2440
|
+
/**
|
|
2441
|
+
* The parameter name to resolve options for (from `ToolActionParameter.name`),
|
|
2442
|
+
* e.g. "label" or "channel".
|
|
2443
|
+
*/
|
|
2444
|
+
propName: string;
|
|
2445
|
+
/**
|
|
2446
|
+
* Credential UUID (from `ToolCredential.id`). The credential provides the
|
|
2447
|
+
* authenticated account context needed to fetch options.
|
|
2448
|
+
*/
|
|
2449
|
+
credentialId: string;
|
|
2450
|
+
/**
|
|
2451
|
+
* Already-selected parameter values. Some parameters depend on others
|
|
2452
|
+
* (cascading dropdowns) — for example, selecting a Google Drive folder before
|
|
2453
|
+
* listing files in that folder. Pass previously selected values here so the
|
|
2454
|
+
* API can resolve the correct options.
|
|
2455
|
+
*/
|
|
2456
|
+
configuredProps?: Record<string, unknown>;
|
|
2457
|
+
}
|
|
2458
|
+
/** A single option in a dynamic dropdown. */
|
|
2459
|
+
interface RemoteOption {
|
|
2460
|
+
/** Human-readable display label. */
|
|
2461
|
+
label: string;
|
|
2462
|
+
/** The value to use when configuring this parameter. */
|
|
2463
|
+
value: string | number | boolean;
|
|
2464
|
+
}
|
|
2465
|
+
/** Response from `client.tools.resolveOptions()`. */
|
|
2466
|
+
interface ResolveRemoteOptionsResponse {
|
|
2467
|
+
/** The available options for the requested parameter. */
|
|
2468
|
+
options: RemoteOption[];
|
|
2469
|
+
}
|
|
2470
|
+
/**
|
|
2471
|
+
* A skill is an organization-owned asset that can be attached to an agent:
|
|
2472
|
+
* a workflow (automation), an AI task, or a knowledge collection.
|
|
2473
|
+
*/
|
|
2474
|
+
interface SkillItem {
|
|
2475
|
+
/** Unique skill ID. */
|
|
2476
|
+
id: string;
|
|
2477
|
+
/** Display name. */
|
|
2478
|
+
name: string | null;
|
|
2479
|
+
/** Description of what this skill does. */
|
|
2480
|
+
description: string | null;
|
|
2481
|
+
/** Skill type: "TASK", "WORKFLOW", or "COLLECTION". */
|
|
2482
|
+
type: string;
|
|
2483
|
+
/** ISO 8601 creation timestamp. */
|
|
2484
|
+
createdAt: string;
|
|
2485
|
+
/** ISO 8601 last-updated timestamp. */
|
|
2486
|
+
updatedAt: string;
|
|
2487
|
+
}
|
|
2488
|
+
/** Query parameters for `client.tools.skills()`. */
|
|
2489
|
+
interface ListSkillsParams {
|
|
2490
|
+
/** Filter by skill type. */
|
|
2491
|
+
type?: "TASK" | "WORKFLOW" | "COLLECTION";
|
|
2492
|
+
/** Free-text search within skill names and descriptions. */
|
|
2493
|
+
search?: string;
|
|
2494
|
+
/** Max results to return (default 20, max 100). */
|
|
2495
|
+
limit?: number;
|
|
2496
|
+
/** Offset for pagination (default 0). */
|
|
2497
|
+
offset?: number;
|
|
2498
|
+
}
|
|
2499
|
+
/** Response from `client.tools.skills()`. */
|
|
2500
|
+
interface ListSkillsResponse {
|
|
2501
|
+
/** Matching skills (paginated). */
|
|
2502
|
+
skills: SkillItem[];
|
|
2503
|
+
/** Total number of matching skills. */
|
|
2504
|
+
total: number;
|
|
2505
|
+
}
|
|
2506
|
+
/**
|
|
2507
|
+
* Request body for `client.tools.test()`.
|
|
2508
|
+
* Provide sample input values to test-execute a configured agent tool.
|
|
2509
|
+
*/
|
|
2510
|
+
interface TestAgentToolBody {
|
|
2511
|
+
/** Key-value pairs matching the tool's expected parameters. */
|
|
2512
|
+
input: Record<string, unknown>;
|
|
2513
|
+
}
|
|
2514
|
+
/** Response from `client.tools.test()`. */
|
|
2515
|
+
interface TestAgentToolResponse {
|
|
2516
|
+
/** Whether the tool executed successfully. */
|
|
2517
|
+
status: "success" | "error";
|
|
2518
|
+
/** The tool's output data (shape depends on the specific tool/action). */
|
|
2519
|
+
output: unknown;
|
|
2520
|
+
/** Error message if `status` is "error". */
|
|
2521
|
+
error?: string;
|
|
2522
|
+
/** How long the execution took in milliseconds. */
|
|
2523
|
+
executionTimeMs: number;
|
|
2524
|
+
}
|
|
2525
|
+
|
|
2526
|
+
/**
|
|
2527
|
+
* Tool discovery and configuration resource.
|
|
2528
|
+
*
|
|
2529
|
+
* Provides the full LLM tool-configuration workflow:
|
|
2530
|
+
*
|
|
2531
|
+
* ```
|
|
2532
|
+
* 1. search() — Find marketplace tools (e.g. "gmail")
|
|
2533
|
+
* 2. get() — Get full tool detail with actions & parameter schemas
|
|
2534
|
+
* 3. credentials() — List existing connected accounts for the tool
|
|
2535
|
+
* 4. resolveOptions() — Fetch dynamic dropdown values for parameters with remoteOptions
|
|
2536
|
+
* 5. skills() — List org's workflows, AI tasks, and collections
|
|
2537
|
+
* 6. test() — Test-execute a configured agent tool
|
|
2538
|
+
* ```
|
|
2539
|
+
*
|
|
2540
|
+
* Typical workflow: search → get detail → list credentials → resolve dynamic
|
|
2541
|
+
* fields → configure tool on agent (via `client.agents.tools.create()`) → test.
|
|
2542
|
+
*
|
|
2543
|
+
* Accessed via `client.tools`.
|
|
2544
|
+
*/
|
|
2545
|
+
declare class ToolDiscoveryResource extends BaseResource {
|
|
2546
|
+
/**
|
|
2547
|
+
* Search marketplace tools by keyword with optional category and type filters.
|
|
2548
|
+
* Uses Typesense full-text search with SQL fallback.
|
|
2549
|
+
*
|
|
2550
|
+
* @param params - Search query and filters.
|
|
2551
|
+
* @returns Matching tools, category facets, and total count.
|
|
2552
|
+
*
|
|
2553
|
+
* @example
|
|
2554
|
+
* ```ts
|
|
2555
|
+
* const result = await client.tools.search({ q: "gmail", limit: 5 });
|
|
2556
|
+
* console.log(`Found ${result.total} tools`);
|
|
2557
|
+
* for (const tool of result.tools) {
|
|
2558
|
+
* console.log(`${tool.name} (${tool.type}): ${tool.description}`);
|
|
2559
|
+
* }
|
|
2560
|
+
* ```
|
|
2561
|
+
*/
|
|
2562
|
+
search(params?: SearchMarketplaceToolsParams): Promise<SearchMarketplaceToolsResponse>;
|
|
2563
|
+
/**
|
|
2564
|
+
* Get full marketplace tool detail including actions and their parameter schemas.
|
|
2565
|
+
*
|
|
2566
|
+
* For Pipedream tools, each action's parameters are enriched with the full
|
|
2567
|
+
* component definition including types, descriptions, defaults, and
|
|
2568
|
+
* `remoteOptions` flags indicating which fields need dynamic option resolution.
|
|
2569
|
+
*
|
|
2570
|
+
* @param toolId - Marketplace tool ID (from search results).
|
|
2571
|
+
* @param params - Optional pagination/filter params for actions.
|
|
2572
|
+
* @returns Full tool detail with actions and parameter schemas.
|
|
2573
|
+
*
|
|
2574
|
+
* @example
|
|
2575
|
+
* ```ts
|
|
2576
|
+
* // Get all actions
|
|
2577
|
+
* const detail = await client.tools.get("tool-uuid");
|
|
2578
|
+
* console.log(`${detail.totalActions} total actions`);
|
|
2579
|
+
*
|
|
2580
|
+
* // Paginate actions
|
|
2581
|
+
* const page = await client.tools.get("tool-uuid", { actionsLimit: 10, actionsOffset: 20 });
|
|
2582
|
+
*
|
|
2583
|
+
* // Search for a specific action
|
|
2584
|
+
* const filtered = await client.tools.get("tool-uuid", { actionsSearch: "get-values" });
|
|
2585
|
+
* ```
|
|
2586
|
+
*/
|
|
2587
|
+
get(toolId: string, params?: GetToolDetailParams): Promise<MarketplaceToolDetail>;
|
|
2588
|
+
/**
|
|
2589
|
+
* List existing credentials (connected accounts) for a marketplace tool.
|
|
2590
|
+
*
|
|
2591
|
+
* Credentials represent authenticated connections (e.g. a Gmail OAuth token).
|
|
2592
|
+
* They are read-only through this endpoint — users create credentials via the
|
|
2593
|
+
* Nexus dashboard. Use the credential `id` when calling `resolveOptions()` or
|
|
2594
|
+
* when configuring an agent tool.
|
|
2595
|
+
*
|
|
2596
|
+
* @param toolId - Marketplace tool ID.
|
|
2597
|
+
* @returns List of credentials for this tool in the organization.
|
|
2598
|
+
*
|
|
2599
|
+
* @example
|
|
2600
|
+
* ```ts
|
|
2601
|
+
* const { credentials } = await client.tools.credentials("tool-uuid");
|
|
2602
|
+
* if (credentials.length === 0) {
|
|
2603
|
+
* console.log("No credentials — user must connect account in dashboard first");
|
|
2604
|
+
* }
|
|
2605
|
+
* ```
|
|
2606
|
+
*/
|
|
2607
|
+
credentials(toolId: string): Promise<ListToolCredentialsResponse>;
|
|
2608
|
+
/**
|
|
2609
|
+
* Resolve dynamic dropdown options for a tool action parameter.
|
|
2610
|
+
*
|
|
2611
|
+
* Some parameters (those with `remoteOptions: true` in the tool detail) have
|
|
2612
|
+
* values that depend on the user's connected account — for example, a list of
|
|
2613
|
+
* Gmail labels or Slack channels. This method fetches those options at runtime.
|
|
2614
|
+
*
|
|
2615
|
+
* For cascading dependencies (e.g. "select folder" → "select file in folder"),
|
|
2616
|
+
* pass previously selected values in `configuredProps`.
|
|
2617
|
+
*
|
|
2618
|
+
* @param toolId - Marketplace tool ID.
|
|
2619
|
+
* @param body - Component ID, parameter name, credential, and current values.
|
|
2620
|
+
* @returns Available options for the specified parameter.
|
|
2621
|
+
*
|
|
2622
|
+
* @example
|
|
2623
|
+
* ```ts
|
|
2624
|
+
* const { options } = await client.tools.resolveOptions("tool-uuid", {
|
|
2625
|
+
* componentId: "gmail-send-email", // from ToolAction.key
|
|
2626
|
+
* propName: "label", // from ToolActionParameter.name
|
|
2627
|
+
* credentialId: "cred-uuid", // from ToolCredential.id
|
|
2628
|
+
* configuredProps: {} // previously selected values
|
|
2629
|
+
* });
|
|
2630
|
+
* for (const opt of options) {
|
|
2631
|
+
* console.log(`${opt.label}: ${opt.value}`);
|
|
2632
|
+
* }
|
|
2633
|
+
* ```
|
|
2634
|
+
*/
|
|
2635
|
+
resolveOptions(toolId: string, body: ResolveRemoteOptionsBody): Promise<ResolveRemoteOptionsResponse>;
|
|
2636
|
+
/**
|
|
2637
|
+
* List the organization's skills — workflows, AI tasks, and collections.
|
|
2638
|
+
*
|
|
2639
|
+
* Skills are org-owned assets that can be attached to agents as tool
|
|
2640
|
+
* configurations of type WORKFLOW, TASK, or COLLECTION (as opposed to
|
|
2641
|
+
* marketplace PLUGIN tools).
|
|
2642
|
+
*
|
|
2643
|
+
* @param params - Optional type filter, search, and pagination.
|
|
2644
|
+
* @returns Matching skills and total count.
|
|
2645
|
+
*
|
|
2646
|
+
* @example
|
|
2647
|
+
* ```ts
|
|
2648
|
+
* // List all workflows
|
|
2649
|
+
* const { skills, total } = await client.tools.skills({ type: "WORKFLOW" });
|
|
2650
|
+
* console.log(`${total} workflows found`);
|
|
2651
|
+
*
|
|
2652
|
+
* // Search across all skill types
|
|
2653
|
+
* const result = await client.tools.skills({ search: "onboarding", limit: 10 });
|
|
2654
|
+
* ```
|
|
2655
|
+
*/
|
|
2656
|
+
skills(params?: ListSkillsParams): Promise<ListSkillsResponse>;
|
|
2657
|
+
/**
|
|
2658
|
+
* Test-execute a configured agent tool with sample input.
|
|
2659
|
+
*
|
|
2660
|
+
* This runs the tool using its saved configuration (action, credentials,
|
|
2661
|
+
* parameter setup) and returns the execution result. Use this to verify a
|
|
2662
|
+
* tool is correctly configured before deploying the agent.
|
|
2663
|
+
*
|
|
2664
|
+
* @param agentId - Agent UUID that owns the tool config.
|
|
2665
|
+
* @param toolConfigId - Agent tool configuration UUID (from `client.agents.tools.list()`).
|
|
2666
|
+
* @param body - Sample input values to pass to the tool.
|
|
2667
|
+
* @returns Execution result with status, output, and timing.
|
|
2668
|
+
*
|
|
2669
|
+
* @example
|
|
2670
|
+
* ```ts
|
|
2671
|
+
* const result = await client.tools.test("agent-uuid", "tool-config-uuid", {
|
|
2672
|
+
* input: { to: "test@example.com", subject: "Hello", body: "Test email" }
|
|
2673
|
+
* });
|
|
2674
|
+
* if (result.status === "success") {
|
|
2675
|
+
* console.log(`Executed in ${result.executionTimeMs}ms`, result.output);
|
|
2676
|
+
* } else {
|
|
2677
|
+
* console.error(`Tool error: ${result.error}`);
|
|
2678
|
+
* }
|
|
2679
|
+
* ```
|
|
2680
|
+
*/
|
|
2681
|
+
test(agentId: string, toolConfigId: string, body: TestAgentToolBody): Promise<TestAgentToolResponse>;
|
|
2682
|
+
}
|
|
2683
|
+
|
|
2684
|
+
declare class WorkflowExecutionsResource extends BaseResource {
|
|
2685
|
+
list(params?: {
|
|
2686
|
+
workflowId?: string;
|
|
2687
|
+
status?: string;
|
|
2688
|
+
startDate?: string;
|
|
2689
|
+
endDate?: string;
|
|
2690
|
+
page?: number;
|
|
2691
|
+
limit?: number;
|
|
2692
|
+
sortBy?: string;
|
|
2693
|
+
order?: string;
|
|
2694
|
+
}): Promise<PageResponse<any>>;
|
|
2695
|
+
listByWorkflow(workflowId: string, params?: {
|
|
2696
|
+
page?: number;
|
|
2697
|
+
limit?: number;
|
|
2698
|
+
status?: string;
|
|
2699
|
+
}): Promise<PageResponse<any>>;
|
|
2700
|
+
get(executionId: string): Promise<any>;
|
|
2701
|
+
getGraph(executionId: string): Promise<any>;
|
|
2702
|
+
getNodeResult(executionId: string, nodeId: string): Promise<any>;
|
|
2703
|
+
getOutput(executionId: string): Promise<any>;
|
|
2704
|
+
retryNode(executionId: string, nodeId: string): Promise<any>;
|
|
2705
|
+
export(executionId: string): Promise<any>;
|
|
2706
|
+
}
|
|
2707
|
+
|
|
2708
|
+
/** Workflow lifecycle status. */
|
|
2709
|
+
type WorkflowStatus = "DRAFT" | "PUBLISHED" | "ARCHIVED";
|
|
2710
|
+
/** Summary view of a workflow returned by list endpoints. */
|
|
2711
|
+
interface WfSummary {
|
|
2712
|
+
id: string;
|
|
2713
|
+
name: string;
|
|
2714
|
+
description: string | null;
|
|
2715
|
+
status: WorkflowStatus;
|
|
2716
|
+
triggerType: string | null;
|
|
2717
|
+
nodeCount: number;
|
|
2718
|
+
createdAt: string;
|
|
2719
|
+
updatedAt: string;
|
|
2720
|
+
}
|
|
2721
|
+
/** A single node in a workflow graph. */
|
|
2722
|
+
interface WorkflowNode {
|
|
2723
|
+
id: string;
|
|
2724
|
+
type: string;
|
|
2725
|
+
data: Record<string, unknown>;
|
|
2726
|
+
position: {
|
|
2727
|
+
x: number;
|
|
2728
|
+
y: number;
|
|
2729
|
+
};
|
|
2730
|
+
parentId: string | null;
|
|
2731
|
+
configStatus: "complete" | "incomplete" | "error";
|
|
2732
|
+
missingFields: string[];
|
|
2733
|
+
errors: string[];
|
|
2734
|
+
}
|
|
2735
|
+
/** A single edge connecting two nodes in a workflow graph. */
|
|
2736
|
+
interface WorkflowEdge {
|
|
2737
|
+
id: string;
|
|
2738
|
+
source: string;
|
|
2739
|
+
target: string;
|
|
2740
|
+
sourceHandle: string | null;
|
|
2741
|
+
type: string;
|
|
2742
|
+
}
|
|
2743
|
+
/** Full workflow detail including nodes and edges. */
|
|
2744
|
+
interface WorkflowDetail extends WfSummary {
|
|
2745
|
+
nodes: WorkflowNode[];
|
|
2746
|
+
edges: WorkflowEdge[];
|
|
2747
|
+
}
|
|
2748
|
+
/** Body for creating a new workflow. */
|
|
2749
|
+
interface CreateWorkflowBody {
|
|
2750
|
+
name: string;
|
|
2751
|
+
description?: string;
|
|
2752
|
+
}
|
|
2753
|
+
/** Body for updating an existing workflow. */
|
|
2754
|
+
interface UpdateWorkflowBody {
|
|
2755
|
+
name?: string;
|
|
2756
|
+
description?: string;
|
|
2757
|
+
}
|
|
2758
|
+
/** Query parameters for listing workflows. */
|
|
2759
|
+
interface ListWorkflowsParams {
|
|
2760
|
+
page?: number;
|
|
2761
|
+
limit?: number;
|
|
2762
|
+
status?: WorkflowStatus;
|
|
2763
|
+
search?: string;
|
|
2764
|
+
}
|
|
2765
|
+
/** Body for creating a new node in a workflow. */
|
|
2766
|
+
interface CreateNodeBody {
|
|
2767
|
+
type: string;
|
|
2768
|
+
position?: {
|
|
2769
|
+
x: number;
|
|
2770
|
+
y: number;
|
|
2771
|
+
};
|
|
2772
|
+
data?: Record<string, unknown>;
|
|
2773
|
+
parentId?: string;
|
|
2774
|
+
}
|
|
2775
|
+
/** Body for updating an existing node. */
|
|
2776
|
+
interface UpdateNodeBody {
|
|
2777
|
+
data: Record<string, unknown>;
|
|
2778
|
+
}
|
|
2779
|
+
/** Body for replacing the trigger node of a workflow. */
|
|
2780
|
+
interface ReplaceTriggerBody {
|
|
2781
|
+
type: "webhookTrigger" | "agentInputTrigger" | "scheduleTrigger" | "pluginTrigger";
|
|
2782
|
+
}
|
|
2783
|
+
/** Body for reloading dynamic properties of a node. */
|
|
2784
|
+
interface ReloadPropsBody {
|
|
2785
|
+
configuredProps?: Record<string, unknown>;
|
|
2786
|
+
dynamicPropsId?: string;
|
|
2787
|
+
}
|
|
2788
|
+
/** Response from reloading dynamic properties. */
|
|
2789
|
+
interface ReloadPropsResponse {
|
|
2790
|
+
parametersSetup: unknown[];
|
|
2791
|
+
dynamicPropsId: string | null;
|
|
2792
|
+
errors: string[];
|
|
2793
|
+
}
|
|
2794
|
+
/** A branch within a conditional or router node. */
|
|
2795
|
+
interface Branch {
|
|
2796
|
+
id: string;
|
|
2797
|
+
name: string;
|
|
2798
|
+
description: string | null;
|
|
2799
|
+
}
|
|
2800
|
+
/** Body for creating a new branch on a node. */
|
|
2801
|
+
interface CreateBranchBody {
|
|
2802
|
+
name: string;
|
|
2803
|
+
description?: string;
|
|
2804
|
+
}
|
|
2805
|
+
/** Body for updating an existing branch. */
|
|
2806
|
+
interface UpdateBranchBody {
|
|
2807
|
+
name?: string;
|
|
2808
|
+
description?: string;
|
|
2809
|
+
}
|
|
2810
|
+
/** Body for creating a new edge between nodes. */
|
|
2811
|
+
interface CreateEdgeBody {
|
|
2812
|
+
source: string;
|
|
2813
|
+
target: string;
|
|
2814
|
+
sourceHandle?: string;
|
|
2815
|
+
type?: "main" | "rewind";
|
|
2816
|
+
}
|
|
2817
|
+
/** High-level overview of a workflow with node summaries. */
|
|
2818
|
+
interface WorkflowOverview {
|
|
2819
|
+
id: string;
|
|
2820
|
+
name: string;
|
|
2821
|
+
status: string;
|
|
2822
|
+
nodes: Array<{
|
|
2823
|
+
id: string;
|
|
2824
|
+
type: string;
|
|
2825
|
+
label: string;
|
|
2826
|
+
configStatus: "complete" | "incomplete" | "error";
|
|
2827
|
+
missingFields: string[];
|
|
2828
|
+
errors: string[];
|
|
2829
|
+
}>;
|
|
2830
|
+
edges: WorkflowEdge[];
|
|
2831
|
+
}
|
|
2832
|
+
/** Variables available to a node from upstream nodes. */
|
|
2833
|
+
interface AvailableVariable {
|
|
2834
|
+
nodeId: string;
|
|
2835
|
+
nodeLabel: string;
|
|
2836
|
+
nodeType: string;
|
|
2837
|
+
properties: Array<{
|
|
2838
|
+
key: string;
|
|
2839
|
+
label: string;
|
|
2840
|
+
type: string;
|
|
2841
|
+
}>;
|
|
2842
|
+
}
|
|
2843
|
+
/** Output format definition for a node. */
|
|
2844
|
+
interface OutputFormat {
|
|
2845
|
+
format: unknown;
|
|
2846
|
+
source: "manual" | "lastExecution" | "default";
|
|
2847
|
+
}
|
|
2848
|
+
/** Validation report for a workflow. */
|
|
2849
|
+
interface ValidationReport {
|
|
2850
|
+
isValid: boolean;
|
|
2851
|
+
readyToPublish: boolean;
|
|
2852
|
+
readyToTest: boolean;
|
|
2853
|
+
nodeIssues: Array<{
|
|
2854
|
+
nodeId: string;
|
|
2855
|
+
nodeType: string;
|
|
2856
|
+
configStatus: string;
|
|
2857
|
+
missingFields: string[];
|
|
2858
|
+
errors: string[];
|
|
2859
|
+
}>;
|
|
2860
|
+
graphIssues: string[];
|
|
2861
|
+
}
|
|
2862
|
+
/** Summary of a node type available in the workflow builder. */
|
|
2863
|
+
interface NodeTypeSummary {
|
|
2864
|
+
type: string;
|
|
2865
|
+
label: string;
|
|
2866
|
+
description: string;
|
|
2867
|
+
category: string;
|
|
2868
|
+
}
|
|
2869
|
+
/** Full schema for a node type including fields and connection rules. */
|
|
2870
|
+
interface NodeTypeSchema {
|
|
2871
|
+
type: string;
|
|
2872
|
+
label: string;
|
|
2873
|
+
description: string;
|
|
2874
|
+
category: string;
|
|
2875
|
+
fields: unknown[];
|
|
2876
|
+
configurationSteps: unknown[];
|
|
2877
|
+
connectionRules: {
|
|
2878
|
+
maxInputs: number;
|
|
2879
|
+
maxOutputs: number;
|
|
2880
|
+
canLoop: boolean;
|
|
2881
|
+
canMask: boolean;
|
|
2882
|
+
};
|
|
2883
|
+
defaultData: Record<string, unknown>;
|
|
2884
|
+
}
|
|
2885
|
+
/** Body for testing a single node. */
|
|
2886
|
+
interface TestNodeBody {
|
|
2887
|
+
input?: Record<string, unknown>;
|
|
2888
|
+
}
|
|
2889
|
+
/** Body for testing an entire workflow. */
|
|
2890
|
+
interface TestWorkflowBody {
|
|
2891
|
+
triggerData?: Record<string, unknown>;
|
|
2892
|
+
}
|
|
2893
|
+
/** Result of starting a test execution. */
|
|
2894
|
+
interface TestResult {
|
|
2895
|
+
executionId: string;
|
|
2896
|
+
}
|
|
2897
|
+
/** Status of a workflow execution. */
|
|
2898
|
+
interface ExecutionStatus {
|
|
2899
|
+
id: string;
|
|
2900
|
+
status: "PENDING" | "RUNNING" | "COMPLETED" | "FAILED" | "CANCELLED";
|
|
2901
|
+
nodes: Array<{
|
|
2902
|
+
id: string;
|
|
2903
|
+
nodeId: string;
|
|
2904
|
+
status: string;
|
|
2905
|
+
startedAt: string | null;
|
|
2906
|
+
completedAt: string | null;
|
|
2907
|
+
}>;
|
|
2908
|
+
startedAt: string;
|
|
2909
|
+
completedAt: string | null;
|
|
2910
|
+
}
|
|
2911
|
+
/** Execution result for a single node. */
|
|
2912
|
+
interface NodeExecutionResult {
|
|
2913
|
+
nodeId: string;
|
|
2914
|
+
status: string;
|
|
2915
|
+
input: unknown;
|
|
2916
|
+
output: unknown;
|
|
2917
|
+
error: string | null;
|
|
2918
|
+
logs: string[];
|
|
2919
|
+
startedAt: string | null;
|
|
2920
|
+
completedAt: string | null;
|
|
2921
|
+
}
|
|
2922
|
+
/** Result of publishing a workflow. */
|
|
2923
|
+
interface PublishResult {
|
|
2924
|
+
id: string;
|
|
2925
|
+
status: "PUBLISHED";
|
|
2926
|
+
}
|
|
2927
|
+
/** Result of unpublishing a workflow. */
|
|
2928
|
+
interface UnpublishResult {
|
|
2929
|
+
id: string;
|
|
2930
|
+
status: "DRAFT";
|
|
2931
|
+
}
|
|
2932
|
+
/** Result of uploading a workflow icon. */
|
|
2933
|
+
interface IconResult {
|
|
2934
|
+
iconUrl: string;
|
|
2935
|
+
}
|
|
2936
|
+
|
|
2937
|
+
/**
|
|
2938
|
+
* Workflow management resource. Accessed via `client.workflows`.
|
|
2939
|
+
*
|
|
2940
|
+
* Provides full CRUD for workflows plus sub-operations for nodes, edges,
|
|
2941
|
+
* branches, overview/validation, builder node-types, and test executions.
|
|
2942
|
+
*
|
|
2943
|
+
* ```
|
|
2944
|
+
* client.workflows.list() — List workflows
|
|
2945
|
+
* client.workflows.create({ name: "My Flow" }) — Create workflow
|
|
2946
|
+
* client.workflows.createNode(wfId, { type }) — Add a node
|
|
2947
|
+
* client.workflows.testWorkflow(wfId, { ... }) — Run a test
|
|
2948
|
+
* client.workflows.publish(wfId) — Publish workflow
|
|
2949
|
+
* ```
|
|
2950
|
+
*/
|
|
2951
|
+
declare class WorkflowsResource extends BaseResource {
|
|
2952
|
+
/**
|
|
2953
|
+
* List workflows with optional filtering and pagination.
|
|
2954
|
+
*
|
|
2955
|
+
* @param params - Optional status filter, search, and pagination.
|
|
2956
|
+
* @returns Paginated list of workflow summaries.
|
|
2957
|
+
*/
|
|
2958
|
+
list(params?: ListWorkflowsParams): Promise<PageResponse<WfSummary>>;
|
|
2959
|
+
/**
|
|
2960
|
+
* Create a new workflow.
|
|
2961
|
+
*
|
|
2962
|
+
* @param body - Workflow name and optional description.
|
|
2963
|
+
* @returns The created workflow detail.
|
|
2964
|
+
*/
|
|
2965
|
+
create(body: CreateWorkflowBody): Promise<WorkflowDetail>;
|
|
2966
|
+
/**
|
|
2967
|
+
* Get detailed information about a specific workflow, including nodes and edges.
|
|
2968
|
+
*
|
|
2969
|
+
* @param workflowId - Workflow UUID.
|
|
2970
|
+
* @returns Full workflow detail.
|
|
2971
|
+
*/
|
|
2972
|
+
get(workflowId: string): Promise<WorkflowDetail>;
|
|
2973
|
+
/**
|
|
2974
|
+
* Update an existing workflow's properties. Only provided fields are updated.
|
|
2975
|
+
*
|
|
2976
|
+
* @param workflowId - Workflow UUID.
|
|
2977
|
+
* @param body - Fields to update.
|
|
2978
|
+
* @returns The updated workflow detail.
|
|
2979
|
+
*/
|
|
2980
|
+
update(workflowId: string, body: UpdateWorkflowBody): Promise<WorkflowDetail>;
|
|
2981
|
+
/**
|
|
2982
|
+
* Permanently delete a workflow and all its nodes, edges, and executions.
|
|
2983
|
+
*
|
|
2984
|
+
* @param workflowId - Workflow UUID.
|
|
2985
|
+
* @returns Confirmation with the deleted workflow's ID.
|
|
2986
|
+
*/
|
|
2987
|
+
delete(workflowId: string): Promise<DeleteResponse>;
|
|
2988
|
+
/**
|
|
2989
|
+
* Create a copy of an existing workflow.
|
|
2990
|
+
*
|
|
2991
|
+
* @param workflowId - Workflow UUID to duplicate.
|
|
2992
|
+
* @returns The newly created workflow detail.
|
|
2993
|
+
*/
|
|
2994
|
+
duplicate(workflowId: string): Promise<WorkflowDetail>;
|
|
2995
|
+
/**
|
|
2996
|
+
* Publish a workflow, making it available for execution.
|
|
2997
|
+
*
|
|
2998
|
+
* @param workflowId - Workflow UUID.
|
|
2999
|
+
* @returns Publish confirmation with updated status.
|
|
3000
|
+
*/
|
|
3001
|
+
publish(workflowId: string): Promise<PublishResult>;
|
|
3002
|
+
/**
|
|
3003
|
+
* Unpublish a workflow, reverting it to draft status.
|
|
3004
|
+
*
|
|
3005
|
+
* @param workflowId - Workflow UUID.
|
|
3006
|
+
* @returns Unpublish confirmation with updated status.
|
|
3007
|
+
*/
|
|
3008
|
+
unpublish(workflowId: string): Promise<UnpublishResult>;
|
|
3009
|
+
/**
|
|
3010
|
+
* Upload an icon image for a workflow.
|
|
3011
|
+
*
|
|
3012
|
+
* @param workflowId - Workflow UUID.
|
|
3013
|
+
* @param file - Image file as a Blob or File.
|
|
3014
|
+
* @returns URL of the uploaded icon.
|
|
3015
|
+
*/
|
|
3016
|
+
uploadIcon(workflowId: string, file: Blob | File): Promise<IconResult>;
|
|
3017
|
+
/**
|
|
3018
|
+
* List all available node types for the workflow builder.
|
|
3019
|
+
*
|
|
3020
|
+
* @returns Array of node type summaries.
|
|
3021
|
+
*/
|
|
3022
|
+
listNodeTypes(): Promise<NodeTypeSummary[]>;
|
|
3023
|
+
/**
|
|
3024
|
+
* Get the full schema for a specific node type, including fields and connection rules.
|
|
3025
|
+
*
|
|
3026
|
+
* @param nodeType - Node type identifier.
|
|
3027
|
+
* @returns Node type schema with fields, configuration steps, and defaults.
|
|
3028
|
+
*/
|
|
3029
|
+
getNodeTypeSchema(nodeType: string): Promise<NodeTypeSchema>;
|
|
3030
|
+
/**
|
|
3031
|
+
* Create a new node in a workflow.
|
|
3032
|
+
*
|
|
3033
|
+
* @param workflowId - Workflow UUID.
|
|
3034
|
+
* @param body - Node type, position, data, and optional parent.
|
|
3035
|
+
* @returns The created node.
|
|
3036
|
+
*/
|
|
3037
|
+
createNode(workflowId: string, body: CreateNodeBody): Promise<WorkflowNode>;
|
|
3038
|
+
/**
|
|
3039
|
+
* Get a specific node within a workflow.
|
|
3040
|
+
*
|
|
3041
|
+
* @param workflowId - Workflow UUID.
|
|
3042
|
+
* @param nodeId - Node UUID.
|
|
3043
|
+
* @returns The node detail.
|
|
3044
|
+
*/
|
|
3045
|
+
getNode(workflowId: string, nodeId: string): Promise<WorkflowNode>;
|
|
3046
|
+
/**
|
|
3047
|
+
* Update a node's data. Only the `data` field is replaced.
|
|
3048
|
+
*
|
|
3049
|
+
* @param workflowId - Workflow UUID.
|
|
3050
|
+
* @param nodeId - Node UUID.
|
|
3051
|
+
* @param body - New data for the node.
|
|
3052
|
+
* @returns The updated node.
|
|
3053
|
+
*/
|
|
3054
|
+
updateNode(workflowId: string, nodeId: string, body: UpdateNodeBody): Promise<WorkflowNode>;
|
|
3055
|
+
/**
|
|
3056
|
+
* Delete a node from a workflow. Connected edges are also removed.
|
|
3057
|
+
*
|
|
3058
|
+
* @param workflowId - Workflow UUID.
|
|
3059
|
+
* @param nodeId - Node UUID.
|
|
3060
|
+
* @returns Confirmation with the deleted node's ID.
|
|
3061
|
+
*/
|
|
3062
|
+
deleteNode(workflowId: string, nodeId: string): Promise<DeleteResponse>;
|
|
3063
|
+
/**
|
|
3064
|
+
* Reload dynamic properties for a node (e.g. after selecting a tool or action).
|
|
3065
|
+
*
|
|
3066
|
+
* @param workflowId - Workflow UUID.
|
|
3067
|
+
* @param nodeId - Node UUID.
|
|
3068
|
+
* @param body - Currently configured props and optional dynamic props ID.
|
|
3069
|
+
* @returns Updated parameters setup and any errors.
|
|
3070
|
+
*/
|
|
3071
|
+
reloadProps(workflowId: string, nodeId: string, body: ReloadPropsBody): Promise<ReloadPropsResponse>;
|
|
3072
|
+
/**
|
|
3073
|
+
* Replace the trigger node of a workflow with a different trigger type.
|
|
3074
|
+
*
|
|
3075
|
+
* @param workflowId - Workflow UUID.
|
|
3076
|
+
* @param body - New trigger type.
|
|
3077
|
+
* @returns The updated workflow detail.
|
|
3078
|
+
*/
|
|
3079
|
+
replaceTrigger(workflowId: string, body: ReplaceTriggerBody): Promise<WorkflowDetail>;
|
|
3080
|
+
/**
|
|
3081
|
+
* List branches on a conditional or router node.
|
|
3082
|
+
*
|
|
3083
|
+
* @param workflowId - Workflow UUID.
|
|
3084
|
+
* @param nodeId - Node UUID.
|
|
3085
|
+
* @returns Array of branches.
|
|
3086
|
+
*/
|
|
3087
|
+
listBranches(workflowId: string, nodeId: string): Promise<Branch[]>;
|
|
3088
|
+
/**
|
|
3089
|
+
* Create a new branch on a conditional or router node.
|
|
3090
|
+
*
|
|
3091
|
+
* @param workflowId - Workflow UUID.
|
|
3092
|
+
* @param nodeId - Node UUID.
|
|
3093
|
+
* @param body - Branch name and optional description.
|
|
3094
|
+
* @returns The created branch.
|
|
3095
|
+
*/
|
|
3096
|
+
createBranch(workflowId: string, nodeId: string, body: CreateBranchBody): Promise<Branch>;
|
|
3097
|
+
/**
|
|
3098
|
+
* Update a branch on a node.
|
|
3099
|
+
*
|
|
3100
|
+
* @param workflowId - Workflow UUID.
|
|
3101
|
+
* @param nodeId - Node UUID.
|
|
3102
|
+
* @param branchId - Branch UUID.
|
|
3103
|
+
* @param body - Fields to update.
|
|
3104
|
+
* @returns The updated branch.
|
|
3105
|
+
*/
|
|
3106
|
+
updateBranch(workflowId: string, nodeId: string, branchId: string, body: UpdateBranchBody): Promise<Branch>;
|
|
3107
|
+
/**
|
|
3108
|
+
* Delete a branch from a node.
|
|
3109
|
+
*
|
|
3110
|
+
* @param workflowId - Workflow UUID.
|
|
3111
|
+
* @param nodeId - Node UUID.
|
|
3112
|
+
* @param branchId - Branch UUID.
|
|
3113
|
+
* @returns Confirmation with the deleted branch's ID.
|
|
3114
|
+
*/
|
|
3115
|
+
deleteBranch(workflowId: string, nodeId: string, branchId: string): Promise<DeleteResponse>;
|
|
3116
|
+
/**
|
|
3117
|
+
* Create an edge between two nodes in a workflow.
|
|
3118
|
+
*
|
|
3119
|
+
* @param workflowId - Workflow UUID.
|
|
3120
|
+
* @param body - Source node, target node, optional handle and type.
|
|
3121
|
+
* @returns The created edge.
|
|
3122
|
+
*/
|
|
3123
|
+
createEdge(workflowId: string, body: CreateEdgeBody): Promise<WorkflowEdge>;
|
|
3124
|
+
/**
|
|
3125
|
+
* Delete an edge from a workflow.
|
|
3126
|
+
*
|
|
3127
|
+
* @param workflowId - Workflow UUID.
|
|
3128
|
+
* @param edgeId - Edge UUID.
|
|
3129
|
+
* @returns Confirmation with the deleted edge's ID.
|
|
3130
|
+
*/
|
|
3131
|
+
deleteEdge(workflowId: string, edgeId: string): Promise<DeleteResponse>;
|
|
3132
|
+
/**
|
|
3133
|
+
* Get a high-level overview of a workflow with node summaries.
|
|
3134
|
+
*
|
|
3135
|
+
* @param workflowId - Workflow UUID.
|
|
3136
|
+
* @returns Workflow overview with node labels and config statuses.
|
|
3137
|
+
*/
|
|
3138
|
+
getOverview(workflowId: string): Promise<WorkflowOverview>;
|
|
3139
|
+
/**
|
|
3140
|
+
* Auto-layout the nodes in a workflow graph.
|
|
3141
|
+
*
|
|
3142
|
+
* @param workflowId - Workflow UUID.
|
|
3143
|
+
* @returns The updated workflow detail with new node positions.
|
|
3144
|
+
*/
|
|
3145
|
+
layout(workflowId: string): Promise<WorkflowDetail>;
|
|
3146
|
+
/**
|
|
3147
|
+
* Get variables available to a specific node from upstream nodes.
|
|
3148
|
+
*
|
|
3149
|
+
* @param workflowId - Workflow UUID.
|
|
3150
|
+
* @param nodeId - Node UUID.
|
|
3151
|
+
* @returns Array of available variables grouped by source node.
|
|
3152
|
+
*/
|
|
3153
|
+
getAvailableVariables(workflowId: string, nodeId: string): Promise<AvailableVariable[]>;
|
|
3154
|
+
/**
|
|
3155
|
+
* Get the output format definition for a specific node.
|
|
3156
|
+
*
|
|
3157
|
+
* @param workflowId - Workflow UUID.
|
|
3158
|
+
* @param nodeId - Node UUID.
|
|
3159
|
+
* @returns Output format with source indicator.
|
|
3160
|
+
*/
|
|
3161
|
+
getOutputFormat(workflowId: string, nodeId: string): Promise<OutputFormat>;
|
|
3162
|
+
/**
|
|
3163
|
+
* Validate a workflow for completeness and correctness.
|
|
3164
|
+
*
|
|
3165
|
+
* @param workflowId - Workflow UUID.
|
|
3166
|
+
* @returns Validation report with node issues and graph issues.
|
|
3167
|
+
*/
|
|
3168
|
+
validate(workflowId: string): Promise<ValidationReport>;
|
|
3169
|
+
/**
|
|
3170
|
+
* Test-execute a single node with optional input.
|
|
3171
|
+
*
|
|
3172
|
+
* @param workflowId - Workflow UUID.
|
|
3173
|
+
* @param nodeId - Node UUID.
|
|
3174
|
+
* @param body - Optional input data for the node.
|
|
3175
|
+
* @returns Execution ID for polling status.
|
|
3176
|
+
*/
|
|
3177
|
+
testNode(workflowId: string, nodeId: string, body?: TestNodeBody): Promise<TestResult>;
|
|
3178
|
+
/**
|
|
3179
|
+
* Test-execute an entire workflow with optional trigger data.
|
|
3180
|
+
*
|
|
3181
|
+
* @param workflowId - Workflow UUID.
|
|
3182
|
+
* @param body - Optional trigger data to start the workflow.
|
|
3183
|
+
* @returns Execution ID for polling status.
|
|
3184
|
+
*/
|
|
3185
|
+
testWorkflow(workflowId: string, body?: TestWorkflowBody): Promise<TestResult>;
|
|
3186
|
+
/**
|
|
3187
|
+
* Get the status of a workflow execution.
|
|
3188
|
+
*
|
|
3189
|
+
* @param workflowId - Workflow UUID.
|
|
3190
|
+
* @param executionId - Execution UUID.
|
|
3191
|
+
* @returns Execution status with per-node statuses.
|
|
3192
|
+
*/
|
|
3193
|
+
getExecutionStatus(workflowId: string, executionId: string): Promise<ExecutionStatus>;
|
|
3194
|
+
/**
|
|
3195
|
+
* Get the execution result for a specific node within a workflow execution.
|
|
3196
|
+
*
|
|
3197
|
+
* @param workflowId - Workflow UUID.
|
|
3198
|
+
* @param executionId - Execution UUID.
|
|
3199
|
+
* @param nodeId - Node UUID.
|
|
3200
|
+
* @returns Node execution result with input, output, and logs.
|
|
3201
|
+
*/
|
|
3202
|
+
getNodeExecutionResult(workflowId: string, executionId: string, nodeId: string): Promise<NodeExecutionResult>;
|
|
3203
|
+
/**
|
|
3204
|
+
* Stop a running workflow execution.
|
|
3205
|
+
*
|
|
3206
|
+
* @param workflowId - Workflow UUID.
|
|
3207
|
+
* @param executionId - Execution UUID.
|
|
3208
|
+
* @returns Updated execution status.
|
|
3209
|
+
*/
|
|
3210
|
+
stopExecution(workflowId: string, executionId: string): Promise<ExecutionStatus>;
|
|
3211
|
+
}
|
|
3212
|
+
|
|
3213
|
+
interface NexusClientOptions {
|
|
3214
|
+
/**
|
|
3215
|
+
* API key for authentication. Falls back to `NEXUS_API_KEY` env var.
|
|
3216
|
+
* Generate one in the Nexus dashboard under Settings > API Keys.
|
|
3217
|
+
*/
|
|
3218
|
+
apiKey?: string;
|
|
3219
|
+
/**
|
|
3220
|
+
* Base URL of the Nexus API. Falls back to `NEXUS_BASE_URL` env var,
|
|
3221
|
+
* then defaults to `https://api.nexusgpt.io`.
|
|
3222
|
+
*/
|
|
3223
|
+
baseUrl?: string;
|
|
3224
|
+
/**
|
|
3225
|
+
* Custom `fetch` implementation (e.g., for testing or non-standard runtimes).
|
|
3226
|
+
* Defaults to the global `fetch`.
|
|
3227
|
+
*/
|
|
3228
|
+
fetch?: typeof globalThis.fetch;
|
|
3229
|
+
/**
|
|
3230
|
+
* Additional headers sent with every request.
|
|
3231
|
+
*/
|
|
3232
|
+
defaultHeaders?: Record<string, string>;
|
|
3233
|
+
/**
|
|
3234
|
+
* Request timeout in milliseconds. Defaults to 30 000 (30 s).
|
|
3235
|
+
*/
|
|
3236
|
+
timeout?: number;
|
|
3237
|
+
}
|
|
3238
|
+
/**
|
|
3239
|
+
* Main entry point for the Nexus SDK.
|
|
3240
|
+
*
|
|
3241
|
+
* ```ts
|
|
3242
|
+
* import { NexusClient } from "@agent-nexus/sdk";
|
|
3243
|
+
*
|
|
3244
|
+
* const client = new NexusClient({ apiKey: "nxs_..." });
|
|
3245
|
+
*
|
|
3246
|
+
* // Agents
|
|
3247
|
+
* const { data: agents } = await client.agents.list();
|
|
3248
|
+
* const agent = await client.agents.create({ firstName: "A", lastName: "B", role: "Assistant" });
|
|
3249
|
+
*
|
|
3250
|
+
* // Agent tools (sub-resource)
|
|
3251
|
+
* const tools = await client.agents.tools.list(agent.id);
|
|
3252
|
+
*
|
|
3253
|
+
* // Prompt versions (sub-resource)
|
|
3254
|
+
* const { data: versions } = await client.agents.versions.list(agent.id);
|
|
3255
|
+
*
|
|
3256
|
+
* // Folders
|
|
3257
|
+
* const { folders } = await client.folders.list();
|
|
3258
|
+
*
|
|
3259
|
+
* // Tool discovery (search, detail, credentials, dynamic options, skills, test)
|
|
3260
|
+
* const results = await client.tools.search({ q: "gmail" });
|
|
3261
|
+
* const detail = await client.tools.get(results.tools[0].id);
|
|
3262
|
+
* ```
|
|
3263
|
+
*/
|
|
3264
|
+
declare class NexusClient {
|
|
3265
|
+
/** Manage agents, their tool configurations, and prompt versions. */
|
|
3266
|
+
readonly agents: AgentsResource;
|
|
3267
|
+
/** Create documents via file upload, text, website, or Google Sheet import. */
|
|
3268
|
+
readonly documents: DocumentsResource;
|
|
3269
|
+
/** Manage folders and agent-folder assignments. */
|
|
3270
|
+
readonly folders: FoldersResource;
|
|
3271
|
+
/** List available AI models for agents. */
|
|
3272
|
+
readonly models: ModelsResource;
|
|
3273
|
+
/** Discover marketplace tools, resolve dynamic options, list skills, and test configured tools. */
|
|
3274
|
+
readonly tools: ToolDiscoveryResource;
|
|
3275
|
+
/** Browse workflows, AI tasks, collections, and document templates. */
|
|
3276
|
+
readonly skills: SkillsResource;
|
|
3277
|
+
/** Manage workflows, nodes, edges, and test executions. */
|
|
3278
|
+
readonly workflows: WorkflowsResource;
|
|
3279
|
+
/** Connect tools via OAuth or HTTP credentials. */
|
|
3280
|
+
readonly toolConnection: ToolConnectionResource;
|
|
3281
|
+
/** Deploy agents to channels (web widget, WhatsApp, Telegram, etc.). */
|
|
3282
|
+
readonly deployments: DeploymentsResource;
|
|
3283
|
+
/** Test deployments with the emulator — sessions, messages, and replayable scenarios. */
|
|
3284
|
+
readonly emulator: EmulatorResource;
|
|
3285
|
+
/** Organize deployments into folders. */
|
|
3286
|
+
readonly deploymentFolders: DeploymentFoldersResource;
|
|
3287
|
+
/** Organize document templates into folders. */
|
|
3288
|
+
readonly documentTemplateFolders: DocumentTemplateFoldersResource;
|
|
3289
|
+
/** Organization analytics and metrics. */
|
|
3290
|
+
readonly analytics: AnalyticsResource;
|
|
3291
|
+
/** Attach knowledge collections to agents. */
|
|
3292
|
+
readonly agentCollections: AgentCollectionsResource;
|
|
3293
|
+
/** View and debug workflow execution history. */
|
|
3294
|
+
readonly workflowExecutions: WorkflowExecutionsResource;
|
|
3295
|
+
/** Evaluate and benchmark AI tasks. */
|
|
3296
|
+
readonly evaluations: EvaluationsResource;
|
|
3297
|
+
/** Import documents from Google Drive, SharePoint, Notion. */
|
|
3298
|
+
readonly cloudImports: CloudImportsResource;
|
|
3299
|
+
/** Chat with AI to generate high-quality prompts for agents and AI tasks. */
|
|
3300
|
+
readonly promptAssistant: PromptAssistantResource;
|
|
3301
|
+
/** Create and manage support tickets. */
|
|
3302
|
+
readonly tickets: TicketsResource;
|
|
3303
|
+
constructor(opts?: NexusClientOptions);
|
|
3304
|
+
}
|
|
3305
|
+
|
|
3306
|
+
/** Base error class for all Nexus SDK errors. */
|
|
3307
|
+
declare class NexusError extends Error {
|
|
3308
|
+
constructor(message: string);
|
|
3309
|
+
}
|
|
3310
|
+
/**
|
|
3311
|
+
* Thrown when the Nexus API returns an error response (`{ success: false }`).
|
|
3312
|
+
*
|
|
3313
|
+
* Check `status` for the HTTP status code and `code` for the machine-readable
|
|
3314
|
+
* error code (e.g. `"NOT_FOUND"`, `"VALIDATION_ERROR"`).
|
|
3315
|
+
*/
|
|
3316
|
+
declare class NexusApiError extends NexusError {
|
|
3317
|
+
/** Machine-readable error code (e.g. `"NOT_FOUND"`, `"VALIDATION_ERROR"`). */
|
|
3318
|
+
readonly code: string;
|
|
3319
|
+
/** HTTP status code (e.g. 400, 404, 500). */
|
|
3320
|
+
readonly status: number;
|
|
3321
|
+
/** Additional error details (e.g. validation errors per field). */
|
|
3322
|
+
readonly details?: unknown;
|
|
3323
|
+
constructor(code: string, message: string, status: number, details?: unknown);
|
|
3324
|
+
}
|
|
3325
|
+
/** Thrown when the API returns a 401 status (invalid or missing API key). */
|
|
3326
|
+
declare class NexusAuthenticationError extends NexusApiError {
|
|
3327
|
+
constructor(message?: string);
|
|
3328
|
+
}
|
|
3329
|
+
/** Thrown when the request fails due to network issues or timeout. */
|
|
3330
|
+
declare class NexusConnectionError extends NexusError {
|
|
3331
|
+
/** The underlying error that caused the connection failure. */
|
|
3332
|
+
readonly cause?: Error;
|
|
3333
|
+
constructor(message: string, cause?: Error);
|
|
3334
|
+
}
|
|
3335
|
+
|
|
3336
|
+
export { type AddWebsiteDocumentBody, AgentCollectionsResource, type AgentDetail, type AgentFolder, type AgentModel, type AgentStatus, type AgentSummary, type AgentToolConfig, type AgentToolConfigType, AgentToolsResource, AgentsResource, AnalyticsResource, type AssignAgentToFolderBody, type AssignAgentToFolderResponse, type AttachCollectionDocumentsBody, type AttachCollectionDocumentsResponse, type AvailableVariable, type Branch, CloudImportsResource, type CollectionDetail, type CollectionSummary, type ConnectToolBody, type ConnectToolHttpBody, type ConnectToolHttpResponse, type ConnectToolOAuthBody, type ConnectToolOAuthResponse, type CreateAgentBody, type CreateAgentToolBody, type CreateBranchBody, type CreateCheckpointBody, type CreateEdgeBody, type CreateEmulatorSessionBody, type CreateFolderBody, type CreateGoogleSheetDocumentBody, type CreateNodeBody, type CreateTextDocumentBody, type CreateTicketBody, type CreateTicketCommentBody, type CreateWorkflowBody, type DeleteResponse, DeploymentFoldersResource, DeploymentsResource, type DocumentInfo, type DocumentTemplateDetail, DocumentTemplateFoldersResource, type DocumentTemplateSummary, DocumentsResource, type EmulatorDebugInfo, type EmulatorMessage, type EmulatorMessageFile, type EmulatorParticipant, EmulatorResource, type EmulatorScenario, type EmulatorScenarioDetail, type EmulatorScenarioMessage, type EmulatorSendMessageResult, type EmulatorSession, type EmulatorSessionDetail, EvaluationsResource, type ExecutionStatus, type FolderAssignment, FoldersResource, type GetToolDetailParams, type GoogleSheetResult, type HandshakeStatusResponse, HttpClient, type HttpClientOptions, type IconResult, type ListAgentsParams, type ListCollectionsResponse, type ListDocumentTemplatesResponse, type ListEmulatorScenariosParams, type ListFoldersResponse, type ListSkillsCommonParams, type ListSkillsParams, type ListSkillsResponse, type ListTasksResponse, type ListTicketsParams, type ListToolCredentialsResponse, type ListVersionsParams, type ListWorkflowsParams, type ListWorkflowsResponse, type MarketplaceToolDetail, type MarketplaceToolItem, type ModelConfig, type ModelProvider, type ModelSummary, ModelsResource, NexusApiError, NexusAuthenticationError, NexusClient, type NexusClientOptions, NexusConnectionError, NexusError, type NodeExecutionResult, type NodeTypeSchema, type NodeTypeSummary, type OutputFormat, type PageResponse, type PaginationMeta, type PaginationParams, type PromptAssistantChatBody, type PromptAssistantChatResponse, PromptAssistantResource, type PromptAssistantThreadMessage, type PromptAssistantThreadResponse, type PromptResult, type PublishResult, type ReloadPropsBody, type ReloadPropsResponse, type RemoteOption, type ReplaceTriggerBody, type ReplayEmulatorScenarioBody, type RequestOptions, type ResolveRemoteOptionsBody, type ResolveRemoteOptionsResponse, type RestoreVersionResponse, type SaveEmulatorScenarioBody, type SearchMarketplaceToolsParams, type SearchMarketplaceToolsResponse, type SendEmulatorMessageBody, type SkillItem, SkillsResource, type TaskDetail, type TaskSummary, type TestAgentToolBody, type TestAgentToolResponse, type TestNodeBody, type TestResult, type TestWorkflowBody, type TicketAttachment, type TicketComment, type TicketContext, type TicketDetail, type TicketPriority, type TicketSummary, type TicketType, TicketsResource, type ToolAction, type ToolActionParameter, ToolConnectionResource, type ToolCredential, ToolDiscoveryResource, type UnpublishResult, type UpdateAgentBody, type UpdateAgentToolBody, type UpdateBranchBody, type UpdateFolderBody, type UpdateNodeBody, type UpdateTicketBody, type UpdateVersionBody, type UpdateWorkflowBody, type UploadProfilePictureResponse, type ValidationReport, type VersionCreator, type VersionDetail, type VersionSummary, type VersionType, VersionsResource, type WfSummary, type WorkflowDetail, type WorkflowEdge, WorkflowExecutionsResource, type WorkflowNode, type WorkflowOverview, type WorkflowStatus, type WorkflowSummary, WorkflowsResource };
|