Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Dial: a question always says who is asking, and a tap opens it

0xdiego2509218c511c88
diff --git a/cli/src/cable/cableHost.spec.ts b/cli/src/cable/cableHost.spec.ts
index 1c97d5442..bbbcf649f 100644
--- a/cli/src/cable/cableHost.spec.ts
+++ b/cli/src/cable/cableHost.spec.ts
@@ -339,6 +339,22 @@ describe('DaemonCableHost.listAgentsFlat across machines, and the tab the dial g
expect(host.activeSwarm()).toBe('')
})
+ it('names the machine, and routes an open, for an agent heard from before it was listed', async () => {
+ // A remote machine's question can arrive before its agent list has ever been read. The card still has
+ // to say where it came from, and a tap on it has to open — "ignored open for unknown agent" was a
+ // question screen nobody could act on.
+ AGENTS.length = 0
+ const opened = vi.fn()
+ const host = new DaemonCableHost(wiring({ opened }), crossFleet({ other: [] }))
+ await settled(host)
+
+ expect(host.describe('r9')).toBeUndefined()
+ host.noteAgent('other', 'r9')
+ expect(host.describe('r9')).toEqual({ name: '', engine: '', machine: 'office-imac' })
+ host.openAgent('r9')
+ expect(opened).toHaveBeenCalledWith('other', 'r9')
+ })
+
it('describes an agent it has listed, for a card about one the dial does not hold', async () => {
AGENTS.length = 0
AGENTS.push({ agentId: 'a1', registeredAt: 1, active: true, terminalAvailable: true, engine: 'codex' })
diff --git a/cli/src/cable/cableHost.ts b/cli/src/cable/cableHost.ts
index c61ed2e50..8f602a438 100644
--- a/cli/src/cable/cableHost.ts
+++ b/cli/src/cable/cableHost.ts
@@ -424,10 +424,30 @@ export class DaemonCableHost implements CableHost {
* with that copy gone, the frame has to say who it is about.
*/
describe(agentId: string): { name: string; engine: string; machine: string } | undefined {
- const a = this.knownAgents.get(agentId)
- return a ? { name: a.name, engine: a.engine ?? '', machine: a.machine ?? '' } : undefined
+ const a = this.knownAgents.get(agentId) ?? this.localAgents().find((x) => x.id === agentId)
+ if (a) return { name: a.name, engine: a.engine ?? '', machine: a.machine ?? '' }
+ // A remote agent whose machine has spoken (a question, a card) before its list was ever read: no
+ // name to give, but the machine's is better than nothing on a screen asking for a decision.
+ const machineId = this.seenOn.get(agentId)
+ const machine = machineId ? this.machineNames.get(machineId) ?? '' : ''
+ return machineId ? { name: '', engine: '', machine } : undefined
}
+ /**
+ * A card arrived from a machine for an agent. Remembered so a `question` or `summary` about an agent
+ * this daemon has never LISTED — a remote machine's, before its list was read, or one on a tab the
+ * window has not opened — can still be described and, when tapped, opened: `machineOf` falls back to
+ * this, and without it the open was "ignored for unknown agent" and the tap did nothing.
+ */
+ noteAgent(machineId: string, agentId: string): void {
+ if (machineId && agentId) this.seenOn.set(agentId, machineId)
+ }
+
+ /** agentId → machineId for agents heard from but not (yet) listed — see noteAgent. */
+ private readonly seenOn = new Map<string, string>()
+ /** machineId → name, from the last wheel read, for describe(). */
+ private machineNames = new Map<string, string>()
+
/**
* EVERY agent in LIST order — this computer first, then each machine in wheel order — the fleet the
* dial no longer holds.
@@ -441,6 +461,7 @@ export class DaemonCableHost implements CableHost {
async listAgentsFlat(): Promise<CableAgent[]> {
const out = this.localAgents()
const { machines } = await this.listMachines()
+ this.machineNames = new Map(machines.map((m) => [m.id, m.name]))
for (const m of machines) {
if (m.local) continue
const entry = this.remoteAgents.get(m.id)
@@ -490,7 +511,7 @@ export class DaemonCableHost implements CableHost {
* turn to a different computer, which is the worst outcome this whole feature can produce.
*/
private machineOf(agentId: string): string {
- return this.agentMachine.get(agentId) ?? ''
+ return this.agentMachine.get(agentId) ?? this.seenOn.get(agentId) ?? ''
}
openAgent(agentId: string): void {
diff --git a/cli/src/cli.ts b/cli/src/cli.ts
index a9f551419..adcb7ef6c 100644
--- a/cli/src/cli.ts
+++ b/cli/src/cli.ts
@@ -4931,6 +4931,9 @@ async function runForeground(session: AuthSession): Promise<void> {
// whichever machine is selected. Filtering it with the guard below would freeze the dots the moment
// the dial came back to this computer, which is where it sits most of the time.
if (event.kind === 'state') { void cable.syncMachines(); return }
+ // Which machine this agent is on, before its list is necessarily read — what lets a question from it
+ // be named and, tapped, opened. See DaemonCableHost.noteAgent.
+ cableHost.noteAgent(event.machineId, event.agentId)
// No selection guard. Every machine's agents are on the carousel at once, so a card from a machine
// the wheel is not pointed at still belongs to a tile the user can see — and dropping it is what a
// tile that never leaves "Working…" looks like from the outside.
diff --git a/devices/harness-device/firmware/main/cable_client.c b/devices/harness-device/firmware/main/cable_client.c
index 8e00ba255..8fadcafaa 100644
--- a/devices/harness-device/firmware/main/cable_client.c
+++ b/devices/harness-device/firmware/main/cable_client.c
@@ -714,7 +714,7 @@ static void handle_message(const cJSON *root)
if (strcmp(t, "question") == 0) {
const cJSON *questions = cJSON_GetObjectItemCaseSensitive(p, "questions");
// The name rides on the frame for the same reason as on `summary`: the asker may be off this tab.
- if (agent_id && questions) ui_question_show(agent_id, str_of(p, "name"), str_of(p, "id"), questions);
+ if (agent_id && questions) ui_question_show(agent_id, str_of(p, "name"), str_of(p, "machine"), str_of(p, "id"), questions);
return;
}
// Somebody else answered it. A question is a dialog in a tmux pane, not a shared object, so this is
diff --git a/devices/harness-device/firmware/main/ui/ui_screens.c b/devices/harness-device/firmware/main/ui/ui_screens.c
index e6dd11800..c80eaa0fa 100644
--- a/devices/harness-device/firmware/main/ui/ui_screens.c
+++ b/devices/harness-device/firmware/main/ui/ui_screens.c
@@ -6837,6 +6837,7 @@ static EXT_RAM_BSS_ATTR struct {
bool active;
char request_id[80];
char who[64]; // the asker's name, from the frame — it may be on a tab the dial does not hold
+ char machine[NAME_MAX]; // and its machine's name, shown when it is not the cabled computer
char project[48];
qitem_t q[Q_MAX];
char answer[Q_MAX][256]; // chosen label(s) or transcript, per question
@@ -6845,6 +6846,7 @@ static EXT_RAM_BSS_ATTR struct {
} s_q;
static void q_render(void);
+static void machine_toast(const char *msg); // defined with the machine picker, below
static void q_advance(void);
static void q_cancel(void);
static void q_opt_tap(lv_event_t *e);
@@ -6948,35 +6950,65 @@ static lv_obj_t *q_add_btn(const char *txt, lv_color_t txtcol, lv_color_t bg, lv
// Rebuild the question screen for the current question (caller holds the lock). Figma layout:
// bold prompt title (32px) · dark option pills (selected → green ✓) · blue "Done". Tap-only: a question
// is answered by picking an option, never by voice.
+// The eyebrow or the question was tapped: ask the window to open this agent, and say so.
+static void q_open_tap(lv_event_t *e)
+{
+ (void)e;
+ if (!s_q.project[0]) return;
+ cable_client_send_open(s_q.project);
+ machine_toast("Opening in the app");
+}
+
static void q_render(void)
{
lv_obj_clean(scr_question);
qitem_t *q = &s_q.q[s_q.idx];
// WHO is asking, above the question (owner, 2026-09-15: "noti cần thêm tên của agent ở phía trên …
- // để user có thêm context ra quyết định"). The same question — "switch to the cheaper model?" —
- // means different things from a scratch agent and from the one mid-deploy. Muted, small, one line:
- // an eyebrow, not a second title.
+ // để user có thêm context ra quyết định"; again 2026-09-17: a limit dialog with three options and no
+ // name is a decision nobody can make). The same question — "switch to the cheaper model?" — means
+ // different things from a scratch agent and from the one mid-deploy. Muted, small, one line: an
+ // eyebrow, not a second title. ALWAYS drawn: with no name at all it still says "Agent", and the
+ // machine follows when it is not the cabled computer.
//
- // From the FRAME, not from the tile: the dial holds one tab, and the question may come from an agent
- // on another. The tile's name is the fallback for a daemon that sent none.
+ // From the FRAME first: the dial holds one tab, and the question may come from an agent on another.
+ // The tile's name is the fallback for a daemon that sent none.
+ //
+ // TAPPABLE: the eyebrow and the question both ask the window to open the agent — the same `open`
+ // sent when the screen appeared, sent again on purpose (owner, 2026-09-17: "bấm vào để focus trên
+ // app cũng không được"). The first one went out while the person was still reading; this one is a
+ // request, and it says so.
{
int ai = s_q.who[0] ? -1 : find_proj(s_q.project);
- if (s_q.who[0] || (ai >= 0 && s_proj[ai].name[0])) {
- static char who[64];
- utf8_filter(s_q.who[0] ? s_q.who : s_proj[ai].name, who, sizeof(who));
- lv_obj_t *l = lv_label_create(scr_question);
- lv_label_set_long_mode(l, LV_LABEL_LONG_DOT);
- lv_obj_set_width(l, lv_pct(100));
- lv_obj_set_style_text_font(l, &geist_sem_24, 0);
- lv_obj_set_style_text_color(l, COL_MUTED, 0);
- lv_obj_set_style_text_align(l, LV_TEXT_ALIGN_CENTER, 0);
- lv_obj_set_style_pad_bottom(l, 2, 0);
- lv_label_set_text(l, who);
+ const char *nm = s_q.who[0] ? s_q.who : (ai >= 0 && s_proj[ai].name[0]) ? s_proj[ai].name : "Agent";
+ const char *here = cable_client_machine_name();
+ static char who[64 + NAME_MAX + 4];
+ char nmf[64]; utf8_filter(nm, nmf, sizeof(nmf));
+ if (s_q.machine[0] && strcmp(s_q.machine, here ? here : "") != 0) {
+ char mf[NAME_MAX]; utf8_filter(s_q.machine, mf, sizeof(mf));
+ snprintf(who, sizeof who, "%s \xC2\xB7 %s", nmf, mf);
+ } else {
+ snprintf(who, sizeof who, "%s", nmf);
}
+ lv_obj_t *l = lv_label_create(scr_question);
+ lv_label_set_long_mode(l, LV_LABEL_LONG_DOT);
+ lv_obj_set_size(l, lv_pct(100), lv_font_get_line_height(&geist_sem_24) + 2);
+ lv_obj_set_style_text_font(l, &geist_sem_24, 0);
+ lv_obj_set_style_text_color(l, COL_MUTED, 0);
+ lv_obj_set_style_text_align(l, LV_TEXT_ALIGN_CENTER, 0);
+ lv_obj_set_style_pad_bottom(l, 2, 0);
+ lv_label_set_text(l, who);
+ lv_obj_add_flag(l, LV_OBJ_FLAG_CLICKABLE);
+ lv_obj_set_ext_click_area(l, 10);
+ lv_obj_add_event_cb(l, q_open_tap, LV_EVENT_CLICKED, NULL);
}
static char tmp[256];
utf8_filter(q->text, tmp, sizeof(tmp));
q_add_text(tmp[0] ? tmp : "?", COL_FG, &geist_med_32); // prompt = title
+ { // the title opens the agent in the window too — see the eyebrow
+ lv_obj_t *t = lv_obj_get_child(scr_question, -1);
+ lv_obj_add_flag(t, LV_OBJ_FLAG_CLICKABLE);
+ lv_obj_add_event_cb(t, q_open_tap, LV_EVENT_CLICKED, NULL);
+ }
for (int i = 0; i < q->n_options; i++) {
char ftxt[100]; utf8_filter(q->options[i], ftxt, sizeof(ftxt));
char shown[100]; q_clip_words(ftxt, shown, sizeof(shown), Q_OPT_MAX_WORDS); // display only
@@ -7110,7 +7142,7 @@ static void q_done_tap(lv_event_t *e)
display_unlock();
}
-void ui_question_show(const char *project_id, const char *agent_name, const char *request_id, const struct cJSON *questions)
+void ui_question_show(const char *project_id, const char *agent_name, const char *machine, const char *request_id, const struct cJSON *questions)
{
if (!request_id || !questions) return;
display_lock();
@@ -7120,6 +7152,7 @@ void ui_question_show(const char *project_id, const char *agent_name, const char
snprintf(s_q.request_id, sizeof(s_q.request_id), "%s", request_id);
snprintf(s_q.project, sizeof(s_q.project), "%s", project_id ? project_id : "");
snprintf(s_q.who, sizeof(s_q.who), "%s", agent_name ? agent_name : "");
+ snprintf(s_q.machine, sizeof(s_q.machine), "%s", machine ? machine : "");
int qi = 0;
const cJSON *qn;
diff --git a/devices/harness-device/firmware/main/ui/ui_screens.h b/devices/harness-device/firmware/main/ui/ui_screens.h
index 79917a09f..39a6cd396 100644
--- a/devices/harness-device/firmware/main/ui/ui_screens.h
+++ b/devices/harness-device/firmware/main/ui/ui_screens.h
@@ -331,7 +331,7 @@ void ui_project_set_agents(const char *project_id, const struct cJSON *agents);
// Show the question screen: tap an option row to answer (single/multi-select). Tap-only — there is no
// voice answer. `questions` is the cJSON array from the `commander_question` frame; copied out
// synchronously, so the caller may free the JSON right after this returns.
-void ui_question_show(const char *project_id, const char *agent_name, const char *request_id, const struct cJSON *questions);
+void ui_question_show(const char *project_id, const char *agent_name, const char *machine, const char *request_id, const struct cJSON *questions);
// That question was answered somewhere else (the app, or the pane by hand) — leave the screen instead of
// waiting for an answer that can no longer be delivered. No-op unless THIS request is the one on screen.
void ui_question_close(const char *project_id, const char *request_id);