Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/sim/lib/sim-search/live/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Each event must exist under the source's delegated token, be in an allowed calen

### Slack

Member mode only. Search uses the connected user's Slack real-time search grant and provider search syntax. Date bounds are sent as numeric provider timestamps; date ordering selects keyword retrieval and timestamp sort, because Slack semantic retrieval uses relevance ordering. Channels, messages, direct messages, and files are limited by that grant and provider scopes; there is no admin channel filter in member mode. Missing required search scopes produce a reconnect status. Thread/file reads use the same connected identity. Real-time Search returns only a file's title for a file hit, so the hit names the file's type and size and whether a read returns its text. A file read downloads the full text of a canvas (HTML), text snippet, PDF or DOCX from `files.slack.com` only, using `url_private_download` when present (Slack redirects a PDF's `url_private` to a viewer on another domain), never a remote file's own URL (redirects are followed only within that host; a hop elsewhere, such as a sign-in page, keeps the preview), within the shared response-size limit; when Slack will not serve it, the read returns the `files.info` preview. Real-time Search returns at most 20 results a call and counts every page against the member's rate limit, so a search across every source reads one page; a Slack-scoped or native Slack search follows the cursor for up to three pages to fill its limit, and a later page that fails keeps the earlier pages and returns the unread cursor.
Member mode only. Search uses the connected user's Slack real-time search grant and provider search syntax. Date bounds are sent as numeric provider timestamps; date ordering selects keyword retrieval and timestamp sort, because Slack semantic retrieval uses relevance ordering. Channels, messages, direct messages, and files are limited by that grant and provider scopes; there is no admin channel filter in member mode. Missing required search scopes produce a reconnect status. Thread/file reads use the same connected identity. Real-time Search returns only a file's title for a file hit, so the hit names the file's type and size and whether a read can return its text. A file read downloads the full text of a canvas (HTML), text snippet, PDF or DOCX from `files.slack.com` only, using `url_private_download` when present (Slack redirects a PDF's `url_private` to a viewer on another domain), never a remote file's own URL (redirects are followed only within that host; a hop elsewhere, such as a sign-in page, keeps the preview), within the shared response-size limit; when Slack will not serve it, the read returns the `files.info` preview. Real-time Search returns at most 20 results a call and counts every page against the member's rate limit, so a search across every source reads one page; a Slack-scoped or native Slack search follows the cursor for up to three pages to fill its limit, and a later page that fails keeps the earlier pages and returns the unread cursor.

### GitHub

Expand Down
10 changes: 5 additions & 5 deletions apps/sim/lib/sim-search/live/providers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ describe('Slack file hits', () => {
...fields,
})

it('says what each file is and whether a read returns its text, instead of echoing its title', async () => {
it('says what each file is and whether a read can return its text, instead of echoing its title', async () => {
expect(
await fileHits([
hit({ file_type: 'application/pdf', size: 245760 }),
Expand All @@ -223,9 +223,9 @@ describe('Slack file hits', () => {
hit({ file_type: 'application/vnd.slack-list' }),
])
).toEqual([
'PDF, 240 KB. Reading it returns its full text.',
'Canvas. Reading it returns its full text.',
'CSV. Reading it returns its full text.',
'PDF, 240 KB. Reading it can return its full text.',
'Canvas. Reading it can return its full text.',
'CSV. Reading it can return its full text.',
'Image. Its contents cannot be read here; open the source.',
'List. Its contents cannot be read here; open the source.',
])
Expand All @@ -239,7 +239,7 @@ describe('Slack file hits', () => {
hit({ file_type: 'application/x-unknown', title: 'Plan v2.1 final', content: '' }),
])
).toEqual([
'PDF. Reading it returns its full text.\nRevenue grew 12% in Q3',
'PDF. Reading it can return its full text.\nRevenue grew 12% in Q3',
'File. Its contents cannot be read here; open the source.',
'File. Its contents cannot be read here; open the source.',
])
Expand Down
4 changes: 2 additions & 2 deletions apps/sim/lib/sim-search/live/slack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ function knownFileLabel(mimetype: string): string {

/**
* Slack search returns only a file's title, repeated as its content. A hit says what the file is
* and whether reading it returns its text, so a reader can tell which files to open.
* and whether reading it can return its text, so a reader can tell which files to open.
*/
function slackFileHitContent(file: Record<string, unknown>, users: Map<string, string>): string {
const mimetype = normalizeMimeType(string(file.file_type))
Expand All @@ -402,7 +402,7 @@ function slackFileHitContent(file: Record<string, unknown>, users: Map<string, s
: file.size === 0
? 'The file is empty.'
: withinDownloadLimit(format, file.size)
? 'Reading it returns its full text.'
? 'Reading it can return its full text.'
: 'Too large to read in full here; open the source.'
const text = slackPlainText(string(file.content), users)
return [`${summary}. ${reading}`, text === string(file.title) ? '' : text]
Expand Down
Loading