chore: fix linting issues

This commit is contained in:
rhit-lid2
2026-07-19 22:18:42 +05:30
parent 01ec062194
commit 8f6fe0dc28
21 changed files with 105 additions and 94 deletions

View File

@@ -43,13 +43,7 @@ import {
CardTitle,
CardAction,
} from "@/components/ui/card";
import {
Item,
ItemContent,
ItemGroup,
ItemTitle,
ItemDescription,
} from "@/components/ui/item";
import { Item, ItemContent, ItemGroup, ItemTitle } from "@/components/ui/item";
import { Empty, EmptyTitle, EmptyDescription } from "@/components/ui/empty";
import { cn } from "@/lib/utils";
import { RefreshCwIcon } from "lucide-react";
@@ -200,14 +194,12 @@ export function ProviderInstancesConfig({
fetchModelsForExistingInstance(selectedInstanceId);
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [selectedInstanceId, instances, availableProviders]);
// Re-fetch models when provider/key/endpoint changes on new instance form
useEffect(() => {
if (selectedInstanceId !== "new") return;
fetchModelsForNewInstance(editProvider, editKey, editEndpointUrl);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [editProvider, editKey, editEndpointUrl, selectedInstanceId]);
const handleProviderChange = (providerId: string | null) => {

View File

@@ -126,66 +126,73 @@ export function HandoffModal({ entry, onClose }: HandoffModalProps) {
<h3 className="text-xs font-semibold uppercase tracking-wider text-muted-foreground font-mono">
Memory Ledger Additions
</h3>
{chunks.map((chunk: any, index: number) => (
<div
key={index}
className="border border-border/30 bg-card p-4 shadow-[2px_2px_0_0_var(--border)] relative flex flex-col gap-3"
>
<div className="flex justify-between items-start gap-4">
<div className="flex-1 text-sm text-foreground/90 leading-relaxed font-sans">
{chunk.content}
</div>
<Badge
variant="outline"
className={`font-mono text-xs ${getImportanceColor(chunk.importance)}`}
>
Importance: {chunk.importance}
</Badge>
</div>
{chunk.quotes && chunk.quotes.length > 0 && (
<div className="bg-secondary/10 border-l-2 border-primary/50 p-2.5 my-1 text-xs italic text-muted-foreground space-y-1">
{chunk.quotes.map((quote: string, qIdx: number) => (
<div key={qIdx}>&ldquo;{quote}&rdquo;</div>
))}
</div>
)}
<div className="flex flex-wrap gap-2 text-xs pt-2 border-t border-dotted border-border/10">
{chunk.retainInBuffer ? (
{chunks.map(
(
chunk: { content: string; importance: number },
index: number,
) => (
<div
key={index}
className="border border-border/30 bg-card p-4 shadow-sm relative flex flex-col gap-3"
>
<div className="flex justify-between items-start gap-4">
<div className="flex-1 text-sm text-foreground/90 leading-relaxed font-sans">
{chunk.content}
</div>
<Badge
variant="outline"
className="bg-primary/5 text-primary border-primary/20 text-[10px] font-mono"
className={`font-mono text-xs ${getImportanceColor(chunk.importance)}`}
>
Pinned in Buffer
</Badge>
) : (
<Badge
variant="outline"
className="bg-muted text-muted-foreground border-border/20 text-[10px] font-mono"
>
Pruned from Buffer
Importance: {chunk.importance}
</Badge>
</div>
{chunk.quotes && chunk.quotes.length > 0 && (
<div className="bg-secondary/10 border-l-2 border-primary/50 p-2.5 my-1 text-xs italic text-muted-foreground space-y-1">
{chunk.quotes.map((quote: string, qIdx: number) => (
<div key={qIdx}>&ldquo;{quote}&rdquo;</div>
))}
</div>
)}
{chunk.involvedEntityIds &&
chunk.involvedEntityIds.length > 0 && (
<div className="flex items-center gap-1.5 ml-auto text-[10px] font-mono text-muted-foreground">
<span>Entities:</span>
{chunk.involvedEntityIds.map((entId: string) => (
<Badge
key={entId}
variant="outline"
className="text-[10px] px-1 py-0 border-border/20 font-mono"
>
{entId}
</Badge>
))}
</div>
<div className="flex flex-wrap gap-2 text-xs pt-2 border-t border-dotted border-border/10">
{chunk.retainInBuffer ? (
<Badge
variant="outline"
className="bg-primary/5 text-primary border-primary/20 text-[10px] font-mono"
>
Pinned in Buffer
</Badge>
) : (
<Badge
variant="outline"
className="bg-muted text-muted-foreground border-border/20 text-[10px] font-mono"
>
Pruned from Buffer
</Badge>
)}
{chunk.involvedEntityIds &&
chunk.involvedEntityIds.length > 0 && (
<div className="flex items-center gap-1.5 ml-auto text-[10px] font-mono text-muted-foreground">
<span>Entities:</span>
{chunk.involvedEntityIds.map(
(entId: string) => (
<Badge
key={entId}
variant="outline"
className="text-[10px] px-1 py-0 border-border/20 font-mono"
>
{entId}
</Badge>
),
)}
</div>
)}
</div>
</div>
</div>
))}
),
)}
</div>
)}
</div>

View File

@@ -17,13 +17,11 @@ import {
function IntentTag({
intent,
isSelf,
playerAliases,
playerId,
entities,
}: {
intent: SimSnapshot["log"][number]["intents"][number];
isSelf?: boolean;
playerAliases: Record<string, string>;
playerId: string;
entities: SimSnapshot["entities"];
@@ -59,7 +57,10 @@ function IntentTag({
aliases: viewerAliasesMap,
};
const textToDisplay = hydrate(intent.content, viewerEntityMock as any);
const textToDisplay = hydrate(
intent.content,
viewerEntityMock as unknown as Parameters<typeof hydrate>[1],
);
const modifiersStr =
intent.modifiers && intent.modifiers.length > 0 ? (
@@ -147,7 +148,6 @@ function LogEntryCard({
<IntentTag
key={i}
intent={intent}
isSelf={isPlayerCard}
playerAliases={playerAliases}
playerId={playerId}
entities={entities}

View File

@@ -1,7 +1,7 @@
"use client";
import { useEffect, useState } from "react";
import type { SimSnapshot } from "@/lib/simulation-types";
import type { SimSnapshot, PromptBreakdown } from "@/lib/simulation-types";
import {
Dialog,
DialogContent,
@@ -28,7 +28,7 @@ export function PromptModal({ entry, onClose }: PromptModalProps) {
// Helper to resolve components with a fallback if none exist (for backwards-compatibility)
const getComponents = (
promptBreakdown: any,
promptBreakdown: PromptBreakdown | null | undefined,
defaultType: "world" | "input",
) => {
if (!promptBreakdown) return [];
@@ -66,7 +66,7 @@ export function PromptModal({ entry, onClose }: PromptModalProps) {
return (
<Dialog open onOpenChange={(open) => !open && onClose()}>
<DialogContent className="max-w-[750px] sm:max-w-[750px] h-[90vh] overflow-hidden flex flex-col p-0 gap-0">
<DialogContent className="max-w-187.5 sm:max-w-187.5 h-[90vh] overflow-hidden flex flex-col p-0 gap-0">
<DialogHeader className="px-6 pt-5 pb-4 border-b">
<DialogTitle className="text-lg">
Raw Prompts & Token Usage ({entry.entityName})

View File

@@ -2,7 +2,7 @@
interface PromptSwitcherProps {
activeTab: string;
onTabChange: (tab: any) => void;
onTabChange: (tab: string) => void;
hasActor: boolean;
hasDecoder: boolean;
validatorCalls?: { intentIndex: number; intentContent: string }[];

View File

@@ -5,7 +5,6 @@ import { Combobox as ComboboxPrimitive } from "@base-ui/react";
import { CheckIcon, ChevronDownIcon, XIcon } from "lucide-react";
import { cn } from "@/lib/utils";
import { Button } from "@/components/ui/button";
import {
InputGroup,
InputGroupAddon,

View File

@@ -99,12 +99,13 @@ function InputGroupButton({
return React.cloneElement(render, {
className: cn(
inputGroupButtonVariants({ size }),
(render.props as any)?.className,
(render.props as Record<string, unknown>)?.className as
string | undefined,
className,
),
type,
...props,
} as any);
} as Record<string, unknown> as React.HTMLAttributes<HTMLElement>);
}
return (

View File

@@ -38,6 +38,13 @@ export interface ValidatorCall {
};
}
export interface HandoffResult {
chunks: {
content: string;
importance: number;
}[];
}
export interface LogEntry {
turn: number;
entityId: string;
@@ -46,7 +53,7 @@ export interface LogEntry {
intents: IntentInfo[];
timestamp: string;
isHandoff?: boolean;
handoffResult?: any;
handoffResult?: HandoffResult;
decodedIntents?: IntentInfo[];
validatorCalls?: ValidatorCall[];
rawPrompt?: PromptBreakdown;

View File

@@ -39,7 +39,7 @@ export async function runHandoffResolution(session: SimSession): Promise<void> {
worldState.clock.get(),
);
if (ran) {
const lastResult = (handoffEngine as any).lastResult;
const lastResult = handoffEngine.lastResult;
const lastCall =
session.handoffProvider.lastCalls?.[
(session.handoffProvider.lastCalls?.length || 0) - 1

View File

@@ -68,11 +68,8 @@ async function processIntents(
minutesToAdvance: outcome.timeDelta?.minutesToAdvance,
});
if (
intent.type === "action" &&
(session.architect.validator as any).lastResult
) {
const lastResult = (session.architect.validator as any).lastResult;
if (intent.type === "action" && session.architect.validator.lastResult) {
const lastResult = session.architect.validator.lastResult;
let usage = undefined;
if (
session.validatorProvider.lastCalls &&

View File

@@ -4,7 +4,6 @@ import {
WorldState,
naturalizeTime,
serializeSubjectiveWorldState,
resolveAlias,
} from "@omnia/core";
import {
BufferEntry,

View File

@@ -1,7 +1,7 @@
import { describe, test, expect } from "vitest";
import { WorldState, Entity } from "@omnia/core";
import { MockLLMProvider } from "@omnia/llm";
import { IntentDecoder, IntentSequence } from "@omnia/intent";
import { IntentDecoder } from "@omnia/intent";
describe("IntentDecoder Unit Tests (Tier 1)", () => {
test("decodes prose with a single action intent", async () => {

View File

@@ -13,7 +13,7 @@ export interface PromptBreakdown {
components?: PromptComponent[];
}
export interface IPromptBuilder<TArgs extends any[]> {
export interface IPromptBuilder<TArgs extends unknown[]> {
build(...args: TArgs): PromptBreakdown;
}
@@ -49,7 +49,7 @@ export interface LLMCallRecord {
providerInstanceName?: string;
maxContext?: number;
};
response?: any;
response?: unknown;
}
export interface ILLMProvider {

View File

@@ -30,6 +30,7 @@ export class MockLLMProvider implements ILLMProvider {
registerGenerative("mock", () => new MockLLMProvider([]));
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
static create(inst: ModelProviderInstance): ILLMProvider {
return new MockLLMProvider([]);
}

View File

@@ -66,6 +66,7 @@ vi.mock("@langchain/openai", () => {
constructor(config: unknown) {
this.config = config;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
embedQuery = vi.fn().mockImplementation(async (text: string) => {
return [0.1, 0.2, 0.3];
});

View File

@@ -1,5 +1,5 @@
import Database from "better-sqlite3";
import { Entity, resolveAlias } from "@omnia/core";
import { Entity } from "@omnia/core";
import { Intent } from "@omnia/intent";
import { hydrate } from "@omnia/voice";

View File

@@ -208,7 +208,7 @@ export interface HandoffRunResult {
systemPrompt?: string;
userContext?: string;
promptComponents?: PromptComponent[];
response?: any;
response?: unknown;
}
export class HandoffEngine {
@@ -267,7 +267,11 @@ export class HandoffEngine {
};
const result = response.data;
const db = (this.bufferRepo as any).db;
const db = (
this.bufferRepo as unknown as {
db: { transaction: (fn: () => void) => () => void };
}
).db;
const ledgerEntries: LedgerEntry[] = [];
for (const chunk of result.chunks) {

View File

@@ -10,7 +10,6 @@ export function splitQuotes(text: string): Segment[] {
const segments: Segment[] = [];
let current = "";
let inQuote = false;
let quoteChar = "";
for (let i = 0; i < text.length; i++) {
const char = text[i];
@@ -78,7 +77,10 @@ export function dehydrate(
// 2. Replace names and aliases with entity@<id>[name]
sortedNames.forEach((name) => {
const id = nameToId.get(name)!;
const escapedName = name.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
const escapedName = name.replace(
new RegExp("[-/\\\\^$*+?.()|[\\]{}]", "g"),
"\\$&",
);
const regex = new RegExp(`\\b${escapedName}\\b`, "gi");
text = text.replace(regex, (matched) => {

View File

@@ -48,7 +48,7 @@ export function hydrate(content: string, viewer: Entity): string {
return seg.text.replace(regex, (matchStr, id, original, followingWord) => {
const isSelf = id === viewer.id;
const lowerOriginal = original.toLowerCase();
let resolvedSubject = "";
let resolvedSubject: string;
let isThirdPersonSingular = false;
if (isSelf) {
@@ -129,7 +129,8 @@ export function hydrate(content: string, viewer: Entity): string {
if (followingWord) {
if (isThirdPersonSingular) {
const conj = nlp(followingWord).verbs().conjugate()[0] as any;
const conj = nlp(followingWord).verbs().conjugate()[0] as
{ Infinitive?: string; PresentTense?: string } | undefined;
if (conj && conj.Infinitive === followingWord && conj.PresentTense) {
return `${resolvedSubject} ${conj.PresentTense}`;
}
@@ -194,7 +195,7 @@ export function hydrateObjective(
const entity = worldState.getEntity(id);
const name = entity?.attributes.get("name")?.getValue() || id;
const lowerOriginal = original.toLowerCase();
let resolvedSubject = "";
let resolvedSubject: string;
let isThirdPersonSingular = false;
if (firstPersonSet.has(lowerOriginal)) {
@@ -220,7 +221,8 @@ export function hydrateObjective(
if (followingWord) {
if (isThirdPersonSingular) {
const conj = nlp(followingWord).verbs().conjugate()[0] as any;
const conj = nlp(followingWord).verbs().conjugate()[0] as
{ Infinitive?: string; PresentTense?: string } | undefined;
if (conj && conj.Infinitive === followingWord && conj.PresentTense) {
return `${resolvedSubject} ${conj.PresentTense}`;
}

View File

@@ -7,7 +7,6 @@ import {
AttributeVisibility,
} from "@omnia/core";
import { MockLLMProvider } from "@omnia/llm";
import { IntentSequence } from "@omnia/intent";
import { Architect } from "@omnia/architect";
import { BufferRepository, BufferEntry } from "@omnia/memory";
import {

View File

@@ -2,7 +2,7 @@ import { describe, test, expect } from "vitest";
import Database from "better-sqlite3";
import { WorldState, Entity, SQLiteRepository } from "@omnia/core";
import { MockLLMProvider } from "@omnia/llm";
import { IntentDecoder, IntentSequence } from "@omnia/intent";
import { IntentDecoder } from "@omnia/intent";
import { Architect } from "@omnia/architect";
describe("Game Loop Integration Tests (Tier 2)", () => {