bailinghub 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/README.en.md +11 -7
  2. package/README.md +10 -7
  3. package/docker-compose.images.yml +2 -2
  4. package/docs/AGENT_AUTH_API.en.md +112 -1
  5. package/docs/AGENT_AUTH_API.md +99 -1
  6. package/docs/AGENT_CLIENT_QUICKSTART.en.md +32 -5
  7. package/docs/AGENT_CLIENT_QUICKSTART.md +27 -4
  8. package/docs/AGENT_CLIENT_RUNTIME_API.md +4 -1
  9. package/docs/AGENT_CONVERSATION_AUDIT.en.md +109 -4
  10. package/docs/AGENT_CONVERSATION_AUDIT.md +84 -3
  11. package/docs/AGENT_SUBJECT_DISPLAY.en.md +95 -0
  12. package/docs/AGENT_SUBJECT_DISPLAY.md +95 -0
  13. package/docs/AGENT_SYSTEM_INFO.en.md +99 -0
  14. package/docs/AGENT_SYSTEM_INFO.md +97 -0
  15. package/docs/CHANGELOG.en.md +25 -2
  16. package/docs/CHANGELOG.md +24 -1
  17. package/docs/INDEPENDENT_VALIDATION.en.md +4 -4
  18. package/docs/INDEPENDENT_VALIDATION.md +4 -4
  19. package/docs/LOCAL_AGENT_SETUP.en.md +116 -0
  20. package/docs/LOCAL_AGENT_SETUP.md +116 -0
  21. package/docs/README.en.md +8 -0
  22. package/docs/README.md +8 -0
  23. package/docs/RELEASE_NOTES_NEXT.en.md +3 -0
  24. package/docs/RELEASE_NOTES_NEXT.md +3 -0
  25. package/docs/RELEASE_NOTES_v0.6.0.en.md +4 -2
  26. package/docs/RELEASE_NOTES_v0.6.0.md +2 -0
  27. package/docs/RELEASE_NOTES_v0.6.1.en.md +53 -0
  28. package/docs/RELEASE_NOTES_v0.6.1.md +53 -0
  29. package/docs/RELEASE_NOTES_v0.7.0.en.md +116 -0
  30. package/docs/RELEASE_NOTES_v0.7.0.md +116 -0
  31. package/docs/SDK.en.md +31 -0
  32. package/docs/user-guide/conversations.en.md +4 -2
  33. package/docs/user-guide/conversations.md +4 -2
  34. package/package.json +1 -1
  35. package/schemas/config/route.schema.json +15 -2
  36. package/scripts/check-doc-links.mjs +2 -0
  37. package/scripts/check-image-tags.sh +1 -1
  38. package/scripts/check-release-consistency.test.mjs +2 -2
  39. package/scripts/install.sh +1 -1
  40. package/scripts/publish-images.sh +1 -1
  41. package/scripts/release-audit.mjs +2 -0
  42. package/scripts/sdk-agent-auth-lifecycle-check.mjs +178 -0
  43. package/scripts/sdk-runtime-test.mjs +5 -2
  44. package/scripts/verify-github-repo.mjs +2 -0
  45. package/sdk/php/README.md +29 -0
  46. package/sdk/php/src/AgentAuth.php +100 -4
  47. package/sdk/php/src/HubClient.php +2 -1
  48. package/sdk/php7/README.md +31 -0
  49. package/sdk/php7/src/AgentAuth.php +99 -4
  50. package/sdk/php7/src/HubClient.php +2 -1
  51. package/sql/058_agent_conversation_member_bindings.sql +9 -0
  52. package/sql/059_agent_subject_display.sql +5 -0
  53. package/sql/README.en.md +15 -0
  54. package/sql/README.md +25 -0
  55. package/src/app/agent-conversation-audit.ts +20 -0
  56. package/src/app/agent-system-info.ts +41 -0
  57. package/src/app/agent-tool-invocations.ts +16 -4
  58. package/src/core/config/agent-setup.ts +37 -0
  59. package/src/core/config/client-agent-setup.ts +25 -0
  60. package/src/core/config/config-schema.test.ts +11 -0
  61. package/src/core/config/route-config.test.ts +28 -0
  62. package/src/core/config/route-config.ts +43 -4
  63. package/src/core/contracts/agent-subject-display.test.ts +19 -0
  64. package/src/core/contracts/agent-subject-display.ts +36 -0
  65. package/src/core/contracts/types.ts +15 -0
  66. package/src/core/runtime/agent-conversation-audit.test.ts +19 -1
  67. package/src/core/runtime/agent-conversation-audit.ts +39 -0
  68. package/src/infrastructure/config/config-agent-auth-business-sessions.test.ts +120 -0
  69. package/src/infrastructure/config/config-agent-auth-lifecycle-race.test.ts +152 -0
  70. package/src/infrastructure/config/config-agent-auth-repository.test.ts +2 -0
  71. package/src/infrastructure/config/config-agent-auth-repository.ts +208 -18
  72. package/src/infrastructure/config/config-agent-conversation-audit-cross-binding.test.ts +120 -0
  73. package/src/infrastructure/config/config-agent-conversation-audit-repository.ts +117 -23
  74. package/src/infrastructure/config/config-agent-subject-display.test.ts +103 -0
  75. package/src/infrastructure/config/config-client-repository.ts +21 -0
  76. package/src/infrastructure/config/config-route-agent-setup.test.ts +59 -0
  77. package/src/infrastructure/config/config-route-repository.ts +24 -0
  78. package/src/infrastructure/config/configstore.ts +7 -3
  79. package/src/infrastructure/schema/core-schema-migrator.test.ts +90 -0
  80. package/src/routes/admin-access.ts +37 -0
  81. package/src/routes/admin-agent-clients.ts +11 -0
  82. package/src/routes/admin-agent-setup.test.ts +130 -0
  83. package/src/routes/admin-agent-setup.ts +68 -0
  84. package/src/routes/admin-client-agent-setup.test.ts +93 -0
  85. package/src/routes/admin-dispatch-config.ts +2 -0
  86. package/src/routes/agent-api.ts +7 -0
  87. package/src/routes/agent-auth-lifecycle-http.test.ts +177 -0
  88. package/src/routes/agent-auth-lifecycle.test.ts +193 -0
  89. package/src/routes/agent-auth.test.ts +1 -1
  90. package/src/routes/agent-auth.ts +206 -16
  91. package/src/routes/agent-conversation-audit-cross-binding-http.test.ts +122 -0
  92. package/src/routes/agent-conversation-audit.ts +8 -2
  93. package/src/routes/agent-subject-display-http.test.ts +145 -0
  94. package/src/routes/agent-system-info.test.ts +132 -0
  95. package/src/test-support/agent-auth-business-query-fixture.ts +43 -0
  96. package/src/test-support/agent-auth-lifecycle-fixture.ts +288 -0
  97. package/src/test-support/agent-conversation-audit-fixture.ts +30 -6
  98. package/src/test-support/agent-conversation-audit-http-fixture.ts +84 -0
  99. package/web/connect/bailing-connect-php.tgz +0 -0
  100. package/web/connect/bailing-connect-php7.tgz +0 -0
  101. package/web/console/assets/{Accounts-Ca_VnSu9.js → Accounts-ChL9k-XA.js} +1 -1
  102. package/web/console/assets/AgentClients-Bs7UgVDj.js +1 -0
  103. package/web/console/assets/AgentClients-DkgPTEbq.css +1 -0
  104. package/web/console/assets/{Approvals-CMvPWacY.js → Approvals-Bs6FGbp2.js} +1 -1
  105. package/web/console/assets/{Audit-CIRqOCnL.js → Audit-4WWYhkFM.js} +1 -1
  106. package/web/console/assets/{BrandLockup-BrytmTTH.js → BrandLockup-D2GhCipL.js} +1 -1
  107. package/web/console/assets/{Channels-CApxH2TB.js → Channels-CmoGpiCJ.js} +1 -1
  108. package/web/console/assets/{ChatEntries-CJon3bWJ.js → ChatEntries-BFRMtwta.js} +1 -1
  109. package/web/console/assets/Clients-CSHIsaWU.css +1 -0
  110. package/web/console/assets/Clients-DGkkSXyA.js +3 -0
  111. package/web/console/assets/{Cost-BbhlQFP8.js → Cost-BmGt0MfS.js} +1 -1
  112. package/web/console/assets/{Credentials-kqr1W0K7.js → Credentials-CR-sYINT.js} +1 -1
  113. package/web/console/assets/{Diagnostics-Kljt9XTH.js → Diagnostics-DAPbKSJp.js} +1 -1
  114. package/web/console/assets/{Executors-DnsB-Xz4.js → Executors-CgpiT3o8.js} +1 -1
  115. package/web/console/assets/{Kb-DLZSAFWP.js → Kb-Cm9dVSQw.js} +1 -1
  116. package/web/console/assets/{Login-DiTjPWmN.js → Login-CyUcsTZ_.js} +1 -1
  117. package/web/console/assets/{Projects-CXcVCgCD.js → Projects-DldFPgWg.js} +1 -1
  118. package/web/console/assets/Routes-DkMIjMQA.css +1 -0
  119. package/web/console/assets/Routes-DubfjlBD.js +124 -0
  120. package/web/console/assets/Runs-1hxgkuR4.js +3 -0
  121. package/web/console/assets/Runs-CvGTV8I-.css +1 -0
  122. package/web/console/assets/{Setup-FqoCKmfZ.js → Setup-DBLOnI2_.js} +1 -1
  123. package/web/console/assets/{Shell-BEqpONiy.js → Shell-gJ5Vz_E7.js} +1 -1
  124. package/web/console/assets/{StorageBuckets-CkORbYXY.js → StorageBuckets-DkDW16tj.js} +1 -1
  125. package/web/console/assets/{SystemSettings-gTQAazu7.js → SystemSettings-cDkudo2y.js} +1 -1
  126. package/web/console/assets/{SystemStatus-DAmUUNqO.js → SystemStatus-DZd6s8OX.js} +1 -1
  127. package/web/console/assets/{Targets-CZmDcjsE.js → Targets-DYNGq1NU.js} +1 -1
  128. package/web/console/assets/{Tools-CIHInlHL.js → Tools-DpWM59vV.js} +1 -1
  129. package/web/console/assets/{index-BkLbd7Cc.js → index-DGqs28gI.js} +2 -2
  130. package/web/console/assets/{request-r7GHVJzw.js → request-B7MLvOqo.js} +1 -1
  131. package/web/console/assets/{schema-BVn_hB7M.js → schema-CMuwjYdJ.js} +1 -1
  132. package/web/console/index.html +1 -1
  133. package/web-admin/scripts/subject-display-ui.mjs +78 -0
  134. package/web-admin/src/components/AgentSetupPanel.vue +262 -0
  135. package/web-admin/src/components/ClientConversations.vue +21 -4
  136. package/web-admin/src/components/conversation-audit.ts +20 -0
  137. package/web-admin/src/pages/AgentClients.vue +97 -23
  138. package/web-admin/src/pages/Clients.vue +4 -1
  139. package/web-admin/src/pages/Routes.vue +10 -1
  140. package/web-admin/tests/conversation-audit.fixture.mjs +13 -10
  141. package/web-admin/tests/conversation-audit.test.mjs +63 -1
  142. package/web/console/assets/AgentClients-BPIvlLYY.js +0 -1
  143. package/web/console/assets/AgentClients-DsWADpzr.css +0 -1
  144. package/web/console/assets/Clients-BSA1rlTB.js +0 -3
  145. package/web/console/assets/Clients-CNIVs7Qn.css +0 -1
  146. package/web/console/assets/Routes-CXGl9SMM.css +0 -1
  147. package/web/console/assets/Routes-DN9_d9Po.js +0 -124
  148. package/web/console/assets/Runs-Cwbe6thL.js +0 -3
  149. package/web/console/assets/Runs-D8UmjP5G.css +0 -1
@@ -2,6 +2,11 @@
2
2
 
3
3
  [中文版](AGENT_CONVERSATION_AUDIT.md)
4
4
 
5
+ > This page retains the existing v1 protocol and describes **Core 0.7.0 cross-system member bindings**. v2 identifies only the
6
+ > explicit create-request schema; existing v1 creation, events, headers and admin
7
+ > response schemas remain unchanged. Cross-system use requires matching SDK and client support;
8
+ > upgrading Core alone does not expand an existing v1 scope.
9
+
5
10
  This optional API records the complete **visible** conversation managed by a local
6
11
  Agent, and links its turns to separately authorized BailingHub runs. It does not
7
12
  merge Agent Sessions, business identities, threads, runtime memory, tool grants,
@@ -16,8 +21,9 @@ write and admin read endpoints then report `conversation_audit_unavailable`.
16
21
 
17
22
  - Every Agent request uses the existing `Authorization: Bearer <Agent access token>`
18
23
  authentication. Tokens are never fields in the archive or event DTOs.
19
- - A creator freezes the exact member Agent Session UUIDs, client application,
20
- route and original `client_conversation_id`. The creator must be a member.
24
+ - A v1 creator freezes the exact member Agent Session UUIDs, common client
25
+ application and route, and original `client_conversation_id`. The creator must
26
+ be a member. v1 does not acquire cross-application or cross-route scope.
21
27
  - Each other member confirms with **its own** authenticated bearer. A caller
22
28
  cannot confirm a session ID supplied in a body. All members must confirm before
23
29
  any event, including the first visible message, can be stored.
@@ -39,7 +45,7 @@ write and admin read endpoints then report `conversation_audit_unavailable`.
39
45
  memory. An authorized multi-store conversation is not copied into each store's
40
46
  model context. Existing run completion records keep their original purpose.
41
47
 
42
- ## Create and confirm membership
48
+ ## v1 creation and member confirmation
43
49
 
44
50
  `POST /agent-api/v1/conversation-audits`
45
51
 
@@ -74,8 +80,97 @@ Both operations return schema `bailing.agent-conversation-audit.v1` and the
74
80
  conversation header described below. `state` is `enrolling` until all members
75
81
  confirm, then `ready`. It describes enrollment, not a permanent guarantee that
76
82
  all authorizations remain active; every subsequent write revalidates them.
83
+ It also does not establish that all visible history was uploaded or verified as complete.
77
84
  Replies contain no transcript text, credentials, identity hashes or tool data.
78
85
 
86
+ ## Core 0.7.0: cross-system member bindings
87
+
88
+ ### Probe capability first
89
+
90
+ `GET /agent-api/v1/conversation-audits/capabilities` uses the existing
91
+ `Authorization: Bearer <Agent access token>` authentication and returns
92
+ `Cache-Control: no-store`:
93
+
94
+ ```json
95
+ {
96
+ "schema": "bailing.agent-conversation-audit-capabilities.v1",
97
+ "cross_binding_members": true,
98
+ "member_bindings": "session-client-route.v1"
99
+ }
100
+ ```
101
+
102
+ This is capability metadata only: no transcript, member list, account names,
103
+ Session identifiers, credentials or tool data are exposed. `cross_binding_members`
104
+ is `false` when the archive repository is absent, an older Host omits either
105
+ optional `createCrossBinding` / `supportsCrossBindingMembers` method, or the Core
106
+ database lacks any of migration 058's new columns. A failed probe is not proof of
107
+ support. When an older Core returns `404`, the client must reject cross-binding
108
+ use, without trying to send text or downgrading a cross-binding request to v1.
109
+ Existing common-binding v1 features retain their original checks and protocol.
110
+ The `member_bindings` string in a false response does not enable the feature.
111
+
112
+ ### Explicit v2 creation
113
+
114
+ Before sending, the SDK must verify that all selected connections belong to the
115
+ **same Hub**, and validate each connection's own authorization, App and route.
116
+ Each target retains an independent Agent Session. A shared Hub does not permit
117
+ combining repositories or queries across Host tenant data domains.
118
+ After confirming capability, send to the same `POST /agent-api/v1/conversation-audits`:
119
+
120
+ ```json
121
+ {
122
+ "schema": "bailing.agent-conversation-audit-create.v2",
123
+ "client_archive_id": "323e4567-e89b-42d3-a456-426614174001",
124
+ "client_conversation_id": "conversation-stable-id",
125
+ "members": [
126
+ {"session_id":"123e4567-e89b-42d3-a456-426614174001","client_app_id":"crm-demo","route":"customers","label":"CRM account"},
127
+ {"session_id":"123e4567-e89b-42d3-a456-426614174002","client_app_id":"erp-demo","route":"orders","label":"ERP account"}
128
+ ]
129
+ }
130
+ ```
131
+
132
+ `members` contains 1–64 entries. Each requires `session_id`, `client_app_id` and
133
+ `route`; only `label` is optional. App IDs and routes use the lowercase resource
134
+ key pattern `^[a-z0-9][a-z0-9_-]{1,63}$`; route cannot be `auto`. Labels are display
135
+ text of at most 128 characters. A Session may occur only once and bind one route,
136
+ even when that Session is authorized for several routes. Use a separate authorized
137
+ Session for another target. v2 rejects mixed-in top-level `route`,
138
+ `member_session_ids` or `member_labels` fields.
139
+
140
+ The member matching the **creating bearer** is the writer (creator), must be in
141
+ the member list, and must match that bearer's App. It is not the first sorted
142
+ member: sorting only makes validation deterministic. The idempotency key remains
143
+ `creator_session_id + writer route + client_archive_id`; the entire frozen input
144
+ must match on retry. A header's `client_app_id` / `route_key` describes **only the
145
+ writer**, not the sole system or a shared authorization for the whole group.
146
+ For example, if the ERP member's bearer creates the example above, that member
147
+ is the writer and the header contains `erp-demo` / `orders`.
148
+
149
+ v2 creation validates every member's own Session/App/route and confirms only the
150
+ writer. Each other member still calls the original confirm endpoint with **its
151
+ own bearer** and `{}`. The writer cannot confirm on another member's behalf.
152
+ Confirmation and every append batch revalidate the whole group, including each
153
+ confirmed identity snapshot. Revocation, refresh expiry, identity changes or lost
154
+ route permission for any selected member reject the group write. Do not silently
155
+ drop that member, choose another account or save only the remaining group's text.
156
+ Only the writer appends events. Each run link is checked against the member named
157
+ by `member_session_id`, its own App/route and the original run's conversation/turn;
158
+ the writer's binding is not substituted. Business permissions, approvals,
159
+ invocations and original trace links remain independent for each member.
160
+
161
+ ### Host packaging and migration
162
+
163
+ The cross-binding extension additionally requires explicit application of
164
+ `sql/058_agent_conversation_member_bindings.sql`. It only adds the archive
165
+ `membership_version` and member `client_app_id`, `route_key`, `client_name` columns.
166
+ 057 remains unchanged; no Sessions, runs, invocations or text are moved, and
167
+ existing identity and text content are not rewritten. Older records remain v1 with NULL in the new member columns. A
168
+ deployment with only 057 can continue using v1 but cannot advertise cross-binding
169
+ support. Hosts must include the official SQL in their release artifacts and run
170
+ their existing explicit migration process. Runtime code upgrades or startup do
171
+ not migrate automatically. Each Host retains its own database and tenant boundary;
172
+ do not combine stores across tenants.
173
+
79
174
  ## Append visible events
80
175
 
81
176
  `POST /agent-api/v1/conversation-audits/:conversation_id/events`
@@ -132,6 +227,8 @@ Hosts should persist the archive UUID, creator/member binding, stable event IDs,
132
227
  ordered events and acknowledged sequence before claiming successful archival.
133
228
  Lost acknowledgements can be retried unchanged. Restoring an audit queue does not
134
229
  restore invocation execution state or grant permission to resume unknown IDs.
230
+ Upload retries do not repeat business execution. A synchronization ACK confirms
231
+ the received event cursor; it does not erase unsaved events or missing history.
135
232
 
136
233
  ## Administrator read API
137
234
 
@@ -159,6 +256,12 @@ event kinds and must not be displayed as message counts.
159
256
  `session_id`, `display_label`, `confirmed`, and, once confirmed, the frozen
160
257
  `principal` and `on_behalf_of`. Event views contain the submitted visible fields,
161
258
  server `created_at`, and server-derived numeric `thread_id` on run links.
259
+ The cross-binding extension optionally adds `client_app_id`, `client_name` and
260
+ `route_key` to member views while retaining the v1 admin response schema.
261
+ `client_name` is a display snapshot, not identity evidence. Older v1 responses may
262
+ omit these fields, and legacy database NULL values do not prove a member binding.
263
+ A UI falling back to the header must explicitly mark it as legacy header-only
264
+ information, not evidence of separately recorded member systems and routes.
162
265
  Read the next page using `next_after_sequence`; no fixed first-1000-message cutoff
163
266
  is imposed. Responses use `Cache-Control: no-store`.
164
267
 
@@ -186,9 +289,11 @@ than truncate an allegedly complete transcript.
186
289
  | 409 | `conversation_audit_conflict` | Frozen membership, event sequence/content, turn or run association conflicts. |
187
290
  | 413 | `conversation_audit_limit` | No partial or truncated events were saved. |
188
291
  | 503 | `conversation_audit_unavailable` | Optional archive repository is not available. |
292
+ | 503 | `conversation_audit_cross_binding_unavailable` | Methods or migration for v2 cross-system creation are unavailable. |
189
293
  | 500 | `conversation_audit_internal_error` | Storage/internal failure; raw exception details are not returned. |
190
294
 
191
- Unknown endpoints, including every Agent transcript GET, return `404`. An older
295
+ The metadata-only capabilities GET is the sole Agent archive GET exception;
296
+ transcript reads and unknown endpoints return `404`. An older
192
297
  Core without these routes may also return `404`; adapters must report archival
193
298
  as unsupported, not claim that a complete conversation was uploaded. An archive
194
299
  failure must remain visible independently of a successful business operation.
@@ -2,16 +2,21 @@
2
2
 
3
3
  [English protocol and examples](AGENT_CONVERSATION_AUDIT.en.md)
4
4
 
5
+ > 本页保留既有 v1 协议,并说明 **Core 0.7.0 的跨系统成员绑定扩展**。
6
+ > v2 仅是显式创建请求的 schema,不改变现有 v1 创建、事件、会话头或管理员响应 schema,
7
+ > 旧 v1 请求不会因此获得跨系统范围;新功能需要配套 SDK/客户端。
8
+
5
9
  本接口归档本地智能体与用户之间的**可见对话**,将每轮沟通关联到各授权独立的 run。
6
10
  它不合并 Agent Session、业务身份、thread、记忆、工具授权、审批或 invocation,也不上传隐藏推理。
7
11
  正文单独写入 `bz_agent_conversation_events`,不写入各门店的 `bz_messages` 或模型记忆。
8
12
 
9
13
  部署方需要按自己的 Core 升级流程显式应用新增迁移 `sql/057_agent_conversation_audit.sql`;
10
- 运行时启动不会自动迁移。旧宿主可以不提供可选的 `ConfigStore.agentConversationAudit`,此时新接口明确返回不可用。
14
+ 运行时启动不会自动迁移。旧宿主可以不提供可选的 `ConfigStore.agentConversationAudit`,此时写入和管理员读取接口明确返回不可用。
11
15
 
12
- ## 创建与逐成员确认
16
+ ## v1 创建与逐成员确认
13
17
 
14
18
  所有写接口继续使用现有 Agent access bearer 鉴权,Token 不进入归档 DTO。
19
+ v1 成员仍限定在同一个 Client App 和同一个 route;不能用 v1 请求取得跨系统或跨路由范围。
15
20
 
16
21
  `POST /agent-api/v1/conversation-audits` 请求字段:
17
22
 
@@ -31,12 +36,83 @@
31
36
  `POST /agent-api/v1/conversation-audits/:id/confirm`,请求体为 `{}`,不能在 body 中代填另一个身份。
32
37
  创建和确认均返回 `schema: bailing.agent-conversation-audit.v1` 及下文会话头。
33
38
  全部成员确认前 `state=enrolling`,完成后为 `ready`;每次写入仍会重新校验授权有效性。
39
+ `ready` 只表示成员确认完成,不表示授权永久有效,也不表示全部可见历史已经上传或完整性已核验。
34
40
 
35
41
  只有创建者可以追加正文。只知道归档 UUID 或客户端会话字符串的人无法确认成员、写入或读取正文,
36
42
  因此无需另发 enrollment secret。正文写事务会锁定归档、client、route 和成员 Session,
37
43
  复核所有成员未撤销、refresh 生命周期有效、原主体快照未改变,且 client/session 的路由白名单交集、
38
44
  路由启用和 audience 仍允许访问。access token 刷新可以沿用同一 Session,替换身份不能替换旧成员。
39
45
 
46
+ ## Core 0.7.0:跨系统成员绑定
47
+
48
+ ### 先探测能力
49
+
50
+ `GET /agent-api/v1/conversation-audits/capabilities` 使用现有
51
+ `Authorization: Bearer <Agent access token>` 鉴权,响应带 `Cache-Control: no-store`:
52
+
53
+ ```json
54
+ {
55
+ "schema": "bailing.agent-conversation-audit-capabilities.v1",
56
+ "cross_binding_members": true,
57
+ "member_bindings": "session-client-route.v1"
58
+ }
59
+ ```
60
+
61
+ 这只是能力元数据,不返回会话正文、成员列表、账户名称、Session 标识、凭据或工具数据。
62
+ 未提供归档仓储、旧 Host 未实现可选的 `createCrossBinding` / `supportsCrossBindingMembers` 方法,
63
+ 或 Core 状态库缺少 058 的任一新增列时,`cross_binding_members` 为 `false`。
64
+ 探测失败不是支持证明;旧 Core 对此 GET 返回 `404` 时,客户端必须拒绝跨绑定使用,
65
+ 不能试发正文,也不能把跨绑定请求降级成 v1。已有同绑定 v1 功能仍按原协议判断和使用。
66
+ `false` 响应中的 `member_bindings` 字符串本身不表示功能已启用。
67
+
68
+ ### 显式 v2 创建
69
+
70
+ SDK 在发送前先验证全部所选连接来自**同一 Hub**,并逐一核对各自的授权状态、App 与 route。
71
+ 不同系统通过该 Hub 中各自独立的 Agent Session 接入;Hub 相同不意味着可以跨 Host 租户数据域拼接仓储或查询。
72
+ 确认能力后,向同一个 `POST /agent-api/v1/conversation-audits` 发送:
73
+
74
+ ```json
75
+ {
76
+ "schema": "bailing.agent-conversation-audit-create.v2",
77
+ "client_archive_id": "323e4567-e89b-42d3-a456-426614174001",
78
+ "client_conversation_id": "conversation-stable-id",
79
+ "members": [
80
+ {"session_id":"123e4567-e89b-42d3-a456-426614174001","client_app_id":"crm-demo","route":"customers","label":"CRM 账户"},
81
+ {"session_id":"123e4567-e89b-42d3-a456-426614174002","client_app_id":"erp-demo","route":"orders","label":"ERP 账户"}
82
+ ]
83
+ }
84
+ ```
85
+
86
+ `members` 为 1–64 项;每项必填 `session_id`、`client_app_id`、`route`,只有 `label` 可选。
87
+ App ID 和 route 均遵守小写资源 key 规则 `^[a-z0-9][a-z0-9_-]{1,63}$`;route 不能是 `auto`。
88
+ label 最多 128 字符,只作显示。每个 Session 只能出现一次并绑定一个 route;即使该 Session
89
+ 获准访问多个 route,也不能在同一归档中重复声明。需要另一目标时使用独立授权 Session。
90
+ v2 不接受顶层 `route`、`member_session_ids` 或 `member_labels` 混搭。
91
+
92
+ 创建 bearer 对应的成员就是 **writer(创建者)**,必须包含在 members 中并匹配其 App;
93
+ writer 不是排序后的首项。成员排序只用于确定性校验。幂等键仍为
94
+ `creator_session_id + writer route + client_archive_id`,完整冻结输入必须相同;不能通过重试修改成员绑定。
95
+ 返回的会话头 `client_app_id` / `route_key` **只描述 writer**,不能当作全组唯一系统或公共授权。
96
+ 例如,上例若由 ERP 成员的 bearer 创建,writer 就是 ERP 成员,会话头为 `erp-demo` / `orders`。
97
+
98
+ v2 创建时校验全部成员各自的 Session/App/route。创建请求只确认 writer;其他成员仍分别用
99
+ **自己的 bearer** 和 `{}` 调用原 confirm 接口,不能由 writer 代替确认。
100
+ 确认及每批事件追加都会重新校验整组成员,各成员已确认的身份快照不能改变。
101
+ 任何所选成员撤销、refresh 生命周期失效、主体变化或路由权限失效,整组写入被拒绝;
102
+ 不得静默移除该成员、改用其他账户或只保存剩余组的正文。
103
+ 只有 writer 可以追加事件;每条 run_link 按其 `member_session_id` 核对该成员自己的
104
+ App、route 和原 run 的 conversation/turn,不按 writer 的 App/route 推断归属。
105
+ 成员之间的业务权限、审批、invocation 和原 trace 链保持独立。
106
+
107
+ ### Host 与迁移
108
+
109
+ 跨绑定扩展另需显式应用 `sql/058_agent_conversation_member_bindings.sql`。
110
+ 058 只增加归档 `membership_version` 和成员 `client_app_id` / `route_key` / `client_name` 列;
111
+ 原 057 文件保持不变,不移动 Session、run、invocation 或正文,也不改写既有身份和正文内容。旧记录保持 v1,成员新增列为 NULL。
112
+ 仅应用 057 的部署可继续使用 v1,不能宣告跨绑定支持。
113
+ Host 必须将官方 SQL 包含在自己的发行产物中,再按既有迁移流程显式执行 migrate;
114
+ 升级运行时代码或启动服务不会自动迁移。各 Host 继续使用自己的状态库和租户边界,不得跨租户拼库。
115
+
40
116
  ## 追加可见事件
41
117
 
42
118
  `POST /agent-api/v1/conversation-audits/:id/events` 接收 `{ "events": [...] }`。
@@ -65,10 +141,11 @@ thread_id 由服务端获取。一个 run 最多属于一个完整对话归档
65
141
  成功响应为 `{ "schema": "bailing.agent-conversation-audit-ack.v1", "conversation_id": "<UUID>", "last_sequence": 5 }`。
66
142
  宿主应先持久保存归档 UUID、创建者及成员绑定、事件 ID、事件顺序和确认游标,再宣称归档成功。
67
143
  ACK 丢失可原样重试。恢复归档队列不等于恢复 invocation 执行状态,也不能续执行未知调用 ID。
144
+ 补传不会重执行业务操作;同步 ACK 仅确认已接收的事件游标,不能掩盖本地未保存事件或旧历史缺口。
68
145
 
69
146
  ## 管理员分页读取
70
147
 
71
- 没有 Agent 正文读取接口;全部 Agent 归档 GET 请求返回 `404`。
148
+ 没有 Agent 正文读取接口;除上述仅返回元数据的 capabilities GET 外,其他 Agent 归档 GET 请求均返回 `404`。
72
149
  以下接口仅供已有 `runs:read` 权限的管理员,响应设置 `Cache-Control: no-store`。
73
150
  宿主继续负责其租户数据域隔离,不能因为字符串相同而跨租户合并数据库查询。
74
151
 
@@ -81,6 +158,9 @@ state、member_count、confirmed_count、last_sequence、message_count、turn_co
81
158
  `GET /admin/api/conversation-audits/:id?after_sequence=0&limit=100` 返回 schema
82
159
  `bailing.agent-conversation-audit-detail.v1`、`conversation`、`members`、`events`、has_more、next_after_sequence。
83
160
  成员包含 session_id/display_label/confirmed;确认后有冻结的 principal/on_behalf_of。
161
+ 跨绑定扩展的成员视图可选增加 `client_app_id`、`client_name`、`route_key`,管理员响应仍为 v1。
162
+ client_name 是显示快照,不能作身份依据。旧 v1 响应可缺少这些字段,旧数据库 NULL 也不是成员系统的证明;
163
+ 界面如回退会话头,必须标注“旧记录:仅有归档头部信息”,不能冒充逐成员绑定证据。
84
164
  事件包含提交的可见字段、服务端 created_at,run_link 还有数值 thread_id。
85
165
  按 next_after_sequence 继续读后页,不受原 thread 前 1000 条消息限制。
86
166
 
@@ -105,6 +185,7 @@ conversation_audit_id 和 client_turn_id,用于返回完整对话。
105
185
  | 409 | `conversation_audit_conflict` | 成员、幂等内容、序号、轮次或 run 关联冲突。 |
106
186
  | 413 | `conversation_audit_limit` | 超限,整批未落库。 |
107
187
  | 503 | `conversation_audit_unavailable` | 可选归档仓储未提供。 |
188
+ | 503 | `conversation_audit_cross_binding_unavailable` | v2 跨系统创建所需方法或迁移未就绪。 |
108
189
  | 500 | `conversation_audit_internal_error` | 内部失败,不返回原始数据库或异常详情。 |
109
190
 
110
191
  旧 Core 未提供接口时也可能返回 `404`,适配器必须显示不支持归档。
@@ -0,0 +1,95 @@
1
+ # Show the business name after authorization
2
+
3
+ English | [简体中文](AGENT_SUBJECT_DISPLAY.md)
4
+
5
+ When a user approves “Account A” on a business authorization page, their agent client should be able to show that name without asking for another connection label. Core 0.7.0 adds optional `subject_display` metadata supplied by the business backend, bound by BailingHub to the original Agent Session, and read by a matching client. The subject can be a store, company, project, or another business account.
6
+
7
+ **Use Core 0.7.0, Agent Client SDK 0.5.0 and DSH 0.5.0, or a custom host implementing the same interfaces.** An older authorization without a name shows “Pending synchronization”. Its existing local note may remain separate, without posing as a business-confirmed name or changing business access.
8
+
9
+ ## Responsibilities
10
+
11
+ | Party | Responsibility |
12
+ |---|---|
13
+ | Business backend | Read the name from the actual business record after validating the selected account and current server session. Supply it when approving authorization; synchronize later renames or older authorizations. |
14
+ | BailingHub | Bind the display data to the original authorization and Agent Session. Only the owning client application can update an active session's display metadata. |
15
+ | Agent client | Display the SDK-provided name while retaining a separate local note, connection key and original session binding. Show system information or another distinguishing hint for duplicate names. |
16
+
17
+ A system description explains what the system normally does. A subject display name tells the user which business account this authorization represents. A device label identifies the device and remains separate.
18
+
19
+ ## Approve a new authorization
20
+
21
+ Use the existing server-side Client Token and add one optional field to the approval body:
22
+
23
+ ```json
24
+ {
25
+ "principal": { "id": "user-a", "tenant": "tenant-a", "roles": ["operator"] },
26
+ "on_behalf_of": "tenant-a:user-a",
27
+ "allowed_routes": ["operations"],
28
+ "subject_display": { "name": "Account A" }
29
+ }
30
+ ```
31
+
32
+ `subject_display` allows only `name`, or `null` for no supplied name. The name must be valid Unicode, nonempty after trimming, single-line, and at most 120 UTF-16 code units. Reject C0/C1 control characters and U+2028/U+2029 in the original input before trimming. Read the actual authorized business record rather than trusting an editable form field. Do not put this metadata into `principal` or `device_label`.
33
+
34
+ PHP 8.1+ and PHP 7.3 use the same optional fifth argument:
35
+
36
+ ```php
37
+ // Read $accountName from the business record after server-side identity and permission checks.
38
+ $result = $agentAuth->approve(
39
+ $authorizationId,
40
+ $principal,
41
+ $onBehalfOf,
42
+ $allowedRoutes,
43
+ array('name' => $accountName)
44
+ );
45
+ ```
46
+
47
+ Existing four-argument calls preserve the original HTTP body and remain compatible with older Core versions. Explicitly supplying the fifth argument requires a supporting Core. The browser still follows only the returned `redirect_uri`; do not append the name to a URL. Client Tokens remain on the business backend.
48
+
49
+ ## Synchronize an older authorization or rename
50
+
51
+ After applying its own management permissions, the business backend finds the exact original Session using `context()` or `listSessions()`, then calls:
52
+
53
+ ```http
54
+ PUT /agent-auth/v1/sessions/{session_id}/subject-display
55
+ Authorization: Bearer <Client Token>
56
+ Content-Type: application/json
57
+
58
+ {"subject_display":{"name":"Account A"}}
59
+ ```
60
+
61
+ ```php
62
+ $session = $agentAuth->updateSubjectDisplay($sessionId, array('name' => $accountName));
63
+ // Explicitly clear the display metadata:
64
+ $session = $agentAuth->updateSubjectDisplay($sessionId, null);
65
+ ```
66
+
67
+ Only an active session owned by the current Client Token's application may be updated. This changes display data only: no token issuance, identity/route/expiry changes, or revival of a revoked session. The response is the safe business-session projection, including the original `session_id`, `subject_display`, and `subject_display_status`, with no tokens or token hashes. It creates no business run and calls no business tools. For concurrent changes with different names, the last successful save wins.
68
+
69
+ | HTTP / error code | Meaning |
70
+ |---|---|
71
+ | `400 invalid_request` | Invalid fields or name |
72
+ | `404 not_found` | Invalid Session ID, missing Session, or Session owned by another application |
73
+ | `409 session_inactive` | Original Session inactive; changing its name cannot restore access |
74
+ | `503 subject_display_unavailable` | Repository capability or storage operation unavailable; do not report a successful save |
75
+
76
+ A timeout, network error or 503 is not a successful synchronization. Retry the same value against the original Session; use the owning application's session query for readback. Do not reauthorize, recreate a connection or replace a Session merely to synchronize a name.
77
+
78
+ ## Read the result
79
+
80
+ Token exchange/refresh, the current Agent Session view, the owning application's session list and the administrator session list add:
81
+
82
+ ```json
83
+ {
84
+ "subject_display": { "name": "Account A" },
85
+ "subject_display_status": "provided"
86
+ }
87
+ ```
88
+
89
+ Older or explicitly cleared authorizations return `subject_display: null` and `subject_display_status: "missing"`. The SDK reports `unsupported` for absent fields on a legacy server and `unavailable` for invalid display data. The UI may show a pending name in each case. Do not derive the business name from a device label or another identifier, or confuse display status with authorization status.
90
+
91
+ Matching clients use the supplied business name as a default display value and may keep a separate user note. Selection still uses `connectionKey` and the fixed scope retains its original Agent Session. Two authorizations called “Account A” remain separate. Renaming must not merge accounts, steal another connection's alias, or rewrite labels in an already-started conversation. Names are data, never model instructions.
92
+
93
+ The console's “Agent clients → Devices and runs” view shows authorization and device names separately. A read-only detail view retains the original subject, tenant, application, workspaces and Session. Missing names are shown as pending synchronization; the console does not invent them for the business system.
94
+
95
+ See [Agent Auth v1](AGENT_AUTH_API.en.md) for unchanged identity/lifecycle rules and [system descriptions](AGENT_SYSTEM_INFO.en.md) for product positioning metadata.
@@ -0,0 +1,95 @@
1
+ # 授权后显示业务名称
2
+
3
+ [English](AGENT_SUBJECT_DISPLAY.en.md) | 简体中文
4
+
5
+ 用户在业务授权页确认了“Account A”,回到智能体客户端后,应能看到这个名称,而不用再起一个连接名。Core 0.7.0 增加可选的 `subject_display`:由业务后端提供授权对象的名称,经 BailingHub 绑定到原 Agent Session,再由配套客户端读取并显示。它适用于门店、公司、项目或其他业务账户,不固定某一种业务模型。
6
+
7
+ **使用 Core 0.7.0、Agent Client SDK 0.5.0 与 DSH 0.5.0,或实现相同接口的自有客户端。** 旧授权未提供名称时显示“待同步”;原本地备注可以单独保留,不充当业务确认的名称,已有业务访问能力不受影响。
8
+
9
+ ## 三方分别做什么
10
+
11
+ | 参与方 | 需要做的事 |
12
+ |---|---|
13
+ | 业务后端 | 在用户确认授权后,从当前服务端登录态和真实业务记录读取名称;批准授权时提交。负责后续更名、旧授权名称同步。 |
14
+ | BailingHub | 把名称与原授权、原 Agent Session 关联;仅允许原接入方更新有效会话的显示信息。名称不修改身份或权限。 |
15
+ | 智能体客户端 | 从 SDK 的授权信息展示名称,保留独立的本地备注、连接键和原会话绑定。重名时展示系统或辅助标识以供区分。 |
16
+
17
+ 授权名称与系统说明不同:系统说明回答“这个系统通常负责什么”,授权名称回答“这份授权在业务系统中叫什么”。设备名称说明在哪个设备使用,也应单独保留。
18
+
19
+ ## 批准新授权
20
+
21
+ 业务后端继续使用现有 Client Token 调用 `approve`,新增可选字段:
22
+
23
+ ```json
24
+ {
25
+ "principal": { "id": "user-a", "tenant": "tenant-a", "roles": ["operator"] },
26
+ "on_behalf_of": "tenant-a:user-a",
27
+ "allowed_routes": ["operations"],
28
+ "subject_display": { "name": "Account A" }
29
+ }
30
+ ```
31
+
32
+ `subject_display` 只允许 `name`,或传 `null` 表示尚未提供。名称须为有效 Unicode 单行非空文本,去除首尾空白后不超过 120 个 UTF-16 单元;原始文本不得包含 C0/C1 控制字符及 U+2028/U+2029 换行分隔符。不把表单中可任意修改的名称直接当作服务端确认的业务名称,不往 `principal` 或 `device_label` 塞入该信息。
33
+
34
+ PHP 8.1+ 和 PHP 7.3 SDK 使用相同方法;在原四个参数后追加可选第五参数:
35
+
36
+ ```php
37
+ // $accountName 来自已校验当前登录态及管理权限后的业务记录。
38
+ $result = $agentAuth->approve(
39
+ $authorizationId,
40
+ $principal,
41
+ $onBehalfOf,
42
+ $allowedRoutes,
43
+ array('name' => $accountName)
44
+ );
45
+ ```
46
+
47
+ 原四参数调用仍发送原请求结构,可与旧 Core 配合;显式传第五参数需要支持本契约的 Core。浏览器仍只跳转批准结果的 `redirect_uri`,无需在 URL 中拼接名称。Client Token 继续仅保留在业务后端。
48
+
49
+ ## 给旧授权补名称或同步更名
50
+
51
+ 业务后端先按自己的管理权限确认目标,再通过现有 `context()` 或 `listSessions()` 找到准确的原 Session。随后调用:
52
+
53
+ ```http
54
+ PUT /agent-auth/v1/sessions/{session_id}/subject-display
55
+ Authorization: Bearer <Client Token>
56
+ Content-Type: application/json
57
+
58
+ {"subject_display":{"name":"Account A"}}
59
+ ```
60
+
61
+ ```php
62
+ $session = $agentAuth->updateSubjectDisplay($sessionId, array('name' => $accountName));
63
+ // 明确清除显示信息:
64
+ $session = $agentAuth->updateSubjectDisplay($sessionId, null);
65
+ ```
66
+
67
+ 更新只允许当前 Client Token 所属应用的有效会话,只改变显示信息,不换发 Token、不改变原主体/路由/有效期,也不恢复已撤销会话。返回业务会话安全投影,保留原 `session_id`,包含新的 `subject_display` 和 `subject_display_status`;不返回 Token 或 Token 哈希。该方法不创建业务运行记录或调用业务工具。不同内容并发更新时,以最后成功保存的名称为准。
68
+
69
+ | HTTP / 错误码 | 含义 |
70
+ |---|---|
71
+ | `400 invalid_request` | 字段或名称不合规则 |
72
+ | `404 not_found` | 会话 ID 无效、会话不存在或不属于此接入方 |
73
+ | `409 session_inactive` | 原会话已失效,不能通过改名恢复 |
74
+ | `503 subject_display_unavailable` | 当前仓储未实现该能力或保存过程不可用;不能记作保存成功 |
75
+
76
+ 超时、网络失败和 503 都不能记为已同步。重试时使用原 Session 和同一名称;需要回读时查询原接入方自己的会话列表。不得为补名称重新授权、重建连接或替换原会话。
77
+
78
+ ## 客户端和控制台如何读取
79
+
80
+ Token 交换/刷新、当前 Agent Session 查询、业务自身会话列表与管理员会话列表增加:
81
+
82
+ ```json
83
+ {
84
+ "subject_display": { "name": "Account A" },
85
+ "subject_display_status": "provided"
86
+ }
87
+ ```
88
+
89
+ 旧授权、显式清除的名称返回 `subject_display: null` 和 `subject_display_status: "missing"`。旧服务端完全没有新字段时,SDK 标为 `unsupported`;无效展示数据标为 `unavailable`。界面都可以显示名称待同步,但不能根据设备名或其他标识猜补名称,亦不能把展示数据状态当成授权状态。
90
+
91
+ 配套客户端优先用业务提供的名称作默认展示;已有本地备注可独立保留。连接仍以 `connectionKey` 选择,固定范围仍绑定原 Agent Session。两份授权即便都叫“Account A”也必须独立保存;更新名称不能把两份授权合并、替换 alias 的所有者或改写已开始会话的历史标签。模型应把名称当普通数据,不能执行名称中的指令。
92
+
93
+ 控制台“智能体客户端 → 设备与运行”将授权名称和设备名称分别展示;详情保留主体、租户、应用、工作空间及原 Session,旧授权明确显示“待同步”。该页面不替业务系统编造业务名称。
94
+
95
+ 完整身份及生命周期规则继续见 [Agent Auth v1](AGENT_AUTH_API.md),系统定位说明见 [首次能力搜索前的系统说明](AGENT_SYSTEM_INFO.md)。
@@ -0,0 +1,99 @@
1
+ # Help an agent understand each business system
2
+
3
+ English | [简体中文](AGENT_SYSTEM_INFO.md)
4
+
5
+ Before choosing where to search for tools, an agent needs to understand what each selected system usually does. A helpdesk handles tickets while an inventory system manages stock; both may offer a tool called “find record”.
6
+
7
+ Administrators open **Agent Clients → Connection Setup**, choose **Configure Connection** on the application's row, and edit the **System Description** step. It stays in the original business route, shared by Clients using that workspace. A user-editable account label cannot establish system identity. Reading the description requires the original Agent Session and selected route, without a business run or conversation text.
8
+
9
+ For the whole setup flow, see [Configure a local agent in one place](LOCAL_AGENT_SETUP.en.md).
10
+
11
+ ## What to enter
12
+
13
+ Choose the workspace, fill in its name, short purpose, typical domains, and boundaries, then save. Missing descriptions leave existing authorization and tool flows intact. The stored field is `agent_client.system_info`:
14
+
15
+ ```json
16
+ {
17
+ "name": "Helpdesk",
18
+ "summary": "Manage support tickets, check progress, and prepare replies.",
19
+ "domains": ["Ticket lookup", "Response preparation"],
20
+ "boundaries": ["Inventory adjustments belong to the inventory system."]
21
+ }
22
+ ```
23
+
24
+ | Field | Constraint |
25
+ | --- | --- |
26
+ | `name` | Nonempty, at most 120 characters |
27
+ | `summary` | Nonempty, at most 400 characters |
28
+ | `domains` | Up to 6 nonempty strings, each at most 120 characters; an empty array is allowed |
29
+ | `boundaries` | Up to 6 nonempty strings, each at most 160 characters; an empty array is allowed |
30
+
31
+ These fields describe the product, not additional model instructions. Use single-line text without control characters. Do not include credentials, conversation text, private endpoint addresses, or requests to bypass permissions. Configuration rejects unknown fields and oversized values. Reads do not invent descriptions from a route prompt, route name, authorization label, or tool result.
32
+
33
+ The existing `agent_client` JSON field stores the configuration; no new table or migration is required.
34
+
35
+ ## Host read contract
36
+
37
+ ```http
38
+ GET /agent-api/v1/workspaces/helpdesk/system-info
39
+ Authorization: Bearer <Agent access token>
40
+ ```
41
+
42
+ The endpoint returns only this route's description. Core revalidates the Client, original Agent Session, both route grants, and route audience. Revocation or forbidden access remains 401/403. Disabled or missing routes return 404 `route_unavailable`. The read does not enumerate other routes, load tools, knowledge, memory, or business context, create a run, invoke business tools, or read a request body.
43
+
44
+ ```json
45
+ {
46
+ "schema_version": "bailing.agent-system-info.v1",
47
+ "binding": {
48
+ "client_app_id": "helpdesk-client",
49
+ "session_id": "123e4567-e89b-42d3-a456-426614174000",
50
+ "workspace": "helpdesk"
51
+ },
52
+ "metadata_status": "configured",
53
+ "revision": "<sha256>",
54
+ "system": {
55
+ "name": "Helpdesk",
56
+ "summary": "Manage support tickets, check progress, and prepare replies.",
57
+ "domains": ["Ticket lookup", "Response preparation"],
58
+ "boundaries": ["Inventory adjustments belong to the inventory system."]
59
+ },
60
+ "tool_status": "not_loaded",
61
+ "availability": "unknown"
62
+ }
63
+ ```
64
+
65
+ `revision` is the SHA-256 of the normalized description and schema. It identifies description changes, not authorization identity or capability revision. Responses use `Cache-Control: no-store`.
66
+
67
+ Keep these meanings separate:
68
+
69
+ - `system` describes what the product usually does; it does not prove that this authorization grants every related action.
70
+ - `metadata_status=missing` means there is no valid description, with `system` and `revision` both `null`; it does not mean there are no tools.
71
+ - `tool_status=not_loaded` means tools have not been loaded, not that there are zero tools.
72
+ - `availability=unknown` makes no claim about business-service connectivity. Disabled runtime or direct tools return `unavailable` with `agent_client_disabled` or `agent_direct_disabled`. The description remains readable while actual calls retain their original configuration checks.
73
+
74
+ Read only the conversation's explicitly selected targets. Validate the response binding against the original Agent Session, Client, and workspace, then associate it with the host's existing `authorization_ref` and `system_ref`. Single, same-system multiple, and cross-system authorizations use the same shape. Do not inject unselected targets or expand a fixed scope when descriptions change.
75
+
76
+ An old Core returns 404 `not_found` for this unknown endpoint, allowing the host to report description support as unavailable. Missing descriptions can display unknown purpose or use a controlled local dictionary keyed by the original binding. Do not classify 401/403, `route_unavailable`, or temporary network failures as old-version incompatibility. Metadata fallback never replaces identity checks or switches to a default authorization.
77
+
78
+ ## Console configuration API
79
+
80
+ `GET /admin/api/routes/:route_key/agent-setup` returns only `route_key`, `name`, `enabled`, `permission`, `revision`, `agent_client`, `tool_sources`, and `agent_direct`. It excludes route `target_config` and provider credentials. `permission` is a read-only reminder of the route's existing execution permission, such as `readonly`; PUT cannot change it.
81
+
82
+ PUT to the same path accepts exactly four fields:
83
+
84
+ ```json
85
+ {
86
+ "expected_revision": "<revision returned by GET>",
87
+ "agent_client": { "enabled": true, "system_info": { "name": "Helpdesk", "summary": "Support ticket management", "domains": [], "boundaries": [] } },
88
+ "tool_sources": [{ "provider": "helpdesk", "allow": ["ticket.read"], "subject_field": "operator_id" }],
89
+ "agent_direct": { "enabled": true }
90
+ }
91
+ ```
92
+
93
+ `agent_client` and `agent_direct` may explicitly be `null` to clear them; an empty `tool_sources` clears source selection. Preserve existing instructions, active-tool limits, and source options when editing a description.
94
+
95
+ GET requires `routes:read`; PUT requires `routes:write`. Client-management permission does not substitute for route permission. Existing route, provider, exact write-operation, and approval validation still applies. The database transaction locks and compares the full route revision; a conflict returns 409 `agent_setup_conflict`. Success updates only `agent_client`, `tools`, and the update timestamp.
96
+
97
+ A host repository without optional `compareAndSetAgentSetup` can still read but receives 503 `agent_setup_unsupported` on save. There is no fallback to whole-row replacement. Success returns the same projection with its new revision. For the separate Client settings endpoint, see the [setup API appendix](LOCAL_AGENT_SETUP.en.md#api-appendix-narrow-updates).
98
+
99
+ The feature does not change business APIs, approval rules, fixed conversation scope, or archive behavior.