daytona 0.175.0 → 0.176.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/computer_use.rb +137 -0
- data/lib/daytona/sdk/version.rb +1 -1
- data/scripts/generate-docs.rb +6 -1
- metadata +5 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7535ad9431345bb3c463fe8bfbeb3e0f296fb5aefd6e8a2208376aa71893fb77
|
|
4
|
+
data.tar.gz: 74f70acd3c6cb193bc8d471e437345ea6ed68bf65d6b8735fc1d0826306c8a03
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e80742f74b83913585be67091015a0b39c6bbd4acb1c7d0743e73bde841940fe9cdce49d4a466cead18bd54b550888ba873925b80cb034995ae4dc0f7bb986d3
|
|
7
|
+
data.tar.gz: b123fc8cfd3c45d122f750777194f493982256550bb93525c5cb981b795d0aaa8e2f5d707ce0e00bb4ca2c76fabbfcc464bb3370787c6243e184ea1c21fbf61e
|
data/lib/daytona/computer_use.rb
CHANGED
|
@@ -409,6 +409,139 @@ module Daytona
|
|
|
409
409
|
attr_reader :otel_state
|
|
410
410
|
end
|
|
411
411
|
|
|
412
|
+
# Accessibility operations for computer use functionality.
|
|
413
|
+
class Accessibility
|
|
414
|
+
include Instrumentation
|
|
415
|
+
|
|
416
|
+
# @return [String] The ID of the sandbox
|
|
417
|
+
attr_reader :sandbox_id
|
|
418
|
+
|
|
419
|
+
# @return [DaytonaToolboxApiClient::ComputerUseApi] API client for sandbox operations
|
|
420
|
+
attr_reader :toolbox_api
|
|
421
|
+
|
|
422
|
+
# @param sandbox_id [String] The ID of the sandbox
|
|
423
|
+
# @param toolbox_api [DaytonaToolboxApiClient::ComputerUseApi] API client for sandbox operations
|
|
424
|
+
# @param otel_state [Daytona::OtelState, nil]
|
|
425
|
+
def initialize(sandbox_id:, toolbox_api:, otel_state: nil)
|
|
426
|
+
@sandbox_id = sandbox_id
|
|
427
|
+
@toolbox_api = toolbox_api
|
|
428
|
+
@otel_state = otel_state
|
|
429
|
+
end
|
|
430
|
+
|
|
431
|
+
# Fetches the AT-SPI accessibility tree.
|
|
432
|
+
#
|
|
433
|
+
# @param scope [String, nil] Tree scope to inspect: "focused", "pid", or "all"
|
|
434
|
+
# @param pid [Integer, nil] Process ID when scope is "pid"
|
|
435
|
+
# @param max_depth [Integer, nil] Maximum depth to descend; 0 returns only the root
|
|
436
|
+
# @return [DaytonaToolboxApiClient::AccessibilityTreeResponse] Accessibility tree response
|
|
437
|
+
# @raise [Daytona::Sdk::Error] If the operation fails
|
|
438
|
+
#
|
|
439
|
+
# @example
|
|
440
|
+
# tree = sandbox.computer_use.accessibility.get_tree(scope: "all", max_depth: 3)
|
|
441
|
+
# puts tree.root.name
|
|
442
|
+
def get_tree(scope: nil, pid: nil, max_depth: nil)
|
|
443
|
+
opts = {}
|
|
444
|
+
opts[:scope] = scope unless scope.nil?
|
|
445
|
+
opts[:pid] = pid unless pid.nil?
|
|
446
|
+
opts[:max_depth] = max_depth unless max_depth.nil?
|
|
447
|
+
|
|
448
|
+
toolbox_api.get_accessibility_tree(opts)
|
|
449
|
+
rescue StandardError => e
|
|
450
|
+
raise Sdk::Error, "Failed to get accessibility tree: #{e.message}"
|
|
451
|
+
end
|
|
452
|
+
|
|
453
|
+
# Finds AT-SPI accessibility nodes matching the provided filters.
|
|
454
|
+
#
|
|
455
|
+
# @param scope [String, nil] Search scope: "focused", "pid", or "all"
|
|
456
|
+
# @param pid [Integer, nil] Process ID when scope is "pid"
|
|
457
|
+
# @param role [String, nil] Accessibility role to match, such as "button"
|
|
458
|
+
# @param name [String, nil] Accessible name to match
|
|
459
|
+
# @param name_match [String, nil] Name match mode, such as "exact" or "substring"
|
|
460
|
+
# @param states [Array<String>, nil] Required accessibility states
|
|
461
|
+
# @param limit [Integer, nil] Maximum number of matches
|
|
462
|
+
# @return [DaytonaToolboxApiClient::AccessibilityNodesResponse] Matching accessibility nodes
|
|
463
|
+
# @raise [Daytona::Sdk::Error] If the operation fails
|
|
464
|
+
#
|
|
465
|
+
# @example
|
|
466
|
+
# buttons = sandbox.computer_use.accessibility.find_nodes(
|
|
467
|
+
# scope: "all",
|
|
468
|
+
# role: "button",
|
|
469
|
+
# name: "Submit",
|
|
470
|
+
# name_match: "substring"
|
|
471
|
+
# )
|
|
472
|
+
# puts buttons.matches.length
|
|
473
|
+
def find_nodes(scope: nil, pid: nil, role: nil, name: nil, name_match: nil, states: nil, limit: nil)
|
|
474
|
+
attrs = {}
|
|
475
|
+
attrs[:scope] = scope unless scope.nil?
|
|
476
|
+
attrs[:pid] = pid unless pid.nil?
|
|
477
|
+
attrs[:role] = role unless role.nil?
|
|
478
|
+
attrs[:name] = name unless name.nil?
|
|
479
|
+
attrs[:name_match] = name_match unless name_match.nil?
|
|
480
|
+
attrs[:states] = states unless states.nil?
|
|
481
|
+
attrs[:limit] = limit unless limit.nil?
|
|
482
|
+
|
|
483
|
+
request = DaytonaToolboxApiClient::FindAccessibilityNodesRequest.new(attrs)
|
|
484
|
+
toolbox_api.find_accessibility_nodes(request)
|
|
485
|
+
rescue StandardError => e
|
|
486
|
+
raise Sdk::Error, "Failed to find accessibility nodes: #{e.message}"
|
|
487
|
+
end
|
|
488
|
+
|
|
489
|
+
# Focuses an AT-SPI accessibility node.
|
|
490
|
+
#
|
|
491
|
+
# @param id [String] Accessibility node ID returned by get_tree or find_nodes
|
|
492
|
+
# @raise [Daytona::Sdk::Error] If the operation fails
|
|
493
|
+
#
|
|
494
|
+
# @example
|
|
495
|
+
# sandbox.computer_use.accessibility.focus_node(id: node.id)
|
|
496
|
+
def focus_node(id:)
|
|
497
|
+
request = DaytonaToolboxApiClient::AccessibilityNodeRequest.new(id:)
|
|
498
|
+
toolbox_api.focus_accessibility_node(request)
|
|
499
|
+
rescue StandardError => e
|
|
500
|
+
raise Sdk::Error, "Failed to focus accessibility node: #{e.message}"
|
|
501
|
+
end
|
|
502
|
+
|
|
503
|
+
# Invokes an AT-SPI accessibility node action.
|
|
504
|
+
#
|
|
505
|
+
# @param id [String] Accessibility node ID returned by get_tree or find_nodes
|
|
506
|
+
# @param action [String, nil] Action name to invoke, or nil for the primary action
|
|
507
|
+
# @raise [Daytona::Sdk::Error] If the operation fails
|
|
508
|
+
#
|
|
509
|
+
# @example
|
|
510
|
+
# sandbox.computer_use.accessibility.invoke_node(id: node.id, action: "click")
|
|
511
|
+
def invoke_node(id:, action: nil)
|
|
512
|
+
attrs = { id: }
|
|
513
|
+
attrs[:action] = action unless action.nil?
|
|
514
|
+
|
|
515
|
+
request = DaytonaToolboxApiClient::AccessibilityInvokeRequest.new(attrs)
|
|
516
|
+
toolbox_api.invoke_accessibility_node(request)
|
|
517
|
+
rescue StandardError => e
|
|
518
|
+
raise Sdk::Error, "Failed to invoke accessibility node: #{e.message}"
|
|
519
|
+
end
|
|
520
|
+
|
|
521
|
+
# Sets an AT-SPI accessibility node value.
|
|
522
|
+
#
|
|
523
|
+
# @param id [String] Accessibility node ID returned by get_tree or find_nodes
|
|
524
|
+
# @param value [String] Value to write to the node
|
|
525
|
+
# @raise [Daytona::Sdk::Error] If the operation fails
|
|
526
|
+
#
|
|
527
|
+
# @example
|
|
528
|
+
# sandbox.computer_use.accessibility.set_node_value(id: node.id, value: "hello")
|
|
529
|
+
def set_node_value(id:, value:)
|
|
530
|
+
request = DaytonaToolboxApiClient::AccessibilitySetValueRequest.new(id:, value:)
|
|
531
|
+
toolbox_api.set_accessibility_node_value(request)
|
|
532
|
+
rescue StandardError => e
|
|
533
|
+
raise Sdk::Error, "Failed to set accessibility node value: #{e.message}"
|
|
534
|
+
end
|
|
535
|
+
|
|
536
|
+
instrument :get_tree, :find_nodes, :focus_node, :invoke_node, :set_node_value,
|
|
537
|
+
component: 'Accessibility'
|
|
538
|
+
|
|
539
|
+
private
|
|
540
|
+
|
|
541
|
+
# @return [Daytona::OtelState, nil]
|
|
542
|
+
attr_reader :otel_state
|
|
543
|
+
end
|
|
544
|
+
|
|
412
545
|
# Region coordinates for screenshot operations.
|
|
413
546
|
class ScreenshotRegion
|
|
414
547
|
# @return [Integer] X coordinate of the region
|
|
@@ -652,6 +785,9 @@ module Daytona
|
|
|
652
785
|
# @return [Recording] Screen recording operations interface
|
|
653
786
|
attr_reader :recording
|
|
654
787
|
|
|
788
|
+
# @return [Accessibility] Accessibility operations interface
|
|
789
|
+
attr_reader :accessibility
|
|
790
|
+
|
|
655
791
|
# Initialize a new ComputerUse instance.
|
|
656
792
|
#
|
|
657
793
|
# @param sandbox_id [String] The ID of the sandbox
|
|
@@ -666,6 +802,7 @@ module Daytona
|
|
|
666
802
|
@screenshot = Screenshot.new(sandbox_id:, toolbox_api:, otel_state:)
|
|
667
803
|
@display = Display.new(sandbox_id:, toolbox_api:, otel_state:)
|
|
668
804
|
@recording = Recording.new(sandbox_id:, toolbox_api:, otel_state:)
|
|
805
|
+
@accessibility = Accessibility.new(sandbox_id:, toolbox_api:, otel_state:)
|
|
669
806
|
end
|
|
670
807
|
|
|
671
808
|
# Starts all computer use processes (Xvfb, xfce4, x11vnc, novnc).
|
data/lib/daytona/sdk/version.rb
CHANGED
data/scripts/generate-docs.rb
CHANGED
|
@@ -23,6 +23,7 @@ CLASSES_TO_DOCUMENT = [
|
|
|
23
23
|
['volume.rb', 'volume.mdx', 'Daytona::Volume'],
|
|
24
24
|
['object_storage.rb', 'object-storage.mdx', 'Daytona::ObjectStorage'],
|
|
25
25
|
['computer_use.rb', 'computer-use.mdx', 'Daytona::ComputerUse'],
|
|
26
|
+
['computer_use.rb', 'computer-use.mdx', 'Daytona::ComputerUse::Accessibility'],
|
|
26
27
|
['snapshot_service.rb', 'snapshot.mdx', 'Daytona::SnapshotService'],
|
|
27
28
|
['volume_service.rb', 'volume-service.mdx', 'Daytona::VolumeService'],
|
|
28
29
|
['common/charts.rb', 'charts.mdx', 'Daytona::Chart'],
|
|
@@ -371,7 +372,11 @@ def generate_docs_for_class(file_path, output_filename, class_name)
|
|
|
371
372
|
|
|
372
373
|
# Write to output file
|
|
373
374
|
output_path = File.join(DOCS_OUTPUT_DIR, output_filename)
|
|
374
|
-
File.
|
|
375
|
+
if File.exist?(output_path)
|
|
376
|
+
File.write(output_path, "#{File.read(output_path).rstrip}\n\n#{markdown_content}")
|
|
377
|
+
else
|
|
378
|
+
File.write(output_path, final_content)
|
|
379
|
+
end
|
|
375
380
|
|
|
376
381
|
puts "✅ Generated: #{output_filename}"
|
|
377
382
|
rescue StandardError => e
|
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.
|
|
4
|
+
version: 0.176.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.
|
|
88
|
+
version: 0.176.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.
|
|
95
|
+
version: 0.176.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.
|
|
102
|
+
version: 0.176.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.
|
|
109
|
+
version: 0.176.0
|
|
110
110
|
- !ruby/object:Gem::Dependency
|
|
111
111
|
name: dotenv
|
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|