Repository navigation
[codex] Refactor chat parser and transcript service ownership #6216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
25ba2e6
Refactor chat parser and transcript service ownership
azooz2003-bit 00d6338
Fix chat refactor CI guards
azooz2003-bit ec753ba
Type ghostty title change observation
azooz2003-bit 7004a32
Fix chat refactor project file entry
azooz2003-bit 5c5cbad
Fix remaining chat refactor project file id
azooz2003-bit c301c96
Merge main into chat refactor
azooz2003-bit bc336ca
Fix chat service actor-isolated defaults
azooz2003-bit 61e699a
Localize mobile chat unavailable error
azooz2003-bit eb84e0e
Merge remote-tracking branch 'origin/main' into refactor-chat-service…
azooz2003-bit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import Foundation | ||
|
|
||
| /// Typed payload for `.ghosttyDidSetTitle` notifications. | ||
| struct GhosttyTitleChange: Equatable, Sendable { | ||
| let tabId: UUID | ||
| let surfaceId: UUID | ||
| let title: String | ||
|
|
||
| init(tabId: UUID, surfaceId: UUID, title: String) { | ||
| self.tabId = tabId | ||
| self.surfaceId = surfaceId | ||
| self.title = title | ||
| } | ||
|
|
||
| init?(notification: Notification) { | ||
| guard let tabId = notification.userInfo?[GhosttyNotificationKey.tabId] as? UUID, | ||
| let surfaceId = notification.userInfo?[GhosttyNotificationKey.surfaceId] as? UUID, | ||
| let title = notification.userInfo?[GhosttyNotificationKey.title] as? String else { | ||
| return nil | ||
| } | ||
| self.init(tabId: tabId, surfaceId: surfaceId, title: title) | ||
| } | ||
|
|
||
| var userInfo: [String: Any] { | ||
| [ | ||
| GhosttyNotificationKey.tabId: tabId, | ||
| GhosttyNotificationKey.surfaceId: surfaceId, | ||
| GhosttyNotificationKey.title: title, | ||
| ] | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import Foundation | ||
|
|
||
| /// Owns a `.ghosttyDidSetTitle` observer and delivers typed title changes. | ||
| final class GhosttyTitleChangeSubscription { | ||
| private let center: NotificationCenter | ||
| private let observer: NSObjectProtocol | ||
|
|
||
| init( | ||
| center: NotificationCenter = .default, | ||
| handler: @escaping @MainActor (GhosttyTitleChange) -> Void | ||
| ) { | ||
| self.center = center | ||
| observer = center.addObserver( | ||
| forName: Notification.Name.ghosttyDidSetTitle, | ||
| object: nil, | ||
| queue: .main | ||
| ) { notification in | ||
| guard let change = GhosttyTitleChange(notification: notification) else { return } | ||
| Task { @MainActor in | ||
| handler(change) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| deinit { | ||
| center.removeObserver(observer) | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nil == nilcase that the original code did not have.tabManager.selectedTabIdisUUID?, so when the failableGhosttyTitleChange.initreturnsnil(malformed notification) andselectedTabIdis alsonil(no tab selected), the guard passes andscheduleTitlebarTextRefresh()is called incorrectly. The original code used a non-optionaltabId: UUIDon the left-hand side, makingUUID == nilalwaysfalse. Use aguard letto preserve the original semantics.