Skip to content

Commit d904e17

Browse files
authored
chore(mothership): sync the Search assistant tool contract from mothership (#9250)
1 parent 583e0ea commit d904e17

1 file changed

Lines changed: 65 additions & 61 deletions

File tree

‎apps/sim/lib/mothership/generated/sim-assistant-tools.generated.ts‎

Lines changed: 65 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -241,67 +241,71 @@ export const workspaceSearchFiltersSchema = z.object({
241241
),
242242
})
243243

244-
export const searchWorkspaceInputSchema = workspaceSearchFiltersSchema
245-
.extend({
246-
nativeQueries: nativeSearchQueriesSchema
247-
.optional()
248-
.describe(
249-
`Live search only: queries in a provider's own language (Drive q, Gmail operators, JQL, CQL, GitHub qualifiers, Slack RTS, plain Linear/Fireflies/HubSpot/Lucid/Zoom terms, bounded local Google Meet text matching, Granola natural-language questions, Notion keywords or AI questions when available). Blank queries require a date bound, sortBy newest/oldest, or explicit browse mode. Lucid browse folder lists root or a numeric folder project; Notion browse private/shared/favorites/recent lists sidebar pages. Recent means viewed, not modified. Up to ${MAX_NATIVE_QUERIES_PER_ACCOUNT} per account run separately and merge; one GitHub, GitLab, or HubSpot query without a kind searches GitHub issues (plus code when the query has no date bound or boolean operators, as its status message says), GitLab issues, merge requests, and code, or every HubSpot CRM kind; other collections, and multiple content queries on one account, each need a kind, which may repeat; explicit browse queries may select distinct folders or sidebar sections without a kind. HubSpot kinds are contacts, companies, deals, and tickets; Lucid kinds are lucidchart and lucidspark. Google Meet kinds are transcript and smart_notes (note metadata and Docs link only); it searches bounded recent conference artifacts with 30-day retention. Zoom kind is meeting and searches past occurrences; read for transcripts and separately labeled summaries. Use Drive for saved Meet note bodies and older transcripts; Drive dates mean file modification time. HubSpot, Lucid, Zoom and Meet reject ownership filters. Lucid title search has no continuation; folder browsing is paginated and returns child folders in account coverage; project can scope a literal shape-text query to one known document UUID or Lucid URL. Read for structured diagram evidence. Dates and sorting cover only retrieved candidates, not globally newest/oldest matches. Write queries from the returned live guidance and account IDs; each account status names the queryIndex its cursor belongs to. Omit for simple cross-provider terms.`
250-
),
251-
query: z
252-
.string()
253-
.trim()
254-
.max(2000)
255-
.default('')
256-
.describe(
257-
'Search terms, without dates already supplied as filters. May be empty for a live listing with a date bound or sortBy newest or oldest where supported, or use an explicit native browse mode. Notion date-only search depends on plan capabilities.'
258-
),
259-
topK: z
260-
.number()
261-
.int()
262-
.min(1)
263-
.max(50)
264-
.default(20)
265-
.describe(
266-
'Maximum matching passage previews; retrieval ranking is independent of preview length.'
267-
),
268-
})
269-
.superRefine((input, context) => {
270-
const bounded = Boolean(
271-
input.startDate ||
272-
input.endDate ||
273-
input.modifiedAfter ||
274-
input.modifiedBefore ||
275-
input.sortBy === 'newest' ||
276-
input.sortBy === 'oldest'
277-
)
278-
if (
279-
!input.query &&
280-
!input.nativeQueries?.some((query) => query.query || query.browse) &&
281-
!bounded
282-
)
283-
context.addIssue({
284-
code: 'custom',
285-
path: ['query'],
286-
message: 'Supply search terms, a native query, a date bound, or sortBy newest or oldest.',
287-
})
288-
if (
289-
input.startDate &&
290-
input.endDate &&
291-
Date.parse(input.startDate) >= Date.parse(input.endDate)
292-
)
293-
context.addIssue({
294-
code: 'custom',
295-
path: ['endDate'],
296-
message: 'endDate must be after startDate.',
297-
})
298-
if (input.nativeQueries?.some((query) => !query.query && !query.browse) && !bounded)
299-
context.addIssue({
300-
code: 'custom',
301-
path: ['nativeQueries'],
302-
message: 'Empty native queries require a date bound or sortBy newest or oldest.',
303-
})
304-
})
244+
export const searchWorkspaceInputFieldsSchema = workspaceSearchFiltersSchema.extend({
245+
nativeQueries: nativeSearchQueriesSchema
246+
.optional()
247+
.describe(
248+
`Live search only: queries in a provider's own language (Drive q, Gmail operators, JQL, CQL, GitHub qualifiers, Slack RTS, plain Linear/Fireflies/HubSpot/Lucid/Zoom terms, bounded local Google Meet text matching, Granola natural-language questions, Notion keywords or AI questions when available). Blank queries require a date bound, sortBy newest/oldest, or explicit browse mode. Lucid browse folder lists root or a numeric folder project; Notion browse private/shared/favorites/recent lists sidebar pages. Recent means viewed, not modified. Up to ${MAX_NATIVE_QUERIES_PER_ACCOUNT} per account run separately and merge; one GitHub, GitLab, or HubSpot query without a kind searches GitHub issues (plus code when the query has no date bound or boolean operators, as its status message says), GitLab issues, merge requests, and code, or every HubSpot CRM kind; other collections, and multiple content queries on one account, each need a kind, which may repeat; explicit browse queries may select distinct folders or sidebar sections without a kind. HubSpot kinds are contacts, companies, deals, and tickets; Lucid kinds are lucidchart and lucidspark. Google Meet kinds are transcript and smart_notes (note metadata and Docs link only); it searches bounded recent conference artifacts with 30-day retention. Zoom kind is meeting and searches past occurrences; read for transcripts and separately labeled summaries. Use Drive for saved Meet note bodies and older transcripts; Drive dates mean file modification time. HubSpot, Lucid, Zoom and Meet reject ownership filters. Lucid title search has no continuation; folder browsing is paginated and returns child folders in account coverage; project can scope a literal shape-text query to one known document UUID or Lucid URL. Read for structured diagram evidence. Dates and sorting cover only retrieved candidates, not globally newest/oldest matches. Write queries from the returned live guidance and account IDs; each account status names the queryIndex its cursor belongs to. Omit for simple cross-provider terms.`
249+
),
250+
query: z
251+
.string()
252+
.trim()
253+
.max(2000)
254+
.default('')
255+
.describe(
256+
'Search terms, without dates already supplied as filters. May be empty for a live listing with a date bound or sortBy newest or oldest where supported, or use an explicit native browse mode. Notion date-only search depends on plan capabilities.'
257+
),
258+
topK: z
259+
.number()
260+
.int()
261+
.min(1)
262+
.max(50)
263+
.default(20)
264+
.describe(
265+
'Maximum matching passage previews; retrieval ranking is independent of preview length.'
266+
),
267+
})
268+
269+
/** Rules shared by every search input schema built from {@link searchWorkspaceInputFieldsSchema}. */
270+
export function refineSearchWorkspaceInput(
271+
input: Omit<z.output<typeof searchWorkspaceInputFieldsSchema>, 'topK'>,
272+
context: z.RefinementCtx
273+
) {
274+
const bounded = Boolean(
275+
input.startDate ||
276+
input.endDate ||
277+
input.modifiedAfter ||
278+
input.modifiedBefore ||
279+
input.sortBy === 'newest' ||
280+
input.sortBy === 'oldest'
281+
)
282+
if (
283+
!input.query &&
284+
!input.nativeQueries?.some((query) => query.query || query.browse) &&
285+
!bounded
286+
)
287+
context.addIssue({
288+
code: 'custom',
289+
path: ['query'],
290+
message: 'Supply search terms, a native query, a date bound, or sortBy newest or oldest.',
291+
})
292+
if (input.startDate && input.endDate && Date.parse(input.startDate) >= Date.parse(input.endDate))
293+
context.addIssue({
294+
code: 'custom',
295+
path: ['endDate'],
296+
message: 'endDate must be after startDate.',
297+
})
298+
if (input.nativeQueries?.some((query) => !query.query && !query.browse) && !bounded)
299+
context.addIssue({
300+
code: 'custom',
301+
path: ['nativeQueries'],
302+
message: 'Empty native queries require a date bound or sortBy newest or oldest.',
303+
})
304+
}
305+
306+
export const searchWorkspaceInputSchema = searchWorkspaceInputFieldsSchema.superRefine(
307+
refineSearchWorkspaceInput
308+
)
305309

306310
export const readDocumentInputSchema = z.object({
307311
documentId: z

0 commit comments

Comments
 (0)