copilot-sdk-supercharged 2.5.2 → 3.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.
data/lib/copilot/types.rb CHANGED
@@ -62,8 +62,10 @@ module Copilot
62
62
 
63
63
  # A tool definition. +handler+ is a callable (Proc/lambda/method) that receives
64
64
  # (arguments, invocation) and returns a result (String, Hash, or ToolResult).
65
+ # Set +idempotent+ to true when repeating a call with the same arguments has no
66
+ # additional effect, so the runtime may safely retry it.
65
67
  Tool = Struct.new(
66
- :name, :description, :parameters, :handler,
68
+ :name, :description, :parameters, :handler, :idempotent,
67
69
  keyword_init: true
68
70
  ) do
69
71
  # @return [Hash] wire-format representation sent to the server
@@ -71,6 +73,7 @@ module Copilot
71
73
  h = { name: name }
72
74
  h[:description] = description if description
73
75
  h[:parameters] = parameters if parameters
76
+ h[:idempotent] = idempotent unless idempotent.nil?
74
77
  h
75
78
  end
76
79
  end
@@ -182,8 +185,12 @@ module Copilot
182
185
  end
183
186
 
184
187
  # Custom API provider configuration (BYOK).
188
+ #
189
+ # +model_provider+ selects the provider family (see {ModelProvider}) and
190
+ # +api_key_command+ is a command whose stdout is used as the API key.
185
191
  ProviderConfig = Struct.new(
186
192
  :type, :wire_api, :base_url, :api_key, :bearer_token, :azure,
193
+ :model_provider, :api_key_command,
187
194
  keyword_init: true
188
195
  ) do
189
196
  def to_wire
@@ -193,6 +200,8 @@ module Copilot
193
200
  h[:baseUrl] = base_url if base_url
194
201
  h[:apiKey] = api_key if api_key
195
202
  h[:bearerToken] = bearer_token if bearer_token
203
+ h[:modelProvider] = model_provider if model_provider
204
+ h[:apiKeyCommand] = api_key_command if api_key_command
196
205
  if azure
197
206
  az = {}
198
207
  az[:apiVersion] = azure[:api_version] if azure[:api_version]
@@ -290,10 +299,21 @@ module Copilot
290
299
  :github_token,
291
300
  :commands, :on_elicitation_request,
292
301
  :instruction_directories,
302
+ # v2.6.0 upstream-sync options
303
+ :name, :auto_tier, :ask_user_variant, :github_token_provider,
304
+ :sandbox_config, :feature_flags, :allowed_models, :auth_client_id_metadata_url,
305
+ :agent_directories, :hook_directories,
306
+ :interactive_user, :excluded_managed_settings, :enforce_managed_model_defaults,
307
+ :trust_working_directory, :refresh_custom_instructions,
308
+ :image_generation, :autopilot,
309
+ # v3.0.0 (SDK protocol 4) options
310
+ :providers, :models, :default_provider, :capi,
311
+ :on_shell_authentication_request, :store_memory, :permission_mode,
293
312
  keyword_init: true
294
313
  )
295
314
 
296
- # Configuration for resuming a session. Same fields as SessionConfig plus disable_resume.
315
+ # Configuration for resuming a session. Same fields as SessionConfig plus disable_resume
316
+ # (create-only fields such as +name+ are omitted; +allow_transcript_recovery+ is resume-only).
297
317
  ResumeSessionConfig = Struct.new(
298
318
  :model, :reasoning_effort, :config_dir,
299
319
  :tools, :system_message, :available_tools, :excluded_tools,
@@ -306,6 +326,17 @@ module Copilot
306
326
  :commands, :on_elicitation_request,
307
327
  :instruction_directories,
308
328
  :disable_resume,
329
+ # v2.6.0 upstream-sync options
330
+ :auto_tier, :ask_user_variant, :github_token_provider,
331
+ :sandbox_config, :feature_flags, :allowed_models, :auth_client_id_metadata_url,
332
+ :agent_directories, :hook_directories,
333
+ :interactive_user, :excluded_managed_settings, :enforce_managed_model_defaults,
334
+ :allow_transcript_recovery,
335
+ :image_generation, :autopilot,
336
+ # v3.0.0 (SDK protocol 4) options; an explicit +default_provider: nil+ clears the
337
+ # session's default provider
338
+ :providers, :models, :default_provider, :capi,
339
+ :on_shell_authentication_request, :store_memory, :permission_mode,
309
340
  keyword_init: true
310
341
  )
311
342
 
@@ -326,7 +357,15 @@ module Copilot
326
357
  ContentBlock = Struct.new(:type, :text, :image, keyword_init: true)
327
358
 
328
359
  # Options for sending a message.
329
- MessageOptions = Struct.new(:prompt, :attachments, :mode, :response_format, :image_options, :request_headers, keyword_init: true)
360
+ #
361
+ # +source+ is the message provenance (see {MessageSource}); +response_schema+ is a
362
+ # JSON Schema Hash requesting structured output for this run; +client_turn_id+ is an
363
+ # opaque caller-chosen identifier echoed on the turn's events.
364
+ MessageOptions = Struct.new(
365
+ :prompt, :attachments, :mode, :response_format, :image_options, :request_headers,
366
+ :agent_mode, :display_prompt, :source, :response_schema, :client_turn_id,
367
+ keyword_init: true
368
+ )
330
369
 
331
370
  # Ping response from the server.
332
371
  PingResponse = Struct.new(:message, :timestamp, :protocol_version, keyword_init: true) do
@@ -385,14 +424,15 @@ module Copilot
385
424
 
386
425
  # Model limits.
387
426
  ModelLimits = Struct.new(
388
- :max_prompt_tokens, :max_context_window_tokens, :vision,
427
+ :max_prompt_tokens, :max_context_window_tokens, :vision, :max_output_tokens,
389
428
  keyword_init: true
390
429
  ) do
391
430
  def self.from_hash(h)
392
431
  new(
393
432
  max_prompt_tokens: h["max_prompt_tokens"],
394
433
  max_context_window_tokens: h["max_context_window_tokens"],
395
- vision: h["vision"] ? ModelVisionLimits.from_hash(h["vision"]) : nil
434
+ vision: h["vision"] ? ModelVisionLimits.from_hash(h["vision"]) : nil,
435
+ max_output_tokens: h["max_output_tokens"]
396
436
  )
397
437
  end
398
438
  end
@@ -503,6 +543,7 @@ module Copilot
503
543
  TOOL_EXECUTION_PARTIAL = "tool.execution_partial_result"
504
544
  TOOL_EXECUTION_PROGRESS = "tool.execution_progress"
505
545
  TOOL_EXECUTION_COMPLETE = "tool.execution_complete"
546
+ TOOL_SHELL_OUTPUT = "tool.shell_output"
506
547
  SKILL_INVOKED = "skill.invoked"
507
548
  SUBAGENT_STARTED = "subagent.started"
508
549
  SUBAGENT_COMPLETED = "subagent.completed"
@@ -551,16 +592,24 @@ module Copilot
551
592
  StopError = Struct.new(:message, keyword_init: true)
552
593
 
553
594
  # Hook configuration for a session. Each value is a callable or nil.
595
+ #
596
+ # +on_subagent_start+ (hook type "subagentStart") receives the base hook fields plus
597
+ # transcriptPath, agentName, agentDisplayName, agentDescription and may return
598
+ # { additionalContext: }. +on_subagent_stop+ (hook type "subagentStop") also receives
599
+ # agentId, agentType, stopReason ("end_turn") and response, and may return
600
+ # { decision: "block" | "allow", reason:, modifiedResponse: }.
554
601
  SessionHooks = Struct.new(
555
602
  :on_pre_tool_use, :on_post_tool_use, :on_user_prompt_submitted,
556
603
  :on_user_prompt_transformed,
557
604
  :on_session_start, :on_session_end, :on_error_occurred,
605
+ :on_subagent_start, :on_subagent_stop,
558
606
  keyword_init: true
559
607
  ) do
560
608
  def any_handler?
561
609
  [on_pre_tool_use, on_post_tool_use, on_user_prompt_submitted,
562
610
  on_user_prompt_transformed,
563
- on_session_start, on_session_end, on_error_occurred].any?
611
+ on_session_start, on_session_end, on_error_occurred,
612
+ on_subagent_start, on_subagent_stop].any?
564
613
  end
565
614
  end
566
615
 
@@ -600,6 +649,8 @@ module Copilot
600
649
  :copilot_home, :tcp_connection_token,
601
650
  :request_handler,
602
651
  :on_get_trace_context,
652
+ :client_info,
653
+ :mode, :network,
603
654
  keyword_init: true
604
655
  )
605
656
 
@@ -662,4 +713,377 @@ module Copilot
662
713
  GITHUB_FILE = "GitHubFile"
663
714
  GITHUB_SNIPPET = "GitHubSnippet"
664
715
  end
716
+
717
+ # --- v2.6.0 upstream-sync feature types (parity with @github/copilot-sdk) ---
718
+
719
+ # Identity of the integrating application. When any field is set, the client sends it
720
+ # on the +connect+ handshake (as editorName/editorVersion/extensionName/extensionVersion)
721
+ # so the runtime attributes its telemetry to your application.
722
+ ClientInfo = Struct.new(
723
+ :application_name, :application_version, :integration_name, :integration_version,
724
+ keyword_init: true
725
+ ) do
726
+ # @return [Hash, nil] wire shape with only non-empty fields, or nil when all are empty
727
+ def to_wire
728
+ h = {}
729
+ h[:editorName] = application_name unless application_name.to_s.empty?
730
+ h[:editorVersion] = application_version unless application_version.to_s.empty?
731
+ h[:extensionName] = integration_name unless integration_name.to_s.empty?
732
+ h[:extensionVersion] = integration_version unless integration_version.to_s.empty?
733
+ h.empty? ? nil : h
734
+ end
735
+ end
736
+
737
+ # Auto routing preference used when the session model is "auto" (experimental).
738
+ module AutoTier
739
+ EFFICIENCY = "efficiency"
740
+ BALANCE = "balance"
741
+ INTELLIGENCE = "intelligence"
742
+ FAST = "fast"
743
+ end
744
+
745
+ # Wire shape used for ask-user prompts.
746
+ module AskUserVariant
747
+ LEGACY = "legacy"
748
+ ELICITATION = "elicitation"
749
+ end
750
+
751
+ # Scope of the working-directory trust granted at session creation.
752
+ module WorkingDirectoryTrust
753
+ SESSION = "session"
754
+ USER = "user"
755
+ end
756
+
757
+ # BYOK provider families accepted by +ProviderConfig#model_provider+.
758
+ module ModelProvider
759
+ OPENAI = "openai"
760
+ ANTHROPIC = "anthropic"
761
+ AZURE_OPENAI = "azure_openai"
762
+ OLLAMA = "ollama"
763
+ LM_STUDIO = "lm_studio"
764
+ FOUNDRY_LOCAL = "foundry_local"
765
+ LLAMA_CPP = "llama_cpp"
766
+ end
767
+
768
+ # Message provenance for +CopilotSession#send+ (+source:+).
769
+ module MessageSource
770
+ USER = "user"
771
+ SYSTEM = "system"
772
+
773
+ # @param agent_id [String] opaque agent identifier
774
+ # @return [String] the "agent-<id>" source value
775
+ def self.agent(agent_id)
776
+ "agent-#{agent_id}"
777
+ end
778
+ end
779
+
780
+ # Arguments passed to a session's +github_token_provider+ callable.
781
+ # +reason+ is "initial" or "refresh"; +session_id+ may be nil before a cloud
782
+ # session has been assigned its id.
783
+ GitHubTokenProviderArgs = Struct.new(:host, :session_id, :reason, keyword_init: true)
784
+
785
+ # Result returned by a +github_token_provider+: either a token
786
+ # (+kind+ "token" with +access_token+, optional +token_type+ and +expires_in+ seconds)
787
+ # or a cancellation (+kind+ "cancelled"). Providers may also return a plain Hash.
788
+ GitHubTokenResult = Struct.new(:kind, :access_token, :token_type, :expires_in, keyword_init: true) do
789
+ def self.token(access_token:, expires_in:, token_type: nil)
790
+ new(kind: "token", access_token: access_token, token_type: token_type, expires_in: expires_in)
791
+ end
792
+
793
+ def self.cancelled
794
+ new(kind: "cancelled")
795
+ end
796
+
797
+ def to_wire
798
+ return { kind: "cancelled" } if kind.to_s == "cancelled"
799
+
800
+ h = { kind: "token", accessToken: access_token, expiresIn: expires_in }
801
+ h[:tokenType] = token_type if token_type
802
+ h
803
+ end
804
+ end
805
+
806
+ # Session sandbox configuration. +allow_bypass+ opts in to letting the agent request
807
+ # that an individual command run outside the sandbox through the normal permission flow.
808
+ SandboxConfig = Struct.new(
809
+ :enabled, :user_policy, :add_current_working_directory,
810
+ :sandbox_mcp_servers, :sandbox_lsp_servers, :sandbox_extensions, :allow_bypass,
811
+ keyword_init: true
812
+ ) do
813
+ def to_wire
814
+ h = { enabled: enabled ? true : false }
815
+ h[:userPolicy] = user_policy if user_policy
816
+ h[:addCurrentWorkingDirectory] = add_current_working_directory unless add_current_working_directory.nil?
817
+ h[:sandboxMcpServers] = sandbox_mcp_servers unless sandbox_mcp_servers.nil?
818
+ h[:sandboxLspServers] = sandbox_lsp_servers unless sandbox_lsp_servers.nil?
819
+ h[:sandboxExtensions] = sandbox_extensions unless sandbox_extensions.nil?
820
+ h[:allowBypass] = allow_bypass unless allow_bypass.nil?
821
+ h
822
+ end
823
+ end
824
+
825
+ # Session-level image generation configuration.
826
+ ImageGenerationConfig = Struct.new(:enabled, :watermark, :save_to_disk, keyword_init: true) do
827
+ def to_wire
828
+ h = {}
829
+ h[:enabled] = enabled unless enabled.nil?
830
+ h[:watermark] = watermark unless watermark.nil?
831
+ h[:saveToDisk] = save_to_disk unless save_to_disk.nil?
832
+ h
833
+ end
834
+ end
835
+
836
+ # Runtime-owned Autopilot continuation options.
837
+ AutopilotOptions = Struct.new(:continuation_enabled, :max_continues, keyword_init: true) do
838
+ def to_wire
839
+ h = {}
840
+ h[:continuationEnabled] = continuation_enabled unless continuation_enabled.nil?
841
+ h[:maxContinues] = max_continues unless max_continues.nil?
842
+ h
843
+ end
844
+ end
845
+
846
+ # Per-property model capability overrides (+model_capabilities:+ session option).
847
+ # +limits+ uses snake_case wire keys, e.g.
848
+ # { max_prompt_tokens:, max_output_tokens:, max_context_window_tokens: }.
849
+ ModelCapabilitiesOverride = Struct.new(:supports, :limits, keyword_init: true) do
850
+ def to_wire
851
+ h = {}
852
+ h[:supports] = supports if supports
853
+ h[:limits] = (limits.respond_to?(:to_wire) ? limits.to_wire : limits) if limits
854
+ h
855
+ end
856
+ end
857
+
858
+ # Limit overrides for {ModelCapabilitiesOverride}.
859
+ ModelLimitsOverride = Struct.new(
860
+ :max_prompt_tokens, :max_output_tokens, :max_context_window_tokens,
861
+ keyword_init: true
862
+ ) do
863
+ def to_wire
864
+ to_h.compact
865
+ end
866
+ end
867
+
868
+ # --- v3.0.0 feature types (SDK protocol 4, parity with the Microsoft Copilot SDK 2.0) ---
869
+
870
+ # Client mode (+mode:+ client option). "coding-agent" (the default) keeps the CLI-like
871
+ # coding tools and defaults. "empty" requires every session to set +available_tools+
872
+ # and applies conservative session defaults (no telemetry, in-memory OAuth and
873
+ # embedding storage, no cross-session store or memory, no on-demand instruction
874
+ # discovery, repository hooks or host git operations). "copilot-cli" is accepted as a
875
+ # legacy alias of "coding-agent".
876
+ module ClientMode
877
+ CODING_AGENT = "coding-agent"
878
+ EMPTY = "empty"
879
+ COPILOT_CLI = "copilot-cli"
880
+ end
881
+
882
+ # A named BYOK provider connection (+providers:+ session option). Select a registered
883
+ # model with "provider/id" (see {ProviderModelConfig}) or set +default_provider:+ to
884
+ # route unqualified model names through this connection.
885
+ NamedProviderConfig = Struct.new(
886
+ :name, :type, :base_url, :api_key, :api_key_command, :bearer_token,
887
+ :wire_api, :transport, :azure, :headers, :model_provider,
888
+ keyword_init: true
889
+ ) do
890
+ def to_wire
891
+ h = { name: name }
892
+ h[:type] = type if type
893
+ h[:baseUrl] = base_url if base_url
894
+ h[:apiKey] = api_key if api_key
895
+ h[:apiKeyCommand] = api_key_command if api_key_command
896
+ h[:bearerToken] = bearer_token if bearer_token
897
+ h[:wireApi] = wire_api if wire_api
898
+ h[:transport] = transport if transport
899
+ if azure
900
+ az = azure.transform_keys(&:to_sym)
901
+ api_version = az[:api_version] || az[:apiVersion]
902
+ h[:azure] = { apiVersion: api_version } if api_version
903
+ end
904
+ h[:headers] = headers if headers
905
+ h[:modelProvider] = model_provider if model_provider
906
+ h
907
+ end
908
+ end
909
+
910
+ # A model registered under a named provider (+models:+ session option). The canonical
911
+ # selection id is "provider/id"; +model_id+ is the known base model and +wire_model+
912
+ # the name sent to the provider API (both default to +id+).
913
+ ProviderModelConfig = Struct.new(
914
+ :provider, :id, :model_id, :wire_model, :name,
915
+ :max_prompt_tokens, :max_context_window_tokens, :max_output_tokens, :capabilities,
916
+ keyword_init: true
917
+ ) do
918
+ def to_wire
919
+ h = { provider: provider, id: id }
920
+ h[:modelId] = model_id if model_id
921
+ h[:wireModel] = wire_model if wire_model
922
+ h[:name] = name if name
923
+ h[:maxPromptTokens] = max_prompt_tokens if max_prompt_tokens
924
+ h[:maxContextWindowTokens] = max_context_window_tokens if max_context_window_tokens
925
+ h[:maxOutputTokens] = max_output_tokens if max_output_tokens
926
+ h[:capabilities] = (capabilities.respond_to?(:to_wire) ? capabilities.to_wire : capabilities) if capabilities
927
+ h
928
+ end
929
+ end
930
+
931
+ # Copilot API (CAPI) routing policy (+capi:+ session option). Set +enabled+ to false
932
+ # for a BYOK-only model catalog.
933
+ CapiConfig = Struct.new(:enabled, keyword_init: true) do
934
+ def to_wire
935
+ { enabled: enabled }.compact
936
+ end
937
+ end
938
+
939
+ # Stream of a {ShellOutputData} chunk; omitted on the wire means stdout.
940
+ module ShellOutputStream
941
+ STDOUT = "stdout"
942
+ STDERR = "stderr"
943
+ end
944
+
945
+ # Data of a live "tool.shell_output" event ({SessionEventType::TOOL_SHELL_OUTPUT}).
946
+ # +sequence+ orders chunks across both streams of one tool call.
947
+ ShellOutputData = Struct.new(:tool_call_id, :text, :sequence, :stream, keyword_init: true) do
948
+ def self.from_hash(h)
949
+ new(
950
+ tool_call_id: h["toolCallId"],
951
+ text: h["text"],
952
+ sequence: h["sequence"],
953
+ stream: h["stream"]
954
+ )
955
+ end
956
+ end
957
+
958
+ # Input kinds of a {ShellAuthenticationRequest}.
959
+ module ShellAuthenticationInputKind
960
+ SECRET = "secret"
961
+ TEXT = "text"
962
+ CONFIRM = "confirm"
963
+ end
964
+
965
+ # A shell program asking for credentials (+on_shell_authentication_request:+ handler).
966
+ ShellAuthenticationRequest = Struct.new(
967
+ :session_id, :request_id, :program, :prompt, :input_kind, :command, :cwd,
968
+ keyword_init: true
969
+ ) do
970
+ def self.from_hash(h)
971
+ new(
972
+ session_id: h["sessionId"],
973
+ request_id: h["requestId"],
974
+ program: h["program"],
975
+ prompt: h["prompt"],
976
+ input_kind: h["inputKind"],
977
+ command: h["command"].is_a?(String) ? h["command"] : "",
978
+ cwd: h["cwd"].is_a?(String) ? h["cwd"] : ""
979
+ )
980
+ end
981
+ end
982
+
983
+ # Answer to a {ShellAuthenticationRequest}: +action+ "accept" with a String +value+, or
984
+ # "cancel". Handlers may also return a plain Hash or nil (cancel).
985
+ ShellAuthenticationResponse = Struct.new(:action, :value, keyword_init: true) do
986
+ def self.accept(value)
987
+ new(action: "accept", value: value)
988
+ end
989
+
990
+ def self.cancel
991
+ new(action: "cancel")
992
+ end
993
+ end
994
+
995
+ # A memory the agent asked to store (+store_memory:+ session callback).
996
+ StoredMemory = Struct.new(:session_id, :subject, :fact, :citations, :reason, keyword_init: true) do
997
+ def self.from_hash(h)
998
+ new(
999
+ session_id: h["sessionId"],
1000
+ subject: h["subject"],
1001
+ fact: h["fact"],
1002
+ citations: h["citations"],
1003
+ reason: h["reason"]
1004
+ )
1005
+ end
1006
+ end
1007
+
1008
+ # Traffic served by the {NetworkConfig} callbacks.
1009
+ module NetworkScope
1010
+ CONNECTION = "connection"
1011
+ RUNTIME = "runtime"
1012
+ end
1013
+
1014
+ # Host network callbacks (+network:+ client option). Each callback is optional:
1015
+ # +resolve_proxy+ receives a {NetworkResolveProxyRequest} and returns a PAC-style proxy
1016
+ # list String (or nil to keep the runtime's own resolution); +authenticate_negotiate+
1017
+ # receives a {NetworkAuthenticateNegotiateRequest} and returns a base64 SPNEGO token
1018
+ # String or nil; +authenticate_basic+ receives a {NetworkAuthenticateBasicRequest} and
1019
+ # returns +{ username:, password: }+ or nil. Tokens and passwords are never logged.
1020
+ NetworkConfig = Struct.new(
1021
+ :scope, :resolve_proxy, :authenticate_negotiate, :authenticate_basic,
1022
+ keyword_init: true
1023
+ ) do
1024
+ # @return [Boolean] true when at least one callback is set
1025
+ def any_callback?
1026
+ !!(resolve_proxy || authenticate_negotiate || authenticate_basic)
1027
+ end
1028
+ end
1029
+
1030
+ # Request target passed to {NetworkConfig#resolve_proxy}.
1031
+ NetworkResolveProxyRequest = Struct.new(:url, keyword_init: true)
1032
+
1033
+ # Kerberos service principal passed to {NetworkConfig#authenticate_negotiate}.
1034
+ NetworkAuthenticateNegotiateRequest = Struct.new(:spn, keyword_init: true)
1035
+
1036
+ # Proxy Basic challenge passed to {NetworkConfig#authenticate_basic}.
1037
+ NetworkAuthenticateBasicRequest = Struct.new(:proxy, :realm, :previous_rejected, keyword_init: true)
1038
+
1039
+ # Structured Policy Helper failure. Attached to a failed session.create / session.resume
1040
+ # as +error.data.policyHelperFailure+ (see {JsonRpcError#policy_helper_failure}).
1041
+ # Helper-authored text is untrusted: render it as plain text and never execute it.
1042
+ PolicyHelperFailure = Struct.new(
1043
+ :category, :failure_mode, :message, :previous_policy_retained, :reason,
1044
+ :authority, :code, :details, :diagnostic, :help_link, :remediation, :severity,
1045
+ keyword_init: true
1046
+ ) do
1047
+ def self.from_hash(h)
1048
+ new(
1049
+ category: h["category"],
1050
+ failure_mode: h["failureMode"],
1051
+ message: h["message"],
1052
+ previous_policy_retained: h["previousPolicyRetained"] ? true : false,
1053
+ reason: h["reason"],
1054
+ authority: h["authority"],
1055
+ code: h["code"],
1056
+ details: h["details"],
1057
+ diagnostic: h["diagnostic"],
1058
+ help_link: h["helpLink"],
1059
+ remediation: h["remediation"],
1060
+ severity: h["severity"]
1061
+ )
1062
+ end
1063
+ end
1064
+
1065
+ # Session permission modes (+permission_mode:+ option, {CopilotSession#set_permission_mode}).
1066
+ module PermissionMode
1067
+ MANUAL = "manual"
1068
+ ASSISTED = "assisted"
1069
+ ALLOW_ALL = "allow-all"
1070
+ end
1071
+
1072
+ # Known reasons a permission-mode change was refused.
1073
+ module PermissionModeRefusalReason
1074
+ MANAGED_POLICY = "managed_policy"
1075
+ end
1076
+
1077
+ # Result of {CopilotSession#set_permission_mode}. +reason+ explains a refusal when known
1078
+ # (see {PermissionModeRefusalReason}, currently "managed_policy").
1079
+ PermissionModeSetResult = Struct.new(:success, :mode, :reason, keyword_init: true) do
1080
+ def self.from_hash(h)
1081
+ new(success: h["success"] ? true : false, mode: h["mode"], reason: h["reason"])
1082
+ end
1083
+
1084
+ # @return [Boolean] true when managed (enterprise) policy refused the mode
1085
+ def refused_by_managed_policy?
1086
+ reason == PermissionModeRefusalReason::MANAGED_POLICY
1087
+ end
1088
+ end
665
1089
  end
@@ -3,5 +3,5 @@
3
3
  # Copyright (c) Microsoft Corporation. All rights reserved.
4
4
 
5
5
  module Copilot
6
- VERSION = "2.5.2"
6
+ VERSION = "3.0.0"
7
7
  end
data/lib/copilot.rb CHANGED
@@ -5,6 +5,7 @@
5
5
  require_relative "copilot/version"
6
6
  require_relative "copilot/sdk_protocol_version"
7
7
  require_relative "copilot/types"
8
+ require_relative "copilot/session_params"
8
9
  require_relative "copilot/json_rpc_client"
9
10
  require_relative "copilot/define_tool"
10
11
  require_relative "copilot/session"
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.5.2
4
+ version: 3.0.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-08-21 00:00:00.000000000 Z
11
+ date: 2026-11-23 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.
@@ -27,6 +27,7 @@ files:
27
27
  - lib/copilot/json_rpc_client.rb
28
28
  - lib/copilot/sdk_protocol_version.rb
29
29
  - lib/copilot/session.rb
30
+ - lib/copilot/session_params.rb
30
31
  - lib/copilot/types.rb
31
32
  - lib/copilot/version.rb
32
33
  homepage: https://github.com/jeremiahjordanisaacson/copilot-sdk-supercharged