dsh-bailinghub 0.1.1 → 0.3.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.
@@ -0,0 +1,260 @@
1
+ # Agent Client Host Adapter Contract
2
+
3
+ Status: public native Agent Client contract for `dsh-bailinghub@0.3.0`. This contract is not part
4
+ of the legacy public `0.1.x` line. The multi-connection lifecycle described below is stable with
5
+ BailingHub Core `0.5.1` and `bailinghub-mcp-server@0.3.0`.
6
+
7
+ ## Host Configuration
8
+
9
+ The Cordis Config schema contains only:
10
+
11
+ ```text
12
+ hubUrl
13
+ clientAppId
14
+ workspace
15
+ connectionName
16
+ ```
17
+
18
+ `hubUrl`, `clientAppId`, and `workspace` identify a public Hub-side application/workspace binding.
19
+ `connectionName` selects one local SDK connection instance, but it is not an account, tenant, or
20
+ identity claim. The Hub Client App resolves to one stable business authorization endpoint; no
21
+ business endpoint, authorization endpoint, token, secret, or business credential belongs in this
22
+ config. The business authorization page owns sign-in, account switching, tenant selection, and
23
+ the trusted identity ultimately represented by `on_behalf_of`.
24
+
25
+ ## Injectable Transport Seam
26
+
27
+ The default transport is lazily created from `bailinghub-mcp-server/sdk`. Tests and future host
28
+ adapters may inject an object with all methods below:
29
+
30
+ ```js
31
+ connectionsList({})
32
+ connectionsAdd({ connectionName, hubUrl, clientAppId, workspace })
33
+ connectionsUse(connectionNameOrKey)
34
+ connectionsRemove(connectionNameOrKey)
35
+
36
+ login({ hubUrl, clientAppId, workspace, route, connectionName })
37
+ status({ connectionName })
38
+ logout({ connectionName })
39
+ workspaces({ connectionName })
40
+ use({ workspace, route, connectionName })
41
+
42
+ startTurn({
43
+ clientConversationId,
44
+ clientTurnId,
45
+ userMessageId,
46
+ userInput,
47
+ pageContext?,
48
+ renderers?,
49
+ })
50
+
51
+ searchCapabilities({ query, limit?, runId? })
52
+ invoke({ invocationId, capabilityRevision, agentRunId, tool, arguments })
53
+ resume(invocationId, {}, { workspace, connectionName, signal? })
54
+ completeRun(runId, {
55
+ assistantMessageId,
56
+ content,
57
+ status,
58
+ model?,
59
+ runtime?,
60
+ usage?,
61
+ })
62
+ ```
63
+
64
+ The adapter may pass a second host metadata argument (`workspace`, `connectionName`, and an
65
+ `AbortSignal`) to turn/tool methods. The framework-neutral SDK DTO is always the first argument;
66
+ an SDK implementation that does not consume host metadata may ignore it.
67
+
68
+ ## Browser Identity and Local Reconciliation
69
+
70
+ `/bailinghub login` always starts from the selected Hub/client/workspace binding. The plugin does
71
+ not accept or derive a business URL, account id, tenant id, or identity selector. Core redirects
72
+ to the single authorization endpoint configured for that Client App, and the business page
73
+ performs any login, account switching, or tenant selection required before it approves the
74
+ authorization.
75
+
76
+ The SDK may stage more than one named local instance for the same public binding while browser
77
+ authorization is in progress. After authorization it compares the trusted Session
78
+ `on_behalf_of`, never the local `connectionName`:
79
+
80
+ - the same identity replaces the older local connection and revokes its old Agent Session;
81
+ - a different identity remains a separate named connection; when login was launched from an alias
82
+ already owned by the old identity, the SDK preserves that alias and Session, allocates an
83
+ available alias such as `default-2` to the new identity, and makes the new connection current;
84
+ - an uncertain identity inspection or failed old-Session revoke keeps the new Session authorized
85
+ and returns `cleanupRequired: true` with cleanup metadata.
86
+
87
+ The adapter reports that last result as successful authorization plus a visible warning. It tells
88
+ the user not to authorize again and to retry explicit cleanup with the user-only connection
89
+ lifecycle commands. It does not turn the result into a failed login or let the model perform
90
+ cleanup.
91
+
92
+ ## Core HTTP Mapping
93
+
94
+ The SDK, not this adapter, maps those DTOs to:
95
+
96
+ ```text
97
+ POST /agent-api/v1/workspaces/:route/turns
98
+ POST /agent-api/v1/workspaces/:route/capabilities/search
99
+ POST /agent-api/v1/tool-invocations
100
+ POST /agent-api/v1/tool-invocations/:invocation_id/resume
101
+ POST /agent-api/v1/runs/:run_id/complete
102
+ ```
103
+
104
+ `startTurn` accepts the Core `schema` or `schema_version` alias, but the resolved value must be
105
+ exactly `bailing.agent-turn-context.v1`. Its runtime result is:
106
+
107
+ ```json
108
+ {
109
+ "schema_version": "bailing.agent-turn-context.v1",
110
+ "run_id": "UUID",
111
+ "profile_revision": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
112
+ "capability_revision": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
113
+ "context": {
114
+ "instructions": "...",
115
+ "page_context": {},
116
+ "renderers": [],
117
+ "memory": null,
118
+ "memory_refs": [],
119
+ "knowledge": [],
120
+ "knowledge_refs": [],
121
+ "governance": {}
122
+ },
123
+ "active_tools": []
124
+ }
125
+ ```
126
+
127
+ At most 12 active tools are accepted. Each tool must use the Core tool-name grammar, an
128
+ object-rooted input schema, and complete governance metadata (`scope`, `risk`,
129
+ `approval_required`, `readonly`, and `idempotent`).
130
+ Both revision fields are required lowercase 64-character SHA-256 values; shorter labels or
131
+ uppercase digests fail closed.
132
+
133
+ ## Verified DSH Lifecycles
134
+
135
+ DSH `0.1.0-rc.7` and `0.1.1-rc.2` claim inbox messages before assembling the current step:
136
+
137
+ ```text
138
+ agent/inbox/claimed
139
+ -> systemPrompt.assemble()
140
+ -> system-prompt/assemble async waterfall
141
+ -> agent/pre-step
142
+ -> model request
143
+ ```
144
+
145
+ The adapter captures only a claimed message whose `source.kind` is `user`. On the authoritative
146
+ `system-prompt/assemble` waterfall, it calls `startTurn`, registers the returned definitions
147
+ through `agent.ctx.tools.register()`, and also adds their schemas to the already-sampled current
148
+ assembly. Later steps receive the same agent-scoped definitions from the ordinary ToolRuntime
149
+ registry.
150
+
151
+ Stable profile/instructions/governance are system-prompt sections. Memory, reference-only
152
+ knowledge body/refs, page context, and renderers are named runtime-context entries. Knowledge
153
+ content is evidence, never an instruction source.
154
+
155
+ The adapter listens to durable `session/event` values:
156
+
157
+ - `assistant/message`: keep only `content` blocks whose type is `text`, plus model and the
158
+ public numeric usage buckets;
159
+ - `tool/call`: count distinct durable call ids for the public `tool_calls` metric; never copy
160
+ tool arguments or results into completion usage;
161
+ - `turn/end`: freeze the completion DTO and synchronize it;
162
+ - `assistant/chunk`: deliberately ignored, including hidden reasoning chunks.
163
+
164
+ ## Tool Invocation and Recovery
165
+
166
+ Every active Core tool becomes an agent-scoped DSH definition. Its invocation id is a stable
167
+ 64-character lowercase SHA-256 digest of the session, run, DSH call id, and Core tool name. It
168
+ calls the SDK `invoke` DTO without letting the model choose the run, capability revision, route,
169
+ or identity.
170
+
171
+ An SDK error with `disposition === 'accepted_unknown'` starts recovery with the exact invocation
172
+ id; it never repeats the business-tool `invoke`. Likewise, `awaiting_approval`, `in_progress`, and
173
+ retryable `rejected_before_dispatch` results keep the original DSH tool call open while the
174
+ adapter performs bounded `resume` polling. Approval therefore continues the same invocation and
175
+ the same Core run before the local Agent writes its final answer.
176
+
177
+ The default recovery window is at most 120 seconds and 60 resume attempts. `executed`,
178
+ `business_rejected`, `denied`, non-retryable `rejected_before_dispatch`, and
179
+ `reconciliation_required` are terminal and are never polled. If the bounded wait expires while a
180
+ known result is still pending, the tool returns that result plus an `agent_client_wait` marker
181
+ containing the same invocation id and the only legal recovery tool. If no trustworthy invocation
182
+ result was ever received, the safe error still retains only that exact id. Raw transport errors
183
+ are never exposed.
184
+
185
+ Concurrent or replayed executions of the same DSH call share one in-flight operation. A terminal
186
+ result is returned from the per-run cache, while an unfinished replay resumes the same invocation;
187
+ neither path submits another `invoke`. A replay that changes the original tool or arguments fails
188
+ closed.
189
+
190
+ `search_business_capabilities` applies the returned revision/tool set only to the current
191
+ session/run. `resume_governed_tool_invocation` accepts only the exact 64-character id, shares the
192
+ same bounded recovery state when known locally, and never creates a replacement invocation.
193
+
194
+ ## Session and Completion State
195
+
196
+ Connection selector, workspace, conversation alias, Core run, active definitions, and completion
197
+ state are isolated per DSH Agent/session. Named connections for different trusted identities own
198
+ separate SDK credentials and Agent Sessions. Same-binding connections that resolve to the same
199
+ trusted identity are reconciled to one local survivor after authorization. A workspace switch
200
+ preserves the selected connection instance and affects future sessions; it is rejected while any
201
+ Core run is active/completing or has an unsynchronized completion payload.
202
+
203
+ After a same-alias login resolves to a different trusted identity, the SDK-returned replacement
204
+ alias becomes the adapter default for new sessions. The retained old alias and the new alias both
205
+ remain visible through `connections list` and user-selectable through `connections use`; existing
206
+ DSH sessions remain pinned as described below.
207
+
208
+ Multi-connection add/use/remove is exposed only through the `/bailinghub connections` user
209
+ command. It is never registered as a model tool. Selecting a connection changes defaults for new
210
+ Agent sessions only; existing states keep their captured connection and workspace. Removing a
211
+ connection is rejected while any run is active or has an unsynchronized completion. The SDK then
212
+ revokes only that instance's remote Agent Session before removing its local credentials and
213
+ registry metadata; a revoke failure preserves both. Repeating add with the same name and public
214
+ binding selects the existing instance; reusing a name for different public metadata fails.
215
+ `connectionName` remains a local user selector and never becomes a trusted identity claim.
216
+
217
+ After a successful remove, the adapter reads the registry again. A valid remaining
218
+ `currentConnectionKey` replaces all four public defaults for future sessions, using the key itself
219
+ when the profile has no alias; no remaining connection sets the adapter to unconfigured. A refresh
220
+ failure does not change the successful remove result. It makes a removed default unavailable, but
221
+ does not invalidate an unchanged non-current default. Existing session state is never rewritten.
222
+
223
+ The four static adapter fields bootstrap SDK construction only. Before the first new Agent session
224
+ or user command after process start, the adapter reads `connectionsList()` and adopts the public
225
+ metadata matching `currentConnectionKey`. Invalid, missing, or unavailable registry data leaves the
226
+ bootstrap defaults in place and must not remove or block unrelated host tools. The lookup is not a
227
+ model tool, and restoring or later selecting a default never mutates an already-created session.
228
+
229
+ The completion request is restricted to:
230
+
231
+ ```json
232
+ {
233
+ "assistant_message_id": "stable alias",
234
+ "content": "visible final text",
235
+ "status": "completed | failed | cancelled",
236
+ "model": "optional",
237
+ "runtime": "optional",
238
+ "usage": {}
239
+ }
240
+ ```
241
+
242
+ The adapter supplies the camelCase SDK equivalent. It never passes an event, message object,
243
+ reasoning block, DSH end-reason object, or arbitrary host metadata. The payload is frozen before
244
+ the first attempt and reused unchanged for up to three automatic attempts. A failed completion
245
+ remains pending in its original run; `/bailinghub sync` starts another bounded attempt batch with
246
+ that same id and payload.
247
+
248
+ The verified DSH releases report disjoint camelCase buckets (`inputTokens`, `cacheReadTokens`,
249
+ optional `cacheWriteTokens`, and `outputTokens`) on each durable `assistant/message`. The adapter sums them
250
+ across model steps, exposes total input as Core `input_tokens`, cache reads as the
251
+ `cached_input_tokens` subset, and derives `total_tokens` without adding `reasoningTokens` a second
252
+ time. Unknown, non-finite, and negative metrics are discarded; only the Core public usage
253
+ allowlist can leave the host.
254
+
255
+ ## Graceful Degradation
256
+
257
+ Missing/invalid configuration, missing SDK, failed authorization, failed Core context, a tool-name
258
+ collision, or unsupported DSH Code Mode removes the Core business tools and inserts a concise
259
+ status section. The local Agent may continue using unrelated local tools, but it is explicitly
260
+ told not to claim a BailingHub business action was executed.
@@ -1,15 +1,97 @@
1
1
  # Compatibility
2
2
 
3
+ ## Native Agent Client 0.3.0
4
+
3
5
  | Component | Verified version |
4
6
  | --- | --- |
7
+ | DeepSeek Harness / Cordis lifecycle | `0.1.0-rc.7`; `0.1.1-rc.2` |
8
+ | Node.js | `22.19.0+` or `24+` |
9
+ | DSH tool presentation | Native Tool Mode |
10
+ | Generic Agent Client SDK | `bailinghub-mcp-server@0.3.0` via `./sdk` |
11
+ | BailingHub Core | `bailinghub@0.5.1`; Agent Auth v1 + Agent Client Runtime v1 |
12
+ | BailingHub turn context | `bailing.agent-turn-context.v1` |
13
+ | BailingHub capability search | `bailing.agent-capability-search.v1` |
14
+ | BailingHub governed invocation | `bailing.agent-tool-invocation.v1` |
15
+ | BailingHub run completion | `bailing.agent-run-completion.v1` |
16
+
17
+ Version 0.3.0 declares `bailinghub-mcp-server@0.3.0` as an exact ordinary dependency. A clean DSH
18
+ profile must work after installing only the plugin; ambient `node_modules`, peer/optional
19
+ dependencies, dist-tags, ranges, and local `file:` paths are outside the supported contract.
20
+ Compatibility with Core 0.5.1 includes the live Agent Auth/Runtime
21
+ contracts from that release.
22
+
23
+ DeepSeek Harness remains a developer preview. Every Harness version change requires a new smoke
24
+ against its real Cordis lifecycle, prompt waterfall, ToolRuntime, commands, durable session events,
25
+ and Web profile installation before this table can change.
26
+
27
+ `/bailinghub doctor` validates the required host API shape at runtime and reports the releases for
28
+ which that shape has been exercised. This is a diagnostic check, not a substitute for the live
29
+ browser authorization, read/write, approval/recovery, trajectory, and revocation gates below.
30
+
31
+ ### Tool-mode and operating-system boundaries
32
+
33
+ - Native Tool Mode is required. DSH Code Mode is deliberately degraded because it cannot safely
34
+ present the current-turn dynamic business schemas in 0.3.0.
35
+ - macOS Agent Session credentials use Keychain.
36
+ - Linux and other POSIX systems require the SDK's explicit secure file-store opt-in; the file must
37
+ remain owned by the current user with mode `0600`.
38
+ - Windows Agent Session credentials use CurrentUser DPAPI. Native package installation, SDK
39
+ resolution, and host lifecycle are Windows CI gates; each deployment must still accept its own
40
+ live browser and business authorization flow.
41
+ - Non-loopback Hub connections require HTTPS. Loopback HTTP is for local development only.
42
+
43
+ ### Host configuration contract
44
+
45
+ The plugin accepts only these four public routing fields:
46
+
47
+ ```text
48
+ hubUrl
49
+ clientAppId
50
+ workspace
51
+ connectionName
52
+ ```
53
+
54
+ In Agent Client v1, `workspace` is the BailingHub route id. Business endpoints, authorization page
55
+ URLs, Client Tokens, Tool Provider signing secrets, business credentials, and model-provider keys
56
+ are not DSH plugin configuration.
57
+
58
+ The public binding is the normalized Hub URL, client app id, and workspace tuple.
59
+ `connectionName` is a user-controlled local selector, not an identity claim. The Hub Client App
60
+ supplies one stable business authorization entry, and the business page
61
+ handles login, account switching, and tenant selection. After authorization, the SDK compares the
62
+ trusted `on_behalf_of` within the same public binding: the same identity replaces the older local
63
+ connection, while different identities remain independent. When a same-alias login returns a
64
+ different identity, the old alias and Session remain intact and the new identity receives a
65
+ non-conflicting alias that becomes current. A cleanup-required result keeps the new connection
66
+ authorized and must be resolved explicitly without another authorization attempt.
67
+
68
+ ## Public legacy 0.1.x
69
+
70
+ | Component | Published version |
71
+ | --- | --- |
5
72
  | DeepSeek Harness | `0.1.0-rc.7` |
6
73
  | DSH MCP Client | in-box version shipped by `0.1.0-rc.7` |
7
- | BailingHub MCP Server | `0.1.1` |
74
+ | BailingHub MCP Server | exactly `0.1.1` |
8
75
  | BailingHub Client API | `bailing.client-api.v1` |
9
76
  | Node.js | `22.19.0+` |
10
77
 
11
- DeepSeek Harness is currently a developer preview. Compatibility with another Harness release
12
- must be rechecked before changing this table or the package's supported range.
78
+ Public `dsh-bailinghub@0.1.1` remains a configuration-only bundle. It starts the exact
79
+ `bailinghub-mcp-server@0.1.1` stdio command, exposes three fixed governed-job tools, and uses one
80
+ operator-configured Hub URL, route-scoped Client Token, and route. It does not establish an Agent
81
+ Session, receive a dynamic capability catalog, or move orchestration into local DSH.
82
+
83
+ The 0.3 line must not mutate the published 0.1 package or reinterpret its configuration. A new
84
+ BailingHub Core release is compatible only after a separate clean legacy profile proves that the
85
+ 0.1.1 `/run` and `/jobs/{job_id}` flow still works.
86
+
87
+ ## Release compatibility rule
88
+
89
+ Compatibility requires independent evidence for both paths:
90
+
91
+ 1. Native 0.3: clean install of only the exact plugin package, browser authorization, workspace
92
+ discovery, same-identity replacement, different-identity isolation, read, permitted mutation,
93
+ approval/resume, visible completion, and Hub trajectory.
94
+ 2. Legacy 0.1.1: clean static profile, fixed Client Token route, one submit, and same-job follow-up
95
+ through the unchanged public Client API.
13
96
 
14
- The bundle uses DSH's in-box `@deepseek-ai/dsh-mcp-client`; it intentionally does not install a
15
- second copy into the profile. The stdio child is pinned to `bailinghub-mcp-server@0.1.1`.
97
+ Passing one path does not establish compatibility for the other.
@@ -0,0 +1,92 @@
1
+ # Get started in three minutes
2
+
3
+ This guide is for someone whose organization has already connected a business system to
4
+ BailingHub. If that integration does not exist yet, the BailingHub administrator and business
5
+ developer must prepare it before an end user installs this plugin.
6
+
7
+ ## What to ask your administrator for
8
+
9
+ Ask for these four public connection values:
10
+
11
+ ```text
12
+ Hub URL
13
+ Client App ID
14
+ Workspace
15
+ Connection Name
16
+ ```
17
+
18
+ They identify the BailingHub application and starting workspace. They are not credentials. Do not
19
+ ask the administrator to send you a Client Token, Tool Provider secret, business password, model
20
+ API key, authorization code, browser session cookie, business URL, or tenant-specific login URL.
21
+
22
+ ## 1. Install the plugin
23
+
24
+ Install the exact public version into the DSH Web profile:
25
+
26
+ ```bash
27
+ dsh plugin --profile web add dsh-bailinghub@0.3.0
28
+ ```
29
+
30
+ The plugin installs the matching BailingHub SDK automatically.
31
+
32
+ ## 2. Enter the four connection values
33
+
34
+ Use the DSH plugin settings page or these environment names:
35
+
36
+ ```bash
37
+ export BAILINGHUB_HUB_URL='https://hub.example.com'
38
+ export BAILINGHUB_CLIENT_APP_ID='example-agent-client'
39
+ export BAILINGHUB_WORKSPACE='employee_assistant'
40
+ export BAILINGHUB_CONNECTION_NAME='default'
41
+ ```
42
+
43
+ The values above are placeholders. Use the public values from your own BailingHub administrator.
44
+ Never paste credentials into the Cordis patch or a chat message.
45
+
46
+ ## 3. Authorize in the browser
47
+
48
+ Start DSH and run:
49
+
50
+ ```text
51
+ /bailinghub login
52
+ /bailinghub status
53
+ /bailinghub workspaces
54
+ ```
55
+
56
+ `login` opens the one business-side authorization entry configured for the Client App. Sign in or
57
+ switch account there, select a tenant there when the business system asks, and check the resulting
58
+ business identity and requested workspace before approving. Authorization uses the business
59
+ system's own login; it does not send the business password or business URL to the plugin.
60
+
61
+ `Connection Name` is only a local selector. If the same trusted business identity authorizes the
62
+ same Hub/client/workspace binding again, the SDK replaces the older local connection. A different
63
+ trusted identity remains separate. When the selected name already belongs to the old identity,
64
+ the SDK preserves it and assigns the new identity an available alias such as `default-2`; the new
65
+ alias becomes current. Run `/bailinghub connections list` to see both and
66
+ `/bailinghub connections use <name-or-key>` to switch. If login says cleanup is required, the new
67
+ connection is already authorized, but an existing connection may still need inspection or
68
+ removal: do not authorize again; list connections and remove the reported old entry.
69
+
70
+ ## 4. Try one safe business request
71
+
72
+ Start a new conversation and ask for one read-only action that the connected system exposes, for
73
+ example:
74
+
75
+ ```text
76
+ Find the demonstration employee EMP-001 and summarize the visible fields.
77
+ ```
78
+
79
+ Then try one reversible permitted update in a dedicated development workspace. The exact requests
80
+ depend on the capabilities your business system has exposed. An operation that requires approval
81
+ must continue through the existing approval flow; an operation outside the current identity's
82
+ permissions must remain unavailable.
83
+
84
+ ## 5. Confirm the result in BailingHub
85
+
86
+ The BailingHub console should show the same visible conversation, Agent Run, governed tool calls,
87
+ approval state, and final result. Do not treat a successful installation alone as proof that a
88
+ business action ran.
89
+
90
+ If setup fails, include the DSH version, plugin version, operating system, the command that failed,
91
+ and redacted error text in a GitHub Issue. Never attach tokens, private URLs, personal information,
92
+ authorization codes, or production payloads.
@@ -0,0 +1,83 @@
1
+ # 三分钟开始使用
2
+
3
+ 这份指南面向业务系统已经接入 BailingHub 的最终用户。如果还没有完成业务接入,需要先由
4
+ BailingHub 管理员和业务开发者准备中枢应用、授权页面与业务能力,再安装本插件。
5
+
6
+ ## 先向管理员获取什么
7
+
8
+ 只需要向管理员获取四项公开连接信息:
9
+
10
+ ```text
11
+ Hub URL
12
+ Client App ID
13
+ Workspace
14
+ Connection Name
15
+ ```
16
+
17
+ 它们用于定位 BailingHub 应用和初始业务空间,不是凭据。不要让管理员把 Client Token、Tool
18
+ Provider 密钥、业务密码、模型 API Key、授权码、浏览器 Cookie、业务地址或租户专属登录地址
19
+ 发给你。
20
+
21
+ ## 第一步:安装插件
22
+
23
+ 把精确公开版本安装到 DSH Web Profile:
24
+
25
+ ```bash
26
+ dsh plugin --profile web add dsh-bailinghub@0.3.0
27
+ ```
28
+
29
+ 插件会自动安装匹配版本的 BailingHub SDK,不需要再手工拼装依赖。
30
+
31
+ ## 第二步:填写四项连接信息
32
+
33
+ 可以在 DSH 插件设置页面填写,也可以使用对应环境变量:
34
+
35
+ ```bash
36
+ export BAILINGHUB_HUB_URL='https://hub.example.com'
37
+ export BAILINGHUB_CLIENT_APP_ID='example-agent-client'
38
+ export BAILINGHUB_WORKSPACE='employee_assistant'
39
+ export BAILINGHUB_CONNECTION_NAME='default'
40
+ ```
41
+
42
+ 上面都是占位值,请替换成自己中枢管理员提供的公开信息。不要把凭据写进 Cordis Patch,也不要
43
+ 把凭据粘贴到聊天消息里。
44
+
45
+ ## 第三步:在浏览器完成授权
46
+
47
+ 启动 DSH 后依次执行:
48
+
49
+ ```text
50
+ /bailinghub login
51
+ /bailinghub status
52
+ /bailinghub workspaces
53
+ ```
54
+
55
+ `login` 会打开 Client App 配置的唯一业务授权入口。在该页面登录或切换账号,并在业务系统要求
56
+ 时选择租户;点击同意前,确认页面显示的最终业务身份和准备使用的 workspace。整个过程沿用业务
57
+ 系统自己的登录流程,不会把业务密码或业务地址交给插件。
58
+
59
+ `Connection Name` 只是本机选择器。同一可信业务身份再次授权同一 Hub/client/workspace 绑定时,
60
+ SDK 会覆盖旧的本机连接;不同可信身份继续相互独立。如果当前名称已经属于旧身份,SDK 会保留
61
+ 它,并给新身份分配一个可用名称(例如 `default-2`),同时把新名称设为当前连接。使用
62
+ `/bailinghub connections list` 可以查看两者,再用
63
+ `/bailinghub connections use <名称或连接键>` 显式切换。如果登录提示需要清理,新连接其实已经
64
+ 授权成功,但某个旧连接可能仍需检查或删除:不要再次授权,应先列出连接,再删除提示的旧连接。
65
+
66
+ ## 第四步:尝试一条安全的业务请求
67
+
68
+ 新建一个会话,先尝试业务系统已经开放的一条只读请求,例如:
69
+
70
+ ```text
71
+ 查询演示员工 EMP-001,并汇总我能看到的资料。
72
+ ```
73
+
74
+ 随后可以在专用开发空间尝试一次可回滚、当前账号允许的修改。实际能问什么,取决于业务系统
75
+ 开放了哪些能力。需要审批的操作必须继续走原有审批,没有权限的操作仍然不可用。
76
+
77
+ ## 第五步:在 BailingHub 查看结果
78
+
79
+ BailingHub 控制台应当能看到同一条可见会话、Agent Run、业务工具调用、审批状态与最终结果。
80
+ 只有插件安装成功,还不能证明业务操作已经真正完成。
81
+
82
+ 如果初始化失败,请在 GitHub Issue 中提供 DSH 版本、插件版本、操作系统、失败命令和脱敏错误。
83
+ 不要附带 Token、私有地址、个人信息、授权码或生产业务载荷。
@@ -0,0 +1,128 @@
1
+ # Migration Boundary: Public 0.1.x to the Native Agent Client
2
+
3
+ There is no automatic credential, configuration, tool, or orchestration migration from public
4
+ `dsh-bailinghub@0.1.x` to the native 0.3 Agent Client.
5
+
6
+ ## What remains unchanged
7
+
8
+ Public `dsh-bailinghub@0.1.1` is immutable. It remains a configuration-only DSH Bundle that starts
9
+ `bailinghub-mcp-server@0.1.1` through the in-box MCP client and exposes exactly:
10
+
11
+ ```text
12
+ mcp__bailinghub__submit_governed_job
13
+ mcp__bailinghub__get_governed_job
14
+ mcp__bailinghub__wait_for_governed_job
15
+ ```
16
+
17
+ The operator supplies one Hub URL, route-scoped Client Token, and fixed route. BailingHub performs
18
+ the orchestration. Local DSH does not obtain a trusted Agent Session or dynamic capability catalog.
19
+
20
+ The retained [legacy patch](../cordis.patch.yml) documents that historical meaning. It is not
21
+ selected by the current native package metadata, and its presence is not a dual-mode switch.
22
+
23
+ ## What changed in 0.2
24
+
25
+ | Concern | Public 0.1.1 | Native 0.2 and later |
26
+ | --- | --- | --- |
27
+ | DSH integration | in-box MCP client | native Cordis host adapter |
28
+ | Core unit | governed job | conversation, run, and governed invocation |
29
+ | Authentication | operator Client Token | end-user browser authorization with PKCE |
30
+ | Tool surface | three fixed job tools | current-turn typed tools plus search/resume |
31
+ | Reasoning/orchestration | BailingHub route | local DSH Agent |
32
+ | Business identity | not established by DSH | Agent Session approved through the business boundary |
33
+ | Hub audit | job records | conversation, run, completion, and invocation trajectory |
34
+
35
+ ## What 0.3 adds
36
+
37
+ Version 0.3 keeps the same native boundary and adds stable named multi-connection lifecycle,
38
+ same-binding trusted-identity reconciliation, and Windows CurrentUser DPAPI credential storage.
39
+ It does not reinterpret or migrate the public 0.1.x Client Token path.
40
+
41
+ The new plugin config is limited to `hubUrl`, `clientAppId`, `workspace`, and `connectionName`.
42
+ The old `BAILINGHUB_CLIENT_TOKEN` is not read, copied, exchanged, or converted into an Agent
43
+ Session. Browser authorization creates a new independently revocable credential in SDK-owned
44
+ secure storage. The plugin does not accept a business URL: the Hub Client App resolves to one
45
+ stable, account- and tenant-neutral business authorization entry, where the user can log in,
46
+ switch account, and select a tenant.
47
+
48
+ ## Safe evaluation before migration
49
+
50
+ Do not replace a working production profile merely to evaluate 0.3.0. Use a separate DSH home or
51
+ another isolated Web profile and verify that the CLI really honors that location. Stable public
52
+ `0.3.0` creates a separate credential for each name registered through
53
+ `connections add` while authorization is pending. After authorization, the SDK replaces an older
54
+ same-binding connection when its trusted `on_behalf_of` is the same; different trusted identities
55
+ remain independent. A different identity returned from a same-alias login keeps the original
56
+ alias and Session and receives a non-conflicting alias that becomes current. Use the exact matching
57
+ SDK installed by the DSH package when evaluating that behavior.
58
+
59
+ 1. Keep the existing `0.1.1` profile and its legacy environment unchanged.
60
+ 2. Install the exact released 0.3 package into an isolated profile.
61
+ 3. Configure only the four public native fields using neutral values for dry composition.
62
+ 4. Run `/bailinghub login` and approve a dedicated non-production client app/workspace whose
63
+ credential can be revoked without affecting a maintainer's existing profile.
64
+ 5. Verify status, workspace discovery, one read, one permitted mutation, approval/resume, and Hub
65
+ trajectory.
66
+ 6. Separately re-run the `0.1.1` submit and same-job follow-up against the newly released Core.
67
+
68
+ Passing the native path does not prove legacy compatibility, and passing the legacy path does not
69
+ prove the native Agent Client.
70
+
71
+ ## Moving a profile to 0.3
72
+
73
+ Only after the isolated acceptance passes:
74
+
75
+ 1. Record the exact old plugin, DSH, MCP, and Core versions without copying credentials into the
76
+ migration record.
77
+ 2. Finish or cancel outstanding legacy jobs. A wait timeout is not a terminal failure.
78
+ 3. Install the exact accepted 0.3 plugin version. Do not use an unpinned dist-tag.
79
+ 4. Replace the legacy plugin configuration with the four native fields. Remove the old Client
80
+ Token from that process environment after confirming no remaining 0.1 integration uses it.
81
+ 5. Start DSH, run `/bailinghub login`, use the business page to log in or switch account and select
82
+ a tenant if required, then authorize the intended workspace.
83
+ 6. Run `/bailinghub status`, open a new conversation, and repeat the accepted read/mutation checks.
84
+ 7. Confirm BailingHub receives visible conversation and invocation audit without hidden reasoning.
85
+
86
+ The developer or deployer supplies the Hub URL, public client app id, and initial workspace/route.
87
+ The end user completes browser authorization. Neither role supplies a business API secret or model
88
+ key to this plugin.
89
+
90
+ ## Rollback
91
+
92
+ Rollback is explicit; it does not convert the Agent Session back into a Client Token.
93
+
94
+ Before downgrading a 0.3 profile to 0.2, first use the installed 0.3 plugin to finish active runs
95
+ and remove every named instance through `/bailinghub connections remove <name>`. The SDK returns
96
+ the registry to schema v1 after the last such instance is removed. Stable `0.2.0` fails closed on
97
+ schema v2; do not manually delete the registry, Keychain entry, DPAPI ciphertext, or secure file
98
+ credentials as a downgrade shortcut.
99
+
100
+ 1. Finish active native runs and use `/bailinghub sync` for any known pending completion.
101
+ 2. Run `/bailinghub logout` if the new Agent Session should be revoked.
102
+ 3. Reinstall exact `dsh-bailinghub@0.1.1` in the target profile.
103
+ 4. Restore the separately retained legacy Hub URL, route-scoped Client Token, and route through the
104
+ original `BAILINGHUB_BASE_URL`, `BAILINGHUB_CLIENT_TOKEN`, and `BAILINGHUB_ROUTE` environment
105
+ names.
106
+ 5. Verify the three fixed MCP tools and follow one stable `request_id`/`job_id` flow to terminal
107
+ state without resubmission.
108
+
109
+ Do not delete SDK credential files or Keychain entries manually as a substitute for logout. Do not
110
+ reuse, move, or republish an npm version or Git tag as a rollback mechanism.
111
+
112
+ ## Release gates
113
+
114
+ Before any public 0.3 release:
115
+
116
+ 1. The matching BailingHub Core Agent Auth/Agent API contracts are released.
117
+ 2. The exact `bailinghub-mcp-server/sdk` version is publicly installable and has passed DTO,
118
+ credential, invoke/resume, and completion tests.
119
+ 3. Installing only `dsh-bailinghub` into a clean DSH `0.1.1-rc.2` profile installs and resolves that
120
+ exact SDK dependency automatically.
121
+ 4. Browser login, session isolation, dynamic tool replacement, approval recovery, visible
122
+ completion, same-identity replacement, different-identity isolation, and Hub trajectory pass
123
+ from the packaged artifact.
124
+ 5. Public `0.1.1` still works against the new Core through the unchanged Client API.
125
+ 6. The maintainer explicitly selects the public version and migration story.
126
+
127
+ Do not tag or publish a future 0.3.x version until all gates pass, and do not describe release
128
+ validation as public adoption.