From e808d6d4f03749e7adad4392d5f3c3c85e5cdc60 Mon Sep 17 00:00:00 2001 From: Ramnique Singh <30795890+ramnique@users.noreply.github.com> Date: Fri, 10 Jul 2026 11:48:32 +0530 Subject: [PATCH 1/8] =?UTF-8?q?refactor(x):=20the=20runtime=20moves=20unde?= =?UTF-8?q?r=20one=20roof=20=E2=80=94=20core/src/runtime/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Everything "model runtime" now lives under core/src/runtime/, whose five children are the architecture: turns/ (the engine + bridges), sessions/, assembly/ (what an agent is: registry, composer, workspace context, message encoding, permission metadata, headless runners, spawn-agent, copilot/ definition, capabilities/, skills/ — no longer buried at application/assistant), tools/ (catalog + domains + exec plumbing + descriptors, which leave turns/bridges and fix the upward lib→bridges edge), and legacy/ (the quarantined runs engine, with agents/runtime.ts finally honestly named engine.ts). Pure moves via git mv (history follows) with mechanical import rewrites; no durable schema, wire format, or behavior changes — the golden prompt snapshots and the catalog key-order pin pass unchanged. di/ stays top-level (whole-app composition root); application/ shrinks to browser-control/browser-skills/notification and true cross-cutting lib utils. Co-Authored-By: Claude Fable 5 --- apps/x/apps/main/src/composio-handler.ts | 2 +- apps/x/apps/main/src/ipc.ts | 10 +-- apps/x/apps/main/src/main.ts | 4 +- apps/x/apps/main/src/test-agent.ts | 4 +- apps/x/packages/core/package.json | 4 +- .../core/src/agent-schedule/runner.ts | 2 +- .../src/application/lib/command-executor.ts | 2 +- apps/x/packages/core/src/apps/host-api.ts | 4 +- .../core/src/background-tasks/agent.ts | 2 +- .../src/background-tasks/code-sessions.ts | 2 +- .../core/src/background-tasks/runner.ts | 4 +- .../packages/core/src/channels/bridge.test.ts | 6 +- apps/x/packages/core/src/channels/bridge.ts | 10 +-- apps/x/packages/core/src/channels/service.ts | 4 +- .../core/src/code-mode/sessions/service.ts | 8 +-- apps/x/packages/core/src/di/container.ts | 66 +++++++++---------- .../core/src/knowledge/agent_notes.ts | 4 +- .../core/src/knowledge/build_graph.ts | 4 +- .../core/src/knowledge/inline_task_agent.ts | 2 +- .../core/src/knowledge/inline_tasks.ts | 2 +- .../core/src/knowledge/label_emails.ts | 4 +- .../core/src/knowledge/live-note/agent.ts | 2 +- .../core/src/knowledge/live-note/runner.ts | 4 +- .../packages/core/src/knowledge/tag_notes.ts | 4 +- .../core/src/migrations/runs/migrate.test.ts | 4 +- apps/x/packages/core/src/pre_built/runner.ts | 2 +- apps/x/packages/core/src/runs/bus.ts | 4 -- .../compose-instructions.test.ts.snap | 0 .../assembly}/build-trigger-block.ts | 0 .../assembly}/capabilities/modes.ts | 0 .../assembly}/capabilities/types.ts | 0 .../assembly}/capabilities/workspace.ts | 0 .../assembly}/compose-instructions.test.ts | 0 .../assembly}/compose-instructions.ts | 6 +- .../assembly}/connections.ts | 0 .../assembly/copilot}/agent.ts | 0 .../assembly/copilot}/base-tools.ts | 0 .../assembly/copilot}/instructions.ts | 12 ++-- .../assembly/copilot}/runtime-context.ts | 0 .../assembly}/headless-app.ts | 6 +- .../assembly}/headless.test.ts | 2 +- .../{agents => runtime/assembly}/headless.ts | 2 +- .../assembly}/message-encoding.ts | 0 .../assembly}/permission-metadata.ts | 8 +-- .../assembly}/registry.test.ts | 0 .../{agents => runtime/assembly}/registry.ts | 22 +++---- .../src/{agents => runtime/assembly}/repo.ts | 4 +- .../assembly}/skills/app-navigation/skill.ts | 0 .../assembly}/skills/apps/skill.ts | 0 .../assembly}/skills/background-task/skill.ts | 0 .../assembly}/skills/browser-control/skill.ts | 0 .../assembly}/skills/builtin-tools/skill.ts | 0 .../skills/code-with-agents/skill.ts | 0 .../skills/composio-integration/skill.ts | 0 .../skills/create-presentations/skill.ts | 0 .../skills/deletion-guardrails/skill.ts | 0 .../assembly}/skills/disk-loader.test.ts | 0 .../assembly}/skills/disk-loader.ts | 2 +- .../assembly}/skills/doc-collab/skill.ts | 2 +- .../assembly}/skills/draft-emails/skill.ts | 0 .../assembly}/skills/index.test.ts | 0 .../assembly}/skills/index.ts | 0 .../assembly}/skills/live-note/skill.ts | 0 .../assembly}/skills/mcp-integration/skill.ts | 0 .../assembly}/skills/meeting-prep/skill.ts | 0 .../assembly}/skills/notify-user/skill.ts | 0 .../assembly}/skills/organize-files/skill.ts | 0 .../assembly}/skills/slack/skill.ts | 0 .../assembly}/skills/watcher.ts | 2 +- .../assembly}/spawn-agent.test.ts | 0 .../assembly}/spawn-agent.ts | 2 +- .../assembly}/workspace-context.test.ts | 0 .../assembly}/workspace-context.ts | 2 +- .../x/packages/core/src/runtime/legacy/bus.ts | 4 ++ .../runtime.ts => runtime/legacy/engine.ts} | 46 ++++++------- .../core/src/{runs => runtime/legacy}/lock.ts | 0 .../core/src/{runs => runtime/legacy}/repo.ts | 6 +- .../core/src/{runs => runtime/legacy}/runs.ts | 20 +++--- .../src/{agents => runtime/legacy}/utils.ts | 4 +- .../core/src/{ => runtime}/sessions/api.ts | 0 .../core/src/{ => runtime}/sessions/bus.ts | 0 .../{ => runtime}/sessions/fs-repo.test.ts | 0 .../src/{ => runtime}/sessions/fs-repo.ts | 0 .../sessions/in-memory-session-repo.ts | 0 .../core/src/{ => runtime}/sessions/index.ts | 0 .../core/src/{ => runtime}/sessions/repo.ts | 0 .../{ => runtime}/sessions/session-index.ts | 0 .../{ => runtime}/sessions/sessions.test.ts | 0 .../src/{ => runtime}/sessions/sessions.ts | 4 +- .../tools/catalog.test.ts} | 4 +- .../tools/catalog.ts} | 44 ++++++------- .../tools/descriptors.ts} | 2 +- .../tools/domains}/agent-analysis.ts | 2 +- .../tools/domains}/app.ts | 2 +- .../tools/domains}/background-tasks.ts | 0 .../tools/domains}/browser.ts | 4 +- .../tools/domains}/code.ts | 0 .../tools/domains}/composio.ts | 0 .../tools/domains}/files.ts | 0 .../tools/domains}/live-note.ts | 0 .../tools/domains}/mcp.ts | 2 +- .../tools/domains}/memory.ts | 0 .../tools/domains}/models.ts | 0 .../tools/domains}/notifications.ts | 6 +- .../tools/domains}/parsing.ts | 0 .../tools/domains}/shell.ts | 2 +- .../tools/domains}/support.ts | 0 .../tools/domains}/web.ts | 0 .../lib => runtime/tools}/exec-tool.ts | 4 +- .../lib => runtime/tools}/tool-additions.ts | 0 .../src/{ => runtime}/turns/abort-registry.ts | 0 .../src/{ => runtime}/turns/agent-resolver.ts | 0 .../core/src/{ => runtime}/turns/api.ts | 0 .../bridges/agent-resolver-dispatch.test.ts | 0 .../turns/bridges/agent-resolver-dispatch.ts | 0 .../src/{ => runtime}/turns/bridges/index.ts | 0 .../bridges/inline-agent-resolver.test.ts | 2 +- .../turns/bridges/inline-agent-resolver.ts | 6 +- .../turns/bridges/real-agent-resolver.test.ts | 4 +- .../turns/bridges/real-agent-resolver.ts | 16 ++--- .../turns/bridges/real-model-registry.test.ts | 0 .../turns/bridges/real-model-registry.ts | 14 ++-- .../bridges/real-permission-checker.test.ts | 2 +- .../turns/bridges/real-permission-checker.ts | 2 +- .../real-permission-classifier.test.ts | 2 +- .../bridges/real-permission-classifier.ts | 6 +- .../turns/bridges/real-tool-registry.test.ts | 4 +- .../turns/bridges/real-tool-registry.ts | 8 +-- .../turns/bridges/real-usage-reporter.ts | 4 +- .../core/src/{ => runtime}/turns/bus.ts | 0 .../core/src/{ => runtime}/turns/clock.ts | 0 .../turns/compose-model-request.ts | 0 .../turns/context-elision.test.ts | 0 .../{ => runtime}/turns/context-elision.ts | 2 +- .../turns/context-resolver.test.ts | 0 .../{ => runtime}/turns/context-resolver.ts | 0 .../src/{ => runtime}/turns/event-hub.test.ts | 0 .../core/src/{ => runtime}/turns/event-hub.ts | 0 .../src/{ => runtime}/turns/fs-repo.test.ts | 0 .../core/src/{ => runtime}/turns/fs-repo.ts | 0 .../turns/in-memory-turn-repo.ts | 0 .../core/src/{ => runtime}/turns/index.ts | 0 .../src/{ => runtime}/turns/inspect-cli.ts | 4 +- .../src/{ => runtime}/turns/keyed-mutex.ts | 0 .../src/{ => runtime}/turns/model-registry.ts | 0 .../src/{ => runtime}/turns/permission.ts | 0 .../core/src/{ => runtime}/turns/repo.ts | 0 .../src/{ => runtime}/turns/runtime.test.ts | 0 .../core/src/{ => runtime}/turns/runtime.ts | 2 +- .../src/{ => runtime}/turns/stream.test.ts | 0 .../core/src/{ => runtime}/turns/stream.ts | 0 .../src/{ => runtime}/turns/tool-registry.ts | 0 .../src/{ => runtime}/turns/usage-reporter.ts | 0 153 files changed, 238 insertions(+), 238 deletions(-) delete mode 100644 apps/x/packages/core/src/runs/bus.ts rename apps/x/packages/core/src/{agents => runtime/assembly}/__snapshots__/compose-instructions.test.ts.snap (100%) rename apps/x/packages/core/src/{agents => runtime/assembly}/build-trigger-block.ts (100%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/capabilities/modes.ts (100%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/capabilities/types.ts (100%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/capabilities/workspace.ts (100%) rename apps/x/packages/core/src/{agents => runtime/assembly}/compose-instructions.test.ts (100%) rename apps/x/packages/core/src/{agents => runtime/assembly}/compose-instructions.ts (95%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/connections.ts (100%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly/copilot}/agent.ts (100%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly/copilot}/base-tools.ts (100%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly/copilot}/instructions.ts (98%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly/copilot}/runtime-context.ts (100%) rename apps/x/packages/core/src/{agents => runtime/assembly}/headless-app.ts (90%) rename apps/x/packages/core/src/{agents => runtime/assembly}/headless.test.ts (99%) rename apps/x/packages/core/src/{agents => runtime/assembly}/headless.ts (98%) rename apps/x/packages/core/src/{agents => runtime/assembly}/message-encoding.ts (100%) rename apps/x/packages/core/src/{agents => runtime/assembly}/permission-metadata.ts (95%) rename apps/x/packages/core/src/{agents => runtime/assembly}/registry.test.ts (100%) rename apps/x/packages/core/src/{agents => runtime/assembly}/registry.ts (82%) rename apps/x/packages/core/src/{agents => runtime/assembly}/repo.ts (96%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/skills/app-navigation/skill.ts (100%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/skills/apps/skill.ts (100%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/skills/background-task/skill.ts (100%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/skills/browser-control/skill.ts (100%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/skills/builtin-tools/skill.ts (100%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/skills/code-with-agents/skill.ts (100%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/skills/composio-integration/skill.ts (100%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/skills/create-presentations/skill.ts (100%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/skills/deletion-guardrails/skill.ts (100%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/skills/disk-loader.test.ts (100%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/skills/disk-loader.ts (98%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/skills/doc-collab/skill.ts (99%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/skills/draft-emails/skill.ts (100%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/skills/index.test.ts (100%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/skills/index.ts (100%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/skills/live-note/skill.ts (100%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/skills/mcp-integration/skill.ts (100%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/skills/meeting-prep/skill.ts (100%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/skills/notify-user/skill.ts (100%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/skills/organize-files/skill.ts (100%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/skills/slack/skill.ts (100%) rename apps/x/packages/core/src/{application/assistant => runtime/assembly}/skills/watcher.ts (97%) rename apps/x/packages/core/src/{agents => runtime/assembly}/spawn-agent.test.ts (100%) rename apps/x/packages/core/src/{agents => runtime/assembly}/spawn-agent.ts (99%) rename apps/x/packages/core/src/{agents => runtime/assembly}/workspace-context.test.ts (100%) rename apps/x/packages/core/src/{agents => runtime/assembly}/workspace-context.ts (98%) create mode 100644 apps/x/packages/core/src/runtime/legacy/bus.ts rename apps/x/packages/core/src/{agents/runtime.ts => runtime/legacy/engine.ts} (97%) rename apps/x/packages/core/src/{runs => runtime/legacy}/lock.ts (100%) rename apps/x/packages/core/src/{runs => runtime/legacy}/repo.ts (98%) rename apps/x/packages/core/src/{runs => runtime/legacy}/runs.ts (91%) rename apps/x/packages/core/src/{agents => runtime/legacy}/utils.ts (97%) rename apps/x/packages/core/src/{ => runtime}/sessions/api.ts (100%) rename apps/x/packages/core/src/{ => runtime}/sessions/bus.ts (100%) rename apps/x/packages/core/src/{ => runtime}/sessions/fs-repo.test.ts (100%) rename apps/x/packages/core/src/{ => runtime}/sessions/fs-repo.ts (100%) rename apps/x/packages/core/src/{ => runtime}/sessions/in-memory-session-repo.ts (100%) rename apps/x/packages/core/src/{ => runtime}/sessions/index.ts (100%) rename apps/x/packages/core/src/{ => runtime}/sessions/repo.ts (100%) rename apps/x/packages/core/src/{ => runtime}/sessions/session-index.ts (100%) rename apps/x/packages/core/src/{ => runtime}/sessions/sessions.test.ts (100%) rename apps/x/packages/core/src/{ => runtime}/sessions/sessions.ts (99%) rename apps/x/packages/core/src/{application/lib/builtin-tools.test.ts => runtime/tools/catalog.test.ts} (98%) rename apps/x/packages/core/src/{application/lib/builtin-tools.ts => runtime/tools/catalog.ts} (78%) rename apps/x/packages/core/src/{turns/bridges/builtin-descriptors.ts => runtime/tools/descriptors.ts} (94%) rename apps/x/packages/core/src/{application/lib/builtin-tools => runtime/tools/domains}/agent-analysis.ts (97%) rename apps/x/packages/core/src/{application/lib/builtin-tools => runtime/tools/domains}/app.ts (99%) rename apps/x/packages/core/src/{application/lib/builtin-tools => runtime/tools/domains}/background-tasks.ts (100%) rename apps/x/packages/core/src/{application/lib/builtin-tools => runtime/tools/domains}/browser.ts (97%) rename apps/x/packages/core/src/{application/lib/builtin-tools => runtime/tools/domains}/code.ts (100%) rename apps/x/packages/core/src/{application/lib/builtin-tools => runtime/tools/domains}/composio.ts (100%) rename apps/x/packages/core/src/{application/lib/builtin-tools => runtime/tools/domains}/files.ts (100%) rename apps/x/packages/core/src/{application/lib/builtin-tools => runtime/tools/domains}/live-note.ts (100%) rename apps/x/packages/core/src/{application/lib/builtin-tools => runtime/tools/domains}/mcp.ts (98%) rename apps/x/packages/core/src/{application/lib/builtin-tools => runtime/tools/domains}/memory.ts (100%) rename apps/x/packages/core/src/{application/lib/builtin-tools => runtime/tools/domains}/models.ts (100%) rename apps/x/packages/core/src/{application/lib/builtin-tools => runtime/tools/domains}/notifications.ts (96%) rename apps/x/packages/core/src/{application/lib/builtin-tools => runtime/tools/domains}/parsing.ts (100%) rename apps/x/packages/core/src/{application/lib/builtin-tools => runtime/tools/domains}/shell.ts (97%) rename apps/x/packages/core/src/{application/lib/builtin-tools => runtime/tools/domains}/support.ts (100%) rename apps/x/packages/core/src/{application/lib/builtin-tools => runtime/tools/domains}/web.ts (100%) rename apps/x/packages/core/src/{application/lib => runtime/tools}/exec-tool.ts (94%) rename apps/x/packages/core/src/{application/lib => runtime/tools}/tool-additions.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/abort-registry.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/agent-resolver.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/api.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/bridges/agent-resolver-dispatch.test.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/bridges/agent-resolver-dispatch.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/bridges/index.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/bridges/inline-agent-resolver.test.ts (98%) rename apps/x/packages/core/src/{ => runtime}/turns/bridges/inline-agent-resolver.ts (94%) rename apps/x/packages/core/src/{ => runtime}/turns/bridges/real-agent-resolver.test.ts (98%) rename apps/x/packages/core/src/{ => runtime}/turns/bridges/real-agent-resolver.ts (94%) rename apps/x/packages/core/src/{ => runtime}/turns/bridges/real-model-registry.test.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/bridges/real-model-registry.ts (97%) rename apps/x/packages/core/src/{ => runtime}/turns/bridges/real-permission-checker.test.ts (97%) rename apps/x/packages/core/src/{ => runtime}/turns/bridges/real-permission-checker.ts (95%) rename apps/x/packages/core/src/{ => runtime}/turns/bridges/real-permission-classifier.test.ts (97%) rename apps/x/packages/core/src/{ => runtime}/turns/bridges/real-permission-classifier.ts (89%) rename apps/x/packages/core/src/{ => runtime}/turns/bridges/real-tool-registry.test.ts (98%) rename apps/x/packages/core/src/{ => runtime}/turns/bridges/real-tool-registry.ts (97%) rename apps/x/packages/core/src/{ => runtime}/turns/bridges/real-usage-reporter.ts (87%) rename apps/x/packages/core/src/{ => runtime}/turns/bus.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/clock.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/compose-model-request.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/context-elision.test.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/context-elision.ts (99%) rename apps/x/packages/core/src/{ => runtime}/turns/context-resolver.test.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/context-resolver.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/event-hub.test.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/event-hub.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/fs-repo.test.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/fs-repo.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/in-memory-turn-repo.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/index.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/inspect-cli.ts (98%) rename apps/x/packages/core/src/{ => runtime}/turns/keyed-mutex.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/model-registry.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/permission.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/repo.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/runtime.test.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/runtime.ts (99%) rename apps/x/packages/core/src/{ => runtime}/turns/stream.test.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/stream.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/tool-registry.ts (100%) rename apps/x/packages/core/src/{ => runtime}/turns/usage-reporter.ts (100%) 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 From 5f4788cf56b040bb3f2c825dc9335a528a34b434 Mon Sep 17 00:00:00 2001 From: Ramnique Singh <30795890+ramnique@users.noreply.github.com> Date: Fri, 10 Jul 2026 11:51:11 +0530 Subject: [PATCH 2/8] refactor(x): dissolve the tools support grab-bag into its owners MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit domains/support.ts bundled five unrelated concerns. Each moves to its owner: the catalog schema → tools/types.ts (every domain's typing); lenient ~-expansion → tools/paths.ts (documented as distinct from filesystem's throwing variant); the bg-task input schemas and resolveCodeProject → domains/background-tasks.ts; the code-run coalescer → domains/code.ts (catalog re-export retargeted); parser plumbing → domains/parsing.ts, now module-private. Co-Authored-By: Claude Fable 5 --- .../core/src/runtime/tools/catalog.ts | 4 +- .../runtime/tools/domains/agent-analysis.ts | 4 +- .../core/src/runtime/tools/domains/app.ts | 4 +- .../runtime/tools/domains/background-tasks.ts | 68 ++++++++- .../core/src/runtime/tools/domains/browser.ts | 4 +- .../core/src/runtime/tools/domains/code.ts | 31 +++- .../src/runtime/tools/domains/composio.ts | 4 +- .../core/src/runtime/tools/domains/files.ts | 4 +- .../src/runtime/tools/domains/live-note.ts | 4 +- .../core/src/runtime/tools/domains/mcp.ts | 4 +- .../core/src/runtime/tools/domains/memory.ts | 4 +- .../core/src/runtime/tools/domains/models.ts | 4 +- .../runtime/tools/domains/notifications.ts | 4 +- .../core/src/runtime/tools/domains/parsing.ts | 35 ++++- .../core/src/runtime/tools/domains/shell.ts | 4 +- .../core/src/runtime/tools/domains/support.ts | 133 ------------------ .../core/src/runtime/tools/domains/web.ts | 4 +- .../packages/core/src/runtime/tools/paths.ts | 18 +++ .../packages/core/src/runtime/tools/types.ts | 15 ++ 19 files changed, 165 insertions(+), 187 deletions(-) delete mode 100644 apps/x/packages/core/src/runtime/tools/domains/support.ts create mode 100644 apps/x/packages/core/src/runtime/tools/paths.ts create mode 100644 apps/x/packages/core/src/runtime/tools/types.ts diff --git a/apps/x/packages/core/src/runtime/tools/catalog.ts b/apps/x/packages/core/src/runtime/tools/catalog.ts index df7682b8..3a89d86e 100644 --- a/apps/x/packages/core/src/runtime/tools/catalog.ts +++ b/apps/x/packages/core/src/runtime/tools/catalog.ts @@ -22,8 +22,8 @@ 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"; +import { BuiltinToolsSchema } from "./types.js"; +export { coalesceCodeRunEvents } from "./domains/code.js"; // The builtin-tool catalog, assembled from domain modules // (./builtin-tools/*). SPREAD ORDER IS LOAD-BEARING: catalog key order is diff --git a/apps/x/packages/core/src/runtime/tools/domains/agent-analysis.ts b/apps/x/packages/core/src/runtime/tools/domains/agent-analysis.ts index e6e6fcfb..dbbd5a7f 100644 --- a/apps/x/packages/core/src/runtime/tools/domains/agent-analysis.ts +++ b/apps/x/packages/core/src/runtime/tools/domains/agent-analysis.ts @@ -5,9 +5,7 @@ import { z } from "zod"; import container from "../../../di/container.js"; import { IAgentsRepo } from "../../assembly/repo.js"; -import { - BuiltinToolsSchema, -} from "./support.js"; +import { BuiltinToolsSchema } from "../types.js"; export const agentAnalysisTools: z.infer = { diff --git a/apps/x/packages/core/src/runtime/tools/domains/app.ts b/apps/x/packages/core/src/runtime/tools/domains/app.ts index a81ced8d..595cc99f 100644 --- a/apps/x/packages/core/src/runtime/tools/domains/app.ts +++ b/apps/x/packages/core/src/runtime/tools/domains/app.ts @@ -13,9 +13,7 @@ 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 { - BuiltinToolsSchema, -} from "./support.js"; +import { BuiltinToolsSchema } from "../types.js"; export const appNavigationTools: z.infer = { diff --git a/apps/x/packages/core/src/runtime/tools/domains/background-tasks.ts b/apps/x/packages/core/src/runtime/tools/domains/background-tasks.ts index 25d0b5f0..2fbe53a3 100644 --- a/apps/x/packages/core/src/runtime/tools/domains/background-tasks.ts +++ b/apps/x/packages/core/src/runtime/tools/domains/background-tasks.ts @@ -3,12 +3,68 @@ // catalog key order (provider-payload bytes; see the key-order test there). import { z } from "zod"; -import { - CreateBackgroundTaskInput, - PatchBackgroundTaskInput, - resolveCodeProject, - BuiltinToolsSchema, -} from "./support.js"; +import { BuiltinToolsSchema } from "../types.js"; + +import * as path from "path"; +import container from "../../../di/container.js"; +import { BackgroundTaskSchema, TriggersSchema } from "@x/shared/dist/background-task.js"; +import * as gitService from "../../../code-mode/git/service.js"; +import type { ICodeProjectsRepo } from "../../../code-mode/projects/repo.js"; +import { expandHome } from "../paths.js"; + +// Inputs for the bg-task builtin tools. Reuse the canonical schema field +// descriptions; only `triggers` gets a tighter contextual override (the +// shared TriggersSchema description is written from the live-note perspective). +export const CreateBackgroundTaskInput = BackgroundTaskSchema.pick({ + name: true, + instructions: true, + triggers: true, + model: true, + provider: true, +}).extend({ + triggers: TriggersSchema.optional().describe('All three sub-fields (cronExpr, windows, eventMatchCriteria) are independently optional — mix freely. No triggers at all = manual-only (user clicks Run).'), + projectDir: z.string().optional().describe( + "Set this ONLY when the user wants the task to WRITE CODE. An absolute path (or ~/…) to a LOCAL GIT REPOSITORY with at least one commit. It turns this into a *coding task*: each run scans the trigger source for actionable items and implements them autonomously in isolated git worktrees off this repo — never touching the user's checkout. Extract the directory from the user's request (e.g. 'use ~/Work/space/test as the work directory'). Omit for ordinary output/action tasks.", + ), +}); + +export const PatchBackgroundTaskInput = BackgroundTaskSchema.pick({ + name: true, + instructions: true, + active: true, + triggers: true, + model: true, + provider: true, +}).partial().extend({ + slug: z.string().describe('The slug of the task to update (the folder name under bg-tasks/).'), + triggers: TriggersSchema.optional().describe('Replace the triggers object. To remove all triggers (make manual-only) pass an empty object.'), + projectDir: z.string().optional().describe("Point an existing task at a code repo (or change which one) to make it a coding task. Absolute path or ~/… to a local git repository with at least one commit. Same rules as on create."), + clearModel: z.boolean().optional().describe("Reset the task's model/provider override so it falls back to the default. Use this to unstick a bad/rejected model value (do not also pass model)."), +}); + +export async function resolveCodeProject(dirPath: string): Promise< + { ok: true; projectId: string; path: string; warning?: string } | { ok: false; error: string } +> { + const abs = path.resolve(expandHome(dirPath)); + const projectsRepo = container.resolve('codeProjectsRepo'); + let project: Awaited>; + try { + project = await projectsRepo.add(abs); + } catch (err) { + return { ok: false, error: `Could not use '${dirPath}' as a code directory: ${err instanceof Error ? err.message : String(err)}` }; + } + // Worktree isolation needs a real git repo with at least one commit + // (codeSessionService.create throws otherwise). Surface it now as a soft + // warning rather than letting the next run fail silently. + let warning: string | undefined; + try { + const info = await gitService.repoInfo(project.path); + if (!info.isGitRepo) warning = `${project.path} is not a git repository yet — run \`git init\` and make a commit, or the coding sessions will fail.`; + else if (!info.hasCommits) warning = `${project.path} has no commits yet — make an initial commit, or the coding sessions will fail.`; + } catch { /* best effort — worktree creation will surface it later */ } + return { ok: true, projectId: project.id, path: project.path, ...(warning ? { warning } : {}) }; +} + export const backgroundTaskTools: z.infer = { diff --git a/apps/x/packages/core/src/runtime/tools/domains/browser.ts b/apps/x/packages/core/src/runtime/tools/domains/browser.ts index ea5e0614..a32ab38e 100644 --- a/apps/x/packages/core/src/runtime/tools/domains/browser.ts +++ b/apps/x/packages/core/src/runtime/tools/domains/browser.ts @@ -8,9 +8,7 @@ import { BrowserControlInputSchema, type BrowserControlInput } from "@x/shared/d 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 "../../../application/browser-control/service.js"; -import { - BuiltinToolsSchema, -} from "./support.js"; +import { BuiltinToolsSchema } from "../types.js"; export const browserTools: z.infer = { diff --git a/apps/x/packages/core/src/runtime/tools/domains/code.ts b/apps/x/packages/core/src/runtime/tools/domains/code.ts index e6cafa48..d220b1ae 100644 --- a/apps/x/packages/core/src/runtime/tools/domains/code.ts +++ b/apps/x/packages/core/src/runtime/tools/domains/code.ts @@ -12,11 +12,32 @@ import { ICodeModeConfigRepo } from "../../../code-mode/repo.js"; import type { ApprovalPolicy, CodeRunEvent as CodeRunEventType } from "@x/shared/dist/code-mode.js"; import type { CodeRunFeed } from "../../../code-mode/feed.js"; import type { ToolContext } from "../exec-tool.js"; -import { - expandHome, - coalesceCodeRunEvents, - BuiltinToolsSchema, -} from "./support.js"; +import { expandHome } from "../paths.js"; +import { BuiltinToolsSchema } from "../types.js"; + + + +// Shrink a code-run timeline for durable storage: consecutive same-role message +// chunks merge into one event. Display-lossless — the timeline renderer +// concatenates consecutive messages anyway (CodingRunTimeline) — and typically +// collapses the ~90% of a run's events that are per-token text deltas. +// Everything else (tool calls/updates, plans, permissions) is kept verbatim in +// order: updates are id-keyed transitions and must not be merged. +export function coalesceCodeRunEvents(events: CodeRunEventType[]): CodeRunEventType[] { + const out: CodeRunEventType[] = []; + for (const event of events) { + const last = out[out.length - 1]; + if ( + event.type === 'message' && last?.type === 'message' && last.role === event.role + ) { + out[out.length - 1] = { ...last, text: last.text + event.text }; + } else { + out.push(event); + } + } + return out; +} + export const codeAgentRunTools: z.infer = { diff --git a/apps/x/packages/core/src/runtime/tools/domains/composio.ts b/apps/x/packages/core/src/runtime/tools/domains/composio.ts index b069e822..f9ff020e 100644 --- a/apps/x/packages/core/src/runtime/tools/domains/composio.ts +++ b/apps/x/packages/core/src/runtime/tools/domains/composio.ts @@ -6,9 +6,7 @@ import { z } from "zod"; import { composioAccountsRepo } from "../../../composio/repo.js"; import { executeAction as executeComposioAction, isConfigured as isComposioConfigured, searchTools as searchComposioTools } from "../../../composio/client.js"; import { CURATED_TOOLKITS, CURATED_TOOLKIT_SLUGS } from "@x/shared/dist/composio.js"; -import { - BuiltinToolsSchema, -} from "./support.js"; +import { BuiltinToolsSchema } from "../types.js"; export const composioTools: z.infer = { diff --git a/apps/x/packages/core/src/runtime/tools/domains/files.ts b/apps/x/packages/core/src/runtime/tools/domains/files.ts index f0791cc8..fe20516c 100644 --- a/apps/x/packages/core/src/runtime/tools/domains/files.ts +++ b/apps/x/packages/core/src/runtime/tools/domains/files.ts @@ -5,9 +5,7 @@ import { z } from "zod"; import * as files from "../../../filesystem/files.js"; import { WorkDir } from "../../../config/config.js"; -import { - BuiltinToolsSchema, -} from "./support.js"; +import { BuiltinToolsSchema } from "../types.js"; export const fileTools: z.infer = { diff --git a/apps/x/packages/core/src/runtime/tools/domains/live-note.ts b/apps/x/packages/core/src/runtime/tools/domains/live-note.ts index 5d70a434..b33e658f 100644 --- a/apps/x/packages/core/src/runtime/tools/domains/live-note.ts +++ b/apps/x/packages/core/src/runtime/tools/domains/live-note.ts @@ -3,9 +3,7 @@ // catalog key order (provider-payload bytes; see the key-order test there). import { z } from "zod"; -import { - BuiltinToolsSchema, -} from "./support.js"; +import { BuiltinToolsSchema } from "../types.js"; export const liveNoteTools: z.infer = { diff --git a/apps/x/packages/core/src/runtime/tools/domains/mcp.ts b/apps/x/packages/core/src/runtime/tools/domains/mcp.ts index a1f5c5ae..33d0e7a1 100644 --- a/apps/x/packages/core/src/runtime/tools/domains/mcp.ts +++ b/apps/x/packages/core/src/runtime/tools/domains/mcp.ts @@ -7,9 +7,7 @@ import { executeTool, listServers, listTools } from "../../../mcp/mcp.js"; import container from "../../../di/container.js"; import { IMcpConfigRepo } from "../../../mcp/repo.js"; import { McpServerDefinition } from "@x/shared/dist/mcp.js"; -import { - BuiltinToolsSchema, -} from "./support.js"; +import { BuiltinToolsSchema } from "../types.js"; export const mcpTools: z.infer = { diff --git a/apps/x/packages/core/src/runtime/tools/domains/memory.ts b/apps/x/packages/core/src/runtime/tools/domains/memory.ts index 999093a9..b55c3c1f 100644 --- a/apps/x/packages/core/src/runtime/tools/domains/memory.ts +++ b/apps/x/packages/core/src/runtime/tools/domains/memory.ts @@ -6,9 +6,7 @@ import { z } from "zod"; import * as path from "path"; import * as fs from "fs/promises"; import { WorkDir } from "../../../config/config.js"; -import { - BuiltinToolsSchema, -} from "./support.js"; +import { BuiltinToolsSchema } from "../types.js"; export const memoryTools: z.infer = { diff --git a/apps/x/packages/core/src/runtime/tools/domains/models.ts b/apps/x/packages/core/src/runtime/tools/domains/models.ts index 276d11b5..05896140 100644 --- a/apps/x/packages/core/src/runtime/tools/domains/models.ts +++ b/apps/x/packages/core/src/runtime/tools/domains/models.ts @@ -6,9 +6,7 @@ import { z } from "zod"; import { getDefaultModelAndProvider } from "../../../models/defaults.js"; import { listGatewayModels } from "../../../models/gateway.js"; import { isSignedIn } from "../../../account/account.js"; -import { - BuiltinToolsSchema, -} from "./support.js"; +import { BuiltinToolsSchema } from "../types.js"; export const modelTools: z.infer = { diff --git a/apps/x/packages/core/src/runtime/tools/domains/notifications.ts b/apps/x/packages/core/src/runtime/tools/domains/notifications.ts index 5d364ffc..5e488c11 100644 --- a/apps/x/packages/core/src/runtime/tools/domains/notifications.ts +++ b/apps/x/packages/core/src/runtime/tools/domains/notifications.ts @@ -8,9 +8,7 @@ import type { ToolContext } from "../exec-tool.js"; import { getCurrentUseCase } from "../../../analytics/use_case.js"; import type { INotificationService } from "../../../application/notification/service.js"; import { notifyIfEnabled } from "../../../application/notification/notifier.js"; -import { - BuiltinToolsSchema, -} from "./support.js"; +import { BuiltinToolsSchema } from "../types.js"; export const notificationTools: z.infer = { diff --git a/apps/x/packages/core/src/runtime/tools/domains/parsing.ts b/apps/x/packages/core/src/runtime/tools/domains/parsing.ts index 8d8cde4e..11007e44 100644 --- a/apps/x/packages/core/src/runtime/tools/domains/parsing.ts +++ b/apps/x/packages/core/src/runtime/tools/domains/parsing.ts @@ -10,11 +10,36 @@ import { createLanguageModel } from "../../../models/models.js"; import { getDefaultModelAndProvider, resolveProviderConfig } from "../../../models/defaults.js"; import { captureLlmUsage } from "../../../analytics/usage.js"; import { getCurrentUseCase, withUseCase } from "../../../analytics/use_case.js"; -import { - _importDynamic, - BuiltinToolsSchema, - LLMPARSE_MIME_TYPES, -} from "./support.js"; +import { BuiltinToolsSchema } from "../types.js"; + + + +// Parser libraries are loaded dynamically inside parseFile.execute() +// to avoid pulling pdfjs-dist's DOM polyfills into the main bundle. +// Import paths are computed so esbuild cannot statically resolve them. +// eslint-disable-next-line @typescript-eslint/no-explicit-any +const _importDynamic = new Function('mod', 'return import(mod)') as (mod: string) => Promise; + +const LLMPARSE_MIME_TYPES: Record = { + '.pdf': 'application/pdf', + '.docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + '.doc': 'application/msword', + '.pptx': 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + '.xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + '.xls': 'application/vnd.ms-excel', + '.csv': 'text/csv', + '.txt': 'text/plain', + '.html': 'text/html', + '.png': 'image/png', + '.jpg': 'image/jpeg', + '.jpeg': 'image/jpeg', + '.gif': 'image/gif', + '.webp': 'image/webp', + '.svg': 'image/svg+xml', + '.bmp': 'image/bmp', + '.tiff': 'image/tiff', +}; + export const parsingTools: z.infer = { diff --git a/apps/x/packages/core/src/runtime/tools/domains/shell.ts b/apps/x/packages/core/src/runtime/tools/domains/shell.ts index 36371c13..e1a7a523 100644 --- a/apps/x/packages/core/src/runtime/tools/domains/shell.ts +++ b/apps/x/packages/core/src/runtime/tools/domains/shell.ts @@ -8,9 +8,7 @@ import { executeCommand, executeCommandAbortable } from "../../../application/li import { agentSlackShimEnv } from "../../../slack/agent-slack-exec.js"; import { WorkDir } from "../../../config/config.js"; import type { ToolContext } from "../exec-tool.js"; -import { - BuiltinToolsSchema, -} from "./support.js"; +import { BuiltinToolsSchema } from "../types.js"; export const shellTools: z.infer = { diff --git a/apps/x/packages/core/src/runtime/tools/domains/support.ts b/apps/x/packages/core/src/runtime/tools/domains/support.ts deleted file mode 100644 index 0391cd3e..00000000 --- a/apps/x/packages/core/src/runtime/tools/domains/support.ts +++ /dev/null @@ -1,133 +0,0 @@ -// Shared support for the builtin-tools domain modules: the catalog schema -// and the helpers/input-schemas the tool entries use. Extracted verbatim -// from the historical monolith. - -import { z, ZodType } from "zod"; -import * as path from "path"; -import * as os from "os"; -import container from "../../../di/container.js"; -import { BackgroundTaskSchema, TriggersSchema } from "@x/shared/dist/background-task.js"; -import type { CodeRunEvent as CodeRunEventType } from "@x/shared/dist/code-mode.js"; -import type { ICodeProjectsRepo } from "../../../code-mode/projects/repo.js"; -import * as gitService from "../../../code-mode/git/service.js"; - -// Inputs for the bg-task builtin tools. Reuse the canonical schema field -// descriptions; only `triggers` gets a tighter contextual override (the -// shared TriggersSchema description is written from the live-note perspective). -export const CreateBackgroundTaskInput = BackgroundTaskSchema.pick({ - name: true, - instructions: true, - triggers: true, - model: true, - provider: true, -}).extend({ - triggers: TriggersSchema.optional().describe('All three sub-fields (cronExpr, windows, eventMatchCriteria) are independently optional — mix freely. No triggers at all = manual-only (user clicks Run).'), - projectDir: z.string().optional().describe( - "Set this ONLY when the user wants the task to WRITE CODE. An absolute path (or ~/…) to a LOCAL GIT REPOSITORY with at least one commit. It turns this into a *coding task*: each run scans the trigger source for actionable items and implements them autonomously in isolated git worktrees off this repo — never touching the user's checkout. Extract the directory from the user's request (e.g. 'use ~/Work/space/test as the work directory'). Omit for ordinary output/action tasks.", - ), -}); - -export const PatchBackgroundTaskInput = BackgroundTaskSchema.pick({ - name: true, - instructions: true, - active: true, - triggers: true, - model: true, - provider: true, -}).partial().extend({ - slug: z.string().describe('The slug of the task to update (the folder name under bg-tasks/).'), - triggers: TriggersSchema.optional().describe('Replace the triggers object. To remove all triggers (make manual-only) pass an empty object.'), - projectDir: z.string().optional().describe("Point an existing task at a code repo (or change which one) to make it a coding task. Absolute path or ~/… to a local git repository with at least one commit. Same rules as on create."), - clearModel: z.boolean().optional().describe("Reset the task's model/provider override so it falls back to the default. Use this to unstick a bad/rejected model value (do not also pass model)."), -}); - -// Turn a user-supplied directory into a registered code project id. Reuses the -// same idempotent registry the Code-section picker writes to (add() validates the -// dir exists & is a directory, and dedupes by resolved path). Returns a soft -// `warning` — not an error — when the repo isn't yet worktree-ready, so the task -// still gets created and the copilot can tell the user what to fix. -export function expandHome(p: string): string { - const t = p.trim(); - if (t === '~') return os.homedir(); - if (t.startsWith('~/') || t.startsWith(`~${path.sep}`)) return path.join(os.homedir(), t.slice(2)); - return t; -} - -// Shrink a code-run timeline for durable storage: consecutive same-role message -// chunks merge into one event. Display-lossless — the timeline renderer -// concatenates consecutive messages anyway (CodingRunTimeline) — and typically -// collapses the ~90% of a run's events that are per-token text deltas. -// Everything else (tool calls/updates, plans, permissions) is kept verbatim in -// order: updates are id-keyed transitions and must not be merged. -export function coalesceCodeRunEvents(events: CodeRunEventType[]): CodeRunEventType[] { - const out: CodeRunEventType[] = []; - for (const event of events) { - const last = out[out.length - 1]; - if ( - event.type === 'message' && last?.type === 'message' && last.role === event.role - ) { - out[out.length - 1] = { ...last, text: last.text + event.text }; - } else { - out.push(event); - } - } - return out; -} - -export async function resolveCodeProject(dirPath: string): Promise< - { ok: true; projectId: string; path: string; warning?: string } | { ok: false; error: string } -> { - const abs = path.resolve(expandHome(dirPath)); - const projectsRepo = container.resolve('codeProjectsRepo'); - let project: Awaited>; - try { - project = await projectsRepo.add(abs); - } catch (err) { - return { ok: false, error: `Could not use '${dirPath}' as a code directory: ${err instanceof Error ? err.message : String(err)}` }; - } - // Worktree isolation needs a real git repo with at least one commit - // (codeSessionService.create throws otherwise). Surface it now as a soft - // warning rather than letting the next run fail silently. - let warning: string | undefined; - try { - const info = await gitService.repoInfo(project.path); - if (!info.isGitRepo) warning = `${project.path} is not a git repository yet — run \`git init\` and make a commit, or the coding sessions will fail.`; - else if (!info.hasCommits) warning = `${project.path} has no commits yet — make an initial commit, or the coding sessions will fail.`; - } catch { /* best effort — worktree creation will surface it later */ } - return { ok: true, projectId: project.id, path: project.path, ...(warning ? { warning } : {}) }; -} -// Parser libraries are loaded dynamically inside parseFile.execute() -// to avoid pulling pdfjs-dist's DOM polyfills into the main bundle. -// Import paths are computed so esbuild cannot statically resolve them. -// eslint-disable-next-line @typescript-eslint/no-explicit-any -export const _importDynamic = new Function('mod', 'return import(mod)') as (mod: string) => Promise; - -export const BuiltinToolsSchema = z.record(z.string(), z.object({ - description: z.string(), - inputSchema: z.custom(), - execute: z.function({ - input: z.any(), // (input, ctx?) => Promise - output: z.promise(z.any()), - }), - isAvailable: z.custom<() => Promise>().optional(), -})); - -export const LLMPARSE_MIME_TYPES: Record = { - '.pdf': 'application/pdf', - '.docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - '.doc': 'application/msword', - '.pptx': 'application/vnd.openxmlformats-officedocument.presentationml.presentation', - '.xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - '.xls': 'application/vnd.ms-excel', - '.csv': 'text/csv', - '.txt': 'text/plain', - '.html': 'text/html', - '.png': 'image/png', - '.jpg': 'image/jpeg', - '.jpeg': 'image/jpeg', - '.gif': 'image/gif', - '.webp': 'image/webp', - '.svg': 'image/svg+xml', - '.bmp': 'image/bmp', - '.tiff': 'image/tiff', -}; diff --git a/apps/x/packages/core/src/runtime/tools/domains/web.ts b/apps/x/packages/core/src/runtime/tools/domains/web.ts index 9b9c5ad2..e3d40829 100644 --- a/apps/x/packages/core/src/runtime/tools/domains/web.ts +++ b/apps/x/packages/core/src/runtime/tools/domains/web.ts @@ -9,9 +9,7 @@ import { WorkDir } from "../../../config/config.js"; import { isSignedIn } from "../../../account/account.js"; import { getAccessToken } from "../../../auth/tokens.js"; import { API_URL } from "../../../config/env.js"; -import { - BuiltinToolsSchema, -} from "./support.js"; +import { BuiltinToolsSchema } from "../types.js"; export const webSearchTools: z.infer = { diff --git a/apps/x/packages/core/src/runtime/tools/paths.ts b/apps/x/packages/core/src/runtime/tools/paths.ts new file mode 100644 index 00000000..80fc0528 --- /dev/null +++ b/apps/x/packages/core/src/runtime/tools/paths.ts @@ -0,0 +1,18 @@ +// Lenient ~-expansion for user-supplied paths in tool inputs. Distinct from +// filesystem/files.ts' private expandHomePath, which throws on empty input — +// tool entries want pass-through semantics for their own validation. + +import * as path from "path"; +import * as os from "os"; + +// Turn a user-supplied directory into a registered code project id. Reuses the +// same idempotent registry the Code-section picker writes to (add() validates the +// dir exists & is a directory, and dedupes by resolved path). Returns a soft +// `warning` — not an error — when the repo isn't yet worktree-ready, so the task +// still gets created and the copilot can tell the user what to fix. +export function expandHome(p: string): string { + const t = p.trim(); + if (t === '~') return os.homedir(); + if (t.startsWith('~/') || t.startsWith(`~${path.sep}`)) return path.join(os.homedir(), t.slice(2)); + return t; +} diff --git a/apps/x/packages/core/src/runtime/tools/types.ts b/apps/x/packages/core/src/runtime/tools/types.ts new file mode 100644 index 00000000..082d4254 --- /dev/null +++ b/apps/x/packages/core/src/runtime/tools/types.ts @@ -0,0 +1,15 @@ +// The builtin-tool catalog schema: every entry is {description, inputSchema, +// execute, isAvailable?}. Shared typing for the domain modules and the +// merged catalog. + +import { z, ZodType } from "zod"; + +export const BuiltinToolsSchema = z.record(z.string(), z.object({ + description: z.string(), + inputSchema: z.custom(), + execute: z.function({ + input: z.any(), // (input, ctx?) => Promise + output: z.promise(z.any()), + }), + isAvailable: z.custom<() => Promise>().optional(), +})); From a3d2ddf34cc026a6f406ab272361b5bf2213a4a5 Mon Sep 17 00:00:00 2001 From: Ramnique Singh <30795890+ramnique@users.noreply.github.com> Date: Fri, 10 Jul 2026 11:52:40 +0530 Subject: [PATCH 3/8] docs(x): design docs and prompt catalogs follow the runtime/ move MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Path pass over turn-runtime-design.md, session-design.md, VIDEO_MODE.md, and LIVE_NOTE.md: every source pointer updated to the runtime/ layout, the turn doc's suggested-module-layout section (§28) refreshed to the real tree (it predated the event hub, bridges, and composer), and the session doc's §14 layout fixed including its old §11/§14 contradiction about where the headless runner lives. Co-Authored-By: Claude Fable 5 --- apps/x/LIVE_NOTE.md | 14 +++++----- apps/x/VIDEO_MODE.md | 10 +++---- apps/x/packages/core/docs/session-design.md | 13 ++++++--- .../packages/core/docs/turn-runtime-design.md | 27 +++++++++---------- 4 files changed, 34 insertions(+), 30 deletions(-) diff --git a/apps/x/LIVE_NOTE.md b/apps/x/LIVE_NOTE.md index d8a157d7..85f16786 100644 --- a/apps/x/LIVE_NOTE.md +++ b/apps/x/LIVE_NOTE.md @@ -326,7 +326,7 @@ Three branches by `trigger`: ### 5. Live Note skill (Copilot-facing) - **Purpose**: teaches Copilot the `live:` model — operational posture (act-first), the strong/medium/anti-signal taxonomy and how to act on each, the **always-extend-not-fork** rule for already-live notes, user-facing language (call them "live notes"; surface the **Live Note panel** by name), the auto-run-once-on-create/edit default, schema, triggers, YAML-safety rules, insertion workflow, and the `run-live-note-agent` tool with `context` backfills. -- **File**: `packages/core/src/application/assistant/skills/live-note/skill.ts`. Exported `skill` constant. +- **File**: `packages/core/src/runtime/assembly/skills/live-note/skill.ts`. Exported `skill` constant. - **Schema interpolation**: at module load, `stringifyYaml(z.toJSONSchema(LiveNoteSchema))` is interpolated into the "Canonical Schema" section. Edits to `LiveNoteSchema` propagate automatically. - **Output**: markdown, injected into the Copilot system prompt when `loadSkill('live-note')` fires. - **Invoked by**: Copilot's `loadSkill` builtin tool. Registration in `skills/index.ts`. @@ -334,7 +334,7 @@ Three branches by `trigger`: ### 6. Copilot trigger paragraph - **Purpose**: tells Copilot *when* to load the `live-note` skill, and frames how aggressively to act once loaded. -- **File**: `packages/core/src/application/assistant/instructions.ts` (look for the "Live Notes" paragraph). +- **File**: `packages/core/src/runtime/assembly/copilot/instructions.ts` (look for the "Live Notes" paragraph). - **Strong signals (load + act without asking)**: cadence words ("every morning / daily / hourly…"), living-document verbs ("keep a running summary of…", "maintain a digest of…"), watch/monitor verbs, pin-live framings ("always show the latest X here"), direct ("track / follow X"), event-conditional ("whenever a relevant email comes in…"). - **Medium signals (load + answer the one-off + offer)**: time-decaying questions ("what's the weather?", "USD/INR right now?", "service X status?"), note-anchored snapshots ("show me my schedule here"), recurring artifacts ("morning briefing", "weekly review", "Acme dashboard"), topic-following / catch-up. - **Anti-signals (do NOT make live)**: definitional questions, one-off lookups, manual document editing. @@ -343,7 +343,7 @@ Three branches by `trigger`: ### 7. `run-live-note-agent` tool — `context` parameter description - **Purpose**: a mini-prompt (a Zod `.describe()`) that guides Copilot on when to pass extra context for a run. -- **File**: `packages/core/src/application/lib/builtin-tools.ts` (the `run-live-note-agent` tool definition). +- **File**: `packages/core/src/runtime/tools/catalog.ts` (the `run-live-note-agent` tool definition). - **Inputs**: `filePath` (workspace-relative; the tool strips the `knowledge/` prefix internally), optional `context`. - **Output**: flows into `runLiveNoteAgent(..., 'manual')` → `buildMessage` → appended as `**Context:**` in the agent message. - **Key use case**: backfill a newly-made-live note so its body isn't empty on day 1. @@ -394,10 +394,10 @@ Conventions: | Deprecated Today.md one-time migration | `packages/core/src/knowledge/deprecate_today_note.ts` | | Gmail event producer | `packages/core/src/knowledge/sync_gmail.ts` | | Calendar event producer + digest | `packages/core/src/knowledge/sync_calendar.ts` | -| Copilot skill | `packages/core/src/application/assistant/skills/live-note/skill.ts` | -| Skill registration | `packages/core/src/application/assistant/skills/index.ts` | -| Copilot trigger paragraph | `packages/core/src/application/assistant/instructions.ts` | -| `run-live-note-agent` builtin tool | `packages/core/src/application/lib/builtin-tools.ts` | +| Copilot skill | `packages/core/src/runtime/assembly/skills/live-note/skill.ts` | +| Skill registration | `packages/core/src/runtime/assembly/skills/index.ts` | +| Copilot trigger paragraph | `packages/core/src/runtime/assembly/copilot/instructions.ts` | +| `run-live-note-agent` builtin tool | `packages/core/src/runtime/tools/catalog.ts` | | Editor toolbar (Radio button → panel) | `apps/renderer/src/components/editor-toolbar.tsx` | | Live Note panel (single-view editor) | `apps/renderer/src/components/live-note-sidebar.tsx` | | Status hook (`useLiveNoteAgentStatus`) | `apps/renderer/src/hooks/use-live-note-agent-status.ts` | diff --git a/apps/x/VIDEO_MODE.md b/apps/x/VIDEO_MODE.md index 15549906..abfeaf07 100644 --- a/apps/x/VIDEO_MODE.md +++ b/apps/x/VIDEO_MODE.md @@ -108,7 +108,7 @@ is live) to the outgoing message as `UserImagePart`s and sets (`data`, `mediaType`), `source: 'camera' | 'screen'`, `capturedAt`. Unlike file attachments (path references read via the `LLMParse` tool), image parts go to the model as real multimodal image parts. -- `packages/core/src/agents/message-encoding.ts` `convertFromMessages`: +- `packages/core/src/runtime/assembly/message-encoding.ts` `convertFromMessages`: emits a context line (frame counts + time span), then labeled groups — a `"Webcam frames (oldest to newest):"` text part before camera images and a `"Screen-share frames (oldest to newest):"` text part before screen @@ -176,11 +176,11 @@ Push-to-talk is disabled while a call owns the mic. | Prompt | Where | |--------|-------| -| `# Video Mode (Live Camera)` system section — how to use webcam frames, coaching guidance, screen-share rules ("treat the screen as the primary subject", "last screen frame is current"), etiquette (never comment on appearance) | `packages/core/src/application/assistant/capabilities/modes.ts` (the `VIDEO_MODE` fragment of the `video-mode` capability, composed by `agents/compose-instructions.ts`) | +| `# Video Mode (Live Camera)` system section — how to use webcam frames, coaching guidance, screen-share rules ("treat the screen as the primary subject", "last screen frame is current"), etiquette (never comment on appearance) | `packages/core/src/runtime/assembly/capabilities/modes.ts` (the `VIDEO_MODE` fragment of the `video-mode` capability, composed by `agents/compose-instructions.ts`) | | `# Practice Session (Coach Mode)` system section — coaching persona: specific/actionable feedback after each take, one-sentence interjections mid-flow, structured debrief on wrap-up | `capabilities/modes.ts` (the `COACH_MODE` fragment, directly after the video capability) | -| "Driving the app" paragraph in the video-mode section — on calls, prefer app-navigation read-view/open-item (show while telling) over describing or squinting at frames | same `# Video Mode` section; full action docs in the `app-navigation` skill (`application/assistant/skills/app-navigation/skill.ts`) | -| Per-message frame context line `[Video mode: N live webcam frames … and M frames of the user's shared screen …]` + group labels | `packages/core/src/agents/runtime.ts` (`convertFromMessages`) | -| `videoMode` / `coachMode` composition overrides (session-sticky; flips bust prefix cache) | `packages/core/src/turns/bridges/real-agent-resolver.ts` (`CompositionOverrides`); set from `App.tsx` `sendConfig` | +| "Driving the app" paragraph in the video-mode section — on calls, prefer app-navigation read-view/open-item (show while telling) over describing or squinting at frames | same `# Video Mode` section; full action docs in the `app-navigation` skill (`runtime/assembly/skills/app-navigation/skill.ts`) | +| Per-message frame context line `[Video mode: N live webcam frames … and M frames of the user's shared screen …]` + group labels | `packages/core/src/runtime/legacy/engine.ts` (`convertFromMessages`) | +| `videoMode` / `coachMode` composition overrides (session-sticky; flips bust prefix cache) | `packages/core/src/runtime/turns/bridges/real-agent-resolver.ts` (`CompositionOverrides`); set from `App.tsx` `sendConfig` | Voice input/output prompt sections (`# Voice Input`, `# Voice Output`) are reused untouched — calls set `voiceInput` per utterance and force diff --git a/apps/x/packages/core/docs/session-design.md b/apps/x/packages/core/docs/session-design.md index ab4f122d..f92acd47 100644 --- a/apps/x/packages/core/docs/session-design.md +++ b/apps/x/packages/core/docs/session-design.md @@ -520,16 +520,21 @@ All tests use the in-memory/mocked turn runtime and repo fakes. ## 14. Suggested module layout ```text -apps/x/packages/shared/src/sessions.ts # event schemas, reducer, index types +apps/x/packages/shared/src/sessions.ts # event schemas, reducer, index types -apps/x/packages/core/src/sessions/ +apps/x/packages/core/src/runtime/sessions/ sessions.ts # ISessions implementation + api.ts # public contract repo.ts # ISessionRepo contract fs-repo.ts # filesystem implementation - index.ts # in-memory index + startup scan - headless.ts # runHeadlessTurn + session-index.ts # in-memory index + bus.ts # index-changed fan-out ``` +The headless helper of §11 is implemented as `HeadlessAgentRunner` in +`runtime/assembly/headless.ts` (not under `sessions/`). + + Awilix registration mirrors the turn runtime: singleton scope, PROXY constructor injection, no container resolution from inside the classes. diff --git a/apps/x/packages/core/docs/turn-runtime-design.md b/apps/x/packages/core/docs/turn-runtime-design.md index d487aa90..8abee863 100644 --- a/apps/x/packages/core/docs/turn-runtime-design.md +++ b/apps/x/packages/core/docs/turn-runtime-design.md @@ -1888,21 +1888,20 @@ tests for: This is a suggested organization, not a locked implementation requirement: ```text -apps/x/packages/shared/src/turns.ts +apps/x/packages/shared/src/turns.ts # durable schemas + reducer (unchanged home) -apps/x/packages/core/src/turns/ - runtime.ts - reducer.ts # if implementation is re-exported through shared, - # locate pure code to avoid dependency cycles - repo.ts - fs-repo.ts - stream.ts - agent-resolver.ts - context-resolver.ts - model-registry.ts - tool-registry.ts - permission.ts - index.ts +apps/x/packages/core/src/runtime/ + turns/ # the engine: runtime.ts, stream, event-hub, context + # resolution/elision, request composer, repos, inspect-cli + bridges/ # real implementations of the engine's seams (agent/tool/ + # model resolvers, permission checker/classifier) + sessions/ # session layer (session-design.md) + assembly/ # what an agent is: registry, compose-instructions, + # workspace-context, message-encoding, permission-metadata, + # headless runners, spawn-agent, copilot/, capabilities/, + # skills/ + tools/ # builtin-tool catalog + domain modules + exec plumbing + legacy/ # the dying runs engine (engine.ts + runs.ts + repos) ``` The final reducer location must permit both core and renderer to use exactly the From 24fb0d38e5f35000f9cc555a81729faed19d0ffe Mon Sep 17 00:00:00 2001 From: Ramnique Singh <30795890+ramnique@users.noreply.github.com> Date: Fri, 10 Jul 2026 16:17:07 +0530 Subject: [PATCH 4/8] fix(x): skill catalog advertises the post-reorg path; legacy path stays an alias MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The bundled-skill CATALOG_PREFIX still pointed at the deleted src/application/assistant/skills tree, so the system prompt and the loadSkill example advertised paths that no longer exist — while the real post-reorg path (src/runtime/assembly/skills) was NOT a resolvable alias, so a model referencing the actual source tree got 'Skill not found'. The new path is now canonical in the catalog and tool description; the old prefix is kept as a loadSkill alias because agent snapshots baked before the reorg still carry it. Regression test pins both. Co-Authored-By: Claude Fable 5 --- .../src/runtime/assembly/skills/index.test.ts | 16 ++++++++++++++-- .../core/src/runtime/assembly/skills/index.ts | 7 ++++++- .../x/packages/core/src/runtime/tools/catalog.ts | 2 +- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/apps/x/packages/core/src/runtime/assembly/skills/index.test.ts b/apps/x/packages/core/src/runtime/assembly/skills/index.test.ts index 71056630..5491bcb6 100644 --- a/apps/x/packages/core/src/runtime/assembly/skills/index.test.ts +++ b/apps/x/packages/core/src/runtime/assembly/skills/index.test.ts @@ -103,7 +103,7 @@ describe("skills index (disk skill merge layer)", () => { const skills = await loadSkillsIndex(); const resolved = skills.resolveSkill("meeting-prep"); - expect(resolved?.catalogPath).toBe("src/application/assistant/skills/meeting-prep/skill.ts"); + expect(resolved?.catalogPath).toBe("src/runtime/assembly/skills/meeting-prep/skill.ts"); expect(resolved?.content).not.toContain("DISK CONTENT MARKER"); const catalog = skills.buildSkillCatalog(); @@ -178,7 +178,7 @@ describe("capability activation boundary", () => { summary: "a genuine model-activated skill", content: "guidance", tools: ["file-readText"], - catalogPath: "src/application/assistant/skills/real-skill/skill.ts", + catalogPath: "src/runtime/assembly/skills/real-skill/skill.ts", }; const mixed = [model, eager]; @@ -199,6 +199,18 @@ describe("capability activation boundary", () => { expect(catalog).toContain(id); } }); + + it("resolves bundled skills by the advertised path and by the pre-reorg legacy path", async () => { + // The catalog advertises the post-reorg source path; agent snapshots baked + // before the move still reference the old application/assistant prefix. + // Both must resolve to the same skill. + const { resolveSkill } = await loadSkillsIndex(); + const advertised = resolveSkill("src/runtime/assembly/skills/meeting-prep/skill.ts"); + const legacy = resolveSkill("src/application/assistant/skills/meeting-prep/skill.ts"); + expect(advertised?.id).toBe("meeting-prep"); + expect(legacy?.id).toBe("meeting-prep"); + expect(legacy?.content).toBe(advertised?.content); + }); }); describe("availability (catalog visibility)", () => { diff --git a/apps/x/packages/core/src/runtime/assembly/skills/index.ts b/apps/x/packages/core/src/runtime/assembly/skills/index.ts index a1d35a9b..8d89697d 100644 --- a/apps/x/packages/core/src/runtime/assembly/skills/index.ts +++ b/apps/x/packages/core/src/runtime/assembly/skills/index.ts @@ -31,7 +31,10 @@ import appsSkill from "./apps/skill.js"; import slackSkill from "./slack/skill.js"; const CURRENT_DIR = path.dirname(fileURLToPath(import.meta.url)); -const CATALOG_PREFIX = "src/application/assistant/skills"; +const CATALOG_PREFIX = "src/runtime/assembly/skills"; +// Pre-reorg home of the bundled skills. Agent snapshots baked before the move +// carry loadSkill references under this prefix, so it stays a resolvable alias. +const LEGACY_CATALOG_PREFIX = "src/application/assistant/skills"; // console.log(liveNoteSkill); @@ -355,6 +358,8 @@ for (const entry of bundledEntries) { `skills/${entry.id}/skill.js`, `${CATALOG_PREFIX}/${entry.id}/skill.ts`, `${CATALOG_PREFIX}/${entry.id}/skill.js`, + `${LEGACY_CATALOG_PREFIX}/${entry.id}/skill.ts`, + `${LEGACY_CATALOG_PREFIX}/${entry.id}/skill.js`, absoluteTs, absoluteJs, ]; diff --git a/apps/x/packages/core/src/runtime/tools/catalog.ts b/apps/x/packages/core/src/runtime/tools/catalog.ts index 3a89d86e..dd5b97ea 100644 --- a/apps/x/packages/core/src/runtime/tools/catalog.ts +++ b/apps/x/packages/core/src/runtime/tools/catalog.ts @@ -39,7 +39,7 @@ export const BuiltinTools: z.infer = { loadSkill: { description: "Load a Rowboat skill definition into context by fetching its guidance string", inputSchema: z.object({ - skillName: z.string().describe("Skill identifier or path (e.g., 'workflow-run-ops' or 'src/application/assistant/skills/workflow-run-ops/skill.ts')"), + skillName: z.string().describe("Skill identifier or path (e.g., 'workflow-run-ops' or 'src/runtime/assembly/skills/workflow-run-ops/skill.ts')"), }), execute: async ({ skillName }: { skillName: string }) => { const resolved = resolveSkill(skillName); From de84b2e9ce7c31935f985023b90140c558a539c2 Mon Sep 17 00:00:00 2001 From: Ramnique Singh <30795890+ramnique@users.noreply.github.com> Date: Fri, 10 Jul 2026 16:18:57 +0530 Subject: [PATCH 5/8] fix(x): real-permission-checker test types against permission-metadata, not the legacy engine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Phase A extraction moved getToolPermissionMetadata to assembly/permission-metadata.ts but this test's type-only import was mechanically retargeted to legacy/engine.js during the tree move, where the symbol is imported rather than exported — a TS2459 that vitest and the build tsconfig never see, and one of the last live->legacy edges. Co-Authored-By: Claude Fable 5 --- .../src/runtime/turns/bridges/real-permission-checker.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/x/packages/core/src/runtime/turns/bridges/real-permission-checker.test.ts b/apps/x/packages/core/src/runtime/turns/bridges/real-permission-checker.test.ts index 64d65ca8..efafc0d2 100644 --- a/apps/x/packages/core/src/runtime/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 "../../legacy/engine.js"; +import type { getToolPermissionMetadata } from "../../assembly/permission-metadata.js"; import { RealPermissionChecker } from "./real-permission-checker.js"; type MetadataFn = typeof getToolPermissionMetadata; From 05eb94cd3a7570195483d55ce78ea4dbbff3a4ea Mon Sep 17 00:00:00 2001 From: Ramnique Singh <30795890+ramnique@users.noreply.github.com> Date: Fri, 10 Jul 2026 16:19:25 +0530 Subject: [PATCH 6/8] fix(x): FakeTurnEventBus satisfies ITurnEventBus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The interface grew subscribe/subscribeAll when the IPC bridge moved to resolving ITurnEventBus, but the runtime-test fake still only had publish — a TS2739 invisible to vitest and the build tsconfig. The fake now declares 'implements ITurnEventBus' so the next interface change fails loudly here instead of silently drifting. Co-Authored-By: Claude Fable 5 --- apps/x/packages/core/src/runtime/turns/runtime.test.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/x/packages/core/src/runtime/turns/runtime.test.ts b/apps/x/packages/core/src/runtime/turns/runtime.test.ts index 9bc8b072..ef8ea96c 100644 --- a/apps/x/packages/core/src/runtime/turns/runtime.test.ts +++ b/apps/x/packages/core/src/runtime/turns/runtime.test.ts @@ -15,6 +15,7 @@ import type { IAgentResolver } from "./agent-resolver.js"; import type { TurnExecution, TurnOutcome } from "./api.js"; import { TurnDependencyError, TurnInputError } from "./api.js"; import type { TurnLifecycleEvent } from "./bus.js"; +import type { ITurnEventBus } from "./event-hub.js"; import { TurnRepoContextResolver } from "./context-resolver.js"; import { InMemoryTurnRepo } from "./in-memory-turn-repo.js"; import type { @@ -278,11 +279,17 @@ class FakeBus { } } -class FakeTurnEventBus { +class FakeTurnEventBus implements ITurnEventBus { events: TurnBusEvent[] = []; publish(event: TurnBusEvent): void { this.events.push(event); } + subscribe(): () => void { + return () => {}; + } + subscribeAll(): () => void { + return () => {}; + } } class FakeIdGen { From 02912ba9efe763275d09548ec2f5bd44771cf3e0 Mon Sep 17 00:00:00 2001 From: Ramnique Singh <30795890+ramnique@users.noreply.github.com> Date: Fri, 10 Jul 2026 16:21:21 +0530 Subject: [PATCH 7/8] fix(x): clear remaining tsc drift in runtime test fixtures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Same class as the two review findings — type errors only tsc sees (tests run untyped under vitest; the build tsconfig excludes them): - headless.test.ts read .agent.overrides without narrowing the RequestedAgent union; the assertions now compare the whole agent object, which is also stricter - real-agent-resolver.test.ts's byte-identity fixture predates the videoMode/coachMode flags (explicit false = the schema defaults, so the composed bytes are unchanged) - real-tool-registry.test.ts's permission asks predate isRead being required (options: [] was from the older ask shape) npx tsc --noEmit -p tsconfig.json is now clean for the whole package. Co-Authored-By: Claude Fable 5 --- apps/x/packages/core/src/runtime/assembly/headless.test.ts | 7 ++++--- .../src/runtime/turns/bridges/real-agent-resolver.test.ts | 2 ++ .../src/runtime/turns/bridges/real-tool-registry.test.ts | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/apps/x/packages/core/src/runtime/assembly/headless.test.ts b/apps/x/packages/core/src/runtime/assembly/headless.test.ts index 2e67d298..a099a33e 100644 --- a/apps/x/packages/core/src/runtime/assembly/headless.test.ts +++ b/apps/x/packages/core/src/runtime/assembly/headless.test.ts @@ -252,7 +252,7 @@ describe("HeadlessAgentRunner", () => { const { runner, resolve } = createRunner(runtime); await runner.start({ agentId: "worker", message: "go" }); expect(resolve).not.toHaveBeenCalled(); - expect(runtime.createInputs[0].agent.overrides).toBeUndefined(); + expect(runtime.createInputs[0].agent).toEqual({ agentId: "worker" }); }); it("uses an injected default only for a partial model override", async () => { @@ -264,8 +264,9 @@ describe("HeadlessAgentRunner", () => { model: "custom-model", }); expect(resolve).toHaveBeenCalledOnce(); - expect(runtime.createInputs[0].agent.overrides).toEqual({ - model: { provider: "default-provider", model: "custom-model" }, + expect(runtime.createInputs[0].agent).toEqual({ + agentId: "worker", + overrides: { model: { provider: "default-provider", model: "custom-model" } }, }); }); diff --git a/apps/x/packages/core/src/runtime/turns/bridges/real-agent-resolver.test.ts b/apps/x/packages/core/src/runtime/turns/bridges/real-agent-resolver.test.ts index ac6c0c74..cd28c6cd 100644 --- a/apps/x/packages/core/src/runtime/turns/bridges/real-agent-resolver.test.ts +++ b/apps/x/packages/core/src/runtime/turns/bridges/real-agent-resolver.test.ts @@ -163,6 +163,8 @@ describe("RealAgentResolver", () => { searchEnabled: true, codeMode: "claude", codeCwd: null, + videoMode: false, + coachMode: false, }), ); }); diff --git a/apps/x/packages/core/src/runtime/turns/bridges/real-tool-registry.test.ts b/apps/x/packages/core/src/runtime/turns/bridges/real-tool-registry.test.ts index 41e3f3a1..59a44fbb 100644 --- a/apps/x/packages/core/src/runtime/turns/bridges/real-tool-registry.test.ts +++ b/apps/x/packages/core/src/runtime/turns/bridges/real-tool-registry.test.ts @@ -153,11 +153,11 @@ describe("RealToolRegistry", () => { const chunk = { type: "message", role: "agent", text: "hi" } as const; const resolution = { type: "permission", - ask: { toolCallId: "x", title: "write file", options: [] }, + ask: { toolCallId: "x", title: "write file", isRead: false }, decision: "allow_once", auto: false, } as const; - const ask = { toolCallId: "x", title: "write file", options: [] }; + const ask = { toolCallId: "x", title: "write file", isRead: false }; const { registry } = makeRegistry(async ({ ctx }) => { // Chatty stream events are ephemeral (CodeRunFeed) — NOT progress. await ctx.publish({ From 6a8e67878dc1c7b450c7e2783afa1fda4a02cb6b Mon Sep 17 00:00:00 2001 From: Ramnique Singh <30795890+ramnique@users.noreply.github.com> Date: Fri, 10 Jul 2026 16:27:06 +0530 Subject: [PATCH 8/8] =?UTF-8?q?ci(x):=20typecheck=20test=20files=20?= =?UTF-8?q?=E2=80=94=20the=20gap=20vitest=20and=20the=20build=20tsconfigs?= =?UTF-8?q?=20both=20miss?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test files were typechecked by nothing: tsconfig.build.json excludes them (correctly — they must not land in dist), and vitest transforms with esbuild, which strips types without checking them. That gap is where the review's two tsc breaks and the fixture drift accumulated. Adds 'typecheck' scripts per package (dev tsconfigs, which include src/**/*.test.ts; renderer reuses its existing tsc -b), a root orchestrator mirroring the test script, and a CI step in the vitest job. All three packages are currently clean. Co-Authored-By: Claude Fable 5 --- .github/workflows/x-tests.yml | 6 ++++++ CLAUDE.md | 1 + apps/x/apps/renderer/package.json | 1 + apps/x/package.json | 6 +++++- apps/x/packages/core/package.json | 1 + apps/x/packages/shared/package.json | 1 + 6 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/x-tests.yml b/.github/workflows/x-tests.yml index 9e8b1c7d..c08c4095 100644 --- a/.github/workflows/x-tests.yml +++ b/.github/workflows/x-tests.yml @@ -34,6 +34,12 @@ jobs: - name: Run apps/x Vitest suites run: npm test + # Typechecks with the dev tsconfigs, which include test files — + # the build tsconfigs exclude them and vitest strips types without + # checking, so this is the only gate that sees type errors in tests. + - name: Typecheck apps/x packages + run: npm run typecheck + apps-x-electron-package: name: apps/x Electron package smoke test runs-on: ubuntu-latest diff --git a/CLAUDE.md b/CLAUDE.md index e0989688..a5fe24c8 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -139,6 +139,7 @@ Long-form docs for specific features. Read the relevant file before making chang ### Verify compilation ```bash cd apps/x && npm run deps && npm run lint +cd apps/x && npm run typecheck # dev tsconfigs — the only gate that typechecks *.test.ts ``` ## Tech Stack diff --git a/apps/x/apps/renderer/package.json b/apps/x/apps/renderer/package.json index 0a8c9f9f..c0ad3480 100644 --- a/apps/x/apps/renderer/package.json +++ b/apps/x/apps/renderer/package.json @@ -5,6 +5,7 @@ "scripts": { "dev": "vite", "build": "tsc -b && vite build", + "typecheck": "tsc -b", "lint": "eslint .", "preview": "vite preview", "test": "vitest run", diff --git a/apps/x/package.json b/apps/x/package.json index d0931dc7..fbead12c 100644 --- a/apps/x/package.json +++ b/apps/x/package.json @@ -16,7 +16,11 @@ "test": "npm run shared && npm run test:shared && npm run test:core && npm run test:renderer", "test:shared": "cd packages/shared && npm test", "test:core": "cd packages/core && npm test", - "test:renderer": "cd apps/renderer && npm test" + "test:renderer": "cd apps/renderer && npm test", + "typecheck": "npm run shared && npm run typecheck:shared && npm run typecheck:core && npm run typecheck:renderer", + "typecheck:shared": "cd packages/shared && npm run typecheck", + "typecheck:core": "cd packages/core && npm run typecheck", + "typecheck:renderer": "cd apps/renderer && npm run typecheck" }, "devDependencies": { "@eslint/js": "^9.39.2", diff --git a/apps/x/packages/core/package.json b/apps/x/packages/core/package.json index 5bd6d9b5..80b5b54d 100644 --- a/apps/x/packages/core/package.json +++ b/apps/x/packages/core/package.json @@ -7,6 +7,7 @@ "scripts": { "build": "rm -rf dist && tsc -p tsconfig.build.json", "dev": "tsc -w -p tsconfig.build.json", + "typecheck": "tsc --noEmit -p tsconfig.json", "test": "vitest run", "test:watch": "vitest", "inspect-turn": "node dist/runtime/turns/inspect-cli.js", diff --git a/apps/x/packages/shared/package.json b/apps/x/packages/shared/package.json index 31f99cdd..982f99dc 100644 --- a/apps/x/packages/shared/package.json +++ b/apps/x/packages/shared/package.json @@ -7,6 +7,7 @@ "scripts": { "build": "rm -rf dist && tsc -p tsconfig.build.json", "dev": "tsc -w", + "typecheck": "tsc --noEmit -p tsconfig.json", "test": "vitest run", "test:watch": "vitest" },