cyberdesk 1.8.0 → 1.10.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/dist/index.d.ts CHANGED
@@ -1,9 +1,58 @@
1
- import { type MachineResponse, type WorkflowResponse, type RunResponse, type ConnectionResponse, type TrajectoryResponse, type PaginatedResponseMachineResponse, type PaginatedResponseWorkflowResponse, type PaginatedResponseRunResponse, type PaginatedResponseConnectionResponse, type PaginatedResponseTrajectoryResponse, type MachineStatus, type RunStatus, type ConnectionStatus, type MachineCreate, type WorkflowCreate, type RunCreate, type ConnectionCreate, type TrajectoryCreate, type MachineUpdate, type WorkflowUpdate, type RunUpdate, type TrajectoryUpdate } from './client/types.gen';
1
+ /**
2
+ * @fileoverview Cyberdesk TypeScript SDK
3
+ *
4
+ * A comprehensive SDK for interacting with the Cyberdesk Cloud API.
5
+ * Provides typed methods for managing machines, workflows, runs, and more.
6
+ *
7
+ * @module cyberdesk
8
+ * @example
9
+ * ```typescript
10
+ * import { createCyberdeskClient } from 'cyberdesk';
11
+ *
12
+ * const client = createCyberdeskClient('your-api-key');
13
+ *
14
+ * // List machines
15
+ * const { data: machines } = await client.machines.list();
16
+ *
17
+ * // Create and run a workflow
18
+ * const { data: workflow } = await client.workflows.create({
19
+ * name: 'My Workflow',
20
+ * main_prompt: 'Perform this task...'
21
+ * });
22
+ *
23
+ * const { data: run } = await client.runs.create({
24
+ * workflow_id: workflow.id
25
+ * });
26
+ * ```
27
+ */
28
+ import { type MachineResponse, type WorkflowResponse, type RunResponse, type ConnectionResponse, type TrajectoryResponse, type PaginatedResponseMachineResponse, type PaginatedResponseWorkflowResponse, type PaginatedResponseRunResponse, type PaginatedResponseConnectionResponse, type PaginatedResponseTrajectoryResponse, type MachineStatus, type RunStatus, type ConnectionStatus, type MachineCreate, type WorkflowCreate, type RunCreate, type FileInput, type ConnectionCreate, type TrajectoryCreate, type MachineUpdate, type WorkflowUpdate, type RunUpdate, type TrajectoryUpdate, type RunAttachmentCreate, type RunAttachmentUpdate, type RunAttachmentResponse, type RunAttachmentDownloadUrlResponse, type AttachmentType, type PaginatedResponseRunAttachmentResponse } from './client/types.gen';
2
29
  export * from './client/types.gen';
3
30
  export * from './client/sdk.gen';
4
31
  export * from './client/client.gen';
32
+ /**
33
+ * Create a Cyberdesk API client
34
+ *
35
+ * @param apiKey - Your Cyberdesk API key
36
+ * @param baseUrl - Optional API base URL (defaults to https://api.cyberdesk.io)
37
+ * @returns Configured client with all API endpoints
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * const client = createCyberdeskClient('your-api-key');
42
+ * const machines = await client.machines.list();
43
+ * ```
44
+ */
5
45
  export declare function createCyberdeskClient(apiKey: string, baseUrl?: string): {
6
46
  machines: {
47
+ /**
48
+ * List machines with optional filtering
49
+ *
50
+ * @param params - Optional query parameters
51
+ * @param params.skip - Number of items to skip (for pagination)
52
+ * @param params.limit - Maximum number of items to return
53
+ * @param params.status - Filter by machine status
54
+ * @returns Paginated list of machines
55
+ */
7
56
  list: (params?: {
8
57
  skip?: number;
9
58
  limit?: number;
@@ -12,18 +61,42 @@ export declare function createCyberdeskClient(apiKey: string, baseUrl?: string):
12
61
  data?: PaginatedResponseMachineResponse;
13
62
  error?: any;
14
63
  }>;
64
+ /**
65
+ * Create a new machine
66
+ *
67
+ * @param data - Machine configuration
68
+ * @returns Created machine details
69
+ */
15
70
  create: (data: MachineCreate) => Promise<{
16
71
  data?: MachineResponse;
17
72
  error?: any;
18
73
  }>;
74
+ /**
75
+ * Get a specific machine by ID
76
+ *
77
+ * @param machineId - The ID of the machine
78
+ * @returns Machine details
79
+ */
19
80
  get: (machineId: string) => Promise<{
20
81
  data?: MachineResponse;
21
82
  error?: any;
22
83
  }>;
84
+ /**
85
+ * Update a machine
86
+ *
87
+ * @param machineId - The ID of the machine to update
88
+ * @param data - Update data (name, status, availability, etc.)
89
+ * @returns Updated machine details
90
+ */
23
91
  update: (machineId: string, data: MachineUpdate) => Promise<{
24
92
  data?: MachineResponse;
25
93
  error?: any;
26
94
  }>;
95
+ /**
96
+ * Delete a machine
97
+ *
98
+ * @param machineId - The ID of the machine to delete
99
+ */
27
100
  delete: (machineId: string) => Promise<({
28
101
  data: undefined;
29
102
  error: import("./client/types.gen").HttpValidationError;
@@ -36,6 +109,14 @@ export declare function createCyberdeskClient(apiKey: string, baseUrl?: string):
36
109
  }>;
37
110
  };
38
111
  workflows: {
112
+ /**
113
+ * List workflows
114
+ *
115
+ * @param params - Optional query parameters
116
+ * @param params.skip - Number of items to skip (for pagination)
117
+ * @param params.limit - Maximum number of items to return
118
+ * @returns Paginated list of workflows
119
+ */
39
120
  list: (params?: {
40
121
  skip?: number;
41
122
  limit?: number;
@@ -43,18 +124,51 @@ export declare function createCyberdeskClient(apiKey: string, baseUrl?: string):
43
124
  data?: PaginatedResponseWorkflowResponse;
44
125
  error?: any;
45
126
  }>;
127
+ /**
128
+ * Create a new workflow
129
+ *
130
+ * @param data - Workflow configuration including name and main prompt
131
+ * @returns Created workflow details
132
+ *
133
+ * @example
134
+ * ```typescript
135
+ * const workflow = await client.workflows.create({
136
+ * name: 'My Workflow',
137
+ * main_prompt: 'Perform this task...',
138
+ * includes_file_exports: true
139
+ * });
140
+ * ```
141
+ */
46
142
  create: (data: WorkflowCreate) => Promise<{
47
143
  data?: WorkflowResponse;
48
144
  error?: any;
49
145
  }>;
146
+ /**
147
+ * Get a specific workflow by ID
148
+ *
149
+ * @param workflowId - The ID of the workflow
150
+ * @returns Workflow details
151
+ */
50
152
  get: (workflowId: string) => Promise<{
51
153
  data?: WorkflowResponse;
52
154
  error?: any;
53
155
  }>;
156
+ /**
157
+ * Update a workflow
158
+ *
159
+ * @param workflowId - The ID of the workflow to update
160
+ * @param data - Update data (name, main_prompt, output_schema, etc.)
161
+ * @returns Updated workflow details
162
+ */
54
163
  update: (workflowId: string, data: WorkflowUpdate) => Promise<{
55
164
  data?: WorkflowResponse;
56
165
  error?: any;
57
166
  }>;
167
+ /**
168
+ * Delete a workflow
169
+ *
170
+ * @param workflowId - The ID of the workflow to delete
171
+ */
58
172
  delete: (workflowId: string) => Promise<({
59
173
  data: undefined;
60
174
  error: import("./client/types.gen").HttpValidationError;
@@ -67,6 +181,17 @@ export declare function createCyberdeskClient(apiKey: string, baseUrl?: string):
67
181
  }>;
68
182
  };
69
183
  runs: {
184
+ /**
185
+ * List runs with optional filtering
186
+ *
187
+ * @param params - Optional query parameters
188
+ * @param params.skip - Number of items to skip (for pagination)
189
+ * @param params.limit - Maximum number of items to return
190
+ * @param params.status - Filter by run status (scheduling, running, success, cancelled, error)
191
+ * @param params.workflow_id - Filter by workflow ID
192
+ * @param params.machine_id - Filter by machine ID
193
+ * @returns Paginated list of runs
194
+ */
70
195
  list: (params?: {
71
196
  skip?: number;
72
197
  limit?: number;
@@ -77,18 +202,60 @@ export declare function createCyberdeskClient(apiKey: string, baseUrl?: string):
77
202
  data?: PaginatedResponseRunResponse;
78
203
  error?: any;
79
204
  }>;
205
+ /**
206
+ * Create a new run
207
+ *
208
+ * @param data - Run configuration
209
+ * @param data.workflow_id - The workflow to run
210
+ * @param data.machine_id - Optional machine ID (auto-selected if not provided)
211
+ * @param data.input_values - Optional input values for workflow variables
212
+ * @param data.file_inputs - Optional files to upload to the machine
213
+ * @returns Created run details
214
+ *
215
+ * @example
216
+ * ```typescript
217
+ * const run = await client.runs.create({
218
+ * workflow_id: 'workflow-id',
219
+ * input_values: { prompt: 'Hello' },
220
+ * file_inputs: [{
221
+ * filename: 'data.txt',
222
+ * content: 'base64-encoded-content',
223
+ * target_path: '~/CyberdeskTransfers/',
224
+ * cleanup_imports_after_run: true
225
+ * }]
226
+ * });
227
+ * ```
228
+ */
80
229
  create: (data: RunCreate) => Promise<{
81
230
  data?: RunResponse;
82
231
  error?: any;
83
232
  }>;
233
+ /**
234
+ * Get a specific run by ID
235
+ *
236
+ * @param runId - The ID of the run
237
+ * @returns Run details including status, output, and attachments
238
+ */
84
239
  get: (runId: string) => Promise<{
85
240
  data?: RunResponse;
86
241
  error?: any;
87
242
  }>;
243
+ /**
244
+ * Update a run
245
+ *
246
+ * @param runId - The ID of the run to update
247
+ * @param data - Update data (status, output_data, error messages, etc.)
248
+ * @returns Updated run details
249
+ */
88
250
  update: (runId: string, data: RunUpdate) => Promise<{
89
251
  data?: RunResponse;
90
252
  error?: any;
91
253
  }>;
254
+ /**
255
+ * Delete a run
256
+ *
257
+ * @param runId - The ID of the run to delete
258
+ */
92
259
  delete: (runId: string) => Promise<({
93
260
  data: undefined;
94
261
  error: import("./client/types.gen").HttpValidationError;
@@ -101,6 +268,16 @@ export declare function createCyberdeskClient(apiKey: string, baseUrl?: string):
101
268
  }>;
102
269
  };
103
270
  connections: {
271
+ /**
272
+ * List connections with optional filtering
273
+ *
274
+ * @param params - Optional query parameters
275
+ * @param params.skip - Number of items to skip (for pagination)
276
+ * @param params.limit - Maximum number of items to return
277
+ * @param params.machine_id - Filter by machine ID
278
+ * @param params.status - Filter by connection status
279
+ * @returns Paginated list of connections
280
+ */
104
281
  list: (params?: {
105
282
  skip?: number;
106
283
  limit?: number;
@@ -110,12 +287,27 @@ export declare function createCyberdeskClient(apiKey: string, baseUrl?: string):
110
287
  data?: PaginatedResponseConnectionResponse;
111
288
  error?: any;
112
289
  }>;
290
+ /**
291
+ * Create a new connection
292
+ *
293
+ * @param data - Connection data including machine ID and websocket info
294
+ * @returns Created connection details
295
+ */
113
296
  create: (data: ConnectionCreate) => Promise<{
114
297
  data?: ConnectionResponse;
115
298
  error?: any;
116
299
  }>;
117
300
  };
118
301
  trajectories: {
302
+ /**
303
+ * List trajectories with optional filtering
304
+ *
305
+ * @param params - Optional query parameters
306
+ * @param params.skip - Number of items to skip (for pagination)
307
+ * @param params.limit - Maximum number of items to return
308
+ * @param params.workflow_id - Filter by workflow ID
309
+ * @returns Paginated list of trajectories
310
+ */
119
311
  list: (params?: {
120
312
  skip?: number;
121
313
  limit?: number;
@@ -124,18 +316,48 @@ export declare function createCyberdeskClient(apiKey: string, baseUrl?: string):
124
316
  data?: PaginatedResponseTrajectoryResponse;
125
317
  error?: any;
126
318
  }>;
319
+ /**
320
+ * Create a new trajectory
321
+ *
322
+ * A trajectory represents a recorded sequence of actions for a workflow.
323
+ *
324
+ * @param data - Trajectory data
325
+ * @param data.workflow_id - The workflow this trajectory belongs to
326
+ * @param data.trajectory_data - Array of recorded actions
327
+ * @param data.dimensions - Display dimensions when trajectory was recorded
328
+ * @param data.original_input_values - Input values used during recording
329
+ * @returns Created trajectory details
330
+ */
127
331
  create: (data: TrajectoryCreate) => Promise<{
128
332
  data?: TrajectoryResponse;
129
333
  error?: any;
130
334
  }>;
335
+ /**
336
+ * Get a specific trajectory by ID
337
+ *
338
+ * @param trajectoryId - The ID of the trajectory
339
+ * @returns Trajectory details including recorded actions
340
+ */
131
341
  get: (trajectoryId: string) => Promise<{
132
342
  data?: TrajectoryResponse;
133
343
  error?: any;
134
344
  }>;
345
+ /**
346
+ * Update a trajectory
347
+ *
348
+ * @param trajectoryId - The ID of the trajectory to update
349
+ * @param data - Update data (trajectory_data)
350
+ * @returns Updated trajectory details
351
+ */
135
352
  update: (trajectoryId: string, data: TrajectoryUpdate) => Promise<{
136
353
  data?: TrajectoryResponse;
137
354
  error?: any;
138
355
  }>;
356
+ /**
357
+ * Delete a trajectory
358
+ *
359
+ * @param trajectoryId - The ID of the trajectory to delete
360
+ */
139
361
  delete: (trajectoryId: string) => Promise<({
140
362
  data: undefined;
141
363
  error: import("./client/types.gen").HttpValidationError;
@@ -146,10 +368,130 @@ export declare function createCyberdeskClient(apiKey: string, baseUrl?: string):
146
368
  request: Request;
147
369
  response: Response;
148
370
  }>;
371
+ /**
372
+ * Get the latest trajectory for a workflow
373
+ *
374
+ * Returns the most recently created trajectory for the specified workflow.
375
+ * Useful for replaying the latest recorded actions.
376
+ *
377
+ * @param workflowId - The ID of the workflow
378
+ * @returns Latest trajectory for the workflow, or null if none exists
379
+ */
149
380
  getLatestForWorkflow: (workflowId: string) => Promise<{
150
381
  data?: TrajectoryResponse;
151
382
  error?: any;
152
383
  }>;
153
384
  };
385
+ run_attachments: {
386
+ /**
387
+ * List run attachments with optional filtering
388
+ *
389
+ * @param params - Optional query parameters
390
+ * @param params.skip - Number of items to skip (for pagination)
391
+ * @param params.limit - Maximum number of items to return
392
+ * @param params.run_id - Filter by run ID
393
+ * @param params.attachment_type - Filter by attachment type (input/output)
394
+ * @returns Paginated list of run attachments
395
+ */
396
+ list: (params?: {
397
+ skip?: number;
398
+ limit?: number;
399
+ run_id?: string;
400
+ attachment_type?: AttachmentType;
401
+ }) => Promise<{
402
+ data?: PaginatedResponseRunAttachmentResponse;
403
+ error?: any;
404
+ }>;
405
+ /**
406
+ * Create a new run attachment
407
+ *
408
+ * @param data - Attachment data including file content as base64
409
+ * @returns Created attachment details
410
+ */
411
+ create: (data: RunAttachmentCreate) => Promise<{
412
+ data?: RunAttachmentResponse;
413
+ error?: any;
414
+ }>;
415
+ /**
416
+ * Get run attachment details
417
+ *
418
+ * @param attachmentId - The ID of the attachment
419
+ * @returns Attachment metadata
420
+ */
421
+ get: (attachmentId: string) => Promise<{
422
+ data?: RunAttachmentResponse;
423
+ error?: any;
424
+ }>;
425
+ /**
426
+ * Get a signed download URL for a run attachment
427
+ *
428
+ * The returned URL will trigger an automatic download when accessed in a browser.
429
+ *
430
+ * @param attachmentId - The ID of the attachment
431
+ * @param expiresIn - URL expiration time in seconds (10-3600). Default: 300 (5 minutes)
432
+ * @returns Object containing the signed URL and expiration time
433
+ *
434
+ * @example
435
+ * ```typescript
436
+ * const { data } = await client.run_attachments.getDownloadUrl('attachment-id', 600);
437
+ * if (data) {
438
+ * console.log(`Download URL: ${data.url}`);
439
+ * console.log(`Expires in: ${data.expires_in} seconds`);
440
+ * }
441
+ * ```
442
+ */
443
+ getDownloadUrl: (attachmentId: string, expiresIn?: number) => Promise<{
444
+ data?: RunAttachmentDownloadUrlResponse;
445
+ error?: any;
446
+ }>;
447
+ /**
448
+ * Download a run attachment file directly
449
+ *
450
+ * This method returns the raw file content. For a download URL instead,
451
+ * use `getDownloadUrl()`.
452
+ *
453
+ * @param attachmentId - The ID of the attachment to download
454
+ * @returns Raw file data
455
+ *
456
+ * @example
457
+ * ```typescript
458
+ * const { data } = await client.run_attachments.download('attachment-id');
459
+ * if (data) {
460
+ * // Handle raw file bytes
461
+ * const blob = new Blob([data]);
462
+ * }
463
+ * ```
464
+ */
465
+ download: (attachmentId: string) => Promise<{
466
+ data?: any;
467
+ error?: any;
468
+ }>;
469
+ /**
470
+ * Update a run attachment (e.g., set expiration)
471
+ *
472
+ * @param attachmentId - The ID of the attachment to update
473
+ * @param data - Update data
474
+ * @returns Updated attachment details
475
+ */
476
+ update: (attachmentId: string, data: RunAttachmentUpdate) => Promise<{
477
+ data?: RunAttachmentResponse;
478
+ error?: any;
479
+ }>;
480
+ /**
481
+ * Delete a run attachment
482
+ *
483
+ * @param attachmentId - The ID of the attachment to delete
484
+ */
485
+ delete: (attachmentId: string) => Promise<({
486
+ data: undefined;
487
+ error: import("./client/types.gen").HttpValidationError;
488
+ } | {
489
+ data: void;
490
+ error: undefined;
491
+ }) & {
492
+ request: Request;
493
+ response: Response;
494
+ }>;
495
+ };
154
496
  };
155
- export type { MachineResponse, WorkflowResponse, RunResponse, ConnectionResponse, TrajectoryResponse, PaginatedResponseMachineResponse, PaginatedResponseWorkflowResponse, PaginatedResponseRunResponse, PaginatedResponseConnectionResponse, PaginatedResponseTrajectoryResponse, };
497
+ export type { MachineResponse, WorkflowResponse, RunResponse, ConnectionResponse, TrajectoryResponse, RunAttachmentResponse, RunAttachmentDownloadUrlResponse, FileInput, AttachmentType, PaginatedResponseMachineResponse, PaginatedResponseWorkflowResponse, PaginatedResponseRunResponse, PaginatedResponseConnectionResponse, PaginatedResponseTrajectoryResponse, PaginatedResponseRunAttachmentResponse, };