You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a690907
Browse filesBrowse the repository at this point in the historyBrowse files
fix(tables): make the agent tool picker version-aware and enrich the v2 query
The Agent block's tool picker gated on a hardcoded `CORE_AGENT_TOOL_TYPES`
set naming `'table'` with no version resolution. Both Table blocks are
`category: 'blocks'`, so that set is their only route into the picker —
meaning `table_v2` would never appear there, even once it ships and the
toolbar has moved to it. Store base types and match after stripping the
`_vN` suffix so a cutover never has to re-list a block here. The existing
`hideFromToolbar` guard already excludes superseded versions (file v1-v4)
and unrevealed preview blocks, so broadening `file_v5` to `file` admits
nothing new. `BUILT_IN_TOOL_TYPES` had the same gap and would have filed
v2 under Integrations.
`table_query_rows_v2` also shipped with no `toolEnrichment` while all seven
other table tools have one, so an agent using it never saw the table's
column names and had to guess field values. The enrichment module only knew
v1's MongoDB grammar, so adding the id to the existing sets would have
taught the wrong syntax — v2 gets its own branch emitting predicate
examples, `order` rather than `sort`, and cursor paging guidance.
Unlike v1, a v2 query with no filter is valid and returns every row, so the
new branch deliberately does not push `filter` into `required`.
The shared bulk tools stay on `$eq`: the rows route accepts either grammar
via `resolveBulkFilter`, and enrichment is keyed on tool id alone, so it
cannot tell which block invoked it.
Copy file name to clipboardExpand all lines: apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/tool-input.test.ts
Copy file name to clipboardExpand all lines: apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/tool-input/utils.ts
5. like/ilike use * as the wildcard, e.g. {"field":"name","op":"ilike","value":"*jo*"}
104
+
6. There are no array columns - for substring matching use ilike with *x*
105
+
7. For ranking queries (highest, lowest, Nth, top N) set order and a small limit, e.g. limit 1 for the highest, 2 for the second highest
106
+
8. Omit limit to return every matching row; the query fails if the result exceeds 5MB, so narrow with a filter instead of guessing a limit
107
+
9. With a limit, a page can end early at the byte budget - a non-null nextCursor means more rows remain, so pass it back as cursor and loop until it is null. Never infer completion from page size
108
+
10. Omit the filter only when the user genuinely wants every row
description: `Predicate built from the user's question using columns: ${columnNames}. One condition is {"field":"<column>","op":"<operator>","value":<value>}; combine with {"all":[...]} for AND or {"any":[...]} for OR. Operators: eq, ne, gt, gte, lt, lte, in, nin, like, ilike, nlike, nilike, contains, startsWith, endsWith, isNull, isNotNull, isEmpty, isNotEmpty. Omit only to match every row.`,
219
+
}
220
+
}
221
+
222
+
if(enrichedProperties.order){
223
+
enrichedProperties.order={
224
+
...enrichedProperties.order,
225
+
description: `Sort spec as [{"field":"<column>","direction":"asc"|"desc"}] over columns: ${columnNames}. REQUIRED for ranking queries (highest, lowest, Nth).`,
226
+
}
227
+
}
228
+
229
+
if(enrichedProperties.columns){
230
+
enrichedProperties.columns={
231
+
...enrichedProperties.columns,
232
+
description: `Column names to include in each row. Available: ${columnNames}. Omit to return all columns.`,
233
+
}
234
+
}
235
+
236
+
if(enrichedProperties.limit){
237
+
enrichedProperties.limit={
238
+
...enrichedProperties.limit,
239
+
description: `Maximum rows per page (min: 1). Omit to return every matching row; the query fails if the result exceeds 5MB, so narrow with a filter rather than guessing. For ranking queries: 1 for the highest/lowest, 2 for the second highest.`,
240
+
}
241
+
}
242
+
243
+
if(enrichedProperties.cursor){
244
+
enrichedProperties.cursor={
245
+
...enrichedProperties.cursor,
246
+
description: `Opaque cursor from a prior page's nextCursor. Omit for the first page. A non-null nextCursor means more rows remain even if the page came back short - loop until it is null.`,
247
+
}
248
+
}
249
+
250
+
/*
251
+
* Deliberately NOT pushed into `required`: unlike v1, a v2 query with no
252
+
* filter is valid and returns every row. Forcing it would make the model
0 commit comments