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

@@ -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}`;
}