bailinghub 0.3.4 → 0.5.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 (169) hide show
  1. package/.gitignore +5 -0
  2. package/README.en.md +6 -1
  3. package/README.md +6 -0
  4. package/SECURITY.md +11 -0
  5. package/docker-compose.images.yml +2 -2
  6. package/docs/AGENT_AUTH_API.en.md +175 -0
  7. package/docs/AGENT_AUTH_API.md +190 -0
  8. package/docs/AGENT_CLIENT_QUICKSTART.en.md +212 -0
  9. package/docs/AGENT_CLIENT_QUICKSTART.md +206 -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 +59 -1
  13. package/docs/CHANGELOG.md +27 -1
  14. package/docs/COMPATIBILITY.en.md +25 -0
  15. package/docs/CONTRACT.en.md +79 -8
  16. package/docs/CONTRACT.md +36 -6
  17. package/docs/INDEPENDENT_VALIDATION.en.md +4 -4
  18. package/docs/INDEPENDENT_VALIDATION.md +4 -4
  19. package/docs/QUICKSTART.en.md +6 -0
  20. package/docs/QUICKSTART.md +1 -1
  21. package/docs/README.en.md +8 -0
  22. package/docs/README.md +8 -0
  23. package/docs/RELEASE_NOTES_v0.4.0.en.md +39 -0
  24. package/docs/RELEASE_NOTES_v0.4.0.md +39 -0
  25. package/docs/RELEASE_NOTES_v0.5.0.en.md +41 -0
  26. package/docs/RELEASE_NOTES_v0.5.0.md +41 -0
  27. package/docs/STREAMING.en.md +32 -0
  28. package/docs/STREAMING.md +8 -2
  29. package/docs/WIDGET_RENDERERS.en.md +123 -6
  30. package/docs/WIDGET_RENDERERS.md +75 -6
  31. package/docs/user-guide/console-map.en.md +1 -2
  32. package/docs/user-guide/console-map.md +2 -2
  33. package/docs//345/205/274/345/256/271/346/200/247/344/270/216/345/215/207/347/272/247.md +9 -0
  34. package/package.json +3 -2
  35. package/schemas/config/chat-entry.schema.json +2 -1
  36. package/schemas/config/client.schema.json +7 -0
  37. package/schemas/config/common.schema.json +30 -0
  38. package/schemas/config/route.schema.json +11 -0
  39. package/scripts/check-doc-links.mjs +1 -0
  40. package/scripts/check-image-tags.sh +1 -1
  41. package/scripts/check-release-consistency.test.mjs +5 -5
  42. package/scripts/e2e-console.mjs +144 -0
  43. package/scripts/export-oss.mjs +5 -12
  44. package/scripts/install.sh +1 -1
  45. package/scripts/public-content-denylist.mjs +82 -0
  46. package/scripts/public-content-denylist.test.mjs +53 -0
  47. package/scripts/publish-images.sh +1 -1
  48. package/scripts/release-audit.mjs +8 -12
  49. package/scripts/sdk-runtime-test.mjs +171 -7
  50. package/scripts/security-scan.mjs +8 -5
  51. package/scripts/validate-examples.mjs +3 -1
  52. package/scripts/verify-github-repo.mjs +7 -11
  53. package/scripts/verify-oss-export.mjs +6 -12
  54. package/scripts/widget-renderer-test.mjs +244 -16
  55. package/sdk/php/README.md +27 -1
  56. package/sdk/php/src/AgentAuth.php +78 -0
  57. package/sdk/php/src/HubClient.php +3 -0
  58. package/sdk/php7/README.md +32 -2
  59. package/sdk/php7/src/AgentAuth.php +77 -0
  60. package/sdk/php7/src/HubClient.php +3 -0
  61. package/sql/055_agent_auth.sql +72 -0
  62. package/sql/056_agent_client_runtime.sql +60 -0
  63. package/src/adapters/channels/wecom-api.ts +1 -1
  64. package/src/app/agent-client-runtime.test.ts +221 -0
  65. package/src/app/agent-client-runtime.ts +408 -0
  66. package/src/app/agent-tool-invocations.test.ts +462 -0
  67. package/src/app/agent-tool-invocations.ts +795 -0
  68. package/src/app/agent-tool-job.test.ts +62 -0
  69. package/src/app/agent-tool-job.ts +41 -0
  70. package/src/app/auth.ts +2 -1
  71. package/src/app/kernel.ts +2 -0
  72. package/src/app/runtime-context.ts +8 -0
  73. package/src/app/tool-approvals.ts +5 -1
  74. package/src/app/tool-assembly.ts +19 -1
  75. package/src/app/tool-context.ts +2 -1
  76. package/src/core/config/config-codec.ts +2 -1
  77. package/src/core/config/config-models.test.ts +28 -1
  78. package/src/core/config/config-models.ts +46 -3
  79. package/src/core/config/config-schema.test.ts +8 -0
  80. package/src/core/config/route-config.test.ts +15 -0
  81. package/src/core/config/route-config.ts +36 -0
  82. package/src/core/config/tools-config.test.ts +58 -1
  83. package/src/core/config/tools-config.ts +84 -0
  84. package/src/core/contracts/tools.ts +162 -29
  85. package/src/core/contracts/types.ts +38 -1
  86. package/src/core/platform/chat-form.test.ts +147 -0
  87. package/src/core/platform/chat-form.ts +402 -0
  88. package/src/core/platform/version.ts +1 -1
  89. package/src/core/runtime/agent-client-trace.test.ts +154 -0
  90. package/src/core/runtime/agent-client-trace.ts +288 -0
  91. package/src/core/runtime/execution-runtime.test.ts +61 -0
  92. package/src/core/runtime/execution-runtime.ts +17 -0
  93. package/src/core/runtime/launch-runtime.ts +13 -0
  94. package/src/core/runtime/trace-runtime.test.ts +18 -1
  95. package/src/core/runtime/trace-runtime.ts +28 -3
  96. package/src/core/state/state-codec.ts +2 -0
  97. package/src/infrastructure/config/config-agent-auth-repository.test.ts +147 -0
  98. package/src/infrastructure/config/config-agent-auth-repository.ts +356 -0
  99. package/src/infrastructure/config/config-agent-client-runtime-repository.ts +253 -0
  100. package/src/infrastructure/config/config-approval-ledger.test.ts +32 -0
  101. package/src/infrastructure/config/config-approval-ledger.ts +16 -0
  102. package/src/infrastructure/config/config-client-repository.ts +3 -3
  103. package/src/infrastructure/config/config-conversation-ledger.test.ts +69 -0
  104. package/src/infrastructure/config/config-conversation-ledger.ts +8 -7
  105. package/src/infrastructure/config/config-observability-ledger.test.ts +50 -0
  106. package/src/infrastructure/config/config-observability-ledger.ts +65 -10
  107. package/src/infrastructure/config/config-route-repository.ts +4 -3
  108. package/src/infrastructure/config/configstore.ts +14 -3
  109. package/src/infrastructure/state/state-mysql.ts +2 -2
  110. package/src/kernel-api/v1/contracts.ts +8 -0
  111. package/src/routes/admin-runtime.test.ts +214 -0
  112. package/src/routes/admin-runtime.ts +82 -2
  113. package/src/routes/agent-api.test.ts +379 -0
  114. package/src/routes/agent-api.ts +251 -0
  115. package/src/routes/agent-auth.test.ts +276 -0
  116. package/src/routes/agent-auth.ts +395 -0
  117. package/src/routes/approvals.ts +4 -1
  118. package/src/routes/chat.test.ts +319 -7
  119. package/src/routes/chat.ts +166 -21
  120. package/src/routes/critical-routes.test.ts +235 -1
  121. package/src/routes/private-default.ts +2 -1
  122. package/src/routes/private.ts +16 -1
  123. package/src/routes/run.ts +79 -13
  124. package/web/connect/bailing-connect-php.tgz +0 -0
  125. package/web/connect/bailing-connect-php7.tgz +0 -0
  126. package/web/console/assets/{Accounts-CAwrtBiS.js → Accounts-D4RRm5D1.js} +1 -1
  127. package/web/console/assets/{Approvals-C2BZ86T3.js → Approvals-CsTTKb8o.js} +1 -1
  128. package/web/console/assets/{Audit-B-E4Y_Up.js → Audit-BzvZ7JZw.js} +1 -1
  129. package/web/console/assets/{BrandLockup-C18u8Lx5.js → BrandLockup-CYcA93wh.js} +1 -1
  130. package/web/console/assets/{Channels-DTy8ylH-.js → Channels-DRQZggqM.js} +1 -1
  131. package/web/console/assets/ChatEntries-BUB7BWKU.js +7 -0
  132. package/web/console/assets/ChatEntries-DsYtcXN6.css +1 -0
  133. package/web/console/assets/Clients-CQ_MonGL.css +1 -0
  134. package/web/console/assets/Clients-HhCyrxfz.js +3 -0
  135. package/web/console/assets/{Cost-2SSYs1AT.js → Cost-BZgFf1yM.js} +1 -1
  136. package/web/console/assets/{Credentials-B79LtxCE.js → Credentials-BTe2Q07j.js} +1 -1
  137. package/web/console/assets/{Diagnostics-BakcRYvb.js → Diagnostics-WL-buYli.js} +1 -1
  138. package/web/console/assets/{Executors-BXoyo28u.js → Executors-CGZ-7Xmp.js} +1 -1
  139. package/web/console/assets/{Kb-ISbzquab.js → Kb-VVw8oGsT.js} +1 -1
  140. package/web/console/assets/{Login-Dlu6Wgcf.js → Login-rwvmBBPl.js} +1 -1
  141. package/web/console/assets/{Projects-DFzmtnqg.js → Projects-CexaCEY1.js} +1 -1
  142. package/web/console/assets/Routes-B9ZHbQAp.js +124 -0
  143. package/web/console/assets/Routes-BbkFpi6Y.css +1 -0
  144. package/web/console/assets/Runs-4zDD9VOC.css +1 -0
  145. package/web/console/assets/Runs-BzFNPTwD.js +3 -0
  146. package/web/console/assets/{Setup-CrBAV-b9.js → Setup-Djh5yadQ.js} +1 -1
  147. package/web/console/assets/{Shell-B1a8DvXQ.js → Shell-kn763smL.js} +1 -1
  148. package/web/console/assets/{StorageBuckets-BRfL_eHb.js → StorageBuckets-CQBR41W1.js} +1 -1
  149. package/web/console/assets/{SystemSettings-CyirVLbq.js → SystemSettings-DgnopekD.js} +1 -1
  150. package/web/console/assets/{SystemStatus-DZ_OR7sk.js → SystemStatus-Bj8-kPt2.js} +1 -1
  151. package/web/console/assets/{Targets-CtIMa66c.js → Targets-BAfCt_nH.js} +1 -1
  152. package/web/console/assets/{Tools-BfDZHt01.js → Tools-xjd0NZdE.js} +1 -1
  153. package/web/console/assets/{index-DBiByFiO.js → index-DfJA7iJS.js} +2 -2
  154. package/web/console/assets/{request-DY2cxQqZ.js → request-DkNPOweH.js} +1 -1
  155. package/web/console/assets/{schema-6mCQ7rR5.js → schema-CgPWAu1_.js} +1 -1
  156. package/web/console/index.html +1 -1
  157. package/web/widget/widget.js +493 -14
  158. package/web-admin/src/pages/ChatEntries.vue +18 -6
  159. package/web-admin/src/pages/Clients.vue +11 -3
  160. package/web-admin/src/pages/Routes.vue +282 -16
  161. package/web-admin/src/pages/Runs.vue +159 -38
  162. package/web/console/assets/ChatEntries-9xbRiQov.css +0 -1
  163. package/web/console/assets/ChatEntries-DvD-4IeE.js +0 -7
  164. package/web/console/assets/Clients--D7NQJKk.css +0 -1
  165. package/web/console/assets/Clients-DWs9JFr0.js +0 -3
  166. package/web/console/assets/Routes-B-hm9HGY.js +0 -124
  167. package/web/console/assets/Routes-DWGQN5Pv.css +0 -1
  168. package/web/console/assets/Runs-CUtSsPW-.css +0 -1
  169. package/web/console/assets/Runs-hMRu1im3.js +0 -3
@@ -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,7 +22,65 @@ Each public version should describe:
22
22
 
23
23
  ## Unreleased
24
24
 
25
- There are no unreleased changes.
25
+ ## v0.5.0 - Revocable Local-Agent Authorization and Governed Local Planning
26
+
27
+ Released on 2026-08-26.
28
+
29
+ - **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.
30
+ - **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.
31
+ - **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.
32
+ - **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.
33
+ - **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.
34
+ - **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.
35
+ - **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.
36
+ - **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).
37
+
38
+ ## v0.4.0 - Native Conversational Forms and Chat-Entry Controls
39
+
40
+ Released on 2026-08-25.
41
+
42
+ - **Origin allowlist guardrails**: chat-entry saves now accept only
43
+ `scheme://host[:port]`, canonicalize and deduplicate entries, and report the
44
+ persisted restriction count in the console. A non-allowlisted browser Origin
45
+ is rejected with 403 before a conversation job can start.
46
+ - **Default-open chat entries**: appearance configuration adds an opt-in,
47
+ default-false `default_open` setting. When enabled, existing official widget
48
+ embeds open on load without changing page markup. The existing
49
+ `data-open="1"` force-open behavior remains compatible.
50
+ - **Native conversational forms**: the dependency-free official widget adds
51
+ constrained `bailing-form` v1 controls for text, textarea, number, date,
52
+ boolean, single-select, and multi-select fields, with client/server
53
+ validation, read-only receipts, and history recovery.
54
+ - **Non-blocking continuation contract**: `POST /chat/:entry` compatibly adds
55
+ `interaction_response`, translating submit or cancel into a new user message
56
+ and a new job in the same thread. The source job still reaches `done`; there
57
+ is no `input_required` or new SSE state.
58
+ - **Correlation, idempotency, and security**: the server reloads the
59
+ authoritative form after matching source job, entry, identity, and thread,
60
+ then deduplicates by `submission_id`. Forms cannot request credential or
61
+ payment secrets and do not replace tool approval, business authorization, or
62
+ side-effect gates.
63
+ - **Presentation negotiation**: the LLM receives constrained form-output
64
+ guidance only when the client explicitly advertises `bailing-form`. Other
65
+ clients continue with text questions, and `bailing-chart` remains an
66
+ independent compatible capability.
67
+ - **Ecosystem documentation discovery**: the README links to an independently
68
+ maintained community plugin for DeepSeek Harness. It is not part of
69
+ BailingHub Core and does not imply official DeepSeek development,
70
+ certification, endorsement, or adoption.
71
+ - **Contract and integration impact**: the public boundary advances additively
72
+ to `bailing.contract.v2.14`; `WIDGET_API` and `rendererApiVersion` remain 1,
73
+ with no database migration. Client API v1, Kernel Host API v1, ACC, SDKs,
74
+ tool signatures, approval semantics, and final business authorization are
75
+ unchanged.
76
+ - **Validation**: `npm run typecheck`, focused conversational-form contract and
77
+ route tests, `npm run widget:renderer:test`, `npm run web-admin:check`,
78
+ `npm run docs:check`, `npm test`, and a real local-browser form interaction
79
+ check.
80
+ - **Related docs**: [RELEASE_NOTES_v0.4.0.en.md](RELEASE_NOTES_v0.4.0.en.md),
81
+ [HTTP contract](CONTRACT.en.md), [Widget renderer and form
82
+ contract](WIDGET_RENDERERS.en.md), [Streaming protocol](STREAMING.en.md), and
83
+ [Compatibility](COMPATIBILITY.en.md).
26
84
 
27
85
  ## v0.3.4 - Anonymous Preview and Trusted Business Identity Guidance
28
86
 
package/docs/CHANGELOG.md CHANGED
@@ -15,7 +15,33 @@
15
15
 
16
16
  ## Unreleased
17
17
 
18
- 当前无待发布变更。
18
+ ## v0.5.0 - 可撤销本地 Agent 授权与受治理本地编排
19
+
20
+ 发布日期:2026-08-26。
21
+
22
+ - **Agent Auth v1**:新增浏览器 + PKCE 授权,由业务系统复用现有登录态批准可信主体和 route;access token 短期有效,refresh token 轮换并对重放失败关闭,会话可由本地或业务后端撤销。
23
+ - **Agent Client Runtime v1**:本地 Agent 负责规划与多步选择;Core 继续提供受限的提示词、记忆、知识和工具面,并负责身份重验、审批、幂等、业务调用、恢复和审计。
24
+ - **能力与审批收敛**:路由页新增 `tools.agent_direct` 结构化配置。可写工具按精确 operationId 开放;审批默认继承业务侧 ACC,`force_approval_tools` 只能额外收紧。
25
+ - **会话和轨迹可见**:本地编排的用户消息、可见最终回复、工具申请和治理结果进入 Core 总账;不接收、不同步也不持久化 hidden reasoning。
26
+ - **业务侧 SDK**:PHP 8.1+ 与 PHP 7.3 兼容 SDK 都增加同语义的服务端 `AgentAuth` 薄客户端。Client Token 仍只存业务后端,不进入浏览器、本地插件或公开配置。
27
+ - **数据库结构**:新增 `055_agent_auth.sql` 和 `056_agent_client_runtime.sql`。升级时必须通过正式迁移器执行全部未应用 migration,不得修改已应用文件或复制其他实例的状态库。
28
+ - **兼容性**:新能力为可选增量接口;现有 `/run`、聊天入口、Client API v1、Kernel Host API v1、Executor Protocol、ACC、工具签名和业务最终授权语义保持兼容。
29
+ - **相关文档**:[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)。
30
+
31
+ ## v0.4.0 - 原生对话表单与聊天入口控制
32
+
33
+ 发布日期:2026-08-25。
34
+
35
+ - **Origin 白名单防误配**:聊天入口保存时仅接受 `scheme://host[:port]`,统一规范化、去重并在控制台回显实际限制数;非白名单浏览器 Origin 在进入对话任务前返回 403。
36
+ - **聊天入口默认展开**:外观配置新增默认关闭的 `default_open`;开启后已嵌入的官方 Widget 加载即展开,业务页面无需改脚本。既有 `data-open="1"` 强制展开行为保持兼容。
37
+ - **原生对话表单**:官方零依赖 Widget 新增受限 `bailing-form` v1,支持文本、多行文本、数字、日期、布尔、单选和多选,含客户端/服务端双校验、只读回执与历史恢复。
38
+ - **非阻塞续聊契约**:`POST /chat/:entry` 兼容新增 `interaction_response`,把表单提交/取消规范化为同 thread 的新用户消息和新 job;源 job 仍正常 `done`,不新增 `input_required` 或 SSE 状态。
39
+ - **关联、幂等与安全**:服务端按源 job/入口/身份/thread 重读权威表单验值,以 `submission_id` 去重;表单不能要求凭据或支付秘密,不替代工具审批、业务授权或副作用闸门。
40
+ - **展示能力协商**:只在客户端明确声明 `bailing-form` 时向 LLM 注入受约束输出提示;无能力客户端继续使用文字提问,`bailing-chart` 能力保持独立兼容。
41
+ - **生态文档发现**:README 增加独立维护的 DeepSeek Harness 社区插件链接;它不进入 BailingHub Core,也不代表 DeepSeek 官方开发、认证、背书或采用。
42
+ - **契约与对接影响**:公开边界增量到 `bailing.contract.v2.14`;`WIDGET_API` / `rendererApiVersion` 仍为 1,无数据库迁移。Client API v1、Kernel Host API v1、ACC、SDK、工具签名、审批语义和最终业务授权不变。
43
+ - **验证方式**:`npm run typecheck`、对话表单契约/路由测试、`npm run widget:renderer:test`、`npm run web-admin:check`、`npm run docs:check`、`npm test` 与本地真实浏览器表单交互检查。
44
+ - **相关文档**:[RELEASE_NOTES_v0.4.0.md](RELEASE_NOTES_v0.4.0.md)、[公开运行时契约](CONTRACT.md)、[Widget 渲染与表单契约](WIDGET_RENDERERS.md)、[流式协议](STREAMING.md) 与[兼容性与升级](兼容性与升级.md)。
19
45
 
20
46
  ## v0.3.4 - 匿名预览与可信业务身份引导
21
47
 
@@ -82,6 +82,31 @@ transition window. The widget core remains dependency-free; see
82
82
  [WIDGET_RENDERERS.en.md](WIDGET_RENDERERS.en.md) for registration, cleanup, and
83
83
  fallback rules.
84
84
 
85
+ The `bailing-form` v1 addition under `bailing.contract.v2.14` follows that
86
+ compatibility rule:
87
+
88
+ - Existing `{message,...}` chat requests are unchanged.
89
+ `interaction_response` is an optional alternative input to
90
+ `POST /chat/:entry`. This public Chat addition is outside
91
+ `bailing.client-api.v1` and does not change Client API, Kernel Host API, ACC,
92
+ or SDK versions.
93
+ - The official widget adds the built-in `bailing-form` type. Older or custom
94
+ clients still fall back to its safe fenced code block. A custom client should
95
+ advertise `client_capabilities.renderers:["bailing-form"]` only after it
96
+ implements the complete validation and response lifecycle.
97
+ - The renderer `mount` context gains optional `message` and `respond`
98
+ properties. Existing JavaScript destructuring ignores additional properties,
99
+ so both `WIDGET_API` and `rendererApiVersion` remain 1.
100
+ - A form response creates a new job in the same thread. It changes neither the
101
+ source job's terminal state, the `bailing.chat.stream.v1` event set, nor the
102
+ database schema. Existing proxies, SSE clients, and upgrade flows need no new
103
+ waiting state.
104
+
105
+ The official `widget.js` and Chat endpoints ship from the same Hub artifact, so
106
+ a normal upgrade obtains both rendering and response handling. Clear any
107
+ separately cached legacy widget during rollout, and do not advertise the new
108
+ capability from a custom client against an older Hub.
109
+
85
110
  ## URL Tool Catalog Access Policy Upgrade
86
111
 
87
112
  The release that introduces `053_tool_spec_access_policy.sql` adds two nullable columns to `bz_tool_providers`. Keep the normal backup, `db:init`, and restart order. The public configuration surface always has exactly two values, `signed_required` and `public_allowed`; new URL providers default to the former.
@@ -1,6 +1,6 @@
1
1
  # HTTP Contract
2
2
 
3
- > Current contract: `bailing.contract.v2.13`. This is the only network boundary between a business system and BailingHub.
3
+ > Current contract: `bailing.contract.v2.14`. This is the only network boundary between a business system and BailingHub.
4
4
 
5
5
  This document summarizes the public wire contract between a business system and BailingHub.
6
6
 
@@ -96,6 +96,21 @@ short-lived visitor ticket from its own authenticated business backend. A
96
96
  BailingHub administrator identity must never be promoted to a business acting
97
97
  subject.
98
98
 
99
+ The public entry configuration includes optional appearance settings. The
100
+ `default_open` flag defaults to `false`; when it is `true`, the official widget
101
+ opens its panel after loading. Existing embeds with `data-open="1"` also keep
102
+ forcing the panel open, independently of this entry setting. Because the
103
+ widget fetches entry configuration on every page load, changing this option in
104
+ the console does not require changing host-page markup.
105
+
106
+ Each Origin allowlist item must be an HTTP(S) `scheme://host[:port]` value.
107
+ Chat-entry saves canonicalize and deduplicate origins and reject paths, query
108
+ strings, user information, and fragments. When a browser sends an Origin that
109
+ is not allowlisted, public chat endpoints return 403 before starting a job. An
110
+ empty list remains unrestricted, and requests without a browser Origin remain
111
+ compatible with mini-program and server-side callers. The Origin allowlist is
112
+ therefore a browser anti-embedding boundary, not server-side authentication.
113
+
99
114
  The embedded widget creates a job with `POST /chat/{entry_key}` and consumes its result through:
100
115
 
101
116
  ```http
@@ -109,15 +124,71 @@ Incremental text is provisional transport data. It is not a durable conversation
109
124
 
110
125
  See [STREAMING.en.md](STREAMING.en.md) for event payloads, reconnect rules, provider fallback, audit boundaries, and multi-replica deployment requirements.
111
126
 
127
+ ### Non-blocking `bailing-form` responses
128
+
129
+ `POST /chat/{entry_key}` accepts exactly one user input shape: a normal non-empty
130
+ `message`, or an `interaction_response` to a form rendered by an earlier final
131
+ reply. Both shapes keep the existing optional `visitor_id`, `ticket`,
132
+ `thread_id`, `context`, and `client_capabilities` fields.
133
+
134
+ ```json
135
+ {
136
+ "visitor_id": "visitor_01HXYZ",
137
+ "thread_id": "support_1",
138
+ "interaction_response": {
139
+ "type": "bailing-form",
140
+ "version": 1,
141
+ "source_job_id": "job_that_rendered_the_form",
142
+ "form_id": "refund_info",
143
+ "submission_id": "01JFORMRESPONSE0001",
144
+ "action": "submit",
145
+ "values": {
146
+ "reason": "The item arrived damaged",
147
+ "method": "original"
148
+ }
149
+ }
150
+ }
151
+ ```
152
+
153
+ The source job has already reached `done`. Submitting or cancelling the form
154
+ creates a new user turn and a new job in the same thread; it does not pause or
155
+ resume the source job and adds no `input_required` or SSE status. `action` is
156
+ `submit` or `cancel`; submit requires a values object, while cancel cannot carry
157
+ non-empty values.
158
+
159
+ The server reloads the immutable final reply from `source_job_id` and validates
160
+ that the source job is done and belongs to the same entry, verified uid or
161
+ anonymous visitor, and thread. Values are validated against the matching source
162
+ form declaration, never against a client-supplied schema. A stable
163
+ `submission_id` matches `[A-Za-z0-9_-]{8,64}`. It makes retries for the same
164
+ source job and form return the original job, optionally with `deduped:true`,
165
+ instead of running twice, and must not be reused for different values. The
166
+ serialized `values` object is capped at 32 KiB.
167
+
168
+ After validation, the server builds a self-contained user message from the
169
+ original field labels and choices. Values are therefore durable conversation
170
+ ledger content. Job metadata and the optional history `interaction` summary
171
+ retain only `type`, `version`, `source_job_id`, `form_id`, `submission_id`, and
172
+ `action`, without duplicating values. Form data remains untrusted user data and
173
+ cannot change identity, routing, tool allowlists, approval, or final business
174
+ authorization. A form must not request passwords, API keys, tokens, private
175
+ keys, or payment credentials, and it is not a substitute for the governed tool
176
+ approval path.
177
+
178
+ If the canonical user message would exceed 4,000 characters, the server returns
179
+ 400 instead of silently truncating form values. Keep the same `submission_id`,
180
+ shorten the entered content, and retry.
181
+
112
182
  ### Optional Widget Renderers
113
183
 
114
- Charts and interactive reports do not add a new server-side attachment type or
115
- change the canonical `reply` payload. A host page may register a trusted
116
- renderer through `window.BailingChat.registerRenderer(...)` and consume a
117
- declarative fenced payload. Unknown types, invalid JSON, oversized payloads, or
118
- renderer failures fall back to a text code block. See
119
- [WIDGET_RENDERERS.en.md](WIDGET_RENDERERS.en.md) for the full trust and lifecycle
120
- contract.
184
+ Charts and forms do not add a new server-side attachment type or change the
185
+ canonical `reply` payload. Both consume declarative fenced payloads. A host page
186
+ may register a trusted chart renderer through
187
+ `window.BailingChat.registerRenderer(...)`; the official widget provides the
188
+ constrained `bailing-form` and posts its response through the contract above.
189
+ Unknown types, invalid JSON, oversized payloads, or renderer failures fall back
190
+ to a text code block. See [WIDGET_RENDERERS.en.md](WIDGET_RENDERERS.en.md) for
191
+ the full trust and lifecycle contract.
121
192
 
122
193
  ## Tool Provider Spec
123
194
 
package/docs/CONTRACT.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # 百灵中枢 · 边界契约
2
2
 
3
- > 当前契约:`bailing.contract.v2.13`。这是业务系统与中枢之间唯一的网络边界。
3
+ > 当前契约:`bailing.contract.v2.14`。这是业务系统与中枢之间唯一的网络边界。
4
4
 
5
5
  **冻结它,两边就能各自独立开发。** 任何字段变更都按兼容方式演进(只增不改语义、不删字段)。
6
6
 
@@ -121,17 +121,47 @@ POST /admin/api/routes/auto-preview
121
121
 
122
122
  | 端点 | 说明 |
123
123
  |---|---|
124
- | `POST /chat/:entry_key` | 体 `{message, visitor_id?, ticket?, thread_id?}`。`thread_id`(字母数字_-,≤32 字符):同一身份下的平行会话切分键——开新会话=换新值,延续已有会话=复用,不带=单线程续聊;会话与对话总账同键切分,且写入 metadata.thread_id 供任务详情对账。返回 `{done:false, job_id, visitor_id}` 后,组件通过 SSE 结果流接收状态和最终回答 |
124
+ | `POST /chat/:entry_key` | 请求体必须在普通消息 `{message, ...}` 与表单回传 `{interaction_response, ...}` 中**二选一**;其余既有可选字段(`visitor_id` / `ticket` / `thread_id` / `context` / `client_capabilities`)按原语义共用。`thread_id`(字母数字_-,≤32 字符):同一身份下的平行会话切分键——开新会话=换新值,延续已有会话=复用,不带=单线程续聊;会话与对话总账同键切分,且写入 `metadata.thread_id` 供任务详情对账。返回 `{done:false, job_id, visitor_id}` 后,组件通过 SSE 结果流接收状态和最终回答 |
125
125
  | `GET /chat/:entry_key/events/:job_id` | **SSE 结果流**:只能订阅本入口发起的任务。基础事件为 `open/status/ping/done/failed/timeout`;支持增量输出时还会发送 `phase/reset/delta`。`done` 携带任务库中的权威最终结果 `{done:true, reply, job_id, visitor_id, references?, attachments?}`。完整语义见 [STREAMING.md](STREAMING.md) |
126
- | `GET /chat/:entry_key/thread?visitor_id=&thread_id=&ticket=` | **拉服务端会话总账**:组件重开、或异步迟到结果(如审批批准后重跑的回复落在另一条任务里)回灌用——按与提问一致的身份重建线索、只读返回正序消息。身份纪律同 `POST /chat`(带票按 uid、无票按 visitor,票坏=401) |
127
- | `GET /chat/:entry_key/config` | 组件状态与配置:停用入口返回 `{enabled:false}`,组件静默不挂载;启用时返回标题/开场白/主色/品牌,**外观**(窗口尺寸/标题对齐/气泡位置与偏移/头像/自定义气泡图标/底部品牌标识)、`upload`。控制台改完后,业务页面无需改嵌入代码 |
126
+ | `GET /chat/:entry_key/thread?visitor_id=&thread_id=&ticket=` | **拉服务端会话总账**:组件重开、表单回执恢复,或异步迟到结果(如审批批准后重跑的回复落在另一条任务里)回灌用——按与提问一致的身份重建线索、只读返回正序消息。表单回传对应的用户消息可附带不含表单值的 `interaction` 关联摘要。身份纪律同 `POST /chat`(带票按 uid、无票按 visitor,票坏=401) |
127
+ | `GET /chat/:entry_key/config` | 组件状态与配置:停用入口返回 `{enabled:false}`,组件静默不挂载;启用时返回标题/开场白/主色/品牌,**外观**(默认展开/窗口尺寸/标题对齐/气泡位置与偏移/头像/自定义气泡图标/底部品牌标识)、`upload`。`default_open` 缺省为 `false`;设为 `true` 或脚本带 `data-open="1"` 都会在加载后展开。控制台改完后,业务页面无需改嵌入代码 |
128
128
  | `POST /chat/:entry_key/rate/:job_id` | **评价回答**:体 `{rating:"up"\|"down"\|"note", visitor_id, comment?}`;`note` 表示只提交文字反馈,此时 `comment` 必填。只能评自己问出来的那条(visitor_id 须与提问时一致);一答一评,重评覆盖。运营在控制台「聊天入口 → 评价」看汇总 |
129
129
 
130
+ ### 1.1.1 `bailing-form` 非阻塞交互回传
131
+
132
+ 当最终 `done.reply` 含有符合 [WIDGET_RENDERERS.md](WIDGET_RENDERERS.md) 的 `bailing-form` fenced payload 时,官方 Widget 可把它渲染为受约束表单。当前助手任务在输出该回答后依然正常进入 `done`;用户提交或取消表单时,Widget 对**同一 `thread_id`** 再发一次 `POST /chat/:entry_key`,创建新的用户轮次和新 job。该机制不引入 `input_required` 或新的 SSE 任务状态。
133
+
134
+ ```json
135
+ {
136
+ "visitor_id": "visitor_01HXYZ",
137
+ "thread_id": "support_1",
138
+ "interaction_response": {
139
+ "type": "bailing-form",
140
+ "version": 1,
141
+ "source_job_id": "job_that_rendered_the_form",
142
+ "form_id": "refund_info",
143
+ "submission_id": "01JFORMRESPONSE0001",
144
+ "action": "submit",
145
+ "values": {
146
+ "reason": "商品破损",
147
+ "method": "original"
148
+ }
149
+ }
150
+ }
151
+ ```
152
+
153
+ - `action` 只接受 `submit` 或 `cancel`。`submit` 必须带 `values` 对象;`cancel` 不得携带非空值。
154
+ - 服务端不信任客户端回传的 schema。它会重新读取 `source_job_id` 的权威最终回复,校验该 job 已 `done`、属于同一入口、同一已验签 uid 或匿名 visitor、同一 thread,并依据其中同 `form_id` 的不可变表单声明验证字段、必填、长度、范围和选项。
155
+ - `submission_id` 匹配 `[A-Za-z0-9_-]{8,64}`,是这次回传的幂等键。同一身份对同一 `source_job_id + form_id + submission_id` 重试时返回原 job,并可附带 `deduped:true`,不重复运行。客户端不得把同一 `submission_id` 复用给另一组值。`values` 序列化后最大 32 KiB。
156
+ - 校验通过后,服务端按原声明的字段标签与选项生成自包含的用户消息,再进入普通聊天运行时。字段值会随该用户消息进入对话总账;job metadata 与历史 `interaction` 摘要只保留 `type/version/source_job_id/form_id/submission_id/action`,不重复存储值。
157
+ - 规范化后的用户消息超过 4000 字时返回 400,不会静默截断表单值;客户端应保留原 `submission_id`、缩短填写内容后再提交。
158
+ - 表单值仍是不可信用户数据,不能改变身份、路由、工具白名单、审批或业务授权。表单不得索要密码、API Key、Token、私钥或支付凭据;需要审批或产生业务副作用的动作仍须走 §2.4 的工具治理车道。
159
+
130
160
  **引用来源**:路由挂了知识库时,回答附 `references: [{seq, title, score, snippet}]`(本次检索命中),正文中模型按 `[n]` 标注实际引用的资料编号——消费方可据此展示"答案出处"。完整快照(含 doc_id)在 job 的 `dispatch.kb_refs`,`/run` 触发的任务同样携带。
131
161
 
132
162
  **富内容**:`reply` 为 markdown;同时附 `attachments`(图片/文件的结构化数组),无 markdown 渲染器的端据此渲染——见 §2.5。
133
163
 
134
- 防滥用三件套:站点 **Origin 白名单**(浏览器 Origin 不可伪造;空=未限制)、**按 IP 限速**(默认 20/分钟)、入口可停用/删除。CORS 全放开(公开面无 Cookie)。
164
+ 防滥用三件套:站点 **Origin 白名单**(浏览器 Origin 不可伪造;空=未限制)、**按 IP 限速**(默认 20/分钟)、入口可停用/删除。白名单每项只接受 `scheme://host[:port]`,保存时按 URL origin 规范化并去重;带路径、参数、用户信息或片段的值会拒绝保存。浏览器携带的 Origin 不在白名单时,公开聊天端点在进入任务链路前返回 403。无 Origin 的小程序/服务端请求按既有契约保持兼容;因此 Origin 白名单是浏览器防盗嵌边界,不是服务端身份鉴权。CORS 全放开(公开面无 Cookie),最终是否放行以服务端白名单裁决为准。
135
165
 
136
166
  **身份纪律(与总纲一致)**:网页访客默认是**匿名主体**。`visitor_id` 是组件存 localStorage 的随机串,只用于会话/线索连续性(同访客自动续聊),**不是身份凭证**;metadata 由中枢服务端构造,组件带不进业务操作主体——只有不要求主体的公开能力可用于匿名访问;声明需要主体的查询和写操作均保持不可见,业务侧仍须依据空或有效的 On-Behalf-Of 做最终授权。
137
167
 
@@ -593,7 +623,7 @@ AI 的回复是 **GitHub 风味 markdown**。为让没有 markdown 渲染器的
593
623
 
594
624
  约束:图片/文件本体存放在业务自己的存储/CDN(中枢只透传 url,不代管二进制);同一 url 在 attachments 内去重。
595
625
 
596
- > **聊天组件专用的图表/交互报告不是新的服务端 `attachments` 类型。** 它是宿主页面通过 `window.BailingChat.registerRenderer(...)` 注册的可选展示扩展,消费回复中的声明式 fenced payload;未知类型、无效 JSON、超限载荷或渲染失败必须降级为纯文本代码块。服务端契约保持 `reply/text + attachments` 不变,完整边界见 [WIDGET_RENDERERS.md](WIDGET_RENDERERS.md)。
626
+ > **聊天组件专用的图表和表单不是新的服务端 `attachments` 类型。** 它们消费回复中的声明式 fenced payload;图表可由宿主通过 `window.BailingChat.registerRenderer(...)` 扩展,`bailing-form` 由官方 Widget 受限渲染并通过 §1.1.1 回传。未知类型、无效 JSON、超限载荷或渲染失败必须降级为纯文本代码块。回复契约保持 `reply/text + attachments` 不变,完整边界见 [WIDGET_RENDERERS.md](WIDGET_RENDERERS.md)。
597
627
 
598
628
  ## 2.6 入站渠道:外部平台消息进中枢
599
629
 
@@ -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.3.4`;
10
+ - Stable baseline: `v0.5.0`;
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.3.4` 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.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.
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.3.4 https://github.com/bailinghub/bailinghub.git
49
+ git clone --depth 1 --branch v0.5.0 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.3.4.en.md).
170
+ - [Current stable release notes](RELEASE_NOTES_v0.5.0.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.3.4`;
10
+ - 稳定基线:`v0.5.0`;
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.3.4` 官方镜像,生成随机 Token 与后台密码,启动服务并自动运行基础体检。首次管理员只在数据库管理员表为空时创建;对同一持久化数据库进行重启、升级、容器重建或重新安装,不会覆盖已经修改的管理员密码。可选 `/metrics` 端点默认关闭,不影响基础验证。请保留终端输出中的版本、安装模式、耗时和“常用命令”,但不要把密码或 Token 写入反馈。新安装 Docker 后,当前非 root 会话通常仍需使用脚本打印的 `sudo docker compose ...` 命令;重新登录后 Docker 组权限才可能生效。
35
+ 脚本默认拉取 `v0.5.0` 官方镜像,生成随机 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.3.4 https://github.com/bailinghub/bailinghub.git
49
+ git clone --depth 1 --branch v0.5.0 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.3.4.md)。
170
+ - [当前稳定版发布说明](RELEASE_NOTES_v0.5.0.md)。
171
171
 
172
172
  扩展验证请在同一 Issue 模板中选择对应路径,并说明是否获得过维护者的直接帮助。
173
173
 
@@ -41,6 +41,12 @@ ticket from its own authenticated session and render it as `data-ticket`.
41
41
  BailingHub verifies that ticket before using its opaque uid as the acting
42
42
  subject; the integration token never belongs in browser code.
43
43
 
44
+ Chat Entry appearance settings can optionally open the official widget as soon
45
+ as an embedded page loads. This setting is off by default, and existing
46
+ `data-open="1"` embeds continue to force the same behavior. Since the widget
47
+ loads entry configuration at startup, changing the setting does not require a
48
+ host-page code change.
49
+
44
50
  ## Option A: Docker Demo
45
51
 
46
52
  ```bash
@@ -117,7 +117,7 @@ node bailing-executor.mjs --hub <中枢地址> --targets <目标名> \
117
117
  - **聊天附件上传**(「媒体存储」+「聊天入口」):不开任何对象存储也能用,默认写服务器 `data/uploads` 并返回 `/uploads/*` 公开 URL;生产需要 CDN、生命周期管理或多副本共享时,再登记业务对象存储(当前 COS:region/bucket/AK·SK/公开域名/写入前缀)并让聊天入口关联它。图片、语音、文件都会得到**永久 URL**,一份存储喂三件事:完整追溯 / 多模态输入策略 / 业务接口入参。路由决定图片、语音、文件分别走识别、转写、文本抽取、摘要、直送或忽略;指向业务自己的桶则 URL 即业务 CDN、零转存。见 CONTRACT §2.4e。
118
118
  - **对话记忆**(「触发路由 → 对话记忆」):长会话开**滚动摘要**(默认关、不改原行为)——超水位线的早期对话异步压缩成结构化摘要,后续连摘要一起注入,上下文不爆。
119
119
  - **页面感知**(「聊天入口 → 页面登记」):配 URL 模式 → 页面名+说明的登记表,AI 据此知道访客在哪页提问、精准定位;路由再开「页面感知检索」可偏置召回本页相关文档(全局仍兜底)。见 CONTRACT §1.2。
120
- - **组件外观与运营启停**(「聊天入口」):窗口尺寸/高度、标题对齐、气泡贴左/右下角与像素偏移、头部头像、自定义气泡图标、底部品牌标识都可配置;入口可在列表一键暂停,已嵌入页面无需删除脚本,恢复后自动重新展示。
120
+ - **组件外观与运营启停**(「聊天入口」):默认展开、窗口尺寸/高度、标题对齐、气泡贴左/右下角与像素偏移、头部头像、自定义气泡图标、底部品牌标识都可配置;入口可在列表一键暂停,已嵌入页面无需删除脚本,恢复后自动重新展示。
121
121
 
122
122
  ## 不同形态怎么配(速查)
123
123
 
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,6 +105,8 @@ 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. |
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. |
102
110
  | [RELEASE_NOTES_v0.1.0.en.md](RELEASE_NOTES_v0.1.0.en.md) | First public release notes. |
103
111
  | [CHANGELOG.en.md](CHANGELOG.en.md) | Public changelog format and current release summary. |
104
112
  | [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,6 +118,8 @@
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. |
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. |
115
123
  | [RELEASE_NOTES_v0.1.0.md](RELEASE_NOTES_v0.1.0.md) | 首个公开版本的 GitHub Release 草稿。 |
116
124
  | [RELEASE_NOTES_v0.1.0.en.md](RELEASE_NOTES_v0.1.0.en.md) | English release notes. |
117
125
  | [CHANGELOG.md](CHANGELOG.md) | 公开发布后的对外变更记录。 |
@@ -0,0 +1,39 @@
1
+ # BailingHub v0.4.0: Native Conversational Forms and Chat-Entry Controls
2
+
3
+ `v0.4.0` adds constrained native conversational forms to the official web widget and completes chat-entry controls for default-open presentation and browser Origin allowlists. Forms reuse the existing presentation-capability negotiation and non-blocking conversation model rather than introducing a second task state or approval protocol.
4
+
5
+ ## Main changes
6
+
7
+ - **Native conversational forms**: the dependency-free official widget supports `bailing-form` v1 for text, textarea, number, date, boolean, single-select, and multi-select fields, with client/server validation, submission receipts, and history recovery.
8
+ - **Proactive information collection**: the built-in LLM receives constrained form guidance only when the client explicitly advertises `bailing-form`. When the context shows that several fields are required before the task can continue, the model may emit a form proactively without waiting for the user to request one.
9
+ - **Non-blocking continuation**: the source answer still reaches `done`. Submit, cancel, or skip creates a new user turn and job in the same thread, without adding `input_required` or changing existing SSE terminal semantics.
10
+ - **Default-open entries**: appearance configuration adds a default-false `default_open` setting. When enabled, existing official embeds open on load without page changes; the existing `data-open="1"` force-open behavior remains compatible.
11
+ - **Origin allowlist guardrails**: the console accepts exact `scheme://host[:port]` origins, canonicalizes and deduplicates them, and rejects non-allowlisted browser Origins with 403 before a job starts. Invalid formats or types return 400.
12
+ - **Ecosystem documentation discovery**: the README links to an independently maintained community plugin for DeepSeek Harness. The link is not part of BailingHub Core and does not imply official DeepSeek development, certification, endorsement, or adoption.
13
+
14
+ ## Security and trust boundaries
15
+
16
+ - The server reloads the authoritative form from the source job's final reply and matches entry, identity, thread, and `submission_id`; a client-supplied Schema cannot rewrite submission rules.
17
+ - Forms cannot request passwords, tokens, API keys, private keys, or payment credentials, and cannot change identity, routing, tool eligibility, approval, business permissions, or side-effect gates.
18
+ - Ordinary form values follow existing chat semantics and enter the conversation ledger and model context. Deployers remain responsible for their own retention, privacy notice, and compliance policies.
19
+ - The Origin allowlist prevents direct browser re-embedding; it is not server authentication. An empty array remains unrestricted, and existing server or mini-program calls without Origin remain compatible. Use request signing or a business identity ticket when non-browser callers must be restricted.
20
+ - Custom or external executors do not automatically receive the built-in LLM form prompt and must implement the same public output contract themselves.
21
+
22
+ ## Compatibility and upgrade
23
+
24
+ - The public contract advances additively to `bailing.contract.v2.14`; `WIDGET_API` and `rendererApiVersion` remain 1.
25
+ - There is no new database migration. `054_demo_dataset_state.sql` remains the latest migration.
26
+ - Client API v1, Kernel Host API v1, Executor Protocol, ACC, SDKs, tool signatures, approval semantics, and final business authorization remain unchanged.
27
+ - Existing chat entries remain collapsed by default, and existing `allowed_origins: []` remains unrestricted. To restrict browser embeds, save exact origins without paths, query strings, or wildcards.
28
+
29
+ ## Validation
30
+
31
+ The release gate covers the complete `npm run release:check`, 554 Core tests, real-browser widget interaction, console builds, bilingual documentation, OSS boundaries, security scans, Client API contracts, and npm artifact consistency. Proactive form output, submission continuation, history recovery, default-open presentation, and non-allowlisted browser rejection also completed real end-to-end validation.
32
+
33
+ ## Related documentation
34
+
35
+ - [Public runtime contract](CONTRACT.en.md)
36
+ - [Widget renderer and form contract](WIDGET_RENDERERS.en.md)
37
+ - [Streaming protocol](STREAMING.en.md)
38
+ - [Compatibility and upgrade](COMPATIBILITY.en.md)
39
+ - [中文发布说明](RELEASE_NOTES_v0.4.0.md)