Skip to content

Commit c09031f

Browse files
committed
fix: tighten inbound replay typing
1 parent 63965dc commit c09031f

3 files changed

Lines changed: 25 additions & 25 deletions

File tree

extensions/nextcloud-talk/src/monitor.replay.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,14 @@ describe("createNextcloudTalkWebhookServer replay handling", () => {
9999
stateDir: params.stateDir,
100100
});
101101

102-
return async (message: NextcloudTalkInboundMessage) =>
102+
return async (message: NextcloudTalkInboundMessage): Promise<void> => {
103103
await processNextcloudTalkReplayGuardedMessage({
104104
replayGuard,
105105
accountId: params.accountId ?? "acct",
106106
message,
107107
handleMessage: () => params.handleMessage(message),
108108
});
109+
};
109110
}
110111

111112
it("acknowledges replayed requests and skips onMessage side effects", async () => {

extensions/whatsapp/src/inbound/monitor.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ function shouldClearSocketRefAfterSendFailure(err: unknown): boolean {
4646
return /closed|reset|disconnect|no active socket/i.test(formatError(err));
4747
}
4848

49+
function isNonEmptyString(value: string | undefined): value is string {
50+
return Boolean(value);
51+
}
52+
4953
export type MonitorWebInboxOptions = {
5054
verbose: boolean;
5155
accountId: string;
@@ -132,11 +136,7 @@ export async function attachWebInboxToSocket(
132136
error?: unknown,
133137
): Promise<void> => {
134138
const dedupeKeys = [
135-
...new Set(
136-
entries
137-
.map((entry) => entry.dedupeKey)
138-
.filter((dedupeKey): dedupeKey is string => Boolean(dedupeKey)),
139-
),
139+
...new Set(entries.map((entry) => entry.dedupeKey).filter(isNonEmptyString)),
140140
];
141141
if (dedupeKeys.length === 0) {
142142
return;

src/wizard/setup.ts

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { formatCliCommand } from "../cli/command-format.js";
22
import type {
3+
AuthChoice,
34
GatewayAuthChoice,
45
OnboardMode,
56
OnboardOptions,
@@ -484,25 +485,23 @@ export async function runSetupWizard(
484485
let nextConfig: OpenClawConfig = applyLocalSetupWorkspaceConfig(baseConfig, workspaceDir);
485486

486487
const authChoiceFromPrompt = opts.authChoice === undefined;
487-
const promptedAuthChoice = authChoiceFromPrompt
488-
? await (async () => {
489-
const { ensureAuthProfileStore } = await import("../agents/auth-profiles.runtime.js");
490-
const { promptAuthChoiceGrouped } = await import("../commands/auth-choice-prompt.js");
491-
const authStore = ensureAuthProfileStore(undefined, {
492-
allowKeychainPrompt: false,
493-
});
494-
return await promptAuthChoiceGrouped({
495-
prompter,
496-
store: authStore,
497-
includeSkip: true,
498-
config: nextConfig,
499-
workspaceDir,
500-
});
501-
})()
502-
: undefined;
503-
const authChoice = opts.authChoice ?? promptedAuthChoice;
504-
if (!authChoice) {
505-
throw new Error("Failed to resolve auth choice.");
488+
let authChoice: AuthChoice | undefined = opts.authChoice;
489+
if (authChoiceFromPrompt) {
490+
const { ensureAuthProfileStore } = await import("../agents/auth-profiles.runtime.js");
491+
const { promptAuthChoiceGrouped } = await import("../commands/auth-choice-prompt.js");
492+
const authStore = ensureAuthProfileStore(undefined, {
493+
allowKeychainPrompt: false,
494+
});
495+
authChoice = await promptAuthChoiceGrouped({
496+
prompter,
497+
store: authStore,
498+
includeSkip: true,
499+
config: nextConfig,
500+
workspaceDir,
501+
});
502+
}
503+
if (authChoice === undefined) {
504+
throw new WizardCancelledError("auth choice is required");
506505
}
507506

508507
if (authChoice === "custom-api-key") {

0 commit comments

Comments
 (0)