@@ -12,7 +12,10 @@ import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";
|
12 | 12 | import { appendIMessageCliStderrTail, appendIMessageCliStdout } from "./cli-output.js"; |
13 | 13 | import { createIMessageRpcClient } from "./client.js"; |
14 | 14 | import { extractMarkdownFormatRuns } from "./markdown-format.js"; |
15 | | -import { resolveIMessageMessageId as resolveIMessageMessageIdImpl } from "./monitor-reply-cache.js"; |
| 15 | +import { |
| 16 | +normalizeDirectChatIdentifier, |
| 17 | +resolveIMessageMessageId as resolveIMessageMessageIdImpl, |
| 18 | +} from "./monitor-reply-cache.js"; |
16 | 19 | import type { IMessageTarget } from "./targets.js"; |
17 | 20 | |
18 | 21 | type CliRunOptions = { |
@@ -115,7 +118,7 @@ function chatListCacheSet(
|
115 | 118 | * forms — the action surface synthesizes `iMessage;-;<phone>` from a |
116 | 119 | * handle target, while imsg's chats.list returns `identifier: <phone>` |
117 | 120 | * and `guid: any;-;<phone>`. Comparing the raw strings would falsely |
118 | | - * miss the match. Mirror of the same helper in monitor-reply-cache.ts. |
| 121 | + * miss the match. |
119 | 122 | */ |
120 | 123 | export function normalizeDirectChatIdentifierForTest(raw: string): string { |
121 | 124 | return normalizeDirectChatIdentifier(raw); |
@@ -128,17 +131,6 @@ export function findChatGuidForTest(
|
128 | 131 | return findChatGuid(chats, target); |
129 | 132 | } |
130 | 133 | |
131 | | -function normalizeDirectChatIdentifier(raw: string): string { |
132 | | -const trimmed = raw.trim(); |
133 | | -const lowered = trimmed.toLowerCase(); |
134 | | -for (const prefix of ["imessage;-;", "sms;-;", "any;-;"]) { |
135 | | -if (lowered.startsWith(prefix)) { |
136 | | -return trimmed.slice(prefix.length); |
137 | | -} |
138 | | -} |
139 | | -return trimmed; |
140 | | -} |
141 | | - |
142 | 134 | function findChatGuid( |
143 | 135 | chats: readonly Record<string, unknown>[], |
144 | 136 | target: Extract<IMessageTarget, { kind: "chat_id" | "chat_identifier" }>, |
|