mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-26 20:35:39 -06:00
71a33f07a9
* fix(imessage): harden remote Mac transport Route SSH-backed iMessage actions through JSON-RPC, preserve remote database paths, and stage outbound files on the Messages Mac with bounded cleanup. Keep local action semantics intact while failing closed on ambiguous wrappers and surfacing the remaining imsg v0.13.4 limits. * fix(imessage): remove test-only exports
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
import { createIMessageRpcClient } from "./client.js";
|
|
|
|
export type IMessageActionTransportOptions = {
|
|
cliPath: string;
|
|
dbPath?: string;
|
|
remoteHost?: string;
|
|
timeoutMs?: number;
|
|
};
|
|
|
|
class IMessageRemoteUnsupportedError extends Error {
|
|
readonly code = "IMESSAGE_REMOTE_UNSUPPORTED";
|
|
|
|
constructor(message: string) {
|
|
super(message);
|
|
this.name = "IMessageRemoteUnsupportedError";
|
|
}
|
|
}
|
|
|
|
export function throwIMessageRemoteUnsupported(message: string): never {
|
|
throw new IMessageRemoteUnsupportedError(`iMessage Remote Mac limitation: ${message}`);
|
|
}
|
|
|
|
export async function requestIMessageActionRpc<T extends Record<string, unknown>>(
|
|
method: string,
|
|
params: Record<string, unknown>,
|
|
options: IMessageActionTransportOptions,
|
|
): Promise<T> {
|
|
const client = await createIMessageRpcClient({
|
|
cliPath: options.cliPath,
|
|
dbPath: options.dbPath,
|
|
remoteHost: options.remoteHost,
|
|
});
|
|
try {
|
|
return await client.request<T>(method, params, { timeoutMs: options.timeoutMs });
|
|
} finally {
|
|
await client.stop();
|
|
}
|
|
}
|