chore(lint): remove unused vars and imports

- agents-crud: drop unused roleLevel local + inferRoleLevel import
- agents-hierarchy: prefix unused builder params with _
- company-settings: drop InboxItem import, prefix unused builder params
- worker-message-handler: drop unused WorkerServiceDependencies import
This commit is contained in:
ZacharyZhang-NY committed 2026-04-17 01:44:40 -04:00
1 parent aba3ccd275
commit 71791825ce
4 files changed
+14 -14

No files matched your search

+4 -3
View File
@@ -1,5 +1,5 @@
import type { DatabaseSync, SQLInputValue } from "node:sqlite";
import type { AgentRecord, ConnectorId } from "@shared/types";
import type { AgentRecord, AgentRoleLevel, ConnectorId } from "@shared/types";
import {
type ReadAll,
type Transaction,
@@ -7,7 +7,6 @@ import {
normalizeOptionalId,
nowIso,
} from "./helpers";
export function buildAgentCrudMethods(
getDb: () => DatabaseSync,
readAll: ReadAll,
@@ -46,6 +45,8 @@ export function buildAgentCrudMethods(
metadataJson?: string;
capabilities: string;
budgetMonthlyUsd: number;
/** Optional explicit seniority; inferred from role/title when omitted. */
roleLevel?: AgentRoleLevel;
}): string {
const id = ensureId(input.id ?? null);
const ts = nowIso();
@@ -64,7 +65,7 @@ export function buildAgentCrudMethods(
.prepare(
"SELECT name, role, title, department, capabilities, connector_id, model, budget_monthly_usd, metadata_json FROM agents WHERE id = ? AND company_id = ?",
)
.get(id, input.companyId) as Record<string, any> | undefined;
.get(id, input.companyId) as Record<string, unknown> | undefined;
getDb()
.prepare(
"update agents set name = ?, role = ?, title = ?, department = ?, status = ?, reports_to = ?, connector_id = ?, workspace_id = ?, model = ?, metadata_json = ?, capabilities = ?, budget_monthly_usd = ?, updated_at = ? where id = ? and company_id = ?",
+7 -7
View File
@@ -52,8 +52,8 @@ export type AgentStandupRow = {
export function buildAgentHierarchyMethods(
getDb: () => DatabaseSync,
readAll: ReadAll,
transaction: Transaction,
deps: {
_transaction: Transaction,
_deps: {
getAgent: (id: string) => AgentRecord;
},
) {
@@ -63,7 +63,7 @@ export function buildAgentHierarchyMethods(
`WITH RECURSIVE chain AS (
SELECT id, company_id as companyId, name, role, title, department, status,
reports_to as reportsTo, connector_id as connectorId, workspace_id as workspaceId,
model, capabilities, budget_monthly_usd as budgetMonthlyUsd,
model, capabilities, role_level as roleLevel, budget_monthly_usd as budgetMonthlyUsd,
spent_monthly_usd as spentMonthlyUsd, metadata_json as metadataJson,
heartbeat_enabled as heartbeatEnabled, heartbeat_interval_sec as heartbeatIntervalSec,
last_heartbeat_at as lastHeartbeatAt, created_at as createdAt, updated_at as updatedAt,
@@ -72,7 +72,7 @@ export function buildAgentHierarchyMethods(
UNION ALL
SELECT a.id, a.company_id, a.name, a.role, a.title, a.department, a.status,
a.reports_to, a.connector_id, a.workspace_id,
a.model, a.capabilities, a.budget_monthly_usd,
a.model, a.capabilities, a.role_level, a.budget_monthly_usd,
a.spent_monthly_usd, a.metadata_json,
a.heartbeat_enabled, a.heartbeat_interval_sec,
a.last_heartbeat_at, a.created_at, a.updated_at,
@@ -92,7 +92,7 @@ export function buildAgentHierarchyMethods(
getDirectReports(agentId: string, companyId: string): AgentRecord[] {
return readAll<AgentRecord>(
"select id, company_id as companyId, name, role, title, department, status, reports_to as reportsTo, connector_id as connectorId, workspace_id as workspaceId, model, capabilities, budget_monthly_usd as budgetMonthlyUsd, spent_monthly_usd as spentMonthlyUsd, metadata_json as metadataJson, heartbeat_enabled as heartbeatEnabled, heartbeat_interval_sec as heartbeatIntervalSec, last_heartbeat_at as lastHeartbeatAt, created_at as createdAt, updated_at as updatedAt from agents where company_id = ? and reports_to = ?",
"select id, company_id as companyId, name, role, title, department, status, reports_to as reportsTo, connector_id as connectorId, workspace_id as workspaceId, model, capabilities, role_level as roleLevel, budget_monthly_usd as budgetMonthlyUsd, spent_monthly_usd as spentMonthlyUsd, metadata_json as metadataJson, heartbeat_enabled as heartbeatEnabled, heartbeat_interval_sec as heartbeatIntervalSec, last_heartbeat_at as lastHeartbeatAt, created_at as createdAt, updated_at as updatedAt from agents where company_id = ? and reports_to = ?",
companyId,
agentId,
).map((record) => ({
@@ -122,7 +122,7 @@ export function buildAgentHierarchyMethods(
*/
listAgentsForApi(companyId: string): AgentApiRow[] {
return readAll<AgentApiRow & { heartbeatEnabled: number | boolean }>(
"select id, company_id as companyId, name, role, title, department, status, reports_to as reportsTo, connector_id as connectorId, workspace_id as workspaceId, model, capabilities, budget_monthly_usd as budgetMonthlyUsd, spent_monthly_usd as spentMonthlyUsd, metadata_json as metadataJson, heartbeat_enabled as heartbeatEnabled, heartbeat_interval_sec as heartbeatIntervalSec, last_heartbeat_at as lastHeartbeatAt, created_at as createdAt, updated_at as updatedAt from agents where company_id = ? order by created_at asc",
"select id, company_id as companyId, name, role, title, department, status, reports_to as reportsTo, connector_id as connectorId, workspace_id as workspaceId, model, capabilities, role_level as roleLevel, budget_monthly_usd as budgetMonthlyUsd, spent_monthly_usd as spentMonthlyUsd, metadata_json as metadataJson, heartbeat_enabled as heartbeatEnabled, heartbeat_interval_sec as heartbeatIntervalSec, last_heartbeat_at as lastHeartbeatAt, created_at as createdAt, updated_at as updatedAt from agents where company_id = ? order by created_at asc",
companyId,
).map((a) => ({ ...a, heartbeatEnabled: Boolean(a.heartbeatEnabled) })) as AgentApiRow[];
},
@@ -201,7 +201,7 @@ export function buildAgentHierarchyMethods(
listHeartbeatEligibleAgents(companyId: string): AgentRecord[] {
return readAll<AgentRecord>(
"select id, company_id as companyId, name, role, title, department, status, reports_to as reportsTo, connector_id as connectorId, workspace_id as workspaceId, model, capabilities, budget_monthly_usd as budgetMonthlyUsd, spent_monthly_usd as spentMonthlyUsd, metadata_json as metadataJson, heartbeat_enabled as heartbeatEnabled, heartbeat_interval_sec as heartbeatIntervalSec, last_heartbeat_at as lastHeartbeatAt, created_at as createdAt, updated_at as updatedAt from agents where company_id = ? and heartbeat_enabled = 1 and status not in ('terminated', 'paused', 'error', 'pending_approval')",
"select id, company_id as companyId, name, role, title, department, status, reports_to as reportsTo, connector_id as connectorId, workspace_id as workspaceId, model, capabilities, role_level as roleLevel, budget_monthly_usd as budgetMonthlyUsd, spent_monthly_usd as spentMonthlyUsd, metadata_json as metadataJson, heartbeat_enabled as heartbeatEnabled, heartbeat_interval_sec as heartbeatIntervalSec, last_heartbeat_at as lastHeartbeatAt, created_at as createdAt, updated_at as updatedAt from agents where company_id = ? and heartbeat_enabled = 1 and status not in ('terminated', 'paused', 'error', 'pending_approval')",
companyId,
).map((record) => ({
...record,
+2 -3
View File
@@ -2,7 +2,6 @@ import type { DatabaseSync } from "node:sqlite";
import type {
CompanyMetrics,
AgentMetrics,
InboxItem,
ProfileSnapshot,
RunStatus,
StandupReport,
@@ -16,8 +15,8 @@ import {
export function buildCompanySettingsMethods(
getDb: () => DatabaseSync,
readAll: ReadAll,
transaction: Transaction,
deps: {
_transaction: Transaction,
_deps: {
listSnapshot: (options: { companyId?: string | null }) => ProfileSnapshot;
},
) {
+1 -1
View File
@@ -1,4 +1,4 @@
import type { WorkerServiceDependencies, workerMessageSchema } from "./worker-types";
import type { workerMessageSchema } from "./worker-types";
import { handleRunLog } from "./handlers/run-log-handler";
import { handleRunStatus } from "./handlers/run-status-handler";
import { handleRunFinished } from "./handlers/run-finished-handler";