From e20a6563a3b727eeedbe4104d268e932bd33336a Mon Sep 17 00:00:00 2001 From: leo Date: Wed, 4 Nov 2026 19:18:46 +0800 Subject: [PATCH] Give a new agent's phone id this run's mark A phone keeps what it had of the last run's new-0; the next run's new-0 was shown with it, an old conversation for the new one. Co-Authored-By: BaoCode --- lib/link/workspace_bridge.dart | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/link/workspace_bridge.dart b/lib/link/workspace_bridge.dart index b6946a10..8fef9a2b 100644 --- a/lib/link/workspace_bridge.dart +++ b/lib/link/workspace_bridge.dart @@ -155,12 +155,15 @@ class WorkspaceBridge { // --- Ids ------------------------------------------------------------------ /// Each agent's id for the phones: its session's, else one given here - /// (a new agent's, until it has one), kept for the run. + /// (a new agent's, until it has one), kept for the run. Those given here + /// are this run's alone: a phone keeps what it had of the last run's + /// `new-0`, not to be shown as this one's. static final Expando _ids = Expando('link id'); static int _nextId = 0; + static final _run = DateTime.now().millisecondsSinceEpoch.toRadixString(36); static String idOf(AgentThread thread) => - _ids[thread] ??= thread.id ?? 'new-${_nextId++}'; + _ids[thread] ??= thread.id ?? 'new-$_run-${_nextId++}'; AgentThread _thread(Object? id) { if (id is String) {