neoagent 2.3.1-beta.49 → 2.3.1-beta.50
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: "3106849421" /* Flutter's service worker is deprecated and will be removed in a future Flutter release. */
|
|
41
41
|
}
|
|
42
42
|
});
|
|
@@ -13,6 +13,42 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
const MCP_ALWAYS_INCLUDE_THRESHOLD = 20;
|
|
16
|
+
const MAX_TOOLS = 128; // Strict provider limit (e.g. Github Copilot / OpenAI)
|
|
17
|
+
|
|
18
|
+
function ensureRequiredTools(selectedTools = [], builtInTools = [], options = {}) {
|
|
19
|
+
const requiredNames = [];
|
|
20
|
+
if (options.widgetId) requiredNames.push('save_widget_snapshot');
|
|
21
|
+
if (!requiredNames.length) return selectedTools;
|
|
22
|
+
|
|
23
|
+
const selected = Array.isArray(selectedTools) ? [...selectedTools] : [];
|
|
24
|
+
|
|
25
|
+
for (const toolName of requiredNames) {
|
|
26
|
+
if (selected.some((tool) => tool?.name === toolName)) continue;
|
|
27
|
+
const required = builtInTools.find((tool) => tool?.name === toolName);
|
|
28
|
+
if (!required) continue;
|
|
29
|
+
|
|
30
|
+
if (selected.length < MAX_TOOLS) {
|
|
31
|
+
selected.push(required);
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Keep within provider tool cap: replace the last non-required tool.
|
|
36
|
+
let replaced = false;
|
|
37
|
+
for (let index = selected.length - 1; index >= 0; index -= 1) {
|
|
38
|
+
const currentName = selected[index]?.name;
|
|
39
|
+
if (!requiredNames.includes(currentName)) {
|
|
40
|
+
selected[index] = required;
|
|
41
|
+
replaced = true;
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (!replaced && selected.length > 0) {
|
|
46
|
+
selected[selected.length - 1] = required;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return selected;
|
|
51
|
+
}
|
|
16
52
|
|
|
17
53
|
function selectMcpTools(task, mcpTools = []) {
|
|
18
54
|
if (!mcpTools.length) return [];
|
|
@@ -33,20 +69,24 @@ function selectMcpTools(task, mcpTools = []) {
|
|
|
33
69
|
}
|
|
34
70
|
|
|
35
71
|
function selectToolsForTask(task, builtInTools = [], mcpTools = [], _options = {}) {
|
|
36
|
-
const MAX_TOOLS = 128; // Strict provider limit (e.g. Github Copilot / OpenAI)
|
|
37
72
|
const selectedMcp = selectMcpTools(task, mcpTools);
|
|
73
|
+
const options = _options || {};
|
|
74
|
+
let selected;
|
|
38
75
|
|
|
39
76
|
if (builtInTools.length + selectedMcp.length <= MAX_TOOLS) {
|
|
40
|
-
|
|
77
|
+
selected = [...builtInTools, ...selectedMcp];
|
|
78
|
+
return ensureRequiredTools(selected, builtInTools, options);
|
|
41
79
|
}
|
|
42
80
|
|
|
43
81
|
// If we exceed the limit, prioritize base tools and take as many MCP tools as fit
|
|
44
82
|
const remainingSpace = MAX_TOOLS - builtInTools.length;
|
|
45
83
|
if (remainingSpace > 0) {
|
|
46
|
-
|
|
84
|
+
selected = [...builtInTools, ...selectedMcp.slice(0, remainingSpace)];
|
|
85
|
+
return ensureRequiredTools(selected, builtInTools, options);
|
|
47
86
|
}
|
|
48
87
|
|
|
49
|
-
|
|
88
|
+
selected = builtInTools.slice(0, MAX_TOOLS);
|
|
89
|
+
return ensureRequiredTools(selected, builtInTools, options);
|
|
50
90
|
}
|
|
51
91
|
|
|
52
92
|
module.exports = { selectToolsForTask, selectMcpTools };
|
|
@@ -545,7 +545,9 @@ class WidgetService {
|
|
|
545
545
|
'{"title":"","kicker":"","subtitle":"","body":"","metric":"","metricLabel":"","secondaryMetric":"","secondaryLabel":"","tertiaryMetric":"","tertiaryLabel":"","trend":{"label":"","direction":"flat"},"progress":{"value":0,"max":100,"label":""},"rows":[{"label":"","value":""}],"chips":[""],"iconToken":"","accentToken":"","backgroundToken":"","surfaceColor":"","updatedAt":"","deepLink":""}',
|
|
546
546
|
'Rules:',
|
|
547
547
|
'- Do not change the template or layout variant.',
|
|
548
|
+
'- The run is only complete after save_widget_snapshot succeeds. A plain text reply without saving is a failed refresh.',
|
|
548
549
|
'- Once you have enough accurate data, call save_widget_snapshot exactly once and stop. Do not keep exploring after saving.',
|
|
550
|
+
'- Do not repeat the same tool call with identical arguments unless the previous attempt clearly failed or returned empty/incomplete data.',
|
|
549
551
|
'- Keep rows to at most 3 and chips to at most 3.',
|
|
550
552
|
'- Prefer concrete data over generic prose. Use metric + supporting fields whenever live data exists.',
|
|
551
553
|
'- Make the widget immediately useful at a glance. Avoid filler copy, duplicated labels, or repeating the widget name unless it helps identify the subject.',
|