runtype 0.2.2 → 0.3.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.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +17 -1
  3. data/README.md +104 -17
  4. data/generated/lib/runtype/agent_aliases/client.rb +49 -1
  5. data/generated/lib/runtype/agent_aliases/types/get_v1agent_aliases_request.rb +13 -0
  6. data/generated/lib/runtype/agent_aliases/types/get_v1agent_aliases_response.rb +11 -0
  7. data/generated/lib/runtype/agent_aliases/types/get_v1agent_aliases_response_data_item.rb +25 -0
  8. data/generated/lib/runtype/agent_aliases/types/post_v1agents_id_aliases_alias_rollback_response.rb +4 -0
  9. data/generated/lib/runtype/agent_aliases/types/put_v1agents_id_aliases_alias_request.rb +2 -0
  10. data/generated/lib/runtype/agent_aliases/types/put_v1agents_id_aliases_alias_response.rb +4 -0
  11. data/generated/lib/runtype/agents/types/post_v1agents_ensure_request_definition_config_memory.rb +2 -0
  12. data/generated/lib/runtype/agents/types/post_v1agents_ensure_request_definition_config_memory_pointer_scope.rb +15 -0
  13. data/generated/lib/runtype/agents/types/post_v1agents_id_execute_request_x_runtype_concurrency.rb +1 -0
  14. data/generated/lib/runtype/agents/types/post_v1agents_request_config_memory.rb +2 -0
  15. data/generated/lib/runtype/agents/types/post_v1agents_request_config_memory_pointer_scope.rb +15 -0
  16. data/generated/lib/runtype/agents/types/put_v1agents_id_request_config_memory.rb +2 -0
  17. data/generated/lib/runtype/agents/types/put_v1agents_id_request_config_memory_pointer_scope.rb +15 -0
  18. data/generated/lib/runtype/batch/types/get_v1batch_batch_id_records_record_id_steps_response_data_item_execution_engine.rb +1 -0
  19. data/generated/lib/runtype/client.rb +5 -5
  20. data/generated/lib/runtype/client_runtime/client.rb +118 -1
  21. data/generated/lib/runtype/client_runtime/types/get_v1client_conversations_conversation_id_executions_execution_id_deliveries_delivery_id_request.rb +21 -0
  22. data/generated/lib/runtype/client_runtime/types/post_v1client_chat_request_submit_mode.rb +1 -0
  23. data/generated/lib/runtype/client_runtime/types/post_v1client_conversations_conversation_id_executions_execution_id_cancel_request.rb +19 -0
  24. data/generated/lib/runtype/client_runtime/types/post_v1client_conversations_conversation_id_executions_execution_id_cancel_response.rb +13 -0
  25. data/generated/lib/runtype/client_runtime/types/post_v1client_init_response_durable_recovery.rb +2 -0
  26. data/generated/lib/runtype/client_tokens/types/get_v1client_tokens_id_response_client_token.rb +4 -0
  27. data/generated/lib/runtype/client_tokens/types/get_v1client_tokens_response_client_tokens_item.rb +4 -0
  28. data/generated/lib/runtype/client_tokens/types/post_v1client_tokens_id_regenerate_response_client_token.rb +4 -0
  29. data/generated/lib/runtype/client_tokens/types/post_v1client_tokens_request.rb +4 -0
  30. data/generated/lib/runtype/client_tokens/types/post_v1client_tokens_response_client_token.rb +4 -0
  31. data/generated/lib/runtype/client_tokens/types/put_v1client_tokens_id_request.rb +4 -0
  32. data/generated/lib/runtype/client_tokens/types/put_v1client_tokens_id_response_client_token.rb +4 -0
  33. data/generated/lib/runtype/dispatch/client.rb +5 -3
  34. data/generated/lib/runtype/dispatch/types/post_v1dispatch_request_one_agent_memory.rb +2 -0
  35. data/generated/lib/runtype/dispatch/types/post_v1dispatch_request_one_agent_memory_pointer_scope.rb +15 -0
  36. data/generated/lib/runtype/dispatch/types/post_v1dispatch_request_zero_agent_memory.rb +2 -0
  37. data/generated/lib/runtype/dispatch/types/post_v1dispatch_request_zero_agent_memory_pointer_scope.rb +15 -0
  38. data/generated/lib/runtype/evals/types/get_v1eval_id_results_response.rb +10 -0
  39. data/generated/lib/runtype/evals/types/get_v1eval_id_results_response_agent_target_resolution.rb +15 -0
  40. data/generated/lib/runtype/evals/types/get_v1eval_id_results_response_results_by_record_value_item_execution_engine.rb +1 -0
  41. data/generated/lib/runtype/evals/types/post_v1eval_run_request.rb +2 -0
  42. data/generated/lib/runtype/evals/types/post_v1eval_run_request_agent.rb +15 -0
  43. data/generated/lib/runtype/evals/types/post_v1eval_submit_request.rb +2 -0
  44. data/generated/lib/runtype/evals/types/post_v1eval_submit_request_agent.rb +15 -0
  45. data/generated/lib/runtype/evals/types/post_v1eval_suites_id_run_request.rb +2 -0
  46. data/generated/lib/runtype/executions/client.rb +43 -0
  47. data/generated/lib/runtype/executions/types/get_v1executions_execution_id_deliveries_delivery_id_request.rb +13 -0
  48. data/generated/lib/runtype/flows/client.rb +3 -4
  49. data/generated/lib/runtype/flows/types/get_v1flows_id_step_results_response_data_item_execution_engine.rb +1 -0
  50. data/generated/lib/runtype/messaging_conversations/client.rb +2 -0
  51. data/generated/lib/runtype/messaging_conversations/types/get_v1messaging_conversations_request.rb +2 -0
  52. data/generated/lib/runtype/records/types/get_v1records_id_results_response_data_item_execution_engine.rb +1 -0
  53. data/generated/lib/runtype/records/types/get_v1records_id_step_results_response_data_item_execution_engine.rb +1 -0
  54. data/generated/lib/runtype/schedules/types/get_v1schedules_batch_batch_id_results_response_data_item_execution_engine.rb +1 -0
  55. data/generated/lib/runtype/schedules/types/get_v1schedules_runs_run_id_results_response_data_item_execution_engine.rb +1 -0
  56. data/generated/lib/runtype/types/agent_deployment_promotion.rb +17 -0
  57. data/generated/lib/runtype/types/agent_ensure_preview_alias_limit.rb +19 -0
  58. data/generated/lib/runtype/types/agent_ensure_preview_alias_limit_code.rb +11 -0
  59. data/generated/lib/runtype/types/agent_ensure_preview_alias_limit_scope.rb +12 -0
  60. data/generated/lib/runtype/types/agent_pull_response_definition_config_memory.rb +2 -0
  61. data/generated/lib/runtype/types/agent_pull_response_definition_config_memory_pointer_scope.rb +13 -0
  62. data/generated/lib/runtype/types/async_dispatch_handle.rb +10 -0
  63. data/generated/lib/runtype/types/async_dispatch_handle_delivery_status.rb +14 -0
  64. data/generated/lib/runtype/types/async_dispatch_handle_status.rb +5 -0
  65. data/generated/lib/runtype/types/client_input_delivery_receipt.rb +19 -0
  66. data/generated/lib/runtype/types/client_input_delivery_receipt_status.rb +14 -0
  67. data/generated/lib/runtype/types/conversation_busy_error.rb +15 -0
  68. data/generated/lib/runtype/types/conversation_busy_error_code.rb +11 -0
  69. data/generated/lib/runtype/types/conversation_busy_error_phase.rb +14 -0
  70. data/generated/lib/runtype/types/dispatch_agent_json_response.rb +12 -0
  71. data/generated/lib/runtype/types/dispatch_agent_json_response_delivery_status.rb +14 -0
  72. data/generated/lib/runtype/types/dispatch_agent_json_response_execution_mode.rb +1 -0
  73. data/generated/lib/runtype/types/eval_agent_selector.rb +13 -0
  74. data/generated/lib/runtype/types/eval_run_scores_response.rb +10 -0
  75. data/generated/lib/runtype/types/eval_run_scores_response_agent_target_resolution.rb +13 -0
  76. data/generated/lib/runtype/types/eval_run_scores_response_cases_item_execution_engine.rb +1 -0
  77. data/generated/lib/runtype/types/eval_suite_run_queued.rb +10 -0
  78. data/generated/lib/runtype/types/eval_suite_run_queued_agent_target_resolution.rb +13 -0
  79. data/generated/lib/runtype/types/input_delivery_receipt.rb +19 -0
  80. data/generated/lib/runtype/types/input_delivery_receipt_status.rb +14 -0
  81. data/generated/lib/runtype/types/preview_alias_limit_error.rb +21 -0
  82. data/generated/lib/runtype/types/preview_alias_limit_error_code.rb +11 -0
  83. data/generated/lib/runtype/types/preview_alias_limit_error_scope.rb +12 -0
  84. data/generated/lib/runtype/types/run_eval_response.rb +10 -0
  85. data/generated/lib/runtype/types/run_eval_response_agent_target_resolution.rb +13 -0
  86. data/generated/lib/runtype.rb +52 -16
  87. data/lib/runtype/agent_ensure.rb +35 -3
  88. data/lib/runtype/agent_release_aliases.rb +138 -0
  89. data/lib/runtype/client.rb +1 -0
  90. data/lib/runtype/sdk_version.rb +1 -1
  91. data/lib/runtype.rb +1 -0
  92. metadata +38 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: af0bbf25840f4340b5269585397637edd31012849c0d9bb6228d60818a3999b8
4
- data.tar.gz: 7faf081469ffb6891459f53583b38919703705b21dc44e72aa99058ad5d6bdb3
3
+ metadata.gz: d23cd0d2f0bdb92ba4fadac9b25290bd05bd56b768bd504ce72734ac55fa86a7
4
+ data.tar.gz: 5e14e7acb3005a4fae7c6bfd6a0e9bba5d9743c2012e2a0235515aa72ff20da6
5
5
  SHA512:
6
- metadata.gz: 037faa37e743cb38c72015de37a5c76f5cc1b01288c592abae0bf1f106f431c1fe3401131f4f7cf695c10fbbfbd30db0ca27dff520f16dde6e8279506d6698ff
7
- data.tar.gz: 2db93bef84aef75510da3e23895d15a1cf75d640d8023397d2f90925f2f46353dc2c1adc5b34fb92dc061861e4aaccb6a5cdb96171908c6a054997fa133ee793
6
+ metadata.gz: 8fbe5f379329fd9dfb6b282c569f144154aeb4e786fb274a42256130dff35ab6e03a69689b747c95945806403eacfa862efcc74c93f1d8d9b0f7e1113cb866e0
7
+ data.tar.gz: 3b1101e037ea23e8af4fbeb207464f91bf147a5ba7cb70bdb5a99d900815a137656c541b9b81dd72a44ff6e3728539af414f2db0e5c98fb643d60af14f22b393
data/CHANGELOG.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  All notable changes to the Runtype Ruby SDK are documented here.
4
4
 
5
+ ## 0.3.0
6
+
7
+ - Release aliases on `Runtype::Client`: `#list_agent_aliases`, `#get_agent_alias`,
8
+ `#activate_agent_alias`, `#archive_agent_alias`, `#rollback_agent_alias` and
9
+ `#list_agent_deployments` wrap the generated `agent_aliases` client with the curated
10
+ `Runtype::Error` tree. `revision:` is sent as `If-Match` and `idempotency_key:` as
11
+ `Idempotency-Key`; `version_id` is sent exactly as given, because an alias is never
12
+ resolved to a version client-side.
13
+ - `Runtype::Client#ensure_agent(deploy:)` saves a version and aims a release alias at
14
+ it in one call, taking `{ alias: "pr-482" }` or the bare alias name. It rides both
15
+ the hash probe and the full-definition request. `release:` remains the compatibility
16
+ spelling of `deploy: { alias: "live" }`; passing both raises an `ArgumentError`
17
+ carrying the API's own refusal sentence.
18
+ - README: a "Release aliases" section covering the wrappers, dispatching against a
19
+ pointer, and the cross-organization prepare, validate, evaluate, activate recipe.
20
+
5
21
  ## 0.2.2
6
22
 
7
23
  - The durable follow from 0.2.1, hardened after review: a buffered follow gives up
@@ -30,7 +46,7 @@ All notable changes to the Runtype Ruby SDK are documented here.
30
46
  ## 0.2.0
31
47
 
32
48
  - Agents as code: `Runtype.define_agent` builds a validated, immutable
33
- `Runtype::AgentDefinition` (snake_case or wire camelCase top-level fields, nested
49
+ `Runtype::AgentDefinition` (`snake_case` or wire `camelCase` top-level fields, nested
34
50
  config passed through untouched, account-scoped `tool_…`/`agent_…`/`flow_…` refs
35
51
  rejected). `Runtype::Client#ensure_agent` converges it via `POST /v1/agents/ensure`
36
52
  with the hash-first probe, per-client memo of the server hash, `dry_run:`,
data/README.md CHANGED
@@ -83,11 +83,9 @@ pulled["definition"] # the canonical wire definition; ensure_agent accepts it
83
83
  pulled["lastModifiedSource"]
84
84
  ```
85
85
 
86
- Top-level fields take snake_case or the wire's camelCase; nested config (`tools`,
86
+ Top-level fields take snake*case or the wire's camelCase; nested config (`tools`,
87
87
  `loop_config`, ...) is passed through in wire shape untouched, because its keys can be
88
- tool names. Definitions must be environment-portable: raw `tool_…`, `agent_…` and
89
- `flow_…` ids are rejected in favour of `builtin:`, `platform:`, `mcp:` and
90
- `tool:<name>` / `agent:<name>` / `flow:<name>` references, so the same definition
88
+ tool names. Definitions must be environment-portable: raw `tool*…`, `agent*…`and`flow*…`ids are rejected in favour of`builtin:`, `platform:`, `mcp:`and`tool:<name>`/`agent:<name>`/`flow:<name>` references, so the same definition
91
89
  converges staging and production.
92
90
 
93
91
  `ensure_agent` raises `Runtype::EnsureConflictError` (a 409) when the agent's last
@@ -98,6 +96,95 @@ pass `on_conflict: "overwrite"` to converge over it) or when an
98
96
  platform does, over the canonical normalized form (keys ordered as `JSON.stringify`
99
97
  emits them, numbers rendered as JavaScript renders them).
100
98
 
99
+ ## Release aliases
100
+
101
+ An agent runs an immutable **version**. A named mutable **alias** selects which one:
102
+ `live` is the permanent pointer every unqualified dispatch resolves, and preview
103
+ aliases such as `pr-482` point somewhere else. Every activation appends a
104
+ **deployment receipt**, so the history of what ran is append-only.
105
+
106
+ ```ruby
107
+ client.list_agent_aliases(agent_id) # live first, then previews by name
108
+ client.list_agent_aliases(agent_id, include_archived: true, limit: 20, cursor: cursor)
109
+ client.get_agent_alias(agent_id, "live") # 404 names the alias; never falls back to live
110
+
111
+ client.activate_agent_alias(agent_id, "live", version_id: "agv_9",
112
+ revision: current.revision, # sent as If-Match
113
+ idempotency_key: "deploy-482",
114
+ reason: "ship the pricing fix")
115
+
116
+ client.rollback_agent_alias(agent_id, "live", steps: 1, revision: current.revision)
117
+ client.archive_agent_alias(agent_id, "pr-482", revision: preview.revision)
118
+
119
+ client.list_agent_deployments(agent_id, alias_name: "live", limit: 20)
120
+ ```
121
+
122
+ `version_id` is sent exactly as given: the SDK never resolves an alias to a version
123
+ for you. `revision:` is the alias revision you read back from `get_agent_alias`, sent
124
+ as `If-Match`; moving an existing `live` pointer requires it, and a stale value is a
125
+ 409 rather than a lost update. Archiving stops a preview from resolving for new
126
+ executions, keeps its history, and does not interrupt runs already admitted; `live`
127
+ cannot be archived. Rollback restores configuration only, not external data or side
128
+ effects.
129
+
130
+ `ensure_agent` can save and activate in one call. `deploy:` names the alias to aim at
131
+ the version it just saved:
132
+
133
+ ```ruby
134
+ client.ensure_agent(assistant) # save a version, live unchanged
135
+ client.ensure_agent(assistant, deploy: { alias: "pr-482" }) # save and aim the preview pointer
136
+ client.ensure_agent(assistant, deploy: "live") # a bare String names the alias
137
+ ```
138
+
139
+ `release: "publish"` is the older spelling of `deploy: { alias: "live" }`. Passing both
140
+ raises an `ArgumentError` with the same sentence the API answers a 400 with.
141
+
142
+ Dispatch against a pointer instead of pinning a version, and the run resolves it at
143
+ admission:
144
+
145
+ ```ruby
146
+ client.dispatch(agent: { agentId: agent_id }, messages: messages) # live
147
+ client.dispatch(agent: { agentId: agent_id, alias: "pr-482" }, messages: messages) # a preview
148
+ client.dispatch(agent: { agentId: agent_id, versionId: "agv_9" }, messages: messages) # one exact version
149
+ ```
150
+
151
+ ### Deploying across organizations
152
+
153
+ Organizations are isolated, so a staging version id means nothing in production. The
154
+ recipe is prepare, validate the bindings, evaluate, activate, with one client per
155
+ organization and the destination's own ids throughout. Credentials are never copied:
156
+ the destination's connections and secrets are what its runs use.
157
+
158
+ ```ruby
159
+ staging = Runtype::Client.new(api_key: ENV.fetch("RUNTYPE_STAGING_KEY"))
160
+ production = Runtype::Client.new(api_key: ENV.fetch("RUNTYPE_PRODUCTION_KEY"))
161
+
162
+ # 1. Prepare. Same portable definition, destination account, no deploy: so live is untouched.
163
+ definition = staging.pull_agent("Pricing Assistant")["definition"]
164
+ prepared = production.ensure_agent(definition)
165
+ agent_id, candidate = prepared["agentId"], prepared["versionId"]
166
+
167
+ # 2. Validate the bindings in the destination, where the portable refs actually resolve.
168
+ production.pull_agent("Pricing Assistant")["definition"]["tools"]
169
+ live = production.get_agent_alias(agent_id, "live")
170
+
171
+ # 3. Evaluate that exact version id against a destination suite.
172
+ report = production.evals.run_eval_suite_synchronously(
173
+ suite_id: "evs_pricing", agent: { versionId: candidate }
174
+ )
175
+
176
+ # 4. Activate, quoting the revision you just read.
177
+ production.activate_agent_alias(
178
+ agent_id, "live", version_id: candidate, revision: live.revision,
179
+ idempotency_key: "release-#{candidate}", reason: "promoted from staging"
180
+ )
181
+ ```
182
+
183
+ Nothing gates step 4 on step 3. `evaluate` reports; it does not hold the pointer. If a
184
+ score should stop a release, branch on `report` yourself before calling
185
+ `activate_agent_alias`. An environment-specific rendering of the definition produces a
186
+ different artifact, so its evaluation evidence does not carry over from staging.
187
+
101
188
  ## Authentication
102
189
 
103
190
  Pass `api_key:`, or leave it out and the client reads `RUNTYPE_API_KEY`. The base URL
@@ -216,19 +303,19 @@ loop that exceeds `max_rounds:` raises `Runtype::LocalToolError`.
216
303
 
217
304
  Everything the client raises descends from `Runtype::Error`.
218
305
 
219
- | Class | When |
220
- | ----------------------------------- | ---------------------------------- |
221
- | `Runtype::AuthenticationError` | 401, or no API key at construction |
222
- | `Runtype::PermissionDeniedError` | 403 |
223
- | `Runtype::NotFoundError` | 404 |
224
- | `Runtype::ConflictError` | 409 |
225
- | `Runtype::EnsureConflictError` | 409 from `ensure_agent`, exposes `#code` |
226
- | `Runtype::UnprocessableEntityError` | 422 |
227
- | `Runtype::RateLimitError` | 429, exposes `#retry_after` |
228
- | `Runtype::APIStatusError` | any other non-2xx |
229
- | `Runtype::APITimeoutError` | the request timed out |
230
- | `Runtype::APIConnectionError` | the request never reached the API |
231
- | `Runtype::DriftError` | `ensure_agent(..., expect_no_changes: true)` found drift, exposes `#plan` |
306
+ | Class | When |
307
+ | ----------------------------------- | ------------------------------------------------------------------------------ |
308
+ | `Runtype::AuthenticationError` | 401, or no API key at construction |
309
+ | `Runtype::PermissionDeniedError` | 403 |
310
+ | `Runtype::NotFoundError` | 404 |
311
+ | `Runtype::ConflictError` | 409 |
312
+ | `Runtype::EnsureConflictError` | 409 from `ensure_agent`, exposes `#code` |
313
+ | `Runtype::UnprocessableEntityError` | 422 |
314
+ | `Runtype::RateLimitError` | 429, exposes `#retry_after` |
315
+ | `Runtype::APIStatusError` | any other non-2xx |
316
+ | `Runtype::APITimeoutError` | the request timed out |
317
+ | `Runtype::APIConnectionError` | the request never reached the API |
318
+ | `Runtype::DriftError` | `ensure_agent(..., expect_no_changes: true)` found drift, exposes `#plan` |
232
319
  | `Runtype::LocalToolError` | `run_with_local_tools` could not run a tool, exposes `#tool_name` and `#cause` |
233
320
 
234
321
  Status errors carry `#status_code`, `#body` (parsed when the response was JSON), and
@@ -10,6 +10,52 @@ module Runtype
10
10
  @client = client
11
11
  end
12
12
 
13
+ # Every agent in the caller's organization that carries a release alias with this name, with the pointer revision
14
+ # to quote back as `If-Match`. This is the read a "pull request closed" cleanup makes before archiving each
15
+ # pointer. Archived rows are omitted unless `includeArchived=true`; the built-in `live` alias is readable here
16
+ # like any other name.
17
+ #
18
+ # @param request_options [Hash]
19
+ # @param params [Hash]
20
+ # @option request_options [String] :base_url
21
+ # @option request_options [Hash{String => Object}] :additional_headers
22
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
23
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
24
+ # @option request_options [Integer] :timeout_in_seconds
25
+ # @option params [String] :alias_
26
+ # @option params [String, nil] :include_archived
27
+ #
28
+ # @example
29
+ # client.agent_aliases.list_release_aliases_with_one_name_across_the_organization(alias_: "alias")
30
+ #
31
+ # @return [Runtype::AgentAliases::Types::GetV1AgentAliasesResponse]
32
+ def list_release_aliases_with_one_name_across_the_organization(request_options: {}, **params)
33
+ params = Runtype::Internal::Types::Utils.normalize_keys(params)
34
+ query_params = {}
35
+ query_params["alias"] = params[:alias_] if params.key?(:alias_)
36
+ query_params["includeArchived"] = params[:include_archived] if params.key?(:include_archived)
37
+
38
+ request = Runtype::Internal::JSON::Request.new(
39
+ base_url: request_options[:base_url],
40
+ method: "GET",
41
+ path: "v1/agent-aliases",
42
+ query: query_params,
43
+ request_options: request_options
44
+ )
45
+ begin
46
+ response = @client.send(request)
47
+ rescue Net::HTTPRequestTimeout
48
+ raise Runtype::Errors::TimeoutError
49
+ end
50
+ code = response.code.to_i
51
+ if code.between?(200, 299)
52
+ Runtype::AgentAliases::Types::GetV1AgentAliasesResponse.load(response.body)
53
+ else
54
+ error_class = Runtype::Errors::ResponseError.subclass_for_code(code)
55
+ raise error_class.new(response.body, code: code)
56
+ end
57
+ end
58
+
13
59
  # List the named pointers that select which immutable version of this agent runs. `live` sorts first, then the
14
60
  # preview aliases by name. Archived aliases are omitted unless `includeArchived=true`. Omitting `limit` returns
15
61
  # every pointer; supplying it pages through the same order with `cursor`.
@@ -108,7 +154,9 @@ module Runtype
108
154
  # Aim one alias at one immutable version of the same agent, appending a deployment receipt in the same
109
155
  # transaction. Moving an existing `live` pointer requires the AGENTS:DEPLOY:LIVE scope and an `If-Match` revision;
110
156
  # preview aliases require AGENTS:DEPLOY:PREVIEW. Dependency references the version names are fingerprinted first,
111
- # and an unresolvable reference refuses the activation.
157
+ # and an unresolvable reference refuses the activation. Activating a preview alias renews its 14-day expiry;
158
+ # `live` never expires. Creating a new preview alias past the active-preview quota answers 429 with code
159
+ # PREVIEW_ALIAS_LIMIT.
112
160
  #
113
161
  # @param request_options [Hash]
114
162
  # @param params [Runtype::AgentAliases::Types::PutV1AgentsIDAliasesAliasRequest]
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Runtype
4
+ module AgentAliases
5
+ module Types
6
+ class GetV1AgentAliasesRequest < Internal::Types::Model
7
+ field :alias_, -> { String }, optional: false, nullable: false, api_name: "alias"
8
+
9
+ field :include_archived, -> { String }, optional: true, nullable: false, api_name: "includeArchived"
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Runtype
4
+ module AgentAliases
5
+ module Types
6
+ class GetV1AgentAliasesResponse < Internal::Types::Model
7
+ field :data, -> { Internal::Types::Array[Runtype::AgentAliases::Types::GetV1AgentAliasesResponseDataItem] }, optional: false, nullable: false
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Runtype
4
+ module AgentAliases
5
+ module Types
6
+ class GetV1AgentAliasesResponseDataItem < Internal::Types::Model
7
+ field :agent_id, -> { String }, optional: false, nullable: false, api_name: "agentId"
8
+
9
+ field :agent_name, -> { String }, optional: false, nullable: false, api_name: "agentName"
10
+
11
+ field :alias_, -> { String }, optional: false, nullable: false, api_name: "alias"
12
+
13
+ field :archived_at, -> { String }, optional: false, nullable: true, api_name: "archivedAt"
14
+
15
+ field :expires_at, -> { String }, optional: false, nullable: true, api_name: "expiresAt"
16
+
17
+ field :revision, -> { Integer }, optional: false, nullable: false
18
+
19
+ field :updated_at, -> { String }, optional: false, nullable: false, api_name: "updatedAt"
20
+
21
+ field :version_id, -> { String }, optional: false, nullable: false, api_name: "versionId"
22
+ end
23
+ end
24
+ end
25
+ end
@@ -4,10 +4,14 @@ module Runtype
4
4
  module AgentAliases
5
5
  module Types
6
6
  class PostV1AgentsIDAliasesAliasRollbackResponse < Internal::Types::Model
7
+ field :active_preview_count, -> { Integer }, optional: false, nullable: true, api_name: "activePreviewCount"
8
+
7
9
  field :alias_, -> { String }, optional: false, nullable: false, api_name: "alias"
8
10
 
9
11
  field :changed, -> { Internal::Types::Boolean }, optional: false, nullable: false
10
12
 
13
+ field :preview_limit, -> { Integer }, optional: false, nullable: true, api_name: "previewLimit"
14
+
11
15
  field :receipt_id, -> { String }, optional: false, nullable: false, api_name: "receiptId"
12
16
 
13
17
  field :revision, -> { Integer }, optional: false, nullable: false
@@ -12,6 +12,8 @@ module Runtype
12
12
 
13
13
  field :idempotency_key, -> { String }, optional: true, nullable: false, api_name: "idempotency-key"
14
14
 
15
+ field :promotion, -> { Runtype::Types::AgentDeploymentPromotion }, optional: true, nullable: false
16
+
15
17
  field :reason, -> { String }, optional: true, nullable: false
16
18
 
17
19
  field :version_id, -> { String }, optional: false, nullable: false, api_name: "versionId"
@@ -4,10 +4,14 @@ module Runtype
4
4
  module AgentAliases
5
5
  module Types
6
6
  class PutV1AgentsIDAliasesAliasResponse < Internal::Types::Model
7
+ field :active_preview_count, -> { Integer }, optional: false, nullable: true, api_name: "activePreviewCount"
8
+
7
9
  field :alias_, -> { String }, optional: false, nullable: false, api_name: "alias"
8
10
 
9
11
  field :changed, -> { Internal::Types::Boolean }, optional: false, nullable: false
10
12
 
13
+ field :preview_limit, -> { Integer }, optional: false, nullable: true, api_name: "previewLimit"
14
+
11
15
  field :receipt_id, -> { String }, optional: false, nullable: false, api_name: "receiptId"
12
16
 
13
17
  field :revision, -> { Integer }, optional: false, nullable: false
@@ -8,6 +8,8 @@ module Runtype
8
8
 
9
9
  field :inject_summary, -> { Internal::Types::Boolean }, optional: true, nullable: false, api_name: "injectSummary"
10
10
 
11
+ field :pointer_scope, -> { Runtype::Agents::Types::PostV1AgentsEnsureRequestDefinitionConfigMemoryPointerScope }, optional: true, nullable: false, api_name: "pointerScope"
12
+
11
13
  field :profile_template, -> { String }, optional: true, nullable: false, api_name: "profileTemplate"
12
14
  end
13
15
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Runtype
4
+ module Agents
5
+ module Types
6
+ module PostV1AgentsEnsureRequestDefinitionConfigMemoryPointerScope
7
+ extend Runtype::Internal::Types::Enum
8
+
9
+ SHARED = "shared"
10
+ ALIAS = "alias"
11
+ VERSION = "version"
12
+ end
13
+ end
14
+ end
15
+ end
@@ -9,6 +9,7 @@ module Runtype
9
9
  REJECT = "reject"
10
10
  SUPERSEDE = "supersede"
11
11
  QUEUE = "queue"
12
+ JOIN = "join"
12
13
  end
13
14
  end
14
15
  end
@@ -8,6 +8,8 @@ module Runtype
8
8
 
9
9
  field :inject_summary, -> { Internal::Types::Boolean }, optional: true, nullable: false, api_name: "injectSummary"
10
10
 
11
+ field :pointer_scope, -> { Runtype::Agents::Types::PostV1AgentsRequestConfigMemoryPointerScope }, optional: true, nullable: false, api_name: "pointerScope"
12
+
11
13
  field :profile_template, -> { String }, optional: true, nullable: false, api_name: "profileTemplate"
12
14
  end
13
15
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Runtype
4
+ module Agents
5
+ module Types
6
+ module PostV1AgentsRequestConfigMemoryPointerScope
7
+ extend Runtype::Internal::Types::Enum
8
+
9
+ SHARED = "shared"
10
+ ALIAS = "alias"
11
+ VERSION = "version"
12
+ end
13
+ end
14
+ end
15
+ end
@@ -8,6 +8,8 @@ module Runtype
8
8
 
9
9
  field :inject_summary, -> { Internal::Types::Boolean }, optional: true, nullable: false, api_name: "injectSummary"
10
10
 
11
+ field :pointer_scope, -> { Runtype::Agents::Types::PutV1AgentsIDRequestConfigMemoryPointerScope }, optional: true, nullable: false, api_name: "pointerScope"
12
+
11
13
  field :profile_template, -> { String }, optional: true, nullable: false, api_name: "profileTemplate"
12
14
  end
13
15
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Runtype
4
+ module Agents
5
+ module Types
6
+ module PutV1AgentsIDRequestConfigMemoryPointerScope
7
+ extend Runtype::Internal::Types::Enum
8
+
9
+ SHARED = "shared"
10
+ ALIAS = "alias"
11
+ VERSION = "version"
12
+ end
13
+ end
14
+ end
15
+ end
@@ -8,6 +8,7 @@ module Runtype
8
8
 
9
9
  RUNTIME = "runtime"
10
10
  LEGACY = "legacy"
11
+ EXTERNAL = "external"
11
12
  end
12
13
  end
13
14
  end
@@ -21,6 +21,11 @@ module Runtype
21
21
  )
22
22
  end
23
23
 
24
+ # @return [Runtype::AgentAliases::Client]
25
+ def agent_aliases
26
+ @agent_aliases ||= Runtype::AgentAliases::Client.new(client: @raw_client)
27
+ end
28
+
24
29
  # @return [Runtype::AgentVersions::Client]
25
30
  def agent_versions
26
31
  @agent_versions ||= Runtype::AgentVersions::Client.new(client: @raw_client)
@@ -31,11 +36,6 @@ module Runtype
31
36
  @agents ||= Runtype::Agents::Client.new(client: @raw_client)
32
37
  end
33
38
 
34
- # @return [Runtype::AgentAliases::Client]
35
- def agent_aliases
36
- @agent_aliases ||= Runtype::AgentAliases::Client.new(client: @raw_client)
37
- end
38
-
39
39
  # @return [Runtype::Analytics::Client]
40
40
  def analytics
41
41
  @analytics ||= Runtype::Analytics::Client.new(client: @raw_client)
@@ -12,7 +12,10 @@ module Runtype
12
12
 
13
13
  # Send a message for a browser client-token chat session. The request streams flow/agent events over Server-Sent
14
14
  # Events. `turnId` and `submitMode` are optional and let newer Persona clients suppress stale interrupted
15
- # responses; older clients can omit both fields.
15
+ # responses; older clients can omit both fields. Opt-in `join` accepts exactly one new user message whose `id`
16
+ # equals `turnId` for visitor-owned native durable agents. A new execution streams SSE; joining an existing
17
+ # execution returns a 202 delivery receipt without replacing its response. Retry with the same turn and message
18
+ # IDs.
16
19
  #
17
20
  # @param request_options [Hash]
18
21
  # @param params [Runtype::ClientRuntime::Types::PostV1ClientChatRequest]
@@ -180,6 +183,120 @@ module Runtype
180
183
  end
181
184
  end
182
185
 
186
+ # Cancel the specified execution without starting a replacement. Pending inputs become not applied. Requires the
187
+ # exact visitor and session bound to the conversation.
188
+ #
189
+ # @param request_options [Hash]
190
+ # @param params [Hash]
191
+ # @option request_options [String] :base_url
192
+ # @option request_options [Hash{String => Object}] :additional_headers
193
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
194
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
195
+ # @option request_options [Integer] :timeout_in_seconds
196
+ # @option params [String] :conversation_id
197
+ # @option params [String] :execution_id
198
+ # @option params [String] :session_id
199
+ # @option params [String] :visitor_token
200
+ # @option params [String, nil] :identity_proof
201
+ #
202
+ # @example
203
+ # client.client_runtime.stop_a_native_durable_client_execution(
204
+ # conversation_id: "conversationId",
205
+ # execution_id: "executionId",
206
+ # session_id: "sessionId",
207
+ # visitor_token: "x-visitor-token"
208
+ # )
209
+ #
210
+ # @return [Runtype::ClientRuntime::Types::PostV1ClientConversationsConversationIDExecutionsExecutionIDCancelResponse]
211
+ def stop_a_native_durable_client_execution(request_options: {}, **params)
212
+ params = Runtype::Internal::Types::Utils.normalize_keys(params)
213
+ query_params = {}
214
+ query_params["sessionId"] = params[:session_id] if params.key?(:session_id)
215
+
216
+ headers = {}
217
+ headers["x-visitor-token"] = params[:visitor_token] if params[:visitor_token]
218
+ headers["x-identity-proof"] = params[:identity_proof] if params[:identity_proof]
219
+
220
+ request = Runtype::Internal::JSON::Request.new(
221
+ base_url: request_options[:base_url],
222
+ method: "POST",
223
+ path: "v1/client/conversations/#{URI.encode_uri_component(params[:conversation_id].to_s)}/executions/#{URI.encode_uri_component(params[:execution_id].to_s)}/cancel",
224
+ headers: headers,
225
+ query: query_params,
226
+ request_options: request_options
227
+ )
228
+ begin
229
+ response = @client.send(request)
230
+ rescue Net::HTTPRequestTimeout
231
+ raise Runtype::Errors::TimeoutError
232
+ end
233
+ code = response.code.to_i
234
+ if code.between?(200, 299)
235
+ Runtype::ClientRuntime::Types::PostV1ClientConversationsConversationIDExecutionsExecutionIDCancelResponse.load(response.body)
236
+ else
237
+ error_class = Runtype::Errors::ResponseError.subclass_for_code(code)
238
+ raise error_class.new(response.body, code: code)
239
+ end
240
+ end
241
+
242
+ # Read whether a joined message is pending, applied, settled, or not applied. Requires the exact visitor and
243
+ # session bound to this conversation.
244
+ #
245
+ # @param request_options [Hash]
246
+ # @param params [Hash]
247
+ # @option request_options [String] :base_url
248
+ # @option request_options [Hash{String => Object}] :additional_headers
249
+ # @option request_options [Hash{String => Object}] :additional_query_parameters
250
+ # @option request_options [Hash{String => Object}] :additional_body_parameters
251
+ # @option request_options [Integer] :timeout_in_seconds
252
+ # @option params [String] :conversation_id
253
+ # @option params [String] :execution_id
254
+ # @option params [String] :delivery_id
255
+ # @option params [String] :session_id
256
+ # @option params [String] :visitor_token
257
+ # @option params [String, nil] :identity_proof
258
+ #
259
+ # @example
260
+ # client.client_runtime.read_a_live_input_delivery_receipt(
261
+ # conversation_id: "conversationId",
262
+ # execution_id: "executionId",
263
+ # delivery_id: "deliveryId",
264
+ # session_id: "sessionId",
265
+ # visitor_token: "x-visitor-token"
266
+ # )
267
+ #
268
+ # @return [Runtype::Types::ClientInputDeliveryReceipt]
269
+ def read_a_live_input_delivery_receipt(request_options: {}, **params)
270
+ params = Runtype::Internal::Types::Utils.normalize_keys(params)
271
+ query_params = {}
272
+ query_params["sessionId"] = params[:session_id] if params.key?(:session_id)
273
+
274
+ headers = {}
275
+ headers["x-visitor-token"] = params[:visitor_token] if params[:visitor_token]
276
+ headers["x-identity-proof"] = params[:identity_proof] if params[:identity_proof]
277
+
278
+ request = Runtype::Internal::JSON::Request.new(
279
+ base_url: request_options[:base_url],
280
+ method: "GET",
281
+ path: "v1/client/conversations/#{URI.encode_uri_component(params[:conversation_id].to_s)}/executions/#{URI.encode_uri_component(params[:execution_id].to_s)}/deliveries/#{URI.encode_uri_component(params[:delivery_id].to_s)}",
282
+ headers: headers,
283
+ query: query_params,
284
+ request_options: request_options
285
+ )
286
+ begin
287
+ response = @client.send(request)
288
+ rescue Net::HTTPRequestTimeout
289
+ raise Runtype::Errors::TimeoutError
290
+ end
291
+ code = response.code.to_i
292
+ if code.between?(200, 299)
293
+ Runtype::Types::ClientInputDeliveryReceipt.load(response.body)
294
+ else
295
+ error_class = Runtype::Errors::ResponseError.subclass_for_code(code)
296
+ raise error_class.new(response.body, code: code)
297
+ end
298
+ end
299
+
183
300
  # Return a single conversation with its message transcript. Answers 404 (never 403) for a conversation the caller
184
301
  # does not own, so the route cannot be used to probe for other visitors' conversations. Every response carries
185
302
  # `X-History-Identity-Status` (`not_provided` | `admitted` | `ignored`) reporting what the server did with a
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Runtype
4
+ module ClientRuntime
5
+ module Types
6
+ class GetV1ClientConversationsConversationIDExecutionsExecutionIDDeliveriesDeliveryIDRequest < Internal::Types::Model
7
+ field :conversation_id, -> { String }, optional: false, nullable: false, api_name: "conversationId"
8
+
9
+ field :execution_id, -> { String }, optional: false, nullable: false, api_name: "executionId"
10
+
11
+ field :delivery_id, -> { String }, optional: false, nullable: false, api_name: "deliveryId"
12
+
13
+ field :session_id, -> { String }, optional: false, nullable: false, api_name: "sessionId"
14
+
15
+ field :visitor_token, -> { String }, optional: false, nullable: false, api_name: "x-visitor-token"
16
+
17
+ field :identity_proof, -> { String }, optional: true, nullable: false, api_name: "x-identity-proof"
18
+ end
19
+ end
20
+ end
21
+ end
@@ -8,6 +8,7 @@ module Runtype
8
8
 
9
9
  NORMAL = "normal"
10
10
  INTERRUPT = "interrupt"
11
+ JOIN = "join"
11
12
  end
12
13
  end
13
14
  end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Runtype
4
+ module ClientRuntime
5
+ module Types
6
+ class PostV1ClientConversationsConversationIDExecutionsExecutionIDCancelRequest < Internal::Types::Model
7
+ field :conversation_id, -> { String }, optional: false, nullable: false, api_name: "conversationId"
8
+
9
+ field :execution_id, -> { String }, optional: false, nullable: false, api_name: "executionId"
10
+
11
+ field :session_id, -> { String }, optional: false, nullable: false, api_name: "sessionId"
12
+
13
+ field :visitor_token, -> { String }, optional: false, nullable: false, api_name: "x-visitor-token"
14
+
15
+ field :identity_proof, -> { String }, optional: true, nullable: false, api_name: "x-identity-proof"
16
+ end
17
+ end
18
+ end
19
+ end