mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-13 23:56:07 +00:00
fix: keep thread placement metadata cold
This commit is contained in:
1
extensions/discord/thread-binding-api.ts
Normal file
1
extensions/discord/thread-binding-api.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const defaultTopLevelPlacement = "child" as const;
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
normalizeOptionalLowercaseString,
|
||||
normalizeOptionalString,
|
||||
} from "../shared/string-coerce.js";
|
||||
import { getChannelPlugin, getLoadedChannelPlugin, normalizeChannelId } from "./plugins/index.js";
|
||||
import { getLoadedChannelPlugin, normalizeChannelId } from "./plugins/index.js";
|
||||
import { parseExplicitTargetForChannel } from "./plugins/target-parsing.js";
|
||||
import {
|
||||
resolveBundledChannelThreadBindingDefaultPlacement,
|
||||
@@ -233,11 +233,7 @@ export function resolveChannelDefaultBindingPlacement(
|
||||
}
|
||||
const pluginPlacement =
|
||||
resolveRuntimeChannelPlugin(channel)?.conversationBindings?.defaultTopLevelPlacement;
|
||||
return (
|
||||
pluginPlacement ??
|
||||
resolveBundledChannelThreadBindingDefaultPlacement(channel) ??
|
||||
getChannelPlugin(channel)?.conversationBindings?.defaultTopLevelPlacement
|
||||
);
|
||||
return pluginPlacement ?? resolveBundledChannelThreadBindingDefaultPlacement(channel);
|
||||
}
|
||||
|
||||
export function resolveCommandConversationResolution(
|
||||
@@ -405,23 +401,6 @@ export function resolveInboundConversationResolution(
|
||||
return artifactResolution;
|
||||
}
|
||||
|
||||
const bundledPlugin = getChannelPlugin(channel);
|
||||
const bundledConversation =
|
||||
bundledPlugin !== plugin
|
||||
? bundledPlugin?.messaging?.resolveInboundConversation?.(resolverParams)
|
||||
: undefined;
|
||||
const bundledResolution = normalizeResolutionTarget({
|
||||
channel,
|
||||
accountId,
|
||||
conversation: bundledConversation,
|
||||
source: "inbound-bundled-plugin",
|
||||
threadId,
|
||||
plugin: bundledPlugin ?? plugin,
|
||||
});
|
||||
if (bundledResolution || bundledConversation === null) {
|
||||
return bundledResolution;
|
||||
}
|
||||
|
||||
const parentConversationId =
|
||||
resolveChannelTargetId({
|
||||
channel,
|
||||
|
||||
@@ -5,7 +5,8 @@ import {
|
||||
resolveThreadBindingLifecycle as resolveSharedThreadBindingLifecycle,
|
||||
type ThreadBindingLifecycleRecord,
|
||||
} from "../shared/thread-binding-lifecycle.js";
|
||||
import { getChannelPlugin } from "./plugins/index.js";
|
||||
import { getLoadedChannelPlugin } from "./plugins/index.js";
|
||||
import { resolveBundledChannelThreadBindingDefaultPlacement } from "./plugins/thread-binding-api.js";
|
||||
|
||||
export {
|
||||
resolveThreadBindingLifecycle,
|
||||
@@ -64,7 +65,11 @@ function resolveDefaultTopLevelPlacement(channel: string): "current" | "child" {
|
||||
if (!normalized) {
|
||||
return "current";
|
||||
}
|
||||
return getChannelPlugin(normalized)?.conversationBindings?.defaultTopLevelPlacement ?? "current";
|
||||
return (
|
||||
getLoadedChannelPlugin(normalized)?.conversationBindings?.defaultTopLevelPlacement ??
|
||||
resolveBundledChannelThreadBindingDefaultPlacement(normalized) ??
|
||||
"current"
|
||||
);
|
||||
}
|
||||
|
||||
function normalizeBoolean(value: unknown): boolean | undefined {
|
||||
|
||||
Reference in New Issue
Block a user