daytona 0.146.0 → 0.147.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 +4 -4
- data/lib/daytona/daytona.rb +0 -22
- data/lib/daytona/sandbox.rb +9 -6
- data/lib/daytona/sdk/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9b9b1e10e9aa311fa1d3b185dae7f21568ff4927fb165dd190ea3a3d56e4514e
|
|
4
|
+
data.tar.gz: 34cabab63bdd79383dc7c462273bd52d578a19f63d9a134c547a76b1fe276e84
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '080240079d26b62ad89b4ab7a97dbfe4395899d62327f07bd4e2eb4fe262256efcca37924b63fa375fbf2576150541fbbe526a1ccd473b662b9f91a77bb430c0'
|
|
7
|
+
data.tar.gz: 6941184fa87a94c5f20afb92875324e8eaf40ddf8a3e94c6b9a4fe70efe79cd9066e4546148c41921ad3717ebf6eaf9579e63bb2c0975ececb70e2757a58336e
|
data/lib/daytona/daytona.rb
CHANGED
|
@@ -44,8 +44,6 @@ module Daytona
|
|
|
44
44
|
@snapshots_api = DaytonaApiClient::SnapshotsApi.new(api_client)
|
|
45
45
|
@snapshot = SnapshotService.new(snapshots_api:, object_storage_api:, default_region_id: config.target,
|
|
46
46
|
otel_state:)
|
|
47
|
-
@proxy_toolbox_url_cache = {}
|
|
48
|
-
@proxy_toolbox_url_mutex = Mutex.new
|
|
49
47
|
end
|
|
50
48
|
|
|
51
49
|
# Shuts down OTel providers, flushing any pending telemetry data.
|
|
@@ -267,30 +265,10 @@ module Daytona
|
|
|
267
265
|
config:,
|
|
268
266
|
sandbox_api:,
|
|
269
267
|
code_toolbox:,
|
|
270
|
-
get_proxy_toolbox_url: proc { |sandbox_id, region_id| proxy_toolbox_url(sandbox_id, region_id) },
|
|
271
268
|
otel_state: @otel_state
|
|
272
269
|
)
|
|
273
270
|
end
|
|
274
271
|
|
|
275
|
-
# Gets the proxy toolbox URL from the sandbox API (cached per region)
|
|
276
|
-
#
|
|
277
|
-
# @param sandbox_id [String] The sandbox ID
|
|
278
|
-
# @param region_id [String] The region ID
|
|
279
|
-
# @return [String] The proxy toolbox URL
|
|
280
|
-
def proxy_toolbox_url(sandbox_id, region_id)
|
|
281
|
-
# Return cached URL if available
|
|
282
|
-
return @proxy_toolbox_url_cache[region_id] if @proxy_toolbox_url_cache.key?(region_id)
|
|
283
|
-
|
|
284
|
-
# Use mutex to ensure thread-safe caching
|
|
285
|
-
@proxy_toolbox_url_mutex.synchronize do
|
|
286
|
-
# Double-check after acquiring lock
|
|
287
|
-
return @proxy_toolbox_url_cache[region_id] if @proxy_toolbox_url_cache.key?(region_id)
|
|
288
|
-
|
|
289
|
-
# Fetch and cache the URL
|
|
290
|
-
@proxy_toolbox_url_cache[region_id] = sandbox_api.get_toolbox_proxy_url(sandbox_id).url
|
|
291
|
-
end
|
|
292
|
-
end
|
|
293
|
-
|
|
294
272
|
# Converts a language to a code toolbox
|
|
295
273
|
#
|
|
296
274
|
# @param language [Symbol]
|
data/lib/daytona/sandbox.rb
CHANGED
|
@@ -119,12 +119,11 @@ module Daytona
|
|
|
119
119
|
# @params sandbox_api [DaytonaApiClient::SandboxApi]
|
|
120
120
|
# @params sandbox_dto [DaytonaApiClient::Sandbox]
|
|
121
121
|
# @params otel_state [Daytona::OtelState, nil]
|
|
122
|
-
def initialize(code_toolbox:, sandbox_dto:, config:, sandbox_api:,
|
|
122
|
+
def initialize(code_toolbox:, sandbox_dto:, config:, sandbox_api:, otel_state: nil) # rubocop:disable Metrics/MethodLength
|
|
123
123
|
process_response(sandbox_dto)
|
|
124
124
|
@code_toolbox = code_toolbox
|
|
125
125
|
@config = config
|
|
126
126
|
@sandbox_api = sandbox_api
|
|
127
|
-
@get_proxy_toolbox_url = get_proxy_toolbox_url
|
|
128
127
|
@otel_state = otel_state
|
|
129
128
|
|
|
130
129
|
# Create toolbox API clients with dynamic configuration
|
|
@@ -229,6 +228,10 @@ module Daytona
|
|
|
229
228
|
def delete
|
|
230
229
|
sandbox_api.delete_sandbox(id)
|
|
231
230
|
refresh
|
|
231
|
+
rescue DaytonaApiClient::ApiError => e
|
|
232
|
+
raise unless e.code == 404
|
|
233
|
+
|
|
234
|
+
@state = 'destroyed'
|
|
232
235
|
end
|
|
233
236
|
|
|
234
237
|
# Gets the user's home directory path for the logged in user inside the Sandbox.
|
|
@@ -477,10 +480,9 @@ module Daytona
|
|
|
477
480
|
# @return [DaytonaToolboxApiClient::Configuration]
|
|
478
481
|
def build_toolbox_api_config
|
|
479
482
|
DaytonaToolboxApiClient::Configuration.new.configure do |cfg|
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
full_url = "#{proxy_toolbox_url}#{id}"
|
|
483
|
+
proxy_url = @toolbox_proxy_url
|
|
484
|
+
proxy_url += '/' unless proxy_url.end_with?('/')
|
|
485
|
+
full_url = "#{proxy_url}#{id}"
|
|
484
486
|
uri = URI(full_url)
|
|
485
487
|
|
|
486
488
|
cfg.scheme = uri.scheme
|
|
@@ -521,6 +523,7 @@ module Daytona
|
|
|
521
523
|
@daemon_version = sandbox_dto.daemon_version
|
|
522
524
|
@network_block_all = sandbox_dto.network_block_all
|
|
523
525
|
@network_allow_list = sandbox_dto.network_allow_list
|
|
526
|
+
@toolbox_proxy_url = sandbox_dto.toolbox_proxy_url
|
|
524
527
|
end
|
|
525
528
|
|
|
526
529
|
# Monitors block not to exceed max execution time.
|
data/lib/daytona/sdk/version.rb
CHANGED
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.
|
|
4
|
+
version: 0.147.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-
|
|
11
|
+
date: 2026-02-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: opentelemetry-exporter-otlp
|
|
@@ -86,28 +86,28 @@ dependencies:
|
|
|
86
86
|
requirements:
|
|
87
87
|
- - '='
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: 0.
|
|
89
|
+
version: 0.147.0
|
|
90
90
|
type: :runtime
|
|
91
91
|
prerelease: false
|
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
93
|
requirements:
|
|
94
94
|
- - '='
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: 0.
|
|
96
|
+
version: 0.147.0
|
|
97
97
|
- !ruby/object:Gem::Dependency
|
|
98
98
|
name: daytona_toolbox_api_client
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
100
100
|
requirements:
|
|
101
101
|
- - '='
|
|
102
102
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: 0.
|
|
103
|
+
version: 0.147.0
|
|
104
104
|
type: :runtime
|
|
105
105
|
prerelease: false
|
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
107
|
requirements:
|
|
108
108
|
- - '='
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
|
-
version: 0.
|
|
110
|
+
version: 0.147.0
|
|
111
111
|
- !ruby/object:Gem::Dependency
|
|
112
112
|
name: dotenv
|
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|