Move message-*.ts into messaging/ subdir (N10)
Consolidate the two runtime messaging modules under src/main/messaging/. Storage stays in database/messages.ts — that is the SQL layer and belongs with the other DB modules; messaging/ covers the dispatch/normalize runtime around it. - message-dispatch.ts -> messaging/dispatch.ts - message-normalize.ts -> messaging/normalize.ts - add messaging/index.ts barrel for future consumers (existing call sites import the concrete module path directly) - 10 call sites updated across src/main and tests
This commit is contained in:
1 parent
ec0c81b4b3
commit
557090a6a8
14 files changed
+23
-12
No files matched your search
@@ -23,7 +23,7 @@ export interface AgentDirectory {
|
||||
|
||||
/**
|
||||
* Strip control characters (except newlines/tabs) and collapse excessive
|
||||
* whitespace runs. Mirrors `message-normalize.ts#cleanText` to keep the
|
||||
* whitespace runs. Mirrors `messaging/normalize.ts#cleanText` to keep the
|
||||
* transcript resilient against garbage from upstream senders.
|
||||
*/
|
||||
function cleanText(text: string): string {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import log from "electron-log/main.js";
|
||||
import { agentMessageInputSchema } from "@shared/contracts";
|
||||
import { dispatchAgentMessage } from "../message-dispatch";
|
||||
import { dispatchAgentMessage } from "../messaging/dispatch";
|
||||
import { requireParam, type AgentApiServer } from "./server-core";
|
||||
|
||||
export function registerMessageRoutes(server: AgentApiServer) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AppDatabase } from "../database";
|
||||
import type { AutomationAction, DesktopEvent } from "@shared/types";
|
||||
import { dispatchAgentMessage } from "../message-dispatch";
|
||||
import { dispatchAgentMessage } from "../messaging/dispatch";
|
||||
import { validateTaskCreation } from "../task-quality-gates";
|
||||
import type { AutomationEventContext } from "./types";
|
||||
import { parseActionConfig, type AutomationActionConfigMap } from "./automation-action-schemas";
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
searchMessagesSchema,
|
||||
} from "@shared/contracts";
|
||||
import { fail, ok, type RegisterDomainHandlersDependencies } from "./ipc-domain-common";
|
||||
import { dispatchAgentMessage } from "./message-dispatch";
|
||||
import { dispatchAgentMessage } from "./messaging/dispatch";
|
||||
|
||||
export function registerAgentCoordinationHandlers({
|
||||
registerHandle,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { AppDatabase } from "./database";
|
||||
import type { AppDatabase } from "../database";
|
||||
import type { AgentMessageRecord, DesktopEvent, MessageChannel, MentionResult, SectionId } from "@shared/types";
|
||||
|
||||
/**
|
||||
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Barrel for the messaging layer. `dispatch` handles wire-in between
|
||||
* the API server, thread runtime, and the DB; `normalize` sanitises
|
||||
* comment bodies before they are projected into a prompt. Storage
|
||||
* itself lives in `database/messages.ts` and stays there — the
|
||||
* messaging/ directory covers runtime behaviour around that store, not
|
||||
* the SQL.
|
||||
*/
|
||||
|
||||
export * from "./dispatch";
|
||||
export * from "./normalize";
|
||||
File renamed without changes.
@@ -4,7 +4,7 @@ import type { AgentRecord, ConnectorRecord } from "@shared/types";
|
||||
import type { OrchestrationDependencies } from "./types";
|
||||
import type { RunDispatchParams } from "./turn-context";
|
||||
import { pickModelForAgent } from "../model-dispatch";
|
||||
import { HUMAN_SENDER_ID } from "../message-dispatch";
|
||||
import { HUMAN_SENDER_ID } from "../messaging/dispatch";
|
||||
|
||||
/**
|
||||
* Every reason a heartbeat attempt can be rejected before a run is
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
import type { AppDatabase } from "../database";
|
||||
import type { AgentMessageRecord } from "@shared/types";
|
||||
import { HUMAN_SENDER_ID } from "../message-dispatch";
|
||||
import { HUMAN_SENDER_ID } from "../messaging/dispatch";
|
||||
|
||||
export interface InitialUserTurnDeps {
|
||||
db: AppDatabase;
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { OrchestrationDependencies } from "./types";
|
||||
import { sweepStaleReviews } from "../task-quality-gates";
|
||||
import type { SweepStaleReviewsDeps } from "../task-quality-gates";
|
||||
import { resolveApprovalDecision } from "../approval-policy";
|
||||
import { dispatchAgentMessage } from "../message-dispatch";
|
||||
import { dispatchAgentMessage } from "../messaging/dispatch";
|
||||
|
||||
export function createHousekeepingScheduler(
|
||||
deps: OrchestrationDependencies,
|
||||
|
||||
@@ -11,7 +11,7 @@ import type { AppDatabase } from "../database";
|
||||
import type { ProjectedSkill } from "../skill-types";
|
||||
import type { ConnectorId, ExecutionMode } from "@shared/types";
|
||||
import type { WorkspaceLockMode, EnqueueRunPayload } from "./types";
|
||||
import { normalizeCommentsForPrompt } from "../message-normalize";
|
||||
import { normalizeCommentsForPrompt } from "../messaging/normalize";
|
||||
import { getConnectorModelPolicy, validateConnectorModelSelection } from "../connector-model-policy";
|
||||
import { resolveInitialUserTurn } from "./initial-user-turn";
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import log from "electron-log/main.js";
|
||||
import type { DesktopEvent } from "@shared/types";
|
||||
import type { AppDatabase } from "@main/database";
|
||||
import type { NotificationOptions } from "@main/notification-service";
|
||||
import type { dispatchAgentMessage } from "@main/message-dispatch";
|
||||
import type { dispatchAgentMessage } from "@main/messaging/dispatch";
|
||||
import type { resolveApprovalDecision } from "@main/approval-policy";
|
||||
import { validateTaskRubric } from "@main/task-rubrics";
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { afterEach, describe, expect, it } from "vitest";
|
||||
import { AppDatabase } from "../../src/main/database";
|
||||
import { createThreadIntegration } from "../../src/main/thread-integration";
|
||||
import { createCheckpointEngine } from "../../src/main/checkpoint-engine";
|
||||
import { dispatchAgentMessage, HUMAN_SENDER_ID } from "../../src/main/message-dispatch";
|
||||
import { dispatchAgentMessage, HUMAN_SENDER_ID } from "../../src/main/messaging/dispatch";
|
||||
|
||||
const tempDirs: string[] = [];
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import { tmpdir } from "node:os";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { AppDatabase } from "../../src/main/database";
|
||||
import { createThreadIntegration } from "../../src/main/thread-integration";
|
||||
import { dispatchAgentMessage, HUMAN_SENDER_ID } from "../../src/main/message-dispatch";
|
||||
import { dispatchAgentMessage, HUMAN_SENDER_ID } from "../../src/main/messaging/dispatch";
|
||||
|
||||
const tempDirs: string[] = [];
|
||||
|
||||
|
||||
Reference in new issue
Block a user