daytona 0.139.0 → 0.140.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1afded1f1c42c9f42d86c6419c40b69a21e736045c529719c4fc099618d680fb
4
- data.tar.gz: bb8a65df010757f279849a70979de4e458e60cdf3d7a3669c6b2e3ae8900001f
3
+ metadata.gz: 97efbea0f339d4ec24eec1fe2a40ece74aa8f3eb0e74939d68e2fcd175f0c5e3
4
+ data.tar.gz: 9b97d704d4853538570dcb6e82c4ce82e3492526fe327e9b0ea9183f90279a0c
5
5
  SHA512:
6
- metadata.gz: a82345038ec0b71c63141f6a7a1fdf9df74f8e7b88f29c900dd1bd64ae7219ecb0a2ed8cb5631ea95abe387fd775274be520d21ad1fe72975c40dc9fc80562cf
7
- data.tar.gz: f309568213a8e491780dd5457cffd8d9fddda1c8db3e7a71c5c7b7f478f60ad691decceb6145a1fb107efe2d9be502fb332af988654b9254d44312bc0581b8b3
6
+ metadata.gz: 2eb373cf9c9d84ea459df3c384265d674bba34b87671fef7be02cbf6964d907398685d9258a85742260c39cdd6755169c04155277657714dd44946d78bc89737
7
+ data.tar.gz: b728c4cd356eb6965b664cbd822283098ccd5e5dc5fc692826f6e743359973b2c64bde1c2ce447364774147f35bd30cef78134a24d509ff47e423c17e7515394
@@ -413,6 +413,163 @@ module Daytona
413
413
  end
414
414
  end
415
415
 
416
+ # Recording operations for computer use functionality.
417
+ class Recording
418
+ # @return [String] The ID of the sandbox
419
+ attr_reader :sandbox_id
420
+
421
+ # @return [DaytonaToolboxApiClient::ComputerUseApi] API client for sandbox operations
422
+ attr_reader :toolbox_api
423
+
424
+ # @param sandbox_id [String] The ID of the sandbox
425
+ # @param toolbox_api [DaytonaToolboxApiClient::ComputerUseApi] API client for sandbox operations
426
+ def initialize(sandbox_id:, toolbox_api:)
427
+ @sandbox_id = sandbox_id
428
+ @toolbox_api = toolbox_api
429
+ end
430
+
431
+ # Starts a new screen recording session.
432
+ #
433
+ # @param label [String, nil] Optional custom label for the recording
434
+ # @return [DaytonaToolboxApiClient::Recording] Started recording details
435
+ # @raise [Daytona::Sdk::Error] If the operation fails
436
+ #
437
+ # @example
438
+ # # Start a recording with a label
439
+ # recording = sandbox.computer_use.recording.start(label: "my-test-recording")
440
+ # puts "Recording started: #{recording.id}"
441
+ # puts "File: #{recording.file_path}"
442
+ def start(label: nil)
443
+ request = DaytonaToolboxApiClient::StartRecordingRequest.new(label:)
444
+ toolbox_api.start_recording(request: request)
445
+ rescue StandardError => e
446
+ raise Sdk::Error, "Failed to start recording: #{e.message}"
447
+ end
448
+
449
+ # Stops an active screen recording session.
450
+ #
451
+ # @param id [String] The ID of the recording to stop
452
+ # @return [DaytonaToolboxApiClient::Recording] Stopped recording details
453
+ # @raise [Daytona::Sdk::Error] If the operation fails
454
+ #
455
+ # @example
456
+ # result = sandbox.computer_use.recording.stop(id: recording.id)
457
+ # puts "Recording stopped: #{result.duration_seconds} seconds"
458
+ # puts "Saved to: #{result.file_path}"
459
+ def stop(id:)
460
+ request = DaytonaToolboxApiClient::StopRecordingRequest.new(id: id)
461
+ toolbox_api.stop_recording(request)
462
+ rescue StandardError => e
463
+ raise Sdk::Error, "Failed to stop recording: #{e.message}"
464
+ end
465
+
466
+ # Lists all recordings (active and completed).
467
+ #
468
+ # @return [DaytonaToolboxApiClient::ListRecordingsResponse] List of all recordings
469
+ # @raise [Daytona::Sdk::Error] If the operation fails
470
+ #
471
+ # @example
472
+ # recordings = sandbox.computer_use.recording.list
473
+ # puts "Found #{recordings.recordings.length} recordings"
474
+ # recordings.recordings.each do |rec|
475
+ # puts "- #{rec.file_name}: #{rec.status}"
476
+ # end
477
+ def list
478
+ toolbox_api.list_recordings
479
+ rescue StandardError => e
480
+ raise Sdk::Error, "Failed to list recordings: #{e.message}"
481
+ end
482
+
483
+ # Gets details of a specific recording by ID.
484
+ #
485
+ # @param id [String] The ID of the recording to retrieve
486
+ # @return [DaytonaToolboxApiClient::Recording] Recording details
487
+ # @raise [Daytona::Sdk::Error] If the operation fails
488
+ #
489
+ # @example
490
+ # recording = sandbox.computer_use.recording.get(id: recording_id)
491
+ # puts "Recording: #{recording.file_name}"
492
+ # puts "Status: #{recording.status}"
493
+ # puts "Duration: #{recording.duration_seconds} seconds"
494
+ def get(id:)
495
+ toolbox_api.get_recording(id)
496
+ rescue StandardError => e
497
+ raise Sdk::Error, "Failed to get recording: #{e.message}"
498
+ end
499
+
500
+ # Deletes a recording by ID.
501
+ #
502
+ # @param id [String] The ID of the recording to delete
503
+ # @return [void]
504
+ # @raise [Daytona::Sdk::Error] If the operation fails
505
+ #
506
+ # @example
507
+ # sandbox.computer_use.recording.delete(id: recording_id)
508
+ # puts "Recording deleted"
509
+ def delete(id:)
510
+ toolbox_api.delete_recording(id)
511
+ rescue StandardError => e
512
+ raise Sdk::Error, "Failed to delete recording: #{e.message}"
513
+ end
514
+
515
+ # Downloads a recording file and saves it to a local path.
516
+ #
517
+ # The file is streamed directly to disk without loading the entire content into memory.
518
+ #
519
+ # @param id [String] The ID of the recording to download
520
+ # @param local_path [String] Path to save the recording file locally
521
+ # @return [void]
522
+ # @raise [Daytona::Sdk::Error] If the operation fails
523
+ #
524
+ # @example
525
+ # sandbox.computer_use.recording.download(id: recording_id, local_path: "local_recording.mp4")
526
+ # puts "Recording downloaded"
527
+ def download(id:, local_path:)
528
+ require 'fileutils'
529
+ require 'typhoeus'
530
+
531
+ # Get the API configuration and build the download URL
532
+ api_client = toolbox_api.api_client
533
+ config = api_client.config
534
+ base_url = config.base_url
535
+ download_url = "#{base_url}/computeruse/recordings/#{id}/download"
536
+
537
+ # Create parent directory if it doesn't exist
538
+ parent_dir = File.dirname(local_path)
539
+ FileUtils.mkdir_p(parent_dir) unless parent_dir.empty?
540
+
541
+ # Stream the download directly to file
542
+ file = File.open(local_path, 'wb')
543
+ request = Typhoeus::Request.new(
544
+ download_url,
545
+ method: :get,
546
+ headers: api_client.default_headers,
547
+ timeout: config.timeout,
548
+ ssl_verifypeer: config.verify_ssl,
549
+ ssl_verifyhost: config.verify_ssl_host ? 2 : 0
550
+ )
551
+
552
+ # Stream chunks directly to file
553
+ request.on_body do |chunk|
554
+ file.write(chunk)
555
+ end
556
+
557
+ request.on_complete do |response|
558
+ file.close
559
+ unless response.success?
560
+ File.delete(local_path) if File.exist?(local_path)
561
+ raise Sdk::Error, "Failed to download recording: HTTP #{response.code}"
562
+ end
563
+ end
564
+
565
+ request.run
566
+ rescue StandardError => e
567
+ file&.close
568
+ File.delete(local_path) if File.exist?(local_path)
569
+ raise Sdk::Error, "Failed to download recording: #{e.message}"
570
+ end
571
+ end
572
+
416
573
  # @return [String] The ID of the sandbox
417
574
  attr_reader :sandbox_id
418
575
 
@@ -431,6 +588,9 @@ module Daytona
431
588
  # @return [Display] Display operations interface
432
589
  attr_reader :display
433
590
 
591
+ # @return [Recording] Screen recording operations interface
592
+ attr_reader :recording
593
+
434
594
  # Initialize a new ComputerUse instance.
435
595
  #
436
596
  # @param sandbox_id [String] The ID of the sandbox
@@ -442,6 +602,7 @@ module Daytona
442
602
  @keyboard = Keyboard.new(sandbox_id:, toolbox_api:)
443
603
  @screenshot = Screenshot.new(sandbox_id:, toolbox_api:)
444
604
  @display = Display.new(sandbox_id:, toolbox_api:)
605
+ @recording = Recording.new(sandbox_id:, toolbox_api:)
445
606
  end
446
607
 
447
608
  # Starts all computer use processes (Xvfb, xfce4, x11vnc, novnc).
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Daytona
4
4
  module Sdk
5
- VERSION = '0.139.0'
5
+ VERSION = '0.140.0'
6
6
  end
7
7
  end
data/project.json CHANGED
@@ -19,8 +19,6 @@
19
19
  },
20
20
  "set-version"
21
21
  ],
22
- "cache": true,
23
- "inputs": ["default"],
24
22
  "outputs": ["{projectRoot}/**/*.gem"]
25
23
  },
26
24
  "set-version": {
@@ -30,7 +28,10 @@
30
28
  "command": "if [ -n \"$RUBYGEMS_PKG_VERSION\" ]; then sed -i \"s/VERSION = '[^']*'/VERSION = '$RUBYGEMS_PKG_VERSION'/\" lib/daytona/sdk/version.rb && echo \"Changed version to $RUBYGEMS_PKG_VERSION\"; else echo \"Using version from version.rb\"; fi"
31
29
  },
32
30
  "cache": true,
33
- "inputs": [{ "env": "RUBYGEMS_PKG_VERSION" }, { "env": "VERSION" }],
31
+ "inputs": [
32
+ { "env": "RUBYGEMS_PKG_VERSION" },
33
+ { "env": "VERSION" }
34
+ ],
34
35
  "outputs": ["{projectRoot}/lib/daytona/sdk/version.rb"]
35
36
  },
36
37
  "lint": {
@@ -57,6 +58,7 @@
57
58
  },
58
59
  "docs": {
59
60
  "executor": "nx:run-commands",
61
+ "outputs": ["{workspaceRoot}/apps/docs/src/content/docs/en/ruby-sdk/**/*"],
60
62
  "options": {
61
63
  "cwd": "{projectRoot}",
62
64
  "command": "bash -O extglob -c 'rm -rf ../../apps/docs/src/content/docs/en/ruby-sdk/!(index.mdx)' && bundle exec ruby scripts/generate-docs.rb"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daytona
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.139.0
4
+ version: 0.140.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daytona Platforms Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-02-03 00:00:00.000000000 Z
11
+ date: 2026-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.139.0
33
+ version: 0.140.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.139.0
40
+ version: 0.140.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: daytona_toolbox_api_client
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 0.139.0
47
+ version: 0.140.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 0.139.0
54
+ version: 0.140.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: dotenv
57
57
  requirement: !ruby/object:Gem::Requirement