Skip to content

Commit 4074432

Browse files
authored
refactor: localize internal reply and plugin types (#101666)
1 parent a9582a1 commit 4074432

33 files changed

Lines changed: 49 additions & 54 deletions

extensions/acpx/src/process-lease.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export type AcpxProcessLeaseStore = {
4343
markState(leaseId: string, state: AcpxProcessLeaseState): Promise<void>;
4444
};
4545

46-
export type AcpxProcessLeaseFile = {
46+
type AcpxProcessLeaseFile = {
4747
version: 1;
4848
leases: AcpxProcessLease[];
4949
};

extensions/acpx/src/process-reaper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ export type AcpxProcessCleanupDeps = {
4848
};
4949

5050
/** Result from cleaning up a single ACPX process tree. */
51-
export type AcpxProcessCleanupResult = {
51+
type AcpxProcessCleanupResult = {
5252
inspectedPids: number[];
5353
terminatedPids: number[];
5454
skippedReason?: "missing-root" | "not-openclaw-owned" | "unverified-root";
5555
};
5656

5757
/** Result from startup orphan reaping. */
58-
export type AcpxStartupReapResult = {
58+
type AcpxStartupReapResult = {
5959
inspectedPids: number[];
6060
terminatedPids: number[];
6161
skippedReason?: "unsupported-platform" | "process-list-unavailable";

extensions/browser/src/browser/cdp-target-filter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ const BROWSER_INTERNAL_TARGET_URL_PREFIXES = [
1414
"opera://",
1515
];
1616

17-
export type BrowserTargetUrlLike = {
17+
type BrowserTargetUrlLike = {
1818
url?: string | null;
1919
};
2020

2121
/** Return true for browser-owned chrome/devtools/internal URLs. */
22-
export function isBrowserInternalTargetUrl(url: string | null | undefined): boolean {
22+
function isBrowserInternalTargetUrl(url: string | null | undefined): boolean {
2323
const normalized = url?.trim().toLowerCase() ?? "";
2424
return BROWSER_INTERNAL_TARGET_URL_PREFIXES.some((prefix) => normalized.startsWith(prefix));
2525
}

extensions/browser/src/browser/extension-relay/relay-protocol.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export type RelayTabInfo = {
1414
};
1515

1616
/** First message the extension sends after the WebSocket opens. */
17-
export type ExtensionHelloMessage = {
17+
type ExtensionHelloMessage = {
1818
type: "hello";
1919
userAgent: string;
2020
/** Full browser product string, e.g. "Chrome/144.0.7204.49". */
@@ -24,13 +24,13 @@ export type ExtensionHelloMessage = {
2424
};
2525

2626
/** Full refresh of shared tabs; sent on any group membership or tab change. */
27-
export type ExtensionTabsMessage = {
27+
type ExtensionTabsMessage = {
2828
type: "tabs";
2929
tabs: RelayTabInfo[];
3030
};
3131

3232
/** CDP event emitted by an attached tab (child sessions carry sessionId). */
33-
export type ExtensionCdpEventMessage = {
33+
type ExtensionCdpEventMessage = {
3434
type: "cdpEvent";
3535
tabId: number;
3636
sessionId?: string;
@@ -39,28 +39,28 @@ export type ExtensionCdpEventMessage = {
3939
};
4040

4141
/** Successful response to a relay command (cdp/attach/createTab/...). */
42-
export type ExtensionResultMessage = {
42+
type ExtensionResultMessage = {
4343
type: "result";
4444
seq: number;
4545
result?: unknown;
4646
};
4747

4848
/** Failed response to a relay command. */
49-
export type ExtensionErrorMessage = {
49+
type ExtensionErrorMessage = {
5050
type: "error";
5151
seq: number;
5252
message: string;
5353
};
5454

5555
/** chrome.debugger detached outside relay control (infobar cancel, tab gone). */
56-
export type ExtensionDetachedMessage = {
56+
type ExtensionDetachedMessage = {
5757
type: "detached";
5858
tabId: number;
5959
reason: string;
6060
};
6161

6262
/** Keepalive reply; message traffic keeps the MV3 service worker alive. */
63-
export type ExtensionPongMessage = {
63+
type ExtensionPongMessage = {
6464
type: "pong";
6565
};
6666

@@ -92,7 +92,7 @@ export type RelayCommandBody =
9292
| { type: "activateTab"; tabId: number };
9393

9494
/** Keepalive probe; the extension answers with pong. */
95-
export type RelayPingMessage = {
95+
type RelayPingMessage = {
9696
type: "ping";
9797
};
9898

extensions/browser/src/browser/profiles-service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import type { BrowserRouteContext, ProfileStatus } from "./server-context.js";
2525
import { movePathToTrash } from "./trash.js";
2626

2727
/** Input accepted when creating a browser profile. */
28-
export type CreateProfileParams = {
28+
type CreateProfileParams = {
2929
name: string;
3030
color?: string;
3131
cdpUrl?: string;
@@ -34,7 +34,7 @@ export type CreateProfileParams = {
3434
};
3535

3636
/** Result returned after creating a browser profile. */
37-
export type CreateProfileResult = {
37+
type CreateProfileResult = {
3838
ok: true;
3939
profile: string;
4040
transport: "cdp" | "chrome-mcp";
@@ -46,7 +46,7 @@ export type CreateProfileResult = {
4646
};
4747

4848
/** Result returned after deleting a browser profile. */
49-
export type DeleteProfileResult = {
49+
type DeleteProfileResult = {
5050
ok: true;
5151
profile: string;
5252
deleted: boolean;

extensions/browser/src/browser/pw-session.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export type BrowserObservedDialogRecord = {
9595
};
9696

9797
/** Pending and recent dialog state for a page. */
98-
export type BrowserObservedDialogState = {
98+
type BrowserObservedDialogState = {
9999
pending: BrowserObservedDialogRecord[];
100100
recent: BrowserObservedDialogRecord[];
101101
};

extensions/browser/src/browser/screenshot-annotate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// chrome-mcp path keeps its own inline overlay (renderChromeMcpLabels) for now.
1313

1414
export const ANNOTATION_OVERLAY_ATTR = "data-openclaw-labels";
15-
export const ANNOTATION_OVERLAY_ROOT_ID = "__openclaw-annotations__";
15+
const ANNOTATION_OVERLAY_ROOT_ID = "__openclaw-annotations__";
1616
export const ANNOTATION_MAX_LABELS_DEFAULT = 150;
1717

1818
export type CoordinateSpace = "viewport" | "fullpage" | "element";
@@ -48,7 +48,7 @@ export interface OverlayItem {
4848
h: number;
4949
}
5050

51-
export interface AnnotationPlan {
51+
interface AnnotationPlan {
5252
/** Always document-space items, fed to buildOverlayInjectionScript. */
5353
overlayItems: OverlayItem[];
5454
/** Items projected into the capture mode's image-space coordinates. */

extensions/browser/src/browser/vision.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export type BrowserScreenshotDescriptionDeps = {
4242
};
4343

4444
/** Result returned from browser screenshot description. */
45-
export type BrowserScreenshotDescriptionResult = {
45+
type BrowserScreenshotDescriptionResult = {
4646
text: string;
4747
provider?: string;
4848
model?: string;

extensions/file-transfer/src/node-host/path-errors.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ import fs from "node:fs/promises";
33
import path from "node:path";
44
import { FsSafeError, resolveAbsolutePathForRead } from "openclaw/plugin-sdk/security-runtime";
55

6-
export type InvalidPathResult = {
6+
type InvalidPathResult = {
77
ok: false;
88
code: "INVALID_PATH";
99
message: string;
1010
};
1111

12-
export const SYMLINK_REJECTED_MESSAGE =
12+
const SYMLINK_REJECTED_MESSAGE =
1313
"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)";
1414

15-
export type FsSafeReadErrorCode = "INVALID_PATH" | "NOT_FOUND" | "SYMLINK_REDIRECT";
15+
type FsSafeReadErrorCode = "INVALID_PATH" | "NOT_FOUND" | "SYMLINK_REDIRECT";
1616

1717
export function classifyFsSafeReadError(err: unknown): FsSafeReadErrorCode | undefined {
1818
if (!(err instanceof FsSafeError)) {

extensions/file-transfer/src/shared/policy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ import { getRuntimeConfig } from "openclaw/plugin-sdk/runtime-config-snapshot";
5454
export type FilePolicyKind = "read" | "write";
5555
export type FilePolicyAskMode = "off" | "on-miss" | "always";
5656

57-
export type FilePolicyDecision =
57+
type FilePolicyDecision =
5858
| { ok: true; reason: "matched-allow"; maxBytes?: number; followSymlinks: boolean }
5959
| {
6060
ok: true;

0 commit comments

Comments
 (0)