mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 13:10:43 +00:00
refactor: trim bluebubbles helper exports
This commit is contained in:
@@ -6,7 +6,7 @@ import {
|
||||
import type { OpenClawConfig } from "./runtime-api.js";
|
||||
import { normalizeResolvedSecretInputString } from "./secret-input.js";
|
||||
|
||||
export type BlueBubblesAccountResolveOpts = {
|
||||
type BlueBubblesAccountResolveOpts = {
|
||||
serverUrl?: string;
|
||||
password?: string;
|
||||
accountId?: string;
|
||||
|
||||
@@ -23,7 +23,7 @@ import { extractBlueBubblesMessageId, resolveBlueBubblesSendTarget } from "./sen
|
||||
import { createChatForHandle, resolveChatGuidForTarget } from "./send.js";
|
||||
import { type BlueBubblesAttachment } from "./types.js";
|
||||
|
||||
export type BlueBubblesAttachmentOpts = {
|
||||
type BlueBubblesAttachmentOpts = {
|
||||
serverUrl?: string;
|
||||
password?: string;
|
||||
accountId?: string;
|
||||
@@ -111,7 +111,7 @@ export async function downloadBlueBubblesAttachment(
|
||||
});
|
||||
}
|
||||
|
||||
export type SendBlueBubblesAttachmentResult = {
|
||||
type SendBlueBubblesAttachmentResult = {
|
||||
messageId: string;
|
||||
};
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ const DEFAULT_MULTIPART_TIMEOUT_MS = 60_000;
|
||||
* - `blueBubblesHeaderAuth` — header-based auth; flip the default here when
|
||||
* BB Server ships the header-auth change for #66869.
|
||||
*/
|
||||
export interface BlueBubblesAuthStrategy {
|
||||
interface BlueBubblesAuthStrategy {
|
||||
/**
|
||||
* Stable identifier for this strategy. Used by the client cache fingerprint
|
||||
* so two clients for the same account + credential that differ only in auth
|
||||
@@ -149,7 +149,7 @@ export function resolveBlueBubblesClientSsrfPolicy(params: {
|
||||
|
||||
// --- Client ----------------------------------------------------------------
|
||||
|
||||
export type BlueBubblesClientOptions = {
|
||||
type BlueBubblesClientOptions = {
|
||||
cfg?: OpenClawConfig;
|
||||
accountId?: string;
|
||||
serverUrl?: string;
|
||||
|
||||
@@ -2,14 +2,14 @@ import { resolveBlueBubblesServerAccount } from "./account-resolve.js";
|
||||
import { createBlueBubblesClientFromParts } from "./client.js";
|
||||
import type { OpenClawConfig } from "./runtime-api.js";
|
||||
|
||||
export type BlueBubblesHistoryEntry = {
|
||||
type BlueBubblesHistoryEntry = {
|
||||
sender: string;
|
||||
body: string;
|
||||
timestamp?: number;
|
||||
messageId?: string;
|
||||
};
|
||||
|
||||
export type BlueBubblesHistoryFetchResult = {
|
||||
type BlueBubblesHistoryFetchResult = {
|
||||
entries: BlueBubblesHistoryEntry[];
|
||||
/**
|
||||
* True when at least one API path returned a recognized response shape.
|
||||
@@ -18,7 +18,7 @@ export type BlueBubblesHistoryFetchResult = {
|
||||
resolved: boolean;
|
||||
};
|
||||
|
||||
export type BlueBubblesMessageData = {
|
||||
type BlueBubblesMessageData = {
|
||||
guid?: string;
|
||||
text?: string;
|
||||
handle_id?: string;
|
||||
@@ -32,7 +32,7 @@ export type BlueBubblesMessageData = {
|
||||
};
|
||||
};
|
||||
|
||||
export type BlueBubblesChatOpts = {
|
||||
type BlueBubblesChatOpts = {
|
||||
serverUrl?: string;
|
||||
password?: string;
|
||||
accountId?: string;
|
||||
|
||||
@@ -159,7 +159,7 @@ export function resolveBlueBubblesInboundDedupeKey(
|
||||
return base;
|
||||
}
|
||||
|
||||
export type InboundDedupeClaim =
|
||||
type InboundDedupeClaim =
|
||||
| { kind: "claimed"; finalize: () => Promise<void>; release: () => void }
|
||||
| { kind: "duplicate" }
|
||||
| { kind: "inflight" }
|
||||
|
||||
@@ -29,12 +29,12 @@ function sanitizeDebounceEntry(entry: BlueBubblesDebounceEntry): BlueBubblesDebo
|
||||
};
|
||||
}
|
||||
|
||||
export type BlueBubblesDebouncer = {
|
||||
type BlueBubblesDebouncer = {
|
||||
enqueue: (item: BlueBubblesDebounceEntry) => Promise<void>;
|
||||
flushKey: (key: string) => Promise<void>;
|
||||
};
|
||||
|
||||
export type BlueBubblesDebounceRegistry = {
|
||||
type BlueBubblesDebounceRegistry = {
|
||||
getOrCreateDebouncer: (target: WebhookTarget) => BlueBubblesDebouncer;
|
||||
removeDebouncer: (target: WebhookTarget) => void;
|
||||
};
|
||||
|
||||
@@ -355,7 +355,7 @@ export function logVerbose(
|
||||
}
|
||||
}
|
||||
|
||||
export type BlueBubblesInboundChatResolveTarget =
|
||||
type BlueBubblesInboundChatResolveTarget =
|
||||
| { readonly kind: "chat_id"; readonly chatId: number }
|
||||
| { readonly kind: "chat_identifier"; readonly chatIdentifier: string }
|
||||
| { readonly kind: "handle"; readonly address: string };
|
||||
|
||||
@@ -20,7 +20,7 @@ const REPLY_TO_ID_MAX_LENGTH = 128;
|
||||
const PART_INDEX_REPLY_TO_ID_PATTERN = /^p:\d{1,10}\/([A-Za-z0-9._:-]+)$/;
|
||||
const PART_INDEX_REPLY_TO_ID_MAX_LENGTH = REPLY_TO_ID_MAX_LENGTH + "p:".length + 10 + "/".length;
|
||||
|
||||
export type BlueBubblesReplyFetchResult = {
|
||||
type BlueBubblesReplyFetchResult = {
|
||||
body?: string;
|
||||
sender?: string;
|
||||
};
|
||||
@@ -41,7 +41,7 @@ export function _resetBlueBubblesReplyFetchState(): void {
|
||||
inflight.clear();
|
||||
}
|
||||
|
||||
export type FetchBlueBubblesReplyContextParams = {
|
||||
type FetchBlueBubblesReplyContextParams = {
|
||||
accountId: string;
|
||||
replyToId: string;
|
||||
baseUrl: string;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { SsrFPolicy } from "openclaw/plugin-sdk/ssrf-runtime";
|
||||
import { blueBubblesFetchWithTimeout } from "./types.js";
|
||||
|
||||
export function concatUint8Arrays(parts: Uint8Array[]): Uint8Array {
|
||||
function concatUint8Arrays(parts: Uint8Array[]): Uint8Array {
|
||||
const totalLength = parts.reduce((acc, part) => acc + part.length, 0);
|
||||
const body = new Uint8Array(totalLength);
|
||||
let offset = 0;
|
||||
|
||||
@@ -8,7 +8,7 @@ export type BlueBubblesProbe = BaseProbeResult & {
|
||||
status?: number | null;
|
||||
};
|
||||
|
||||
export type BlueBubblesServerInfo = {
|
||||
type BlueBubblesServerInfo = {
|
||||
os_version?: string;
|
||||
server_version?: string;
|
||||
private_api?: boolean;
|
||||
@@ -80,7 +80,7 @@ export async function fetchBlueBubblesServerInfo(params: {
|
||||
* Get cached server info synchronously (for use in describeMessageTool).
|
||||
* Returns null if not cached or expired.
|
||||
*/
|
||||
export function getCachedBlueBubblesServerInfo(accountId?: string): BlueBubblesServerInfo | null {
|
||||
function getCachedBlueBubblesServerInfo(accountId?: string): BlueBubblesServerInfo | null {
|
||||
const cacheKey = normalizeOptionalString(accountId) || "default";
|
||||
const cached = serverInfoCache.get(cacheKey);
|
||||
if (cached && cached.expires > Date.now()) {
|
||||
@@ -112,7 +112,7 @@ export function isBlueBubblesPrivateApiEnabled(accountId?: string): boolean {
|
||||
/**
|
||||
* Parse macOS version string (e.g., "15.0.1" or "26.0") into major version number.
|
||||
*/
|
||||
export function parseMacOSMajorVersion(version?: string | null): number | null {
|
||||
function parseMacOSMajorVersion(version?: string | null): number | null {
|
||||
if (!version) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@ import {
|
||||
normalizeOptionalString,
|
||||
} from "openclaw/plugin-sdk/text-runtime";
|
||||
|
||||
export type BlueBubblesService = "imessage" | "sms" | "auto";
|
||||
type BlueBubblesService = "imessage" | "sms" | "auto";
|
||||
|
||||
export type BlueBubblesTarget =
|
||||
type BlueBubblesTarget =
|
||||
| { kind: "chat_id"; chatId: number }
|
||||
| { kind: "chat_guid"; chatGuid: string }
|
||||
| { kind: "chat_identifier"; chatIdentifier: string }
|
||||
|
||||
Reference in New Issue
Block a user