Repository navigation
fix(blocks): read the mapper operation from the tool-call context in internal and a–i blocks #10077
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
908b240
fix(integrations): sweep2 m3 — read the mapper operation from the too…
waleedlatif1 f3be21a
chore: regenerate tool metadata, docs and ratchet baselines
waleedlatif1 fa8953f
refactor: simplify and clean up the sweep changes
waleedlatif1 71257d3
fix(blocks): keep tool-row conflictTarget, parse affinity rank/winRat…
waleedlatif1 d2c443f
fix(blocks): fall back to model args for empty carousel media, blank …
waleedlatif1 18fd17e
chore: shrink the mapper-operation baseline after rebasing onto staging
waleedlatif1 45a1b3f
fix(blocks): keep a numeric zero table limit and drop the model authT…
waleedlatif1 ce7bc59
fix(blocks): send one folder target on File append/edit tool calls
waleedlatif1 eb689af
Merge branch 'staging' into sweep2/m3
waleedlatif1 31cf094
Merge remote-tracking branch 'origin/staging' into sweep2/m3
waleedlatif1 5d53a26
chore: regenerate tool metadata and mapper baseline after merging sta…
waleedlatif1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import { describe, expect, it } from 'vitest' | ||
| import { AffinityBlock } from '@/blocks/blocks/affinity' | ||
|
|
||
| /** Runs the mapper the way an Agent tool call does: its result is spread over the merged args. */ | ||
| function toolCall(args: Record<string, unknown>, operation: string) { | ||
| const mapParams = AffinityBlock.tools.config?.params | ||
| if (!mapParams) throw new Error('Affinity block has no params mapper') | ||
| return { ...args, ...mapParams(args, { operation }) } | ||
| } | ||
|
|
||
| describe('AffinityBlock agent tool calls', () => { | ||
| it('maps block-field keys and keeps model args instead of dropping them', () => { | ||
| const result = toolCall( | ||
| { apiKey: 'key', noteEntityType: 'company', entityId: '42', limit: '10' }, | ||
| 'list_entity_notes' | ||
| ) | ||
| expect(result).toMatchObject({ entityType: 'company', entityId: '42', limit: 10 }) | ||
| expect(result.noteEntityType).toBeUndefined() | ||
|
|
||
| expect( | ||
| toolCall({ apiKey: 'key', name: 'Deals', type: 'company', isPublic: true }, 'create_list') | ||
| ).toMatchObject({ name: 'Deals', type: 'company', isPublic: true }) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import { describe, expect, it } from 'vitest' | ||
| import { AgentMailBlock } from '@/blocks/blocks/agentmail' | ||
|
|
||
| /** Runs the mapper the way an Agent tool call does: its result is spread over the merged args. */ | ||
| function toolCall(args: Record<string, unknown>, operation: string) { | ||
| const mapParams = AgentMailBlock.tools.config?.params | ||
| if (!mapParams) throw new Error('AgentMail block has no params mapper') | ||
| return { ...args, ...mapParams(args, { operation }) } | ||
| } | ||
|
|
||
| describe('AgentMailBlock agent tool calls', () => { | ||
| it('maps the block-field reply message key and keeps the model recipients and flags', () => { | ||
| expect( | ||
| toolCall( | ||
| { inboxId: 'inbox', replyMessageId: 'msg-1', to: 'a@example.com', replyAll: true }, | ||
| 'reply_message' | ||
| ) | ||
| ).toMatchObject({ messageId: 'msg-1', to: 'a@example.com', replyAll: true }) | ||
| }) | ||
|
|
||
| it('keeps a boolean permanent flag from the model', () => { | ||
| expect( | ||
| toolCall({ inboxId: 'inbox', threadId: 't-1', permanent: true }, 'delete_thread') | ||
| ).toMatchObject({ permanent: true }) | ||
| }) | ||
|
|
||
| it('treats a stored "false" permanent dropdown as a trash move, not a permanent delete', () => { | ||
| expect( | ||
| toolCall({ inboxId: 'inbox', threadId: 't-1', permanent: 'false' }, 'delete_thread') | ||
| ).toMatchObject({ permanent: false }) | ||
| }) | ||
|
|
||
| it('treats a stored "false" reply-all dropdown as a reply to the sender only', () => { | ||
| expect( | ||
| toolCall({ inboxId: 'inbox', replyMessageId: 'msg-1', replyAll: 'false' }, 'reply_message') | ||
| ).toMatchObject({ replyAll: false }) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { describe, expect, it } from 'vitest' | ||
| import { AgentPhoneBlock } from '@/blocks/blocks/agentphone' | ||
|
|
||
| /** Runs the mapper the way an Agent tool call does: its result is spread over the merged args. */ | ||
| function toolCall(args: Record<string, unknown>, operation: string) { | ||
| const mapParams = AgentPhoneBlock.tools.config?.params | ||
| if (!mapParams) throw new Error('AgentPhone block has no params mapper') | ||
| return { ...args, ...mapParams(args, { operation }) } | ||
| } | ||
|
|
||
| describe('AgentPhoneBlock agent tool calls', () => { | ||
| it('maps block-field filters and coerces limits for an operation passed only in context', () => { | ||
| expect( | ||
| toolCall({ apiKey: 'key', callsStatus: 'completed', limit: '25' }, 'list_calls') | ||
| ).toMatchObject({ status: 'completed', limit: 25 }) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { describe, expect, it } from 'vitest' | ||
| import { AlgoliaBlock } from '@/blocks/blocks/algolia' | ||
|
|
||
| /** Runs the mapper the way an Agent tool call does: its result is spread over the merged args. */ | ||
| function toolCall(args: Record<string, unknown>, operation: string) { | ||
| const mapParams = AlgoliaBlock.tools.config?.params | ||
| if (!mapParams) throw new Error('Algolia block has no params mapper') | ||
| return { ...args, ...mapParams(args, { operation }) } | ||
| } | ||
|
|
||
| describe('AlgoliaBlock agent tool calls', () => { | ||
| it('maps the block-field requests key on a tool call', () => { | ||
| expect( | ||
| toolCall({ indexName: 'products', getRecordsRequests: '[{"objectID":"1"}]' }, 'get_records') | ||
| ).toMatchObject({ requests: '[{"objectID":"1"}]' }) | ||
| }) | ||
|
|
||
| it('keeps the model filters, requests, and copy-or-move operation', () => { | ||
| expect(toolCall({ indexName: 'p', filters: 'brand:x' }, 'delete_by_filter')).toMatchObject({ | ||
| filters: 'brand:x', | ||
| }) | ||
| expect( | ||
| toolCall({ indexName: 'p', requests: [{ objectID: '1' }] }, 'get_records') | ||
| ).toMatchObject({ requests: [{ objectID: '1' }] }) | ||
| expect( | ||
| toolCall({ indexName: 'p', destination: 'q', operation: 'move' }, 'copy_move_index') | ||
| ).toMatchObject({ operation: 'move' }) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import { describe, expect, it } from 'vitest' | ||
| import { AmplitudeBlock } from '@/blocks/blocks/amplitude' | ||
|
|
||
| /** Runs the mapper the way an Agent tool call does: its result is spread over the merged args. */ | ||
| function toolCall(args: Record<string, unknown>, operation: string) { | ||
| const mapParams = AmplitudeBlock.tools.config?.params | ||
| if (!mapParams) throw new Error('Amplitude block has no params mapper') | ||
| return { ...args, ...mapParams(args, { operation }) } | ||
| } | ||
|
|
||
| describe('AmplitudeBlock agent tool calls', () => { | ||
| it('maps the block-field event key for an operation passed only in context', () => { | ||
| expect( | ||
| toolCall( | ||
| { apiKey: 'k', secretKey: 's', segmentationEventType: 'signup', start: '20260101' }, | ||
| 'event_segmentation' | ||
| ) | ||
| ).toMatchObject({ eventType: 'signup', start: '20260101' }) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.