acp-sdk 0.13.0 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +23 -0
  3. data/LICENSE +21 -0
  4. data/README.md +142 -70
  5. data/lib/acp/agent_connection/client.rb +2 -3
  6. data/lib/acp/agent_connection/optional_route.rb +45 -0
  7. data/lib/acp/agent_connection.rb +121 -77
  8. data/lib/acp/agent_process.rb +4 -4
  9. data/lib/acp/client_connection/elicitations.rb +44 -0
  10. data/lib/acp/client_connection/inbound.rb +240 -0
  11. data/lib/acp/client_connection/streams.rb +20 -52
  12. data/lib/acp/client_connection.rb +37 -315
  13. data/lib/acp/extensions.rb +6 -0
  14. data/lib/acp/protocol.rb +14 -4
  15. data/lib/acp/transport/reply.rb +5 -15
  16. data/lib/acp/transport/stdio.rb +7 -2
  17. data/lib/acp/types/parse_error.rb +1 -1
  18. data/lib/acp/types.rb +13 -0
  19. data/lib/acp/version.rb +1 -1
  20. data/sig/generated/acp/agent_connection/optional_route.rbs +35 -0
  21. data/sig/generated/acp/agent_connection.rbs +5 -21
  22. data/sig/generated/acp/client_connection/elicitations.rbs +29 -0
  23. data/sig/generated/acp/client_connection/inbound.rbs +109 -0
  24. data/sig/generated/acp/client_connection/streams.rbs +7 -28
  25. data/sig/generated/acp/client_connection.rbs +12 -139
  26. data/sig/generated/acp/extensions.rbs +4 -0
  27. data/sig/generated/acp/protocol.rbs +8 -0
  28. data/sig/generated/acp/transport/reply.rbs +11 -9
  29. data/sig/generated/acp/transport/stdio.rbs +17 -4
  30. data/sig/generated/acp/types.rbs +9 -0
  31. data/sig/manual/acp/agent_connection.rbs +5 -57
  32. data/sig/manual/acp/client_connection.rbs +27 -0
  33. data/sig/manual/acp/transport/stdio.rbs +1 -5
  34. metadata +10 -10
  35. data/LICENSE.txt +0 -9
  36. data/lib/acp/agent_connection/optional_method/spec.rb +0 -42
  37. data/lib/acp/agent_connection/optional_method.rb +0 -40
  38. data/lib/acp/transport/stdio/serving.rb +0 -18
  39. data/sig/generated/acp/agent_connection/optional_method/spec.rbs +0 -32
  40. data/sig/generated/acp/agent_connection/optional_method.rbs +0 -7
  41. data/sig/generated/acp/transport/stdio/serving.rbs +0 -14
@@ -8,75 +8,23 @@ class ACP::AgentConnection
8
8
  def respond_to?: (Symbol) -> bool
9
9
  end
10
10
 
11
- interface _LoadSession
11
+ interface _FullAgent
12
+ include _Agent
13
+ def authenticate: (ACP::Types::AuthenticateRequest) -> (ACP::Types::AuthenticateResponse | ACP::RequestError)
12
14
  def load_session: (ACP::Types::LoadSessionRequest) -> (ACP::Types::LoadSessionResponse | ACP::RequestError)
13
- end
14
-
15
- interface _ListSessions
16
15
  def list_sessions: (ACP::Types::ListSessionsRequest) -> (ACP::Types::ListSessionsResponse | ACP::RequestError)
17
- end
18
-
19
- interface _Authenticate
20
- def authenticate: (ACP::Types::AuthenticateRequest) -> (ACP::Types::AuthenticateResponse | ACP::RequestError)
21
- end
22
-
23
- interface _ResumeSession
24
16
  def resume_session: (ACP::Types::ResumeSessionRequest) -> (ACP::Types::ResumeSessionResponse | ACP::RequestError)
25
- end
26
-
27
- interface _CloseSession
28
17
  def close_session: (ACP::Types::CloseSessionRequest) -> (ACP::Types::CloseSessionResponse | ACP::RequestError)
29
- end
30
-
31
- interface _DeleteSession
32
18
  def delete_session: (ACP::Types::DeleteSessionRequest) -> (ACP::Types::DeleteSessionResponse | ACP::RequestError)
33
- end
34
-
35
- interface _Logout
36
19
  def logout: (ACP::Types::LogoutRequest) -> (ACP::Types::LogoutResponse | ACP::RequestError)
37
- end
38
-
39
- interface _ForkSession
20
+ def change_session_mode: (ACP::Types::SetSessionModeRequest) -> (ACP::Types::SetSessionModeResponse | ACP::RequestError)
21
+ def change_session_config_option: (ACP::Types::SetSessionConfigOptionRequest) -> (ACP::Types::SetSessionConfigOptionResponse | ACP::RequestError)
40
22
  def fork_session: (ACP::Types::Unstable::ForkSessionRequest) -> (ACP::Types::Unstable::ForkSessionResponse | ACP::RequestError)
41
- end
42
-
43
- interface _ListProviders
44
23
  def list_providers: (ACP::Types::Unstable::ListProvidersRequest) -> (ACP::Types::Unstable::ListProvidersResponse | ACP::RequestError)
45
- end
46
-
47
- interface _SetProvider
48
24
  def set_provider: (ACP::Types::Unstable::SetProviderRequest) -> (ACP::Types::Unstable::SetProviderResponse | ACP::RequestError)
49
- end
50
-
51
- interface _DisableProvider
52
25
  def disable_provider: (ACP::Types::Unstable::DisableProviderRequest) -> (ACP::Types::Unstable::DisableProviderResponse | ACP::RequestError)
53
26
  end
54
27
 
55
- interface _ChangeSessionMode
56
- def change_session_mode: (ACP::Types::SetSessionModeRequest) -> (ACP::Types::SetSessionModeResponse | ACP::RequestError)
57
- end
58
-
59
- interface _ChangeSessionConfigOption
60
- def change_session_config_option: (ACP::Types::SetSessionConfigOptionRequest) -> (ACP::Types::SetSessionConfigOptionResponse | ACP::RequestError)
61
- end
62
-
63
- interface _FullAgent
64
- include _Agent
65
- include _LoadSession
66
- include _ListSessions
67
- include _Authenticate
68
- include _ResumeSession
69
- include _CloseSession
70
- include _DeleteSession
71
- include _Logout
72
- include _ForkSession
73
- include _ListProviders
74
- include _SetProvider
75
- include _DisableProvider
76
- include _ChangeSessionMode
77
- include _ChangeSessionConfigOption
78
- end
79
-
80
28
  interface _SessionCreated
81
29
  def session_created: (ACP::Types::NewSessionResponse) -> void
82
30
  end
@@ -8,4 +8,31 @@ class ACP::ClientConnection
8
8
  # Runs on the transport's reader thread, so it must return quickly.
9
9
  def call: (ACP::Types::SessionNotification) -> void
10
10
  end
11
+
12
+ # Each handler object needs only the methods of the capabilities initialize
13
+ # advertises; ClientConnection probes for the rest.
14
+ interface _FileSystem
15
+ def read_text_file: (ACP::Types::ReadTextFileRequest) -> (ACP::Types::ReadTextFileResponse | ACP::RequestError)
16
+ def write_text_file: (ACP::Types::WriteTextFileRequest) -> (ACP::Types::WriteTextFileResponse | ACP::RequestError)
17
+ def respond_to?: (Symbol) -> bool
18
+ end
19
+
20
+ # Each method runs on its own thread and may block for as long as the
21
+ # command runs.
22
+ interface _Terminal
23
+ def create_terminal: (ACP::Types::CreateTerminalRequest) -> (ACP::Types::CreateTerminalResponse | ACP::RequestError)
24
+ def terminal_output: (ACP::Types::TerminalOutputRequest) -> (ACP::Types::TerminalOutputResponse | ACP::RequestError)
25
+ def wait_for_terminal_exit: (ACP::Types::WaitForTerminalExitRequest) -> (ACP::Types::WaitForTerminalExitResponse | ACP::RequestError)
26
+ def kill_terminal: (ACP::Types::KillTerminalRequest) -> (ACP::Types::KillTerminalResponse | ACP::RequestError)
27
+ def release_terminal: (ACP::Types::ReleaseTerminalRequest) -> (ACP::Types::ReleaseTerminalResponse | ACP::RequestError)
28
+ def respond_to?: (Symbol) -> bool
29
+ end
30
+
31
+ interface _Elicitation
32
+ def create_elicitation: (ACP::Types::CreateElicitationRequest) -> (ACP::Types::CreateElicitationResponse | ACP::RequestError)
33
+ # Optional, for url mode. Runs on the transport's reader thread, so it
34
+ # must return quickly.
35
+ def complete_elicitation: (ACP::Types::CompleteElicitationNotification) -> void
36
+ def respond_to?: (Symbol) -> bool
37
+ end
11
38
  end
@@ -1,8 +1,4 @@
1
1
  class ACP::Transport::Stdio
2
- interface _ToH
3
- def to_h: () -> Hash[String, untyped]
4
- end
5
-
6
2
  interface _Reader
7
3
  def each_line: () { (String) -> void } -> untyped
8
4
  end
@@ -13,7 +9,7 @@ class ACP::Transport::Stdio
13
9
  end
14
10
 
15
11
  interface _Handler
16
- def call: (untyped params) -> (_ToH | ACP::RequestError | ACP::Transport::Reply)
12
+ def call: (untyped params) -> (ACP::Transport::_Response | ACP::RequestError | ACP::Transport::Reply)
17
13
  end
18
14
 
19
15
  interface _NotificationHandler
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acp-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Bottrall
@@ -30,14 +30,15 @@ extensions: []
30
30
  extra_rdoc_files: []
31
31
  files:
32
32
  - CHANGELOG.md
33
- - LICENSE.txt
33
+ - LICENSE
34
34
  - README.md
35
35
  - lib/acp/agent_connection.rb
36
36
  - lib/acp/agent_connection/client.rb
37
- - lib/acp/agent_connection/optional_method.rb
38
- - lib/acp/agent_connection/optional_method/spec.rb
37
+ - lib/acp/agent_connection/optional_route.rb
39
38
  - lib/acp/agent_process.rb
40
39
  - lib/acp/client_connection.rb
40
+ - lib/acp/client_connection/elicitations.rb
41
+ - lib/acp/client_connection/inbound.rb
41
42
  - lib/acp/client_connection/streams.rb
42
43
  - lib/acp/extensions.rb
43
44
  - lib/acp/protocol.rb
@@ -48,7 +49,6 @@ files:
48
49
  - lib/acp/transport/reply.rb
49
50
  - lib/acp/transport/stderr_logger.rb
50
51
  - lib/acp/transport/stdio.rb
51
- - lib/acp/transport/stdio/serving.rb
52
52
  - lib/acp/types.rb
53
53
  - lib/acp/types/agent_auth_capabilities.rb
54
54
  - lib/acp/types/agent_capabilities.rb
@@ -392,10 +392,11 @@ files:
392
392
  - lib/acp/version.rb
393
393
  - sig/generated/acp/agent_connection.rbs
394
394
  - sig/generated/acp/agent_connection/client.rbs
395
- - sig/generated/acp/agent_connection/optional_method.rbs
396
- - sig/generated/acp/agent_connection/optional_method/spec.rbs
395
+ - sig/generated/acp/agent_connection/optional_route.rbs
397
396
  - sig/generated/acp/agent_process.rbs
398
397
  - sig/generated/acp/client_connection.rbs
398
+ - sig/generated/acp/client_connection/elicitations.rbs
399
+ - sig/generated/acp/client_connection/inbound.rbs
399
400
  - sig/generated/acp/client_connection/streams.rbs
400
401
  - sig/generated/acp/extensions.rbs
401
402
  - sig/generated/acp/protocol.rbs
@@ -406,7 +407,6 @@ files:
406
407
  - sig/generated/acp/transport/reply.rbs
407
408
  - sig/generated/acp/transport/stderr_logger.rbs
408
409
  - sig/generated/acp/transport/stdio.rbs
409
- - sig/generated/acp/transport/stdio/serving.rbs
410
410
  - sig/generated/acp/types.rbs
411
411
  - sig/generated/acp/types/agent_auth_capabilities.rbs
412
412
  - sig/generated/acp/types/agent_capabilities.rbs
@@ -769,14 +769,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
769
769
  requirements:
770
770
  - - ">="
771
771
  - !ruby/object:Gem::Version
772
- version: '3.4'
772
+ version: '3.3'
773
773
  required_rubygems_version: !ruby/object:Gem::Requirement
774
774
  requirements:
775
775
  - - ">="
776
776
  - !ruby/object:Gem::Version
777
777
  version: '0'
778
778
  requirements: []
779
- rubygems_version: 4.0.16
779
+ rubygems_version: 4.0.20
780
780
  specification_version: 4
781
781
  summary: A Ruby SDK for the Agent Client Protocol.
782
782
  test_files: []
data/LICENSE.txt DELETED
@@ -1,9 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2026 Jake Bottrall
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
-
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
-
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,42 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class ACP::AgentConnection::OptionalMethod::Spec
4
- # @dynamic rpc_method
5
- attr_reader :rpc_method #: String
6
- # @dynamic agent_method
7
- attr_reader :agent_method #: Symbol
8
- # @dynamic path
9
- attr_reader :path #: Array[Symbol]
10
-
11
- # @rbs rpc_method: String
12
- # @rbs agent_method: Symbol
13
- # @rbs path: Array[Symbol]
14
- # @rbs return: void
15
- def initialize(rpc_method:, agent_method:, path:)
16
- @rpc_method = rpc_method
17
- @agent_method = agent_method
18
- @path = path.freeze
19
- freeze
20
- end
21
-
22
- # Readers missing along the chain count as unadvertised, so the stable
23
- # capabilities answer false for the unstable-only paths (fork, providers).
24
- #
25
- # @rbs initialize_response: ACP::Types::InitializeResponse
26
- # @rbs return: bool
27
- def advertised?(initialize_response)
28
- # reduce's U pins to the InitializeResponse argument, but the chain walks
29
- # through unrelated capability types.
30
- value = path.reduce(initialize_response) { |node, name| follow(node, name) } #: untyped
31
- value ? true : false
32
- end
33
-
34
- private
35
-
36
- # @rbs node: untyped
37
- # @rbs name: Symbol
38
- # @rbs return: untyped
39
- def follow(node, name)
40
- node.respond_to?(name) ? node.public_send(name) : nil
41
- end
42
- end
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ACP::AgentConnection::OptionalMethod
4
- SPECS = [
5
- Spec.new(rpc_method: 'authenticate', agent_method: :authenticate, path: %i[auth_methods any?]),
6
- Spec.new(rpc_method: 'session/load', agent_method: :load_session, path: %i[agent_capabilities load_session]),
7
- Spec.new(
8
- rpc_method: 'session/list',
9
- agent_method: :list_sessions,
10
- path: %i[agent_capabilities session_capabilities list]
11
- ),
12
- Spec.new(
13
- rpc_method: 'session/resume',
14
- agent_method: :resume_session,
15
- path: %i[agent_capabilities session_capabilities resume]
16
- ),
17
- Spec.new(
18
- rpc_method: 'session/close',
19
- agent_method: :close_session,
20
- path: %i[agent_capabilities session_capabilities close]
21
- ),
22
- Spec.new(
23
- rpc_method: 'session/delete',
24
- agent_method: :delete_session,
25
- path: %i[agent_capabilities session_capabilities delete]
26
- ),
27
- Spec.new(rpc_method: 'logout', agent_method: :logout, path: %i[agent_capabilities auth logout])
28
- ].freeze #: Array[Spec]
29
-
30
- UNSTABLE_SPECS = [
31
- Spec.new(
32
- rpc_method: 'session/fork',
33
- agent_method: :fork_session,
34
- path: %i[agent_capabilities session_capabilities fork]
35
- ),
36
- Spec.new(rpc_method: 'providers/list', agent_method: :list_providers, path: %i[agent_capabilities providers]),
37
- Spec.new(rpc_method: 'providers/set', agent_method: :set_provider, path: %i[agent_capabilities providers]),
38
- Spec.new(rpc_method: 'providers/disable', agent_method: :disable_provider, path: %i[agent_capabilities providers])
39
- ].freeze #: Array[Spec]
40
- end
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class ACP::Transport::Stdio::Serving
4
- # @dynamic id
5
- attr_reader :id #: untyped
6
-
7
- # @dynamic cancellation
8
- attr_reader :cancellation #: ACP::Transport::Cancellation
9
-
10
- # @rbs id: untyped
11
- # @rbs cancellation: ACP::Transport::Cancellation
12
- # @rbs return: void
13
- def initialize(id:, cancellation:)
14
- @id = id
15
- @cancellation = cancellation
16
- freeze
17
- end
18
- end
@@ -1,32 +0,0 @@
1
- # Generated from lib/acp/agent_connection/optional_method/spec.rb with RBS::Inline
2
-
3
- class ACP::AgentConnection::OptionalMethod::Spec
4
- # @dynamic rpc_method
5
- attr_reader rpc_method: String
6
-
7
- # @dynamic agent_method
8
- attr_reader agent_method: Symbol
9
-
10
- # @dynamic path
11
- attr_reader path: Array[Symbol]
12
-
13
- # @rbs rpc_method: String
14
- # @rbs agent_method: Symbol
15
- # @rbs path: Array[Symbol]
16
- # @rbs return: void
17
- def initialize: (rpc_method: String, agent_method: Symbol, path: Array[Symbol]) -> void
18
-
19
- # Readers missing along the chain count as unadvertised, so the stable
20
- # capabilities answer false for the unstable-only paths (fork, providers).
21
- #
22
- # @rbs initialize_response: ACP::Types::InitializeResponse
23
- # @rbs return: bool
24
- def advertised?: (ACP::Types::InitializeResponse initialize_response) -> bool
25
-
26
- private
27
-
28
- # @rbs node: untyped
29
- # @rbs name: Symbol
30
- # @rbs return: untyped
31
- def follow: (untyped node, Symbol name) -> untyped
32
- end
@@ -1,7 +0,0 @@
1
- # Generated from lib/acp/agent_connection/optional_method.rb with RBS::Inline
2
-
3
- module ACP::AgentConnection::OptionalMethod
4
- SPECS: Array[Spec]
5
-
6
- UNSTABLE_SPECS: Array[Spec]
7
- end
@@ -1,14 +0,0 @@
1
- # Generated from lib/acp/transport/stdio/serving.rb with RBS::Inline
2
-
3
- class ACP::Transport::Stdio::Serving
4
- # @dynamic id
5
- attr_reader id: untyped
6
-
7
- # @dynamic cancellation
8
- attr_reader cancellation: ACP::Transport::Cancellation
9
-
10
- # @rbs id: untyped
11
- # @rbs cancellation: ACP::Transport::Cancellation
12
- # @rbs return: void
13
- def initialize: (id: untyped, cancellation: ACP::Transport::Cancellation) -> void
14
- end