Skip to content

Commit c64d69d

Browse files
authored
chore(release): version 1.28.0 (#1480)
1 parent 064ef2e commit c64d69d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1868
-313
lines changed

docs/reference/app/app.html

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
4848
<dl>
4949
<dt id="slack_bolt.app.app.App"><code class="flex name class">
5050
<span>class <span class="ident">App</span></span>
51-
<span>(</span><span>*,<br>logger: logging.Logger | None = None,<br>name: str | None = None,<br>process_before_response: bool = False,<br>raise_error_for_unhandled_request: bool = False,<br>signing_secret: str | None = None,<br>token: str | None = None,<br>token_verification_enabled: bool = True,<br>client: slack_sdk.web.client.WebClient | None = None,<br>before_authorize: <a title="slack_bolt.middleware.middleware.Middleware" href="../middleware/middleware.html#slack_bolt.middleware.middleware.Middleware">Middleware</a> | Callable[..., Any] | None = None,<br>authorize: Callable[..., <a title="slack_bolt.authorization.authorize_result.AuthorizeResult" href="../authorization/authorize_result.html#slack_bolt.authorization.authorize_result.AuthorizeResult">AuthorizeResult</a>] | None = None,<br>user_facing_authorize_error_message: str | None = None,<br>installation_store: slack_sdk.oauth.installation_store.installation_store.InstallationStore | None = None,<br>installation_store_bot_only: bool | None = None,<br>request_verification_enabled: bool = True,<br>ignoring_self_events_enabled: bool = True,<br>ignoring_self_assistant_message_events_enabled: bool = True,<br>ssl_check_enabled: bool = True,<br>url_verification_enabled: bool = True,<br>attaching_function_token_enabled: bool = True,<br>oauth_settings: <a title="slack_bolt.oauth.oauth_settings.OAuthSettings" href="../oauth/oauth_settings.html#slack_bolt.oauth.oauth_settings.OAuthSettings">OAuthSettings</a> | None = None,<br>oauth_flow: <a title="slack_bolt.oauth.oauth_flow.OAuthFlow" href="../oauth/oauth_flow.html#slack_bolt.oauth.oauth_flow.OAuthFlow">OAuthFlow</a> | None = None,<br>verification_token: str | None = None,<br>listener_executor: concurrent.futures._base.Executor | None = None,<br>assistant_thread_context_store: <a title="slack_bolt.context.assistant.thread_context_store.store.AssistantThreadContextStore" href="../context/assistant/thread_context_store/store.html#slack_bolt.context.assistant.thread_context_store.store.AssistantThreadContextStore">AssistantThreadContextStore</a> | None = None)</span>
51+
<span>(</span><span>*,<br>logger: logging.Logger | None = None,<br>name: str | None = None,<br>process_before_response: bool = False,<br>raise_error_for_unhandled_request: bool = False,<br>signing_secret: str | None = None,<br>token: str | None = None,<br>token_verification_enabled: bool = True,<br>client: slack_sdk.web.client.WebClient | None = None,<br>before_authorize: <a title="slack_bolt.middleware.middleware.Middleware" href="../middleware/middleware.html#slack_bolt.middleware.middleware.Middleware">Middleware</a> | Callable[..., Any] | None = None,<br>authorize: Callable[..., <a title="slack_bolt.authorization.authorize_result.AuthorizeResult" href="../authorization/authorize_result.html#slack_bolt.authorization.authorize_result.AuthorizeResult">AuthorizeResult</a>] | None = None,<br>user_facing_authorize_error_message: str | None = None,<br>installation_store: slack_sdk.oauth.installation_store.installation_store.InstallationStore | None = None,<br>installation_store_bot_only: bool | None = None,<br>request_verification_enabled: bool = True,<br>ignoring_self_events_enabled: bool = True,<br>ignoring_self_assistant_message_events_enabled: bool = True,<br>ssl_check_enabled: bool = True,<br>url_verification_enabled: bool = True,<br>attaching_function_token_enabled: bool = True,<br>oauth_settings: <a title="slack_bolt.oauth.oauth_settings.OAuthSettings" href="../oauth/oauth_settings.html#slack_bolt.oauth.oauth_settings.OAuthSettings">OAuthSettings</a> | None = None,<br>oauth_flow: <a title="slack_bolt.oauth.oauth_flow.OAuthFlow" href="../oauth/oauth_flow.html#slack_bolt.oauth.oauth_flow.OAuthFlow">OAuthFlow</a> | None = None,<br>verification_token: str | None = None,<br>listener_executor: concurrent.futures._base.Executor | None = None,<br>assistant_thread_context_store: <a title="slack_bolt.context.assistant.thread_context_store.store.AssistantThreadContextStore" href="../context/assistant/thread_context_store/store.html#slack_bolt.context.assistant.thread_context_store.store.AssistantThreadContextStore">AssistantThreadContextStore</a> | None = None,<br>attaching_conversation_kwargs_enabled: bool = True)</span>
5252
</code></dt>
5353
<dd>
5454
<details class="source">
@@ -95,6 +95,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
9595
listener_executor: Optional[Executor] = None,
9696
# for AI Agents &amp; Assistants
9797
assistant_thread_context_store: Optional[AssistantThreadContextStore] = None,
98+
attaching_conversation_kwargs_enabled: bool = True,
9899
):
99100
&#34;&#34;&#34;Bolt App that provides functionalities to register middleware/listeners.
100101

@@ -315,6 +316,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
315316
listener_executor = ThreadPoolExecutor(max_workers=5)
316317

317318
self._assistant_thread_context_store = assistant_thread_context_store
319+
self._attaching_conversation_kwargs_enabled = attaching_conversation_kwargs_enabled
318320

319321
self._process_before_response = process_before_response
320322
self._listener_runner = ThreadListenerRunner(
@@ -799,10 +801,13 @@ <h2 class="section-title" id="header-classes">Classes</h2>
799801
middleware: A list of lister middleware functions.
800802
Only when all the middleware call `next()` method, the listener function can be invoked.
801803
&#34;&#34;&#34;
804+
middleware = list(middleware) if middleware else []
802805

803806
def __call__(*args, **kwargs):
804807
functions = self._to_listener_functions(kwargs) if kwargs else list(args)
805808
primary_matcher = builtin_matchers.event(event, base_logger=self._base_logger)
809+
if self._attaching_conversation_kwargs_enabled:
810+
middleware.insert(0, AttachingConversationKwargs(self._assistant_thread_context_store))
806811
return self._register_listener(list(functions), primary_matcher, matchers, middleware, True)
807812

808813
return __call__
@@ -860,6 +865,8 @@ <h2 class="section-title" id="header-classes">Classes</h2>
860865
primary_matcher = builtin_matchers.message_event(
861866
keyword=keyword, constraints=constraints, base_logger=self._base_logger
862867
)
868+
if self._attaching_conversation_kwargs_enabled:
869+
middleware.insert(0, AttachingConversationKwargs(self._assistant_thread_context_store))
863870
middleware.insert(0, MessageListenerMatches(keyword))
864871
return self._register_listener(list(functions), primary_matcher, matchers, middleware, True)
865872

@@ -1356,20 +1363,6 @@ <h2 class="section-title" id="header-classes">Classes</h2>
13561363
# It is intended for apps that start lazy listeners from their custom global middleware.
13571364
req.context[&#34;listener_runner&#34;] = self.listener_runner
13581365

1359-
# For AI Agents &amp; Assistants
1360-
if is_assistant_event(req.body):
1361-
assistant = AssistantUtilities(
1362-
payload=to_event(req.body), # type:ignore[arg-type]
1363-
context=req.context,
1364-
thread_context_store=self._assistant_thread_context_store,
1365-
)
1366-
req.context[&#34;say&#34;] = assistant.say
1367-
req.context[&#34;set_status&#34;] = assistant.set_status
1368-
req.context[&#34;set_title&#34;] = assistant.set_title
1369-
req.context[&#34;set_suggested_prompts&#34;] = assistant.set_suggested_prompts
1370-
req.context[&#34;get_thread_context&#34;] = assistant.get_thread_context
1371-
req.context[&#34;save_thread_context&#34;] = assistant.save_thread_context
1372-
13731366
@staticmethod
13741367
def _to_listener_functions(
13751368
kwargs: dict,
@@ -1415,7 +1408,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
14151408
CustomListener(
14161409
app_name=self.name,
14171410
ack_function=functions.pop(0),
1418-
lazy_functions=functions, # type:ignore[arg-type]
1411+
lazy_functions=functions, # type: ignore[arg-type]
14191412
matchers=listener_matchers,
14201413
middleware=listener_middleware,
14211414
auto_acknowledgement=auto_acknowledgement,
@@ -2203,10 +2196,13 @@ <h2 id="args">Args</h2>
22032196
middleware: A list of lister middleware functions.
22042197
Only when all the middleware call `next()` method, the listener function can be invoked.
22052198
&#34;&#34;&#34;
2199+
middleware = list(middleware) if middleware else []
22062200

22072201
def __call__(*args, **kwargs):
22082202
functions = self._to_listener_functions(kwargs) if kwargs else list(args)
22092203
primary_matcher = builtin_matchers.event(event, base_logger=self._base_logger)
2204+
if self._attaching_conversation_kwargs_enabled:
2205+
middleware.insert(0, AttachingConversationKwargs(self._assistant_thread_context_store))
22102206
return self._register_listener(list(functions), primary_matcher, matchers, middleware, True)
22112207

22122208
return __call__</code></pre>
@@ -2410,6 +2406,8 @@ <h2 id="args">Args</h2>
24102406
primary_matcher = builtin_matchers.message_event(
24112407
keyword=keyword, constraints=constraints, base_logger=self._base_logger
24122408
)
2409+
if self._attaching_conversation_kwargs_enabled:
2410+
middleware.insert(0, AttachingConversationKwargs(self._assistant_thread_context_store))
24132411
middleware.insert(0, MessageListenerMatches(keyword))
24142412
return self._register_listener(list(functions), primary_matcher, matchers, middleware, True)
24152413

0 commit comments

Comments
 (0)