copilot-sdk-supercharged 2.3.0 → 2.4.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: 392f8acf685d1aa8978a06e40ebd965ab0ca2a7420a7194a91d5b89f1468e925
4
- data.tar.gz: 8b91a8a18f10a8bb5e0b85ffee7eabf309246b268303436741a3d87dceca28fe
3
+ metadata.gz: 8d80c4e262952967db3b9ed58e8899587afa12b158074ab57d7f475af58ccd68
4
+ data.tar.gz: 302abe246cec1dd679f2036f49407a10b01756c421634a3c97f6fb1105743606
5
5
  SHA512:
6
- metadata.gz: 333bb586d18fa374572905b4044cceef361659eba6b7be7dcbbfdc2c621fa9ac0ce400a6b64e28549ec6d84fbf8279fe93d30222d3ace4ae715d6aa6f33a154d
7
- data.tar.gz: ffd63d77549c4e8e6d41cb242012a2af2eae8a01faecb773055cc158ce59386cdf68ad10315653bb3a9aad6dd1ed0e768d14b87a23785fb8e030545dbb38c16d
6
+ metadata.gz: e7aa7ee115dfe39db890cffa6d1d4535caf0b6926cde80b0346b5ce3e8e5a9ca24b688af91c49b223aa5fbdb1e95733052f142b4bcef42d18d69101ccae1fde5
7
+ data.tar.gz: f51f8baeb7ede5fb5db28855db3e94f397379e78d75e9f6aa871a6c970733b8bfd80ab5d3013acc21510add30f29be55e7db79cb6251061355470b220e95655a
@@ -845,6 +845,23 @@ module Copilot
845
845
  payload[:infiniteSessions] = is_cfg.respond_to?(:to_wire) ? is_cfg.to_wire : is_cfg
846
846
  end
847
847
 
848
+ # --- Upstream-sync session options (parity with @github/copilot-sdk) ---
849
+ payload[:enableCitations] = config[:enable_citations] unless config[:enable_citations].nil?
850
+ payload[:excludedBuiltinAgents] = config[:excluded_builtin_agents] if config[:excluded_builtin_agents]
851
+ if config[:session_limits]
852
+ sl = config[:session_limits]
853
+ payload[:sessionLimits] = sl.respond_to?(:to_wire) ? sl.to_wire : sl
854
+ end
855
+ if config[:memory]
856
+ mem = config[:memory]
857
+ payload[:memory] = mem.respond_to?(:to_wire) ? mem.to_wire : mem
858
+ end
859
+ payload[:otlpProtocol] = config[:otlp_protocol] if config[:otlp_protocol]
860
+ payload[:enableWebSocketResponses] = config[:enable_web_socket_responses] unless config[:enable_web_socket_responses].nil?
861
+ payload[:expAssignments] = config[:exp_assignments] if config[:exp_assignments]
862
+ # MCP OAuth host token handler: signal to the runtime that a handler is registered.
863
+ payload[:mcpAuthHandler] = true if config[:on_mcp_auth_request]
864
+
848
865
  payload
849
866
  end
850
867
 
@@ -68,10 +68,13 @@ module Copilot
68
68
  # @param response_format [String, nil] desired response format ("text", "image", "json_object")
69
69
  # @param image_options [ImageOptions, nil] options for image generation
70
70
  # @return [String] the message ID
71
- def send(prompt:, attachments: nil, mode: nil, response_format: nil, image_options: nil)
71
+ def send(prompt:, attachments: nil, mode: nil, agent_mode: nil, display_prompt: nil, request_headers: nil, response_format: nil, image_options: nil)
72
72
  payload = { sessionId: @session_id, prompt: prompt }
73
73
  payload[:attachments] = attachments if attachments
74
74
  payload[:mode] = mode if mode
75
+ payload[:agentMode] = agent_mode if agent_mode
76
+ payload[:displayPrompt] = display_prompt if display_prompt
77
+ payload[:requestHeaders] = request_headers if request_headers
75
78
  payload[:responseFormat] = response_format if response_format
76
79
  payload[:imageOptions] = image_options.to_h if image_options
77
80
 
@@ -108,7 +111,7 @@ module Copilot
108
111
  # @return [SessionEvent, nil] the final assistant.message event, or nil
109
112
  # @raise [Timeout::Error] if the timeout expires before session.idle
110
113
  # @raise [RuntimeError] if the session emits a session.error event
111
- def send_and_wait(prompt:, attachments: nil, mode: nil, response_format: nil, image_options: nil, timeout: 60)
114
+ def send_and_wait(prompt:, attachments: nil, mode: nil, agent_mode: nil, display_prompt: nil, request_headers: nil, response_format: nil, image_options: nil, timeout: 60)
112
115
  idle_mutex = Mutex.new
113
116
  idle_cv = ConditionVariable.new
114
117
  idle_fired = false
@@ -139,6 +142,8 @@ module Copilot
139
142
 
140
143
  begin
141
144
  self.send(prompt: prompt, attachments: attachments, mode: mode,
145
+ agent_mode: agent_mode, display_prompt: display_prompt,
146
+ request_headers: request_headers,
142
147
  response_format: response_format, image_options: image_options)
143
148
 
144
149
  idle_mutex.synchronize do
data/lib/copilot/types.rb CHANGED
@@ -75,132 +75,6 @@ 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
-
204
78
  # System message in append mode (default).
205
79
  SystemMessageAppendConfig = Struct.new(:mode, :content, keyword_init: true) do
206
80
  def to_h
@@ -229,23 +103,21 @@ module Copilot
229
103
  SAFETY = "safety"
230
104
  TOOL_INSTRUCTIONS = "tool_instructions"
231
105
  CUSTOM_INSTRUCTIONS = "custom_instructions"
232
- RUNTIME_INSTRUCTIONS = "runtime_instructions"
233
106
  LAST_INSTRUCTIONS = "last_instructions"
234
107
  end
235
108
 
236
109
  # Override action for a system prompt section.
237
110
  module SectionOverrideAction
238
- REPLACE = "replace"
239
- REMOVE = "remove"
240
- APPEND = "append"
241
- PREPEND = "prepend"
242
- TRANSFORM = "transform"
111
+ REPLACE = "replace"
112
+ REMOVE = "remove"
113
+ APPEND = "append"
114
+ PREPEND = "prepend"
243
115
  end
244
116
 
245
117
  # Override operation for a single system prompt section.
246
- SectionOverride = Struct.new(:action, :content, :transform, keyword_init: true) do
118
+ SectionOverride = Struct.new(:action, :content, keyword_init: true) do
247
119
  def to_h
248
- h = { action: transform ? SectionOverrideAction::TRANSFORM : action }
120
+ h = { action: action }
249
121
  h[:content] = content if content
250
122
  h
251
123
  end
@@ -390,69 +262,6 @@ module Copilot
390
262
  end
391
263
  end
392
264
 
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
-
456
265
  # Context for a slash-command invocation.
457
266
  CommandContext = Struct.new(:session_id, :command, :command_name, :args, keyword_init: true)
458
267
 
@@ -469,30 +278,6 @@ module Copilot
469
278
  # Result returned from an elicitation handler.
470
279
  ElicitationResult = Struct.new(:action, :content, keyword_init: true)
471
280
 
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
-
496
281
  # Configuration for creating a session.
497
282
  SessionConfig = Struct.new(
498
283
  :session_id, :model, :reasoning_effort, :config_dir,
@@ -503,7 +288,7 @@ module Copilot
503
288
  :skill_directories, :disabled_skills, :infinite_sessions,
504
289
  :model_capabilities, :enable_config_discovery,
505
290
  :github_token,
506
- :commands, :on_elicitation_request, :on_exit_plan_mode,
291
+ :commands, :on_elicitation_request,
507
292
  :instruction_directories,
508
293
  keyword_init: true
509
294
  )
@@ -518,20 +303,14 @@ module Copilot
518
303
  :skill_directories, :disabled_skills, :infinite_sessions,
519
304
  :model_capabilities, :enable_config_discovery,
520
305
  :github_token,
521
- :commands, :on_elicitation_request, :on_exit_plan_mode,
306
+ :commands, :on_elicitation_request,
522
307
  :instruction_directories,
523
308
  :disable_resume,
524
309
  keyword_init: true
525
310
  )
526
311
 
527
312
  # Response format for message responses.
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
313
+ RESPONSE_FORMATS = %w[text image json_object].freeze
535
314
 
536
315
  # Options for image generation.
537
316
  ImageOptions = Struct.new(:size, :quality, :style, keyword_init: true) do
@@ -635,38 +414,10 @@ module Copilot
635
414
  end
636
415
  end
637
416
 
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
-
662
417
  # Model billing information.
663
- ModelBilling = Struct.new(:multiplier, :token_prices, :picker_price_category, keyword_init: true) do
418
+ ModelBilling = Struct.new(:multiplier, keyword_init: true) do
664
419
  def self.from_hash(h)
665
- new(
666
- multiplier: h["multiplier"],
667
- token_prices: h["tokenPrices"] ? ModelBillingTokenPrices.from_hash(h["tokenPrices"]) : nil,
668
- picker_price_category: h["pickerPriceCategory"]
669
- )
420
+ new(multiplier: h["multiplier"])
670
421
  end
671
422
  end
672
423
 
@@ -793,45 +544,6 @@ module Copilot
793
544
  end
794
545
  end
795
546
 
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
-
835
547
  # Foreground session info (TUI+server mode).
836
548
  ForegroundSessionInfo = Struct.new(:session_id, :workspace_path, keyword_init: true)
837
549
 
@@ -884,7 +596,67 @@ module Copilot
884
596
  :github_token, :use_logged_in_user, :session_idle_timeout_seconds,
885
597
  :session_fs,
886
598
  :copilot_home, :tcp_connection_token,
887
- :on_get_trace_context,
599
+ :request_handler,
888
600
  keyword_init: true
889
601
  )
602
+
603
+ # --- Upstream-sync feature types (parity with @github/copilot-sdk) ---
604
+
605
+ # Per-session AI-credit budget; set +max_ai_credits+ to cap spend.
606
+ SessionLimitsConfig = Struct.new(:max_ai_credits, keyword_init: true) do
607
+ def to_wire
608
+ { maxAiCredits: max_ai_credits }.compact
609
+ end
610
+ end
611
+
612
+ # Opt-in persistent session memory.
613
+ MemoryConfiguration = Struct.new(:enabled, keyword_init: true) do
614
+ def to_wire
615
+ { enabled: enabled }.compact
616
+ end
617
+ end
618
+
619
+ # Arguments passed to a BYOK +bearer_token_provider+ callable (per-session scoping).
620
+ ProviderTokenArgs = Struct.new(:session_id, keyword_init: true)
621
+
622
+ # Intercept outbound LLM inference HTTP/WebSocket requests. Assign an instance to
623
+ # +ClientOptions#request_handler+ and override +send_request+ to mutate, replace,
624
+ # or forward the request. BYOK providers may also set +bearer_token_provider+.
625
+ class CopilotRequestHandler
626
+ def send_request(request, _context)
627
+ request
628
+ end
629
+ end
630
+
631
+ # Tool "defer" loading policy: eager pre-load ("never") or lazy via search ("auto").
632
+ module ToolDefer
633
+ AUTO = "auto"
634
+ NEVER = "never"
635
+ end
636
+
637
+ # System-message section identifiers (used with system_message section overrides).
638
+ # The "preamble" section targets only the identity preamble; the "preserve" action
639
+ # protects an individually-addressable section from a group-level remove.
640
+ module SystemMessageSection
641
+ PREAMBLE = "preamble"
642
+ IDENTITY = "identity"
643
+ TOOL_INSTRUCTIONS = "tool_instructions"
644
+ PRESERVE = "preserve"
645
+ end
646
+
647
+ # Hook names include :on_pre_tool_use, :on_post_tool_use, :on_pre_mcp_tool_call,
648
+ # and :on_mcp_auth_request (MCP OAuth host token handler).
649
+
650
+ # GitHub-anchored attachment variants.
651
+ module GitHubAttachment
652
+ GITHUB_COMMIT = "GitHubCommit"
653
+ GITHUB_RELEASE = "GitHubRelease"
654
+ GITHUB_ACTIONS_JOB = "GitHubActionsJob"
655
+ GITHUB_REPOSITORY = "GitHubRepository"
656
+ GITHUB_FILE_DIFF = "GitHubFileDiff"
657
+ GITHUB_TREE_COMPARISON = "GitHubTreeComparison"
658
+ GITHUB_URL = "GitHubUrl"
659
+ GITHUB_FILE = "GitHubFile"
660
+ GITHUB_SNIPPET = "GitHubSnippet"
661
+ end
890
662
  end
@@ -3,5 +3,5 @@
3
3
  # Copyright (c) Microsoft Corporation. All rights reserved.
4
4
 
5
5
  module Copilot
6
- VERSION = "2.3.0"
6
+ VERSION = "2.1.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: 2.3.0
4
+ version: 2.4.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-25 00:00:00.000000000 Z
11
+ date: 2026-07-08 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.