Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(connected-apps): leave the shared hint helper alone and skip the account note when there is nothing to say
David Neyrad0bf4a78c88d
diff --git a/server/connector-account-hint.ts b/server/connector-account-hint.tsindex 847a6a895a..648a7ebbe5 100644--- a/server/connector-account-hint.ts+++ b/server/connector-account-hint.ts@@ -41,9 +41,14 @@ function usable(accounts: ConnectedAccounts, toolkit: string): readonly Connectereturn (accounts[toolkit] ?? []).filter((account) => /^active$/i.test(account.status));}+/** The tool the call names: the first that is not one of Composio's own management tools. */+function calledTool(slugs: readonly string[]): string {+ return slugs.find((candidate) => candidate && !candidate.startsWith("COMPOSIO_")) ?? slugs[0] ?? "";+}+/** The note for a call refused on the account it used: the other accounts of that app, by alias or id. */export function accountHint(slugs: readonly string[], accounts: ConnectedAccounts): string {- const slug = slugs.find((candidate) => candidate && !candidate.startsWith("COMPOSIO_")) ?? "";+ const slug = calledTool(slugs);const toolkit = toolkitOf(slug);const known = usable(accounts, toolkit);if (known.length < 2) return "";@@ -69,5 +74,8 @@ export async function withAccountHint(): Promise<Uint8Array> {if (!ACCOUNT_ERROR.test(new TextDecoder().decode(bytes))) return bytes;const accounts = await loadAccounts().catch(() => ({}) as ConnectedAccounts);- return withFailedCallHint(bytes, contentType, ACCOUNT_ERROR, (failed) => accountHint(failed, accounts), slugs);+ // Nothing to say when that app has no other account to try: the answer stays as it was.+ const note = accountHint(slugs, accounts);+ if (!note) return bytes;+ return withFailedCallHint(bytes, contentType, ACCOUNT_ERROR, (failed) => accountHint(failed, accounts) || note, slugs);}diff --git a/server/connector-scope-hint.ts b/server/connector-scope-hint.tsindex 219d516f91..6c15de8ad7 100644--- a/server/connector-scope-hint.ts+++ b/server/connector-scope-hint.ts@@ -93,10 +93,7 @@ export function annotateFailedCall(if (!refusals.length && result.isError === true && texts.some((text) => pattern.test(text))) refusals.push(null);if (!refusals.length) return false;const named = refusals.filter((slug): slug is string => slug !== null);- // A hint with nothing to say (an app with no other account to try) leaves the result as it was.- const note = hint(named.length ? named : slugs);- if (!note) return false;- result.content.push({ type: "text", text: note });+ result.content.push({ type: "text", text: hint(named.length ? named : slugs) });return true;}