Documentation
¶
Overview ¶
Package runnable provides background task runners with recover and keep-alive.
Index ¶
- func Run(ctx context.Context, name string, fn func(ctx context.Context))
- func StartSessionRunStateProjector(ictx context.Context, service contract.SessionService, eb eventbus.EventBus, ...)
- func StartSessionRunStreamProjector(ictx context.Context, service contract.SessionService, eb eventbus.EventBus)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartSessionRunStateProjector ¶ added in v0.1.17
func StartSessionRunStateProjector( ictx context.Context, service contract.SessionService, eb eventbus.EventBus, db *gorm.DB, )
StartSessionRunStateProjector 订阅 run.state lane,统一处理 session 运行状态投影。
消费 org.*.session.*.run.state,处理以下事件:
- run.started: 标记源用户消息为 processing,记录 replay start seq
- artifact.declared: 幂等持久化 artifact
- run.completed: 创建 completed assistant message
- run.failed / run.cancelled: 创建失败或取消 assistant message
NOTE: 本 projector 只消费 run.state lane,不依赖 run.stream lane。 SSE replay 目前仅订阅 run.stream lane(见 StreamSessionEvents)。 双 lane 回放待未来实现。
func StartSessionRunStreamProjector ¶ added in v0.1.17
func StartSessionRunStreamProjector(ictx context.Context, service contract.SessionService, eb eventbus.EventBus)
StartSessionRunStreamProjector subscribes to the run.stream lane and records the NATS stream sequence of the first stream event for each session so that SSE replay knows where to start.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.