copilot-sdk-supercharged 2.2.0 → 2.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.
- checksums.yaml +4 -4
- data/lib/copilot/client.rb +34 -1
- data/lib/copilot/json_rpc_client.rb +4 -2
- data/lib/copilot/sdk_protocol_version.rb +1 -1
- data/lib/copilot/session.rb +49 -0
- data/lib/copilot/types.rb +300 -11
- data/lib/copilot/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 392f8acf685d1aa8978a06e40ebd965ab0ca2a7420a7194a91d5b89f1468e925
|
|
4
|
+
data.tar.gz: 8b91a8a18f10a8bb5e0b85ffee7eabf309246b268303436741a3d87dceca28fe
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 333bb586d18fa374572905b4044cceef361659eba6b7be7dcbbfdc2c621fa9ac0ce400a6b64e28549ec6d84fbf8279fe93d30222d3ace4ae715d6aa6f33a154d
|
|
7
|
+
data.tar.gz: ffd63d77549c4e8e6d41cb242012a2af2eae8a01faecb773055cc158ce59386cdf68ad10315653bb3a9aad6dd1ed0e768d14b87a23785fb8e030545dbb38c16d
|
data/lib/copilot/client.rb
CHANGED
|
@@ -55,7 +55,8 @@ module Copilot
|
|
|
55
55
|
auto_restart: true,
|
|
56
56
|
env: nil,
|
|
57
57
|
github_token: nil,
|
|
58
|
-
use_logged_in_user: nil
|
|
58
|
+
use_logged_in_user: nil,
|
|
59
|
+
on_get_trace_context: nil
|
|
59
60
|
)
|
|
60
61
|
# Validate mutually exclusive options
|
|
61
62
|
if cli_url && (use_stdio == false || cli_path)
|
|
@@ -95,6 +96,7 @@ module Copilot
|
|
|
95
96
|
env: env,
|
|
96
97
|
github_token: github_token,
|
|
97
98
|
use_logged_in_user: use_logged_in_user,
|
|
99
|
+
on_get_trace_context: on_get_trace_context,
|
|
98
100
|
)
|
|
99
101
|
|
|
100
102
|
@process = nil
|
|
@@ -281,6 +283,10 @@ module Copilot
|
|
|
281
283
|
session._register_permission_handler(config[:on_permission_request]) if config[:on_permission_request]
|
|
282
284
|
session._register_user_input_handler(config[:on_user_input_request]) if config[:on_user_input_request]
|
|
283
285
|
session._register_hooks(config[:hooks]) if config[:hooks]
|
|
286
|
+
session._register_exit_plan_mode_handler(config[:on_exit_plan_mode]) if config[:on_exit_plan_mode]
|
|
287
|
+
if @options.on_get_trace_context
|
|
288
|
+
session._register_trace_context_provider(@options.on_get_trace_context)
|
|
289
|
+
end
|
|
284
290
|
|
|
285
291
|
@sessions_lock.synchronize { @sessions[session_id] = session }
|
|
286
292
|
session
|
|
@@ -305,6 +311,10 @@ module Copilot
|
|
|
305
311
|
session._register_permission_handler(config[:on_permission_request]) if config[:on_permission_request]
|
|
306
312
|
session._register_user_input_handler(config[:on_user_input_request]) if config[:on_user_input_request]
|
|
307
313
|
session._register_hooks(config[:hooks]) if config[:hooks]
|
|
314
|
+
session._register_exit_plan_mode_handler(config[:on_exit_plan_mode]) if config[:on_exit_plan_mode]
|
|
315
|
+
if @options.on_get_trace_context
|
|
316
|
+
session._register_trace_context_provider(@options.on_get_trace_context)
|
|
317
|
+
end
|
|
308
318
|
|
|
309
319
|
@sessions_lock.synchronize { @sessions[resumed_id] = session }
|
|
310
320
|
session
|
|
@@ -633,6 +643,10 @@ module Copilot
|
|
|
633
643
|
@rpc_client.on_request("hooks.invoke") do |params|
|
|
634
644
|
handle_hooks_invoke(params)
|
|
635
645
|
end
|
|
646
|
+
|
|
647
|
+
@rpc_client.on_request("exitPlanMode.request") do |params|
|
|
648
|
+
handle_exit_plan_mode_request(params)
|
|
649
|
+
end
|
|
636
650
|
end
|
|
637
651
|
|
|
638
652
|
def verify_protocol_version
|
|
@@ -769,6 +783,21 @@ module Copilot
|
|
|
769
783
|
{ output: output }
|
|
770
784
|
end
|
|
771
785
|
|
|
786
|
+
def handle_exit_plan_mode_request(params)
|
|
787
|
+
session_id = params["sessionId"]
|
|
788
|
+
raise "Invalid exit plan mode request payload" unless session_id
|
|
789
|
+
|
|
790
|
+
session = @sessions_lock.synchronize { @sessions[session_id] }
|
|
791
|
+
raise "Session not found: #{session_id}" unless session
|
|
792
|
+
|
|
793
|
+
begin
|
|
794
|
+
result = session._handle_exit_plan_mode_request(params)
|
|
795
|
+
result
|
|
796
|
+
rescue StandardError
|
|
797
|
+
{ approved: true }
|
|
798
|
+
end
|
|
799
|
+
end
|
|
800
|
+
|
|
772
801
|
# ---- Payload builders ----
|
|
773
802
|
|
|
774
803
|
def build_create_session_payload(config)
|
|
@@ -789,6 +818,7 @@ module Copilot
|
|
|
789
818
|
payload[:requestPermission] = true if config[:on_permission_request]
|
|
790
819
|
payload[:requestUserInput] = true if config[:on_user_input_request]
|
|
791
820
|
payload[:hooks] = true if config[:hooks]&.respond_to?(:any_handler?) && config[:hooks].any_handler?
|
|
821
|
+
payload[:requestExitPlanMode] = true if config[:on_exit_plan_mode]
|
|
792
822
|
payload[:workingDirectory] = config[:working_directory] if config[:working_directory]
|
|
793
823
|
payload[:streaming] = config[:streaming] unless config[:streaming].nil?
|
|
794
824
|
|
|
@@ -796,6 +826,9 @@ module Copilot
|
|
|
796
826
|
payload[:provider] = config[:provider].respond_to?(:to_wire) ? config[:provider].to_wire : config[:provider]
|
|
797
827
|
end
|
|
798
828
|
|
|
829
|
+
token = config[:auth_token] || config[:github_token] || config[:git_hub_token]
|
|
830
|
+
payload[:gitHubToken] = token if token
|
|
831
|
+
|
|
799
832
|
payload[:mcpServers] = config[:mcp_servers] if config[:mcp_servers]
|
|
800
833
|
|
|
801
834
|
if config[:custom_agents]
|
|
@@ -79,7 +79,8 @@ module Copilot
|
|
|
79
79
|
# @return [Object] the +result+ from the JSON-RPC response
|
|
80
80
|
# @raise [JsonRpcError] if the server returns an error
|
|
81
81
|
# @raise [Timeout::Error] if the request times out
|
|
82
|
-
def request(method, params = nil, timeout: 30)
|
|
82
|
+
def request(method, params = nil, timeout: 30, **kwargs)
|
|
83
|
+
params = kwargs if params.nil? && !kwargs.empty?
|
|
83
84
|
request_id = SecureRandom.uuid
|
|
84
85
|
queue = Queue.new
|
|
85
86
|
|
|
@@ -126,7 +127,8 @@ module Copilot
|
|
|
126
127
|
#
|
|
127
128
|
# @param method [String] the RPC method name
|
|
128
129
|
# @param params [Hash, nil] optional parameters
|
|
129
|
-
def notify(method, params = nil)
|
|
130
|
+
def notify(method, params = nil, **kwargs)
|
|
131
|
+
params = kwargs if params.nil? && !kwargs.empty?
|
|
130
132
|
send_message({
|
|
131
133
|
jsonrpc: "2.0",
|
|
132
134
|
method: method,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
module Copilot
|
|
8
8
|
# The SDK protocol version.
|
|
9
9
|
# This must match the version expected by the copilot-agent-runtime server.
|
|
10
|
-
SDK_PROTOCOL_VERSION =
|
|
10
|
+
SDK_PROTOCOL_VERSION = 3
|
|
11
11
|
|
|
12
12
|
# @return [Integer] the SDK protocol version number
|
|
13
13
|
def self.sdk_protocol_version
|
data/lib/copilot/session.rb
CHANGED
|
@@ -53,6 +53,11 @@ module Copilot
|
|
|
53
53
|
|
|
54
54
|
@hooks = nil
|
|
55
55
|
@hooks_lock = Mutex.new
|
|
56
|
+
|
|
57
|
+
@exit_plan_mode_handler = nil
|
|
58
|
+
@exit_plan_mode_handler_lock = Mutex.new
|
|
59
|
+
|
|
60
|
+
@trace_context_provider = nil
|
|
56
61
|
end
|
|
57
62
|
|
|
58
63
|
# Send a message to this session.
|
|
@@ -69,6 +74,22 @@ module Copilot
|
|
|
69
74
|
payload[:mode] = mode if mode
|
|
70
75
|
payload[:responseFormat] = response_format if response_format
|
|
71
76
|
payload[:imageOptions] = image_options.to_h if image_options
|
|
77
|
+
|
|
78
|
+
# Inject trace context if provider is available
|
|
79
|
+
if @trace_context_provider
|
|
80
|
+
begin
|
|
81
|
+
tc = @trace_context_provider.call
|
|
82
|
+
if tc
|
|
83
|
+
tp = tc.respond_to?(:traceparent) ? tc.traceparent : tc[:traceparent]
|
|
84
|
+
ts = tc.respond_to?(:tracestate) ? tc.tracestate : tc[:tracestate]
|
|
85
|
+
payload[:traceparent] = tp if tp
|
|
86
|
+
payload[:tracestate] = ts if ts
|
|
87
|
+
end
|
|
88
|
+
rescue StandardError
|
|
89
|
+
# ignore trace context errors
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
72
93
|
response = @rpc_client.request("session.send", payload)
|
|
73
94
|
response["messageId"]
|
|
74
95
|
end
|
|
@@ -202,6 +223,8 @@ module Copilot
|
|
|
202
223
|
@permission_handler_lock.synchronize { @permission_handler = nil }
|
|
203
224
|
@user_input_handler_lock.synchronize { @user_input_handler = nil }
|
|
204
225
|
@hooks_lock.synchronize { @hooks = nil }
|
|
226
|
+
@exit_plan_mode_handler_lock.synchronize { @exit_plan_mode_handler = nil }
|
|
227
|
+
@trace_context_provider = nil
|
|
205
228
|
end
|
|
206
229
|
|
|
207
230
|
# Abort the currently processing message.
|
|
@@ -286,6 +309,32 @@ module Copilot
|
|
|
286
309
|
@hooks_lock.synchronize { @hooks = hooks }
|
|
287
310
|
end
|
|
288
311
|
|
|
312
|
+
# @api private
|
|
313
|
+
def _register_exit_plan_mode_handler(handler)
|
|
314
|
+
@exit_plan_mode_handler_lock.synchronize { @exit_plan_mode_handler = handler }
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
# @api private
|
|
318
|
+
def _handle_exit_plan_mode_request(params)
|
|
319
|
+
handler = @exit_plan_mode_handler_lock.synchronize { @exit_plan_mode_handler }
|
|
320
|
+
unless handler
|
|
321
|
+
return { approved: true }
|
|
322
|
+
end
|
|
323
|
+
|
|
324
|
+
begin
|
|
325
|
+
request = ExitPlanModeRequest.from_hash(params)
|
|
326
|
+
result = handler.call(request)
|
|
327
|
+
result.is_a?(ExitPlanModeResponse) ? result.to_h : result
|
|
328
|
+
rescue StandardError
|
|
329
|
+
{ approved: true }
|
|
330
|
+
end
|
|
331
|
+
end
|
|
332
|
+
|
|
333
|
+
# @api private
|
|
334
|
+
def _register_trace_context_provider(provider)
|
|
335
|
+
@trace_context_provider = provider
|
|
336
|
+
end
|
|
337
|
+
|
|
289
338
|
# @api private
|
|
290
339
|
def _handle_hooks_invoke(hook_type, input_data)
|
|
291
340
|
hooks = @hooks_lock.synchronize { @hooks }
|
data/lib/copilot/types.rb
CHANGED
|
@@ -75,6 +75,132 @@ module Copilot
|
|
|
75
75
|
end
|
|
76
76
|
end
|
|
77
77
|
|
|
78
|
+
# An action exposed by a canvas.
|
|
79
|
+
CanvasAction = Struct.new(:name, :description, :input_schema, keyword_init: true) do
|
|
80
|
+
def to_h
|
|
81
|
+
h = { name: name, description: description }
|
|
82
|
+
h[:inputSchema] = input_schema unless input_schema.nil?
|
|
83
|
+
h
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# Declarative metadata for a canvas.
|
|
88
|
+
CanvasDeclaration = Struct.new(
|
|
89
|
+
:id, :display_name, :description, :input_schema, :actions,
|
|
90
|
+
keyword_init: true
|
|
91
|
+
) do
|
|
92
|
+
def to_h
|
|
93
|
+
h = { id: id, displayName: display_name, description: description }
|
|
94
|
+
h[:inputSchema] = input_schema unless input_schema.nil?
|
|
95
|
+
h[:actions] = actions.map { |action| action.respond_to?(:to_h) ? action.to_h : action } unless actions.nil?
|
|
96
|
+
h
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Response returned when opening a canvas.
|
|
101
|
+
CanvasOpenResponse = Struct.new(:url, :title, :status, keyword_init: true) do
|
|
102
|
+
def to_h
|
|
103
|
+
h = {}
|
|
104
|
+
h[:url] = url if url
|
|
105
|
+
h[:title] = title if title
|
|
106
|
+
h[:status] = status if status
|
|
107
|
+
h
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
# Host capabilities passed to canvas callbacks.
|
|
112
|
+
CanvasHostCapabilities = Struct.new(:canvases, keyword_init: true) do
|
|
113
|
+
def self.from_hash(h)
|
|
114
|
+
h ||= {}
|
|
115
|
+
new(canvases: h.fetch("canvases", false))
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def to_h
|
|
119
|
+
{ canvases: !!canvases }
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Host context passed to canvas callbacks.
|
|
124
|
+
CanvasHostContext = Struct.new(:capabilities, keyword_init: true) do
|
|
125
|
+
def self.from_hash(h)
|
|
126
|
+
h ||= {}
|
|
127
|
+
new(capabilities: CanvasHostCapabilities.from_hash(h["capabilities"]))
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def to_h
|
|
131
|
+
{ capabilities: (capabilities || CanvasHostCapabilities.new(canvases: false)).to_h }
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Context provided when a canvas is opened.
|
|
136
|
+
CanvasOpenContext = Struct.new(
|
|
137
|
+
:session_id, :extension_id, :canvas_id, :instance_id, :input, :host,
|
|
138
|
+
keyword_init: true
|
|
139
|
+
) do
|
|
140
|
+
def self.from_hash(h)
|
|
141
|
+
new(
|
|
142
|
+
session_id: h["sessionId"],
|
|
143
|
+
extension_id: h["extensionId"],
|
|
144
|
+
canvas_id: h["canvasId"],
|
|
145
|
+
instance_id: h["instanceId"],
|
|
146
|
+
input: h["input"],
|
|
147
|
+
host: h["host"] && CanvasHostContext.from_hash(h["host"])
|
|
148
|
+
)
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# Context provided when a canvas action is invoked.
|
|
153
|
+
CanvasActionContext = Struct.new(
|
|
154
|
+
:session_id, :extension_id, :canvas_id, :instance_id, :action_name, :input, :host,
|
|
155
|
+
keyword_init: true
|
|
156
|
+
) do
|
|
157
|
+
def self.from_hash(h)
|
|
158
|
+
new(
|
|
159
|
+
session_id: h["sessionId"],
|
|
160
|
+
extension_id: h["extensionId"],
|
|
161
|
+
canvas_id: h["canvasId"],
|
|
162
|
+
instance_id: h["instanceId"],
|
|
163
|
+
action_name: h["actionName"],
|
|
164
|
+
input: h["input"],
|
|
165
|
+
host: h["host"] && CanvasHostContext.from_hash(h["host"])
|
|
166
|
+
)
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
# Context provided for canvas lifecycle events.
|
|
171
|
+
CanvasLifecycleContext = Struct.new(
|
|
172
|
+
:session_id, :extension_id, :canvas_id, :instance_id, :host,
|
|
173
|
+
keyword_init: true
|
|
174
|
+
) do
|
|
175
|
+
def self.from_hash(h)
|
|
176
|
+
new(
|
|
177
|
+
session_id: h["sessionId"],
|
|
178
|
+
extension_id: h["extensionId"],
|
|
179
|
+
canvas_id: h["canvasId"],
|
|
180
|
+
instance_id: h["instanceId"],
|
|
181
|
+
host: h["host"] && CanvasHostContext.from_hash(h["host"])
|
|
182
|
+
)
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
# GitHub repository metadata associated with a cloud session.
|
|
187
|
+
CloudSessionRepository = Struct.new(:owner, :name, :branch, keyword_init: true) do
|
|
188
|
+
def to_h
|
|
189
|
+
h = { owner: owner, name: name }
|
|
190
|
+
h[:branch] = branch if branch
|
|
191
|
+
h
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
# Cloud-session creation options.
|
|
196
|
+
CloudSessionOptions = Struct.new(:repository, keyword_init: true) do
|
|
197
|
+
def to_h
|
|
198
|
+
h = {}
|
|
199
|
+
h[:repository] = repository.respond_to?(:to_h) ? repository.to_h : repository if repository
|
|
200
|
+
h
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
|
|
78
204
|
# System message in append mode (default).
|
|
79
205
|
SystemMessageAppendConfig = Struct.new(:mode, :content, keyword_init: true) do
|
|
80
206
|
def to_h
|
|
@@ -103,21 +229,23 @@ module Copilot
|
|
|
103
229
|
SAFETY = "safety"
|
|
104
230
|
TOOL_INSTRUCTIONS = "tool_instructions"
|
|
105
231
|
CUSTOM_INSTRUCTIONS = "custom_instructions"
|
|
232
|
+
RUNTIME_INSTRUCTIONS = "runtime_instructions"
|
|
106
233
|
LAST_INSTRUCTIONS = "last_instructions"
|
|
107
234
|
end
|
|
108
235
|
|
|
109
236
|
# Override action for a system prompt section.
|
|
110
237
|
module SectionOverrideAction
|
|
111
|
-
REPLACE
|
|
112
|
-
REMOVE
|
|
113
|
-
APPEND
|
|
114
|
-
PREPEND
|
|
238
|
+
REPLACE = "replace"
|
|
239
|
+
REMOVE = "remove"
|
|
240
|
+
APPEND = "append"
|
|
241
|
+
PREPEND = "prepend"
|
|
242
|
+
TRANSFORM = "transform"
|
|
115
243
|
end
|
|
116
244
|
|
|
117
245
|
# Override operation for a single system prompt section.
|
|
118
|
-
SectionOverride = Struct.new(:action, :content, keyword_init: true) do
|
|
246
|
+
SectionOverride = Struct.new(:action, :content, :transform, keyword_init: true) do
|
|
119
247
|
def to_h
|
|
120
|
-
h = { action: action }
|
|
248
|
+
h = { action: transform ? SectionOverrideAction::TRANSFORM : action }
|
|
121
249
|
h[:content] = content if content
|
|
122
250
|
h
|
|
123
251
|
end
|
|
@@ -262,6 +390,69 @@ module Copilot
|
|
|
262
390
|
end
|
|
263
391
|
end
|
|
264
392
|
|
|
393
|
+
# Slash command input completion constants.
|
|
394
|
+
# Valid values: "directory"
|
|
395
|
+
module SlashCommandInputCompletion
|
|
396
|
+
DIRECTORY = "directory"
|
|
397
|
+
end
|
|
398
|
+
|
|
399
|
+
# Slash command kind constants.
|
|
400
|
+
# Valid values: "builtin", "client", "skill"
|
|
401
|
+
module SlashCommandKind
|
|
402
|
+
BUILTIN = "builtin"
|
|
403
|
+
CLIENT = "client"
|
|
404
|
+
SKILL = "skill"
|
|
405
|
+
end
|
|
406
|
+
|
|
407
|
+
# Input configuration for a slash command.
|
|
408
|
+
SlashCommandInput = Struct.new(:hint, :completion, keyword_init: true) do
|
|
409
|
+
def to_h
|
|
410
|
+
h = { hint: hint }
|
|
411
|
+
h[:completion] = completion if completion
|
|
412
|
+
h
|
|
413
|
+
end
|
|
414
|
+
end
|
|
415
|
+
|
|
416
|
+
# Information about a slash command.
|
|
417
|
+
SlashCommandInfo = Struct.new(
|
|
418
|
+
:allow_during_agent_execution, :description, :kind, :name,
|
|
419
|
+
:aliases, :experimental, :input,
|
|
420
|
+
keyword_init: true
|
|
421
|
+
) do
|
|
422
|
+
def to_h
|
|
423
|
+
h = {
|
|
424
|
+
allowDuringAgentExecution: allow_during_agent_execution,
|
|
425
|
+
description: description,
|
|
426
|
+
kind: kind,
|
|
427
|
+
name: name,
|
|
428
|
+
}
|
|
429
|
+
h[:aliases] = aliases if aliases
|
|
430
|
+
h[:experimental] = experimental unless experimental.nil?
|
|
431
|
+
h[:input] = input.to_h if input
|
|
432
|
+
h
|
|
433
|
+
end
|
|
434
|
+
end
|
|
435
|
+
|
|
436
|
+
# Request to invoke a command.
|
|
437
|
+
CommandsInvokeRequest = Struct.new(:name, :input, keyword_init: true) do
|
|
438
|
+
def to_h
|
|
439
|
+
h = { name: name }
|
|
440
|
+
h[:input] = input if input
|
|
441
|
+
h
|
|
442
|
+
end
|
|
443
|
+
end
|
|
444
|
+
|
|
445
|
+
# Request to list available commands.
|
|
446
|
+
CommandsListRequest = Struct.new(:include_builtins, :include_client_commands, :include_skills, keyword_init: true) do
|
|
447
|
+
def to_h
|
|
448
|
+
h = {}
|
|
449
|
+
h[:includeBuiltins] = include_builtins unless include_builtins.nil?
|
|
450
|
+
h[:includeClientCommands] = include_client_commands unless include_client_commands.nil?
|
|
451
|
+
h[:includeSkills] = include_skills unless include_skills.nil?
|
|
452
|
+
h
|
|
453
|
+
end
|
|
454
|
+
end
|
|
455
|
+
|
|
265
456
|
# Context for a slash-command invocation.
|
|
266
457
|
CommandContext = Struct.new(:session_id, :command, :command_name, :args, keyword_init: true)
|
|
267
458
|
|
|
@@ -278,6 +469,30 @@ module Copilot
|
|
|
278
469
|
# Result returned from an elicitation handler.
|
|
279
470
|
ElicitationResult = Struct.new(:action, :content, keyword_init: true)
|
|
280
471
|
|
|
472
|
+
# Exit plan mode request from the server.
|
|
473
|
+
ExitPlanModeRequest = Struct.new(:session_id, keyword_init: true) do
|
|
474
|
+
def self.from_hash(h)
|
|
475
|
+
new(session_id: h["sessionId"])
|
|
476
|
+
end
|
|
477
|
+
end
|
|
478
|
+
|
|
479
|
+
# Exit plan mode response.
|
|
480
|
+
ExitPlanModeResponse = Struct.new(:approved, keyword_init: true) do
|
|
481
|
+
def to_h
|
|
482
|
+
{ approved: approved }
|
|
483
|
+
end
|
|
484
|
+
end
|
|
485
|
+
|
|
486
|
+
# Trace context for distributed tracing.
|
|
487
|
+
TraceContext = Struct.new(:traceparent, :tracestate, keyword_init: true) do
|
|
488
|
+
def to_h
|
|
489
|
+
h = {}
|
|
490
|
+
h[:traceparent] = traceparent if traceparent
|
|
491
|
+
h[:tracestate] = tracestate if tracestate
|
|
492
|
+
h
|
|
493
|
+
end
|
|
494
|
+
end
|
|
495
|
+
|
|
281
496
|
# Configuration for creating a session.
|
|
282
497
|
SessionConfig = Struct.new(
|
|
283
498
|
:session_id, :model, :reasoning_effort, :config_dir,
|
|
@@ -288,7 +503,7 @@ module Copilot
|
|
|
288
503
|
:skill_directories, :disabled_skills, :infinite_sessions,
|
|
289
504
|
:model_capabilities, :enable_config_discovery,
|
|
290
505
|
:github_token,
|
|
291
|
-
:commands, :on_elicitation_request,
|
|
506
|
+
:commands, :on_elicitation_request, :on_exit_plan_mode,
|
|
292
507
|
:instruction_directories,
|
|
293
508
|
keyword_init: true
|
|
294
509
|
)
|
|
@@ -303,14 +518,20 @@ module Copilot
|
|
|
303
518
|
:skill_directories, :disabled_skills, :infinite_sessions,
|
|
304
519
|
:model_capabilities, :enable_config_discovery,
|
|
305
520
|
:github_token,
|
|
306
|
-
:commands, :on_elicitation_request,
|
|
521
|
+
:commands, :on_elicitation_request, :on_exit_plan_mode,
|
|
307
522
|
:instruction_directories,
|
|
308
523
|
:disable_resume,
|
|
309
524
|
keyword_init: true
|
|
310
525
|
)
|
|
311
526
|
|
|
312
527
|
# Response format for message responses.
|
|
313
|
-
|
|
528
|
+
module ResponseFormat
|
|
529
|
+
TEXT = "text"
|
|
530
|
+
IMAGE = "image"
|
|
531
|
+
JSON_OBJECT = "json_object"
|
|
532
|
+
end
|
|
533
|
+
|
|
534
|
+
RESPONSE_FORMATS = [ResponseFormat::TEXT, ResponseFormat::IMAGE, ResponseFormat::JSON_OBJECT].freeze
|
|
314
535
|
|
|
315
536
|
# Options for image generation.
|
|
316
537
|
ImageOptions = Struct.new(:size, :quality, :style, keyword_init: true) do
|
|
@@ -414,10 +635,38 @@ module Copilot
|
|
|
414
635
|
end
|
|
415
636
|
end
|
|
416
637
|
|
|
638
|
+
# Model billing token prices.
|
|
639
|
+
ModelBillingTokenPrices = Struct.new(
|
|
640
|
+
:batch_size, :cache_price, :input_price, :output_price,
|
|
641
|
+
keyword_init: true
|
|
642
|
+
) do
|
|
643
|
+
def self.from_hash(h)
|
|
644
|
+
new(
|
|
645
|
+
batch_size: h["batchSize"],
|
|
646
|
+
cache_price: h["cachePrice"],
|
|
647
|
+
input_price: h["inputPrice"],
|
|
648
|
+
output_price: h["outputPrice"]
|
|
649
|
+
)
|
|
650
|
+
end
|
|
651
|
+
end
|
|
652
|
+
|
|
653
|
+
# Model picker price category constants.
|
|
654
|
+
# Valid values: "high", "low", "medium", "very_high"
|
|
655
|
+
module ModelPickerPriceCategory
|
|
656
|
+
HIGH = "high"
|
|
657
|
+
LOW = "low"
|
|
658
|
+
MEDIUM = "medium"
|
|
659
|
+
VERY_HIGH = "very_high"
|
|
660
|
+
end
|
|
661
|
+
|
|
417
662
|
# Model billing information.
|
|
418
|
-
ModelBilling = Struct.new(:multiplier, keyword_init: true) do
|
|
663
|
+
ModelBilling = Struct.new(:multiplier, :token_prices, :picker_price_category, keyword_init: true) do
|
|
419
664
|
def self.from_hash(h)
|
|
420
|
-
new(
|
|
665
|
+
new(
|
|
666
|
+
multiplier: h["multiplier"],
|
|
667
|
+
token_prices: h["tokenPrices"] ? ModelBillingTokenPrices.from_hash(h["tokenPrices"]) : nil,
|
|
668
|
+
picker_price_category: h["pickerPriceCategory"]
|
|
669
|
+
)
|
|
421
670
|
end
|
|
422
671
|
end
|
|
423
672
|
|
|
@@ -544,6 +793,45 @@ module Copilot
|
|
|
544
793
|
end
|
|
545
794
|
end
|
|
546
795
|
|
|
796
|
+
# Experimental
|
|
797
|
+
# Diagnostics from loading skills.
|
|
798
|
+
SkillsLoadDiagnostics = Struct.new(:errors, :warnings, keyword_init: true) do
|
|
799
|
+
def self.from_hash(h)
|
|
800
|
+
new(
|
|
801
|
+
errors: h["errors"] || [],
|
|
802
|
+
warnings: h["warnings"] || []
|
|
803
|
+
)
|
|
804
|
+
end
|
|
805
|
+
end
|
|
806
|
+
|
|
807
|
+
# Per-session remote mode.
|
|
808
|
+
# "off" disables remote, "export" exports session events to Mission Control
|
|
809
|
+
# without enabling remote steering, "on" enables both export and remote steering.
|
|
810
|
+
module RemoteSessionMode
|
|
811
|
+
EXPORT = "export"
|
|
812
|
+
OFF = "off"
|
|
813
|
+
ON = "on"
|
|
814
|
+
end
|
|
815
|
+
|
|
816
|
+
# Experimental
|
|
817
|
+
# Request to enable remote mode for a session.
|
|
818
|
+
RemoteEnableRequest = Struct.new(:mode, keyword_init: true) do
|
|
819
|
+
def self.from_hash(h)
|
|
820
|
+
new(mode: h["mode"])
|
|
821
|
+
end
|
|
822
|
+
end
|
|
823
|
+
|
|
824
|
+
# Experimental
|
|
825
|
+
# Result of enabling remote mode for a session.
|
|
826
|
+
RemoteEnableResult = Struct.new(:remote_steerable, :url, keyword_init: true) do
|
|
827
|
+
def self.from_hash(h)
|
|
828
|
+
new(
|
|
829
|
+
remote_steerable: h["remoteSteerable"],
|
|
830
|
+
url: h["url"]
|
|
831
|
+
)
|
|
832
|
+
end
|
|
833
|
+
end
|
|
834
|
+
|
|
547
835
|
# Foreground session info (TUI+server mode).
|
|
548
836
|
ForegroundSessionInfo = Struct.new(:session_id, :workspace_path, keyword_init: true)
|
|
549
837
|
|
|
@@ -596,6 +884,7 @@ module Copilot
|
|
|
596
884
|
:github_token, :use_logged_in_user, :session_idle_timeout_seconds,
|
|
597
885
|
:session_fs,
|
|
598
886
|
:copilot_home, :tcp_connection_token,
|
|
887
|
+
:on_get_trace_context,
|
|
599
888
|
keyword_init: true
|
|
600
889
|
)
|
|
601
890
|
end
|
data/lib/copilot/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: copilot-sdk-supercharged
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jeremiah Isaacson
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-05-
|
|
11
|
+
date: 2026-05-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: |
|
|
14
14
|
A Ruby SDK for interacting with the GitHub Copilot CLI server via JSON-RPC 2.0.
|