Skip to content

Commit 353612e

Browse files
committed
improvement(tools): read tool metadata once in the review provider and drop a history phrase
1 parent f37d9d9 commit 353612e

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

‎apps/sim/components/assistant-actions/review.tsx‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,14 +150,14 @@ export function AssistantActionReviewProvider({
150150
messageReceiptIds.set(
151151
message.id,
152152
new Set(
153-
message.contentBlocks?.flatMap(({ toolCall }) =>
154-
toolCall &&
155-
getToolMetadata(toolCall.name)?.assistant &&
156-
(getToolMetadata(toolCall.name)?.effect === 'write' ||
157-
toolCall.status === ToolCallStatus.awaiting_approval)
153+
message.contentBlocks?.flatMap(({ toolCall }) => {
154+
const metadata = toolCall && getToolMetadata(toolCall.name)
155+
return toolCall &&
156+
metadata?.assistant &&
157+
(metadata.effect === 'write' || toolCall.status === ToolCallStatus.awaiting_approval)
158158
? [toolCall.id]
159159
: []
160-
)
160+
})
161161
)
162162
)
163163
const messageStreamId =
@@ -175,9 +175,11 @@ export function AssistantActionReviewProvider({
175175
}
176176
turn.messageId = message.id
177177
for (const { toolCall } of message.contentBlocks ?? []) {
178-
if (!toolCall || !getToolMetadata(toolCall.name)?.assistant) continue
178+
if (!toolCall) continue
179+
const metadata = getToolMetadata(toolCall.name)
180+
if (!metadata?.assistant) continue
179181
turn.representedIds.add(toolCall.id)
180-
if (getToolMetadata(toolCall.name)?.effect === 'write') turn.writeIds.add(toolCall.id)
182+
if (metadata.effect === 'write') turn.writeIds.add(toolCall.id)
181183
if (toolCall.status === ToolCallStatus.awaiting_approval) turn.hasApprovalRows = true
182184
}
183185
turns.set(messageStreamId, turn)

‎scripts/check-tool-effects.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* POST, the rest of function-valued verbs, and in-process operations are not judged here: their
2121
* effect comes from the tool's documented semantics. The `add-tools` skill lists the rules.
2222
*
23-
* The tree was classified when this landed, so there is no baseline.
23+
* Every tool is already classified, so there is no baseline.
2424
*
2525
* Usage: bun run check:tool-effects
2626
*/

0 commit comments

Comments
 (0)