daytona 0.168.0 → 0.170.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: a55e492b379f7d9294e9d7ebbbf12b00c2e8f9e39a956dedf519f3911d9d53f1
4
- data.tar.gz: ee8591af83e51e7a8ada621cb7e88ea1b72933e1ca3f81146a771164c108ab0a
3
+ metadata.gz: 7515dcf7e9ce6366233315925a09418cfe7714473f55ccf2062010f3d5ac692c
4
+ data.tar.gz: 85148ff08b50b7a9d647ac53ae8b73622e5e3d9d01f9a211229a1ec071f49979
5
5
  SHA512:
6
- metadata.gz: a1e9817ed89f69dfae6f5eeccff58068e4a99a94dd427ab3bf0c4e15474f3c358dbab8aaa92abe5fb2ffcac74e5cf9884a1c32e23724c858361ed4da0a832c28
7
- data.tar.gz: 80ef1135472c786405b929da3fa9e1ccdc7fb2b18d0f7f4cc49585659ded304c5caf8cd9971440f03f1cd4652b42b7e0b0fcf69330b57f0f52e0b770b38fd8a4
6
+ metadata.gz: ccd9ad77b30a91e4aa4ca503d87d3d9a976978b553bf3c0a1ba6e80c912c804bfab99b520377edc71ab17abd4eb22790edac7ae683bf2f6a58bfe6419a08e390
7
+ data.tar.gz: 071d6d27256509829400a640d70b386c7a627e44731b07b0a2ba04559c3837bf31ec4f037c76f9f4bdbe5073af58d9660551d14ccac9e6fff5dd653712c0b04a
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  require 'json'
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  module Daytona
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  module Daytona
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  module Daytona
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  module Daytona
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  module Daytona
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  module Daytona
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  require 'digest'
@@ -261,8 +264,9 @@ module Daytona
261
264
  raise Sdk::Error, "Context directory #{context_dir} does not exist" unless Dir.exist?(context_dir)
262
265
  end
263
266
 
264
- # Extract copy sources from dockerfile commands
265
- extract_copy_sources(dockerfile_commands.join("\n"), context_dir || '').each do |context_path, original_path|
267
+ # Extract copy sources from dockerfile commands (class-level helper)
268
+ self.class.send(:extract_copy_sources, dockerfile_commands.join("\n"),
269
+ context_dir || '').each do |context_path, original_path|
266
270
  archive_base_path = context_path
267
271
  if context_dir && !original_path.start_with?(context_dir)
268
272
  archive_base_path = context_path.delete_prefix(context_dir)
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  module Daytona
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  require 'json'
@@ -299,7 +302,7 @@ module Daytona
299
302
  module WebSocketControlStatus
300
303
  ALL = [
301
304
  CONNECTED = 'connected',
302
- ERORR = 'error'
305
+ ERROR = 'error'
303
306
  ].freeze
304
307
  end
305
308
  end
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  module Daytona
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  module Daytona
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  module Daytona
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  module Daytona
@@ -167,14 +170,14 @@ module Daytona
167
170
 
168
171
  # Presses a key with optional modifiers.
169
172
  #
170
- # @param key [String] The key to press (e.g., 'Enter', 'Escape', 'Tab', 'a', 'A')
171
- # @param modifiers [Array<String>, nil] Modifier keys ('ctrl', 'alt', 'meta', 'shift')
173
+ # @param key [String] The key to press. Canonical names include 'enter', 'escape', 'tab', letters, digits, unshifted punctuation, function keys, and grammar-safe numpad names such as 'num_plus'. Named keys are case-insensitive, and common aliases such as 'Return' and 'Escape' are normalized.
174
+ # @param modifiers [Array<String>, nil] Canonical modifier names are 'ctrl', 'alt', 'shift', and 'cmd'. Common aliases such as 'control', 'option', 'meta', and 'win' are normalized.
172
175
  # @return [void]
173
176
  # @raise [Daytona::Sdk::Error] If the operation fails
174
177
  #
175
178
  # @example
176
179
  # # Press Enter
177
- # sandbox.computer_use.keyboard.press("Return")
180
+ # sandbox.computer_use.keyboard.press("enter")
178
181
  #
179
182
  # # Press Ctrl+C
180
183
  # sandbox.computer_use.keyboard.press("c", modifiers: ["ctrl"])
@@ -190,7 +193,7 @@ module Daytona
190
193
 
191
194
  # Presses a hotkey combination.
192
195
  #
193
- # @param keys [String] The hotkey combination (e.g., 'ctrl+c', 'alt+tab', 'cmd+shift+t')
196
+ # @param keys [String] A single atomic hotkey chord (e.g., 'ctrl+c', 'alt+tab', 'cmd+shift+t', 'ctrl + c', 'shift'). Uses the same normalized key contract as #press.
194
197
  # @return [void]
195
198
  # @raise [Daytona::Sdk::Error] If the operation fails
196
199
  #
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  require 'dotenv'
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  require 'json'
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  require 'tempfile'
data/lib/daytona/git.rb CHANGED
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  module Daytona
@@ -142,7 +145,7 @@ module Daytona
142
145
  response = toolbox_api.commit_changes(
143
146
  DaytonaToolboxApiClient::GitCommitRequest.new(path:, message:, author:, email:, allow_empty:)
144
147
  )
145
- GitCommitResponse.new(sha: response.hash)
148
+ GitCommitResponse.new(sha: response._hash)
146
149
  rescue StandardError => e
147
150
  raise Sdk::Error, "Failed to commit changes: #{e.message}"
148
151
  end
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  module Daytona
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  require 'digest'
data/lib/daytona/otel.rb CHANGED
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  module Daytona
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  require 'uri'
@@ -500,7 +503,10 @@ module Daytona
500
503
  # puts "PTY Session #{session.id}: #{session.cols}x#{session.rows}"
501
504
  # end
502
505
  def list_pty_sessions
503
- toolbox_api.list_pty_sessions
506
+ response = toolbox_api.list_pty_sessions
507
+ return [] if response.nil?
508
+
509
+ response.respond_to?(:sessions) ? (response.sessions || []) : response
504
510
  end
505
511
 
506
512
  # Gets detailed information about a specific PTY session
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  require 'timeout'
@@ -202,6 +205,27 @@ module Daytona
202
205
  @auto_delete_interval = interval
203
206
  end
204
207
 
208
+ # Updates outbound network policy on the runner (block all, restore access, or CIDR allow list).
209
+ #
210
+ # @param network_block_all [Boolean, nil]
211
+ # @param network_allow_list [String, nil]
212
+ # @return [void]
213
+ # @raise [Daytona::Sdk::Error]
214
+ def update_network_settings(network_block_all: nil, network_allow_list: nil)
215
+ if network_block_all.nil? && network_allow_list.nil?
216
+ raise Sdk::Error,
217
+ 'At least one of network_block_all or network_allow_list must be provided'
218
+ end
219
+
220
+ body = DaytonaApiClient::UpdateSandboxNetworkSettings.new(
221
+ network_block_all:,
222
+ network_allow_list:
223
+ )
224
+ data = sandbox_api.update_network_settings(id, body)
225
+ @network_block_all = data.network_block_all
226
+ @network_allow_list = data.network_allow_list
227
+ end
228
+
205
229
  # Sets the auto-stop interval for the Sandbox.
206
230
  # The Sandbox will automatically stop after being idle (no new events) for the specified interval.
207
231
  # Events include any state changes or interactions with the Sandbox through the SDK.
@@ -510,6 +534,7 @@ module Daytona
510
534
  end
511
535
 
512
536
  instrument :archive, :auto_archive_interval=, :auto_delete_interval=, :auto_stop_interval=,
537
+ :update_network_settings,
513
538
  :create_ssh_access, :delete, :get_user_home_dir, :get_work_dir, :labels=,
514
539
  :preview_url, :create_signed_preview_url, :expire_signed_preview_url,
515
540
  :refresh, :refresh_activity, :revoke_ssh_access, :start, :recover, :stop,
@@ -1,7 +1,10 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  module Daytona
4
7
  module Sdk
5
- VERSION = '0.168.0'
8
+ VERSION = '0.170.0'
6
9
  end
7
10
  end
data/lib/daytona/sdk.rb CHANGED
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  require 'logger'
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  require 'uri'
data/lib/daytona/util.rb CHANGED
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  require 'net/http'
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  module Daytona
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  module Daytona
data/lib/daytona.rb CHANGED
@@ -1,3 +1,6 @@
1
+ # Copyright Daytona Platforms Inc.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+
1
4
  # frozen_string_literal: true
2
5
 
3
6
  # Main entry point for the Daytona Ruby SDK
data/project.json CHANGED
@@ -41,6 +41,23 @@
41
41
  "command": "bundle exec rubocop"
42
42
  }
43
43
  },
44
+ "test": {
45
+ "executor": "nx:run-commands",
46
+ "cache": true,
47
+ "inputs": ["default", { "env": "DAYTONA_API_KEY" }, { "env": "DAYTONA_API_URL" }, { "env": "DAYTONA_JWT_TOKEN" }, { "env": "DAYTONA_ORGANIZATION_ID" }, { "env": "DAYTONA_TARGET" }],
48
+ "outputs": [],
49
+ "options": {
50
+ "cwd": "{projectRoot}",
51
+ "command": "bundle exec rspec --format documentation --tag '~e2e'"
52
+ }
53
+ },
54
+ "test:e2e": {
55
+ "executor": "nx:run-commands",
56
+ "options": {
57
+ "cwd": "{projectRoot}",
58
+ "command": "bundle exec rspec spec/e2e_spec.rb --format documentation"
59
+ }
60
+ },
44
61
  "format": {
45
62
  "executor": "nx:run-commands",
46
63
  "options": {
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # Copyright Daytona Platforms Inc.
3
+ # SPDX-License-Identifier: Apache-2.0
2
4
  # frozen_string_literal: true
3
5
 
4
6
  require 'fileutils'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daytona
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.168.0
4
+ version: 0.170.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daytona Platforms Inc.
@@ -85,28 +85,28 @@ dependencies:
85
85
  requirements:
86
86
  - - '='
87
87
  - !ruby/object:Gem::Version
88
- version: 0.168.0
88
+ version: 0.170.0
89
89
  type: :runtime
90
90
  prerelease: false
91
91
  version_requirements: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - '='
94
94
  - !ruby/object:Gem::Version
95
- version: 0.168.0
95
+ version: 0.170.0
96
96
  - !ruby/object:Gem::Dependency
97
97
  name: daytona_toolbox_api_client
98
98
  requirement: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - '='
101
101
  - !ruby/object:Gem::Version
102
- version: 0.168.0
102
+ version: 0.170.0
103
103
  type: :runtime
104
104
  prerelease: false
105
105
  version_requirements: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - '='
108
108
  - !ruby/object:Gem::Version
109
- version: 0.168.0
109
+ version: 0.170.0
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: dotenv
112
112
  requirement: !ruby/object:Gem::Requirement
@@ -171,6 +171,7 @@ executables: []
171
171
  extensions: []
172
172
  extra_rdoc_files: []
173
173
  files:
174
+ - ".rspec"
174
175
  - ".rubocop.yml"
175
176
  - ".ruby-version"
176
177
  - CODE_OF_CONDUCT.md