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.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
refactor(mobile): drop the desktop's typed-task router (⌘B)
deeb290f0d6458d
diff --git a/mobile/lib/core/models.dart b/mobile/lib/core/models.dartindex 710b32db4..90b2932a6 100644--- a/mobile/lib/core/models.dart+++ b/mobile/lib/core/models.dart@@ -420,132 +420,6 @@ class Agent {}}-/// What the daemon answered when asked where a typed task belongs (⌘B).-///-/// `candidates` is the pick followed by EVERY other agent the daemon weighed — ranked where the router-/// ranked them, in rail order after that. Not a shortlist: when the router is unsure the right agent is-/// often the one it put fourth, and a picker that cannot show it leaves no way forward but Esc.-/// The window reads it only when `confidence` is too low to act on — the whole point of the number-/// being on the wire.-class RouteAnswer {- const RouteAnswer({- required this.agentId,- required this.machineId,- required this.name,- required this.confidence,- required this.reason,- required this.candidates,- this.weighed = 0,- this.machines = 0,- this.via = '',- });-- final String agentId;-- /// Which computer the pick lives on. Names are for reading; this is what opens the pane.- final String machineId;- final String name;- final double confidence;- final String reason;- final List<RouteCandidate> candidates;-- /// How many agents were weighed, and across how many computers.- ///- /// Shown WHILE the router thinks, because the question during those seconds is not "how long" — it is- /// "did it even look at the agent I mean". The daemon caps the list it weighs, so this is the only- /// place that can answer it.- final int weighed;- final int machines;-- /// 'model' when a classifier answered, 'heuristic' when name matching stood in for it, '' when the- /// daemon did not say.- ///- /// Both land under the threshold BY DESIGN — an unsure model and a router that could not run must both- /// stop and ask — which is exactly why the window needs to tell them apart: "not sure which agent" and- /// "the router could not run" send a person to different next moves.- final String via;-- /// True when nobody was picked at all — an empty machine, or a daemon that could not answer.- bool get isEmpty => agentId.isEmpty;-- /// Read with `is`, never with `as`.- ///- /// `json['x'] as String?` does not answer null for a number — it THROWS, and this frame crosses a- /// socket, so the shape is whatever the other end sent. An exception here surfaces as a palette- /// spinner that never comes down, which is the one failure the person cannot act on. A malformed field- /// has to read as "nobody was picked" instead.- static RouteAnswer fromJson(Map<String, dynamic> json) => RouteAnswer(- agentId: _str(json['agentId']),- machineId: _str(json['machineId']),- name: _str(json['name']),- confidence: json['confidence'] is num- ? (json['confidence'] as num).toDouble()- : 0,- reason: _str(json['reason']),- weighed: json['weighed'] is num ? (json['weighed'] as num).toInt() : 0,- machines: json['machines'] is num ? (json['machines'] as num).toInt() : 0,- via: _str(json['via']),- candidates: [- for (final entry- in (json['candidates'] is List- ? json['candidates'] as List<dynamic>- : const []))- if (entry is Map<String, dynamic>) RouteCandidate.fromJson(entry),- ],- );-}--class RouteCandidate {- const RouteCandidate({- required this.agentId,- required this.machineId,- required this.name,- required this.machine,- required this.recent,- this.engine = '',- this.confidence = 0,- });-- final String agentId;-- /// Which computer to open the pane on. Names are for reading; this is for acting.- final String machineId;- final String name;-- /// Which computer it runs on. The candidate list spans every machine, so two agents named "api" on two- /// of them are the same row twice without this.- final String machine;-- /// What that agent was last doing — the line under its name when the window has to ask.- final String recent;-- /// Which CLI it runs on. The picker wears the same engine mark the rail does, so a row here and the- /// same agent in the rail are recognisably one thing rather than two lists that happen to share names.- final String engine;-- /// How well the router thought this one fits, 0..1. DISPLAY ONLY.- ///- /// Nothing is dispatched on it — the pick is [RouteAnswer.agentId] and the number that gates it is- /// [RouteAnswer.confidence]. 0 means the router said nothing about this candidate, and the picker- /// draws no bar rather than an empty one, because an empty bar reads as "no fit" and this is "no- /// answer".- final double confidence;-- static RouteCandidate fromJson(Map<String, dynamic> json) => RouteCandidate(- agentId: _str(json['agentId']),- machineId: _str(json['machineId']),- name: _str(json['name']),- machine: _str(json['machine']),- recent: _str(json['recent']),- engine: _str(json['engine']),- confidence: json['confidence'] is num- ? (json['confidence'] as num).toDouble().clamp(0, 1)- : 0,- );-}--String _str(Object? value) => value is String ? value : '';-/// How a checkout on no branch reports itself, `Detached 65281563` (`cli/src/lib/agentProject.ts`).const kDetachedBranchPrefix = 'Detached ';diff --git a/mobile/lib/state/app_state.dart b/mobile/lib/state/app_state.dartindex ff9358fa9..3824feca1 100644--- a/mobile/lib/state/app_state.dart+++ b/mobile/lib/state/app_state.dart@@ -1710,32 +1710,11 @@ class AppNotifier extends ChangeNotifier {if (_dismissedLinkPrompts.remove(machineId)) notifyListeners();}- // ── ⌘B: a typed task, and which agent it belongs to ────────────────────────────────────────────-- /// The machine this window is running ON — where the daemon that ANSWERS ⌘B lives.- ///- /// It is not the scope of the search: the daemon weighs agents on every machine and answers with the- /// one each pick belongs to. This is only the socket the question travels on, because the router, the- /// registry and the recap mirror it reads are all on this computer.- MachineState? get localMachineState {- for (final state in machineStates.values) {- if (state.isLocalMachine) {- return state; // the flag is the STATE's, not the machine row's- }- }- return null;- }-- /// Ask the daemon which agent a typed task belongs to. Sends nothing.- ///- /// Rides the app's own rpc convention (`ws_conn.request`), so the pending map, the timeout and the- /// logging are the ones every other request already uses. Returns null when there is nobody to ask —- /// no local machine, or its socket is not up — which the palette says out loud rather than spinning./// Answer the daemon about a spoken task it asked this window to route.///- /// Fire and forget, and correlated by `voiceId` rather than by the rpc convention ⌘B uses: the question- /// travelled the other way this time, so the pending id belongs to the daemon and this is a report, not- /// a request. Sent back to the machine that ASKED — with two daemons attached, answering the selected+ /// Fire and forget, and correlated by `voiceId` rather than by the rpc convention: the question+ /// travelled the other way, so the pending id belongs to the daemon and this is a report, not a+ /// request. Sent back to the machine that ASKED — with two daemons attached, answering the selected/// one leaves the asker waiting on a reply that went to a stranger.void reportVoiceRoute(String machineId,@@ -1756,78 +1735,6 @@ class AppNotifier extends ChangeNotifier {);}- Future<RouteAnswer?> routeTask(String text) async {- final machineId = localMachineState?.machine.machineId;- final connection = machineId == null ? null : _pool?[machineId];- if (connection == null) return null;- try {- final reply = await connection.request(- 'route_task',- payload: {'text': text},- // Over the daemon's own classification budget — which is 20s on this path — plus room for- // gathering the candidates and the round trip. A request that gives up BEFORE the router does- // leaves the person with nothing WHILE the answer is on its way, which is the one outcome worse- // than waiting; and at exactly 20s each it would be a coin toss which of the two fired first.- timeout: const Duration(seconds: 35),- );- return RouteAnswer.fromJson(reply);- } catch (_) {- // A timeout or a transport failure is not an error the person can act on — the palette shows the- // candidates it has and lets them choose, which is the same thing it does for a weak answer.- return null;- }- }-- /// Commit: deliver the task, then bring the agent onto the grid the way a rail click does.- ///- /// The daemon delivers it through the SAME door as the web's messages and the dial's — queueing,- /// retries and the per-engine slash-command adaptation are not re-implemented for the caller that- /// types instead of speaking.- /// Commit: deliver the task, then bring the agent onto the grid the way a rail click does.- ///- /// Returns null when it landed, or a sentence saying why it did not — which the palette shows instead- /// of closing. It ASKS rather than tells for a reason measured on the desk: the remote leg carries no- /// ack of its own, so a machine that has gone deaf takes the turn and nothing comes back. A confident- /// route closes this window silently, so without an answer that is a task that vanished with no mark- /// anywhere — the worst outcome this flow can produce.- ///- /// [agentMachineId] is the agent's OWN machine, which is not this one when the router reached across.- Future<String?> sendRoutedTask(- String agentId,- String agentMachineId,- String text,- ) async {- final localId = localMachineState?.machine.machineId;- if (localId == null) return 'No local machine is connected.';- final connection = _pool?[localId];- if (connection == null) return 'No local machine is connected.';- // The task goes to the LOCAL daemon whichever machine the agent is on: it owns the dispatch that- // knows the difference (its own registry, or the fleet link to the other computer). Sending it down- // the remote machine's own socket would be a second delivery path for the same thing.- try {- final reply = await connection.request(- 'route_send',- payload: {'agentId': agentId, 'text': text},- timeout: const Duration(seconds: 15),- );- if (reply['ok'] != true) {- final machine = (reply['machine'] as String?) ?? '';- final reason =- (reply['reason'] as String?) ?? 'it could not be delivered';- return machine.isEmpty- ? 'Not sent — $reason.'- : 'Not sent to $machine — $reason.';- }- } catch (_) {- return 'The daemon did not answer. Nothing was sent.';- }- // …the PANE opens on the agent's machine. Falling back to this computer would open a tile for an- // agent it does not have and leave the person looking at an empty terminal.- final target = agentMachineId.isNotEmpty ? agentMachineId : localId;- await selectAgent(target, agentId);- return null;- }-MachineState? get activeMachineState {final terminal = activeTerminal;if (terminal != null) return machineStates[terminal.machineId];