diff --git a/apps/x/apps/main/src/composio-handler.ts b/apps/x/apps/main/src/composio-handler.ts index 5119b6ba..256fe365 100644 --- a/apps/x/apps/main/src/composio-handler.ts +++ b/apps/x/apps/main/src/composio-handler.ts @@ -2,7 +2,7 @@ import { shell, BrowserWindow } from 'electron'; import { createAuthServer } from './auth-server.js'; import * as composioClient from '@x/core/dist/composio/client.js'; import { composioAccountsRepo } from '@x/core/dist/composio/repo.js'; -import { invalidateCopilotInstructionsCache } from '@x/core/dist/application/assistant/instructions.js'; +import { invalidateCopilotInstructionsCache } from '@x/core/dist/runtime/assembly/copilot/instructions.js'; import { CURATED_TOOLKIT_SLUGS } from '@x/shared/dist/composio.js'; import type { LocalConnectedAccount, Toolkit } from '@x/core/dist/composio/types.js'; import { triggerSync as triggerGmailSync } from '@x/core/dist/knowledge/sync_gmail.js'; diff --git a/apps/x/apps/main/src/ipc.ts b/apps/x/apps/main/src/ipc.ts index ef46057f..ef530ff0 100644 --- a/apps/x/apps/main/src/ipc.ts +++ b/apps/x/apps/main/src/ipc.ts @@ -12,8 +12,8 @@ import { watcher as watcherCore, workspace } from '@x/core'; import { WorkDir } from '@x/core/dist/config/config.js'; import { workspace as workspaceShared } from '@x/shared'; import * as mcpCore from '@x/core/dist/mcp/mcp.js'; -import * as runsCore from '@x/core/dist/runs/runs.js'; -import { bus } from '@x/core/dist/runs/bus.js'; +import * as runsCore from '@x/core/dist/runtime/legacy/runs.js'; +import { bus } from '@x/core/dist/runtime/legacy/bus.js'; import { serviceBus } from '@x/core/dist/services/service_bus.js'; import type { FSWatcher } from 'chokidar'; import fs from 'node:fs/promises'; @@ -30,8 +30,8 @@ import { RunEvent } from '@x/shared/dist/runs.js'; import { ServiceEvent } from '@x/shared/dist/service-events.js'; import type { SessionBusEvent } from '@x/shared/dist/sessions.js'; import { isDurableTurnEvent } from '@x/shared/dist/turns.js'; -import type { ISessions, EmitterSessionBus } from '@x/core/dist/sessions/index.js'; -import type { ITurnEventBus } from '@x/core/dist/turns/event-hub.js'; +import type { ISessions, EmitterSessionBus } from '@x/core/dist/runtime/sessions/index.js'; +import type { ITurnEventBus } from '@x/core/dist/runtime/turns/event-hub.js'; import container from '@x/core/dist/di/container.js'; import { listOnboardingModels } from '@x/core/dist/models/models-dev.js'; import { testModelConnection, listModelsForProvider, generateOneShot } from '@x/core/dist/models/models.js'; @@ -55,7 +55,7 @@ import * as codeGit from '@x/core/dist/code-mode/git/service.js'; import { readProjectDir, readProjectFile } from '@x/core/dist/code-mode/projects/fs.js'; import { ensureTerminal, writeTerminal, resizeTerminal, disposeTerminal } from './terminal.js'; import type { CodeSession } from '@x/shared/dist/code-sessions.js'; -import { invalidateCopilotInstructionsCache } from '@x/core/dist/application/assistant/instructions.js'; +import { invalidateCopilotInstructionsCache } from '@x/core/dist/runtime/assembly/copilot/instructions.js'; import { triggerSync as triggerGranolaSync } from '@x/core/dist/knowledge/granola/sync.js'; import { ISlackConfigRepo } from '@x/core/dist/slack/repo.js'; import { IChannelsConfigRepo } from '@x/core/dist/channels/repo.js'; diff --git a/apps/x/apps/main/src/main.ts b/apps/x/apps/main/src/main.ts index a373af76..1e1d3874 100644 --- a/apps/x/apps/main/src/main.ts +++ b/apps/x/apps/main/src/main.ts @@ -36,7 +36,7 @@ import { init as initEventProcessor, registerConsumer } from "@x/core/dist/event import { liveNoteEventConsumer } from "@x/core/dist/knowledge/live-note/event-consumer.js"; import { init as initBackgroundTaskScheduler } from "@x/core/dist/background-tasks/scheduler.js"; import { backgroundTaskEventConsumer } from "@x/core/dist/background-tasks/event-consumer.js"; -import { startSkillsWatcher, stopSkillsWatcher } from "@x/core/dist/application/assistant/skills/watcher.js"; +import { startSkillsWatcher, stopSkillsWatcher } from "@x/core/dist/runtime/assembly/skills/watcher.js"; import { init as initAppsServer, shutdown as shutdownAppsServer } from "@x/core/dist/apps/server.js"; import { registerAppsHostApi } from "@x/core/dist/apps/host-api.js"; import { setTokenCipher as setGithubTokenCipher } from "@x/core/dist/apps/github-auth.js"; @@ -52,7 +52,7 @@ import { execFileSync } from "node:child_process"; import { init as initChromeSync } from "@x/core/dist/knowledge/chrome-extension/server/server.js"; import container, { registerBrowserControlService, registerNotificationService } from "@x/core/dist/di/container.js"; import type { CodeModeManager } from "@x/core/dist/code-mode/acp/manager.js"; -import type { ISessions } from "@x/core/dist/sessions/index.js"; +import type { ISessions } from "@x/core/dist/runtime/sessions/index.js"; import { browserViewManager, BROWSER_PARTITION } from "./browser/view.js"; import { setupBrowserEventForwarding } from "./browser/ipc.js"; import { ElectronBrowserControlService } from "./browser/control-service.js"; diff --git a/apps/x/apps/main/src/test-agent.ts b/apps/x/apps/main/src/test-agent.ts index 738d861a..45a5207d 100644 --- a/apps/x/apps/main/src/test-agent.ts +++ b/apps/x/apps/main/src/test-agent.ts @@ -1,5 +1,5 @@ -import * as runsCore from '@x/core/dist/runs/runs.js'; -import { bus } from '@x/core/dist/runs/bus.js'; +import * as runsCore from '@x/core/dist/runtime/legacy/runs.js'; +import { bus } from '@x/core/dist/runtime/legacy/bus.js'; async function main() { const { id } = await runsCore.createRun({ diff --git a/apps/x/packages/core/package.json b/apps/x/packages/core/package.json index 85d7495d..5bd6d9b5 100644 --- a/apps/x/packages/core/package.json +++ b/apps/x/packages/core/package.json @@ -9,8 +9,8 @@ "dev": "tsc -w -p tsconfig.build.json", "test": "vitest run", "test:watch": "vitest", - "inspect-turn": "node dist/turns/inspect-cli.js", - "inspect": "node dist/turns/inspect-cli.js" + "inspect-turn": "node dist/runtime/turns/inspect-cli.js", + "inspect": "node dist/runtime/turns/inspect-cli.js" }, "dependencies": { "@agentclientprotocol/claude-agent-acp": "^0.55.0", diff --git a/apps/x/packages/core/src/agent-schedule/runner.ts b/apps/x/packages/core/src/agent-schedule/runner.ts index 7db29a99..21af9bbd 100644 --- a/apps/x/packages/core/src/agent-schedule/runner.ts +++ b/apps/x/packages/core/src/agent-schedule/runner.ts @@ -4,7 +4,7 @@ import { IAgentScheduleRepo } from "./repo.js"; import { IAgentScheduleStateRepo } from "./state-repo.js"; import { AgentScheduleConfig, AgentScheduleEntry } from "@x/shared/dist/agent-schedule.js"; import { AgentScheduleState, AgentScheduleStateEntry } from "@x/shared/dist/agent-schedule-state.js"; -import { startWhenPossible } from "../agents/headless-app.js"; +import { startWhenPossible } from "../runtime/assembly/headless-app.js"; import { withUseCase } from "../analytics/use_case.js"; import z from "zod"; diff --git a/apps/x/packages/core/src/application/lib/command-executor.ts b/apps/x/packages/core/src/application/lib/command-executor.ts index 2c34005b..980c7647 100644 --- a/apps/x/packages/core/src/application/lib/command-executor.ts +++ b/apps/x/packages/core/src/application/lib/command-executor.ts @@ -1,7 +1,7 @@ import { exec, execSync, spawn, ChildProcess } from 'child_process'; import { promisify } from 'util'; import { getSecurityAllowList } from '../../config/security.js'; -import { getExecutionShell } from '../assistant/runtime-context.js'; +import { getExecutionShell } from '../../runtime/assembly/copilot/runtime-context.js'; const execPromise = promisify(exec); diff --git a/apps/x/packages/core/src/apps/host-api.ts b/apps/x/packages/core/src/apps/host-api.ts index 9b246a4d..ff664d63 100644 --- a/apps/x/packages/core/src/apps/host-api.ts +++ b/apps/x/packages/core/src/apps/host-api.ts @@ -26,8 +26,8 @@ import { createProvider } from '../models/models.js'; import { captureLlmUsage } from '../analytics/usage.js'; import { withUseCase } from '../analytics/use_case.js'; import { isSignedIn } from '../account/account.js'; -import { createRun, createMessage } from '../runs/runs.js'; -import { extractAgentResponse, waitForRunCompletion } from '../agents/utils.js'; +import { createRun, createMessage } from '../runtime/legacy/runs.js'; +import { extractAgentResponse, waitForRunCompletion } from '../runtime/legacy/utils.js'; import { getBackgroundTaskAgentModel } from '../models/defaults.js'; // Host API — M2 endpoints (spec §7.4–§7.7): Composio tools, SSRF-guarded fetch diff --git a/apps/x/packages/core/src/background-tasks/agent.ts b/apps/x/packages/core/src/background-tasks/agent.ts index 7016516a..059c8f13 100644 --- a/apps/x/packages/core/src/background-tasks/agent.ts +++ b/apps/x/packages/core/src/background-tasks/agent.ts @@ -1,6 +1,6 @@ import z from 'zod'; import { Agent, ToolAttachment } from '@x/shared/dist/agent.js'; -import { BuiltinTools } from '../application/lib/builtin-tools.js'; +import { BuiltinTools } from '../runtime/tools/catalog.js'; import { KNOWLEDGE_NOTE_STYLE_GUIDE } from '../application/lib/knowledge-note-style.js'; import { WorkDir } from '../config/config.js'; diff --git a/apps/x/packages/core/src/background-tasks/code-sessions.ts b/apps/x/packages/core/src/background-tasks/code-sessions.ts index 2958cbc2..13fe94e0 100644 --- a/apps/x/packages/core/src/background-tasks/code-sessions.ts +++ b/apps/x/packages/core/src/background-tasks/code-sessions.ts @@ -5,7 +5,7 @@ import container from '../di/container.js'; import type { CodeSessionService } from '../code-mode/sessions/service.js'; import type { ICodeProjectsRepo } from '../code-mode/projects/repo.js'; import * as gitService from '../code-mode/git/service.js'; -import { extractAgentResponse } from '../agents/utils.js'; +import { extractAgentResponse } from '../runtime/legacy/utils.js'; import { withFileLock } from '../knowledge/file-lock.js'; import { fetchTask, taskIndexPath } from './fileops.js'; diff --git a/apps/x/packages/core/src/background-tasks/runner.ts b/apps/x/packages/core/src/background-tasks/runner.ts index 1463d27b..2f14a422 100644 --- a/apps/x/packages/core/src/background-tasks/runner.ts +++ b/apps/x/packages/core/src/background-tasks/runner.ts @@ -2,8 +2,8 @@ import type { BackgroundTask, BackgroundTaskTriggerType } from '@x/shared/dist/b import { PrefixLogger } from '@x/shared/dist/prefix-logger.js'; import { fetchTask, patchTask, prependRunId } from './fileops.js'; import { getBackgroundTaskAgentModel } from '../models/defaults.js'; -import { startHeadlessAgent, startWhenPossible } from '../agents/headless-app.js'; -import { buildTriggerBlock } from '../agents/build-trigger-block.js'; +import { startHeadlessAgent, startWhenPossible } from '../runtime/assembly/headless-app.js'; +import { buildTriggerBlock } from '../runtime/assembly/build-trigger-block.js'; import { backgroundTaskBus } from './bus.js'; import { withUseCase } from '../analytics/use_case.js'; diff --git a/apps/x/packages/core/src/channels/bridge.test.ts b/apps/x/packages/core/src/channels/bridge.test.ts index c2b3adb7..477d7259 100644 --- a/apps/x/packages/core/src/channels/bridge.test.ts +++ b/apps/x/packages/core/src/channels/bridge.test.ts @@ -1,9 +1,9 @@ import { describe, expect, it, vi } from "vitest"; import type { SessionIndexEntry } from "@x/shared/dist/sessions.js"; import type { TurnStreamEvent } from "@x/shared/dist/turns.js"; -import { TurnEventHub } from "../turns/event-hub.js"; -import { TurnInputError } from "../turns/api.js"; -import type { ISessions } from "../sessions/api.js"; +import { TurnEventHub } from "../runtime/turns/event-hub.js"; +import { TurnInputError } from "../runtime/turns/api.js"; +import type { ISessions } from "../runtime/sessions/api.js"; import { ChannelBridge, type ModelChoice } from "./bridge.js"; const SENDER = "test:1"; diff --git a/apps/x/packages/core/src/channels/bridge.ts b/apps/x/packages/core/src/channels/bridge.ts index cd5d1fc9..b287d50f 100644 --- a/apps/x/packages/core/src/channels/bridge.ts +++ b/apps/x/packages/core/src/channels/bridge.ts @@ -1,10 +1,10 @@ import type { SessionIndexEntry } from "@x/shared/dist/sessions.js"; import { reduceTurn, type TurnStreamEvent } from "@x/shared/dist/turns.js"; -import { assistantText, lastAssistantText } from "../agents/headless.js"; -import { TurnInputError } from "../turns/api.js"; -import { ASK_HUMAN_TOOL } from "../turns/bridges/real-agent-resolver.js"; -import { TurnNotSettledError, type ISessions } from "../sessions/api.js"; -import type { ITurnEventBus } from "../turns/event-hub.js"; +import { assistantText, lastAssistantText } from "../runtime/assembly/headless.js"; +import { TurnInputError } from "../runtime/turns/api.js"; +import { ASK_HUMAN_TOOL } from "../runtime/turns/bridges/real-agent-resolver.js"; +import { TurnNotSettledError, type ISessions } from "../runtime/sessions/api.js"; +import type { ITurnEventBus } from "../runtime/turns/event-hub.js"; // Transport-agnostic command layer: inbound texts from a messaging channel // are parsed into commands (list / resume / new / stop / status) or forwarded diff --git a/apps/x/packages/core/src/channels/service.ts b/apps/x/packages/core/src/channels/service.ts index eb354b53..946a2abc 100644 --- a/apps/x/packages/core/src/channels/service.ts +++ b/apps/x/packages/core/src/channels/service.ts @@ -4,8 +4,8 @@ import type { z } from "zod"; import type { ChannelsConfig, ChannelsStatus } from "@x/shared/dist/channels.js"; import container from "../di/container.js"; import { WorkDir } from "../config/config.js"; -import type { ISessions } from "../sessions/api.js"; -import type { ITurnEventBus } from "../turns/event-hub.js"; +import type { ISessions } from "../runtime/sessions/api.js"; +import type { ITurnEventBus } from "../runtime/turns/event-hub.js"; import { isSignedIn } from "../account/account.js"; import { listGatewayModels } from "../models/gateway.js"; import { listOnboardingModels } from "../models/models-dev.js"; diff --git a/apps/x/packages/core/src/code-mode/sessions/service.ts b/apps/x/packages/core/src/code-mode/sessions/service.ts index c082dc18..d6d683f1 100644 --- a/apps/x/packages/core/src/code-mode/sessions/service.ts +++ b/apps/x/packages/core/src/code-mode/sessions/service.ts @@ -5,11 +5,11 @@ import { WorkDir } from '../../config/config.js'; import type { CodeSession, CodeSessionMode } from '@x/shared/dist/code-sessions.js'; import type { CodingAgent, ApprovalPolicy } from '@x/shared/dist/code-mode.js'; import { RunEvent, MessageEvent } from '@x/shared/dist/runs.js'; -import type { IRunsRepo } from '../../runs/repo.js'; -import type { IRunsLock } from '../../runs/lock.js'; +import type { IRunsRepo } from '../../runtime/legacy/repo.js'; +import type { IRunsLock } from '../../runtime/legacy/lock.js'; import type { IBus } from '../../application/lib/bus.js'; import type { IMonotonicallyIncreasingIdGenerator } from '../../application/lib/id-gen.js'; -import type { IAbortRegistry } from '../../turns/abort-registry.js'; +import type { IAbortRegistry } from '../../runtime/turns/abort-registry.js'; import type { CodeModeManager } from '../acp/manager.js'; import type { CodePermissionRegistry } from '../acp/permission-registry.js'; import type { ICodeSessionsRepo } from './repo.js'; @@ -114,7 +114,7 @@ export class CodeSessionService { // The session is a real run so Rowboat mode (agent runtime) works on it // directly and the existing runs plumbing (fetch/events/stop) applies. - const { createRun } = await import('../../runs/runs.js'); + const { createRun } = await import('../../runtime/legacy/runs.js'); const run = await createRun({ agentId: 'copilot', useCase: 'code_session', diff --git a/apps/x/packages/core/src/di/container.ts b/apps/x/packages/core/src/di/container.ts index ac9d3dc2..90501f67 100644 --- a/apps/x/packages/core/src/di/container.ts +++ b/apps/x/packages/core/src/di/container.ts @@ -3,18 +3,18 @@ import { asClass, asFunction, asValue, createContainer, InjectionMode } from "aw import { WorkDir } from "../config/config.js"; import { FSModelConfigRepo, IModelConfigRepo } from "../models/repo.js"; import { FSMcpConfigRepo, IMcpConfigRepo } from "../mcp/repo.js"; -import { FSAgentsRepo, IAgentsRepo } from "../agents/repo.js"; -import { FSRunsRepo, IRunsRepo } from "../runs/repo.js"; +import { FSAgentsRepo, IAgentsRepo } from "../runtime/assembly/repo.js"; +import { FSRunsRepo, IRunsRepo } from "../runtime/legacy/repo.js"; import { IMonotonicallyIncreasingIdGenerator, IdGen } from "../application/lib/id-gen.js"; import { IMessageQueue, InMemoryMessageQueue } from "../application/lib/message-queue.js"; import { IBus, InMemoryBus } from "../application/lib/bus.js"; -import { IRunsLock, InMemoryRunsLock } from "../runs/lock.js"; -import { IAgentRuntime, AgentRuntime } from "../agents/runtime.js"; +import { IRunsLock, InMemoryRunsLock } from "../runtime/legacy/lock.js"; +import { IAgentRuntime, AgentRuntime } from "../runtime/legacy/engine.js"; import { FSOAuthRepo, IOAuthRepo } from "../auth/repo.js"; import { FSClientRegistrationRepo, IClientRegistrationRepo } from "../auth/client-repo.js"; import { FSGranolaConfigRepo, IGranolaConfigRepo } from "../knowledge/granola/repo.js"; import { FSCodeModeConfigRepo, ICodeModeConfigRepo } from "../code-mode/repo.js"; -import { IAbortRegistry, InMemoryAbortRegistry } from "../turns/abort-registry.js"; +import { IAbortRegistry, InMemoryAbortRegistry } from "../runtime/turns/abort-registry.js"; import { FSAgentScheduleRepo, IAgentScheduleRepo } from "../agent-schedule/repo.js"; import { FSAgentScheduleStateRepo, IAgentScheduleStateRepo } from "../agent-schedule/state-repo.js"; import { FSSlackConfigRepo, ISlackConfigRepo } from "../slack/repo.js"; @@ -28,33 +28,33 @@ import { CodeSessionService } from "../code-mode/sessions/service.js"; import { CodeSessionStatusTracker } from "../code-mode/sessions/status-tracker.js"; import type { IBrowserControlService } from "../application/browser-control/service.js"; import type { INotificationService } from "../application/notification/service.js"; -import { SystemClock, type IClock } from "../turns/clock.js"; -import { FSTurnRepo } from "../turns/fs-repo.js"; -import type { ITurnRepo } from "../turns/repo.js"; -import type { IContextResolver } from "../turns/context-resolver.js"; -import { createContextResolver } from "../turns/context-elision.js"; -import { EmitterTurnLifecycleBus, type ITurnLifecycleBus } from "../turns/bus.js"; -import { TurnEventHub, type ITurnEventBus } from "../turns/event-hub.js"; -import { RealUsageReporter } from "../turns/bridges/real-usage-reporter.js"; -import type { IUsageReporter } from "../turns/usage-reporter.js"; -import { TurnRuntime } from "../turns/runtime.js"; -import type { ITurnRuntime } from "../turns/api.js"; -import type { IAgentResolver } from "../turns/agent-resolver.js"; -import type { IModelRegistry } from "../turns/model-registry.js"; -import type { IToolRegistry } from "../turns/tool-registry.js"; -import type { IPermissionChecker, IPermissionClassifier } from "../turns/permission.js"; -import { RealAgentResolver } from "../turns/bridges/real-agent-resolver.js"; -import { InlineAgentResolver } from "../turns/bridges/inline-agent-resolver.js"; -import { DispatchingAgentResolver } from "../turns/bridges/agent-resolver-dispatch.js"; -import { RealModelRegistry } from "../turns/bridges/real-model-registry.js"; -import { RealToolRegistry } from "../turns/bridges/real-tool-registry.js"; -import { RealPermissionChecker } from "../turns/bridges/real-permission-checker.js"; -import { RealPermissionClassifier } from "../turns/bridges/real-permission-classifier.js"; -import { FSSessionRepo } from "../sessions/fs-repo.js"; -import type { ISessionRepo } from "../sessions/repo.js"; -import { EmitterSessionBus, type ISessionBus } from "../sessions/bus.js"; -import { SessionsImpl } from "../sessions/sessions.js"; -import type { ISessions } from "../sessions/api.js"; +import { SystemClock, type IClock } from "../runtime/turns/clock.js"; +import { FSTurnRepo } from "../runtime/turns/fs-repo.js"; +import type { ITurnRepo } from "../runtime/turns/repo.js"; +import type { IContextResolver } from "../runtime/turns/context-resolver.js"; +import { createContextResolver } from "../runtime/turns/context-elision.js"; +import { EmitterTurnLifecycleBus, type ITurnLifecycleBus } from "../runtime/turns/bus.js"; +import { TurnEventHub, type ITurnEventBus } from "../runtime/turns/event-hub.js"; +import { RealUsageReporter } from "../runtime/turns/bridges/real-usage-reporter.js"; +import type { IUsageReporter } from "../runtime/turns/usage-reporter.js"; +import { TurnRuntime } from "../runtime/turns/runtime.js"; +import type { ITurnRuntime } from "../runtime/turns/api.js"; +import type { IAgentResolver } from "../runtime/turns/agent-resolver.js"; +import type { IModelRegistry } from "../runtime/turns/model-registry.js"; +import type { IToolRegistry } from "../runtime/turns/tool-registry.js"; +import type { IPermissionChecker, IPermissionClassifier } from "../runtime/turns/permission.js"; +import { RealAgentResolver } from "../runtime/turns/bridges/real-agent-resolver.js"; +import { InlineAgentResolver } from "../runtime/turns/bridges/inline-agent-resolver.js"; +import { DispatchingAgentResolver } from "../runtime/turns/bridges/agent-resolver-dispatch.js"; +import { RealModelRegistry } from "../runtime/turns/bridges/real-model-registry.js"; +import { RealToolRegistry } from "../runtime/turns/bridges/real-tool-registry.js"; +import { RealPermissionChecker } from "../runtime/turns/bridges/real-permission-checker.js"; +import { RealPermissionClassifier } from "../runtime/turns/bridges/real-permission-classifier.js"; +import { FSSessionRepo } from "../runtime/sessions/fs-repo.js"; +import type { ISessionRepo } from "../runtime/sessions/repo.js"; +import { EmitterSessionBus, type ISessionBus } from "../runtime/sessions/bus.js"; +import { SessionsImpl } from "../runtime/sessions/sessions.js"; +import type { ISessions } from "../runtime/sessions/api.js"; import { DefaultModelResolver, type IDefaultModelResolver, @@ -62,7 +62,7 @@ import { import { HeadlessAgentRunner, type IHeadlessAgentRunner, -} from "../agents/headless.js"; +} from "../runtime/assembly/headless.js"; const container = createContainer({ injectionMode: InjectionMode.PROXY, diff --git a/apps/x/packages/core/src/knowledge/agent_notes.ts b/apps/x/packages/core/src/knowledge/agent_notes.ts index 3f25002d..0666f499 100644 --- a/apps/x/packages/core/src/knowledge/agent_notes.ts +++ b/apps/x/packages/core/src/knowledge/agent_notes.ts @@ -2,9 +2,9 @@ import fs from 'fs'; import path from 'path'; import { google } from 'googleapis'; import { WorkDir } from '../config/config.js'; -import { runWhenPossible } from '../agents/headless-app.js'; +import { runWhenPossible } from '../runtime/assembly/headless-app.js'; import { getKgModel } from '../models/defaults.js'; -import { getErrorDetails } from '../agents/utils.js'; +import { getErrorDetails } from '../runtime/legacy/utils.js'; import { serviceLogger } from '../services/service_logger.js'; import { loadUserConfig, updateUserEmail } from '../config/user_config.js'; import { GoogleClientFactory } from './google-client-factory.js'; diff --git a/apps/x/packages/core/src/knowledge/build_graph.ts b/apps/x/packages/core/src/knowledge/build_graph.ts index b50852ad..f251f176 100644 --- a/apps/x/packages/core/src/knowledge/build_graph.ts +++ b/apps/x/packages/core/src/knowledge/build_graph.ts @@ -2,8 +2,8 @@ import fs from 'fs'; import path from 'path'; import { WorkDir } from '../config/config.js'; import { getKgModel } from '../models/defaults.js'; -import { runWhenPossible, toolInputPaths } from '../agents/headless-app.js'; -import { getErrorDetails } from '../agents/utils.js'; +import { runWhenPossible, toolInputPaths } from '../runtime/assembly/headless-app.js'; +import { getErrorDetails } from '../runtime/legacy/utils.js'; import { serviceLogger, type ServiceRunContext } from '../services/service_logger.js'; import { loadState, diff --git a/apps/x/packages/core/src/knowledge/inline_task_agent.ts b/apps/x/packages/core/src/knowledge/inline_task_agent.ts index 339c5d38..96be6c22 100644 --- a/apps/x/packages/core/src/knowledge/inline_task_agent.ts +++ b/apps/x/packages/core/src/knowledge/inline_task_agent.ts @@ -1,4 +1,4 @@ -import { BuiltinTools } from '../application/lib/builtin-tools.js'; +import { BuiltinTools } from '../runtime/tools/catalog.js'; export function getRaw(): string { // code_agent_run needs an interactive UI to answer its permission asks; exclude it diff --git a/apps/x/packages/core/src/knowledge/inline_tasks.ts b/apps/x/packages/core/src/knowledge/inline_tasks.ts index 71bdf38f..ec2657bf 100644 --- a/apps/x/packages/core/src/knowledge/inline_tasks.ts +++ b/apps/x/packages/core/src/knowledge/inline_tasks.ts @@ -3,7 +3,7 @@ import path from 'path'; import { CronExpressionParser } from 'cron-parser'; import { generateText } from 'ai'; import { WorkDir } from '../config/config.js'; -import { runWhenPossible } from '../agents/headless-app.js'; +import { runWhenPossible } from '../runtime/assembly/headless-app.js'; import { getKgModel } from '../models/defaults.js'; import container from '../di/container.js'; import type { IModelConfigRepo } from '../models/repo.js'; diff --git a/apps/x/packages/core/src/knowledge/label_emails.ts b/apps/x/packages/core/src/knowledge/label_emails.ts index bac565a1..dfab477c 100644 --- a/apps/x/packages/core/src/knowledge/label_emails.ts +++ b/apps/x/packages/core/src/knowledge/label_emails.ts @@ -1,9 +1,9 @@ import fs from 'fs'; import path from 'path'; import { WorkDir } from '../config/config.js'; -import { runWhenPossible, toolInputPaths } from '../agents/headless-app.js'; +import { runWhenPossible, toolInputPaths } from '../runtime/assembly/headless-app.js'; import { getKgModel } from '../models/defaults.js'; -import { getErrorDetails } from '../agents/utils.js'; +import { getErrorDetails } from '../runtime/legacy/utils.js'; import { serviceLogger } from '../services/service_logger.js'; import { limitEventItems } from './limit_event_items.js'; import { diff --git a/apps/x/packages/core/src/knowledge/live-note/agent.ts b/apps/x/packages/core/src/knowledge/live-note/agent.ts index 7638384e..a0621e08 100644 --- a/apps/x/packages/core/src/knowledge/live-note/agent.ts +++ b/apps/x/packages/core/src/knowledge/live-note/agent.ts @@ -1,6 +1,6 @@ import z from 'zod'; import { Agent, ToolAttachment } from '@x/shared/dist/agent.js'; -import { BuiltinTools } from '../../application/lib/builtin-tools.js'; +import { BuiltinTools } from '../../runtime/tools/catalog.js'; import { KNOWLEDGE_NOTE_STYLE_GUIDE } from '../../application/lib/knowledge-note-style.js'; import { WorkDir } from '../../config/config.js'; diff --git a/apps/x/packages/core/src/knowledge/live-note/runner.ts b/apps/x/packages/core/src/knowledge/live-note/runner.ts index e192a08e..2aa8e9bc 100644 --- a/apps/x/packages/core/src/knowledge/live-note/runner.ts +++ b/apps/x/packages/core/src/knowledge/live-note/runner.ts @@ -1,9 +1,9 @@ import type { LiveNote, LiveNoteTriggerType } from '@x/shared/dist/live-note.js'; import { fetchLiveNote, patchLiveNote, readNoteBody } from './fileops.js'; import { getLiveNoteAgentModel } from '../../models/defaults.js'; -import { startHeadlessAgent, startWhenPossible } from '../../agents/headless-app.js'; +import { startHeadlessAgent, startWhenPossible } from '../../runtime/assembly/headless-app.js'; import { withUseCase } from '../../analytics/use_case.js'; -import { buildTriggerBlock } from '../../agents/build-trigger-block.js'; +import { buildTriggerBlock } from '../../runtime/assembly/build-trigger-block.js'; import { liveNoteBus } from './bus.js'; import { PrefixLogger } from '@x/shared/dist/prefix-logger.js'; diff --git a/apps/x/packages/core/src/knowledge/tag_notes.ts b/apps/x/packages/core/src/knowledge/tag_notes.ts index be87b849..61b18319 100644 --- a/apps/x/packages/core/src/knowledge/tag_notes.ts +++ b/apps/x/packages/core/src/knowledge/tag_notes.ts @@ -1,9 +1,9 @@ import fs from 'fs'; import path from 'path'; import { WorkDir } from '../config/config.js'; -import { runWhenPossible, toolInputPaths } from '../agents/headless-app.js'; +import { runWhenPossible, toolInputPaths } from '../runtime/assembly/headless-app.js'; import { getKgModel } from '../models/defaults.js'; -import { getErrorDetails } from '../agents/utils.js'; +import { getErrorDetails } from '../runtime/legacy/utils.js'; import { serviceLogger } from '../services/service_logger.js'; import { limitEventItems } from './limit_event_items.js'; import { diff --git a/apps/x/packages/core/src/migrations/runs/migrate.test.ts b/apps/x/packages/core/src/migrations/runs/migrate.test.ts index c28440ac..f8d9cb9d 100644 --- a/apps/x/packages/core/src/migrations/runs/migrate.test.ts +++ b/apps/x/packages/core/src/migrations/runs/migrate.test.ts @@ -5,8 +5,8 @@ import path from "node:path"; import { fileURLToPath } from "node:url"; import { reduceTurn } from "@x/shared/dist/turns.js"; import { reduceSession } from "@x/shared/dist/sessions.js"; -import { FSTurnRepo } from "../../turns/fs-repo.js"; -import { FSSessionRepo } from "../../sessions/fs-repo.js"; +import { FSTurnRepo } from "../../runtime/turns/fs-repo.js"; +import { FSSessionRepo } from "../../runtime/sessions/fs-repo.js"; import { migrateRuns } from "./migrate.js"; const fixturesDir = path.join( diff --git a/apps/x/packages/core/src/pre_built/runner.ts b/apps/x/packages/core/src/pre_built/runner.ts index 60243c4b..841c75e5 100644 --- a/apps/x/packages/core/src/pre_built/runner.ts +++ b/apps/x/packages/core/src/pre_built/runner.ts @@ -1,7 +1,7 @@ import fs from 'fs'; import path from 'path'; import { WorkDir } from '../config/config.js'; -import { runWhenPossible } from '../agents/headless-app.js'; +import { runWhenPossible } from '../runtime/assembly/headless-app.js'; import { getKgModel } from '../models/defaults.js'; import { loadConfig, diff --git a/apps/x/packages/core/src/runs/bus.ts b/apps/x/packages/core/src/runs/bus.ts deleted file mode 100644 index 7ddb8577..00000000 --- a/apps/x/packages/core/src/runs/bus.ts +++ /dev/null @@ -1,4 +0,0 @@ -import container from "../di/container.js"; -import { IBus } from "../application/lib/bus.js"; - -export const bus = container.resolve('bus'); \ No newline at end of file diff --git a/apps/x/packages/core/src/agents/__snapshots__/compose-instructions.test.ts.snap b/apps/x/packages/core/src/runtime/assembly/__snapshots__/compose-instructions.test.ts.snap similarity index 100% rename from apps/x/packages/core/src/agents/__snapshots__/compose-instructions.test.ts.snap rename to apps/x/packages/core/src/runtime/assembly/__snapshots__/compose-instructions.test.ts.snap diff --git a/apps/x/packages/core/src/agents/build-trigger-block.ts b/apps/x/packages/core/src/runtime/assembly/build-trigger-block.ts similarity index 100% rename from apps/x/packages/core/src/agents/build-trigger-block.ts rename to apps/x/packages/core/src/runtime/assembly/build-trigger-block.ts diff --git a/apps/x/packages/core/src/application/assistant/capabilities/modes.ts b/apps/x/packages/core/src/runtime/assembly/capabilities/modes.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/capabilities/modes.ts rename to apps/x/packages/core/src/runtime/assembly/capabilities/modes.ts diff --git a/apps/x/packages/core/src/application/assistant/capabilities/types.ts b/apps/x/packages/core/src/runtime/assembly/capabilities/types.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/capabilities/types.ts rename to apps/x/packages/core/src/runtime/assembly/capabilities/types.ts diff --git a/apps/x/packages/core/src/application/assistant/capabilities/workspace.ts b/apps/x/packages/core/src/runtime/assembly/capabilities/workspace.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/capabilities/workspace.ts rename to apps/x/packages/core/src/runtime/assembly/capabilities/workspace.ts diff --git a/apps/x/packages/core/src/agents/compose-instructions.test.ts b/apps/x/packages/core/src/runtime/assembly/compose-instructions.test.ts similarity index 100% rename from apps/x/packages/core/src/agents/compose-instructions.test.ts rename to apps/x/packages/core/src/runtime/assembly/compose-instructions.test.ts diff --git a/apps/x/packages/core/src/agents/compose-instructions.ts b/apps/x/packages/core/src/runtime/assembly/compose-instructions.ts similarity index 95% rename from apps/x/packages/core/src/agents/compose-instructions.ts rename to apps/x/packages/core/src/runtime/assembly/compose-instructions.ts index 3a43c964..2bfe37b0 100644 --- a/apps/x/packages/core/src/agents/compose-instructions.ts +++ b/apps/x/packages/core/src/runtime/assembly/compose-instructions.ts @@ -1,12 +1,12 @@ -import { MODE_CAPABILITIES } from "../application/assistant/capabilities/modes.js"; +import { MODE_CAPABILITIES } from "./capabilities/modes.js"; import { AGENT_NOTES_CAPABILITY, WORK_DIRECTORY_CAPABILITY, -} from "../application/assistant/capabilities/workspace.js"; +} from "./capabilities/workspace.js"; import type { CapabilityContext, ModeFlags, -} from "../application/assistant/capabilities/types.js"; +} from "./capabilities/types.js"; // Everything that composes into the system prompt, in composition order. const PROMPT_CAPABILITIES = [ diff --git a/apps/x/packages/core/src/application/assistant/connections.ts b/apps/x/packages/core/src/runtime/assembly/connections.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/connections.ts rename to apps/x/packages/core/src/runtime/assembly/connections.ts diff --git a/apps/x/packages/core/src/application/assistant/agent.ts b/apps/x/packages/core/src/runtime/assembly/copilot/agent.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/agent.ts rename to apps/x/packages/core/src/runtime/assembly/copilot/agent.ts diff --git a/apps/x/packages/core/src/application/assistant/base-tools.ts b/apps/x/packages/core/src/runtime/assembly/copilot/base-tools.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/base-tools.ts rename to apps/x/packages/core/src/runtime/assembly/copilot/base-tools.ts diff --git a/apps/x/packages/core/src/application/assistant/instructions.ts b/apps/x/packages/core/src/runtime/assembly/copilot/instructions.ts similarity index 98% rename from apps/x/packages/core/src/application/assistant/instructions.ts rename to apps/x/packages/core/src/runtime/assembly/copilot/instructions.ts index ecb8c182..9120851b 100644 --- a/apps/x/packages/core/src/application/assistant/instructions.ts +++ b/apps/x/packages/core/src/runtime/assembly/copilot/instructions.ts @@ -1,16 +1,16 @@ -import { buildAvailableSkillCatalog } from "./skills/index.js"; +import { buildAvailableSkillCatalog } from "../skills/index.js"; import { getRuntimeContext, getRuntimeContextPrompt } from "./runtime-context.js"; import { isCodeModeAvailable, isComposioAvailable, isGoogleConnected, isSlackAvailable, -} from "./connections.js"; -import { composioAccountsRepo } from "../../composio/repo.js"; -import { isConfigured as isComposioConfigured } from "../../composio/client.js"; +} from "../connections.js"; +import { composioAccountsRepo } from "../../../composio/repo.js"; +import { isConfigured as isComposioConfigured } from "../../../composio/client.js"; import { CURATED_TOOLKITS } from "@x/shared/dist/composio.js"; -import { knowledgeSourcesRepo } from "../../knowledge/sources/repo.js"; -import { listApps } from "../../apps/indexer.js"; +import { knowledgeSourcesRepo } from "../../../knowledge/sources/repo.js"; +import { listApps } from "../../../apps/indexer.js"; const runtimeContextPrompt = getRuntimeContextPrompt(getRuntimeContext()); diff --git a/apps/x/packages/core/src/application/assistant/runtime-context.ts b/apps/x/packages/core/src/runtime/assembly/copilot/runtime-context.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/runtime-context.ts rename to apps/x/packages/core/src/runtime/assembly/copilot/runtime-context.ts diff --git a/apps/x/packages/core/src/agents/headless-app.ts b/apps/x/packages/core/src/runtime/assembly/headless-app.ts similarity index 90% rename from apps/x/packages/core/src/agents/headless-app.ts rename to apps/x/packages/core/src/runtime/assembly/headless-app.ts index 7dd0e127..ded7ffe5 100644 --- a/apps/x/packages/core/src/agents/headless-app.ts +++ b/apps/x/packages/core/src/runtime/assembly/headless-app.ts @@ -1,6 +1,6 @@ -import container from "../di/container.js"; -import { chatActivity } from "../application/lib/chat-activity.js"; -import { shouldDeferBackgroundTasks } from "../models/defaults.js"; +import container from "../../di/container.js"; +import { chatActivity } from "../../application/lib/chat-activity.js"; +import { shouldDeferBackgroundTasks } from "../../models/defaults.js"; import { type HeadlessAgentHandle, type HeadlessAgentOptions, diff --git a/apps/x/packages/core/src/agents/headless.test.ts b/apps/x/packages/core/src/runtime/assembly/headless.test.ts similarity index 99% rename from apps/x/packages/core/src/agents/headless.test.ts rename to apps/x/packages/core/src/runtime/assembly/headless.test.ts index 1f756ffd..2e67d298 100644 --- a/apps/x/packages/core/src/agents/headless.test.ts +++ b/apps/x/packages/core/src/runtime/assembly/headless.test.ts @@ -14,7 +14,7 @@ import { lastAssistantText, toolInputPaths, } from "./headless.js"; -import type { IDefaultModelResolver } from "../models/default-model-resolver.js"; +import type { IDefaultModelResolver } from "../../models/default-model-resolver.js"; type TEvent = z.infer; diff --git a/apps/x/packages/core/src/agents/headless.ts b/apps/x/packages/core/src/runtime/assembly/headless.ts similarity index 98% rename from apps/x/packages/core/src/agents/headless.ts rename to apps/x/packages/core/src/runtime/assembly/headless.ts index 755076c3..f24f2f42 100644 --- a/apps/x/packages/core/src/agents/headless.ts +++ b/apps/x/packages/core/src/runtime/assembly/headless.ts @@ -6,7 +6,7 @@ import { type TurnState, } from "@x/shared/dist/turns.js"; import type { ITurnRuntime, TurnOutcome } from "../turns/api.js"; -import type { IDefaultModelResolver } from "../models/default-model-resolver.js"; +import type { IDefaultModelResolver } from "../../models/default-model-resolver.js"; // Drop-in replacement for the old headless runs pattern // (createRun → createMessage → waitForRunCompletion → extractAgentResponse): diff --git a/apps/x/packages/core/src/agents/message-encoding.ts b/apps/x/packages/core/src/runtime/assembly/message-encoding.ts similarity index 100% rename from apps/x/packages/core/src/agents/message-encoding.ts rename to apps/x/packages/core/src/runtime/assembly/message-encoding.ts diff --git a/apps/x/packages/core/src/agents/permission-metadata.ts b/apps/x/packages/core/src/runtime/assembly/permission-metadata.ts similarity index 95% rename from apps/x/packages/core/src/agents/permission-metadata.ts rename to apps/x/packages/core/src/runtime/assembly/permission-metadata.ts index 6f44970f..0b33bd15 100644 --- a/apps/x/packages/core/src/agents/permission-metadata.ts +++ b/apps/x/packages/core/src/runtime/assembly/permission-metadata.ts @@ -4,14 +4,14 @@ // engine file so the turn-runtime bridges no longer depend on it. import path from "path"; -import { WorkDir } from "../config/config.js"; +import { WorkDir } from "../../config/config.js"; import { ToolAttachment } from "@x/shared/dist/agent.js"; import { ToolCallPart } from "@x/shared/dist/message.js"; import { z } from "zod"; import { ToolPermissionMetadata } from "@x/shared/dist/runs.js"; -import { isBlocked, extractCommandNames } from "../application/lib/command-executor.js"; -import { getFileAccessAllowList, type FileAccessGrant, type FileAccessOperation } from "../config/security.js"; -import { resolveFilePathForPermission } from "../filesystem/files.js"; +import { isBlocked, extractCommandNames } from "../../application/lib/command-executor.js"; +import { getFileAccessAllowList, type FileAccessGrant, type FileAccessOperation } from "../../config/security.js"; +import { resolveFilePathForPermission } from "../../filesystem/files.js"; type ToolPermissionMetadataValue = z.infer; diff --git a/apps/x/packages/core/src/agents/registry.test.ts b/apps/x/packages/core/src/runtime/assembly/registry.test.ts similarity index 100% rename from apps/x/packages/core/src/agents/registry.test.ts rename to apps/x/packages/core/src/runtime/assembly/registry.test.ts diff --git a/apps/x/packages/core/src/agents/registry.ts b/apps/x/packages/core/src/runtime/assembly/registry.ts similarity index 82% rename from apps/x/packages/core/src/agents/registry.ts rename to apps/x/packages/core/src/runtime/assembly/registry.ts index 5522f274..00372cf8 100644 --- a/apps/x/packages/core/src/agents/registry.ts +++ b/apps/x/packages/core/src/runtime/assembly/registry.ts @@ -1,16 +1,16 @@ import type { z } from "zod"; import { Agent } from "@x/shared/dist/agent.js"; -import { parseFrontmatter } from "../application/lib/parse-frontmatter.js"; -import { buildCopilotAgent } from "../application/assistant/agent.js"; -import { buildBackgroundTaskAgent } from "../background-tasks/agent.js"; -import { buildLiveNoteAgent } from "../knowledge/live-note/agent.js"; -import { getRaw as getNoteCreationRaw } from "../knowledge/note_creation.js"; -import { getRaw as getNoteCurationRaw } from "../knowledge/note_curation.js"; -import { getRaw as getLabelingAgentRaw } from "../knowledge/labeling_agent.js"; -import { getRaw as getNoteTaggingAgentRaw } from "../knowledge/note_tagging_agent.js"; -import { getRaw as getInlineTaskAgentRaw } from "../knowledge/inline_task_agent.js"; -import { getRaw as getAgentNotesAgentRaw } from "../knowledge/agent_notes_agent.js"; -import { lazyResolve } from "../di/lazy-resolve.js"; +import { parseFrontmatter } from "../../application/lib/parse-frontmatter.js"; +import { buildCopilotAgent } from "./copilot/agent.js"; +import { buildBackgroundTaskAgent } from "../../background-tasks/agent.js"; +import { buildLiveNoteAgent } from "../../knowledge/live-note/agent.js"; +import { getRaw as getNoteCreationRaw } from "../../knowledge/note_creation.js"; +import { getRaw as getNoteCurationRaw } from "../../knowledge/note_curation.js"; +import { getRaw as getLabelingAgentRaw } from "../../knowledge/labeling_agent.js"; +import { getRaw as getNoteTaggingAgentRaw } from "../../knowledge/note_tagging_agent.js"; +import { getRaw as getInlineTaskAgentRaw } from "../../knowledge/inline_task_agent.js"; +import { getRaw as getAgentNotesAgentRaw } from "../../knowledge/agent_notes_agent.js"; +import { lazyResolve } from "../../di/lazy-resolve.js"; import type { IAgentsRepo } from "./repo.js"; // The registry of built-in agents: one table instead of the historical diff --git a/apps/x/packages/core/src/agents/repo.ts b/apps/x/packages/core/src/runtime/assembly/repo.ts similarity index 96% rename from apps/x/packages/core/src/agents/repo.ts rename to apps/x/packages/core/src/runtime/assembly/repo.ts index fc832e16..ce610b4d 100644 --- a/apps/x/packages/core/src/agents/repo.ts +++ b/apps/x/packages/core/src/runtime/assembly/repo.ts @@ -1,11 +1,11 @@ -import { WorkDir } from "../config/config.js"; +import { WorkDir } from "../../config/config.js"; import fs from "fs/promises"; import { glob } from "node:fs/promises"; import path from "path"; import z from "zod"; import { Agent } from "@x/shared/dist/agent.js"; import { stringify } from "yaml"; -import { parseFrontmatter } from "../application/lib/parse-frontmatter.js"; +import { parseFrontmatter } from "../../application/lib/parse-frontmatter.js"; // eslint-disable-next-line @typescript-eslint/no-unused-vars const UpdateAgentSchema = Agent.omit({ name: true }); diff --git a/apps/x/packages/core/src/application/assistant/skills/app-navigation/skill.ts b/apps/x/packages/core/src/runtime/assembly/skills/app-navigation/skill.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/skills/app-navigation/skill.ts rename to apps/x/packages/core/src/runtime/assembly/skills/app-navigation/skill.ts diff --git a/apps/x/packages/core/src/application/assistant/skills/apps/skill.ts b/apps/x/packages/core/src/runtime/assembly/skills/apps/skill.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/skills/apps/skill.ts rename to apps/x/packages/core/src/runtime/assembly/skills/apps/skill.ts diff --git a/apps/x/packages/core/src/application/assistant/skills/background-task/skill.ts b/apps/x/packages/core/src/runtime/assembly/skills/background-task/skill.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/skills/background-task/skill.ts rename to apps/x/packages/core/src/runtime/assembly/skills/background-task/skill.ts diff --git a/apps/x/packages/core/src/application/assistant/skills/browser-control/skill.ts b/apps/x/packages/core/src/runtime/assembly/skills/browser-control/skill.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/skills/browser-control/skill.ts rename to apps/x/packages/core/src/runtime/assembly/skills/browser-control/skill.ts diff --git a/apps/x/packages/core/src/application/assistant/skills/builtin-tools/skill.ts b/apps/x/packages/core/src/runtime/assembly/skills/builtin-tools/skill.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/skills/builtin-tools/skill.ts rename to apps/x/packages/core/src/runtime/assembly/skills/builtin-tools/skill.ts diff --git a/apps/x/packages/core/src/application/assistant/skills/code-with-agents/skill.ts b/apps/x/packages/core/src/runtime/assembly/skills/code-with-agents/skill.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/skills/code-with-agents/skill.ts rename to apps/x/packages/core/src/runtime/assembly/skills/code-with-agents/skill.ts diff --git a/apps/x/packages/core/src/application/assistant/skills/composio-integration/skill.ts b/apps/x/packages/core/src/runtime/assembly/skills/composio-integration/skill.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/skills/composio-integration/skill.ts rename to apps/x/packages/core/src/runtime/assembly/skills/composio-integration/skill.ts diff --git a/apps/x/packages/core/src/application/assistant/skills/create-presentations/skill.ts b/apps/x/packages/core/src/runtime/assembly/skills/create-presentations/skill.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/skills/create-presentations/skill.ts rename to apps/x/packages/core/src/runtime/assembly/skills/create-presentations/skill.ts diff --git a/apps/x/packages/core/src/application/assistant/skills/deletion-guardrails/skill.ts b/apps/x/packages/core/src/runtime/assembly/skills/deletion-guardrails/skill.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/skills/deletion-guardrails/skill.ts rename to apps/x/packages/core/src/runtime/assembly/skills/deletion-guardrails/skill.ts diff --git a/apps/x/packages/core/src/application/assistant/skills/disk-loader.test.ts b/apps/x/packages/core/src/runtime/assembly/skills/disk-loader.test.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/skills/disk-loader.test.ts rename to apps/x/packages/core/src/runtime/assembly/skills/disk-loader.test.ts diff --git a/apps/x/packages/core/src/application/assistant/skills/disk-loader.ts b/apps/x/packages/core/src/runtime/assembly/skills/disk-loader.ts similarity index 98% rename from apps/x/packages/core/src/application/assistant/skills/disk-loader.ts rename to apps/x/packages/core/src/runtime/assembly/skills/disk-loader.ts index 56b6670d..55f6ed16 100644 --- a/apps/x/packages/core/src/application/assistant/skills/disk-loader.ts +++ b/apps/x/packages/core/src/runtime/assembly/skills/disk-loader.ts @@ -3,7 +3,7 @@ import path from "node:path"; import { homedir } from "node:os"; import { WorkDir } from "../../../config/config.js"; import type { ModelCapability } from "../capabilities/types.js"; -import { splitFrontmatter } from "../../lib/parse-frontmatter.js"; +import { splitFrontmatter } from "../../../application/lib/parse-frontmatter.js"; /** * A skill discovered on disk: structurally the model-activated capability diff --git a/apps/x/packages/core/src/application/assistant/skills/doc-collab/skill.ts b/apps/x/packages/core/src/runtime/assembly/skills/doc-collab/skill.ts similarity index 99% rename from apps/x/packages/core/src/application/assistant/skills/doc-collab/skill.ts rename to apps/x/packages/core/src/runtime/assembly/skills/doc-collab/skill.ts index 911ff874..27c5dea5 100644 --- a/apps/x/packages/core/src/application/assistant/skills/doc-collab/skill.ts +++ b/apps/x/packages/core/src/runtime/assembly/skills/doc-collab/skill.ts @@ -1,4 +1,4 @@ -import { KNOWLEDGE_NOTE_STYLE_GUIDE } from '../../../lib/knowledge-note-style.js'; +import { KNOWLEDGE_NOTE_STYLE_GUIDE } from '../../../../application/lib/knowledge-note-style.js'; export const skill = String.raw` # Document Collaboration Skill diff --git a/apps/x/packages/core/src/application/assistant/skills/draft-emails/skill.ts b/apps/x/packages/core/src/runtime/assembly/skills/draft-emails/skill.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/skills/draft-emails/skill.ts rename to apps/x/packages/core/src/runtime/assembly/skills/draft-emails/skill.ts diff --git a/apps/x/packages/core/src/application/assistant/skills/index.test.ts b/apps/x/packages/core/src/runtime/assembly/skills/index.test.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/skills/index.test.ts rename to apps/x/packages/core/src/runtime/assembly/skills/index.test.ts diff --git a/apps/x/packages/core/src/application/assistant/skills/index.ts b/apps/x/packages/core/src/runtime/assembly/skills/index.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/skills/index.ts rename to apps/x/packages/core/src/runtime/assembly/skills/index.ts diff --git a/apps/x/packages/core/src/application/assistant/skills/live-note/skill.ts b/apps/x/packages/core/src/runtime/assembly/skills/live-note/skill.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/skills/live-note/skill.ts rename to apps/x/packages/core/src/runtime/assembly/skills/live-note/skill.ts diff --git a/apps/x/packages/core/src/application/assistant/skills/mcp-integration/skill.ts b/apps/x/packages/core/src/runtime/assembly/skills/mcp-integration/skill.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/skills/mcp-integration/skill.ts rename to apps/x/packages/core/src/runtime/assembly/skills/mcp-integration/skill.ts diff --git a/apps/x/packages/core/src/application/assistant/skills/meeting-prep/skill.ts b/apps/x/packages/core/src/runtime/assembly/skills/meeting-prep/skill.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/skills/meeting-prep/skill.ts rename to apps/x/packages/core/src/runtime/assembly/skills/meeting-prep/skill.ts diff --git a/apps/x/packages/core/src/application/assistant/skills/notify-user/skill.ts b/apps/x/packages/core/src/runtime/assembly/skills/notify-user/skill.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/skills/notify-user/skill.ts rename to apps/x/packages/core/src/runtime/assembly/skills/notify-user/skill.ts diff --git a/apps/x/packages/core/src/application/assistant/skills/organize-files/skill.ts b/apps/x/packages/core/src/runtime/assembly/skills/organize-files/skill.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/skills/organize-files/skill.ts rename to apps/x/packages/core/src/runtime/assembly/skills/organize-files/skill.ts diff --git a/apps/x/packages/core/src/application/assistant/skills/slack/skill.ts b/apps/x/packages/core/src/runtime/assembly/skills/slack/skill.ts similarity index 100% rename from apps/x/packages/core/src/application/assistant/skills/slack/skill.ts rename to apps/x/packages/core/src/runtime/assembly/skills/slack/skill.ts diff --git a/apps/x/packages/core/src/application/assistant/skills/watcher.ts b/apps/x/packages/core/src/runtime/assembly/skills/watcher.ts similarity index 97% rename from apps/x/packages/core/src/application/assistant/skills/watcher.ts rename to apps/x/packages/core/src/runtime/assembly/skills/watcher.ts index 9e5fd459..e5925f52 100644 --- a/apps/x/packages/core/src/application/assistant/skills/watcher.ts +++ b/apps/x/packages/core/src/runtime/assembly/skills/watcher.ts @@ -2,7 +2,7 @@ import chokidar, { type FSWatcher } from "chokidar"; import fs from "node:fs"; import { SKILL_ROOTS } from "./disk-loader.js"; import { refreshDiskSkills } from "./index.js"; -import { invalidateCopilotInstructionsCache } from "../instructions.js"; +import { invalidateCopilotInstructionsCache } from "../copilot/instructions.js"; // The skills CLI writes many files per install (~13 paths for one skill), so we // coalesce a burst of events into a single refresh. diff --git a/apps/x/packages/core/src/agents/spawn-agent.test.ts b/apps/x/packages/core/src/runtime/assembly/spawn-agent.test.ts similarity index 100% rename from apps/x/packages/core/src/agents/spawn-agent.test.ts rename to apps/x/packages/core/src/runtime/assembly/spawn-agent.test.ts diff --git a/apps/x/packages/core/src/agents/spawn-agent.ts b/apps/x/packages/core/src/runtime/assembly/spawn-agent.ts similarity index 99% rename from apps/x/packages/core/src/agents/spawn-agent.ts rename to apps/x/packages/core/src/runtime/assembly/spawn-agent.ts index 85510a92..3acfd24d 100644 --- a/apps/x/packages/core/src/agents/spawn-agent.ts +++ b/apps/x/packages/core/src/runtime/assembly/spawn-agent.ts @@ -230,7 +230,7 @@ export async function runSpawnedAgent( async function resolveServices(): Promise< NonNullable > { - const { lazyResolve } = await import("../di/lazy-resolve.js"); + const { lazyResolve } = await import("../../di/lazy-resolve.js"); return { turnRuntime: await lazyResolve( diff --git a/apps/x/packages/core/src/agents/workspace-context.test.ts b/apps/x/packages/core/src/runtime/assembly/workspace-context.test.ts similarity index 100% rename from apps/x/packages/core/src/agents/workspace-context.test.ts rename to apps/x/packages/core/src/runtime/assembly/workspace-context.test.ts diff --git a/apps/x/packages/core/src/agents/workspace-context.ts b/apps/x/packages/core/src/runtime/assembly/workspace-context.ts similarity index 98% rename from apps/x/packages/core/src/agents/workspace-context.ts rename to apps/x/packages/core/src/runtime/assembly/workspace-context.ts index ea0039e1..dac19d68 100644 --- a/apps/x/packages/core/src/agents/workspace-context.ts +++ b/apps/x/packages/core/src/runtime/assembly/workspace-context.ts @@ -1,6 +1,6 @@ import fs from "fs"; import path from "path"; -import { WorkDir } from "../config/config.js"; +import { WorkDir } from "../../config/config.js"; import { hasWorkspaceContext } from "./registry.js"; // Workspace context for agent assembly: agent notes (global) and the user's diff --git a/apps/x/packages/core/src/runtime/legacy/bus.ts b/apps/x/packages/core/src/runtime/legacy/bus.ts new file mode 100644 index 00000000..54febcdd --- /dev/null +++ b/apps/x/packages/core/src/runtime/legacy/bus.ts @@ -0,0 +1,4 @@ +import container from "../../di/container.js"; +import { IBus } from "../../application/lib/bus.js"; + +export const bus = container.resolve('bus'); \ No newline at end of file diff --git a/apps/x/packages/core/src/agents/runtime.ts b/apps/x/packages/core/src/runtime/legacy/engine.ts similarity index 97% rename from apps/x/packages/core/src/agents/runtime.ts rename to apps/x/packages/core/src/runtime/legacy/engine.ts index 2241197e..4f3c1d59 100644 --- a/apps/x/packages/core/src/agents/runtime.ts +++ b/apps/x/packages/core/src/runtime/legacy/engine.ts @@ -4,32 +4,32 @@ import { AssistantContentPart, AssistantMessage, MessageList, ProviderOptions, T import { LanguageModel, stepCountIs, streamText, tool, Tool, ToolSet } from "ai"; import { z } from "zod"; import { LlmStepStreamEvent } from "@x/shared/dist/llm-step-events.js"; -import { execTool } from "../application/lib/exec-tool.js"; -import { TOOL_ADDITIONS_KEY } from "../application/lib/tool-additions.js"; +import { execTool } from "../tools/exec-tool.js"; +import { TOOL_ADDITIONS_KEY } from "../tools/tool-additions.js"; import { AskHumanRequestEvent, RunEvent, ToolPermissionRequestEvent } from "@x/shared/dist/runs.js"; -import { BuiltinTools } from "../application/lib/builtin-tools.js"; -import { hasWorkspaceContext, loadAgent } from "./registry.js"; -import { composeSystemInstructions } from "./compose-instructions.js"; -import { convertFromMessages } from "./message-encoding.js"; -import { getToolPermissionMetadata } from "./permission-metadata.js"; -import { loadWorkspaceContext } from "./workspace-context.js"; -import { extractCommandNames } from "../application/lib/command-executor.js"; -import { type FileAccessGrant } from "../config/security.js"; -import { notifyIfEnabled } from "../application/notification/notifier.js"; -import { IModelConfigRepo } from "../models/repo.js"; -import { createLanguageModel } from "../models/models.js"; -import { chatActivity } from "../application/lib/chat-activity.js"; -import { resolveProviderConfig } from "../models/defaults.js"; -import { IMonotonicallyIncreasingIdGenerator } from "../application/lib/id-gen.js"; -import { IBus } from "../application/lib/bus.js"; -import { IMessageQueue, type MiddlePaneContext } from "../application/lib/message-queue.js"; -import { IRunsRepo } from "../runs/repo.js"; -import { IRunsLock } from "../runs/lock.js"; +import { BuiltinTools } from "../tools/catalog.js"; +import { hasWorkspaceContext, loadAgent } from "../assembly/registry.js"; +import { composeSystemInstructions } from "../assembly/compose-instructions.js"; +import { convertFromMessages } from "../assembly/message-encoding.js"; +import { getToolPermissionMetadata } from "../assembly/permission-metadata.js"; +import { loadWorkspaceContext } from "../assembly/workspace-context.js"; +import { extractCommandNames } from "../../application/lib/command-executor.js"; +import { type FileAccessGrant } from "../../config/security.js"; +import { notifyIfEnabled } from "../../application/notification/notifier.js"; +import { IModelConfigRepo } from "../../models/repo.js"; +import { createLanguageModel } from "../../models/models.js"; +import { chatActivity } from "../../application/lib/chat-activity.js"; +import { resolveProviderConfig } from "../../models/defaults.js"; +import { IMonotonicallyIncreasingIdGenerator } from "../../application/lib/id-gen.js"; +import { IBus } from "../../application/lib/bus.js"; +import { IMessageQueue, type MiddlePaneContext } from "../../application/lib/message-queue.js"; +import { IRunsRepo } from "./repo.js"; +import { IRunsLock } from "./lock.js"; import { IAbortRegistry } from "../turns/abort-registry.js"; import { PrefixLogger } from "@x/shared"; -import { captureLlmUsage } from "../analytics/usage.js"; -import { enterUseCase, withUseCase, type UseCase } from "../analytics/use_case.js"; -import { classifyToolPermissions, type AutoPermissionCandidate } from "../security/auto-permission-classifier.js"; +import { captureLlmUsage } from "../../analytics/usage.js"; +import { enterUseCase, withUseCase, type UseCase } from "../../analytics/use_case.js"; +import { classifyToolPermissions, type AutoPermissionCandidate } from "../../security/auto-permission-classifier.js"; function formatCurrentDateTime(now: Date): string { return now.toLocaleString('en-US', { diff --git a/apps/x/packages/core/src/runs/lock.ts b/apps/x/packages/core/src/runtime/legacy/lock.ts similarity index 100% rename from apps/x/packages/core/src/runs/lock.ts rename to apps/x/packages/core/src/runtime/legacy/lock.ts diff --git a/apps/x/packages/core/src/runs/repo.ts b/apps/x/packages/core/src/runtime/legacy/repo.ts similarity index 98% rename from apps/x/packages/core/src/runs/repo.ts rename to apps/x/packages/core/src/runtime/legacy/repo.ts index c312b116..361e0ed5 100644 --- a/apps/x/packages/core/src/runs/repo.ts +++ b/apps/x/packages/core/src/runtime/legacy/repo.ts @@ -1,12 +1,12 @@ import z from "zod"; -import { IMonotonicallyIncreasingIdGenerator } from "../application/lib/id-gen.js"; -import { WorkDir } from "../config/config.js"; +import { IMonotonicallyIncreasingIdGenerator } from "../../application/lib/id-gen.js"; +import { WorkDir } from "../../config/config.js"; import path from "path"; import fsp from "fs/promises"; import fs from "fs"; import readline from "readline"; import { Run, RunEvent, StartEvent, ListRunsResponse, MessageEvent, UseCase } from "@x/shared/dist/runs.js"; -import { getDefaultModelAndProvider } from "../models/defaults.js"; +import { getDefaultModelAndProvider } from "../../models/defaults.js"; /** * Reading-only schemas: extend the canonical `StartEvent` / `RunEvent` to diff --git a/apps/x/packages/core/src/runs/runs.ts b/apps/x/packages/core/src/runtime/legacy/runs.ts similarity index 91% rename from apps/x/packages/core/src/runs/runs.ts rename to apps/x/packages/core/src/runtime/legacy/runs.ts index 261122d7..40f33ed3 100644 --- a/apps/x/packages/core/src/runs/runs.ts +++ b/apps/x/packages/core/src/runtime/legacy/runs.ts @@ -1,18 +1,18 @@ import z from "zod"; -import container from "../di/container.js"; -import { IMessageQueue, UserMessageContentType, VoiceOutputMode, MiddlePaneContext } from "../application/lib/message-queue.js"; +import container from "../../di/container.js"; +import { IMessageQueue, UserMessageContentType, VoiceOutputMode, MiddlePaneContext } from "../../application/lib/message-queue.js"; import { AskHumanResponseEvent, ToolPermissionRequestEvent, ToolPermissionResponseEvent, CreateRunOptions, Run, ListRunsResponse, ToolPermissionAuthorizePayload, AskHumanResponsePayload } from "@x/shared/dist/runs.js"; import { IRunsRepo } from "./repo.js"; -import { ICodeSessionsRepo } from "../code-mode/sessions/repo.js"; -import { IAgentRuntime } from "../agents/runtime.js"; -import { IBus } from "../application/lib/bus.js"; +import { ICodeSessionsRepo } from "../../code-mode/sessions/repo.js"; +import { IAgentRuntime } from "./engine.js"; +import { IBus } from "../../application/lib/bus.js"; import { IAbortRegistry } from "../turns/abort-registry.js"; import { IRunsLock } from "./lock.js"; -import { forceCloseAllMcpClients } from "../mcp/mcp.js"; -import { extractCommandNames } from "../application/lib/command-executor.js"; -import { addFileAccessGrant, addToSecurityConfig } from "../config/security.js"; -import { loadAgent } from "../agents/registry.js"; -import { getDefaultModelAndProvider } from "../models/defaults.js"; +import { forceCloseAllMcpClients } from "../../mcp/mcp.js"; +import { extractCommandNames } from "../../application/lib/command-executor.js"; +import { addFileAccessGrant, addToSecurityConfig } from "../../config/security.js"; +import { loadAgent } from "../assembly/registry.js"; +import { getDefaultModelAndProvider } from "../../models/defaults.js"; export async function createRun(opts: z.infer): Promise> { const repo = container.resolve('runsRepo'); diff --git a/apps/x/packages/core/src/agents/utils.ts b/apps/x/packages/core/src/runtime/legacy/utils.ts similarity index 97% rename from apps/x/packages/core/src/agents/utils.ts rename to apps/x/packages/core/src/runtime/legacy/utils.ts index cfc899d6..8d526de1 100644 --- a/apps/x/packages/core/src/agents/utils.ts +++ b/apps/x/packages/core/src/runtime/legacy/utils.ts @@ -1,5 +1,5 @@ -import { bus } from "../runs/bus.js"; -import { fetchRun } from "../runs/runs.js"; +import { bus } from "./bus.js"; +import { fetchRun } from "./runs.js"; type RunRecord = Awaited>; diff --git a/apps/x/packages/core/src/sessions/api.ts b/apps/x/packages/core/src/runtime/sessions/api.ts similarity index 100% rename from apps/x/packages/core/src/sessions/api.ts rename to apps/x/packages/core/src/runtime/sessions/api.ts diff --git a/apps/x/packages/core/src/sessions/bus.ts b/apps/x/packages/core/src/runtime/sessions/bus.ts similarity index 100% rename from apps/x/packages/core/src/sessions/bus.ts rename to apps/x/packages/core/src/runtime/sessions/bus.ts diff --git a/apps/x/packages/core/src/sessions/fs-repo.test.ts b/apps/x/packages/core/src/runtime/sessions/fs-repo.test.ts similarity index 100% rename from apps/x/packages/core/src/sessions/fs-repo.test.ts rename to apps/x/packages/core/src/runtime/sessions/fs-repo.test.ts diff --git a/apps/x/packages/core/src/sessions/fs-repo.ts b/apps/x/packages/core/src/runtime/sessions/fs-repo.ts similarity index 100% rename from apps/x/packages/core/src/sessions/fs-repo.ts rename to apps/x/packages/core/src/runtime/sessions/fs-repo.ts diff --git a/apps/x/packages/core/src/sessions/in-memory-session-repo.ts b/apps/x/packages/core/src/runtime/sessions/in-memory-session-repo.ts similarity index 100% rename from apps/x/packages/core/src/sessions/in-memory-session-repo.ts rename to apps/x/packages/core/src/runtime/sessions/in-memory-session-repo.ts diff --git a/apps/x/packages/core/src/sessions/index.ts b/apps/x/packages/core/src/runtime/sessions/index.ts similarity index 100% rename from apps/x/packages/core/src/sessions/index.ts rename to apps/x/packages/core/src/runtime/sessions/index.ts diff --git a/apps/x/packages/core/src/sessions/repo.ts b/apps/x/packages/core/src/runtime/sessions/repo.ts similarity index 100% rename from apps/x/packages/core/src/sessions/repo.ts rename to apps/x/packages/core/src/runtime/sessions/repo.ts diff --git a/apps/x/packages/core/src/sessions/session-index.ts b/apps/x/packages/core/src/runtime/sessions/session-index.ts similarity index 100% rename from apps/x/packages/core/src/sessions/session-index.ts rename to apps/x/packages/core/src/runtime/sessions/session-index.ts diff --git a/apps/x/packages/core/src/sessions/sessions.test.ts b/apps/x/packages/core/src/runtime/sessions/sessions.test.ts similarity index 100% rename from apps/x/packages/core/src/sessions/sessions.test.ts rename to apps/x/packages/core/src/runtime/sessions/sessions.test.ts diff --git a/apps/x/packages/core/src/sessions/sessions.ts b/apps/x/packages/core/src/runtime/sessions/sessions.ts similarity index 99% rename from apps/x/packages/core/src/sessions/sessions.ts rename to apps/x/packages/core/src/runtime/sessions/sessions.ts index 1bf63df0..97162ee1 100644 --- a/apps/x/packages/core/src/sessions/sessions.ts +++ b/apps/x/packages/core/src/runtime/sessions/sessions.ts @@ -19,8 +19,8 @@ import { isInlineAgentRequest, reduceTurn, } from "@x/shared/dist/turns.js"; -import type { IMonotonicallyIncreasingIdGenerator } from "../application/lib/id-gen.js"; -import { chatActivity } from "../application/lib/chat-activity.js"; +import type { IMonotonicallyIncreasingIdGenerator } from "../../application/lib/id-gen.js"; +import { chatActivity } from "../../application/lib/chat-activity.js"; import type { ITurnRuntime, Turn, diff --git a/apps/x/packages/core/src/application/lib/builtin-tools.test.ts b/apps/x/packages/core/src/runtime/tools/catalog.test.ts similarity index 98% rename from apps/x/packages/core/src/application/lib/builtin-tools.test.ts rename to apps/x/packages/core/src/runtime/tools/catalog.test.ts index 9195aaac..54981d0b 100644 --- a/apps/x/packages/core/src/application/lib/builtin-tools.test.ts +++ b/apps/x/packages/core/src/runtime/tools/catalog.test.ts @@ -2,8 +2,8 @@ import * as os from "os"; import { afterEach, describe, expect, it, vi } from "vitest"; import type { CodeRunEvent } from "@x/shared/dist/code-mode.js"; import container from "../../di/container.js"; -import { InMemoryAbortRegistry } from "../../turns/abort-registry.js"; -import { BuiltinTools, coalesceCodeRunEvents } from "./builtin-tools.js"; +import { InMemoryAbortRegistry } from "../turns/abort-registry.js"; +import { BuiltinTools, coalesceCodeRunEvents } from "./catalog.js"; import type { ToolContext } from "./exec-tool.js"; // A real directory: code_agent_run validates the cwd exists before spawning. diff --git a/apps/x/packages/core/src/application/lib/builtin-tools.ts b/apps/x/packages/core/src/runtime/tools/catalog.ts similarity index 78% rename from apps/x/packages/core/src/application/lib/builtin-tools.ts rename to apps/x/packages/core/src/runtime/tools/catalog.ts index 01d587f4..df7682b8 100644 --- a/apps/x/packages/core/src/application/lib/builtin-tools.ts +++ b/apps/x/packages/core/src/runtime/tools/catalog.ts @@ -1,29 +1,29 @@ import { z } from "zod"; -import { resolveSkill, availableSkills, skillToolNames, setBuiltinToolsSkillTools } from "../assistant/skills/index.js"; -import { COPILOT_BASE_TOOLS } from "../assistant/base-tools.js"; -import { builtinToolDescriptor } from "../../turns/bridges/builtin-descriptors.js"; +import { resolveSkill, availableSkills, skillToolNames, setBuiltinToolsSkillTools } from "../assembly/skills/index.js"; +import { COPILOT_BASE_TOOLS } from "../assembly/copilot/base-tools.js"; +import { builtinToolDescriptor } from "./descriptors.js"; import { TOOL_ADDITIONS_KEY } from "./tool-additions.js"; import type { ToolDescriptor } from "@x/shared/dist/turns.js"; import { SPAWN_AGENT_TOOL_NAME } from "@x/shared/dist/turns.js"; -import { SPAWN_AGENT_DESCRIPTION, SpawnAgentInput } from "../../agents/spawn-agent.js"; +import { SPAWN_AGENT_DESCRIPTION, SpawnAgentInput } from "../assembly/spawn-agent.js"; import type { ToolContext } from "./exec-tool.js"; -import { fileTools } from "./builtin-tools/files.js"; -import { parsingTools } from "./builtin-tools/parsing.js"; -import { agentAnalysisTools } from "./builtin-tools/agent-analysis.js"; -import { mcpTools } from "./builtin-tools/mcp.js"; -import { shellTools } from "./builtin-tools/shell.js"; -import { codeAgentRunTools, codeTaskTools } from "./builtin-tools/code.js"; -import { browserTools } from "./builtin-tools/browser.js"; -import { appNavigationTools, appDataTools } from "./builtin-tools/app.js"; -import { webSearchTools, fetchUrlTools } from "./builtin-tools/web.js"; -import { memoryTools } from "./builtin-tools/memory.js"; -import { composioTools } from "./builtin-tools/composio.js"; -import { modelTools } from "./builtin-tools/models.js"; -import { liveNoteTools } from "./builtin-tools/live-note.js"; -import { backgroundTaskTools } from "./builtin-tools/background-tasks.js"; -import { notificationTools } from "./builtin-tools/notifications.js"; -import { BuiltinToolsSchema } from "./builtin-tools/support.js"; -export { coalesceCodeRunEvents } from "./builtin-tools/support.js"; +import { fileTools } from "./domains/files.js"; +import { parsingTools } from "./domains/parsing.js"; +import { agentAnalysisTools } from "./domains/agent-analysis.js"; +import { mcpTools } from "./domains/mcp.js"; +import { shellTools } from "./domains/shell.js"; +import { codeAgentRunTools, codeTaskTools } from "./domains/code.js"; +import { browserTools } from "./domains/browser.js"; +import { appNavigationTools, appDataTools } from "./domains/app.js"; +import { webSearchTools, fetchUrlTools } from "./domains/web.js"; +import { memoryTools } from "./domains/memory.js"; +import { composioTools } from "./domains/composio.js"; +import { modelTools } from "./domains/models.js"; +import { liveNoteTools } from "./domains/live-note.js"; +import { backgroundTaskTools } from "./domains/background-tasks.js"; +import { notificationTools } from "./domains/notifications.js"; +import { BuiltinToolsSchema } from "./domains/support.js"; +export { coalesceCodeRunEvents } from "./domains/support.js"; // The builtin-tool catalog, assembled from domain modules // (./builtin-tools/*). SPREAD ORDER IS LOAD-BEARING: catalog key order is @@ -101,7 +101,7 @@ export const BuiltinTools: z.infer = { // builtin:spawn-agent in RealToolRegistry with a dedicated handler // that also records the parent→child link as durable tool progress. execute: async (input: unknown, ctx?: ToolContext) => { - const { runSpawnedAgent } = await import("../../agents/spawn-agent.js"); + const { runSpawnedAgent } = await import("../assembly/spawn-agent.js"); const result = await runSpawnedAgent(input, { parentTurnId: ctx?.runId ?? "", signal: ctx?.signal ?? new AbortController().signal, diff --git a/apps/x/packages/core/src/turns/bridges/builtin-descriptors.ts b/apps/x/packages/core/src/runtime/tools/descriptors.ts similarity index 94% rename from apps/x/packages/core/src/turns/bridges/builtin-descriptors.ts rename to apps/x/packages/core/src/runtime/tools/descriptors.ts index 1c6cc153..6b2e8e95 100644 --- a/apps/x/packages/core/src/turns/bridges/builtin-descriptors.ts +++ b/apps/x/packages/core/src/runtime/tools/descriptors.ts @@ -1,6 +1,6 @@ import { z } from "zod"; import type { JsonValue, ToolDescriptor } from "@x/shared/dist/turns.js"; -import type { BuiltinTools } from "../../application/lib/builtin-tools.js"; +import type { BuiltinTools } from "./catalog.js"; type BuiltinToolDef = (typeof BuiltinTools)[string]; diff --git a/apps/x/packages/core/src/application/lib/builtin-tools/agent-analysis.ts b/apps/x/packages/core/src/runtime/tools/domains/agent-analysis.ts similarity index 97% rename from apps/x/packages/core/src/application/lib/builtin-tools/agent-analysis.ts rename to apps/x/packages/core/src/runtime/tools/domains/agent-analysis.ts index 48f038c1..e6e6fcfb 100644 --- a/apps/x/packages/core/src/application/lib/builtin-tools/agent-analysis.ts +++ b/apps/x/packages/core/src/runtime/tools/domains/agent-analysis.ts @@ -4,7 +4,7 @@ import { z } from "zod"; import container from "../../../di/container.js"; -import { IAgentsRepo } from "../../../agents/repo.js"; +import { IAgentsRepo } from "../../assembly/repo.js"; import { BuiltinToolsSchema, } from "./support.js"; diff --git a/apps/x/packages/core/src/application/lib/builtin-tools/app.ts b/apps/x/packages/core/src/runtime/tools/domains/app.ts similarity index 99% rename from apps/x/packages/core/src/application/lib/builtin-tools/app.ts rename to apps/x/packages/core/src/runtime/tools/domains/app.ts index 66992c48..a81ced8d 100644 --- a/apps/x/packages/core/src/application/lib/builtin-tools/app.ts +++ b/apps/x/packages/core/src/runtime/tools/domains/app.ts @@ -12,7 +12,7 @@ import { RowboatAppManifestSchema } from "@x/shared/dist/rowboat-app.js"; import { listApps } from "../../../apps/indexer.js"; import { listImportantThreads, searchThreads } from "../../../knowledge/sync_gmail.js"; import { listTasks as listBackgroundTasks } from "../../../background-tasks/fileops.js"; -import type { ISessions } from "../../../sessions/api.js"; +import type { ISessions } from "../../sessions/api.js"; import { BuiltinToolsSchema, } from "./support.js"; diff --git a/apps/x/packages/core/src/application/lib/builtin-tools/background-tasks.ts b/apps/x/packages/core/src/runtime/tools/domains/background-tasks.ts similarity index 100% rename from apps/x/packages/core/src/application/lib/builtin-tools/background-tasks.ts rename to apps/x/packages/core/src/runtime/tools/domains/background-tasks.ts diff --git a/apps/x/packages/core/src/application/lib/builtin-tools/browser.ts b/apps/x/packages/core/src/runtime/tools/domains/browser.ts similarity index 97% rename from apps/x/packages/core/src/application/lib/builtin-tools/browser.ts rename to apps/x/packages/core/src/runtime/tools/domains/browser.ts index 9c6b0ae4..ea5e0614 100644 --- a/apps/x/packages/core/src/application/lib/builtin-tools/browser.ts +++ b/apps/x/packages/core/src/runtime/tools/domains/browser.ts @@ -5,9 +5,9 @@ import { z } from "zod"; import container from "../../../di/container.js"; import { BrowserControlInputSchema, type BrowserControlInput } from "@x/shared/dist/browser-control.js"; -import { ensureLoaded as ensureBrowserSkillsLoaded, readSkillContent as readBrowserSkillContent, refreshFromRemote as refreshBrowserSkills } from "../../browser-skills/index.js"; +import { ensureLoaded as ensureBrowserSkillsLoaded, readSkillContent as readBrowserSkillContent, refreshFromRemote as refreshBrowserSkills } from "../../../application/browser-skills/index.js"; import type { ToolContext } from "../exec-tool.js"; -import type { IBrowserControlService } from "../../browser-control/service.js"; +import type { IBrowserControlService } from "../../../application/browser-control/service.js"; import { BuiltinToolsSchema, } from "./support.js"; diff --git a/apps/x/packages/core/src/application/lib/builtin-tools/code.ts b/apps/x/packages/core/src/runtime/tools/domains/code.ts similarity index 100% rename from apps/x/packages/core/src/application/lib/builtin-tools/code.ts rename to apps/x/packages/core/src/runtime/tools/domains/code.ts diff --git a/apps/x/packages/core/src/application/lib/builtin-tools/composio.ts b/apps/x/packages/core/src/runtime/tools/domains/composio.ts similarity index 100% rename from apps/x/packages/core/src/application/lib/builtin-tools/composio.ts rename to apps/x/packages/core/src/runtime/tools/domains/composio.ts diff --git a/apps/x/packages/core/src/application/lib/builtin-tools/files.ts b/apps/x/packages/core/src/runtime/tools/domains/files.ts similarity index 100% rename from apps/x/packages/core/src/application/lib/builtin-tools/files.ts rename to apps/x/packages/core/src/runtime/tools/domains/files.ts diff --git a/apps/x/packages/core/src/application/lib/builtin-tools/live-note.ts b/apps/x/packages/core/src/runtime/tools/domains/live-note.ts similarity index 100% rename from apps/x/packages/core/src/application/lib/builtin-tools/live-note.ts rename to apps/x/packages/core/src/runtime/tools/domains/live-note.ts diff --git a/apps/x/packages/core/src/application/lib/builtin-tools/mcp.ts b/apps/x/packages/core/src/runtime/tools/domains/mcp.ts similarity index 98% rename from apps/x/packages/core/src/application/lib/builtin-tools/mcp.ts rename to apps/x/packages/core/src/runtime/tools/domains/mcp.ts index bab254a7..a1f5c5ae 100644 --- a/apps/x/packages/core/src/application/lib/builtin-tools/mcp.ts +++ b/apps/x/packages/core/src/runtime/tools/domains/mcp.ts @@ -5,7 +5,7 @@ import { z } from "zod"; import { executeTool, listServers, listTools } from "../../../mcp/mcp.js"; import container from "../../../di/container.js"; -import { IMcpConfigRepo } from "../../..//mcp/repo.js"; +import { IMcpConfigRepo } from "../../../mcp/repo.js"; import { McpServerDefinition } from "@x/shared/dist/mcp.js"; import { BuiltinToolsSchema, diff --git a/apps/x/packages/core/src/application/lib/builtin-tools/memory.ts b/apps/x/packages/core/src/runtime/tools/domains/memory.ts similarity index 100% rename from apps/x/packages/core/src/application/lib/builtin-tools/memory.ts rename to apps/x/packages/core/src/runtime/tools/domains/memory.ts diff --git a/apps/x/packages/core/src/application/lib/builtin-tools/models.ts b/apps/x/packages/core/src/runtime/tools/domains/models.ts similarity index 100% rename from apps/x/packages/core/src/application/lib/builtin-tools/models.ts rename to apps/x/packages/core/src/runtime/tools/domains/models.ts diff --git a/apps/x/packages/core/src/application/lib/builtin-tools/notifications.ts b/apps/x/packages/core/src/runtime/tools/domains/notifications.ts similarity index 96% rename from apps/x/packages/core/src/application/lib/builtin-tools/notifications.ts rename to apps/x/packages/core/src/runtime/tools/domains/notifications.ts index d9a2d3e9..5d364ffc 100644 --- a/apps/x/packages/core/src/application/lib/builtin-tools/notifications.ts +++ b/apps/x/packages/core/src/runtime/tools/domains/notifications.ts @@ -6,8 +6,8 @@ import { z } from "zod"; import container from "../../../di/container.js"; import type { ToolContext } from "../exec-tool.js"; import { getCurrentUseCase } from "../../../analytics/use_case.js"; -import type { INotificationService } from "../../notification/service.js"; -import { notifyIfEnabled } from "../../notification/notifier.js"; +import type { INotificationService } from "../../../application/notification/service.js"; +import { notifyIfEnabled } from "../../../application/notification/notifier.js"; import { BuiltinToolsSchema, } from "./support.js"; @@ -49,7 +49,7 @@ export const notificationTools: z.infer = { // persisted use case on the run record via ctx.runId. if (!uc && ctx?.runId) { try { - const { fetchRun } = await import("../../../runs/runs.js"); + const { fetchRun } = await import("../../legacy/runs.js"); const run = await fetchRun(ctx.runId); uc = run.useCase; } catch { diff --git a/apps/x/packages/core/src/application/lib/builtin-tools/parsing.ts b/apps/x/packages/core/src/runtime/tools/domains/parsing.ts similarity index 100% rename from apps/x/packages/core/src/application/lib/builtin-tools/parsing.ts rename to apps/x/packages/core/src/runtime/tools/domains/parsing.ts diff --git a/apps/x/packages/core/src/application/lib/builtin-tools/shell.ts b/apps/x/packages/core/src/runtime/tools/domains/shell.ts similarity index 97% rename from apps/x/packages/core/src/application/lib/builtin-tools/shell.ts rename to apps/x/packages/core/src/runtime/tools/domains/shell.ts index 964ec3ae..36371c13 100644 --- a/apps/x/packages/core/src/application/lib/builtin-tools/shell.ts +++ b/apps/x/packages/core/src/runtime/tools/domains/shell.ts @@ -4,7 +4,7 @@ import { z } from "zod"; import * as path from "path"; -import { executeCommand, executeCommandAbortable } from "../command-executor.js"; +import { executeCommand, executeCommandAbortable } from "../../../application/lib/command-executor.js"; import { agentSlackShimEnv } from "../../../slack/agent-slack-exec.js"; import { WorkDir } from "../../../config/config.js"; import type { ToolContext } from "../exec-tool.js"; diff --git a/apps/x/packages/core/src/application/lib/builtin-tools/support.ts b/apps/x/packages/core/src/runtime/tools/domains/support.ts similarity index 100% rename from apps/x/packages/core/src/application/lib/builtin-tools/support.ts rename to apps/x/packages/core/src/runtime/tools/domains/support.ts diff --git a/apps/x/packages/core/src/application/lib/builtin-tools/web.ts b/apps/x/packages/core/src/runtime/tools/domains/web.ts similarity index 100% rename from apps/x/packages/core/src/application/lib/builtin-tools/web.ts rename to apps/x/packages/core/src/runtime/tools/domains/web.ts diff --git a/apps/x/packages/core/src/application/lib/exec-tool.ts b/apps/x/packages/core/src/runtime/tools/exec-tool.ts similarity index 94% rename from apps/x/packages/core/src/application/lib/exec-tool.ts rename to apps/x/packages/core/src/runtime/tools/exec-tool.ts index 49f2404a..9f1722c9 100644 --- a/apps/x/packages/core/src/application/lib/exec-tool.ts +++ b/apps/x/packages/core/src/runtime/tools/exec-tool.ts @@ -1,9 +1,9 @@ import { ToolAttachment } from "@x/shared/dist/agent.js"; import { RunEvent } from "@x/shared/dist/runs.js"; import { z } from "zod"; -import { BuiltinTools } from "./builtin-tools.js"; +import { BuiltinTools } from "./catalog.js"; import { executeTool } from "../../mcp/mcp.js"; -import { IAbortRegistry } from "../../turns/abort-registry.js"; +import { IAbortRegistry } from "../turns/abort-registry.js"; /** * Context passed to every tool execution, providing abort signal and run metadata. diff --git a/apps/x/packages/core/src/application/lib/tool-additions.ts b/apps/x/packages/core/src/runtime/tools/tool-additions.ts similarity index 100% rename from apps/x/packages/core/src/application/lib/tool-additions.ts rename to apps/x/packages/core/src/runtime/tools/tool-additions.ts diff --git a/apps/x/packages/core/src/turns/abort-registry.ts b/apps/x/packages/core/src/runtime/turns/abort-registry.ts similarity index 100% rename from apps/x/packages/core/src/turns/abort-registry.ts rename to apps/x/packages/core/src/runtime/turns/abort-registry.ts diff --git a/apps/x/packages/core/src/turns/agent-resolver.ts b/apps/x/packages/core/src/runtime/turns/agent-resolver.ts similarity index 100% rename from apps/x/packages/core/src/turns/agent-resolver.ts rename to apps/x/packages/core/src/runtime/turns/agent-resolver.ts diff --git a/apps/x/packages/core/src/turns/api.ts b/apps/x/packages/core/src/runtime/turns/api.ts similarity index 100% rename from apps/x/packages/core/src/turns/api.ts rename to apps/x/packages/core/src/runtime/turns/api.ts diff --git a/apps/x/packages/core/src/turns/bridges/agent-resolver-dispatch.test.ts b/apps/x/packages/core/src/runtime/turns/bridges/agent-resolver-dispatch.test.ts similarity index 100% rename from apps/x/packages/core/src/turns/bridges/agent-resolver-dispatch.test.ts rename to apps/x/packages/core/src/runtime/turns/bridges/agent-resolver-dispatch.test.ts diff --git a/apps/x/packages/core/src/turns/bridges/agent-resolver-dispatch.ts b/apps/x/packages/core/src/runtime/turns/bridges/agent-resolver-dispatch.ts similarity index 100% rename from apps/x/packages/core/src/turns/bridges/agent-resolver-dispatch.ts rename to apps/x/packages/core/src/runtime/turns/bridges/agent-resolver-dispatch.ts diff --git a/apps/x/packages/core/src/turns/bridges/index.ts b/apps/x/packages/core/src/runtime/turns/bridges/index.ts similarity index 100% rename from apps/x/packages/core/src/turns/bridges/index.ts rename to apps/x/packages/core/src/runtime/turns/bridges/index.ts diff --git a/apps/x/packages/core/src/turns/bridges/inline-agent-resolver.test.ts b/apps/x/packages/core/src/runtime/turns/bridges/inline-agent-resolver.test.ts similarity index 98% rename from apps/x/packages/core/src/turns/bridges/inline-agent-resolver.test.ts rename to apps/x/packages/core/src/runtime/turns/bridges/inline-agent-resolver.test.ts index 0ec7b586..baaef8d7 100644 --- a/apps/x/packages/core/src/turns/bridges/inline-agent-resolver.test.ts +++ b/apps/x/packages/core/src/runtime/turns/bridges/inline-agent-resolver.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from "vitest"; import { z } from "zod"; -import type { BuiltinTools } from "../../application/lib/builtin-tools.js"; +import type { BuiltinTools } from "../../tools/catalog.js"; import { InlineAgentResolver } from "./inline-agent-resolver.js"; const fakeBuiltins = { diff --git a/apps/x/packages/core/src/turns/bridges/inline-agent-resolver.ts b/apps/x/packages/core/src/runtime/turns/bridges/inline-agent-resolver.ts similarity index 94% rename from apps/x/packages/core/src/turns/bridges/inline-agent-resolver.ts rename to apps/x/packages/core/src/runtime/turns/bridges/inline-agent-resolver.ts index 22ba14f0..58968423 100644 --- a/apps/x/packages/core/src/turns/bridges/inline-agent-resolver.ts +++ b/apps/x/packages/core/src/runtime/turns/bridges/inline-agent-resolver.ts @@ -7,9 +7,9 @@ import { inlineAgentId, } from "@x/shared/dist/turns.js"; import { ResolvedAgent as ResolvedAgentSchema } from "@x/shared/dist/turns.js"; -import { BuiltinTools } from "../../application/lib/builtin-tools.js"; -import { getDefaultModelAndProvider } from "../../models/defaults.js"; -import { builtinToolDescriptor } from "./builtin-descriptors.js"; +import { BuiltinTools } from "../../tools/catalog.js"; +import { getDefaultModelAndProvider } from "../../../models/defaults.js"; +import { builtinToolDescriptor } from "../../tools/descriptors.js"; // Default tool profile for inline agents that omit `tools`: every builtin // except the ones that make no sense headlessly or in a child. Mirrors the diff --git a/apps/x/packages/core/src/turns/bridges/real-agent-resolver.test.ts b/apps/x/packages/core/src/runtime/turns/bridges/real-agent-resolver.test.ts similarity index 98% rename from apps/x/packages/core/src/turns/bridges/real-agent-resolver.test.ts rename to apps/x/packages/core/src/runtime/turns/bridges/real-agent-resolver.test.ts index 0f0e090f..ac6c0c74 100644 --- a/apps/x/packages/core/src/turns/bridges/real-agent-resolver.test.ts +++ b/apps/x/packages/core/src/runtime/turns/bridges/real-agent-resolver.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from "vitest"; import { z } from "zod"; import type { Agent } from "@x/shared/dist/agent.js"; -import { composeSystemInstructions } from "../../agents/compose-instructions.js"; -import type { BuiltinTools } from "../../application/lib/builtin-tools.js"; +import { composeSystemInstructions } from "../../assembly/compose-instructions.js"; +import type { BuiltinTools } from "../../tools/catalog.js"; import { RealAgentResolver } from "./real-agent-resolver.js"; const DEFAULTS = async () => ({ model: "gpt-default", provider: "openai" }); diff --git a/apps/x/packages/core/src/turns/bridges/real-agent-resolver.ts b/apps/x/packages/core/src/runtime/turns/bridges/real-agent-resolver.ts similarity index 94% rename from apps/x/packages/core/src/turns/bridges/real-agent-resolver.ts rename to apps/x/packages/core/src/runtime/turns/bridges/real-agent-resolver.ts index 6b1c6d62..bd162956 100644 --- a/apps/x/packages/core/src/turns/bridges/real-agent-resolver.ts +++ b/apps/x/packages/core/src/runtime/turns/bridges/real-agent-resolver.ts @@ -6,21 +6,21 @@ import { SPAWN_AGENT_TOOL_NAME, type ToolDescriptor, } from "@x/shared/dist/turns.js"; -import { composeSystemInstructions } from "../../agents/compose-instructions.js"; +import { composeSystemInstructions } from "../../assembly/compose-instructions.js"; import { loadAgentNotesContext, loadUserWorkDir, loadWorkspaceContext, -} from "../../agents/workspace-context.js"; -import { carriesSkillsForward, loadAgent } from "../../agents/registry.js"; -import { BuiltinTools } from "../../application/lib/builtin-tools.js"; -import { skillToolNames } from "../../application/assistant/skills/index.js"; -import { ModeFlags } from "../../application/assistant/capabilities/types.js"; -import { getDefaultModelAndProvider } from "../../models/defaults.js"; +} from "../../assembly/workspace-context.js"; +import { carriesSkillsForward, loadAgent } from "../../assembly/registry.js"; +import { BuiltinTools } from "../../tools/catalog.js"; +import { skillToolNames } from "../../assembly/skills/index.js"; +import { ModeFlags } from "../../assembly/capabilities/types.js"; +import { getDefaultModelAndProvider } from "../../../models/defaults.js"; import { builtinToolDescriptor, toJsonValue, -} from "./builtin-descriptors.js"; +} from "../../tools/descriptors.js"; export const ASK_HUMAN_TOOL = "ask-human"; diff --git a/apps/x/packages/core/src/turns/bridges/real-model-registry.test.ts b/apps/x/packages/core/src/runtime/turns/bridges/real-model-registry.test.ts similarity index 100% rename from apps/x/packages/core/src/turns/bridges/real-model-registry.test.ts rename to apps/x/packages/core/src/runtime/turns/bridges/real-model-registry.test.ts diff --git a/apps/x/packages/core/src/turns/bridges/real-model-registry.ts b/apps/x/packages/core/src/runtime/turns/bridges/real-model-registry.ts similarity index 97% rename from apps/x/packages/core/src/turns/bridges/real-model-registry.ts rename to apps/x/packages/core/src/runtime/turns/bridges/real-model-registry.ts index eb311d18..1d62e1fe 100644 --- a/apps/x/packages/core/src/turns/bridges/real-model-registry.ts +++ b/apps/x/packages/core/src/runtime/turns/bridges/real-model-registry.ts @@ -11,13 +11,13 @@ import type { z } from "zod"; import type { LlmProvider } from "@x/shared/dist/models.js"; import type { AssistantContentPart } from "@x/shared/dist/message.js"; import type { JsonValue, ModelDescriptor, TurnUsage } from "@x/shared/dist/turns.js"; -import { convertFromMessages } from "../../agents/message-encoding.js"; -import { resolveProviderConfig } from "../../models/defaults.js"; -import { createProvider } from "../../models/models.js"; -import { isReasoningModel } from "../../models/models-dev.js"; -import { applyPromptCaching } from "../../models/prompt-caching.js"; -import { applyLocalModelSettings } from "../../models/local.js"; -import { mapReasoningEffort, parseReasoningEffort } from "../../models/reasoning.js"; +import { convertFromMessages } from "../../assembly/message-encoding.js"; +import { resolveProviderConfig } from "../../../models/defaults.js"; +import { createProvider } from "../../../models/models.js"; +import { isReasoningModel } from "../../../models/models-dev.js"; +import { applyPromptCaching } from "../../../models/prompt-caching.js"; +import { applyLocalModelSettings } from "../../../models/local.js"; +import { mapReasoningEffort, parseReasoningEffort } from "../../../models/reasoning.js"; import type { IModelRegistry, LlmStreamEvent, diff --git a/apps/x/packages/core/src/turns/bridges/real-permission-checker.test.ts b/apps/x/packages/core/src/runtime/turns/bridges/real-permission-checker.test.ts similarity index 97% rename from apps/x/packages/core/src/turns/bridges/real-permission-checker.test.ts rename to apps/x/packages/core/src/runtime/turns/bridges/real-permission-checker.test.ts index 2967b6ae..64d65ca8 100644 --- a/apps/x/packages/core/src/turns/bridges/real-permission-checker.test.ts +++ b/apps/x/packages/core/src/runtime/turns/bridges/real-permission-checker.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import type { getToolPermissionMetadata } from "../../agents/runtime.js"; +import type { getToolPermissionMetadata } from "../../legacy/engine.js"; import { RealPermissionChecker } from "./real-permission-checker.js"; type MetadataFn = typeof getToolPermissionMetadata; diff --git a/apps/x/packages/core/src/turns/bridges/real-permission-checker.ts b/apps/x/packages/core/src/runtime/turns/bridges/real-permission-checker.ts similarity index 95% rename from apps/x/packages/core/src/turns/bridges/real-permission-checker.ts rename to apps/x/packages/core/src/runtime/turns/bridges/real-permission-checker.ts index ef325909..0383cf51 100644 --- a/apps/x/packages/core/src/turns/bridges/real-permission-checker.ts +++ b/apps/x/packages/core/src/runtime/turns/bridges/real-permission-checker.ts @@ -1,5 +1,5 @@ import type { JsonValue } from "@x/shared/dist/turns.js"; -import { getToolPermissionMetadata } from "../../agents/permission-metadata.js"; +import { getToolPermissionMetadata } from "../../assembly/permission-metadata.js"; import type { IPermissionChecker, PermissionCheckAllowed, diff --git a/apps/x/packages/core/src/turns/bridges/real-permission-classifier.test.ts b/apps/x/packages/core/src/runtime/turns/bridges/real-permission-classifier.test.ts similarity index 97% rename from apps/x/packages/core/src/turns/bridges/real-permission-classifier.test.ts rename to apps/x/packages/core/src/runtime/turns/bridges/real-permission-classifier.test.ts index 23312fca..c8f7d9e6 100644 --- a/apps/x/packages/core/src/turns/bridges/real-permission-classifier.test.ts +++ b/apps/x/packages/core/src/runtime/turns/bridges/real-permission-classifier.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from "vitest"; -import type { classifyToolPermissions } from "../../security/auto-permission-classifier.js"; +import type { classifyToolPermissions } from "../../../security/auto-permission-classifier.js"; import { RealPermissionClassifier } from "./real-permission-classifier.js"; type ClassifierFn = typeof classifyToolPermissions; diff --git a/apps/x/packages/core/src/turns/bridges/real-permission-classifier.ts b/apps/x/packages/core/src/runtime/turns/bridges/real-permission-classifier.ts similarity index 89% rename from apps/x/packages/core/src/turns/bridges/real-permission-classifier.ts rename to apps/x/packages/core/src/runtime/turns/bridges/real-permission-classifier.ts index 8abc0c03..0165c4cf 100644 --- a/apps/x/packages/core/src/turns/bridges/real-permission-classifier.ts +++ b/apps/x/packages/core/src/runtime/turns/bridges/real-permission-classifier.ts @@ -1,7 +1,7 @@ import { ToolPermissionMetadata } from "@x/shared/dist/runs.js"; -import { convertFromMessages } from "../../agents/message-encoding.js"; -import type { UseCase } from "../../analytics/use_case.js"; -import { classifyToolPermissions } from "../../security/auto-permission-classifier.js"; +import { convertFromMessages } from "../../assembly/message-encoding.js"; +import type { UseCase } from "../../../analytics/use_case.js"; +import { classifyToolPermissions } from "../../../security/auto-permission-classifier.js"; import type { IPermissionClassifier, PermissionClassification, diff --git a/apps/x/packages/core/src/turns/bridges/real-tool-registry.test.ts b/apps/x/packages/core/src/runtime/turns/bridges/real-tool-registry.test.ts similarity index 98% rename from apps/x/packages/core/src/turns/bridges/real-tool-registry.test.ts rename to apps/x/packages/core/src/runtime/turns/bridges/real-tool-registry.test.ts index 5238541e..41e3f3a1 100644 --- a/apps/x/packages/core/src/turns/bridges/real-tool-registry.test.ts +++ b/apps/x/packages/core/src/runtime/turns/bridges/real-tool-registry.test.ts @@ -1,8 +1,8 @@ import { describe, expect, it } from "vitest"; import type { z } from "zod"; import type { ToolDescriptor } from "@x/shared/dist/turns.js"; -import type { execTool } from "../../application/lib/exec-tool.js"; -import type { BuiltinTools } from "../../application/lib/builtin-tools.js"; +import type { execTool } from "../../tools/exec-tool.js"; +import type { BuiltinTools } from "../../tools/catalog.js"; import type { IAbortRegistry } from "../abort-registry.js"; import { TurnDependencyError } from "../api.js"; import type { SyncRuntimeTool, ToolExecutionContext } from "../tool-registry.js"; diff --git a/apps/x/packages/core/src/turns/bridges/real-tool-registry.ts b/apps/x/packages/core/src/runtime/turns/bridges/real-tool-registry.ts similarity index 97% rename from apps/x/packages/core/src/turns/bridges/real-tool-registry.ts rename to apps/x/packages/core/src/runtime/turns/bridges/real-tool-registry.ts index 7688308a..679b4329 100644 --- a/apps/x/packages/core/src/turns/bridges/real-tool-registry.ts +++ b/apps/x/packages/core/src/runtime/turns/bridges/real-tool-registry.ts @@ -6,9 +6,9 @@ import { SPAWN_AGENT_TOOL_NAME, type ToolDescriptor, } from "@x/shared/dist/turns.js"; -import { execTool } from "../../application/lib/exec-tool.js"; -import { BuiltinTools } from "../../application/lib/builtin-tools.js"; -import { TOOL_ADDITIONS_KEY } from "../../application/lib/tool-additions.js"; +import { execTool } from "../../tools/exec-tool.js"; +import { BuiltinTools } from "../../tools/catalog.js"; +import { TOOL_ADDITIONS_KEY } from "../../tools/tool-additions.js"; import { type IAbortRegistry, InMemoryAbortRegistry, @@ -105,7 +105,7 @@ export class RealToolRegistry implements IToolRegistry { >, execute: async (input, ctx: ToolExecutionContext) => { const { runSpawnedAgent } = await import( - "../../agents/spawn-agent.js" + "../../assembly/spawn-agent.js" ); return runSpawnedAgent(input, { parentTurnId: ctx.turnId, diff --git a/apps/x/packages/core/src/turns/bridges/real-usage-reporter.ts b/apps/x/packages/core/src/runtime/turns/bridges/real-usage-reporter.ts similarity index 87% rename from apps/x/packages/core/src/turns/bridges/real-usage-reporter.ts rename to apps/x/packages/core/src/runtime/turns/bridges/real-usage-reporter.ts index 99d004e5..0c8ffba5 100644 --- a/apps/x/packages/core/src/turns/bridges/real-usage-reporter.ts +++ b/apps/x/packages/core/src/runtime/turns/bridges/real-usage-reporter.ts @@ -1,5 +1,5 @@ -import { captureLlmUsage } from "../../analytics/usage.js"; -import { getCurrentUseCase } from "../../analytics/use_case.js"; +import { captureLlmUsage } from "../../../analytics/usage.js"; +import { getCurrentUseCase } from "../../../analytics/use_case.js"; import type { IUsageReporter, ModelUsageReport } from "../usage-reporter.js"; // Reports each completed model call as the same `llm_usage` PostHog event diff --git a/apps/x/packages/core/src/turns/bus.ts b/apps/x/packages/core/src/runtime/turns/bus.ts similarity index 100% rename from apps/x/packages/core/src/turns/bus.ts rename to apps/x/packages/core/src/runtime/turns/bus.ts diff --git a/apps/x/packages/core/src/turns/clock.ts b/apps/x/packages/core/src/runtime/turns/clock.ts similarity index 100% rename from apps/x/packages/core/src/turns/clock.ts rename to apps/x/packages/core/src/runtime/turns/clock.ts diff --git a/apps/x/packages/core/src/turns/compose-model-request.ts b/apps/x/packages/core/src/runtime/turns/compose-model-request.ts similarity index 100% rename from apps/x/packages/core/src/turns/compose-model-request.ts rename to apps/x/packages/core/src/runtime/turns/compose-model-request.ts diff --git a/apps/x/packages/core/src/turns/context-elision.test.ts b/apps/x/packages/core/src/runtime/turns/context-elision.test.ts similarity index 100% rename from apps/x/packages/core/src/turns/context-elision.test.ts rename to apps/x/packages/core/src/runtime/turns/context-elision.test.ts diff --git a/apps/x/packages/core/src/turns/context-elision.ts b/apps/x/packages/core/src/runtime/turns/context-elision.ts similarity index 99% rename from apps/x/packages/core/src/turns/context-elision.ts rename to apps/x/packages/core/src/runtime/turns/context-elision.ts index 04796037..744d00d5 100644 --- a/apps/x/packages/core/src/turns/context-elision.ts +++ b/apps/x/packages/core/src/runtime/turns/context-elision.ts @@ -7,7 +7,7 @@ import type { ResolvedAgentSnapshot, TurnContext, } from "@x/shared/dist/turns.js"; -import { WorkDir } from "../config/config.js"; +import { WorkDir } from "../../config/config.js"; import type { IContextResolver } from "./context-resolver.js"; import { TurnRepoContextResolver } from "./context-resolver.js"; import type { ITurnRepo } from "./repo.js"; diff --git a/apps/x/packages/core/src/turns/context-resolver.test.ts b/apps/x/packages/core/src/runtime/turns/context-resolver.test.ts similarity index 100% rename from apps/x/packages/core/src/turns/context-resolver.test.ts rename to apps/x/packages/core/src/runtime/turns/context-resolver.test.ts diff --git a/apps/x/packages/core/src/turns/context-resolver.ts b/apps/x/packages/core/src/runtime/turns/context-resolver.ts similarity index 100% rename from apps/x/packages/core/src/turns/context-resolver.ts rename to apps/x/packages/core/src/runtime/turns/context-resolver.ts diff --git a/apps/x/packages/core/src/turns/event-hub.test.ts b/apps/x/packages/core/src/runtime/turns/event-hub.test.ts similarity index 100% rename from apps/x/packages/core/src/turns/event-hub.test.ts rename to apps/x/packages/core/src/runtime/turns/event-hub.test.ts diff --git a/apps/x/packages/core/src/turns/event-hub.ts b/apps/x/packages/core/src/runtime/turns/event-hub.ts similarity index 100% rename from apps/x/packages/core/src/turns/event-hub.ts rename to apps/x/packages/core/src/runtime/turns/event-hub.ts diff --git a/apps/x/packages/core/src/turns/fs-repo.test.ts b/apps/x/packages/core/src/runtime/turns/fs-repo.test.ts similarity index 100% rename from apps/x/packages/core/src/turns/fs-repo.test.ts rename to apps/x/packages/core/src/runtime/turns/fs-repo.test.ts diff --git a/apps/x/packages/core/src/turns/fs-repo.ts b/apps/x/packages/core/src/runtime/turns/fs-repo.ts similarity index 100% rename from apps/x/packages/core/src/turns/fs-repo.ts rename to apps/x/packages/core/src/runtime/turns/fs-repo.ts diff --git a/apps/x/packages/core/src/turns/in-memory-turn-repo.ts b/apps/x/packages/core/src/runtime/turns/in-memory-turn-repo.ts similarity index 100% rename from apps/x/packages/core/src/turns/in-memory-turn-repo.ts rename to apps/x/packages/core/src/runtime/turns/in-memory-turn-repo.ts diff --git a/apps/x/packages/core/src/turns/index.ts b/apps/x/packages/core/src/runtime/turns/index.ts similarity index 100% rename from apps/x/packages/core/src/turns/index.ts rename to apps/x/packages/core/src/runtime/turns/index.ts diff --git a/apps/x/packages/core/src/turns/inspect-cli.ts b/apps/x/packages/core/src/runtime/turns/inspect-cli.ts similarity index 98% rename from apps/x/packages/core/src/turns/inspect-cli.ts rename to apps/x/packages/core/src/runtime/turns/inspect-cli.ts index 4ca79d0c..a75568e9 100644 --- a/apps/x/packages/core/src/turns/inspect-cli.ts +++ b/apps/x/packages/core/src/runtime/turns/inspect-cli.ts @@ -27,8 +27,8 @@ import { } from "@x/shared/dist/turns.js"; import { reduceSession } from "@x/shared/dist/sessions.js"; import type { z } from "zod"; -import { convertFromMessages } from "../agents/message-encoding.js"; -import { WorkDir } from "../config/config.js"; +import { convertFromMessages } from "../assembly/message-encoding.js"; +import { WorkDir } from "../../config/config.js"; import { FSSessionRepo } from "../sessions/fs-repo.js"; import { composeModelRequest } from "./compose-model-request.js"; import { createContextResolver, loadElisionPolicy } from "./context-elision.js"; diff --git a/apps/x/packages/core/src/turns/keyed-mutex.ts b/apps/x/packages/core/src/runtime/turns/keyed-mutex.ts similarity index 100% rename from apps/x/packages/core/src/turns/keyed-mutex.ts rename to apps/x/packages/core/src/runtime/turns/keyed-mutex.ts diff --git a/apps/x/packages/core/src/turns/model-registry.ts b/apps/x/packages/core/src/runtime/turns/model-registry.ts similarity index 100% rename from apps/x/packages/core/src/turns/model-registry.ts rename to apps/x/packages/core/src/runtime/turns/model-registry.ts diff --git a/apps/x/packages/core/src/turns/permission.ts b/apps/x/packages/core/src/runtime/turns/permission.ts similarity index 100% rename from apps/x/packages/core/src/turns/permission.ts rename to apps/x/packages/core/src/runtime/turns/permission.ts diff --git a/apps/x/packages/core/src/turns/repo.ts b/apps/x/packages/core/src/runtime/turns/repo.ts similarity index 100% rename from apps/x/packages/core/src/turns/repo.ts rename to apps/x/packages/core/src/runtime/turns/repo.ts diff --git a/apps/x/packages/core/src/turns/runtime.test.ts b/apps/x/packages/core/src/runtime/turns/runtime.test.ts similarity index 100% rename from apps/x/packages/core/src/turns/runtime.test.ts rename to apps/x/packages/core/src/runtime/turns/runtime.test.ts diff --git a/apps/x/packages/core/src/turns/runtime.ts b/apps/x/packages/core/src/runtime/turns/runtime.ts similarity index 99% rename from apps/x/packages/core/src/turns/runtime.ts rename to apps/x/packages/core/src/runtime/turns/runtime.ts index d027e385..a7dfd5ce 100644 --- a/apps/x/packages/core/src/turns/runtime.ts +++ b/apps/x/packages/core/src/runtime/turns/runtime.ts @@ -27,7 +27,7 @@ import { outstandingPermissions, reduceTurn, } from "@x/shared/dist/turns.js"; -import type { IMonotonicallyIncreasingIdGenerator } from "../application/lib/id-gen.js"; +import type { IMonotonicallyIncreasingIdGenerator } from "../../application/lib/id-gen.js"; import type { IAgentResolver } from "./agent-resolver.js"; import { type CreateTurnInput, diff --git a/apps/x/packages/core/src/turns/stream.test.ts b/apps/x/packages/core/src/runtime/turns/stream.test.ts similarity index 100% rename from apps/x/packages/core/src/turns/stream.test.ts rename to apps/x/packages/core/src/runtime/turns/stream.test.ts diff --git a/apps/x/packages/core/src/turns/stream.ts b/apps/x/packages/core/src/runtime/turns/stream.ts similarity index 100% rename from apps/x/packages/core/src/turns/stream.ts rename to apps/x/packages/core/src/runtime/turns/stream.ts diff --git a/apps/x/packages/core/src/turns/tool-registry.ts b/apps/x/packages/core/src/runtime/turns/tool-registry.ts similarity index 100% rename from apps/x/packages/core/src/turns/tool-registry.ts rename to apps/x/packages/core/src/runtime/turns/tool-registry.ts diff --git a/apps/x/packages/core/src/turns/usage-reporter.ts b/apps/x/packages/core/src/runtime/turns/usage-reporter.ts similarity index 100% rename from apps/x/packages/core/src/turns/usage-reporter.ts rename to apps/x/packages/core/src/runtime/turns/usage-reporter.ts