From 9a15ed85b4f82721440e7aa7f2c17acd5a2449d3 Mon Sep 17 00:00:00 2001 From: Nucleic Date: Wed, 5 Aug 2026 03:22:55 -0700 Subject: [PATCH] Merge nucleic/tidy-slate-lynx-t7al into dev --- .../Views/Transcript/SandboxToolDisplay.swift | 3 ++ .../Transcript/TranscriptProjection.swift | 29 ++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/NucleicRemote/NucleicRemote/Views/Transcript/SandboxToolDisplay.swift b/NucleicRemote/NucleicRemote/Views/Transcript/SandboxToolDisplay.swift index 2354eba..b70e0e8 100644 --- a/NucleicRemote/NucleicRemote/Views/Transcript/SandboxToolDisplay.swift +++ b/NucleicRemote/NucleicRemote/Views/Transcript/SandboxToolDisplay.swift @@ -39,6 +39,7 @@ enum SandboxToolDisplay { case "linux_vm_exec", "linux_vm_control": "Linux VM" case "linux_vm_computer", "linux_vm_computer_batch": "Linux VM screen" case "linux_container": "Linux container" + case "nucleic_supervise": "Supervising subagents" default: nil } } @@ -67,6 +68,7 @@ enum SandboxToolDisplay { case "mac_vm_request_operator": "Waiting for you to drive the VM…" case "mac_vm_control": "Managing the macOS VM…" case "linux_vm_control": "Managing the Linux VM…" + case "nucleic_supervise": "Waiting on subagents…" default: nil } } @@ -84,6 +86,7 @@ enum SandboxToolDisplay { case "mac_vm_clear_notifications": "bell.slash" case "mac_vm_request_operator": "hand.raised" case "mac_vm_control", "linux_vm_control": "power" + case "nucleic_supervise": "eye" default: nil } } diff --git a/NucleicRemote/NucleicRemote/Views/Transcript/TranscriptProjection.swift b/NucleicRemote/NucleicRemote/Views/Transcript/TranscriptProjection.swift index 1c4f9e7..54fa145 100644 --- a/NucleicRemote/NucleicRemote/Views/Transcript/TranscriptProjection.swift +++ b/NucleicRemote/NucleicRemote/Views/Transcript/TranscriptProjection.swift @@ -111,6 +111,9 @@ struct ToolGroup: Equatable { /// Unlike a `Task` subagent, a worker runs as its own observed session, so it carries no /// nested `children` here; its card shows the final output it returned instead. static let orchestraSubagentToolName = "mcp__nucleic__nucleic_subagent" + /// The supervisor's blocking worker-event drain. Holder-level Orchestra lock notes that have + /// no edit card in the parent transcript fold onto this card. + static let orchestraSuperviseToolName = "mcp__nucleic__nucleic_supervise" /// Subagent orchestration — a `Task`/`Agent` spawn or a `nucleic_subagent` worker — gets the /// gold card treatment, like the Mac. @@ -157,6 +160,7 @@ enum TranscriptProjection { struct PriorEdit: Equatable { let toolCallID: String /// Repo-relative, normalized paths this call writes (`editedPaths` ∘ `normalizeForLock`). + /// Empty marks a `nucleic_supervise` card for unmatched Orchestra worker locks. let paths: [String] } @@ -204,6 +208,9 @@ enum TranscriptProjection { let items = showRaw ? coalesced : coalesced.filter { !$0.isDebug } let edits = flat.compactMap { item -> PriorEdit? in guard case .tool(let group) = item.kind else { return nil } + if isOrchestraSupervise(group) { + return PriorEdit(toolCallID: group.toolCallID, paths: []) + } let paths = editedPaths(toolName: group.name, input: group.input) .map { normalizeForLock($0, worktreeRoot: root) } .filter { !$0.isEmpty } @@ -243,14 +250,17 @@ enum TranscriptProjection { ) -> [TranscriptItem] { // Each tool item's repo-relative edited paths (only edit-class tools have any), by index. var editsByIndex: [Int: (id: String, paths: [String])] = [:] + var superviseByIndex: [Int: String] = [:] for (i, item) in flat.enumerated() { guard case .tool(let group) = item.kind else { continue } + if isOrchestraSupervise(group) { superviseByIndex[i] = group.toolCallID } let paths = editedPaths(toolName: group.name, input: group.input) .map { normalizeForLock($0, worktreeRoot: worktreeRoot) } .filter { !$0.isEmpty } if !paths.isEmpty { editsByIndex[i] = (group.toolCallID, paths) } } - guard !editsByIndex.isEmpty || !priorEdits.isEmpty else { return flat } + guard !editsByIndex.isEmpty || !superviseByIndex.isEmpty || !priorEdits.isEmpty + else { return flat } let priorIDs = Set(priorEdits.map(\.toolCallID)) var locksByCall: [String: [NoteLock]] = [:] @@ -279,6 +289,19 @@ enum TranscriptProjection { break } } + if hitID == nil { + for j in stride(from: i - 1, through: 0, by: -1) { + if let supervise = superviseByIndex[j] { hitID = supervise; break } + } + if hitID == nil { + for j in (i + 1).. Bool { + group.name == ToolGroup.orchestraSuperviseToolName || group.name == "nucleic_supervise" + } + /// Make a raw tool-call path comparable to a lock note's repo-relative path: strip the worktree /// root prefix and normalize. A path not under the root is left as-is (it simply won't overlap). /// Mirrors the Mac's `normalizeForLock`.