bailinghub 0.4.0 → 0.5.1

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 (164) hide show
  1. package/.gitignore +5 -0
  2. package/README.en.md +5 -2
  3. package/README.md +6 -2
  4. package/SECURITY.md +11 -0
  5. package/docker-compose.images.yml +2 -2
  6. package/docs/AGENT_AUTH_API.en.md +191 -0
  7. package/docs/AGENT_AUTH_API.md +202 -0
  8. package/docs/AGENT_CLIENT_QUICKSTART.en.md +263 -0
  9. package/docs/AGENT_CLIENT_QUICKSTART.md +245 -0
  10. package/docs/AGENT_CLIENT_RUNTIME_API.en.md +157 -0
  11. package/docs/AGENT_CLIENT_RUNTIME_API.md +107 -0
  12. package/docs/CHANGELOG.en.md +25 -0
  13. package/docs/CHANGELOG.md +25 -0
  14. package/docs/INDEPENDENT_VALIDATION.en.md +4 -4
  15. package/docs/INDEPENDENT_VALIDATION.md +4 -4
  16. package/docs/README.en.md +10 -2
  17. package/docs/README.md +10 -2
  18. package/docs/RELEASE_NOTES_v0.5.0.en.md +41 -0
  19. package/docs/RELEASE_NOTES_v0.5.0.md +41 -0
  20. package/docs/RELEASE_NOTES_v0.5.1.en.md +45 -0
  21. package/docs/RELEASE_NOTES_v0.5.1.md +45 -0
  22. package/package.json +3 -2
  23. package/schemas/config/client.schema.json +7 -0
  24. package/schemas/config/common.schema.json +30 -0
  25. package/schemas/config/route.schema.json +11 -0
  26. package/scripts/check-doc-links.mjs +2 -1
  27. package/scripts/check-image-tags.sh +1 -1
  28. package/scripts/check-release-consistency.test.mjs +5 -5
  29. package/scripts/e2e-console.mjs +144 -0
  30. package/scripts/export-oss.mjs +5 -12
  31. package/scripts/install.sh +1 -1
  32. package/scripts/public-content-denylist.mjs +82 -0
  33. package/scripts/public-content-denylist.test.mjs +53 -0
  34. package/scripts/publish-images.sh +1 -1
  35. package/scripts/release-audit.mjs +9 -13
  36. package/scripts/sdk-runtime-test.mjs +171 -7
  37. package/scripts/security-scan.mjs +8 -5
  38. package/scripts/validate-examples.mjs +3 -1
  39. package/scripts/verify-github-repo.mjs +8 -12
  40. package/scripts/verify-oss-export.mjs +6 -12
  41. package/sdk/php/README.md +27 -1
  42. package/sdk/php/src/AgentAuth.php +78 -0
  43. package/sdk/php/src/HubClient.php +3 -0
  44. package/sdk/php7/README.md +32 -2
  45. package/sdk/php7/src/AgentAuth.php +77 -0
  46. package/sdk/php7/src/HubClient.php +3 -0
  47. package/sql/055_agent_auth.sql +72 -0
  48. package/sql/056_agent_client_runtime.sql +60 -0
  49. package/src/adapters/channels/wecom-api.ts +1 -1
  50. package/src/app/agent-client-runtime.test.ts +221 -0
  51. package/src/app/agent-client-runtime.ts +408 -0
  52. package/src/app/agent-tool-invocations.test.ts +462 -0
  53. package/src/app/agent-tool-invocations.ts +795 -0
  54. package/src/app/agent-tool-job.test.ts +62 -0
  55. package/src/app/agent-tool-job.ts +41 -0
  56. package/src/app/auth.ts +2 -1
  57. package/src/app/kernel.ts +2 -0
  58. package/src/app/oss-edition.ts +1 -0
  59. package/src/app/runtime-context.ts +8 -0
  60. package/src/app/tool-approvals.ts +5 -1
  61. package/src/app/tool-assembly.ts +19 -1
  62. package/src/app/tool-context.ts +2 -1
  63. package/src/core/config/agent-direct-console-selection.test.ts +22 -0
  64. package/src/core/config/config-codec.ts +2 -1
  65. package/src/core/config/config-models.test.ts +10 -0
  66. package/src/core/config/config-models.ts +21 -0
  67. package/src/core/config/config-schema.test.ts +6 -0
  68. package/src/core/config/route-config.test.ts +15 -0
  69. package/src/core/config/route-config.ts +36 -0
  70. package/src/core/config/tools-config.test.ts +58 -1
  71. package/src/core/config/tools-config.ts +84 -0
  72. package/src/core/contracts/tools.ts +162 -29
  73. package/src/core/contracts/types.ts +36 -0
  74. package/src/core/runtime/agent-client-trace.test.ts +154 -0
  75. package/src/core/runtime/agent-client-trace.ts +288 -0
  76. package/src/core/runtime/launch-runtime.ts +13 -0
  77. package/src/core/runtime/trace-runtime.test.ts +18 -1
  78. package/src/core/runtime/trace-runtime.ts +28 -3
  79. package/src/core/state/state-codec.ts +2 -0
  80. package/src/infrastructure/config/config-agent-auth-repository.test.ts +183 -0
  81. package/src/infrastructure/config/config-agent-auth-repository.ts +453 -0
  82. package/src/infrastructure/config/config-agent-client-runtime-repository.test.ts +38 -0
  83. package/src/infrastructure/config/config-agent-client-runtime-repository.ts +307 -0
  84. package/src/infrastructure/config/config-approval-ledger.test.ts +32 -0
  85. package/src/infrastructure/config/config-approval-ledger.ts +16 -0
  86. package/src/infrastructure/config/config-client-repository.ts +3 -3
  87. package/src/infrastructure/config/config-conversation-ledger.test.ts +69 -0
  88. package/src/infrastructure/config/config-conversation-ledger.ts +8 -7
  89. package/src/infrastructure/config/config-observability-ledger.test.ts +50 -0
  90. package/src/infrastructure/config/config-observability-ledger.ts +65 -10
  91. package/src/infrastructure/config/config-route-repository.ts +4 -3
  92. package/src/infrastructure/config/configstore.ts +14 -3
  93. package/src/infrastructure/state/state-mysql.ts +2 -2
  94. package/src/kernel-api/v1/contracts.ts +8 -0
  95. package/src/routes/admin-agent-clients.test.ts +120 -0
  96. package/src/routes/admin-agent-clients.ts +161 -0
  97. package/src/routes/admin-runtime.test.ts +214 -0
  98. package/src/routes/admin-runtime.ts +82 -2
  99. package/src/routes/admin.ts +3 -0
  100. package/src/routes/agent-api.test.ts +379 -0
  101. package/src/routes/agent-api.ts +251 -0
  102. package/src/routes/agent-auth.test.ts +276 -0
  103. package/src/routes/agent-auth.ts +395 -0
  104. package/src/routes/approvals.ts +4 -1
  105. package/src/routes/critical-routes.test.ts +235 -1
  106. package/src/routes/private-default.ts +2 -1
  107. package/src/routes/private.ts +16 -1
  108. package/src/routes/run.ts +79 -13
  109. package/web/connect/bailing-connect-php.tgz +0 -0
  110. package/web/connect/bailing-connect-php7.tgz +0 -0
  111. package/web/console/assets/{Accounts-DuUY2UJU.js → Accounts-r10QUjLQ.js} +1 -1
  112. package/web/console/assets/AgentClients-DsWADpzr.css +1 -0
  113. package/web/console/assets/AgentClients-UTTqbkjy.js +1 -0
  114. package/web/console/assets/{Approvals-B11mo1dy.js → Approvals-BGKkYIya.js} +1 -1
  115. package/web/console/assets/{Audit-CQwJRIJT.js → Audit-CQmjOAoO.js} +1 -1
  116. package/web/console/assets/{BrandLockup-BIF-h1pi.js → BrandLockup-BF_0pCa3.js} +1 -1
  117. package/web/console/assets/{Channels-BIploUT-.js → Channels-C4yZE67F.js} +1 -1
  118. package/web/console/assets/{ChatEntries-Cpg_WV-o.js → ChatEntries-OqsqLjU6.js} +1 -1
  119. package/web/console/assets/Clients-CNIVs7Qn.css +1 -0
  120. package/web/console/assets/Clients-Dv3sv51C.js +3 -0
  121. package/web/console/assets/{Cost-BF52tfU2.js → Cost-C_-kiH59.js} +1 -1
  122. package/web/console/assets/{Credentials-SwfmQAv6.js → Credentials-CPTEAiV6.js} +1 -1
  123. package/web/console/assets/{Diagnostics-CJfbI_8p.js → Diagnostics-O-NKFOeI.js} +1 -1
  124. package/web/console/assets/{Executors-CzlZlznA.js → Executors-GVIAiNgv.js} +1 -1
  125. package/web/console/assets/{HelpTip-CT07o3kB.js → HelpTip-i-KJhf5s.js} +1 -1
  126. package/web/console/assets/{Kb-CVX22U4k.js → Kb-BsCWkJI1.js} +2 -2
  127. package/web/console/assets/{Login-PoUVsBI-.js → Login-VFjkHNMr.js} +1 -1
  128. package/web/console/assets/{Projects-DYlbjLQy.js → Projects-Ds-sJwfy.js} +1 -1
  129. package/web/console/assets/Routes-CXGl9SMM.css +1 -0
  130. package/web/console/assets/Routes-Wwurw2UU.js +124 -0
  131. package/web/console/assets/Runs-4zDD9VOC.css +1 -0
  132. package/web/console/assets/Runs-DLPzXmSy.js +3 -0
  133. package/web/console/assets/{Setup-xiPXit_b.js → Setup-BLelw0_V.js} +1 -1
  134. package/web/console/assets/Shell-CvaeK4j_.js +1 -0
  135. package/web/console/assets/Shell-D9Uw-fsa.css +1 -0
  136. package/web/console/assets/{StorageBuckets-Bjsc3pLd.js → StorageBuckets-Dv6u47yO.js} +1 -1
  137. package/web/console/assets/{SystemSettings-CcKF2lJ9.js → SystemSettings-B9K7zaDU.js} +1 -1
  138. package/web/console/assets/{SystemStatus-Oj1xjxJn.js → SystemStatus-H-oKDo-y.js} +1 -1
  139. package/web/console/assets/{Targets-y1KllVXT.js → Targets-CCFhjPKf.js} +1 -1
  140. package/web/console/assets/{Tools-DoEP_y9x.js → Tools-D0H9xpFH.js} +1 -1
  141. package/web/console/assets/index-CuoTgf6q.js +2 -0
  142. package/web/console/assets/{index-DZEQL_yy.js → index-DyX9Bz3V.js} +1 -1
  143. package/web/console/assets/{request-CBLNpLth.js → request-F5lXa7Ro.js} +1 -1
  144. package/web/console/assets/{schema-DzwLpuOy.js → schema-DUWaWqPn.js} +1 -1
  145. package/web/console/assets/{util-SiQC2MJh.js → util-4bN2dv7B.js} +1 -1
  146. package/web/console/assets/{vendor-element-D7WRzHhy.js → vendor-element-CZoEjZr8.js} +1 -1
  147. package/web/console/assets/{vendor-mammoth-DvgsHdlx.js → vendor-mammoth-nXG51Cg7.js} +1 -1
  148. package/web/console/index.html +2 -2
  149. package/web-admin/src/agent-direct-selection.ts +21 -0
  150. package/web-admin/src/layout/Shell.vue +1 -1
  151. package/web-admin/src/pages/AgentClients.vue +254 -0
  152. package/web-admin/src/pages/Clients.vue +13 -3
  153. package/web-admin/src/pages/Routes.vue +331 -16
  154. package/web-admin/src/pages/Runs.vue +159 -38
  155. package/web-admin/src/router.ts +2 -0
  156. package/web/console/assets/Clients--D7NQJKk.css +0 -1
  157. package/web/console/assets/Clients-DS29eUi2.js +0 -3
  158. package/web/console/assets/Routes-DSEvGujN.js +0 -124
  159. package/web/console/assets/Routes-DWGQN5Pv.css +0 -1
  160. package/web/console/assets/Runs-B-TsYZEt.js +0 -3
  161. package/web/console/assets/Runs-CUtSsPW-.css +0 -1
  162. package/web/console/assets/Shell-BVIjmoY8.css +0 -1
  163. package/web/console/assets/Shell-DNiWZOYB.js +0 -1
  164. package/web/console/assets/index-CxPIS6G7.js +0 -2
@@ -0,0 +1,107 @@
1
+ # Agent Client Runtime v1
2
+
3
+ 本版本化接口让已完成 Agent Auth 网页授权的本地智能体在本地承担规划,同时继续复用 BailingHub 的身份重验、工具治理、审批、审计与对话总账。它不替代现有 `/run`、聊天入口或执行器协议。配套的部署、业务授权页和宿主接入步骤见 [Agent Client v1 接入指南](AGENT_CLIENT_QUICKSTART.md),身份授权契约见 [Agent Auth v1](AGENT_AUTH_API.md)。
4
+
5
+ 所有接口只接受 `Authorization: Bearer <Agent access token>`,响应均 `Cache-Control: no-store`。工作区授权面始终取以下交集:Client `allowed_routes` ∩ Agent Session `allowed_routes` ∩ 启用且 audience 允许的 route ∩ `tools.agent_direct`。`agent_client.enabled=false` 只关闭本页接口,不关闭旧 `/agent-api/v1/tools`。
6
+
7
+ ## 端点
8
+
9
+ - `GET /agent-api/v1/workspaces`
10
+ - `GET /agent-api/v1/workspaces/:route/bootstrap`
11
+ - `POST /agent-api/v1/workspaces/:route/turns`
12
+ - `POST /agent-api/v1/workspaces/:route/capabilities/search`
13
+ - `POST /agent-api/v1/runs/:run_id/complete`
14
+ - 工具执行继续使用 `POST /agent-api/v1/tool-invocations` 与既有 resume 端点。
15
+
16
+ `turns` 与 `complete` 的原始 JSON 请求上限为 512 KiB。该上限可覆盖 64000 字符 Unicode 文本的 JSON 编码、Turn 的 16 KiB `page_context` 以及合理 envelope;解析后仍按各字段的字符上限严格校验。
17
+
18
+ ## 工具审批语义
19
+
20
+ `tools.agent_direct.write_tools` 只负责按精确 operationId 开放本地 Agent 可调用的写工具;工具是否需要审批默认继续以业务侧 ACC 的 `risk`、`approval.required` 和 `approval.when` 声明为准。路由只有把工具精确列入 `tools.agent_direct.force_approval_tools` 时,才会在 ACC 之外额外强制审批。高风险、ACC 明示审批和条件审批不会被路由覆盖掉。
21
+
22
+ 早期私有候选的 `unattended_write_tools` 仅保留兼容读取:存在该字段时,`write_tools` 中未列入它的工具仍按旧语义强制审批。新配置不得与 `force_approval_tools` 同时使用;删除旧字段表示默认继承 ACC,迁移为新字段时应填写旧 `write_tools` 与 `unattended_write_tools` 的差集,而不是原样复制旧列表。
23
+
24
+ ## Bootstrap
25
+
26
+ ```json
27
+ {
28
+ "schema_version": "bailing.agent-runtime-profile.v1",
29
+ "workspace": { "route": "tenant-agent", "name": "门店助手", "description": "" },
30
+ "profile": {
31
+ "revision": "<sha256>",
32
+ "instructions": "【路由系统规则】\n...\n\n【本地 Agent 补充规则】\n...",
33
+ "memory": { "recent_messages": 12, "recent_budget_chars": 8000, "per_message_chars": 2000, "summary_enabled": false, "summary_max_chars": 1200 },
34
+ "knowledge": { "enabled": true, "sources": 1, "mode": "chunk", "top_k": 5, "max_docs": 4, "page_boost": false },
35
+ "governance": {
36
+ "planner": "local_agent",
37
+ "execution": "bailinghub_governed",
38
+ "authorization": "server_revalidated",
39
+ "knowledge_trust": "reference_only",
40
+ "tool_results_trust": "untrusted_data",
41
+ "hidden_reasoning_sync": false,
42
+ "max_tool_calls": 5,
43
+ "permission": "full"
44
+ }
45
+ },
46
+ "capabilities": { "revision": "<sha256>", "authorized_total": 312, "active_limit": 8, "readonly": 311, "writes": 1, "approval_required": 0 }
47
+ }
48
+ ```
49
+
50
+ Bootstrap 只逐字段抽取 `target_config.system_prompt`,再拼接可选 `agent_client.instructions`。不会返回 `credential`、`model`、其他 `target_config`、ToolProvider base URL/secret 或业务工具出站配置。
51
+
52
+ ## Turn
53
+
54
+ 请求的四个标识/输入字段必填;`page_context` 与 `renderers` 可选。未知字段拒绝。
55
+ `user_input` 最多 64000 字符;`renderers` 最多 20 个,名称必须合法且不能重复。客户端文本出现不允许的控制字符、超长或非法 renderer 时直接返回 `400`,服务端不会截断、替换或静默丢弃。
56
+
57
+ ```json
58
+ {
59
+ "client_conversation_id": "local-conversation-1",
60
+ "client_turn_id": "turn-1",
61
+ "user_message_id": "message-1",
62
+ "user_input": "帮我查一下员工 Ada",
63
+ "page_context": { "url": "/staff", "title": "员工" },
64
+ "renderers": ["markdown", "bailing-form.v1"]
65
+ }
66
+ ```
67
+
68
+ ```json
69
+ {
70
+ "schema_version": "bailing.agent-turn-context.v1",
71
+ "run_id": "<uuid>",
72
+ "profile_revision": "<sha256>",
73
+ "capability_revision": "<sha256>",
74
+ "context": {
75
+ "instructions": "...",
76
+ "page_context": {},
77
+ "renderers": [],
78
+ "memory": { "summary": null, "recent": [] },
79
+ "memory_refs": [{ "thread_id": 7, "summary_upto_id": 0, "prior_messages": 0 }],
80
+ "knowledge": [{ "ref": "knowledge:1", "title": "...", "content": "..." }],
81
+ "knowledge_refs": [{ "ref": "knowledge:1", "doc_id": 9, "title": "...", "score": 0.82 }],
82
+ "governance": { "planner": "local_agent", "execution": "bailinghub_governed", "authorization": "server_revalidated", "knowledge_trust": "reference_only", "tool_results_trust": "untrusted_data", "hidden_reasoning_sync": false, "max_tool_calls": 5, "permission": "full" }
83
+ },
84
+ "active_tools": []
85
+ }
86
+ ```
87
+
88
+ 同一 Agent Session + route + conversation + turn,以及同一 `user_message_id`,会冻结到同一个 `run_id` 和上下文快照;同键不同请求返回 `409`。服务端先读取本轮之前的 memory,再把用户可见消息追加到总账。
89
+
90
+ 能力搜索最多返回 12 个完整 typed tools,schema 为 `bailing.agent-capability-search.v1`。检索只在当前授权集内进行;任一工具源的 embedding 不可用时,整次搜索确定性退回 lexical 排序。
91
+ 能力搜索必须提供非空 `query`,或者提供属于当前 Agent Session 与 route 的合法 `run_id`,由服务端回退使用该 run 的 `user_input`。
92
+
93
+ ## Complete
94
+
95
+ ```json
96
+ {
97
+ "assistant_message_id": "assistant-message-1",
98
+ "status": "completed",
99
+ "content": "已完成。",
100
+ "model": "optional-model-name",
101
+ "runtime": "optional-runtime-name",
102
+ "usage": { "input_tokens": 120, "cached_input_tokens": 80, "output_tokens": 30, "total_tokens": 150, "tool_calls": 1 }
103
+ }
104
+ ```
105
+
106
+ `assistant_message_id`、状态、可见正文、model/runtime/usage 共同参与幂等指纹;完全相同的重放返回 `200`,任一字段改变返回 `409`。接口不接收、不同步、也不落库 hidden reasoning。
107
+ `content` 最多 64000 字符,`model` 与 `runtime` 各最多 191 字符;超长或包含不允许控制字符时返回 `400`,不会静默规范化后落库。
@@ -22,6 +22,31 @@ Each public version should describe:
22
22
 
23
23
  ## Unreleased
24
24
 
25
+ ## v0.5.1 - Agent Client Management and Bulk Write-Operation Configuration
26
+
27
+ Planned release date: 2026-09-01.
28
+
29
+ - **Agent Client management center**: adds a dedicated console page that summarizes applications with business authorization enabled, available workspaces, Agent Session state, and recent run statistics without creating a second Client, route, or executor resource model.
30
+ - **Session governance**: administrators can filter Agent Sessions by client and state and revoke an individual session. The projection never returns access tokens, refresh tokens, prompts, tool arguments, or business results.
31
+ - **Bulk write-operation configuration**: the route page can select or clear every writable operationId currently declared by the selected tool sources. The stored policy remains an exact operationId list, rejects wildcards, and cannot weaken ACC approval or final business authorization.
32
+ - **Neutral business authorization entry**: the bilingual guides define `agent_authorize_url` as one account- and tenant-neutral entry. The business page still owns login, account switching, and explicit tenant selection, while the business backend derives trusted `principal` and `on_behalf_of` values from the current session. Local `connectionName` only selects a local connection instance.
33
+ - **Database and runtime contracts**: no migration is added, and Agent Client Runtime, Client API, Kernel API, business SDK, Widget, tool-signature, approval, and final-authorization semantics remain unchanged.
34
+ - **Validation**: 612 Core tests, console build and E2E, Client API ecosystem consumers, SDK contracts, Docker Demo, security audit, OSS export, and npm artifact checks.
35
+ - **Related docs**: [RELEASE_NOTES_v0.5.1.en.md](RELEASE_NOTES_v0.5.1.en.md), [Agent Client v1 Integration Guide](AGENT_CLIENT_QUICKSTART.en.md), and [Agent Auth v1](AGENT_AUTH_API.en.md).
36
+
37
+ ## v0.5.0 - Revocable Local-Agent Authorization and Governed Local Planning
38
+
39
+ Released on 2026-08-26.
40
+
41
+ - **Agent Auth v1**: adds browser + PKCE authorization in which the business system reuses its existing authenticated session to approve a trusted subject and routes. Access tokens are short-lived, refresh tokens rotate with replay fail-closed behavior, and sessions can be revoked locally or by the business backend.
42
+ - **Agent Client Runtime v1**: the local Agent owns planning and multi-step selection while Core continues to provide bounded prompts, memory, knowledge, and tools and owns identity revalidation, approval, idempotency, business invocation, recovery, and audit.
43
+ - **Constrained capability and approval policy**: the route page adds structured `tools.agent_direct` configuration. Writable tools are exposed by exact operation ID; approval inherits business-side ACC by default, and `force_approval_tools` may only tighten policy.
44
+ - **Visible conversation and trace**: user messages, visible final answers, tool requests, and governance outcomes from local planning enter the Core ledger. Hidden reasoning is not accepted, synchronized, or persisted.
45
+ - **Business-side SDKs**: both the PHP 8.1+ and PHP 7.3-compatible SDKs add the same server-side `AgentAuth` thin client. The Client Token remains only in the business backend and never enters a browser, local plugin, or public configuration.
46
+ - **Database schema**: adds `055_agent_auth.sql` and `056_agent_client_runtime.sql`. Apply every pending migration through the official migrator; do not modify an applied file or copy another instance's state database.
47
+ - **Compatibility**: the new capability is an optional additive surface. Existing `/run`, chat entries, Client API v1, Kernel Host API v1, Executor Protocol, ACC, tool signatures, and final business authorization remain compatible.
48
+ - **Related docs**: [RELEASE_NOTES_v0.5.0.en.md](RELEASE_NOTES_v0.5.0.en.md), [Agent Client v1 Integration Guide](AGENT_CLIENT_QUICKSTART.en.md), [Agent Auth v1](AGENT_AUTH_API.en.md), [Agent Client Runtime v1](AGENT_CLIENT_RUNTIME_API.en.md), and [Compatibility](COMPATIBILITY.en.md).
49
+
25
50
  ## v0.4.0 - Native Conversational Forms and Chat-Entry Controls
26
51
 
27
52
  Released on 2026-08-25.
package/docs/CHANGELOG.md CHANGED
@@ -15,6 +15,31 @@
15
15
 
16
16
  ## Unreleased
17
17
 
18
+ ## v0.5.1 - 智能体客户端管理中心与批量写操作配置
19
+
20
+ 计划发布日期:2026-09-01。
21
+
22
+ - **智能体客户端管理中心**:新增独立控制台菜单,汇总已启用业务授权的客户端应用、可用工作区、Agent Session 状态与最近运行统计,不创建第二套 Client、路由或执行器资源。
23
+ - **会话治理**:管理员可按客户端和状态查看 Agent Session,并逐个撤销;投影不返回 access token、refresh token、提示词、工具参数或业务结果。
24
+ - **批量写操作配置**:路由页可一次选择或清除当前工具源声明的全部可写 operationId;保存结果仍是精确 operationId 列表,不接受通配符,也不放宽 ACC 审批或业务系统最终授权。
25
+ - **统一业务授权入口**:中英文文档明确 `agent_authorize_url` 是账号与租户中立的统一入口。业务页面继续负责登录、换号与显式租户选择,业务后端从当前会话派生可信 `principal` 与 `on_behalf_of`;本地 `connectionName` 只选择本机连接实例。
26
+ - **数据库与运行契约**:没有新增 migration,也不改变 Agent Client Runtime、Client API、Kernel API、业务 SDK、Widget、工具签名、审批与最终业务授权语义。
27
+ - **验证方式**:Core 612 项单测、控制台构建与 E2E、Client API 生态消费者、SDK 契约、Docker Demo、安全审计、OSS 导出和 npm 制品检查。
28
+ - **相关文档**:[RELEASE_NOTES_v0.5.1.md](RELEASE_NOTES_v0.5.1.md)、[Agent Client v1 接入指南](AGENT_CLIENT_QUICKSTART.md) 与 [Agent Auth v1](AGENT_AUTH_API.md)。
29
+
30
+ ## v0.5.0 - 可撤销本地 Agent 授权与受治理本地编排
31
+
32
+ 发布日期:2026-08-26。
33
+
34
+ - **Agent Auth v1**:新增浏览器 + PKCE 授权,由业务系统复用现有登录态批准可信主体和 route;access token 短期有效,refresh token 轮换并对重放失败关闭,会话可由本地或业务后端撤销。
35
+ - **Agent Client Runtime v1**:本地 Agent 负责规划与多步选择;Core 继续提供受限的提示词、记忆、知识和工具面,并负责身份重验、审批、幂等、业务调用、恢复和审计。
36
+ - **能力与审批收敛**:路由页新增 `tools.agent_direct` 结构化配置。可写工具按精确 operationId 开放;审批默认继承业务侧 ACC,`force_approval_tools` 只能额外收紧。
37
+ - **会话和轨迹可见**:本地编排的用户消息、可见最终回复、工具申请和治理结果进入 Core 总账;不接收、不同步也不持久化 hidden reasoning。
38
+ - **业务侧 SDK**:PHP 8.1+ 与 PHP 7.3 兼容 SDK 都增加同语义的服务端 `AgentAuth` 薄客户端。Client Token 仍只存业务后端,不进入浏览器、本地插件或公开配置。
39
+ - **数据库结构**:新增 `055_agent_auth.sql` 和 `056_agent_client_runtime.sql`。升级时必须通过正式迁移器执行全部未应用 migration,不得修改已应用文件或复制其他实例的状态库。
40
+ - **兼容性**:新能力为可选增量接口;现有 `/run`、聊天入口、Client API v1、Kernel Host API v1、Executor Protocol、ACC、工具签名和业务最终授权语义保持兼容。
41
+ - **相关文档**:[RELEASE_NOTES_v0.5.0.md](RELEASE_NOTES_v0.5.0.md)、[Agent Client v1 接入指南](AGENT_CLIENT_QUICKSTART.md)、[Agent Auth v1](AGENT_AUTH_API.md)、[Agent Client Runtime v1](AGENT_CLIENT_RUNTIME_API.md) 与[兼容性与升级](兼容性与升级.md)。
42
+
18
43
  ## v0.4.0 - 原生对话表单与聊天入口控制
19
44
 
20
45
  发布日期:2026-08-25。
@@ -7,7 +7,7 @@ It is not certification, a benchmark, or evidence of production adoption. Passin
7
7
  ## Scope
8
8
 
9
9
  - Target: the open-source BailingHub Docker demo;
10
- - Stable baseline: `v0.4.0`;
10
+ - Stable baseline: `v0.5.1`;
11
11
  - Data: the bundled demo orders, tickets, refunds, and failure probe;
12
12
  - Expected time: about 20 minutes after images and dependencies are available;
13
13
  - Not required: a real model key, production API, production credential, or real business data.
@@ -32,7 +32,7 @@ curl -fsSL https://www.bailinghub.com/install.sh | sh
32
32
  cd "$HOME/bailinghub"
33
33
  ```
34
34
 
35
- The installer pulls the official `v0.4.0` images by default, generates random tokens and an admin password, starts the services, and runs the smoke test. The initial administrator is created only when the administrator table is empty; restarting, upgrading, recreating containers, or reinstalling against the same persistent database does not overwrite a changed password. The optional `/metrics` endpoint remains disabled and does not affect core validation. Keep the reported version, install mode, elapsed time, and the commands printed under `常用命令`, but never include passwords or tokens in your report. After Docker is installed, the current non-root login usually still needs the printed `sudo docker compose ...` commands; Docker group membership may not take effect until the next login.
35
+ The installer pulls the official `v0.5.1` images by default, generates random tokens and an admin password, starts the services, and runs the smoke test. The initial administrator is created only when the administrator table is empty; restarting, upgrading, recreating containers, or reinstalling against the same persistent database does not overwrite a changed password. The optional `/metrics` endpoint remains disabled and does not affect core validation. Keep the reported version, install mode, elapsed time, and the commands printed under `常用命令`, but never include passwords or tokens in your report. After Docker is installed, the current non-root login usually still needs the printed `sudo docker compose ...` commands; Docker group membership may not take effect until the next login.
36
36
 
37
37
  If the default directory is already in use, choose a new empty directory instead of overwriting an existing deployment:
38
38
 
@@ -46,7 +46,7 @@ cd "$HOME/bailinghub-validation"
46
46
  ### Path B: local source reproduction
47
47
 
48
48
  ```bash
49
- git clone --depth 1 --branch v0.4.0 https://github.com/bailinghub/bailinghub.git
49
+ git clone --depth 1 --branch v0.5.1 https://github.com/bailinghub/bailinghub.git
50
50
  cd bailinghub
51
51
  git rev-parse HEAD
52
52
  export BAILING_TOKEN="$(openssl rand -hex 32)"
@@ -167,7 +167,7 @@ After the core task passes, you may continue with:
167
167
  - [Trusted rich rendering and chat reliability](RELEASE_NOTES_v0.1.15.en.md).
168
168
  - [Bounded tool runtime and resilient semantic retrieval](RELEASE_NOTES_v0.1.16.en.md).
169
169
  - [Composable Core and Kernel Host API v1](RELEASE_NOTES_v0.3.0.en.md).
170
- - [Current stable release notes](RELEASE_NOTES_v0.4.0.en.md).
170
+ - [Current stable release notes](RELEASE_NOTES_v0.5.1.en.md).
171
171
 
172
172
  Select the relevant track in the same Issue form and disclose whether you received direct maintainer assistance.
173
173
 
@@ -7,7 +7,7 @@
7
7
  ## 验证范围
8
8
 
9
9
  - 验证对象:BailingHub 开源版 Docker demo;
10
- - 稳定基线:`v0.4.0`;
10
+ - 稳定基线:`v0.5.1`;
11
11
  - 数据范围:仓库自带的 demo 订单、工单、退款和故障工具;
12
12
  - 预计用时:镜像和依赖下载完成后约 20 分钟;
13
13
  - 不需要:真实大模型 Key、生产 API、生产凭据或真实业务数据。
@@ -32,7 +32,7 @@ curl -fsSL https://www.bailinghub.com/install.sh | sh
32
32
  cd "$HOME/bailinghub"
33
33
  ```
34
34
 
35
- 脚本默认拉取 `v0.4.0` 官方镜像,生成随机 Token 与后台密码,启动服务并自动运行基础体检。首次管理员只在数据库管理员表为空时创建;对同一持久化数据库进行重启、升级、容器重建或重新安装,不会覆盖已经修改的管理员密码。可选 `/metrics` 端点默认关闭,不影响基础验证。请保留终端输出中的版本、安装模式、耗时和“常用命令”,但不要把密码或 Token 写入反馈。新安装 Docker 后,当前非 root 会话通常仍需使用脚本打印的 `sudo docker compose ...` 命令;重新登录后 Docker 组权限才可能生效。
35
+ 脚本默认拉取 `v0.5.1` 官方镜像,生成随机 Token 与后台密码,启动服务并自动运行基础体检。首次管理员只在数据库管理员表为空时创建;对同一持久化数据库进行重启、升级、容器重建或重新安装,不会覆盖已经修改的管理员密码。可选 `/metrics` 端点默认关闭,不影响基础验证。请保留终端输出中的版本、安装模式、耗时和“常用命令”,但不要把密码或 Token 写入反馈。新安装 Docker 后,当前非 root 会话通常仍需使用脚本打印的 `sudo docker compose ...` 命令;重新登录后 Docker 组权限才可能生效。
36
36
 
37
37
  如果默认目录已被占用,请使用一个新的空目录,不要覆盖现有部署:
38
38
 
@@ -46,7 +46,7 @@ cd "$HOME/bailinghub-validation"
46
46
  ### 路径 B:本地源码复现
47
47
 
48
48
  ```bash
49
- git clone --depth 1 --branch v0.4.0 https://github.com/bailinghub/bailinghub.git
49
+ git clone --depth 1 --branch v0.5.1 https://github.com/bailinghub/bailinghub.git
50
50
  cd bailinghub
51
51
  git rev-parse HEAD
52
52
  export BAILING_TOKEN="$(openssl rand -hex 32)"
@@ -167,7 +167,7 @@ docker compose exec -T bailinghub npm run demo:e2e
167
167
  - [可信富内容渲染与聊天可靠性](RELEASE_NOTES_v0.1.15.md)。
168
168
  - [工具运行时收敛与语义检索韧性](RELEASE_NOTES_v0.1.16.md)。
169
169
  - [可组合 Core 与 Kernel Host API v1](RELEASE_NOTES_v0.3.0.md)。
170
- - [当前稳定版发布说明](RELEASE_NOTES_v0.4.0.md)。
170
+ - [当前稳定版发布说明](RELEASE_NOTES_v0.5.1.md)。
171
171
 
172
172
  扩展验证请在同一 Issue 模板中选择对应路径,并说明是否获得过维护者的直接帮助。
173
173
 
package/docs/README.en.md CHANGED
@@ -10,6 +10,12 @@ This directory contains public documentation for the open-source BailingHub proj
10
10
  | [DEMO.en.md](DEMO.en.md) | Docker demo walkthrough: hub, MySQL, demo business system, tool provider, audit, and trace. |
11
11
  | [INDEPENDENT_VALIDATION.en.md](INDEPENDENT_VALIDATION.en.md) | Independent Docker demo task with objective pass criteria and a standard report path. |
12
12
  | [INDEPENDENT_VALIDATION.md](INDEPENDENT_VALIDATION.md) | Chinese independent validation task. |
13
+ | [AGENT_CLIENT_QUICKSTART.en.md](AGENT_CLIENT_QUICKSTART.en.md) | End-to-end Agent Client setup and configuration ownership. |
14
+ | [AGENT_CLIENT_QUICKSTART.md](AGENT_CLIENT_QUICKSTART.md) | Chinese Agent Client integration guide. |
15
+ | [AGENT_AUTH_API.en.md](AGENT_AUTH_API.en.md) | Agent Auth v1, PKCE, trusted business identity, and revocation. |
16
+ | [AGENT_AUTH_API.md](AGENT_AUTH_API.md) | Chinese Agent Auth v1 protocol. |
17
+ | [AGENT_CLIENT_RUNTIME_API.en.md](AGENT_CLIENT_RUNTIME_API.en.md) | Agent Client Runtime v1 workspaces, turns, tools, and completion contract. |
18
+ | [AGENT_CLIENT_RUNTIME_API.md](AGENT_CLIENT_RUNTIME_API.md) | Chinese Agent Client Runtime v1 contract. |
13
19
  | [user-guide/README.en.md](user-guide/README.en.md) | User and product-owner guide: business goals, console concepts, and scenario-based setup. |
14
20
  | [CONTRACT.en.md](CONTRACT.en.md) | Stable HTTP and wire contract between business systems and the hub. |
15
21
  | [INTEGRATION.en.md](INTEGRATION.en.md) | Third-party integration guide for tools, signatures, authorization, and callback handling. |
@@ -99,8 +105,10 @@ This directory contains public documentation for the open-source BailingHub proj
99
105
  | [RELEASE_NOTES_v0.3.3.md](RELEASE_NOTES_v0.3.3.md) | Chinese `v0.3.3` release notes. |
100
106
  | [RELEASE_NOTES_v0.3.4.en.md](RELEASE_NOTES_v0.3.4.en.md) | `v0.3.4` anonymous-preview and trusted-business-identity guidance. |
101
107
  | [RELEASE_NOTES_v0.3.4.md](RELEASE_NOTES_v0.3.4.md) | Chinese `v0.3.4` release notes. |
102
- | [RELEASE_NOTES_v0.4.0.en.md](RELEASE_NOTES_v0.4.0.en.md) | `v0.4.0` native conversational forms and chat-entry controls. |
103
- | [RELEASE_NOTES_v0.4.0.md](RELEASE_NOTES_v0.4.0.md) | Chinese `v0.4.0` release notes. |
108
+ | [RELEASE_NOTES_v0.5.0.en.md](RELEASE_NOTES_v0.5.0.en.md) | `v0.5.0` revocable local-Agent authorization and governed local planning. |
109
+ | [RELEASE_NOTES_v0.5.0.md](RELEASE_NOTES_v0.5.0.md) | Chinese `v0.5.0` release notes. |
110
+ | [RELEASE_NOTES_v0.5.1.en.md](RELEASE_NOTES_v0.5.1.en.md) | `v0.5.1` Agent Client management center and bulk write-operation configuration. |
111
+ | [RELEASE_NOTES_v0.5.1.md](RELEASE_NOTES_v0.5.1.md) | Chinese `v0.5.1` release notes. |
104
112
  | [RELEASE_NOTES_v0.1.0.en.md](RELEASE_NOTES_v0.1.0.en.md) | First public release notes. |
105
113
  | [CHANGELOG.en.md](CHANGELOG.en.md) | Public changelog format and current release summary. |
106
114
  | [COMPATIBILITY.en.md](COMPATIBILITY.en.md) | Versioning, compatibility, migration, and schema discipline. |
package/docs/README.md CHANGED
@@ -14,6 +14,12 @@
14
14
  | [DEMO.en.md](DEMO.en.md) | English Docker demo walkthrough. |
15
15
  | [INDEPENDENT_VALIDATION.md](INDEPENDENT_VALIDATION.md) | 陌生开发者仅凭公开资料验证 Docker demo 的任务卡、通过标准与反馈方式。 |
16
16
  | [INDEPENDENT_VALIDATION.en.md](INDEPENDENT_VALIDATION.en.md) | English independent validation task, pass criteria, and report path. |
17
+ | [AGENT_CLIENT_QUICKSTART.md](AGENT_CLIENT_QUICKSTART.md) | 智能体客户端从 Core、业务授权页、通用 SDK 到本地宿主插件的完整接入路径。 |
18
+ | [AGENT_CLIENT_QUICKSTART.en.md](AGENT_CLIENT_QUICKSTART.en.md) | English end-to-end Agent Client integration guide and configuration ownership. |
19
+ | [AGENT_AUTH_API.md](AGENT_AUTH_API.md) | Agent Auth v1:业务登录态绑定、PKCE、Token 交换与会话撤销的语言无关契约。 |
20
+ | [AGENT_AUTH_API.en.md](AGENT_AUTH_API.en.md) | English Agent Auth v1 protocol and trusted business-identity boundary. |
21
+ | [AGENT_CLIENT_RUNTIME_API.md](AGENT_CLIENT_RUNTIME_API.md) | Agent Client Runtime v1:工作区、turn、能力搜索、工具执行与完成回传。 |
22
+ | [AGENT_CLIENT_RUNTIME_API.en.md](AGENT_CLIENT_RUNTIME_API.en.md) | English Agent Client Runtime v1 contract. |
17
23
  | [user-guide/README.md](user-guide/README.md) | 使用者/产品经理视角:从业务需求出发,理解为什么需要中枢、后台菜单怎么配、配完交给开发者什么。 |
18
24
  | [CONTRACT.md](CONTRACT.md) | 业务系统和中枢之间的稳定网络契约,接入前应先读。 |
19
25
  | [CONTRACT.en.md](CONTRACT.en.md) | English HTTP and wire contract summary. |
@@ -112,8 +118,10 @@
112
118
  | [RELEASE_NOTES_v0.3.3.en.md](RELEASE_NOTES_v0.3.3.en.md) | English `v0.3.3` npm publication provenance-metadata correction. |
113
119
  | [RELEASE_NOTES_v0.3.4.md](RELEASE_NOTES_v0.3.4.md) | `v0.3.4` 匿名预览与可信业务身份引导说明。 |
114
120
  | [RELEASE_NOTES_v0.3.4.en.md](RELEASE_NOTES_v0.3.4.en.md) | English `v0.3.4` anonymous-preview and trusted-business-identity guidance. |
115
- | [RELEASE_NOTES_v0.4.0.md](RELEASE_NOTES_v0.4.0.md) | `v0.4.0` 原生对话表单与聊天入口控制说明。 |
116
- | [RELEASE_NOTES_v0.4.0.en.md](RELEASE_NOTES_v0.4.0.en.md) | English `v0.4.0` native conversational forms and chat-entry controls. |
121
+ | [RELEASE_NOTES_v0.5.0.md](RELEASE_NOTES_v0.5.0.md) | `v0.5.0` 可撤销本地 Agent 授权与受治理本地编排说明。 |
122
+ | [RELEASE_NOTES_v0.5.0.en.md](RELEASE_NOTES_v0.5.0.en.md) | English `v0.5.0` revocable local-Agent authorization and governed local planning release notes. |
123
+ | [RELEASE_NOTES_v0.5.1.md](RELEASE_NOTES_v0.5.1.md) | `v0.5.1` 智能体客户端管理中心与批量写操作配置说明。 |
124
+ | [RELEASE_NOTES_v0.5.1.en.md](RELEASE_NOTES_v0.5.1.en.md) | English `v0.5.1` Agent Client management center and bulk write-operation configuration release notes. |
117
125
  | [RELEASE_NOTES_v0.1.0.md](RELEASE_NOTES_v0.1.0.md) | 首个公开版本的 GitHub Release 草稿。 |
118
126
  | [RELEASE_NOTES_v0.1.0.en.md](RELEASE_NOTES_v0.1.0.en.md) | English release notes. |
119
127
  | [CHANGELOG.md](CHANGELOG.md) | 公开发布后的对外变更记录。 |
@@ -0,0 +1,41 @@
1
+ # BailingHub v0.5.0: Revocable Local-Agent Authorization and Governed Local Planning
2
+
3
+ `v0.5.0` adds Agent Auth v1 and Agent Client Runtime v1. A local Agent may now own understanding, planning, and multi-step tool selection while BailingHub continues to own revocable business identity, route and capability filtering, approvals, idempotency, business invocation, recovery, audit, and the visible conversation ledger. These are optional additive surfaces; they do not replace `/run`, chat entries, or the executor protocol.
4
+
5
+ ## Main changes
6
+
7
+ - **Agent Auth v1**: a local SDK starts browser authorization with PKCE S256 and a locked loopback callback. The business system continues to use its own authenticated session, user/tenant/role model, and permission tables when deciding whether to approve.
8
+ - **Revocable Agent Sessions**: access tokens are short-lived, refresh tokens rotate, and replay of an old refresh token fails closed. Core stores only SHA-256 token digests and supports user denial, local revocation, and business-backend session revocation.
9
+ - **Agent Client Runtime v1**: adds workspace discovery, bounded bootstrap, turn snapshots, authorized capability search, governed tool invocation, and visible completion reporting. Prompts, memory, knowledge, and capability configuration remain centrally managed by Core while planning runs locally.
10
+ - **Exact capability and approval semantics**: an effective workspace is the intersection of the client, Agent Session, route audience, and `tools.agent_direct` policies. `write_tools` explicitly exposes writable operation IDs. Approval continues to inherit business-side ACC by default, while `force_approval_tools` may only tighten the policy.
11
+ - **Visible conversation and governance trace**: user messages, visible final answers, tool requests, and governance outcomes enter the Core ledger. Hidden reasoning is neither accepted, synchronized, nor persisted.
12
+ - **Business-side SDKs**: both the PHP 8.1+ and PHP 7.3-compatible SDKs provide the same server-side `AgentAuth` thin client for context, approve, deny, and session revoke. Non-PHP systems may implement the same HTTP contract directly.
13
+ - **Console configuration**: the route page configures `tools.agent_direct` structurally and reads operation ID, scope, read-only status, and ACC approval metadata from the selected tool provider. Writable-tool allowlists cannot use `*`.
14
+
15
+ ## Security and responsibility boundaries
16
+
17
+ - The authorization page belongs to the business system. The BailingHub SDK provides server-side methods; it does not inject a universal UI or replace business login and final authorization.
18
+ - The Client Token is supplied only to the business backend. It must not enter browser JavaScript, URLs, local-plugin settings, logs, or screenshots. The local Agent also receives no Tool Provider Secret, business password, cookie, business API address, or model key.
19
+ - Agent Auth binds revocable business identity, device, and routes. It carries no plan, payment, entitlement, or usage semantics.
20
+ - Tool invocation still revalidates the session and policy in BailingHub and follows the existing idempotency, approval, uncertain-outcome freezing, and audit paths. Every business tool endpoint must still verify the request signature and current business permission.
21
+ - Host plugins, the generic Agent SDK/MCP package, and model providers are not bundled with BailingHub Core. Install them independently according to their public compatibility matrices.
22
+
23
+ ## Compatibility and upgrade
24
+
25
+ - This release adds `055_agent_auth.sql` and `056_agent_client_runtime.sql`. Back up the state database, upgrade code or images, run `npm run db:init`, and start or switch traffic only after every pending migration succeeds. Never edit an applied migration or copy a state database from another instance.
26
+ - Agent Auth v1 and Agent Client Runtime v1 are additive. Existing `/run`, chat entries, Client API v1, Kernel Host API v1, Executor Protocol, ACC, tickets, tool signatures, and final business authorization remain compatible.
27
+ - Deployments that do not use Agent Client need no authorization page or `tools.agent_direct` configuration. Existing chat-entry and executor flows keep their original behavior.
28
+ - The early private-candidate `unattended_write_tools` field remains read-compatible only. New configuration uses `force_approval_tools`; migrate it with the set-difference rule documented by the public Runtime contract.
29
+
30
+ ## Validation
31
+
32
+ The stable release gate requires the complete `npm run release:check`, type checks, focused Core and Agent Auth/Runtime coverage, console builds, database migration checks, bilingual documentation, OSS-boundary and security scans, npm artifact consistency, and a clean-host acceptance flow using only public dependencies. That acceptance covers browser authorization, a read-only invocation, a reversible write, and conversation/trace inspection. Before publication, both source and actual package artifacts must also be checked for private domains, local paths, credentials, and local dependencies.
33
+
34
+ ## Related documentation
35
+
36
+ - [Agent Client v1 Integration Guide](AGENT_CLIENT_QUICKSTART.en.md)
37
+ - [Agent Auth v1](AGENT_AUTH_API.en.md)
38
+ - [Agent Client Runtime v1](AGENT_CLIENT_RUNTIME_API.en.md)
39
+ - [Business-side PHP SDK](../sdk/php/README.md) / [PHP 7.3 SDK](../sdk/php7/README.md)
40
+ - [Compatibility and upgrade](COMPATIBILITY.en.md)
41
+ - [中文发布说明](RELEASE_NOTES_v0.5.0.md)
@@ -0,0 +1,41 @@
1
+ # BailingHub v0.5.0:可撤销本地 Agent 授权与受治理本地编排
2
+
3
+ `v0.5.0` 新增 Agent Auth v1 与 Agent Client Runtime v1,让本地智能体可以承担理解、规划和多步工具选择,同时继续由 BailingHub 负责可撤销业务身份、route 与能力裁剪、审批、幂等、业务调用、恢复、审计和可见会话总账。这是新增的可选接入面,不替代现有 `/run`、聊天入口或执行器协议。
4
+
5
+ ## 主要变化
6
+
7
+ - **Agent Auth v1**:本地 SDK 使用浏览器、PKCE S256 和锁定的 loopback callback 发起授权;业务系统继续使用自己的登录态、用户/租户/角色与权限表决定是否批准。
8
+ - **可撤销 Agent Session**:access token 短期有效,refresh token 逐次轮换,旧 token 重放失败关闭;Core 只持久化 token 的 SHA-256 摘要,并支持用户拒绝、本地撤销和业务后端按 session 撤销。
9
+ - **Agent Client Runtime v1**:提供 workspace 发现、受限 bootstrap、turn 快照、授权能力搜索、治理工具调用和可见结果回传。提示词、记忆、知识库与能力配置仍由 Core 统一管理,规划在本地完成。
10
+ - **精确能力和审批语义**:有效工作区取接入方、Agent Session、route 受众与 `tools.agent_direct` 的交集。`write_tools` 只精确开放可写 operationId;是否需审批默认继承业务侧 ACC,`force_approval_tools` 只能额外收紧。
11
+ - **可见会话与治理轨迹**:本地编排的用户消息、可见最终回复、工具申请与治理结果进入 Core 总账;不接收、不同步、不持久化 hidden reasoning。
12
+ - **业务侧 SDK**:PHP 8.1+ 与 PHP 7.3 兼容 SDK 都提供同语义的服务端 `AgentAuth` 薄客户端,用于 context、approve、deny 和 session revoke。非 PHP 系统可直接实现同一 HTTP 契约。
13
+ - **控制台配置**:路由页可结构化配置 `tools.agent_direct`,并从选定工具源读取 operationId、scope、只读与 ACC 审批元数据;不允许用 `*` 代替可写工具白名单。
14
+
15
+ ## 安全与责任边界
16
+
17
+ - 业务授权页属于业务系统。BailingHub SDK 只提供服务端方法,不自动注入通用 UI,也不代替业务登录和最终权限判定。
18
+ - Client Token 只交给业务后端;不进入浏览器 JavaScript、URL、本地插件配置、日志或截图。本地 Agent 也不获取 Tool Provider Secret、业务密码、Cookie、业务 API 地址或模型 Key。
19
+ - Agent Auth 只绑定可撤销业务身份、设备和 route,不承载套餐、付费、权益或用量语义。
20
+ - 工具调用仍由 BailingHub 重验会话和权限面,并经过现有幂等、审批、不确定结果冻结与审计路径;业务工具端点每次仍须验签并查当前权限。
21
+ - 本地宿主插件、通用 Agent SDK/MCP 包和模型提供方不包含在 BailingHub Core 制品中,应按各自公开兼容矩阵独立安装。
22
+
23
+ ## 兼容性与升级
24
+
25
+ - 新增 `055_agent_auth.sql` 和 `056_agent_client_runtime.sql`。升级前备份状态库,升级代码或镜像后运行 `npm run db:init`,确认所有未应用 migration 成功后再启动或切流。不得修改已应用 migration 或从其他实例复制状态库。
26
+ - Agent Auth v1 和 Agent Client Runtime v1 是增量接口。原有 `/run`、聊天入口、Client API v1、Kernel Host API v1、Executor Protocol、ACC、票据、工具签名和业务最终授权语义保持兼容。
27
+ - 不使用 Agent Client 的部署无需配置授权页或 `tools.agent_direct`;现有聊天入口和执行器继续按原路径运行。
28
+ - 早期私有候选的 `unattended_write_tools` 仅保留兼容读取。新配置使用 `force_approval_tools`,迁移时按公开 Runtime 文档的差集规则处理。
29
+
30
+ ## 验证
31
+
32
+ 稳定发布门禁要求完整 `npm run release:check`、类型检查、Core 与 Agent Auth/Runtime 定向测试、控制台构建、数据库迁移、双语文档、OSS 边界、安全扫描、npm 制品一致性,以及从干净宿主安装公开依赖后完成浏览器授权、只读调用、可回滚写入、会话与轨迹回查。发布前还必须检查源码与实际包制品不包含私有域名、本机路径、凭据或本地依赖。
33
+
34
+ ## 相关文档
35
+
36
+ - [Agent Client v1 接入指南](AGENT_CLIENT_QUICKSTART.md)
37
+ - [Agent Auth v1](AGENT_AUTH_API.md)
38
+ - [Agent Client Runtime v1](AGENT_CLIENT_RUNTIME_API.md)
39
+ - [业务侧 PHP SDK](../sdk/php/README.md) / [PHP 7.3 SDK](../sdk/php7/README.md)
40
+ - [兼容性与升级](兼容性与升级.md)
41
+ - [English release notes](RELEASE_NOTES_v0.5.0.en.md)
@@ -0,0 +1,45 @@
1
+ # BailingHub v0.5.1: Agent Client Management and Bulk Write-Operation Configuration
2
+
3
+ `v0.5.1` is a compatible management increment for the Agent Client v1 surface introduced in `v0.5.0`. It lets deployers inspect client applications, authorized devices and Agent Sessions, recent runtime statistics, and workspaces in one BailingHub console page, and bulk-select writable operations declared by current tool sources. Existing identity, approval, idempotency, business invocation, and final-authorization governance remains in force.
4
+
5
+ ## Highlights
6
+
7
+ - **Dedicated management center**: the console adds an Agent Client menu backed by the existing Client App, route, Agent Auth, and Agent Client Runtime ledgers. It does not create another client or executor resource model.
8
+ - **Application and workspace overview**: shows client state, whether a neutral business authorization entry is configured, allowed routes, last use, and workspaces enabled for Agent Client access.
9
+ - **Session list and revocation**: filters Agent Sessions by client and active, expired, or revoked state. An administrator with client write permission may revoke one session, and the action is appended to the audit ledger.
10
+ - **Runtime statistics**: aggregates runs, conversations, completed and failed runs, tool calls, tokens, and approval states over a bounded time window. Failure rate is derived from Agent Runs already recorded by Core.
11
+ - **Bulk write-operation selection**: the route editor can select or clear all writable operationIds currently declared by selected tool sources. The persisted policy remains an exact operationId allowlist and never accepts `*`.
12
+ - **Neutral business authorization entry**: each Client App configures one account- and tenant-neutral `agent_authorize_url`. The business page uses its current login session to handle account switching, explicit tenant selection, approval, or denial, and the business backend derives the trusted identity.
13
+
14
+ ## Security and Responsibility Boundaries
15
+
16
+ - The management APIs remain behind existing Core administrator permissions. Session projections do not select or return access-token hashes, refresh tokens, authorization codes, prompts, tool arguments, or business results.
17
+ - Bulk selection only removes repetitive console work. An operation remains unavailable unless the tool source declares it, the route exact allowlist contains it, and the Agent Session allows the route.
18
+ - Approval continues to inherit business-side ACC metadata and Core risk policy. `force_approval_tools` may only tighten approval; bulk selection cannot weaken it.
19
+ - The business system still verifies every tool request and checks the current user, tenant, role, and permissions. A BailingHub administrator does not replace final business authorization.
20
+ - `connectionName` is only a local host selector. It is not a trusted identity, business URL, account, or tenant declaration.
21
+
22
+ ## Compatibility and Upgrade
23
+
24
+ - No SQL migration is added or modified. This release reuses the Agent Auth and Agent Client Runtime tables published in `v0.5.0`.
25
+ - Agent Client Runtime, Client API, Kernel API, the business-side PHP SDKs, Widget, Executor Protocol, tool signatures, and approval protocol remain compatible.
26
+ - The management center requires the MySQL Agent Auth and Runtime ledgers. A deployment without those ledgers does not receive fabricated session or runtime data.
27
+ - Deployments that do not use Agent Client require no new configuration. Existing `/run`, chat-entry, and executor paths are unchanged.
28
+
29
+ ## Validation
30
+
31
+ The release candidate must pass:
32
+
33
+ ```bash
34
+ npm run release:check
35
+ ```
36
+
37
+ The gate covers Core type checking and 612 tests, management-API permissions and redacted projections, session revocation, bulk operationId selection, console build and E2E, Client API ecosystem consumers, all SDK contracts, Docker Demo, OSS boundaries, security and dependency audits, release consistency, and npm artifact inspection. Before publication, the public diff and package must also be checked for private domains, credentials, local paths, and environment-specific data.
38
+
39
+ ## Related Documentation
40
+
41
+ - [Agent Client v1 Integration Guide](AGENT_CLIENT_QUICKSTART.en.md)
42
+ - [Agent Auth v1](AGENT_AUTH_API.en.md)
43
+ - [Agent Client Runtime v1](AGENT_CLIENT_RUNTIME_API.en.md)
44
+ - [Compatibility and Upgrade](COMPATIBILITY.en.md)
45
+ - [中文发布说明](RELEASE_NOTES_v0.5.1.md)
@@ -0,0 +1,45 @@
1
+ # BailingHub v0.5.1:智能体客户端管理中心与批量写操作配置
2
+
3
+ `v0.5.1` 是 `v0.5.0` Agent Client v1 的兼容性管理增量。它让部署者能在 BailingHub 控制台集中查看客户端应用、已授权设备与 Agent Session、运行统计和工作区,并为路由批量选择当前工具源声明的可写操作。身份、审批、幂等、业务调用与最终授权仍沿用既有治理链路。
4
+
5
+ ## 主要变化
6
+
7
+ - **独立管理中心**:控制台新增“智能体客户端”菜单,复用既有 Client App、触发路由、Agent Auth 与 Agent Client Runtime 账本,不新增第二套客户端或执行器资源。
8
+ - **应用与工作区概览**:展示客户端启停状态、是否配置统一业务授权入口、允许路由、最近使用时间,以及启用 Agent Client 的工作区。
9
+ - **会话列表与撤销**:支持按客户端和 active、expired、revoked 状态查看 Agent Session,并由具备客户端写权限的管理员逐个撤销。撤销操作进入审计记录。
10
+ - **运行统计**:按时间窗口聚合运行数、会话数、完成/失败、工具调用、Token 与审批状态。失败率按 Core 已记录的 Agent Run 计算。
11
+ - **批量写操作选择**:路由编辑页可选择或清除当前工具源中全部可写 operationId,避免逐项配置大量能力。保存结果仍是精确 operationId 白名单,不支持 `*`。
12
+ - **统一业务授权入口**:文档明确每个 Client App 只配置一个账号与租户中立的 `agent_authorize_url`。用户打开该入口后,由业务页面基于当前登录态完成换号、租户选择、批准或拒绝;业务后端负责派生可信身份。
13
+
14
+ ## 安全与责任边界
15
+
16
+ - 管理 API 只向已有 Core 管理员权限开放。会话投影不选择或返回 access token hash、refresh token、授权码、提示词、工具参数和业务结果。
17
+ - 批量选择只减少控制台重复操作,不改变能力声明。未由工具源声明、未进入路由精确白名单或不在 Agent Session 允许范围内的操作仍不可见。
18
+ - 是否需要审批继续继承业务侧 ACC 与 Core 风险规则;`force_approval_tools` 只能额外收紧,不能通过批量选择放宽。
19
+ - 业务系统仍须在每次工具调用时验签并检查当前用户、租户、角色和权限;BailingHub 管理员不能替代业务最终授权。
20
+ - `connectionName` 是宿主本机的连接实例选择器,不是可信身份、业务 URL、账号或租户声明。
21
+
22
+ ## 兼容性与升级
23
+
24
+ - 没有新增或修改 SQL migration;沿用 `v0.5.0` 已发布的 Agent Auth 与 Agent Client Runtime 表。
25
+ - Agent Client Runtime、Client API、Kernel API、业务侧 PHP SDK、Widget、Executor Protocol、工具签名和审批协议保持兼容。
26
+ - 新管理中心依赖 MySQL Agent Auth 与 Runtime 账本。没有这些账本的部署不会获得虚构的会话或统计数据。
27
+ - 不使用 Agent Client 的部署无需新增配置,既有 `/run`、聊天入口和执行器路径不变。
28
+
29
+ ## 验证
30
+
31
+ 发布候选应完成:
32
+
33
+ ```bash
34
+ npm run release:check
35
+ ```
36
+
37
+ 重点覆盖 Core 类型检查与 612 项单测、管理 API 权限与脱敏投影、会话撤销、批量 operationId 选择、控制台构建和 E2E、Client API 生态消费者、全部 SDK 契约、Docker Demo、OSS 边界、安全扫描、依赖审计、版本一致性和 npm 制品检查。发布前还必须确认公开差异与制品不包含私有域名、凭据、本机路径或环境专属信息。
38
+
39
+ ## 相关文档
40
+
41
+ - [Agent Client v1 接入指南](AGENT_CLIENT_QUICKSTART.md)
42
+ - [Agent Auth v1](AGENT_AUTH_API.md)
43
+ - [Agent Client Runtime v1](AGENT_CLIENT_RUNTIME_API.md)
44
+ - [兼容性与升级](兼容性与升级.md)
45
+ - [English release notes](RELEASE_NOTES_v0.5.1.en.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bailinghub",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Open-source ACC runtime and agent control plane for existing business systems.",
@@ -71,6 +71,7 @@
71
71
  "package:artifact:check": "node scripts/check-package-artifact.mjs",
72
72
  "prepack": "npm run package:build",
73
73
  "security:scan": "node scripts/security-scan.mjs",
74
+ "public-content:denylist:test": "node --test scripts/public-content-denylist.test.mjs",
74
75
  "notices:generate": "node scripts/generate-third-party-notices.mjs",
75
76
  "notices:check": "node scripts/generate-third-party-notices.mjs --check",
76
77
  "assets:generate": "node scripts/generate-readme-assets.mjs",
@@ -87,7 +88,7 @@
87
88
  "oss:verify": "node scripts/verify-oss-export.mjs",
88
89
  "release:consistency": "node scripts/check-release-consistency.mjs",
89
90
  "release:consistency:test": "node --test scripts/check-release-consistency.test.mjs",
90
- "release:audit": "npm run release:consistency && npm run release:consistency:test && npm run images:policy:test && npm run security:scan && npm run oss:guard && node scripts/release-audit.mjs && npm run package:artifact:check",
91
+ "release:audit": "npm run release:consistency && npm run release:consistency:test && npm run images:policy:test && npm run public-content:denylist:test && npm run security:scan && npm run oss:guard && node scripts/release-audit.mjs && npm run package:artifact:check",
91
92
  "github:verify": "node scripts/verify-github-repo.mjs",
92
93
  "release:check": "npm run notices:check && npm run assets:check && npm run audit:deps && npm run client-api:contract && npm run client-api:ecosystem:clone && npm run typecheck && npm test && npm run widget:renderer:test && npm run web-admin:check && npm run docs:check && npm run examples:check && npm run sdk:test && npm run sdk:test7 && npm run sdk:test-node && npm run sdk:test-python && npm run sdk:test-runtime && npm run sdk:test-p1 && npm run release:audit && npm run oss:verify && npm run github:verify",
93
94
  "images:build": "sh scripts/publish-images.sh",
@@ -17,6 +17,13 @@
17
17
  "title": "名称",
18
18
  "description": "后台展示的人类可读名称。"
19
19
  },
20
+ "agent_authorize_url": {
21
+ "type": "string",
22
+ "format": "uri",
23
+ "maxLength": 2048,
24
+ "title": "Agent 授权页",
25
+ "description": "可选。本地 Agent 发起登录时打开的业务系统授权页 URL;未配置时不开放 Agent Auth。"
26
+ },
20
27
  "allowed_routes": {
21
28
  "type": "array",
22
29
  "items": { "type": "string", "minLength": 1 },
@@ -198,6 +198,36 @@
198
198
  "url": { "type": "string" },
199
199
  "to": { "type": "string" }
200
200
  }
201
+ },
202
+ "agent_direct": {
203
+ "type": "object",
204
+ "additionalProperties": false,
205
+ "required": ["enabled"],
206
+ "not": { "required": ["force_approval_tools", "unattended_write_tools"] },
207
+ "properties": {
208
+ "enabled": { "type": "boolean" },
209
+ "write_tools": {
210
+ "type": "array",
211
+ "minItems": 1,
212
+ "uniqueItems": true,
213
+ "items": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}$" }
214
+ },
215
+ "force_approval_tools": {
216
+ "description": "Route-level exact operationIds that require approval in addition to the ACC declaration. Omit to inherit ACC approval semantics.",
217
+ "type": "array",
218
+ "minItems": 1,
219
+ "uniqueItems": true,
220
+ "items": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}$" }
221
+ },
222
+ "unattended_write_tools": {
223
+ "description": "Deprecated private-candidate compatibility field. When present, every write_tools entry not listed here is forced to approval. Remove it to inherit ACC, or migrate its complement within write_tools to force_approval_tools.",
224
+ "deprecated": true,
225
+ "type": "array",
226
+ "minItems": 1,
227
+ "uniqueItems": true,
228
+ "items": { "type": "string", "pattern": "^[A-Za-z_][A-Za-z0-9_]{0,63}$" }
229
+ }
230
+ }
201
231
  }
202
232
  },
203
233
  "not": {
@@ -128,6 +128,17 @@
128
128
  "title": "对话记忆",
129
129
  "description": "路由会话历史装配、逐字窗口和滚动摘要配置。"
130
130
  },
131
+ "agent_client": {
132
+ "type": "object",
133
+ "title": "本地 Agent Runtime",
134
+ "description": "本地 Agent 编排的显式开关、补充指令和每轮主动工具上限;缺省时兼容 tools.agent_direct.enabled。",
135
+ "additionalProperties": false,
136
+ "properties": {
137
+ "enabled": { "type": "boolean" },
138
+ "instructions": { "type": "string", "maxLength": 20000 },
139
+ "active_tool_limit": { "type": "integer", "minimum": 1, "maximum": 12 }
140
+ }
141
+ },
131
142
  "budget": {
132
143
  "$ref": "common.schema.json#/$defs/budgetPolicy",
133
144
  "title": "成本预算闸",
@@ -101,7 +101,8 @@ const englishCompanions = {
101
101
  'docs/RELEASE_NOTES_v0.3.2.md': 'docs/RELEASE_NOTES_v0.3.2.en.md',
102
102
  'docs/RELEASE_NOTES_v0.3.3.md': 'docs/RELEASE_NOTES_v0.3.3.en.md',
103
103
  'docs/RELEASE_NOTES_v0.3.4.md': 'docs/RELEASE_NOTES_v0.3.4.en.md',
104
- 'docs/RELEASE_NOTES_v0.4.0.md': 'docs/RELEASE_NOTES_v0.4.0.en.md',
104
+ 'docs/RELEASE_NOTES_v0.5.0.md': 'docs/RELEASE_NOTES_v0.5.0.en.md',
105
+ 'docs/RELEASE_NOTES_v0.5.1.md': 'docs/RELEASE_NOTES_v0.5.1.en.md',
105
106
  'docs/TOOLS_DESIGN.md': 'docs/TOOLS_DESIGN.en.md',
106
107
  'docs/TOOLS_MODEL.md': 'docs/TOOLS_MODEL.en.md',
107
108
  'docs/AI友好工具设计指南.md': 'docs/AI_FRIENDLY_TOOLS.en.md',
@@ -9,7 +9,7 @@ REGISTRY="${BAILING_IMAGE_REGISTRY:-$DEFAULT_REGISTRY}"
9
9
  NAMESPACE="${BAILING_IMAGE_NAMESPACE:-$DEFAULT_NAMESPACE}"
10
10
  PACKAGE_VERSION="$(sed -n 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' package.json | head -1)"
11
11
  TAG="${BAILING_IMAGE_TAG:-$PACKAGE_VERSION}"
12
- [ -n "$TAG" ] || TAG="0.4.0"
12
+ [ -n "$TAG" ] || TAG="0.5.1"
13
13
  MYSQL_TAG="${BAILING_MYSQL_IMAGE_TAG:-8.4}"
14
14
  MYSQL_IMAGE="${BAILING_MYSQL_IMAGE:-$REGISTRY/$NAMESPACE/bailing-mysql:$MYSQL_TAG}"
15
15
  PLATFORM="${BAILING_IMAGE_PLATFORM:-linux/amd64}"