bailinghub 0.6.1 → 0.8.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 (229) hide show
  1. package/README.en.md +8 -7
  2. package/README.md +7 -7
  3. package/docker-compose.images.yml +2 -2
  4. package/docs/AGENT_AUTH_API.en.md +112 -1
  5. package/docs/AGENT_AUTH_API.md +99 -1
  6. package/docs/AGENT_CLIENT_QUICKSTART.en.md +32 -5
  7. package/docs/AGENT_CLIENT_QUICKSTART.md +27 -4
  8. package/docs/AGENT_CLIENT_RUNTIME_API.en.md +46 -0
  9. package/docs/AGENT_CLIENT_RUNTIME_API.md +38 -1
  10. package/docs/AGENT_CONVERSATION_AUDIT.en.md +109 -4
  11. package/docs/AGENT_CONVERSATION_AUDIT.md +84 -3
  12. package/docs/AGENT_SUBJECT_DISPLAY.en.md +95 -0
  13. package/docs/AGENT_SUBJECT_DISPLAY.md +95 -0
  14. package/docs/AGENT_SYSTEM_INFO.en.md +99 -0
  15. package/docs/AGENT_SYSTEM_INFO.md +97 -0
  16. package/docs/AGENT_TASK_CONTROL.en.md +25 -0
  17. package/docs/AGENT_TASK_CONTROL.md +94 -0
  18. package/docs/AGENT_TASK_CONTROL_FOUNDATION.md +134 -0
  19. package/docs/CHANGELOG.en.md +24 -1
  20. package/docs/CHANGELOG.md +24 -1
  21. package/docs/COMPATIBILITY.en.md +2 -0
  22. package/docs/CONTRACT.en.md +2 -0
  23. package/docs/CONTRACT.md +2 -0
  24. package/docs/GENERATED_ARTIFACTS.en.md +46 -0
  25. package/docs/GENERATED_ARTIFACTS.md +108 -0
  26. package/docs/INDEPENDENT_VALIDATION.en.md +4 -4
  27. package/docs/INDEPENDENT_VALIDATION.md +4 -4
  28. package/docs/INVOCATION_RECEIPTS.md +111 -0
  29. package/docs/LOCAL_AGENT_SETUP.en.md +116 -0
  30. package/docs/LOCAL_AGENT_SETUP.md +116 -0
  31. package/docs/README.en.md +9 -0
  32. package/docs/README.md +9 -0
  33. package/docs/RELEASE_NOTES_NEXT.en.md +3 -0
  34. package/docs/RELEASE_NOTES_NEXT.md +3 -0
  35. package/docs/RELEASE_NOTES_v0.7.0.en.md +116 -0
  36. package/docs/RELEASE_NOTES_v0.7.0.md +116 -0
  37. package/docs/RELEASE_NOTES_v0.8.0.en.md +40 -0
  38. package/docs/RELEASE_NOTES_v0.8.0.md +62 -0
  39. package/docs/SDK.en.md +31 -0
  40. package/docs/TOOL_RATE_LIMITS.md +50 -0
  41. package/docs/UPGRADE_v0.8.0.en.md +71 -0
  42. package/docs/UPGRADE_v0.8.0.md +73 -0
  43. package/docs/user-guide/conversations.en.md +4 -2
  44. package/docs/user-guide/conversations.md +4 -2
  45. package/docs//345/205/274/345/256/271/346/200/247/344/270/216/345/215/207/347/272/247.md +2 -0
  46. package/package.json +1 -1
  47. package/schemas/config/route.schema.json +16 -2
  48. package/schemas/config/tool-provider.schema.json +2 -1
  49. package/scripts/check-doc-links.mjs +2 -0
  50. package/scripts/check-image-tags.sh +1 -1
  51. package/scripts/check-release-consistency.test.mjs +2 -2
  52. package/scripts/e2e-console.mjs +32 -2
  53. package/scripts/install.sh +1 -1
  54. package/scripts/publish-images.sh +1 -1
  55. package/scripts/release-audit.mjs +2 -0
  56. package/scripts/sdk-agent-auth-lifecycle-check.mjs +178 -0
  57. package/scripts/sdk-runtime-test.mjs +5 -2
  58. package/scripts/verify-github-repo.mjs +2 -0
  59. package/sdk/php/README.md +29 -0
  60. package/sdk/php/src/AgentAuth.php +100 -4
  61. package/sdk/php/src/HubClient.php +2 -1
  62. package/sdk/php7/README.md +31 -0
  63. package/sdk/php7/src/AgentAuth.php +99 -4
  64. package/sdk/php7/src/HubClient.php +2 -1
  65. package/sql/058_agent_conversation_member_bindings.sql +9 -0
  66. package/sql/059_agent_subject_display.sql +5 -0
  67. package/sql/060_agent_artifacts.sql +11 -0
  68. package/sql/061_tool_rate_limit_policies.sql +3 -0
  69. package/sql/062_agent_task_control.sql +92 -0
  70. package/sql/README.en.md +15 -0
  71. package/sql/README.md +25 -0
  72. package/src/adapters/storage/object-storage.ts +15 -3
  73. package/src/adapters/storage/oss-signature.test.ts +40 -0
  74. package/src/adapters/storage/oss-signature.ts +21 -0
  75. package/src/app/agent-artifacts.test.ts +165 -0
  76. package/src/app/agent-artifacts.ts +85 -0
  77. package/src/app/agent-client-runtime.test.ts +76 -1
  78. package/src/app/agent-client-runtime.ts +13 -0
  79. package/src/app/agent-conversation-audit.ts +20 -0
  80. package/src/app/agent-invocation-snapshot.ts +35 -0
  81. package/src/app/agent-system-info.ts +41 -0
  82. package/src/app/agent-task-control.ts +187 -0
  83. package/src/app/agent-task-runtime.ts +68 -0
  84. package/src/app/agent-tool-invocations.test.ts +329 -1
  85. package/src/app/agent-tool-invocations.ts +239 -14
  86. package/src/app/agent-tool-job.test.ts +11 -1
  87. package/src/app/agent-tool-job.ts +8 -1
  88. package/src/app/builtin-tools.ts +4 -0
  89. package/src/app/oss-edition.ts +1 -0
  90. package/src/app/tool-approvals.ts +4 -0
  91. package/src/app/tool-assembly.ts +5 -0
  92. package/src/core/config/agent-setup.ts +37 -0
  93. package/src/core/config/artifact-config.ts +15 -0
  94. package/src/core/config/client-agent-setup.ts +25 -0
  95. package/src/core/config/config-codec.ts +3 -1
  96. package/src/core/config/config-models.ts +11 -1
  97. package/src/core/config/config-schema.test.ts +11 -0
  98. package/src/core/config/route-config.test.ts +28 -0
  99. package/src/core/config/route-config.ts +44 -4
  100. package/src/core/contracts/agent-subject-display.test.ts +19 -0
  101. package/src/core/contracts/agent-subject-display.ts +36 -0
  102. package/src/core/contracts/tool-rate-limits.test.ts +59 -0
  103. package/src/core/contracts/tool-rate-limits.ts +48 -0
  104. package/src/core/contracts/tools.ts +122 -43
  105. package/src/core/contracts/types.ts +18 -1
  106. package/src/core/runtime/agent-conversation-audit.test.ts +19 -1
  107. package/src/core/runtime/agent-conversation-audit.ts +39 -0
  108. package/src/core/runtime/agent-task-control.test.ts +114 -0
  109. package/src/core/runtime/agent-task-control.ts +227 -0
  110. package/src/infrastructure/config/config-agent-artifact-repository.ts +32 -0
  111. package/src/infrastructure/config/config-agent-auth-business-sessions.test.ts +120 -0
  112. package/src/infrastructure/config/config-agent-auth-lifecycle-race.test.ts +152 -0
  113. package/src/infrastructure/config/config-agent-auth-repository.test.ts +2 -0
  114. package/src/infrastructure/config/config-agent-auth-repository.ts +208 -18
  115. package/src/infrastructure/config/config-agent-client-runtime-repository.ts +7 -1
  116. package/src/infrastructure/config/config-agent-conversation-audit-cross-binding.test.ts +120 -0
  117. package/src/infrastructure/config/config-agent-conversation-audit-repository.ts +117 -23
  118. package/src/infrastructure/config/config-agent-subject-display.test.ts +103 -0
  119. package/src/infrastructure/config/config-agent-task-control-journal-mysql.test.ts +315 -0
  120. package/src/infrastructure/config/config-agent-task-control-mysql.test.ts +331 -0
  121. package/src/infrastructure/config/config-agent-task-control-repository.ts +640 -0
  122. package/src/infrastructure/config/config-client-repository.ts +21 -0
  123. package/src/infrastructure/config/config-rate-limit-ledger.integration.test.ts +52 -0
  124. package/src/infrastructure/config/config-rate-limit-ledger.ts +48 -0
  125. package/src/infrastructure/config/config-route-agent-setup.test.ts +59 -0
  126. package/src/infrastructure/config/config-route-repository.ts +24 -0
  127. package/src/infrastructure/config/config-storage-bucket-repository.ts +2 -2
  128. package/src/infrastructure/config/config-tool-provider-repository.ts +4 -4
  129. package/src/infrastructure/config/configstore.ts +16 -4
  130. package/src/infrastructure/schema/core-schema-migrator.test.ts +90 -0
  131. package/src/routes/admin-access.ts +37 -0
  132. package/src/routes/admin-agent-clients.ts +11 -0
  133. package/src/routes/admin-agent-setup.test.ts +130 -0
  134. package/src/routes/admin-agent-setup.ts +68 -0
  135. package/src/routes/admin-agent-tasks.ts +32 -0
  136. package/src/routes/admin-client-agent-setup.test.ts +93 -0
  137. package/src/routes/admin-dispatch-config.ts +2 -0
  138. package/src/routes/admin-tool-providers.test.ts +22 -0
  139. package/src/routes/admin-tool-providers.ts +9 -1
  140. package/src/routes/admin.ts +3 -0
  141. package/src/routes/agent-api.test.ts +76 -0
  142. package/src/routes/agent-api.ts +49 -1
  143. package/src/routes/agent-artifacts.ts +29 -0
  144. package/src/routes/agent-auth-lifecycle-http.test.ts +177 -0
  145. package/src/routes/agent-auth-lifecycle.test.ts +193 -0
  146. package/src/routes/agent-auth.test.ts +1 -1
  147. package/src/routes/agent-auth.ts +206 -16
  148. package/src/routes/agent-conversation-audit-cross-binding-http.test.ts +122 -0
  149. package/src/routes/agent-conversation-audit.ts +8 -2
  150. package/src/routes/agent-subject-display-http.test.ts +145 -0
  151. package/src/routes/agent-system-info.test.ts +132 -0
  152. package/src/routes/agent-task-control-http-mysql.test.ts +246 -0
  153. package/src/routes/private.ts +1 -0
  154. package/src/routes/run.ts +2 -1
  155. package/src/test-support/agent-auth-business-query-fixture.ts +43 -0
  156. package/src/test-support/agent-auth-lifecycle-fixture.ts +288 -0
  157. package/src/test-support/agent-conversation-audit-fixture.ts +30 -6
  158. package/src/test-support/agent-conversation-audit-http-fixture.ts +84 -0
  159. package/src/test-support/agent-task-control-mysql-fixture.ts +75 -0
  160. package/web/connect/bailing-connect-php.tgz +0 -0
  161. package/web/connect/bailing-connect-php7.tgz +0 -0
  162. package/web/console/assets/{Accounts-Ca_VnSu9.js → Accounts-BRCR3O0P.js} +1 -1
  163. package/web/console/assets/AgentClients-Bf7sUUs_.js +1 -0
  164. package/web/console/assets/AgentClients-i52AI6YV.css +1 -0
  165. package/web/console/assets/AgentTasks--bqL_QKg.js +2 -0
  166. package/web/console/assets/AgentTasks-C8ox3TyS.css +1 -0
  167. package/web/console/assets/{Approvals-CMvPWacY.js → Approvals-BIbZvInm.js} +1 -1
  168. package/web/console/assets/{Audit-CIRqOCnL.js → Audit-KyPSmBdZ.js} +1 -1
  169. package/web/console/assets/{BrandLockup-BrytmTTH.js → BrandLockup-Sv5DU2G6.js} +1 -1
  170. package/web/console/assets/{Channels-CApxH2TB.js → Channels-B9n4fbxg.js} +1 -1
  171. package/web/console/assets/{ChatEntries-CJon3bWJ.js → ChatEntries-xsOCUXi_.js} +1 -1
  172. package/web/console/assets/Clients-CI3DBDHf.js +3 -0
  173. package/web/console/assets/Clients-CSHIsaWU.css +1 -0
  174. package/web/console/assets/{Cost-BbhlQFP8.js → Cost-JgNXQPlN.js} +1 -1
  175. package/web/console/assets/{Credentials-kqr1W0K7.js → Credentials-B5UUUdt0.js} +1 -1
  176. package/web/console/assets/{Diagnostics-Kljt9XTH.js → Diagnostics-BMGciWQb.js} +1 -1
  177. package/web/console/assets/{Executors-DnsB-Xz4.js → Executors-CRbboOCZ.js} +1 -1
  178. package/web/console/assets/{Kb-DLZSAFWP.js → Kb-CgLNGjRp.js} +1 -1
  179. package/web/console/assets/{Login-DiTjPWmN.js → Login-C52JmXzx.js} +1 -1
  180. package/web/console/assets/{Projects-CXcVCgCD.js → Projects-CDOvHPVS.js} +1 -1
  181. package/web/console/assets/Routes-DkMIjMQA.css +1 -0
  182. package/web/console/assets/Routes-X9vHLpKW.js +124 -0
  183. package/web/console/assets/Runs-CvGTV8I-.css +1 -0
  184. package/web/console/assets/Runs-DYNDXsqk.js +3 -0
  185. package/web/console/assets/{Setup-FqoCKmfZ.js → Setup-B91P6i1x.js} +1 -1
  186. package/web/console/assets/Shell-Bj6C8Hgo.css +1 -0
  187. package/web/console/assets/Shell-BsRa7bQQ.js +1 -0
  188. package/web/console/assets/StorageBuckets-CVgpZRWY.css +1 -0
  189. package/web/console/assets/StorageBuckets-DkuDM0oX.js +1 -0
  190. package/web/console/assets/{SystemSettings-gTQAazu7.js → SystemSettings-B7Mqj3k1.js} +1 -1
  191. package/web/console/assets/{SystemStatus-DAmUUNqO.js → SystemStatus-Db93b6dc.js} +1 -1
  192. package/web/console/assets/{Targets-CZmDcjsE.js → Targets-CuuIYeZO.js} +1 -1
  193. package/web/console/assets/Tools-CHiqz9XZ.js +2 -0
  194. package/web/console/assets/Tools-DU8ei6sd.css +1 -0
  195. package/web/console/assets/index-UGvfF3Xr.js +2 -0
  196. package/web/console/assets/{request-r7GHVJzw.js → request-DeGya810.js} +1 -1
  197. package/web/console/assets/{schema-BVn_hB7M.js → schema-BqlqLw1R.js} +1 -1
  198. package/web/console/index.html +1 -1
  199. package/web-admin/scripts/agent-task-control-smoke.mjs +120 -0
  200. package/web-admin/scripts/subject-display-ui.mjs +78 -0
  201. package/web-admin/src/components/AgentSetupPanel.vue +275 -0
  202. package/web-admin/src/components/ClientConversations.vue +21 -4
  203. package/web-admin/src/components/ToolRateLimitEditor.vue +28 -0
  204. package/web-admin/src/components/conversation-audit.ts +20 -0
  205. package/web-admin/src/layout/Shell.vue +1 -1
  206. package/web-admin/src/pages/AgentClients.vue +99 -23
  207. package/web-admin/src/pages/AgentTasks.vue +281 -0
  208. package/web-admin/src/pages/Clients.vue +4 -1
  209. package/web-admin/src/pages/Routes.vue +10 -1
  210. package/web-admin/src/pages/StorageBuckets.vue +6 -6
  211. package/web-admin/src/pages/Tools.vue +53 -4
  212. package/web-admin/src/router.ts +2 -0
  213. package/web-admin/tests/conversation-audit.fixture.mjs +13 -10
  214. package/web-admin/tests/conversation-audit.test.mjs +63 -1
  215. package/web/console/assets/AgentClients-BPIvlLYY.js +0 -1
  216. package/web/console/assets/AgentClients-DsWADpzr.css +0 -1
  217. package/web/console/assets/Clients-BSA1rlTB.js +0 -3
  218. package/web/console/assets/Clients-CNIVs7Qn.css +0 -1
  219. package/web/console/assets/Routes-CXGl9SMM.css +0 -1
  220. package/web/console/assets/Routes-DN9_d9Po.js +0 -124
  221. package/web/console/assets/Runs-Cwbe6thL.js +0 -3
  222. package/web/console/assets/Runs-D8UmjP5G.css +0 -1
  223. package/web/console/assets/Shell-BEqpONiy.js +0 -1
  224. package/web/console/assets/Shell-D9Uw-fsa.css +0 -1
  225. package/web/console/assets/StorageBuckets-CkORbYXY.js +0 -1
  226. package/web/console/assets/StorageBuckets-GnXnVvF0.css +0 -1
  227. package/web/console/assets/Tools-A20oaMaQ.css +0 -1
  228. package/web/console/assets/Tools-CIHInlHL.js +0 -2
  229. package/web/console/assets/index-BkLbd7Cc.js +0 -2
@@ -0,0 +1,97 @@
1
+ # 让智能体先理解业务系统
2
+
3
+ [English](AGENT_SYSTEM_INFO.en.md) | 简体中文
4
+
5
+ 同一会话连接多个系统时,智能体需要先知道每个系统通常负责什么,才能决定向哪个目标查找工具。例如 Helpdesk 处理客服工单,Inventory 管理库存;两个系统都可以有“查询记录”,但用途不同。
6
+
7
+ 系统说明由中枢管理员在“智能体客户端 → 接入配置”中点击应用行的“配置接入”,进入“系统说明”步骤维护,仍保存在对应业务路由上。用户自己的授权名称或门店名称只是展示标签,不能替代系统身份。读取说明只需要当前 Agent Session 与已选业务路由,不需要先创建业务运行或发送对话正文。
8
+
9
+ 需要从开启接入一路配置到工具范围时,先看[本地智能体集中配置指南](LOCAL_AGENT_SETUP.md)。同一 workspace 的接入方共享这里的说明;同系统多账户无需各写一份产品介绍。
10
+
11
+ ## 管理员填写什么
12
+
13
+ 先在面板中选择工作空间,再填写系统名称、一句话介绍、典型业务方向和系统边界,然后保存工作空间。不配置说明时继续使用既有授权与工具流程。配置对应路由的 `agent_client.system_info`:
14
+
15
+ ```json
16
+ {
17
+ "name": "Helpdesk",
18
+ "summary": "管理客服工单,协助查询处理进度并准备回复。",
19
+ "domains": ["工单查询", "客服回复准备"],
20
+ "boundaries": ["库存调整由库存系统处理。"]
21
+ }
22
+ ```
23
+
24
+ | 字段 | 约束 |
25
+ | --- | --- |
26
+ | `name` | 非空,最多 120 字符 |
27
+ | `summary` | 非空,最多 400 字符 |
28
+ | `domains` | 数组,最多 6 项,每项非空且最多 120 字符;可为空数组 |
29
+ | `boundaries` | 数组,最多 6 项,每项非空且最多 160 字符;可为空数组 |
30
+
31
+ 这四项是产品定位数据,不是额外的模型系统指令。文本字段和每个列表项均使用单行,不包含控制字符。不要填入凭据、业务原文、内部接口地址或权限绕过要求。服务端拒绝未声明字段与超长内容,读取时不会从 `target_config.system_prompt`、路由名称、授权名称或业务工具结果猜补说明。
32
+
33
+ 配置沿用已有 `agent_client` JSON 存储,不需要增加数据库表或迁移。
34
+
35
+ ## 宿主读取契约
36
+
37
+ ```http
38
+ GET /agent-api/v1/workspaces/helpdesk/system-info
39
+ Authorization: Bearer <Agent access token>
40
+ ```
41
+
42
+ 接口仅返回请求中这个路由的说明。服务端重新检查当前 Client、原 Agent Session、双方的路由授权以及路由 audience;撤销或越权仍返回 401/403。已停用或不存在的路由返回 404 `route_unavailable`。不遍历其他路由,也不加载工具目录、知识、记忆或业务上下文,不创建 run,不执行业务工具,不读取请求正文。
43
+
44
+ ```json
45
+ {
46
+ "schema_version": "bailing.agent-system-info.v1",
47
+ "binding": {
48
+ "client_app_id": "helpdesk-client",
49
+ "session_id": "123e4567-e89b-42d3-a456-426614174000",
50
+ "workspace": "helpdesk"
51
+ },
52
+ "metadata_status": "configured",
53
+ "revision": "<sha256>",
54
+ "system": {
55
+ "name": "Helpdesk",
56
+ "summary": "管理客服工单,协助查询处理进度并准备回复。",
57
+ "domains": ["工单查询", "客服回复准备"],
58
+ "boundaries": ["库存调整由库存系统处理。"]
59
+ },
60
+ "tool_status": "not_loaded",
61
+ "availability": "unknown"
62
+ }
63
+ ```
64
+
65
+ `revision` 是规范化说明内容和 schema 的 SHA-256;它标识说明的变化,不替代固定授权身份或工具能力修订。响应使用 `Cache-Control: no-store`。
66
+
67
+ 以下状态必须分开理解:
68
+
69
+ - `system` 说明产品通常做什么,不证明当前授权可以调用所有相关能力。
70
+ - `metadata_status=missing` 表示没有有效说明,`system` 与 `revision` 均为 `null`,不表示没有业务工具。
71
+ - `tool_status=not_loaded` 表示尚未加载工具,不表示工具数量为零。
72
+ - `availability=unknown` 表示本接口没有验证业务服务是否可用。关闭 Runtime 或工具直调时返回 `unavailable`,并使用 `unavailable_reason=agent_client_disabled` 或 `agent_direct_disabled` 表明配置状态。说明仍可读取;工具调用继续服从原开关和权限。
73
+
74
+ 客户端只为本会话明确选定的目标读取说明,并核验返回的 `binding` 与原 Agent Session / Client / workspace 一致,再关联到本地原 `authorization_ref` 和 `system_ref`。单授权、同系统多授权、跨系统授权使用相同的数据结构。不可把未选目标的说明注入模型,也不可因说明更新扩大固定会话范围。
75
+
76
+ 旧 Core 对未知此端点返回 404 `not_found`,宿主可报告说明功能不支持;缺失说明也可显示“系统用途未知”,或使用按受控原绑定关联的本地词典。401/403、`route_unavailable` 与暂时网络故障不能伪装为旧版本不支持。说明功能的降级不替代原授权校验,也不触发默认授权切换。
77
+
78
+ ## 控制台集中配置接口
79
+
80
+ 控制台可使用 `GET /admin/api/routes/:route_key/agent-setup` 读取路由的授权客户端设置、说明、工具源与直调设置。返回仅包含 `route_key`、`name`、`enabled`、`permission`、`revision`、`agent_client`、`tool_sources`、`agent_direct`,不返回路由 `target_config` 或工具源凭据。`permission` 只读;例如 `readonly` 提醒管理员原路由仍不允许写入,不能在此 PUT 中改动。
81
+
82
+ `PUT` 同一路径只接收四个字段:
83
+
84
+ ```json
85
+ {
86
+ "expected_revision": "<GET 返回的 revision>",
87
+ "agent_client": { "enabled": true, "system_info": { "name": "Helpdesk", "summary": "客服工单管理", "domains": [], "boundaries": [] } },
88
+ "tool_sources": [{ "provider": "helpdesk", "allow": ["ticket.read"], "subject_field": "operator_id" }],
89
+ "agent_direct": { "enabled": true }
90
+ }
91
+ ```
92
+
93
+ `agent_client` 与 `agent_direct` 可以显式设为 `null` 来清除;空 `tool_sources` 数组清除工具源选择。编辑界面应保留已有的 `instructions`、`active_tool_limit` 和工具源配置,避免因只填写说明而意外删掉它们。
94
+
95
+ GET 需要 `routes:read`;PUT 需要 `routes:write`,接入方管理权限不能替代路由权限。保存时仍使用既有路由、工具、精确写操作与审批配置校验。数据库事务锁定并比较当前完整路由修订,冲突返回 409 `agent_setup_conflict`;成功只更新 `agent_client`、`tools` 与更新时间,其他配置保持原值。
96
+
97
+ 旧宿主仓储没有实现可选的 `compareAndSetAgentSetup` 时,读取仍可使用,保存返回 503 `agent_setup_unsupported`,不会退回整行覆盖。成功保存返回与 GET 相同的投影及新修订。该配置接口不改变业务 API、审批规则、会话固定范围或归档行为。
@@ -0,0 +1,25 @@
1
+ # Task budgets and pause control
2
+
3
+ Use Core 0.8.0 with Agent Client SDK / DSH 0.6.0 and an adapted host. Task controls require explicit administrator enrollment. See the [complete protocol and operator guide](AGENT_TASK_CONTROL.md).
4
+
5
+ An assistant updating shop products and checking stock may work across several messages and systems. An administrator can freeze the original authorizations, exact tool names, cumulative write-call allowance, concurrency and optional expiry for that task. New messages, tool searches and client restarts do not reset the allowance. Existing business APIs, ACC declarations, authorization and approval rules remain unchanged.
6
+
7
+ Use **Agent Clients → Task control** to create and inspect tasks. The host verifies every original member and persists the binding before business execution. Agent access tokens cannot create tasks, increase budgets or control their state. Participating Agent Sessions become persistently task-required across conversations; cancelling a task does not remove that requirement. Use dedicated synthetic authorizations when first integrating.
8
+
9
+ - A write call is a call whose trusted declaration has `readonly=false`, including idempotent writes. It is not a product, monetary amount, token or successful business change. `null` means unlimited; zero allows reads only.
10
+ - Metering covers governed business tool invocations through the Hub, not local host tools, inference, artifact uploads or conversation archives.
11
+ - Approval waits reserve writes. Confirmed HTTP outcomes consume them, including business rejection. Unknown outcomes retain their reservation and concurrency permit.
12
+ - Pause blocks new permits, while already permitted requests can finish. Continue keeps the original scope and limits and does not execute anything automatically. Cancel cannot be undone and does not roll back business changes.
13
+ - Approval consumption, permit, original-job fence and execution journal commit atomically before HTTP dispatch. Unknown results are inspected using the original invocation; do not submit a replacement write.
14
+
15
+ Agent endpoints are `GET /agent-api/v1/task-control/capabilities` and `GET /agent-api/v1/tasks/{task_id}?workspace=...&client_conversation_id=...`. Turn creation accepts and echoes trusted `task_binding` (`bailing.agent-task-binding.v1`, `task_id`, `scope_hash`). Task snapshots use `bailing.agent-task.v1`, disclose only the requesting member and shared counters, and explicitly do not confer dispatch permission. Verify the complete original group; this release supports one Hub and audit domain only.
16
+
17
+ Read-only progress uses `GET /agent-api/v1/tool-invocations/{invocation_id}/receipt`. `POST .../resume` can dispatch an approved original operation and must never be used as a polling method. Managed runtime searches require the bound `run_id`; discovery itself does not consume the write allowance.
18
+
19
+ The administrator APIs are `GET/POST /admin/api/agent-tasks`, `GET /admin/api/agent-tasks/{task_id}`, and `POST /admin/api/agent-tasks/{task_id}/control`. They require `clients:read` or `clients:write`. Create freezes `members` and `policy`; controls require a stable request ID, expected revision and `pause/resume/cancel`. Read the complete guide for exact wire fields and pagination.
20
+
21
+ The paired SDK adds `getTaskControlCapabilities`, `getTask`, and trusted `startTurn` task binding. DSH supplies host CAS storage and task restoration, lazy business runs, read-only polling and original-invocation recovery. Business backends need no new endpoints.
22
+
23
+ This integrates the existing six-table migration `062`; it adds no further migration. Fully unmigrated installations report unsupported. Partial tables or database failures fail closed. Old clients can continue using non-enrolled Sessions, but cannot bypass an enrolled Session's requirement. After enrollment, do not roll back to a Core that cannot enforce the marker or remove task tables to disable enforcement.
24
+
25
+ `TASK_DISPATCH_UNCERTAIN`, or `TASK_UNAVAILABLE` during invoke/resume, conservatively requires original-call inspection. Revocation of any original member blocks the group; neither default targets nor a remaining subset are valid fallbacks. Local synthetic acceptance does not imply deployment or production acceptance.
@@ -0,0 +1,94 @@
1
+ # 一个任务,跨轮次累计额度与暂停控制
2
+
3
+ 配套版本:Core 0.8.0 / SDK 0.6.0 / DSH 0.6.0。新能力需部署方升级并按宿主契约接入;业务权限、审批和原身份约束保持。 业务后端的 API、ACC 声明、授权和审批规则不需要为此修改。
4
+
5
+ 例如,用户请助手“整理商城商品,再核对库存”。对话可能持续多轮、切换多个工具、涉及两个系统。管理员可以给这个任务指定原授权集合、精确工具范围、累计最多 20 次写调用、最多 2 个在途派发许可。后续消息、重新搜索工具、重开客户端都不能把任务额度归零。普通聊天不为了恢复任务而创建业务运行。
6
+
7
+ ## 怎么用
8
+
9
+ 1. 客户端先显式固定会话授权范围,并提供每个成员原 Agent Session、接入方、工作区和本地会话 ID。
10
+ 2. 管理员在 **智能体客户端 → 任务控制** 创建任务,选择相同成员和精确工具名单,设置累计写额度、并发许可数和可选截止时间。
11
+ 3. 客户端通过 SDK 对全部原成员读取任务,核对 `task_id`、`scope_hash`、成员总数和自己的绑定。宿主把任务关联持久保存,再允许这段会话发起业务操作。任务 ID 不作为模型工具参数。
12
+ 4. 首次真正使用某个系统时,`startTurn` 携带可信 `task_binding`,Core 在创建业务 run 或装配正文上下文之前核验整个原范围,并将真实 run 固定到该任务。
13
+ 5. 管理员在同一页面查看累计用量、原调用与运行关联,按需暂停、继续或取消。页面刷新只读,不继续审批后的业务操作。
14
+
15
+ **启用范围的重要影响:** 创建任务会为每个原 Agent Session 保存持续有效的任务强制标记。之后该授权的其他会话及旧调用入口也不能省略任务绑定。取消任务不删除此标记。第一次联调请使用专门的合成测试授权,先核对全部客户端版本;没有兼容客户端的授权不应提前加入任务。管理员可以明确创建后续任务,但模型和客户端不能为绕开旧额度自动创建新任务。
16
+
17
+ ## 额度到底数什么
18
+
19
+ | 项目 | 含义 |
20
+ |---|---|
21
+ | 累计写额度 | 按可信声明中 `readonly=false` 的原工具调用计数;声明幂等的写操作也计入。`null` 不限;`0` 只读。 |
22
+ | 已预留 | 等待审批或派发的写调用。结果不明的写操作继续保留预留,不能先释放给下一笔。 |
23
+ | 已消耗 | 原调用已经获得可信 HTTP 回执。业务拒绝也计入;它不是业务成功次数。 |
24
+ | 在途许可 | 已获得派发许可、尚未结清的读写调用。结果不明时不自动释放。 |
25
+ | 并发上限 | 同任务同时在途许可的上限,至少 1;读操作也占在途许可。 |
26
+
27
+ 这不是共享工具频率限流,也不按消息、商品数量、金额或 Token 计数。一次批量接口可能影响多个商品,仍只算一次写调用;业务侧需继续按自身规则确认批量影响。已有工具源、单工具限流及审批仍独立生效,不被任务额度替代。
28
+
29
+ 本批计量范围是经中枢派发的受治理业务工具调用,不包含宿主本地工具、模型推理、附件上传或聊天归档。它不是这些资源的通用配额系统。
30
+
31
+ ## 暂停、继续与不确定结果
32
+
33
+ - **暂停**:阻止后续派发许可。已获得许可的请求可能完成;暂停不等于撤回请求。
34
+ - **继续**:恢复原任务可派发状态,不增加额度、不变更成员,也不会自动执行任何业务调用。审批已通过的操作仍需显式继续原 `invocation_id`。
35
+ - **取消**:终止后续派发,不能重新开启,也不会回滚已经发生的业务变化。
36
+ - **原成员失效**:任一成员撤销、身份变化或绑定变化,整组阻断;不缩成剩余子集,不换默认授权。
37
+ - **结果不明**:只核对原调用。不能换 ID、换授权、重建任务或改用另一个工具重新发出同一写操作。当前候选不会自动向业务系统查询补证,也不自动释放未知许可。
38
+
39
+ 审批单消费、原调用派发标记、任务许可和执行 journal 在同一 MySQL 事务提交;之后才发出 HTTP。可信响应与额度结算也同事务保存。审计降级或传输不确定会保留明确的不确定状态,不能当成业务成功。
40
+
41
+ ## Agent / 宿主接口
42
+
43
+ 全部 Agent 端点仅接受原 Agent Bearer,响应 `Cache-Control: no-store`。
44
+
45
+ | 接口 | 用途 |
46
+ |---|---|
47
+ | `GET /agent-api/v1/task-control/capabilities` | 协商 `supported`、`mode=optional/required`、`same_hub_only`、`metering=write_invocation` 和只读核对能力。 |
48
+ | `GET /agent-api/v1/tasks/{task_id}?workspace=...&client_conversation_id=...` | 核验整组选定身份,返回当前请求成员和任务共享计数;不返回其他成员身份、凭据、正文或工具结果。 |
49
+ | `POST /agent-api/v1/workspaces/{workspace}/turns` | 增量接受下述可信绑定,并在上下文响应顶层原样回显。 |
50
+ | `GET /agent-api/v1/tool-invocations/{invocation_id}/receipt` | 只读原记录;管理任务还会重新验证整个原成员集合。 |
51
+ | `POST /agent-api/v1/tool-invocations/{invocation_id}/resume` | 可能真正派发原操作,只能作为显式继续,不能当轮询。 |
52
+
53
+ ```json
54
+ {
55
+ "task_binding": {
56
+ "schema_version": "bailing.agent-task-binding.v1",
57
+ "task_id": "11111111-1111-4111-8111-111111111111",
58
+ "scope_hash": "<64位十六进制摘要>"
59
+ }
60
+ }
61
+ ```
62
+
63
+ 任务快照 schema 为 `bailing.agent-task.v1`,包括 `state`、控制 `revision`、账本 `ledger_sequence`、`scope_hash`、`member_count`、当前 `member`、`policy`、`counters`。`snapshot_is_dispatch_permission=false`:读取成功不是下一笔派发的许可。SDK/DSH 必须对全部原成员验证,不能只读某一个成员就推断其他成员也可用。
64
+
65
+ 能力搜索不消耗写额度。已加入任务的 Session 在 Runtime 搜索时须携带原 `run_id`;只带裸查询不能绕过任务范围。当前目录仍描述原授权下的能力,任务精确工具名单在执行前再次裁剪和校验;不能把目录存在理解成这项任务一定允许执行。
66
+
67
+ SDK 增量方法为 `getTaskControlCapabilities`、`getTask` 和 `startTurn(..., { taskBinding })`。DSH 提供宿主 `setSessionTaskBinding/getSessionTaskState/restoreSessionTaskBinding` 及 CAS 存储接缝;精确签名以配套 DSH 的 `docs/TASK_CONTROL.md` 为准。模型不获得管理员 Token、创建任务、改额度或解除暂停的工具。沿用已选授权、跨轮工具缓存和原调用持久 journal;新操作使用本轮真实 run,恢复操作使用原 run / invocation。
68
+
69
+ 本候选限同一 Hub 和同一审计域。不同 Hub 的预算、正文转发和权限不能自动合并。
70
+
71
+ ## 管理接口
72
+
73
+ 仅管理员身份且具备 `clients:read` / `clients:write` 可使用,Agent Bearer 无权创建或控制任务。
74
+
75
+ | 接口 | 请求/返回 |
76
+ |---|---|
77
+ | `GET /admin/api/agent-tasks?limit=30&before=...` | `{items,next_cursor}`;按稳定 task ID 降序分页,不是创建时间排序。 |
78
+ | `POST /admin/api/agent-tasks` | `{request_id,members,policy}`,返回任务快照。 |
79
+ | `GET /admin/api/agent-tasks/{task_id}?limit=30&before=...` | `{task,invocations,next_cursor}`;原调用按稳定 job ID 分页。 |
80
+ | `POST /admin/api/agent-tasks/{task_id}/control` | `{request_id,expected_revision,action}`,`action=pause/resume/cancel`,返回快照。 |
81
+
82
+ `members` 每项为 `{session_id,client_app_id,workspace,client_conversation_id,allowed_tools}`;工具只允许精确名称。`policy` 为 `{max_write_calls,max_concurrent,expires_at}`,截止时间可为 `null`。成员与策略创建后冻结,本候选不支持直接编辑。
83
+
84
+ 创建与控制必须保留同一逻辑请求的 `request_id`,丢失确认时重试原请求。控制使用 CAS;修订冲突先刷新并请操作者重新判断,不能自动换修订号重放操作。后台只展示原关联、状态和计数,任务接口不返回工具参数或业务正文。
85
+
86
+ ## 错误与兼容
87
+
88
+ `TASK_PAUSED`、`TASK_CANCELLED`、`TASK_EXPIRED`、`TASK_WRITE_BUDGET_EXHAUSTED`、`TASK_CONCURRENCY_EXHAUSTED`、`TASK_TOOL_NOT_ALLOWED` 分别表达具体闸门;`TASK_REQUIRED` 表示不能省略任务。`TASK_SCOPE_BLOCKED` 不允许缩小原范围;绑定、成员和记录错误不能通过猜测坐标修复。
89
+
90
+ `TASK_DISPATCH_UNCERTAIN` 以及 invoke/resume 的 `TASK_UNAVAILABLE` 由配套 SDK 保守标成原调用结果未知,指导 `inspect_original`,不建议新写。旧 Core 404/405/501 能力协商为明确不支持;网络问题不能冒充“不支持”。旧 SDK/DSH 可继续使用**未加入任务**的授权,但不能执行已强制任务的 Session。
91
+
92
+ 数据库需要既有 `062_agent_task_control.sql` 的六张表,本次接线不增加后续迁移。全未迁移时任务能力不支持;部分表缺失或数据库故障必须阻断,不降级绕过。正式部署需先备份并核对当前数据库、成套候选和宿主兼容性;本地测试通过不代表已经部署。启用任务后不要回退到不认识强制标记的旧 Core,也不要删除标记或任务表作为回滚手段。
93
+
94
+ Core 的可复现检查:`npm run typecheck`、`npm test`。真实事务/HTTP 验收通过显式 `BAILING_TASK_TEST_MYSQL_CONFIG` 指向专用 loopback 临时数据库,再运行 `src/routes/agent-task-control-http-mysql.test.ts` 与任务仓储的 MySQL 测试。禁止将该测试指向业务数据库。
@@ -0,0 +1,134 @@
1
+ # Task control: persistence foundation
2
+
3
+ Historical foundation notes. The paired integration candidate now connects the actual runtime, HTTP, SDK/DSH and console; see [Task control](AGENT_TASK_CONTROL.en.md). The limitations below describe the earlier foundation slice only.
4
+
5
+ Status: internal implementation foundation. It is **not connected to the HTTP APIs,
6
+ tool runtime, SDK, DSH, or console**. Applying the new SQL alone does not enforce a
7
+ task budget or pause business execution. No client should enable task mode from
8
+ this foundation alone.
9
+
10
+ ## What this layer is for
11
+
12
+ A user may ask an assistant to update product descriptions in a shop and check
13
+ stock in an inventory system. A task links those selected authorizations and the
14
+ original calls. It can restrict the allowed tools, cumulative write calls,
15
+ concurrent dispatch permits, and expiry time. Existing authorization and business
16
+ approval checks remain necessary.
17
+
18
+ The write counter counts calls to tools whose trusted declaration is not
19
+ `readonly`. This includes idempotent writes. It does not count products, money,
20
+ successful business changes, or tokens. One bulk call may affect many objects.
21
+
22
+ ## Trusted inputs and persistent records
23
+
24
+ The future authenticated management layer must create the task and supply its
25
+ actor. The model cannot create a replacement task or increase its budget. Members
26
+ freeze the original Agent Session, Client, route, client conversation, identity
27
+ digest, and allowed tool names. Display names are not identities.
28
+
29
+ The repository also stores a persistent enforcement marker for each participating
30
+ Agent Session. Cancelling a task does not remove that marker. A future final
31
+ dispatch guard must check it even when a caller omits task metadata, changes its
32
+ conversation ID, or uses an older execution API. This first foundation does not
33
+ yet install that guard.
34
+
35
+ The first trusted reservation also binds the real run to exactly one task. A new
36
+ invocation ID cannot move that run to another approved task. The future run
37
+ creation path must establish this association from authenticated host state,
38
+ rather than letting the model choose a task on its first call.
39
+
40
+ `reserveInvocation` verifies a real Agent runtime run and the original Agent tool
41
+ Job. New operations require an active run. An existing original operation keeps
42
+ its original run even after that run ends. The classification must match a
43
+ Core-written `agent_task_tool_contract` snapshot in the original Job; user text or
44
+ model arguments cannot establish that snapshot. Current capability permission
45
+ and execution fingerprint validation must still be applied by the future runtime
46
+ integration before admission.
47
+
48
+ The task tables contain identifiers, hashes, control state and counters. They do
49
+ not duplicate conversation bodies, access tokens, or full business arguments.
50
+ Internal repository views include identity digests and group state; they are not
51
+ safe response DTOs. An authenticated API must authorize and project these views.
52
+
53
+ ## Budget and dispatch semantics
54
+
55
+ | Fact | Write budget | Concurrency permit |
56
+ | --- | --- | --- |
57
+ | Original write reserved, including waiting for approval | reserved once | none |
58
+ | A fresh dispatch permit committed | remains reserved | held |
59
+ | Result is unknown | remains reserved | held as unknown |
60
+ | Trusted evidence confirms dispatch and a terminal outcome | consumed once | released |
61
+ | Trusted evidence confirms no dispatch, terminal outcome | released | released |
62
+ | Confirmed no dispatch, explicit retry of the same original operation | original reservation retained | a new permit may be granted |
63
+ | Read-only tool | no write charge | same concurrency policy |
64
+
65
+ Only `fresh: true` from a successful grant authorizes a new dispatch attempt. A
66
+ lost grant acknowledgement or a repeated grant returns the original permit and
67
+ must never cause a second request. An unresolved grant may require original
68
+ evidence reconciliation; a timer alone cannot prove that no request was sent.
69
+
70
+ Permit IDs fence settlement. A late response from an older permit cannot settle a
71
+ newer attempt. Only the trusted execution/evidence layer can report a settlement;
72
+ an Agent-facing API must not let the model claim `confirmed_not_dispatched` to
73
+ release its own quota.
74
+
75
+ A reservation that has never obtained a permit can be closed after an exact
76
+ denied approval or an authenticated administrator's abandonment. The transaction
77
+ checks the original no-dispatch fence and absence of an execution journal before
78
+ releasing budget. After a permit, this shortcut is forbidden. If a trusted
79
+ observation confirms that the original permitted operation was not dispatched,
80
+ an explicit retry may reuse its original still-approved approval ID; an unknown
81
+ outcome cannot enable that reuse or a new dispatch.
82
+
83
+ Task control revisions are separate from the execution ledger sequence. High
84
+ call volume should not continuously invalidate an administrator's pause request.
85
+ Pause stops **new permits** after the control transaction commits. Previously
86
+ granted permits can still finish and report their results. Cancellation is final
87
+ and does not promise rollback of completed business operations. Reading original
88
+ receipts remains distinct from explicitly continuing a business operation.
89
+
90
+ ## Transaction boundary
91
+
92
+ This foundation requires the same MySQL database for task records, original Jobs,
93
+ Agent identities, and approvals. Granting a permit, consuming the matching
94
+ approval when required, and persisting the original Job attempt fence use one
95
+ connection and one transaction. Sharing a pool without sharing the connection is
96
+ insufficient.
97
+
98
+ The runtime integration must also coordinate the existing execution journal with
99
+ that transaction and the actual HTTP dispatch point. It must preserve known
100
+ journal results before allocating new permits and must not consume an approval
101
+ before discovering that the task is paused or its concurrency is exhausted.
102
+ External state stores and JSONL are not supported for task enforcement by this
103
+ foundation.
104
+
105
+ ## Remaining activation requirements
106
+
107
+ Before advertising task-control support or enabling it for a client:
108
+
109
+ 1. Connect one final admission path to direct invoke/resume and cover or reject
110
+ older run, engine rerun, approval continuation and executor tool paths.
111
+ 2. Require authoritative run/task association. A marked Session cannot escape
112
+ enforcement by omitting a field or creating another conversation.
113
+ 3. Add authenticated management APIs, protected Agent projections, capability
114
+ negotiation, and explicit unsupported behavior for incompatible stores.
115
+ 4. Integrate SDK/DSH using the original scope and invocation journal. Observation
116
+ must use read-only receipts; explicit continuation must pass task admission.
117
+ 5. Add the console controls and full synthetic HTTP/host acceptance, including
118
+ cancellation, missing acknowledgements, identity revocation and local storage
119
+ failures. A repository test is not proof of end-to-end enforcement.
120
+
121
+ `062_agent_task_control.sql` only adds task tables; it does not backfill tasks or
122
+ change existing limits. Once enforcement is activated in a later implementation,
123
+ downgrading to an implementation that ignores markers is not a safe rollback.
124
+ Keep the original task and invocation records when disabling new admission.
125
+
126
+ ## Local verification
127
+
128
+ Pure state tests run with the normal test suite. The separate MySQL test accepts
129
+ `BAILING_TASK_TEST_MYSQL_CONFIG`, a path to a disposable database connection JSON.
130
+ It refuses non-loopback hosts and databases outside the `bailing_task_test` naming
131
+ boundary. It runs the real migration twice, seeds synthetic identities and empty
132
+ conversation bodies, then exercises concurrent budget/permit decisions,
133
+ transaction rollback, pause, revocation, and original-ID recovery. Never point
134
+ these tests at a business or shared environment.
@@ -12,6 +12,8 @@ For the current integration contract, use:
12
12
 
13
13
  ## Recording Rules
14
14
 
15
+ Lead each release with a familiar shop, product-maintenance or inventory scenario: the previous problem, changed behavior, affected users and developers, upgrade steps, observable checks and limits. Keep English and Chinese facts aligned and distinguish additions, fixes and existing features. See [the release scenario notes](RELEASE_NOTES_v0.8.0.en.md).
16
+
15
17
  Each public version should describe:
16
18
 
17
19
  - new capabilities;
@@ -20,7 +22,28 @@ Each public version should describe:
20
22
  - validation commands;
21
23
  - related docs.
22
24
 
23
- ## Unreleased
25
+ ## v0.8.0 - Longer task recovery, attachments and task controls
26
+
27
+ Release date: 2026-09-16. Pair SDK/DSH 0.6.0; see [scenarios](RELEASE_NOTES_v0.8.0.en.md) and [upgrade guide](UPGRADE_v0.8.0.en.md).
28
+
29
+ - Add public image attachment delivery, read-only original receipts and administrator task budgets, concurrency, pause and cancellation.
30
+ - Clarify discovery counts and structured failures; configure inherited, custom or disabled Hub tool limits while retaining hour/day windows.
31
+ - Fix cross-turn artifact run links, original argument recovery, legal long Client IDs and concurrent metadata updates; uncertain writes are never replaced.
32
+ - Add migrations060–062. Task enrollment persists on original Agent Sessions, cancellation does not remove it, and enrolled deployments must not downgrade to versions that ignore it.
33
+ - Keep business APIs/authorization/approval; hosts supply matched persistent stores and opt into cross-turn reuse. See release limits; no full-plan automatic restart is claimed.
34
+
35
+ ## v0.7.0 - cross-system conversations, authorization names and centralized setup
36
+
37
+ Release date: 2026-09-10. These additions extend Core 0.6.1 and pair with SDK/DSH 0.5.0. See [shop and inventory scenarios](RELEASE_NOTES_v0.7.0.en.md).
38
+
39
+ - **New: cross-system conversation associations on one Hub.** Distinct original Sessions from different Client Apps/workspaces confirm independently, with whole-group identity checks. Execution, approval, invocation and memory ownership remain separate. Existing same-system scope and visible archives continue to work.
40
+ - **New: system descriptions before first capability search.** Controlled metadata explains selling versus inventory responsibilities for selected targets only. Description reads send no user text, create no business run and grant no tool permissions.
41
+ - **New: generic authorization subject display.** Backends provide a name at approval or update an original active Session. Clients and the console can display an organization, account, project or location separately from system purpose, device label and identity. Duplicate names and renames preserve authorizations and historical associations.
42
+ - **Improved: centralized setup.** Agent Clients → Setup brings authorization, descriptions, tools/approvals and connection checks together while retaining the original Client/route and administrator permissions. It does not enable writes automatically.
43
+ - **New: authorization lifecycle lookup and revocation.** Applications can page through their own Sessions, obtain a consumed authorization's Session link and revoke by original authorization. Revocation and exchange are atomic. Backends integrate account-disable events themselves; queries return no credentials.
44
+ - **SDK and upgrade impact.** PHP/PHP7 retain the existing `approve()` arguments and add optional names, `updateSubjectDisplay()`, `listSessions()` and `revokeAuthorization()`. Display and cross-system experiences require matched SDK/hosts. Missing old-version support remains explicit and never widens authority.
45
+ - **Database.** Relative to 0.6.1, only 058 member bindings and 059's two nullable JSON columns are added. Existing migrations are unchanged and old names are not guessed. Apply all outstanding migrations through the official migrator. Custom hosts must check optional repository support; unavailable features remain disabled.
46
+ - **Validation.** Regression coverage includes original bindings, per-system execution, revocation/offline recovery, ACK idempotency, cancellation, display rename/duplicate cases, old-version behavior, SDKs and console. Final artifacts and CI remain release gates; tests are not production-adoption evidence.
24
47
 
25
48
  ## v0.6.1 - Conversation Release and Package Source Verification
26
49
 
package/docs/CHANGELOG.md CHANGED
@@ -5,6 +5,8 @@
5
5
 
6
6
  ## 记录规则
7
7
 
8
+ 每次先用商城、商品维护或库存等常见场景说明原问题与本版行为,再按使用者、业务后端与客户端开发者交代升级影响。中英文使用同一事实,新增能力、修复和已有能力分别标明;参考[本版场景说明](RELEASE_NOTES_v0.8.0.md)。
9
+
8
10
  每个公开版本至少说明:
9
11
 
10
12
  - **新增能力**:新增的端点、控制台能力、工具注解、SDK 能力;
@@ -13,7 +15,28 @@
13
15
  - **验证方式**:部署方如何确认该版本运行正常;
14
16
  - **相关文档**:对应的契约、指南或示例。
15
17
 
16
- ## Unreleased
18
+ ## v0.8.0 - 长任务恢复、附件空间与任务控制
19
+
20
+ 发布日期:2026-09-16。配套 SDK/DSH 0.6.0;[场景与更新](RELEASE_NOTES_v0.8.0.md)、[升级指南](UPGRADE_v0.8.0.md)。
21
+
22
+ - 新增公开图片附件空间、只读原调用回执和管理端任务预算/并发/暂停/取消。
23
+ - 改进能力发现数量与结构化错误;中枢工具限额可继承、自定义或关闭,小时/日窗口保留。
24
+ - 修复跨轮附件run关联、原调用参数恢复、合法长接入方ID与并发metadata更新;未知写结果不新建替代调用。
25
+ - 新增060–062迁移;任务enrollment对原Agent Session持续生效,取消不解除,启用后不能降到忽略标记的旧版本。
26
+ - 业务API/授权/审批不重做;宿主需配套持久记录,跨轮工具复用显式启用。已测范围与未覆盖项见版本说明,不宣称整项计划自动续跑。
27
+
28
+ ## v0.7.0 - 多系统会话、授权名称与集中配置
29
+
30
+ 发布日期:2026-09-10。相对 Core 0.6.1 新增以下能力,完整配套为 SDK/DSH 0.5.0。见[商城与库存场景说明](RELEASE_NOTES_v0.7.0.md)。
31
+
32
+ - **新增:同中枢跨系统会话关联。** 不同 Client App/workspace 的独立原 Session 可加入一段可见会话;每个目标独立确认,整组身份重验,原执行、审批、调用和记忆归属保留。现有同系统多授权和完整归档继续使用。
33
+ - **新增:首次能力搜索前的系统说明。** 受控配置说明商城负责售卖、库存系统负责库存等定位;只提供已选目标信息,说明本身不发送用户正文、不创建业务 run、不授予工具权限。
34
+ - **新增:通用授权主体展示信息。** 业务后端在批准授权时提交名称,或给原有效 Session 补名、改名;客户端和控制台可展示实际组织、账户、项目或门店。名称与系统说明、设备名及身份独立,同名与改名不改变原授权和历史关联。
35
+ - **改进:集中接入配置。** “智能体客户端 → 接入配置”汇总授权入口、系统说明、工具/审批与连接检查,沿用原 Client/route 和管理员权限,不自动开放写操作。
36
+ - **新增:授权生命周期查询和撤销。** 接入方分页查询自己的 Session,已换码授权返回最终 Session 关联,并可按原授权撤销;撤销与换码原子互斥。业务后端负责将其接入账号停用等事件;不返回凭据。
37
+ - **SDK 与升级影响。** PHP/PHP7 的 `approve()` 保留原参数兼容,增加可选名称及 `updateSubjectDisplay()`、`listSessions()`、`revokeAuthorization()`。新展示与跨系统体验需配套 SDK/宿主;旧版本缺少支持时明确降级,不扩大授权。
38
+ - **数据库。** 相对 0.6.1 仅新增 058 成员绑定和 059 两列可空 JSON;旧迁移不改写,旧名称不猜补。按正式迁移器执行全部未应用文件。自定义 Host 需核对可选仓储接口,缺少支持时关闭对应新能力。
39
+ - **验证范围。** 权限与原成员绑定、逐系统执行归属、撤销与离线恢复、ACK 幂等、取消、名称同名/改名、旧版本兼容、SDK 与控制台均有回归覆盖。正式发布仍需最终制品与 CI 检查,不以这些验证宣称生产采用。
17
40
 
18
41
  ## v0.6.1 - 完整对话配套正式发布与来源校验
19
42
 
@@ -1,5 +1,7 @@
1
1
  # Compatibility And Upgrade Policy
2
2
 
3
+ > Core 0.8.0 task enrollment persists on original Agent Sessions. Do not downgrade an enrolled deployment to a version that ignores enforcement markers. See [upgrade boundaries](UPGRADE_v0.8.0.md).
4
+
3
5
  BailingHub follows SemVer for public releases.
4
6
 
5
7
  Before `1.0.0`, the project may still adjust public contracts, but breaking changes must be documented clearly in release notes and changelog entries.
@@ -1,5 +1,7 @@
1
1
  # HTTP Contract
2
2
 
3
+ Unreleased additive candidate: [task control](AGENT_TASK_CONTROL.en.md) defines separate task schemas, trusted turn binding and administrator controls. It requires paired capability negotiation and does not change the stable business authorization or approval semantics below.
4
+
3
5
  > Current contract: `bailing.contract.v2.14`. This is the only network boundary between a business system and BailingHub.
4
6
 
5
7
  This document summarizes the public wire contract between a business system and BailingHub.
package/docs/CONTRACT.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # 百灵中枢 · 边界契约
2
2
 
3
+ 未发布增量:[任务控制候选](AGENT_TASK_CONTROL.md)新增独立任务 schema、受信 turn 绑定和管理员控制接口,须成套协商启用;不改变下面稳定业务契约的权限或审批含义。
4
+
3
5
  > 当前契约:`bailing.contract.v2.14`。这是业务系统与中枢之间唯一的网络边界。
4
6
 
5
7
  **冻结它,两边就能各自独立开发。** 任何字段变更都按兼容方式演进(只增不改语义、不删字段)。
@@ -0,0 +1,46 @@
1
+ # Local Agent attachment space: bring generated outputs into business workflows
2
+
3
+ This image-first extension is available in Core 0.8.0 with SDK/DSH 0.6.0 and an adapted host. Storage and uploads require explicit administrator configuration.
4
+
5
+ A local Agent can generate useful content, but another application usually cannot read a path on that computer. The attachment space connects an approved conversation image to a URL: the host registers it, the Agent selects its reference and authorization, and BailingHub stores it using the operator's configured storage.
6
+
7
+ Examples include campaign artwork for a content platform, PNG charts for a reporting system, and pictures for an online shop. The receiving application must already provide the relevant URL-based business action. The image generator remains a host choice.
8
+
9
+ ## What the first increment provides
10
+
11
+ - A host-managed catalog of approved images for the original conversation.
12
+ - PNG, JPEG and WebP uploads, up to 6 MiB per image; DSH batches contain 1–8 images. Administrators can lower the size limit or restrict MIME types.
13
+ - Explicit destination authorization and per-image ready, pending or blocked results.
14
+ - Original upload receipt recovery after an uncertain response or a reopened conversation.
15
+ - Ordinary COS, OSS or explicitly configured server-local storage. Returned URLs are publicly readable. Retention is managed by the deployment, without automatic conversation-expiry deletion.
16
+
17
+ The first increment does not accept documents or video. Hosts supply permitted file bytes; BailingHub cannot read the client's filesystem. Enabling the SDK does not automatically grant file access to every MCP application.
18
+
19
+ ## Upload and use are separate steps
20
+
21
+ Generate an image → register it in the conversation catalog → upload → receive a ready URL. Attachment delivery is complete at that point.
22
+
23
+ Use a ready URL directly with an existing business tool. Repeated receipt lookup is only needed for upload recovery, not for every use of the image. A business change keeps its own authorization, approvals and outcome. For example, a shop gallery update should wait for all required images and preserve any existing images the user did not ask to remove.
24
+
25
+ ## Configure and integrate
26
+
27
+ 1. Register a storage entry with its bucket, region, credentials, public address and write prefix.
28
+ 2. In Agent Clients → Setup → Tools and approvals, choose the workspace, enable the current image-upload setting and select that storage.
29
+ 3. Install matching Core, Agent Client SDK and DSH packages. SDK hosts supply bytes and retain original upload identities. DSH hosts supply artifactSource and a durable artifactStore.
30
+ 4. Apply outstanding Core migrations, including sql/060_agent_artifacts.sql. Existing URL-based business APIs need no change for attachment delivery.
31
+
32
+ The existing APIs remain uploadArtifact/getArtifact in the SDK and list_generated_artifacts/upload_generated_artifacts in DSH. Naming the user-facing feature an attachment space does not rename these compatible technical interfaces.
33
+
34
+ The [configuration and HTTP contract](GENERATED_ARTIFACTS.md) includes exact metadata, original-target validation and error handling.
35
+
36
+ ## Stale optional run links
37
+
38
+ Core returns `artifact_run_turn_mismatch` only when the referenced run is verified to belong to the same original Agent Session, client, workspace and conversation, but its valid turn differs from the upload turn. The request is rejected before reserving an upload or storing bytes. Missing runs, mismatched identity/route/conversation, or a legacy run without a valid turn retain `artifact_run_mismatch`. Neither error exposes another turn's identifiers or content.
39
+
40
+ The matching DSH release may repair this specific rejected link only after a lookup confirms that the original upload ID does not exist, while the original identity and file remain valid. It durably records the correction, retains the original local record, upload ID, content, destination, conversation and turn, and removes only the optional run link proven to belong to another turn. Ready or pending receipts, uncertain network outcomes, generic run mismatches and damaged recovery records do not allow this correction. Older SDKs that do not recognize the precise error must remain blocked until upgraded. Upload recovery never executes a business action.
41
+
42
+ ## Known issues tracked separately
43
+
44
+ The matching release adds [configurable tool limits and original-invocation recovery](TOOL_RATE_LIMITS.md). Hour/day windows retain their original duration; newly recorded pre-dispatch rejections retain encrypted arguments. Uncertain writes are never replayed, and missing arguments from historical calls are never reconstructed. Ready attachment URLs remain reusable independently.
45
+
46
+ DSH may simplify some artifact-list source errors to unknown_failure; hosts should preserve their own storage_error and recovery_gap diagnostics. Per-image upload results remain separate.