惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
Check Point Blog
Y
Y Combinator Blog
GbyAI
GbyAI
Microsoft Azure Blog
Microsoft Azure Blog
Martin Fowler
Martin Fowler
博客园_首页
大猫的无限游戏
大猫的无限游戏
美团技术团队
S
SegmentFault 最新的问题
T
The Blog of Author Tim Ferriss
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
MyScale Blog
MyScale Blog
小众软件
小众软件
Vercel News
Vercel News
阮一峰的网络日志
阮一峰的网络日志
N
Netflix TechBlog - Medium
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
量子位
博客园 - 【当耐特】
J
Java Code Geeks
F
Fortinet All Blogs
宝玉的分享
宝玉的分享
Stack Overflow Blog
Stack Overflow Blog
博客园 - 司徒正美

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix: align native think menus with session models · openc...
steipete · 2026-04-25 · via Recent Commits to openclaw:main

@@ -1,6 +1,11 @@

11

import type { SlackActionMiddlewareArgs, SlackCommandMiddlewareArgs } from "@slack/bolt";

2+

import { resolveDefaultModelForAgent } from "openclaw/plugin-sdk/agent-runtime";

23

import { createChannelReplyPipeline } from "openclaw/plugin-sdk/channel-reply-pipeline";

3-

import type { ChatCommandDefinition } from "openclaw/plugin-sdk/command-auth";

4+

import {

5+

formatCommandArgMenuTitle,

6+

resolveStoredModelOverride,

7+

type ChatCommandDefinition,

8+

} from "openclaw/plugin-sdk/command-auth";

49

import {

510

type CommandArgs,

611

resolveCommandAuthorizedFromAuthorizers,

@@ -9,11 +14,18 @@ import {

914

import {

1015

resolveNativeCommandsEnabled,

1116

resolveNativeSkillsEnabled,

17+

loadSessionStore,

18+

resolveStorePath,

1219

} from "openclaw/plugin-sdk/config-runtime";

1320

import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";

1421

import type { ReplyPayload } from "openclaw/plugin-sdk/reply-runtime";

22+

import type { ResolvedAgentRoute } from "openclaw/plugin-sdk/routing";

1523

import { danger, logVerbose } from "openclaw/plugin-sdk/runtime-env";

16-

import { chunkItems, normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/text-runtime";

24+

import {

25+

chunkItems,

26+

normalizeLowercaseStringOrEmpty,

27+

normalizeOptionalString,

28+

} from "openclaw/plugin-sdk/text-runtime";

1729

import type { ResolvedSlackAccount } from "../accounts.js";

1830

import { truncateSlackText } from "../truncate.js";

1931

import { resolveSlackAllowListMatch, resolveSlackUserAllowed } from "./allow-list.js";

@@ -74,6 +86,51 @@ function loadSlashSkillCommandsRuntime() {

7486

return slashSkillCommandsRuntimePromise;

7587

}

768889+

function resolveSlackCommandMenuModelContext(params: {

90+

cfg: SlackMonitorContext["cfg"];

91+

agentId: string;

92+

sessionKey: string;

93+

}): { provider?: string; model?: string } {

94+

if (!params.sessionKey.trim()) {

95+

return {};

96+

}

97+

try {

98+

const defaultModel = resolveDefaultModelForAgent({

99+

cfg: params.cfg,

100+

agentId: params.agentId,

101+

});

102+

const storePath = resolveStorePath(params.cfg.session?.store, { agentId: params.agentId });

103+

const store = loadSessionStore(storePath);

104+

const entry = store[params.sessionKey];

105+

if (entry?.modelOverrideSource === "auto" && normalizeOptionalString(entry.modelOverride)) {

106+

return { provider: defaultModel.provider, model: defaultModel.model };

107+

}

108+

const override = resolveStoredModelOverride({

109+

sessionEntry: entry,

110+

sessionStore: store,

111+

sessionKey: params.sessionKey,

112+

defaultProvider: defaultModel.provider,

113+

});

114+

if (override?.model) {

115+

return {

116+

provider: override.provider || defaultModel.provider,

117+

model: override.model,

118+

};

119+

}

120+

const provider =

121+

normalizeOptionalString(entry?.providerOverride) ??

122+

normalizeOptionalString(entry?.modelProvider);

123+

const model =

124+

normalizeOptionalString(entry?.modelOverride) ?? normalizeOptionalString(entry?.model);

125+

return {

126+

...(provider ? { provider } : {}),

127+

...(model ? { model } : {}),

128+

};

129+

} catch {

130+

return {};

131+

}

132+

}

133+77134

type EncodedMenuChoice = SlackExternalArgMenuChoice;

78135

const slackExternalArgMenuStore = createSlackExternalArgMenuStore();

79136

@@ -496,17 +553,49 @@ export async function registerSlackMonitorSlashCommands(params: {

496553

}

497554

}

498555556+

let resolvedSlashRoute: ResolvedAgentRoute | undefined;

557+

const resolveSlashRoute = async () => {

558+

if (resolvedSlashRoute) {

559+

return resolvedSlashRoute;

560+

}

561+

const { resolveAgentRoute } = await loadSlashDispatchRuntime();

562+

resolvedSlashRoute = resolveAgentRoute({

563+

cfg,

564+

channel: "slack",

565+

accountId: account.accountId,

566+

teamId: ctx.teamId || undefined,

567+

peer: {

568+

kind: isDirectMessage ? "direct" : isRoom ? "channel" : "group",

569+

id: isDirectMessage ? command.user_id : command.channel_id,

570+

},

571+

});

572+

return resolvedSlashRoute;

573+

};

574+499575

if (commandDefinition && supportsInteractiveArgMenus) {

500576

const { resolveCommandArgMenu } = await loadSlashCommandsRuntime();

577+

const menuNeedsModelContext =

578+

!(commandArgs?.raw && !commandArgs.values) &&

579+

commandDefinition.args?.some(

580+

(arg) => typeof arg.choices === "function" && commandArgs?.values?.[arg.name] == null,

581+

);

582+

const menuRoute = menuNeedsModelContext ? await resolveSlashRoute() : undefined;

583+

const menuModelContext = menuRoute

584+

? resolveSlackCommandMenuModelContext({

585+

cfg,

586+

agentId: menuRoute.agentId,

587+

sessionKey: menuRoute.sessionKey,

588+

})

589+

: {};

501590

const menu = resolveCommandArgMenu({

502591

command: commandDefinition,

503592

args: commandArgs,

504593

cfg,

594+

...menuModelContext,

505595

});

506596

if (menu) {

507597

const commandLabel = commandDefinition.nativeName ?? commandDefinition.key;

508-

const title =

509-

menu.title ?? `Choose ${menu.arg.description || menu.arg.name} for /${commandLabel}.`;

598+

const title = formatCommandArgMenuTitle({ command: commandDefinition, menu });

510599

const blocks = buildSlackCommandArgMenuBlocks({

511600

title,

512601

command: commandLabel,

@@ -539,16 +628,18 @@ export async function registerSlackMonitorSlashCommands(params: {

539628

resolveMarkdownTableMode,

540629

} = await loadSlashDispatchRuntime();

541630542-

const route = resolveAgentRoute({

543-

cfg,

544-

channel: "slack",

545-

accountId: account.accountId,

546-

teamId: ctx.teamId || undefined,

547-

peer: {

548-

kind: isDirectMessage ? "direct" : isRoom ? "channel" : "group",

549-

id: isDirectMessage ? command.user_id : command.channel_id,

550-

},

551-

});

631+

const route =

632+

resolvedSlashRoute ??

633+

resolveAgentRoute({

634+

cfg,

635+

channel: "slack",

636+

accountId: account.accountId,

637+

teamId: ctx.teamId || undefined,

638+

peer: {

639+

kind: isDirectMessage ? "direct" : isRoom ? "channel" : "group",

640+

id: isDirectMessage ? command.user_id : command.channel_id,

641+

},

642+

});

552643553644

const { untrustedChannelMetadata, groupSystemPrompt } = resolveSlackRoomContextHints({

554645

isRoomish,