Skip to content

Commit eb1f85c

Browse files
authored
fix: update lockfile and fix lint findings (elizaOS#2128)
* typo fix: close object * update lockfile
1 parent 005685d commit eb1f85c

File tree

25 files changed

+113
-114
lines changed

25 files changed

+113
-114
lines changed

packages/adapter-postgres/src/__tests__/vector-extension.test.ts

+17-17
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import pg from 'pg';
33
import fs from 'fs';
44
import path from 'path';
55
import { describe, test, expect, beforeEach, afterEach, vi, beforeAll } from 'vitest';
6-
import { DatabaseAdapter, elizaLogger, type Memory, type Content, EmbeddingProvider } from '@elizaos/core';
6+
import { elizaLogger, type Memory, type Content } from '@elizaos/core';
77

88
// Increase test timeout
99
vi.setConfig({ testTimeout: 15000 });
@@ -41,7 +41,7 @@ vi.mock('@elizaos/core', () => ({
4141
const parseVectorString = (vectorStr: string): number[] => {
4242
if (!vectorStr) return [];
4343
// Remove brackets and split by comma
44-
return vectorStr.replace(/[\[\]]/g, '').split(',').map(Number);
44+
return vectorStr.replace(/[[\]]/g, '').split(',').map(Number);
4545
};
4646

4747
describe('PostgresDatabaseAdapter - Vector Extension Validation', () => {
@@ -111,7 +111,7 @@ describe('PostgresDatabaseAdapter - Vector Extension Validation', () => {
111111
user: 'postgres',
112112
password: 'postgres'
113113
});
114-
114+
115115
const setupClient = await setupPool.connect();
116116
try {
117117
await cleanDatabase(setupClient);
@@ -133,13 +133,13 @@ describe('PostgresDatabaseAdapter - Vector Extension Validation', () => {
133133
user: 'postgres',
134134
password: 'postgres'
135135
});
136-
136+
137137
testClient = await testPool.connect();
138138
elizaLogger.debug('Database connection established');
139-
139+
140140
await cleanDatabase(testClient);
141141
elizaLogger.debug('Database cleaned');
142-
142+
143143
adapter = new PostgresDatabaseAdapter({
144144
host: 'localhost',
145145
port: 5433,
@@ -254,7 +254,7 @@ describe('PostgresDatabaseAdapter - Vector Extension Validation', () => {
254254
elizaLogger.debug('Attempting initialization with error...');
255255
await expect(adapter.init()).rejects.toThrow('Schema read error');
256256
elizaLogger.success('Error thrown as expected');
257-
257+
258258
// Verify no tables were created
259259
elizaLogger.debug('Verifying rollback...');
260260
const { rows } = await testClient.query(`
@@ -277,19 +277,19 @@ describe('PostgresDatabaseAdapter - Vector Extension Validation', () => {
277277
describe('Memory Operations with Vector', () => {
278278
const TEST_UUID = 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee';
279279
const TEST_TABLE = 'test_memories';
280-
280+
281281
beforeEach(async () => {
282282
elizaLogger.info('Setting up memory operations test...');
283283
try {
284284
// Ensure clean state and proper initialization
285285
await adapter.init();
286-
286+
287287
// Verify vector extension and search path
288288
await testClient.query(`
289289
SET search_path TO public, extensions;
290290
SELECT set_config('app.use_openai_embedding', 'true', false);
291291
`);
292-
292+
293293
// Create necessary account and room first
294294
await testClient.query('BEGIN');
295295
try {
@@ -298,19 +298,19 @@ describe('PostgresDatabaseAdapter - Vector Extension Validation', () => {
298298
VALUES ($1, 'test@test.com')
299299
ON CONFLICT (id) DO NOTHING
300300
`, [TEST_UUID]);
301-
301+
302302
await testClient.query(`
303303
INSERT INTO rooms (id)
304304
VALUES ($1)
305305
ON CONFLICT (id) DO NOTHING
306306
`, [TEST_UUID]);
307-
307+
308308
await testClient.query('COMMIT');
309309
} catch (error) {
310310
await testClient.query('ROLLBACK');
311311
throw error;
312312
}
313-
313+
314314
} catch (error) {
315315
elizaLogger.error('Memory operations setup failed:', {
316316
error: error instanceof Error ? error.message : String(error)
@@ -324,7 +324,7 @@ describe('PostgresDatabaseAdapter - Vector Extension Validation', () => {
324324
const content: Content = {
325325
text: 'test content'
326326
};
327-
327+
328328
const memory: Memory = {
329329
id: TEST_UUID,
330330
content,
@@ -383,7 +383,7 @@ describe('PostgresDatabaseAdapter - Vector Extension Validation', () => {
383383
await testClient.query('ROLLBACK');
384384
throw error;
385385
}
386-
386+
387387
// Act
388388
const results = await adapter.searchMemoriesByEmbedding(embedding, {
389389
tableName: TEST_TABLE,
@@ -405,7 +405,7 @@ describe('PostgresDatabaseAdapter - Vector Extension Validation', () => {
405405
const content: Content = {
406406
text: 'test content'
407407
};
408-
408+
409409
const memory: Memory = {
410410
id: TEST_UUID,
411411
content,
@@ -430,4 +430,4 @@ describe('PostgresDatabaseAdapter - Vector Extension Validation', () => {
430430
}
431431
}, { timeout: 30000 }); // Increased timeout for retry attempts
432432
});
433-
});
433+
});

packages/adapter-sqljs/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ export class SqlJsDatabaseAdapter
859859
return JSON.parse(cachedResult);
860860
}
861861

862-
let sql = `
862+
const sql = `
863863
WITH vector_scores AS (
864864
SELECT id,
865865
1 / (1 + vec_distance_L2(embedding, ?)) as vector_score

packages/client-direct/src/api.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export function createApiRouter(
5656
return;
5757
}
5858

59-
let character = agent?.character;
59+
const character = agent?.character;
6060
if (character?.settings?.secrets) {
6161
delete character.settings.secrets;
6262
}

packages/client-direct/src/index.ts

+40-42
Original file line numberDiff line numberDiff line change
@@ -373,14 +373,12 @@ export class DirectClient {
373373

374374
// hyperfi specific parameters
375375
let nearby = [];
376-
let messages = [];
377376
let availableEmotes = [];
378377

379378
if (body.nearby) {
380379
nearby = body.nearby;
381380
}
382381
if (body.messages) {
383-
messages = body.messages;
384382
// loop on the messages and record the memories
385383
// might want to do this in parallel
386384
for (const msg of body.messages) {
@@ -502,10 +500,17 @@ export class DirectClient {
502500
schema: hyperfiOutSchema,
503501
});
504502

503+
if (!response) {
504+
res.status(500).send(
505+
"No response from generateMessageResponse"
506+
);
507+
return;
508+
}
509+
505510
let hfOut;
506511
try {
507512
hfOut = hyperfiOutSchema.parse(response.object);
508-
} catch (e) {
513+
} catch {
509514
elizaLogger.error(
510515
"cant serialize response",
511516
response.object
@@ -515,7 +520,7 @@ export class DirectClient {
515520
}
516521

517522
// do this in the background
518-
const rememberThis = new Promise(async (resolve) => {
523+
new Promise((resolve) => {
519524
const contentObj: Content = {
520525
text: hfOut.say,
521526
};
@@ -545,45 +550,38 @@ export class DirectClient {
545550
content: contentObj,
546551
};
547552

548-
await runtime.messageManager.createMemory(responseMessage); // 18.2ms
549-
550-
if (!response) {
551-
res.status(500).send(
552-
"No response from generateMessageResponse"
553-
);
554-
return;
555-
}
556-
557-
let message = null as Content | null;
558-
559-
const messageId = stringToUuid(Date.now().toString());
560-
const memory: Memory = {
561-
id: messageId,
562-
agentId: runtime.agentId,
563-
userId,
564-
roomId,
565-
content,
566-
createdAt: Date.now(),
567-
};
568-
569-
// run evaluators (generally can be done in parallel with processActions)
570-
// can an evaluator modify memory? it could but currently doesn't
571-
await runtime.evaluate(memory, state); // 0.5s
572-
573-
// only need to call if responseMessage.content.action is set
574-
if (contentObj.action) {
575-
// pass memory (query) to any actions to call
576-
const _result = await runtime.processActions(
577-
memory,
578-
[responseMessage],
579-
state,
580-
async (newMessages) => {
581-
message = newMessages;
582-
return [memory];
553+
runtime.messageManager.createMemory(responseMessage).then(() => {
554+
const messageId = stringToUuid(Date.now().toString());
555+
const memory: Memory = {
556+
id: messageId,
557+
agentId: runtime.agentId,
558+
userId,
559+
roomId,
560+
content,
561+
createdAt: Date.now(),
562+
};
563+
564+
// run evaluators (generally can be done in parallel with processActions)
565+
// can an evaluator modify memory? it could but currently doesn't
566+
runtime.evaluate(memory, state).then(() => {
567+
// only need to call if responseMessage.content.action is set
568+
if (contentObj.action) {
569+
// pass memory (query) to any actions to call
570+
runtime.processActions(
571+
memory,
572+
[responseMessage],
573+
state,
574+
async (newMessages) => {
575+
// FIXME: this is supposed override what the LLM said/decided
576+
// but the promise doesn't make this possible
577+
//message = newMessages;
578+
return [memory];
579+
}
580+
); // 0.674s
583581
}
584-
); // 0.674s
585-
}
586-
resolve(true);
582+
resolve(true);
583+
});
584+
});
587585
});
588586
res.json({ response: hfOut });
589587
}

packages/client-slack/src/actions/chat_with_attachments.ts

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
parseJSONObjectFromText,
66
getModelSettings,
77
} from "@elizaos/core";
8-
import { models } from "@elizaos/core";
98
import {
109
Action,
1110
ActionExample,

packages/client-slack/src/actions/summarize_conversation.ts

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
parseJSONObjectFromText,
77
getModelSettings,
88
} from "@elizaos/core";
9-
import { models } from "@elizaos/core";
109
import { getActorDetails } from "@elizaos/core";
1110
import {
1211
Action,

packages/client-twitter/src/plugins/SttTtsSpacesPlugin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export class SttTtsPlugin implements Plugin {
6767
private ttsQueue: string[] = [];
6868
private isSpeaking = false;
6969

70-
onAttach(space: Space) {
70+
onAttach(_space: Space) {
7171
elizaLogger.log("[SttTtsPlugin] onAttach => space was attached");
7272
}
7373

packages/client-twitter/src/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ function extractUrls(paragraph: string): {
345345
function splitSentencesAndWords(text: string, maxLength: number): string[] {
346346
// Split by periods, question marks and exclamation marks
347347
// Note that URLs in text have been replaced with `<<URL_xxx>>` and won't be split by dots
348-
const sentences = text.match(/[^\.!\?]+[\.!\?]+|[^\.!\?]+$/g) || [text];
348+
const sentences = text.match(/[^.!?]+[.!?]+|[^.!?]+$/g) || [text];
349349
const chunks: string[] = [];
350350
let currentChunk = "";
351351

packages/core/src/generation.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import {
4545
IVerifiableInferenceAdapter,
4646
VerifiableInferenceOptions,
4747
VerifiableInferenceResult,
48-
VerifiableInferenceProvider,
48+
//VerifiableInferenceProvider,
4949
TelemetrySettings,
5050
TokenizerType,
5151
} from "./types.ts";
@@ -1777,9 +1777,9 @@ export async function handleProvider(
17771777
runtime,
17781778
context,
17791779
modelClass,
1780-
verifiableInference,
1781-
verifiableInferenceAdapter,
1782-
verifiableInferenceOptions,
1780+
//verifiableInference,
1781+
//verifiableInferenceAdapter,
1782+
//verifiableInferenceOptions,
17831783
} = options;
17841784
switch (provider) {
17851785
case ModelProviderName.OPENAI:

packages/core/src/ragknowledge.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -299,14 +299,14 @@ export class RAGKnowledgeManager implements IRAGKnowledgeManager {
299299
};
300300

301301
const startTime = Date.now();
302-
let content = file.content;
302+
const content = file.content;
303303

304304
try {
305305
const fileSizeKB = (new TextEncoder().encode(content)).length / 1024;
306306
elizaLogger.info(`[File Progress] Starting ${file.path} (${fileSizeKB.toFixed(2)} KB)`);
307307

308308
// Step 1: Preprocessing
309-
const preprocessStart = Date.now();
309+
//const preprocessStart = Date.now();
310310
const processedContent = this.preprocess(content);
311311
timeMarker('Preprocessing');
312312

packages/core/src/runtime.ts

+3-6
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ import {
3434
IRAGKnowledgeManager,
3535
IMemoryManager,
3636
KnowledgeItem,
37-
RAGKnowledgeItem,
38-
Media,
37+
//RAGKnowledgeItem,
38+
//Media,
3939
ModelClass,
4040
ModelProviderName,
4141
Plugin,
@@ -546,10 +546,7 @@ export class AgentRuntime implements IAgentRuntime {
546546
agentId: this.agentId
547547
});
548548

549-
let content: string;
550-
551-
content = await readFile(filePath, 'utf8');
552-
549+
const content: string = await readFile(filePath, 'utf8');
553550
if (!content) {
554551
hasError = true;
555552
continue;

packages/plugin-anyone/src/actions/startAnyone.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ export const startAnyone: Action = {
2424
_callback: HandlerCallback
2525
): Promise<boolean> => {
2626
await AnyoneClientService.initialize();
27-
const anon = AnyoneClientService.getInstance();
27+
//lint says unused
28+
//const anon = AnyoneClientService.getInstance();
2829
const proxyService = AnyoneProxyService.getInstance();
2930
await proxyService.initialize();
3031

packages/plugin-autonome/src/actions/launchAgent.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Given the recent messages, extract the following information about the requested
4242
export default {
4343
name: "LAUNCH_AGENT",
4444
similes: ["CREATE_AGENT", "DEPLOY_AGENT", "DEPLOY_ELIZA", "DEPLOY_BOT"],
45-
validate: async (runtime: IAgentRuntime, message: Memory) => {
45+
validate: async (_runtime: IAgentRuntime, _message: Memory) => {
4646
return true;
4747
},
4848
description: "Launch an Eliza agent",

0 commit comments

Comments
 (0)