{"openapi":"3.1.0","info":{"title":"chatagent-platform","summary":"通用跨行业多租户 RAG 聊天智能体平台","description":"多租户 RAG 聊天智能体平台。鉴权分层：`X-Admin-Token`（平台）、`X-API-Key`（租户）、`X-End-User`（代理终端用户）、`Authorization: Bearer <jwt>`（平台登录终端用户）、`X-Act-Tenant`（admin 以租户身份）、可选 `X-Space-Id`。详见管理端「API 文档」页。","version":"0.1.0"},"paths":{"/internal/tls-allow":{"get":{"tags":["custom-domains"],"summary":"Tls Allow","description":"Caddy on_demand_tls 的 `ask`：200 = 给这个域名签证书，404 = 拒绝握手。\n\n没有它，任何人把域名解析过来我们就免费替他签证书并托管 —— 等于给陌生人跑 CDN。\n\n**只服务 Caddy 自己的进程内请求**。Caddy 与 app 同机（host network），它的 ask 子请求\n直连 127.0.0.1 且**不带** X-Forwarded-For；被它反代进来的公网请求同样来自 127.0.0.1，\n但一定带 X-Forwarded-For —— 这个头的有无就是内外的分界线。光看来源 IP 分不出这两者。","operationId":"tls_allow_internal_tls_allow_get","parameters":[{"name":"domain","in":"query","required":false,"schema":{"type":"string","default":"","title":"Domain"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenant/custom-domain/feature":{"get":{"tags":["custom-domain"],"summary":"Custom Domain Feature","description":"控制台入口预检:未开通且未绑定时,租户 Settings 隐藏整张绑定卡片(2026-08-01 用户定案,\n取代旧的\"显示升级提示\"策略)。已绑定的即使关了开关也要显示——降级不下线,得能看/能解绑。","operationId":"custom_domain_feature_tenant_custom_domain_feature_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Custom Domain Feature Tenant Custom Domain Feature Get"}}}}}}},"/tenant/custom-domain":{"get":{"tags":["custom-domain"],"summary":"Get Custom Domain","operationId":"get_custom_domain_tenant_custom_domain_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/CustomDomainOut"},{"type":"null"}],"title":"Response Get Custom Domain Tenant Custom Domain Get"}}}}}},"put":{"tags":["custom-domain"],"summary":"Set Custom Domain","operationId":"set_custom_domain_tenant_custom_domain_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomDomainIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomDomainOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["custom-domain"],"summary":"Delete Custom Domain","operationId":"delete_custom_domain_tenant_custom_domain_delete","responses":{"204":{"description":"Successful Response"}}}},"/tenant/custom-domain/check":{"post":{"tags":["custom-domain"],"summary":"Check Custom Domain","operationId":"check_custom_domain_tenant_custom_domain_check_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomDomainOut"}}}}}}},"/health":{"get":{"tags":["health"],"summary":"Health","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Health Health Get"}}}}}}},"/readyz":{"get":{"tags":["health"],"summary":"Readyz","operationId":"readyz_readyz_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/":{"get":{"tags":["meta"],"summary":"Root","operationId":"root__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Root  Get"}}}}}}},"/auth/methods":{"get":{"tags":["end-user-auth"],"summary":"Auth Methods","description":"登录页据此决定显示哪些登录方式：只有租户实际启用/配置的才显示。\n\n公开端点（tenant_id 是公开标识）。auth_mode=proxy 的租户没有平台原生登录，\npassword/oauth 都为空。社交按钮只列该租户有有效凭证的 provider（见 oauth.available_providers）。","operationId":"auth_methods_auth_methods_get","parameters":[{"name":"tenant_id","in":"query","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthMethodsOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/register":{"post":{"tags":["end-user-auth"],"summary":"Register","operationId":"register_auth_register_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/verify":{"get":{"tags":["end-user-auth"],"summary":"Verify Email","operationId":"verify_email_auth_verify_get","parameters":[{"name":"token","in":"query","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/resend-verification":{"post":{"tags":["end-user-auth"],"summary":"Resend Verification","operationId":"resend_verification_auth_resend_verification_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__auth_end_user__EmailIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Resend Verification Auth Resend Verification Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/forgot-password":{"post":{"tags":["end-user-auth"],"summary":"Forgot Password","operationId":"forgot_password_auth_forgot_password_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__auth_end_user__EmailIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Forgot Password Auth Forgot Password Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/reset-password":{"post":{"tags":["end-user-auth"],"summary":"Reset Password","operationId":"reset_password_auth_reset_password_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Reset Password Auth Reset Password Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/oauth/{provider}/start":{"get":{"tags":["end-user-auth"],"summary":"Oauth Start","operationId":"oauth_start_auth_oauth__provider__start_get","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string","title":"Provider"}},{"name":"tenant_id","in":"query","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"redirect","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Redirect"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/oauth/{provider}/callback":{"get":{"tags":["end-user-auth"],"summary":"Oauth Callback","operationId":"oauth_callback_auth_oauth__provider__callback_get","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string","title":"Provider"}},{"name":"code","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"}},{"name":"state","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"State"}},{"name":"error","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/login":{"post":{"tags":["end-user-auth"],"summary":"Login","operationId":"login_auth_login_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__auth_end_user__LoginIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/stream":{"get":{"tags":["auth","auth"],"summary":"Me Stream","description":"常驻 SSE 通道：服务端把本 (user, space) 的主动推送（如到点的延后跟进）实时下发给网页。\n\n前端用 fetch 读取器带 bearer/X-Space-Id 打开（EventSource 不能带 header）。按配置周期性 ping 保活。","operationId":"me_stream_me_stream_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/me/reminders":{"post":{"tags":["auth","auth"],"summary":"Create My Reminder","description":"**手动**建一条提醒。\n\n在这之前，提醒只能由模型调 `schedule_reminder` 建出来——用户想自己加一条，界面上没有任何\n地方可点。而\"我知道我要什么，让我直接填\"是一条**确定性**的路：不经自然语言解析，\n填错了当场就有话说，不会变成一个永远不触发的东西。\n\n规则（时区怎么解释、上限、什么算过去）与工具那条路**共用同一份**\n（`app/push/reminders.py`）——抄一遍的话，两处错开的那天不会有任何报错。","operationId":"create_my_reminder_me_reminders_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NewReminderIn"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyReminderOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["auth","auth"],"summary":"My Reminders","description":"本用户的定时提醒/闹钟（游标分页，最近创建在前；正文不返回）。","operationId":"my_reminders_me_reminders_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyReminderPage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/reminders/{rid}/cancel":{"post":{"tags":["auth","auth"],"summary":"Cancel My Reminder","description":"取消本人一个待触发（pending）提醒（保留记录，置为已取消）。","operationId":"cancel_my_reminder_me_reminders__rid__cancel_post","parameters":[{"name":"rid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Rid"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/reminders/{rid}":{"delete":{"tags":["auth","auth"],"summary":"Delete My Reminder","description":"彻底删除本人一个提醒（任意状态，从列表移除）。","operationId":"delete_my_reminder_me_reminders__rid__delete","parameters":[{"name":"rid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Rid"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me":{"get":{"tags":["auth","auth"],"summary":"Me","operationId":"me_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Me Me Get"}}}}}}},"/me/features":{"get":{"tags":["auth","auth"],"summary":"My Features","description":"客户端能力探测：目前只有 stt（是否可用语音输入 = 存在启用的 stt 后端）。","operationId":"my_features_me_features_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Response My Features Me Features Get"}}}}}}},"/me/remembered":{"get":{"tags":["auth","auth"],"summary":"My Remembered","description":"看 Agent 记住了我什么。\n\nGDPR 第 15 条（访问权）。注册前的匿名咨询也会以要点摘要的形式结转到这里\n（见 app/chat/handoff.py），用户理应看得到。","operationId":"my_remembered_me_remembered_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/MyRememberedOut"},"type":"array","title":"Response My Remembered Me Remembered Get"}}}}}}},"/me/remembered/{agent_name}":{"delete":{"tags":["auth","auth"],"summary":"Forget Me","description":"让 Agent 忘掉关于我的画像。\n\nGDPR 第 17 条（删除权）。**只删画像，不动会话记录**——那是两件事，用户想清掉「你记住的\n我是谁」时，通常并不是要销毁自己的历史对话；会话另有删除入口。","operationId":"forget_me_me_remembered__agent_name__delete","parameters":[{"name":"agent_name","in":"path","required":true,"schema":{"type":"string","title":"Agent Name"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/profile":{"get":{"tags":["auth","auth"],"summary":"My Profile","description":"本用户的称呼/联系方式/城市/时区偏好；附上按当前 IP 检测到的建议值（best-effort）。","operationId":"my_profile_me_profile_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyProfileOut"}}}}}},"patch":{"tags":["auth","auth"],"summary":"Update My Profile","description":"设置称呼/联系方式/城市/时区；空串或 null 清空。邮箱/电话字段级加密存。","operationId":"update_my_profile_me_profile_patch","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyProfileIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyProfileOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/agents":{"get":{"tags":["auth","auth"],"summary":"My Available Agents","description":"本租户已发布的 agent（可加入空间对话的候选）。","operationId":"my_available_agents_me_agents_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"type":"string"},"type":"array","title":"Response My Available Agents Me Agents Get"}}}}}}},"/me/spaces":{"get":{"tags":["auth","auth"],"summary":"My Spaces","operationId":"my_spaces_me_spaces_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/MySpaceOut"},"type":"array","title":"Response My Spaces Me Spaces Get"}}}}}},"post":{"tags":["auth","auth"],"summary":"Create My Space","operationId":"create_my_space_me_spaces_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpaceIn"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MySpaceOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/spaces/{sid}":{"patch":{"tags":["auth","auth"],"summary":"Rename My Space","operationId":"rename_my_space_me_spaces__sid__patch","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpaceIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MySpaceOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["auth","auth"],"summary":"Delete My Space","operationId":"delete_my_space_me_spaces__sid__delete","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/spaces/{sid}/merge":{"post":{"tags":["auth","auth"],"summary":"Merge My Space","description":"把 sid 空间下的所有数据迁入 target 空间后删除 sid。\n\n内容按 (user, space) 字段级加密（space_id 参与 AAD），迁移需**逐条重加密**到目标空间的 space_id。\n整个操作在一个事务内；任一步失败则回滚，不会损坏数据。","operationId":"merge_my_space_me_spaces__sid__merge_post","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpaceMergeIn"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/spaces/{sid}/agents":{"post":{"tags":["auth","auth"],"summary":"Add My Space Agent","operationId":"add_my_space_agent_me_spaces__sid__agents_post","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpaceAgentIn"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"string"},"title":"Response Add My Space Agent Me Spaces  Sid  Agents Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/spaces/{sid}/agents/{name}":{"delete":{"tags":["auth","auth"],"summary":"Remove My Space Agent","operationId":"remove_my_space_agent_me_spaces__sid__agents__name__delete","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}},{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/spaces/{sid}/sessions":{"get":{"tags":["auth","auth"],"summary":"My Space Sessions","description":"本用户在某空间的会话列表（最新在前，游标分页——历史很长时懒加载）。","operationId":"my_space_sessions_me_spaces__sid__sessions_get","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":30,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MySessionPage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/spaces/{sid}/sessions/search":{"get":{"tags":["auth","auth"],"summary":"My Search Sessions","description":"检索本用户在该空间的历史会话。核心与分享页同一实现（app/chat/session_search.py）：\n语义走标题向量，关键词查询时解密——隐私模式租户只有关键词层。","operationId":"my_search_sessions_me_spaces__sid__sessions_search_get","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}},{"name":"q","in":"query","required":false,"schema":{"type":"string","default":"","title":"Q"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MySessionSearchHit"},"title":"Response My Search Sessions Me Spaces  Sid  Sessions Search Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/sessions/{sid}":{"patch":{"tags":["auth","auth"],"summary":"Rename My Session","description":"用户手动重命名会话；置 title_by_user=True 后 AI 不再自动覆盖（见 docs/18）。","operationId":"rename_my_session_me_sessions__sid__patch","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionTitleIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MySessionOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["auth","auth"],"summary":"Delete My Session","description":"删除本用户的一个会话（级联清其消息与附件）。","operationId":"delete_my_session_me_sessions__sid__delete","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/sessions/{sid}/read":{"post":{"tags":["auth","auth"],"summary":"Mark My Session Read","description":"把这条会话标成**读到此刻为止**（2026-08-20）。\n\n落到服务端，所以换一台设备也算数——这正是主人问的那件事：在这之前挂件把它放在\nlocalStorage、网页版只放在内存里，同一条会话在手机上是已读、在电脑上还是未读。\n\n**不收前端传来的数字。** 客户端说\"我读到第 12 条\"是没法验证的，而它一旦说大了，\n真正的新消息就被永久地标成已读、再也不会提醒。这里自己数一次当前条数——\n\"打开即读完\"是这个动作**唯一**的语义。\n\n幂等：读过再读一次，写进去的还是同一个数。","operationId":"mark_my_session_read_me_sessions__sid__read_post","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MySessionOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/sessions/{sid}/messages/{mid}":{"delete":{"tags":["auth","auth"],"summary":"Delete My Message","description":"删除本用户某会话里的单条消息（避免不必要的上下文污染）。","operationId":"delete_my_message_me_sessions__sid__messages__mid__delete","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}},{"name":"mid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Mid"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["auth","auth"],"summary":"Edit My Message","description":"编辑本用户某条消息的正文（重新加密存储）。若编辑的是用户消息，后台按新内容重提取派生记忆。","operationId":"edit_my_message_me_sessions__sid__messages__mid__patch","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}},{"name":"mid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Mid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageEditIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyMessageOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/sessions/{sid}/messages/{mid}/branch":{"post":{"tags":["auth","auth"],"summary":"Branch My Session","description":"从某条消息处分叉。\n\n**含不含被点的那一条，取决于它是谁说的**（见 `branch_session`）：助手那条含，用户那条\n不含——后者的意思是\"这个问题换个问法\"，原文由 `prefill` 带回去填进输入框。","operationId":"branch_my_session_me_sessions__sid__messages__mid__branch_post","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}},{"name":"mid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Mid"}}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MySessionOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/sessions/{sid}/messages":{"get":{"tags":["auth","auth"],"summary":"My Session Messages","description":"本用户某会话的消息（时序，解密自己的内容）。","operationId":"my_session_messages_me_sessions__sid__messages_get","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":200,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MyMessageOut"},"title":"Response My Session Messages Me Sessions  Sid  Messages Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/sessions/{sid}/attachments":{"get":{"tags":["auth","auth"],"summary":"My Session Attachments","description":"本用户某会话的图片附件（时序，仅元信息；原图经 /me/attachments/{id} 解密取回）。","operationId":"my_session_attachments_me_sessions__sid__attachments_get","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MyAttachmentOut"},"title":"Response My Session Attachments Me Sessions  Sid  Attachments Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/attachments/{aid}":{"get":{"tags":["auth","auth"],"summary":"My Attachment Blob","description":"解密并回传本用户的附件原图（按 owner 校验）。","operationId":"my_attachment_blob_me_attachments__aid__get","parameters":[{"name":"aid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Aid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/telegram/bind-code":{"post":{"tags":["auth","auth"],"summary":"Create Tg Bind Code","description":"为当前登录用户签发一次性绑定码 + 二维码深链，用于扫码把 Telegram 关联到本账号。","operationId":"create_tg_bind_code_me_telegram_bind_code_post","parameters":[{"name":"agent","in":"query","required":true,"schema":{"type":"string","title":"Agent"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TgBindOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/telegram/status":{"get":{"tags":["auth","auth"],"summary":"Tg Status","operationId":"tg_status_me_telegram_status_get","parameters":[{"name":"agent","in":"query","required":true,"schema":{"type":"string","title":"Agent"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TgStatusOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/telegram/binding":{"delete":{"tags":["auth","auth"],"summary":"Tg Unbind","description":"解绑：删除指向本账号的 Telegram 身份（对方下次发消息会回落为匿名 telegram:<id>）。","operationId":"tg_unbind_me_telegram_binding_delete","responses":{"204":{"description":"Successful Response"}}}},"/me/whatsapp/bind-code":{"post":{"tags":["auth","auth"],"summary":"Create Wa Bind Code","operationId":"create_wa_bind_code_me_whatsapp_bind_code_post","parameters":[{"name":"agent","in":"query","required":true,"schema":{"type":"string","title":"Agent"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaBindOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/whatsapp/status":{"get":{"tags":["auth","auth"],"summary":"Wa Bind Status","operationId":"wa_bind_status_me_whatsapp_status_get","parameters":[{"name":"agent","in":"query","required":true,"schema":{"type":"string","title":"Agent"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaBindStatusOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/whatsapp/binding":{"delete":{"tags":["auth","auth"],"summary":"Wa Unbind","operationId":"wa_unbind_me_whatsapp_binding_delete","responses":{"204":{"description":"Successful Response"}}}},"/me/documents":{"get":{"tags":["auth","me"],"summary":"List My Documents","description":"当前空间内我上传的文档。空间是隔离边界（X-Space-Id / 默认空间），不跨空间列。\n\n`tag`：按标签过滤（JSONB 包含；标签是明文组织元数据，故可以 SQL 过滤）。","operationId":"list_my_documents_me_documents_get","parameters":[{"name":"tag","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tag"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MyDocOut"},"title":"Response List My Documents Me Documents Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/documents/{doc_id}/tags":{"patch":{"tags":["auth","me"],"summary":"Set My Document Tags","description":"改自己文档的标签（整组替换；normalize 见 app/tags）。","operationId":"set_my_document_tags_me_documents__doc_id__tags_patch","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TagsIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyDocOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/documents/{doc_id}/reingest":{"post":{"tags":["auth","me"],"summary":"Reingest My Document","description":"重试入库：用已存的加密正文重跑嵌入，无需重新上传。置 pending 并后台跑（见 rag/ingest）。\n\n针对被重启打断/嵌入失败的文档。若正文本就为空（扫描件/纯图片 PDF），重试仍会落 error。","operationId":"reingest_my_document_me_documents__doc_id__reingest_post","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyDocOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/documents/{doc_id}":{"delete":{"tags":["auth","me"],"summary":"Delete My Document","description":"删自己空间里的文档。chunks 由 FK CASCADE 带走；渗入记忆的衍生内容先回收（docs/28）。","operationId":"delete_my_document_me_documents__doc_id__delete","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/documents/{doc_id}/detail":{"get":{"tags":["auth","me"],"summary":"My Document Detail","description":"这份文档产出了什么：切片（带预览）+ 抽出的实体（带在本文档的提及次数）。","operationId":"my_document_detail_me_documents__doc_id__detail_get","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyDocDetailOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/memories":{"get":{"tags":["auth","me"],"summary":"List My Memories","description":"当前空间从我的对话中派生出的长期记忆。按重要性+最近性排序（同管理端）。","operationId":"list_my_memories_me_memories_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/MyMemoryOut"},"type":"array","title":"Response List My Memories Me Memories Get"}}}}}}},"/me/memories/{mid}":{"delete":{"tags":["auth","me"],"summary":"Delete My Memory","description":"删掉一条自己的记忆（不想让 AI 记住的东西，用户自己就能清）。","operationId":"delete_my_memory_me_memories__mid__delete","parameters":[{"name":"mid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Mid"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/graph":{"get":{"tags":["auth","me"],"summary":"My Knowledge Graph","description":"我的知识星云。两种视图（前端切换，见 docs/35）：\n\n- `chunks`（默认）：投用户上传文档的切片，父节点=文档（原行为）。\n- `entities`：投抽出的实体，节点=实体（按类型标注）、边=同一 chunk 共现。\n\n范围锁死本空间：聊天记忆不进（有自己的 tab）、租户 KB 不进（另一暴露级别）。","operationId":"my_knowledge_graph_me_graph_get","parameters":[{"name":"mode","in":"query","required":false,"schema":{"type":"string","default":"chunks","title":"Mode"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response My Knowledge Graph Me Graph Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/writing/runs":{"get":{"tags":["auth","me"],"summary":"List Runs","operationId":"list_runs_me_writing_runs_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RunOut"},"title":"Response List Runs Me Writing Runs Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/writing/runs/{run_id}":{"get":{"tags":["auth","me"],"summary":"Get Run","operationId":"get_run_me_writing_runs__run_id__get","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunDetailOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/writing/runs/{run_id}/events":{"get":{"tags":["auth","me"],"summary":"Get Events","description":"断线补齐。**这不是 SSE 的冗余**——见模块 docstring。","operationId":"get_events_me_writing_runs__run_id__events_get","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}},{"name":"since","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Since"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":200,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/EventOut"},"title":"Response Get Events Me Writing Runs  Run Id  Events Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/writing/runs/{run_id}/markdown":{"get":{"tags":["auth","me"],"summary":"Get Markdown","description":"整篇 Markdown。\n\n标题层级由 `parent_key` 决定，**由代码拼，不让模型写**（同\"工单号 / 绝对时间 / 品牌色\"\n那条规矩：让模型拼目录，它会给你一份看起来很像的目录）。","operationId":"get_markdown_me_writing_runs__run_id__markdown_get","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/writing/stats":{"get":{"tags":["auth","me"],"summary":"Stats","operationId":"stats_me_writing_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/me/monitors":{"get":{"tags":["auth","auth"],"summary":"My Monitors","description":"**分页**：一个人可以有很多跟踪，而每一行下面还挂着源和报告。\n\n默认 100 是为了**老调用方一行不改**（面板以前不传这两个参数，一次要全部）。\n形状仍然是一个裸数组：包一层 `{items, total}` 会把每一个既有调用方都打断，\n而\"还有没有下一页\"用**多要一条**就能判断——少一次计数查询，也不会和插入竞态。","operationId":"my_monitors_me_monitors_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":100,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MonitorOut"},"title":"Response My Monitors Me Monitors Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["auth","auth"],"summary":"Create Draft","description":"一句话 → 一份**草稿**。确认之前不会有任何一轮抓取。","operationId":"create_draft_me_monitors_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MonitorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/monitors/manual":{"post":{"tags":["auth","auth"],"summary":"Create Manual","description":"给几个网址，直接建草稿。**一次模型都不叫。**","operationId":"create_manual_me_monitors_manual_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManualIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MonitorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/monitors/stream":{"post":{"tags":["auth","auth"],"summary":"Create Draft Stream","description":"同 `POST /me/monitors`，但**把调研的推理过程流出来**。\n\n## 为什么要流\n\n这一步要几十秒（两次推理 + 真去搜 + 挑 + 逐个抓一遍样本），而用户面对的是一个转圈。\n转圈说不出\"它在干什么\"，也说不出\"它想明白了什么\"——于是四十秒之后他拿到一份结果，\n却没有任何依据判断这份结果好不好。\n\n**流出去的是推理本身**（\"血氧仪在巴西属 Classe II，所以二类器械的标签规则变动都与你\n有关\"），不是\"正在处理…\"。前者让人能当场说\"不对，我要的是别的\"；后者只是个会动的进度条。\n\n## 事件\n\n    stage    这一步在干什么（scope / where / search / pick / probe）\n    think    模型的推理原话\n    scope    第一段的结论（分类、会波及的规则族、明确排除的）\n    queries  想出来的搜索词\n    searched 某条搜索词回了几条\n    picked   挑中了哪个源、为什么\n    draft    最终草稿（和非流式那个接口同一份 JSON）\n    error    出错了，带上原因\n\n**不复用 `/me/monitors` 的返回体拼装**：那一份在下面，`draft` 事件直接调它，\n两处各拼一份迟早会分叉（这个仓库反复栽在这上面）。","operationId":"create_draft_stream_me_monitors_stream_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/monitors/probe":{"post":{"tags":["auth","auth"],"summary":"Probe One","description":"探一个网址：能不能抓、抽出了什么。**什么都不建。**\n\n自己加源那一栏用它——**每一个都在加进去的那一刻探一次**。一次贴五个然后直接确认，\n其中两个抓不到的话，他要到第一份报告没来的那天才知道，而**那一天不会到来**：\n一个静默失败的源，和一个\"这周没消息\"的源长得一模一样。\n\n与 `app/tools/probe_source.py` 同一条路径（`setup._probe` + 同一套 SSRF 守卫）。","operationId":"probe_one_me_monitors_probe_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__me__monitors__ProbeIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Probe One Me Monitors Probe Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/monitors/{plan_id}/confirm":{"post":{"tags":["auth","auth"],"summary":"Confirm","operationId":"confirm_me_monitors__plan_id__confirm_post","parameters":[{"name":"plan_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Plan Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Confirm Me Monitors  Plan Id  Confirm Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/monitors/{plan_id}":{"delete":{"tags":["auth","auth"],"summary":"Delete Monitor","operationId":"delete_monitor_me_monitors__plan_id__delete","parameters":[{"name":"plan_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Plan Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Delete Monitor Me Monitors  Plan Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/monitors/{plan_id}/run-now":{"post":{"tags":["auth","auth"],"summary":"Run Now","description":"立即检查一次。\n\n**不是\"演习\"。** 它走的是和定时完全一样的那条路——同一把锁、同一套记账、同样会出报告\n发信。演习证明不了真跑起来是好的，而人点这颗按钮要的正是那个证明。","operationId":"run_now_me_monitors__plan_id__run_now_post","parameters":[{"name":"plan_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Plan Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunNowOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/monitors/{plan_id}/reports":{"get":{"tags":["auth","auth"],"summary":"My Reports","description":"这个跟踪出过的报告，**一页一页给**（2026-08-18 主人：「这个报告可能会很多，\n要增加分页功能」）。\n\n## 两件事一起修\n\n原来是 `limit(50)` 一次拿完，而且**为了拿一个标题，把每一份报告的正文都解密了一遍**\n（`load_report` 解 title / markdown / html / highlights 四栏）。五十份报告的正文，\n换回来的是五十个标题——列表越长越慢，而慢的那部分全是没人要的东西。\n\n这里只解标题那一栏。游标按 `created_at`：它就是这一列的排序键，而报告是只增不改的，\n不会出现\"翻着翻着顺序变了\"。","operationId":"my_reports_me_monitors__plan_id__reports_get","parameters":[{"name":"plan_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Plan Id"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportPage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/monitors/{plan_id}/title":{"patch":{"tags":["auth","auth"],"summary":"Rename","description":"改名（2026-08-19 主人：「这些 AI 自动取的名字，请给我一个可以手工改名的方式」）。\n\n名字是模型在调研那一步写的短名——多数时候够用，但它是**给人认的东西**：\n列表上分辨\"哪个是哪个\"、报告标题、邮件主题都读它。既然是给人认的，人就该能改。\n\n**只动 `title`，不动别的**：名字和这个跟踪盯什么、怎么判、多久查一次都无关，\n改名不该顺手重排一次运行，也不该让判据重新生成。","operationId":"rename_me_monitors__plan_id__title_patch","parameters":[{"name":"plan_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Plan Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenameIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MonitorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/monitors/{plan_id}/cron":{"patch":{"tags":["auth","auth"],"summary":"Set Cron","description":"改这个跟踪多久查一次（2026-08-18 主人：「没有看到那里可以修改跟踪的触发频率」）。\n\n**改完要立刻重排下一次。** 只写 `cron` 而不动 `next_run_at`，那一栏还指着按老节奏\n算出来的时刻——用户把\"每天\"改成\"每小时\"，然后眼睁睁等到明天早上八点。改动生效得\n这么晚，看起来就跟没生效一样。","operationId":"set_cron_me_monitors__plan_id__cron_patch","parameters":[{"name":"plan_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Plan Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CronIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MonitorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/monitors/{plan_id}/live":{"get":{"tags":["auth","auth"],"summary":"Live Progress","description":"正在跑的那一轮，跑到哪儿了（docs/58 §五·六）。\n\n**重放 + 追随**：不带 `since` 就把到目前为止的全给你；带上就只给更晚的那些。\n中途打开、刷新页面，看到的都是完整的——**只做实时流的话，晚开一分钟就是一屏空白，\n而那时人会以为它根本没在跑**。\n\n**看不影响跑**：这个端点只读。关掉页面、十个人同时看，运行照旧\n（和新建调研那条流恰好相反，那里的取消必须真把请求掐掉）。","operationId":"live_progress_me_monitors__plan_id__live_get","parameters":[{"name":"plan_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Plan Id"}},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Since"}},{"name":"fresh","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Fresh"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LiveOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/monitors/{plan_id}/revise":{"post":{"tags":["auth","auth"],"summary":"Revise","description":"用户说\"哪里不对\" → 重新规划，并**说清楚改了什么**。\n\n**修改的方式是说话，不是勾选。** 勾选框只能让人做减法（去掉一个源），\n而最有价值的那种纠正是「你理解偏了」——它在勾选框里没有地方可去。","operationId":"revise_me_monitors__plan_id__revise_post","parameters":[{"name":"plan_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Plan Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__me__monitors__ReviseIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviseOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/monitors/{plan_id}/plan":{"get":{"tags":["auth","auth"],"summary":"Read Plan","description":"这个跟踪**按什么策略在盯**：盯什么、算相关、不算相关、怎么判。\n\n确认屏上摆过一次，然后就再也看不到了——而它是会变的（`/revise` 改的就是它），\n也是\"它为什么没报给我这条\"唯一说得清的东西。列表里点开一行就该看得到。\n\n不塞进列表接口：判据是加密存的，每一行都解一次 DEK，而绝大多数行不会被点开。","operationId":"read_plan_me_monitors__plan_id__plan_get","parameters":[{"name":"plan_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Plan Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanView"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/monitors/{plan_id}/preview":{"post":{"tags":["auth","auth"],"summary":"Preview","description":"**开始跟踪之前，先看一眼第一份简报**（2026-08-17 主人要的）。\n\n它跑的是真的那一轮的前半段：按计划抓一遍、抽出事实、成文——但**什么都不落库**，\n也不排期、不发信。所以：\n\n- 用户在按下「开始跟踪」之前就知道这个计划能给出什么，不满意可以先 Revise 或取消；\n- 而它是**真花钱的一次**（抓 N 个页面 + 两次模型调用），所以是一颗按钮，不是自动跑。\n  自动跑等于给每个只是点进来看看的人都记一笔账。\n\n**不写库**这一条是承重的：草稿此刻还不是一个跟踪，它落下的基线会让第一轮正式运行\n变成\"什么都不是新的\"——那正是用户最需要看到东西的那一轮。","operationId":"preview_me_monitors__plan_id__preview_post","parameters":[{"name":"plan_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Plan Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Preview Me Monitors  Plan Id  Preview Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/monitors/{plan_id}/preview-stream":{"post":{"tags":["auth","auth"],"summary":"Preview Stream","description":"预演，**一边跑一边说它在干什么**（2026-08-18 主人：「这个过程 UI 会卡很久」）。\n\n非流式那一版从按下到出结果之间只有一行\"这需要一分钟\"，而它真的要抓 N 个页面 + 两次\n模型调用。屏幕上什么都不动的那一分钟里，**\"在跑\"和\"挂了\"长得一模一样**——而这正是\n「立即检查」那一屏已经解决过的问题。\n\n所以不另造事件：留痕本来就是\"这一轮做了什么\"的逐条记录，`trace.watching` 在写留痕的\n同一处分一份出去，句子走 `live.step_text`（和轮询那条路同一份写法）。两个入口，\n一套进度。\n\n**和 `/preview` 是同一次运行**，只是多了一路旁白：正身在 `_preview_run`。","operationId":"preview_stream_me_monitors__plan_id__preview_stream_post","parameters":[{"name":"plan_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Plan Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/monitors/{plan_id}/sources/{source_id}":{"patch":{"tags":["auth","auth"],"summary":"Toggle Source","description":"开/关一个源。\n\n**建完之后就没有地方能改它了。** 确认屏上没勾的源会以 `enabled=false` 落库（勾选是\n减法，这是有意的），可那之后它就锁死了：线上一个计划 6 个源里 5 个是关的，列表却\n写着\"6 sources\"，每一轮只读一页、一秒就完——用户看到的是\"它好像什么都没做\"。\n要么给一个开关，要么别把它关上；关上而没有开关是最坏的第三种。","operationId":"toggle_source_me_monitors__plan_id__sources__source_id__patch","parameters":[{"name":"plan_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Plan Id"}},{"name":"source_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Source Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SourceToggleIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Toggle Source Me Monitors  Plan Id  Sources  Source Id  Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/monitor-reports/{token}":{"get":{"tags":["auth","auth"],"summary":"Read Report","operationId":"read_report_me_monitor_reports__token__get","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReportView"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/monitor-reports/{token}/kb-buttons":{"get":{"tags":["auth","auth"],"summary":"Kb Buttons","operationId":"kb_buttons_me_monitor_reports__token__kb_buttons_get","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/KbButtonOut"},"title":"Response Kb Buttons Me Monitor Reports  Token  Kb Buttons Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/monitor-reports/{token}/kb/{item_id}":{"post":{"tags":["auth","auth"],"summary":"Add Kb","description":"把这一条送进知识审阅队列。**只有这一个入口，且必须是人点的。**","operationId":"add_kb_me_monitor_reports__token__kb__item_id__post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Item Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Add Kb Me Monitor Reports  Token  Kb  Item Id  Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/monitors/{plan_id}/missed":{"post":{"tags":["auth","auth"],"summary":"Missed","description":"\"这条其实相关\"。补一份报告，并**提议**改关键词——未经确认不生效。","operationId":"missed_me_monitors__plan_id__missed_post","parameters":[{"name":"plan_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Plan Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MissedIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Missed Me Monitors  Plan Id  Missed Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/monitors/{plan_id}/keywords":{"post":{"tags":["auth","auth"],"summary":"Accept Keywords","description":"接受那条提议。**添加，不是替换**——替换会把他原本关心的东西挤掉。","operationId":"accept_keywords_me_monitors__plan_id__keywords_post","parameters":[{"name":"plan_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Plan Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KeywordsIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Accept Keywords Me Monitors  Plan Id  Keywords Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/debug/stream":{"get":{"tags":["admin"],"summary":"Debug Stream","description":"管理台实时调试日志流（SSE）：每个请求的输入/输出、记忆召回、工具调用、后端路由等。\n\n平台 admin 可看全部；带 `?tenant=<id>`（或管理台的 X-Act-Tenant）则只看该租户。","operationId":"debug_stream_admin_debug_stream_get","parameters":[{"name":"tenant","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant"}},{"name":"x-act-tenant","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Act-Tenant"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/tenants":{"post":{"tags":["admin"],"summary":"Create Tenant Endpoint","operationId":"create_tenant_endpoint_admin_tenants_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTenantIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTenantOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["admin"],"summary":"List Tenants","description":"每租户摘要（含用户/Agent/消息/文档计数）。sort=newest|oldest|users|messages|documents。\n\n`q`：按**名字 / 别名 / UUID / 控制台登录邮箱** 模糊搜索——管理员手上拿到的可能是\n任意一种，让他先想清楚\"这串是什么\"再选对应的框，是没必要的负担。邮箱走\ntenant_accounts（客户员工登控制台用的账号）：自动开通的租户名虽带注册邮箱\n（`agent4.io/<email>`），但客户改名后线索就断了，账号表才是稳定出处。\n\n`hidden`：`false` 只列没被收起的（控制台面板的默认视图），`true` 只列收起来的，\n**省略则两者都列**。默认不过滤是刻意的：一个默认就少返回一部分行的管理接口，会让\n\"我明明建了它，怎么查不到\"变成一次排查——而这一层的调用方（脚本、测试、将来的别的\n界面）要的是\"库里到底有什么\"。挑视图是界面的事，界面自己说清楚要哪一种。\n\n按聚合列排序 → 用 offset 分页（cursor 为不透明 offset）；租户数量适中，性能可接受。","operationId":"list_tenants_admin_tenants_get","parameters":[{"name":"sort","in":"query","required":false,"schema":{"type":"string","default":"newest","title":"Sort"}},{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Q"}},{"name":"hidden","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Hidden"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":30,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantPage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/tenants/{tid}":{"get":{"tags":["admin"],"summary":"Get Tenant","operationId":"get_tenant_admin_tenants__tid__get","parameters":[{"name":"tid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Tid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["admin"],"summary":"Patch Tenant","operationId":"patch_tenant_admin_tenants__tid__patch","parameters":[{"name":"tid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Tid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantPatch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["admin"],"summary":"Delete Tenant","operationId":"delete_tenant_admin_tenants__tid__delete","parameters":[{"name":"tid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Tid"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/tenants/{tid}/keys":{"get":{"tags":["admin"],"summary":"List Keys","operationId":"list_keys_admin_tenants__tid__keys_get","parameters":[{"name":"tid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Tid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ApiKeyOut"},"title":"Response List Keys Admin Tenants  Tid  Keys Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["admin"],"summary":"Issue Key","operationId":"issue_key_admin_tenants__tid__keys_post","parameters":[{"name":"tid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Tid"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/KeyIssueIn"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IssuedKeyOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/tenants/{tid}/keys/{kid}/revoke":{"post":{"tags":["admin"],"summary":"Revoke Key","operationId":"revoke_key_admin_tenants__tid__keys__kid__revoke_post","parameters":[{"name":"tid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Tid"}},{"name":"kid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Kid"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/tenants/{tid}/keys/{kid}":{"delete":{"tags":["admin"],"summary":"Delete Key","description":"软删除一把**已撤销**的 Key：从列表隐藏，行仍留库（审计可追）。\n\n只允许删已撤销的——避免用\"删除\"绕过撤销语义把一把仍有效的 key 从视野里抹掉。\n鉴权本就先看 revoked，故被软删的 key 依旧被拒（见 app/auth/principal.py）。","operationId":"delete_key_admin_tenants__tid__keys__kid__delete","parameters":[{"name":"tid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Tid"}},{"name":"kid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Kid"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/tenants/{tid}/accounts":{"get":{"tags":["admin"],"summary":"List Accounts","operationId":"list_accounts_admin_tenants__tid__accounts_get","parameters":[{"name":"tid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Tid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TenantAccountOut"},"title":"Response List Accounts Admin Tenants  Tid  Accounts Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["admin"],"summary":"Add Account","operationId":"add_account_admin_tenants__tid__accounts_post","parameters":[{"name":"tid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Tid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAccountIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantAccountOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/tenants/{tid}/accounts/{aid}/password":{"post":{"tags":["admin"],"summary":"Reset Account Password","description":"管理员重置某租户账号的密码（租户方忘记密码时的兜底）。\n\n**不校验旧密码**——这是管理员的越权重置，不是用户自助改密（那条在 /console/change-password）。","operationId":"reset_account_password_admin_tenants__tid__accounts__aid__password_post","parameters":[{"name":"tid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Tid"}},{"name":"aid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Aid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetPasswordIn"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/tenants/{tid}/accounts/{aid}":{"delete":{"tags":["admin"],"summary":"Delete Account","operationId":"delete_account_admin_tenants__tid__accounts__aid__delete","parameters":[{"name":"tid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Tid"}},{"name":"aid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Aid"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/tenants/{tid}/oauth":{"get":{"tags":["admin"],"summary":"List Oauth","operationId":"list_oauth_admin_tenants__tid__oauth_get","parameters":[{"name":"tid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Tid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/OauthProviderOut"},"title":"Response List Oauth Admin Tenants  Tid  Oauth Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/tenants/{tid}/oauth/{provider}":{"put":{"tags":["admin"],"summary":"Set Oauth","operationId":"set_oauth_admin_tenants__tid__oauth__provider__put","parameters":[{"name":"tid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Tid"}},{"name":"provider","in":"path","required":true,"schema":{"type":"string","title":"Provider"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OauthCredIn"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["admin"],"summary":"Delete Oauth","operationId":"delete_oauth_admin_tenants__tid__oauth__provider__delete","parameters":[{"name":"tid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Tid"}},{"name":"provider","in":"path","required":true,"schema":{"type":"string","title":"Provider"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/tenants/{tid}/oauth/{provider}/enabled":{"put":{"tags":["admin"],"summary":"Set Oauth Enabled","description":"显式开/关某个社交登录（与「填没填凭证」解耦）——平台端镜像 tenant.py 的同名自服务路由。\n先前只有租户自服务侧有这条，admin 代租户编辑时 toggle 会 404（见 OauthCreds.tsx）。","operationId":"set_oauth_enabled_admin_tenants__tid__oauth__provider__enabled_put","parameters":[{"name":"tid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Tid"}},{"name":"provider","in":"path","required":true,"schema":{"type":"string","title":"Provider"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OauthEnabledIn"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/overview":{"get":{"tags":["admin"],"summary":"Overview","operationId":"overview_admin_overview_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OverviewOut"}}}}}}},"/admin/audit":{"get":{"tags":["admin"],"summary":"Audit","description":"游标分页（keyset：按 (created_at, id) 降序）。next_cursor 非空则可继续加载。\n\n`changes_only` 只留下改了数据的记录。判据是 `entity` 字段——轨迹自动记录的每条都带，\n手写埋点里改了东西的也带（见 app/audit.py）——而不是对动作名后缀的猜测：登录、连接测试、\n工具调用这类只读记录数量上远多于真正的改动，会把后者淹掉。","operationId":"audit_admin_audit_get","parameters":[{"name":"tenant_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Tenant Id"}},{"name":"action","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Action"}},{"name":"changes_only","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Changes Only"}},{"name":"date_from","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Date From"}},{"name":"date_to","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Date To"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditPage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/planner/summary":{"get":{"tags":["admin"],"summary":"Planner Summary","description":"规划器用量与配置总览:开通了的租户 + 周期内有 kind=planner 用量的租户,并集。","operationId":"planner_summary_admin_planner_summary_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","default":30,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PlannerTenantRow"},"title":"Response Planner Summary Admin Planner Summary Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/tenants/{tid}/planner":{"put":{"tags":["admin"],"summary":"Put Tenant Planner","operationId":"put_tenant_planner_admin_tenants__tid__planner_put","parameters":[{"name":"tid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Tid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlannerConfigIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlannerTenantRow"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/models":{"get":{"tags":["admin"],"summary":"List Models","operationId":"list_models_admin_models_get","parameters":[{"name":"kind","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kind"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ModelBackendOut"},"title":"Response List Models Admin Models Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["admin"],"summary":"Create Model","operationId":"create_model_admin_models_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelBackendIn"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelBackendOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/models/fetch-models":{"post":{"tags":["admin"],"summary":"Fetch Models","description":"据 base_url + api_key 探测远端 /v1/models，返回可选模型 id + 推断的类型。\n\naudio.cpp（OpenAI 兼容的 /v1/models + /v1/audio/{speech,transcriptions}）会在模型条目带\n`task`（tts/asr），据此自动分类 stt/tts；缺失则按 id 关键词启发，仍不确定则留空由人工选。","operationId":"fetch_models_admin_models_fetch_models_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FetchModelsIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FetchModelsOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/models/{mid}":{"get":{"tags":["admin"],"summary":"Get Model","operationId":"get_model_admin_models__mid__get","parameters":[{"name":"mid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Mid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelBackendOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["admin"],"summary":"Patch Model","operationId":"patch_model_admin_models__mid__patch","parameters":[{"name":"mid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Mid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelBackendPatch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelBackendOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["admin"],"summary":"Delete Model","operationId":"delete_model_admin_models__mid__delete","parameters":[{"name":"mid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Mid"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/models/{mid}/test":{"post":{"tags":["admin"],"summary":"Test Model","description":"用该后端凭证探测 /v1/models，校验 model 是否存在，缓存 status/last_error/last_checked_at。","operationId":"test_model_admin_models__mid__test_post","parameters":[{"name":"mid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Mid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelBackendOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/models/usage/by-server":{"get":{"tags":["admin"],"summary":"Usage By Server","description":"每 LLM 后端 server 的 token 汇总 + 已分配会话数（负载监看）。","operationId":"usage_by_server_admin_models_usage_by_server_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ServerUsageRow"},"type":"array","title":"Response Usage By Server Admin Models Usage By Server Get"}}}}}}},"/admin/models/usage/daily":{"get":{"tags":["admin"],"summary":"Usage Daily","description":"每 server 的 token 消耗时间序列（供折线图）。hours>0 按小时分桶（近 N 小时），否则按天；kind 过滤后端类型。\n\n返回**连续的**桶序列：无数据的时段补 0 占位而非跳过——否则折线图上等宽的一段可能代表 1 小时也可能\n代表 9 小时，横轴失去时间意义。","operationId":"usage_daily_admin_models_usage_daily_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","default":30,"title":"Days"}},{"name":"hours","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Hours"}},{"name":"kind","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kind"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DailyUsageOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/platform-skills":{"get":{"tags":["平台技能库"],"summary":"List Platform Skills","operationId":"list_platform_skills_admin_platform_skills_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LibraryOut"}}}}}}},"/admin/platform-skills/{name}":{"put":{"tags":["平台技能库"],"summary":"Upsert Platform Skill","operationId":"upsert_platform_skill_admin_platform_skills__name__put","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__admin_platform_skills__SkillIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__admin_platform_skills__SkillOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["平台技能库"],"summary":"Remove Platform Skill","operationId":"remove_platform_skill_admin_platform_skills__name__delete","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Remove Platform Skill Admin Platform Skills  Name  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/platform-skills/{name}/anchors/regenerate":{"post":{"tags":["平台技能库"],"summary":"Regenerate Anchors","description":"重新生成触发范例。**只动生成的那一份**——手写的 `menu_anchors` 不碰。","operationId":"regenerate_anchors_admin_platform_skills__name__anchors_regenerate_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__admin_platform_skills__SkillOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/platform-skills/diagnose":{"get":{"tags":["平台技能库"],"summary":"Diagnose","description":"逐个技能算自命中率：**它的典型说法，检索回来的是不是它自己**。\n\n比\"两个技能的描述像不像\"准得多——平台内置工具里 `cancel_reminder` 与 `list_reminders`\n相似度 0.903 却从不混淆，而\"市场格局测绘\"与\"市场格局全景研究\"只有 0.836 却真的分不开。\n文本像不像，和能不能被区分开，是两回事（docs/59 §五）。","operationId":"diagnose_admin_platform_skills_diagnose_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/Diagnosis"},"type":"array","title":"Response Diagnose Admin Platform Skills Diagnose Get"}}}}}}},"/admin/platform-skills/activate":{"post":{"tags":["平台技能库"],"summary":"Activate","description":"一键启用/停用平台技能库。\n\n**启用之后立刻生效，不用重启**——这正是把标记放进库里而不是环境变量的理由：\n环境变量改了不重启就不生效，而\"不生效\"和\"已生效\"在界面上长得一模一样。","operationId":"activate_admin_platform_skills_activate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivateIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LibraryOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenant/changelog":{"get":{"tags":["更新日志"],"summary":"Changelog","operationId":"changelog_tenant_changelog_get","parameters":[{"name":"locale","in":"query","required":false,"schema":{"type":"string","default":"en","title":"Locale"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangelogOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/web-cache":{"get":{"tags":["admin"],"summary":"List Cache","description":"按抓取时间倒序。`hits` 那一列是重点：一个从来不命中的缓存是纯粹的负担。","operationId":"list_cache_admin_web_cache_get","parameters":[{"name":"kind","in":"query","required":false,"schema":{"anyOf":[{"type":"string","pattern":"^(page|search)$"},{"type":"null"}],"title":"Kind"}},{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Q"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CachePage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/web-cache/{cid}":{"delete":{"tags":["admin"],"summary":"Delete One","description":"清一条。**这是最常用的那个操作**：某一页抓岔了，不该为它把整个缓存倒掉。","operationId":"delete_one_admin_web_cache__cid__delete","parameters":[{"name":"cid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Cid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Delete One Admin Web Cache  Cid  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/web-cache/purge":{"post":{"tags":["admin"],"summary":"Purge","description":"整体清空（可只清一类，或只清过期的）。返回删了多少条。","operationId":"purge_admin_web_cache_purge_post","parameters":[{"name":"kind","in":"query","required":false,"schema":{"anyOf":[{"type":"string","pattern":"^(page|search)$"},{"type":"null"}],"title":"Kind"}},{"name":"expired_only","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Expired Only"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Purge Admin Web Cache Purge Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenant/settings":{"get":{"tags":["tenant"],"summary":"Get Settings Ep","operationId":"get_settings_ep_tenant_settings_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantSettingsOut"}}}}}},"patch":{"tags":["tenant"],"summary":"Patch Settings Ep","operationId":"patch_settings_ep_tenant_settings_patch","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantSettingsPatch"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantSettingsOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenant/quota":{"get":{"tags":["tenant"],"summary":"Get Quota Ep","description":"本租户配额消耗快照（供控制台警告横幅 + 进度条，见 docs/36）。租户只读，配额由平台/agent4.io 设。","operationId":"get_quota_ep_tenant_quota_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Get Quota Ep Tenant Quota Get"}}}}}}},"/tenant/settings/smtp":{"put":{"tags":["tenant"],"summary":"Set Smtp Ep","description":"设置租户级 SMTP 发信配置（密码平台 KEK 封装）。host 留空=清空（回落平台全局）。","operationId":"set_smtp_ep_tenant_settings_smtp_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SmtpIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantSettingsOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenant/settings/smtp/test":{"post":{"tags":["tenant"],"summary":"Test Smtp Ep","description":"用当前租户 SMTP 发一封测试邮件到 `to`。未配则走平台全局（或 dev-log）。","operationId":"test_smtp_ep_tenant_settings_smtp_test_post","parameters":[{"name":"to","in":"query","required":true,"schema":{"type":"string","title":"To"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenant/oauth/{provider}":{"put":{"tags":["tenant"],"summary":"Set Oauth Ep","operationId":"set_oauth_ep_tenant_oauth__provider__put","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string","title":"Provider"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OauthCredIn"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["tenant"],"summary":"Delete Oauth Ep","operationId":"delete_oauth_ep_tenant_oauth__provider__delete","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string","title":"Provider"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenant/oauth/{provider}/enabled":{"put":{"tags":["tenant"],"summary":"Set Oauth Enabled Ep","description":"显式开/关某个社交登录（与「有没有填凭证」解耦）。\n\n关掉后即使平台有默认 OAuth 应用，登录页也不显示该按钮——租户得能自己决定给不给用，\n而不是\"平台配了就一定出现\"。","operationId":"set_oauth_enabled_ep_tenant_oauth__provider__enabled_put","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string","title":"Provider"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OauthEnabledIn"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenant/keys":{"get":{"tags":["tenant"],"summary":"List My Keys","description":"本租户的 API Key 列表（仅元数据，永不回明文）。","operationId":"list_my_keys_tenant_keys_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ApiKeyOut"},"type":"array","title":"Response List My Keys Tenant Keys Get"}}}}}},"post":{"tags":["tenant"],"summary":"Issue My Key","description":"为本租户生成一把新 API Key（明文仅此刻返回一次）。","operationId":"issue_my_key_tenant_keys_post","requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/KeyIssueIn"},{"type":"null"}],"title":"Body"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IssuedKeyOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenant/keys/{kid}/revoke":{"post":{"tags":["tenant"],"summary":"Revoke My Key","description":"撤销本租户的一把 API Key。禁止撤销最后一把有效 key（避免自锁死）。","operationId":"revoke_my_key_tenant_keys__kid__revoke_post","parameters":[{"name":"kid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Kid"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenant/keys/{kid}":{"delete":{"tags":["tenant"],"summary":"Delete My Key","description":"软删除本租户一把**已撤销**的 Key:从列表隐藏,行仍留库(审计可追)。\n\n只允许删已撤销的——否则\"删除\"就成了绕过撤销语义、把一把仍有效的 key 从视野里抹掉的\n后门(撤销那边还有\"不能撤销最后一把\"的自锁死保护,删除若能越过它就白设了)。\n与平台端 /admin/tenants/{tid}/keys/{kid} 同语义,两处行为必须一致。","operationId":"delete_my_key_tenant_keys__kid__delete","parameters":[{"name":"kid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Kid"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenant/me":{"get":{"tags":["tenant"],"summary":"Tenant Me","description":"当前租户身份（供管理端显示租户 ID / 名称）。鉴权 X-API-Key 或 admin+X-Act-Tenant。","operationId":"tenant_me_tenant_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantMeOut"}}}}}}},"/tenant/privacy":{"get":{"tags":["tenant"],"summary":"Get Privacy","operationId":"get_privacy_tenant_privacy_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ByokOut"}}}}}},"put":{"tags":["tenant"],"summary":"Set Privacy","operationId":"set_privacy_tenant_privacy_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ByokIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ByokOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenant/settings/logo":{"post":{"tags":["tenant"],"summary":"Upload Brand Logo","description":"上传登录页 Logo：存 blob，profile.login_logo 指向公开流式端点。\n\n带时间戳 `?v=` 破缓存——公开端点缓存了一天，换 Logo 后 URL 要变才刷新。","operationId":"upload_brand_logo_tenant_settings_logo_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_brand_logo_tenant_settings_logo_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Upload Brand Logo Tenant Settings Logo Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenant/audit":{"get":{"tags":["tenant"],"summary":"Tenant Audit","description":"本租户的操作轨迹，按时间倒序。\n\n记录由 ORM 层自动产生（app/audit_trail.py），所以经 REST、MCP、控制台、脚本做的改动\n都在这里，不取决于哪个端点记得埋点。\n\n**两种翻页方式，各有各的用处**：`offset` + `total` 支持跳页（控制台的表格用这个——要看\n三周前的记录，一次次\"加载更多\"是走不到的）；`cursor` 是稳定游标，适合从头到尾拉一遍\n（中途有新记录写入也不会重复或漏掉，脚本导出用这个）。传了 cursor 就走游标模式。","operationId":"tenant_audit_tenant_audit_get","parameters":[{"name":"action","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Action"}},{"name":"entity","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Entity"}},{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Q"}},{"name":"changes_only","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Changes Only"}},{"name":"date_from","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Date From"}},{"name":"date_to","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Date To"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantAuditPage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenant/audit.csv":{"get":{"tags":["tenant"],"summary":"Tenant Audit Csv","description":"同样的筛选条件导出 CSV。\n\n合规场景里\"给我看\"和\"给我一份\"是两件事——审计要能交出去（发给审计师、存进自己的归档），\n而截图和翻页都不算交付。before/after 序列化成 JSON 放进单元格，保持可机读。","operationId":"tenant_audit_csv_tenant_audit_csv_get","parameters":[{"name":"action","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Action"}},{"name":"entity","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Entity"}},{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Q"}},{"name":"changes_only","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Changes Only"}},{"name":"date_from","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Date From"}},{"name":"date_to","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Date To"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":5000,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/t/{alias}":{"get":{"tags":["tenant-page"],"summary":"Tenant Login Page","description":"租户品牌登录页。别名解析不到 / 租户停用 → 404。\n\n**宿主已经换成挂件本体**（`web/widget.html`）——与 `/s/{token}`、`/t/{alias}/{agent}` 同一份\n代码，于是能力菜单、文档模式、引用角标、开场白、逐步进度这些**一次都不必搬**（差集 250 项，\n见 docs/52）。反过来 `/t/` 独有的四块（消息工具栏、我的数据、提醒、个人设置）抽成了\n`web/{msgtools,dataview,mepanels}.js`，两个宿主共用。\n\n`?host=index` 退回旧宿主 `web/index.html`。**它还留着，不是为了兼容，是因为空间与成员\n管理还没搬**（多空间实测几乎无人使用：2686 个用户 1 个空间、1 个用户 2 个，所以它排在\n最后而不是不做）。那一块搬完，这个开关连同 index.html、app.js 一起删。","operationId":"tenant_login_page_t__alias__get","parameters":[{"name":"alias","in":"path","required":true,"schema":{"type":"string","title":"Alias"}}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/t/{alias}/{agent_ref}":{"get":{"tags":["tenant-page"],"summary":"Tenant Agent Page","description":"某个 agent 的人类可读整页对话：`chat.agent4.io/t/{租户别名}/{agent 别名}`。\n\n只暴露主人**显式设了别名**的 agent（resolve_agent_by_alias 不回落 name）。首次访问时若该\nagent 还没有可用的分享链接，就懒建一个匿名分享——别名本身即\"我要公开分享它\"的意图，这样\n这条链接对已设别名的 agent 永远可用，而不会因为忘了先建分享而 404。之后复用同一个令牌。","operationId":"tenant_agent_page_t__alias___agent_ref__get","parameters":[{"name":"alias","in":"path","required":true,"schema":{"type":"string","title":"Alias"}},{"name":"agent_ref","in":"path","required":true,"schema":{"type":"string","title":"Agent Ref"}}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/t/{alias}/console/agents":{"get":{"tags":["tenant-page"],"summary":"Tenant Console Agents","description":"后台的 agent 切换器：这个租户里我能对话的每个 agent，各配一条可用的分享令牌。\n\n**身份必须是这个租户的终端用户。** 令牌本身不是秘密（公开页用的就是它们），但\"这个租户\n有哪些 agent\"是租户的经营信息，不该匿名可枚举——所以这里校验 JWT 且比对 `tid`，与\n`share._verify_account` 同一口径。","operationId":"tenant_console_agents_t__alias__console_agents_get","parameters":[{"name":"alias","in":"path","required":true,"schema":{"type":"string","title":"Alias"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true},"title":"Response Tenant Console Agents T  Alias  Console Agents Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/brand/{tenant_id}/logo":{"get":{"tags":["tenant-page"],"summary":"Tenant Logo","description":"公开流式租户上传的 Logo（登录页 <img> 用）。未上传 → 404。","operationId":"tenant_logo_brand__tenant_id__logo_get","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/img/{tenant_id}/{image_id}":{"get":{"tags":["tenant-page"],"summary":"Tenant Image","description":"公开流式租户上传的商品图（挂件里给访客看的 <img>）。仿 Logo：公开、不加密。\n\nid 是随机 UUID、不可枚举，且校验 image.tenant_id 与路径一致，防跨租户猜取。图片内容不加密\n——它本就要挂在租户聊天里公开展示（见 TenantImage 的说明）。内容按 blob_ref 不可变，长缓存。","operationId":"tenant_image_img__tenant_id___image_id__get","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Tenant Id"}},{"name":"image_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Image Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agents":{"get":{"tags":["agents"],"summary":"List Tenant Agents","operationId":"list_tenant_agents_agents_get","parameters":[{"name":"published","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Published"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AgentSummary"},"title":"Response List Tenant Agents Agents Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agents/{name}":{"get":{"tags":["agents"],"summary":"Get Agent","operationId":"get_agent_agents__name__get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["agents"],"summary":"Create Agent","operationId":"create_agent_agents__name__post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentIn"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["agents"],"summary":"Update Agent","operationId":"update_agent_agents__name__put","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["agents"],"summary":"Patch Agent","description":"局部更新：只写请求里出现过的字段，其余原样留着。\n\n404 而不是「创建一个」：PATCH 一个不存在的对象是调用方弄错了名字，替他建一个空壳只会让\n那个错误更晚才被发现。","operationId":"patch_agent_agents__name__patch","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentPatch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["agents"],"summary":"Remove Agent","operationId":"remove_agent_agents__name__delete","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agents/import":{"post":{"tags":["agents"],"summary":"Import Agent","description":"导入一份导出的 Agent JSON，落成一个未发布的 Agent。版本号感知；名字冲突自动改名。","operationId":"import_agent_agents_import_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentImportIn"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agents/{name}/clone":{"post":{"tags":["agents"],"summary":"Clone Agent","description":"从现有 Agent 复制一个未发布的副本，供改动微调（也可复制内置 Agent 成一份可编辑的）。","operationId":"clone_agent_agents__name__clone_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agents/{name}/export":{"get":{"tags":["agents"],"summary":"Export Agent","description":"导出一份可移植的 Agent JSON（不含租户/别名/发布态），供备份或迁移。","operationId":"export_agent_agents__name__export_get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentExport"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agents/{name}/alias":{"get":{"tags":["agents"],"summary":"Get Agent Alias","operationId":"get_agent_alias_agents__name__alias_get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentAliasOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["agents"],"summary":"Set Agent Alias","description":"设置或清除 agent 别名。校验 + 租户内查重（撞车 409，不合法 400）。\n\n刻意不走 upsert_agent：别名是路由属性、不进修订快照，混进整体替换只会招来\"PUT 静默清字段\"\n那类 bug。","operationId":"set_agent_alias_agents__name__alias_put","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentAliasIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentAliasOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agents/{name}/revisions":{"get":{"tags":["agents"],"summary":"List Agent Revisions","description":"这个 Agent 的历史，最新在前。第一条就是当前状态（快照记的是写入之后）。","operationId":"list_agent_revisions_agents__name__revisions_get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/app__api__agents__RevisionOut"},"title":"Response List Agent Revisions Agents  Name  Revisions Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agents/{name}/revisions/{rev_id}/restore":{"post":{"tags":["agents"],"summary":"Restore Agent Revision","description":"把 Agent 变回某一条修订的样子。\n\n恢复本身也是一次写入，所以它自己也会产生一条修订——撤销是可撤销的。这不是巧合，是把\n记录挂在 upsert 漏斗上的直接结果。","operationId":"restore_agent_revision_agents__name__revisions__rev_id__restore_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}},{"name":"rev_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Rev Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agents/{name}/shares":{"post":{"tags":["agents"],"summary":"Create Agent Share","operationId":"create_agent_share_agents__name__shares_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareIn"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["agents"],"summary":"List Agent Shares","operationId":"list_agent_shares_agents__name__shares_get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ShareOut"},"title":"Response List Agent Shares Agents  Name  Shares Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agents/{name}/shares/{token}":{"patch":{"tags":["agents"],"summary":"Update Agent Share","operationId":"update_agent_share_agents__name__shares__token__patch","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}},{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SharePatch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["agents"],"summary":"Revoke Agent Share","operationId":"revoke_agent_share_agents__name__shares__token__delete","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}},{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"purge","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Purge"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agents/{name}/shares/{token}/secret":{"post":{"tags":["agents"],"summary":"Rotate Share Secret","description":"（重新）签发 host_session 集成密钥：明文仅本次返回，服务端只存密文。","operationId":"rotate_share_secret_agents__name__shares__token__secret_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}},{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SecretOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agents/{name}/pwa":{"get":{"tags":["agents"],"summary":"Get Agent Pwa","description":"该 Agent 的 PWA 品牌（安装提示形态 + 图标 URL；未设图标的键为 null → 用平台图标）。","operationId":"get_agent_pwa_agents__name__pwa_get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PwaOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["agents"],"summary":"Patch Agent Pwa","description":"改安装提示形态：banner（非打扰横幅，默认）| card（首次弹卡片）| off（不提示）。","operationId":"patch_agent_pwa_agents__name__pwa_patch","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PwaPatch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PwaOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agents/{name}/pwa/icon":{"post":{"tags":["agents"],"summary":"Upload Agent Pwa Icon","description":"上传**一张母图**（≥192×192 的 PNG/JPG/WebP），服务端出全套：\nfavicon(48) + 192 + 512 + maskable(512)。非正方形按中心裁方。\n产物存 tenant_images（公开托管，/img/{tenant}/{id}），Agent.branding 只存引用。","operationId":"upload_agent_pwa_icon_agents__name__pwa_icon_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_agent_pwa_icon_agents__name__pwa_icon_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PwaOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["agents"],"summary":"Clear Agent Pwa Icon","description":"清掉该 Agent 的自定义图标，回退平台图标。","operationId":"clear_agent_pwa_icon_agents__name__pwa_icon_delete","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PwaOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agents/{name}/test-trigger":{"post":{"tags":["agents"],"summary":"Test Trigger","operationId":"test_trigger_agents__name__test_trigger_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TriggerTestIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Test Trigger Agents  Name  Test Trigger Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agents/{name}/test-planner-trigger":{"post":{"tags":["agents"],"summary":"Test Planner Trigger","description":"升级裁判 dry-run:最后一条消息当\"本轮\",其余当此前的用户发言窗口(与线上同构)。","operationId":"test_planner_trigger_agents__name__test_planner_trigger_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlannerTriggerIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlannerTriggerOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agents/{name}/preview-plan":{"post":{"tags":["agents"],"summary":"Preview Plan","description":"生成一份计划供审阅——**不落库、不入线、不影响任何用户**。","operationId":"preview_plan_agents__name__preview_plan_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreviewPlanIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreviewPlanOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/assist/improve-prompt":{"post":{"tags":["assist"],"summary":"Improve Prompt Endpoint","operationId":"improve_prompt_endpoint_assist_improve_prompt_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImprovePromptIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImprovePromptOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/assist/diagnose-prompt":{"post":{"tags":["assist"],"summary":"Diagnose Prompt Endpoint","operationId":"diagnose_prompt_endpoint_assist_diagnose_prompt_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DiagnosePromptIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DiagnosePromptOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/skills":{"get":{"tags":["skills"],"summary":"List Tenant Skills","operationId":"list_tenant_skills_skills_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/app__api__skills__SkillOut"},"type":"array","title":"Response List Tenant Skills Skills Get"}}}}}}},"/skills/{name}":{"get":{"tags":["skills"],"summary":"Get Skill","operationId":"get_skill_skills__name__get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__skills__SkillOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["skills"],"summary":"Create Skill","operationId":"create_skill_skills__name__post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__skills__SkillIn"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__skills__SkillOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["skills"],"summary":"Update Skill","operationId":"update_skill_skills__name__put","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__skills__SkillIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__skills__SkillOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["skills"],"summary":"Patch Skill","description":"局部更新。404 而不是创建：PATCH 一个不存在的技能是名字写错了。","operationId":"patch_skill_skills__name__patch","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SkillPatch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__skills__SkillOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["skills"],"summary":"Remove Skill","operationId":"remove_skill_skills__name__delete","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/skills/{name}/revisions":{"get":{"tags":["skills"],"summary":"List Skill Revisions","operationId":"list_skill_revisions_skills__name__revisions_get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SkillRevisionOut"},"title":"Response List Skill Revisions Skills  Name  Revisions Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/skills/{name}/revisions/{rev_id}/restore":{"post":{"tags":["skills"],"summary":"Restore Skill Revision","operationId":"restore_skill_revision_skills__name__revisions__rev_id__restore_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}},{"name":"rev_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Rev Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__skills__SkillOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/writing-types":{"get":{"tags":["writing"],"summary":"List Types","operationId":"list_types_writing_types_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/TypeOut"},"type":"array","title":"Response List Types Writing Types Get"}}}}}}},"/writing-types/{name}":{"get":{"tags":["writing"],"summary":"Get Type","operationId":"get_type_writing_types__name__get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TypeOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["writing"],"summary":"Create Type","operationId":"create_type_writing_types__name__post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TypeIn"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TypeOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["writing"],"summary":"Replace Type","operationId":"replace_type_writing_types__name__put","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TypeIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TypeOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["writing"],"summary":"Patch Type","operationId":"patch_type_writing_types__name__patch","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TypePatch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TypeOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["writing"],"summary":"Delete Type","description":"删类型。**已经起过的文档不受影响**——`writing_runs.type_id` 刻意没有外键，一份写好的\n材料不该因为有人清理了一个模板而读不出来。","operationId":"delete_type_writing_types__name__delete","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/writing-types/{name}/publish":{"post":{"tags":["writing"],"summary":"Publish Type","description":"发布 = **冻结一版 + 算一次匹配向量**。在跑的文档钉住的是冻结的那一份，不是当前值。\n\n向量在**发布时**算，不是匹配时算：匹配挂在每一轮对话上，那里不能有一次嵌入调用；而发布\n是一次人工动作，慢一点没有人会注意到。","operationId":"publish_type_writing_types__name__publish_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TypeOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/writing-types/{name}/revisions":{"get":{"tags":["writing"],"summary":"List Revisions","operationId":"list_revisions_writing_types__name__revisions_get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/app__api__writing_types__RevisionOut"},"title":"Response List Revisions Writing Types  Name  Revisions Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/storylines":{"get":{"tags":["storylines"],"summary":"List Storylines","operationId":"list_storylines_storylines_get","parameters":[{"name":"agent","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/StorylineOut"},"title":"Response List Storylines Storylines Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["storylines"],"summary":"Create Storyline","operationId":"create_storyline_storylines_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StorylineIn"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StorylineOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/storylines/feature":{"get":{"tags":["storylines"],"summary":"Storyline Feature","description":"控制台入口预检:开关状态。必须注册在 /{storyline_id} 之前(路由顺序)。\n没有它,\"New storyline\" 打开的是纯前端画布,画完图保存时才 403——门要拦在门口。","operationId":"storyline_feature_storylines_feature_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Storyline Feature Storylines Feature Get"}}}}}}},"/storylines/{storyline_id}":{"get":{"tags":["storylines"],"summary":"Get Storyline","operationId":"get_storyline_storylines__storyline_id__get","parameters":[{"name":"storyline_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Storyline Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StorylineOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["storylines"],"summary":"Update Storyline","operationId":"update_storyline_storylines__storyline_id__put","parameters":[{"name":"storyline_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Storyline Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StorylineIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StorylineOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["storylines"],"summary":"Delete Storyline","operationId":"delete_storyline_storylines__storyline_id__delete","parameters":[{"name":"storyline_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Storyline Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/storylines/{storyline_id}/clone":{"post":{"tags":["storylines"],"summary":"Clone Storyline","operationId":"clone_storyline_storylines__storyline_id__clone_post","parameters":[{"name":"storyline_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Storyline Id"}}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StorylineOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/storylines/{storyline_id}/export":{"get":{"tags":["storylines"],"summary":"Export Storyline","description":"导出一份可移植的故事线 JSON（不含租户/版本/revision/串联 id），供备份或迁移。","operationId":"export_storyline_storylines__storyline_id__export_get","parameters":[{"name":"storyline_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Storyline Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StorylineExport"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/storylines/import":{"post":{"tags":["storylines"],"summary":"Import Storyline","operationId":"import_storyline_storylines_import_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StorylineImportIn"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StorylineOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/storylines/{storyline_id}/validate":{"post":{"tags":["storylines"],"summary":"Validate Storyline","operationId":"validate_storyline_storylines__storyline_id__validate_post","parameters":[{"name":"storyline_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Storyline Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/storylines/{storyline_id}/publish":{"post":{"tags":["storylines"],"summary":"Publish Storyline","operationId":"publish_storyline_storylines__storyline_id__publish_post","parameters":[{"name":"storyline_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Storyline Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StorylineOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/storylines/{storyline_id}/unpublish":{"post":{"tags":["storylines"],"summary":"Unpublish Storyline","description":"下线（归档）：不再自动入线，在途用户下一轮静默降级为普通 Agent（进度保留，重新发布可续）。","operationId":"unpublish_storyline_storylines__storyline_id__unpublish_post","parameters":[{"name":"storyline_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Storyline Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StorylineOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/storylines/{storyline_id}/revisions":{"get":{"tags":["storylines"],"summary":"List Revisions","operationId":"list_revisions_storylines__storyline_id__revisions_get","parameters":[{"name":"storyline_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Storyline Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/app__api__storylines__RevisionOut"},"title":"Response List Revisions Storylines  Storyline Id  Revisions Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/storylines/{storyline_id}/enrollments":{"get":{"tags":["storylines"],"summary":"List Enrollments","description":"在途学员列表（含 user_id 以便运营点进用户详情；不含 blackboard/正文）。按 tenant 校验故事线归属。","operationId":"list_enrollments_storylines__storyline_id__enrollments_get","parameters":[{"name":"storyline_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Storyline Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/EnrollmentOut"},"title":"Response List Enrollments Storylines  Storyline Id  Enrollments Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/storylines/{storyline_id}/funnel":{"get":{"tags":["storylines"],"summary":"Storyline Funnel","description":"节点漏斗：历史 enter/exit/complete（来自聚合埋点，不记用户）+ 当前各节点停留人数。","operationId":"storyline_funnel_storylines__storyline_id__funnel_get","parameters":[{"name":"storyline_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Storyline Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FunnelOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/storylines/{storyline_id}/enrollments/migrate":{"post":{"tags":["storylines"],"summary":"Migrate Enrollments","description":"批量处置在途学员（细则 5）：move 迁到指定节点 / reset 打回入口 / abandon 作废。\n\nreset/abandon 会丢学员进度——UI 侧强制二次确认；此处只执行。跨用户，靠 storyline_id 归属校验隔离。","operationId":"migrate_enrollments_storylines__storyline_id__enrollments_migrate_post","parameters":[{"name":"storyline_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Storyline Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MigrateIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Migrate Enrollments Storylines  Storyline Id  Enrollments Migrate Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/storyline/callback":{"post":{"tags":["storylines"],"summary":"Storyline Callback","description":"第三方（教学评测 / 嵌入小游戏）回传结构化反馈。带外到达，故自建会话 + set_rls_context。","operationId":"storyline_callback_storyline_callback_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallbackIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Storyline Callback Storyline Callback Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/knowledge-bases":{"get":{"tags":["knowledge-bases"],"summary":"List Tenant Kbs","operationId":"list_tenant_kbs_knowledge_bases_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/KbOut"},"type":"array","title":"Response List Tenant Kbs Knowledge Bases Get"}}}}}}},"/knowledge-bases/{name}":{"get":{"tags":["knowledge-bases"],"summary":"Get Tenant Kb","operationId":"get_tenant_kb_knowledge_bases__name__get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["knowledge-bases"],"summary":"Create Kb","operationId":"create_kb_knowledge_bases__name__post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbIn"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["knowledge-bases"],"summary":"Update Kb","operationId":"update_kb_knowledge_bases__name__put","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["knowledge-bases"],"summary":"Patch Kb","description":"局部更新。之前只有全量 PUT，逼得每个调用方（含我们自己的 MCP update_knowledge_base）\n各自 GET+合并——合并白名单一旦落后于字段演化，就会把没读到的字段静默重置。404 而不是创建。","operationId":"patch_kb_knowledge_bases__name__patch","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbPatch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["knowledge-bases"],"summary":"Remove Kb","operationId":"remove_kb_knowledge_bases__name__delete","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/knowledge-bases/{name}/documents/inspect":{"post":{"tags":["knowledge-bases"],"summary":"Inspect Upload","description":"**预检**：这个文件里有什么、能不能导。不写任何东西。\n\n存在的理由是交互顺序：拖上来就直接开导，等于让人在**还不知道包里是什么**的时候做决定\n——里面 5000 份还是 5 份、是不是加密的、有没有一半是图片，都得等导完才知道。而\n\"整份保留不切块\"这种选项更是只有看到内容之后才答得上来。\n\n只读中央目录，不解压（见 archive.inspect），所以几千份的包也是毫秒级。","operationId":"inspect_upload_knowledge_bases__name__documents_inspect_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_inspect_upload_knowledge_bases__name__documents_inspect_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Inspect Upload Knowledge Bases  Name  Documents Inspect Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/knowledge-bases/{name}/purge":{"post":{"tags":["knowledge-bases"],"summary":"Purge Kb","description":"清空这个知识库的全部文档（保留知识库本身）。**不可逆**。\n\n留着知识库、只清内容：删库会让挂着它的每个 Agent 当场少一个知识源，而\"重导一遍资料\"\n不该付这个代价——重建同名库要重新挂载、重设阈值，中间那段时间线上是缺料的。","operationId":"purge_kb_knowledge_bases__name__purge_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbPurgeIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Purge Kb Knowledge Bases  Name  Purge Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/knowledge-bases/{name}/documents":{"get":{"tags":["knowledge-bases"],"summary":"List Documents","operationId":"list_documents_knowledge_bases__name__documents_get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}},{"name":"tag","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tag"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/KbDocOut"},"title":"Response List Documents Knowledge Bases  Name  Documents Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["knowledge-bases"],"summary":"Add Text Document","operationId":"add_text_document_knowledge_bases__name__documents_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbTextIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbIngestOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/knowledge-bases/{name}/documents/upload":{"post":{"tags":["knowledge-bases"],"summary":"Upload Kb Document","description":"上传文件入库：txt/md/html/pdf/docx。切片/嵌入**同步**完成（与用户级的后台入库不同）。\n\n租户 KB 是管理员低频的运维动作，不是终端用户的交互路径——同步返回真实块数比\"先返回再后台跑\"\n对管理员更有用（传完就知道成没成，不必再刷新看状态）。","operationId":"upload_kb_document_knowledge_bases__name__documents_upload_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_kb_document_knowledge_bases__name__documents_upload_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbIngestOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/knowledge-bases/{name}/documents/upload/stream":{"post":{"tags":["knowledge-bases"],"summary":"Upload Kb Archive Stream","description":"同上，但**逐份汇报进度**（SSE）。给大压缩包用。\n\n非流式那条在几百份文件上就已经难受，几千份上是不可用：一个 HTTP 请求要挂几十分钟，\n网关、浏览器、MCP 客户端会先后超时，而调用方在此期间**拿不到任何东西**——连\"还活着\"\n都不知道。改成边导边报之后，超时问题自己消失（连接一直有数据），而 MCP 那边能说\n\"已导入 1200/5154\"，网站能画进度条。\n\n事件：`start{total}` → `progress{done,total,file,chunks}`×N → `done{...}` 或 `error{detail}`。\n**每份仍然逐份 commit**（与非流式一致）：断线时已经导进去的就是导进去了，钱没白花。","operationId":"upload_kb_archive_stream_knowledge_bases__name__documents_upload_stream_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_kb_archive_stream_knowledge_bases__name__documents_upload_stream_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/knowledge-bases/{name}/documents/{doc_id}/tags":{"patch":{"tags":["knowledge-bases"],"summary":"Set Kb Document Tags","description":"改 KB 文档的标签（整组替换；normalize 见 app/tags）。","operationId":"set_kb_document_tags_knowledge_bases__name__documents__doc_id__tags_patch","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}},{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbTagsIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbDocOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/knowledge-bases/{name}/documents/{doc_id}":{"delete":{"tags":["knowledge-bases"],"summary":"Remove Kb Document","operationId":"remove_kb_document_knowledge_bases__name__documents__doc_id__delete","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}},{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/knowledge-bases/{name}/search":{"post":{"tags":["knowledge-bases"],"summary":"Search Kb","description":"按该 KB 检索（管理员自测用：验证阈值与切片是否合理）。走与对话完全相同的检索路径。","operationId":"search_kb_knowledge_bases__name__search_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbSearchIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/KbSearchHit"},"title":"Response Search Kb Knowledge Bases  Name  Search Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/knowledge-bases/{name}/documents/{doc_id}/chunks":{"get":{"tags":["knowledge-bases"],"summary":"List Document Chunks","description":"某文档的全部切片原文（控制台预览用：肉眼检查导入/切片质量）。\n\nkb_chunks 没有序号列，且同一文档的切片在一个事务里插入（created_at 相同），\n故按 (created_at, id) 排——顺序确定但不保证等于原文顺序；预览场景够用。","operationId":"list_document_chunks_knowledge_bases__name__documents__doc_id__chunks_get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}},{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/KbChunkOut"},"title":"Response List Document Chunks Knowledge Bases  Name  Documents  Doc Id  Chunks Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/knowledge-bases/{name}/chunks/{chunk_id}":{"get":{"tags":["knowledge-bases"],"summary":"Get Kb Chunk","description":"单个切片的全文。知识图谱节点只带 120 字预览（payload 考虑，见 app/viz/graph.py），\n点开\"查看全文\"时按需取这一条。","operationId":"get_kb_chunk_knowledge_bases__name__chunks__chunk_id__get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}},{"name":"chunk_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Chunk Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbChunkOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["knowledge-bases"],"summary":"Edit Kb Chunk","description":"改一片的正文或检索助记。**改完立刻重嵌入。**\n\n重嵌入不是可选的收尾，是这个端点的一半。向量代表的是**写它的时候那段文字**：只改正文\n不重算，这一片就继续按旧文本被召回——屏幕上显示的内容和它为什么会出现在这里，从此是两\n件事，而且没有任何信号。一片说\"UDI 不适用\"的文字，靠着旧向量继续在问 UDI 时排第一。\n\n重嵌入用的输入必须和入库那条路**逐字同构**（`build_embedding_input(title, content,\nindex_text)`，见 app/knowledge/store.py）：换一种拼法就等于把这一片放进了另一个坐标系，\n它和同库其它八千片的距离全部失真——而失真是均匀的，看不出来。\n\n**改动活不过一次重导**，这是明确的取舍（见迁移 0102）：purge 之后这些是新行新 uuid。\n`edited_at` 只保证丢之前有人被告知。","operationId":"edit_kb_chunk_knowledge_bases__name__chunks__chunk_id__patch","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}},{"name":"chunk_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Chunk Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbChunkPatchIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbChunkOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/knowledge-bases/{name}/chunks/search":{"post":{"tags":["knowledge-bases"],"summary":"Search Kb Chunks","description":"按 id / 来源 / 正文找切片。**这是定位，不是检索**——不碰向量，一个 token 都不花。\n\n与 `/search` 的分工：那一个问\"哪几片和这个问题相关\"（语义，要嵌入），这一个问\"我要改的\n那一片在哪\"（字面）。用语义检索去找一片你已经看见过的内容，是在用概率做一件确定的事。","operationId":"search_kb_chunks_knowledge_bases__name__chunks_search_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbChunkSearchIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/KbChunkOut"},"title":"Response Search Kb Chunks Knowledge Bases  Name  Chunks Search Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/knowledge-bases/{name}/index/build":{"post":{"tags":["knowledge-bases"],"summary":"Build Kb Index","description":"给这个知识库建（或重建）结构化索引。返回一份**给人看的**报告。\n\n报告里最要紧的不是\"建了几列\"，是 `dropped`——哪一列因为什么被丢掉了。少了一列这件事\n在查询结果里看不出来（模型会绕开它），只有这份报告会说。","operationId":"build_kb_index_knowledge_bases__name__index_build_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/KbIndexBuildIn"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Build Kb Index Knowledge Bases  Name  Index Build Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/knowledge-bases/{name}/index":{"get":{"tags":["knowledge-bases"],"summary":"Get Kb Index","description":"结构化索引的画像：每列的覆盖率、类型、数值范围、类别 top 值、以及**告警**。\n\n告警是这个端点的主要价值。在真实语料上它当场顶出三条数据质量问题——1,058 本页数为 0、\n505 本阅读等级为 0、493 本字数为 0。那不是零，是缺失被写成了 0，而它会污染每一个\n数值过滤与聚合，且不报错。","operationId":"get_kb_index_knowledge_bases__name__index_get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Kb Index Knowledge Bases  Name  Index Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/knowledge-bases/{name}/index/schema":{"post":{"tags":["knowledge-bases"],"summary":"Patch Kb Index Schema","description":"按一句自然语言改 schema。\n\n模型只被允许输出 add/modify/remove/refused 四段，**重写整表这条路根本不开放给它**——\n所以它没有机会弄坏用户没提到的列。这不是靠提示词约束，是靠这里没有那个入口。\n\n`apply=false` 时只回补丁与警告，不落库：攒批的意义是让人一次看完再决定。","operationId":"patch_kb_index_schema_knowledge_bases__name__index_schema_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbIndexPatchIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Patch Kb Index Schema Knowledge Bases  Name  Index Schema Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/images":{"post":{"tags":["catalog"],"summary":"Upload Image","description":"上传一张商品图：存 blob（公开、不加密），返回可直接放进商品的绝对/相对 URL。","operationId":"upload_image_images_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_image_images_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Upload Image Images Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/knowledge-bases/{name}/products":{"get":{"tags":["catalog"],"summary":"Get Products","operationId":"get_products_knowledge_bases__name__products_get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ProductOut"},"title":"Response Get Products Knowledge Bases  Name  Products Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["catalog"],"summary":"Create Product","operationId":"create_product_knowledge_bases__name__products_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/knowledge-bases/{name}/products/{product_id}":{"put":{"tags":["catalog"],"summary":"Update Product","operationId":"update_product_knowledge_bases__name__products__product_id__put","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Product Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProductOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["catalog"],"summary":"Remove Product","operationId":"remove_product_knowledge_bases__name__products__product_id__delete","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}},{"name":"product_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Product Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/knowledge-bases/{name}/products/import":{"post":{"tags":["catalog"],"summary":"Import Feed","description":"从 Google Shopping 风格的 Feed 批量导入/更新商品（按 external_id 去重）。文件或 URL 二选一。","operationId":"import_feed_knowledge_bases__name__products_import_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_import_feed_knowledge_bases__name__products_import_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Import Feed Knowledge Bases  Name  Products Import Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/sessions/{sid}/attachments":{"get":{"tags":["case-attachments"],"summary":"Session Attachments","description":"某会话里访客上传的附件（时序，仅元信息；内容经 /manage/attachments/{id} 取回）。","operationId":"session_attachments_manage_sessions__sid__attachments_get","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AttachmentOut"},"title":"Response Session Attachments Manage Sessions  Sid  Attachments Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/attachments/{aid}":{"get":{"tags":["case-attachments"],"summary":"Attachment Blob","description":"解密并回传一个附件原文件（图片/PDF），按 (session→user→tenant) 归属校验。","operationId":"attachment_blob_manage_attachments__aid__get","parameters":[{"name":"aid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Aid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/console/login":{"post":{"tags":["console"],"summary":"Login","description":"用户名+密码 → 控制台会话令牌。\n\n失败**不区分**\"用户不存在\"与\"密码错\"——否则等于白送一个用户名枚举接口。\n\n**限流按 (来源IP, 账号) + 来源IP 两个维度**，刻意不按账号单独计：那会变成\n\"任何知道 ADMIN_USER 的人都能把你永久锁在控制台外面\"的 DoS。见 app/auth/ratelimit。","operationId":"login_console_login_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__console_auth__LoginIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/console/me":{"get":{"tags":["console"],"summary":"Me","description":"回显当前控制台会话（前端启动时验令牌是否还有效）。","operationId":"me_console_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeOut"}}}}}}},"/console/change-password":{"post":{"tags":["console"],"summary":"Change Password","description":"租户账号自助改密码。**必须给对旧密码**——否则一个被顺手拿到的令牌就能改掉密码、\n把真正的主人锁在外面。（管理员的越权重置在 /admin/tenants/{tid}/accounts/{aid}/password。）\n\n平台管理员改不了：ADMIN_USER/ADMIN_PASS 来自 .env，**数据库里没有那一行**，\n改密码得去改 .env 再重启。","operationId":"change_password_console_change_password_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangePasswordIn"}}},"required":true},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/console/prefs":{"get":{"tags":["console"],"summary":"Get Prefs","operationId":"get_prefs_console_prefs_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrefsOut"}}}}}},"put":{"tags":["console"],"summary":"Put Prefs","description":"**合并**式更新（不是整体替换）：前端只发改动的那几个键。\n\n整体替换会让两个标签页互相覆盖——A 页改了排序、B 页改了 tab，后提交的把先提交的抹掉。","operationId":"put_prefs_console_prefs_put","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Patch"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrefsOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/console/oidc/start":{"get":{"tags":["console"],"summary":"Oidc Start","description":"把管理员送去 agent4.io 授权。未配置 SSO 时明确 404，而不是静默跳到一个坏地址。","operationId":"oidc_start_console_oidc_start_get","parameters":[{"name":"redirect","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Redirect"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/console/oidc/callback":{"get":{"tags":["console"],"summary":"Oidc Callback","description":"授权回调：换令牌 → 认账号 → 发控制台令牌。\n\n令牌经 URL fragment 交给前端（`#console_token=…`）。fragment 不会被浏览器发往服务端，\n因此不会落进 Referer 或反代访问日志——查询串会，这正是不用查询串的原因。","operationId":"oidc_callback_console_oidc_callback_get","parameters":[{"name":"code","in":"query","required":false,"schema":{"type":"string","default":"","title":"Code"}},{"name":"state","in":"query","required":false,"schema":{"type":"string","default":"","title":"State"}},{"name":"error","in":"query","required":false,"schema":{"type":"string","default":"","title":"Error"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/integration/install.sh":{"get":{"tags":["integration"],"summary":"Install Sh","description":"One command to add the MCP server and install every skill module (and to update them).","operationId":"install_sh_integration_install_sh_get","responses":{"200":{"description":"Successful Response","content":{"text/plain":{"schema":{"type":"string"}}}}}}},"/integration/manifest.json":{"get":{"tags":["integration"],"summary":"Manifest","description":"Module metadata for update detection — no markdown. `sha256`/`version` change when the\nupstream Cookbook changes, so a client can tell it holds an old copy.","operationId":"manifest_integration_manifest_json_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/integration/skills/{name}/SKILL.md":{"get":{"tags":["integration"],"summary":"Skill Module","description":"A single skill module's SKILL.md, mirrored from the website Cookbook.","operationId":"skill_module_integration_skills__name__SKILL_md_get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"text/plain":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/integration/commands.json":{"get":{"tags":["integration"],"summary":"Commands Manifest","description":"Slash commands available to install (name + description). Bodies are fetched per-command below.","operationId":"commands_manifest_integration_commands_json_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/integration/commands/{name}":{"get":{"tags":["integration"],"summary":"Command File","description":"A single slash-command body (Markdown), to drop into an agent's commands directory.","operationId":"command_file_integration_commands__name__get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"text/plain":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/integration/SKILL.md":{"get":{"tags":["integration"],"summary":"Skill Doc","description":"Back-compat single-file guide: the module index followed by every module, as one document.\nPreferred path is the one-command installer (`install.sh`) which lays down the modules separately.","operationId":"skill_doc_integration_SKILL_md_get","responses":{"200":{"description":"Successful Response","content":{"text/plain":{"schema":{"type":"string"}}}}}}},"/agent-templates":{"get":{"tags":["templates"],"summary":"List Agent Templates","operationId":"list_agent_templates_agent_templates_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"type":"string"},"type":"array","title":"Response List Agent Templates Agent Templates Get"}}}}}}},"/agent-templates/{name}":{"get":{"tags":["templates"],"summary":"Get Agent Template","operationId":"get_agent_template_agent_templates__name__get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tools":{"get":{"tags":["tools"],"summary":"List Available Tools","description":"返回可勾选工具（名字 + 简要说明），供白名单列表渲染。","operationId":"list_available_tools_tools_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response List Available Tools Tools Get"}}}}}}},"/mcp-servers/{sid}/reveal":{"get":{"tags":["mcp-servers"],"summary":"Reveal Config","description":"返回该 MCP server 的**未遮罩**连接配置（含明文机密），供管理员调试。记审计。","operationId":"reveal_config_mcp_servers__sid__reveal_get","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevealOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/mcp-servers":{"get":{"tags":["mcp-servers"],"summary":"List Servers","operationId":"list_servers_mcp_servers_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/McpServerOut"},"type":"array","title":"Response List Servers Mcp Servers Get"}}}}}},"post":{"tags":["mcp-servers"],"summary":"Create Server","operationId":"create_server_mcp_servers_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/McpServerIn"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/McpServerOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/mcp-servers/{sid}":{"patch":{"tags":["mcp-servers"],"summary":"Update Server","operationId":"update_server_mcp_servers__sid__patch","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/McpServerPatch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/McpServerOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["mcp-servers"],"summary":"Delete Server","operationId":"delete_server_mcp_servers__sid__delete","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/mcp-servers/test-config":{"post":{"tags":["mcp-servers"],"summary":"Test Config","description":"保存前先探测：用给定 transport+config **连一次但不落库**，返回连接状态/发现的工具/错误。\n前端据此在连接成功后才允许保存。仅远程传输（同创建策略）。","operationId":"test_config_mcp_servers_test_config_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestConfigIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/McpServerOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/mcp-servers/{sid}/test":{"post":{"tags":["mcp-servers"],"summary":"Test Server","description":"临时连接一次，发现工具并把状态/工具列表/错误缓存进库（供 UI 展示）。","operationId":"test_server_mcp_servers__sid__test_post","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/McpServerOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/mcp-servers/{sid}/probe":{"post":{"tags":["mcp-servers"],"summary":"Probe Server","description":"端到端\"试调用\"：给 AI 一句指令 + 只暴露本 server 的工具，看它是否发出正确的 tool_call。\n\n与 `/test`（连接+列工具，无 LLM）互补——这里验证 **AI 是否真的理解如何调用这个 MCP**。\n`execute=True` 则真执行工具拿到返回；否则只看意图（干跑，无副作用）。","operationId":"probe_server_mcp_servers__sid__probe_post","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__mcp_servers__ProbeIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProbeOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/users":{"get":{"tags":["manage","manage"],"summary":"List Users","operationId":"list_users_manage_users_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}},{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Q"}},{"name":"sort","in":"query","required":false,"schema":{"type":"string","default":"recent","title":"Sort"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserPage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/users/{uid}":{"get":{"tags":["manage","manage"],"summary":"Get User","operationId":"get_user_manage_users__uid__get","parameters":[{"name":"uid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Uid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserDetailOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["manage","manage"],"summary":"Delete User","description":"删除用户及其全部数据（加密销毁：级联删 UserKeys/空间/文档/会话/记忆/附件）。","operationId":"delete_user_manage_users__uid__delete","parameters":[{"name":"uid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Uid"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/users/{uid}/usage":{"get":{"tags":["manage","manage"],"summary":"User Usage","description":"该用户的 token 用量时间序列（供图表）。hours>0 按小时分桶（近 N 小时），否则按天。空桶补 0。","operationId":"user_usage_manage_users__uid__usage_get","parameters":[{"name":"uid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Uid"}},{"name":"hours","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Hours"}},{"name":"days","in":"query","required":false,"schema":{"type":"integer","default":30,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserUsageOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/users/{uid}/password":{"post":{"tags":["manage","manage"],"summary":"Admin Reset Password","description":"管理员/客服重置某邮箱密码用户的密码（见 docs/18）。非邮箱账号 → 404。","operationId":"admin_reset_password_manage_users__uid__password_post","parameters":[{"name":"uid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Uid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PasswordIn"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/end-user-token":{"post":{"tags":["manage","manage"],"summary":"Mint End User Token","description":"为集成方的某个用户换一个终端用户令牌（proxy 模式的单点登录握手）。\n\n`auth_mode=proxy` 的租户在平台上没有原生登录——身份由集成方提供。此前这条路只在\n**请求头**（X-End-User）里走得通，也就是只有服务端对服务端的调用能用；浏览器落在\n`/t/{alias}` 上时无从获得身份，那个页面因此是**无法登录**的。\n\n有了这个接口，集成方在自己站点确认用户身份后，用租户 API Key 换一个令牌交给浏览器，\n握手就闭合了。\n\n**只对 proxy / both 开放**：platform 模式的租户有自己的登录，再开一条「凭 API Key 就能\n冒充任意终端用户」的路没有必要，只是白白扩大攻击面。\n\n调用方必须在**服务端**持有 API Key。把它放到浏览器里，等于任何人都能签发任意身份。","operationId":"mint_end_user_token_manage_end_user_token_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EndUserTokenIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EndUserTokenOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/users/{uid}/spaces":{"post":{"tags":["manage","manage"],"summary":"Create Space","operationId":"create_space_manage_users__uid__spaces_post","parameters":[{"name":"uid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Uid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpaceIn"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpaceOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/spaces/{sid}":{"patch":{"tags":["manage","manage"],"summary":"Rename Space","operationId":"rename_space_manage_spaces__sid__patch","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpaceIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpaceOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["manage","manage"],"summary":"Delete Space","description":"删除空间及其全部知识与会话（级联）。默认空间不可删除。","operationId":"delete_space_manage_spaces__sid__delete","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/spaces/{sid}/agents":{"get":{"tags":["manage","manage"],"summary":"List Space Members","operationId":"list_space_members_manage_spaces__sid__agents_get","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"string"},"title":"Response List Space Members Manage Spaces  Sid  Agents Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["manage","manage"],"summary":"Add Space Member","operationId":"add_space_member_manage_spaces__sid__agents_post","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpaceAgentIn"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"string"},"title":"Response Add Space Member Manage Spaces  Sid  Agents Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/spaces/{sid}/agents/{name}":{"delete":{"tags":["manage","manage"],"summary":"Remove Space Member","operationId":"remove_space_member_manage_spaces__sid__agents__name__delete","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}},{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/spaces/{sid}/documents":{"get":{"tags":["manage","manage"],"summary":"List Space Documents","operationId":"list_space_documents_manage_spaces__sid__documents_get","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentPage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/spaces/{sid}/sessions":{"get":{"tags":["manage","manage"],"summary":"List Space Sessions","operationId":"list_space_sessions_manage_spaces__sid__sessions_get","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionPage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/spaces/{sid}/memories":{"get":{"tags":["manage","manage"],"summary":"List Space Memories","description":"该空间从会话中派生出的长期记忆（事实/主题/整轮），供管理员查看与治理。按重要性+最近性排序。","operationId":"list_space_memories_manage_spaces__sid__memories_get","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MemoryOut"},"title":"Response List Space Memories Manage Spaces  Sid  Memories Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/memories/{mid}":{"delete":{"tags":["manage","manage"],"summary":"Delete Memory","description":"删除一条派生记忆（治理：清掉不该记的信息）。校验其归属空间属于本租户。","operationId":"delete_memory_manage_memories__mid__delete","parameters":[{"name":"mid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Mid"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/spaces/{sid}/profiles":{"get":{"tags":["manage","manage"],"summary":"List Space Profiles","description":"该空间下各 Agent 对该用户的画像（跨会话人格层），供管理员查看/治理。按更新时间倒序。","operationId":"list_space_profiles_manage_spaces__sid__profiles_get","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ProfileOut"},"title":"Response List Space Profiles Manage Spaces  Sid  Profiles Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/profiles/{pid}":{"put":{"tags":["manage","manage"],"summary":"Update Profile","description":"人工修改画像正文（重新加密入库）。下一轮对话仍可能被自动刷新覆盖。","operationId":"update_profile_manage_profiles__pid__put","parameters":[{"name":"pid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Pid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfileIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfileOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["manage","manage"],"summary":"Delete Profile","description":"删除画像（清空重置：下一轮对话累计到阈值后会重新生成）。","operationId":"delete_profile_manage_profiles__pid__delete","parameters":[{"name":"pid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Pid"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/users/{uid}/documents":{"get":{"tags":["manage","manage"],"summary":"List User Documents","operationId":"list_user_documents_manage_users__uid__documents_get","parameters":[{"name":"uid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Uid"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentPage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/documents/{doc_id}":{"delete":{"tags":["manage","manage"],"summary":"Delete Document","operationId":"delete_document_manage_documents__doc_id__delete","parameters":[{"name":"doc_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Doc Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/users/{uid}/sessions":{"get":{"tags":["manage","manage"],"summary":"List User Sessions","operationId":"list_user_sessions_manage_users__uid__sessions_get","parameters":[{"name":"uid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Uid"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionPage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/agents/{name}/sessions":{"get":{"tags":["manage","manage"],"summary":"List Agent Sessions","description":"某智能体在本租户内的会话时间线（跨用户/跨空间，按 created_at 降序）。\n\n把智能体当作「一个人」：看它和各用户在各空间的过往会话。仅会话元数据、不解密内容，\n故不设隐私门禁；读具体消息仍走 /sessions/{sid}/messages（受隐私门禁）。\n归属：join users.tenant_id 限定本租户。会话的 agent 归属为首轮智能体（见 chat.service）。","operationId":"list_agent_sessions_manage_agents__name__sessions_get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":30,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentSessionPage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/sessions/{sid}/messages":{"get":{"tags":["manage","manage"],"summary":"Get Session Messages","description":"按 (created_at,id) 降序分页（最新在前）；前端反转成时序、往上「加载更早」。","operationId":"get_session_messages_manage_sessions__sid__messages_get","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":40,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessagePage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/scheduled-tasks":{"get":{"tags":["manage","manage"],"summary":"List Scheduled Tasks","description":"本租户的计划/跟进任务（按创建时间倒序）。instruction 尝试解密；隐私模式或失败则为 None。","operationId":"list_scheduled_tasks_manage_scheduled_tasks_get","parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduledTaskPage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/scheduled-tasks/{task_id}/cancel":{"post":{"tags":["manage","manage"],"summary":"Cancel Scheduled Task","description":"取消一条待执行（pending）任务；非 pending 返回 409。","operationId":"cancel_scheduled_task_manage_scheduled_tasks__task_id__cancel_post","parameters":[{"name":"task_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Task Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduledTaskOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/usage":{"get":{"tags":["manage","manage"],"summary":"Usage Summary","description":"本租户 token 用量汇总:总量 + 按维度(agent/user/space/hour/day/week/model/kind)分组。\n\n`since` 给一个时间窗口(ISO 8601):最近 24 小时配 `group=hour`、最近若干天配\n`group=day`、更长区间配 `group=week`——窗口由调用方算好传进来,这里只做过滤+分桶。\n不传 `since` 时统计全部历史(向后兼容原有 group=agent 等调用)。\n\n用量是纯元数据(仅 token 数),隐私模式租户也照常计量(见 docs/18)。","operationId":"usage_summary_manage_usage_get","parameters":[{"name":"group","in":"query","required":false,"schema":{"type":"string","default":"total","title":"Group"}},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Since"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/agent-stats":{"get":{"tags":["manage","manage"],"summary":"Agent Stats","description":"每个 agent 被用了多少：会话数、不同的人数、最后一次有人跟它说话是什么时候。\n\n`/usage?group=agent` 回答的是\"花了多少 token\"，那是成本；这里回答的是\"有多少人在用\"，\n那是价值。两个数字都拿得到才谈得上判断一个 agent 值不值得留着。\n\n**纯计数，不碰内容。** 会话标题和正文都是加密的，这里一个都没读——只数行、数不同的\nuser_id、取最大时间戳。所以 privacy_mode 的租户同样能看到（那个开关挡的是读取内容，\n不是知道自己有没有被用）。","operationId":"agent_stats_manage_agent_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentStatsOut"}}}}}}},"/manage/users/{uid}/knowledge-graph":{"get":{"tags":["manage","manage"],"summary":"User Knowledge Graph","description":"用户记忆 / 知识库切片的 3D 投影。\n\n父节点：memories 用 **session**（NOT NULL、100% 覆盖），chunks 用 **document**。\n刻意不用 `message_id`——实测 246 条里仅 15 条有值，绝大多数会连不上父。","operationId":"user_knowledge_graph_manage_users__uid__knowledge_graph_get","parameters":[{"name":"uid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Uid"}},{"name":"source","in":"query","required":false,"schema":{"type":"string","pattern":"^(memories|chunks)$","default":"memories","title":"Source"}},{"name":"space_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Space Id"}},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":100000,"minimum":1},{"type":"null"}],"title":"Limit"}},{"name":"refresh","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Refresh"}},{"name":"q","in":"query","required":false,"schema":{"type":"string","maxLength":200,"default":"","title":"Q"}},{"name":"stream","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Stream"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response User Knowledge Graph Manage Users  Uid  Knowledge Graph Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/users/{uid}/knowledge-graph/items/{item_id}":{"get":{"tags":["manage","manage"],"summary":"User Graph Item","description":"图谱数据节点的**全文**。节点 payload 只带 120 字预览（见 app/viz/graph.py），\n点\"查看全文\"按需取这一条。门禁与图谱端点完全一致：隐私模式 403 + 归属校验 + 按用户 DEK 解密。","operationId":"user_graph_item_manage_users__uid__knowledge_graph_items__item_id__get","parameters":[{"name":"uid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Uid"}},{"name":"item_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Item Id"}},{"name":"source","in":"query","required":false,"schema":{"type":"string","pattern":"^(memories|chunks)$","default":"memories","title":"Source"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response User Graph Item Manage Users  Uid  Knowledge Graph Items  Item Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/knowledge-bases/{name}/graph":{"get":{"tags":["manage","manage"],"summary":"Kb Graph","description":"租户级知识库切片的 3D 投影。父节点 = 文档。\n\n不走 `readable_tenant`：租户 KB 是**不加密的公用知识**，与隐私模式（保护的是终端用户内容）无关。\n\n`q` 给定时是**聚焦**而非抽样：把 q 向量化，取语义上最近的 `limit` 条来画。两件事一起解决——\n大知识库降到画得动的量，而且降下来的这批是**围着一个主题的**，比均匀抽样有意义得多。","operationId":"kb_graph_manage_knowledge_bases__name__graph_get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":100000,"minimum":1},{"type":"null"}],"title":"Limit"}},{"name":"refresh","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Refresh"}},{"name":"q","in":"query","required":false,"schema":{"type":"string","maxLength":200,"default":"","title":"Q"}},{"name":"stream","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Stream"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Kb Graph Manage Knowledge Bases  Name  Graph Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/page-contexts":{"get":{"tags":["manage","manage"],"summary":"List Page Contexts","operationId":"list_page_contexts_manage_page_contexts_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/PageContextOut"},"type":"array","title":"Response List Page Contexts Manage Page Contexts Get"}}}}}}},"/manage/page-contexts/{key}":{"put":{"tags":["manage","manage"],"summary":"Upsert Page Context","operationId":"upsert_page_context_manage_page_contexts__key__put","parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string","title":"Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageContextIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageContextOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["manage","manage"],"summary":"Delete Page Context","operationId":"delete_page_context_manage_page_contexts__key__delete","parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string","title":"Key"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/page-context-templates":{"get":{"tags":["manage","manage"],"summary":"List Playbook Templates","description":"页面类型的提问原型，供「新建剧本」时预填骨架。\n\n按**页面类型**而非行业分类是刻意的：剧本绑的是具体站点的具体页面，跨租户不可移植；\n可复用的是「访客在这类页面上会问什么」。行业差异由 Agent 的 soul/task 承担。","operationId":"list_playbook_templates_manage_page_context_templates_get","parameters":[{"name":"lang","in":"query","required":false,"schema":{"type":"string","default":"zh","title":"Lang"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PlaybookTemplate"},"title":"Response List Playbook Templates Manage Page Context Templates Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/page-context-stats":{"get":{"tags":["manage","manage"],"summary":"Playbook Stats","description":"哪条剧本被打开过、哪个推荐问题被点。没有这个，文案就只能靠猜着改。","operationId":"playbook_stats_manage_page_context_stats_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","default":30,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PlaybookStat"},"title":"Response Playbook Stats Manage Page Context Stats Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/page-contexts/resolve":{"get":{"tags":["manage","manage"],"summary":"Resolve Page Context","description":"贴一个网址（或 key），回答它会命中哪条剧本。管理界面的匹配测试器用。","operationId":"resolve_page_context_manage_page_contexts_resolve_get","parameters":[{"name":"url","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"}},{"name":"key","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResolveOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/knowledge-bases/{name}/crawl":{"post":{"tags":["manage","crawl"],"summary":"Start Crawl","description":"启动抓取。**这一步不消耗 token**——只发现页面并取回正文。","operationId":"start_crawl_manage_knowledge_bases__name__crawl_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrawlIn"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrawlOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/crawl":{"get":{"tags":["manage","crawl"],"summary":"Current Crawl","description":"当前任务；没有进行中的就返回最近一个已结束的（界面据此显示上次结果）。","operationId":"current_crawl_manage_crawl_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/CrawlOut"},{"type":"null"}],"title":"Response Current Crawl Manage Crawl Get"}}}}}}},"/manage/crawl/{job_id}/pages":{"get":{"tags":["manage","crawl"],"summary":"Crawl Pages","operationId":"crawl_pages_manage_crawl__job_id__pages_get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PageOut"},"title":"Response Crawl Pages Manage Crawl  Job Id  Pages Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/crawl/{job_id}/confirm":{"post":{"tags":["manage","crawl"],"summary":"Confirm Crawl","description":"确认后开始向量化。**这一步消耗 token**，用户是在看到确切字数之后才走到这里的。","operationId":"confirm_crawl_manage_crawl__job_id__confirm_post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrawlOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/crawl/{job_id}/cancel":{"post":{"tags":["manage","crawl"],"summary":"Cancel Crawl","description":"终止任务。\n\n**已经写进知识库的文档保留**——它们已经花过 token 了，删掉等于让用户白付一次。","operationId":"cancel_crawl_manage_crawl__job_id__cancel_post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrawlOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/reviews":{"get":{"tags":["manage"],"summary":"List Reviews","operationId":"list_reviews_manage_reviews_get","parameters":[{"name":"status","in":"query","required":false,"schema":{"type":"string","default":"pending","title":"Status"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ReviewOut"},"title":"Response List Reviews Manage Reviews Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/reviews/{rid}/draft":{"post":{"tags":["manage"],"summary":"Draft Review Entry","description":"按问题 + 当轮材料**重写**一条无上下文的条目，交给审核员改与确认。\n\n**为什么不直接收那段回答**：它是对着一个人说的。线上第一条就是\n「Anna, based on the most recent week…, our Regulatory Intelligence tool monitors 120+\nmarkets」——里面同时带着另一位访客的名字、只在当时成立的指代（\"这一周\"、\"你的产品线\"），\n以及一段销售话术。逐字入库，等于把一个人的私人语境变成对所有人的答案。\n\n**为什么是按需生成、不在落队列时生成**：待审条目里被通过的是少数，而每条都改写一遍就是\n每条都要一次模型调用。审核员点开哪一条，才为哪一条花这次调用。","operationId":"draft_review_entry_manage_reviews__rid__draft_post","parameters":[{"name":"rid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Rid"}},{"name":"lang","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/reviews/{rid}/approve":{"post":{"tags":["manage"],"summary":"Approve Review","operationId":"approve_review_manage_reviews__rid__approve_post","parameters":[{"name":"rid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Rid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApproveIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/reviews/{rid}/reject":{"post":{"tags":["manage"],"summary":"Reject Review","description":"驳回。**留档，不删除**——同一个问题下个月还会有人问，而\"这条我们看过、不采纳\"本身就是\n要保留的判断；删掉之后下一个审核员会把同样的东西再审一遍。","operationId":"reject_review_manage_reviews__rid__reject_post","parameters":[{"name":"rid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Rid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/gaps":{"get":{"tags":["manage"],"summary":"List Gaps","description":"按**被问过多少次**排序，不按时间。一个问了 40 次的缺口值得先补。","operationId":"list_gaps_manage_gaps_get","parameters":[{"name":"unread","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Unread"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/GapOut"},"title":"Response List Gaps Manage Gaps Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/gaps/read":{"post":{"tags":["manage"],"summary":"Mark Gaps Read","description":"标记已读。**按问题标，不是按行**——同一个问题可能有几十条记录，人看的是问题。","operationId":"mark_gaps_read_manage_gaps_read_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GapReadIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Mark Gaps Read Manage Gaps Read Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/gaps.csv":{"get":{"tags":["manage"],"summary":"Export Gaps","description":"导出。**这份清单的收件人是写文档的人，不是坐在控制台前的人**——所以它必须能离开控制台。\n\nCSV 而不是 JSON：拿到它的人会用表格分工、打勾、加一列\"谁负责\"。","operationId":"export_gaps_manage_gaps_csv_get","parameters":[{"name":"unread","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Unread"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":500,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/writing":{"get":{"tags":["manage","manage"],"summary":"Board","description":"长文写作看板。`user_id` / `space_id` 一给，就是\"**这个人**写的那些\"。\n\n**同一个接口，两种用法**（同 `manage/monitors.py`）：全租户的看板，以及用户详情页\n里的那一块。再开一个端点的话，两处的字段迟早会不一样。","operationId":"board_manage_writing_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":100,"title":"Limit"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"User Id"}},{"name":"space_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Space Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Board"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/monitors":{"get":{"tags":["manage","manage"],"summary":"List Monitors","description":"本租户下所有跟踪（按创建时间倒序）。\n\n**计数一次查完，不在循环里逐条问。** 五十行跟踪就是五十次往返，而这三个数\n（源、报告、轮次+token）各自一条 `GROUP BY` 就够。这一页天生是\"看一眼全局\"的地方，\n它慢一点没人会等——但慢的是它自己没必要的往返，那就只是浪费。","operationId":"list_monitors_manage_monitors_get","parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"User Id"}},{"name":"space_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Space Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantMonitorPage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/monitors/{plan_id}/pause":{"post":{"tags":["manage","manage"],"summary":"Pause Monitor","description":"停掉 / 恢复一条跟踪。\n\n**停用不是删除。** 历史报告和攒起来的主张库都留着，恢复之后它接着上一次往下比——\n而删除会把那些一并带走。租户在这一页的正当理由是付费，所以先给他一个**可逆**的动作。\n\n停用把 `next_run_at` 清空：光改状态不清它，调度器那一侧仍会把它当成到点的计划领出来\n（`due_plans` 看的是那一栏），而\"停了还在跑\"是这一页最不该有的结果。","operationId":"pause_monitor_manage_monitors__plan_id__pause_post","parameters":[{"name":"plan_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Plan Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PauseIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantMonitorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/manage/monitors/{plan_id}":{"delete":{"tags":["manage","manage"],"summary":"Delete Monitor","description":"删掉一条跟踪。**不可逆**：报告、主张、留痕都跟着走（外键 CASCADE）。\n\n留一行审计：**删的是别人建的东西**，而这一页的权力来自付费，不是所有权。\n出了争议时\"谁在什么时候删了它\"必须查得到。","operationId":"delete_monitor_manage_monitors__plan_id__delete","parameters":[{"name":"plan_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Plan Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/documents":{"post":{"tags":["rag"],"summary":"Create Document","description":"入库文档：同步建 Document 并返回计划块数；切片/嵌入在后台异步完成（稍后可检索）。","operationId":"create_document_documents_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/documents/upload":{"post":{"tags":["rag"],"summary":"Upload Document","description":"上传文件入库：支持 .txt/.md/.html/.pdf/.docx（按扩展名/MIME 选解析器）。\n\ntitle 缺省用文件名；source 缺省用文件名。单文件大小上限见 `document_max_upload_mb`。\n含图过多时先回 needs_vision_confirm，前端确认后带 confirm_vision=true 重传。","operationId":"upload_document_documents_upload_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_document_documents_upload_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IngestOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/search":{"post":{"tags":["rag"],"summary":"Search Documents","operationId":"search_documents_search_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/SearchHit"},"type":"array","title":"Response Search Documents Search Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/chat":{"post":{"tags":["chat"],"summary":"Chat Endpoint","operationId":"chat_endpoint_chat_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/chat/stop":{"post":{"tags":["chat"],"summary":"Chat Stop Endpoint","description":"访客按下了停止（登录侧的对话页）。同 `/share/.../chat/stop`。\n\n会话归属由 RLS + 显式条件双保险：一个人停不了别人的一轮。","operationId":"chat_stop_endpoint_chat_stop_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__chat__StopIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Chat Stop Endpoint Chat Stop Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/chat/stream":{"post":{"tags":["chat"],"summary":"Chat Stream Endpoint","operationId":"chat_stream_endpoint_chat_stream_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/me/sessions/{sid}/messages/{mid}/regenerate":{"post":{"tags":["chat"],"summary":"Regenerate Endpoint","description":"重生成某条 assistant 回复（删它及其后，据历史重新流式生成）。SSE 明文流。","operationId":"regenerate_endpoint_me_sessions__sid__messages__mid__regenerate_post","parameters":[{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}},{"name":"mid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Mid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}":{"get":{"tags":["share"],"summary":"Share Info","operationId":"share_info_share__token__get","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareInfo"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/documents/upload":{"post":{"tags":["share"],"summary":"Share Upload Document","description":"访客把文档传进**自己的**空间（与网页客户端同一条 RAG 摄取管线）。\n\n**默认关**，租户在分享配置里打开（uploads=true）——把控制权交给租户：有的场景就是需要\n用户提交材料（\"看看我的证件是否有效\"），有的场景开放上传等于请人灌垃圾。\n滥用护栏：`upload_daily_limit`（默认 20/天/用户，租户可调）+ 全局单文件大小上限。","operationId":"share_upload_document_share__token__documents_upload_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_share_upload_document_share__token__documents_upload_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Share Upload Document Share  Token  Documents Upload Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/visitor":{"post":{"tags":["share"],"summary":"Share Mint Visitor","description":"签发一个新的匿名访客身份 + 持有性证明。\n\n取代 widget 自己 `Math.random()` 造 id 的老做法：id 改为密码学随机，且带一个只有服务端\n能生成的签名，这样\"注册后认领这段匿名咨询\"才有据可依。","operationId":"share_mint_visitor_share__token__visitor_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VisitorOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/visitor/state":{"post":{"tags":["share"],"summary":"Share Visitor State","description":"这个访客名下**还没有任何长期记录**（画像/记忆）吗。排障用，挂件据此点一个小点。\n\n**必须在页面加载时就能问到。** 原来它只随每轮 `meta` 下发，于是在最需要它的那一刻\n——刚打开、还没开口——它什么都不显示，而这正是判断\"我这次是不是真的从零开始\"的时刻。\n\n单独一个端点，而不是搭在 `/playbook` 上：那一个没配剧本时会提前返回空，于是这个标记会\n在\"恰好没配剧本\"的租户那里静默消失——一个排障用的信号，最不能有的就是\"有时候不出现\"。","operationId":"share_visitor_state_share__token__visitor_state_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareAuthIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VisitorStateOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/playbook":{"post":{"tags":["share"],"summary":"Share Playbook","description":"访客打开对话框时的开场白与推荐问题（页面剧本，见 docs/40）。\n\n没有匹配到剧本就返回空——挂件照旧显示空白框，不是错误。","operationId":"share_playbook_share__token__playbook_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareAuthIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlaybookOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/playbook/hit":{"post":{"tags":["share"],"summary":"Share Playbook Hit","description":"访客点了某条推荐问题。纯计数，不记谁点的（见 app/models/playbook_event.py）。","operationId":"share_playbook_hit_share__token__playbook_hit_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlaybookHitIn"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/claim":{"post":{"tags":["share"],"summary":"Share Claim","description":"注册后认领注册前的匿名咨询（只结转要点画像，不迁移原始会话）。\n\n见 app/chat/handoff.py 的取舍说明。这里只负责：验两侧身份 → 生成摘要 → 写入目标画像 →\n打一次性锁。","operationId":"share_claim_share__token__claim_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareClaimIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareClaimOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/greeting":{"post":{"tags":["share"],"summary":"Share Greeting","description":"为新会话生成 Agent 主动问候（需 Agent 开启 auto_greeting 且配置了 greeting 提示词）。","operationId":"share_greeting_share__token__greeting_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareAuthIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GreetingOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/attachments/{attachment_id}":{"get":{"tags":["share"],"summary":"Share Download Attachment","description":"凭短时效签名下载导出的文档（见 app/documents/download.py）。\n\n**签名即授权**，这里没有 principal——挂件访客的 proof 在 IM 渠道拿不到，而导出的文档\n要能发到 WhatsApp/Telegram。因此授权由 URL 上的签名承担，不看客户端自报的身份。\n\n附件行用未加作用域的 session 读：此刻还不知道它属于哪个 user/space，无法先建 RLS\n作用域。签名已经限定了**只能取这一个 attachment_id**，越权的前提（改 id）恰恰是签名\n拦住的那件事。解密所用的 user/space 一律取自附件行本身，绝不取自请求。","operationId":"share_download_attachment_share__token__attachments__attachment_id__get","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"attachment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Attachment Id"}},{"name":"exp","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Exp"}},{"name":"sig","in":"query","required":false,"schema":{"type":"string","default":"","title":"Sig"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/chat":{"post":{"tags":["share"],"summary":"Share Chat","operationId":"share_chat_share__token__chat_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareChatIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/chat/stream":{"post":{"tags":["share"],"summary":"Share Chat Stream","operationId":"share_chat_stream_share__token__chat_stream_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareChatIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/stream":{"post":{"tags":["share"],"summary":"Share Stream","description":"分享/嵌入页的**常驻** SSE 推送通道（对应 `/me/stream`，但按分享 token + keyless 身份鉴权）。\n\n服务端主动推送（到点的定时跟进、IM 侧同步过来的对话）由 `app.push.bus` 按 (user, space) 投递；\n`/me/stream` 要求 JWT/API Key，而 widget 的 anonymous / host_session 两种模式拿不出这类凭证，\n故这里用 `_resolve_principal` 从 body 解析身份（三种模式通吃），space 由服务端推导，无需 X-Space-Id。\n\n注意：bus 无订阅者时事件直接丢弃，所以 widget 收起时也要保持本连接（未读角标靠它实时更新）；\n错过的推送由前端用会话列表的 message_count 差值补算。","operationId":"share_stream_share__token__stream_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareAuthIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/chat/stop":{"post":{"tags":["share"],"summary":"Share Chat Stop","description":"访客按下了停止。置位，正在跑的那一轮会在它的检查点上读到。\n\n**为什么要有这个端点**：靠\"客户端断开\"自己发现是不成立的——这套栈上 SSE 客户端离开时\n既不取消任务也不上报 `http.disconnect`（实测断开 15 秒后仍是 False，细节见 chat/stopper.py）。\n\n**必须校验这个会话是不是他的**，否则谁都能停别人的一轮：那是一条便宜的骚扰通道，\n而且症状对被停的人来说完全无法解释。身份走与聊天同一条路（`_resolve_principal`）。","operationId":"share_chat_stop_share__token__chat_stop_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__share_chat__StopIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Share Chat Stop Share  Token  Chat Stop Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/sessions/{sid}/publish":{"post":{"tags":["share"],"summary":"Publish Conversation","description":"把这个会话**截止到此刻**的内容冻结成一条分享链接。\n\n每调用一次就是新的一条，旧链接不受影响：按下分享按钮表达的是\"我愿意公开到此刻为止\"，\n而复用同一条会让上周发出去的链接自己长出新内容（见 conversation_share.publish 的说明）。\n\n解密用的是**会话主人自己**的密钥，在他自己的这个请求里完成——平台封存的是他明确选择要\n公开的那一份，不是替他打开了什么。","operationId":"publish_conversation_share__token__sessions__sid__publish_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishConvIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishConvOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/sessions/{sid}/shares":{"post":{"tags":["share"],"summary":"List Conversation Shares","description":"这个会话已经发出去过哪些链接。分享者要能看见自己发过什么——一条发出去就再也找不到的\n链接，等于没法撤。","operationId":"list_conversation_shares_share__token__sessions__sid__shares_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareAuthIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ConvListOut"},"title":"Response List Conversation Shares Share  Token  Sessions  Sid  Shares Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/conversations/{ctoken}/revoke":{"post":{"tags":["share"],"summary":"Revoke Conversation Share","description":"撤销一条分享。只有**发起分享的那个人**能撤——它公开的是他的对话。","operationId":"revoke_conversation_share_share__token__conversations__ctoken__revoke_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"ctoken","in":"path","required":true,"schema":{"type":"string","title":"Ctoken"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareAuthIn"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/conversations/{ctoken}/clone":{"post":{"tags":["share"],"summary":"Clone Shared Conversation","description":"把一段被分享的对话克隆进**查看者自己**的会话，让智能体接着聊。\n\n克隆而不是\"加入原会话\"：原会话属于另一个人，两个人往同一条会话里说话，谁的记忆、谁的\n配额、谁能删——每一个问题都没有好答案。克隆之后这段历史就是查看者自己的，与原主人再无关系。\n\n消息用**查看者的**密钥重新加密：从此它归他所有，原主人删掉自己的会话也不影响这一份。","operationId":"clone_shared_conversation_share__token__conversations__ctoken__clone_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"ctoken","in":"path","required":true,"schema":{"type":"string","title":"Ctoken"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareAuthIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloneOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/sessions":{"post":{"tags":["share"],"summary":"Share List Sessions","operationId":"share_list_sessions_share__token__sessions_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":30,"title":"Limit"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareAuthIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareSessionPage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/sessions/search":{"post":{"tags":["share"],"summary":"Share Search Sessions","description":"检索**当前终端用户自己的**历史会话：语义（标题向量）+ 关键词（查询时解密），\n见 app/chat/session_search.py。隔离与会话列表同一对键 (user, space)。","operationId":"share_search_sessions_share__token__sessions_search_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareSearchIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ShareSessionSearchHit"},"title":"Response Share Search Sessions Share  Token  Sessions Search Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/sessions/{sid}/messages":{"post":{"tags":["share"],"summary":"Share Session Messages","operationId":"share_session_messages_share__token__sessions__sid__messages_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareAuthIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ShareMessageOut"},"title":"Response Share Session Messages Share  Token  Sessions  Sid  Messages Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/sessions/{sid}/read":{"post":{"tags":["share"],"summary":"Share Mark Read","description":"把这条会话标成读到此刻为止。**和 `/me/sessions/{sid}/read` 同一份实现**\n（`message_ops.mark_read`）——这个功能就是被\"两个宿主各写一份\"坑出来的。\n\n回 204 而不是整条会话：挂件那一侧拿到之后只需要把角标清零，而它手上本来就有这一行。","operationId":"share_mark_read_share__token__sessions__sid__read_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareAuthIn"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/sessions/{sid}/messages/{mid}/delete":{"post":{"tags":["share"],"summary":"Share Delete Message","operationId":"share_delete_message_share__token__sessions__sid__messages__mid__delete_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}},{"name":"mid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Mid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareAuthIn"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/sessions/{sid}/messages/{mid}/edit":{"post":{"tags":["share"],"summary":"Share Edit Message","description":"改写自己某条消息的正文。改的若是用户那句话，派生自它的记忆后台重提取——\n与登录侧同一条规矩：一条被改掉的话不该继续以旧内容的形式留在记忆里。","operationId":"share_edit_message_share__token__sessions__sid__messages__mid__edit_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}},{"name":"mid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Mid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareMessageEditIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareMessageOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/sessions/{sid}/messages/{mid}/branch":{"post":{"tags":["share"],"summary":"Share Branch Session","description":"从这条消息处分叉出一条新会话。\n\n**含不含被点的那一条，取决于它是谁说的**（见 `branch_session`）。挂件那条路走的就是这个\n端点，所以两边必须同时改——只改 `/me` 那份，分享页上点分叉会得到旧语义，而症状是\n\"编辑后一发，同一个问题问了两遍\"。","operationId":"share_branch_session_share__token__sessions__sid__messages__mid__branch_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}},{"name":"mid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Mid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareAuthIn"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareSessionOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/sessions/{sid}/messages/{mid}/regenerate":{"post":{"tags":["share"],"summary":"Share Regenerate Message","description":"重生成某条 assistant 回复（删它及其后，据历史重新流式生成）。SSE 明文流，同登录侧。\n\n**限流同聊天。** 它和发一句话一样是一次完整生成——不限的话，这就是一条绕过 `shchat`\n计数的免费生成通道。","operationId":"share_regenerate_message_share__token__sessions__sid__messages__mid__regenerate_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}},{"name":"mid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Mid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareAuthIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/sessions/{sid}/delete":{"post":{"tags":["share"],"summary":"Share Delete Session","operationId":"share_delete_session_share__token__sessions__sid__delete_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareAuthIn"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/sessions/{sid}/rename":{"post":{"tags":["share"],"summary":"Share Rename Session","operationId":"share_rename_session_share__token__sessions__sid__rename_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareRenameIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareSessionOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/sessions/{sid}/storyline":{"post":{"tags":["share"],"summary":"Share Session Storyline","description":"重开历史会话时横幅的取态入口(实时轮次走流式 meta.storyline,两处同源 peek_state)。","operationId":"share_session_storyline_share__token__sessions__sid__storyline_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareAuthIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareStorylineState"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/sessions/{sid}/storyline/view":{"post":{"tags":["share"],"summary":"Share Session Storyline View","description":"查看弹窗的只读图(docs/40 M2)。脱敏在服务端(engine.view_payload);\nnamed/invisible 档无此入口 → 404,别让人猜出\"有条线但不给看图\"之外的信息。","operationId":"share_session_storyline_view_share__token__sessions__sid__storyline_view_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareAuthIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Share Session Storyline View Share  Token  Sessions  Sid  Storyline View Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/storylines":{"post":{"tags":["share"],"summary":"Share Storylines","description":"用户可主动进入的故事线列表(docs/40 M3:输入区按钮 + New Chat 分裂下拉的数据源)。","operationId":"share_storylines_share__token__storylines_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareAuthIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true},"title":"Response Share Storylines Share  Token  Storylines Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/storyline/enter":{"post":{"tags":["share"],"summary":"Share Storyline Enter","description":"确定性主动进入。session_id 缺省时新建会话(一案一会话的入口)。\n返回 {session_id, opening, state}——opening 由 widget 以问候气泡呈现,\nstate 是进入后的横幅状态。","operationId":"share_storyline_enter_share__token__storyline_enter_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareEnterIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Share Storyline Enter Share  Token  Storyline Enter Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/planner/plan":{"post":{"tags":["share"],"summary":"Share Planner Plan","description":"动态规划器显式触发(docs/41 通道二):生成计划→临时线→确定性入线。\n\nPro 门控 = tenant.profile.planner.enabled(网站按订阅档写入;管理员可手动开)。\n规划用量 kind=planner 独立记账。失败路径统一 502,对话不受影响。","operationId":"share_planner_plan_share__token__planner_plan_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SharePlanIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Share Planner Plan Share  Token  Planner Plan Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/sessions/{sid}/storyline/exit":{"post":{"tags":["share"],"summary":"Share Storyline Exit","description":"横幅退出(仅 allow_exit 的线)。abandoned 即\"本会话不再自动重进\"。","operationId":"share_storyline_exit_share__token__sessions__sid__storyline_exit_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareAuthIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Share Storyline Exit Share  Token  Sessions  Sid  Storyline Exit Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/sessions/{sid}/storyline/rewind":{"post":{"tags":["share"],"summary":"Share Storyline Rewind","description":"回到已走过的某一步(仅节点 rewind ∈ reset|keep,docs/40 M4)。","operationId":"share_storyline_rewind_share__token__sessions__sid__storyline_rewind_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"sid","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Sid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareRewindIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Share Storyline Rewind Share  Token  Sessions  Sid  Storyline Rewind Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/writing/runs":{"post":{"tags":["share"],"summary":"List Runs","operationId":"list_runs_share__token__writing_runs_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WritingIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/writing/runs/{run_id}":{"post":{"tags":["share"],"summary":"Get Run","operationId":"get_run_share__token__writing_runs__run_id__post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WritingIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/writing/runs/{run_id}/events":{"post":{"tags":["share"],"summary":"Get Events","description":"断线补齐。**不是 SSE 的冗余**：`bus.publish` 在背压下丢最旧的，而一份 40 节的文档会\n发出几百条——慢连接丢的恰恰是它最需要的那几条。","operationId":"get_events_share__token__writing_runs__run_id__events_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WritingIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/writing/stream":{"post":{"tags":["share"],"summary":"Stream","description":"订阅进度。**共用 `/me/stream` 的那个 bus 键**，零新 pub/sub。\n\n身份在 body 里，所以只能是 POST——匿名访客没有可以放进请求头的东西。","operationId":"stream_share__token__writing_stream_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WritingIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/writing/runs/{run_id}/email":{"post":{"tags":["share"],"summary":"Set Email","description":"留邮箱 → 开工。**成本闸 + 文档找得回来是同一步**（docs/51 §4.5）。","operationId":"set_email_share__token__writing_runs__run_id__email_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__share_writing__EmailIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/writing/runs/{run_id}/answer":{"post":{"tags":["share"],"summary":"Answer","operationId":"answer_share__token__writing_runs__run_id__answer_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnswerIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/writing/runs/{run_id}/confirm":{"post":{"tags":["share"],"summary":"Confirm","description":"确认开写——**计费闸**：过了这一步才开始花 token。","operationId":"confirm_share__token__writing_runs__run_id__confirm_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WritingIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/writing/runs/{run_id}/translations":{"post":{"tags":["share"],"summary":"List Translations","description":"有哪些语言副本，每个新鲜到什么程度。\n\n**`fresh/stale/missing` 是数出来的，不是存的**（§28.1 决策 2）：脏 =\n`source_revision_no != current_revision_no`。这里数一遍，界面据此显示\"要重译\"。","operationId":"list_translations_share__token__writing_runs__run_id__translations_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WritingIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/writing/runs/{run_id}/translations/{lang}":{"post":{"tags":["share"],"summary":"Start Translation","description":"切到这个语言：**缺的和过期的入队**，已有的立即可读。\n\n不重译没变的节——一份 40 节的材料改了一句话，重译一整篇是在烧钱（§28.1 决策 7）。","operationId":"start_translation_share__token__writing_runs__run_id__translations__lang__post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}},{"name":"lang","in":"path","required":true,"schema":{"type":"string","title":"Lang"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TranslateIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/writing/runs/{run_id}/translations/{lang}/delete":{"post":{"tags":["share"],"summary":"Delete Translation","description":"删掉一份语言副本。源文档一个字不动。","operationId":"delete_translation_share__token__writing_runs__run_id__translations__lang__delete_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}},{"name":"lang","in":"path","required":true,"schema":{"type":"string","title":"Lang"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TranslateIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/writing/runs/{run_id}/materials":{"post":{"tags":["share"],"summary":"List Materials","description":"这份文档背后的支撑资料（docs/51 §31）。按来源归并——**人管理的是\"那份文件\"，\n不是它的第 17 段**。","operationId":"list_materials_share__token__writing_runs__run_id__materials_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WritingIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/writing/runs/{run_id}/materials/add":{"post":{"tags":["share"],"summary":"Add Material","description":"加一份资料：一段文字、一个网址、或者一个文件。\n\n**加完不自动重写**——它只是进了资料库。要让它落到正文里，在对话里说一句（那条路会判\n哪几节受影响并排重写）。这样\"补资料\"和\"改文档\"是两个动作，误传一份文件不会当场改稿。","operationId":"add_material_share__token__writing_runs__run_id__materials_add_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MaterialIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/writing/runs/{run_id}/materials/delete":{"post":{"tags":["share"],"summary":"Delete Material","description":"删掉一份资料。**只删资料，一个字都不动正文**——重写是花钱的事，由人决定。","operationId":"delete_material_share__token__writing_runs__run_id__materials_delete_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MaterialIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/writing/runs/{run_id}/cancel":{"post":{"tags":["share"],"summary":"Cancel","operationId":"cancel_share__token__writing_runs__run_id__cancel_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WritingIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/writing/sections/{section_id}":{"post":{"tags":["share"],"summary":"Save Section","description":"手改一节。**版本对不上回 409 带当前值**，绝不静默覆盖——那一刻另一边可能是 agent\n刚重写完。","operationId":"save_section_share__token__writing_sections__section_id__post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"section_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Section Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveSectionIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/writing/sections/{section_id}/requirements":{"post":{"tags":["share"],"summary":"Save Requirements","description":"改**注意事项**，默认立刻重写这一节（docs/51 §11）。\n\n注意事项是模型看到的那段话。藏起来等于让人对着一个看不见的提示词猜为什么写成这样——\n所以它可见、可改，改完能重跑。","operationId":"save_requirements_share__token__writing_sections__section_id__requirements_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"section_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Section Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequirementsIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/writing/runs/{run_id}/outline":{"post":{"tags":["share"],"summary":"Edit Outline","description":"重排 / 改名 / 加一节 / 删一节。**删是软删**，误删救得回来；`anchor` 一个都不动。","operationId":"edit_outline_share__token__writing_runs__run_id__outline_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutlineIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/writing/start":{"post":{"tags":["share"],"summary":"Start","description":"起一份新文档。**停在 `draft`**——匿名访客要先留邮箱才开工（成本闸，§4.5）。\n\n入队即返回，不走 SSE：于是这条路径完全不碰 `on_abort` 那个坑。进度从 `/writing/stream`\n看，那是唯一的长连接，而它不持有事务。","operationId":"start_share__token__writing_start_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/writing/sections/{section_id}/revise":{"post":{"tags":["share"],"summary":"Revise","description":"选中一段 → 提要求 → **只换那一段**（docs/51 §10）。\n\n整节改写 = `start=0, end=len(body)`，一条代码路径。区间由客户端给、由服务端切——**模型\n永远不产出偏移**。返回里带 `unsourced`：片段里在事实引文中找不到的具体说法，界面上带虚\n下划线；它是代码扫出来的，不是模型自评的。","operationId":"revise_share__token__writing_sections__section_id__revise_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"section_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Section Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__share_writing__ReviseIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/writing/sections/{section_id}/revisions":{"post":{"tags":["share"],"summary":"Revisions","description":"这一节改过几次、每次是谁改的、改的哪一段。\n\n**正文按需取**（`no` 给了才解密那一版）：一节留着几十版，把每版全文都解密再发一遍，\n等于每开一次面板就把整份文档传好几遍。列表这一层只回结构——它够画时间线了。\n\n`origin` 的四个值就是\"谁改的\"：`agent`（写出来的那一版）、`user`（手改）、\n`revise`（选中一段提要求）、`restore`（翻回某一版）。**回退也是新的一版**，所以时间线\n永远是往前长的，没有\"消失的一版\"。","operationId":"revisions_share__token__writing_sections__section_id__revisions_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"section_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Section Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevisionsIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/writing/sections/{section_id}/restore":{"post":{"tags":["share"],"summary":"Restore","description":"回到某一版。**新建一版拷回去，从不删历史。**","operationId":"restore_share__token__writing_sections__section_id__restore_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"section_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Section Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RestoreIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/writing/runs/{run_id}/export":{"post":{"tags":["share"],"summary":"Export Pdf","description":"导出 PDF（docs/51 §12）。\n\n**访客的身份从不进子进程**：这里用他的身份确认归属，然后签一个一分钟就过期、且只能从\n回环地址取的链接，子进程拿到的只有那个链接。","operationId":"export_pdf_share__token__writing_runs__run_id__export_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WritingIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/share/{token}/writing/runs/{run_id}/delete":{"post":{"tags":["share"],"summary":"Delete Run","description":"删掉一份文档。\n\n**真删，不是软删**：这是访客自己的东西，他说不要了就是不要了；留一份\"已删除\"的副本，\n等于我们替他保存了一份他明确不想留的材料。级联会带走它的节、版本、事实与事件。\n\n在跑的作业先取消——不然 worker 会继续写一份已经不存在的文档，日志里全是 \"run 已不存在\"。","operationId":"delete_run_share__token__writing_runs__run_id__delete_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Run Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WritingIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/c/{ctoken}/data":{"get":{"tags":["conversation-share"],"summary":"Conversation Data","description":"页面渲染用的数据。附件在这里被替换成**本页自己的**地址（见模块说明）。","operationId":"conversation_data_c__ctoken__data_get","parameters":[{"name":"ctoken","in":"path","required":true,"schema":{"type":"string","title":"Ctoken"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConvOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/c/{ctoken}/att/{attachment_id}":{"get":{"tags":["conversation-share"],"summary":"Conversation Attachment","description":"快照里那些附件的本体。**白名单之外一律 404。**\n\n解密所用的 user/space 一律取自附件行本身，绝不取自请求——与 `/share/{token}/attachments`\n同一条规矩：请求可以自报任何身份，附件行不会。","operationId":"conversation_attachment_c__ctoken__att__attachment_id__get","parameters":[{"name":"ctoken","in":"path","required":true,"schema":{"type":"string","title":"Ctoken"}},{"name":"attachment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Attachment Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/c/{ctoken}/qr.svg":{"get":{"tags":["conversation-share"],"summary":"Conversation Qr","description":"二维码。**不设鉴权**：它编码的就是这条 URL 本身，而 URL 已经在分享者手里了。\n\nbase 取自本次请求而不是配置：客户绑了自己的域名时，二维码里印着我们的域名是错的。","operationId":"conversation_qr_c__ctoken__qr_svg_get","parameters":[{"name":"ctoken","in":"path","required":true,"schema":{"type":"string","title":"Ctoken"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/c/{ctoken}/continue":{"get":{"tags":["conversation-share"],"summary":"Conversation Continue","description":"把人送去挂件、并带上\"从这段对话接着聊\"的标记。\n\n**不在这里克隆**：克隆要写进**查看者自己**的会话，而这一刻还不知道他是谁——匿名分享的\n身份是挂件在浏览器里签出来的（app/auth/visitor.py）。所以这里只负责把人送过去，\n克隆由挂件带着身份去调 `/share/{token}/conversations/{ctoken}/clone`。","operationId":"conversation_continue_c__ctoken__continue_get","parameters":[{"name":"ctoken","in":"path","required":true,"schema":{"type":"string","title":"Ctoken"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/c/{ctoken}":{"get":{"tags":["conversation-share"],"summary":"Conversation Page","description":"公开页。HTML 是个壳，数据走 `/data`——壳可以被缓存，内容不能。","operationId":"conversation_page_c__ctoken__get","parameters":[{"name":"ctoken","in":"path","required":true,"schema":{"type":"string","title":"Ctoken"}}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/embed/{token}":{"get":{"tags":["embed"],"summary":"Embed Widget","description":"嵌入形态：供宿主页 iframe 加载（气泡/窗口/全屏三态）。","operationId":"embed_widget_embed__token__get","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/s/{token}":{"get":{"tags":["embed"],"summary":"Standalone Page","description":"独立整页形态：直接发给终端用户的分享链接。\n\n**host_session + 没带签名 + 配了登录页 → 直接送去登录。** 这一形态整页就是这个对话，没有\n别的内容可显示，与其先画一个用不了的输入框、等人打完字才说\"你没登录\"，不如立刻把人送到\n能解决问题的地方；登录完宿主后端就签得出签名。\n\n没配登录页就照常渲染——widget 自己会画拒绝页（`ShareInfo.denied`）。挂件形态（`/embed/`）\n刻意**不**跳：那是宿主页面里一个 400×640 的 iframe，多数登录页带着\n`X-Frame-Options: DENY`，跳进去的结果是一块白板，比拒绝页更糟。它改在顶层窗口打开。","operationId":"standalone_page_s__token__get","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/s/{token}/manifest.webmanifest":{"get":{"tags":["embed"],"summary":"Share Manifest","description":"按 share 生成的 PWA manifest：装到主屏幕的是**这个租户的这个入口**——\n名字用 share 的页面标题、主题色用它配置的品牌色、图标用租户母图管线的产物\n（POST /agents/{name}/pwa/icon，见 app/branding.py），没传过母图则回落平台图标。","operationId":"share_manifest_s__token__manifest_webmanifest_get","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/s/{token}/qr.svg":{"get":{"tags":["embed"],"summary":"Standalone Qr","description":"终端用户链接的二维码（SVG，公开）：印在名片/传单/店内，客户扫码即打开整页聊天页——**没有网站也能发布**。\n编码的就是公开的 `/s/<token>` 地址；SVG 可无限清晰缩放、直接下载打印。","operationId":"standalone_qr_s__token__qr_svg_get","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/d/{token}":{"get":{"tags":["embed"],"summary":"Canvas Page","description":"写作画布。身份与挂件是**同一个访客**（读同一把 localStorage 钥匙），所以这里只注入\n令牌，不做任何鉴权——每一次取数都要过 `/share/{token}/writing/*`，那一组挂着准入门。","operationId":"canvas_page_d__token__get","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/telegram/webhook/{secret}":{"post":{"tags":["telegram"],"summary":"Telegram Webhook","operationId":"telegram_webhook_telegram_webhook__secret__post","parameters":[{"name":"secret","in":"path","required":true,"schema":{"type":"string","title":"Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Telegram Webhook Telegram Webhook  Secret  Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agents/{name}/telegram":{"get":{"tags":["telegram"],"summary":"Get Agent Telegram","operationId":"get_agent_telegram_agents__name__telegram_get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TelegramStatusOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["telegram"],"summary":"Connect Agent Telegram","operationId":"connect_agent_telegram_agents__name__telegram_put","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TelegramTokenIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TelegramStatusOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["telegram"],"summary":"Disconnect Agent Telegram","operationId":"disconnect_agent_telegram_agents__name__telegram_delete","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agents/{name}/telegram/toggle":{"post":{"tags":["telegram"],"summary":"Toggle Agent Telegram","operationId":"toggle_agent_telegram_agents__name__telegram_toggle_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TelegramToggleIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TelegramStatusOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/whatsapp/webhook":{"get":{"tags":["whatsapp"],"summary":"Whatsapp Verify","description":"Meta 校验握手：verify_token 命中某集成则回显 hub.challenge。","operationId":"whatsapp_verify_whatsapp_webhook_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["whatsapp"],"summary":"Whatsapp Inbound","operationId":"whatsapp_inbound_whatsapp_webhook_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Whatsapp Inbound Whatsapp Webhook Post"}}}}}}},"/agents/{name}/whatsapp":{"get":{"tags":["whatsapp"],"summary":"Get Agent Whatsapp","operationId":"get_agent_whatsapp_agents__name__whatsapp_get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaStatusOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["whatsapp"],"summary":"Connect Agent Whatsapp","operationId":"connect_agent_whatsapp_agents__name__whatsapp_put","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaConnectIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaStatusOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["whatsapp"],"summary":"Disconnect Agent Whatsapp","operationId":"disconnect_agent_whatsapp_agents__name__whatsapp_delete","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agents/{name}/whatsapp/toggle":{"post":{"tags":["whatsapp"],"summary":"Toggle Agent Whatsapp","operationId":"toggle_agent_whatsapp_agents__name__whatsapp_toggle_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaToggleIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaStatusOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/attachments/{attachment_id}":{"get":{"tags":["attachments"],"summary":"Download Attachment","operationId":"download_attachment_attachments__attachment_id__get","parameters":[{"name":"attachment_id","in":"path","required":true,"schema":{"type":"string","title":"Attachment Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"ActivateIn":{"properties":{"active":{"type":"boolean","title":"Active"}},"type":"object","required":["active"],"title":"ActivateIn"},"AgentAliasIn":{"properties":{"alias":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Alias"}},"type":"object","title":"AgentAliasIn"},"AgentAliasOut":{"properties":{"alias":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Alias"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"url_prefix":{"type":"string","title":"Url Prefix","default":"/t/"}},"type":"object","title":"AgentAliasOut"},"AgentExport":{"properties":{"schema_version":{"type":"integer","title":"Schema Version"},"kind":{"type":"string","title":"Kind","default":"agent"},"name":{"type":"string","title":"Name"},"soul":{"type":"string","title":"Soul","default":""},"task":{"type":"string","title":"Task","default":""},"tools":{"items":{"type":"string"},"type":"array","title":"Tools","default":[]},"skills":{"items":{"type":"string"},"type":"array","title":"Skills","default":[]},"knowledge_bases":{"items":{"type":"string"},"type":"array","title":"Knowledge Bases","default":[]},"history_window":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"History Window"},"max_output_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Output Tokens"},"tool_call_max_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tool Call Max Tokens"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"},"greeting":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Greeting"},"auto_greeting":{"type":"boolean","title":"Auto Greeting","default":false},"auto_suggest":{"type":"boolean","title":"Auto Suggest","default":false},"suggest_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Suggest Prompt"},"ask_forms":{"type":"boolean","title":"Ask Forms","default":false},"proactive_cta":{"type":"boolean","title":"Proactive Cta","default":false},"cta_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cta Prompt"},"no_match_reply":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"No Match Reply"},"reasoning":{"type":"boolean","title":"Reasoning","default":false},"grounding_required":{"type":"boolean","title":"Grounding Required","default":false}},"type":"object","required":["schema_version","name"],"title":"AgentExport"},"AgentImportIn":{"properties":{"schema_version":{"type":"integer","title":"Schema Version","default":1},"kind":{"type":"string","title":"Kind","default":"agent"},"name":{"type":"string","title":"Name"},"soul":{"type":"string","title":"Soul","default":""},"task":{"type":"string","title":"Task","default":""},"tools":{"items":{"type":"string"},"type":"array","title":"Tools","default":[]},"skills":{"items":{"type":"string"},"type":"array","title":"Skills","default":[]},"knowledge_bases":{"items":{"type":"string"},"type":"array","title":"Knowledge Bases","default":[]},"history_window":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"History Window"},"max_output_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Output Tokens"},"tool_call_max_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tool Call Max Tokens"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"},"greeting":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Greeting"},"auto_greeting":{"type":"boolean","title":"Auto Greeting","default":false},"auto_suggest":{"type":"boolean","title":"Auto Suggest","default":false},"suggest_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Suggest Prompt"},"ask_forms":{"type":"boolean","title":"Ask Forms","default":false},"proactive_cta":{"type":"boolean","title":"Proactive Cta","default":false},"cta_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cta Prompt"},"no_match_reply":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"No Match Reply"},"reasoning":{"type":"boolean","title":"Reasoning","default":false},"grounding_required":{"type":"boolean","title":"Grounding Required","default":false},"override_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Override Name"}},"type":"object","required":["name"],"title":"AgentImportIn"},"AgentIn":{"properties":{"soul":{"type":"string","title":"Soul","default":""},"task":{"type":"string","title":"Task","default":""},"tools":{"items":{"type":"string"},"type":"array","title":"Tools","default":[]},"skills":{"items":{"type":"string"},"type":"array","title":"Skills","default":[]},"knowledge_bases":{"items":{"type":"string"},"type":"array","title":"Knowledge Bases","default":[]},"history_window":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"History Window"},"max_output_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Output Tokens"},"tool_call_max_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tool Call Max Tokens","description":"发起工具调用那一轮的输出预算（token）。工具的入参也算模型输出，而导出文档的入参就是整份文档，所以这个值决定了智能体一次能写多长的文档。\n\n调大：面对大上下文的复杂问题，智能体能把话讲透、文档写全；代价是这类回合更慢（约 160 token/秒，写满 16K 约需 100 秒），且会更快消耗月度 token 配额。\n\n调小：更快更省，但复杂问题会被迫简答。低于下限的值会被抬回下限——设得过小不会让文档变短，而是让参数 JSON 被截断、整个导出失败。\n\n留空使用平台默认值。"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"},"published":{"type":"boolean","title":"Published","default":false},"greeting":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Greeting"},"auto_greeting":{"type":"boolean","title":"Auto Greeting","default":false},"auto_suggest":{"type":"boolean","title":"Auto Suggest","default":false},"suggest_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Suggest Prompt"},"ask_forms":{"type":"boolean","title":"Ask Forms","default":true},"proactive_cta":{"type":"boolean","title":"Proactive Cta","default":false},"cta_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cta Prompt"},"no_match_reply":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"No Match Reply"},"reasoning":{"type":"boolean","title":"Reasoning","default":false},"grounding_required":{"type":"boolean","title":"Grounding Required","default":false},"injection_guard":{"type":"boolean","title":"Injection Guard","default":true},"public_sources":{"type":"boolean","title":"Public Sources","default":false},"ambiguity_check":{"type":"boolean","title":"Ambiguity Check","default":false},"deep_research":{"type":"boolean","title":"Deep Research","default":false},"on_demand_context":{"type":"boolean","title":"On Demand Context","default":false},"guard_escalation":{"type":"boolean","title":"Guard Escalation","default":false},"menu_items":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Menu Items"}},"type":"object","title":"AgentIn"},"AgentOut":{"properties":{"name":{"type":"string","title":"Name"},"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id"},"alias":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Alias"},"soul":{"type":"string","title":"Soul"},"task":{"type":"string","title":"Task"},"tools":{"items":{"type":"string"},"type":"array","title":"Tools"},"skills":{"items":{"type":"string"},"type":"array","title":"Skills","default":[]},"knowledge_bases":{"items":{"type":"string"},"type":"array","title":"Knowledge Bases","default":[]},"history_window":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"History Window"},"max_output_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Output Tokens"},"tool_call_max_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tool Call Max Tokens"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"},"published":{"type":"boolean","title":"Published","default":false},"greeting":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Greeting"},"auto_greeting":{"type":"boolean","title":"Auto Greeting","default":false},"auto_suggest":{"type":"boolean","title":"Auto Suggest","default":false},"suggest_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Suggest Prompt"},"ask_forms":{"type":"boolean","title":"Ask Forms","default":false},"proactive_cta":{"type":"boolean","title":"Proactive Cta","default":false},"cta_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cta Prompt"},"no_match_reply":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"No Match Reply"},"reasoning":{"type":"boolean","title":"Reasoning","default":false},"grounding_required":{"type":"boolean","title":"Grounding Required","default":false},"injection_guard":{"type":"boolean","title":"Injection Guard","default":true},"public_sources":{"type":"boolean","title":"Public Sources","default":false},"ambiguity_check":{"type":"boolean","title":"Ambiguity Check","default":false},"deep_research":{"type":"boolean","title":"Deep Research","default":false},"on_demand_context":{"type":"boolean","title":"On Demand Context","default":false},"guard_escalation":{"type":"boolean","title":"Guard Escalation","default":false},"menu_items":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Menu Items"},"source":{"type":"string","title":"Source"}},"type":"object","required":["name","soul","task","tools","source"],"title":"AgentOut"},"AgentPatch":{"properties":{"soul":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Soul"},"task":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Task"},"tools":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Tools"},"tools_add":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Tools Add"},"tools_remove":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Tools Remove"},"skills":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Skills"},"skills_add":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Skills Add"},"skills_remove":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Skills Remove"},"knowledge_bases":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Knowledge Bases"},"knowledge_bases_add":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Knowledge Bases Add"},"knowledge_bases_remove":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Knowledge Bases Remove"},"history_window":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"History Window"},"max_output_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Output Tokens"},"tool_call_max_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tool Call Max Tokens"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"},"published":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Published"},"greeting":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Greeting"},"auto_greeting":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Auto Greeting"},"auto_suggest":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Auto Suggest"},"suggest_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Suggest Prompt"},"ask_forms":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Ask Forms"},"proactive_cta":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Proactive Cta"},"cta_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cta Prompt"},"no_match_reply":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"No Match Reply"},"reasoning":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Reasoning"},"grounding_required":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Grounding Required"},"injection_guard":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Injection Guard"},"public_sources":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Public Sources"},"ambiguity_check":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Ambiguity Check"},"deep_research":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Deep Research"},"on_demand_context":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"On Demand Context"},"guard_escalation":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Guard Escalation"},"menu_items":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Menu Items"}},"type":"object","title":"AgentPatch","description":"只改传来的字段。\n\n存在的理由是 `PUT` 是整体替换：`AgentIn` 每个字段都有默认值，一个漏掉 `soul` 的 PUT 会把\nsoul 静默清空。谁都不想要那个语义，所以每个调用方各自实现了一遍 GET→合并→PUT——包括我们\n自己的 MCP 工具 `update_agent`，它的 docstring 专门解释过这件事。同一个坑被绕两次，就说明\n该修的是坑。\n\n区分「传了 null」和「没传」靠 `model_fields_set`：`greeting=null` 是清空开场白，不传是别动它。\n\n列表字段（tools/skills/knowledge_bases）另备 `*_add` / `*_remove` **增量**语义：\n`tools=[...]` 是整表替换——调用方（尤其是通过 MCP 操作的智能体）想\"加一个工具\"时\n发整表，就会把没读到的其它项挤掉；线上真出过（加 save_contact 顺手挤掉了\nip_geo/weather，无人察觉）。增删各自幂等：加已有的、删没有的都不报错。\n同一字段的替换和增量可同用，先替换、再加、后删。"},"AgentSessionOut":{"properties":{"id":{"type":"string","title":"Id"},"user_id":{"type":"string","title":"User Id"},"external_user_id":{"type":"string","title":"External User Id"},"space_id":{"type":"string","title":"Space Id"},"space_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Name"},"agent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent"},"message_count":{"type":"integer","title":"Message Count"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","user_id","external_user_id","space_id","message_count","created_at"],"title":"AgentSessionOut","description":"某智能体维度的会话（跨用户/跨空间），带用户与空间标签供时间线展示。"},"AgentSessionPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AgentSessionOut"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"AgentSessionPage"},"AgentStatRow":{"properties":{"agent":{"type":"string","title":"Agent"},"conversations":{"type":"integer","title":"Conversations"},"people":{"type":"integer","title":"People"},"last_active":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Active"}},"type":"object","required":["agent","conversations","people"],"title":"AgentStatRow"},"AgentStatsOut":{"properties":{"rows":{"items":{"$ref":"#/components/schemas/AgentStatRow"},"type":"array","title":"Rows"}},"type":"object","required":["rows"],"title":"AgentStatsOut"},"AgentSummary":{"properties":{"name":{"type":"string","title":"Name"},"id":{"type":"string","title":"Id"},"alias":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Alias"},"published":{"type":"boolean","title":"Published","default":false},"source":{"type":"string","title":"Source","default":"db"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"},"task":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Task"},"tools_count":{"type":"integer","title":"Tools Count","default":0},"skills_count":{"type":"integer","title":"Skills Count","default":0},"tools":{"items":{"type":"string"},"type":"array","title":"Tools","default":[]},"skills":{"items":{"type":"string"},"type":"array","title":"Skills","default":[]},"knowledge_bases":{"items":{"type":"string"},"type":"array","title":"Knowledge Bases","default":[]}},"type":"object","required":["name","id"],"title":"AgentSummary"},"AnswerIn":{"properties":{"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"lang_explicit":{"type":"boolean","title":"Lang Explicit","default":false},"end_user":{"type":"string","title":"End User","default":""},"end_user_proof":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End User Proof"},"page_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Key"},"page_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Url"},"id_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id Token"},"host_uid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Uid"},"host_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Ts"},"host_sig":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Sig"},"space_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Id"},"info_key":{"type":"string","title":"Info Key","default":""},"answer":{"type":"string","title":"Answer","default":""}},"type":"object","title":"AnswerIn"},"ApiKeyOut":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name","default":"default"},"revoked":{"type":"boolean","title":"Revoked"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","revoked","created_at"],"title":"ApiKeyOut"},"ApproveIn":{"properties":{"kb_name":{"type":"string","title":"Kb Name"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Text"}},"type":"object","required":["kb_name"],"title":"ApproveIn"},"AttachmentOut":{"properties":{"id":{"type":"string","title":"Id"},"mime":{"type":"string","title":"Mime"},"name":{"type":"string","title":"Name"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","mime","name","created_at"],"title":"AttachmentOut"},"AuditOut":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"},"tenant_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Name"},"actor_type":{"type":"string","title":"Actor Type"},"actor_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor Id"},"action":{"type":"string","title":"Action"},"target":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Target"},"meta":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Meta"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"actor_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor Label"},"via":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Via"},"entity":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Entity"},"entity_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Entity Id"},"before":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Before"},"after":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"After"}},"type":"object","required":["id","actor_type","action","created_at"],"title":"AuditOut"},"AuditPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AuditOut"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"},"total":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total"}},"type":"object","required":["items"],"title":"AuditPage"},"AuthMethodsOut":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"password":{"type":"boolean","title":"Password"},"oauth":{"items":{"type":"string"},"type":"array","title":"Oauth"}},"type":"object","required":["tenant_id","password","oauth"],"title":"AuthMethodsOut"},"Board":{"properties":{"by_status":{"additionalProperties":{"type":"integer"},"type":"object","title":"By Status"},"active_jobs":{"type":"integer","title":"Active Jobs","default":0},"stale_jobs":{"type":"integer","title":"Stale Jobs","default":0},"stuck":{"type":"integer","title":"Stuck","default":0},"waiting":{"type":"integer","title":"Waiting","default":0},"runs":{"items":{"$ref":"#/components/schemas/RunRow"},"type":"array","title":"Runs"}},"type":"object","required":["by_status","runs"],"title":"Board"},"Body_import_feed_knowledge_bases__name__products_import_post":{"properties":{"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"file":{"anyOf":[{"type":"string","contentMediaType":"application/octet-stream"},{"type":"null"}],"title":"File"}},"type":"object","title":"Body_import_feed_knowledge_bases__name__products_import_post"},"Body_inspect_upload_knowledge_bases__name__documents_inspect_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_inspect_upload_knowledge_bases__name__documents_inspect_post"},"Body_share_upload_document_share__token__documents_upload_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"auth":{"type":"string","title":"Auth","default":"{}"},"confirm_vision":{"type":"boolean","title":"Confirm Vision","default":false}},"type":"object","required":["file"],"title":"Body_share_upload_document_share__token__documents_upload_post"},"Body_upload_agent_pwa_icon_agents__name__pwa_icon_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_upload_agent_pwa_icon_agents__name__pwa_icon_post"},"Body_upload_brand_logo_tenant_settings_logo_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_upload_brand_logo_tenant_settings_logo_post"},"Body_upload_document_documents_upload_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source"},"confirm_vision":{"type":"boolean","title":"Confirm Vision","default":false}},"type":"object","required":["file"],"title":"Body_upload_document_documents_upload_post"},"Body_upload_image_images_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_upload_image_images_post"},"Body_upload_kb_archive_stream_knowledge_bases__name__documents_upload_stream_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"no_chunk":{"type":"boolean","title":"No Chunk","default":false}},"type":"object","required":["file"],"title":"Body_upload_kb_archive_stream_knowledge_bases__name__documents_upload_stream_post"},"Body_upload_kb_document_knowledge_bases__name__documents_upload_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"no_chunk":{"type":"boolean","title":"No Chunk","default":false}},"type":"object","required":["file"],"title":"Body_upload_kb_document_knowledge_bases__name__documents_upload_post"},"ByokIn":{"properties":{"privacy_mode":{"type":"boolean","title":"Privacy Mode"},"byok_config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Byok Config"}},"type":"object","required":["privacy_mode"],"title":"ByokIn"},"ByokOut":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"privacy_mode":{"type":"boolean","title":"Privacy Mode"},"byok_provider":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Byok Provider"}},"type":"object","required":["tenant_id","privacy_mode"],"title":"ByokOut"},"CachePage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CacheRow"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"stats":{"additionalProperties":true,"type":"object","title":"Stats"}},"type":"object","required":["items","total","stats"],"title":"CachePage"},"CacheRow":{"properties":{"id":{"type":"string","title":"Id"},"kind":{"type":"string","title":"Kind"},"key":{"type":"string","title":"Key"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"status":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Status"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"bytes":{"type":"integer","title":"Bytes","default":0},"hits":{"type":"integer","title":"Hits","default":0},"fetched_at":{"type":"string","title":"Fetched At"},"fresh":{"type":"boolean","title":"Fresh","default":true}},"type":"object","required":["id","kind","key","fetched_at"],"title":"CacheRow"},"CallbackIn":{"properties":{"token":{"type":"string","title":"Token"},"nonce":{"type":"string","title":"Nonce"},"signal":{"type":"string","title":"Signal","default":"done"},"dims":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Dims"},"blackboard":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Blackboard"}},"type":"object","required":["token","nonce"],"title":"CallbackIn"},"ChangePasswordIn":{"properties":{"old_password":{"type":"string","title":"Old Password"},"new_password":{"type":"string","title":"New Password"}},"type":"object","required":["old_password","new_password"],"title":"ChangePasswordIn"},"ChangelogOut":{"properties":{"available":{"type":"boolean","title":"Available"},"locale":{"type":"string","title":"Locale"},"entries":{"items":{"$ref":"#/components/schemas/Entry"},"type":"array","title":"Entries","default":[]},"site_url":{"type":"string","title":"Site Url","default":"https://agent4.io/changelog"}},"type":"object","required":["available","locale"],"title":"ChangelogOut"},"ChatIn":{"properties":{"message":{"type":"string","title":"Message","default":""},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"},"k":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"K"},"agent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent"},"images":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Images"},"files":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Files"},"audio":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Audio"},"client_pubkey":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Pubkey"},"viewing_report":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Viewing Report"}},"type":"object","title":"ChatIn"},"ChatOut":{"properties":{"session_id":{"type":"string","title":"Session Id"},"reply":{"type":"string","title":"Reply"},"sources":{"items":{"$ref":"#/components/schemas/Source"},"type":"array","title":"Sources"},"transcript":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Transcript"}},"type":"object","required":["session_id","reply","sources"],"title":"ChatOut"},"CloneOut":{"properties":{"session_id":{"type":"string","title":"Session Id"},"message_count":{"type":"integer","title":"Message Count"}},"type":"object","required":["session_id","message_count"],"title":"CloneOut"},"ConfirmIn":{"properties":{"email":{"type":"string","title":"Email","default":""},"channel":{"type":"string","title":"Channel","default":""},"keep_sources":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Keep Sources"},"add_urls":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Add Urls"},"source_intervals":{"anyOf":[{"additionalProperties":{"type":"integer"},"type":"object"},{"type":"null"}],"title":"Source Intervals"},"cron":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cron"},"tz":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tz"},"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"}},"type":"object","title":"ConfirmIn"},"ConvListOut":{"properties":{"token":{"type":"string","title":"Token"},"url":{"type":"string","title":"Url"},"mode":{"type":"string","title":"Mode"},"allow_continue":{"type":"boolean","title":"Allow Continue"},"message_count":{"type":"integer","title":"Message Count"},"views":{"type":"integer","title":"Views"},"revoked":{"type":"boolean","title":"Revoked"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["token","url","mode","allow_continue","message_count","views","revoked","created_at"],"title":"ConvListOut"},"ConvOut":{"properties":{"title":{"type":"string","title":"Title"},"agent":{"type":"string","title":"Agent"},"agent_label":{"type":"string","title":"Agent Label","default":""},"logo_url":{"type":"string","title":"Logo Url","default":""},"shared_at":{"type":"string","title":"Shared At","default":""},"agent_url":{"type":"string","title":"Agent Url","default":""},"mode":{"type":"string","title":"Mode"},"allow_continue":{"type":"boolean","title":"Allow Continue"},"messages":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Messages"},"storyline_view":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Storyline View"},"opening":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Opening"},"docs":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Docs","default":[]}},"type":"object","required":["title","agent","mode","allow_continue","messages"],"title":"ConvOut"},"CrawlIn":{"properties":{"url":{"type":"string","title":"Url"},"path_prefix":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Path Prefix"},"max_depth":{"type":"integer","maximum":3.0,"minimum":1.0,"title":"Max Depth","default":2},"max_pages":{"type":"integer","maximum":200.0,"minimum":1.0,"title":"Max Pages","default":50}},"type":"object","required":["url"],"title":"CrawlIn"},"CrawlOut":{"properties":{"id":{"type":"string","title":"Id"},"knowledge_base":{"type":"string","title":"Knowledge Base"},"start_url":{"type":"string","title":"Start Url"},"status":{"type":"string","title":"Status"},"error_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Code"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"discovered":{"type":"integer","title":"Discovered"},"fetched":{"type":"integer","title":"Fetched"},"embedded":{"type":"integer","title":"Embedded"},"skipped":{"type":"integer","title":"Skipped"},"flagged":{"type":"integer","title":"Flagged"},"total_chars":{"type":"integer","title":"Total Chars"},"estimated_tokens":{"type":"integer","title":"Estimated Tokens"},"tokens_used":{"type":"integer","title":"Tokens Used"},"created_at":{"type":"string","title":"Created At"},"finished_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Finished At"}},"type":"object","required":["id","knowledge_base","start_url","status","error_code","error","discovered","fetched","embedded","skipped","flagged","total_chars","estimated_tokens","tokens_used","created_at","finished_at"],"title":"CrawlOut"},"CreateAccountIn":{"properties":{"email":{"type":"string","title":"Email"},"password":{"type":"string","title":"Password"}},"type":"object","required":["email","password"],"title":"CreateAccountIn"},"CreateTenantIn":{"properties":{"name":{"type":"string","title":"Name"},"privacy_mode":{"type":"boolean","title":"Privacy Mode","default":false},"byok_config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Byok Config"},"onboarding_config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Onboarding Config"},"auth_mode":{"type":"string","title":"Auth Mode","default":"proxy"},"admin_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Admin Email"},"admin_password":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Admin Password"}},"type":"object","required":["name"],"title":"CreateTenantIn"},"CreateTenantOut":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"api_key":{"type":"string","title":"Api Key"},"admin_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Admin Email"}},"type":"object","required":["tenant_id","api_key"],"title":"CreateTenantOut"},"CronIn":{"properties":{"every":{"type":"string","title":"Every"}},"type":"object","required":["every"],"title":"CronIn","description":"改检查频率。**只收 `CRONS` 里的键**，不收裸 cron。"},"CustomDomainIn":{"properties":{"domain":{"type":"string","title":"Domain"},"agent_alias":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent Alias"}},"type":"object","required":["domain"],"title":"CustomDomainIn"},"CustomDomainOut":{"properties":{"domain":{"type":"string","title":"Domain"},"agent_alias":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent Alias"},"status":{"type":"string","title":"Status"},"cname_target":{"type":"string","title":"Cname Target"},"last_checked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Checked At"},"last_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Error"}},"type":"object","required":["domain","status","cname_target"],"title":"CustomDomainOut"},"DailyUsageOut":{"properties":{"servers":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Servers"},"points":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Points"}},"type":"object","required":["servers","points"],"title":"DailyUsageOut"},"DiagnosePromptIn":{"properties":{"field":{"type":"string","enum":["persona","task","greeting","storyline_task","storyline_opening","storyline_ai_trigger","storyline_ai_criteria","skill_description","skill_instructions","kb_description","kb_instructions"],"title":"Field"},"current":{"type":"string","title":"Current","description":"该字段当前的文字；诊断需要有内容可读","default":""},"context":{"additionalProperties":true,"type":"object","title":"Context"}},"type":"object","required":["field"],"title":"DiagnosePromptIn"},"DiagnosePromptOut":{"properties":{"suggestions":{"items":{"type":"string"},"type":"array","title":"Suggestions"}},"type":"object","required":["suggestions"],"title":"DiagnosePromptOut"},"Diagnosis":{"properties":{"name":{"type":"string","title":"Name"},"label":{"type":"string","title":"Label"},"self_hit":{"type":"number","title":"Self Hit"},"stolen_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stolen By"},"verdict":{"type":"string","title":"Verdict"}},"type":"object","required":["name","label","self_hit","verdict"],"title":"Diagnosis"},"DocChunkOut":{"properties":{"id":{"type":"string","title":"Id"},"preview":{"type":"string","title":"Preview"},"chars":{"type":"integer","title":"Chars"},"embedded":{"type":"boolean","title":"Embedded"}},"type":"object","required":["id","preview","chars","embedded"],"title":"DocChunkOut","description":"一个切片的摘要。正文只给前若干字——详情页是给人扫一眼「切成了什么」，不是全文阅读器。"},"DocEntityOut":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"kind":{"type":"string","title":"Kind"},"mentions":{"type":"integer","title":"Mentions"}},"type":"object","required":["id","name","kind","mentions"],"title":"DocEntityOut"},"DocumentOut":{"properties":{"id":{"type":"string","title":"Id"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source"},"space_id":{"type":"string","title":"Space Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","space_id","created_at"],"title":"DocumentOut"},"DocumentPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/DocumentOut"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"DocumentPage"},"DraftIn":{"properties":{"brief":{"type":"string","title":"Brief"},"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"}},"type":"object","required":["brief"],"title":"DraftIn"},"DraftOut":{"properties":{"text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Text"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"}},"type":"object","required":["text"],"title":"DraftOut"},"EndUserTokenIn":{"properties":{"external_user_id":{"type":"string","title":"External User Id"},"ttl":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Ttl"}},"type":"object","required":["external_user_id"],"title":"EndUserTokenIn"},"EndUserTokenOut":{"properties":{"token":{"type":"string","title":"Token"},"external_user_id":{"type":"string","title":"External User Id"},"expires_in":{"type":"integer","title":"Expires In"}},"type":"object","required":["token","external_user_id","expires_in"],"title":"EndUserTokenOut"},"EnrollmentOut":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"user_id":{"type":"string","format":"uuid","title":"User Id"},"current_node_key":{"type":"string","title":"Current Node Key"},"status":{"type":"string","title":"Status"},"entered_node_at":{"type":"string","format":"date-time","title":"Entered Node At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","user_id","current_node_key","status","entered_node_at","updated_at"],"title":"EnrollmentOut"},"Entry":{"properties":{"slug":{"type":"string","title":"Slug"},"title":{"type":"string","title":"Title"},"date":{"type":"string","title":"Date"},"kind":{"type":"string","title":"Kind","default":"new"},"summary":{"type":"string","title":"Summary","default":""},"href":{"type":"string","title":"Href","default":""},"fallback":{"type":"boolean","title":"Fallback","default":false}},"type":"object","required":["slug","title","date"],"title":"Entry"},"EventOut":{"properties":{"seq":{"type":"integer","title":"Seq"},"kind":{"type":"string","title":"Kind"},"payload":{"additionalProperties":true,"type":"object","title":"Payload"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["seq","kind","payload","created_at"],"title":"EventOut"},"FetchModelsIn":{"properties":{"base_url":{"type":"string","title":"Base Url"},"api_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Api Key"},"id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Id"}},"type":"object","required":["base_url"],"title":"FetchModelsIn"},"FetchModelsOut":{"properties":{"models":{"items":{"type":"string"},"type":"array","title":"Models"},"detail":{"items":{"$ref":"#/components/schemas/FetchedModel"},"type":"array","title":"Detail","default":[]},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["models"],"title":"FetchModelsOut"},"FetchedModel":{"properties":{"id":{"type":"string","title":"Id"},"kind":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kind"}},"type":"object","required":["id"],"title":"FetchedModel"},"FunnelOut":{"properties":{"nodes":{"additionalProperties":{"additionalProperties":{"type":"integer"},"type":"object"},"type":"object","title":"Nodes"}},"type":"object","required":["nodes"],"title":"FunnelOut"},"GapOut":{"properties":{"question":{"type":"string","title":"Question"},"times":{"type":"integer","title":"Times"},"last_at":{"type":"string","title":"Last At"},"agents":{"items":{"type":"string"},"type":"array","title":"Agents","default":[]},"read":{"type":"boolean","title":"Read","default":false}},"type":"object","required":["question","times","last_at"],"title":"GapOut"},"GapReadIn":{"properties":{"questions":{"items":{"type":"string"},"type":"array","title":"Questions"}},"type":"object","required":["questions"],"title":"GapReadIn"},"GreetingOut":{"properties":{"text":{"type":"string","title":"Text"}},"type":"object","required":["text"],"title":"GreetingOut"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ImprovePromptIn":{"properties":{"field":{"type":"string","enum":["persona","task","greeting","storyline_task","storyline_opening","storyline_ai_trigger","storyline_ai_criteria","skill_description","skill_instructions","kb_description","kb_instructions"],"title":"Field","description":"在编辑哪个字段，决定改写目标（见 app/assist/prompt_helper.py 的 FIELDS）"},"current":{"type":"string","title":"Current","description":"该字段当前的文字；留空表示从零起草","default":""},"hint":{"type":"string","title":"Hint","description":"用户这次想要的方向/提示；留空则做通用打磨","default":""},"context":{"additionalProperties":true,"type":"object","title":"Context"}},"type":"object","required":["field"],"title":"ImprovePromptIn"},"ImprovePromptOut":{"properties":{"improved":{"type":"string","title":"Improved"}},"type":"object","required":["improved"],"title":"ImprovePromptOut"},"IngestIn":{"properties":{"title":{"type":"string","title":"Title"},"content":{"type":"string","title":"Content"},"content_type":{"type":"string","title":"Content Type","default":"text/plain"},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source"}},"type":"object","required":["title","content"],"title":"IngestIn"},"IngestOut":{"properties":{"document_id":{"type":"string","title":"Document Id","default":""},"chunks":{"type":"integer","title":"Chunks","default":0},"needs_vision_confirm":{"type":"boolean","title":"Needs Vision Confirm","default":false},"figures":{"type":"integer","title":"Figures","default":0}},"type":"object","title":"IngestOut"},"IssuedKeyOut":{"properties":{"id":{"type":"string","title":"Id"},"api_key":{"type":"string","title":"Api Key"}},"type":"object","required":["id","api_key"],"title":"IssuedKeyOut"},"KbButtonOut":{"properties":{"item_id":{"type":"string","title":"Item Id"},"title":{"type":"string","title":"Title"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"effective":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Effective"},"added":{"type":"boolean","title":"Added","default":false}},"type":"object","required":["item_id","title"],"title":"KbButtonOut"},"KbChunkOut":{"properties":{"id":{"type":"string","title":"Id"},"content":{"type":"string","title":"Content"},"index_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Index Text"},"doc_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Doc Id"},"doc_title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Doc Title"},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source"},"edited_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Edited At"}},"type":"object","required":["id","content"],"title":"KbChunkOut"},"KbChunkPatchIn":{"properties":{"content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content"},"index_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Index Text"}},"type":"object","title":"KbChunkPatchIn","description":"改一片。两个字段各自可选，**都不传就是一次空操作**（拒绝，而不是悄悄记一次编辑）。"},"KbChunkSearchIn":{"properties":{"chunk_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Chunk Id"},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source"},"text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Text"},"limit":{"type":"integer","maximum":200.0,"minimum":1.0,"title":"Limit","default":30},"edited_only":{"type":"boolean","title":"Edited Only","default":false}},"type":"object","title":"KbChunkSearchIn","description":"在一个知识库里把某一片找出来。三个入口，因为它们各自在不同的时候是唯一能用的那个。"},"KbDocOut":{"properties":{"id":{"type":"string","title":"Id"},"title":{"type":"string","title":"Title"},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source"},"tags":{"items":{"type":"string"},"type":"array","title":"Tags","default":[]},"chunks":{"type":"integer","title":"Chunks","default":0}},"type":"object","required":["id","title","source"],"title":"KbDocOut"},"KbIn":{"properties":{"instructions":{"type":"string","title":"Instructions","default":""},"description":{"type":"string","title":"Description","default":""},"max_distance":{"anyOf":[{"type":"number","maximum":2.0,"minimum":0.0},{"type":"null"}],"title":"Max Distance"},"top_k":{"anyOf":[{"type":"integer","maximum":10.0,"minimum":1.0},{"type":"null"}],"title":"Top K"},"rerank":{"type":"boolean","title":"Rerank","default":false},"recall_eval":{"type":"boolean","title":"Recall Eval","default":false},"kind":{"type":"string","title":"Kind","default":"text"}},"type":"object","title":"KbIn"},"KbIndexBuildIn":{"properties":{"roles":{"items":{"type":"string"},"type":"array","title":"Roles"}},"type":"object","title":"KbIndexBuildIn"},"KbIndexPatchIn":{"properties":{"request":{"type":"string","maxLength":500,"minLength":1,"title":"Request"},"apply":{"type":"boolean","title":"Apply","default":false}},"type":"object","required":["request"],"title":"KbIndexPatchIn"},"KbIngestOut":{"properties":{"document_id":{"type":"string","title":"Document Id"},"chunks":{"type":"integer","title":"Chunks"},"imported":{"type":"integer","title":"Imported","default":1},"chunked_anyway":{"items":{"type":"string"},"type":"array","title":"Chunked Anyway","default":[]}},"type":"object","required":["document_id","chunks"],"title":"KbIngestOut"},"KbOut":{"properties":{"name":{"type":"string","title":"Name"},"kind":{"type":"string","title":"Kind","default":"text"},"instructions":{"type":"string","title":"Instructions"},"description":{"type":"string","title":"Description"},"max_distance":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Max Distance"},"top_k":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Top K"},"rerank":{"type":"boolean","title":"Rerank","default":false},"recall_eval":{"type":"boolean","title":"Recall Eval","default":false},"documents":{"type":"integer","title":"Documents","default":0},"chunks":{"type":"integer","title":"Chunks","default":0},"chunk_spread":{"anyOf":[{"items":{"type":"integer"},"type":"array"},{"type":"null"}],"title":"Chunk Spread"},"edited_chunks":{"type":"integer","title":"Edited Chunks","default":0}},"type":"object","required":["name","instructions","description","max_distance"],"title":"KbOut"},"KbPatch":{"properties":{"instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Instructions"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"max_distance":{"anyOf":[{"type":"number","maximum":2.0,"minimum":0.0},{"type":"null"}],"title":"Max Distance"},"top_k":{"anyOf":[{"type":"integer","maximum":10.0,"minimum":1.0},{"type":"null"}],"title":"Top K"},"rerank":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Rerank"},"recall_eval":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Recall Eval"}},"type":"object","title":"KbPatch","description":"只改传来的字段（语义同 AgentPatch）。`kind` 不在此列——建库后不可变（见 upsert_kb）。"},"KbPurgeIn":{"properties":{"confirm_name":{"type":"string","title":"Confirm Name"}},"type":"object","required":["confirm_name"],"title":"KbPurgeIn"},"KbSearchHit":{"properties":{"kb":{"type":"string","title":"Kb"},"content":{"type":"string","title":"Content"},"distance":{"type":"number","title":"Distance"},"index_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Index Text"}},"type":"object","required":["kb","content","distance"],"title":"KbSearchHit"},"KbSearchIn":{"properties":{"query":{"type":"string","title":"Query"},"k":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"K"}},"type":"object","required":["query"],"title":"KbSearchIn"},"KbTagsIn":{"properties":{"tags":{"items":{"type":"string"},"type":"array","title":"Tags"}},"type":"object","required":["tags"],"title":"KbTagsIn"},"KbTextIn":{"properties":{"title":{"type":"string","title":"Title"},"content":{"type":"string","title":"Content"},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source"},"no_chunk":{"type":"boolean","title":"No Chunk","default":false}},"type":"object","required":["title","content"],"title":"KbTextIn"},"KeyIssueIn":{"properties":{"name":{"type":"string","title":"Name","default":"default"}},"type":"object","title":"KeyIssueIn"},"KeywordsIn":{"properties":{"keywords":{"items":{"type":"string"},"type":"array","title":"Keywords"}},"type":"object","required":["keywords"],"title":"KeywordsIn"},"LibraryOut":{"properties":{"enabled":{"type":"boolean","title":"Enabled"},"tenant_id":{"type":"string","title":"Tenant Id"},"skills":{"items":{"$ref":"#/components/schemas/app__api__admin_platform_skills__SkillOut"},"type":"array","title":"Skills"}},"type":"object","required":["enabled","tenant_id","skills"],"title":"LibraryOut"},"LiveOut":{"properties":{"running":{"type":"boolean","title":"Running"},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Started At"},"steps":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Steps","default":[]},"cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"},"took_s":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Took S"},"tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tokens"},"footer":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Footer"}},"type":"object","required":["running"],"title":"LiveOut","description":"跑到哪儿了。`running=False` 时前端停轮询、翻成\"看报告\"。"},"LoginOut":{"properties":{"token":{"type":"string","title":"Token"},"role":{"type":"string","title":"Role"},"subject":{"type":"string","title":"Subject"},"tenant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"}},"type":"object","required":["token","role","subject"],"title":"LoginOut"},"ManualIn":{"properties":{"title":{"type":"string","title":"Title","default":""},"topic":{"type":"string","title":"Topic"},"urls":{"items":{"type":"string"},"type":"array","title":"Urls"},"cron":{"type":"string","title":"Cron","default":"0 8 * * *"},"tz":{"type":"string","title":"Tz","default":"UTC"},"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"}},"type":"object","required":["topic","urls"],"title":"ManualIn","description":"**自己给网址**建一个跟踪。\n\n这不只是\"另一种入口\"——线上实跑那次，模型推荐的 4 个网址里 3 个是 404。用户自己给的\n那个，是目前更可靠的一条路。整条链上不叫模型选源；判断相关性时用的是他自己写的\n`topic`，那比模型归纳过一轮的版本更贴近他真正想要的东西。"},"MaterialIn":{"properties":{"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"lang_explicit":{"type":"boolean","title":"Lang Explicit","default":false},"end_user":{"type":"string","title":"End User","default":""},"end_user_proof":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End User Proof"},"page_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Key"},"page_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Url"},"id_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id Token"},"host_uid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Uid"},"host_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Ts"},"host_sig":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Sig"},"space_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Id"},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source"},"text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Text"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"file":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"}},"type":"object","title":"MaterialIn"},"McpServerIn":{"properties":{"name":{"type":"string","title":"Name"},"transport":{"type":"string","title":"Transport","default":"streamable_http"},"config":{"additionalProperties":true,"type":"object","title":"Config","default":{}},"enabled":{"type":"boolean","title":"Enabled","default":true}},"type":"object","required":["name"],"title":"McpServerIn"},"McpServerOut":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"transport":{"type":"string","title":"Transport"},"enabled":{"type":"boolean","title":"Enabled"},"config":{"additionalProperties":true,"type":"object","title":"Config"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"last_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Error"},"discovered_tools":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Discovered Tools"},"last_checked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Checked At"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","name","transport","enabled","config","created_at","updated_at"],"title":"McpServerOut"},"McpServerPatch":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"transport":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Transport"},"config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Config"},"enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enabled"}},"type":"object","title":"McpServerPatch"},"MeOut":{"properties":{"role":{"type":"string","title":"Role"},"subject":{"type":"string","title":"Subject"},"tenant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"}},"type":"object","required":["role","subject"],"title":"MeOut"},"MemoryOut":{"properties":{"id":{"type":"string","title":"Id"},"kind":{"type":"string","title":"Kind"},"topic":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Topic"},"importance":{"type":"integer","title":"Importance"},"content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updated At"}},"type":"object","required":["id","kind","importance","created_at"],"title":"MemoryOut"},"MessageEditIn":{"properties":{"content":{"type":"string","title":"Content"}},"type":"object","required":["content"],"title":"MessageEditIn"},"MessageOut":{"properties":{"id":{"type":"string","title":"Id"},"role":{"type":"string","title":"Role"},"agent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent"},"content":{"type":"string","title":"Content"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"attachments":{"items":{"$ref":"#/components/schemas/MsgAttachmentOut"},"type":"array","title":"Attachments","default":[]},"citations":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Citations","default":[]},"steps":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Steps","default":[]}},"type":"object","required":["id","role","content","created_at"],"title":"MessageOut"},"MessagePage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/MessageOut"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"MessagePage"},"MigrateIn":{"properties":{"action":{"type":"string","title":"Action"},"from_node":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"From Node"},"to_node":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"To Node"}},"type":"object","required":["action"],"title":"MigrateIn"},"MissedIn":{"properties":{"item_id":{"type":"string","format":"uuid","title":"Item Id"},"suggest_keywords":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Suggest Keywords"}},"type":"object","required":["item_id"],"title":"MissedIn"},"ModelBackendIn":{"properties":{"name":{"type":"string","title":"Name"},"kind":{"type":"string","title":"Kind","default":"chat"},"base_url":{"type":"string","title":"Base Url"},"model":{"type":"string","title":"Model"},"api_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Api Key"},"weight":{"type":"integer","title":"Weight","default":1},"enabled":{"type":"boolean","title":"Enabled","default":true},"exclusive":{"type":"boolean","title":"Exclusive","default":false},"max_parallel":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Parallel"}},"type":"object","required":["name","base_url","model"],"title":"ModelBackendIn"},"ModelBackendOut":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"kind":{"type":"string","title":"Kind"},"base_url":{"type":"string","title":"Base Url"},"model":{"type":"string","title":"Model"},"weight":{"type":"integer","title":"Weight"},"enabled":{"type":"boolean","title":"Enabled"},"exclusive":{"type":"boolean","title":"Exclusive","default":false},"supports_vision":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Supports Vision"},"n_ctx":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"N Ctx"},"max_parallel":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Parallel"},"has_api_key":{"type":"boolean","title":"Has Api Key"},"status":{"type":"string","title":"Status"},"last_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Error"},"last_checked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Checked At"},"assigned_sessions":{"type":"integer","title":"Assigned Sessions","default":0},"total_tokens":{"type":"integer","title":"Total Tokens","default":0},"prompt_tokens":{"type":"integer","title":"Prompt Tokens","default":0},"completion_tokens":{"type":"integer","title":"Completion Tokens","default":0},"audio_ms":{"type":"integer","title":"Audio Ms","default":0},"text_words":{"type":"integer","title":"Text Words","default":0},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","name","kind","base_url","model","weight","enabled","has_api_key","status","created_at"],"title":"ModelBackendOut"},"ModelBackendPatch":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"kind":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kind"},"base_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Base Url"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"},"api_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Api Key"},"weight":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Weight"},"enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enabled"},"exclusive":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Exclusive"},"supports_vision":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Supports Vision"},"n_ctx":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"N Ctx"},"max_parallel":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Parallel"}},"type":"object","title":"ModelBackendPatch"},"MonitorOut":{"properties":{"id":{"type":"string","title":"Id"},"title":{"type":"string","title":"Title"},"status":{"type":"string","title":"Status"},"cron":{"type":"string","title":"Cron"},"tz":{"type":"string","title":"Tz"},"keywords":{"items":{"type":"string"},"type":"array","title":"Keywords","default":[]},"notify_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notify Email"},"email_verified":{"type":"boolean","title":"Email Verified","default":false},"notify_channel":{"type":"string","title":"Notify Channel","default":"chat"},"delivery_failing":{"type":"boolean","title":"Delivery Failing","default":false},"plan":{"anyOf":[{"$ref":"#/components/schemas/PlanView"},{"type":"null"}]},"next_run_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Run At"},"running_now":{"type":"boolean","title":"Running Now","default":false},"sources":{"items":{"$ref":"#/components/schemas/SourceOut"},"type":"array","title":"Sources","default":[]}},"type":"object","required":["id","title","status","cron","tz"],"title":"MonitorOut"},"MsgAttachmentOut":{"properties":{"id":{"type":"string","title":"Id"},"mime":{"type":"string","title":"Mime"},"name":{"type":"string","title":"Name","default":""}},"type":"object","required":["id","mime"],"title":"MsgAttachmentOut","description":"用户上传的图片/案件材料在消息回放里的回显（元信息；内容经 GET /manage/attachments/{id}\n带鉴权头取回，见 case_attachments.py）。"},"MyAttachmentOut":{"properties":{"id":{"type":"string","title":"Id"},"mime":{"type":"string","title":"Mime"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","mime","created_at"],"title":"MyAttachmentOut"},"MyDocDetailOut":{"properties":{"id":{"type":"string","title":"Id"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source"},"tags":{"items":{"type":"string"},"type":"array","title":"Tags","default":[]},"chunks":{"type":"integer","title":"Chunks"},"embedded":{"type":"integer","title":"Embedded"},"ready":{"type":"boolean","title":"Ready"},"status":{"type":"string","title":"Status"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"pages_total":{"type":"integer","title":"Pages Total","default":0},"pages_done":{"type":"integer","title":"Pages Done","default":0},"embed_total":{"type":"integer","title":"Embed Total","default":0},"embed_done":{"type":"integer","title":"Embed Done","default":0},"can_retry":{"type":"boolean","title":"Can Retry","default":true},"created_at":{"type":"string","format":"date-time","title":"Created At"},"chunk_list":{"items":{"$ref":"#/components/schemas/DocChunkOut"},"type":"array","title":"Chunk List","default":[]},"entities":{"items":{"$ref":"#/components/schemas/DocEntityOut"},"type":"array","title":"Entities","default":[]}},"type":"object","required":["id","chunks","embedded","ready","status","created_at"],"title":"MyDocDetailOut","description":"文档详情：入库到底产出了什么。\n\n「状态是 ready」和「这份文件被读懂了」是两回事——前者只说明切片落库了。\n用户没有办法看到切成了几块、每块是什么、抽出了哪些实体，于是「知识星云里没有我的东西」\n这类问题无从自查。这个接口就是把那层黑箱打开。"},"MyDocOut":{"properties":{"id":{"type":"string","title":"Id"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source"},"tags":{"items":{"type":"string"},"type":"array","title":"Tags","default":[]},"chunks":{"type":"integer","title":"Chunks"},"embedded":{"type":"integer","title":"Embedded"},"ready":{"type":"boolean","title":"Ready"},"status":{"type":"string","title":"Status"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"pages_total":{"type":"integer","title":"Pages Total","default":0},"pages_done":{"type":"integer","title":"Pages Done","default":0},"embed_total":{"type":"integer","title":"Embed Total","default":0},"embed_done":{"type":"integer","title":"Embed Done","default":0},"can_retry":{"type":"boolean","title":"Can Retry","default":true},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","chunks","embedded","ready","status","created_at"],"title":"MyDocOut"},"MyMemoryOut":{"properties":{"id":{"type":"string","title":"Id"},"kind":{"type":"string","title":"Kind"},"topic":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Topic"},"importance":{"type":"integer","title":"Importance"},"content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","kind","importance","created_at"],"title":"MyMemoryOut"},"MyMessageOut":{"properties":{"id":{"type":"string","title":"Id"},"role":{"type":"string","title":"Role"},"agent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent"},"content":{"type":"string","title":"Content"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"gen_ms":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Gen Ms"},"completion_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Completion Tokens"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"}},"type":"object","required":["id","role","content","created_at"],"title":"MyMessageOut"},"MyProfileIn":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"City"},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone"}},"type":"object","title":"MyProfileIn"},"MyProfileOut":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"City"},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone"},"detected_city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Detected City"},"detected_timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Detected Timezone"}},"type":"object","title":"MyProfileOut"},"MyRememberedOut":{"properties":{"agent_name":{"type":"string","title":"Agent Name"},"content":{"type":"string","title":"Content"}},"type":"object","required":["agent_name","content"],"title":"MyRememberedOut","description":"Agent 记住的关于我的内容（跨会话画像），按 Agent 分。"},"MyReminderOut":{"properties":{"id":{"type":"string","title":"Id"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"run_at":{"type":"string","format":"date-time","title":"Run At"},"cron":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cron"},"status":{"type":"string","title":"Status"},"channel":{"type":"string","title":"Channel"}},"type":"object","required":["id","run_at","status","channel"],"title":"MyReminderOut"},"MyReminderPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/MyReminderOut"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"MyReminderPage"},"MySessionOut":{"properties":{"id":{"type":"string","title":"Id"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"title_by_user":{"type":"boolean","title":"Title By User","default":false},"agent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent"},"message_count":{"type":"integer","title":"Message Count"},"unread":{"type":"integer","title":"Unread","default":0},"created_at":{"type":"string","format":"date-time","title":"Created At"},"prefill":{"type":"string","title":"Prefill","default":""}},"type":"object","required":["id","message_count","created_at"],"title":"MySessionOut"},"MySessionPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/MySessionOut"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"MySessionPage"},"MySessionSearchHit":{"properties":{"session_id":{"type":"string","title":"Session Id"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"snippet":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Snippet"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"source":{"type":"string","title":"Source"}},"type":"object","required":["session_id","created_at","source"],"title":"MySessionSearchHit"},"MySpaceOut":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"is_default":{"type":"boolean","title":"Is Default"},"agents":{"items":{"type":"string"},"type":"array","title":"Agents","default":[]},"session_count":{"type":"integer","title":"Session Count","default":0}},"type":"object","required":["id","name","is_default"],"title":"MySpaceOut"},"NewReminderIn":{"properties":{"instruction":{"type":"string","title":"Instruction"},"title":{"type":"string","title":"Title","default":""},"mode":{"type":"string","title":"Mode","default":"once"},"at":{"type":"string","title":"At","default":"09:00"},"date":{"type":"string","title":"Date","default":""},"weekday":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Weekday"},"day":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Day"},"tz_hint":{"type":"string","title":"Tz Hint","default":""}},"type":"object","required":["instruction"],"title":"NewReminderIn","description":"面板上那张表。**传的是意图，不是 cron**——见 `app/push/reminders.py` 的说明。"},"OauthCredIn":{"properties":{"client_id":{"type":"string","title":"Client Id"},"client_secret":{"type":"string","title":"Client Secret"}},"type":"object","required":["client_id","client_secret"],"title":"OauthCredIn"},"OauthEnabledIn":{"properties":{"enabled":{"type":"boolean","title":"Enabled"}},"type":"object","required":["enabled"],"title":"OauthEnabledIn"},"OauthProviderOut":{"properties":{"provider":{"type":"string","title":"Provider"},"client_id":{"type":"string","title":"Client Id"},"has_secret":{"type":"boolean","title":"Has Secret"},"enabled":{"type":"boolean","title":"Enabled","default":true},"creds_ok":{"type":"boolean","title":"Creds Ok","default":false},"effective":{"type":"boolean","title":"Effective","default":false},"redirect_uri":{"type":"string","title":"Redirect Uri","default":""}},"type":"object","required":["provider","client_id","has_secret"],"title":"OauthProviderOut"},"ObservedOut":{"properties":{"label":{"type":"string","title":"Label","default":""},"kind":{"type":"string","title":"Kind","default":""},"count":{"type":"integer","title":"Count","default":0},"sample":{"items":{"type":"string"},"type":"array","title":"Sample","default":[]},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"not_modified":{"type":"boolean","title":"Not Modified","default":false}},"type":"object","title":"ObservedOut"},"OpeningIn":{"properties":{"greeting":{"type":"string","title":"Greeting","default":""},"questions":{"items":{"type":"string"},"type":"array","title":"Questions","default":[]}},"type":"object","title":"OpeningIn","description":"这段对话开始时，访客屏幕上实际出现过的问候与破冰问题。"},"OutlineIn":{"properties":{"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"lang_explicit":{"type":"boolean","title":"Lang Explicit","default":false},"end_user":{"type":"string","title":"End User","default":""},"end_user_proof":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End User Proof"},"page_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Key"},"page_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Url"},"id_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id Token"},"host_uid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Uid"},"host_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Ts"},"host_sig":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Sig"},"space_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Id"},"sections":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Sections","default":[]}},"type":"object","title":"OutlineIn"},"OverviewOut":{"properties":{"tenants":{"type":"integer","title":"Tenants"},"tenants_disabled":{"type":"integer","title":"Tenants Disabled"},"users":{"type":"integer","title":"Users"},"messages":{"type":"integer","title":"Messages"},"documents":{"type":"integer","title":"Documents"}},"type":"object","required":["tenants","tenants_disabled","users","messages","documents"],"title":"OverviewOut"},"PageContextIn":{"properties":{"label":{"type":"string","title":"Label","default":""},"url_pattern":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url Pattern"},"context":{"type":"string","title":"Context","default":""},"greeting":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Greeting"},"questions":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Questions"},"greeting_mode":{"type":"string","title":"Greeting Mode","default":"static"},"is_default":{"type":"boolean","title":"Is Default","default":false},"position":{"type":"integer","title":"Position","default":0}},"type":"object","title":"PageContextIn"},"PageContextOut":{"properties":{"label":{"type":"string","title":"Label","default":""},"url_pattern":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url Pattern"},"context":{"type":"string","title":"Context","default":""},"greeting":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Greeting"},"questions":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Questions"},"greeting_mode":{"type":"string","title":"Greeting Mode","default":"static"},"is_default":{"type":"boolean","title":"Is Default","default":false},"position":{"type":"integer","title":"Position","default":0},"key":{"type":"string","title":"Key"},"generated_langs":{"items":{"type":"string"},"type":"array","title":"Generated Langs"}},"type":"object","required":["key"],"title":"PageContextOut"},"PageOut":{"properties":{"url":{"type":"string","title":"Url"},"status":{"type":"string","title":"Status"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"chars":{"type":"integer","title":"Chars"},"review":{"type":"string","title":"Review"},"review_note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Review Note"},"similar_to":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Similar To"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["url","status","title","chars","review","review_note","similar_to","error"],"title":"PageOut"},"PasswordIn":{"properties":{"new_password":{"type":"string","title":"New Password"}},"type":"object","required":["new_password"],"title":"PasswordIn"},"PauseIn":{"properties":{"paused":{"type":"boolean","title":"Paused","default":true}},"type":"object","title":"PauseIn"},"PlanView":{"properties":{"subject":{"type":"string","title":"Subject","default":""},"affects":{"items":{"type":"string"},"type":"array","title":"Affects","default":[]},"excludes":{"items":{"type":"string"},"type":"array","title":"Excludes","default":[]},"rubric":{"type":"string","title":"Rubric","default":""},"keywords":{"items":{"type":"string"},"type":"array","title":"Keywords","default":[]},"queries":{"items":{"type":"string"},"type":"array","title":"Queries","default":[]},"query_hits":{"additionalProperties":{"type":"integer"},"type":"object","title":"Query Hits","default":{}},"picture":{"type":"string","title":"Picture","default":""}},"type":"object","title":"PlanView","description":"确认屏摆的**计划**（2026-08-17 主人定的方向）。\n\n此前这一屏摆的是网址清单，而 `rubric`——决定什么会被报、什么被忽略的那一条——\n是隐形的。**主次反了**：判据判错，盯再多网址也没用；判据判对，少一两个源无所谓。"},"PlannerConfigIn":{"properties":{"enabled":{"type":"boolean","title":"Enabled"},"backend_ids":{"items":{"type":"string"},"type":"array","title":"Backend Ids","default":[]}},"type":"object","required":["enabled"],"title":"PlannerConfigIn"},"PlannerTenantRow":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"name":{"type":"string","title":"Name"},"enabled":{"type":"boolean","title":"Enabled"},"backend_ids":{"items":{"type":"string"},"type":"array","title":"Backend Ids"},"backend_names":{"items":{"type":"string"},"type":"array","title":"Backend Names"},"calls":{"type":"integer","title":"Calls"},"prompt_tokens":{"type":"integer","title":"Prompt Tokens"},"completion_tokens":{"type":"integer","title":"Completion Tokens"},"total_tokens":{"type":"integer","title":"Total Tokens"}},"type":"object","required":["tenant_id","name","enabled","backend_ids","backend_names","calls","prompt_tokens","completion_tokens","total_tokens"],"title":"PlannerTenantRow"},"PlannerTriggerIn":{"properties":{"messages":{"items":{"type":"string"},"type":"array","maxItems":6,"minItems":1,"title":"Messages"},"samples":{"type":"integer","maximum":5.0,"minimum":1.0,"title":"Samples","default":1},"expect":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Expect"}},"type":"object","required":["messages"],"title":"PlannerTriggerIn"},"PlannerTriggerOut":{"properties":{"triggered":{"type":"integer","title":"Triggered"},"samples":{"type":"integer","title":"Samples"},"goals":{"items":{"type":"string"},"type":"array","title":"Goals"},"domain":{"type":"string","title":"Domain"},"matched":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Matched"}},"type":"object","required":["triggered","samples","goals","domain"],"title":"PlannerTriggerOut"},"PlaybookHitIn":{"properties":{"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"lang_explicit":{"type":"boolean","title":"Lang Explicit","default":false},"end_user":{"type":"string","title":"End User","default":""},"end_user_proof":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End User Proof"},"page_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Key"},"page_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Url"},"id_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id Token"},"host_uid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Uid"},"host_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Ts"},"host_sig":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Sig"},"space_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Id"},"key":{"type":"string","title":"Key","default":""},"question_index":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Question Index"}},"type":"object","title":"PlaybookHitIn"},"PlaybookOut":{"properties":{"key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Key"},"greeting":{"type":"string","title":"Greeting","default":""},"questions":{"items":{"type":"string"},"type":"array","title":"Questions","default":[]}},"type":"object","title":"PlaybookOut"},"PlaybookStat":{"properties":{"key":{"type":"string","title":"Key"},"opened":{"type":"integer","title":"Opened","default":0},"question_clicks":{"type":"integer","title":"Question Clicks","default":0},"per_question":{"additionalProperties":{"type":"integer"},"type":"object","title":"Per Question"}},"type":"object","required":["key"],"title":"PlaybookStat"},"PlaybookTemplate":{"properties":{"key":{"type":"string","title":"Key"},"label":{"type":"string","title":"Label"},"context_hint":{"type":"string","title":"Context Hint"},"questions":{"items":{"type":"string"},"type":"array","title":"Questions"}},"type":"object","required":["key","label","context_hint","questions"],"title":"PlaybookTemplate"},"PrefsOut":{"properties":{"prefs":{"additionalProperties":true,"type":"object","title":"Prefs"}},"type":"object","required":["prefs"],"title":"PrefsOut"},"PreviewPlanIn":{"properties":{"goal":{"type":"string","maxLength":2000,"minLength":4,"title":"Goal"}},"type":"object","required":["goal"],"title":"PreviewPlanIn"},"PreviewPlanOut":{"properties":{"plan":{"additionalProperties":true,"type":"object","title":"Plan"},"backend":{"type":"string","title":"Backend"},"warnings":{"items":{"type":"string"},"type":"array","title":"Warnings"}},"type":"object","required":["plan","backend","warnings"],"title":"PreviewPlanOut"},"ProbeOut":{"properties":{"called":{"type":"boolean","title":"Called"},"tool":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tool"},"arguments":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Arguments"},"executed":{"type":"boolean","title":"Executed","default":false},"result":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Result"},"reply":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reply"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["called"],"title":"ProbeOut"},"ProductIn":{"properties":{"name":{"type":"string","maxLength":500,"minLength":1,"title":"Name"},"description":{"type":"string","title":"Description","default":""},"price":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Price"},"availability":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Availability"},"category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"},"tags":{"items":{"type":"string"},"type":"array","title":"Tags","default":[]},"image_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image Url"},"image_urls":{"items":{"type":"string"},"type":"array","title":"Image Urls","default":[]},"link":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Link"}},"type":"object","required":["name"],"title":"ProductIn"},"ProductOut":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"price":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Price"},"availability":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Availability"},"category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"},"tags":{"items":{"type":"string"},"type":"array","title":"Tags"},"image_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Image Url"},"image_urls":{"items":{"type":"string"},"type":"array","title":"Image Urls"},"link":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Link"},"source":{"type":"string","title":"Source"}},"type":"object","required":["id","name","description","price","availability","category","tags","image_url","image_urls","link","source"],"title":"ProductOut"},"ProfileIn":{"properties":{"content":{"type":"string","title":"Content"}},"type":"object","required":["content"],"title":"ProfileIn"},"ProfileOut":{"properties":{"id":{"type":"string","title":"Id"},"agent_name":{"type":"string","title":"Agent Name"},"content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","agent_name","updated_at"],"title":"ProfileOut"},"PublishConvIn":{"properties":{"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"lang_explicit":{"type":"boolean","title":"Lang Explicit","default":false},"end_user":{"type":"string","title":"End User","default":""},"end_user_proof":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End User Proof"},"page_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Key"},"page_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Url"},"id_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id Token"},"host_uid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Uid"},"host_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Ts"},"host_sig":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Sig"},"space_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Id"},"mode":{"type":"string","title":"Mode","default":"replay"},"allow_continue":{"type":"boolean","title":"Allow Continue","default":true},"include_docs":{"type":"boolean","title":"Include Docs","default":false},"opening":{"anyOf":[{"$ref":"#/components/schemas/OpeningIn"},{"type":"null"}]}},"type":"object","title":"PublishConvIn"},"PublishConvOut":{"properties":{"token":{"type":"string","title":"Token"},"url":{"type":"string","title":"Url"},"qr_url":{"type":"string","title":"Qr Url"},"mode":{"type":"string","title":"Mode"},"allow_continue":{"type":"boolean","title":"Allow Continue"},"message_count":{"type":"integer","title":"Message Count"},"doc_count":{"type":"integer","title":"Doc Count","default":0}},"type":"object","required":["token","url","qr_url","mode","allow_continue","message_count"],"title":"PublishConvOut"},"PwaOut":{"properties":{"install_prompt":{"type":"string","title":"Install Prompt","default":"banner"},"favicon_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Favicon Url"},"icon192_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Icon192 Url"},"icon512_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Icon512 Url"},"icon_maskable_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Icon Maskable Url"}},"type":"object","title":"PwaOut"},"PwaPatch":{"properties":{"install_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Install Prompt"}},"type":"object","title":"PwaPatch"},"QuestionOut":{"properties":{"info_key":{"type":"string","title":"Info Key"},"prompt":{"type":"string","title":"Prompt","default":""},"why":{"type":"string","title":"Why","default":""},"spec":{"additionalProperties":true,"type":"object","title":"Spec","default":{}},"status":{"type":"string","title":"Status"},"blocks":{"items":{"type":"string"},"type":"array","title":"Blocks","default":[]}},"type":"object","required":["info_key","status"],"title":"QuestionOut"},"RegisterIn":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"email":{"type":"string","title":"Email"},"password":{"type":"string","title":"Password"}},"type":"object","required":["tenant_id","email","password"],"title":"RegisterIn"},"RenameIn":{"properties":{"title":{"type":"string","title":"Title"}},"type":"object","required":["title"],"title":"RenameIn","description":"给这个跟踪改个名字。"},"ReportOut":{"properties":{"token":{"type":"string","title":"Token"},"title":{"type":"string","title":"Title"},"created_at":{"type":"string","title":"Created At"},"share_url":{"type":"string","title":"Share Url","default":""},"pdf_url":{"type":"string","title":"Pdf Url","default":""}},"type":"object","required":["token","title","created_at"],"title":"ReportOut"},"ReportPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ReportOut"},"type":"array","title":"Items","default":[]},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","title":"ReportPage","description":"一页报告。`next_cursor` 为空 = 到底了。"},"ReportView":{"properties":{"title":{"type":"string","title":"Title","default":""},"html":{"type":"string","title":"Html","default":""},"created_at":{"type":"string","title":"Created At","default":""},"share_url":{"type":"string","title":"Share Url","default":""},"pdf_url":{"type":"string","title":"Pdf Url","default":""}},"type":"object","title":"ReportView","description":"一份报告的正文，**给面板自己渲染用**。\n\n`/r/{token}` 是一张独立网页（邮件里那条链接落在它上面）。面板里点开报告不该跳出去：\n人正在这一屏读\"它看到了什么\"，新开一个标签页等于把上下文丢掉，而回来还得重新找。\n这条走 `/me/*`，鉴权和这一族其余接口完全一样——**面板里的人本来就带着身份**。"},"RequirementsIn":{"properties":{"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"lang_explicit":{"type":"boolean","title":"Lang Explicit","default":false},"end_user":{"type":"string","title":"End User","default":""},"end_user_proof":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End User Proof"},"page_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Key"},"page_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Url"},"id_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id Token"},"host_uid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Uid"},"host_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Ts"},"host_sig":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Sig"},"space_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Id"},"requirements":{"type":"string","title":"Requirements","default":""},"version":{"type":"integer","title":"Version","default":0},"rerun":{"type":"boolean","title":"Rerun","default":true}},"type":"object","title":"RequirementsIn"},"ResetIn":{"properties":{"token":{"type":"string","title":"Token"},"new_password":{"type":"string","title":"New Password"}},"type":"object","required":["token","new_password"],"title":"ResetIn"},"ResolveOut":{"properties":{"key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Key"},"label":{"type":"string","title":"Label","default":""},"matched_by":{"type":"string","title":"Matched By","default":"none"}},"type":"object","title":"ResolveOut"},"RestoreIn":{"properties":{"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"lang_explicit":{"type":"boolean","title":"Lang Explicit","default":false},"end_user":{"type":"string","title":"End User","default":""},"end_user_proof":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End User Proof"},"page_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Key"},"page_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Url"},"id_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id Token"},"host_uid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Uid"},"host_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Ts"},"host_sig":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Sig"},"space_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Id"},"no":{"type":"integer","title":"No","default":0},"version":{"type":"integer","title":"Version","default":0}},"type":"object","title":"RestoreIn"},"RevealOut":{"properties":{"config":{"additionalProperties":true,"type":"object","title":"Config"}},"type":"object","required":["config"],"title":"RevealOut"},"ReviewOut":{"properties":{"id":{"type":"string","title":"Id"},"question":{"type":"string","title":"Question"},"answer":{"type":"string","title":"Answer"},"source_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Url"},"source_title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Title"},"unsourced":{"items":{"type":"string"},"type":"array","title":"Unsourced","default":[]},"source_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Text"},"agent_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent Name"},"kb_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kb Name"},"status":{"type":"string","title":"Status"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","question","answer","source_url","source_title","agent_name","kb_name","status","created_at"],"title":"ReviewOut"},"ReviseOut":{"properties":{"plan":{"$ref":"#/components/schemas/PlanView"},"added":{"items":{"type":"string"},"type":"array","title":"Added","default":[]},"removed":{"items":{"type":"string"},"type":"array","title":"Removed","default":[]},"rubric_changed":{"type":"boolean","title":"Rubric Changed","default":false},"unchanged":{"type":"boolean","title":"Unchanged","default":false},"why":{"type":"string","title":"Why","default":""}},"type":"object","required":["plan"],"title":"ReviseOut"},"RevisionsIn":{"properties":{"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"lang_explicit":{"type":"boolean","title":"Lang Explicit","default":false},"end_user":{"type":"string","title":"End User","default":""},"end_user_proof":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End User Proof"},"page_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Key"},"page_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Url"},"id_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id Token"},"host_uid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Uid"},"host_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Ts"},"host_sig":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Sig"},"space_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Id"},"no":{"type":"integer","title":"No","default":0}},"type":"object","title":"RevisionsIn"},"RunDetailOut":{"properties":{"run":{"$ref":"#/components/schemas/RunOut"},"sections":{"items":{"$ref":"#/components/schemas/SectionOut"},"type":"array","title":"Sections"},"questions":{"items":{"$ref":"#/components/schemas/QuestionOut"},"type":"array","title":"Questions"},"last_seq":{"type":"integer","title":"Last Seq","default":0}},"type":"object","required":["run","sections","questions"],"title":"RunDetailOut"},"RunNowOut":{"properties":{"ok":{"type":"boolean","title":"Ok","default":false},"reason":{"type":"string","title":"Reason","default":""},"observed":{"items":{"$ref":"#/components/schemas/ObservedOut"},"type":"array","title":"Observed","default":[]},"checked":{"type":"integer","title":"Checked","default":0},"new_items":{"type":"integer","title":"New Items","default":0},"changed_pages":{"type":"integer","title":"Changed Pages","default":0},"gone_items":{"type":"integer","title":"Gone Items","default":0},"relevant":{"type":"integer","title":"Relevant","default":0},"failures":{"type":"integer","title":"Failures","default":0},"token":{"type":"string","title":"Token","default":""},"report_not_emailed":{"type":"boolean","title":"Report Not Emailed","default":false},"email_unconfigured":{"type":"boolean","title":"Email Unconfigured","default":false}},"type":"object","title":"RunNowOut"},"RunOut":{"properties":{"id":{"type":"string","title":"Id"},"title":{"type":"string","title":"Title"},"status":{"type":"string","title":"Status"},"phase_detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phase Detail"},"lang":{"type":"string","title":"Lang","default":""},"type_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Type Name"},"sections_total":{"type":"integer","title":"Sections Total","default":0},"sections_done":{"type":"integer","title":"Sections Done","default":0},"words_total":{"type":"integer","title":"Words Total","default":0},"est_tokens":{"type":"integer","title":"Est Tokens","default":0},"error_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Code"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"version":{"type":"integer","title":"Version","default":0},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","title","status","created_at","updated_at"],"title":"RunOut"},"RunRow":{"properties":{"id":{"type":"string","title":"Id"},"user_id":{"type":"string","title":"User Id"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"type_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Type Name"},"agent_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent Name"},"status":{"type":"string","title":"Status"},"phase_detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phase Detail"},"lang":{"type":"string","title":"Lang","default":""},"sections_total":{"type":"integer","title":"Sections Total","default":0},"sections_done":{"type":"integer","title":"Sections Done","default":0},"words_total":{"type":"integer","title":"Words Total","default":0},"est_tokens":{"type":"integer","title":"Est Tokens","default":0},"tokens_used":{"type":"integer","title":"Tokens Used","default":0},"error_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Code"},"waiting":{"type":"boolean","title":"Waiting","default":false},"stuck":{"type":"boolean","title":"Stuck","default":false},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","user_id","status","created_at","updated_at"],"title":"RunRow"},"SaveSectionIn":{"properties":{"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"lang_explicit":{"type":"boolean","title":"Lang Explicit","default":false},"end_user":{"type":"string","title":"End User","default":""},"end_user_proof":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End User Proof"},"page_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Key"},"page_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Url"},"id_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id Token"},"host_uid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Uid"},"host_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Ts"},"host_sig":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Sig"},"space_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Id"},"body":{"type":"string","title":"Body","default":""},"version":{"type":"integer","title":"Version","default":0}},"type":"object","title":"SaveSectionIn"},"ScheduledTaskOut":{"properties":{"id":{"type":"string","title":"Id"},"user_id":{"type":"string","title":"User Id"},"external_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External User Id"},"space_id":{"type":"string","title":"Space Id"},"space_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Name"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"},"session_title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Title"},"agent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent"},"channel":{"type":"string","title":"Channel"},"kind":{"type":"string","title":"Kind","default":"followup"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"cron":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cron"},"status":{"type":"string","title":"Status"},"instruction":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Instruction"},"run_at":{"type":"string","format":"date-time","title":"Run At"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"last_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Error"}},"type":"object","required":["id","user_id","space_id","channel","status","run_at","created_at"],"title":"ScheduledTaskOut","description":"计划/跟进任务（AI 安排的延后跟进 + 未来的定时提醒共用 scheduled_tasks）。"},"ScheduledTaskPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ScheduledTaskOut"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"ScheduledTaskPage"},"SearchHit":{"properties":{"chunk_id":{"type":"string","title":"Chunk Id"},"document_id":{"type":"string","title":"Document Id"},"content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content"},"distance":{"type":"number","title":"Distance"}},"type":"object","required":["chunk_id","document_id","content","distance"],"title":"SearchHit"},"SearchIn":{"properties":{"query":{"type":"string","title":"Query"},"k":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"K"}},"type":"object","required":["query"],"title":"SearchIn"},"SecretOut":{"properties":{"secret":{"type":"string","title":"Secret"}},"type":"object","required":["secret"],"title":"SecretOut"},"SectionOut":{"properties":{"id":{"type":"string","title":"Id"},"key":{"type":"string","title":"Key"},"anchor":{"type":"string","title":"Anchor"},"parent_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Key"},"position":{"type":"integer","title":"Position"},"title":{"type":"string","title":"Title","default":""},"requirements":{"type":"string","title":"Requirements","default":""},"requirements_origin":{"type":"string","title":"Requirements Origin","default":"type"},"body":{"type":"string","title":"Body","default":""},"status":{"type":"string","title":"Status"},"needs":{"items":{"type":"string"},"type":"array","title":"Needs","default":[]},"words":{"type":"integer","title":"Words","default":0},"chars":{"type":"integer","title":"Chars","default":0},"version":{"type":"integer","title":"Version","default":0},"current_revision_no":{"type":"integer","title":"Current Revision No","default":0}},"type":"object","required":["id","key","anchor","position","status"],"title":"SectionOut"},"ServerUsageRow":{"properties":{"server_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Server Id"},"name":{"type":"string","title":"Name"},"prompt_tokens":{"type":"integer","title":"Prompt Tokens"},"completion_tokens":{"type":"integer","title":"Completion Tokens"},"total_tokens":{"type":"integer","title":"Total Tokens"},"events":{"type":"integer","title":"Events"},"sessions":{"type":"integer","title":"Sessions","default":0}},"type":"object","required":["server_id","name","prompt_tokens","completion_tokens","total_tokens","events"],"title":"ServerUsageRow"},"SessionOut":{"properties":{"id":{"type":"string","title":"Id"},"space_id":{"type":"string","title":"Space Id"},"agent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"message_count":{"type":"integer","title":"Message Count"},"tokens":{"type":"integer","title":"Tokens","default":0},"created_at":{"type":"string","format":"date-time","title":"Created At"},"last_message_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Message At"}},"type":"object","required":["id","space_id","message_count","created_at"],"title":"SessionOut"},"SessionPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/SessionOut"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"SessionPage"},"SessionTitleIn":{"properties":{"title":{"type":"string","title":"Title"}},"type":"object","required":["title"],"title":"SessionTitleIn"},"SetPasswordIn":{"properties":{"password":{"type":"string","title":"Password"}},"type":"object","required":["password"],"title":"SetPasswordIn"},"ShareAttachmentOut":{"properties":{"url":{"type":"string","title":"Url"},"mime":{"type":"string","title":"Mime"},"name":{"type":"string","title":"Name","default":""}},"type":"object","required":["url","mime"],"title":"ShareAttachmentOut","description":"用户上传的图片/案件材料在历史里的回显。url 是短时效签名链接（见 documents/download.py）。"},"ShareAuthIn":{"properties":{"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"lang_explicit":{"type":"boolean","title":"Lang Explicit","default":false},"end_user":{"type":"string","title":"End User","default":""},"end_user_proof":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End User Proof"},"page_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Key"},"page_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Url"},"id_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id Token"},"host_uid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Uid"},"host_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Ts"},"host_sig":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Sig"},"space_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Id"}},"type":"object","title":"ShareAuthIn","description":"keyless 请求携带的终端用户身份（按 auth_method 三选一）。"},"ShareChatIn":{"properties":{"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"lang_explicit":{"type":"boolean","title":"Lang Explicit","default":false},"end_user":{"type":"string","title":"End User","default":""},"end_user_proof":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End User Proof"},"page_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Key"},"page_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Url"},"id_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id Token"},"host_uid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Uid"},"host_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Ts"},"host_sig":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Sig"},"space_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Id"},"message":{"type":"string","title":"Message","default":""},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"},"images":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Images"},"files":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Files"},"audio":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Audio"},"client_pubkey":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Pubkey"},"picked":{"type":"boolean","title":"Picked","default":false},"intents":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Intents"},"modes":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Modes"},"writing_run":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Writing Run"},"viewing_report":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Viewing Report"}},"type":"object","title":"ShareChatIn"},"ShareClaimIn":{"properties":{"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"lang_explicit":{"type":"boolean","title":"Lang Explicit","default":false},"end_user":{"type":"string","title":"End User","default":""},"end_user_proof":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End User Proof"},"page_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Key"},"page_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Url"},"id_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id Token"},"host_uid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Uid"},"host_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Ts"},"host_sig":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Sig"},"space_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Id"}},"type":"object","title":"ShareClaimIn","description":"认领：把 end_user(+proof) 那段匿名咨询结转给 body 里的账号身份。\n\n继承 ShareAuthIn 是为了复用账号侧的三种身份证明；这里 end_user/end_user_proof 指的是\n**来源**（匿名），id_token 或 host_* 指的是**目标**（正式账号）。"},"ShareClaimOut":{"properties":{"claimed":{"type":"boolean","title":"Claimed"},"summary":{"type":"string","title":"Summary","default":""},"reason":{"type":"string","title":"Reason","default":""}},"type":"object","required":["claimed"],"title":"ShareClaimOut"},"ShareEnterIn":{"properties":{"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"lang_explicit":{"type":"boolean","title":"Lang Explicit","default":false},"end_user":{"type":"string","title":"End User","default":""},"end_user_proof":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End User Proof"},"page_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Key"},"page_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Url"},"id_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id Token"},"host_uid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Uid"},"host_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Ts"},"host_sig":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Sig"},"space_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Id"},"line_id":{"type":"string","title":"Line Id","default":""},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"}},"type":"object","title":"ShareEnterIn"},"ShareIn":{"properties":{"label":{"type":"string","title":"Label","default":""},"greeting":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Greeting"},"config":{"anyOf":[{"$ref":"#/components/schemas/WidgetConfig"},{"type":"null"}]}},"type":"object","title":"ShareIn"},"ShareInfo":{"properties":{"agent":{"type":"string","title":"Agent"},"label":{"type":"string","title":"Label"},"greeting":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Greeting"},"auto_greeting":{"type":"boolean","title":"Auto Greeting","default":false},"theme_color":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Theme Color"},"theme_color_fg":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Theme Color Fg"},"theme_color_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Theme Color Text"},"theme_color_text_dark":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Theme Color Text Dark"},"theme_color_2":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Theme Color 2"},"theme_color_2_fg":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Theme Color 2 Fg"},"theme_color_2_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Theme Color 2 Text"},"theme_color_2_text_dark":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Theme Color 2 Text Dark"},"logo_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Logo Url"},"launcher":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Launcher"},"stt":{"type":"boolean","title":"Stt","default":false},"input_mode":{"type":"string","title":"Input Mode","default":"text"},"install_prompt":{"type":"string","title":"Install Prompt","default":"banner"},"auth_method":{"type":"string","title":"Auth Method","default":"anonymous"},"planner":{"type":"boolean","title":"Planner","default":false},"canvas":{"type":"boolean","title":"Canvas","default":false},"writing_pdf":{"type":"boolean","title":"Writing Pdf","default":false},"capabilities":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Capabilities"},"tenant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"},"providers":{"items":{"type":"string"},"type":"array","title":"Providers","default":[]},"auto_open":{"type":"boolean","title":"Auto Open","default":false},"custom_css":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Custom Css"},"css_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Css Url"},"theme":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Theme"},"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"uploads":{"type":"boolean","title":"Uploads","default":false},"denied":{"type":"boolean","title":"Denied","default":false},"login_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Login Url"}},"type":"object","required":["agent","label"],"title":"ShareInfo"},"ShareMessageEditIn":{"properties":{"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"lang_explicit":{"type":"boolean","title":"Lang Explicit","default":false},"end_user":{"type":"string","title":"End User","default":""},"end_user_proof":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End User Proof"},"page_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Key"},"page_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Url"},"id_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id Token"},"host_uid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Uid"},"host_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Ts"},"host_sig":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Sig"},"space_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Id"},"content":{"type":"string","title":"Content"}},"type":"object","required":["content"],"title":"ShareMessageEditIn"},"ShareMessageOut":{"properties":{"id":{"type":"string","title":"Id"},"role":{"type":"string","title":"Role"},"content":{"type":"string","title":"Content"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"attachments":{"items":{"$ref":"#/components/schemas/ShareAttachmentOut"},"type":"array","title":"Attachments","default":[]},"citations":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Citations","default":[]},"suggestions":{"items":{"type":"string"},"type":"array","title":"Suggestions","default":[]},"steps":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Steps","default":[]}},"type":"object","required":["id","role","content","created_at"],"title":"ShareMessageOut"},"ShareOut":{"properties":{"token":{"type":"string","title":"Token"},"agent":{"type":"string","title":"Agent"},"label":{"type":"string","title":"Label"},"greeting":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Greeting"},"config":{"$ref":"#/components/schemas/WidgetConfig"},"has_secret":{"type":"boolean","title":"Has Secret"},"disabled":{"type":"boolean","title":"Disabled"},"internal":{"type":"boolean","title":"Internal","default":false},"url":{"type":"string","title":"Url"},"embed_url":{"type":"string","title":"Embed Url"},"public_base":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Public Base"},"css_warnings":{"items":{"additionalProperties":{"type":"string"},"type":"object"},"type":"array","title":"Css Warnings","default":[]}},"type":"object","required":["token","agent","label","config","has_secret","disabled","url","embed_url"],"title":"ShareOut"},"SharePatch":{"properties":{"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"},"greeting":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Greeting"},"config":{"anyOf":[{"$ref":"#/components/schemas/WidgetConfig"},{"type":"null"}]},"disabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Disabled"}},"type":"object","title":"SharePatch"},"SharePlanIn":{"properties":{"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"lang_explicit":{"type":"boolean","title":"Lang Explicit","default":false},"end_user":{"type":"string","title":"End User","default":""},"end_user_proof":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End User Proof"},"page_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Key"},"page_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Url"},"id_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id Token"},"host_uid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Uid"},"host_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Ts"},"host_sig":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Sig"},"space_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Id"},"goal":{"type":"string","title":"Goal","default":""},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"}},"type":"object","title":"SharePlanIn"},"ShareRenameIn":{"properties":{"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"lang_explicit":{"type":"boolean","title":"Lang Explicit","default":false},"end_user":{"type":"string","title":"End User","default":""},"end_user_proof":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End User Proof"},"page_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Key"},"page_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Url"},"id_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id Token"},"host_uid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Uid"},"host_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Ts"},"host_sig":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Sig"},"space_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Id"},"title":{"type":"string","title":"Title","default":""}},"type":"object","title":"ShareRenameIn"},"ShareRewindIn":{"properties":{"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"lang_explicit":{"type":"boolean","title":"Lang Explicit","default":false},"end_user":{"type":"string","title":"End User","default":""},"end_user_proof":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End User Proof"},"page_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Key"},"page_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Url"},"id_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id Token"},"host_uid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Uid"},"host_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Ts"},"host_sig":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Sig"},"space_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Id"},"node_key":{"type":"string","title":"Node Key","default":""}},"type":"object","title":"ShareRewindIn"},"ShareSearchIn":{"properties":{"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"lang_explicit":{"type":"boolean","title":"Lang Explicit","default":false},"end_user":{"type":"string","title":"End User","default":""},"end_user_proof":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End User Proof"},"page_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Key"},"page_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Url"},"id_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id Token"},"host_uid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Uid"},"host_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Ts"},"host_sig":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Sig"},"space_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Id"},"q":{"type":"string","title":"Q","default":""}},"type":"object","title":"ShareSearchIn"},"ShareSessionOut":{"properties":{"id":{"type":"string","title":"Id"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"title_by_user":{"type":"boolean","title":"Title By User","default":false},"message_count":{"type":"integer","title":"Message Count","default":0},"unread":{"type":"integer","title":"Unread","default":0},"created_at":{"type":"string","format":"date-time","title":"Created At"},"last_message_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Message At"},"prefill":{"type":"string","title":"Prefill","default":""},"writing_run":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Writing Run"}},"type":"object","required":["id","created_at"],"title":"ShareSessionOut"},"ShareSessionPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ShareSessionOut"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"ShareSessionPage"},"ShareSessionSearchHit":{"properties":{"session_id":{"type":"string","title":"Session Id"},"title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Title"},"snippet":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Snippet"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"source":{"type":"string","title":"Source"}},"type":"object","required":["session_id","created_at","source"],"title":"ShareSessionSearchHit"},"ShareStorylineState":{"properties":{"active":{"type":"boolean","title":"Active","default":false},"name":{"type":"string","title":"Name","default":""},"visibility":{"type":"string","title":"Visibility","default":""},"step":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Step"},"line_id":{"type":"string","title":"Line Id","default":""},"enrollment_id":{"type":"string","title":"Enrollment Id","default":""},"allow_exit":{"type":"boolean","title":"Allow Exit","default":false},"choices":{"items":{"type":"string"},"type":"array","title":"Choices","default":[]},"questions":{"items":{"type":"string"},"type":"array","title":"Questions","default":[]},"node":{"type":"string","title":"Node","default":""},"checklist":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Checklist","default":[]},"expandable":{"type":"boolean","title":"Expandable","default":false},"expand_goal":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expand Goal"}},"type":"object","title":"ShareStorylineState","description":"会话当前的故事线横幅状态(docs/40)。active=false 即无可见故事线(含 invisible 档)。\n\n字段必须与 engine.peek_state 的键保持同步——流式 meta 发的是 peek 的裸 dict,这里是\n模型:漏一个字段就是\"两条路不同源\"(allow_exit 就这么静默丢过,横幅退出按钮只在\n实时轮出现)。"},"SkillPatch":{"properties":{"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Instructions"},"tools":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Tools"},"tools_add":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Tools Add"},"tools_remove":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Tools Remove"},"knowledge_bases":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Knowledge Bases"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"},"menu_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Menu Label"},"menu_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Menu Prompt"},"menu_anchors":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Menu Anchors"}},"type":"object","title":"SkillPatch","description":"只改传来的字段。理由同 AgentPatch：PUT 是整体替换，一个漏掉 instructions 的\nPUT 会把技能的正文清空。\n\n`tools_add`/`tools_remove` 是增量语义（同 AgentPatch）：`tools=[...]` 整表替换，\n想\"加/删一个\"用增量，免得把没读到的其它项挤掉。幂等。"},"SkillRevisionOut":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"actor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor"},"snapshot":{"additionalProperties":true,"type":"object","title":"Snapshot"}},"type":"object","required":["id","created_at","snapshot"],"title":"SkillRevisionOut"},"SmtpIn":{"properties":{"host":{"type":"string","title":"Host","default":""},"port":{"type":"integer","title":"Port","default":587},"user":{"type":"string","title":"User","default":""},"password":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Password"},"from_addr":{"type":"string","title":"From Addr","default":""},"starttls":{"type":"boolean","title":"Starttls","default":true}},"type":"object","title":"SmtpIn"},"Source":{"properties":{"document_id":{"type":"string","title":"Document Id"},"distance":{"type":"number","title":"Distance"}},"type":"object","required":["document_id","distance"],"title":"Source"},"SourceOut":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id"},"url":{"type":"string","title":"Url"},"kind":{"type":"string","title":"Kind","default":"list"},"label":{"type":"string","title":"Label","default":""},"why":{"type":"string","title":"Why","default":""},"ok":{"type":"boolean","title":"Ok","default":true},"reason":{"type":"string","title":"Reason","default":""},"warn":{"type":"string","title":"Warn","default":""},"doubt":{"type":"string","title":"Doubt","default":""},"sample":{"items":{"type":"string"},"type":"array","title":"Sample","default":[]},"enabled":{"type":"boolean","title":"Enabled","default":true},"check_every_minutes":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Check Every Minutes"},"disabled_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Disabled Reason"}},"type":"object","required":["url"],"title":"SourceOut"},"SourceToggleIn":{"properties":{"enabled":{"type":"boolean","title":"Enabled"}},"type":"object","required":["enabled"],"title":"SourceToggleIn"},"SpaceAgentIn":{"properties":{"name":{"type":"string","title":"Name"}},"type":"object","required":["name"],"title":"SpaceAgentIn"},"SpaceIn":{"properties":{"name":{"type":"string","title":"Name"}},"type":"object","required":["name"],"title":"SpaceIn"},"SpaceMergeIn":{"properties":{"target_space_id":{"type":"string","format":"uuid","title":"Target Space Id"}},"type":"object","required":["target_space_id"],"title":"SpaceMergeIn"},"SpaceOut":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"is_default":{"type":"boolean","title":"Is Default"}},"type":"object","required":["id","name","is_default"],"title":"SpaceOut"},"StartIn":{"properties":{"lang":{"type":"string","title":"Lang","default":""},"lang_explicit":{"type":"boolean","title":"Lang Explicit","default":false},"end_user":{"type":"string","title":"End User","default":""},"end_user_proof":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End User Proof"},"page_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Key"},"page_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Url"},"id_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id Token"},"host_uid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Uid"},"host_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Ts"},"host_sig":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Sig"},"space_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Id"},"topic":{"type":"string","title":"Topic","default":""},"title":{"type":"string","title":"Title","default":""},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"}},"type":"object","title":"StartIn"},"StorylineExport":{"properties":{"schema_version":{"type":"integer","title":"Schema Version"},"kind":{"type":"string","title":"Kind","default":"storyline"},"key":{"type":"string","title":"Key"},"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"agent_name":{"type":"string","title":"Agent Name"},"graph":{"additionalProperties":true,"type":"object","title":"Graph"},"profile_schema":{"additionalProperties":true,"type":"object","title":"Profile Schema"},"is_default":{"type":"boolean","title":"Is Default"},"user_visibility":{"type":"string","title":"User Visibility"},"entry":{"type":"string","title":"Entry","default":"auto"},"display_name":{"type":"string","title":"Display Name","default":""},"allow_exit":{"type":"boolean","title":"Allow Exit","default":false},"show_profile":{"type":"boolean","title":"Show Profile","default":false},"on_complete":{"type":"string","title":"On Complete"},"allow_agent_enroll":{"type":"boolean","title":"Allow Agent Enroll"},"enroll_trigger":{"type":"string","title":"Enroll Trigger"}},"type":"object","required":["schema_version","key","name","description","agent_name","graph","profile_schema","is_default","user_visibility","on_complete","allow_agent_enroll","enroll_trigger"],"title":"StorylineExport"},"StorylineImportIn":{"properties":{"schema_version":{"type":"integer","title":"Schema Version","default":1},"key":{"type":"string","title":"Key","default":""},"name":{"type":"string","title":"Name","default":""},"description":{"type":"string","title":"Description","default":""},"agent_name":{"type":"string","title":"Agent Name","default":""},"graph":{"additionalProperties":true,"type":"object","title":"Graph","default":{"nodes":[],"edges":[]}},"profile_schema":{"additionalProperties":true,"type":"object","title":"Profile Schema","default":{}},"user_visibility":{"type":"string","title":"User Visibility","default":"invisible"},"learner_visibility":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Learner Visibility"},"entry":{"type":"string","title":"Entry","default":"auto"},"display_name":{"type":"string","title":"Display Name","default":""},"allow_exit":{"type":"boolean","title":"Allow Exit","default":false},"show_profile":{"type":"boolean","title":"Show Profile","default":false},"on_complete":{"type":"string","title":"On Complete","default":"end"},"allow_agent_enroll":{"type":"boolean","title":"Allow Agent Enroll","default":false},"enroll_trigger":{"type":"string","title":"Enroll Trigger","default":""},"override_agent_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Override Agent Name"}},"type":"object","title":"StorylineImportIn"},"StorylineIn":{"properties":{"agent_name":{"type":"string","title":"Agent Name"},"key":{"type":"string","title":"Key"},"name":{"type":"string","title":"Name","default":""},"description":{"type":"string","title":"Description","default":""},"graph":{"additionalProperties":true,"type":"object","title":"Graph","default":{"nodes":[],"edges":[]}},"profile_schema":{"additionalProperties":true,"type":"object","title":"Profile Schema","default":{}},"is_default":{"type":"boolean","title":"Is Default","default":false},"user_visibility":{"type":"string","title":"User Visibility","default":"invisible"},"learner_visibility":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Learner Visibility"},"entry":{"type":"string","title":"Entry","default":"auto"},"display_name":{"type":"string","title":"Display Name","default":""},"allow_exit":{"type":"boolean","title":"Allow Exit","default":false},"show_profile":{"type":"boolean","title":"Show Profile","default":false},"on_complete":{"type":"string","title":"On Complete","default":"end"},"allow_agent_enroll":{"type":"boolean","title":"Allow Agent Enroll","default":false},"enroll_trigger":{"type":"string","title":"Enroll Trigger","default":""},"concurrency":{"type":"string","title":"Concurrency","default":"user"},"next_storyline_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Next Storyline Id"},"position":{"type":"integer","title":"Position","default":0},"expected_version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Expected Version"}},"type":"object","required":["agent_name","key"],"title":"StorylineIn"},"StorylineOut":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"agent_name":{"type":"string","title":"Agent Name"},"key":{"type":"string","title":"Key"},"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"graph":{"additionalProperties":true,"type":"object","title":"Graph"},"profile_schema":{"additionalProperties":true,"type":"object","title":"Profile Schema"},"status":{"type":"string","title":"Status"},"published_revision_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Published Revision Id"},"is_default":{"type":"boolean","title":"Is Default"},"user_visibility":{"type":"string","title":"User Visibility"},"entry":{"type":"string","title":"Entry","default":"auto"},"display_name":{"type":"string","title":"Display Name","default":""},"allow_exit":{"type":"boolean","title":"Allow Exit","default":false},"show_profile":{"type":"boolean","title":"Show Profile","default":false},"on_complete":{"type":"string","title":"On Complete"},"allow_agent_enroll":{"type":"boolean","title":"Allow Agent Enroll"},"enroll_trigger":{"type":"string","title":"Enroll Trigger"},"concurrency":{"type":"string","title":"Concurrency","default":"user"},"next_storyline_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Next Storyline Id"},"position":{"type":"integer","title":"Position"},"version":{"type":"integer","title":"Version"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","agent_name","key","name","description","graph","profile_schema","status","published_revision_id","is_default","user_visibility","on_complete","allow_agent_enroll","enroll_trigger","next_storyline_id","position","version","updated_at"],"title":"StorylineOut"},"TagsIn":{"properties":{"tags":{"items":{"type":"string"},"type":"array","title":"Tags"}},"type":"object","required":["tags"],"title":"TagsIn"},"TelegramStatusOut":{"properties":{"connected":{"type":"boolean","title":"Connected"},"enabled":{"type":"boolean","title":"Enabled","default":false},"bot_username":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Bot Username"},"bot_link":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Bot Link"},"has_token":{"type":"boolean","title":"Has Token","default":false}},"type":"object","required":["connected"],"title":"TelegramStatusOut"},"TelegramToggleIn":{"properties":{"enabled":{"type":"boolean","title":"Enabled"}},"type":"object","required":["enabled"],"title":"TelegramToggleIn"},"TelegramTokenIn":{"properties":{"bot_token":{"type":"string","title":"Bot Token"}},"type":"object","required":["bot_token"],"title":"TelegramTokenIn"},"TemplateOut":{"properties":{"name":{"type":"string","title":"Name"},"soul":{"type":"string","title":"Soul"},"task":{"type":"string","title":"Task"},"tools":{"items":{"type":"string"},"type":"array","title":"Tools"},"skills":{"items":{"type":"string"},"type":"array","title":"Skills"},"history_window":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"History Window"},"max_output_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Output Tokens"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"}},"type":"object","required":["name","soul","task","tools","skills"],"title":"TemplateOut"},"TenantAccountOut":{"properties":{"id":{"type":"string","title":"Id"},"email":{"type":"string","title":"Email"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"last_login_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Login At"}},"type":"object","required":["id","email","created_at"],"title":"TenantAccountOut"},"TenantAuditOut":{"properties":{"id":{"type":"string","title":"Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"action":{"type":"string","title":"Action"},"entity":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Entity"},"entity_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Entity Id"},"target":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Target"},"actor_type":{"type":"string","title":"Actor Type"},"actor_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor Label"},"via":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Via"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Request Id"},"before":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Before"},"after":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"After"},"meta":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Meta"}},"type":"object","required":["id","created_at","action","actor_type"],"title":"TenantAuditOut"},"TenantAuditPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/TenantAuditOut"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"},"total":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Total"}},"type":"object","required":["items"],"title":"TenantAuditPage"},"TenantMeOut":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"name":{"type":"string","title":"Name"},"auth_mode":{"type":"string","title":"Auth Mode"},"alias":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Alias"},"public_base":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Public Base"}},"type":"object","required":["tenant_id","name","auth_mode"],"title":"TenantMeOut"},"TenantMonitorOut":{"properties":{"id":{"type":"string","title":"Id"},"title":{"type":"string","title":"Title"},"status":{"type":"string","title":"Status"},"user_id":{"type":"string","title":"User Id"},"external_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External User Id"},"space_id":{"type":"string","title":"Space Id"},"space_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Name"},"cron":{"type":"string","title":"Cron"},"tz":{"type":"string","title":"Tz"},"sources":{"type":"integer","title":"Sources","default":0},"sources_on":{"type":"integer","title":"Sources On","default":0},"reports":{"type":"integer","title":"Reports","default":0},"runs":{"type":"integer","title":"Runs","default":0},"tokens_in":{"type":"integer","title":"Tokens In","default":0},"tokens_out":{"type":"integer","title":"Tokens Out","default":0},"last_run_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Run At"},"next_run_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Next Run At"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","title","status","user_id","space_id","cron","tz","created_at"],"title":"TenantMonitorOut","description":"一条跟踪在租户眼里的样子。**标题是明文**（`monitor_plans.title` 建表时就没加密），\n所以隐私模式下也照给——隐私模式管的是会话正文那一类，不是\"这个租户有哪些跟踪\"。"},"TenantMonitorPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/TenantMonitorOut"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"},"total_tokens":{"type":"integer","title":"Total Tokens","default":0},"total_plans":{"type":"integer","title":"Total Plans","default":0}},"type":"object","required":["items"],"title":"TenantMonitorPage"},"TenantOut":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"alias":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Alias"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"},"disabled":{"type":"boolean","title":"Disabled"},"privacy_mode":{"type":"boolean","title":"Privacy Mode"},"onboarding_config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Onboarding Config"},"auth_mode":{"type":"string","title":"Auth Mode","default":"proxy"},"status":{"type":"string","title":"Status","default":"active"},"profile":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Profile"},"byok_provider":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Byok Provider"},"user_count":{"type":"integer","title":"User Count","default":0},"agent_count":{"type":"integer","title":"Agent Count","default":0},"message_count":{"type":"integer","title":"Message Count","default":0},"document_count":{"type":"integer","title":"Document Count","default":0},"tokens_24h":{"type":"integer","title":"Tokens 24H","default":0},"tokens_total":{"type":"integer","title":"Tokens Total","default":0},"month_tokens":{"type":"integer","title":"Month Tokens","default":0},"login_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Login Email"},"logo":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Logo"},"hidden":{"type":"boolean","title":"Hidden","default":false},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","name","disabled","privacy_mode","created_at"],"title":"TenantOut"},"TenantPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/TenantOut"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"},"hidden_count":{"type":"integer","title":"Hidden Count","default":0}},"type":"object","required":["items"],"title":"TenantPage"},"TenantPatch":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"alias":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Alias"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"},"disabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Disabled"},"onboarding_config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Onboarding Config"},"auth_mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Mode"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"profile":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Profile"},"hidden":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Hidden"}},"type":"object","title":"TenantPatch"},"TenantSettingsOut":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"name":{"type":"string","title":"Name"},"alias":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Alias"},"alias_prefix":{"type":"string","title":"Alias Prefix","default":"/t/"},"auth_mode":{"type":"string","title":"Auth Mode"},"privacy_mode":{"type":"boolean","title":"Privacy Mode"},"status":{"type":"string","title":"Status"},"profile":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Profile"},"onboarding_config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Onboarding Config"},"oauth":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Oauth","default":[]},"smtp":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Smtp"}},"type":"object","required":["tenant_id","name","auth_mode","privacy_mode","status"],"title":"TenantSettingsOut"},"TenantSettingsPatch":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"alias":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Alias"},"auth_mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Mode"},"profile":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Profile"},"onboarding_config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Onboarding Config"}},"type":"object","title":"TenantSettingsPatch"},"TestConfigIn":{"properties":{"transport":{"type":"string","title":"Transport","default":"streamable_http"},"config":{"additionalProperties":true,"type":"object","title":"Config","default":{}}},"type":"object","title":"TestConfigIn"},"TgBindOut":{"properties":{"deep_link":{"type":"string","title":"Deep Link"},"qr_svg":{"type":"string","title":"Qr Svg"},"expires_at":{"type":"string","format":"date-time","title":"Expires At"},"bot_username":{"type":"string","title":"Bot Username"}},"type":"object","required":["deep_link","qr_svg","expires_at","bot_username"],"title":"TgBindOut"},"TgStatusOut":{"properties":{"available":{"type":"boolean","title":"Available"},"bound":{"type":"boolean","title":"Bound","default":false},"bot_username":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Bot Username"}},"type":"object","required":["available"],"title":"TgStatusOut"},"TokenOut":{"properties":{"token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Token"},"user_id":{"type":"string","title":"User Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"external_user_id":{"type":"string","title":"External User Id"},"verified":{"type":"boolean","title":"Verified","default":true},"needs_verification":{"type":"boolean","title":"Needs Verification","default":false}},"type":"object","required":["user_id","tenant_id","external_user_id"],"title":"TokenOut"},"TranslateIn":{"properties":{"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"lang_explicit":{"type":"boolean","title":"Lang Explicit","default":false},"end_user":{"type":"string","title":"End User","default":""},"end_user_proof":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End User Proof"},"page_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Key"},"page_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Url"},"id_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id Token"},"host_uid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Uid"},"host_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Ts"},"host_sig":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Sig"},"space_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Id"}},"type":"object","title":"TranslateIn"},"TriggerTestIn":{"properties":{"messages":{"items":{"type":"string"},"type":"array","maxItems":5,"minItems":1,"title":"Messages"},"expect_tool":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expect Tool"},"samples":{"type":"integer","maximum":5.0,"minimum":1.0,"title":"Samples","default":3},"loaded":{"type":"boolean","title":"Loaded","default":false},"skill":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Skill"}},"type":"object","required":["messages"],"title":"TriggerTestIn"},"TypeIn":{"properties":{"display_name":{"type":"string","title":"Display Name","default":""},"description":{"type":"string","title":"Description","default":""},"agent_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent Name"},"outline":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Outline","default":[]},"info_schema":{"additionalProperties":true,"type":"object","title":"Info Schema","default":{}},"boundary":{"type":"string","title":"Boundary","default":""},"knowledge_bases":{"items":{"type":"string"},"type":"array","title":"Knowledge Bases","default":[]},"match_hints":{"type":"string","title":"Match Hints","default":""}},"type":"object","title":"TypeIn"},"TypeOut":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"display_name":{"type":"string","title":"Display Name","default":""},"description":{"type":"string","title":"Description","default":""},"agent_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent Name"},"outline":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Outline","default":[]},"info_schema":{"additionalProperties":true,"type":"object","title":"Info Schema","default":{}},"boundary":{"type":"string","title":"Boundary","default":""},"knowledge_bases":{"items":{"type":"string"},"type":"array","title":"Knowledge Bases","default":[]},"match_hints":{"type":"string","title":"Match Hints","default":""},"status":{"type":"string","title":"Status","default":"draft"},"version":{"type":"integer","title":"Version","default":0},"runs":{"type":"integer","title":"Runs","default":0},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","name","created_at","updated_at"],"title":"TypeOut"},"TypePatch":{"properties":{"display_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Display Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"agent_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent Name"},"outline":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Outline"},"info_schema":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Info Schema"},"boundary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Boundary"},"knowledge_bases":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Knowledge Bases"},"match_hints":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Match Hints"}},"type":"object","title":"TypePatch","description":"只改传来的字段。理由同 `AgentPatch`：PUT 是整体替换，一个漏掉 `outline` 的 PUT 会把\n骨架清空——而那正是这个类型的全部价值。"},"UsageOut":{"properties":{"group":{"type":"string","title":"Group"},"total":{"$ref":"#/components/schemas/UsageRow"},"rows":{"items":{"$ref":"#/components/schemas/UsageRow"},"type":"array","title":"Rows"}},"type":"object","required":["group","total","rows"],"title":"UsageOut"},"UsageRow":{"properties":{"key":{"type":"string","title":"Key"},"prompt_tokens":{"type":"integer","title":"Prompt Tokens"},"completion_tokens":{"type":"integer","title":"Completion Tokens"},"total_tokens":{"type":"integer","title":"Total Tokens"},"events":{"type":"integer","title":"Events"}},"type":"object","required":["key","prompt_tokens","completion_tokens","total_tokens","events"],"title":"UsageRow"},"UserDetailOut":{"properties":{"id":{"type":"string","title":"Id"},"external_user_id":{"type":"string","title":"External User Id"},"pref_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pref Name"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"space_count":{"type":"integer","title":"Space Count","default":0},"session_count":{"type":"integer","title":"Session Count","default":0},"document_count":{"type":"integer","title":"Document Count","default":0},"auth":{"type":"string","title":"Auth","default":"proxy"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"email_verified":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Email Verified"},"tokens_24h":{"type":"integer","title":"Tokens 24H","default":0},"spaces":{"items":{"$ref":"#/components/schemas/SpaceOut"},"type":"array","title":"Spaces","default":[]},"contact_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Email"},"contact_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Phone"},"pref_city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pref City"},"pref_timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pref Timezone"},"recent_refs":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Recent Refs","default":[]}},"type":"object","required":["id","external_user_id","created_at"],"title":"UserDetailOut"},"UserOut":{"properties":{"id":{"type":"string","title":"Id"},"external_user_id":{"type":"string","title":"External User Id"},"pref_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pref Name"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"space_count":{"type":"integer","title":"Space Count","default":0},"session_count":{"type":"integer","title":"Session Count","default":0},"document_count":{"type":"integer","title":"Document Count","default":0},"auth":{"type":"string","title":"Auth","default":"proxy"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"email_verified":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Email Verified"},"tokens_24h":{"type":"integer","title":"Tokens 24H","default":0}},"type":"object","required":["id","external_user_id","created_at"],"title":"UserOut"},"UserPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/UserOut"},"type":"array","title":"Items"},"next_cursor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Cursor"}},"type":"object","required":["items"],"title":"UserPage"},"UserUsageOut":{"properties":{"points":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Points"},"total_tokens":{"type":"integer","title":"Total Tokens"}},"type":"object","required":["points","total_tokens"],"title":"UserUsageOut"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"ValidationOut":{"properties":{"ok":{"type":"boolean","title":"Ok"},"errors":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Errors"}},"type":"object","required":["ok","errors"],"title":"ValidationOut"},"VisitorOut":{"properties":{"end_user":{"type":"string","title":"End User"},"proof":{"type":"string","title":"Proof"}},"type":"object","required":["end_user","proof"],"title":"VisitorOut","description":"服务端签发的匿名访客身份。浏览器两个都存，之后每次请求带上。"},"VisitorStateOut":{"properties":{"fresh":{"type":"boolean","title":"Fresh","default":true}},"type":"object","title":"VisitorStateOut"},"WaBindOut":{"properties":{"link":{"type":"string","title":"Link"},"qr_svg":{"type":"string","title":"Qr Svg"},"expires_at":{"type":"string","format":"date-time","title":"Expires At"},"wa_number":{"type":"string","title":"Wa Number"}},"type":"object","required":["link","qr_svg","expires_at","wa_number"],"title":"WaBindOut"},"WaBindStatusOut":{"properties":{"available":{"type":"boolean","title":"Available"},"bound":{"type":"boolean","title":"Bound","default":false},"wa_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Wa Number"}},"type":"object","required":["available"],"title":"WaBindStatusOut"},"WaConnectIn":{"properties":{"phone_number_id":{"type":"string","title":"Phone Number Id"},"access_token":{"type":"string","title":"Access Token"},"app_secret":{"type":"string","title":"App Secret","default":""},"display_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Display Phone"},"graph_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Graph Version"}},"type":"object","required":["phone_number_id","access_token"],"title":"WaConnectIn"},"WaStatusOut":{"properties":{"connected":{"type":"boolean","title":"Connected"},"enabled":{"type":"boolean","title":"Enabled","default":false},"phone_number_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone Number Id"},"display_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Display Phone"},"callback_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Callback Url"},"verify_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Verify Token"},"has_token":{"type":"boolean","title":"Has Token","default":false}},"type":"object","required":["connected"],"title":"WaStatusOut"},"WaToggleIn":{"properties":{"enabled":{"type":"boolean","title":"Enabled"}},"type":"object","required":["enabled"],"title":"WaToggleIn"},"WidgetConfig":{"properties":{"theme_color":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Theme Color"},"theme_color_2":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Theme Color 2"},"logo_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Logo Url"},"launcher":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Launcher"},"allowed_domains":{"items":{"type":"string"},"type":"array","title":"Allowed Domains","default":[]},"auth_method":{"type":"string","title":"Auth Method","default":"anonymous"},"login_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Login Url"},"auto_open":{"type":"boolean","title":"Auto Open","default":false},"custom_css":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Custom Css"},"css_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Css Url"},"theme":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Theme"},"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"uploads":{"type":"boolean","title":"Uploads","default":false},"upload_daily_limit":{"type":"integer","title":"Upload Daily Limit","default":20},"input_mode":{"type":"string","title":"Input Mode","default":"text"}},"type":"object","title":"WidgetConfig"},"WritingIn":{"properties":{"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"lang_explicit":{"type":"boolean","title":"Lang Explicit","default":false},"end_user":{"type":"string","title":"End User","default":""},"end_user_proof":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End User Proof"},"page_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Key"},"page_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Url"},"id_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id Token"},"host_uid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Uid"},"host_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Ts"},"host_sig":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Sig"},"space_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Id"},"since":{"type":"integer","title":"Since","default":0}},"type":"object","title":"WritingIn"},"app__api__admin_platform_skills__SkillIn":{"properties":{"description":{"type":"string","title":"Description","default":""},"instructions":{"type":"string","title":"Instructions","default":""},"menu_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Menu Label"},"tools":{"items":{"type":"string"},"type":"array","title":"Tools","default":[]},"knowledge_bases":{"items":{"type":"string"},"type":"array","title":"Knowledge Bases","default":[]},"menu_anchors":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Menu Anchors"},"platform_visible":{"type":"boolean","title":"Platform Visible","default":true}},"type":"object","title":"SkillIn"},"app__api__admin_platform_skills__SkillOut":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"instructions":{"type":"string","title":"Instructions"},"menu_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Menu Label"},"tools":{"items":{"type":"string"},"type":"array","title":"Tools","default":[]},"knowledge_bases":{"items":{"type":"string"},"type":"array","title":"Knowledge Bases","default":[]},"menu_anchors":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Menu Anchors"},"anchors_generated":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Anchors Generated"},"anchor_count":{"type":"integer","title":"Anchor Count","default":0},"has_vectors":{"type":"boolean","title":"Has Vectors","default":false},"platform_visible":{"type":"boolean","title":"Platform Visible","default":true}},"type":"object","required":["name","description","instructions"],"title":"SkillOut"},"app__api__agents__RevisionOut":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"actor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor"},"snapshot":{"additionalProperties":true,"type":"object","title":"Snapshot"}},"type":"object","required":["id","created_at","snapshot"],"title":"RevisionOut"},"app__api__auth_end_user__EmailIn":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"email":{"type":"string","title":"Email"}},"type":"object","required":["tenant_id","email"],"title":"EmailIn"},"app__api__auth_end_user__LoginIn":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"email":{"type":"string","title":"Email"},"password":{"type":"string","title":"Password"}},"type":"object","required":["tenant_id","email","password"],"title":"LoginIn"},"app__api__chat__StopIn":{"properties":{"session_id":{"type":"string","title":"Session Id","default":""}},"type":"object","title":"StopIn"},"app__api__console_auth__LoginIn":{"properties":{"username":{"type":"string","title":"Username"},"password":{"type":"string","title":"Password"}},"type":"object","required":["username","password"],"title":"LoginIn"},"app__api__mcp_servers__ProbeIn":{"properties":{"instruction":{"type":"string","title":"Instruction"},"tool":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tool"},"execute":{"type":"boolean","title":"Execute","default":false}},"type":"object","required":["instruction"],"title":"ProbeIn"},"app__api__me__monitors__ProbeIn":{"properties":{"url":{"type":"string","title":"Url"}},"type":"object","required":["url"],"title":"ProbeIn"},"app__api__me__monitors__ReviseIn":{"properties":{"note":{"type":"string","title":"Note"}},"type":"object","required":["note"],"title":"ReviseIn"},"app__api__share_chat__StopIn":{"properties":{"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"lang_explicit":{"type":"boolean","title":"Lang Explicit","default":false},"end_user":{"type":"string","title":"End User","default":""},"end_user_proof":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End User Proof"},"page_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Key"},"page_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Url"},"id_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id Token"},"host_uid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Uid"},"host_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Ts"},"host_sig":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Sig"},"space_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Id"},"session_id":{"type":"string","title":"Session Id","default":""}},"type":"object","title":"StopIn"},"app__api__share_writing__EmailIn":{"properties":{"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"lang_explicit":{"type":"boolean","title":"Lang Explicit","default":false},"end_user":{"type":"string","title":"End User","default":""},"end_user_proof":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End User Proof"},"page_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Key"},"page_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Url"},"id_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id Token"},"host_uid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Uid"},"host_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Ts"},"host_sig":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Sig"},"space_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Id"},"email":{"type":"string","title":"Email","default":""}},"type":"object","title":"EmailIn"},"app__api__share_writing__ReviseIn":{"properties":{"lang":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lang"},"lang_explicit":{"type":"boolean","title":"Lang Explicit","default":false},"end_user":{"type":"string","title":"End User","default":""},"end_user_proof":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End User Proof"},"page_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Key"},"page_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Url"},"id_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id Token"},"host_uid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Uid"},"host_ts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Ts"},"host_sig":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host Sig"},"space_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Space Id"},"start":{"type":"integer","title":"Start","default":0},"end":{"type":"integer","title":"End","default":0},"instruction":{"type":"string","title":"Instruction","default":""},"version":{"type":"integer","title":"Version","default":0},"dry_run":{"type":"boolean","title":"Dry Run","default":false},"fragment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fragment"}},"type":"object","title":"ReviseIn"},"app__api__skills__SkillIn":{"properties":{"description":{"type":"string","title":"Description","default":""},"instructions":{"type":"string","title":"Instructions","default":""},"tools":{"items":{"type":"string"},"type":"array","title":"Tools","default":[]},"knowledge_bases":{"items":{"type":"string"},"type":"array","title":"Knowledge Bases","default":[]},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"},"menu_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Menu Label"},"menu_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Menu Prompt"},"menu_anchors":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Menu Anchors"}},"type":"object","title":"SkillIn"},"app__api__skills__SkillOut":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"instructions":{"type":"string","title":"Instructions"},"tools":{"items":{"type":"string"},"type":"array","title":"Tools"},"knowledge_bases":{"items":{"type":"string"},"type":"array","title":"Knowledge Bases","default":[]},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"},"menu_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Menu Label"},"menu_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Menu Prompt"},"menu_anchors":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Menu Anchors"},"anchors_generated":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Anchors Generated"},"anchor_vec_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Anchor Vec At"},"warnings":{"items":{"additionalProperties":{"type":"string"},"type":"object"},"type":"array","title":"Warnings","default":[]}},"type":"object","required":["name","description","instructions","tools"],"title":"SkillOut"},"app__api__storylines__RevisionOut":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"version":{"type":"integer","title":"Version"},"actor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","version","actor","created_at"],"title":"RevisionOut"},"app__api__writing_types__RevisionOut":{"properties":{"id":{"type":"string","title":"Id"},"version":{"type":"integer","title":"Version"},"sections":{"type":"integer","title":"Sections"},"actor":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","version","sections","created_at"],"title":"RevisionOut"}}},"tags":[{"name":"health","description":"健康检查与就绪探针（无需鉴权）。"},{"name":"meta","description":"服务信息（版本、名称）。"},{"name":"end-user-auth","description":"终端用户平台原生认证：邮箱+密码注册/登录、邮箱验证、找回密码、社交 OAuth。请求带 tenant_id（公开标识）；登录返回 JWT，之后用 `Authorization: Bearer <jwt>`。"},{"name":"auth","description":"终端用户身份与自助：`/me` 回显身份；`/me/spaces` 管理自己的空间；`/me/spaces/{id}/agents` 把已发布 Agent 加入/移出空间；`/me/agents` 可选 Agent。鉴权：`Authorization: Bearer <jwt>`（平台登录）或 `X-API-Key + X-End-User`（代理）。"},{"name":"chat","description":"对话（RAG 检索 + 工具/MCP + 记忆），按空间隔离、流式可选。只有已加入该空间的 Agent 可对话；超月度配额返回 429。鉴权同 auth。可选 `X-Space-Id` 指定空间。"},{"name":"share","description":"匿名分享页对话：客户凭分享令牌与某个 Agent 对话，无需账号/API Key。"},{"name":"telegram","description":"Telegram bot 整合：每 Agent 一个 bot（webhook 回调 + 租户端 token 管理）；终端用户私聊用 telegram:<id> 身份，或扫码绑定平台账号共享会话。"},{"name":"whatsapp","description":"WhatsApp 整合（Meta Cloud API）：每 Agent 一个号（App 级 webhook + 签名校验 + 租户端凭证管理）；终端用户用 whatsapp:<号> 身份，或扫码绑定平台账号共享会话。"},{"name":"admin","description":"平台管理（`X-Admin-Token`）：租户 CRUD、API Key 签发/吊销、用量概览、审计、租户级 OAuth 凭证、冷启动模板、状态/档案。"},{"name":"tenant","description":"租户自服务设置（隐私模式 BYOK 等）。鉴权 `X-API-Key`。"},{"name":"manage","description":"租户管理面（`X-API-Key`，或平台 admin `X-Admin-Token + X-Act-Tenant`）：用户列表/详情/删除、空间与成员、文档、会话（客服只读）、用量汇总、重置用户密码。隐私模式内容不可读。"},{"name":"agents","description":"智能体 CRUD（人格/职责/工具/技能/发布）+ 分享链接。鉴权 `X-API-Key`。"},{"name":"skills","description":"技能 CRUD（按需加载的能力包）。"},{"name":"templates","description":"智能体模板（只读示例，可实例化为租户 Agent）。"},{"name":"tools","description":"可用工具清单（内置 + 该租户 MCP 工具），供 Agent 工具白名单选择。"},{"name":"mcp-servers","description":"租户私有 MCP server 注册（增删改 + 测试连接）；密钥加密存。"},{"name":"attachments","description":"附件（聊天图片原文件）访问，按用户/空间隔离。"},{"name":"integration","description":"接入分发：管理 MCP 的远程 HTTP 端点 `/mcp` 与给智能体看的指南。"},{"name":"console","description":"控制台登录（用户名+密码）：管理员用 ADMIN_USER/ADMIN_PASS；租户用其控制台账号（邮箱+密码，由平台管理员建租户时一并创建）。会话令牌带 typ=console，与终端用户 JWT 严格分型、不可互相冒充。"}]}