diff --git a/src/agents/pi-embedded-runner/google.ts b/src/agents/pi-embedded-runner/google.ts index 0666e3b02f..6cd261e4f9 100644 --- a/src/agents/pi-embedded-runner/google.ts +++ b/src/agents/pi-embedded-runner/google.ts @@ -1,8 +1,7 @@ +import { EventEmitter } from "node:events"; import type { AgentMessage, AgentTool } from "@mariozechner/pi-agent-core"; import type { SessionManager } from "@mariozechner/pi-coding-agent"; import type { TSchema } from "@sinclair/typebox"; -import { EventEmitter } from "node:events"; -import type { TranscriptPolicy } from "../transcript-policy.js"; import { registerUnhandledRejectionHandler } from "../../infra/unhandled-rejections.js"; import { hasInterSessionUserProvenance, @@ -21,6 +20,7 @@ import { stripToolResultDetails, sanitizeToolUseResultPairing, } from "../session-transcript-repair.js"; +import type { TranscriptPolicy } from "../transcript-policy.js"; import { resolveTranscriptPolicy } from "../transcript-policy.js"; import { log } from "./logger.js"; import { describeUnknownError } from "./utils.js"; diff --git a/src/agents/pi-tools.ts b/src/agents/pi-tools.ts index d7103d6381..39fde7b58e 100644 --- a/src/agents/pi-tools.ts +++ b/src/agents/pi-tools.ts @@ -7,9 +7,6 @@ import { } from "@mariozechner/pi-coding-agent"; import type { OpenClawConfig } from "../config/config.js"; import type { ToolLoopDetectionConfig } from "../config/types.tools.js"; -import type { ModelAuthMode } from "./model-auth.js"; -import type { AnyAgentTool } from "./pi-tools.types.js"; -import type { SandboxContext } from "./sandbox.js"; import { logWarn } from "../logger.js"; import { getPluginToolMeta } from "../plugins/tools.js"; import { isSubagentSessionKey } from "../routing/session-key.js"; @@ -23,6 +20,7 @@ import { type ProcessToolDefaults, } from "./bash-tools.js"; import { listChannelAgentTools } from "./channel-tools.js"; +import type { ModelAuthMode } from "./model-auth.js"; import { createOpenClawTools } from "./openclaw-tools.js"; import { wrapToolWithAbortSignal } from "./pi-tools.abort.js"; import { wrapToolWithBeforeToolCallHook } from "./pi-tools.before-tool-call.js"; @@ -45,6 +43,8 @@ import { wrapToolParamNormalization, } from "./pi-tools.read.js"; import { cleanToolSchemaForGemini, normalizeToolParameters } from "./pi-tools.schema.js"; +import type { AnyAgentTool } from "./pi-tools.types.js"; +import type { SandboxContext } from "./sandbox.js"; import { getSubagentDepthFromSessionStore } from "./subagent-depth.js"; import { applyToolPolicyPipeline, diff --git a/src/channels/dock.ts b/src/channels/dock.ts index 2326bcfdb6..32ccf835b2 100644 --- a/src/channels/dock.ts +++ b/src/channels/dock.ts @@ -1,17 +1,4 @@ import type { OpenClawConfig } from "../config/config.js"; -import type { - ChannelCapabilities, - ChannelCommandAdapter, - ChannelElevatedAdapter, - ChannelGroupAdapter, - ChannelId, - ChannelAgentPromptAdapter, - ChannelMentionAdapter, - ChannelPlugin, - ChannelThreadingContext, - ChannelThreadingAdapter, - ChannelThreadingToolContext, -} from "./plugins/types.js"; import { resolveChannelGroupRequireMention, resolveChannelGroupToolsPolicy, @@ -41,6 +28,19 @@ import { resolveWhatsAppGroupRequireMention, resolveWhatsAppGroupToolPolicy, } from "./plugins/group-mentions.js"; +import type { + ChannelCapabilities, + ChannelCommandAdapter, + ChannelElevatedAdapter, + ChannelGroupAdapter, + ChannelId, + ChannelAgentPromptAdapter, + ChannelMentionAdapter, + ChannelPlugin, + ChannelThreadingContext, + ChannelThreadingAdapter, + ChannelThreadingToolContext, +} from "./plugins/types.js"; import { CHAT_CHANNEL_ORDER, type ChatChannelId, getChatChannelMeta } from "./registry.js"; export type ChannelDock = { diff --git a/src/channels/registry.ts b/src/channels/registry.ts index 205372334d..20a015320d 100644 --- a/src/channels/registry.ts +++ b/src/channels/registry.ts @@ -1,6 +1,6 @@ +import { requireActivePluginRegistry } from "../plugins/runtime.js"; import type { ChannelMeta } from "./plugins/types.js"; import type { ChannelId } from "./plugins/types.js"; -import { requireActivePluginRegistry } from "../plugins/runtime.js"; // Channel docking: add new core channels here (order + meta + aliases), then // register the plugin in its extension entrypoint and keep protocol IDs in sync. diff --git a/src/commands/onboard-helpers.ts b/src/commands/onboard-helpers.ts index f1c40d3b79..4da787b0e1 100644 --- a/src/commands/onboard-helpers.ts +++ b/src/commands/onboard-helpers.ts @@ -1,12 +1,10 @@ -import { cancel, isCancel } from "@clack/prompts"; import crypto from "node:crypto"; import fs from "node:fs/promises"; import path from "node:path"; import { inspect } from "node:util"; -import type { OpenClawConfig } from "../config/config.js"; -import type { RuntimeEnv } from "../runtime.js"; -import type { NodeManagerChoice, OnboardMode, ResetScope } from "./onboard-types.js"; +import { cancel, isCancel } from "@clack/prompts"; import { DEFAULT_AGENT_WORKSPACE_DIR, ensureAgentWorkspace } from "../agents/workspace.js"; +import type { OpenClawConfig } from "../config/config.js"; import { CONFIG_PATH } from "../config/config.js"; import { resolveSessionTranscriptsDirForAgent } from "../config/sessions.js"; import { callGateway } from "../gateway/call.js"; @@ -16,6 +14,7 @@ import { isSafeExecutableValue } from "../infra/exec-safety.js"; import { pickPrimaryTailnetIPv4 } from "../infra/tailnet.js"; import { isWSL } from "../infra/wsl.js"; import { runCommandWithTimeout } from "../process/exec.js"; +import type { RuntimeEnv } from "../runtime.js"; import { stylePromptTitle } from "../terminal/prompt-style.js"; import { CONFIG_DIR, @@ -26,6 +25,7 @@ import { } from "../utils.js"; import { GATEWAY_CLIENT_MODES, GATEWAY_CLIENT_NAMES } from "../utils/message-channel.js"; import { VERSION } from "../version.js"; +import type { NodeManagerChoice, OnboardMode, ResetScope } from "./onboard-types.js"; export function guardCancel(value: T | symbol, runtime: RuntimeEnv): T { if (isCancel(value)) { diff --git a/src/hooks/bundled/session-memory/handler.test.ts b/src/hooks/bundled/session-memory/handler.test.ts index fcc895f89b..5a611162c7 100644 --- a/src/hooks/bundled/session-memory/handler.test.ts +++ b/src/hooks/bundled/session-memory/handler.test.ts @@ -2,8 +2,8 @@ import fs from "node:fs/promises"; import path from "node:path"; import { beforeAll, describe, expect, it, vi } from "vitest"; import type { OpenClawConfig } from "../../../config/config.js"; -import type { HookHandler } from "../../hooks.js"; import { makeTempWorkspace, writeWorkspaceFile } from "../../../test-helpers/workspace.js"; +import type { HookHandler } from "../../hooks.js"; import { createHookEvent } from "../../hooks.js"; // Avoid calling the embedded Pi agent (global command lane); keep this unit test deterministic. diff --git a/src/hooks/bundled/session-memory/handler.ts b/src/hooks/bundled/session-memory/handler.ts index 540aab243f..f35938124c 100644 --- a/src/hooks/bundled/session-memory/handler.ts +++ b/src/hooks/bundled/session-memory/handler.ts @@ -8,14 +8,14 @@ import fs from "node:fs/promises"; import os from "node:os"; import path from "node:path"; -import type { OpenClawConfig } from "../../../config/config.js"; -import type { HookHandler } from "../../hooks.js"; import { resolveAgentWorkspaceDir } from "../../../agents/agent-scope.js"; +import type { OpenClawConfig } from "../../../config/config.js"; import { resolveStateDir } from "../../../config/paths.js"; import { createSubsystemLogger } from "../../../logging/subsystem.js"; import { resolveAgentIdFromSessionKey } from "../../../routing/session-key.js"; import { hasInterSessionUserProvenance } from "../../../sessions/input-provenance.js"; import { resolveHookConfig } from "../../config.js"; +import type { HookHandler } from "../../hooks.js"; import { generateSlugViaLLM } from "../../llm-slug-generator.js"; const log = createSubsystemLogger("hooks/session-memory"); diff --git a/src/plugins/runtime/index.ts b/src/plugins/runtime/index.ts index d5abe65600..e36b8f7286 100644 --- a/src/plugins/runtime/index.ts +++ b/src/plugins/runtime/index.ts @@ -1,5 +1,4 @@ import { createRequire } from "node:module"; -import type { PluginRuntime } from "./types.js"; import { resolveEffectiveMessagesConfig, resolveHumanDelayConfig } from "../../agents/identity.js"; import { createMemoryGetTool, createMemorySearchTool } from "../../agents/tools/memory-tool.js"; import { handleSlackAction } from "../../agents/tools/slack-actions.js"; @@ -139,6 +138,7 @@ import { } from "../../web/auth-store.js"; import { loadWebMedia } from "../../web/media.js"; import { formatNativeDependencyHint } from "./native-deps.js"; +import type { PluginRuntime } from "./types.js"; let cachedVersion: string | null = null; diff --git a/src/process/supervisor/adapters/pty.ts b/src/process/supervisor/adapters/pty.ts index e93c42a00b..40b0bc2ce7 100644 --- a/src/process/supervisor/adapters/pty.ts +++ b/src/process/supervisor/adapters/pty.ts @@ -1,5 +1,5 @@ -import type { ManagedRunStdin } from "../types.js"; import { killProcessTree } from "../../kill-tree.js"; +import type { ManagedRunStdin } from "../types.js"; import { toStringEnv } from "./env.js"; const FORCE_KILL_WAIT_FALLBACK_MS = 4000; diff --git a/src/slack/monitor/events/interactions.ts b/src/slack/monitor/events/interactions.ts index 38367cdd40..958d6b3f5d 100644 --- a/src/slack/monitor/events/interactions.ts +++ b/src/slack/monitor/events/interactions.ts @@ -1,8 +1,8 @@ import type { SlackActionMiddlewareArgs } from "@slack/bolt"; import type { Block, KnownBlock } from "@slack/web-api"; -import type { SlackMonitorContext } from "../context.js"; import { enqueueSystemEvent } from "../../../infra/system-events.js"; import { parseSlackModalPrivateMetadata } from "../../modal-metadata.js"; +import type { SlackMonitorContext } from "../context.js"; // Prefix for OpenClaw-generated action IDs to scope our handler const OPENCLAW_ACTION_PREFIX = "openclaw:"; diff --git a/src/slack/monitor/media.ts b/src/slack/monitor/media.ts index 47729b868c..964aec1107 100644 --- a/src/slack/monitor/media.ts +++ b/src/slack/monitor/media.ts @@ -1,9 +1,9 @@ import type { WebClient as SlackWebClient } from "@slack/web-api"; -import type { FetchLike } from "../../media/fetch.js"; -import type { SlackAttachment, SlackFile } from "../types.js"; import { normalizeHostname } from "../../infra/net/hostname.js"; +import type { FetchLike } from "../../media/fetch.js"; import { fetchRemoteMedia } from "../../media/fetch.js"; import { saveMediaBuffer } from "../../media/store.js"; +import type { SlackAttachment, SlackFile } from "../types.js"; function isSlackHostname(hostname: string): boolean { const normalized = normalizeHostname(hostname); diff --git a/src/slack/monitor/message-handler/prepare.test.ts b/src/slack/monitor/message-handler/prepare.test.ts index 3f81c59ed8..836a68f7e1 100644 --- a/src/slack/monitor/message-handler/prepare.test.ts +++ b/src/slack/monitor/message-handler/prepare.test.ts @@ -1,16 +1,16 @@ -import type { App } from "@slack/bolt"; import fs from "node:fs"; import os from "node:os"; import path from "node:path"; +import type { App } from "@slack/bolt"; import { afterAll, beforeAll, describe, expect, it, vi } from "vitest"; +import { expectInboundContextContract } from "../../../../test/helpers/inbound-contract.js"; import type { OpenClawConfig } from "../../../config/config.js"; +import { resolveAgentRoute } from "../../../routing/resolve-route.js"; +import { resolveThreadSessionKeys } from "../../../routing/session-key.js"; import type { RuntimeEnv } from "../../../runtime.js"; import type { ResolvedSlackAccount } from "../../accounts.js"; import type { SlackMessageEvent } from "../../types.js"; import type { SlackMonitorContext } from "../context.js"; -import { expectInboundContextContract } from "../../../../test/helpers/inbound-contract.js"; -import { resolveAgentRoute } from "../../../routing/resolve-route.js"; -import { resolveThreadSessionKeys } from "../../../routing/session-key.js"; import { createSlackMonitorContext } from "../context.js"; import { prepareSlackMessage } from "./prepare.js"; diff --git a/src/wizard/onboarding.finalize.ts b/src/wizard/onboarding.finalize.ts index b73979915e..c1bae8cd0c 100644 --- a/src/wizard/onboarding.finalize.ts +++ b/src/wizard/onboarding.finalize.ts @@ -1,10 +1,5 @@ import fs from "node:fs/promises"; import path from "node:path"; -import type { OnboardOptions } from "../commands/onboard-types.js"; -import type { OpenClawConfig } from "../config/config.js"; -import type { RuntimeEnv } from "../runtime.js"; -import type { GatewayWizardSettings, WizardFlow } from "./onboarding.types.js"; -import type { WizardPrompter } from "./prompts.js"; import { DEFAULT_BOOTSTRAP_FILENAME } from "../agents/workspace.js"; import { formatCliCommand } from "../cli/command-format.js"; import { @@ -25,13 +20,18 @@ import { waitForGatewayReachable, resolveControlUiLinks, } from "../commands/onboard-helpers.js"; +import type { OnboardOptions } from "../commands/onboard-types.js"; +import type { OpenClawConfig } from "../config/config.js"; import { resolveGatewayService } from "../daemon/service.js"; import { isSystemdUserServiceAvailable } from "../daemon/systemd.js"; import { ensureControlUiAssetsBuilt } from "../infra/control-ui-assets.js"; +import type { RuntimeEnv } from "../runtime.js"; import { restoreTerminalState } from "../terminal/restore.js"; import { runTui } from "../tui/tui.js"; import { resolveUserPath } from "../utils.js"; import { setupOnboardingShellCompletion } from "./onboarding.completion.js"; +import type { GatewayWizardSettings, WizardFlow } from "./onboarding.types.js"; +import type { WizardPrompter } from "./prompts.js"; type FinalizeOnboardingOptions = { flow: WizardFlow; diff --git a/ui/src/i18n/lib/translate.ts b/ui/src/i18n/lib/translate.ts index 8ba9557b72..3b1cfa0978 100644 --- a/ui/src/i18n/lib/translate.ts +++ b/ui/src/i18n/lib/translate.ts @@ -1,5 +1,5 @@ -import type { Locale, TranslationMap } from "./types.ts"; import { en } from "../locales/en.ts"; +import type { Locale, TranslationMap } from "./types.ts"; type Subscriber = (locale: Locale) => void; diff --git a/ui/src/ui/app.ts b/ui/src/ui/app.ts index eb66b8ffb0..84e39067ba 100644 --- a/ui/src/ui/app.ts +++ b/ui/src/ui/app.ts @@ -1,34 +1,5 @@ import { LitElement } from "lit"; import { customElement, state } from "lit/decorators.js"; -import type { EventLogEntry } from "./app-events.ts"; -import type { AppViewState } from "./app-view-state.ts"; -import type { DevicePairingList } from "./controllers/devices.ts"; -import type { ExecApprovalRequest } from "./controllers/exec-approval.ts"; -import type { ExecApprovalsFile, ExecApprovalsSnapshot } from "./controllers/exec-approvals.ts"; -import type { SkillMessage } from "./controllers/skills.ts"; -import type { GatewayBrowserClient, GatewayHelloOk } from "./gateway.ts"; -import type { Tab } from "./navigation.ts"; -import type { ResolvedTheme, ThemeMode } from "./theme.ts"; -import type { - AgentsListResult, - AgentsFilesListResult, - AgentIdentityResult, - ConfigSnapshot, - ConfigUiHints, - CronJob, - CronRunLogEntry, - CronStatus, - HealthSnapshot, - LogEntry, - LogLevel, - PresenceEntry, - ChannelsStatusSnapshot, - SessionsListResult, - SkillStatusReport, - StatusSummary, - NostrProfile, -} from "./types.ts"; -import type { NostrProfileFormState } from "./views/channels.nostr-profile-form.ts"; import { i18n, I18nController, isSupportedLocale } from "../i18n/index.ts"; import { handleChannelConfigReload as handleChannelConfigReloadInternal, @@ -49,6 +20,7 @@ import { removeQueuedMessage as removeQueuedMessageInternal, } from "./app-chat.ts"; import { DEFAULT_CRON_FORM, DEFAULT_LOG_LEVEL_FILTERS } from "./app-defaults.ts"; +import type { EventLogEntry } from "./app-events.ts"; import { connectGateway as connectGatewayInternal } from "./app-gateway.ts"; import { handleConnected, @@ -77,10 +49,38 @@ import { type ToolStreamEntry, type CompactionStatus, } from "./app-tool-stream.ts"; +import type { AppViewState } from "./app-view-state.ts"; import { normalizeAssistantIdentity } from "./assistant-identity.ts"; import { loadAssistantIdentity as loadAssistantIdentityInternal } from "./controllers/assistant-identity.ts"; +import type { DevicePairingList } from "./controllers/devices.ts"; +import type { ExecApprovalRequest } from "./controllers/exec-approval.ts"; +import type { ExecApprovalsFile, ExecApprovalsSnapshot } from "./controllers/exec-approvals.ts"; +import type { SkillMessage } from "./controllers/skills.ts"; +import type { GatewayBrowserClient, GatewayHelloOk } from "./gateway.ts"; +import type { Tab } from "./navigation.ts"; import { loadSettings, type UiSettings } from "./storage.ts"; +import type { ResolvedTheme, ThemeMode } from "./theme.ts"; +import type { + AgentsListResult, + AgentsFilesListResult, + AgentIdentityResult, + ConfigSnapshot, + ConfigUiHints, + CronJob, + CronRunLogEntry, + CronStatus, + HealthSnapshot, + LogEntry, + LogLevel, + PresenceEntry, + ChannelsStatusSnapshot, + SessionsListResult, + SkillStatusReport, + StatusSummary, + NostrProfile, +} from "./types.ts"; import { type ChatAttachment, type ChatQueueItem, type CronFormState } from "./ui-types.ts"; +import type { NostrProfileFormState } from "./views/channels.nostr-profile-form.ts"; declare global { interface Window { diff --git a/ui/src/ui/storage.ts b/ui/src/ui/storage.ts index b2eecc3295..b32e6c3c5b 100644 --- a/ui/src/ui/storage.ts +++ b/ui/src/ui/storage.ts @@ -1,7 +1,7 @@ const KEY = "openclaw.control.settings.v1"; -import type { ThemeMode } from "./theme.ts"; import { isSupportedLocale } from "../i18n/index.ts"; +import type { ThemeMode } from "./theme.ts"; export type UiSettings = { gatewayUrl: string; diff --git a/ui/src/ui/views/overview.ts b/ui/src/ui/views/overview.ts index caa2a6fd15..6d94ea1fda 100644 --- a/ui/src/ui/views/overview.ts +++ b/ui/src/ui/views/overview.ts @@ -1,9 +1,9 @@ import { html } from "lit"; -import type { GatewayHelloOk } from "../gateway.ts"; -import type { UiSettings } from "../storage.ts"; import { t, i18n, type Locale } from "../../i18n/index.ts"; import { formatRelativeTimestamp, formatDurationHuman } from "../format.ts"; +import type { GatewayHelloOk } from "../gateway.ts"; import { formatNextRun } from "../presenter.ts"; +import type { UiSettings } from "../storage.ts"; export type OverviewProps = { connected: boolean;