Skip to content

A tiny friend in your Mac's notch and on your iPhone that keeps an eye on your AI coding agents: Claude Code, Codex, Cursor, Gemini CLI, Antigravity and more. Approve from the notch or your Lock Screen.

Make agent pills visible in the prefix(4) / slice(0,4) display

Louis Raillef612110ffb50
diff --git a/NotchBuddy/Sources/App/HookServer.swift b/NotchBuddy/Sources/App/HookServer.swift
index 5df16235..e4ddafd5 100644
--- a/NotchBuddy/Sources/App/HookServer.swift
+++ b/NotchBuddy/Sources/App/HookServer.swift
@@ -299,13 +299,18 @@ final class HookServer: @unchecked Sendable {
/// Creates a dynamic pill for a third-party agent on first event, then no-ops.
/// ID format: "agent_<name>" — never collides with "integration_*" pills.
+ /// Inserted right after integration_claude so it appears in the visible prefix(4).
@MainActor
private func upsertExternalAgent(id: String, name: String) {
let state = AppState.shared
guard state.tasks.firstIndex(where: { $0.id == id }) == nil else { return }
let color = IslandConst.colorForProject(name)
let task = AgentTask(id: id, name: name, color: color, state: .idle, steps: [], source: .agent)
- state.tasks.append(task)
+ if let claudeIdx = state.tasks.firstIndex(where: { $0.id == "integration_claude" }) {
+ state.tasks.insert(task, at: claudeIdx + 1)
+ } else {
+ state.tasks.append(task)
+ }
if state.focusId == nil { state.focusId = id }
state.syncMode()
}
diff --git a/windows/src/core/state.ts b/windows/src/core/state.ts
index cc52fc11..fb2c4da5 100644
--- a/windows/src/core/state.ts
+++ b/windows/src/core/state.ts
@@ -208,16 +208,21 @@ class AppState {
if (shouldLoad && idx < 0) this.tasks.push({ ...proto, steps: [] });
if (!shouldLoad && idx >= 0) this.tasks.splice(idx, 1);
}
- // Keep the declared order so pills never shuffle.
- // Dynamic agent_ pills (coucou_agent) are not in the order list — sort them last.
+ // Order: integration_claude first, then agent_* pills (visible in slice(0,4)),
+ // then other integrations in declaration order.
const order = INTEGRATION_AGENTS.map((t) => t.id);
this.tasks.sort((a, b) => {
- const ia = order.indexOf(a.id);
- const ib = order.indexOf(b.id);
- if (ia < 0 && ib < 0) return 0;
- if (ia < 0) return 1;
- if (ib < 0) return -1;
- return ia - ib;
+ const isAgentA = a.id.startsWith("agent_");
+ const isAgentB = b.id.startsWith("agent_");
+ // integration_claude always first
+ if (a.id === "integration_claude") return -1;
+ if (b.id === "integration_claude") return 1;
+ // agent_* before other integrations; preserve insertion order among themselves
+ if (isAgentA && !isAgentB) return -1;
+ if (isAgentB && !isAgentA) return 1;
+ if (isAgentA && isAgentB) return 0;
+ // both known integrations → declaration order
+ return order.indexOf(a.id) - order.indexOf(b.id);
});
if (!this.focusId) this.focusId = "integration_claude";
this.notify();