diff --git a/src/app-server/catalog/data.ts b/src/app-server/catalog.ts similarity index 94% rename from src/app-server/catalog/data.ts rename to src/app-server/catalog.ts index eb891fbb..5f06bcab 100644 --- a/src/app-server/catalog/data.ts +++ b/src/app-server/catalog.ts @@ -1,12 +1,12 @@ -import type { AppServerClient } from "../connection/client"; +import type { AppServerClient } from "./connection/client"; import { appServerHookOperationFromHookItem, type CatalogModel, hookItemsFromCatalogHooks, modelMetadataFromCatalogModels, skillMetadataFromCatalogSkills, -} from "../protocol/catalog"; -import type { HookItem, ModelMetadata, SkillMetadata } from "../../domain/catalog/metadata"; +} from "./protocol/catalog"; +import type { HookItem, ModelMetadata, SkillMetadata } from "../domain/catalog/metadata"; export interface HookData { hooks: HookItem[]; diff --git a/src/app-server/query/cache.ts b/src/app-server/query/cache.ts index addbe2ed..cdd60191 100644 --- a/src/app-server/query/cache.ts +++ b/src/app-server/query/cache.ts @@ -1,10 +1,10 @@ import { QueryClient, QueryObserver, type QueryObserverResult } from "@tanstack/query-core"; import type { AppServerClient } from "../connection/client"; -import { listModelMetadata } from "../catalog/data"; +import { listModelMetadata } from "../catalog"; import { readRateLimitMetadataProbe, readSkillMetadataProbe } from "./metadata-probes"; import { runtimeConfigSnapshotFromAppServerConfig } from "../protocol/runtime-config"; -import { listThreads } from "../threads/data"; +import { listThreads } from "../threads"; import type { ModelMetadata } from "../../domain/catalog/metadata"; import { createServerDiagnostics, diagnosticProbeError, diagnosticProbeOk, diagnosticsWithProbe } from "../../domain/server/diagnostics"; import type { SharedServerMetadata } from "../../domain/server/metadata"; diff --git a/src/app-server/query/metadata-probes.ts b/src/app-server/query/metadata-probes.ts index 6803e925..e09084c2 100644 --- a/src/app-server/query/metadata-probes.ts +++ b/src/app-server/query/metadata-probes.ts @@ -1,6 +1,6 @@ import type { AppServerClient } from "../connection/client"; import { accountRateLimitsSummaryFromResponse, rateLimitSnapshotFromAccountRateLimitsResponse } from "../protocol/runtime-metrics"; -import { listSkillCatalog } from "../catalog/data"; +import { listSkillCatalog } from "../catalog"; import { diagnosticProbeError, diagnosticProbeOk, type Diagnostics } from "../../domain/server/diagnostics"; import type { SkillMetadata } from "../../domain/catalog/metadata"; import type { RateLimitSnapshot } from "../../domain/runtime/metrics"; diff --git a/src/app-server/services/ephemeral-structured-turn.ts b/src/app-server/services/ephemeral-structured-turn.ts index e4ca5833..d2fc9fca 100644 --- a/src/app-server/services/ephemeral-structured-turn.ts +++ b/src/app-server/services/ephemeral-structured-turn.ts @@ -6,7 +6,7 @@ import { } from "../connection/client"; import { abortablePromise, throwIfAbortSignalAborted } from "../../shared/lifecycle/abortable"; import type { RequestId, ServerNotification } from "../connection/rpc-messages"; -import type { ModelMetadataClient } from "../catalog/data"; +import type { ModelMetadataClient } from "../catalog"; import { lastAgentMessageTextFromTurnRecord, type TurnItem, type TurnRecord } from "../protocol/turn"; export type StructuredTurnOutputSchema = AppServerStartStructuredTurnOptions["outputSchema"]; diff --git a/src/app-server/services/runtime-overrides.ts b/src/app-server/services/runtime-overrides.ts index 2f74dea7..0fccc116 100644 --- a/src/app-server/services/runtime-overrides.ts +++ b/src/app-server/services/runtime-overrides.ts @@ -1,6 +1,6 @@ import type { RuntimeOverride, RuntimeOverrideSettings } from "../../domain/runtime/overrides"; import { runtimeOverride, validatedRuntimeOverrideForModelMetadata } from "../../domain/runtime/overrides"; -import { listModelMetadata, type ModelMetadataClient } from "../catalog/data"; +import { listModelMetadata, type ModelMetadataClient } from "../catalog"; export async function resolvedRuntimeOverrideForClient( client: ModelMetadataClient, diff --git a/src/app-server/services/thread-archive.ts b/src/app-server/services/thread-archive.ts index c2c020eb..464177d4 100644 --- a/src/app-server/services/thread-archive.ts +++ b/src/app-server/services/thread-archive.ts @@ -1,7 +1,7 @@ import type { ArchiveExportAdapter, ArchiveExportSettings } from "../../domain/threads/archive-markdown"; import type { AppServerClient } from "../connection/client"; import { exportArchivedThreadMarkdown } from "./thread-archive-markdown"; -import { readThreadForArchiveExport } from "../threads/data"; +import { readThreadForArchiveExport } from "../threads"; export interface ArchiveThreadOptions { settings: ArchiveExportSettings; diff --git a/src/app-server/threads/data.ts b/src/app-server/threads.ts similarity index 85% rename from src/app-server/threads/data.ts rename to src/app-server/threads.ts index 5b1861f2..f9453f4f 100644 --- a/src/app-server/threads/data.ts +++ b/src/app-server/threads.ts @@ -1,21 +1,21 @@ -import type { AppServerClient } from "../connection/client"; -import { appServerThreadGoalUserHistoryItem, threadGoalFromAppServerGoal } from "../protocol/thread-goal"; -import { threadFromThreadRecord, threadsFromThreadRecords, type ThreadRecord } from "../protocol/thread"; +import type { AppServerClient } from "./connection/client"; +import { appServerThreadGoalUserHistoryItem, threadGoalFromAppServerGoal } from "./protocol/thread-goal"; +import { threadFromThreadRecord, threadsFromThreadRecords, type ThreadRecord } from "./protocol/thread"; import { chronologicalConversationSummariesFromTurnRecords, completedConversationSummariesFromTurnRecords, transcriptEntriesFromTurnRecords, -} from "../protocol/turn"; -import { normalizeReasoningEffort } from "../../domain/catalog/metadata"; -import type { ActivePermissionProfile, ApprovalPolicy, ApprovalsReviewer, ServiceTier } from "../../domain/runtime/policy"; -import { parseServiceTier } from "../../domain/runtime/policy"; -import type { ArchiveThreadInput } from "../../domain/threads/archive-markdown"; -import type { ThreadActivationSnapshot } from "../../domain/threads/activation"; -import type { ThreadGoal, ThreadGoalUpdate } from "../../domain/threads/goal"; -import type { HistoricalTurn } from "../../domain/threads/history"; -import type { Thread } from "../../domain/threads/model"; -import { REFERENCED_THREAD_TURN_LIMIT } from "../../domain/threads/reference"; -import type { ThreadConversationSummary } from "../../domain/threads/transcript"; +} from "./protocol/turn"; +import { normalizeReasoningEffort } from "../domain/catalog/metadata"; +import type { ActivePermissionProfile, ApprovalPolicy, ApprovalsReviewer, ServiceTier } from "../domain/runtime/policy"; +import { parseServiceTier } from "../domain/runtime/policy"; +import type { ArchiveThreadInput } from "../domain/threads/archive-markdown"; +import type { ThreadActivationSnapshot } from "../domain/threads/activation"; +import type { ThreadGoal, ThreadGoalUpdate } from "../domain/threads/goal"; +import type { HistoricalTurn } from "../domain/threads/history"; +import type { Thread } from "../domain/threads/model"; +import { REFERENCED_THREAD_TURN_LIMIT } from "../domain/threads/reference"; +import type { ThreadConversationSummary } from "../domain/threads/transcript"; const THREAD_LIST_PAGE_LIMIT = 100; diff --git a/src/features/chat/app-server/actions/threads.ts b/src/features/chat/app-server/actions/threads.ts index 31cb7595..390991f3 100644 --- a/src/features/chat/app-server/actions/threads.ts +++ b/src/features/chat/app-server/actions/threads.ts @@ -1,5 +1,5 @@ import type { Thread } from "../../../../domain/threads/model"; -import { threadActivationSnapshotFromAppServerResponse } from "../../../../app-server/threads/data"; +import { threadActivationSnapshotFromAppServerResponse } from "../../../../app-server/threads"; import type { RuntimeSnapshot } from "../../application/runtime/snapshot"; import { runtimeConfigOrDefault } from "../../domain/runtime/effective"; import { serviceTierRequestForThreadStart } from "../../application/runtime/thread-settings-update"; diff --git a/src/features/chat/app-server/inbound/notification-plan.ts b/src/features/chat/app-server/inbound/notification-plan.ts index d89e0cda..7f26f6ef 100644 --- a/src/features/chat/app-server/inbound/notification-plan.ts +++ b/src/features/chat/app-server/inbound/notification-plan.ts @@ -1,7 +1,7 @@ import { activeThreadSettingsAppliedAction } from "../../application/state/actions"; import type { McpServerStartupStatus } from "../../../../domain/server/diagnostics"; import { threadTokenUsageFromRuntimeUsage } from "../../../../domain/runtime/metrics"; -import { threadFromAppServerRecord } from "../../../../app-server/threads/data"; +import { threadFromAppServerRecord } from "../../../../app-server/threads"; import { completedConversationSummaryFromTurnRecord, type TurnItem } from "../../../../app-server/protocol/turn"; import type { ServerNotification } from "../../../../app-server/connection/rpc-messages"; import { normalizeExplicitThreadName, type Thread } from "../../../../domain/threads/model"; diff --git a/src/features/chat/app-server/threads/resume.ts b/src/features/chat/app-server/threads/resume.ts index 2570fb9e..f20b9109 100644 --- a/src/features/chat/app-server/threads/resume.ts +++ b/src/features/chat/app-server/threads/resume.ts @@ -1,5 +1,5 @@ import type { AppServerClient } from "../../../../app-server/connection/client"; -import { threadActivationSnapshotFromAppServerResponse } from "../../../../app-server/threads/data"; +import { threadActivationSnapshotFromAppServerResponse } from "../../../../app-server/threads"; import type { ThreadActivationSnapshot } from "../../../../domain/threads/activation"; import type { ChatThreadHistoryPage } from "./history"; import { chatThreadHistoryPageFromTurnsPage } from "./history"; diff --git a/src/features/chat/application/conversation/slash-command-handler.ts b/src/features/chat/application/conversation/slash-command-handler.ts index 5b9f6fe5..7551fa85 100644 --- a/src/features/chat/application/conversation/slash-command-handler.ts +++ b/src/features/chat/application/conversation/slash-command-handler.ts @@ -1,6 +1,6 @@ import type { AppServerClient } from "../../../../app-server/connection/client"; import { codexTextInputWithAttachments, type CodexInput } from "../../../../domain/chat/input"; -import { readReferencedThreadConversationSummaries } from "../../../../app-server/threads/data"; +import { readReferencedThreadConversationSummaries } from "../../../../app-server/threads"; import { referencedThreadPromptBundle, REFERENCED_THREAD_TURN_LIMIT } from "../../../../domain/threads/reference"; import type { Thread } from "../../../../domain/threads/model"; import { shortThreadId } from "../../../../utils"; diff --git a/src/features/chat/application/threads/goal-actions.ts b/src/features/chat/application/threads/goal-actions.ts index 9b653faa..da445dd3 100644 --- a/src/features/chat/application/threads/goal-actions.ts +++ b/src/features/chat/application/threads/goal-actions.ts @@ -1,5 +1,5 @@ import type { AppServerClient } from "../../../../app-server/connection/client"; -import { readThreadGoal, recordThreadGoalUserMessage, setThreadGoal } from "../../../../app-server/threads/data"; +import { readThreadGoal, recordThreadGoalUserMessage, setThreadGoal } from "../../../../app-server/threads"; import type { ThreadGoal, ThreadGoalStatus, ThreadGoalUpdate } from "../../../../domain/threads/goal"; import type { ChatStateStore } from "../state/store"; import type { GoalMessageStreamItem } from "../../domain/message-stream/items"; diff --git a/src/features/chat/application/threads/thread-management-actions.ts b/src/features/chat/application/threads/thread-management-actions.ts index 3cf4f8c6..6cc2bccc 100644 --- a/src/features/chat/application/threads/thread-management-actions.ts +++ b/src/features/chat/application/threads/thread-management-actions.ts @@ -1,5 +1,5 @@ import type { AppServerClient } from "../../../../app-server/connection/client"; -import { forkThread as forkThreadOnAppServer, rollbackThread as rollbackThreadOnAppServer } from "../../../../app-server/threads/data"; +import { forkThread as forkThreadOnAppServer, rollbackThread as rollbackThreadOnAppServer } from "../../../../app-server/threads"; import { inheritedForkThreadName, type Thread } from "../../../../domain/threads/model"; import type { ThreadOperations } from "../../../threads/thread-operations"; import { messageStreamItemsFromTurns } from "../../app-server/mappers/message-stream/turn-items"; diff --git a/src/features/threads/thread-title-service.ts b/src/features/threads/thread-title-service.ts index 70f486f7..14922ae6 100644 --- a/src/features/threads/thread-title-service.ts +++ b/src/features/threads/thread-title-service.ts @@ -1,6 +1,6 @@ import type { AppServerClient } from "../../app-server/connection/client"; import { generateThreadTitleWithCodex } from "../../app-server/services/thread-title-generation"; -import { readCompletedConversationSummariesPage } from "../../app-server/threads/data"; +import { readCompletedConversationSummariesPage } from "../../app-server/threads"; import type { ThreadConversationSummary } from "../../domain/threads/transcript"; import { findThreadTitleContext, diff --git a/src/settings/app-server-data.ts b/src/settings/app-server-data.ts index 7d784bab..e3928349 100644 --- a/src/settings/app-server-data.ts +++ b/src/settings/app-server-data.ts @@ -1,6 +1,6 @@ import type { AppServerClient } from "../app-server/connection/client"; -import { listHookData, type HookData } from "../app-server/catalog/data"; -import { listThreads } from "../app-server/threads/data"; +import { listHookData, type HookData } from "../app-server/catalog"; +import { listThreads } from "../app-server/threads"; import type { Thread } from "../domain/threads/model"; import { errorMessage } from "../utils"; diff --git a/src/settings/dynamic-data-controller.ts b/src/settings/dynamic-data-controller.ts index 8b5d7f0e..2da3d0b7 100644 --- a/src/settings/dynamic-data-controller.ts +++ b/src/settings/dynamic-data-controller.ts @@ -2,8 +2,8 @@ import type { AppServerClient } from "../app-server/connection/client"; import type { AppServerObservedQueryResult } from "../app-server/query/cache"; import { isStaleAppServerSharedQueryContextError } from "../app-server/query/shared-queries"; import { withShortLivedAppServerClient } from "../app-server/connection/short-lived-client"; -import { setHookItemEnabled, trustHookItem } from "../app-server/catalog/data"; -import { restoreArchivedThread as restoreArchivedThreadOnAppServer } from "../app-server/threads/data"; +import { setHookItemEnabled, trustHookItem } from "../app-server/catalog"; +import { restoreArchivedThread as restoreArchivedThreadOnAppServer } from "../app-server/threads"; import type { AppServerSharedQueries } from "../app-server/query/shared-queries"; import type { HookItem, ModelMetadata, ReasoningEffort } from "../domain/catalog/metadata"; import { findModelMetadataByIdOrName, sortedModelMetadata, supportedEffortsForModelMetadata } from "../domain/catalog/metadata"; diff --git a/tests/app-server/catalog-data.test.ts b/tests/app-server/catalog-data.test.ts deleted file mode 100644 index 811c3161..00000000 --- a/tests/app-server/catalog-data.test.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { describe, expect, it, vi } from "vitest"; - -import type { AppServerClient } from "../../src/app-server/connection/client"; -import { listHookData, listSkillCatalog } from "../../src/app-server/catalog/data"; - -describe("app-server catalog data adapters", () => { - it("returns enabled skill options while preserving total app-server skill count", async () => { - const client = { - listSkills: vi.fn().mockResolvedValue({ - data: [ - { - cwd: "/vault", - skills: [ - { name: "enabled", description: "Enabled skill", path: "/skills/enabled", scope: "repo", enabled: true }, - { name: "disabled", description: "Disabled skill", path: "/skills/disabled", scope: "repo", enabled: false }, - ], - }, - ], - }), - } as unknown as AppServerClient; - - await expect(listSkillCatalog(client, "/vault")).resolves.toMatchObject({ - skills: [{ name: "enabled", description: "Enabled skill", path: "/skills/enabled", enabled: true }], - totalCount: 2, - }); - }); - - it("uses only hook rows for the requested cwd", async () => { - const client = { - listHooks: vi.fn().mockResolvedValue({ - data: [ - { cwd: "/other", hooks: [{ key: "other" }], warnings: ["skip"], errors: [{ message: "skip" }] }, - { cwd: "/vault", hooks: [{ key: "vault" }], warnings: ["warn"], errors: [{ message: "err" }] }, - ], - }), - } as unknown as AppServerClient; - - await expect(listHookData(client, "/vault")).resolves.toMatchObject({ - hooks: [{ key: "vault" }], - warnings: ["warn"], - errors: ['{"message":"err"}'], - }); - }); -}); diff --git a/tests/app-server/catalog.test.ts b/tests/app-server/catalog.test.ts index 95588817..c4b90a26 100644 --- a/tests/app-server/catalog.test.ts +++ b/tests/app-server/catalog.test.ts @@ -1,5 +1,7 @@ -import { describe, expect, it } from "vitest"; +import { describe, expect, it, vi } from "vitest"; +import type { AppServerClient } from "../../src/app-server/connection/client"; +import { listHookData, listSkillCatalog } from "../../src/app-server/catalog"; import { appServerHookOperationFromHookItem, hookItemsFromCatalogHooks, @@ -78,6 +80,46 @@ describe("app-server catalog mappers", () => { }); }); +describe("app-server catalog adapters", () => { + it("returns enabled skill options while preserving total app-server skill count", async () => { + const client = { + listSkills: vi.fn().mockResolvedValue({ + data: [ + { + cwd: "/vault", + skills: [ + { name: "enabled", description: "Enabled skill", path: "/skills/enabled", scope: "repo", enabled: true }, + { name: "disabled", description: "Disabled skill", path: "/skills/disabled", scope: "repo", enabled: false }, + ], + }, + ], + }), + } as unknown as AppServerClient; + + await expect(listSkillCatalog(client, "/vault")).resolves.toMatchObject({ + skills: [{ name: "enabled", description: "Enabled skill", path: "/skills/enabled", enabled: true }], + totalCount: 2, + }); + }); + + it("uses only hook rows for the requested cwd", async () => { + const client = { + listHooks: vi.fn().mockResolvedValue({ + data: [ + { cwd: "/other", hooks: [{ key: "other" }], warnings: ["skip"], errors: [{ message: "skip" }] }, + { cwd: "/vault", hooks: [{ key: "vault" }], warnings: ["warn"], errors: [{ message: "err" }] }, + ], + }), + } as unknown as AppServerClient; + + await expect(listHookData(client, "/vault")).resolves.toMatchObject({ + hooks: [{ key: "vault" }], + warnings: ["warn"], + errors: ['{"message":"err"}'], + }); + }); +}); + function modelFixture(): Model { return { id: "gpt-5.5-id", diff --git a/tests/app-server/thread-activation.test.ts b/tests/app-server/thread-activation.test.ts index cac972d9..6f142a12 100644 --- a/tests/app-server/thread-activation.test.ts +++ b/tests/app-server/thread-activation.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "vitest"; -import { threadActivationSnapshotFromAppServerResponse } from "../../src/app-server/threads/data"; +import { threadActivationSnapshotFromAppServerResponse } from "../../src/app-server/threads"; import type { ThreadResumeResponse } from "../../src/generated/app-server/v2/ThreadResumeResponse"; import type { Thread as ThreadRecord } from "../../src/generated/app-server/v2/Thread"; diff --git a/tests/app-server/threads-data.test.ts b/tests/app-server/threads.test.ts similarity index 97% rename from tests/app-server/threads-data.test.ts rename to tests/app-server/threads.test.ts index 435bc750..ecbd25a3 100644 --- a/tests/app-server/threads-data.test.ts +++ b/tests/app-server/threads.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it, vi } from "vitest"; import type { AppServerClient } from "../../src/app-server/connection/client"; -import { listThreads } from "../../src/app-server/threads/data"; +import { listThreads } from "../../src/app-server/threads"; describe("app-server thread data adapters", () => { it("maps listed threads to domain threads with archive state", async () => {