bailinghub 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +11 -7
- package/README.md +10 -7
- package/docker-compose.images.yml +2 -2
- package/docs/AGENT_AUTH_API.en.md +112 -1
- package/docs/AGENT_AUTH_API.md +99 -1
- package/docs/AGENT_CLIENT_QUICKSTART.en.md +32 -5
- package/docs/AGENT_CLIENT_QUICKSTART.md +27 -4
- package/docs/AGENT_CLIENT_RUNTIME_API.md +4 -1
- package/docs/AGENT_CONVERSATION_AUDIT.en.md +109 -4
- package/docs/AGENT_CONVERSATION_AUDIT.md +84 -3
- package/docs/AGENT_SUBJECT_DISPLAY.en.md +95 -0
- package/docs/AGENT_SUBJECT_DISPLAY.md +95 -0
- package/docs/AGENT_SYSTEM_INFO.en.md +99 -0
- package/docs/AGENT_SYSTEM_INFO.md +97 -0
- package/docs/CHANGELOG.en.md +25 -2
- package/docs/CHANGELOG.md +24 -1
- package/docs/INDEPENDENT_VALIDATION.en.md +4 -4
- package/docs/INDEPENDENT_VALIDATION.md +4 -4
- package/docs/LOCAL_AGENT_SETUP.en.md +116 -0
- package/docs/LOCAL_AGENT_SETUP.md +116 -0
- package/docs/README.en.md +8 -0
- package/docs/README.md +8 -0
- package/docs/RELEASE_NOTES_NEXT.en.md +3 -0
- package/docs/RELEASE_NOTES_NEXT.md +3 -0
- package/docs/RELEASE_NOTES_v0.6.0.en.md +4 -2
- package/docs/RELEASE_NOTES_v0.6.0.md +2 -0
- package/docs/RELEASE_NOTES_v0.6.1.en.md +53 -0
- package/docs/RELEASE_NOTES_v0.6.1.md +53 -0
- package/docs/RELEASE_NOTES_v0.7.0.en.md +116 -0
- package/docs/RELEASE_NOTES_v0.7.0.md +116 -0
- package/docs/SDK.en.md +31 -0
- package/docs/user-guide/conversations.en.md +4 -2
- package/docs/user-guide/conversations.md +4 -2
- package/package.json +1 -1
- package/schemas/config/route.schema.json +15 -2
- package/scripts/check-doc-links.mjs +2 -0
- package/scripts/check-image-tags.sh +1 -1
- package/scripts/check-release-consistency.test.mjs +2 -2
- package/scripts/install.sh +1 -1
- package/scripts/publish-images.sh +1 -1
- package/scripts/release-audit.mjs +2 -0
- package/scripts/sdk-agent-auth-lifecycle-check.mjs +178 -0
- package/scripts/sdk-runtime-test.mjs +5 -2
- package/scripts/verify-github-repo.mjs +2 -0
- package/sdk/php/README.md +29 -0
- package/sdk/php/src/AgentAuth.php +100 -4
- package/sdk/php/src/HubClient.php +2 -1
- package/sdk/php7/README.md +31 -0
- package/sdk/php7/src/AgentAuth.php +99 -4
- package/sdk/php7/src/HubClient.php +2 -1
- package/sql/058_agent_conversation_member_bindings.sql +9 -0
- package/sql/059_agent_subject_display.sql +5 -0
- package/sql/README.en.md +15 -0
- package/sql/README.md +25 -0
- package/src/app/agent-conversation-audit.ts +20 -0
- package/src/app/agent-system-info.ts +41 -0
- package/src/app/agent-tool-invocations.ts +16 -4
- package/src/core/config/agent-setup.ts +37 -0
- package/src/core/config/client-agent-setup.ts +25 -0
- package/src/core/config/config-schema.test.ts +11 -0
- package/src/core/config/route-config.test.ts +28 -0
- package/src/core/config/route-config.ts +43 -4
- package/src/core/contracts/agent-subject-display.test.ts +19 -0
- package/src/core/contracts/agent-subject-display.ts +36 -0
- package/src/core/contracts/types.ts +15 -0
- package/src/core/runtime/agent-conversation-audit.test.ts +19 -1
- package/src/core/runtime/agent-conversation-audit.ts +39 -0
- package/src/infrastructure/config/config-agent-auth-business-sessions.test.ts +120 -0
- package/src/infrastructure/config/config-agent-auth-lifecycle-race.test.ts +152 -0
- package/src/infrastructure/config/config-agent-auth-repository.test.ts +2 -0
- package/src/infrastructure/config/config-agent-auth-repository.ts +208 -18
- package/src/infrastructure/config/config-agent-conversation-audit-cross-binding.test.ts +120 -0
- package/src/infrastructure/config/config-agent-conversation-audit-repository.ts +117 -23
- package/src/infrastructure/config/config-agent-subject-display.test.ts +103 -0
- package/src/infrastructure/config/config-client-repository.ts +21 -0
- package/src/infrastructure/config/config-route-agent-setup.test.ts +59 -0
- package/src/infrastructure/config/config-route-repository.ts +24 -0
- package/src/infrastructure/config/configstore.ts +7 -3
- package/src/infrastructure/schema/core-schema-migrator.test.ts +90 -0
- package/src/routes/admin-access.ts +37 -0
- package/src/routes/admin-agent-clients.ts +11 -0
- package/src/routes/admin-agent-setup.test.ts +130 -0
- package/src/routes/admin-agent-setup.ts +68 -0
- package/src/routes/admin-client-agent-setup.test.ts +93 -0
- package/src/routes/admin-dispatch-config.ts +2 -0
- package/src/routes/agent-api.ts +7 -0
- package/src/routes/agent-auth-lifecycle-http.test.ts +177 -0
- package/src/routes/agent-auth-lifecycle.test.ts +193 -0
- package/src/routes/agent-auth.test.ts +1 -1
- package/src/routes/agent-auth.ts +206 -16
- package/src/routes/agent-conversation-audit-cross-binding-http.test.ts +122 -0
- package/src/routes/agent-conversation-audit.ts +8 -2
- package/src/routes/agent-subject-display-http.test.ts +145 -0
- package/src/routes/agent-system-info.test.ts +132 -0
- package/src/test-support/agent-auth-business-query-fixture.ts +43 -0
- package/src/test-support/agent-auth-lifecycle-fixture.ts +288 -0
- package/src/test-support/agent-conversation-audit-fixture.ts +30 -6
- package/src/test-support/agent-conversation-audit-http-fixture.ts +84 -0
- package/web/connect/bailing-connect-php.tgz +0 -0
- package/web/connect/bailing-connect-php7.tgz +0 -0
- package/web/console/assets/{Accounts-Ca_VnSu9.js → Accounts-ChL9k-XA.js} +1 -1
- package/web/console/assets/AgentClients-Bs7UgVDj.js +1 -0
- package/web/console/assets/AgentClients-DkgPTEbq.css +1 -0
- package/web/console/assets/{Approvals-CMvPWacY.js → Approvals-Bs6FGbp2.js} +1 -1
- package/web/console/assets/{Audit-CIRqOCnL.js → Audit-4WWYhkFM.js} +1 -1
- package/web/console/assets/{BrandLockup-BrytmTTH.js → BrandLockup-D2GhCipL.js} +1 -1
- package/web/console/assets/{Channels-CApxH2TB.js → Channels-CmoGpiCJ.js} +1 -1
- package/web/console/assets/{ChatEntries-CJon3bWJ.js → ChatEntries-BFRMtwta.js} +1 -1
- package/web/console/assets/Clients-CSHIsaWU.css +1 -0
- package/web/console/assets/Clients-DGkkSXyA.js +3 -0
- package/web/console/assets/{Cost-BbhlQFP8.js → Cost-BmGt0MfS.js} +1 -1
- package/web/console/assets/{Credentials-kqr1W0K7.js → Credentials-CR-sYINT.js} +1 -1
- package/web/console/assets/{Diagnostics-Kljt9XTH.js → Diagnostics-DAPbKSJp.js} +1 -1
- package/web/console/assets/{Executors-DnsB-Xz4.js → Executors-CgpiT3o8.js} +1 -1
- package/web/console/assets/{Kb-DLZSAFWP.js → Kb-Cm9dVSQw.js} +1 -1
- package/web/console/assets/{Login-DiTjPWmN.js → Login-CyUcsTZ_.js} +1 -1
- package/web/console/assets/{Projects-CXcVCgCD.js → Projects-DldFPgWg.js} +1 -1
- package/web/console/assets/Routes-DkMIjMQA.css +1 -0
- package/web/console/assets/Routes-DubfjlBD.js +124 -0
- package/web/console/assets/Runs-1hxgkuR4.js +3 -0
- package/web/console/assets/Runs-CvGTV8I-.css +1 -0
- package/web/console/assets/{Setup-FqoCKmfZ.js → Setup-DBLOnI2_.js} +1 -1
- package/web/console/assets/{Shell-BEqpONiy.js → Shell-gJ5Vz_E7.js} +1 -1
- package/web/console/assets/{StorageBuckets-CkORbYXY.js → StorageBuckets-DkDW16tj.js} +1 -1
- package/web/console/assets/{SystemSettings-gTQAazu7.js → SystemSettings-cDkudo2y.js} +1 -1
- package/web/console/assets/{SystemStatus-DAmUUNqO.js → SystemStatus-DZd6s8OX.js} +1 -1
- package/web/console/assets/{Targets-CZmDcjsE.js → Targets-DYNGq1NU.js} +1 -1
- package/web/console/assets/{Tools-CIHInlHL.js → Tools-DpWM59vV.js} +1 -1
- package/web/console/assets/{index-BkLbd7Cc.js → index-DGqs28gI.js} +2 -2
- package/web/console/assets/{request-r7GHVJzw.js → request-B7MLvOqo.js} +1 -1
- package/web/console/assets/{schema-BVn_hB7M.js → schema-CMuwjYdJ.js} +1 -1
- package/web/console/index.html +1 -1
- package/web-admin/scripts/subject-display-ui.mjs +78 -0
- package/web-admin/src/components/AgentSetupPanel.vue +262 -0
- package/web-admin/src/components/ClientConversations.vue +21 -4
- package/web-admin/src/components/conversation-audit.ts +20 -0
- package/web-admin/src/pages/AgentClients.vue +97 -23
- package/web-admin/src/pages/Clients.vue +4 -1
- package/web-admin/src/pages/Routes.vue +10 -1
- package/web-admin/tests/conversation-audit.fixture.mjs +13 -10
- package/web-admin/tests/conversation-audit.test.mjs +63 -1
- package/web/console/assets/AgentClients-BPIvlLYY.js +0 -1
- package/web/console/assets/AgentClients-DsWADpzr.css +0 -1
- package/web/console/assets/Clients-BSA1rlTB.js +0 -3
- package/web/console/assets/Clients-CNIVs7Qn.css +0 -1
- package/web/console/assets/Routes-CXGl9SMM.css +0 -1
- package/web/console/assets/Routes-DN9_d9Po.js +0 -124
- package/web/console/assets/Runs-Cwbe6thL.js +0 -3
- package/web/console/assets/Runs-D8UmjP5G.css +0 -1
package/README.en.md
CHANGED
|
@@ -29,15 +29,17 @@ 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.7.0: check stock, then update and list a shop product
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
> “Check tumbler stock. If available, change the corresponding shop product's price to 59 and list it.”
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
Select inventory and shop authorizations on one Hub. The Agent uses each system's tools and authority for the right step. Controlled system descriptions explain their roles, business-supplied names identify the approved subjects, and centralized setup and visible records help administrators configure and trace the work.
|
|
37
37
|
|
|
38
|
-
|
|
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
39
|
|
|
40
|
-
|
|
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)
|
|
41
43
|
|
|
42
44
|
## Operate the System by Conversation
|
|
43
45
|
|
|
@@ -127,7 +129,7 @@ To explore before installing, use the [online experience](https://trial.bailingh
|
|
|
127
129
|
To run the complete disposable loop locally:
|
|
128
130
|
|
|
129
131
|
```bash
|
|
130
|
-
git clone --branch v0.6.
|
|
132
|
+
git clone --branch v0.6.1 --depth 1 https://github.com/bailinghub/bailinghub.git
|
|
131
133
|
cd bailinghub
|
|
132
134
|
export BAILING_TOKEN="${BAILING_TOKEN:-$(openssl rand -hex 32)}"
|
|
133
135
|
docker compose up --build
|
|
@@ -207,11 +209,13 @@ Run separate BailingHub deployments for mutually isolated organizations. A `clie
|
|
|
207
209
|
- [Docker Demo](docs/DEMO.en.md) — complete the sample business-operation loop.
|
|
208
210
|
- [Integration Guide](docs/INTEGRATION.en.md) — connect an existing application.
|
|
209
211
|
- [Agent Client v1](docs/AGENT_CLIENT_QUICKSTART.en.md) — browser authorization and local planning.
|
|
212
|
+
- [Local Agent Setup](docs/LOCAL_AGENT_SETUP.en.md) — configure authorization, descriptions, tools, and connection checks in one place.
|
|
213
|
+
- [System Information](docs/AGENT_SYSTEM_INFO.en.md) — explain selected systems before searching for tools.
|
|
210
214
|
- [Business Tools and Governance](docs/TOOLS.en.md) — declare, sign, approve, and audit tools.
|
|
211
215
|
- [HTTP Contract](docs/CONTRACT.en.md) — stable network and identity boundaries.
|
|
212
216
|
- [Architecture](docs/ARCHITECTURE.en.md) — runtime layers and dependency direction.
|
|
213
217
|
- [English Documentation Map](docs/README.en.md) — the complete public documentation index.
|
|
214
|
-
- [Changelog](docs/CHANGELOG.en.md) and [v0.6.
|
|
218
|
+
- [Changelog](docs/CHANGELOG.en.md) and [v0.6.1 Release Notes](docs/RELEASE_NOTES_v0.6.1.en.md) — current release changes and upgrade notes.
|
|
215
219
|
|
|
216
220
|
## Feedback and Ecosystem
|
|
217
221
|
|
package/README.md
CHANGED
|
@@ -27,15 +27,17 @@
|
|
|
27
27
|
|
|
28
28
|
在线体验环境只用于了解产品和配置方式。请勿上传生产凭据、敏感数据或接入真实业务;正式使用请自行部署开源版。
|
|
29
29
|
|
|
30
|
-
## v0.
|
|
30
|
+
## v0.7.0:先查库存,再到商城改价上架
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
> “先查保温杯还有多少库存,有货就把商城对应商品改为 59 元并上架。”
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
在同一个中枢内选定库存与商城授权,Agent 按每一步使用对应工具与权限。系统说明让它先分清谁负责什么,业务提供的授权名称让用户认清具体对象;集中配置入口和完整会话记录帮助管理员设置、检查与追溯。
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
示例动作需由业务系统开放,商品映射需已确认,原审批继续生效;查库存不等于锁库存,改价完成也不代表上架审批已通过。
|
|
37
37
|
|
|
38
|
-
|
|
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)
|
|
39
41
|
|
|
40
42
|
## 适合哪些团队
|
|
41
43
|
|
|
@@ -117,7 +119,7 @@
|
|
|
117
119
|
在本机启动中枢、MySQL、Demo 业务系统、工具源、路由和接入方:
|
|
118
120
|
|
|
119
121
|
```bash
|
|
120
|
-
git clone --branch v0.6.
|
|
122
|
+
git clone --branch v0.6.1 --depth 1 https://github.com/bailinghub/bailinghub.git
|
|
121
123
|
cd bailinghub
|
|
122
124
|
export BAILING_TOKEN="${BAILING_TOKEN:-$(openssl rand -hex 32)}"
|
|
123
125
|
docker compose up --build
|
|
@@ -195,9 +197,10 @@ BailingHub Core 是独立服务,只通过稳定网络契约与业务系统协
|
|
|
195
197
|
| 跑通公开 Demo | [Docker Demo](docs/DEMO.md) |
|
|
196
198
|
| 接入现有业务 | [第三方对接指南](docs/第三方对接指南.md) |
|
|
197
199
|
| 接入本地智能体 | [Agent Client v1 指南](docs/AGENT_CLIENT_QUICKSTART.md) |
|
|
200
|
+
| 集中开启本地智能体与工具 | [四步配置指南](docs/LOCAL_AGENT_SETUP.md) · [系统说明](docs/AGENT_SYSTEM_INFO.md) |
|
|
198
201
|
| 查 API 与边界契约 | [HTTP 契约](docs/CONTRACT.md) · [Client API](docs/CLIENT_API.md) |
|
|
199
202
|
| 理解架构与长期取舍 | [架构](docs/ARCHITECTURE.md) · [项目愿景](VISION.md) |
|
|
200
|
-
| 查看版本变化 | [CHANGELOG](docs/CHANGELOG.md) · [v0.6.
|
|
203
|
+
| 查看版本变化 | [CHANGELOG](docs/CHANGELOG.md) · [v0.6.1 Release Notes](docs/RELEASE_NOTES_v0.6.1.md) |
|
|
201
204
|
|
|
202
205
|
完整中英文文档地图见 [docs/README.md](docs/README.md)。公共 API、SDK、Schema、Docker Demo 与代码标识保持语言中立。
|
|
203
206
|
|
|
@@ -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.7.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.7.0}
|
|
33
33
|
depends_on:
|
|
34
34
|
mysql:
|
|
35
35
|
condition: service_healthy
|
|
@@ -11,12 +11,17 @@ See the [Agent Client v1 Integration Guide](AGENT_CLIENT_QUICKSTART.en.md) for t
|
|
|
11
11
|
relationship. This protocol does not carry subscription, billing, model credentials, or business
|
|
12
12
|
API secrets.
|
|
13
13
|
|
|
14
|
+
**Core 0.7.0 adds authorization lifecycle management**. A business
|
|
15
|
+
backend can identify the device session created by an authorization, page through sessions for an
|
|
16
|
+
operator or tenant, and withdraw access using the original authorization record. Session listing,
|
|
17
|
+
authorization revocation and `context.session` require Core 0.7.0 and its matching PHP/PHP7 SDKs; Core 0.6.1 does not include these additions.
|
|
18
|
+
|
|
14
19
|
## 1. Parties and credentials
|
|
15
20
|
|
|
16
21
|
| Party | Identifier or credential | Boundary |
|
|
17
22
|
|---|---|---|
|
|
18
23
|
| local Agent SDK | public `client_app_id`, PKCE, loopback callback | no Client Token or business password |
|
|
19
|
-
| business authorization backend | BailingHub Client Token | server-only context/approve/deny/revoke calls |
|
|
24
|
+
| business authorization backend | BailingHub Client Token | server-only context/approve/deny/list/revoke calls |
|
|
20
25
|
| BailingHub Core | authorization and session ledger | stores only SHA-256 token hashes |
|
|
21
26
|
| business tool endpoint | Tool Provider Secret and business ACL | revalidates every real invocation |
|
|
22
27
|
|
|
@@ -90,6 +95,22 @@ Authorization: Bearer <BUSINESS_CLIENT_TOKEN>
|
|
|
90
95
|
|
|
91
96
|
The response exposes only client name, device name, requested routes, status, and expiry metadata.
|
|
92
97
|
|
|
98
|
+
The lifecycle API preserves those fields and adds `session` when `status=consumed`, linking
|
|
99
|
+
the authorization to the original session created by code exchange. Example `session` value:
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"session_id": "22222222-2222-4222-8222-222222222222",
|
|
104
|
+
"state": "active",
|
|
105
|
+
"expires_at": "2030-02-01T00:00:00.000Z"
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
A revoked session may also include `revoked_at`. If a legacy record has no reliable mapping, or
|
|
110
|
+
the linked session is missing, `session` is `null`. Never infer a Session ID from device labels,
|
|
111
|
+
identity or timestamps. The original top-level `expires_at` remains the authorization-request
|
|
112
|
+
expiry; `session.expires_at` is the refresh/session lifecycle expiry.
|
|
113
|
+
|
|
93
114
|
### 4.3 Approve or deny from the business backend
|
|
94
115
|
|
|
95
116
|
`POST /agent-auth/v1/authorizations/{authorization_id}/approve`
|
|
@@ -156,6 +177,92 @@ secure credential store, never in connection metadata or plugin settings.
|
|
|
156
177
|
Revoke sessions when an employee leaves, a tenant is disabled, a device is lost, or business
|
|
157
178
|
authority changes. Business tool endpoints still revalidate current permission on every call.
|
|
158
179
|
|
|
180
|
+
### 4.6 List business sessions (Core 0.7.0)
|
|
181
|
+
|
|
182
|
+
`GET /agent-auth/v1/sessions` uses the business backend Client Token and is restricted to its
|
|
183
|
+
Client App. A query cannot select another app. The backend must also enforce its own caller's
|
|
184
|
+
permission to inspect the requested tenant or operator; browser-supplied filters are not authority.
|
|
185
|
+
The Client Token grants backend authority for the whole app. Do not proxy this endpoint as an
|
|
186
|
+
unrestricted browser API. Any business admin UI must constrain both queries and revocations in
|
|
187
|
+
its backend using the current administrator's tenant, operator and authorization permissions.
|
|
188
|
+
BailingHub does not interpret business-specific user/store identifiers or replace that admin ACL.
|
|
189
|
+
|
|
190
|
+
| Optional parameter | Rule |
|
|
191
|
+
|---|---|
|
|
192
|
+
| `authorization_id` | UUID of the original authorization |
|
|
193
|
+
| `on_behalf_of` | Non-empty exact value, at most 191 UTF-16 units |
|
|
194
|
+
| `principal_id` | Non-empty, at most 128 UTF-16 units; requires an explicit `tenant` |
|
|
195
|
+
| `tenant` | At most 128 UTF-16 units; may filter a tenant on its own. Empty means no tenant; omission means no tenant filter |
|
|
196
|
+
| `state` | `active`, `expired` or `revoked` |
|
|
197
|
+
| `limit` | Integer 1–100, default 20 |
|
|
198
|
+
| `cursor` | Non-empty, unpadded base64url returned by the server; at most 2048 characters |
|
|
199
|
+
|
|
200
|
+
All filters are combined with AND. Unknown or repeated parameters are rejected. Identity and
|
|
201
|
+
tenant values cannot contain leading/trailing whitespace or control characters and are not
|
|
202
|
+
trimmed. Use RFC3986 encoding so `+`, `&`, `=` and an explicitly empty tenant survive transport.
|
|
203
|
+
The cursor is bound to the current Client App and all filters, but not to `limit`. Preserve filters
|
|
204
|
+
on the next page and treat cursors as opaque. Reusing one across apps or filters returns
|
|
205
|
+
`400 invalid_request`.
|
|
206
|
+
This is keyset pagination over current state, not a snapshot frozen across requests. Sessions that
|
|
207
|
+
expire or are revoked between pages are evaluated using their state at that later request.
|
|
208
|
+
|
|
209
|
+
```json
|
|
210
|
+
{
|
|
211
|
+
"list": [{
|
|
212
|
+
"session_id": "22222222-2222-4222-8222-222222222222",
|
|
213
|
+
"authorization_id": "11111111-1111-4111-8111-111111111111",
|
|
214
|
+
"client_app_id": "merchant-agent",
|
|
215
|
+
"device_label": "Workstation",
|
|
216
|
+
"principal": { "id": "user-42", "tenant": "tenant-7", "roles": ["manager"] },
|
|
217
|
+
"on_behalf_of": "tenant-7:user-42",
|
|
218
|
+
"allowed_routes": ["order-assistant"],
|
|
219
|
+
"state": "active",
|
|
220
|
+
"created_at": "2030-01-01T00:00:00.000Z",
|
|
221
|
+
"expires_at": "2030-02-01T00:00:00.000Z"
|
|
222
|
+
}],
|
|
223
|
+
"next_cursor": null
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Items may include `last_seen_at` and `revoked_at`; `authorization_id` is omitted when there is no
|
|
228
|
+
reliable original mapping. No access/refresh token, token hash, PKCE, callback URL or business
|
|
229
|
+
execution text is returned. Expiry and the `expired` state follow the refresh/session lifetime,
|
|
230
|
+
not the short-lived access token. `active` describes the session ledger; it does not guarantee that
|
|
231
|
+
the business account is currently valid. Per-call business permission checks remain mandatory.
|
|
232
|
+
|
|
233
|
+
### 4.7 Revoke an authorization (Core 0.7.0)
|
|
234
|
+
|
|
235
|
+
`POST /agent-auth/v1/authorizations/{authorization_id}/revoke` uses the business Client Token and
|
|
236
|
+
an empty JSON object `{}`.
|
|
237
|
+
|
|
238
|
+
```json
|
|
239
|
+
{
|
|
240
|
+
"authorization_id": "11111111-1111-4111-8111-111111111111",
|
|
241
|
+
"revoked": true,
|
|
242
|
+
"session_id": "22222222-2222-4222-8222-222222222222"
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
Revoked `pending` / `approved` requests can no longer exchange a code. A `consumed` authorization
|
|
247
|
+
revokes its reliably linked original Session and may return `session_id`. Revocation and exchange
|
|
248
|
+
are atomic against the same authorization record; repeated revocation is idempotent and never
|
|
249
|
+
creates or selects a replacement session. An unexchanged request may omit `session_id`. For a
|
|
250
|
+
`consumed` record, a missing mapping, missing session or session owned by another app returns 404;
|
|
251
|
+
failure to find a session must never be treated as proof of revocation.
|
|
252
|
+
Existing `revokeSession(sessionId)` remains appropriate when the exact Session ID is already known.
|
|
253
|
+
|
|
254
|
+
The matching PHP 8.1+ / PHP 7.3 SDKs expose `listSessions(array $filters = [])` and
|
|
255
|
+
`revokeAuthorization($authorizationId)`; `context()` passes through the new fields. Node / Python
|
|
256
|
+
currently have no separate `AgentAuth` module and can use the same server-side HTTP contract.
|
|
257
|
+
|
|
258
|
+
Older Core versions may return 404. A Host without the lifecycle repository methods returns
|
|
259
|
+
`503 agent_auth_lifecycle_unavailable` for the new list/revoke operations. Keep failures explicit;
|
|
260
|
+
do not report an empty list or successful revocation, or fall back to stronger credentials.
|
|
261
|
+
A 503 or timeout does not prove revocation; retry idempotently with the same `authorization_id`.
|
|
262
|
+
The lifecycle APIs add no SQL migration themselves. The combined Core 0.7.0 upgrade includes
|
|
263
|
+
cross-system archive migration 058 and subject display migration 059. Validate the matched
|
|
264
|
+
versions in an isolated environment before upgrading your deployment.
|
|
265
|
+
|
|
159
266
|
## 5. Business-page rules
|
|
160
267
|
|
|
161
268
|
- The page belongs to the business system; the SDK does not inject a universal UI.
|
|
@@ -189,3 +296,7 @@ authorization succeeded but revoking or removing the older connection failed, th
|
|
|
189
296
|
a recoverable state and return `cleanupRequired`. Do not reauthorize in that state; clean up the
|
|
190
297
|
reported old connection first. Core does not turn this local deduplication rule into a global
|
|
191
298
|
cross-device session-uniqueness constraint.
|
|
299
|
+
|
|
300
|
+
## Optional subject display names (Core 0.7.0)
|
|
301
|
+
|
|
302
|
+
Approval accepts optional `subject_display: {name} | null`. The owning business Client Token can call `PUT /agent-auth/v1/sessions/{session_id}/subject-display` to update an active session. Display metadata does not enter `principal` or change identity, permissions or sessions. See [business names after authorization](AGENT_SUBJECT_DISPLAY.en.md) for fields, errors and compatibility.
|
package/docs/AGENT_AUTH_API.md
CHANGED
|
@@ -9,12 +9,16 @@ Agent Session。BailingHub 提供协议与服务端 SDK 方法;业务系统负
|
|
|
9
9
|
完整组件关系见 [Agent Client v1 接入指南](AGENT_CLIENT_QUICKSTART.md)。本协议不承载套餐、付费、
|
|
10
10
|
模型凭据或业务 API Secret。
|
|
11
11
|
|
|
12
|
+
**Core 0.7.0 新增授权生命周期管理**:业务后端可以核对某次授权对应的设备会话、分页查找
|
|
13
|
+
某个操作人或租户的会话,再按原授权记录收回访问。新增列表、授权撤销与 `context.session`
|
|
14
|
+
需要 Core 0.7.0 及其配套 PHP/PHP7 SDK;Core 0.6.1 不包含这些增量。
|
|
15
|
+
|
|
12
16
|
## 1. 参与方与凭据
|
|
13
17
|
|
|
14
18
|
| 参与方 | 使用的标识/凭据 | 边界 |
|
|
15
19
|
|---|---|---|
|
|
16
20
|
| 本地 Agent SDK | 公开 `client_app_id`、PKCE、loopback callback | 不持有 Client Token 或业务密码 |
|
|
17
|
-
| 业务授权后端 | 接入方 Client Token | 只在服务端调用 context/approve/deny/revoke |
|
|
21
|
+
| 业务授权后端 | 接入方 Client Token | 只在服务端调用 context/approve/deny/list/revoke |
|
|
18
22
|
| BailingHub Core | Agent authorization/session 账本 | 只存 access/refresh token 的 SHA-256 摘要 |
|
|
19
23
|
| 业务工具端点 | Tool Provider Secret 与业务权限表 | 每次真实调用仍重新验签并校验权限 |
|
|
20
24
|
|
|
@@ -102,6 +106,20 @@ Authorization: Bearer <BUSINESS_CLIENT_TOKEN>
|
|
|
102
106
|
|
|
103
107
|
响应只包含应用名、设备名、请求的 routes、状态和过期时间,不包含 PKCE、callback 或 token。
|
|
104
108
|
|
|
109
|
+
生命周期接口保留上述字段;`status=consumed` 时增加 `session`,用于确认换码后生成的原会话:
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"session_id": "22222222-2222-4222-8222-222222222222",
|
|
114
|
+
"state": "active",
|
|
115
|
+
"expires_at": "2030-02-01T00:00:00.000Z"
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
这是 `session` 字段的示例,撤销后还可包含 `revoked_at`。旧记录没有可靠映射或关联会话不存在时
|
|
120
|
+
返回 `session: null`,不能按设备名、操作人或时间推测 Session ID。原顶层 `expires_at` 仍表示授权
|
|
121
|
+
请求的过期时间;`session.expires_at` 表示 refresh/session 生命周期到期时间,两者不可混用。
|
|
122
|
+
|
|
105
123
|
### 4.3 业务后端:批准或拒绝
|
|
106
124
|
|
|
107
125
|
`POST /agent-auth/v1/authorizations/{authorization_id}/approve`
|
|
@@ -170,6 +188,82 @@ access token 默认 15 分钟有效,refresh session 默认 30 天有效;每
|
|
|
170
188
|
员工离职、租户禁用、设备丢失或业务权限撤销时,业务系统应主动撤销相关会话。即使会话尚未撤销,
|
|
171
189
|
业务工具端点仍必须在每次调用时按当前权限表重新裁决。
|
|
172
190
|
|
|
191
|
+
### 4.6 业务后端:分页查询会话(Core 0.7.0)
|
|
192
|
+
|
|
193
|
+
`GET /agent-auth/v1/sessions`,使用业务后端 Client Token。只查询该 Token 所属 Client App,
|
|
194
|
+
不能通过 query 指定其他接入方。业务后端还须校验自己的用户是否有权查看相应租户和操作人,
|
|
195
|
+
不能把浏览器传来的筛选字段当成权限依据。
|
|
196
|
+
Client Token 是整个接入方的后端权限,不能把该接口直接代理成任意前端用户都能查全应用账号
|
|
197
|
+
的入口。业务后台 UI 的查询与撤销都必须由其后端按当前管理员权限限制租户、操作人及目标授权;
|
|
198
|
+
BailingHub 不解释业务系统自己的用户/门店编号,也不代替其后台权限判断。
|
|
199
|
+
|
|
200
|
+
| 可选参数 | 规则 |
|
|
201
|
+
|---|---|
|
|
202
|
+
| `authorization_id` | UUID,按原授权记录筛选 |
|
|
203
|
+
| `on_behalf_of` | 非空,最多 191 个 UTF-16 单元,精确匹配 |
|
|
204
|
+
| `principal_id` | 非空,最多 128 个 UTF-16 单元;必须同时传 `tenant` |
|
|
205
|
+
| `tenant` | 最多 128 个 UTF-16 单元;可单独筛选整个租户;空字符串精确表示无租户,省略表示不筛选 |
|
|
206
|
+
| `state` | `active`、`expired` 或 `revoked` |
|
|
207
|
+
| `limit` | 整数 1–100,默认 20 |
|
|
208
|
+
| `cursor` | 服务端返回的非空、不带 padding 的 base64url 游标,最多 2048 字符 |
|
|
209
|
+
|
|
210
|
+
筛选条件全部按 AND 组合,不接受未知或重复参数。主体、租户字段不能带首尾空白或控制字符,
|
|
211
|
+
也不会自动 trim。查询值须按 RFC3986 编码;尤其 `+`、`&`、`=` 和空 `tenant` 不能丢失。
|
|
212
|
+
游标绑定当前 Client App 和全部筛选条件;翻页时保留这些条件,`limit` 可以调整。不要解析或自行
|
|
213
|
+
构造游标。跨接入方或跨筛选复用返回 `400 invalid_request`。
|
|
214
|
+
分页是按当前状态进行的 keyset 分页,不是跨请求冻结的快照;会话在翻页期间过期或撤销时,
|
|
215
|
+
后续页面会反映当时状态。
|
|
216
|
+
|
|
217
|
+
```json
|
|
218
|
+
{
|
|
219
|
+
"list": [{
|
|
220
|
+
"session_id": "22222222-2222-4222-8222-222222222222",
|
|
221
|
+
"authorization_id": "11111111-1111-4111-8111-111111111111",
|
|
222
|
+
"client_app_id": "merchant-agent",
|
|
223
|
+
"device_label": "Workstation",
|
|
224
|
+
"principal": { "id": "user-42", "tenant": "tenant-7", "roles": ["manager"] },
|
|
225
|
+
"on_behalf_of": "tenant-7:user-42",
|
|
226
|
+
"allowed_routes": ["order-assistant"],
|
|
227
|
+
"state": "active",
|
|
228
|
+
"created_at": "2030-01-01T00:00:00.000Z",
|
|
229
|
+
"expires_at": "2030-02-01T00:00:00.000Z"
|
|
230
|
+
}],
|
|
231
|
+
"next_cursor": null
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
有记录时还可包含 `last_seen_at`、`revoked_at`;没有可靠原授权映射时省略 `authorization_id`。
|
|
236
|
+
结果不包含 access/refresh token、token hash、PKCE、回调地址或业务执行正文。`expires_at` 与
|
|
237
|
+
`expired` 按 refresh/session 寿命判断,短期 access token 到期不会单独把会话标成 `expired`。
|
|
238
|
+
`active` 只说明会话账本未过期或撤销,不保证业务账号当前有效,业务侧仍须逐次校验权限。
|
|
239
|
+
|
|
240
|
+
### 4.7 业务后端:按原授权撤销(Core 0.7.0)
|
|
241
|
+
|
|
242
|
+
`POST /agent-auth/v1/authorizations/{authorization_id}/revoke`,业务 Client Token,JSON body `{}`。
|
|
243
|
+
|
|
244
|
+
```json
|
|
245
|
+
{
|
|
246
|
+
"authorization_id": "11111111-1111-4111-8111-111111111111",
|
|
247
|
+
"revoked": true,
|
|
248
|
+
"session_id": "22222222-2222-4222-8222-222222222222"
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
`pending` / `approved` 授权撤销后不可再换码;已 `consumed` 的授权则撤销其可靠映射的原 Session,
|
|
253
|
+
响应可带 `session_id`。撤销与换码在同一授权记录上原子互斥,重复撤销幂等,不创建或重新选择
|
|
254
|
+
会话。未换码的请求可省略 `session_id`;但 `consumed` 记录的映射缺失、关联会话不存在或属于其他
|
|
255
|
+
应用时返回 404,不能把“查不到 Session”当成已经撤销。
|
|
256
|
+
已有 `revokeSession(sessionId)` 继续适用于业务系统已经持有确切 Session ID 的情况。
|
|
257
|
+
|
|
258
|
+
配套 PHP 8.1+ / PHP 7.3 SDK 提供 `listSessions(array $filters = [])` 与
|
|
259
|
+
`revokeAuthorization($authorizationId)`;`context()` 原样返回新增字段。Node / Python 当前没有
|
|
260
|
+
独立 `AgentAuth` 模块,可用服务端 HTTP 调用相同契约,无需引入第二套授权协议。
|
|
261
|
+
|
|
262
|
+
旧 Core 可能返回 404;旧 Host 未实现生命周期仓储方法时,新列表/撤销返回
|
|
263
|
+
`503 agent_auth_lifecycle_unavailable`。查询或撤销失败必须明确保留失败状态,不能伪装成空列表、
|
|
264
|
+
已撤销或改用更高权限凭据。503 或超时不代表撤销成功,可用同一 `authorization_id` 幂等重试。
|
|
265
|
+
生命周期接口本身不增加 SQL 迁移;Core 0.7.0 组合升级包括跨系统归档的 058 和主体展示的 059。接入方应先在隔离环境验收,再按运维指南升级。
|
|
266
|
+
|
|
173
267
|
## 5. 业务授权页实现规则
|
|
174
268
|
|
|
175
269
|
- 页面属于业务系统,不由 SDK 自动注入;可以完全继承业务系统自己的 UI 风格;
|
|
@@ -200,3 +294,7 @@ access token 默认 15 分钟有效,refresh session 默认 30 天有效;每
|
|
|
200
294
|
本机连接;不同 `on_behalf_of` 保持独立。若新授权已成功、但旧会话撤销或本地清理失败,SDK 应保留
|
|
201
295
|
可恢复状态并返回 `cleanupRequired`:此时不要重复授权,应先按返回信息清理旧连接。Core 不把该
|
|
202
296
|
本机去重规则提升为跨设备的全局会话唯一约束。
|
|
297
|
+
|
|
298
|
+
## 可选授权显示名称(Core 0.7.0)
|
|
299
|
+
|
|
300
|
+
approve 可选 `subject_display: {name} | null`,支持由业务 Client Token 调用 `PUT /agent-auth/v1/sessions/{session_id}/subject-display` 更新自己有效会话的名称。显示信息不进入 `principal`,不更换身份、权限或会话。完整字段、错误和兼容规则见 [授权后显示业务名称](AGENT_SUBJECT_DISPLAY.md)。
|
|
@@ -11,6 +11,8 @@ direct business API endpoints.
|
|
|
11
11
|
This guide separates the responsibilities of the BailingHub deployer, the business-system
|
|
12
12
|
developer, and the local Agent user. They do not share one credential or configuration file.
|
|
13
13
|
|
|
14
|
+
For the current console flow, start with [Local Agent Setup](LOCAL_AGENT_SETUP.en.md): authorization, descriptions, tools/approvals, and connection checks share one entry point under Agent Clients. The sections below explain configuration ownership and advanced integration details.
|
|
15
|
+
|
|
14
16
|
## 1. Component relationship
|
|
15
17
|
|
|
16
18
|
```text
|
|
@@ -48,8 +50,9 @@ the end user to paste a BailingHub Client Token, Tool Provider Secret, or busine
|
|
|
48
50
|
|
|
49
51
|
### 3.1 Deploy Core and apply migrations
|
|
50
52
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
For the complete cross-system flow, use BailingHub 0.7.0, Agent Client SDK 0.5.0 and DSH 0.5.0
|
|
54
|
+
or a compatible client. Apply all outstanding migrations, including 055–059, as part of the
|
|
55
|
+
deployment; runtime startup does not apply them.
|
|
53
56
|
Confirm that health and readiness pass, no migration is pending, the console can edit
|
|
54
57
|
Agent Client settings, and production traffic uses HTTPS.
|
|
55
58
|
|
|
@@ -160,6 +163,30 @@ Other languages can implement the Agent Auth v1 HTTP contract directly. The Clie
|
|
|
160
163
|
in the backend `Authorization: Bearer <BUSINESS_CLIENT_TOKEN>` header and is never sent to the
|
|
161
164
|
browser.
|
|
162
165
|
|
|
166
|
+
### 4.1 Inspect and withdraw access (Core 0.7.0)
|
|
167
|
+
|
|
168
|
+
The lifecycle additions in this branch let a business backend identify the device session created
|
|
169
|
+
by an authorization and find sessions for an operator or tenant before withdrawing access. Tool
|
|
170
|
+
declarations and the existing consent page need no redesign. The new methods require matching
|
|
171
|
+
Core 0.7.0 and its matching PHP/PHP7 SDKs.
|
|
172
|
+
|
|
173
|
+
```php
|
|
174
|
+
// Derive filters from the backend's validated management permission and tenant scope.
|
|
175
|
+
$page = $agentAuth->listSessions(['tenant' => (string) $tenantId, 'limit' => 20]);
|
|
176
|
+
// Keep the same filters and pass next_cursor for the next page; null means no next page.
|
|
177
|
+
$context = $agentAuth->context($authorizationId);
|
|
178
|
+
$session = $context['session'] ?? null; // Reliable link on consumed records only; never guess.
|
|
179
|
+
$result = $agentAuth->revokeAuthorization($authorizationId);
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
An operator filter requires both `principal_id` and `tenant`; use `tenant => ''` for no tenant.
|
|
183
|
+
`active` describes the session ledger, not current business-account permission; expiry follows the
|
|
184
|
+
refresh/session lifetime. Revocation and exchange are atomic, and repeated revocation of the same
|
|
185
|
+
authorization is idempotent. A 503/timeout, or a 404 for a consumed record with no valid mapping,
|
|
186
|
+
does not prove revocation. Keep the failure and retry or investigate the original ID.
|
|
187
|
+
Use the existing `revokeSession()` when the exact Session ID is already known. See the
|
|
188
|
+
[Agent Auth contract](AGENT_AUTH_API.en.md) for pagination and compatibility details.
|
|
189
|
+
|
|
163
190
|
## 5. Local Agent user: install and authorize
|
|
164
191
|
|
|
165
192
|
For DSH, follow the versioned installation and compatibility matrix in the
|
|
@@ -220,7 +247,7 @@ on the same public binding, use a console-generated command or run these user co
|
|
|
220
247
|
```
|
|
221
248
|
|
|
222
249
|
Connection selection is a user command, not a model tool. It selects the connection-management and
|
|
223
|
-
login target; it does not grant business scope to a new conversation. DSH0.
|
|
250
|
+
login target; it does not grant business scope to a new conversation. DSH0.5.0 requires a separate
|
|
224
251
|
explicit scope selection before the first message. Existing conversations retain their original scope. `/bailinghub use
|
|
225
252
|
<workspace>` moves only within workspaces already granted to the current authorization and is not
|
|
226
253
|
a multi-connection selector. `/bailinghub connections remove <name>` first revokes the remote
|
|
@@ -245,13 +272,13 @@ Authorize the intended accounts separately, then obtain each `connectionKey` fro
|
|
|
245
272
|
/bailinghub scope
|
|
246
273
|
```
|
|
247
274
|
|
|
248
|
-
Use the actual returned keys, not these placeholders or account labels. Select only A to allow only A; `/bailinghub scope none` means ordinary chat without Hub access. Wait for successful selection before sending business requests. DSH0.
|
|
275
|
+
Use the actual returned keys, not these placeholders or account labels. Select only A to allow only A; `/bailinghub scope none` means ordinary chat without Hub access. Wait for successful selection before sending business requests. DSH0.5.0 accepts distinct original Agent Sessions from different Client Apps/workspaces on one Hub and audit domain. Existing same-system scopes remain supported and never expand automatically.
|
|
249
276
|
|
|
250
277
|
The first user message fixes the scope; changing it requires a new conversation. Custom hosts use `setSessionScope/getSessionScope/restoreSessionScope`. Failed restoration must never select a default or remaining subset.
|
|
251
278
|
|
|
252
279
|
### 6.2 Read the conversation and retry synchronization
|
|
253
280
|
|
|
254
|
-
Compatible hosts use SDK0.
|
|
281
|
+
Compatible hosts use SDK0.5.0 to capture actual visible text, preserving the original Session, durable history and separate pending records. Administrators open Tasks → Conversations → Client conversations and follow each turn into the original account's execution record.
|
|
255
282
|
|
|
256
283
|
Use `/bailinghub archive status` to inspect synchronization and `/bailinghub archive sync` to retry. After reopening offline, the same runtime and Session can revalidate the original scope and synchronize when connectivity returns. Confirmed revocation keeps the whole group blocked. Show storage failures and history gaps separately; never resend user messages or repeat business actions merely to repair the archive. Restoring an archive does not restore an invocation lost across process restarts. See the [user guide](user-guide/conversations.en.md) and [archive API](AGENT_CONVERSATION_AUDIT.en.md).
|
|
257
284
|
|
|
@@ -9,6 +9,8 @@ BailingHub 负责可信业务身份、能力裁剪、审批、幂等、业务调
|
|
|
9
9
|
本指南面向三类角色:BailingHub 部署者、业务系统开发者和本地智能体使用者。三者需要填写的
|
|
10
10
|
配置不同,不应共享同一份密钥或配置文件。
|
|
11
11
|
|
|
12
|
+
使用当前控制台集中配置时,先看[四步本地智能体配置](LOCAL_AGENT_SETUP.md):授权入口、系统说明、工具与审批和连接检查都从“智能体客户端 → 接入配置”开始。本页后续说明各项配置的归属和高级接口。
|
|
13
|
+
|
|
12
14
|
## 1. 组件关系
|
|
13
15
|
|
|
14
16
|
```text
|
|
@@ -45,7 +47,7 @@ BailingHub Client Token、Tool Provider Secret 或业务系统密码的步骤。
|
|
|
45
47
|
|
|
46
48
|
### 3.1 部署 Core 并执行数据库迁移
|
|
47
49
|
|
|
48
|
-
完整对话归档使用 BailingHub0.
|
|
50
|
+
完整对话归档使用 BailingHub0.7.0、Agent Client SDK0.5.0及兼容客户端。Core需要按账本应用全部未执行迁移,包括055/056/057及本版058/059;由一个部署步骤执行迁移,运行时启动不会自动迁移。
|
|
49
51
|
升级后先确认:
|
|
50
52
|
|
|
51
53
|
- `/health` 和 `/health/ready` 正常;
|
|
@@ -149,6 +151,27 @@ return redirect($result['redirect_uri']);
|
|
|
149
151
|
非 PHP 项目可直接实现相同的 Agent Auth v1 HTTP 契约。Client Token 始终放在服务端
|
|
150
152
|
`Authorization: Bearer <BUSINESS_CLIENT_TOKEN>` 请求头中,不得下发到浏览器。
|
|
151
153
|
|
|
154
|
+
### 4.2 核对授权并收回访问(Core 0.7.0)
|
|
155
|
+
|
|
156
|
+
Core 0.7.0 的生命周期接口让业务后端能回答“这次授权生成了哪个设备会话”,也能查找某个操作人或
|
|
157
|
+
租户的授权会话,在离职、设备丢失等场景收回访问。无需修改能力声明或重新设计授权页;新增
|
|
158
|
+
方法需要 Core 0.7.0 与配套 PHP/PHP7 SDK。
|
|
159
|
+
|
|
160
|
+
```php
|
|
161
|
+
// 查询参数必须来自后端已校验的管理权限与租户范围。
|
|
162
|
+
$page = $agentAuth->listSessions(['tenant' => (string) $tenantId, 'limit' => 20]);
|
|
163
|
+
// 下一页保持原筛选条件,再传 $page['next_cursor'];null 表示没有下一页。
|
|
164
|
+
$context = $agentAuth->context($authorizationId);
|
|
165
|
+
$session = $context['session'] ?? null; // consumed 记录才有可靠原会话投影;null 不能猜。
|
|
166
|
+
$result = $agentAuth->revokeAuthorization($authorizationId);
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
按操作人筛选时必须同时提供 `principal_id` 与 `tenant`,无租户主体用 `tenant => ''`。`active`
|
|
170
|
+
表示会话账本状态,业务账号是否有效仍由业务系统判断;有效期是 refresh/session 寿命。
|
|
171
|
+
撤销和换码原子互斥,重复撤销同一授权幂等。503/超时或 consumed 映射缺失返回 404 都不能当成
|
|
172
|
+
撤销成功;后端应保留失败并按原 ID 重试或核查。已有确切 Session ID 时仍可调用
|
|
173
|
+
`revokeSession()`。完整分页和兼容边界见 [Agent Auth v1](AGENT_AUTH_API.md)。
|
|
174
|
+
|
|
152
175
|
## 5. 本地智能体使用者:安装并授权
|
|
153
176
|
|
|
154
177
|
以 DSH 原生插件为例,安装步骤、目标版本和兼容矩阵以
|
|
@@ -205,7 +228,7 @@ DSH 的模型提供方和模型 API Key 需要在 DSH 自己的模型设置中
|
|
|
205
228
|
/bailinghub login
|
|
206
229
|
```
|
|
207
230
|
|
|
208
|
-
连接切换是用户命令,不是模型工具;它选择连接管理和登录的目标,不会为新会话自动授予业务范围。DSH0.
|
|
231
|
+
连接切换是用户命令,不是模型工具;它选择连接管理和登录的目标,不会为新会话自动授予业务范围。DSH0.5.0在首消息前必须另外显式选择本次授权,已有会话保持原范围。
|
|
209
232
|
`/bailinghub use <workspace>` 只在当前授权已经允许的 workspace 内切换,不能替代多连接选择。
|
|
210
233
|
删除连接时使用 `/bailinghub connections remove <名称>`:SDK 会先远程撤销 Agent Session,成功
|
|
211
234
|
后再删除该实例的本地凭据;远程撤销失败则保留该实例和凭据供重试。不要复制 access/refresh token
|
|
@@ -226,13 +249,13 @@ DSH 的模型提供方和模型 API Key 需要在 DSH 自己的模型设置中
|
|
|
226
249
|
/bailinghub scope
|
|
227
250
|
```
|
|
228
251
|
|
|
229
|
-
这里使用实际返回的连接key,不使用示例占位符或门店名。只选择A就只能使用A;`/bailinghub scope none`表示只聊天,不访问Hub。确认选择成功后再发送业务请求。DSH0.
|
|
252
|
+
这里使用实际返回的连接key,不使用示例占位符或门店名。只选择A就只能使用A;`/bailinghub scope none`表示只聊天,不访问Hub。确认选择成功后再发送业务请求。DSH0.5.0可选择同一Hub、同一审计域内不同Client App/workspace的独立原Agent Session;旧同系统范围仍可使用,不会自动扩大。
|
|
230
253
|
|
|
231
254
|
第一条用户消息后范围固定;改选需要新会话。自研宿主使用`setSessionScope/getSessionScope/restoreSessionScope`,恢复失败不能回退到默认或剩余授权。
|
|
232
255
|
|
|
233
256
|
### 6.2 查看完整对话与重试同步
|
|
234
257
|
|
|
235
|
-
支持的宿主通过SDK0.
|
|
258
|
+
支持的宿主通过SDK0.5.0归档真实可见文本,保留原Session、持久历史与独立待传记录。管理员在“任务→会话→客户端完整对话”阅读沟通并打开各授权的原执行记录。
|
|
236
259
|
|
|
237
260
|
DSH使用`/bailinghub archive status`查看状态,`/bailinghub archive sync`补传。离线重开后联网,可在同一runtime、同一Session重试原范围核验与同步;原授权明确撤销仍整组阻断。保存失败或历史缺口要单独显示,不能靠重复发消息或重执行业务来补账。归档恢复不等于恢复跨进程丢失的invocation。详见[使用者指南](user-guide/conversations.md)与[归档接口](AGENT_CONVERSATION_AUDIT.md)。
|
|
238
261
|
|
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
本版本化接口让已完成 Agent Auth 网页授权的本地智能体在本地承担规划,同时继续复用 BailingHub 的身份重验、工具治理、审批、审计与对话总账。它不替代现有 `/run`、聊天入口或执行器协议。配套的部署、业务授权页和宿主接入步骤见 [Agent Client v1 接入指南](AGENT_CLIENT_QUICKSTART.md),身份授权契约见 [Agent Auth v1](AGENT_AUTH_API.md)。
|
|
4
4
|
|
|
5
|
-
所有接口只接受 `Authorization: Bearer <Agent access token>`,响应均 `Cache-Control: no-store
|
|
5
|
+
所有接口只接受 `Authorization: Bearer <Agent access token>`,响应均 `Cache-Control: no-store`。业务运行与能力接口的工作区授权面始终取以下交集:Client `allowed_routes` ∩ Agent Session `allowed_routes` ∩ 启用且 audience 允许的 route ∩ `tools.agent_direct`。`agent_client.enabled=false` 关闭 Runtime 工作区、上下文与能力接口,不关闭旧 `/agent-api/v1/tools`。
|
|
6
|
+
|
|
7
|
+
首次选择业务目标所需的[系统说明](AGENT_SYSTEM_INFO.md)采用同一身份与路由边界,但读取说明不要求开启 Runtime 或工具直调,也不会加载工具或创建业务运行。
|
|
6
8
|
|
|
7
9
|
## 端点
|
|
8
10
|
|
|
9
11
|
- `GET /agent-api/v1/workspaces`
|
|
12
|
+
- `GET /agent-api/v1/workspaces/:route/system-info`
|
|
10
13
|
- `GET /agent-api/v1/workspaces/:route/bootstrap`
|
|
11
14
|
- `POST /agent-api/v1/workspaces/:route/turns`
|
|
12
15
|
- `POST /agent-api/v1/workspaces/:route/capabilities/search`
|