refactor: localize internal reply and plugin types (#101666)

This commit is contained in:
Vincent Koc
2026-07-07 05:51:47 -07:00
committed by GitHub
parent a9582a1bb6
commit 407443264c
33 changed files with 49 additions and 54 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ export type AcpxProcessLeaseStore = {
markState(leaseId: string, state: AcpxProcessLeaseState): Promise<void>;
};
export type AcpxProcessLeaseFile = {
type AcpxProcessLeaseFile = {
version: 1;
leases: AcpxProcessLease[];
};
+2 -2
View File
@@ -48,14 +48,14 @@ export type AcpxProcessCleanupDeps = {
};
/** Result from cleaning up a single ACPX process tree. */
export type AcpxProcessCleanupResult = {
type AcpxProcessCleanupResult = {
inspectedPids: number[];
terminatedPids: number[];
skippedReason?: "missing-root" | "not-openclaw-owned" | "unverified-root";
};
/** Result from startup orphan reaping. */
export type AcpxStartupReapResult = {
type AcpxStartupReapResult = {
inspectedPids: number[];
terminatedPids: number[];
skippedReason?: "unsupported-platform" | "process-list-unavailable";
@@ -14,12 +14,12 @@ const BROWSER_INTERNAL_TARGET_URL_PREFIXES = [
"opera://",
];
export type BrowserTargetUrlLike = {
type BrowserTargetUrlLike = {
url?: string | null;
};
/** Return true for browser-owned chrome/devtools/internal URLs. */
export function isBrowserInternalTargetUrl(url: string | null | undefined): boolean {
function isBrowserInternalTargetUrl(url: string | null | undefined): boolean {
const normalized = url?.trim().toLowerCase() ?? "";
return BROWSER_INTERNAL_TARGET_URL_PREFIXES.some((prefix) => normalized.startsWith(prefix));
}
@@ -14,7 +14,7 @@ export type RelayTabInfo = {
};
/** First message the extension sends after the WebSocket opens. */
export type ExtensionHelloMessage = {
type ExtensionHelloMessage = {
type: "hello";
userAgent: string;
/** Full browser product string, e.g. "Chrome/144.0.7204.49". */
@@ -24,13 +24,13 @@ export type ExtensionHelloMessage = {
};
/** Full refresh of shared tabs; sent on any group membership or tab change. */
export type ExtensionTabsMessage = {
type ExtensionTabsMessage = {
type: "tabs";
tabs: RelayTabInfo[];
};
/** CDP event emitted by an attached tab (child sessions carry sessionId). */
export type ExtensionCdpEventMessage = {
type ExtensionCdpEventMessage = {
type: "cdpEvent";
tabId: number;
sessionId?: string;
@@ -39,28 +39,28 @@ export type ExtensionCdpEventMessage = {
};
/** Successful response to a relay command (cdp/attach/createTab/...). */
export type ExtensionResultMessage = {
type ExtensionResultMessage = {
type: "result";
seq: number;
result?: unknown;
};
/** Failed response to a relay command. */
export type ExtensionErrorMessage = {
type ExtensionErrorMessage = {
type: "error";
seq: number;
message: string;
};
/** chrome.debugger detached outside relay control (infobar cancel, tab gone). */
export type ExtensionDetachedMessage = {
type ExtensionDetachedMessage = {
type: "detached";
tabId: number;
reason: string;
};
/** Keepalive reply; message traffic keeps the MV3 service worker alive. */
export type ExtensionPongMessage = {
type ExtensionPongMessage = {
type: "pong";
};
@@ -92,7 +92,7 @@ export type RelayCommandBody =
| { type: "activateTab"; tabId: number };
/** Keepalive probe; the extension answers with pong. */
export type RelayPingMessage = {
type RelayPingMessage = {
type: "ping";
};
@@ -25,7 +25,7 @@ import type { BrowserRouteContext, ProfileStatus } from "./server-context.js";
import { movePathToTrash } from "./trash.js";
/** Input accepted when creating a browser profile. */
export type CreateProfileParams = {
type CreateProfileParams = {
name: string;
color?: string;
cdpUrl?: string;
@@ -34,7 +34,7 @@ export type CreateProfileParams = {
};
/** Result returned after creating a browser profile. */
export type CreateProfileResult = {
type CreateProfileResult = {
ok: true;
profile: string;
transport: "cdp" | "chrome-mcp";
@@ -46,7 +46,7 @@ export type CreateProfileResult = {
};
/** Result returned after deleting a browser profile. */
export type DeleteProfileResult = {
type DeleteProfileResult = {
ok: true;
profile: string;
deleted: boolean;
+1 -1
View File
@@ -95,7 +95,7 @@ export type BrowserObservedDialogRecord = {
};
/** Pending and recent dialog state for a page. */
export type BrowserObservedDialogState = {
type BrowserObservedDialogState = {
pending: BrowserObservedDialogRecord[];
recent: BrowserObservedDialogRecord[];
};
@@ -12,7 +12,7 @@
// chrome-mcp path keeps its own inline overlay (renderChromeMcpLabels) for now.
export const ANNOTATION_OVERLAY_ATTR = "data-openclaw-labels";
export const ANNOTATION_OVERLAY_ROOT_ID = "__openclaw-annotations__";
const ANNOTATION_OVERLAY_ROOT_ID = "__openclaw-annotations__";
export const ANNOTATION_MAX_LABELS_DEFAULT = 150;
export type CoordinateSpace = "viewport" | "fullpage" | "element";
@@ -48,7 +48,7 @@ export interface OverlayItem {
h: number;
}
export interface AnnotationPlan {
interface AnnotationPlan {
/** Always document-space items, fed to buildOverlayInjectionScript. */
overlayItems: OverlayItem[];
/** Items projected into the capture mode's image-space coordinates. */
+1 -1
View File
@@ -42,7 +42,7 @@ export type BrowserScreenshotDescriptionDeps = {
};
/** Result returned from browser screenshot description. */
export type BrowserScreenshotDescriptionResult = {
type BrowserScreenshotDescriptionResult = {
text: string;
provider?: string;
model?: string;
@@ -3,16 +3,16 @@ import fs from "node:fs/promises";
import path from "node:path";
import { FsSafeError, resolveAbsolutePathForRead } from "openclaw/plugin-sdk/security-runtime";
export type InvalidPathResult = {
type InvalidPathResult = {
ok: false;
code: "INVALID_PATH";
message: string;
};
export const SYMLINK_REJECTED_MESSAGE =
const SYMLINK_REJECTED_MESSAGE =
"path traverses a symlink; refusing because followSymlinks=false (set plugins.entries.file-transfer.config.nodes.<node>.followSymlinks=true to allow, or update allowReadPaths to the canonical path)";
export type FsSafeReadErrorCode = "INVALID_PATH" | "NOT_FOUND" | "SYMLINK_REDIRECT";
type FsSafeReadErrorCode = "INVALID_PATH" | "NOT_FOUND" | "SYMLINK_REDIRECT";
export function classifyFsSafeReadError(err: unknown): FsSafeReadErrorCode | undefined {
if (!(err instanceof FsSafeError)) {
@@ -54,7 +54,7 @@ import { getRuntimeConfig } from "openclaw/plugin-sdk/runtime-config-snapshot";
export type FilePolicyKind = "read" | "write";
export type FilePolicyAskMode = "off" | "on-miss" | "always";
export type FilePolicyDecision =
type FilePolicyDecision =
| { ok: true; reason: "matched-allow"; maxBytes?: number; followSymlinks: boolean }
| {
ok: true;
+1 -1
View File
@@ -15,7 +15,7 @@ export const SHORT_TERM_PHASE_SIGNAL_NAMESPACE = "short-term-phase-signals";
export const SHORT_TERM_META_NAMESPACE = "short-term-meta";
export const SHORT_TERM_LOCK_NAMESPACE = "short-term-locks";
export const DREAMING_WORKSPACE_STATE_MAX_ENTRIES = 50_000;
const DREAMING_WORKSPACE_STATE_MAX_ENTRIES = 50_000;
export const SHORT_TERM_LOCK_MAX_ENTRIES = 4_096;
export const SESSION_SEEN_HASHES_PER_CHUNK = 512;
+2 -2
View File
@@ -86,13 +86,13 @@ function joinBlocks(blocks: MemoryBlock[]): string {
return blocks.map((block) => block.text).join("\n");
}
export type CompactMemoryParams = {
type CompactMemoryParams = {
existingMemory: string;
newSection: string;
budgetChars: number;
};
export type CompactMemoryResult = {
type CompactMemoryResult = {
compacted: string;
droppedDates: string[];
};
@@ -7,8 +7,8 @@ export const QMD_RUNTIME_CACHE_COLLECTION_VALIDATION_NAMESPACE =
"qmd-runtime-cache.collection-validation";
export const QMD_RUNTIME_CACHE_MULTI_COLLECTION_PROBE_NAMESPACE =
"qmd-runtime-cache.multi-collection-probe";
export const QMD_RUNTIME_CACHE_COLLECTION_VALIDATION_MAX_ENTRIES = 1_000;
export const QMD_RUNTIME_CACHE_MULTI_COLLECTION_PROBE_MAX_ENTRIES = 1_000;
const QMD_RUNTIME_CACHE_COLLECTION_VALIDATION_MAX_ENTRIES = 1_000;
const QMD_RUNTIME_CACHE_MULTI_COLLECTION_PROBE_MAX_ENTRIES = 1_000;
export const QMD_RUNTIME_CACHE_COLLECTION_VALIDATION_TTL_MS = 5 * 60_000;
export const QMD_RUNTIME_CACHE_MULTI_COLLECTION_PROBE_TTL_MS = 10 * 60_000;
@@ -1,7 +1,7 @@
// Memory Core plugin module implements watch pressure behavior.
import type { FSWatcher } from "chokidar";
export const MEMORY_WATCH_PRESSURE_WARNING_THRESHOLD = 2_000;
const MEMORY_WATCH_PRESSURE_WARNING_THRESHOLD = 2_000;
export type MemoryWatchPressureUnit = "directories" | "paths";
@@ -17,7 +17,7 @@ const PERSISTENT_NAMESPACE = "whatsapp.approval-reactions";
const PERSISTENT_MAX_ENTRIES = 1000;
const DEFAULT_REACTION_TARGET_TTL_MS = 24 * 60 * 60 * 1000;
export type WhatsAppApprovalReactionBinding = ApprovalReactionDecisionBinding;
type WhatsAppApprovalReactionBinding = ApprovalReactionDecisionBinding;
type WhatsAppApprovalReactionResolution = {
approvalId: string;
@@ -16,7 +16,7 @@ import { resolveGroupActivationFor } from "./group-activation.js";
export type { StatusReactionController };
export type WhatsAppStatusReactionParams = {
type WhatsAppStatusReactionParams = {
cfg: OpenClawConfig;
msg: AdmittedWebInboundMessage;
agentId: string;
+1 -1
View File
@@ -95,7 +95,7 @@ export function resetWebInboundDedupe(): void {
recentOutboundMessages.clear();
}
export type RecentInboundMessageClaimKind = "claimed" | "duplicate" | "inflight";
type RecentInboundMessageClaimKind = "claimed" | "duplicate" | "inflight";
export async function claimRecentInboundMessageDelivery(
key: string,
@@ -29,7 +29,7 @@ export type WhatsAppDurableInboundMetadata = {
readReceipt?: WhatsAppReadReceiptTarget;
};
export type WhatsAppDurableInboundCompletedMetadata = {
type WhatsAppDurableInboundCompletedMetadata = {
readReceipt?: WhatsAppReadReceiptTarget;
};
+1 -1
View File
@@ -24,7 +24,7 @@ import {
import { resolveWhatsAppSocketTiming, type WhatsAppSocketTimingOptions } from "./socket-timing.js";
type WaSocket = Awaited<ReturnType<typeof createWaSocket>>;
export type StartWebLoginWithQrResult = {
type StartWebLoginWithQrResult = {
qrDataUrl?: string;
message: string;
connected?: boolean;
+1 -1
View File
@@ -344,7 +344,7 @@ function normalizeEnvProxyValue(value: string | undefined): string | null | unde
return trimmed.length > 0 ? trimmed : null;
}
export type WhatsAppConnectionWaitOptions =
type WhatsAppConnectionWaitOptions =
| {
timeout: "none";
}
+1 -1
View File
@@ -8,7 +8,7 @@ const ACP_TOOL_TERMINAL_OUTCOMES = {
cancelled: "cancelled",
} as const;
export type AcpToolTerminalOutcome =
type AcpToolTerminalOutcome =
(typeof ACP_TOOL_TERMINAL_OUTCOMES)[keyof typeof ACP_TOOL_TERMINAL_OUTCOMES];
export function resolveAcpToolTerminalOutcome(status: unknown): AcpToolTerminalOutcome | undefined {
+1 -1
View File
@@ -1,6 +1,6 @@
// Shared command argument shapes for auto-reply command parsing.
/** Primitive values accepted by parsed auto-reply command args. */
export type CommandArgValue = string | number | boolean | bigint;
type CommandArgValue = string | number | boolean | bigint;
/** Named parsed auto-reply command values. */
export type CommandArgValues = Record<string, CommandArgValue>;
+1 -1
View File
@@ -14,7 +14,7 @@ export type BlockReplyContext = {
};
/** Context passed to onModelSelected callback with actual model used. */
export type ModelSelectedContext = {
type ModelSelectedContext = {
provider: string;
model: string;
thinkLevel: string | undefined;
+1 -1
View File
@@ -2,7 +2,7 @@
import type { AgentMessage } from "../agents/runtime/index.js";
/** Summary of the prior model state used to brief the fallback model. */
export interface HandoffSnapshot {
interface HandoffSnapshot {
summary: string;
activeSubagents: Array<{
sessionId: string;
@@ -22,7 +22,7 @@ export function loadAgentTurnMediaRuntime() {
}
/** Runtime surface needed to resolve agent-turn media attachments. */
export type AgentTurnAttachmentRuntime = Pick<
type AgentTurnAttachmentRuntime = Pick<
Awaited<ReturnType<typeof loadAgentTurnMediaRuntime>>,
| "MediaAttachmentCache"
| "isMediaUnderstandingSkipError"
+1 -1
View File
@@ -3,7 +3,7 @@ import { parseSlashCommandOrNull } from "./commands-slash-parse.js";
import { parseConfigValue } from "./config-value.js";
/** Parsed set/unset action or a user-facing parse error. */
export type SetUnsetParseResult =
type SetUnsetParseResult =
| { kind: "set"; path: string; value: unknown }
| { kind: "unset"; path: string }
| { kind: "error"; message: string };
+1 -1
View File
@@ -2,7 +2,7 @@
import { normalizeLowercaseStringOrEmpty } from "@openclaw/normalization-core/string-coerce";
/** Internal parse state for slash command action extraction. */
export type SlashCommandParseResult =
type SlashCommandParseResult =
| { kind: "no-match" }
| { kind: "empty" }
| { kind: "invalid" }
@@ -29,7 +29,7 @@ import type { SkillEligibilityContext } from "../../skills/types.js";
import type { HandleCommandsParams } from "./commands-types.js";
import { resolveRuntimePolicySessionKey } from "./runtime-policy-session-key.js";
export type CommandsSystemPromptBundle = {
type CommandsSystemPromptBundle = {
systemPrompt: string;
tools: AgentTool[];
skillsPrompt: string;
+1 -6
View File
@@ -3,12 +3,7 @@ import { readStringAlias } from "../../utils/string-readers.js";
import type { FinalizedMsgContext } from "../templating.js";
/** Message context fields that can carry user-visible command text. */
export type ContextTextKey =
| "BodyForAgent"
| "BodyForCommands"
| "CommandBody"
| "RawBody"
| "Body";
type ContextTextKey = "BodyForAgent" | "BodyForCommands" | "CommandBody" | "RawBody" | "Body";
/** Returns the first string field from a finalized message context. */
export function resolveFirstContextText(
@@ -25,7 +25,7 @@ export type EffectiveReplyRouteEntry = Pick<
>;
/** Effective channel target selected for source reply delivery. */
export type EffectiveReplyRoute = {
type EffectiveReplyRoute = {
channel?: string;
to?: string;
accountId?: string;
+1 -1
View File
@@ -11,7 +11,7 @@ export type ReplySessionBinding = {
storePath?: string;
};
export type InternalReplySessionOptions = {
type InternalReplySessionOptions = {
requestedSessionId?: string;
resumeRequestedSession?: boolean;
sessionPromptSourceReplyDeliveryMode?: GetReplyOptions["sourceReplyDeliveryMode"];
+1 -1
View File
@@ -22,7 +22,7 @@ import {
export type NormalizeReplySkipReason = "empty" | "silent" | "heartbeat";
export type NormalizeReplyOptions = {
type NormalizeReplyOptions = {
responsePrefix?: string;
applyChannelTransforms?: boolean;
/** Context for template variable interpolation in responsePrefix */
@@ -47,7 +47,7 @@ function matchesSectionSet(sectionNames: string[], expectedSections: string[]):
* Substitutes YYYY-MM-DD placeholders with the real date so agents read the correct
* daily memory files instead of guessing based on training cutoff.
*/
export type PostCompactionContextOptions = {
type PostCompactionContextOptions = {
cfg?: OpenClawConfig;
agentId?: string;
nowMs?: number;