🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(context-engine): allow tool type recovery from manifest when models strip suffixes (#12636)
Luis Sambranod92bb7a8e826
diff --git a/packages/context-engine/src/engine/tools/ToolNameResolver.ts b/packages/context-engine/src/engine/tools/ToolNameResolver.tsindex ef176bac57f..6d2bfcc786b 100644--- a/packages/context-engine/src/engine/tools/ToolNameResolver.ts+++ b/packages/context-engine/src/engine/tools/ToolNameResolver.ts@@ -86,7 +86,7 @@ export class ToolNameResolver {id: toolCall.id,identifier,thoughtSignature: toolCall.thoughtSignature,- type: (type ?? 'default') as any,+ type: (type ?? manifests[identifier]?.type ?? 'default') as any,};// Step 2: Resolve hashed apiName if neededdiff --git a/packages/context-engine/src/engine/tools/__tests__/ToolNameResolver.test.ts b/packages/context-engine/src/engine/tools/__tests__/ToolNameResolver.test.tsindex 6f8272cd0fa..84c843185fd 100644--- a/packages/context-engine/src/engine/tools/__tests__/ToolNameResolver.test.ts+++ b/packages/context-engine/src/engine/tools/__tests__/ToolNameResolver.test.ts@@ -259,6 +259,32 @@ describe('ToolNameResolver', () => {expect(result[0].identifier).toBe('plugin1');expect(result[1].identifier).toBe('plugin2');});++ it('should recover tool type from manifest if model strips the suffix (e.g. GLM-4)', () => {+ const toolCalls = [+ {+ function: { arguments: '{}', name: 'lobe-notebook____createDocument' },+ id: 'call_1',+ type: 'function',+ },+ ];++ const manifests = {+ 'lobe-notebook': {+ api: [{ description: '', name: 'createDocument', parameters: {} }],+ identifier: 'lobe-notebook',+ meta: {},+ type: 'builtin' as const,+ },+ };++ const result = resolver.resolve(toolCalls, manifests);++ expect(result).toHaveLength(1);+ expect(result[0].identifier).toBe('lobe-notebook');+ expect(result[0].apiName).toBe('createDocument');+ expect(result[0].type).toBe('builtin'); // Recovered from manifest!+ });});describe('resolve - hashed apiName', () => {