Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat(channel): offer the shared Agent creator's card when their device needs permission (#23737)

Arvin Xu8da1eb10ec0e
diff --git a/src/features/Channels/shareRefusal.test.ts b/src/features/Channels/shareRefusal.test.ts
index e4dcdb8970b..256662083f8 100644
--- a/src/features/Channels/shareRefusal.test.ts
+++ b/src/features/Channels/shareRefusal.test.ts
@@ -31,6 +31,16 @@ describe('shareRefusalOf', () => {
).toEqual({ errorType: ChatErrorType.ShareSpendLimitExceeded, owner });
});
+ // A visitor refused a local Agent was told to ask its creator, with no way to reach them.
+ it('offers the owner as a contact when their machine needs their permission', () => {
+ expect(
+ shareRefusalOf(
+ detail({ errorType: ChatErrorType.ShareHeterogeneousAgentUnsupported, status: 'failed' }),
+ 'msg',
+ ),
+ ).toEqual({ errorType: ChatErrorType.ShareHeterogeneousAgentUnsupported, owner });
+ });
+
it('only explains a message that is too long, which the visitor fixes themselves', () => {
expect(
shareRefusalOf(
diff --git a/src/features/Channels/shareRefusal.ts b/src/features/Channels/shareRefusal.ts
index fbe76f55956..830b6b4da26 100644
--- a/src/features/Channels/shareRefusal.ts
+++ b/src/features/Channels/shareRefusal.ts
@@ -4,10 +4,12 @@ import { ChatErrorType } from '@lobechat/types';
/**
* The share refusals a visitor reads beside their message instead of behind a failure mark,
* since the reply will never come; each names what the visitor can do next. Running out of
- * messages or of the share's monthly usage is the owner's limit, so the visitor may ask the
- * owner directly: as a contact, they can message them in their own conversation.
+ * messages or of the share's monthly usage is the owner's limit, and running an Agent on the
+ * owner's own machine needs the owner's permission, so the visitor may ask the owner directly:
+ * as a contact, they can message them in their own conversation.
*/
const SHARE_REFUSALS: Record<string, { addOwner: boolean }> = {
+ [ChatErrorType.ShareHeterogeneousAgentUnsupported]: { addOwner: true },
[ChatErrorType.ShareMessageLimitExceeded]: { addOwner: true },
[ChatErrorType.SharePromptTooLong]: { addOwner: false },
[ChatErrorType.ShareSpendLimitExceeded]: { addOwner: true },