Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1b74dbd
Prove Vault needs targeted Pi session restore
austinywang May 5, 2026
8376b64
Make Vault agent restore extensible enough for Pi
austinywang May 5, 2026
fda2b1a
Keep Vault registration support within file-length limits
austinywang May 5, 2026
4d478ca
Honor registered Vault agent contracts under review
austinywang May 5, 2026
344eb00
Keep Vault agent display cache concurrency-safe
austinywang May 5, 2026
81c7548
Compile Vault extension files in the app target
austinywang May 5, 2026
79290ac
Avoid repeated Vault config reads during detection
austinywang May 5, 2026
374c38a
Fix Vault process registry helper lookup
austinywang May 5, 2026
670d0a5
Keep Vault review fixes off hot UI paths
austinywang May 6, 2026
d708b03
Integrate latest main before Vault PR fixes
austinywang May 6, 2026
0d7f756
Make Vault registrations own restore presentation
austinywang May 6, 2026
5937c5b
Keep session drag registration on main actor
austinywang May 6, 2026
61116b2
Make Vault resume metadata authoritative
austinywang May 6, 2026
24caa1f
Stay within the session view length budget
austinywang May 6, 2026
c3b7a6f
Let registered transcripts reach content fallback parsing
austinywang May 6, 2026
d0edb09
Match multi-argument Vault detect needles
austinywang May 6, 2026
b4ac048
Retry CircleCI Zig bootstrap downloads
austinywang May 6, 2026
fa4fa1d
Resume Zig downloads across CI
austinywang May 6, 2026
379c002
Bound stalled Zig downloads in CI
austinywang May 6, 2026
5b9d4fe
Make registered resume templates non-recursive
austinywang May 6, 2026
2d103a9
Retry Zig downloads with an explicit resumable helper
austinywang May 6, 2026
204025a
Integrate current main before PR update
austinywang May 6, 2026
3e105ee
Preserve Pi kind identity across Vault merge
austinywang May 6, 2026
0ebdf4d
Move Vault resume registration off the hot path
austinywang May 7, 2026
92a45df
Integrate Hermes mainline without regressing Vault agents
austinywang May 7, 2026
fee25cd
Preserve autosave in-flight cleanup across task handoff
austinywang May 7, 2026
242cf05
Integrate current main after Vault Pi updates
austinywang May 7, 2026
afe4fea
Keep merged Swift files within guard budget
austinywang May 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions GhosttyTabs.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@
A5001005 /* GhosttyTerminalView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5001015 /* GhosttyTerminalView.swift */; };
C13519000000000000000001 /* TerminalStartupEnvironment.swift in Sources */ = {isa = PBXBuildFile; fileRef = C13519000000000000000002 /* TerminalStartupEnvironment.swift */; };
C13519000000000000000005 /* RestorableAgentTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = C13519000000000000000006 /* RestorableAgentTypes.swift */; };
B3575000000000000000000C /* SessionIndexModels.swift in Sources */ = {isa = PBXBuildFile; fileRef = B3575000000000000000000B /* SessionIndexModels.swift */; };
B35750000000000000000002 /* VaultAgentRegistry.swift in Sources */ = {isa = PBXBuildFile; fileRef = B35750000000000000000001 /* VaultAgentRegistry.swift */; };
D3284101A1B2C3D4E5F60718 /* GhosttyTextInputSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = D3284102A1B2C3D4E5F60718 /* GhosttyTextInputSupport.swift */; };
D7AB00000000000000000005 /* GhosttyNSView+MoveTabToNewWorkspace.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7AB00000000000000000006 /* GhosttyNSView+MoveTabToNewWorkspace.swift */; };
A5001006 /* GhosttyKit.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = A5001016 /* GhosttyKit.xcframework */; };
Expand Down Expand Up @@ -230,6 +232,7 @@
A5001534 /* BrowserWindowPortal.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5001533 /* BrowserWindowPortal.swift */; };
A5001540 /* PortScanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5001541 /* PortScanner.swift */; };
C7A501000000000000000002 /* CmuxTopSnapshot.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7A501000000000000000001 /* CmuxTopSnapshot.swift */; };
B35750000000000000000004 /* CmuxTopProcessArguments.swift in Sources */ = {isa = PBXBuildFile; fileRef = B35750000000000000000003 /* CmuxTopProcessArguments.swift */; };
C7A508000000000000000002 /* CmuxTopSnapshotScopeCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7A508000000000000000001 /* CmuxTopSnapshotScopeCache.swift */; };
C7A502000000000000000002 /* TaskManagerWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7A502000000000000000001 /* TaskManagerWindowController.swift */; };
C7A506000000000000000002 /* TaskManagerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7A506000000000000000001 /* TaskManagerView.swift */; };
Expand Down Expand Up @@ -336,6 +339,7 @@
F4200000A1B2C3D4E5F60718 /* WindowAppearanceSnapshotTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4200001A1B2C3D4E5F60718 /* WindowAppearanceSnapshotTests.swift */; };
F4100000A1B2C3D4E5F60718 /* PortScannerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4100001A1B2C3D4E5F60718 /* PortScannerTests.swift */; };
F5000000A1B2C3D4E5F60718 /* SessionPersistenceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5000001A1B2C3D4E5F60718 /* SessionPersistenceTests.swift */; };
B3575000000000000000000A /* PiVaultAgentPersistenceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B35750000000000000000009 /* PiVaultAgentPersistenceTests.swift */; };
F5410000A1B2C3D4E5F60718 /* RestorableAgentHookProviderResumeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5410001A1B2C3D4E5F60718 /* RestorableAgentHookProviderResumeTests.swift */; };
F5410002A1B2C3D4E5F60718 /* RestorableAgentNonInteractiveTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F5410003A1B2C3D4E5F60718 /* RestorableAgentNonInteractiveTests.swift */; };
F6000000A1B2C3D4E5F60718 /* AppDelegateShortcutRoutingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6000001A1B2C3D4E5F60718 /* AppDelegateShortcutRoutingTests.swift */; };
Expand All @@ -361,6 +365,8 @@
FE002103 /* FileSearchRipgrepParserTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE002003 /* FileSearchRipgrepParserTests.swift */; };
D7AB0000000000000000000F /* AppDelegateMoveTabToNewWorkspaceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7AB00000000000000000010 /* AppDelegateMoveTabToNewWorkspaceTests.swift */; };
FE003101 /* SessionIndexStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE003001 /* SessionIndexStore.swift */; };
B35750000000000000000008 /* SessionIndexRegisteredAgents.swift in Sources */ = {isa = PBXBuildFile; fileRef = B35750000000000000000007 /* SessionIndexRegisteredAgents.swift */; };
B35750000000000000000006 /* VaultAgentProcessScanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = B35750000000000000000005 /* VaultAgentProcessScanner.swift */; };
FE003102 /* SessionIndexView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE003002 /* SessionIndexView.swift */; };
B37A00000000000000000003 /* RightSidebarMode+Availability.swift in Sources */ = {isa = PBXBuildFile; fileRef = B37A00000000000000000004 /* RightSidebarMode+Availability.swift */; };
FE003103 /* RightSidebarPanelView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FE003003 /* RightSidebarPanelView.swift */; };
Expand Down Expand Up @@ -560,6 +566,8 @@
A5001015 /* GhosttyTerminalView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GhosttyTerminalView.swift; sourceTree = "<group>"; };
C13519000000000000000002 /* TerminalStartupEnvironment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TerminalStartupEnvironment.swift; sourceTree = "<group>"; };
C13519000000000000000006 /* RestorableAgentTypes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RestorableAgentTypes.swift; sourceTree = "<group>"; };
B3575000000000000000000B /* SessionIndexModels.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionIndexModels.swift; sourceTree = "<group>"; };
B35750000000000000000001 /* VaultAgentRegistry.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VaultAgentRegistry.swift; sourceTree = "<group>"; };
D3284102A1B2C3D4E5F60718 /* GhosttyTextInputSupport.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GhosttyTextInputSupport.swift; sourceTree = "<group>"; };
D7AB00000000000000000006 /* GhosttyNSView+MoveTabToNewWorkspace.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "GhosttyNSView+MoveTabToNewWorkspace.swift"; sourceTree = "<group>"; };
D0B1000BA1B2C3D4E5F60001 /* GhosttyTerminalViewSupport.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GhosttyTerminalViewSupport.swift; sourceTree = "<group>"; };
Expand All @@ -573,6 +581,7 @@
C7A50A000000000000000001 /* TerminalControllerPaneResizeSupport.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TerminalControllerPaneResizeSupport.swift; sourceTree = "<group>"; };
C7A50B000000000000000001 /* TerminalControllerV2ParamParsingSupport.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TerminalControllerV2ParamParsingSupport.swift; sourceTree = "<group>"; };
C7A501000000000000000001 /* CmuxTopSnapshot.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CmuxTopSnapshot.swift; sourceTree = "<group>"; };
B35750000000000000000003 /* CmuxTopProcessArguments.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CmuxTopProcessArguments.swift; sourceTree = "<group>"; };
C7A508000000000000000001 /* CmuxTopSnapshotScopeCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CmuxTopSnapshotScopeCache.swift; sourceTree = "<group>"; };
C7A502000000000000000001 /* TaskManagerWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TaskManagerWindowController.swift; sourceTree = "<group>"; };
C7A506000000000000000001 /* TaskManagerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TaskManagerView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -764,6 +773,7 @@
F4200001A1B2C3D4E5F60718 /* WindowAppearanceSnapshotTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowAppearanceSnapshotTests.swift; sourceTree = "<group>"; };
F4100001A1B2C3D4E5F60718 /* PortScannerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PortScannerTests.swift; sourceTree = "<group>"; };
F5000001A1B2C3D4E5F60718 /* SessionPersistenceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SessionPersistenceTests.swift; sourceTree = "<group>"; };
B35750000000000000000009 /* PiVaultAgentPersistenceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PiVaultAgentPersistenceTests.swift; sourceTree = "<group>"; };
F5410001A1B2C3D4E5F60718 /* RestorableAgentHookProviderResumeTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RestorableAgentHookProviderResumeTests.swift; sourceTree = "<group>"; };
F5410003A1B2C3D4E5F60718 /* RestorableAgentNonInteractiveTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RestorableAgentNonInteractiveTests.swift; sourceTree = "<group>"; };
F5300001A1B2C3D4E5F60718 /* RovoDevSessionIndexTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RovoDevSessionIndexTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1034,6 +1044,8 @@
A5001015 /* GhosttyTerminalView.swift */,
C13519000000000000000002 /* TerminalStartupEnvironment.swift */,
C13519000000000000000006 /* RestorableAgentTypes.swift */,
B3575000000000000000000B /* SessionIndexModels.swift */,
B35750000000000000000001 /* VaultAgentRegistry.swift */,
D3284102A1B2C3D4E5F60718 /* GhosttyTextInputSupport.swift */,
D7AB00000000000000000006 /* GhosttyNSView+MoveTabToNewWorkspace.swift */,
D0B1000BA1B2C3D4E5F60001 /* GhosttyTerminalViewSupport.swift */,
Expand All @@ -1051,6 +1063,7 @@
C7A50B000000000000000001 /* TerminalControllerV2ParamParsingSupport.swift */,
C7A505000000000000000001 /* TerminalControllerTopSupport.swift */,
C7A501000000000000000001 /* CmuxTopSnapshot.swift */,
B35750000000000000000003 /* CmuxTopProcessArguments.swift */,
C7A508000000000000000001 /* CmuxTopSnapshotScopeCache.swift */,
C7A502000000000000000001 /* TaskManagerWindowController.swift */,
C7A506000000000000000001 /* TaskManagerView.swift */,
Expand Down Expand Up @@ -1133,6 +1146,8 @@
FE001003 /* FileExplorerSearchController.swift */,
FE001002 /* FileExplorerView.swift */,
FE003001 /* SessionIndexStore.swift */,
B35750000000000000000007 /* SessionIndexRegisteredAgents.swift */,
B35750000000000000000005 /* VaultAgentProcessScanner.swift */,
FE003004 /* SessionIndexStore+CodexSQL.swift */,
FE003005 /* RovoDevIndex.swift */,
FE003006 /* SessionAgentPresentation.swift */,
Expand Down Expand Up @@ -1199,6 +1214,7 @@
F4200001A1B2C3D4E5F60718 /* WindowAppearanceSnapshotTests.swift */,
F4100001A1B2C3D4E5F60718 /* PortScannerTests.swift */,
F5000001A1B2C3D4E5F60718 /* SessionPersistenceTests.swift */,
B35750000000000000000009 /* PiVaultAgentPersistenceTests.swift */,
F5410001A1B2C3D4E5F60718 /* RestorableAgentHookProviderResumeTests.swift */,
F5410003A1B2C3D4E5F60718 /* RestorableAgentNonInteractiveTests.swift */,
F5300001A1B2C3D4E5F60718 /* RovoDevSessionIndexTests.swift */,
Expand Down Expand Up @@ -1608,6 +1624,8 @@
A5001005 /* GhosttyTerminalView.swift in Sources */,
C13519000000000000000001 /* TerminalStartupEnvironment.swift in Sources */,
C13519000000000000000005 /* RestorableAgentTypes.swift in Sources */,
B3575000000000000000000C /* SessionIndexModels.swift in Sources */,
B35750000000000000000002 /* VaultAgentRegistry.swift in Sources */,
D3284101A1B2C3D4E5F60718 /* GhosttyTextInputSupport.swift in Sources */,
D7AB00000000000000000005 /* GhosttyNSView+MoveTabToNewWorkspace.swift in Sources */,
D0B1000AA1B2C3D4E5F60001 /* GhosttyTerminalViewSupport.swift in Sources */,
Expand All @@ -1625,6 +1643,7 @@
C7A50B000000000000000002 /* TerminalControllerV2ParamParsingSupport.swift in Sources */,
C7A505000000000000000002 /* TerminalControllerTopSupport.swift in Sources */,
C7A501000000000000000002 /* CmuxTopSnapshot.swift in Sources */,
B35750000000000000000004 /* CmuxTopProcessArguments.swift in Sources */,
C7A508000000000000000002 /* CmuxTopSnapshotScopeCache.swift in Sources */,
C7A502000000000000000002 /* TaskManagerWindowController.swift in Sources */,
C7A506000000000000000002 /* TaskManagerView.swift in Sources */,
Expand Down Expand Up @@ -1707,6 +1726,8 @@
FE001103 /* FileExplorerSearchController.swift in Sources */,
FE001102 /* FileExplorerView.swift in Sources */,
FE003101 /* SessionIndexStore.swift in Sources */,
B35750000000000000000008 /* SessionIndexRegisteredAgents.swift in Sources */,
B35750000000000000000006 /* VaultAgentProcessScanner.swift in Sources */,
FE003104 /* SessionIndexStore+CodexSQL.swift in Sources */,
FE003105 /* RovoDevIndex.swift in Sources */,
FE003106 /* SessionAgentPresentation.swift in Sources */,
Expand Down Expand Up @@ -1812,6 +1833,7 @@
F4200000A1B2C3D4E5F60718 /* WindowAppearanceSnapshotTests.swift in Sources */,
F4100000A1B2C3D4E5F60718 /* PortScannerTests.swift in Sources */,
F5000000A1B2C3D4E5F60718 /* SessionPersistenceTests.swift in Sources */,
B3575000000000000000000A /* PiVaultAgentPersistenceTests.swift in Sources */,
F5410000A1B2C3D4E5F60718 /* RestorableAgentHookProviderResumeTests.swift in Sources */,
F5410002A1B2C3D4E5F60718 /* RestorableAgentNonInteractiveTests.swift in Sources */,
F5300000A1B2C3D4E5F60718 /* RovoDevSessionIndexTests.swift in Sources */,
Expand Down
17 changes: 17 additions & 0 deletions Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -105474,6 +105474,23 @@
}
}
},
"sessionIndex.agent.pi": {
"extractionState": "manual",
"localizations": {
"en": {
"stringUnit": {
"state": "translated",
"value": "Pi"
}
},
"ja": {
"stringUnit": {
"state": "translated",
"value": "Pi"
}
}
}
},
"sessionIndex.agent.rovodev": {
"extractionState": "manual",
"localizations": {
Expand Down
12 changes: 6 additions & 6 deletions Sources/CmuxConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,26 @@ struct CmuxConfigFile: Codable, Sendable {
var newWorkspaceCommand: String?
var surfaceTabBarButtons: [CmuxSurfaceTabBarButton]?
var commands: [CmuxCommandDefinition]
var vault: CmuxVaultConfigDefinition?

private enum CodingKeys: String, CodingKey {
case actions
case ui
case newWorkspaceCommand
case surfaceTabBarButtons
case commands
case actions, ui, newWorkspaceCommand, surfaceTabBarButtons, commands, vault
}

init(
actions: [String: CmuxConfigActionDefinition] = [:],
ui: CmuxConfigUIDefinition? = nil,
newWorkspaceCommand: String? = nil,
surfaceTabBarButtons: [CmuxSurfaceTabBarButton]? = nil,
commands: [CmuxCommandDefinition] = []
commands: [CmuxCommandDefinition] = [],
vault: CmuxVaultConfigDefinition? = nil
) {
self.actions = actions
self.ui = ui
self.newWorkspaceCommand = newWorkspaceCommand
self.surfaceTabBarButtons = surfaceTabBarButtons
self.commands = commands
self.vault = vault
}

init(from decoder: Decoder) throws {
Expand Down Expand Up @@ -79,6 +78,7 @@ struct CmuxConfigFile: Codable, Sendable {
surfaceTabBarButtons = nil
}
commands = try container.decodeIfPresent([CmuxCommandDefinition].self, forKey: .commands) ?? []
vault = try container.decodeIfPresent(CmuxVaultConfigDefinition.self, forKey: .vault)
}

private static func normalizedActions(
Expand Down
90 changes: 90 additions & 0 deletions Sources/CmuxTopProcessArguments.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import Darwin
import Foundation

struct CmuxTopProcessArguments: Sendable {
let arguments: [String]
let environment: [String: String]
}

extension CmuxTopProcessSnapshot {
static func processArgumentsAndEnvironment(for pid: Int) -> CmuxTopProcessArguments? {
guard pid > 0, pid <= Int(Int32.max),
let bytes = kernProcArgsBytes(for: pid) else {
return nil
}
return processArgumentsAndEnvironment(fromKernProcArgs: bytes)
}

static func processArgumentsAndEnvironment(fromKernProcArgs bytes: [UInt8]) -> CmuxTopProcessArguments? {
guard bytes.count > MemoryLayout<Int32>.size else { return nil }

var argcRaw: Int32 = 0
withUnsafeMutableBytes(of: &argcRaw) { rawBuffer in
rawBuffer.copyBytes(from: bytes.prefix(MemoryLayout<Int32>.size))
}
let argc = Int(Int32(littleEndian: argcRaw))
guard argc > 0 else { return nil }

var index = MemoryLayout<Int32>.size
skipString(in: bytes, index: &index)
skipNulls(in: bytes, index: &index)

var arguments: [String] = []
for _ in 0..<argc {
guard index < bytes.count else { return nil }
let start = index
skipString(in: bytes, index: &index)
if start < index,
let argument = String(bytes: bytes[start..<index], encoding: .utf8) {
arguments.append(argument)
}
skipNulls(in: bytes, index: &index)
}

var environment: [String: String] = [:]
while index < bytes.count {
skipNulls(in: bytes, index: &index)
guard index < bytes.count else { break }
let start = index
skipString(in: bytes, index: &index)
guard start < index,
let entry = String(bytes: bytes[start..<index], encoding: .utf8),
let equals = entry.firstIndex(of: "=") else {
continue
}
let key = String(entry[..<equals])
guard !key.isEmpty else { continue }
environment[key] = String(entry[entry.index(after: equals)...])
}

return CmuxTopProcessArguments(arguments: arguments, environment: environment)
}

private static func kernProcArgsBytes(for pid: Int) -> [UInt8]? {
var mib: [Int32] = [CTL_KERN, KERN_PROCARGS2, Int32(pid)]
var size: size_t = 0
guard sysctl(&mib, u_int(mib.count), nil, &size, nil, 0) == 0,
size > MemoryLayout<Int32>.size else {
return nil
}

var buffer = [UInt8](repeating: 0, count: size)
let success = buffer.withUnsafeMutableBytes { rawBuffer in
sysctl(&mib, u_int(mib.count), rawBuffer.baseAddress, &size, nil, 0) == 0
}
guard success else { return nil }
return Array(buffer.prefix(Int(size)))
}

private static func skipString(in bytes: [UInt8], index: inout Int) {
while index < bytes.count, bytes[index] != 0 {
index += 1
}
}

private static func skipNulls(in bytes: [UInt8], index: inout Int) {
while index < bytes.count, bytes[index] == 0 {
index += 1
}
}
}
6 changes: 6 additions & 0 deletions Sources/CmuxTopSnapshot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ final class CmuxTopProcessSnapshot: @unchecked Sendable {
Set(pidsByCMUXSurfaceID[surfaceID] ?? [])
}

func cmuxScopedProcesses() -> [CmuxTopProcessInfo] {
processesByPID.values
.filter { $0.cmuxWorkspaceID != nil && $0.cmuxSurfaceID != nil }
.sorted { $0.pid < $1.pid }
}

func expandedPIDs(rootPIDs: Set<Int>) -> Set<Int> {
var result: Set<Int> = []
var stack = Array(rootPIDs.filter { $0 > 0 })
Expand Down
Loading
Loading