





















@@ -698,14 +698,7 @@ async function runManifestProbes(plan, options) {
698698}
699699}
700700if (plan.runtimeSlashAliases.length > 0 && plan.activeInThisProbe) {
701-const commands = await retryRpcCall(
702-"commands.list",
703-{ scope: "both", includeArgs: true },
704-options,
705-);
706-for (const alias of plan.runtimeSlashAliases) {
707-assertCommandVisible(commands, alias);
708-}
701+await retryCommandsListWithAliases(plan.runtimeSlashAliases, options);
709702} else if (plan.runtimeSlashAliases.length > 0) {
710703console.log(
711704`Runtime slash command smoke skipped for ${options.pluginId}: plugin is lazy in this probe`,
@@ -741,10 +734,10 @@ function isChannelVisible(payload, channel) {
741734return false;
742735}
743736744-function assertCommandVisible(payload, alias) {
737+export function isCommandVisible(payload, alias) {
745738const expected = alias.replace(/^\//u, "").toLowerCase();
746739const commands = Array.isArray(payload.commands) ? payload.commands : [];
747-const found = commands.some((command) => {
740+return commands.some((command) => {
748741const names = [
749742command?.name,
750743command?.nativeName,
@@ -754,13 +747,34 @@ function assertCommandVisible(payload, alias) {
754747.map((value) => value.replace(/^\//u, "").toLowerCase());
755748return names.includes(expected);
756749});
757-if (!found) {
750+}
751+752+function assertCommandVisible(payload, alias) {
753+const expected = alias.replace(/^\//u, "").toLowerCase();
754+if (!isCommandVisible(payload, alias)) {
758755throw new Error(
759756`commands.list did not include /${expected}: ${JSON.stringify(payload).slice(0, 2000)}`,
760757);
761758}
762759}
763760761+async function retryCommandsListWithAliases(aliases, options) {
762+const started = Date.now();
763+let commands;
764+while (Date.now() - started < COMMAND_TIMEOUT_MS) {
765+commands = await retryRpcCall("commands.list", { scope: "both", includeArgs: true }, options);
766+const missing = aliases.filter((alias) => !isCommandVisible(commands, alias));
767+if (missing.length === 0) {
768+return commands;
769+}
770+await delay(500);
771+}
772+for (const alias of aliases) {
773+assertCommandVisible(commands, alias);
774+}
775+return commands;
776+}
777+764778function assertToolVisible(payload, tool) {
765779const groups = Array.isArray(payload.groups) ? payload.groups : [];
766780const found = groups.some((group) =>
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。