fix: add default values for optional config fields #3

Merged
hzhang merged 34 commits from feat/whispergate-mvp into main 2026-02-27 15:31:33 +00:00
2 changed files with 7 additions and 1 deletions
Showing only changes of commit f23d9049a7 - Show all commits

View File

@@ -355,7 +355,7 @@ export default {
return { content: [{ type: "text", text: `unsupported action: ${action}` }], isError: true }; return { content: [{ type: "text", text: `unsupported action: ${action}` }], isError: true };
}, },
}, },
{ optional: true }, { optional: false },
); );
api.on("message_received", async (event, ctx) => { api.on("message_received", async (event, ctx) => {

View File

@@ -73,6 +73,12 @@ export function evaluateDecision(params: {
return { shouldUseNoReply: false, shouldInjectEndMarkerPrompt: false, reason: "non_discord" }; return { shouldUseNoReply: false, shouldInjectEndMarkerPrompt: false, reason: "non_discord" };
} }
// DM bypass: if no conversation info was found in the prompt (no senderId AND no channelId),
// this is a DM session where untrusted metadata is not injected. Always allow through.
if (!params.senderId && !params.channelId) {
return { shouldUseNoReply: false, shouldInjectEndMarkerPrompt: true, reason: "dm_no_metadata_bypass" };
}
const policy = resolvePolicy(config, params.channelId, params.channelPolicies); const policy = resolvePolicy(config, params.channelId, params.channelPolicies);
const mode = policy.listMode; const mode = policy.listMode;