Implement external_select block kit for Slack#397
Conversation
- block_suggestion handler for slack webgook - new <ExternalSelect/> to chat modal jsx - new .onOptionsLoad()
|
@Franz1241 is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
|
Hey @dancer hope its okay to tag you. I noticed youve worked on some Slack-related PRs recently and thought you might be the right person to review this |
|
ping me anytime and will take a look later today |
|
Tysm |
# Conflicts: # packages/adapter-slack/src/index.test.ts
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
perfect this is great thank you so much @Franz1241 sorry for getting to it a bit late will be on the next release cc: @bensabic |
|
also ping me anytime ❤️ will make a follow up to this pr as i see 2 things e.g. initial_option & option_groups |
|
Awesome, thanks a lot 🙌 |
* feat(slack): external_select's block kit implementation - block_suggestion handler for slack webgook - new <ExternalSelect/> to chat modal jsx - new .onOptionsLoad() * feat: add tests for new external_selec implementation * feat(docs): Slack externa_select docs * chore: changeset * chore: remove docs from changeset --------- Co-authored-by: dancer <josh@afterima.ge>
* feat(slack): external_select's block kit implementation - block_suggestion handler for slack webgook - new <ExternalSelect/> to chat modal jsx - new .onOptionsLoad() * feat: add tests for new external_selec implementation * feat(docs): Slack externa_select docs * chore: changeset * chore: remove docs from changeset --------- Co-authored-by: dancer <josh@afterima.ge>
, #397) (#84) * feat(externalselect): add initialOption + option_groups (vercel/chat#410, #397) Ports two upstream PRs that together complete ExternalSelect support: - vercel/chat#397 introduced ExternalSelectElement and the block_suggestion / onOptionsLoad runtime; the runtime half landed here in #66 but the modal element type was deferred. This PR adds the missing ExternalSelectElement TypedDict + ExternalSelect builder and wires up _external_select_to_block in the Slack modal renderer. - vercel/chat#410 adds two new optional fields on top: initialOption (pre-selected option object) and option_groups (labeled sections, Slack max 100 groups x 100 options, label max 75 chars). The handler return type widens to OptionsLoadResult = list[options] | list[OptionsLoadGroup]; the Slack adapter detects grouped form by the presence of an "options" key on the first entry and emits Slack's option_groups response (mutually exclusive with options per Slack's spec). Hazard #1 (truthiness): min_query_length=0 is preserved (0 means "fire on every keystroke"); not silently dropped by an `or` fallback. Hazard #7 (omit vs None): unset initial_option / placeholder / min_query_length are omitted from the rendered Block Kit element, not serialized as null. https://claude.ai/code/session_01FyMxQn2BEAzmwKS1GZczKj * fix(slack): use is-not-None guard for initial_option in external_select renderer Address review on PR #84 (modals.py:209). The TS expression ``if (select.initialOption)`` only filters null/undefined since ``{}`` is truthy in JS. Python ``if initial_option:`` falsely drops a hand-constructed ``initial_option={}`` because empty dicts are falsy. Switch to ``is not None`` for parity with TS and consistency with the ``min_query_length is not None`` check three lines above. Adds test_external_select_initial_option_empty_dict_renders regression test that fails before the fix. https://claude.ai/code/session_01FyMxQn2BEAzmwKS1GZczKj --------- Co-authored-by: Claude <noreply@anthropic.com>
external_select as per Slack Docs
Summary
<ExternalSelect>modal element backed by Slack'sexternal_selectblock, so modals can populate dropdowns from a remote/large data source instead of being limited to static<Select>optionsonOptionsLoad(actionId, handler)for registering loaders. Handlers receive{actionId, query, user, adapter, raw}and return normalized{label, value}[]. Specific action IDs run before catch-all handlers; per-handler errors are isolatedblock_suggestioninteractive payloads, callschat.processOptionsLoad, and converts results into Slack option objects (capped at 100, per Slack's limit).optionsarray and logs a warning, rather than failing the request or leaving Slack hanging.Test plan
-
pnpm validateruns 16/16Closes #398