sai-sdk 0.2.0 → 0.2.1

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: cf8b91f34d28bcf34e57a3a49a3b8a1e996c11ba27dbed5e75cf5f27cda1cd46
4
- data.tar.gz: b67f3951139fc55948b58145cbdd62eaf34f82250a107671b35ef87a27330a94
3
+ metadata.gz: d8a0a6c688d54e3719db71fb3ffa74980efe963c6a3d5e3926861286383e97cc
4
+ data.tar.gz: 4ff11be47d9fdc707e24c1444b97711cceccceab0b89c3b56693fabad967fa29
5
5
  SHA512:
6
- metadata.gz: c785b77c57c7f2f423f460bdd1238afd6cc45ace84d4cb0d082a9bd7fb7332bece7879b716eaaa4783f08a3579105667f47a24c8d560dd8ca59927d7cd83b18c
7
- data.tar.gz: b1eac86011e4a0e87b24e3ca09b8c186f8ce74dfd10e0eb59e486f2d3614b16e75fcb088f7e1572dc8597c20eef4a8d1e569720a9d2fc3a12a0528530f319ad1
6
+ metadata.gz: 2773ec415819ea241e55c31d2e97009b7dd432571f8c23bce1d82ea26c23c2e6efe4119f2dc310670bf2e33ac9fa48866f2257e4be9231fc64c5d99d3e21444a
7
+ data.tar.gz: 5e516f46a6f4558bc98f02169faec4a0c74501718fb42d4143c5df3475f2fba1d76e178cc2b5a73a1c1e13956a7b0616b5db1789ec70d84726f585cc231f3a9e
data/README.md CHANGED
@@ -200,6 +200,11 @@ usage = org.usage.get(granularity: "month", from: "2026-10", to: "2026-10")
200
200
  page = org.usage.sessions(tenant, from: "2026-10-01", to: "2026-10-31")
201
201
  ```
202
202
 
203
+ A machine from `tenant_machines` or `machines.list` has `capabilities`: what stands in the way of
204
+ driving it (`can_see`, `can_use_accessibility`, `can_control`, each nil when nothing was found in the
205
+ way, else a sentence saying what to fix), or nil when there is no answer yet (the machine has not
206
+ reported, or its check failed). See [machine capabilities](https://platform.simular.ai/documentation/organisations/tenant-machines#machine-capabilities).
207
+
203
208
  `usage.sessions` pages what each of a Tenant's sessions spent on AI calls, for UTC days `from:` to `to:`
204
209
  (at most 93). A page can be empty and still have a `next_cursor`: keep paging until it is `nil`.
205
210
 
data/lib/sai/types.rb CHANGED
@@ -105,10 +105,32 @@ module Sai
105
105
  end
106
106
  end
107
107
 
108
+ # What stands in the way of driving a machine, as the Sai runtime on it last reported. Each field
109
+ # is nil when nothing was found in the way (a check that cannot tell counts as fine), else a
110
+ # sentence for the user saying what is missing and how to fix it:
111
+ # +can_see+ (screenshots show what is on screen), +can_use_accessibility+ (other apps'
112
+ # accessibility trees can be read and acted on), +can_control+ (mouse, keyboard and element
113
+ # actions reach other apps; needs what +can_use_accessibility+ needs). See
114
+ # https://platform.simular.ai/documentation/organisations/tenant-machines#machine-capabilities.
115
+ MachineCapabilities = Struct.new(:can_see, :can_use_accessibility, :can_control,
116
+ keyword_init: true) do
117
+ # nil unless +v+ is an object whose three answers are each a string or nil.
118
+ def self.parse(v)
119
+ return nil unless v.is_a?(Hash)
120
+ return nil unless %w[canSee canUseAccessibility canControl].all? { |k| v.key?(k) && (v[k].nil? || v[k].is_a?(String)) }
121
+
122
+ new(can_see: v["canSee"], can_use_accessibility: v["canUseAccessibility"],
123
+ can_control: v["canControl"])
124
+ end
125
+ end
126
+
108
127
  # A computer Sai works on. +kind+ is +cloud+ or +own+; +state+ is +running+, +starting+,
109
128
  # +asleep+, +creating+ or +unknown+ (nil on servers that do not send it). +status+ is deprecated.
110
- Machine = Struct.new(:id, :name, :kind, :online, :state, :status, :can_wake, :os, :raw,
111
- keyword_init: true) do
129
+ # +capabilities+ is what stands in the way of driving it; nil when there is no answer yet: the
130
+ # machine has not reported (its runtime is too old to, or has not yet), or its check failed; also
131
+ # from older servers.
132
+ Machine = Struct.new(:id, :name, :kind, :online, :state, :status, :can_wake, :os, :capabilities,
133
+ :raw, keyword_init: true) do
112
134
  def self.parse(d)
113
135
  new(
114
136
  id: Parse.str(d["machineId"]) || "",
@@ -119,6 +141,7 @@ module Sai
119
141
  status: Parse.str(d["status"]),
120
142
  can_wake: Parse.truthy(d["canWake"]),
121
143
  os: Parse.str(d["os"]),
144
+ capabilities: MachineCapabilities.parse(d["capabilities"]),
122
145
  raw: d
123
146
  )
124
147
  end
@@ -578,9 +601,12 @@ module Sai
578
601
 
579
602
  # A Tenant's computer: enrolled, or a cloud machine Sai hosts. +kind+ is +enrolled+ or +cloud+;
580
603
  # +state+ is +online+/+offline+ (enrolled) or +provisioning+, +ready+, +starting+,
581
- # +hibernated+, +deleting+ or +failed+ (cloud).
604
+ # +hibernated+, +deleting+ or +failed+ (cloud). +capabilities+ is what stands in the way of
605
+ # driving it; nil when there is no answer yet: the machine has not reported (its runtime is too
606
+ # old to, or has not yet), or its check failed; also from older servers.
582
607
  TenantMachine = Struct.new(:id, :name, :platform, :status, :online, :last_seen, :runtime_version,
583
- :kind, :state, :machine_class, :created_at, :raw, keyword_init: true) do
608
+ :kind, :state, :machine_class, :created_at, :capabilities, :raw,
609
+ keyword_init: true) do
584
610
  def self.parse(d)
585
611
  # Servers before cloud machines send online and status and no kind or state.
586
612
  state = Parse.present(d["state"]) || (Parse.truthy(d["online"]) ? "online" : "offline")
@@ -596,6 +622,7 @@ module Sai
596
622
  state: state,
597
623
  machine_class: Parse.str(d["machineClass"]),
598
624
  created_at: Parse.num_or_nil(d["createdAt"]),
625
+ capabilities: MachineCapabilities.parse(d["capabilities"]),
599
626
  raw: d
600
627
  )
601
628
  end
data/lib/sai/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sai
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sai-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simular, Inc.