neoagent 2.3.1-beta.36 → 2.3.1-beta.38
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/package.json
CHANGED
|
@@ -37,6 +37,6 @@ _flutter.buildConfig = {"engineRevision":"42d3d75a56efe1a2e9902f52dc8006099c45d9
|
|
|
37
37
|
|
|
38
38
|
_flutter.loader.load({
|
|
39
39
|
serviceWorkerSettings: {
|
|
40
|
-
serviceWorkerVersion: "
|
|
40
|
+
serviceWorkerVersion: "389230565" /* Flutter's service worker is deprecated and will be removed in a future Flutter release. */
|
|
41
41
|
}
|
|
42
42
|
});
|
|
@@ -33,7 +33,20 @@ function selectMcpTools(task, mcpTools = []) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
function selectToolsForTask(task, builtInTools = [], mcpTools = [], _options = {}) {
|
|
36
|
-
|
|
36
|
+
const MAX_TOOLS = 128; // Strict provider limit (e.g. Github Copilot / OpenAI)
|
|
37
|
+
const selectedMcp = selectMcpTools(task, mcpTools);
|
|
38
|
+
|
|
39
|
+
if (builtInTools.length + selectedMcp.length <= MAX_TOOLS) {
|
|
40
|
+
return [...builtInTools, ...selectedMcp];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// If we exceed the limit, prioritize base tools and take as many MCP tools as fit
|
|
44
|
+
const remainingSpace = MAX_TOOLS - builtInTools.length;
|
|
45
|
+
if (remainingSpace > 0) {
|
|
46
|
+
return [...builtInTools, ...selectedMcp.slice(0, remainingSpace)];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return builtInTools.slice(0, MAX_TOOLS);
|
|
37
50
|
}
|
|
38
51
|
|
|
39
52
|
module.exports = { selectToolsForTask, selectMcpTools };
|
|
@@ -75,6 +75,7 @@ class MeshtasticPlatform extends BasePlatform {
|
|
|
75
75
|
this._transport = null;
|
|
76
76
|
this._connectPromise = null;
|
|
77
77
|
this._disconnecting = false;
|
|
78
|
+
this._reconnectTimer = null;
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
async connect() {
|
|
@@ -175,6 +176,7 @@ class MeshtasticPlatform extends BasePlatform {
|
|
|
175
176
|
if (this._disconnecting) return;
|
|
176
177
|
this.status = 'disconnected';
|
|
177
178
|
this.emit('disconnected', { reason: info?.reason || 'device_disconnected' });
|
|
179
|
+
this._scheduleReconnect();
|
|
178
180
|
});
|
|
179
181
|
|
|
180
182
|
this.status = 'connected';
|
|
@@ -183,6 +185,19 @@ class MeshtasticPlatform extends BasePlatform {
|
|
|
183
185
|
return { status: this.status };
|
|
184
186
|
}
|
|
185
187
|
|
|
188
|
+
_scheduleReconnect() {
|
|
189
|
+
if (this._disconnecting || this._reconnectTimer) return;
|
|
190
|
+
console.log(`[Meshtastic] Connection lost. Reconnecting in 10 seconds...`);
|
|
191
|
+
this._reconnectTimer = setTimeout(() => {
|
|
192
|
+
this._reconnectTimer = null;
|
|
193
|
+
if (this._disconnecting) return;
|
|
194
|
+
this.connect().catch((err) => {
|
|
195
|
+
console.error(`[Meshtastic] Auto-reconnect failed:`, err.message);
|
|
196
|
+
this._scheduleReconnect();
|
|
197
|
+
});
|
|
198
|
+
}, 10000);
|
|
199
|
+
}
|
|
200
|
+
|
|
186
201
|
_buildAuthInfo(conn) {
|
|
187
202
|
const nodeNum = conn?.myNodeNum || 0;
|
|
188
203
|
const user = conn?.nodeUsers.get(nodeNum) || {};
|
|
@@ -216,6 +231,10 @@ class MeshtasticPlatform extends BasePlatform {
|
|
|
216
231
|
async disconnect() {
|
|
217
232
|
this._disconnecting = true;
|
|
218
233
|
this.status = 'disconnected';
|
|
234
|
+
if (this._reconnectTimer) {
|
|
235
|
+
clearTimeout(this._reconnectTimer);
|
|
236
|
+
this._reconnectTimer = null;
|
|
237
|
+
}
|
|
219
238
|
|
|
220
239
|
const transport = this._transport;
|
|
221
240
|
this._transport = null;
|
|
@@ -81,15 +81,15 @@ function encodeMessageField(fieldNumber, messageBytes) {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
function decodeVarint(buf, offset) {
|
|
84
|
-
let result =
|
|
85
|
-
let shift =
|
|
84
|
+
let result = 0n;
|
|
85
|
+
let shift = 0n;
|
|
86
86
|
let pos = offset;
|
|
87
87
|
while (pos < buf.length) {
|
|
88
|
-
const b = buf[pos++];
|
|
89
|
-
result |= (b &
|
|
90
|
-
if ((b &
|
|
91
|
-
shift +=
|
|
92
|
-
if (shift >
|
|
88
|
+
const b = BigInt(buf[pos++]);
|
|
89
|
+
result |= (b & 0x7Fn) << shift;
|
|
90
|
+
if ((b & 0x80n) === 0n) return { value: Number(result), offset: pos };
|
|
91
|
+
shift += 7n;
|
|
92
|
+
if (shift > 69n) throw new Error('Varint too long');
|
|
93
93
|
}
|
|
94
94
|
throw new Error('Unexpected end of varint');
|
|
95
95
|
}
|