proscenium 0.0.11__py3-none-any.whl → 0.0.12__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,9 +24,12 @@ def props(console: Optional[Console]) -> List[Prop]:
24
24
 
25
25
  class Admin(Character):
26
26
 
27
- def __init__(self, admin_channel_id: str):
28
- super().__init__(admin_channel_id)
29
- self.admin_channel_id = admin_channel_id
27
+ def __init__(self, channel_id: str, channel: str):
28
+ super().__init__(channel_id)
29
+ self.channel_id = channel_id
30
+ self.channel = channel
31
+
32
+ log.info("Admin handler started %s %s.", self.channel, self.channel_id)
30
33
 
31
34
  def wants_to_handle(self, channel_id: str, speaker_id: str, utterance: str) -> bool:
32
35
  return False
proscenium/bin/bot.py CHANGED
@@ -1,15 +1,16 @@
1
1
  #!/usr/bin/env python3
2
2
 
3
+ import typer
4
+ import time
3
5
  import os
4
6
  import sys
5
7
  import logging
6
- import typer
7
8
  from pathlib import Path
8
9
  from rich.console import Console
9
10
 
10
11
  from proscenium.verbs.display import header
11
12
  from proscenium.bin import production_from_config
12
- from proscenium.interfaces.slack import slack_main
13
+ from proscenium.interfaces.slack import SlackProductionProcessor
13
14
 
14
15
  logging.basicConfig(
15
16
  stream=sys.stdout,
@@ -52,7 +53,20 @@ def start(
52
53
  production.prepare_props()
53
54
  console.print("Props are up-to-date.")
54
55
 
55
- slack_main(production, config, console)
56
+ slack_admin_channel = config.get("slack", {}).get("admin_channel", None)
57
+ slack_production_processor = SlackProductionProcessor(
58
+ production,
59
+ slack_admin_channel,
60
+ console,
61
+ )
62
+
63
+ try:
64
+ while True:
65
+ time.sleep(1)
66
+ except KeyboardInterrupt:
67
+ console.print("Exiting...")
68
+
69
+ slack_production_processor.shutdown()
56
70
 
57
71
 
58
72
  if __name__ == "__main__":
@@ -1,7 +1,7 @@
1
1
  from typing import Callable
2
2
  from typing import Generator
3
+ from typing import Optional
3
4
 
4
- import time
5
5
  import logging
6
6
  import os
7
7
  from rich.console import Console
@@ -11,7 +11,6 @@ from slack_sdk.web import WebClient
11
11
  from slack_sdk.socket_mode import SocketModeClient
12
12
  from slack_sdk.socket_mode.request import SocketModeRequest
13
13
  from slack_sdk.socket_mode.response import SocketModeResponse
14
- from slack_sdk.socket_mode.listeners import SocketModeRequestListener
15
14
 
16
15
  from proscenium.core import Production
17
16
  from proscenium.core import Character
@@ -187,7 +186,7 @@ def channel_table(channels_by_id) -> Table:
187
186
  return channel_table
188
187
 
189
188
 
190
- def bot_user_id(socket_mode_client: SocketModeClient, console: Console):
189
+ def bot_user_id(socket_mode_client: SocketModeClient, console: Console) -> str:
191
190
 
192
191
  auth_response = socket_mode_client.web_client.auth_test()
193
192
 
@@ -239,113 +238,81 @@ Curtain up.
239
238
  )
240
239
 
241
240
 
242
- def listen(
243
- socket_mode_client: SocketModeClient,
244
- slack_listener: SocketModeRequestListener,
245
- user_id: str,
246
- console: Console,
247
- ):
248
- socket_mode_client.socket_mode_request_listeners.append(slack_listener)
249
-
250
- try:
251
- while True:
252
- time.sleep(1)
253
- except KeyboardInterrupt:
254
- console.print("Exiting...")
255
-
256
-
257
- def send_curtain_down(
258
- socket_mode_client: SocketModeClient, slack_admin_channel_id: str
259
- ) -> None:
260
- socket_mode_client.web_client.chat_postMessage(
261
- channel=slack_admin_channel_id,
262
- text="""Curtain down. We hope you enjoyed the show!""",
263
- )
264
-
265
-
266
- def shutdown(
267
- socket_mode_client: SocketModeClient,
268
- slack_listener: SocketModeRequestListener,
269
- user_id: str,
270
- production: Production,
271
- console: Console,
272
- ):
273
-
274
- socket_mode_client.socket_mode_request_listeners.remove(slack_listener)
275
- socket_mode_client.disconnect()
276
- console.print("Disconnected from Slack.")
277
-
278
- production.curtain()
279
-
280
- console.print("Handlers stopped.")
281
-
282
-
283
- def slack_main(
284
- production: Production,
285
- config: dict,
286
- console: Console,
287
- ) -> None:
288
-
289
- slack_app_token, slack_bot_token = get_slack_auth()
290
-
291
- socket_mode_client = connect(slack_app_token, slack_bot_token)
292
-
293
- user_id = bot_user_id(socket_mode_client, console)
294
- console.print()
295
-
296
- channels_by_id, channel_name_to_id = channel_maps(socket_mode_client)
297
- console.print(channel_table(channels_by_id))
298
- console.print()
299
-
300
- slack_admin_channel = config.get("slack", {}).get("admin_channel", None)
301
-
302
- if slack_admin_channel is None:
303
- raise ValueError(
304
- "slack.admin_channel is not set. "
305
- "Please set it to the channel name of the Proscenium admin channel."
306
- )
307
- slack_admin_channel_id = channel_name_to_id.get(slack_admin_channel, None)
308
- if slack_admin_channel_id is None:
309
- raise ValueError(
310
- f"Admin channel {slack_admin_channel} not found in subscribed channels."
241
+ class SlackProductionProcessor:
242
+
243
+ def __init__(
244
+ self,
245
+ production: Production,
246
+ slack_admin_channel: str,
247
+ console: Optional[Console] = None,
248
+ event_log: Optional[list[tuple[str, str]]] = None,
249
+ ):
250
+ self.production = production
251
+ self.console = console
252
+ self.event_log = event_log
253
+
254
+ slack_app_token, slack_bot_token = get_slack_auth()
255
+
256
+ self.socket_mode_client = connect(slack_app_token, slack_bot_token)
257
+
258
+ user_id = bot_user_id(self.socket_mode_client, console)
259
+ console.print()
260
+
261
+ channels_by_id, channel_name_to_id = channel_maps(self.socket_mode_client)
262
+ console.print(channel_table(channels_by_id))
263
+ console.print()
264
+
265
+ if slack_admin_channel is None:
266
+ raise ValueError(
267
+ "slack.admin_channel is not set. "
268
+ "Please set it to the channel name of the Proscenium admin channel."
269
+ )
270
+ slack_admin_channel_id = channel_name_to_id.get(slack_admin_channel, None)
271
+ if slack_admin_channel_id is None:
272
+ raise ValueError(
273
+ f"Admin channel {slack_admin_channel} not found in subscribed channels."
274
+ )
275
+
276
+ self.admin = Admin(slack_admin_channel_id, slack_admin_channel)
277
+
278
+ log.info("Places, please!")
279
+ channel_id_to_character = production.places(channel_name_to_id)
280
+ channel_id_to_character[slack_admin_channel_id] = self.admin
281
+
282
+ console.print(places_table(channel_id_to_character, channels_by_id))
283
+ console.print()
284
+
285
+ self.slack_listener = make_slack_listener(
286
+ user_id,
287
+ slack_admin_channel_id,
288
+ channels_by_id,
289
+ channel_id_to_character,
290
+ console,
311
291
  )
312
292
 
313
- admin = Admin(slack_admin_channel_id)
314
- log.info(
315
- "Admin handler started %s %s.", slack_admin_channel, slack_admin_channel_id
316
- )
317
-
318
- log.info("Places, please!")
319
- channel_id_to_character = production.places(channel_name_to_id)
320
- channel_id_to_character[slack_admin_channel_id] = admin
293
+ send_curtain_up(self.socket_mode_client, production, slack_admin_channel_id)
321
294
 
322
- console.print(places_table(channel_id_to_character, channels_by_id))
323
- console.print()
324
-
325
- slack_listener = make_slack_listener(
326
- user_id,
327
- slack_admin_channel_id,
328
- channels_by_id,
329
- channel_id_to_character,
330
- console,
331
- )
295
+ console.print("Starting the show. Listening for events...")
296
+ self.socket_mode_client.socket_mode_request_listeners.append(
297
+ self.slack_listener
298
+ )
332
299
 
333
- send_curtain_up(socket_mode_client, production, slack_admin_channel_id)
300
+ def shutdown(
301
+ self,
302
+ ):
303
+ self.socket_mode_client.web_client.chat_postMessage(
304
+ channel=self.admin.channel_id,
305
+ text="""Curtain down. We hope you enjoyed the show!""",
306
+ )
334
307
 
335
- console.print("Starting the show. Listening for events...")
336
- listen(
337
- socket_mode_client,
338
- slack_listener,
339
- user_id,
340
- console,
341
- )
308
+ self.socket_mode_client.socket_mode_request_listeners.remove(
309
+ self.slack_listener
310
+ )
311
+ self.socket_mode_client.disconnect()
312
+ if self.console is not None:
313
+ self.console.print("Disconnected from Slack.")
342
314
 
343
- send_curtain_down(socket_mode_client, slack_admin_channel_id)
315
+ self.production.curtain()
344
316
 
345
- shutdown(
346
- socket_mode_client,
347
- slack_listener,
348
- user_id,
349
- production,
350
- console,
351
- )
317
+ if self.console is not None:
318
+ self.console.print("Handlers stopped.")
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: proscenium
3
- Version: 0.0.11
4
- Summary: Frame AI Agents
3
+ Version: 0.0.12
4
+ Summary: Declare AI Agent Scenes
5
5
  Author-email: Adam Pingel <oss@pingel.org>
6
6
  License-Expression: Apache-2.0
7
7
  Requires-Python: >=3.11
@@ -33,8 +33,6 @@ Dynamic: license-file
33
33
 
34
34
  Proscenium is a small, experimental library of composable glue that allows for succinct construction of enterprise AI applications. It was started in February 2025 and is still in early development.
35
35
 
36
- Currently, proscenium development prioritizes support for domains where the creation and use of structured data is critical.
37
-
38
36
  See the [website](https://the-ai-alliance.github.io/proscenium/) for quickstart info, goals, and other links.
39
37
 
40
38
  To find the Proscenium community, see the [discussions](https://github.com/The-AI-Alliance/proscenium/discussions)
@@ -1,10 +1,10 @@
1
1
  proscenium/__init__.py,sha256=nDWNd6_TSf4vDQuHVBoAf4QfZCB3ZUFQ0M7XvifNJ-g,78
2
- proscenium/admin/__init__.py,sha256=GqGrkf7NOm3inuo67xszkARXZYKDsDs2jHuZh1tF4n0,924
2
+ proscenium/admin/__init__.py,sha256=31XUp83v7oCEXTeJb-GgnIitfs2EWovr3QJOewZ0zSg,1026
3
3
  proscenium/bin/__init__.py,sha256=ThVsDG6BmnZ86gYaZLGMDcNmR6fVwBLJG3k_JawfzOY,1160
4
- proscenium/bin/bot.py,sha256=kdZBe1SGM-S3-QSN-DM-_UnGwe6W5D32s-dTuczIPCU,1358
4
+ proscenium/bin/bot.py,sha256=cuHj2-ldPXGRf75Ts_J_y4WfDgTB49iN3sNmnoKKFus,1713
5
5
  proscenium/core/__init__.py,sha256=aSUqPMn2LjZ0C_l9Tx6yqqlfCzM7oSljZxHosJyjlLU,4335
6
6
  proscenium/interfaces/__init__.py,sha256=nDWNd6_TSf4vDQuHVBoAf4QfZCB3ZUFQ0M7XvifNJ-g,78
7
- proscenium/interfaces/slack.py,sha256=wjkdhqAHgISxdNG5Pwo-8_QIyQf76X7b-0WwZfNabI8,10600
7
+ proscenium/interfaces/slack.py,sha256=zfj1D4O6ucVdw6HFnBIMGAbZUb5XK17c-57une42C48,10205
8
8
  proscenium/patterns/__init__.py,sha256=nDWNd6_TSf4vDQuHVBoAf4QfZCB3ZUFQ0M7XvifNJ-g,78
9
9
  proscenium/patterns/graph_rag.py,sha256=1HH1xdlAA6ypvYdP4dWFm-KXrGPUmm0T4qIdAU8mgvE,1763
10
10
  proscenium/patterns/rag.py,sha256=iNPL7i8zfhEGIZAI7FjAs5yKgN1iV_E-PcJiQFrm7lE,2310
@@ -18,9 +18,9 @@ proscenium/verbs/remember.py,sha256=Hh9BDRAYf7MGeMD4MzU73p6Q28KrSiLWPx4GjTW1amQ,
18
18
  proscenium/verbs/display/__init__.py,sha256=GXuvaMld8tzfJGngHdwVT-YLnuRmW2G0pMdti9Vj53s,238
19
19
  proscenium/verbs/display/chat.py,sha256=2THBUdhG3cIIVZOnJ_AMYL4nWXKFG2cuSkX6wkm48yQ,1148
20
20
  proscenium/verbs/display/tools.py,sha256=eR5g-r7MGKFZY0qg-ndkW3p0mfbupV0UaAUFqJPfnNM,1491
21
- proscenium-0.0.11.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
22
- proscenium-0.0.11.dist-info/METADATA,sha256=wVnK3-0GveteN4CZ4JbmD2ytWZoBu7h8JoZ28ZUdl4w,2102
23
- proscenium-0.0.11.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
24
- proscenium-0.0.11.dist-info/entry_points.txt,sha256=bbrDWv4WKIx9UROGXcyH0eo40F8SNpDQKvXxoE8BTHI,58
25
- proscenium-0.0.11.dist-info/top_level.txt,sha256=aiTgQy73e21wnSSxM5iICXmXT3zldN8cFKeXpvJ5Xx4,11
26
- proscenium-0.0.11.dist-info/RECORD,,
21
+ proscenium-0.0.12.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
22
+ proscenium-0.0.12.dist-info/METADATA,sha256=G_d8cWVfT-bv8zBlmgK0DejMHvFGrJSS09FZyIVTz0w,1984
23
+ proscenium-0.0.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
24
+ proscenium-0.0.12.dist-info/entry_points.txt,sha256=bbrDWv4WKIx9UROGXcyH0eo40F8SNpDQKvXxoE8BTHI,58
25
+ proscenium-0.0.12.dist-info/top_level.txt,sha256=aiTgQy73e21wnSSxM5iICXmXT3zldN8cFKeXpvJ5Xx4,11
26
+ proscenium-0.0.12.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.7.1)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5