Codemod db pass-through calls to domain modules: tasks + agents (C1 part 1/3)
Rewrite ~525 call sites from `db.<method>()` to `db.<module>.<method>()` for tasks and agents domains (including `getAgent`/`findAgent`/`getTask` which live on the `entityCrud` field). Delete the corresponding pass-through methods on AppDatabaseBase. Structural types that narrowed `db` to a bag of flat methods (CapabilityMatchDb, EscalationDeps, SweepStaleReviewsDeps) are reshaped to match the new namespace. Internal callback references inside database.ts/database-base.ts now invoke the owning module directly (e.g. `this.agents.saveAgent`) rather than the deleted pass-through. The codemod lives at scripts/codemod/remove-appdatabase-passthrough.mjs and filters by owning module + optional explicit method list. It is idempotent and does not re-rewrite already-namespaced calls.
This commit is contained in:
1 parent
411294afa6
commit
5e9b7acbc6
95 files changed
+1123
-793
No files matched your search
@@ -49,10 +49,10 @@ export function recoverShutdownInterruptedTasks(deps: RecoverInterruptedTasksDep
|
||||
for (const run of shutdownRuns) {
|
||||
try {
|
||||
if (run.taskId) {
|
||||
const task = deps.db.getTask(run.taskId);
|
||||
const task = deps.db.entityCrud.getTask(run.taskId);
|
||||
if (task.status === "in_progress" || task.status === "blocked") {
|
||||
deps.db.advanceTaskStatus(run.taskId, "todo", "Auto-resumed after app restart.");
|
||||
deps.db.releaseTaskLock(run.taskId, run.id);
|
||||
deps.db.tasks.advanceTaskStatus(run.taskId, "todo", "Auto-resumed after app restart.");
|
||||
deps.db.tasks.releaseTaskLock(run.taskId, run.id);
|
||||
}
|
||||
}
|
||||
if (!resumedAgents.has(run.agentId)) {
|
||||
|
||||
@@ -75,7 +75,7 @@ export function wireApiServer(deps: WireApiServerDeps): AgentApiServer {
|
||||
deps.threadIntegration.onTaskStatusChanged(taskId, companyId, prev, next);
|
||||
if (prev === "todo" && next === "in_progress") {
|
||||
try {
|
||||
const task = deps.db.getTask(taskId);
|
||||
const task = deps.db.entityCrud.getTask(taskId);
|
||||
deps.checkpointEngine.onTaskStarted(taskId, companyId, task.assigneeAgentId);
|
||||
} catch (error) {
|
||||
log.warn(
|
||||
@@ -118,7 +118,7 @@ export function wireApiServer(deps: WireApiServerDeps): AgentApiServer {
|
||||
},
|
||||
input,
|
||||
),
|
||||
onAutoAssignTask: (taskId, companyId) => deps.db.autoAssignTask(taskId, companyId),
|
||||
onAutoAssignTask: (taskId, companyId) => deps.db.tasks.autoAssignTask(taskId, companyId),
|
||||
onHumanMessage: (companyId, toAgentId, threadId, waitStateId) => {
|
||||
deps.threadIntegration.onHumanMessage(companyId, toAgentId, threadId, waitStateId);
|
||||
deps.publishDomainChanged();
|
||||
|
||||
Reference in new issue
Block a user