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:
1 parent
aba3ccd275
commit
71791825ce
4 files changed
+14
-14
No files matched your search
@@ -1,5 +1,5 @@
|
|||||||
import type { DatabaseSync, SQLInputValue } from "node:sqlite";
|
import type { DatabaseSync, SQLInputValue } from "node:sqlite";
|
||||||
import type { AgentRecord, ConnectorId } from "@shared/types";
|
import type { AgentRecord, AgentRoleLevel, ConnectorId } from "@shared/types";
|
||||||
import {
|
import {
|
||||||
type ReadAll,
|
type ReadAll,
|
||||||
type Transaction,
|
type Transaction,
|
||||||
@@ -7,7 +7,6 @@ import {
|
|||||||
normalizeOptionalId,
|
normalizeOptionalId,
|
||||||
nowIso,
|
nowIso,
|
||||||
} from "./helpers";
|
} from "./helpers";
|
||||||
|
|
||||||
export function buildAgentCrudMethods(
|
export function buildAgentCrudMethods(
|
||||||
getDb: () => DatabaseSync,
|
getDb: () => DatabaseSync,
|
||||||
readAll: ReadAll,
|
readAll: ReadAll,
|
||||||
@@ -46,6 +45,8 @@ export function buildAgentCrudMethods(
|
|||||||
metadataJson?: string;
|
metadataJson?: string;
|
||||||
capabilities: string;
|
capabilities: string;
|
||||||
budgetMonthlyUsd: number;
|
budgetMonthlyUsd: number;
|
||||||
|
/** Optional explicit seniority; inferred from role/title when omitted. */
|
||||||
|
roleLevel?: AgentRoleLevel;
|
||||||
}): string {
|
}): string {
|
||||||
const id = ensureId(input.id ?? null);
|
const id = ensureId(input.id ?? null);
|
||||||
const ts = nowIso();
|
const ts = nowIso();
|
||||||
@@ -64,7 +65,7 @@ export function buildAgentCrudMethods(
|
|||||||
.prepare(
|
.prepare(
|
||||||
"SELECT name, role, title, department, capabilities, connector_id, model, budget_monthly_usd, metadata_json FROM agents WHERE id = ? AND company_id = ?",
|
"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()
|
getDb()
|
||||||
.prepare(
|
.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 = ?",
|
"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 = ?",
|
||||||
|
|||||||
@@ -52,8 +52,8 @@ export type AgentStandupRow = {
|
|||||||
export function buildAgentHierarchyMethods(
|
export function buildAgentHierarchyMethods(
|
||||||
getDb: () => DatabaseSync,
|
getDb: () => DatabaseSync,
|
||||||
readAll: ReadAll,
|
readAll: ReadAll,
|
||||||
transaction: Transaction,
|
_transaction: Transaction,
|
||||||
deps: {
|
_deps: {
|
||||||
getAgent: (id: string) => AgentRecord;
|
getAgent: (id: string) => AgentRecord;
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
@@ -63,7 +63,7 @@ export function buildAgentHierarchyMethods(
|
|||||||
`WITH RECURSIVE chain AS (
|
`WITH RECURSIVE chain AS (
|
||||||
SELECT id, company_id as companyId, name, role, title, department, status,
|
SELECT id, company_id as companyId, name, role, title, department, status,
|
||||||
reports_to as reportsTo, connector_id as connectorId, workspace_id as workspaceId,
|
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,
|
spent_monthly_usd as spentMonthlyUsd, metadata_json as metadataJson,
|
||||||
heartbeat_enabled as heartbeatEnabled, heartbeat_interval_sec as heartbeatIntervalSec,
|
heartbeat_enabled as heartbeatEnabled, heartbeat_interval_sec as heartbeatIntervalSec,
|
||||||
last_heartbeat_at as lastHeartbeatAt, created_at as createdAt, updated_at as updatedAt,
|
last_heartbeat_at as lastHeartbeatAt, created_at as createdAt, updated_at as updatedAt,
|
||||||
@@ -72,7 +72,7 @@ export function buildAgentHierarchyMethods(
|
|||||||
UNION ALL
|
UNION ALL
|
||||||
SELECT a.id, a.company_id, a.name, a.role, a.title, a.department, a.status,
|
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.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.spent_monthly_usd, a.metadata_json,
|
||||||
a.heartbeat_enabled, a.heartbeat_interval_sec,
|
a.heartbeat_enabled, a.heartbeat_interval_sec,
|
||||||
a.last_heartbeat_at, a.created_at, a.updated_at,
|
a.last_heartbeat_at, a.created_at, a.updated_at,
|
||||||
@@ -92,7 +92,7 @@ export function buildAgentHierarchyMethods(
|
|||||||
|
|
||||||
getDirectReports(agentId: string, companyId: string): AgentRecord[] {
|
getDirectReports(agentId: string, companyId: string): AgentRecord[] {
|
||||||
return readAll<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,
|
companyId,
|
||||||
agentId,
|
agentId,
|
||||||
).map((record) => ({
|
).map((record) => ({
|
||||||
@@ -122,7 +122,7 @@ export function buildAgentHierarchyMethods(
|
|||||||
*/
|
*/
|
||||||
listAgentsForApi(companyId: string): AgentApiRow[] {
|
listAgentsForApi(companyId: string): AgentApiRow[] {
|
||||||
return readAll<AgentApiRow & { heartbeatEnabled: number | boolean }>(
|
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,
|
companyId,
|
||||||
).map((a) => ({ ...a, heartbeatEnabled: Boolean(a.heartbeatEnabled) })) as AgentApiRow[];
|
).map((a) => ({ ...a, heartbeatEnabled: Boolean(a.heartbeatEnabled) })) as AgentApiRow[];
|
||||||
},
|
},
|
||||||
@@ -201,7 +201,7 @@ export function buildAgentHierarchyMethods(
|
|||||||
|
|
||||||
listHeartbeatEligibleAgents(companyId: string): AgentRecord[] {
|
listHeartbeatEligibleAgents(companyId: string): AgentRecord[] {
|
||||||
return readAll<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,
|
companyId,
|
||||||
).map((record) => ({
|
).map((record) => ({
|
||||||
...record,
|
...record,
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import type { DatabaseSync } from "node:sqlite";
|
|||||||
import type {
|
import type {
|
||||||
CompanyMetrics,
|
CompanyMetrics,
|
||||||
AgentMetrics,
|
AgentMetrics,
|
||||||
InboxItem,
|
|
||||||
ProfileSnapshot,
|
ProfileSnapshot,
|
||||||
RunStatus,
|
RunStatus,
|
||||||
StandupReport,
|
StandupReport,
|
||||||
@@ -16,8 +15,8 @@ import {
|
|||||||
export function buildCompanySettingsMethods(
|
export function buildCompanySettingsMethods(
|
||||||
getDb: () => DatabaseSync,
|
getDb: () => DatabaseSync,
|
||||||
readAll: ReadAll,
|
readAll: ReadAll,
|
||||||
transaction: Transaction,
|
_transaction: Transaction,
|
||||||
deps: {
|
_deps: {
|
||||||
listSnapshot: (options: { companyId?: string | null }) => ProfileSnapshot;
|
listSnapshot: (options: { companyId?: string | null }) => ProfileSnapshot;
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -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 { handleRunLog } from "./handlers/run-log-handler";
|
||||||
import { handleRunStatus } from "./handlers/run-status-handler";
|
import { handleRunStatus } from "./handlers/run-status-handler";
|
||||||
import { handleRunFinished } from "./handlers/run-finished-handler";
|
import { handleRunFinished } from "./handlers/run-finished-handler";
|
||||||
|
|||||||
Reference in new issue
Block a user