neoagent 3.3.1-beta.3 → 3.3.1-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/flutter_app/lib/main_controller.dart +55 -0
- package/flutter_app/lib/main_models.dart +4 -0
- package/package.json +1 -1
- package/server/public/.last_build_id +1 -1
- package/server/public/flutter_bootstrap.js +1 -1
- package/server/public/main.dart.js +37419 -37363
- package/server/services/behavior/pipeline.js +19 -2
- package/server/services/messaging/access_policy.js +3 -14
- package/server/services/messaging/automation.js +10 -12
|
@@ -47,6 +47,7 @@ class NeoAgentController extends ChangeNotifier {
|
|
|
47
47
|
'NEOAGENT_BACKEND_URL',
|
|
48
48
|
);
|
|
49
49
|
static const String _selectedSectionPrefsKey = 'ui.selectedSection';
|
|
50
|
+
static const String _selectedAgentPrefsKey = 'ui.selectedAgentId';
|
|
50
51
|
|
|
51
52
|
SharedPreferences? _prefs;
|
|
52
53
|
final FlutterSecureStorage _secureStorage = const FlutterSecureStorage();
|
|
@@ -269,6 +270,20 @@ class NeoAgentController extends ChangeNotifier {
|
|
|
269
270
|
|
|
270
271
|
String? get _scopedAgentId => selectedAgentId;
|
|
271
272
|
|
|
273
|
+
bool _matchesSelectedAgent(String? agentId) {
|
|
274
|
+
final selected = selectedAgentId?.trim() ?? '';
|
|
275
|
+
if (selected.isEmpty) {
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
final incoming = agentId?.trim() ?? '';
|
|
279
|
+
if (incoming.isEmpty) {
|
|
280
|
+
// Legacy payloads without agent scope belong to the default/main agent.
|
|
281
|
+
final active = activeAgent;
|
|
282
|
+
return active == null || active.isDefault || active.id == selected;
|
|
283
|
+
}
|
|
284
|
+
return incoming == selected;
|
|
285
|
+
}
|
|
286
|
+
|
|
272
287
|
bool get requiresBackendUrlSetup =>
|
|
273
288
|
!kIsWeb &&
|
|
274
289
|
_configuredBackendUrl.trim().isEmpty &&
|
|
@@ -1426,6 +1441,7 @@ class NeoAgentController extends ChangeNotifier {
|
|
|
1426
1441
|
_resetChatHistoryPagination();
|
|
1427
1442
|
agentProfiles = const <AgentProfile>[];
|
|
1428
1443
|
selectedAgentId = null;
|
|
1444
|
+
unawaited(_persistSelectedAgentId(null));
|
|
1429
1445
|
supportedModels = const <ModelMeta>[];
|
|
1430
1446
|
aiProviders = const <AiProviderMeta>[];
|
|
1431
1447
|
recentRuns = const <RunSummary>[];
|
|
@@ -1596,14 +1612,33 @@ class NeoAgentController extends ChangeNotifier {
|
|
|
1596
1612
|
(agent) => agent.id == selectedAgentId,
|
|
1597
1613
|
);
|
|
1598
1614
|
if (selectedExists) {
|
|
1615
|
+
unawaited(_persistSelectedAgentId(selectedAgentId));
|
|
1599
1616
|
return;
|
|
1600
1617
|
}
|
|
1618
|
+
|
|
1619
|
+
final restoredId = _prefs?.getString(_selectedAgentPrefsKey)?.trim() ?? '';
|
|
1620
|
+
if (restoredId.isNotEmpty &&
|
|
1621
|
+
agentProfiles.any((agent) => agent.id == restoredId)) {
|
|
1622
|
+
selectedAgentId = restoredId;
|
|
1623
|
+
return;
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1601
1626
|
selectedAgentId = agentProfiles
|
|
1602
1627
|
.firstWhere(
|
|
1603
1628
|
(agent) => agent.isDefault,
|
|
1604
1629
|
orElse: () => agentProfiles.first,
|
|
1605
1630
|
)
|
|
1606
1631
|
.id;
|
|
1632
|
+
unawaited(_persistSelectedAgentId(selectedAgentId));
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
Future<void> _persistSelectedAgentId(String? id) async {
|
|
1636
|
+
final normalized = id?.trim() ?? '';
|
|
1637
|
+
if (normalized.isEmpty) {
|
|
1638
|
+
await _prefs?.remove(_selectedAgentPrefsKey);
|
|
1639
|
+
return;
|
|
1640
|
+
}
|
|
1641
|
+
await _prefs?.setString(_selectedAgentPrefsKey, normalized);
|
|
1607
1642
|
}
|
|
1608
1643
|
|
|
1609
1644
|
Future<void> switchAgent(String id) async {
|
|
@@ -1611,6 +1646,7 @@ class NeoAgentController extends ChangeNotifier {
|
|
|
1611
1646
|
return;
|
|
1612
1647
|
}
|
|
1613
1648
|
selectedAgentId = id;
|
|
1649
|
+
unawaited(_persistSelectedAgentId(id));
|
|
1614
1650
|
chatMessages = const <ChatEntry>[];
|
|
1615
1651
|
_resetChatHistoryPagination();
|
|
1616
1652
|
recentRuns = const <RunSummary>[];
|
|
@@ -1656,9 +1692,11 @@ class NeoAgentController extends ChangeNotifier {
|
|
|
1656
1692
|
await _backendClient.createAgentProfile(backendUrl, payload),
|
|
1657
1693
|
);
|
|
1658
1694
|
selectedAgentId = created.id;
|
|
1695
|
+
unawaited(_persistSelectedAgentId(created.id));
|
|
1659
1696
|
} else {
|
|
1660
1697
|
await _backendClient.updateAgentProfile(backendUrl, id, payload);
|
|
1661
1698
|
selectedAgentId = id;
|
|
1699
|
+
unawaited(_persistSelectedAgentId(id));
|
|
1662
1700
|
}
|
|
1663
1701
|
await refresh();
|
|
1664
1702
|
return true;
|
|
@@ -1685,6 +1723,7 @@ class NeoAgentController extends ChangeNotifier {
|
|
|
1685
1723
|
await _backendClient.archiveAgentProfile(backendUrl, id);
|
|
1686
1724
|
if (selectedAgentId == id) {
|
|
1687
1725
|
selectedAgentId = null;
|
|
1726
|
+
unawaited(_persistSelectedAgentId(null));
|
|
1688
1727
|
}
|
|
1689
1728
|
await refresh();
|
|
1690
1729
|
} catch (error) {
|
|
@@ -6430,6 +6469,11 @@ class NeoAgentController extends ChangeNotifier {
|
|
|
6430
6469
|
});
|
|
6431
6470
|
socket.on('messaging:sent', (dynamic data) {
|
|
6432
6471
|
final payload = _jsonMap(data);
|
|
6472
|
+
final agentId =
|
|
6473
|
+
payload['agentId']?.toString() ?? payload['agent_id']?.toString();
|
|
6474
|
+
if (!_matchesSelectedAgent(agentId)) {
|
|
6475
|
+
return;
|
|
6476
|
+
}
|
|
6433
6477
|
messagingMessages = <MessagingMessage>[
|
|
6434
6478
|
MessagingMessage.fromSocket(payload, outgoing: true),
|
|
6435
6479
|
...messagingMessages,
|
|
@@ -6443,6 +6487,11 @@ class NeoAgentController extends ChangeNotifier {
|
|
|
6443
6487
|
});
|
|
6444
6488
|
socket.on('messaging:message', (dynamic data) {
|
|
6445
6489
|
final payload = _jsonMap(data);
|
|
6490
|
+
final agentId =
|
|
6491
|
+
payload['agentId']?.toString() ?? payload['agent_id']?.toString();
|
|
6492
|
+
if (!_matchesSelectedAgent(agentId)) {
|
|
6493
|
+
return;
|
|
6494
|
+
}
|
|
6446
6495
|
messagingMessages = <MessagingMessage>[
|
|
6447
6496
|
MessagingMessage.fromSocket(payload, outgoing: false),
|
|
6448
6497
|
...messagingMessages,
|
|
@@ -6634,6 +6683,8 @@ class NeoAgentController extends ChangeNotifier {
|
|
|
6634
6683
|
final payload = _jsonMap(data);
|
|
6635
6684
|
final triggerSource = payload['triggerSource']?.toString() ?? '';
|
|
6636
6685
|
final runId = payload['runId']?.toString() ?? '';
|
|
6686
|
+
final agentId =
|
|
6687
|
+
payload['agentId']?.toString() ?? payload['agent_id']?.toString();
|
|
6637
6688
|
if (triggerSource == 'voice_live') {
|
|
6638
6689
|
_voiceRunIds.add(runId);
|
|
6639
6690
|
return;
|
|
@@ -6643,6 +6694,10 @@ class NeoAgentController extends ChangeNotifier {
|
|
|
6643
6694
|
_backgroundRunIds.add(runId);
|
|
6644
6695
|
return;
|
|
6645
6696
|
}
|
|
6697
|
+
if (!_matchesSelectedAgent(agentId)) {
|
|
6698
|
+
_backgroundRunIds.add(runId);
|
|
6699
|
+
return;
|
|
6700
|
+
}
|
|
6646
6701
|
activeRun = ActiveRunState(
|
|
6647
6702
|
runId: runId,
|
|
6648
6703
|
title:
|
|
@@ -557,6 +557,7 @@ class MessagingMessage {
|
|
|
557
557
|
this.sender,
|
|
558
558
|
this.senderName,
|
|
559
559
|
this.target,
|
|
560
|
+
this.agentId,
|
|
560
561
|
});
|
|
561
562
|
|
|
562
563
|
factory MessagingMessage.fromJson(Map<dynamic, dynamic> json) {
|
|
@@ -583,6 +584,7 @@ class MessagingMessage {
|
|
|
583
584
|
sender: sender.isEmpty ? null : sender,
|
|
584
585
|
senderName: senderName.isEmpty ? null : senderName,
|
|
585
586
|
target: chatId.isEmpty ? null : chatId,
|
|
587
|
+
agentId: json['agent_id']?.toString() ?? json['agentId']?.toString(),
|
|
586
588
|
);
|
|
587
589
|
}
|
|
588
590
|
|
|
@@ -599,6 +601,7 @@ class MessagingMessage {
|
|
|
599
601
|
sender: json['sender']?.toString(),
|
|
600
602
|
senderName: json['senderName']?.toString(),
|
|
601
603
|
target: json['to']?.toString(),
|
|
604
|
+
agentId: json['agentId']?.toString() ?? json['agent_id']?.toString(),
|
|
602
605
|
);
|
|
603
606
|
}
|
|
604
607
|
|
|
@@ -630,6 +633,7 @@ class MessagingMessage {
|
|
|
630
633
|
final String? sender;
|
|
631
634
|
final String? senderName;
|
|
632
635
|
final String? target;
|
|
636
|
+
final String? agentId;
|
|
633
637
|
|
|
634
638
|
String get createdAtLabel => _formatTimestamp(createdAt);
|
|
635
639
|
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
93e2d470c306717e1e9ead6365c9d8eb
|
|
@@ -37,6 +37,6 @@ _flutter.buildConfig = {"engineRevision":"0cd610717bde95fd88343c64f81c11ba4e5c00
|
|
|
37
37
|
|
|
38
38
|
_flutter.loader.load({
|
|
39
39
|
serviceWorkerSettings: {
|
|
40
|
-
serviceWorkerVersion: "
|
|
40
|
+
serviceWorkerVersion: "4101806863" /* Flutter's service worker is deprecated and will be removed in a future Flutter release. */
|
|
41
41
|
}
|
|
42
42
|
});
|