acp-sdk 0.10.0 → 0.12.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/CHANGELOG.md +29 -0
- data/README.md +19 -5
- data/lib/acp/agent_connection/client.rb +7 -19
- data/lib/acp/agent_connection/optional_method/spec.rb +42 -0
- data/lib/acp/agent_connection/optional_method.rb +36 -0
- data/lib/acp/agent_connection.rb +17 -40
- data/lib/acp/agent_process.rb +0 -13
- data/lib/acp/client_connection/streams.rb +183 -0
- data/lib/acp/client_connection.rb +227 -384
- data/lib/acp/protocol.rb +33 -0
- data/lib/acp/request_error.rb +17 -17
- data/lib/acp/transport/cancellation.rb +0 -7
- data/lib/acp/transport/reply.rb +0 -2
- data/lib/acp/transport/stderr_logger.rb +1 -2
- data/lib/acp/transport/stdio/serving.rb +18 -0
- data/lib/acp/transport/stdio.rb +67 -59
- data/lib/acp/types/audio_content.rb +3 -46
- data/lib/acp/types/auth_method_terminal.rb +3 -59
- data/lib/acp/types/available_commands_update.rb +3 -32
- data/lib/acp/types/boolean_property_schema.rb +3 -41
- data/lib/acp/types/check.rb +210 -0
- data/lib/acp/types/config_option_update.rb +3 -32
- data/lib/acp/types/content.rb +3 -29
- data/lib/acp/types/{elicitation_url_mode → create_elicitation_request/mode/form}/scope.rb +1 -1
- data/lib/acp/types/create_elicitation_request/mode/form.rb +3 -3
- data/lib/acp/types/{elicitation_form_mode → create_elicitation_request/mode/url}/scope.rb +1 -1
- data/lib/acp/types/create_elicitation_request/mode/url.rb +3 -3
- data/lib/acp/types/current_mode_update.rb +3 -29
- data/lib/acp/types/diff.rb +3 -41
- data/lib/acp/types/elicitation_accept_action.rb +3 -26
- data/lib/acp/types/elicitation_form_mode.rb +3 -33
- data/lib/acp/types/elicitation_url_mode.rb +3 -35
- data/lib/acp/types/embedded_resource.rb +3 -44
- data/lib/acp/types/image_content.rb +3 -58
- data/lib/acp/types/integer_property_schema.rb +3 -60
- data/lib/acp/types/mcp_server_http.rb +3 -44
- data/lib/acp/types/mcp_server_sse.rb +3 -44
- data/lib/acp/types/multi_select_property_schema.rb +3 -70
- data/lib/acp/types/number_property_schema.rb +3 -60
- data/lib/acp/types/parse_error.rb +37 -0
- data/lib/acp/types/plan.rb +3 -29
- data/lib/acp/types/resource_link.rb +3 -79
- data/lib/acp/types/selected_permission_outcome.rb +3 -26
- data/lib/acp/types/session_config_boolean.rb +3 -21
- data/lib/acp/types/session_config_select.rb +3 -33
- data/lib/acp/types/session_info_update.rb +3 -42
- data/lib/acp/types/string_multi_select_items.rb +3 -29
- data/lib/acp/types/string_property_schema.rb +3 -105
- data/lib/acp/types/terminal.rb +3 -29
- data/lib/acp/types/text_content.rb +3 -40
- data/lib/acp/types/tool_call.rb +3 -115
- data/lib/acp/types/unstable/compaction_summary_chunk.rb +3 -35
- data/lib/acp/types/unstable/compaction_update.rb +3 -56
- data/lib/acp/types/unstable/idle_state_update.rb +3 -40
- data/lib/acp/types/unstable/mcp_server_acp.rb +3 -35
- data/lib/acp/types/unstable/nes_edit_suggestion.rb +3 -61
- data/lib/acp/types/unstable/nes_jump_suggestion.rb +3 -45
- data/lib/acp/types/unstable/nes_rename_suggestion.rb +3 -51
- data/lib/acp/types/unstable/nes_search_and_replace_suggestion.rb +3 -60
- data/lib/acp/types/unstable/notice.rb +3 -41
- data/lib/acp/types/unstable/plan_file.rb +3 -35
- data/lib/acp/types/unstable/plan_items.rb +3 -38
- data/lib/acp/types/unstable/plan_markdown.rb +3 -35
- data/lib/acp/types/unstable/plan_removed.rb +3 -26
- data/lib/acp/types/unstable/plan_update.rb +3 -33
- data/lib/acp/types/unstable/requires_action_state_update.rb +3 -21
- data/lib/acp/types/unstable/running_state_update.rb +3 -21
- data/lib/acp/types/unstable/session_message.rb +3 -56
- data/lib/acp/types/unstable/session_message_chunk.rb +3 -53
- data/lib/acp/types/unstable/subagent_update.rb +3 -65
- data/lib/acp/types/unstable/unknown_state_update.rb +3 -21
- data/lib/acp/types/unstable.rb +20 -20
- data/lib/acp/types/usage_update.rb +3 -41
- data/lib/acp/types.rb +7 -246
- data/lib/acp/version.rb +1 -1
- data/sig/generated/acp/agent_connection/client.rbs +10 -19
- data/sig/generated/acp/agent_connection/optional_method/spec.rbs +32 -0
- data/sig/generated/acp/agent_connection/optional_method.rbs +3 -0
- data/sig/generated/acp/agent_connection.rbs +16 -24
- data/sig/generated/acp/agent_process.rbs +0 -13
- data/sig/generated/acp/client_connection/streams.rbs +94 -0
- data/sig/generated/acp/client_connection.rbs +100 -159
- data/sig/generated/acp/protocol.rbs +9 -0
- data/sig/generated/acp/request_error.rbs +15 -17
- data/sig/generated/acp/transport/cancellation.rbs +0 -7
- data/sig/generated/acp/transport/reply.rbs +0 -2
- data/sig/generated/acp/transport/stderr_logger.rbs +1 -2
- data/sig/generated/acp/transport/stdio/serving.rbs +14 -0
- data/sig/generated/acp/transport/stdio.rbs +31 -35
- data/sig/generated/acp/types/audio_content.rbs +1 -27
- data/sig/generated/acp/types/auth_method_terminal.rbs +1 -35
- data/sig/generated/acp/types/available_commands_update.rbs +1 -19
- data/sig/generated/acp/types/boolean_property_schema.rbs +1 -27
- data/sig/generated/acp/types/check.rbs +115 -0
- data/sig/generated/acp/types/config_option_update.rbs +1 -19
- data/sig/generated/acp/types/content.rbs +1 -19
- data/sig/generated/acp/types/{elicitation_url_mode → create_elicitation_request/mode/form}/scope.rbs +2 -2
- data/sig/generated/acp/types/create_elicitation_request/mode/form.rbs +3 -3
- data/sig/generated/acp/types/{elicitation_form_mode → create_elicitation_request/mode/url}/scope.rbs +2 -2
- data/sig/generated/acp/types/create_elicitation_request/mode/url.rbs +3 -3
- data/sig/generated/acp/types/current_mode_update.rbs +1 -19
- data/sig/generated/acp/types/diff.rbs +1 -27
- data/sig/generated/acp/types/elicitation_accept_action.rbs +1 -15
- data/sig/generated/acp/types/elicitation_form_mode.rbs +1 -19
- data/sig/generated/acp/types/elicitation_url_mode.rbs +1 -23
- data/sig/generated/acp/types/embedded_resource.rbs +1 -23
- data/sig/generated/acp/types/image_content.rbs +1 -31
- data/sig/generated/acp/types/integer_property_schema.rbs +1 -35
- data/sig/generated/acp/types/mcp_server_http.rbs +1 -27
- data/sig/generated/acp/types/mcp_server_sse.rbs +1 -27
- data/sig/generated/acp/types/multi_select_property_schema.rbs +1 -39
- data/sig/generated/acp/types/number_property_schema.rbs +1 -35
- data/sig/generated/acp/types/parse_error.rbs +22 -0
- data/sig/generated/acp/types/plan.rbs +1 -19
- data/sig/generated/acp/types/resource_link.rbs +1 -43
- data/sig/generated/acp/types/selected_permission_outcome.rbs +1 -19
- data/sig/generated/acp/types/session_config_boolean.rbs +1 -15
- data/sig/generated/acp/types/session_config_select.rbs +1 -19
- data/sig/generated/acp/types/session_info_update.rbs +1 -23
- data/sig/generated/acp/types/string_multi_select_items.rbs +1 -19
- data/sig/generated/acp/types/string_property_schema.rbs +1 -51
- data/sig/generated/acp/types/terminal.rbs +1 -19
- data/sig/generated/acp/types/text_content.rbs +1 -23
- data/sig/generated/acp/types/tool_call.rbs +1 -51
- data/sig/generated/acp/types/unstable/compaction_summary_chunk.rbs +1 -23
- data/sig/generated/acp/types/unstable/compaction_update.rbs +1 -31
- data/sig/generated/acp/types/unstable/idle_state_update.rbs +1 -23
- data/sig/generated/acp/types/unstable/mcp_server_acp.rbs +1 -23
- data/sig/generated/acp/types/unstable/nes_edit_suggestion.rbs +1 -31
- data/sig/generated/acp/types/unstable/nes_jump_suggestion.rbs +1 -27
- data/sig/generated/acp/types/unstable/nes_rename_suggestion.rbs +1 -31
- data/sig/generated/acp/types/unstable/nes_search_and_replace_suggestion.rbs +1 -35
- data/sig/generated/acp/types/unstable/notice.rbs +1 -27
- data/sig/generated/acp/types/unstable/plan_file.rbs +1 -23
- data/sig/generated/acp/types/unstable/plan_items.rbs +1 -23
- data/sig/generated/acp/types/unstable/plan_markdown.rbs +1 -23
- data/sig/generated/acp/types/unstable/plan_removed.rbs +1 -19
- data/sig/generated/acp/types/unstable/plan_update.rbs +1 -19
- data/sig/generated/acp/types/unstable/requires_action_state_update.rbs +1 -15
- data/sig/generated/acp/types/unstable/running_state_update.rbs +1 -15
- data/sig/generated/acp/types/unstable/session_message.rbs +1 -31
- data/sig/generated/acp/types/unstable/session_message_chunk.rbs +1 -31
- data/sig/generated/acp/types/unstable/subagent_update.rbs +1 -35
- data/sig/generated/acp/types/unstable/unknown_state_update.rbs +1 -15
- data/sig/generated/acp/types/usage_update.rbs +1 -27
- data/sig/generated/acp/types.rbs +6 -143
- data/sig/manual/acp/agent_connection.rbs +0 -30
- data/sig/manual/acp/client_connection.rbs +7 -2
- data/sig/manual/acp/{agent_connection/optional_method/logout.rbs → protocol.rbs} +3 -3
- data/sig/manual/acp/transport/stdio.rbs +0 -2
- data/sig/manual/acp/transport.rbs +25 -2
- metadata +18 -40
- data/lib/acp/agent_connection/optional_method/authenticate.rb +0 -21
- data/lib/acp/agent_connection/optional_method/close_session.rb +0 -21
- data/lib/acp/agent_connection/optional_method/delete_session.rb +0 -21
- data/lib/acp/agent_connection/optional_method/disable_provider.rb +0 -23
- data/lib/acp/agent_connection/optional_method/fork_session.rb +0 -23
- data/lib/acp/agent_connection/optional_method/list_providers.rb +0 -23
- data/lib/acp/agent_connection/optional_method/list_sessions.rb +0 -21
- data/lib/acp/agent_connection/optional_method/load_session.rb +0 -21
- data/lib/acp/agent_connection/optional_method/logout.rb +0 -21
- data/lib/acp/agent_connection/optional_method/resume_session.rb +0 -21
- data/lib/acp/agent_connection/optional_method/set_provider.rb +0 -23
- data/lib/acp/types/content_chunk.rb +0 -40
- data/sig/generated/acp/agent_connection/optional_method/authenticate.rbs +0 -13
- data/sig/generated/acp/agent_connection/optional_method/close_session.rbs +0 -13
- data/sig/generated/acp/agent_connection/optional_method/delete_session.rbs +0 -13
- data/sig/generated/acp/agent_connection/optional_method/disable_provider.rbs +0 -13
- data/sig/generated/acp/agent_connection/optional_method/fork_session.rbs +0 -13
- data/sig/generated/acp/agent_connection/optional_method/list_providers.rbs +0 -13
- data/sig/generated/acp/agent_connection/optional_method/list_sessions.rbs +0 -13
- data/sig/generated/acp/agent_connection/optional_method/load_session.rbs +0 -13
- data/sig/generated/acp/agent_connection/optional_method/logout.rbs +0 -13
- data/sig/generated/acp/agent_connection/optional_method/resume_session.rbs +0 -13
- data/sig/generated/acp/agent_connection/optional_method/set_provider.rbs +0 -13
- data/sig/generated/acp/types/content_chunk.rbs +0 -25
- data/sig/manual/acp/agent_connection/optional_method/authenticate.rbs +0 -6
- data/sig/manual/acp/agent_connection/optional_method/close_session.rbs +0 -6
- data/sig/manual/acp/agent_connection/optional_method/delete_session.rbs +0 -6
- data/sig/manual/acp/agent_connection/optional_method/disable_provider.rbs +0 -6
- data/sig/manual/acp/agent_connection/optional_method/fork_session.rbs +0 -6
- data/sig/manual/acp/agent_connection/optional_method/list_providers.rbs +0 -6
- data/sig/manual/acp/agent_connection/optional_method/list_sessions.rbs +0 -6
- data/sig/manual/acp/agent_connection/optional_method/load_session.rbs +0 -6
- data/sig/manual/acp/agent_connection/optional_method/resume_session.rbs +0 -6
- data/sig/manual/acp/agent_connection/optional_method/set_provider.rbs +0 -6
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Hand-authored support for the generated types: the generator neither emits
|
|
4
|
+
# nor deletes this file (see TypeGenerator::SUPPORT_FILES).
|
|
5
|
+
|
|
6
|
+
module ACP::Types::Check
|
|
7
|
+
# @rbs hash: Hash[String, untyped]
|
|
8
|
+
# @rbs key: String
|
|
9
|
+
# @rbs return: untyped
|
|
10
|
+
def self.key(hash, key)
|
|
11
|
+
hash.fetch(key)
|
|
12
|
+
rescue KeyError
|
|
13
|
+
raise ACP::Types::ParseError.new([key], 'is required')
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# @rbs value: untyped
|
|
17
|
+
# @rbs path: String | Array[String | Integer]
|
|
18
|
+
# @rbs allow_nil: bool
|
|
19
|
+
# @rbs allow_unset: bool
|
|
20
|
+
# @rbs return: untyped
|
|
21
|
+
def self.string(value, path, allow_nil: false, allow_unset: false)
|
|
22
|
+
return value if value.is_a?(String) || skipped?(value, allow_nil, allow_unset)
|
|
23
|
+
|
|
24
|
+
raise ACP::Types::ParseError.new(segments(path), "expected String, got #{describe(value)}")
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# @rbs value: untyped
|
|
28
|
+
# @rbs path: String | Array[String | Integer]
|
|
29
|
+
# @rbs allow_nil: bool
|
|
30
|
+
# @rbs allow_unset: bool
|
|
31
|
+
# @rbs return: untyped
|
|
32
|
+
def self.boolean(value, path, allow_nil: false, allow_unset: false)
|
|
33
|
+
return value if value == true || value == false || skipped?(value, allow_nil, allow_unset)
|
|
34
|
+
|
|
35
|
+
raise ACP::Types::ParseError.new(segments(path), "expected boolean, got #{describe(value)}")
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# @rbs value: untyped
|
|
39
|
+
# @rbs path: String | Array[String | Integer]
|
|
40
|
+
# @rbs min: Integer?
|
|
41
|
+
# @rbs max: Integer?
|
|
42
|
+
# @rbs allow_nil: bool
|
|
43
|
+
# @rbs allow_unset: bool
|
|
44
|
+
# @rbs return: untyped
|
|
45
|
+
def self.integer(value, path, min: nil, max: nil, allow_nil: false, allow_unset: false)
|
|
46
|
+
return value if (value.is_a?(Integer) && within?(value, min, max)) || skipped?(value, allow_nil, allow_unset)
|
|
47
|
+
|
|
48
|
+
raise ACP::Types::ParseError.new(segments(path), "expected #{bounded('Integer', min, max)}, got #{describe(value)}")
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# @rbs value: untyped
|
|
52
|
+
# @rbs path: String | Array[String | Integer]
|
|
53
|
+
# @rbs min: Integer?
|
|
54
|
+
# @rbs max: Integer?
|
|
55
|
+
# @rbs allow_nil: bool
|
|
56
|
+
# @rbs allow_unset: bool
|
|
57
|
+
# @rbs return: untyped
|
|
58
|
+
def self.number(value, path, min: nil, max: nil, allow_nil: false, allow_unset: false)
|
|
59
|
+
return value if (value.is_a?(Numeric) && within?(value, min, max)) || skipped?(value, allow_nil, allow_unset)
|
|
60
|
+
|
|
61
|
+
raise ACP::Types::ParseError.new(segments(path), "expected #{bounded('Numeric', min, max)}, got #{describe(value)}")
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# @rbs value: untyped
|
|
65
|
+
# @rbs path: String | Array[String | Integer]
|
|
66
|
+
# @rbs values: Array[untyped]
|
|
67
|
+
# @rbs allow_nil: bool
|
|
68
|
+
# @rbs allow_unset: bool
|
|
69
|
+
# @rbs return: untyped
|
|
70
|
+
def self.enum(value, path, values, allow_nil: false, allow_unset: false)
|
|
71
|
+
return value if values.include?(value) || skipped?(value, allow_nil, allow_unset)
|
|
72
|
+
|
|
73
|
+
expected = values.map(&:inspect).join(', ')
|
|
74
|
+
raise ACP::Types::ParseError.new(segments(path), "expected one of #{expected}, got #{describe(value)}")
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# @rbs value: untyped
|
|
78
|
+
# @rbs path: String | Array[String | Integer]
|
|
79
|
+
# @rbs classes: Array[untyped]
|
|
80
|
+
# @rbs allow_nil: bool
|
|
81
|
+
# @rbs allow_unset: bool
|
|
82
|
+
# @rbs ?&items: (untyped, Array[String | Integer]) -> void
|
|
83
|
+
# @rbs return: untyped
|
|
84
|
+
def self.one_of(value, path, classes, allow_nil: false, allow_unset: false, &items)
|
|
85
|
+
return value if skipped?(value, allow_nil, allow_unset)
|
|
86
|
+
|
|
87
|
+
unless classes.any? { |klass| value.is_a?(klass) }
|
|
88
|
+
expected = classes.map(&:name).join(' | ')
|
|
89
|
+
raise ACP::Types::ParseError.new(segments(path), "expected #{expected}, got #{describe(value)}")
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
return value unless value.is_a?(Array) && items
|
|
93
|
+
|
|
94
|
+
value.each_with_index { |item, index| yield(item, [*segments(path), index]) }
|
|
95
|
+
value
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# @rbs value: untyped
|
|
99
|
+
# @rbs path: String | Array[String | Integer]
|
|
100
|
+
# @rbs allow_nil: bool
|
|
101
|
+
# @rbs allow_unset: bool
|
|
102
|
+
# @rbs &check: (untyped, Array[String | Integer]) -> void
|
|
103
|
+
# @rbs return: untyped
|
|
104
|
+
def self.hash(value, path, allow_nil: false, allow_unset: false, &check)
|
|
105
|
+
return value if skipped?(value, allow_nil, allow_unset)
|
|
106
|
+
raise ACP::Types::ParseError.new(segments(path), "expected object, got #{describe(value)}") unless value.is_a?(Hash)
|
|
107
|
+
|
|
108
|
+
parsed = {} #: Hash[String, untyped]
|
|
109
|
+
value.each { |key, item| parsed[key] = yield(item, [*segments(path), key]) }
|
|
110
|
+
parsed
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# @rbs value: untyped
|
|
114
|
+
# @rbs path: String | Array[String | Integer]
|
|
115
|
+
# @rbs allow_nil: bool
|
|
116
|
+
# @rbs allow_unset: bool
|
|
117
|
+
# @rbs &check: (untyped, Array[String | Integer]) -> void
|
|
118
|
+
# @rbs return: untyped
|
|
119
|
+
def self.array(value, path, allow_nil: false, allow_unset: false, &check)
|
|
120
|
+
return value if skipped?(value, allow_nil, allow_unset)
|
|
121
|
+
raise ACP::Types::ParseError.new(segments(path), "expected array, got #{describe(value)}") unless value.is_a?(Array)
|
|
122
|
+
|
|
123
|
+
value.each_with_index.map { |item, index| yield(item, [*segments(path), index]) }
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# @rbs value: untyped
|
|
127
|
+
# @rbs path: String | Array[String | Integer]
|
|
128
|
+
# @rbs klass: untyped
|
|
129
|
+
# @rbs allow_nil: bool
|
|
130
|
+
# @rbs allow_unset: bool
|
|
131
|
+
# @rbs return: untyped
|
|
132
|
+
def self.object(value, path, klass, allow_nil: false, allow_unset: false)
|
|
133
|
+
return value if skipped?(value, allow_nil, allow_unset)
|
|
134
|
+
raise ACP::Types::ParseError.new(segments(path), "expected object, got #{describe(value)}") unless value.is_a?(Hash)
|
|
135
|
+
|
|
136
|
+
begin
|
|
137
|
+
klass.from_h(value)
|
|
138
|
+
rescue ACP::Types::ParseError => e
|
|
139
|
+
raise e.prefix(*segments(path))
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# @rbs value: untyped
|
|
144
|
+
# @rbs path: String | Array[String | Integer]
|
|
145
|
+
# @rbs klass: untyped
|
|
146
|
+
# @rbs allow_nil: bool
|
|
147
|
+
# @rbs allow_unset: bool
|
|
148
|
+
# @rbs return: untyped
|
|
149
|
+
def self.objects(value, path, klass, allow_nil: false, allow_unset: false)
|
|
150
|
+
return value if skipped?(value, allow_nil, allow_unset)
|
|
151
|
+
raise ACP::Types::ParseError.new(segments(path), "expected array, got #{describe(value)}") unless value.is_a?(Array)
|
|
152
|
+
|
|
153
|
+
value.each_with_index do |item, index|
|
|
154
|
+
next if item.is_a?(Hash)
|
|
155
|
+
|
|
156
|
+
raise ACP::Types::ParseError.new([*segments(path), index], "expected object, got #{describe(item)}")
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
begin
|
|
160
|
+
klass.from_a(value)
|
|
161
|
+
rescue ACP::Types::ParseError => e
|
|
162
|
+
raise e.prefix(*segments(path))
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# @rbs value: untyped
|
|
167
|
+
# @rbs allow_nil: bool
|
|
168
|
+
# @rbs allow_unset: bool
|
|
169
|
+
# @rbs return: bool
|
|
170
|
+
def self.skipped?(value, allow_nil, allow_unset)
|
|
171
|
+
(value.nil? && allow_nil) || (allow_unset && value.equal?(:unset))
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# @rbs path: String | Array[String | Integer]
|
|
175
|
+
# @rbs return: Array[String | Integer]
|
|
176
|
+
def self.segments(path)
|
|
177
|
+
path.is_a?(Array) ? path : [path]
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
# @rbs value: untyped
|
|
181
|
+
# @rbs return: String
|
|
182
|
+
def self.describe(value)
|
|
183
|
+
case value
|
|
184
|
+
when nil then 'null'
|
|
185
|
+
when true then 'true'
|
|
186
|
+
when false then 'false'
|
|
187
|
+
else value.class.name
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# @rbs value: Numeric
|
|
192
|
+
# @rbs min: Integer?
|
|
193
|
+
# @rbs max: Integer?
|
|
194
|
+
# @rbs return: bool
|
|
195
|
+
def self.within?(value, min, max)
|
|
196
|
+
(min.nil? || value >= min) && (max.nil? || value <= max)
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
# @rbs name: String
|
|
200
|
+
# @rbs min: Integer?
|
|
201
|
+
# @rbs max: Integer?
|
|
202
|
+
# @rbs return: String
|
|
203
|
+
def self.bounded(name, min, max)
|
|
204
|
+
if min && max then "#{name} between #{min} and #{max}"
|
|
205
|
+
elsif min then "#{name} >= #{min}"
|
|
206
|
+
elsif max then "#{name} <= #{max}"
|
|
207
|
+
else name
|
|
208
|
+
end
|
|
209
|
+
end
|
|
210
|
+
end
|
|
@@ -2,36 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Generated by bin/types from schema/schema.json. Do not edit.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
attr_reader :config_options #: Array[ACP::Types::SessionConfigOption]
|
|
5
|
+
# @rbs!
|
|
6
|
+
# class ACP::Types::ConfigOptionUpdate = ACP::Types::SessionUpdate::ConfigOptionUpdate
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
attr_reader :meta #: Hash[String, untyped]?
|
|
11
|
-
|
|
12
|
-
# @rbs config_options: Array[ACP::Types::SessionConfigOption]
|
|
13
|
-
# @rbs meta: Hash[String, untyped]?
|
|
14
|
-
# @rbs return: void
|
|
15
|
-
def initialize(config_options:, meta: nil)
|
|
16
|
-
@config_options = config_options
|
|
17
|
-
@meta = meta
|
|
18
|
-
freeze
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
# @rbs hash: Hash[String, untyped]
|
|
22
|
-
# @rbs return: ACP::Types::ConfigOptionUpdate
|
|
23
|
-
def self.from_h(hash)
|
|
24
|
-
config_options = ACP::Types::Check.array(
|
|
25
|
-
ACP::Types::Check.key(hash, 'configOptions'),
|
|
26
|
-
'configOptions'
|
|
27
|
-
) do |item, path|
|
|
28
|
-
ACP::Types::Check.object(item, path, ACP::Types::SessionConfigOption)
|
|
29
|
-
end
|
|
30
|
-
new(config_options:, meta: hash['_meta'])
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# @rbs return: Hash[String, untyped]
|
|
34
|
-
def to_h
|
|
35
|
-
{ 'configOptions' => config_options.map(&:to_h), '_meta' => meta }.compact
|
|
36
|
-
end
|
|
37
|
-
end
|
|
8
|
+
ACP::Types::ConfigOptionUpdate = ACP::Types::SessionUpdate::ConfigOptionUpdate
|
data/lib/acp/types/content.rb
CHANGED
|
@@ -2,33 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Generated by bin/types from schema/schema.json. Do not edit.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
attr_reader :content #: ACP::Types::ContentBlock::t
|
|
5
|
+
# @rbs!
|
|
6
|
+
# class ACP::Types::Content = ACP::Types::ToolCallContent::Content
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
attr_reader :meta #: Hash[String, untyped]?
|
|
11
|
-
|
|
12
|
-
# @rbs content: ACP::Types::ContentBlock::t
|
|
13
|
-
# @rbs meta: Hash[String, untyped]?
|
|
14
|
-
# @rbs return: void
|
|
15
|
-
def initialize(content:, meta: nil)
|
|
16
|
-
@content = content
|
|
17
|
-
@meta = meta
|
|
18
|
-
freeze
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
# @rbs hash: Hash[String, untyped]
|
|
22
|
-
# @rbs return: ACP::Types::Content
|
|
23
|
-
def self.from_h(hash)
|
|
24
|
-
new(
|
|
25
|
-
content: ACP::Types::Check.object(ACP::Types::Check.key(hash, 'content'), 'content', ACP::Types::ContentBlock),
|
|
26
|
-
meta: hash['_meta']
|
|
27
|
-
)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
# @rbs return: Hash[String, untyped]
|
|
31
|
-
def to_h
|
|
32
|
-
{ 'content' => content.to_h, '_meta' => meta }.compact
|
|
33
|
-
end
|
|
34
|
-
end
|
|
8
|
+
ACP::Types::Content = ACP::Types::ToolCallContent::Content
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Generated by bin/types from schema/schema.json. Do not edit.
|
|
4
4
|
|
|
5
|
-
module ACP::Types::
|
|
5
|
+
module ACP::Types::CreateElicitationRequest::Mode::Form::Scope
|
|
6
6
|
# @rbs!
|
|
7
7
|
# type t = ACP::Types::ElicitationSessionScope
|
|
8
8
|
# | ACP::Types::ElicitationRequestScope
|
|
@@ -7,10 +7,10 @@ class ACP::Types::CreateElicitationRequest::Mode::Form
|
|
|
7
7
|
attr_reader :requested_schema #: ACP::Types::ElicitationSchema
|
|
8
8
|
|
|
9
9
|
# @dynamic scope
|
|
10
|
-
attr_reader :scope #: ACP::Types::
|
|
10
|
+
attr_reader :scope #: ACP::Types::CreateElicitationRequest::Mode::Form::Scope::t
|
|
11
11
|
|
|
12
12
|
# @rbs requested_schema: ACP::Types::ElicitationSchema
|
|
13
|
-
# @rbs scope: ACP::Types::
|
|
13
|
+
# @rbs scope: ACP::Types::CreateElicitationRequest::Mode::Form::Scope::t
|
|
14
14
|
# @rbs return: void
|
|
15
15
|
def initialize(requested_schema:, scope:)
|
|
16
16
|
@requested_schema = requested_schema
|
|
@@ -27,7 +27,7 @@ class ACP::Types::CreateElicitationRequest::Mode::Form
|
|
|
27
27
|
'requestedSchema',
|
|
28
28
|
ACP::Types::ElicitationSchema
|
|
29
29
|
),
|
|
30
|
-
scope: ACP::Types::
|
|
30
|
+
scope: ACP::Types::CreateElicitationRequest::Mode::Form::Scope.from_h(hash)
|
|
31
31
|
)
|
|
32
32
|
end
|
|
33
33
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Generated by bin/types from schema/schema.json. Do not edit.
|
|
4
4
|
|
|
5
|
-
module ACP::Types::
|
|
5
|
+
module ACP::Types::CreateElicitationRequest::Mode::Url::Scope
|
|
6
6
|
# @rbs!
|
|
7
7
|
# type t = ACP::Types::ElicitationSessionScope
|
|
8
8
|
# | ACP::Types::ElicitationRequestScope
|
|
@@ -10,11 +10,11 @@ class ACP::Types::CreateElicitationRequest::Mode::Url
|
|
|
10
10
|
attr_reader :url #: String
|
|
11
11
|
|
|
12
12
|
# @dynamic scope
|
|
13
|
-
attr_reader :scope #: ACP::Types::
|
|
13
|
+
attr_reader :scope #: ACP::Types::CreateElicitationRequest::Mode::Url::Scope::t
|
|
14
14
|
|
|
15
15
|
# @rbs elicitation_id: String
|
|
16
16
|
# @rbs url: String
|
|
17
|
-
# @rbs scope: ACP::Types::
|
|
17
|
+
# @rbs scope: ACP::Types::CreateElicitationRequest::Mode::Url::Scope::t
|
|
18
18
|
# @rbs return: void
|
|
19
19
|
def initialize(elicitation_id:, url:, scope:)
|
|
20
20
|
@elicitation_id = elicitation_id
|
|
@@ -29,7 +29,7 @@ class ACP::Types::CreateElicitationRequest::Mode::Url
|
|
|
29
29
|
new(
|
|
30
30
|
elicitation_id: ACP::Types::Check.string(ACP::Types::Check.key(hash, 'elicitationId'), 'elicitationId'),
|
|
31
31
|
url: ACP::Types::Check.string(ACP::Types::Check.key(hash, 'url'), 'url'),
|
|
32
|
-
scope: ACP::Types::
|
|
32
|
+
scope: ACP::Types::CreateElicitationRequest::Mode::Url::Scope.from_h(hash)
|
|
33
33
|
)
|
|
34
34
|
end
|
|
35
35
|
|
|
@@ -2,33 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Generated by bin/types from schema/schema.json. Do not edit.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
attr_reader :current_mode_id #: String
|
|
5
|
+
# @rbs!
|
|
6
|
+
# class ACP::Types::CurrentModeUpdate = ACP::Types::SessionUpdate::CurrentModeUpdate
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
attr_reader :meta #: Hash[String, untyped]?
|
|
11
|
-
|
|
12
|
-
# @rbs current_mode_id: String
|
|
13
|
-
# @rbs meta: Hash[String, untyped]?
|
|
14
|
-
# @rbs return: void
|
|
15
|
-
def initialize(current_mode_id:, meta: nil)
|
|
16
|
-
@current_mode_id = current_mode_id
|
|
17
|
-
@meta = meta
|
|
18
|
-
freeze
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
# @rbs hash: Hash[String, untyped]
|
|
22
|
-
# @rbs return: ACP::Types::CurrentModeUpdate
|
|
23
|
-
def self.from_h(hash)
|
|
24
|
-
new(
|
|
25
|
-
current_mode_id: ACP::Types::Check.string(ACP::Types::Check.key(hash, 'currentModeId'), 'currentModeId'),
|
|
26
|
-
meta: hash['_meta']
|
|
27
|
-
)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
# @rbs return: Hash[String, untyped]
|
|
31
|
-
def to_h
|
|
32
|
-
{ 'currentModeId' => current_mode_id, '_meta' => meta }.compact
|
|
33
|
-
end
|
|
34
|
-
end
|
|
8
|
+
ACP::Types::CurrentModeUpdate = ACP::Types::SessionUpdate::CurrentModeUpdate
|
data/lib/acp/types/diff.rb
CHANGED
|
@@ -2,45 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Generated by bin/types from schema/schema.json. Do not edit.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
attr_reader :path #: String
|
|
5
|
+
# @rbs!
|
|
6
|
+
# class ACP::Types::Diff = ACP::Types::ToolCallContent::Diff
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
attr_reader :old_text #: String?
|
|
11
|
-
|
|
12
|
-
# @dynamic new_text
|
|
13
|
-
attr_reader :new_text #: String
|
|
14
|
-
|
|
15
|
-
# @dynamic meta
|
|
16
|
-
attr_reader :meta #: Hash[String, untyped]?
|
|
17
|
-
|
|
18
|
-
# @rbs path: String
|
|
19
|
-
# @rbs old_text: String?
|
|
20
|
-
# @rbs new_text: String
|
|
21
|
-
# @rbs meta: Hash[String, untyped]?
|
|
22
|
-
# @rbs return: void
|
|
23
|
-
def initialize(path:, new_text:, old_text: nil, meta: nil)
|
|
24
|
-
@path = path
|
|
25
|
-
@old_text = old_text
|
|
26
|
-
@new_text = new_text
|
|
27
|
-
@meta = meta
|
|
28
|
-
freeze
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
# @rbs hash: Hash[String, untyped]
|
|
32
|
-
# @rbs return: ACP::Types::Diff
|
|
33
|
-
def self.from_h(hash)
|
|
34
|
-
new(
|
|
35
|
-
path: ACP::Types::Check.string(ACP::Types::Check.key(hash, 'path'), 'path'),
|
|
36
|
-
old_text: ACP::Types::Check.string(hash['oldText'], 'oldText', allow_nil: true),
|
|
37
|
-
new_text: ACP::Types::Check.string(ACP::Types::Check.key(hash, 'newText'), 'newText'),
|
|
38
|
-
meta: hash['_meta']
|
|
39
|
-
)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
# @rbs return: Hash[String, untyped]
|
|
43
|
-
def to_h
|
|
44
|
-
{ 'path' => path, 'newText' => new_text, 'oldText' => old_text, '_meta' => meta }.compact
|
|
45
|
-
end
|
|
46
|
-
end
|
|
8
|
+
ACP::Types::Diff = ACP::Types::ToolCallContent::Diff
|
|
@@ -2,30 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Generated by bin/types from schema/schema.json. Do not edit.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
attr_reader :content #: (Hash[String, String | Integer | Numeric | bool | Array[String]])?
|
|
5
|
+
# @rbs!
|
|
6
|
+
# class ACP::Types::ElicitationAcceptAction = ACP::Types::CreateElicitationResponse::Action::Accept
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
# @rbs return: void
|
|
11
|
-
def initialize(content: nil)
|
|
12
|
-
@content = content
|
|
13
|
-
freeze
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# @rbs hash: Hash[String, untyped]
|
|
17
|
-
# @rbs return: ACP::Types::ElicitationAcceptAction
|
|
18
|
-
def self.from_h(hash)
|
|
19
|
-
content = ACP::Types::Check.hash(hash['content'], 'content', allow_nil: true) do |value, path|
|
|
20
|
-
ACP::Types::Check.one_of(value, path, [String, Integer, Numeric, TrueClass, FalseClass, Array]) do |item, path|
|
|
21
|
-
ACP::Types::Check.string(item, path)
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
new(content:)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
# @rbs return: Hash[String, untyped]
|
|
28
|
-
def to_h
|
|
29
|
-
{ 'content' => content }.compact
|
|
30
|
-
end
|
|
31
|
-
end
|
|
8
|
+
ACP::Types::ElicitationAcceptAction = ACP::Types::CreateElicitationResponse::Action::Accept
|
|
@@ -2,37 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Generated by bin/types from schema/schema.json. Do not edit.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
attr_reader :requested_schema #: ACP::Types::ElicitationSchema
|
|
5
|
+
# @rbs!
|
|
6
|
+
# class ACP::Types::ElicitationFormMode = ACP::Types::CreateElicitationRequest::Mode::Form
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
attr_reader :scope #: ACP::Types::ElicitationFormMode::Scope::t
|
|
11
|
-
|
|
12
|
-
# @rbs requested_schema: ACP::Types::ElicitationSchema
|
|
13
|
-
# @rbs scope: ACP::Types::ElicitationFormMode::Scope::t
|
|
14
|
-
# @rbs return: void
|
|
15
|
-
def initialize(requested_schema:, scope:)
|
|
16
|
-
@requested_schema = requested_schema
|
|
17
|
-
@scope = scope
|
|
18
|
-
freeze
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
# @rbs hash: Hash[String, untyped]
|
|
22
|
-
# @rbs return: ACP::Types::ElicitationFormMode
|
|
23
|
-
def self.from_h(hash)
|
|
24
|
-
new(
|
|
25
|
-
requested_schema: ACP::Types::Check.object(
|
|
26
|
-
ACP::Types::Check.key(hash, 'requestedSchema'),
|
|
27
|
-
'requestedSchema',
|
|
28
|
-
ACP::Types::ElicitationSchema
|
|
29
|
-
),
|
|
30
|
-
scope: ACP::Types::ElicitationFormMode::Scope.from_h(hash)
|
|
31
|
-
)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
# @rbs return: Hash[String, untyped]
|
|
35
|
-
def to_h
|
|
36
|
-
{ 'requestedSchema' => requested_schema.to_h }.merge(scope.to_h)
|
|
37
|
-
end
|
|
38
|
-
end
|
|
8
|
+
ACP::Types::ElicitationFormMode = ACP::Types::CreateElicitationRequest::Mode::Form
|
|
@@ -2,39 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Generated by bin/types from schema/schema.json. Do not edit.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
attr_reader :elicitation_id #: String
|
|
5
|
+
# @rbs!
|
|
6
|
+
# class ACP::Types::ElicitationUrlMode = ACP::Types::CreateElicitationRequest::Mode::Url
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
attr_reader :url #: String
|
|
11
|
-
|
|
12
|
-
# @dynamic scope
|
|
13
|
-
attr_reader :scope #: ACP::Types::ElicitationUrlMode::Scope::t
|
|
14
|
-
|
|
15
|
-
# @rbs elicitation_id: String
|
|
16
|
-
# @rbs url: String
|
|
17
|
-
# @rbs scope: ACP::Types::ElicitationUrlMode::Scope::t
|
|
18
|
-
# @rbs return: void
|
|
19
|
-
def initialize(elicitation_id:, url:, scope:)
|
|
20
|
-
@elicitation_id = elicitation_id
|
|
21
|
-
@url = url
|
|
22
|
-
@scope = scope
|
|
23
|
-
freeze
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
# @rbs hash: Hash[String, untyped]
|
|
27
|
-
# @rbs return: ACP::Types::ElicitationUrlMode
|
|
28
|
-
def self.from_h(hash)
|
|
29
|
-
new(
|
|
30
|
-
elicitation_id: ACP::Types::Check.string(ACP::Types::Check.key(hash, 'elicitationId'), 'elicitationId'),
|
|
31
|
-
url: ACP::Types::Check.string(ACP::Types::Check.key(hash, 'url'), 'url'),
|
|
32
|
-
scope: ACP::Types::ElicitationUrlMode::Scope.from_h(hash)
|
|
33
|
-
)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
# @rbs return: Hash[String, untyped]
|
|
37
|
-
def to_h
|
|
38
|
-
{ 'elicitationId' => elicitation_id, 'url' => url }.merge(scope.to_h)
|
|
39
|
-
end
|
|
40
|
-
end
|
|
8
|
+
ACP::Types::ElicitationUrlMode = ACP::Types::CreateElicitationRequest::Mode::Url
|
|
@@ -2,48 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Generated by bin/types from schema/schema.json. Do not edit.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
attr_reader :annotations #: ACP::Types::Annotations?
|
|
5
|
+
# @rbs!
|
|
6
|
+
# class ACP::Types::EmbeddedResource = ACP::Types::ContentBlock::Resource
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
attr_reader :resource #: ACP::Types::EmbeddedResourceResource::t
|
|
11
|
-
|
|
12
|
-
# @dynamic meta
|
|
13
|
-
attr_reader :meta #: Hash[String, untyped]?
|
|
14
|
-
|
|
15
|
-
# @rbs annotations: ACP::Types::Annotations?
|
|
16
|
-
# @rbs resource: ACP::Types::EmbeddedResourceResource::t
|
|
17
|
-
# @rbs meta: Hash[String, untyped]?
|
|
18
|
-
# @rbs return: void
|
|
19
|
-
def initialize(resource:, annotations: nil, meta: nil)
|
|
20
|
-
@annotations = annotations
|
|
21
|
-
@resource = resource
|
|
22
|
-
@meta = meta
|
|
23
|
-
freeze
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
# @rbs hash: Hash[String, untyped]
|
|
27
|
-
# @rbs return: ACP::Types::EmbeddedResource
|
|
28
|
-
def self.from_h(hash)
|
|
29
|
-
new(
|
|
30
|
-
annotations: ACP::Types::Check.object(
|
|
31
|
-
hash['annotations'],
|
|
32
|
-
'annotations',
|
|
33
|
-
ACP::Types::Annotations,
|
|
34
|
-
allow_nil: true
|
|
35
|
-
),
|
|
36
|
-
resource: ACP::Types::Check.object(
|
|
37
|
-
ACP::Types::Check.key(hash, 'resource'),
|
|
38
|
-
'resource',
|
|
39
|
-
ACP::Types::EmbeddedResourceResource
|
|
40
|
-
),
|
|
41
|
-
meta: hash['_meta']
|
|
42
|
-
)
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
# @rbs return: Hash[String, untyped]
|
|
46
|
-
def to_h
|
|
47
|
-
{ 'resource' => resource.to_h, 'annotations' => annotations&.to_h, '_meta' => meta }.compact
|
|
48
|
-
end
|
|
49
|
-
end
|
|
8
|
+
ACP::Types::EmbeddedResource = ACP::Types::ContentBlock::Resource
|
|
@@ -2,62 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Generated by bin/types from schema/schema.json. Do not edit.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
attr_reader :annotations #: ACP::Types::Annotations?
|
|
5
|
+
# @rbs!
|
|
6
|
+
# class ACP::Types::ImageContent = ACP::Types::ContentBlock::Image
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
attr_reader :data #: String
|
|
11
|
-
|
|
12
|
-
# @dynamic mime_type
|
|
13
|
-
attr_reader :mime_type #: String
|
|
14
|
-
|
|
15
|
-
# @dynamic uri
|
|
16
|
-
attr_reader :uri #: String?
|
|
17
|
-
|
|
18
|
-
# @dynamic meta
|
|
19
|
-
attr_reader :meta #: Hash[String, untyped]?
|
|
20
|
-
|
|
21
|
-
# @rbs annotations: ACP::Types::Annotations?
|
|
22
|
-
# @rbs data: String
|
|
23
|
-
# @rbs mime_type: String
|
|
24
|
-
# @rbs uri: String?
|
|
25
|
-
# @rbs meta: Hash[String, untyped]?
|
|
26
|
-
# @rbs return: void
|
|
27
|
-
def initialize(data:, mime_type:, annotations: nil, uri: nil, meta: nil)
|
|
28
|
-
@annotations = annotations
|
|
29
|
-
@data = data
|
|
30
|
-
@mime_type = mime_type
|
|
31
|
-
@uri = uri
|
|
32
|
-
@meta = meta
|
|
33
|
-
freeze
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
# @rbs hash: Hash[String, untyped]
|
|
37
|
-
# @rbs return: ACP::Types::ImageContent
|
|
38
|
-
def self.from_h(hash)
|
|
39
|
-
new(
|
|
40
|
-
annotations: ACP::Types::Check.object(
|
|
41
|
-
hash['annotations'],
|
|
42
|
-
'annotations',
|
|
43
|
-
ACP::Types::Annotations,
|
|
44
|
-
allow_nil: true
|
|
45
|
-
),
|
|
46
|
-
data: ACP::Types::Check.string(ACP::Types::Check.key(hash, 'data'), 'data'),
|
|
47
|
-
mime_type: ACP::Types::Check.string(ACP::Types::Check.key(hash, 'mimeType'), 'mimeType'),
|
|
48
|
-
uri: ACP::Types::Check.string(hash['uri'], 'uri', allow_nil: true),
|
|
49
|
-
meta: hash['_meta']
|
|
50
|
-
)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
# @rbs return: Hash[String, untyped]
|
|
54
|
-
def to_h
|
|
55
|
-
{
|
|
56
|
-
'data' => data,
|
|
57
|
-
'mimeType' => mime_type,
|
|
58
|
-
'annotations' => annotations&.to_h,
|
|
59
|
-
'uri' => uri,
|
|
60
|
-
'_meta' => meta
|
|
61
|
-
}.compact
|
|
62
|
-
end
|
|
63
|
-
end
|
|
8
|
+
ACP::Types::ImageContent = ACP::Types::ContentBlock::Image
|