-
Notifications
You must be signed in to change notification settings - Fork 4.3k
feat(framework): add ctx.addReaction() to the agent SDK fixes NV-7411 #10882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
ef67f6d
1b05060
4113059
7da8b5c
c7099da
86a67bd
b9fa8ad
29fb4e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| import type { CardElement, ChatElement } from 'chat'; | ||
| import type { CardElement, ChatElement, Emoji } from 'chat'; | ||
| import type { TriggerRecipientsPayload } from '../../shared'; | ||
| export type { TriggerRecipientsPayload }; | ||
|
|
||
|
|
@@ -178,6 +178,19 @@ export interface AgentContext { | |
| * ctx.trigger('team-alert', { to: { type: 'Topic', topicKey: 'support-team' } }); | ||
| */ | ||
| trigger(workflowId: string, opts?: { to?: TriggerRecipientsPayload; payload?: Record<string, unknown> }): void; | ||
| /** | ||
| * Add an emoji reaction to any platform message. | ||
| * Reactions are queued and sent with the next `ctx.reply()`, or flushed automatically | ||
| * when the handler completes (same batching contract as `ctx.trigger()`). | ||
| * | ||
| * @param messageId - Platform-native message ID to react to (e.g. Slack `ts`). | ||
| * @param emojiName - Emoji short-name (e.g. `'thumbs_up'`, `'check_mark'`). | ||
| * | ||
| * @example | ||
| * ctx.addReaction(ctx.reaction!.messageId, 'check_mark'); | ||
| * await ctx.reply('Done!'); | ||
| */ | ||
| addReaction(messageId: string, emojiName: Emoji): void; | ||
| } | ||
|
Comment on lines
+181
to
194
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
fd -t f 'package.json' packages/framework -d 2 --exec cat {} \; | head -40Repository: novuhq/novu Length of output: 875 🏁 Script executed: git diff HEAD packages/framework/package.json 2>/dev/null || echo "No diff found or git not available"Repository: novuhq/novu Length of output: 37 🏁 Script executed: # Also check if there were any version-related changes
git diff --no-ext-diff HEAD -- packages/framework/package.json | head -50Repository: novuhq/novu Length of output: 37 🏁 Script executed: # List the agent.types.ts file to see full exports
cat -n packages/framework/src/resources/agent/agent.types.ts | tail -30Repository: novuhq/novu Length of output: 1041 Ensure The PR adds Update the version from 🤖 Prompt for AI Agents |
||
|
|
||
| export interface AgentHandlers { | ||
|
|
@@ -241,13 +254,20 @@ export interface EditPayload { | |
| content: ReplyContent; | ||
| } | ||
|
|
||
| /** An emoji reaction to be added to a platform message. */ | ||
| export interface AddReactionPayload { | ||
| messageId: string; | ||
| emojiName: Emoji; | ||
| } | ||
|
|
||
| export interface AgentReplyPayload { | ||
| conversationId: string; | ||
| integrationIdentifier: string; | ||
| reply?: ReplyContent; | ||
| edit?: EditPayload; | ||
| resolve?: { summary?: string }; | ||
| signals?: Signal[]; | ||
| addReactions?: AddReactionPayload[]; | ||
| } | ||
|
|
||
| /** Shape returned by /agents/:id/reply when a reply or edit was delivered. */ | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.