Skip to content

Commit 605ffbf

Browse files
committed
fix: keep legacy whatsapp auth export
1 parent a2ecd3c commit 605ffbf

5 files changed

Lines changed: 14 additions & 1 deletion

File tree

extensions/whatsapp/light-runtime-api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export {
66
pickWebChannel,
77
readWebSelfId,
88
resolveDefaultWebAuthDir,
9+
WA_WEB_AUTH_DIR,
910
webAuthExists,
1011
} from "./src/auth-store.js";
1112
export { createWhatsAppLoginTool } from "./src/agent-tools-login.js";

extensions/whatsapp/runtime-api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export {
2727
resolveWebCredsPath,
2828
restoreCredsFromBackupIfNeeded,
2929
webAuthExists,
30+
WA_WEB_AUTH_DIR,
3031
WHATSAPP_AUTH_UNSTABLE_CODE,
3132
WhatsAppAuthUnstableError,
3233
type WhatsAppWebAuthState,

extensions/whatsapp/src/auth-store.lazy-dir.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ describe("WhatsApp auth dir profile resolution", () => {
3434
expect(authStore.resolveDefaultWebAuthDir()).toBe(expected);
3535
});
3636

37+
it("exports the legacy default auth dir as a primitive string", async () => {
38+
process.env.OPENCLAW_STATE_DIR = tempStateDir;
39+
const authStore = await import("./auth-store.js");
40+
41+
const expected = path.join(tempStateDir ?? "", "credentials", "whatsapp", DEFAULT_ACCOUNT_ID);
42+
expect(authStore.WA_WEB_AUTH_DIR).toBe(expected);
43+
expect(typeof authStore.WA_WEB_AUTH_DIR).toBe("string");
44+
});
45+
3746
it("lists WhatsApp auth dirs under the active profile state dir", async () => {
3847
const accounts = await import("./accounts.js");
3948
process.env.OPENCLAW_STATE_DIR = tempStateDir;

extensions/whatsapp/src/auth-store.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ export function resolveDefaultWebAuthDir(): string {
4343
return path.join(resolveOAuthDir(), "whatsapp", DEFAULT_ACCOUNT_ID);
4444
}
4545

46+
export const WA_WEB_AUTH_DIR = resolveDefaultWebAuthDir();
47+
4648
export function readCredsJsonRaw(filePath: string): string | null {
4749
return readWebCredsJsonRawSync(filePath);
4850
}

src/plugins/contracts/plugin-sdk-runtime-api-guardrails.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ const RUNTIME_API_EXPORT_GUARDS: Record<string, readonly string[]> = {
255255
'export { getActiveWebListener, resolveWebAccountId, type ActiveWebListener, type ActiveWebSendOptions } from "./src/active-listener.js";',
256256
'export { handleWhatsAppAction, whatsAppActionRuntime } from "./src/action-runtime.js";',
257257
'export { createWhatsAppLoginTool } from "./src/agent-tools-login.js";',
258-
'export { formatWhatsAppWebAuthStatusState, getWebAuthAgeMs, hasWebCredsSync, logWebSelfId, logoutWeb, pickWebChannel, readCredsJsonRaw, readWebAuthExistsBestEffort, readWebAuthExistsForDecision, readWebAuthSnapshot, readWebAuthSnapshotBestEffort, readWebAuthState, readWebSelfId, readWebSelfIdentity, readWebSelfIdentityForDecision, resolveDefaultWebAuthDir, resolveWebCredsBackupPath, resolveWebCredsPath, restoreCredsFromBackupIfNeeded, webAuthExists, WHATSAPP_AUTH_UNSTABLE_CODE, WhatsAppAuthUnstableError, type WhatsAppWebAuthState } from "./src/auth-store.js";',
258+
'export { formatWhatsAppWebAuthStatusState, getWebAuthAgeMs, hasWebCredsSync, logWebSelfId, logoutWeb, pickWebChannel, readCredsJsonRaw, readWebAuthExistsBestEffort, readWebAuthExistsForDecision, readWebAuthSnapshot, readWebAuthSnapshotBestEffort, readWebAuthState, readWebSelfId, readWebSelfIdentity, readWebSelfIdentityForDecision, resolveDefaultWebAuthDir, resolveWebCredsBackupPath, resolveWebCredsPath, restoreCredsFromBackupIfNeeded, webAuthExists, WA_WEB_AUTH_DIR, WHATSAPP_AUTH_UNSTABLE_CODE, WhatsAppAuthUnstableError, type WhatsAppWebAuthState } from "./src/auth-store.js";',
259259
'export { DEFAULT_WEB_MEDIA_BYTES, HEARTBEAT_PROMPT, HEARTBEAT_TOKEN, monitorWebChannel, SILENT_REPLY_TOKEN, stripHeartbeatToken, type WebChannelStatus, type WebMonitorTuning } from "./src/auto-reply.js";',
260260
'export { extractContactContext, extractLocationData, extractMediaPlaceholder, extractText, monitorWebInbox, resetWebInboundDedupe, type WebInboundMessage, type WebListenerCloseReason } from "./src/inbound.js";',
261261
'export { loginWeb } from "./src/login.js";',

0 commit comments

Comments
 (0)