bailinghub 0.7.0 → 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.
- package/README.en.md +6 -9
- package/README.md +6 -9
- package/docker-compose.images.yml +2 -2
- package/docs/AGENT_CLIENT_RUNTIME_API.en.md +46 -0
- package/docs/AGENT_CLIENT_RUNTIME_API.md +34 -0
- package/docs/AGENT_TASK_CONTROL.en.md +25 -0
- package/docs/AGENT_TASK_CONTROL.md +94 -0
- package/docs/AGENT_TASK_CONTROL_FOUNDATION.md +134 -0
- package/docs/CHANGELOG.en.md +11 -1
- package/docs/CHANGELOG.md +11 -1
- package/docs/COMPATIBILITY.en.md +2 -0
- package/docs/CONTRACT.en.md +2 -0
- package/docs/CONTRACT.md +2 -0
- package/docs/GENERATED_ARTIFACTS.en.md +46 -0
- package/docs/GENERATED_ARTIFACTS.md +108 -0
- package/docs/INDEPENDENT_VALIDATION.en.md +4 -4
- package/docs/INDEPENDENT_VALIDATION.md +4 -4
- package/docs/INVOCATION_RECEIPTS.md +111 -0
- package/docs/README.en.md +3 -0
- package/docs/README.md +3 -0
- package/docs/RELEASE_NOTES_NEXT.en.md +2 -2
- package/docs/RELEASE_NOTES_NEXT.md +2 -2
- package/docs/RELEASE_NOTES_v0.8.0.en.md +40 -0
- package/docs/RELEASE_NOTES_v0.8.0.md +62 -0
- package/docs/TOOL_RATE_LIMITS.md +50 -0
- package/docs/UPGRADE_v0.8.0.en.md +71 -0
- package/docs/UPGRADE_v0.8.0.md +73 -0
- package/docs//345/205/274/345/256/271/346/200/247/344/270/216/345/215/207/347/272/247.md +2 -0
- package/package.json +1 -1
- package/schemas/config/route.schema.json +1 -0
- package/schemas/config/tool-provider.schema.json +2 -1
- package/scripts/check-doc-links.mjs +1 -0
- package/scripts/check-image-tags.sh +1 -1
- package/scripts/check-release-consistency.test.mjs +2 -2
- package/scripts/e2e-console.mjs +32 -2
- package/scripts/install.sh +1 -1
- package/scripts/publish-images.sh +1 -1
- package/scripts/release-audit.mjs +1 -0
- package/scripts/verify-github-repo.mjs +1 -0
- package/sql/060_agent_artifacts.sql +11 -0
- package/sql/061_tool_rate_limit_policies.sql +3 -0
- package/sql/062_agent_task_control.sql +92 -0
- package/src/adapters/storage/object-storage.ts +15 -3
- package/src/adapters/storage/oss-signature.test.ts +40 -0
- package/src/adapters/storage/oss-signature.ts +21 -0
- package/src/app/agent-artifacts.test.ts +165 -0
- package/src/app/agent-artifacts.ts +85 -0
- package/src/app/agent-client-runtime.test.ts +76 -1
- package/src/app/agent-client-runtime.ts +13 -0
- package/src/app/agent-invocation-snapshot.ts +35 -0
- package/src/app/agent-task-control.ts +187 -0
- package/src/app/agent-task-runtime.ts +68 -0
- package/src/app/agent-tool-invocations.test.ts +329 -1
- package/src/app/agent-tool-invocations.ts +223 -10
- package/src/app/agent-tool-job.test.ts +11 -1
- package/src/app/agent-tool-job.ts +8 -1
- package/src/app/builtin-tools.ts +4 -0
- package/src/app/oss-edition.ts +1 -0
- package/src/app/tool-approvals.ts +4 -0
- package/src/app/tool-assembly.ts +5 -0
- package/src/core/config/artifact-config.ts +15 -0
- package/src/core/config/config-codec.ts +3 -1
- package/src/core/config/config-models.ts +11 -1
- package/src/core/config/route-config.ts +3 -2
- package/src/core/contracts/tool-rate-limits.test.ts +59 -0
- package/src/core/contracts/tool-rate-limits.ts +48 -0
- package/src/core/contracts/tools.ts +122 -43
- package/src/core/contracts/types.ts +3 -1
- package/src/core/runtime/agent-task-control.test.ts +114 -0
- package/src/core/runtime/agent-task-control.ts +227 -0
- package/src/infrastructure/config/config-agent-artifact-repository.ts +32 -0
- package/src/infrastructure/config/config-agent-client-runtime-repository.ts +7 -1
- package/src/infrastructure/config/config-agent-task-control-journal-mysql.test.ts +315 -0
- package/src/infrastructure/config/config-agent-task-control-mysql.test.ts +331 -0
- package/src/infrastructure/config/config-agent-task-control-repository.ts +640 -0
- package/src/infrastructure/config/config-rate-limit-ledger.integration.test.ts +52 -0
- package/src/infrastructure/config/config-rate-limit-ledger.ts +48 -0
- package/src/infrastructure/config/config-storage-bucket-repository.ts +2 -2
- package/src/infrastructure/config/config-tool-provider-repository.ts +4 -4
- package/src/infrastructure/config/configstore.ts +9 -1
- package/src/routes/admin-agent-tasks.ts +32 -0
- package/src/routes/admin-tool-providers.test.ts +22 -0
- package/src/routes/admin-tool-providers.ts +9 -1
- package/src/routes/admin.ts +3 -0
- package/src/routes/agent-api.test.ts +76 -0
- package/src/routes/agent-api.ts +42 -1
- package/src/routes/agent-artifacts.ts +29 -0
- package/src/routes/agent-task-control-http-mysql.test.ts +246 -0
- package/src/routes/private.ts +1 -0
- package/src/routes/run.ts +2 -1
- package/src/test-support/agent-task-control-mysql-fixture.ts +75 -0
- package/web/console/assets/{Accounts-ChL9k-XA.js → Accounts-BRCR3O0P.js} +1 -1
- package/web/console/assets/AgentClients-Bf7sUUs_.js +1 -0
- package/web/console/assets/AgentClients-i52AI6YV.css +1 -0
- package/web/console/assets/AgentTasks--bqL_QKg.js +2 -0
- package/web/console/assets/AgentTasks-C8ox3TyS.css +1 -0
- package/web/console/assets/{Approvals-Bs6FGbp2.js → Approvals-BIbZvInm.js} +1 -1
- package/web/console/assets/{Audit-4WWYhkFM.js → Audit-KyPSmBdZ.js} +1 -1
- package/web/console/assets/{BrandLockup-D2GhCipL.js → BrandLockup-Sv5DU2G6.js} +1 -1
- package/web/console/assets/{Channels-CmoGpiCJ.js → Channels-B9n4fbxg.js} +1 -1
- package/web/console/assets/{ChatEntries-BFRMtwta.js → ChatEntries-xsOCUXi_.js} +1 -1
- package/web/console/assets/{Clients-DGkkSXyA.js → Clients-CI3DBDHf.js} +1 -1
- package/web/console/assets/{Cost-BmGt0MfS.js → Cost-JgNXQPlN.js} +1 -1
- package/web/console/assets/{Credentials-CR-sYINT.js → Credentials-B5UUUdt0.js} +1 -1
- package/web/console/assets/{Diagnostics-DAPbKSJp.js → Diagnostics-BMGciWQb.js} +1 -1
- package/web/console/assets/{Executors-CgpiT3o8.js → Executors-CRbboOCZ.js} +1 -1
- package/web/console/assets/{Kb-Cm9dVSQw.js → Kb-CgLNGjRp.js} +1 -1
- package/web/console/assets/{Login-CyUcsTZ_.js → Login-C52JmXzx.js} +1 -1
- package/web/console/assets/{Projects-DldFPgWg.js → Projects-CDOvHPVS.js} +1 -1
- package/web/console/assets/{Routes-DubfjlBD.js → Routes-X9vHLpKW.js} +1 -1
- package/web/console/assets/{Runs-1hxgkuR4.js → Runs-DYNDXsqk.js} +1 -1
- package/web/console/assets/{Setup-DBLOnI2_.js → Setup-B91P6i1x.js} +1 -1
- package/web/console/assets/Shell-Bj6C8Hgo.css +1 -0
- package/web/console/assets/Shell-BsRa7bQQ.js +1 -0
- package/web/console/assets/StorageBuckets-CVgpZRWY.css +1 -0
- package/web/console/assets/StorageBuckets-DkuDM0oX.js +1 -0
- package/web/console/assets/{SystemSettings-cDkudo2y.js → SystemSettings-B7Mqj3k1.js} +1 -1
- package/web/console/assets/{SystemStatus-DZd6s8OX.js → SystemStatus-Db93b6dc.js} +1 -1
- package/web/console/assets/{Targets-DYNGq1NU.js → Targets-CuuIYeZO.js} +1 -1
- package/web/console/assets/Tools-CHiqz9XZ.js +2 -0
- package/web/console/assets/Tools-DU8ei6sd.css +1 -0
- package/web/console/assets/index-UGvfF3Xr.js +2 -0
- package/web/console/assets/{request-B7MLvOqo.js → request-DeGya810.js} +1 -1
- package/web/console/assets/{schema-CMuwjYdJ.js → schema-BqlqLw1R.js} +1 -1
- package/web/console/index.html +1 -1
- package/web-admin/scripts/agent-task-control-smoke.mjs +120 -0
- package/web-admin/src/components/AgentSetupPanel.vue +13 -0
- package/web-admin/src/components/ToolRateLimitEditor.vue +28 -0
- package/web-admin/src/layout/Shell.vue +1 -1
- package/web-admin/src/pages/AgentClients.vue +3 -1
- package/web-admin/src/pages/AgentTasks.vue +281 -0
- package/web-admin/src/pages/StorageBuckets.vue +6 -6
- package/web-admin/src/pages/Tools.vue +53 -4
- package/web-admin/src/router.ts +2 -0
- package/web/console/assets/AgentClients-Bs7UgVDj.js +0 -1
- package/web/console/assets/AgentClients-DkgPTEbq.css +0 -1
- package/web/console/assets/Shell-D9Uw-fsa.css +0 -1
- package/web/console/assets/Shell-gJ5Vz_E7.js +0 -1
- package/web/console/assets/StorageBuckets-DkDW16tj.js +0 -1
- package/web/console/assets/StorageBuckets-GnXnVvF0.css +0 -1
- package/web/console/assets/Tools-A20oaMaQ.css +0 -1
- package/web/console/assets/Tools-DpWM59vV.js +0 -2
- package/web/console/assets/index-DGqs28gI.js +0 -2
package/README.en.md
CHANGED
|
@@ -29,18 +29,13 @@ You choose which business APIs become available. BailingHub connects the convers
|
|
|
29
29
|
<img src="assets/readme-product-overview.en.svg" width="100%" alt="BailingHub connects conversational entry points to governed business capabilities while the business system remains the authority">
|
|
30
30
|
</picture>
|
|
31
31
|
|
|
32
|
-
## v0.
|
|
32
|
+
## v0.8.0: continue and control longer business tasks
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
Move between shop edits, inventory queries and image uploads. Inspect original operations after interruptions; administrators can bound cumulative task calls and pause further dispatch. Existing multi-system authorization and display names remain.
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
The business APIs and product mapping must already exist. Original approvals apply; a stock read is not a reservation, and a completed price change is not an approved listing.
|
|
39
|
-
|
|
40
|
-
Full pairing: **Core 0.7.0 + MCP / Agent Client SDK 0.5.0 + DSH 0.5.0**, or a custom host implementing the same interfaces. Existing same-system conversations remain supported; cross-system scope stays within one Hub and audit domain.
|
|
41
|
-
|
|
42
|
-
[Changes and upgrade steps](docs/RELEASE_NOTES_v0.7.0.en.md) · [Get started](docs/user-guide/conversations.en.md) · [Centralized setup](docs/LOCAL_AGENT_SETUP.en.md)
|
|
36
|
+
Pair **Core 0.8.0 + MCP / Agent Client SDK 0.6.0 + DSH 0.6.0**. Images are public in the first phase; cross-turn reuse requires host opt-in, and task enrollment persists on original authorizations. Original permissions and approvals remain.
|
|
43
37
|
|
|
38
|
+
[Release scenarios](docs/RELEASE_NOTES_v0.8.0.en.md) · [Upgrade and enablement](docs/UPGRADE_v0.8.0.en.md) · [Setup](docs/LOCAL_AGENT_SETUP.en.md)
|
|
44
39
|
## Operate the System by Conversation
|
|
45
40
|
|
|
46
41
|
Most business software already has the data, permission model, and APIs it needs. What it lacks is a safe bridge between a natural-language request and the exact operation the current user is allowed to perform.
|
|
@@ -208,7 +203,9 @@ Run separate BailingHub deployments for mutually isolated organizations. A `clie
|
|
|
208
203
|
- [Quickstart](docs/QUICKSTART.en.md) — deploy and run the first route.
|
|
209
204
|
- [Docker Demo](docs/DEMO.en.md) — complete the sample business-operation loop.
|
|
210
205
|
- [Integration Guide](docs/INTEGRATION.en.md) — connect an existing application.
|
|
206
|
+
- [Read-only invocation receipts](docs/INVOCATION_RECEIPTS.md) — inspection without continuing a business operation.
|
|
211
207
|
- [Agent Client v1](docs/AGENT_CLIENT_QUICKSTART.en.md) — browser authorization and local planning.
|
|
208
|
+
- [Local Agent attachment space](docs/GENERATED_ARTIFACTS.en.md) — the image-first extension for storing local outputs and obtaining business-usable URLs.
|
|
212
209
|
- [Local Agent Setup](docs/LOCAL_AGENT_SETUP.en.md) — configure authorization, descriptions, tools, and connection checks in one place.
|
|
213
210
|
- [System Information](docs/AGENT_SYSTEM_INFO.en.md) — explain selected systems before searching for tools.
|
|
214
211
|
- [Business Tools and Governance](docs/TOOLS.en.md) — declare, sign, approve, and audit tools.
|
package/README.md
CHANGED
|
@@ -27,18 +27,13 @@
|
|
|
27
27
|
|
|
28
28
|
在线体验环境只用于了解产品和配置方式。请勿上传生产凭据、敏感数据或接入真实业务;正式使用请自行部署开源版。
|
|
29
29
|
|
|
30
|
-
## v0.
|
|
30
|
+
## v0.8.0:让业务长任务可继续、可控制
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
助手查询商品、核对库存、上传图片后继续维护商品;中断后沿原调用核对,管理员按任务设置累计额度、暂停或取消后续派发。已有多系统授权与名称继续保留。
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
示例动作需由业务系统开放,商品映射需已确认,原审批继续生效;查库存不等于锁库存,改价完成也不代表上架审批已通过。
|
|
37
|
-
|
|
38
|
-
完整配套为 **Core 0.7.0 + MCP / Agent Client SDK 0.5.0 + DSH 0.5.0**,或实现相同接口的自研客户端。保留原同系统多账户会话,跨系统范围限同一 Hub 与审计域。
|
|
39
|
-
|
|
40
|
-
[看变化与升级步骤](docs/RELEASE_NOTES_v0.7.0.md) · [开始使用](docs/user-guide/conversations.md) · [集中配置](docs/LOCAL_AGENT_SETUP.md)
|
|
34
|
+
配套为 **Core 0.8.0 + MCP / Agent Client SDK 0.6.0 + DSH 0.6.0**。图片首期公开读取;跨轮声明复用需宿主启用,任务启用会持续约束原授权,原权限和审批保持。
|
|
41
35
|
|
|
36
|
+
[更新场景](docs/RELEASE_NOTES_v0.8.0.md) · [升级与启用边界](docs/UPGRADE_v0.8.0.md) · [集中配置](docs/LOCAL_AGENT_SETUP.md)
|
|
42
37
|
## 适合哪些团队
|
|
43
38
|
|
|
44
39
|
- 已有商城、SaaS、CRM、ERP 或内部后台,希望增加能查数据、办业务的 AI 助手。
|
|
@@ -196,6 +191,8 @@ BailingHub Core 是独立服务,只通过稳定网络契约与业务系统协
|
|
|
196
191
|
| 部署完整开源版 | [快速开始](docs/QUICKSTART.md) |
|
|
197
192
|
| 跑通公开 Demo | [Docker Demo](docs/DEMO.md) |
|
|
198
193
|
| 接入现有业务 | [第三方对接指南](docs/第三方对接指南.md) |
|
|
194
|
+
| 为本地智能体接入附件空间(首期图片) | [场景、配置与上传契约](docs/GENERATED_ARTIFACTS.md) |
|
|
195
|
+
| 只核对原操作有没有完成 | [只读回执与恢复的区别](docs/INVOCATION_RECEIPTS.md) |
|
|
199
196
|
| 接入本地智能体 | [Agent Client v1 指南](docs/AGENT_CLIENT_QUICKSTART.md) |
|
|
200
197
|
| 集中开启本地智能体与工具 | [四步配置指南](docs/LOCAL_AGENT_SETUP.md) · [系统说明](docs/AGENT_SYSTEM_INFO.md) |
|
|
201
198
|
| 查 API 与边界契约 | [HTTP 契约](docs/CONTRACT.md) · [Client API](docs/CLIENT_API.md) |
|
|
@@ -18,7 +18,7 @@ services:
|
|
|
18
18
|
retries: 30
|
|
19
19
|
|
|
20
20
|
demo-business:
|
|
21
|
-
image: ${BAILING_DEMO_BUSINESS_IMAGE:-crpi-xm97pbcjrmf5in3s.cn-shanghai.personal.cr.aliyuncs.com/bailinghub/bailing-demo-business:0.
|
|
21
|
+
image: ${BAILING_DEMO_BUSINESS_IMAGE:-crpi-xm97pbcjrmf5in3s.cn-shanghai.personal.cr.aliyuncs.com/bailinghub/bailing-demo-business:0.8.0}
|
|
22
22
|
environment:
|
|
23
23
|
DEMO_HOST: 0.0.0.0
|
|
24
24
|
DEMO_PORT: 19080
|
|
@@ -29,7 +29,7 @@ services:
|
|
|
29
29
|
- "${BAILING_DEMO_PUBLIC_PORT:-19080}:19080"
|
|
30
30
|
|
|
31
31
|
bailinghub:
|
|
32
|
-
image: ${BAILINGHUB_IMAGE:-crpi-xm97pbcjrmf5in3s.cn-shanghai.personal.cr.aliyuncs.com/bailinghub/bailinghub:0.
|
|
32
|
+
image: ${BAILINGHUB_IMAGE:-crpi-xm97pbcjrmf5in3s.cn-shanghai.personal.cr.aliyuncs.com/bailinghub/bailinghub:0.8.0}
|
|
33
33
|
depends_on:
|
|
34
34
|
mysql:
|
|
35
35
|
condition: service_healthy
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Agent Client Runtime v1
|
|
2
2
|
|
|
3
|
+
Unreleased paired addition: [task control](AGENT_TASK_CONTROL.en.md) adds trusted `task_binding` to turns and echoes it. Enrolled Sessions cannot omit it; runtime searches must use the original `run_id`. Read-only inspection and explicit original-operation continuation remain separate.
|
|
4
|
+
|
|
3
5
|
English | [简体中文](AGENT_CLIENT_RUNTIME_API.md)
|
|
4
6
|
|
|
5
7
|
This versioned API lets a browser-authorized local Agent plan locally while reusing BailingHub
|
|
@@ -121,6 +123,41 @@ Capability search returns no more than 12 complete typed tools under
|
|
|
121
123
|
any source is unavailable, the whole search deterministically falls back to lexical ordering. A
|
|
122
124
|
search needs a non-empty query or a valid `run_id` from the same Agent Session and route.
|
|
123
125
|
|
|
126
|
+
Search responses may include the following optional `discovery` metadata. This example returns
|
|
127
|
+
the first 12 ranked candidates from a currently authorized catalog of 14:
|
|
128
|
+
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"discovery": {
|
|
132
|
+
"mode": "ranked_candidates",
|
|
133
|
+
"scope": "current_authorization",
|
|
134
|
+
"returned_count": 12,
|
|
135
|
+
"authorized_total": 14,
|
|
136
|
+
"matched_total": null,
|
|
137
|
+
"matched_total_exact": false,
|
|
138
|
+
"limit": 12,
|
|
139
|
+
"truncated": true,
|
|
140
|
+
"has_more": true,
|
|
141
|
+
"truncation_scope": "authorized_catalog",
|
|
142
|
+
"pagination": "unsupported"
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
`authorized_total` uses the same authorized surface, route and capability revision as the returned
|
|
148
|
+
tools, after session, route, subject and direct-tool policy checks. It is neither the system's
|
|
149
|
+
global capability count nor the host session's shared loaded-tool count. `returned_count` equals
|
|
150
|
+
`tools.length`; `limit` is the effective result limit. `truncated` and `has_more` only indicate
|
|
151
|
+
authorized candidates omitted by that limit, not additional confirmed matches or a next page.
|
|
152
|
+
|
|
153
|
+
Search ranks candidates without filtering zero-score entries. An inventory query can therefore
|
|
154
|
+
still return an authorized order tool. Match totals remain unknown (`matched_total: null`,
|
|
155
|
+
`matched_total_exact: false`), never zero or the returned count. An empty authorized catalog has
|
|
156
|
+
zero authorized and returned candidates; it says nothing about capabilities in other scopes.
|
|
157
|
+
This additive v1 field may be ignored by older clients. New clients must treat missing metadata
|
|
158
|
+
from an older server as unknown. Core does not change authorization or approval rules; the host
|
|
159
|
+
owns dynamic tool replacement/append behavior and the current loaded-tool set.
|
|
160
|
+
|
|
124
161
|
## Tool invocation and recovery
|
|
125
162
|
|
|
126
163
|
Invoke only a tool projected by the current bootstrap/search result. Core revalidates the Agent
|
|
@@ -128,6 +165,15 @@ Session, route, operation ID, ACC declaration, approval state, limits, and busin
|
|
|
128
165
|
on every invocation. When the result is pending, in progress, or uncertain, resume the original
|
|
129
166
|
`invocation_id`; do not create a replacement write call.
|
|
130
167
|
|
|
168
|
+
If a request was attempted but transport or response-body reading fails, Core reports
|
|
169
|
+
`reconciliation_required` with `auto_retry_allowed: false`, including for readonly and
|
|
170
|
+
declared-idempotent tools. It must not report `rejected_before_dispatch`: neither execution nor
|
|
171
|
+
non-execution has been confirmed. Keep the original invocation and authorization binding. Resume
|
|
172
|
+
revalidates authorization and replays the saved result without redispatch; a still-uncertain result
|
|
173
|
+
requires reconciliation. Do not create another inventory adjustment or order update, switch
|
|
174
|
+
authorization, or use another tool to repeat it. Capability rediscovery does not retry a business
|
|
175
|
+
operation. Existing approvals and execution journals remain in force.
|
|
176
|
+
|
|
131
177
|
The Hub records visible governance milestones, operation IDs, parameter key names, approval state,
|
|
132
178
|
and business status. It does not receive model hidden reasoning, complete sensitive arguments, or
|
|
133
179
|
raw business response bodies.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Agent Client Runtime v1
|
|
2
2
|
|
|
3
|
+
未发布配套增量:[任务控制](AGENT_TASK_CONTROL.md)为 turn 增加宿主 `task_binding` 和原样回显;已加入任务的 Session 不能省略,业务搜索须使用原 `run_id`。原调用只读核对与显式继续分别处理。
|
|
4
|
+
|
|
3
5
|
本版本化接口让已完成 Agent Auth 网页授权的本地智能体在本地承担规划,同时继续复用 BailingHub 的身份重验、工具治理、审批、审计与对话总账。它不替代现有 `/run`、聊天入口或执行器协议。配套的部署、业务授权页和宿主接入步骤见 [Agent Client v1 接入指南](AGENT_CLIENT_QUICKSTART.md),身份授权契约见 [Agent Auth v1](AGENT_AUTH_API.md)。
|
|
4
6
|
|
|
5
7
|
所有接口只接受 `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` 关闭 Runtime 工作区、上下文与能力接口,不关闭旧 `/agent-api/v1/tools`。
|
|
@@ -93,6 +95,38 @@ Bootstrap 只逐字段抽取 `target_config.system_prompt`,再拼接可选 `ag
|
|
|
93
95
|
能力搜索最多返回 12 个完整 typed tools,schema 为 `bailing.agent-capability-search.v1`。检索只在当前授权集内进行;任一工具源的 embedding 不可用时,整次搜索确定性退回 lexical 排序。
|
|
94
96
|
能力搜索必须提供非空 `query`,或者提供属于当前 Agent Session 与 route 的合法 `run_id`,由服务端回退使用该 run 的 `user_input`。
|
|
95
97
|
|
|
98
|
+
搜索响应新增可选 `discovery` 元数据,以下示例表示当前授权目录的 14 项候选中,本次返回排序靠前的 12 项:
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"discovery": {
|
|
103
|
+
"mode": "ranked_candidates",
|
|
104
|
+
"scope": "current_authorization",
|
|
105
|
+
"returned_count": 12,
|
|
106
|
+
"authorized_total": 14,
|
|
107
|
+
"matched_total": null,
|
|
108
|
+
"matched_total_exact": false,
|
|
109
|
+
"limit": 12,
|
|
110
|
+
"truncated": true,
|
|
111
|
+
"has_more": true,
|
|
112
|
+
"truncation_scope": "authorized_catalog",
|
|
113
|
+
"pagination": "unsupported"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
`authorized_total` 来自本次响应相同 `route`、`capability_revision` 对应的授权目录,已经过会话、路由、主体和直调策略裁剪。它不是系统全量能力数,也不是客户端会话共享的已加载工具数。`returned_count` 是本次 `tools.length`;`limit` 是实际返回上限。`truncated` / `has_more` 只表示授权候选因上限未全部返回,不表示还有确定匹配结果,也不提供下一页。
|
|
119
|
+
|
|
120
|
+
搜索按相关性排序,不过滤零分候选。例如查询库存时,已授权的订单工具仍可能作为后续候选返回;不能据返回数量断言系统具备或缺少某项能力。`matched_total` 为 `null`,精确性为 `false`,不可用 `0` 或返回数量代替。授权目录为空时,`returned_count` 和 `authorized_total` 均为 `0`,仍不代表其他授权范围没有能力。
|
|
121
|
+
|
|
122
|
+
这是现有 v1 响应的可选扩展;旧客户端可以忽略,新客户端遇到缺少 `discovery` 的旧服务端应把这些统计视为未知。搜索不修改 Core 权限或审批规则,宿主负责说明动态工具的替换/追加方式和当前有效的已加载工具。
|
|
123
|
+
|
|
124
|
+
## 工具调用与恢复
|
|
125
|
+
|
|
126
|
+
工具已经尝试发送、但网络中断或响应正文丢失时,Core 返回 `reconciliation_required` 和 `auto_retry_allowed: false`;只读和声明幂等的工具也不能被标为 `rejected_before_dispatch`。该状态表示尚无可信结果,不证明业务已经执行或尚未执行。
|
|
127
|
+
|
|
128
|
+
客户端必须保留原 `invocation_id` 及授权关联,使用现有 resume 恢复原调用。Core 重新验证当前授权并回放已保存的结果,不重新派发;结果仍不确定时需要人工核实,不能新建库存调整、订单更新等操作,也不能切换授权或改用另一工具重复执行。重新发现工具与恢复业务调用是两个动作。原审批和执行日志机制保持不变。
|
|
129
|
+
|
|
96
130
|
## Complete
|
|
97
131
|
|
|
98
132
|
```json
|
|
@@ -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.
|
package/docs/CHANGELOG.en.md
CHANGED
|
@@ -12,7 +12,7 @@ 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.
|
|
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
16
|
|
|
17
17
|
Each public version should describe:
|
|
18
18
|
|
|
@@ -22,6 +22,16 @@ Each public version should describe:
|
|
|
22
22
|
- validation commands;
|
|
23
23
|
- related docs.
|
|
24
24
|
|
|
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
|
+
|
|
25
35
|
## v0.7.0 - cross-system conversations, authorization names and centralized setup
|
|
26
36
|
|
|
27
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).
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
## 记录规则
|
|
7
7
|
|
|
8
|
-
每次先用商城、商品维护或库存等常见场景说明原问题与本版行为,再按使用者、业务后端与客户端开发者交代升级影响。中英文使用同一事实,新增能力、修复和已有能力分别标明;参考[本版场景说明](RELEASE_NOTES_v0.
|
|
8
|
+
每次先用商城、商品维护或库存等常见场景说明原问题与本版行为,再按使用者、业务后端与客户端开发者交代升级影响。中英文使用同一事实,新增能力、修复和已有能力分别标明;参考[本版场景说明](RELEASE_NOTES_v0.8.0.md)。
|
|
9
9
|
|
|
10
10
|
每个公开版本至少说明:
|
|
11
11
|
|
|
@@ -15,6 +15,16 @@
|
|
|
15
15
|
- **验证方式**:部署方如何确认该版本运行正常;
|
|
16
16
|
- **相关文档**:对应的契约、指南或示例。
|
|
17
17
|
|
|
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
|
+
|
|
18
28
|
## v0.7.0 - 多系统会话、授权名称与集中配置
|
|
19
29
|
|
|
20
30
|
发布日期:2026-09-10。相对 Core 0.6.1 新增以下能力,完整配套为 SDK/DSH 0.5.0。见[商城与库存场景说明](RELEASE_NOTES_v0.7.0.md)。
|
package/docs/COMPATIBILITY.en.md
CHANGED
|
@@ -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.
|
package/docs/CONTRACT.en.md
CHANGED
|
@@ -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
|
@@ -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.
|