chore: Enable more lint rules, disable some that trigger a lot. Will clean up later.

This commit is contained in:
cpojer
2026-01-31 16:03:28 +09:00
parent 481f696a87
commit 15792b153f
292 changed files with 643 additions and 699 deletions

View File

@@ -81,11 +81,11 @@ export function createSessionsSendTool(opts?: {
}
const listSessions = async (listParams: Record<string, unknown>) => {
const result = (await callGateway({
const result = await callGateway({
method: "sessions.list",
params: listParams,
timeoutMs: 10_000,
})) as { sessions?: Array<Record<string, unknown>> };
});
return Array.isArray(result?.sessions) ? result.sessions : [];
};
@@ -136,11 +136,11 @@ export function createSessionsSendTool(opts?: {
};
let resolvedKey = "";
try {
const resolved = (await callGateway({
const resolved = await callGateway({
method: "sessions.resolve",
params: resolveParams,
timeoutMs: 10_000,
})) as { key?: unknown };
});
resolvedKey = typeof resolved?.key === "string" ? resolved.key.trim() : "";
} catch (err) {
const msg = err instanceof Error ? err.message : String(err);
@@ -283,11 +283,11 @@ export function createSessionsSendTool(opts?: {
if (timeoutSeconds === 0) {
try {
const response = (await callGateway({
const response = await callGateway({
method: "agent",
params: sendParams,
timeoutMs: 10_000,
})) as { runId?: string; acceptedAt?: number };
});
if (typeof response?.runId === "string" && response.runId) {
runId = response.runId;
}
@@ -311,11 +311,11 @@ export function createSessionsSendTool(opts?: {
}
try {
const response = (await callGateway({
const response = await callGateway({
method: "agent",
params: sendParams,
timeoutMs: 10_000,
})) as { runId?: string; acceptedAt?: number };
});
if (typeof response?.runId === "string" && response.runId) {
runId = response.runId;
}
@@ -333,14 +333,14 @@ export function createSessionsSendTool(opts?: {
let waitStatus: string | undefined;
let waitError: string | undefined;
try {
const wait = (await callGateway({
const wait = await callGateway({
method: "agent.wait",
params: {
runId,
timeoutMs,
},
timeoutMs: timeoutMs + 2000,
})) as { status?: string; error?: string };
});
waitStatus = typeof wait?.status === "string" ? wait.status : undefined;
waitError = typeof wait?.error === "string" ? wait.error : undefined;
} catch (err) {
@@ -371,10 +371,10 @@ export function createSessionsSendTool(opts?: {
});
}
const history = (await callGateway({
const history = await callGateway({
method: "chat.history",
params: { sessionKey: resolvedKey, limit: 50 },
})) as { messages?: unknown[] };
});
const filtered = stripToolMessages(Array.isArray(history?.messages) ? history.messages : []);
const last = filtered.length > 0 ? filtered[filtered.length - 1] : undefined;
const reply = last ? extractAssistantText(last) : undefined;