acp-sdk 0.12.0 → 0.14.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 +27 -0
- data/README.md +141 -69
- data/lib/acp/agent_connection/client.rb +4 -5
- data/lib/acp/agent_connection/optional_route.rb +45 -0
- data/lib/acp/agent_connection.rb +122 -78
- data/lib/acp/agent_process.rb +4 -4
- data/lib/acp/client_connection/elicitations.rb +44 -0
- data/lib/acp/client_connection/inbound/route.rb +29 -0
- data/lib/acp/client_connection/inbound.rb +232 -0
- data/lib/acp/client_connection/streams.rb +22 -54
- data/lib/acp/client_connection.rb +36 -311
- data/lib/acp/extensions.rb +6 -0
- data/lib/acp/protocol.rb +14 -4
- data/lib/acp/transport/reply.rb +2 -2
- data/lib/acp/transport/stdio.rb +2 -2
- data/lib/acp/types/parse_error.rb +1 -1
- data/lib/acp/types.rb +13 -0
- data/lib/acp/version.rb +1 -1
- data/sig/generated/acp/agent_connection/client.rbs +3 -3
- data/sig/generated/acp/agent_connection/optional_route.rbs +35 -0
- data/sig/generated/acp/agent_connection.rbs +8 -24
- data/sig/generated/acp/client_connection/elicitations.rbs +29 -0
- data/sig/generated/acp/client_connection/inbound/route.rbs +26 -0
- data/sig/generated/acp/client_connection/inbound.rbs +90 -0
- data/sig/generated/acp/client_connection/streams.rbs +8 -29
- data/sig/generated/acp/client_connection.rbs +13 -137
- data/sig/generated/acp/extensions.rbs +4 -0
- data/sig/generated/acp/protocol.rbs +8 -0
- data/sig/generated/acp/transport/reply.rbs +3 -3
- data/sig/generated/acp/transport/stdio.rbs +4 -4
- data/sig/generated/acp/types.rbs +9 -0
- data/sig/manual/acp/agent_connection.rbs +5 -79
- data/sig/manual/acp/client_connection.rbs +25 -5
- data/sig/manual/acp/transport/stdio.rbs +1 -5
- data/sig/manual/acp/transport.rbs +0 -16
- metadata +9 -5
- data/lib/acp/agent_connection/optional_method/spec.rb +0 -42
- data/lib/acp/agent_connection/optional_method.rb +0 -40
- data/sig/generated/acp/agent_connection/optional_method/spec.rbs +0 -32
- data/sig/generated/acp/agent_connection/optional_method.rbs +0 -7
|
@@ -8,75 +8,23 @@ class ACP::AgentConnection
|
|
|
8
8
|
def respond_to?: (Symbol) -> bool
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
interface
|
|
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
|
-
|
|
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
|
|
@@ -85,26 +33,4 @@ class ACP::AgentConnection
|
|
|
85
33
|
# Runs on the transport's reader thread, so it must return quickly.
|
|
86
34
|
def mcp_message_notification: (ACP::Types::Unstable::MessageMcpNotification notification) -> void
|
|
87
35
|
end
|
|
88
|
-
|
|
89
|
-
# What an agent sees of ACP::AgentConnection::Client, so tests can pass a fake.
|
|
90
|
-
interface _Client
|
|
91
|
-
def update: (String session_id, ACP::Types::SessionUpdate::t update) -> void
|
|
92
|
-
def available_commands: (String session_id, Array[ACP::Types::AvailableCommand] commands) -> void
|
|
93
|
-
def request_permission: (ACP::Types::RequestPermissionRequest) -> (ACP::Types::RequestPermissionResponse | ACP::RequestError)
|
|
94
|
-
def cancel_requests: () -> void
|
|
95
|
-
def cancelled?: () -> bool
|
|
96
|
-
def read_text_file: (ACP::Types::ReadTextFileRequest) -> (ACP::Types::ReadTextFileResponse | ACP::RequestError)
|
|
97
|
-
def write_text_file: (ACP::Types::WriteTextFileRequest) -> (ACP::Types::WriteTextFileResponse | ACP::RequestError)
|
|
98
|
-
def create_terminal: (ACP::Types::CreateTerminalRequest) -> (ACP::Types::CreateTerminalResponse | ACP::RequestError)
|
|
99
|
-
def terminal_output: (ACP::Types::TerminalOutputRequest) -> (ACP::Types::TerminalOutputResponse | ACP::RequestError)
|
|
100
|
-
def wait_for_terminal_exit: (ACP::Types::WaitForTerminalExitRequest) -> (ACP::Types::WaitForTerminalExitResponse | ACP::RequestError)
|
|
101
|
-
def kill_terminal: (ACP::Types::KillTerminalRequest) -> (ACP::Types::KillTerminalResponse | ACP::RequestError)
|
|
102
|
-
def release_terminal: (ACP::Types::ReleaseTerminalRequest) -> (ACP::Types::ReleaseTerminalResponse | ACP::RequestError)
|
|
103
|
-
def create_elicitation: (ACP::Types::CreateElicitationRequest request) -> (ACP::Types::CreateElicitationResponse | ACP::RequestError)
|
|
104
|
-
def complete_elicitation: (ACP::Types::CompleteElicitationNotification notification) -> void
|
|
105
|
-
def mcp_message: (ACP::Types::Unstable::MessageMcpRequest request) -> (ACP::Types::Unstable::MessageMcpResponse::t | ACP::RequestError)
|
|
106
|
-
def ext_request: (String method, ?untyped params) -> (Hash[String, untyped] | ACP::RequestError)
|
|
107
|
-
def ext_notify: (String method, ?untyped params) -> void
|
|
108
|
-
def capabilities: () -> ACP::Types::ClientCapabilities?
|
|
109
|
-
end
|
|
110
36
|
end
|
|
@@ -8,11 +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
|
-
end
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def
|
|
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
|
|
17
37
|
end
|
|
18
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) -> (
|
|
12
|
+
def call: (untyped params) -> (ACP::Transport::_Response | ACP::RequestError | ACP::Transport::Reply)
|
|
17
13
|
end
|
|
18
14
|
|
|
19
15
|
interface _NotificationHandler
|
|
@@ -5,22 +5,6 @@ module ACP::Transport
|
|
|
5
5
|
def error: (String message) -> void
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
interface _Peer
|
|
9
|
-
def request: (String method, ?untyped params) -> (Hash[String, untyped] | ACP::RequestError)
|
|
10
|
-
def notify: (String method, ?untyped params) -> void
|
|
11
|
-
def cancellation: () -> ACP::Transport::Cancellation?
|
|
12
|
-
def cancel_requests: () -> void
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
interface _Transport
|
|
16
|
-
include _Peer
|
|
17
|
-
|
|
18
|
-
def start: (
|
|
19
|
-
requests: Hash[String, ACP::Transport::Stdio::_Handler],
|
|
20
|
-
notifications: Hash[String, ACP::Transport::Stdio::_NotificationHandler]
|
|
21
|
-
) -> Thread
|
|
22
|
-
end
|
|
23
|
-
|
|
24
8
|
interface _Parser
|
|
25
9
|
def from_h: (Hash[String, untyped]) -> untyped
|
|
26
10
|
end
|
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.
|
|
4
|
+
version: 0.14.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jake Bottrall
|
|
@@ -34,10 +34,12 @@ files:
|
|
|
34
34
|
- README.md
|
|
35
35
|
- lib/acp/agent_connection.rb
|
|
36
36
|
- lib/acp/agent_connection/client.rb
|
|
37
|
-
- lib/acp/agent_connection/
|
|
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
|
|
42
|
+
- lib/acp/client_connection/inbound/route.rb
|
|
41
43
|
- lib/acp/client_connection/streams.rb
|
|
42
44
|
- lib/acp/extensions.rb
|
|
43
45
|
- lib/acp/protocol.rb
|
|
@@ -392,10 +394,12 @@ files:
|
|
|
392
394
|
- lib/acp/version.rb
|
|
393
395
|
- sig/generated/acp/agent_connection.rbs
|
|
394
396
|
- sig/generated/acp/agent_connection/client.rbs
|
|
395
|
-
- sig/generated/acp/agent_connection/
|
|
396
|
-
- sig/generated/acp/agent_connection/optional_method/spec.rbs
|
|
397
|
+
- sig/generated/acp/agent_connection/optional_route.rbs
|
|
397
398
|
- sig/generated/acp/agent_process.rbs
|
|
398
399
|
- sig/generated/acp/client_connection.rbs
|
|
400
|
+
- sig/generated/acp/client_connection/elicitations.rbs
|
|
401
|
+
- sig/generated/acp/client_connection/inbound.rbs
|
|
402
|
+
- sig/generated/acp/client_connection/inbound/route.rbs
|
|
399
403
|
- sig/generated/acp/client_connection/streams.rbs
|
|
400
404
|
- sig/generated/acp/extensions.rbs
|
|
401
405
|
- sig/generated/acp/protocol.rbs
|
|
@@ -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,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
|