Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(tools): add tool definition helpers

Steven Enamakel03564ade3252
diff --git a/app/src/utils/toolDefinitions.test.ts b/app/src/utils/toolDefinitions.test.ts
index 1699133f59..359523b6c6 100644
--- a/app/src/utils/toolDefinitions.test.ts
+++ b/app/src/utils/toolDefinitions.test.ts
@@ -34,6 +34,19 @@ describe('normalizeEnabledToolList', () => {
expect(result).toEqual(['cron']);
});
+ it('maps the retired memory_store / memory_recall / memory_forget toggles to memory', () => {
+ expect(normalizeEnabledToolList(['memory_store', 'memory_recall', 'memory_forget'])).toEqual([
+ 'memory',
+ ]);
+ });
+
+ it('exposes one memory toggle backed by the single memory tool', () => {
+ const memory = TOOL_CATALOG.filter(tool => tool.category === 'Memory');
+ expect(memory.map(tool => tool.id)).toEqual(['memory']);
+ expect(memory[0].rustToolNames).toEqual(['memory']);
+ expect(TOOL_CATALOG.flatMap(tool => tool.rustToolNames)).not.toContain('update_memory_md');
+ });
+
it('drops unknown entries', () => {
const result = normalizeEnabledToolList(['shell', 'totally_unknown_tool']);
expect(result).toEqual(['shell']);
diff --git a/app/src/utils/toolDefinitions.ts b/app/src/utils/toolDefinitions.ts
index bd02c12baf..7974902dce 100644
--- a/app/src/utils/toolDefinitions.ts
+++ b/app/src/utils/toolDefinitions.ts
@@ -174,11 +174,23 @@ export function getEnabledRustToolNames(enabledIds: string[]): string[] {
* Handles three cases:
* - Entry is already a UI toggle ID → kept as-is
* - Entry is a Rust tool name → converted to its UI toggle ID
+ * - Entry is a retired ID or name → converted to its successor toggle
* - Entry is unknown → dropped
*
* Multiple Rust names that belong to the same UI toggle (e.g. "cron_add",
* "cron_list" both map to "cron") are deduplicated in the output.
*/
+/**
+ * Retired toggle IDs / Rust tool names → the toggle that replaced them, so a
+ * persisted list written before the rename keeps the tool on. The three memory
+ * tools became the single `memory` tool (recall | fetch | learn | forget).
+ */
+const RETIRED_TOOL_IDS: Record<string, string> = {
+ memory_store: 'memory',
+ memory_recall: 'memory',
+ memory_forget: 'memory',
+};
+
export function normalizeEnabledToolList(raw: string[]): string[] {
const rustToUiId = new Map<string, string>();
for (const tool of TOOL_CATALOG) {
@@ -192,7 +204,7 @@ export function normalizeEnabledToolList(raw: string[]): string[] {
if (allUiIds.has(entry)) {
result.add(entry);
} else {
- const uiId = rustToUiId.get(entry);
+ const uiId = rustToUiId.get(entry) ?? RETIRED_TOOL_IDS[entry];
if (uiId !== undefined) result.add(uiId);
}
}