arcp 1.0.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 (83) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +31 -0
  3. data/CONFORMANCE.md +71 -0
  4. data/LICENSE +202 -0
  5. data/README.md +135 -0
  6. data/lib/arcp/auth/auth_scheme.rb +16 -0
  7. data/lib/arcp/auth/bearer.rb +38 -0
  8. data/lib/arcp/auth.rb +4 -0
  9. data/lib/arcp/client.rb +354 -0
  10. data/lib/arcp/clock.rb +35 -0
  11. data/lib/arcp/credential.rb +65 -0
  12. data/lib/arcp/credential_provisioner.rb +132 -0
  13. data/lib/arcp/envelope.rb +115 -0
  14. data/lib/arcp/errors.rb +154 -0
  15. data/lib/arcp/ids.rb +18 -0
  16. data/lib/arcp/job/accepted.rb +37 -0
  17. data/lib/arcp/job/agent_ref.rb +18 -0
  18. data/lib/arcp/job/cancel.rb +18 -0
  19. data/lib/arcp/job/event.rb +68 -0
  20. data/lib/arcp/job/event_body/delegate.rb +24 -0
  21. data/lib/arcp/job/event_body/log.rb +20 -0
  22. data/lib/arcp/job/event_body/metric.rb +20 -0
  23. data/lib/arcp/job/event_body/progress.rb +27 -0
  24. data/lib/arcp/job/event_body/result_chunk.rb +42 -0
  25. data/lib/arcp/job/event_body/status.rb +25 -0
  26. data/lib/arcp/job/event_body/thought.rb +12 -0
  27. data/lib/arcp/job/event_body/tool_call.rb +16 -0
  28. data/lib/arcp/job/event_body/tool_result.rb +23 -0
  29. data/lib/arcp/job/event_body/trace_span.rb +30 -0
  30. data/lib/arcp/job/handle.rb +16 -0
  31. data/lib/arcp/job/job_error.rb +31 -0
  32. data/lib/arcp/job/result.rb +30 -0
  33. data/lib/arcp/job/submit.rb +32 -0
  34. data/lib/arcp/job/subscribe.rb +22 -0
  35. data/lib/arcp/job/subscribed.rb +14 -0
  36. data/lib/arcp/job/summary.rb +27 -0
  37. data/lib/arcp/job/unsubscribe.rb +10 -0
  38. data/lib/arcp/job.rb +15 -0
  39. data/lib/arcp/lease.rb +212 -0
  40. data/lib/arcp/message_types.rb +35 -0
  41. data/lib/arcp/runtime/credential_registry.rb +67 -0
  42. data/lib/arcp/runtime/event_log.rb +62 -0
  43. data/lib/arcp/runtime/job_context.rb +167 -0
  44. data/lib/arcp/runtime/job_manager.rb +256 -0
  45. data/lib/arcp/runtime/lease_manager.rb +88 -0
  46. data/lib/arcp/runtime/runtime.rb +125 -0
  47. data/lib/arcp/runtime/session_actor.rb +300 -0
  48. data/lib/arcp/runtime/subscription_manager.rb +57 -0
  49. data/lib/arcp/runtime.rb +10 -0
  50. data/lib/arcp/serializer.rb +43 -0
  51. data/lib/arcp/session/ack.rb +14 -0
  52. data/lib/arcp/session/agent_inventory.rb +51 -0
  53. data/lib/arcp/session/bye.rb +10 -0
  54. data/lib/arcp/session/capability_set.rb +29 -0
  55. data/lib/arcp/session/feature.rb +25 -0
  56. data/lib/arcp/session/hello.rb +34 -0
  57. data/lib/arcp/session/jobs_response.rb +18 -0
  58. data/lib/arcp/session/list_jobs.rb +19 -0
  59. data/lib/arcp/session/ping.rb +14 -0
  60. data/lib/arcp/session/pong.rb +14 -0
  61. data/lib/arcp/session/session_error.rb +23 -0
  62. data/lib/arcp/session/welcome.rb +38 -0
  63. data/lib/arcp/session.rb +26 -0
  64. data/lib/arcp/trace.rb +51 -0
  65. data/lib/arcp/transport/base.rb +29 -0
  66. data/lib/arcp/transport/memory_transport.rb +54 -0
  67. data/lib/arcp/transport/stdio_transport.rb +56 -0
  68. data/lib/arcp/transport/websocket_transport.rb +47 -0
  69. data/lib/arcp/transport.rb +6 -0
  70. data/lib/arcp/version.rb +7 -0
  71. data/lib/arcp.rb +19 -0
  72. data/sig/arcp/client.rbs +16 -0
  73. data/sig/arcp/credential.rbs +51 -0
  74. data/sig/arcp/envelope.rbs +25 -0
  75. data/sig/arcp/errors.rbs +40 -0
  76. data/sig/arcp/job.rbs +83 -0
  77. data/sig/arcp/lease.rbs +41 -0
  78. data/sig/arcp/runtime.rbs +41 -0
  79. data/sig/arcp/serializer.rbs +8 -0
  80. data/sig/arcp/session.rbs +56 -0
  81. data/sig/arcp/transport.rbs +18 -0
  82. data/sig/arcp.rbs +5 -0
  83. metadata +226 -0
@@ -0,0 +1,56 @@
1
+ module Arcp
2
+ module Session
3
+ module Feature
4
+ HEARTBEAT: String
5
+ ACK: String
6
+ LIST_JOBS: String
7
+ SUBSCRIBE: String
8
+ LEASE_EXPIRES_AT: String
9
+ COST_BUDGET: String
10
+ PROGRESS: String
11
+ RESULT_CHUNK: String
12
+ AGENT_VERSIONS: String
13
+ ALL: Array[String]
14
+ end
15
+
16
+ class CapabilitySet
17
+ attr_reader features: Array[String]
18
+ attr_reader encodings: Array[String]
19
+ attr_reader agents: AgentInventory?
20
+ def self.local: (?features: Array[String], ?encodings: Array[String], ?agents: AgentInventory?) -> CapabilitySet
21
+ def intersect: (CapabilitySet) -> CapabilitySet
22
+ def supports?: (String) -> bool
23
+ def to_h: () -> Hash[String, untyped]
24
+ end
25
+
26
+ class AgentEntry
27
+ attr_reader name: String
28
+ attr_reader versions: Array[String]
29
+ attr_reader default: String?
30
+ def self.from_hash: (Hash[String | Symbol, untyped]) -> AgentEntry
31
+ def to_h: () -> Hash[String, untyped]
32
+ end
33
+
34
+ class AgentInventory
35
+ attr_reader entries: Array[AgentEntry]
36
+ def self.from_array: (Array[Hash[String | Symbol, untyped]]) -> AgentInventory
37
+ def to_a: () -> Array[Hash[String, untyped]]
38
+ def find: (String) -> AgentEntry?
39
+ def default_for: (String) -> String?
40
+ def versions_for: (String) -> Array[String]
41
+ def names: () -> Array[String]
42
+ def resolve: (String) -> String?
43
+ end
44
+
45
+ class Info
46
+ attr_reader id: String
47
+ attr_reader runtime_version: String
48
+ attr_reader capabilities: CapabilitySet
49
+ attr_reader agents: AgentInventory?
50
+ attr_reader heartbeat_interval_sec: Integer?
51
+ attr_reader resume_token: String?
52
+ attr_reader resume_window_sec: Integer?
53
+ def supports?: (String) -> bool
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,18 @@
1
+ module Arcp
2
+ module Transport
3
+ class Base
4
+ def send: (Arcp::Envelope) -> void
5
+ def receive: () -> Arcp::Envelope?
6
+ def close: (?reason: String?) -> void
7
+ def closed?: () -> bool
8
+ end
9
+
10
+ class MemoryTransport < Base
11
+ attr_reader sent: Array[Arcp::Envelope]
12
+ def self.pair: () -> [MemoryTransport, MemoryTransport]
13
+ end
14
+
15
+ class StdioTransport < Base end
16
+ class WebSocketTransport < Base end
17
+ end
18
+ end
data/sig/arcp.rbs ADDED
@@ -0,0 +1,5 @@
1
+ module Arcp
2
+ VERSION: String
3
+ PROTOCOL_VERSION: String
4
+ SUBPROTOCOL: String
5
+ end
metadata ADDED
@@ -0,0 +1,226 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: arcp
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - ARCP Authors
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: async
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '2.20'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '2.20'
26
+ - !ruby/object:Gem::Dependency
27
+ name: async-http
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '0.86'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '0.86'
40
+ - !ruby/object:Gem::Dependency
41
+ name: async-websocket
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '0.30'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '0.30'
54
+ - !ruby/object:Gem::Dependency
55
+ name: bigdecimal
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '3.1'
61
+ type: :runtime
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '3.1'
68
+ - !ruby/object:Gem::Dependency
69
+ name: logger
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '1.6'
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '1.6'
82
+ - !ruby/object:Gem::Dependency
83
+ name: opentelemetry-api
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '1.5'
89
+ type: :runtime
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - "~>"
94
+ - !ruby/object:Gem::Version
95
+ version: '1.5'
96
+ - !ruby/object:Gem::Dependency
97
+ name: sqlite3
98
+ requirement: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - "~>"
101
+ - !ruby/object:Gem::Version
102
+ version: '2.0'
103
+ type: :runtime
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '2.0'
110
+ description: |
111
+ Ruby SDK for ARCP: envelope and message model, fiber-based runtime, client,
112
+ WebSocket / stdio / in-memory transports, SQLite-backed resume log,
113
+ capability negotiation, leases with budget and expiration, streamed results,
114
+ and OpenTelemetry trace propagation. Built on socketry/async.
115
+ email:
116
+ - arcp-authors@users.noreply.github.com
117
+ executables: []
118
+ extensions: []
119
+ extra_rdoc_files: []
120
+ files:
121
+ - CHANGELOG.md
122
+ - CONFORMANCE.md
123
+ - LICENSE
124
+ - README.md
125
+ - lib/arcp.rb
126
+ - lib/arcp/auth.rb
127
+ - lib/arcp/auth/auth_scheme.rb
128
+ - lib/arcp/auth/bearer.rb
129
+ - lib/arcp/client.rb
130
+ - lib/arcp/clock.rb
131
+ - lib/arcp/credential.rb
132
+ - lib/arcp/credential_provisioner.rb
133
+ - lib/arcp/envelope.rb
134
+ - lib/arcp/errors.rb
135
+ - lib/arcp/ids.rb
136
+ - lib/arcp/job.rb
137
+ - lib/arcp/job/accepted.rb
138
+ - lib/arcp/job/agent_ref.rb
139
+ - lib/arcp/job/cancel.rb
140
+ - lib/arcp/job/event.rb
141
+ - lib/arcp/job/event_body/delegate.rb
142
+ - lib/arcp/job/event_body/log.rb
143
+ - lib/arcp/job/event_body/metric.rb
144
+ - lib/arcp/job/event_body/progress.rb
145
+ - lib/arcp/job/event_body/result_chunk.rb
146
+ - lib/arcp/job/event_body/status.rb
147
+ - lib/arcp/job/event_body/thought.rb
148
+ - lib/arcp/job/event_body/tool_call.rb
149
+ - lib/arcp/job/event_body/tool_result.rb
150
+ - lib/arcp/job/event_body/trace_span.rb
151
+ - lib/arcp/job/handle.rb
152
+ - lib/arcp/job/job_error.rb
153
+ - lib/arcp/job/result.rb
154
+ - lib/arcp/job/submit.rb
155
+ - lib/arcp/job/subscribe.rb
156
+ - lib/arcp/job/subscribed.rb
157
+ - lib/arcp/job/summary.rb
158
+ - lib/arcp/job/unsubscribe.rb
159
+ - lib/arcp/lease.rb
160
+ - lib/arcp/message_types.rb
161
+ - lib/arcp/runtime.rb
162
+ - lib/arcp/runtime/credential_registry.rb
163
+ - lib/arcp/runtime/event_log.rb
164
+ - lib/arcp/runtime/job_context.rb
165
+ - lib/arcp/runtime/job_manager.rb
166
+ - lib/arcp/runtime/lease_manager.rb
167
+ - lib/arcp/runtime/runtime.rb
168
+ - lib/arcp/runtime/session_actor.rb
169
+ - lib/arcp/runtime/subscription_manager.rb
170
+ - lib/arcp/serializer.rb
171
+ - lib/arcp/session.rb
172
+ - lib/arcp/session/ack.rb
173
+ - lib/arcp/session/agent_inventory.rb
174
+ - lib/arcp/session/bye.rb
175
+ - lib/arcp/session/capability_set.rb
176
+ - lib/arcp/session/feature.rb
177
+ - lib/arcp/session/hello.rb
178
+ - lib/arcp/session/jobs_response.rb
179
+ - lib/arcp/session/list_jobs.rb
180
+ - lib/arcp/session/ping.rb
181
+ - lib/arcp/session/pong.rb
182
+ - lib/arcp/session/session_error.rb
183
+ - lib/arcp/session/welcome.rb
184
+ - lib/arcp/trace.rb
185
+ - lib/arcp/transport.rb
186
+ - lib/arcp/transport/base.rb
187
+ - lib/arcp/transport/memory_transport.rb
188
+ - lib/arcp/transport/stdio_transport.rb
189
+ - lib/arcp/transport/websocket_transport.rb
190
+ - lib/arcp/version.rb
191
+ - sig/arcp.rbs
192
+ - sig/arcp/client.rbs
193
+ - sig/arcp/credential.rbs
194
+ - sig/arcp/envelope.rbs
195
+ - sig/arcp/errors.rbs
196
+ - sig/arcp/job.rbs
197
+ - sig/arcp/lease.rbs
198
+ - sig/arcp/runtime.rbs
199
+ - sig/arcp/serializer.rbs
200
+ - sig/arcp/session.rbs
201
+ - sig/arcp/transport.rbs
202
+ homepage: https://github.com/nficano/arpc
203
+ licenses:
204
+ - Apache-2.0
205
+ metadata:
206
+ changelog_uri: https://github.com/nficano/arpc/blob/main/ruby-sdk/CHANGELOG.md
207
+ source_code_uri: https://github.com/nficano/arpc.git
208
+ bug_tracker_uri: https://github.com/nficano/arpc/issues
209
+ rdoc_options: []
210
+ require_paths:
211
+ - lib
212
+ required_ruby_version: !ruby/object:Gem::Requirement
213
+ requirements:
214
+ - - ">="
215
+ - !ruby/object:Gem::Version
216
+ version: 3.3.0
217
+ required_rubygems_version: !ruby/object:Gem::Requirement
218
+ requirements:
219
+ - - ">="
220
+ - !ruby/object:Gem::Version
221
+ version: '0'
222
+ requirements: []
223
+ rubygems_version: 3.6.9
224
+ specification_version: 4
225
+ summary: Reference Ruby implementation of the Agent Runtime Control Protocol (ARCP).
226
+ test_files: []