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.

feat(cli): the dial's carousel walks the open panes, and only those

0xdiego25c41688cb79ce
diff --git a/cli/src/cable/cableHost.spec.ts b/cli/src/cable/cableHost.spec.ts
index dbcccdb64..2cb9fd73e 100644
--- a/cli/src/cable/cableHost.spec.ts
+++ b/cli/src/cable/cableHost.spec.ts
@@ -366,14 +366,13 @@ describe('DaemonCableHost.listAgents across machines', () => {
host.focus('r1')
- // No edge: the window has reported no tiles, so there is no desk to be off
- // the end of and nothing for it to replace.
- expect(focused).toHaveBeenCalledWith('other', 'r1', undefined)
+ expect(focused).toHaveBeenCalledWith('other', 'r1')
})
- it('tells the window which end of the desk an off-desk agent belongs to', async () => {
- // The dial never reports which way the thumb went. It does not have to: an
- // agent's side of the ring is the answer, and the ring is built here.
+ it('reports a focus with no edge, on or off the desk', async () => {
+ // `edge` is gone with the arcs. It answered "which tile does this replace" for an agent the window
+ // had none for, which the carousel could reach by walking past the end of the desk; it walks only
+ // the desk now, so every focus it can raise is about a tile that already exists.
AGENTS.length = 0
for (const agentId of ['a1', 'a2', 'a3']) {
AGENTS.push({ agentId, registeredAt: 1, active: true, terminalAvailable: true, engine: 'claude' })
@@ -385,14 +384,30 @@ describe('DaemonCableHost.listAgents across machines', () => {
host.setDesk(['a2'])
await host.listAgents()
- host.focus('a3')
- expect(focused).toHaveBeenLastCalledWith(expect.any(String), 'a3', 'tail')
- host.focus('a1')
- expect(focused).toHaveBeenLastCalledWith(expect.any(String), 'a1', 'head')
- // On the desk already: the window focuses that tile rather than replacing
- // one, so there is no edge to name.
host.focus('a2')
- expect(focused).toHaveBeenLastCalledWith(expect.any(String), 'a2', undefined)
+ expect(focused).toHaveBeenLastCalledWith(expect.any(String), 'a2')
+ // Even for one the carousel does not walk — the switcher can still name it, and the window opening
+ // it is what puts it on the desk.
+ host.focus('a3')
+ expect(focused).toHaveBeenLastCalledWith(expect.any(String), 'a3')
+ })
+
+ it('walks the desk and nothing else', async () => {
+ AGENTS.length = 0
+ for (const agentId of ['a1', 'a2', 'a3', 'a4']) {
+ AGENTS.push({ agentId, registeredAt: 1, active: true, terminalAvailable: true, engine: 'claude' })
+ }
+ const host = new DaemonCableHost(wiring())
+ await settled(host)
+
+ host.setDesk(['a3', 'a1'])
+ const listed = await host.listAgents()
+
+ // Tile order first — that is what the dial walks — then everything else, marked so the session can
+ // count the split. The old ring wrapped the desk in two arcs of off-desk agents; a thumb can no
+ // longer step onto one at all.
+ expect(listed.map((a) => a.id)).toEqual(['a3', 'a1', 'a2', 'a4'])
+ expect(listed.filter((a) => !a.offRing).map((a) => a.id)).toEqual(['a3', 'a1'])
})
it('pushes the agents in ring order, tiles first', async () => {
diff --git a/cli/src/cable/cableHost.ts b/cli/src/cable/cableHost.ts
index 3c72131b5..4998df852 100644
--- a/cli/src/cable/cableHost.ts
+++ b/cli/src/cable/cableHost.ts
@@ -8,7 +8,7 @@
// read, the router is the one the backend already calls for remote machines, and the turn events arrive
// as the very `commander_event` cards the WiFi device receives — teed at the socket rather than emitted
// again here, so the two device surfaces cannot drift.
-import { deskRing, type DeskEdge } from './deskRing.js'
+import { deskRing } from './deskRing.js'
import { join } from 'node:path'
import { AuthSessionManager, readAuthSession } from '../lib/authSession.js'
@@ -47,7 +47,7 @@ export interface CableHostWiring {
/** The runtime catalog, from the same provider the web and the WiFi device read. */
listModels?: (agentId: string) => Promise<Array<{ id: string }>>
/** The dial moved to another agent — the desktop window should show that agent on its own machine. */
- focused?: (machineId: string, agentId: string, edge?: DeskEdge) => void
+ focused?: (machineId: string, agentId: string) => void
/** A notification was tapped: the window gives that agent a tile of its own. */
opened?: (machineId: string, agentId: string) => void
/** A finger on the dial's glass, in pieces, while it is down. */
@@ -291,8 +291,6 @@ export class DaemonCableHost implements CableHost {
*/
private desk: string[] = []
- /** Which edge of the desk an off-desk agent belongs to. Rebuilt with the ring. */
- private deskEdge = new Map<string, DeskEdge>()
/**
* Every agent this daemon has listed since it started, by id.
@@ -324,7 +322,6 @@ export class DaemonCableHost implements CableHost {
const out = await this.listAgentsFlat()
const ring = deskRing(out.map((a) => a.id), this.desk)
- this.deskEdge = ring.edgeOf
// Walked agents first, then the ones the dial knows but does not walk to —
// the session sends the count of the first group, so the order is the split.
const listed = [...ring.order, ...ring.offRing]
@@ -588,13 +585,11 @@ export class DaemonCableHost implements CableHost {
this.wiring.log(`cable: ignored focus for unknown agent ${agentId}`)
return
}
- // Which tile the window should put this agent in, for one it has no tile
- // for: the edge of the desk the agent belongs to. The dial never says which
- // way the thumb went — it does not have to, because an agent's side of the
- // ring already answers it.
- const edge = this.deskEdge.get(agentId)
- this.wiring.log(`cable: focus ${machineId}/${agentId}${edge ? ` (off-desk, ${edge})` : ''}`)
- this.wiring.focused?.(machineId, agentId, edge)
+ // No edge to name any more: the carousel only walks agents the window already has a tile for, so a
+ // focus arriving from the dial is always about a tile that exists. Which tile to REPLACE was the
+ // only question the old arcs answered, and there is nothing left to replace.
+ this.wiring.log(`cable: focus ${machineId}/${agentId}`)
+ this.wiring.focused?.(machineId, agentId)
}
scrolled(phase: 'down' | 'move' | 'up', dy: number, velocity: number): void {
diff --git a/cli/src/cable/deskRing.spec.ts b/cli/src/cable/deskRing.spec.ts
index df4a0fbe4..9b55ec124 100644
--- a/cli/src/cable/deskRing.spec.ts
+++ b/cli/src/cable/deskRing.spec.ts
@@ -1,196 +1,61 @@
import { describe, expect, it } from 'vitest'
import { deskRing } from './deskRing.js'
-// The fixture from the design review, so a case here reads the same as the case
-// that was approved:
-//
-// machine mac : a1 a2 a3 a4 a5 machine vm : b1 b2 b3 b4
-// tiles : [1]=a2 [2]=b1 [3]=a5 [4]=b2
-const FLAT = ['a1', 'a2', 'a3', 'a4', 'a5', 'b1', 'b2', 'b3', 'b4']
-const DESK = ['a2', 'b1', 'a5', 'b2']
-
-describe('desk ring', () => {
- it('puts the tiles in the middle, in tile order', () => {
- // Tile order, NOT flat order: the dial walks the grid the eyes are on, and
- // a5 sits between b1 and b2 here because that is where its tile sits.
- const { order } = deskRing(FLAT, DESK)
- const desk = order.slice(order.indexOf('a2'), order.indexOf('a2') + 4)
- expect(desk).toEqual(DESK)
- })
-
- it('the step past the last tile is the next agent on that tile\'s machine', () => {
- // C2: off the tail from b2 (machine vm) lands on b3, not on some agent of
- // whichever machine happens to be first in the list.
- const { order, edgeOf } = deskRing(FLAT, DESK)
- expect(order[order.indexOf('b2') + 1]).toBe('b3')
- expect(edgeOf.get('b3')).toBe('tail')
- })
-
- it('the step before the first tile is the agent before it on ITS machine', () => {
- // C5: off the head from a2 (machine mac) lands on a1.
- const { order, edgeOf } = deskRing(FLAT, DESK)
- expect(order[order.indexOf('a2') - 1]).toBe('a1')
- expect(edgeOf.get('a1')).toBe('head')
- })
-
- it('holds each agent it carries once, and says which it does not carry', () => {
- // The ring is the desk plus the two directions off it. a3 and a4 sit BETWEEN
- // the first and last tile in list order, so they are in neither direction —
- // see the note in deskRing.ts for why neither end of the ring can hold them.
- const { order } = deskRing(FLAT, DESK)
- expect(order).toEqual(['a1', 'a2', 'b1', 'a5', 'b2', 'b3', 'b4'])
- expect(new Set(order).size).toBe(order.length)
- expect(order).not.toContain('a3')
- expect(order).not.toContain('a4')
- })
-
- it('hands back what it left off the walk, rather than losing it', () => {
- // The dial is still TOLD about these. It counts its agents on the overview
- // and lists them in the pull-down switcher, so dropping them outright made
- // it say "5 agents" to someone who has eleven.
- const { order, offRing } = deskRing(FLAT, DESK)
- expect(offRing).toEqual(['a3', 'a4'])
- expect([...order, ...offRing].sort()).toEqual([...FLAT].sort())
- })
-
- it('an agent belongs to the end of the desk it is reached from', () => {
- const { edgeOf } = deskRing(FLAT, DESK)
- // Past b2, the last tile: the rest of the list forward.
- expect(edgeOf.get('b3')).toBe('tail')
- expect(edgeOf.get('b4')).toBe('tail')
- // Before a2, the first tile: the list running back.
- expect(edgeOf.get('a1')).toBe('head')
- // Off the ring, so no end claims them and there is nothing to replace.
- expect(edgeOf.has('a3')).toBe(false)
- expect(edgeOf.has('a4')).toBe(false)
- })
-
- it('walks on into the next machine when a machine runs out', () => {
- // C4/D3: b2 is on `vm`, so the step off that tile is the rest of vm — and
- // when a machine runs out the list carries on into the next one, because it
- // is one list. It stops at the list's end, where Settings is.
- const { order } = deskRing(FLAT, DESK)
- expect(order.slice(order.indexOf('b2') + 1)).toEqual(['b3', 'b4'])
- })
-
- it('the walk ENDS instead of circling, which is what reaches Settings', () => {
- // The bug this rule exists for, found on the real dial: the arcs used to
- // wrap. Every step onto an off-desk agent puts it on the desk and re-forms
- // the ring, so a wrapping walk never reached an end — the thumb went round
- // eleven agents forever, and the Settings and Machines tiles, which the
- // carousel keeps AFTER the agents, could not be reached at all.
- const { order } = deskRing(FLAT, DESK)
- expect(new Set(order).size).toBe(order.length)
- // Both ends of the ring are the list's own ends in that direction, so one
- // more step off either is the overview on the left, Settings on the right.
- expect(order[0]).toBe('a1')
- expect(order[order.length - 1]).toBe('b4')
- })
-
- it('with nothing past the last tile, the leftovers tuck into the other arc', () => {
- // Mirror of the case above: b4 is the list's last agent AND a tile, so the
- // forward arc is empty and there is no "inside" on the right to tuck into.
- // The left arc takes them — one step in, so its first element is still the
- // list's first agent and the overview stays one step off the ring's end.
- const { order } = deskRing(FLAT, ['a3', 'b4'])
- expect(order[0]).toBe('a1')
- expect(order[order.length - 1]).toBe('b4')
- // The step left off a3 is still the agent before it in the list.
- expect(order[order.indexOf('a3') - 1]).toBe('a2')
- })
-
- it('a desk holding BOTH ends of the list is the whole ring', () => {
- // Reported twice from the dial, once from each side: tile 1 was the first
- // agent in the list and tile 4 the last, so there is nothing to the left of
- // the first tile and nothing to the right of the last one. The swipe then
- // walks the open tiles and nothing else — one step off either end is the
- // overview or Settings, which is what the end of the list means.
- const desk = ['a1', 'a3', 'b1', 'b4']
- const { order, edgeOf } = deskRing(FLAT, desk)
- expect(order).toEqual(desk)
- // No end is left to claim, so nothing off the ring can claim one.
- expect(edgeOf.size).toBe(0)
- })
-
- it('one agent past the desk is that step, and the ring end', () => {
- const desk = ['a1', 'a3', 'b1', 'b3']
- const { order, edgeOf } = deskRing(FLAT, desk)
- expect(order).toEqual([...desk, 'b4'])
- expect(edgeOf.get('b4')).toBe('tail')
- })
-
- it('a walk off the last tile reaches the other machine before Settings', () => {
- // The exact shape on the dial when this was reported, ids and all: nine
- // agents on this computer and two on `machine-remote-3`, four tiles open,
- // the last of them `fa69` on that remote machine.
- const flat = [
- '5899', '37c1', 'dbae', 'acf6', 'f9aa', 'b884', '562d', 'a9e2', '9e01', // this computer
- 'fa69', 'f3c3', // machine-remote-3
- ]
- const { order } = deskRing(flat, ['5899', 'acf6', 'b884', 'fa69'])
- // One step right off the last tile is that machine's remaining agent, and
- // the ring ends there — so the step after it is Settings.
- expect(order[order.indexOf('fa69') + 1]).toBe('f3c3')
- expect(order[order.length - 1]).toBe('f3c3')
- // And one step LEFT off the first tile is the overview, because `5899` is
- // the first agent in the list: exactly the report this rule came from.
- expect(order[0]).toBe('5899')
- })
-
- it('the left end is CLEAR when the first tile is the first agent', () => {
- // Straight from the dial: pane 1 held the first agent in the list, and a
- // swipe left landed on some other machine's agent instead of the overview.
- // Leftovers used to be parked at the far left, which put one of them
- // between the first tile and the overview the carousel keeps before the
- // agents.
- const { order } = deskRing(FLAT, ['a1', 'b2']);
- expect(order[0]).toBe('a1')
- })
-
- it('the walk back ENDS at the start of the list, before the overview', () => {
- const { order } = deskRing(FLAT, ['a3'])
- // Left off the only tile: a2, then a1, then the carousel's own overview.
- const at = order.indexOf('a3')
- expect(order.slice(0, at)).toEqual(['a1', 'a2'])
- })
-
- it('a single tile makes the dial a plain browser of the list', () => {
- // C6: one tile means both edges are the same tile, so both directions
- // replace it. Everything belongs to the forward arc; nothing is listed
- // twice.
- const { order, edgeOf } = deskRing(FLAT, ['a3'])
- expect([...order].sort()).toEqual([...FLAT].sort())
- expect(new Set(order).size).toBe(order.length)
- // One step each way off the only tile is one step each way in the list.
- const at = order.indexOf('a3')
- expect(order[at + 1]).toBe('a4')
- expect(order[at - 1]).toBe('a2')
- // Both edges are the same tile, so whichever way the thumb goes the window
- // replaces that tile — the dial is a plain browser of the list.
- expect(edgeOf.get('a4')).toBe('tail')
- expect(edgeOf.get('a2')).toBe('head')
- })
-
- it('with no tiles the flat list stands, and no agent claims an edge', () => {
- // C7/D4: there is no desk to walk off, so there is no edge tile to replace
- // — the window opens a new tile instead, and that is its call to make.
- const { order, edgeOf } = deskRing(FLAT, [])
- expect(order).toEqual(FLAT)
- expect(edgeOf.size).toBe(0)
- })
-
- it('ignores a tile naming an agent the list has never heard of', () => {
- // A tile can name an agent on a machine that has gone quiet. That is a
- // reason to leave it out of the ring, not to drop the ring.
- const { order } = deskRing(FLAT, ['a2', 'ghost', 'b1'])
- expect(order).toContain('a2')
- expect(order).toContain('b1')
- expect(order).not.toContain('ghost')
- })
-
- it('every tile open means a ring of exactly the tiles', () => {
- const { order, edgeOf } = deskRing(['a1', 'a2'], ['a2', 'a1'])
- expect(order).toEqual(['a2', 'a1'])
- expect(edgeOf.size).toBe(0)
+/** Every agent the daemon knows, in the order the dial reads them. */
+const FLAT = ['a1', 'a2', 'a3', 'a4', 'a5']
+
+describe('deskRing', () => {
+ it('walks the window\'s tiles, in tile order', () => {
+ const ring = deskRing(FLAT, ['a3', 'a1'])
+ // TILE ORDER, not list order. The point of the ring is that a thumb walks the same grid the eyes
+ // are looking at, so the window's arrangement wins over the daemon's.
+ expect(ring.order).toEqual(['a3', 'a1'])
+ })
+
+ it('leaves every other agent off the walk, but does not drop it', () => {
+ const ring = deskRing(FLAT, ['a2'])
+ expect(ring.order).toEqual(['a2'])
+ // Still sent, still counted on the overview, still in the pull-down switcher. Leaving them out of
+ // the LIST is what once made a dial announce "5 agents" to someone who had eleven.
+ expect(ring.offRing).toEqual(['a1', 'a3', 'a4', 'a5'])
+ })
+
+ it('walks everything when there are no tiles at all', () => {
+ // A window that is shut, or a daemon nobody has opened one against. A ring built strictly from an
+ // empty desk would be empty — eight agents on the machine and a carousel showing none of them,
+ // which reads as a broken dial rather than as a closed window.
+ const ring = deskRing(FLAT, [])
+ expect(ring.order).toEqual(FLAT)
+ expect(ring.offRing).toEqual([])
+ })
+
+ it('ignores tiles this daemon has never heard of', () => {
+ // A tile can name an agent on a machine that has gone quiet. The ring is no place to learn that,
+ // and a walk that stepped onto an id nothing can be looked up by lands on a blank tile.
+ const ring = deskRing(FLAT, ['a2', 'ghost', 'a4'])
+ expect(ring.order).toEqual(['a2', 'a4'])
+ expect(ring.offRing).toEqual(['a1', 'a3', 'a5'])
+ })
+
+ it('falls back to the whole list when the desk names nothing real', () => {
+ // Same as an empty desk, and it has to be: a window whose tiles are all on a machine that stopped
+ // answering is a window with no usable desk.
+ const ring = deskRing(FLAT, ['ghost', 'phantom'])
+ expect(ring.order).toEqual(FLAT)
+ expect(ring.offRing).toEqual([])
+ })
+
+ it('puts every agent in exactly one of the two groups', () => {
+ // The session sends the count of the first group and the dial splits the pushed list on it, so an
+ // id in both — or in neither — is a tile the dial either walks twice or cannot see.
+ const ring = deskRing(FLAT, ['a4', 'a2'])
+ expect([...ring.order, ...ring.offRing].sort()).toEqual([...FLAT].sort())
+ expect(new Set(ring.order).size + new Set(ring.offRing).size).toBe(FLAT.length)
+ })
+
+ it('walks the whole list when every agent has a tile', () => {
+ const ring = deskRing(FLAT, ['a5', 'a4', 'a3', 'a2', 'a1'])
+ expect(ring.order).toEqual(['a5', 'a4', 'a3', 'a2', 'a1'])
+ expect(ring.offRing).toEqual([])
})
})
diff --git a/cli/src/cable/deskRing.ts b/cli/src/cable/deskRing.ts
index 500670ecf..981467a71 100644
--- a/cli/src/cable/deskRing.ts
+++ b/cli/src/cable/deskRing.ts
@@ -1,41 +1,26 @@
/**
* The order the dial's carousel walks, given what the window has on screen.
*
- * The dial holds every agent on every machine in one flat ring. This turns that
- * flat list into a ring built around THE DESK — the agents the window has a tile
- * for, in tile order — so a thumb walking the dial walks the same grid the eyes
- * are looking at.
+ * ONE RULE: the carousel walks the window's tiles, in tile order, and nothing else. Swipe is "the next
+ * pane", which is what a person watching four terminals already thinks it is.
*
- * Past either edge of the desk the ring continues into the agents that have no
- * tile, and WHICH ones depends on the edge you left from: forward from the last
- * tile picks up the flat list after that agent, backward from the first tile
- * picks it up before. Two boundary positions cut the flat list into two arcs,
- * one for each edge, so every agent is reachable from exactly one direction and
- * none is reachable twice.
+ * It used to be three: an arc of off-desk agents, then the desk, then another arc — a non-wrapping
+ * shape that let a thumb walk past the end of the desk and pull an unopened agent onto it, with the arc
+ * an agent sat in encoding WHICH tile it replaced so the dial never had to report which way the thumb
+ * went. It worked, and it cost a concept (`DeskEdge`) that had to be understood in three repositories
+ * to change anything here. Discovery by swiping is gone with it; the pull-down switcher still lists
+ * every agent, and picking one there tells the window, which opens it — putting it on the desk, and so
+ * on the ring, by the ordinary route.
*
- * Landing on one of those agents is what puts it ON the desk — the window
- * replaces the tile at the edge it belongs to. Which is why the arcs matter
- * beyond ordering: the arc an agent sits in IS the answer to "which tile does
- * this replace", and it is an answer the daemon can give without the dial ever
- * reporting which way the thumb moved.
+ * Agents with no tile are still SENT to the dial. They are counted on the overview and listed in that
+ * switcher; leaving them out is what once made a dial announce "5 agents" to someone who had eleven.
+ * What they are left out of is the walk.
*/
-export type DeskEdge = 'head' | 'tail'
-
export interface DeskRing {
- /** Ids in carousel order: head arc, then the desk, then the tail arc. */
+ /** Ids in carousel order: the desk, as the window has it. */
order: string[]
- /**
- * Agents the carousel does not walk: the ones between the desk's outermost
- * tiles in list order, which are in neither direction off an edge.
- *
- * They are still SENT to the dial — it keeps a tile's worth of knowledge for
- * every agent, and the overview's count and the pull-down switcher both read
- * that, so leaving them out made the dial say "5 agents" to someone who has
- * eleven. What they are left out of is the walk.
- */
+ /** Agents the carousel does not walk. Still sent, still counted, simply not stepped onto. */
offRing: string[]
- /** Which edge an off-desk agent belongs to. Desk members are absent. */
- edgeOf: Map<string, DeskEdge>
}
/**
@@ -48,62 +33,15 @@ export interface DeskRing {
export function deskRing(flat: string[], desk: string[]): DeskRing {
const known = new Set(flat)
const onDesk = desk.filter((id) => known.has(id))
- const edgeOf = new Map<string, DeskEdge>()
-
- // No tiles: nothing to build a ring around, and the flat list is already the
- // answer. Everything is off-desk, and landing on any of it opens a new tile
- // rather than replacing one — so neither edge applies.
- if (onDesk.length === 0) return { order: [...flat], offRing: [], edgeOf }
-
- const deskSet = new Set(onDesk)
- const rest = flat.filter((id) => !deskSet.has(id))
- const first = flat.indexOf(onDesk[0])
- const last = flat.indexOf(onDesk[onDesk.length - 1])
- // The arcs do NOT wrap, and that is the whole point of them.
+ // NO TILES, NO RESTRICTION — and this fallback is not a nicety.
//
- // The dial's carousel is `overview → agents… → Settings → Machines`, so the
- // way back to those screens is off the END of the agents. A wrapping arc
- // never has an end: every step onto an off-desk agent puts it ON the desk,
- // the ring re-forms around it, and the walk begins again — measured on the
- // real dial, that is a thumb going round eleven agents forever with Settings
- // and Machines unreachable. So forward stops at the last agent in the list,
- // and the carousel's own wrap takes it from there.
- const pos = new Map(flat.map((id, at) => [id, at]));
- const firstPos = pos.get(onDesk[0])!
- const lastPos = pos.get(onDesk[onDesk.length - 1])!
+ // A dial plugged into a computer whose window is shut has an empty desk, and a ring built strictly
+ // from that desk would be empty: eight agents on the machine and a carousel showing none of them,
+ // which reads as a broken dial rather than as a closed window. So with nothing to narrow to, the
+ // walk is the whole list, exactly as it was before any of this existed.
+ if (onDesk.length === 0) return { order: [...flat], offRing: [] }
- // Past the last tile: the list carrying on from THAT agent — the rest of its
- // machine, then the machines after it.
- const tail = rest.filter((id) => pos.get(id)! > lastPos)
- const claimed = new Set(tail)
- // Before the first tile: the list running back from it. Placed before the
- // desk, so one step left off the desk is one step back in the list.
- const head = rest.filter((id) => pos.get(id)! < firstPos && !claimed.has(id))
- for (const id of head) claimed.add(id)
- // Agents that lie BETWEEN the desk's outermost tiles in list order are not on
- // the ring at all.
- //
- // Stepping off a tile means "carry on through the list in that direction", so
- // an agent inside the desk's own span is in neither direction — it is not the
- // next thing left of the first tile, nor the next thing right of the last
- // one. Every attempt to give it a place put it at an END of the ring, and
- // both ends are spoken for: the carousel keeps the overview before the agents
- // and Settings after them, so an agent parked at either one stands between
- // the desk and the way back to those screens. Measured on the real dial,
- // twice, once from each side.
- //
- // They are returned as `offRing` rather than dropped: the dial is still told
- // about them, so the overview's count and the pull-down switcher stay honest.
- // They are simply not walked to — reach one from the window, or from that
- // switcher, and opening it puts it on the desk and back on the ring.
- // Which end an off-desk agent was reached from IS which tile it replaces. The
- // dial never reports the direction of the thumb and does not have to: its side
- // of the ring already says it.
- for (const id of tail) edgeOf.set(id, 'tail')
- for (const id of head) edgeOf.set(id, 'head')
-
- const order = [...head, ...onDesk, ...tail]
- const placed = new Set(order)
- return { order, offRing: rest.filter((id) => !placed.has(id)), edgeOf }
+ const deskSet = new Set(onDesk)
+ return { order: onDesk, offRing: flat.filter((id) => !deskSet.has(id)) }
}
diff --git a/cli/src/cli.ts b/cli/src/cli.ts
index 08c130c91..6e383ac2a 100644
--- a/cli/src/cli.ts
+++ b/cli/src/cli.ts
@@ -4014,14 +4014,12 @@ async function runForeground(session: AuthSession): Promise<void> {
// Both of these are LOCAL-ONLY on purpose (backend.sendLocal, not backend.send): they describe a hand
// at this desk, not a change in what the machine is doing, and the cloud web audience may be sitting
// at another computer entirely.
- // `edge` is present only for an agent the window has NO tile for, and says
- // which end of the desk it belongs to — so the window replaces the first
- // tile or the last one rather than guessing, and the dial never has to
- // report which way the thumb moved.
// A notification tap, which asks for a tile of its OWN — see CableHost.openAgent.
opened: (machineId, agentId) => backend.sendLocal({ type: 'dial_open', payload: { machineId, agentId } }),
- focused: (machineId, agentId, edge) =>
- backend.sendLocal({ type: 'dial_focus', payload: { machineId, agentId, ...(edge ? { edge } : {}) } }),
+ // No `edge`. It used to ride along for an agent the window had no tile for, naming which end of the
+ // desk to replace; the carousel now only walks tiles that exist, so every focus is about one of them.
+ focused: (machineId, agentId) =>
+ backend.sendLocal({ type: 'dial_focus', payload: { machineId, agentId } }),
scrolled: (phase, dy, velocity) => backend.sendLocal({ type: 'dial_scroll', payload: { phase, dy, velocity } }),
// Words spoken on the overview belong to whichever agent the window's palette picks.
routeInWindow: (text, cmd) => windowRouter.ask(text, cmd),