Skip to content

Commit f859be7

Browse files
authored
Merge branch 'develop' into tbh-add-di
2 parents 3015e58 + 64b1602 commit f859be7

File tree

856 files changed

+2626
-3198
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

856 files changed

+2626
-3198
lines changed

.eslintrc.json

-36
This file was deleted.

.github/workflows/ci.yaml

+6-4
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ jobs:
2222
- name: Install dependencies
2323
run: pnpm install -r --no-frozen-lockfile
2424

25-
- name: Run Prettier
26-
run: pnpm run prettier --check .
25+
- name: Setup Biome CLI
26+
uses: biomejs/setup-biome@v2
27+
with:
28+
version: latest
2729

28-
- name: Run Linter
29-
run: pnpm run lint
30+
- name: Run Biome
31+
run: biome ci
3032

3133
- name: Create test env file
3234
run: |

agent/src/__tests__/client-type-identification.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Client, IAgentRuntime } from "@elizaos/core";
1+
import type { Client, IAgentRuntime } from "@elizaos/core";
22
import { describe, it, expect } from "@jest/globals";
33

44
// Helper function to identify client types

agent/src/index.ts

+15-15
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ import {
2020
AgentRuntime,
2121
CacheManager,
2222
CacheStore,
23-
Character,
24-
Client,
23+
type Character,
24+
type Client,
2525
Clients,
2626
DbCacheAdapter,
2727
defaultCharacter,
2828
elizaLogger,
2929
FsCacheAdapter,
30-
IAgentRuntime,
31-
ICacheManager,
32-
IDatabaseAdapter,
33-
IDatabaseCacheAdapter,
30+
type IAgentRuntime,
31+
type ICacheManager,
32+
type IDatabaseAdapter,
33+
type IDatabaseCacheAdapter,
3434
ModelProviderName,
3535
parseBooleanFromText,
3636
settings,
@@ -117,7 +117,7 @@ import yargs from "yargs";
117117
const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file
118118
const __dirname = path.dirname(__filename); // get the name of the directory
119119

120-
export const wait = (minTime: number = 1000, maxTime: number = 3000) => {
120+
export const wait = (minTime = 1000, maxTime = 3000) => {
121121
const waitTime =
122122
Math.floor(Math.random() * (maxTime - minTime + 1)) + minTime;
123123
return new Promise((resolve) => setTimeout(resolve, waitTime));
@@ -301,7 +301,7 @@ async function loadCharacter(filePath: string): Promise<Character> {
301301
if (!content) {
302302
throw new Error(`Character file not found: ${filePath}`);
303303
}
304-
let character = JSON.parse(content);
304+
const character = JSON.parse(content);
305305
return jsonToCharacter(filePath, character);
306306
}
307307

@@ -312,7 +312,7 @@ function commaSeparatedStringToArray(commaSeparated: string): string[] {
312312
export async function loadCharacters(
313313
charactersArg: string
314314
): Promise<Character[]> {
315-
let characterPaths = commaSeparatedStringToArray(charactersArg);
315+
const characterPaths = commaSeparatedStringToArray(charactersArg);
316316
const loadedCharacters: Character[] = [];
317317

318318
if (characterPaths?.length > 0) {
@@ -386,7 +386,7 @@ export async function loadCharacters(
386386

387387
if (hasValidRemoteUrls()) {
388388
elizaLogger.info("Loading characters from remote URLs");
389-
let characterUrls = commaSeparatedStringToArray(
389+
const characterUrls = commaSeparatedStringToArray(
390390
process.env.REMOTE_CHARACTER_URLS
391391
);
392392
for (const characterUrl of characterUrls) {
@@ -1192,9 +1192,9 @@ const hasValidRemoteUrls = () =>
11921192

11931193
const startAgents = async () => {
11941194
const directClient = new DirectClient();
1195-
let serverPort = parseInt(settings.SERVER_PORT || "3000");
1195+
let serverPort = Number.parseInt(settings.SERVER_PORT || "3000");
11961196
const args = parseArguments();
1197-
let charactersArg = args.characters || args.character;
1197+
const charactersArg = args.characters || args.character;
11981198
let characters = [defaultCharacter];
11991199

12001200
if (process.env.IQ_WALLET_ADDRESS && process.env.IQSOlRPC) {
@@ -1235,7 +1235,7 @@ const startAgents = async () => {
12351235

12361236
directClient.start(serverPort);
12371237

1238-
if (serverPort !== parseInt(settings.SERVER_PORT || "3000")) {
1238+
if (serverPort !== Number.parseInt(settings.SERVER_PORT || "3000")) {
12391239
elizaLogger.log(`Server started on alternate port ${serverPort}`);
12401240
}
12411241

@@ -1255,12 +1255,12 @@ if (
12551255
parseBooleanFromText(process.env.PREVENT_UNHANDLED_EXIT)
12561256
) {
12571257
// Handle uncaught exceptions to prevent the process from crashing
1258-
process.on("uncaughtException", function (err) {
1258+
process.on("uncaughtException", (err) => {
12591259
console.error("uncaughtException", err);
12601260
});
12611261

12621262
// Handle unhandled rejections to prevent the process from crashing
1263-
process.on("unhandledRejection", function (err) {
1263+
process.on("unhandledRejection", (err) => {
12641264
console.error("unhandledRejection", err);
12651265
});
12661266
}

biome.json

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
3+
"organizeImports": {
4+
"enabled": false
5+
},
6+
"linter": {
7+
"enabled": true,
8+
"rules": {
9+
"recommended": true,
10+
"suspicious": {
11+
"noExplicitAny": "warn",
12+
"noArrayIndexKey": "warn",
13+
"noPrototypeBuiltins": "warn",
14+
"noDuplicateObjectKeys": "warn",
15+
"noGlobalIsNan": "warn",
16+
"noDuplicateFontNames": "warn",
17+
"noSelfCompare": "warn",
18+
"noDoubleEquals": "warn",
19+
"noImplicitAnyLet": "warn",
20+
"noAssignInExpressions": "warn",
21+
"noExportsInTest": "warn",
22+
"noConstEnum": "warn",
23+
"noEmptyInterface": "warn"
24+
},
25+
"correctness": {
26+
"noUnusedVariables": "warn",
27+
"noUnreachable": "warn",
28+
"useExhaustiveDependencies": "warn",
29+
"noSwitchDeclarations": "warn",
30+
"noUnnecessaryContinue": "warn",
31+
"noInnerDeclarations": "warn"
32+
},
33+
"style": {
34+
"useConst": "warn",
35+
"useTemplate": "warn",
36+
"useImportType": "warn",
37+
"useNodejsImportProtocol": "warn",
38+
"noUselessElse": "warn",
39+
"useSelfClosingElements": "warn",
40+
"useNumberNamespace": "warn",
41+
"noUnusedTemplateLiteral": "warn",
42+
"noInferrableTypes": "warn",
43+
"noNonNullAssertion": "warn",
44+
"noParameterAssign": "warn",
45+
"useDefaultParameterLast": "warn",
46+
"useExponentiationOperator": "warn",
47+
"noVar": "warn",
48+
"useSingleVarDeclarator": "warn",
49+
"useExportType": "warn"
50+
},
51+
"a11y": {
52+
"useAltText": "warn",
53+
"useFocusableInteractive": "warn",
54+
"useMediaCaption": "warn",
55+
"noSvgWithoutTitle": "warn",
56+
"useKeyWithClickEvents": "warn"
57+
},
58+
"complexity": {
59+
"noForEach": "warn",
60+
"useOptionalChain": "warn",
61+
"useArrowFunction": "warn",
62+
"useFlatMap": "warn",
63+
"useLiteralKeys": "warn",
64+
"noBannedTypes": "warn",
65+
"noStaticOnlyClass": "warn",
66+
"noThisInStatic": "warn",
67+
"noUselessConstructor": "warn",
68+
"noUselessTernary": "warn",
69+
"noUselessSwitchCase": "warn",
70+
"noUselessCatch": "warn"
71+
},
72+
"performance": {
73+
"noDelete": "warn",
74+
"noAccumulatingSpread": "warn"
75+
}
76+
},
77+
"ignore": ["**/dist/**", "**/node_modules/**", "**/coverage/**", "**/*.json"]
78+
},
79+
"formatter": {
80+
"enabled": false
81+
},
82+
"javascript": {
83+
"formatter": {
84+
"quoteStyle": "double",
85+
"semicolons": "always"
86+
}
87+
}
88+
}

client/eslint.config.js

-28
This file was deleted.

client/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
"extract-version": "sh version.sh",
88
"dev": "pnpm run extract-version && vite",
99
"build": "pnpm run extract-version && tsc -b && vite build",
10-
"preview": "vite preview",
11-
"lint": "eslint ."
10+
"preview": "vite preview"
1211
},
1312
"dependencies": {
1413
"@elizaos/core": "workspace:*",

client/src/App.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import useVersion from "./hooks/use-version";
1313
const queryClient = new QueryClient({
1414
defaultOptions: {
1515
queries: {
16-
staleTime: Infinity,
16+
staleTime: Number.POSITIVE_INFINITY,
1717
},
1818
},
1919
});

client/src/components/app-sidebar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from "@/components/ui/sidebar";
1616
import { apiClient } from "@/lib/api";
1717
import { NavLink, useLocation } from "react-router";
18-
import { type UUID } from "@elizaos/core";
18+
import type { UUID } from "@elizaos/core";
1919
import { Book, Cog, User } from "lucide-react";
2020
import ConnectionStatus from "./connection-status";
2121

client/src/components/audio-recorder.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Ellipsis, Mic, Send, Trash } from "lucide-react";
99
import { cn } from "@/lib/utils";
1010
import { useToast } from "@/hooks/use-toast";
1111
import { useMutation } from "@tanstack/react-query";
12-
import { UUID } from "@elizaos/core";
12+
import type { UUID } from "@elizaos/core";
1313
import { apiClient } from "@/lib/api";
1414

1515
type Props = {

client/src/components/chat.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { ChatMessageList } from "@/components/ui/chat/chat-message-list";
99
import { useTransition, animated, AnimatedProps } from "@react-spring/web";
1010
import { Paperclip, Send, X } from "lucide-react";
1111
import { useEffect, useRef, useState } from "react";
12-
import { Content, UUID } from "@elizaos/core";
12+
import type { Content, UUID } from "@elizaos/core";
1313
import { useMutation, useQueryClient } from "@tanstack/react-query";
1414
import { apiClient } from "@/lib/api";
1515
import { cn, moment } from "@/lib/utils";
@@ -19,7 +19,7 @@ import ChatTtsButton from "./ui/chat/chat-tts-button";
1919
import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip";
2020
import { useToast } from "@/hooks/use-toast";
2121
import AIWriter from "react-aiwriter";
22-
import { IAttachment } from "@/types";
22+
import type { IAttachment } from "@/types";
2323
import { AudioRecorder } from "./audio-recorder";
2424
import { Badge } from "./ui/badge";
2525

client/src/components/overview.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Character } from "@elizaos/core";
1+
import type { Character } from "@elizaos/core";
22
import ArrayInput from "@/components/array-input";
33
import InputCopy from "@/components/input-copy";
44
import PageTitle from "./page-title";

client/src/components/ui/badge.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as React from "react"
1+
import type * as React from "react"
22
import { cva, type VariantProps } from "class-variance-authority"
33

44
import { cn } from "@/lib/utils"

client/src/components/ui/chat/chat-bubble.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { cva, type VariantProps } from "class-variance-authority";
33
import { cn } from "@/lib/utils";
44
import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar";
55
import MessageLoading from "./message-loading";
6-
import { Button, ButtonProps } from "../button";
6+
import { Button, type ButtonProps } from "../button";
77

88
// ChatBubble
99
const chatBubbleVariant = cva(

client/src/components/ui/chat/expandable-chat.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, { useRef, useState } from "react";
1+
import type React from "react";
2+
import { useRef, useState } from "react";
23
import { X, MessageCircle } from "lucide-react";
34
import { cn } from "@/lib/utils";
45
import { Button } from "@/components/ui/button";

client/src/components/ui/sidebar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from "react";
22
import { Slot } from "@radix-ui/react-slot";
3-
import { VariantProps, cva } from "class-variance-authority";
3+
import { type VariantProps, cva } from "class-variance-authority";
44
import { PanelLeft } from "lucide-react";
55
import { useIsMobile } from "@/hooks/use-mobile";
66
import { cn } from "@/lib/utils";

client/src/components/ui/toaster.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ export function Toaster() {
1313

1414
return (
1515
<ToastProvider>
16-
{toasts.map(function ({
16+
{toasts.map(({
1717
id,
1818
title,
1919
description,
2020
action,
2121
...props
22-
}) {
23-
return (
22+
}) => (
2423
<Toast key={id} {...props}>
2524
<div className="grid gap-1">
2625
{title && <ToastTitle>{title}</ToastTitle>}
@@ -33,8 +32,7 @@ export function Toaster() {
3332
{action}
3433
<ToastClose />
3534
</Toast>
36-
);
37-
})}
35+
))}
3836
<ToastViewport />
3937
</ToastProvider>
4038
);

client/src/lib/api.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { type UUID, type Character } from "@elizaos/core";
1+
import type { UUID, Character } from "@elizaos/core";
22

33
const BASE_URL = `http://localhost:${import.meta.env.VITE_SERVER_PORT ?? 3000}`;
44

0 commit comments

Comments
 (0)