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.js CHANGED
@@ -1,4 +1,31 @@
1
1
  "use strict";
2
+ /**
3
+ * @fileoverview Cyberdesk TypeScript SDK
4
+ *
5
+ * A comprehensive SDK for interacting with the Cyberdesk Cloud API.
6
+ * Provides typed methods for managing machines, workflows, runs, and more.
7
+ *
8
+ * @module cyberdesk
9
+ * @example
10
+ * ```typescript
11
+ * import { createCyberdeskClient } from 'cyberdesk';
12
+ *
13
+ * const client = createCyberdeskClient('your-api-key');
14
+ *
15
+ * // List machines
16
+ * const { data: machines } = await client.machines.list();
17
+ *
18
+ * // Create and run a workflow
19
+ * const { data: workflow } = await client.workflows.create({
20
+ * name: 'My Workflow',
21
+ * main_prompt: 'Perform this task...'
22
+ * });
23
+ *
24
+ * const { data: run } = await client.runs.create({
25
+ * workflow_id: workflow.id
26
+ * });
27
+ * ```
28
+ */
2
29
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
30
  if (k2 === undefined) k2 = k;
4
31
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -32,8 +59,16 @@ __exportStar(require("./client/types.gen"), exports);
32
59
  __exportStar(require("./client/sdk.gen"), exports);
33
60
  __exportStar(require("./client/client.gen"), exports);
34
61
  // Configuration
62
+ /** Default API base URL for Cyberdesk Cloud API */
35
63
  const DEFAULT_API_BASE_URL = "https://api.cyberdesk.io";
36
- // Create configured client with API key and connection reuse
64
+ /**
65
+ * Create a configured HTTP client with authentication
66
+ *
67
+ * @internal
68
+ * @param apiKey - Your Cyberdesk API key
69
+ * @param baseUrl - API base URL
70
+ * @returns Configured HTTP client
71
+ */
37
72
  function createApiClient(apiKey, baseUrl = DEFAULT_API_BASE_URL) {
38
73
  return (0, client_fetch_1.createClient)({
39
74
  baseUrl,
@@ -44,30 +79,70 @@ function createApiClient(apiKey, baseUrl = DEFAULT_API_BASE_URL) {
44
79
  },
45
80
  });
46
81
  }
47
- // Create API client with your API key
82
+ /**
83
+ * Create a Cyberdesk API client
84
+ *
85
+ * @param apiKey - Your Cyberdesk API key
86
+ * @param baseUrl - Optional API base URL (defaults to https://api.cyberdesk.io)
87
+ * @returns Configured client with all API endpoints
88
+ *
89
+ * @example
90
+ * ```typescript
91
+ * const client = createCyberdeskClient('your-api-key');
92
+ * const machines = await client.machines.list();
93
+ * ```
94
+ */
48
95
  function createCyberdeskClient(apiKey, baseUrl) {
49
96
  const client = createApiClient(apiKey, baseUrl);
50
97
  return {
51
98
  // Machine endpoints
52
99
  machines: {
100
+ /**
101
+ * List machines with optional filtering
102
+ *
103
+ * @param params - Optional query parameters
104
+ * @param params.skip - Number of items to skip (for pagination)
105
+ * @param params.limit - Maximum number of items to return
106
+ * @param params.status - Filter by machine status
107
+ * @returns Paginated list of machines
108
+ */
53
109
  list: (params) => __awaiter(this, void 0, void 0, function* () {
54
110
  return (0, sdk_gen_1.listMachinesV1MachinesGet)({
55
111
  client,
56
112
  query: params,
57
113
  });
58
114
  }),
115
+ /**
116
+ * Create a new machine
117
+ *
118
+ * @param data - Machine configuration
119
+ * @returns Created machine details
120
+ */
59
121
  create: (data) => __awaiter(this, void 0, void 0, function* () {
60
122
  return (0, sdk_gen_1.createMachineV1MachinesPost)({
61
123
  client,
62
124
  body: data,
63
125
  });
64
126
  }),
127
+ /**
128
+ * Get a specific machine by ID
129
+ *
130
+ * @param machineId - The ID of the machine
131
+ * @returns Machine details
132
+ */
65
133
  get: (machineId) => __awaiter(this, void 0, void 0, function* () {
66
134
  return (0, sdk_gen_1.getMachineV1MachinesMachineIdGet)({
67
135
  client,
68
136
  path: { machine_id: machineId },
69
137
  });
70
138
  }),
139
+ /**
140
+ * Update a machine
141
+ *
142
+ * @param machineId - The ID of the machine to update
143
+ * @param data - Update data (name, status, availability, etc.)
144
+ * @returns Updated machine details
145
+ */
71
146
  update: (machineId, data) => __awaiter(this, void 0, void 0, function* () {
72
147
  return (0, sdk_gen_1.updateMachineV1MachinesMachineIdPatch)({
73
148
  client,
@@ -75,6 +150,11 @@ function createCyberdeskClient(apiKey, baseUrl) {
75
150
  body: data,
76
151
  });
77
152
  }),
153
+ /**
154
+ * Delete a machine
155
+ *
156
+ * @param machineId - The ID of the machine to delete
157
+ */
78
158
  delete: (machineId) => __awaiter(this, void 0, void 0, function* () {
79
159
  return (0, sdk_gen_1.deleteMachineV1MachinesMachineIdDelete)({
80
160
  client,
@@ -84,24 +164,60 @@ function createCyberdeskClient(apiKey, baseUrl) {
84
164
  },
85
165
  // Workflow endpoints
86
166
  workflows: {
167
+ /**
168
+ * List workflows
169
+ *
170
+ * @param params - Optional query parameters
171
+ * @param params.skip - Number of items to skip (for pagination)
172
+ * @param params.limit - Maximum number of items to return
173
+ * @returns Paginated list of workflows
174
+ */
87
175
  list: (params) => __awaiter(this, void 0, void 0, function* () {
88
176
  return (0, sdk_gen_1.listWorkflowsV1WorkflowsGet)({
89
177
  client,
90
178
  query: params,
91
179
  });
92
180
  }),
181
+ /**
182
+ * Create a new workflow
183
+ *
184
+ * @param data - Workflow configuration including name and main prompt
185
+ * @returns Created workflow details
186
+ *
187
+ * @example
188
+ * ```typescript
189
+ * const workflow = await client.workflows.create({
190
+ * name: 'My Workflow',
191
+ * main_prompt: 'Perform this task...',
192
+ * includes_file_exports: true
193
+ * });
194
+ * ```
195
+ */
93
196
  create: (data) => __awaiter(this, void 0, void 0, function* () {
94
197
  return (0, sdk_gen_1.createWorkflowV1WorkflowsPost)({
95
198
  client,
96
199
  body: data,
97
200
  });
98
201
  }),
202
+ /**
203
+ * Get a specific workflow by ID
204
+ *
205
+ * @param workflowId - The ID of the workflow
206
+ * @returns Workflow details
207
+ */
99
208
  get: (workflowId) => __awaiter(this, void 0, void 0, function* () {
100
209
  return (0, sdk_gen_1.getWorkflowV1WorkflowsWorkflowIdGet)({
101
210
  client,
102
211
  path: { workflow_id: workflowId },
103
212
  });
104
213
  }),
214
+ /**
215
+ * Update a workflow
216
+ *
217
+ * @param workflowId - The ID of the workflow to update
218
+ * @param data - Update data (name, main_prompt, output_schema, etc.)
219
+ * @returns Updated workflow details
220
+ */
105
221
  update: (workflowId, data) => __awaiter(this, void 0, void 0, function* () {
106
222
  return (0, sdk_gen_1.updateWorkflowV1WorkflowsWorkflowIdPatch)({
107
223
  client,
@@ -109,6 +225,11 @@ function createCyberdeskClient(apiKey, baseUrl) {
109
225
  body: data,
110
226
  });
111
227
  }),
228
+ /**
229
+ * Delete a workflow
230
+ *
231
+ * @param workflowId - The ID of the workflow to delete
232
+ */
112
233
  delete: (workflowId) => __awaiter(this, void 0, void 0, function* () {
113
234
  return (0, sdk_gen_1.deleteWorkflowV1WorkflowsWorkflowIdDelete)({
114
235
  client,
@@ -118,24 +239,72 @@ function createCyberdeskClient(apiKey, baseUrl) {
118
239
  },
119
240
  // Run endpoints
120
241
  runs: {
242
+ /**
243
+ * List runs with optional filtering
244
+ *
245
+ * @param params - Optional query parameters
246
+ * @param params.skip - Number of items to skip (for pagination)
247
+ * @param params.limit - Maximum number of items to return
248
+ * @param params.status - Filter by run status (scheduling, running, success, cancelled, error)
249
+ * @param params.workflow_id - Filter by workflow ID
250
+ * @param params.machine_id - Filter by machine ID
251
+ * @returns Paginated list of runs
252
+ */
121
253
  list: (params) => __awaiter(this, void 0, void 0, function* () {
122
254
  return (0, sdk_gen_1.listRunsV1RunsGet)({
123
255
  client,
124
256
  query: params,
125
257
  });
126
258
  }),
259
+ /**
260
+ * Create a new run
261
+ *
262
+ * @param data - Run configuration
263
+ * @param data.workflow_id - The workflow to run
264
+ * @param data.machine_id - Optional machine ID (auto-selected if not provided)
265
+ * @param data.input_values - Optional input values for workflow variables
266
+ * @param data.file_inputs - Optional files to upload to the machine
267
+ * @returns Created run details
268
+ *
269
+ * @example
270
+ * ```typescript
271
+ * const run = await client.runs.create({
272
+ * workflow_id: 'workflow-id',
273
+ * input_values: { prompt: 'Hello' },
274
+ * file_inputs: [{
275
+ * filename: 'data.txt',
276
+ * content: 'base64-encoded-content',
277
+ * target_path: '~/CyberdeskTransfers/',
278
+ * cleanup_imports_after_run: true
279
+ * }]
280
+ * });
281
+ * ```
282
+ */
127
283
  create: (data) => __awaiter(this, void 0, void 0, function* () {
128
284
  return (0, sdk_gen_1.createRunV1RunsPost)({
129
285
  client,
130
286
  body: data,
131
287
  });
132
288
  }),
289
+ /**
290
+ * Get a specific run by ID
291
+ *
292
+ * @param runId - The ID of the run
293
+ * @returns Run details including status, output, and attachments
294
+ */
133
295
  get: (runId) => __awaiter(this, void 0, void 0, function* () {
134
296
  return (0, sdk_gen_1.getRunV1RunsRunIdGet)({
135
297
  client,
136
298
  path: { run_id: runId },
137
299
  });
138
300
  }),
301
+ /**
302
+ * Update a run
303
+ *
304
+ * @param runId - The ID of the run to update
305
+ * @param data - Update data (status, output_data, error messages, etc.)
306
+ * @returns Updated run details
307
+ */
139
308
  update: (runId, data) => __awaiter(this, void 0, void 0, function* () {
140
309
  return (0, sdk_gen_1.updateRunV1RunsRunIdPatch)({
141
310
  client,
@@ -143,6 +312,11 @@ function createCyberdeskClient(apiKey, baseUrl) {
143
312
  body: data,
144
313
  });
145
314
  }),
315
+ /**
316
+ * Delete a run
317
+ *
318
+ * @param runId - The ID of the run to delete
319
+ */
146
320
  delete: (runId) => __awaiter(this, void 0, void 0, function* () {
147
321
  return (0, sdk_gen_1.deleteRunV1RunsRunIdDelete)({
148
322
  client,
@@ -152,12 +326,28 @@ function createCyberdeskClient(apiKey, baseUrl) {
152
326
  },
153
327
  // Connection endpoints
154
328
  connections: {
329
+ /**
330
+ * List connections with optional filtering
331
+ *
332
+ * @param params - Optional query parameters
333
+ * @param params.skip - Number of items to skip (for pagination)
334
+ * @param params.limit - Maximum number of items to return
335
+ * @param params.machine_id - Filter by machine ID
336
+ * @param params.status - Filter by connection status
337
+ * @returns Paginated list of connections
338
+ */
155
339
  list: (params) => __awaiter(this, void 0, void 0, function* () {
156
340
  return (0, sdk_gen_1.listConnectionsV1ConnectionsGet)({
157
341
  client,
158
342
  query: params,
159
343
  });
160
344
  }),
345
+ /**
346
+ * Create a new connection
347
+ *
348
+ * @param data - Connection data including machine ID and websocket info
349
+ * @returns Created connection details
350
+ */
161
351
  create: (data) => __awaiter(this, void 0, void 0, function* () {
162
352
  return (0, sdk_gen_1.createConnectionV1ConnectionsPost)({
163
353
  client,
@@ -167,24 +357,58 @@ function createCyberdeskClient(apiKey, baseUrl) {
167
357
  },
168
358
  // Trajectory endpoints
169
359
  trajectories: {
360
+ /**
361
+ * List trajectories with optional filtering
362
+ *
363
+ * @param params - Optional query parameters
364
+ * @param params.skip - Number of items to skip (for pagination)
365
+ * @param params.limit - Maximum number of items to return
366
+ * @param params.workflow_id - Filter by workflow ID
367
+ * @returns Paginated list of trajectories
368
+ */
170
369
  list: (params) => __awaiter(this, void 0, void 0, function* () {
171
370
  return (0, sdk_gen_1.listTrajectoriesV1TrajectoriesGet)({
172
371
  client,
173
372
  query: params,
174
373
  });
175
374
  }),
375
+ /**
376
+ * Create a new trajectory
377
+ *
378
+ * A trajectory represents a recorded sequence of actions for a workflow.
379
+ *
380
+ * @param data - Trajectory data
381
+ * @param data.workflow_id - The workflow this trajectory belongs to
382
+ * @param data.trajectory_data - Array of recorded actions
383
+ * @param data.dimensions - Display dimensions when trajectory was recorded
384
+ * @param data.original_input_values - Input values used during recording
385
+ * @returns Created trajectory details
386
+ */
176
387
  create: (data) => __awaiter(this, void 0, void 0, function* () {
177
388
  return (0, sdk_gen_1.createTrajectoryV1TrajectoriesPost)({
178
389
  client,
179
390
  body: data,
180
391
  });
181
392
  }),
393
+ /**
394
+ * Get a specific trajectory by ID
395
+ *
396
+ * @param trajectoryId - The ID of the trajectory
397
+ * @returns Trajectory details including recorded actions
398
+ */
182
399
  get: (trajectoryId) => __awaiter(this, void 0, void 0, function* () {
183
400
  return (0, sdk_gen_1.getTrajectoryV1TrajectoriesTrajectoryIdGet)({
184
401
  client,
185
402
  path: { trajectory_id: trajectoryId },
186
403
  });
187
404
  }),
405
+ /**
406
+ * Update a trajectory
407
+ *
408
+ * @param trajectoryId - The ID of the trajectory to update
409
+ * @param data - Update data (trajectory_data)
410
+ * @returns Updated trajectory details
411
+ */
188
412
  update: (trajectoryId, data) => __awaiter(this, void 0, void 0, function* () {
189
413
  return (0, sdk_gen_1.updateTrajectoryV1TrajectoriesTrajectoryIdPatch)({
190
414
  client,
@@ -192,12 +416,26 @@ function createCyberdeskClient(apiKey, baseUrl) {
192
416
  body: data,
193
417
  });
194
418
  }),
419
+ /**
420
+ * Delete a trajectory
421
+ *
422
+ * @param trajectoryId - The ID of the trajectory to delete
423
+ */
195
424
  delete: (trajectoryId) => __awaiter(this, void 0, void 0, function* () {
196
425
  return (0, sdk_gen_1.deleteTrajectoryV1TrajectoriesTrajectoryIdDelete)({
197
426
  client,
198
427
  path: { trajectory_id: trajectoryId },
199
428
  });
200
429
  }),
430
+ /**
431
+ * Get the latest trajectory for a workflow
432
+ *
433
+ * Returns the most recently created trajectory for the specified workflow.
434
+ * Useful for replaying the latest recorded actions.
435
+ *
436
+ * @param workflowId - The ID of the workflow
437
+ * @returns Latest trajectory for the workflow, or null if none exists
438
+ */
201
439
  getLatestForWorkflow: (workflowId) => __awaiter(this, void 0, void 0, function* () {
202
440
  return (0, sdk_gen_1.getLatestTrajectoryForWorkflowV1WorkflowsWorkflowIdLatestTrajectoryGet)({
203
441
  client,
@@ -205,5 +443,122 @@ function createCyberdeskClient(apiKey, baseUrl) {
205
443
  });
206
444
  }),
207
445
  },
446
+ // Run Attachment endpoints
447
+ run_attachments: {
448
+ /**
449
+ * List run attachments with optional filtering
450
+ *
451
+ * @param params - Optional query parameters
452
+ * @param params.skip - Number of items to skip (for pagination)
453
+ * @param params.limit - Maximum number of items to return
454
+ * @param params.run_id - Filter by run ID
455
+ * @param params.attachment_type - Filter by attachment type (input/output)
456
+ * @returns Paginated list of run attachments
457
+ */
458
+ list: (params) => __awaiter(this, void 0, void 0, function* () {
459
+ return (0, sdk_gen_1.listRunAttachmentsV1RunAttachmentsGet)({
460
+ client,
461
+ query: params,
462
+ });
463
+ }),
464
+ /**
465
+ * Create a new run attachment
466
+ *
467
+ * @param data - Attachment data including file content as base64
468
+ * @returns Created attachment details
469
+ */
470
+ create: (data) => __awaiter(this, void 0, void 0, function* () {
471
+ return (0, sdk_gen_1.createRunAttachmentV1RunAttachmentsPost)({
472
+ client,
473
+ body: data,
474
+ });
475
+ }),
476
+ /**
477
+ * Get run attachment details
478
+ *
479
+ * @param attachmentId - The ID of the attachment
480
+ * @returns Attachment metadata
481
+ */
482
+ get: (attachmentId) => __awaiter(this, void 0, void 0, function* () {
483
+ return (0, sdk_gen_1.getRunAttachmentV1RunAttachmentsAttachmentIdGet)({
484
+ client,
485
+ path: { attachment_id: attachmentId },
486
+ });
487
+ }),
488
+ /**
489
+ * Get a signed download URL for a run attachment
490
+ *
491
+ * The returned URL will trigger an automatic download when accessed in a browser.
492
+ *
493
+ * @param attachmentId - The ID of the attachment
494
+ * @param expiresIn - URL expiration time in seconds (10-3600). Default: 300 (5 minutes)
495
+ * @returns Object containing the signed URL and expiration time
496
+ *
497
+ * @example
498
+ * ```typescript
499
+ * const { data } = await client.run_attachments.getDownloadUrl('attachment-id', 600);
500
+ * if (data) {
501
+ * console.log(`Download URL: ${data.url}`);
502
+ * console.log(`Expires in: ${data.expires_in} seconds`);
503
+ * }
504
+ * ```
505
+ */
506
+ getDownloadUrl: (attachmentId, expiresIn) => __awaiter(this, void 0, void 0, function* () {
507
+ return (0, sdk_gen_1.getRunAttachmentDownloadUrlV1RunAttachmentsAttachmentIdDownloadUrlGet)({
508
+ client,
509
+ path: { attachment_id: attachmentId },
510
+ query: expiresIn ? { expires_in: expiresIn } : undefined,
511
+ });
512
+ }),
513
+ /**
514
+ * Download a run attachment file directly
515
+ *
516
+ * This method returns the raw file content. For a download URL instead,
517
+ * use `getDownloadUrl()`.
518
+ *
519
+ * @param attachmentId - The ID of the attachment to download
520
+ * @returns Raw file data
521
+ *
522
+ * @example
523
+ * ```typescript
524
+ * const { data } = await client.run_attachments.download('attachment-id');
525
+ * if (data) {
526
+ * // Handle raw file bytes
527
+ * const blob = new Blob([data]);
528
+ * }
529
+ * ```
530
+ */
531
+ download: (attachmentId) => __awaiter(this, void 0, void 0, function* () {
532
+ return (0, sdk_gen_1.downloadRunAttachmentV1RunAttachmentsAttachmentIdDownloadGet)({
533
+ client,
534
+ path: { attachment_id: attachmentId },
535
+ });
536
+ }),
537
+ /**
538
+ * Update a run attachment (e.g., set expiration)
539
+ *
540
+ * @param attachmentId - The ID of the attachment to update
541
+ * @param data - Update data
542
+ * @returns Updated attachment details
543
+ */
544
+ update: (attachmentId, data) => __awaiter(this, void 0, void 0, function* () {
545
+ return (0, sdk_gen_1.updateRunAttachmentV1RunAttachmentsAttachmentIdPut)({
546
+ client,
547
+ path: { attachment_id: attachmentId },
548
+ body: data,
549
+ });
550
+ }),
551
+ /**
552
+ * Delete a run attachment
553
+ *
554
+ * @param attachmentId - The ID of the attachment to delete
555
+ */
556
+ delete: (attachmentId) => __awaiter(this, void 0, void 0, function* () {
557
+ return (0, sdk_gen_1.deleteRunAttachmentV1RunAttachmentsAttachmentIdDelete)({
558
+ client,
559
+ path: { attachment_id: attachmentId },
560
+ });
561
+ }),
562
+ },
208
563
  };
209
564
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cyberdesk",
3
- "version": "1.8.0",
3
+ "version": "1.10.0",
4
4
  "description": "The official TypeScript SDK for Cyberdesk",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",