🤯 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(agent): align env hook control test with flat response (#20207)
Bryan5d299544d63f
diff --git a/apps/server/src/modules/AgentRuntime/__tests__/RuntimeExecutors.test.ts b/apps/server/src/modules/AgentRuntime/__tests__/RuntimeExecutors.test.tsindex e3aaa0fd96b..7d88af0117d 100644--- a/apps/server/src/modules/AgentRuntime/__tests__/RuntimeExecutors.test.ts+++ b/apps/server/src/modules/AgentRuntime/__tests__/RuntimeExecutors.test.ts@@ -6035,7 +6035,8 @@ describe('RuntimeExecutors', { timeout: 60_000 }, () => {async () =>new Response(JSON.stringify({- hookSpecificOutput: { hookEventName: 'beforeToolCall', permissionDecision },+ decision: permissionDecision,+ ...(permissionDecision === 'deny' && { reason: 'Denied by env hook' }),}),),);@@ -6044,11 +6045,24 @@ describe('RuntimeExecutors', { timeout: 60_000 }, () => {dispatcher.register('op-123', []);const serialized = JSON.stringify(dispatcher.getSerializedHooks('op-123'));const persisted = JSON.parse(serialized);- await createRuntimeExecutors({ ...ctx, hookDispatcher: new HookDispatcher() })- .call_tool!(createToolInstruction(), createToolState({ host: { hooks: persisted } }));+ const result = await createRuntimeExecutors({+ ...ctx,+ hookDispatcher: new HookDispatcher(),+ }).call_tool!(createToolInstruction(), createToolState({ host: { hooks: persisted } }));expect(mockToolExecutionService.executeTool).toHaveBeenCalledTimes(permissionDecision === 'allow' ? 1 : 0,);+ if (permissionDecision === 'deny') {+ expect(result.events).toContainEqual(+ expect.objectContaining({+ type: 'tool_result',+ result: expect.objectContaining({+ content: 'Denied by env hook',+ error: 'hook_denied',+ }),+ }),+ );+ }expect(fetchSpy.mock.calls.map(([, init]) => JSON.parse(String(init?.body)).hookType),).toEqual(['beforeToolCall', 'afterToolCall']);