Skip to content

Commit 3241b2a

Browse files
committed
Pre-release 0.46.164
1 parent 02351b7 commit 3241b2a

File tree

47 files changed

+2662
-260
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2662
-260
lines changed

Copilot for Xcode.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Copilot for Xcode/App.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
2121
case chat
2222
case settings
2323
case tools
24+
case toolsAutoApprove
2425
case byok
2526
}
2627

@@ -51,6 +52,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
5152
return .settings
5253
} else if launchArgs.contains("--tools") {
5354
return .tools
55+
} else if launchArgs.contains("--tools-auto-approve") {
56+
return .toolsAutoApprove
5457
} else if launchArgs.contains("--byok") {
5558
return .byok
5659
} else {
@@ -64,6 +67,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
6467
openSettings()
6568
case .tools:
6669
openToolsSettings()
70+
case .toolsAutoApprove:
71+
openToolsSettingsAutoApprove()
6772
case .byok:
6873
openBYOKSettings()
6974
case .chat:
@@ -92,6 +97,14 @@ class AppDelegate: NSObject, NSApplicationDelegate {
9297
hostAppStore.send(.setActiveTab(.tools))
9398
}
9499
}
100+
101+
private func openToolsSettingsAutoApprove() {
102+
DispatchQueue.main.async {
103+
activateAndOpenSettings()
104+
hostAppStore.send(.setActiveTab(.tools))
105+
hostAppStore.send(.setActiveToolsSubTab(.AutoApprove))
106+
}
107+
}
95108

96109
private func openBYOKSettings() {
97110
DispatchQueue.main.async {
@@ -202,6 +215,18 @@ struct CopilotForXcodeApp: App {
202215
hostAppStore.send(.setActiveTab(.tools))
203216
}
204217
}
218+
219+
DistributedNotificationCenter.default().addObserver(
220+
forName: .openToolsSettingsAutoApproveWindowRequest,
221+
object: nil,
222+
queue: .main
223+
) { _ in
224+
DispatchQueue.main.async {
225+
activateAndOpenSettings()
226+
hostAppStore.send(.setActiveTab(.tools))
227+
hostAppStore.send(.setActiveToolsSubTab(.AutoApprove))
228+
}
229+
}
205230

206231
DistributedNotificationCenter.default().addObserver(
207232
forName: .openBYOKSettingsWindowRequest,

Copilot for Xcode/Credits.rtf

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3349,4 +3349,90 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\
33493349
SOFTWARE.\
33503350
\
33513351
\
3352+
Dependency: https://github.com/tree-sitter/tree-sitter\
3353+
Version: 0.25.10\
3354+
License Content:\
3355+
The MIT License\
3356+
\
3357+
Copyright (c) 2018 Max Brunsfeld
3358+
\
3359+
Permission is hereby granted, free of charge, to any person obtaining a copy
3360+
of this software and associated documentation files (the "Software"), to deal
3361+
in the Software without restriction, including without limitation the rights
3362+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3363+
copies of the Software, and to permit persons to whom the Software is
3364+
furnished to do so, subject to the following conditions:
3365+
\
3366+
The above copyright notice and this permission notice shall be included in all
3367+
copies or substantial portions of the Software.
3368+
\
3369+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3370+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3371+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3372+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3373+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3374+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3375+
SOFTWARE.
3376+
\
3377+
\
3378+
Dependency: https://github.com/tree-sitter/swift-tree-sitter\
3379+
Version: 0.25.0\
3380+
License Content:\
3381+
BSD 3-Clause License\
3382+
\
3383+
Copyright (c) 2021, Chime
3384+
All rights reserved.
3385+
\
3386+
Redistribution and use in source and binary forms, with or without
3387+
modification, are permitted provided that the following conditions are met:
3388+
\
3389+
1. Redistributions of source code must retain the above copyright notice, this
3390+
list of conditions and the following disclaimer.
3391+
\
3392+
2. Redistributions in binary form must reproduce the above copyright notice,
3393+
this list of conditions and the following disclaimer in the documentation
3394+
and/or other materials provided with the distribution.
3395+
\
3396+
3. Neither the name of the copyright holder nor the names of its
3397+
contributors may be used to endorse or promote products derived from
3398+
this software without specific prior written permission.
3399+
\
3400+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
3401+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
3402+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
3403+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
3404+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3405+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
3406+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
3407+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
3408+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3409+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3410+
\
3411+
\
3412+
Dependency: https://github.com/tree-sitter/tree-sitter-bash\
3413+
Version: 0.25.1\
3414+
License Content:\
3415+
The MIT License\
3416+
\
3417+
Copyright (c) 2017 Max Brunsfeld
3418+
\
3419+
Permission is hereby granted, free of charge, to any person obtaining a copy
3420+
of this software and associated documentation files (the "Software"), to deal
3421+
in the Software without restriction, including without limitation the rights
3422+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3423+
copies of the Software, and to permit persons to whom the Software is
3424+
furnished to do so, subject to the following conditions:
3425+
\
3426+
The above copyright notice and this permission notice shall be included in all
3427+
copies or substantial portions of the Software.
3428+
\
3429+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3430+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3431+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3432+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3433+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3434+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3435+
SOFTWARE.
3436+
\
3437+
\
33523438
}

Core/Package.swift

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ let package = Package(
5353
.package(url: "https://github.com/devm33/KeyboardShortcuts", branch: "main"),
5454
.package(url: "https://github.com/devm33/CGEventOverride", branch: "devm33/fix-stale-AXIsProcessTrusted"),
5555
.package(url: "https://github.com/devm33/Highlightr", branch: "master"),
56-
.package(url: "https://github.com/globulus/swiftui-flow-layout", from: "1.0.5")
56+
.package(url: "https://github.com/globulus/swiftui-flow-layout", from: "1.0.5"),
57+
.package(url: "https://github.com/tree-sitter/swift-tree-sitter.git", from: "0.25.0"),
58+
.package(url: "https://github.com/tree-sitter/tree-sitter-bash", from: "0.25.1")
5759
],
5860
targets: [
5961
// MARK: - Main
@@ -132,6 +134,7 @@ let package = Package(
132134
.product(name: "KeyboardShortcuts", package: "KeyboardShortcuts"),
133135
.product(name: "GitHubCopilotService", package: "Tool"),
134136
.product(name: "Persist", package: "Tool"),
137+
.product(name: "UserDefaultsObserver", package: "Tool"),
135138
]),
136139

137140
// MARK: - Suggestion Service
@@ -185,7 +188,10 @@ let package = Package(
185188
.product(name: "AppKitExtension", package: "Tool"),
186189
.product(name: "WebContentExtractor", package: "Tool"),
187190
.product(name: "GitHelper", package: "Tool"),
188-
.product(name: "SuggestionBasic", package: "Tool")
191+
.product(name: "SuggestionBasic", package: "Tool"),
192+
.product(name: "SwiftTreeSitter", package: "swift-tree-sitter"),
193+
.product(name: "SwiftTreeSitterLayer", package: "swift-tree-sitter"),
194+
.product(name: "TreeSitterBash", package: "tree-sitter-bash"),
189195
]),
190196
.testTarget(
191197
name: "ChatServiceTests",

Core/Sources/ChatService/ChatService.swift

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,17 @@ public final class ChatService: ChatServiceType, ObservableObject {
441441

442442
self.lastUserRequest = request
443443
self.skillSet = validSkillSet
444-
if let response = try await sendConversationRequest(request) {
445-
await handleConversationCreateResponse(response)
444+
445+
do {
446+
if let response = try await sendConversationRequest(request) {
447+
await handleConversationCreateResponse(response)
448+
}
449+
} catch {
450+
// Check if this is a certificate error and show helpful message
451+
if isCertificateError(error) {
452+
await showCertificateErrorMessage(turnId: currentTurnId)
453+
}
454+
throw error
446455
}
447456
}
448457

@@ -1018,6 +1027,44 @@ public final class ChatService: ChatServiceType, ObservableObject {
10181027
}
10191028
}
10201029
}
1030+
1031+
// MARK: - Certificate Error Detection
1032+
1033+
/// Checks if an error is related to SSL certificate issues
1034+
private func isCertificateError(_ error: Error) -> Bool {
1035+
let errorDescription = error.localizedDescription.lowercased()
1036+
1037+
// Check for certificate error messages
1038+
if errorDescription.contains("unable to get local issuer certificate") ||
1039+
errorDescription.contains("self-signed certificate in certificate chain") ||
1040+
errorDescription.contains("unable_to_get_issuer_cert_locally") {
1041+
return true
1042+
}
1043+
1044+
// Check GitHubCopilotError with ServerError
1045+
if let serverError = error as? ServerError,
1046+
case .serverError(_, let message, _) = serverError {
1047+
let serverMessage = message.lowercased()
1048+
if serverMessage.contains("unable to get local issuer certificate") ||
1049+
serverMessage.contains("self-signed certificate in certificate chain") {
1050+
return true
1051+
}
1052+
}
1053+
1054+
return false
1055+
}
1056+
1057+
private func showCertificateErrorMessage(turnId: String?) async {
1058+
let messageId = turnId ?? UUID().uuidString
1059+
let errorMessage = ChatMessage(
1060+
errorMessageWithId: messageId,
1061+
chatTabID: chatTabInfo.id,
1062+
errorMessages: [
1063+
SSLCertificateErrorMessage
1064+
]
1065+
)
1066+
await memory.appendMessage(errorMessage)
1067+
}
10211068
}
10221069

10231070

Core/Sources/ChatService/ToolCalls/AutoApproval/AutoApprovalScope.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ public typealias ConversationID = String
44

55
public enum AutoApprovalScope: Hashable {
66
case session(ConversationID)
7+
/// Applies to all workspaces. Persisted in `UserDefaults.autoApproval`.
8+
case global
79
// Future scopes:
810
// case workspace(String)
9-
// case global
1011
}

0 commit comments

Comments
 (0)