copilot-sdk-supercharged 1.0.14 → 2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ed56f2facb108cac8435418675fbd54c967be07a9efc4f863764aba536fb417
4
- data.tar.gz: c70d0bc764352309c987bc23061f63364f3983c59b5b1f2da8b5d8a47195d93f
3
+ metadata.gz: ac265973156bd106fe6625fb7aff8c3be3ce02578e28413900b958381c366315
4
+ data.tar.gz: d463146e751af0d4e57254761d308f9c52f56ff41ef6607124b2fb5eb58f3fb9
5
5
  SHA512:
6
- metadata.gz: d04ba41f5f45220e114461c9d8b74521b0554813124ed6b9dffa55b7b04bfa9ce1358e2c58182a1855eae4618b5075d5e817c955c274bcaa87b9f189dc10f050
7
- data.tar.gz: 11e852c1f8e2b5d141821bf7c30cf493c64618ce302fc884402b9867d7376c9706a5d3fa387073acfe2e8ae107be398ab4dde21897995e36acc9bec3a5024abc
6
+ metadata.gz: aeb633fd58ca1526dd2e1d17efd570ecabc4482b7fbb224c04b5481dcd35257121147a2af1c1a7bf4a7228381abc76d35346bc3f03f1021c9e04c4ac40f703f7
7
+ data.tar.gz: 0d56cb6866c59504cbd6a00af8bb36267f20bc7390eaa8e7774b9cd193756865fdc27ef73ec29fc54a8780261c808aee34131f365a1034ea866b1e2f11bd282f
data/README.md CHANGED
@@ -296,6 +296,20 @@ The SDK uses a background reader thread for the JSON-RPC connection. Event handl
296
296
 
297
297
  The `send_and_wait` method uses a `Mutex` + `ConditionVariable` to block the calling thread until the session becomes idle, which is the recommended pattern for synchronous usage.
298
298
 
299
+ ## Image Generation
300
+
301
+ Request image responses using `response_format` and `image_options`:
302
+
303
+ ```ruby
304
+ response = session.send_and_wait(
305
+ prompt: "Generate a sunset over mountains",
306
+ response_format: "image",
307
+ image_options: Copilot::ImageOptions.new(
308
+ size: "1024x1024", quality: "hd", style: "natural"
309
+ )
310
+ )
311
+ ```
312
+
299
313
  ## License
300
314
 
301
315
  MIT - see [LICENSE](../LICENSE) for details.
@@ -57,14 +57,18 @@ module Copilot
57
57
 
58
58
  # Send a message to this session.
59
59
  #
60
- # @param prompt [String] the message text
61
- # @param attachments [Array, nil] optional file/directory/selection attachments
62
- # @param mode [String, nil] "enqueue" (default) or "immediate"
60
+ # @param prompt [String] the message text
61
+ # @param attachments [Array, nil] optional file/directory/selection attachments
62
+ # @param mode [String, nil] "enqueue" (default) or "immediate"
63
+ # @param response_format [String, nil] desired response format ("text", "image", "json_object")
64
+ # @param image_options [ImageOptions, nil] options for image generation
63
65
  # @return [String] the message ID
64
- def send(prompt:, attachments: nil, mode: nil)
66
+ def send(prompt:, attachments: nil, mode: nil, response_format: nil, image_options: nil)
65
67
  payload = { sessionId: @session_id, prompt: prompt }
66
68
  payload[:attachments] = attachments if attachments
67
69
  payload[:mode] = mode if mode
70
+ payload[:responseFormat] = response_format if response_format
71
+ payload[:imageOptions] = image_options.to_h if image_options
68
72
  response = @rpc_client.request("session.send", payload)
69
73
  response["messageId"]
70
74
  end
@@ -74,14 +78,16 @@ module Copilot
74
78
  # This is a convenience method that combines {#send} with waiting for
75
79
  # the +session.idle+ event.
76
80
  #
77
- # @param prompt [String] the message text
78
- # @param attachments [Array, nil] optional attachments
79
- # @param mode [String, nil] delivery mode
80
- # @param timeout [Numeric] seconds to wait (default 60)
81
+ # @param prompt [String] the message text
82
+ # @param attachments [Array, nil] optional attachments
83
+ # @param mode [String, nil] delivery mode
84
+ # @param response_format [String, nil] desired response format ("text", "image", "json_object")
85
+ # @param image_options [ImageOptions, nil] options for image generation
86
+ # @param timeout [Numeric] seconds to wait (default 60)
81
87
  # @return [SessionEvent, nil] the final assistant.message event, or nil
82
88
  # @raise [Timeout::Error] if the timeout expires before session.idle
83
89
  # @raise [RuntimeError] if the session emits a session.error event
84
- def send_and_wait(prompt:, attachments: nil, mode: nil, timeout: 60)
90
+ def send_and_wait(prompt:, attachments: nil, mode: nil, response_format: nil, image_options: nil, timeout: 60)
85
91
  idle_mutex = Mutex.new
86
92
  idle_cv = ConditionVariable.new
87
93
  idle_fired = false
@@ -111,7 +117,8 @@ module Copilot
111
117
  end
112
118
 
113
119
  begin
114
- self.send(prompt: prompt, attachments: attachments, mode: mode)
120
+ self.send(prompt: prompt, attachments: attachments, mode: mode,
121
+ response_format: response_format, image_options: image_options)
115
122
 
116
123
  idle_mutex.synchronize do
117
124
  unless idle_fired
@@ -177,6 +184,13 @@ module Copilot
177
184
  events.map { |e| SessionEvent.from_hash(e) }
178
185
  end
179
186
 
187
+ # Retrieve metadata for this session.
188
+ #
189
+ # @return [Hash] the session metadata
190
+ def get_metadata
191
+ @rpc_client.request("session.getMetadata", { sessionId: @session_id })
192
+ end
193
+
180
194
  # Destroy this session and release associated resources.
181
195
  def destroy
182
196
  @rpc_client.request("session.destroy", { sessionId: @session_id })
data/lib/copilot/types.rb CHANGED
@@ -92,6 +92,49 @@ module Copilot
92
92
  end
93
93
  end
94
94
 
95
+ # Known system prompt section identifiers for "customize" mode.
96
+ module SystemPromptSection
97
+ IDENTITY = "identity"
98
+ TONE = "tone"
99
+ TOOL_EFFICIENCY = "tool_efficiency"
100
+ ENVIRONMENT_CONTEXT = "environment_context"
101
+ CODE_CHANGE_RULES = "code_change_rules"
102
+ GUIDELINES = "guidelines"
103
+ SAFETY = "safety"
104
+ TOOL_INSTRUCTIONS = "tool_instructions"
105
+ CUSTOM_INSTRUCTIONS = "custom_instructions"
106
+ LAST_INSTRUCTIONS = "last_instructions"
107
+ end
108
+
109
+ # Override action for a system prompt section.
110
+ module SectionOverrideAction
111
+ REPLACE = "replace"
112
+ REMOVE = "remove"
113
+ APPEND = "append"
114
+ PREPEND = "prepend"
115
+ end
116
+
117
+ # Override operation for a single system prompt section.
118
+ SectionOverride = Struct.new(:action, :content, keyword_init: true) do
119
+ def to_h
120
+ h = { action: action }
121
+ h[:content] = content if content
122
+ h
123
+ end
124
+ end
125
+
126
+ # System message in customize mode - section-level overrides.
127
+ SystemMessageCustomizeConfig = Struct.new(:sections, :content, keyword_init: true) do
128
+ def to_h
129
+ h = { mode: "customize" }
130
+ if sections
131
+ h[:sections] = sections.transform_values(&:to_h)
132
+ end
133
+ h[:content] = content if content
134
+ h
135
+ end
136
+ end
137
+
95
138
  # Permission request from the server.
96
139
  PermissionRequest = Struct.new(:kind, :tool_call_id, :extra, keyword_init: true) do
97
140
  def self.from_hash(h)
@@ -190,6 +233,7 @@ module Copilot
190
233
  # Custom agent configuration.
191
234
  CustomAgentConfig = Struct.new(
192
235
  :name, :display_name, :description, :tools, :prompt, :mcp_servers, :infer,
236
+ :skills,
193
237
  keyword_init: true
194
238
  ) do
195
239
  def to_wire
@@ -199,6 +243,7 @@ module Copilot
199
243
  h[:tools] = tools if tools
200
244
  h[:mcpServers] = mcp_servers if mcp_servers
201
245
  h[:infer] = infer unless infer.nil?
246
+ h[:skills] = skills if skills
202
247
  h
203
248
  end
204
249
  end
@@ -217,13 +262,33 @@ module Copilot
217
262
  end
218
263
  end
219
264
 
265
+ # Context for a slash-command invocation.
266
+ CommandContext = Struct.new(:session_id, :command, :command_name, :args, keyword_init: true)
267
+
268
+ # Definition of a slash command registered with the session.
269
+ # handler is a callable (Proc/lambda) that receives a CommandContext.
270
+ CommandDefinition = Struct.new(:name, :description, :handler, keyword_init: true)
271
+
272
+ # Context for an elicitation request from the server.
273
+ ElicitationContext = Struct.new(
274
+ :session_id, :message, :requested_schema, :mode, :elicitation_source, :url,
275
+ keyword_init: true
276
+ )
277
+
278
+ # Result returned from an elicitation handler.
279
+ ElicitationResult = Struct.new(:action, :content, keyword_init: true)
280
+
220
281
  # Configuration for creating a session.
221
282
  SessionConfig = Struct.new(
222
283
  :session_id, :model, :reasoning_effort, :config_dir,
223
284
  :tools, :system_message, :available_tools, :excluded_tools,
224
285
  :provider, :on_permission_request, :on_user_input_request, :hooks,
225
- :working_directory, :streaming, :mcp_servers, :custom_agents,
286
+ :working_directory, :streaming, :include_sub_agent_streaming_events,
287
+ :mcp_servers, :custom_agents,
226
288
  :skill_directories, :disabled_skills, :infinite_sessions,
289
+ :model_capabilities, :enable_config_discovery,
290
+ :github_token,
291
+ :commands, :on_elicitation_request,
227
292
  keyword_init: true
228
293
  )
229
294
 
@@ -232,14 +297,34 @@ module Copilot
232
297
  :model, :reasoning_effort, :config_dir,
233
298
  :tools, :system_message, :available_tools, :excluded_tools,
234
299
  :provider, :on_permission_request, :on_user_input_request, :hooks,
235
- :working_directory, :streaming, :mcp_servers, :custom_agents,
300
+ :working_directory, :streaming, :include_sub_agent_streaming_events,
301
+ :mcp_servers, :custom_agents,
236
302
  :skill_directories, :disabled_skills, :infinite_sessions,
303
+ :model_capabilities, :enable_config_discovery,
304
+ :github_token,
305
+ :commands, :on_elicitation_request,
237
306
  :disable_resume,
238
307
  keyword_init: true
239
308
  )
240
309
 
310
+ # Response format for message responses.
311
+ RESPONSE_FORMATS = %w[text image json_object].freeze
312
+
313
+ # Options for image generation.
314
+ ImageOptions = Struct.new(:size, :quality, :style, keyword_init: true) do
315
+ def to_h
316
+ super.compact
317
+ end
318
+ end
319
+
320
+ # Image data from an assistant image response.
321
+ AssistantImageData = Struct.new(:format, :base64, :url, :revised_prompt, :width, :height, keyword_init: true)
322
+
323
+ # A content block in a mixed text+image response.
324
+ ContentBlock = Struct.new(:type, :text, :image, keyword_init: true)
325
+
241
326
  # Options for sending a message.
242
- MessageOptions = Struct.new(:prompt, :attachments, :mode, keyword_init: true)
327
+ MessageOptions = Struct.new(:prompt, :attachments, :mode, :response_format, :image_options, :request_headers, keyword_init: true)
243
328
 
244
329
  # Ping response from the server.
245
330
  PingResponse = Struct.new(:message, :timestamp, :protocol_version, keyword_init: true) do
@@ -474,11 +559,39 @@ module Copilot
474
559
  end
475
560
  end
476
561
 
562
+ # Configuration for a custom session filesystem provider.
563
+ SessionFsConfig = Struct.new(
564
+ :initial_cwd, :session_state_path, :conventions,
565
+ keyword_init: true
566
+ )
567
+
568
+ # File metadata returned by session filesystem operations.
569
+ SessionFsFileInfo = Struct.new(
570
+ :name, :size, :is_directory, :is_file, :created_at, :modified_at,
571
+ keyword_init: true
572
+ )
573
+
574
+ # Interface for session filesystem providers.
575
+ # Implementors should include this module and define all methods.
576
+ module SessionFsProvider
577
+ def read_file(session_id, path) raise NotImplementedError end
578
+ def write_file(session_id, path, content) raise NotImplementedError end
579
+ def append_file(session_id, path, content) raise NotImplementedError end
580
+ def exists?(session_id, path) raise NotImplementedError end
581
+ def stat(session_id, path) raise NotImplementedError end
582
+ def mkdir(session_id, path, recursive: false) raise NotImplementedError end
583
+ def readdir(session_id, path) raise NotImplementedError end
584
+ def readdir_with_types(session_id, path) raise NotImplementedError end
585
+ def rm(session_id, path, recursive: false) raise NotImplementedError end
586
+ def rename(session_id, old_path, new_path) raise NotImplementedError end
587
+ end
588
+
477
589
  # Client options.
478
590
  ClientOptions = Struct.new(
479
591
  :cli_path, :cli_args, :cwd, :port, :use_stdio, :cli_url,
480
592
  :log_level, :auto_start, :auto_restart, :env,
481
- :github_token, :use_logged_in_user,
593
+ :github_token, :use_logged_in_user, :session_idle_timeout_seconds,
594
+ :session_fs,
482
595
  keyword_init: true
483
596
  )
484
597
  end
@@ -3,5 +3,5 @@
3
3
  # Copyright (c) Microsoft Corporation. All rights reserved.
4
4
 
5
5
  module Copilot
6
- VERSION = "0.1.0"
6
+ VERSION = "2.0.0"
7
7
  end
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: 1.0.14
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Microsoft Corporation
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-12 00:00:00.000000000 Z
11
+ date: 2026-04-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.