Liking cljdoc? Tell your friends :D

im.ttalk.agent.server.agui.thread-store

…/threads* 那七条路背后的存储(C# Keelson.Agui 的 IAguiThreadStore / AguiThreadStore 委托版)。

契约是 C# 的六个可选槽,在这里写成一个 fn 的 map —— 给了哪个键就亮哪个槽,没给的那几条路回 501:

:list (fn [query] …) GET /threads。query = 查询串原样 {"agentId" "echo" "limit" "2"}(值全是串,同名取第一个)。 回线程记录的序列 ⇒ 补成 {threads, nextCursor: null};回带 :threads 的 map ⇒ 原样出(缺 nextCursor 补 null) :messages (fn [thread-id] …) GET /threads/:id/messages ⇒ {messages};nil = 没这条线程(404) :events (fn [thread-id] …) GET /threads/:id/events ⇒ {events};nil = 没这条线程 :state (fn [thread-id] …) GET /threads/:id/state。回 nil = 没这条线程(404);回 {:state v} = 有(v 可以是 nil ⇒ {"state":null}) :update (fn [thread-id agent-id updates] …) PATCH /threads/:id(改名 / 取消归档)与 POST /threads/:id/archive(updates = {:archived true})。 updates 已去掉 agentId / userId。回改过的那条线程记录(PATCH ⇒ 裸的出);nil = 没这条线程 :delete (fn [thread-id agent-id] …) DELETE /threads/:id。false = 没这条线程

外加一个可选钩子(C# IAguiThreadRecorder): :record (fn [agent-id input agui-event]) 每台 run 的每条 AG-UI 事件(RUN_STARTED 是第一条,input 是那台的 RunAgentInput)。 在泵上同步调:要快;抛了吞掉(⛔ 不打断 run)。/suggest 不喂

抛异常 ⇒ 500 thread_store_error,带着异常的话(⛔ 不吞)。

接 clj-agent-agui:它的 thread-store/ThreadStore 只管元数据(三个槽:list / update / delete),消息在 ChatMemory、事件在 runtime 的事件存储 —— from-clj-agent 把这三样拼成上面的六槽 map(host 收到一个 ThreadStore 时自动套上)。

`…/threads*` 那七条路背后的存储(C# Keelson.Agui 的 IAguiThreadStore / AguiThreadStore 委托版)。

**契约是 C# 的六个可选槽**,在这里写成一个 fn 的 map —— 给了哪个键就亮哪个槽,没给的那几条路回 501:

  :list     (fn [query] …)           GET /threads。query = 查询串原样 {"agentId" "echo" "limit" "2"}(值全是串,同名取第一个)。
                                     回线程记录的序列 ⇒ 补成 {threads, nextCursor: null};回带 :threads 的 map ⇒ 原样出(缺 nextCursor 补 null)
  :messages (fn [thread-id] …)       GET /threads/:id/messages ⇒ {messages};nil = 没这条线程(404)
  :events   (fn [thread-id] …)       GET /threads/:id/events ⇒ {events};nil = 没这条线程
  :state    (fn [thread-id] …)       GET /threads/:id/state。回 nil = 没这条线程(404);回 {:state v} = 有(v 可以是 nil ⇒ {"state":null})
  :update   (fn [thread-id agent-id updates] …)  PATCH /threads/:id(改名 / 取消归档)与 POST /threads/:id/archive(updates = {:archived true})。
                                     updates 已去掉 agentId / userId。回改过的那条线程记录(PATCH ⇒ **裸的**出);nil = 没这条线程
  :delete   (fn [thread-id agent-id] …)  DELETE /threads/:id。false = 没这条线程

外加一个可选钩子(C# IAguiThreadRecorder):
  :record   (fn [agent-id input agui-event])  每台 run 的每条 AG-UI 事件(RUN_STARTED 是第一条,input 是那台的 RunAgentInput)。
                                     在泵上同步调:要快;抛了吞掉(⛔ 不打断 run)。`/suggest` 不喂

抛异常 ⇒ 500 `thread_store_error`,带着异常的话(⛔ 不吞)。

**接 clj-agent-agui**:它的 `thread-store/ThreadStore` 只管元数据(三个槽:list / update / delete),消息在 ChatMemory、事件在
runtime 的事件存储 —— `from-clj-agent` 把这三样拼成上面的六槽 map(host 收到一个 ThreadStore 时自动套上)。
raw docstring

from-clj-agentclj

(from-clj-agent store reg)

clj-agent-agui 的线程存储(元数据)+ 注册表 ⇒ 六槽 map。

  • list / update / delete 跟着 ts 给的槽;messages 在至少一台 agent 配了 :memory 时才亮(读那台的 ChatMemory); events / state 一直亮(runtime 的事件存储,缺省有界环形缓冲、不落库 —— 见 clj-agent-agui 的 event-store)。
  • :record 在 RUN_STARTED 上 ts-touch!(线程从此在 /threads 里),新线程按第一条 user 消息起名,记下那一轮的 state 作基线。
  • update / delete 的 agentId 对不上 ⇒ 当作没这条线程(C# 同)。delete = 摘会话(rt/purge!)+ 清 ChatMemory + 删记录。
clj-agent-agui 的线程存储(元数据)+ 注册表 ⇒ 六槽 map。
- list / update / delete 跟着 `ts` 给的槽;messages 在至少一台 agent 配了 `:memory` 时才亮(读那台的 ChatMemory);
  events / state 一直亮(runtime 的事件存储,缺省有界环形缓冲、不落库 —— 见 clj-agent-agui 的 event-store)。
- :record 在 RUN_STARTED 上 `ts-touch!`(线程从此在 /threads 里),新线程按第一条 user 消息起名,记下那一轮的 state 作基线。
- update / delete 的 agentId 对不上 ⇒ 当作没这条线程(C# 同)。delete = 摘会话(`rt/purge!`)+ 清 ChatMemory + 删记录。
sourceraw docstring

has-slot?clj

(has-slot? store slot)
source

mutations?clj

(mutations? store)

threadEndpoints.mutations:update 与 delete 都给了。

`threadEndpoints.mutations`:update 与 delete 都给了。
sourceraw docstring

normalizeclj

(normalize store reg)

宿主给的存储 ⇒ 六槽 map:nil ⇒ nil;clj-agent-agui 的 ThreadStore ⇒ from-clj-agent;map 原样。 一个槽都不给 ⇒ 抛 agui-registry/thread-store-no-slot(它的表现与「没注册」一模一样,多半是写漏了)。

宿主给的存储 ⇒ 六槽 map:nil ⇒ nil;clj-agent-agui 的 ThreadStore ⇒ `from-clj-agent`;map 原样。
一个槽都不给 ⇒ 抛 `agui-registry/thread-store-no-slot`(它的表现与「没注册」一模一样,多半是写漏了)。
sourceraw docstring

slot-keysclj

source

slot-namesclj

槽 ⇒ 进 501 文案的名字(就是槽的关键字;C# 版这里是 AguiThreadSlots 的名字)。

槽 ⇒ 进 501 文案的名字(就是槽的关键字;C# 版这里是 AguiThreadSlots 的名字)。
sourceraw docstring

slotsclj

(slots store)
source

thread-recordclj

(thread-record reg rec)

中立记录 ⇒ C# InMemoryAguiThreadStore 的线程记录形状(organizationId / createdById 为空串,时间带毫秒的 ISO-8601 UTC)。

中立记录 ⇒ C# InMemoryAguiThreadStore 的线程记录形状(organizationId / createdById 为空串,时间带毫秒的 ISO-8601 UTC)。
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close