handinger 0.4.0 → 0.5.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: 944762f22d72ab9b304851aa18a7d34221ad5aa7d785e50f423b7b55ba09eaed
4
- data.tar.gz: 3b9a81528fce0edaedbbe54f0e155c00d91635f24e4275b7f5b40984873a9fc6
3
+ metadata.gz: ecd40670a310e06ad0f0b33baa0f620b434bb11398f45a9e44e9c536533441bd
4
+ data.tar.gz: 18bf80c24a1126bb839e73146ec8d5aab5c62aba54fbdf8d56f32a0fb3c97ec1
5
5
  SHA512:
6
- metadata.gz: 0435c4ab79474558084bd58c91cc6731d56f46e53827d2d0944427c94a8015c310afbd47b1daed618f19f37b375191c338a54c91004c86c316454095a0dc0936
7
- data.tar.gz: 8ea226be6e29c61cd4745a1a774319c951c01684386450bf3115ff0be3097022682c799533683140f96bf23eb3a1ed511b1e0a63bfa083b6b9f802ec43b03194
6
+ metadata.gz: 7520dd4bf1e744831db561b4bc1af8ac9aea2c767f5f477e81604a6d7b1a4a45fc70328bf569832e774eed201bf7bff0ea0c6a80c015f6fea1130caeb6367b91
7
+ data.tar.gz: 40b7e0965ddc840e39988a2d3659d31d3a47074770054149e4c31534ddbee84162eb16ab61ae0831b8dba59b6bd312691223526e06c0dae9a8ff269fef63465f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.0 (2026-05-11)
4
+
5
+ Full Changelog: [v0.4.0...v0.5.0](https://github.com/Ramensoft/handinger-ruby/compare/v0.4.0...v0.5.0)
6
+
7
+ ### Features
8
+
9
+ * Duplicate workers ([95c3bab](https://github.com/Ramensoft/handinger-ruby/commit/95c3babf3d9e97ad4d0b410f90c601e3613bdbee))
10
+
11
+
12
+ ### Chores
13
+
14
+ * remove custom code ([e9cece7](https://github.com/Ramensoft/handinger-ruby/commit/e9cece7ce4e8a03e89b558253048b19f2872f27a))
15
+
3
16
  ## 0.4.0 (2026-05-11)
4
17
 
5
18
  Full Changelog: [v0.3.0...v0.4.0](https://github.com/Ramensoft/handinger-ruby/compare/v0.3.0...v0.4.0)
data/README.md CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "handinger", "~> 0.4.0"
20
+ gem "handinger", "~> 0.5.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -32,7 +32,7 @@ handinger = Handinger::Client.new(
32
32
  api_key: ENV["HANDINGER_API_KEY"] # This is the default and can be omitted
33
33
  )
34
34
 
35
- worker = handinger.tasks.create(worker_id: "wrk_vk81XUHKHG-qr4")
35
+ worker = handinger.tasks.create(input: "What's the weather today in Barcelona?", worker_id: "wrk_vk81XUHKHG-qr4")
36
36
 
37
37
  puts(worker.id)
38
38
  ```
@@ -43,7 +43,7 @@ When the library is unable to connect to the API, or if the API returns a non-su
43
43
 
44
44
  ```ruby
45
45
  begin
46
- task = handinger.tasks.create(worker_id: "wrk_vk81XUHKHG-qr4")
46
+ task = handinger.tasks.create(input: "What's the weather today in Barcelona?", worker_id: "wrk_vk81XUHKHG-qr4")
47
47
  rescue Handinger::Errors::APIConnectionError => e
48
48
  puts("The server could not be reached")
49
49
  puts(e.cause) # an underlying Exception, likely raised within `net/http`
@@ -86,7 +86,11 @@ handinger = Handinger::Client.new(
86
86
  )
87
87
 
88
88
  # Or, configure per-request:
89
- handinger.tasks.create(worker_id: "wrk_vk81XUHKHG-qr4", request_options: {max_retries: 5})
89
+ handinger.tasks.create(
90
+ input: "What's the weather today in Barcelona?",
91
+ worker_id: "wrk_vk81XUHKHG-qr4",
92
+ request_options: {max_retries: 5}
93
+ )
90
94
  ```
91
95
 
92
96
  ### Timeouts
@@ -100,7 +104,11 @@ handinger = Handinger::Client.new(
100
104
  )
101
105
 
102
106
  # Or, configure per-request:
103
- handinger.tasks.create(worker_id: "wrk_vk81XUHKHG-qr4", request_options: {timeout: 5})
107
+ handinger.tasks.create(
108
+ input: "What's the weather today in Barcelona?",
109
+ worker_id: "wrk_vk81XUHKHG-qr4",
110
+ request_options: {timeout: 5}
111
+ )
104
112
  ```
105
113
 
106
114
  On timeout, `Handinger::Errors::APITimeoutError` is raised.
@@ -132,6 +140,7 @@ Note: the `extra_` parameters of the same name overrides the documented paramete
132
140
  ```ruby
133
141
  worker =
134
142
  handinger.tasks.create(
143
+ input: "What's the weather today in Barcelona?",
135
144
  worker_id: "wrk_vk81XUHKHG-qr4",
136
145
  request_options: {
137
146
  extra_query: {my_query_parameter: value},
@@ -178,17 +187,20 @@ This library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitio
178
187
  You can provide typesafe request parameters like so:
179
188
 
180
189
  ```ruby
181
- handinger.tasks.create(worker_id: "wrk_vk81XUHKHG-qr4")
190
+ handinger.tasks.create(input: "What's the weather today in Barcelona?", worker_id: "wrk_vk81XUHKHG-qr4")
182
191
  ```
183
192
 
184
193
  Or, equivalently:
185
194
 
186
195
  ```ruby
187
196
  # Hashes work, but are not typesafe:
188
- handinger.tasks.create(worker_id: "wrk_vk81XUHKHG-qr4")
197
+ handinger.tasks.create(input: "What's the weather today in Barcelona?", worker_id: "wrk_vk81XUHKHG-qr4")
189
198
 
190
199
  # You can also splat a full Params class:
191
- params = Handinger::TaskCreateParams.new(worker_id: "wrk_vk81XUHKHG-qr4")
200
+ params = Handinger::TaskCreateParams.new(
201
+ input: "What's the weather today in Barcelona?",
202
+ worker_id: "wrk_vk81XUHKHG-qr4"
203
+ )
192
204
  handinger.tasks.create(**params)
193
205
  ```
194
206
 
@@ -57,7 +57,7 @@ module Handinger
57
57
  initial_retry_delay: self.class::DEFAULT_INITIAL_RETRY_DELAY,
58
58
  max_retry_delay: self.class::DEFAULT_MAX_RETRY_DELAY
59
59
  )
60
- base_url ||= "https://v3.handinger.com"
60
+ base_url ||= "https://handinger.com"
61
61
 
62
62
  if api_key.nil?
63
63
  raise ArgumentError.new("api_key is required, and can be set via environ: \"HANDINGER_API_KEY\"")
@@ -2,12 +2,21 @@
2
2
 
3
3
  module Handinger
4
4
  module Models
5
- class CreateTask < Handinger::Models::CreateWorker
6
- # @!attribute worker_id
7
- # Worker id the task belongs to.
5
+ class CreateTask < Handinger::Internal::Type::BaseModel
6
+ # @!attribute input
8
7
  #
9
8
  # @return [String]
10
- required :worker_id, String, api_name: :workerId
9
+ required :input, String
10
+
11
+ # @!attribute budget
12
+ #
13
+ # @return [Symbol, Handinger::Models::CreateTask::Budget, nil]
14
+ optional :budget, enum: -> { Handinger::CreateTask::Budget }
15
+
16
+ # @!attribute stream
17
+ #
18
+ # @return [Boolean, nil]
19
+ optional :stream, Handinger::Internal::Type::Boolean
11
20
 
12
21
  # @!attribute task_id
13
22
  # Optional client-provided task id. Reuse this id to add turns to an existing
@@ -16,13 +25,39 @@ module Handinger
16
25
  # @return [String, nil]
17
26
  optional :task_id, String, api_name: :taskId
18
27
 
19
- # @!method initialize(worker_id:, task_id: nil)
28
+ # @!attribute worker_id
29
+ # Worker id the task belongs to. If omitted, a new worker is created on-the-fly
30
+ # using the input as instructions.
31
+ #
32
+ # @return [String, nil]
33
+ optional :worker_id, String, api_name: :workerId
34
+
35
+ # @!method initialize(input:, budget: nil, stream: nil, task_id: nil, worker_id: nil)
20
36
  # Some parameter documentations has been truncated, see
21
37
  # {Handinger::Models::CreateTask} for more details.
22
38
  #
23
- # @param worker_id [String] Worker id the task belongs to.
39
+ # @param input [String]
40
+ #
41
+ # @param budget [Symbol, Handinger::Models::CreateTask::Budget]
42
+ #
43
+ # @param stream [Boolean]
24
44
  #
25
45
  # @param task_id [String] Optional client-provided task id. Reuse this id to add turns to an existing task
46
+ #
47
+ # @param worker_id [String] Worker id the task belongs to. If omitted, a new worker is created on-the-fly us
48
+
49
+ # @see Handinger::Models::CreateTask#budget
50
+ module Budget
51
+ extend Handinger::Internal::Type::Enum
52
+
53
+ LOW = :low
54
+ STANDARD = :standard
55
+ HIGH = :high
56
+ UNLIMITED = :unlimited
57
+
58
+ # @!method self.values
59
+ # @return [Array<Symbol>]
60
+ end
26
61
  end
27
62
  end
28
63
  end
@@ -12,23 +12,17 @@ module Handinger
12
12
  # `multipart/form-data` to attach files; the bytes are bootstrapped into the
13
13
  # worker's workspace before the task starts.
14
14
  #
15
- # @overload create(worker_id:, instructions: nil, output_schema: nil, prompt: nil, summary: nil, task_id: nil, title: nil, visibility: nil, request_options: {})
15
+ # @overload create(input:, budget: nil, stream: nil, task_id: nil, worker_id: nil, request_options: {})
16
16
  #
17
- # @param worker_id [String] Worker id the task belongs to.
17
+ # @param input [String]
18
18
  #
19
- # @param instructions [String] Persistent system prompt the worker uses for every task it runs.
19
+ # @param budget [Symbol, Handinger::Models::CreateTask::Budget]
20
20
  #
21
- # @param output_schema [Hash{Symbol=>Object}] Optional JSON Schema (Draft-07) describing the structured object the worker must
22
- #
23
- # @param prompt [String] Natural-language description of the worker to use for AI-generated instructions
24
- #
25
- # @param summary [String] Short one-line description of the worker's purpose. Auto-generated when omitted
21
+ # @param stream [Boolean]
26
22
  #
27
23
  # @param task_id [String] Optional client-provided task id. Reuse this id to add turns to an existing task
28
24
  #
29
- # @param title [String] Optional display name. When omitted, Handinger assigns a random dog-themed name.
30
- #
31
- # @param visibility [Symbol, Handinger::Models::CreateTask::Visibility] `public` (default) is visible to all org members. `private` is only visible to i
25
+ # @param worker_id [String] Worker id the task belongs to. If omitted, a new worker is created on-the-fly us
32
26
  #
33
27
  # @param request_options [Handinger::RequestOptions, Hash{Symbol=>Object}, nil]
34
28
  #
@@ -111,9 +111,9 @@ module Handinger
111
111
  )
112
112
  end
113
113
 
114
- # Permanently delete a worker template along with its tasks, turns, files,
115
- # schedules, and integrations. This action is not reversible. Only the worker
116
- # creator can delete a worker.
114
+ # Soft-delete a worker template so it no longer appears in list or retrieve
115
+ # endpoints. Tasks, turns, files, schedules, and integrations remain in the
116
+ # database for analytics. Only the worker creator can delete a worker.
117
117
  #
118
118
  # @overload delete(worker_id, request_options: {})
119
119
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Handinger
4
- VERSION = "0.4.0"
4
+ VERSION = "0.5.0"
5
5
  end
data/lib/handinger.rb CHANGED
@@ -52,8 +52,8 @@ require_relative "handinger/errors"
52
52
  require_relative "handinger/internal/transport/base_client"
53
53
  require_relative "handinger/internal/transport/pooled_net_requester"
54
54
  require_relative "handinger/client"
55
- require_relative "handinger/models/create_worker"
56
55
  require_relative "handinger/models/create_task"
56
+ require_relative "handinger/models/create_worker"
57
57
  require_relative "handinger/models/update_worker"
58
58
  require_relative "handinger/models/delete_task_response"
59
59
  require_relative "handinger/models/delete_worker_response"
@@ -2,15 +2,26 @@
2
2
 
3
3
  module Handinger
4
4
  module Models
5
- class CreateTask < Handinger::Models::CreateWorker
5
+ class CreateTask < Handinger::Internal::Type::BaseModel
6
6
  OrHash =
7
7
  T.type_alias do
8
8
  T.any(Handinger::CreateTask, Handinger::Internal::AnyHash)
9
9
  end
10
10
 
11
- # Worker id the task belongs to.
12
11
  sig { returns(String) }
13
- attr_accessor :worker_id
12
+ attr_accessor :input
13
+
14
+ sig { returns(T.nilable(Handinger::CreateTask::Budget::OrSymbol)) }
15
+ attr_reader :budget
16
+
17
+ sig { params(budget: Handinger::CreateTask::Budget::OrSymbol).void }
18
+ attr_writer :budget
19
+
20
+ sig { returns(T.nilable(T::Boolean)) }
21
+ attr_reader :stream
22
+
23
+ sig { params(stream: T::Boolean).void }
24
+ attr_writer :stream
14
25
 
15
26
  # Optional client-provided task id. Reuse this id to add turns to an existing
16
27
  # task.
@@ -20,21 +31,71 @@ module Handinger
20
31
  sig { params(task_id: String).void }
21
32
  attr_writer :task_id
22
33
 
34
+ # Worker id the task belongs to. If omitted, a new worker is created on-the-fly
35
+ # using the input as instructions.
36
+ sig { returns(T.nilable(String)) }
37
+ attr_reader :worker_id
38
+
39
+ sig { params(worker_id: String).void }
40
+ attr_writer :worker_id
41
+
23
42
  sig do
24
- params(worker_id: String, task_id: String).returns(T.attached_class)
43
+ params(
44
+ input: String,
45
+ budget: Handinger::CreateTask::Budget::OrSymbol,
46
+ stream: T::Boolean,
47
+ task_id: String,
48
+ worker_id: String
49
+ ).returns(T.attached_class)
25
50
  end
26
51
  def self.new(
27
- # Worker id the task belongs to.
28
- worker_id:,
52
+ input:,
53
+ budget: nil,
54
+ stream: nil,
29
55
  # Optional client-provided task id. Reuse this id to add turns to an existing
30
56
  # task.
31
- task_id: nil
57
+ task_id: nil,
58
+ # Worker id the task belongs to. If omitted, a new worker is created on-the-fly
59
+ # using the input as instructions.
60
+ worker_id: nil
32
61
  )
33
62
  end
34
63
 
35
- sig { override.returns({ worker_id: String, task_id: String }) }
64
+ sig do
65
+ override.returns(
66
+ {
67
+ input: String,
68
+ budget: Handinger::CreateTask::Budget::OrSymbol,
69
+ stream: T::Boolean,
70
+ task_id: String,
71
+ worker_id: String
72
+ }
73
+ )
74
+ end
36
75
  def to_hash
37
76
  end
77
+
78
+ module Budget
79
+ extend Handinger::Internal::Type::Enum
80
+
81
+ TaggedSymbol =
82
+ T.type_alias { T.all(Symbol, Handinger::CreateTask::Budget) }
83
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
84
+
85
+ LOW = T.let(:low, Handinger::CreateTask::Budget::TaggedSymbol)
86
+ STANDARD = T.let(:standard, Handinger::CreateTask::Budget::TaggedSymbol)
87
+ HIGH = T.let(:high, Handinger::CreateTask::Budget::TaggedSymbol)
88
+ UNLIMITED =
89
+ T.let(:unlimited, Handinger::CreateTask::Budget::TaggedSymbol)
90
+
91
+ sig do
92
+ override.returns(
93
+ T::Array[Handinger::CreateTask::Budget::TaggedSymbol]
94
+ )
95
+ end
96
+ def self.values
97
+ end
98
+ end
38
99
  end
39
100
  end
40
101
  end
@@ -10,40 +10,24 @@ module Handinger
10
10
  # worker's workspace before the task starts.
11
11
  sig do
12
12
  params(
13
- worker_id: String,
14
- instructions: String,
15
- output_schema: T::Hash[Symbol, T.anything],
16
- prompt: String,
17
- summary: String,
13
+ input: String,
14
+ budget: Handinger::CreateTask::Budget::OrSymbol,
15
+ stream: T::Boolean,
18
16
  task_id: String,
19
- title: String,
20
- visibility: Handinger::CreateTask::Visibility::OrSymbol,
17
+ worker_id: String,
21
18
  request_options: Handinger::RequestOptions::OrHash
22
19
  ).returns(Handinger::Worker)
23
20
  end
24
21
  def create(
25
- # Worker id the task belongs to.
26
- worker_id:,
27
- # Persistent system prompt the worker uses for every task it runs.
28
- instructions: nil,
29
- # Optional JSON Schema (Draft-07) describing the structured object the worker must
30
- # produce. When set, every task response is validated against the schema and
31
- # exposed as `structuredOutput`.
32
- output_schema: nil,
33
- # Natural-language description of the worker to use for AI-generated instructions
34
- # when `instructions` is omitted.
35
- prompt: nil,
36
- # Short one-line description of the worker's purpose. Auto-generated when omitted
37
- # and a `prompt` is provided.
38
- summary: nil,
22
+ input:,
23
+ budget: nil,
24
+ stream: nil,
39
25
  # Optional client-provided task id. Reuse this id to add turns to an existing
40
26
  # task.
41
27
  task_id: nil,
42
- # Optional display name. When omitted, Handinger assigns a random dog-themed name.
43
- title: nil,
44
- # `public` (default) is visible to all org members. `private` is only visible to
45
- # invited members.
46
- visibility: nil,
28
+ # Worker id the task belongs to. If omitted, a new worker is created on-the-fly
29
+ # using the input as instructions.
30
+ worker_id: nil,
47
31
  request_options: {}
48
32
  )
49
33
  end
@@ -98,9 +98,9 @@ module Handinger
98
98
  )
99
99
  end
100
100
 
101
- # Permanently delete a worker template along with its tasks, turns, files,
102
- # schedules, and integrations. This action is not reversible. Only the worker
103
- # creator can delete a worker.
101
+ # Soft-delete a worker template so it no longer appears in list or retrieve
102
+ # endpoints. Tasks, turns, files, schedules, and integrations remain in the
103
+ # database for analytics. Only the worker creator can delete a worker.
104
104
  sig do
105
105
  params(
106
106
  worker_id: String,
@@ -1,19 +1,63 @@
1
1
  module Handinger
2
2
  module Models
3
- type create_task = { worker_id: String, task_id: String }
3
+ type create_task =
4
+ {
5
+ input: String,
6
+ budget: Handinger::Models::CreateTask::budget,
7
+ stream: bool,
8
+ task_id: String,
9
+ worker_id: String
10
+ }
4
11
 
5
- class CreateTask < Handinger::Models::CreateWorker
6
- def worker_id: -> String
12
+ class CreateTask < Handinger::Internal::Type::BaseModel
13
+ attr_accessor input: String
7
14
 
8
- def worker_id=: (String _) -> String
15
+ attr_reader budget: Handinger::Models::CreateTask::budget?
9
16
 
10
- def task_id: -> String?
17
+ def budget=: (
18
+ Handinger::Models::CreateTask::budget
19
+ ) -> Handinger::Models::CreateTask::budget
11
20
 
12
- def task_id=: (String _) -> String
21
+ attr_reader stream: bool?
13
22
 
14
- def initialize: (worker_id: String, ?task_id: String) -> void
23
+ def stream=: (bool) -> bool
15
24
 
16
- def to_hash: -> { worker_id: String, task_id: String }
25
+ attr_reader task_id: String?
26
+
27
+ def task_id=: (String) -> String
28
+
29
+ attr_reader worker_id: String?
30
+
31
+ def worker_id=: (String) -> String
32
+
33
+ def initialize: (
34
+ input: String,
35
+ ?budget: Handinger::Models::CreateTask::budget,
36
+ ?stream: bool,
37
+ ?task_id: String,
38
+ ?worker_id: String
39
+ ) -> void
40
+
41
+ def to_hash: -> {
42
+ input: String,
43
+ budget: Handinger::Models::CreateTask::budget,
44
+ stream: bool,
45
+ task_id: String,
46
+ worker_id: String
47
+ }
48
+
49
+ type budget = :low | :standard | :high | :unlimited
50
+
51
+ module Budget
52
+ extend Handinger::Internal::Type::Enum
53
+
54
+ LOW: :low
55
+ STANDARD: :standard
56
+ HIGH: :high
57
+ UNLIMITED: :unlimited
58
+
59
+ def self?.values: -> ::Array[Handinger::Models::CreateTask::budget]
60
+ end
17
61
  end
18
62
  end
19
63
  end
@@ -2,14 +2,11 @@ module Handinger
2
2
  module Resources
3
3
  class Tasks
4
4
  def create: (
5
- worker_id: String,
6
- ?instructions: String,
7
- ?output_schema: ::Hash[Symbol, top],
8
- ?prompt: String,
9
- ?summary: String,
5
+ input: String,
6
+ ?budget: Handinger::Models::CreateTask::budget,
7
+ ?stream: bool,
10
8
  ?task_id: String,
11
- ?title: String,
12
- ?visibility: Handinger::Models::CreateTask::visibility,
9
+ ?worker_id: String,
13
10
  ?request_options: Handinger::request_opts
14
11
  ) -> Handinger::Worker
15
12
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: handinger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Handinger