agentscope.app.message_busMessageBusKeys
class MessageBusKeys
agentscope/app/message_bus/_keys.py:19–410消息总线密钥,把智能体接入外部消息渠道与企业平台。位于 agentscope.app.message_bus 包。核心成员包括 projection_namespace、projection_field、projection_field_prefix、session_events、session_event_checkpoint、session_event_checkpoint_lock。
A flat registry of key/namespace builders — it grows one method per business key, so the public-method count is expected to be high.
属性摘要Attribute Summary
| 属性Attribute | 类型Type | 说明Description | 值Value |
|---|---|---|---|
WAKEUP_KIND_WAKE | Final | WAKEUP 种类 WAKE字段。 | 'wake' |
WAKEUP_KIND_RESUME | Final | WAKEUP 种类恢复字段。 | 'resume' |
WAKEUP_KIND_MESSAGE | Final | WAKEUP 种类消息字段。 | 'message' |
SESSION_REPLAY_MAX_LEN | — | 会话 REPLAY 最大 LEN字段。 | 1000 |
SESSION_EVENT_CURSOR_FIELD | Final | 会话事件游标 FIELD字段。 | 'cursor' |
SESSION_EVENT_CHECKPOINT_LOCK_TTL_SECS | — | 会话事件检查点锁存活时间 SECS字段。 | 30 |
SESSION_RUN_TTL_SECS | — | 会话运行存活时间 SECS字段。 | 600 |
SOP_RUN_TTL_SECS | — | SOP 运行存活时间 SECS字段。 | 600 |
SOP_DISPATCH_FIELD | — | SOP DISPATCH FIELD字段。 | 'step' |
INBOX_LOCK_TTL_SECS | — | 收件箱锁存活时间 SECS字段。 | 30 |
INBOX_CONSUMER_FIELD | — | 收件箱消费者 FIELD字段。 | 'running' |
BG_TASKS_TTL_SECS | — | BG 任务存活时间 SECS字段。 | 86400 |
CREDENTIAL_BINDING_FIELD | — | 凭证绑定 FIELD字段。 | 'record' |
CREDENTIAL_BINDING_CLAIM_TTL_SECS | — | 凭证绑定 CLAIM 存活时间 SECS字段。 | 300 |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
def projection_namespace(target_session_id: str) -> str | 设置该参数。 Return the registry namespace for a session's projections. |
def projection_field(kind: str, entry_id: str) -> str | 执行 `projection_field` 方法。 Return the hash field key for a single projected entry. |
def projection_field_prefix(kind: str) -> str | 设置该参数。 Return the field-key prefix that identifies one feed. |
def session_events(session_id: str) -> str | 设置会话事件。 Replay log + live pub/sub channel key for a session. |
def session_event_checkpoint(session_id: str) -> str | 设置会话事件检查点。 Registry namespace for the persisted replay cursor. |
def session_event_checkpoint_lock(session_id: str) -> str | 设置会话事件检查点锁。 Lock pairing a persisted message snapshot with its cursor. |
def session_lock(session_id: str) -> str | 设置会话锁。 Per-session distributed-lock key. |
def sop_lock(sop_id: str) -> str | 设置SOP 锁。 Per-procedure lock, held while a run is opened or the procedure deleted. Outermost of the three: procedure, run, session. |
def sop_dispatch(session_id: str) -> str | 设置该参数。 Registry namespace holding ``"<run id>:<step index>"`` while a step's turn is parked in this session. Per session and unleased, since a park can wait on a person indefinitely. |
def sop_run_lock(sop_run_id: str) -> str | 设置SOP 运行锁。 Per-run lock, taken after the procedure's and before any session's. |
def inbox(session_id: str) -> str | 设置收件箱。 Per-session inbox drain-queue key. |
def inbox_lock(session_id: str) -> str | 设置收件箱锁。 Per-session lock serialising inbox hand-off. |
def inbox_consumer(session_id: str) -> str | 设置收件箱消费者。 Per-session registry recording whether a run is currently consuming this inbox. |
def wakeup_queue() -> str | 返回 `wakeup_queue` 结果。 Shared run-trigger queue key. |
def wakeup_signal() -> str | 返回 `wakeup_signal` 结果。 Shared signal channel that nudges dispatchers to drain. |
def session_cancel_channel() -> str | 返回会话取消渠道。 Global session-cancel broadcast channel. |
def task_cancel_channel() -> str | 返回任务取消渠道。 Single-task cancel broadcast channel. |
def session_interrupt_channel() -> str | 返回会话中断渠道。 Global session-interrupt broadcast channel. |
def bg_tasks(session_id: str) -> str | 设置bg 任务。 Per-session background task registry key. |
def index_tasks_queue() -> str | 返回索引任务队列。 Shared, durable index-task queue. |
def index_tasks_signal() -> str | 返回 `index_tasks_signal` 结果。 Shared pub/sub channel that nudges every running index-task consumer to drain the queue. |
def schedule_lifecycle() -> str | 返回调度生命周期。 Pub/sub channel that nudges the timer-owning node to reconcile its schedule jobs against storage. |
def channel_credential_binding(binding_id: str) -> str | 设置渠道凭证绑定。 Registry namespace holding one credential-binding session. |
def channel_lifecycle() -> str | 返回渠道生命周期。 Pub/sub channel that nudges every node to reconcile its running channel instances against storage. |
def channel_liveness(channel_id: str) -> str | 设置渠道存活检查。 Per-channel per-node status heartbeat namespace. |
def channel_media_buffer(channel_id: str, chat_id: str, user_id: str) -> str | 执行 `channel_media_buffer` 方法。 Queue key buffering media until the next text message. |
def channel_seen_chats(channel_id: str) -> str | 设置该参数。 Registry namespace of chat_ids the bot has been messaged in. |
属性详情Attribute Detail
WAKEUP_KIND_WAKE
Final = 'wake'WAKEUP 种类 WAKE字段。声明为 Final。
The WAKEUP KIND WAKE field.
agentscope/app/message_bus/_keys.py:33WAKEUP_KIND_RESUME
Final = 'resume'WAKEUP 种类恢复字段。声明为 Final。
The WAKEUP KIND RESUME field.
agentscope/app/message_bus/_keys.py:38WAKEUP_KIND_MESSAGE
Final = 'message'WAKEUP 种类消息字段。声明为 Final。
The WAKEUP KIND MESSAGE field.
agentscope/app/message_bus/_keys.py:45SESSION_REPLAY_MAX_LEN
= 1000会话 REPLAY 最大 LEN字段。
The SESSION REPLAY MAX LEN field.
agentscope/app/message_bus/_keys.py:126SESSION_EVENT_CURSOR_FIELD
Final = 'cursor'会话事件游标 FIELD字段。声明为 Final。
The SESSION EVENT CURSOR FIELD field.
agentscope/app/message_bus/_keys.py:133SESSION_EVENT_CHECKPOINT_LOCK_TTL_SECS
= 30会话事件检查点锁存活时间 SECS字段。
The SESSION EVENT CHECKPOINT LOCK TTL SECS field.
agentscope/app/message_bus/_keys.py:134SESSION_RUN_TTL_SECS
= 600会话运行存活时间 SECS字段。
The SESSION RUN TTL SECS field.
agentscope/app/message_bus/_keys.py:157SOP_RUN_TTL_SECS
= 600SOP 运行存活时间 SECS字段。
The SOP RUN TTL SECS field.
agentscope/app/message_bus/_keys.py:179SOP_DISPATCH_FIELD
= 'step'SOP DISPATCH FIELD字段。
The SOP DISPATCH FIELD field.
agentscope/app/message_bus/_keys.py:184INBOX_LOCK_TTL_SECS
= 30收件箱锁存活时间 SECS字段。
The INBOX LOCK TTL SECS field.
agentscope/app/message_bus/_keys.py:208INBOX_CONSUMER_FIELD
= 'running'收件箱消费者 FIELD字段。
The INBOX CONSUMER FIELD field.
agentscope/app/message_bus/_keys.py:213BG_TASKS_TTL_SECS
= 86400BG 任务存活时间 SECS字段。
The BG TASKS TTL SECS field.
agentscope/app/message_bus/_keys.py:299CREDENTIAL_BINDING_FIELD
= 'record'凭证绑定 FIELD字段。
The CREDENTIAL BINDING FIELD field.
agentscope/app/message_bus/_keys.py:365CREDENTIAL_BINDING_CLAIM_TTL_SECS
= 300凭证绑定 CLAIM 存活时间 SECS字段。
The CREDENTIAL BINDING CLAIM TTL SECS field.
agentscope/app/message_bus/_keys.py:368方法详情Method Detail
projection_namespace
def projection_namespace(target_session_id: str) -> str
设置该参数。
Return the registry namespace for a session's projections.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
target_session_id | str | 目标会话标识(类型 `str`)。The session the entries are projected onto (the session whose UI renders them). |
agentscope/app/message_bus/_keys.py:67–79projection_field
def projection_field(kind: str, entry_id: str) -> str
执行 projection_field 方法。
The kind prefix namespaces the field so different projection feeds sharing one target session never collide, and so a feed can be listed/purged by scanning for its prefix.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
kind | str | 种类(类型 `str`)。The projection feed this entry belongs to (e.g. `"subagent_hitl"`). |
entry_id | str | 条目标识(类型 `str`)。The entry's identity within the feed, unique per `kind` (e.g. `"{worker_session_id}:{reply_id}"`). |
agentscope/app/message_bus/_keys.py:82–101projection_field_prefix
def projection_field_prefix(kind: str) -> str
设置该参数。
Used to filter :meth:MessageBus.registry_getall down to a single kind when listing or purging.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
kind | str | 种类(类型 `str`)。The projection feed. |
agentscope/app/message_bus/_keys.py:104–118session_events
def session_events(session_id: str) -> str
设置会话事件。
Replay log + live pub/sub channel key for a session.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
session_id | str | 会话标识(类型 `str`)。The session id. |
agentscope/app/message_bus/_keys.py:137–139session_event_checkpoint
def session_event_checkpoint(session_id: str) -> str
设置会话事件检查点。
Registry namespace for the persisted replay cursor.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
session_id | str | 会话标识(类型 `str`)。The session id. |
agentscope/app/message_bus/_keys.py:142–144session_event_checkpoint_lock
def session_event_checkpoint_lock(session_id: str) -> str
设置会话事件检查点锁。
Lock pairing a persisted message snapshot with its cursor.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
session_id | str | 会话标识(类型 `str`)。The session id. |
agentscope/app/message_bus/_keys.py:147–149session_lock
def session_lock(session_id: str) -> str
设置会话锁。
Per-session distributed-lock key.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
session_id | str | 会话标识(类型 `str`)。The session id. |
agentscope/app/message_bus/_keys.py:161–163sop_lock
def sop_lock(sop_id: str) -> str
设置SOP 锁。
Per-procedure lock, held while a run is opened or the procedure deleted.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sop_id | str | SOP 标识(类型 `str`)。The sop id. |
agentscope/app/message_bus/_keys.py:172–175sop_dispatch
def sop_dispatch(session_id: str) -> str
设置该参数。
Registry namespace holding " : " while a step's turn is parked in this session.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
session_id | str | 会话标识(类型 `str`)。The session id. |
agentscope/app/message_bus/_keys.py:188–192sop_run_lock
def sop_run_lock(sop_run_id: str) -> str
设置SOP 运行锁。
Per-run lock, taken after the procedure's and before any session's.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
sop_run_id | str | SOP 运行标识(类型 `str`)。The sop run id. |
agentscope/app/message_bus/_keys.py:195–198inbox
def inbox(session_id: str) -> str
设置收件箱。
Per-session inbox drain-queue key.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
session_id | str | 会话标识(类型 `str`)。The session id. |
agentscope/app/message_bus/_keys.py:217–219inbox_lock
def inbox_lock(session_id: str) -> str
设置收件箱锁。
Held only around two tiny critical sections — the producer's "push then read consumer flag" and the consumer's "drain then clear consumer flag".
| 名称Name | 类型Type | 说明Description |
|---|---|---|
session_id | str | 会话标识(类型 `str`)。The session id. |
agentscope/app/message_bus/_keys.py:222–232inbox_consumer
def inbox_consumer(session_id: str) -> str
设置收件箱消费者。
Deliberately not derived from :meth:session_lock — the lock is still held while a finished run persists its state, and during that window no further drain will happen, so producers must already treat the session as having no consumer.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
session_id | str | 会话标识(类型 `str`)。The session id. |
agentscope/app/message_bus/_keys.py:235–245wakeup_queue
def wakeup_queue() -> str
返回 wakeup_queue 结果。
Shared run-trigger queue key.
agentscope/app/message_bus/_keys.py:255–257wakeup_signal
def wakeup_signal() -> str
返回 wakeup_signal 结果。
Shared signal channel that nudges dispatchers to drain.
agentscope/app/message_bus/_keys.py:260–262session_cancel_channel
def session_cancel_channel() -> str
返回会话取消渠道。
Global session-cancel broadcast channel.
agentscope/app/message_bus/_keys.py:273–275task_cancel_channel
def task_cancel_channel() -> str
返回任务取消渠道。
Single-task cancel broadcast channel.
agentscope/app/message_bus/_keys.py:278–280session_interrupt_channel
def session_interrupt_channel() -> str
返回会话中断渠道。
Used by the interrupt API endpoint to request graceful interruption of a running agent.
agentscope/app/message_bus/_keys.py:283–291bg_tasks
def bg_tasks(session_id: str) -> str
设置bg 任务。
Per-session background task registry key.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
session_id | str | 会话标识(类型 `str`)。The session id. |
agentscope/app/message_bus/_keys.py:303–305index_tasks_queue
def index_tasks_queue() -> str
返回索引任务队列。
The producer-side :class:~agentscope.app._service.KnowledgeBaseService queue_push\ es here through :func:~agentscope.app._bus_ops.enqueue_index_task; the consumer-side :class:~agentscope.app._service.IndexTaskConsumer queue_drain\ s it on each signal — plus once eagerl…
agentscope/app/message_bus/_keys.py:315–328index_tasks_signal
def index_tasks_signal() -> str
返回 index_tasks_signal 结果。
Payload is opaque — only its arrival matters.
agentscope/app/message_bus/_keys.py:331–340schedule_lifecycle
def schedule_lifecycle() -> str
返回调度生命周期。
Pub/sub channel that nudges the timer-owning node to reconcile its schedule jobs against storage.
agentscope/app/message_bus/_keys.py:350–353channel_credential_binding
def channel_credential_binding(binding_id: str) -> str
设置渠道凭证绑定。
Registry namespace holding one credential-binding session.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
binding_id | str | 绑定标识(类型 `str`)。The binding id. |
agentscope/app/message_bus/_keys.py:373–375channel_lifecycle
def channel_lifecycle() -> str
返回渠道生命周期。
Pub/sub channel that nudges every node to reconcile its running channel instances against storage.
agentscope/app/message_bus/_keys.py:383–386channel_liveness
def channel_liveness(channel_id: str) -> str
设置渠道存活检查。
Per-channel per-node status heartbeat namespace.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
channel_id | str | 渠道标识(类型 `str`)。The channel id. |
agentscope/app/message_bus/_keys.py:389–391channel_media_buffer
def channel_media_buffer(channel_id: str, chat_id: str, user_id: str) -> str
执行 channel_media_buffer 方法。
Queue key buffering media until the next text message.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
channel_id | str | 渠道标识(类型 `str`)。The channel id. |
chat_id | str | 聊天标识(类型 `str`)。The chat id. |
user_id | str | 用户标识(类型 `str`)。The user id. |
agentscope/app/message_bus/_keys.py:394–405channel_seen_chats
def channel_seen_chats(channel_id: str) -> str
设置该参数。
Registry namespace of chat_ids the bot has been messaged in.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
channel_id | str | 渠道标识(类型 `str`)。The channel id. |
agentscope/app/message_bus/_keys.py:408–410