dsh-bailinghub 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,242 +2,183 @@
2
2
 
3
3
  [简体中文](docs/README.zh-CN.md) | English
4
4
 
5
- Use your local DeepSeek Harness Agent to operate the admin side of an online store, SaaS product,
6
- or other business system through BailingHub. Ask it to look up data, update records, or run other
7
- actions available to the connected account. The existing business identity, permissions, and
8
- approval rules still apply, and BailingHub keeps the authorization and action trail.
5
+ Ask your local DeepSeek Harness Agent to work with a business system connected to BailingHub:
6
+ find records, update allowed fields, and follow the system's existing approval rules.
7
+ BailingHub records which authorization was used and what each business action returned.
9
8
 
10
- For example, depending on what the connected business system has exposed, you can ask the local
11
- Agent to:
9
+ **Version 0.5.0 lets one conversation use authorizations from different systems on the same Hub.**
10
+ Authorize a shop and inventory system separately, select both for a new conversation and ask:
12
11
 
13
- - find an order, customer, product, or employee record;
14
- - update an allowed field or business status;
15
- - run another permitted admin action;
16
- - return the result while BailingHub records the corresponding tool steps.
12
+ > Check tumbler stock. If any are available, change the corresponding shop product's price to 59
13
+ > and list it; otherwise leave it unlisted.
17
14
 
18
- Reasoning and tool orchestration stay in DSH. BailingHub supplies the authorized business context,
19
- available capabilities, approval state, invocation recovery, and audit records required for the
20
- local Agent to act safely.
15
+ The Agent reads stock with the inventory authorization, then uses the shop authorization for the
16
+ permitted price and listing actions. Those capabilities must already exist, and the product mapping
17
+ must be confirmed. A stock read does not reserve or synchronize stock. Price changes, listing
18
+ results and approvals are tracked separately.
21
19
 
22
- This is an independent community integration. It is not developed, certified, endorsed, or
23
- recommended by DeepSeek.
24
-
25
- > **Current stable line:** `dsh-bailinghub@0.3.0` uses the native Agent Client flow documented
26
- > below. Public `0.1.1` remains available only as the explicit static MCP compatibility path.
27
-
28
- For the shortest end-user path, follow the [three-minute getting started guide](docs/GETTING_STARTED.md).
29
-
30
- ## How the 0.3 Agent Client fits together
31
-
32
- ```text
33
- DeepSeek Harness local Agent
34
- -> dsh-bailinghub native Cordis adapter
35
- -> bailinghub-mcp-server/sdk
36
- -> BailingHub Agent Auth + Agent API
37
- -> operator-selected business integration and final authorization
38
- ```
39
-
40
- The packages have separate responsibilities:
41
-
42
- - **BailingHub Core** owns Agent Auth, trusted business identity, runtime context, knowledge and
43
- memory projection, capability governance, approvals, invocation state, and audit records.
44
- - **`bailinghub-mcp-server/sdk`** owns browser login, PKCE, credential storage, refresh,
45
- Hub/client/workspace connection selection, and HTTP DTO mapping.
46
- - **`dsh-bailinghub`** owns only DSH session, prompt, command, and dynamic-tool lifecycle
47
- integration. It does not store credentials or call a business API directly.
48
-
49
- This Agent Client is not the BailingHub executor. The executor receives jobs from the Hub for
50
- work that must run near a machine; the Agent Client keeps the interactive reasoning loop on the
51
- user's local DSH Agent.
52
-
53
- ## Before installing
54
-
55
- The deployer and business integrator must prepare these public identifiers in BailingHub:
56
-
57
- 1. A reachable HTTPS BailingHub deployment with the matching Agent Auth and Agent API contracts.
58
- 2. A public Agent Client application id (`clientAppId`).
59
- 3. At least one authorized workspace. In Agent Client v1, the workspace id is the BailingHub
60
- route id.
61
- 4. One stable, account- and tenant-neutral business authorization entry configured on the Hub
62
- Client App, plus a governed ACC/Tool Provider integration behind that route. The business page
63
- must handle sign-in, account switching, and tenant selection before it approves the request.
64
-
65
- The end user does **not** enter a business API URL, business login credential, Tool Provider
66
- signing secret, BailingHub Client Token, or model-provider key into this plugin.
20
+ The 0.4.0 same-system flow remains available: select Store A and Store B to compare sales without
21
+ switching a global connection. New system descriptions explain each selected system's purpose
22
+ before tool search, and business-supplied names identify the approved organization, account or
23
+ other subject. See [what changed and how to upgrade](docs/RELEASE_NOTES_v0.5.0.md).
67
24
 
68
- ## Install the 0.3 line
25
+ It also keeps the visible conversation together with links to its business actions. If uploading
26
+ that record fails, it can retry after reconnecting or restarting without repeating those actions.
69
27
 
70
- Prerequisites:
28
+ This is an independent community integration, not a plugin developed, certified, endorsed, or
29
+ recommended by DeepSeek.
71
30
 
72
- - Node.js `22.19.0+` or `24+`;
73
- - `pnpm` and a DeepSeek Harness release listed in the compatibility matrix;
74
- - the BailingHub preparation above.
31
+ ## Install and start
75
32
 
76
- Install the exact stable version into the DSH Web profile:
33
+ You need Node.js `22.19.0+` or `24+`, pnpm, and a compatible DeepSeek Harness release. Your
34
+ administrator must first connect the business system to BailingHub. The matched release set is
35
+ **BailingHub Core 0.7.0 → BailingHub MCP/SDK 0.5.0 → this plugin 0.5.0**.
77
36
 
78
37
  ```bash
79
38
  npm install --global pnpm @deepseek-ai/dsh@0.1.1-rc.2
80
- dsh plugin --profile web add dsh-bailinghub@0.3.0
39
+ dsh plugin --profile web add dsh-bailinghub@0.5.0
81
40
  ```
82
41
 
83
- `dsh-bailinghub@0.3.0` installs its exact compatible `bailinghub-mcp-server@0.3.0` dependency
84
- automatically. DSH users should not separately guess or install an SDK version.
42
+ The plugin installs its exact `bailinghub-mcp-server@0.5.0` dependency automatically.
43
+ For an existing installation, read the [migration steps from 0.4.0 and earlier](docs/MIGRATION_VNEXT.md).
85
44
 
86
- ## Configure one Hub connection
45
+ Follow the [getting started guide](docs/GETTING_STARTED.md) to enter your administrator's four
46
+ public connection values and authorize in the browser. Do not put a business password, Client
47
+ Token, signing secret, or model-provider key into this plugin's settings or chat.
87
48
 
88
- The native plugin has exactly four host configuration fields:
49
+ ## Choose the accounts for each conversation
89
50
 
90
- | Plugin field | Environment value | Meaning | Secret |
91
- | --- | --- | --- | --- |
92
- | `hubUrl` | `BAILINGHUB_HUB_URL` | Public HTTPS URL of the developer's own BailingHub | No |
93
- | `clientAppId` | `BAILINGHUB_CLIENT_APP_ID` | Public Agent Client application id registered in that Hub | No |
94
- | `workspace` | `BAILINGHUB_WORKSPACE` | Initial authorized workspace/route id | No |
95
- | `connectionName` | `BAILINGHUB_CONNECTION_NAME` | User-selected local connection label | No |
51
+ Authorize each account separately through its original business authorization page and verify the
52
+ approved subject. A compatible business backend supplies its display name automatically, such as
53
+ “Brand flagship store” or “Main warehouse”. A missing name is shown as “Authorization name pending
54
+ sync”; the plugin does not guess it from a local alias.
96
55
 
97
- Example placeholders:
56
+ Names are for display only. Duplicate names and renames do not merge or recreate credentials,
57
+ change an original Session, or rewrite history. Keep the local connection selector and fixed key
58
+ independent from both the current business name and the system description.
98
59
 
99
- ```bash
100
- export BAILINGHUB_HUB_URL='https://hub.example.com'
101
- export BAILINGHUB_CLIENT_APP_ID='example-agent-client'
102
- export BAILINGHUB_WORKSPACE='order_assistant'
103
- export BAILINGHUB_CONNECTION_NAME='default'
60
+ In a **new conversation, before the first message**, run:
61
+
62
+ ```text
63
+ /bailinghub connections list
64
+ /bailinghub scope set <shop-connection-key> <inventory-connection-key>
65
+ /bailinghub scope
104
66
  ```
105
67
 
106
- The same four fields may be supplied through the DSH plugin settings surface. Do not add tokens,
107
- authorization URLs, business domains, or credentials to the Cordis patch. The Hub resolves the
108
- Client App to its single business authorization entry. `connectionName` is only a user-controlled
109
- local selector; it is not an account, tenant, or identity claim.
68
+ Replace the placeholders with the fixed keys from the list, not connection names. You can select
69
+ just one account, several accounts in one system, or several systems on the same Hub and audit
70
+ domain. Each selected target must have its own original Agent Session.
71
+ Wait for the command to confirm the selection, then send your request.
110
72
 
111
- Inspect the composed profile before starting it:
73
+ **New conversations start as ordinary chat until you select their business scope.** Logging in or
74
+ changing the default connection does not enable business tools. `/bailinghub scope none` explicitly
75
+ chooses ordinary chat. The first user message freezes the selection; start a new conversation to
76
+ change accounts or move from ordinary chat to business access.
112
77
 
113
- ```bash
114
- dsh --profile web --dump-config
115
- dsh web
116
- ```
78
+ Matching tools within one system are shared; same-named tools from different systems remain
79
+ separate. The Agent chooses the authorization for each call; it does not receive credentials. Every action still uses that account's own permissions and
80
+ approval rules. An approval-required action continues the original call after approval while that
81
+ conversation is still running.
82
+
83
+ If any selected authorization is revoked, replaced, or cannot be checked, business access pauses
84
+ for the whole conversation. The plugin never silently switches to another account. A temporary
85
+ connection failure can be retried with the same original selection after the network returns.
86
+ A confirmed revocation or identity change requires a new conversation with a valid selection.
117
87
 
118
- ## Authorize and use the local Agent
88
+ ## Follow the conversation and its actions
119
89
 
120
- In DSH, run:
90
+ With Core 0.7.0 and SDK 0.5.0, BailingHub can show the visible user and assistant messages, turn
91
+ boundaries, and links to the original business runs as one conversation record. Each authorization
92
+ also keeps its own business-call record; the combined reply is not copied into every account's
93
+ memory.
121
94
 
122
95
  ```text
123
- /bailinghub login
124
- /bailinghub doctor
125
- /bailinghub status
126
- /bailinghub workspaces
96
+ /bailinghub archive status
97
+ /bailinghub archive sync
127
98
  ```
128
99
 
129
- `login` opens the system browser at the single business authorization entry configured by the Hub
130
- operator. That business page owns sign-in, account switching, and tenant selection, confirms the
131
- resulting business identity and requested workspace, then returns to a random loopback callback
132
- protected by `state` and PKCE S256. Access and refresh tokens remain in SDK-owned secure storage
133
- and are never written to the plugin configuration or printed by the command.
100
+ `archive status` shows whether the visible record has uploaded. `archive sync` retries the saved
101
+ record without running the business actions again. This is separate from `/bailinghub sync`,
102
+ which retries a pending run completion in the currently running conversation.
134
103
 
135
- Useful commands:
104
+ | Status | What it means |
105
+ | --- | --- |
106
+ | `synced` | Saved events have been acknowledged by the Hub; this does not prove a business action succeeded |
107
+ | `pending` | Upload is unfinished; retry when the connection is available |
108
+ | `blocked` | Original authorization checks prevent upload; inspect `/bailinghub scope` |
109
+ | `unsupported` | The connected SDK or Hub does not support this archive contract |
110
+ | `storage_error` | A local write failed; some visible events may not yet be safely saved |
111
+ | `recovery_gap` | Available DSH history shows missing archive events; the record is incomplete |
112
+
113
+ Reopening a saved business conversation restores its original selected accounts only after every
114
+ original authorization is checked. If it was reopened offline, reconnect and run
115
+ `/bailinghub archive sync` or `/bailinghub scope` in that same conversation to retry the check.
116
+ This recovers scope and saved uploads, **not pending business invocations or approvals after a
117
+ process restart**. A saved draft that never started needs explicit selection again. An older
118
+ started conversation without a valid saved scope cannot adopt today's default account.
119
+
120
+ ## What is shared and stored
121
+
122
+ All selected accounts' context and your visible user request share the same local Agent/model
123
+ conversation. The combined archive requires the full selected authorization set; an authorization
124
+ for only one member is not sufficient to read the mixed conversation. Use separate conversations
125
+ when those accounts' data must remain separate.
126
+
127
+ The plugin captures visible text from business turns enabled with this version, not all past
128
+ conversations, attachments, or hidden reasoning. It cannot remove arbitrary secrets pasted into
129
+ visible text. Missing local writes are reported as gaps when detectable; hosts without durable
130
+ history report unverified coverage.
131
+
132
+ The private local outbox contains **plaintext visible task text**, including events already
133
+ uploaded. It stays under the DSH home until the host/operator removes it; there is no automatic
134
+ retention cleanup. Removing it does not delete the Hub's record. Credentials remain in SDK-owned
135
+ secure storage. Review [Privacy](PRIVACY.md) and [Security](SECURITY.md) before enabling business
136
+ access.
137
+
138
+ ## Commands and administration
136
139
 
137
140
  | Command | Purpose |
138
141
  | --- | --- |
139
- | `/bailinghub doctor` | Check host APIs, public configuration, SDK resolution, authorization, and workspace reachability without printing credentials |
140
- | `/bailinghub connections list` | List local public connection metadata and authorization state without tokens |
141
- | `/bailinghub connections add <name> <hub-url> <client-app-id> <workspace>` | Create and select another local connection instance for new sessions; the public binding may match an existing instance |
142
- | `/bailinghub connections use <name-or-key>` | Select a registered connection for new sessions only |
143
- | `/bailinghub connections remove <name-or-key>` | Remotely revoke its Agent Session, then remove its local credential and metadata |
144
- | `/bailinghub login` | Authorize the configured Hub/client/workspace in the browser |
145
- | `/bailinghub status` | Inspect the selected connection without printing credentials |
146
- | `/bailinghub workspaces` | List workspaces allowed by the current business authorization |
147
- | `/bailinghub use <workspace>` | Select another already-authorized workspace for new sessions |
148
- | `/bailinghub sync` | Retry a pending visible completion record without repeating a tool call |
142
+ | `/bailinghub doctor` | Check setup, SDK, authorization, and workspace without printing credentials |
143
+ | `/bailinghub login` | Authorize the selected connection in the browser |
144
+ | `/bailinghub status` | Inspect that connection's authorization |
145
+ | `/bailinghub connections list` | List connection labels, fixed keys, and authorization state |
146
+ | `/bailinghub connections add <name> <hub-url> <client-app-id> <workspace>` | Register a connection and select it for connection management; quote names containing spaces |
147
+ | `/bailinghub connections use <name-or-key>` | Choose which connection to manage or authorize; does not change a conversation's scope |
148
+ | `/bailinghub connections remove <name-or-key>` | Revoke its Agent Session before removing local credentials |
149
+ | `/bailinghub workspaces` | List workspaces allowed by the current authorization |
150
+ | `/bailinghub use <workspace>` | Select another already-authorized workspace for connection management |
149
151
  | `/bailinghub logout` | Revoke and remove the selected Agent Session |
150
152
 
151
- The four plugin fields are the bootstrap connection. Additional connections can be registered with
152
- `connections add`; the BailingHub console's Agent Client page can generate the same secret-free
153
- command. On restart, the adapter reads the SDK registry before the first new Agent session or user
154
- command and adopts its current connection's public metadata; a missing or unavailable registry
155
- safely falls back to the four bootstrap fields. Quote a connection name when it contains spaces.
156
- After `connections use`, run `/bailinghub login` if that binding is not authorized yet.
157
-
158
- Connection selection is a user-only slash command and is never exposed as a model tool. It affects
159
- only Agent sessions created afterward; existing sessions remain pinned to their original
160
- connection and workspace. `/bailinghub use <workspace>` remains a different operation: it succeeds
161
- only when the current Agent Session already authorizes that workspace.
162
-
163
- After removing the selected connection, the adapter reads the SDK registry and adopts the remaining
164
- current connection for new sessions, including connections without an alias. Removing the final
165
- connection leaves the adapter explicitly unconfigured. A failed post-remove registry read never
166
- turns a successful removal into an error; removing a non-current connection also preserves the
167
- still-valid default when that refresh is unavailable.
168
-
169
- For the same `Hub + clientAppId + workspace` public binding, browser authorization determines the
170
- identity from the business page and its trusted `on_behalf_of` result. If that identity is already
171
- authorized under another local connection name, the SDK replaces the older local connection and
172
- revokes its old Agent Session. A different trusted identity remains an independent connection.
173
- If login starts from a `connectionName` that already belongs to another identity, the SDK keeps
174
- that original alias and Session, gives the newly authorized identity an available local alias such
175
- as `default-2`, and selects the new alias for future sessions. Use `connections list` to see both
176
- and `connections use <name-or-key>` to switch explicitly.
177
- If login returns `cleanupRequired: true`, the newly selected connection is still authorized, but
178
- one or more existing same-binding connections need explicit cleanup. Their identity may still be
179
- unconfirmed when inspection was deferred. Do not authorize again; inspect
180
- `connections list` and retry `/bailinghub connections remove <name-or-key>` for the reported old
181
- entry.
182
-
183
- For the first acceptance check, start a new DSH conversation and perform one read-only request,
184
- then one permitted mutation. Confirm the same conversation, run, visible final answer, and tool
185
- invocation trajectory appear in BailingHub. An approval-required capability must resume the
186
- original invocation after approval; it must never create a replacement business call.
187
-
188
- DSH Code Mode is deliberately degraded in this release because it cannot safely present the
189
- current-turn dynamic schemas. Use native tool mode for governed business actions.
190
-
191
- ## Security and privacy boundary
192
-
193
- - The model cannot choose a Hub URL, workspace, local connection, business identity, credential,
194
- approval result, or capability revision through tool arguments.
195
- - The SDK stores credentials in macOS Keychain. On Windows it protects credential files under
196
- LocalAppData with CurrentUser DPAPI; unavailable Windows PowerShell or DPAPI fails closed without
197
- a plaintext fallback. Linux and other POSIX systems require an explicit secure file-store opt-in.
198
- - BailingHub revalidates identity, scope, approval, idempotency, and invocation state on every
199
- governed call. The downstream business system still performs final authorization.
200
- - The adapter sends visible user input, governed tool arguments/results, and the visible final
201
- answer required by the Agent Client contracts. It never uploads hidden reasoning chunks.
202
- - This plugin governs only the BailingHub tools it registers. It does not intercept unrelated DSH
203
- tools or model-provider traffic.
204
-
205
- Review [Security](SECURITY.md), [Privacy](PRIVACY.md), the
206
- [Agent Client contract](docs/AGENT_CLIENT_CONTRACT.md), and
207
- [compatibility](docs/COMPATIBILITY.md) before production use.
208
-
209
- ## Legacy public 0.1.x static mode
210
-
211
- Public `dsh-bailinghub@0.1.1` remains an immutable configuration-only bundle. It uses the in-box
212
- DSH MCP Client to start `bailinghub-mcp-server@0.1.1`, binds one operator-provisioned Client Token
213
- to one fixed route, and leaves orchestration in BailingHub.
214
-
215
- ```bash
216
- dsh plugin --profile web add dsh-bailinghub@0.1.1
153
+ Connection management and scope selection are user commands, not model tools. Reauthorizing the
154
+ same trusted identity replaces its old connection and Agent Session. A different identity remains
155
+ independent. If login reports cleanup required, the new connection is already authorized: inspect
156
+ the listed old entry and retry its removal, rather than authorizing again. Details are in the
157
+ [host contract](docs/AGENT_CLIENT_CONTRACT.md#browser-identity-and-local-reconciliation).
217
158
 
218
- export BAILINGHUB_BASE_URL='https://hub.example.com'
219
- export BAILINGHUB_CLIENT_TOKEN='replace-with-a-route-scoped-client-token'
220
- export BAILINGHUB_ROUTE='order_assistant'
221
- ```
159
+ ## For integrators
222
160
 
223
- It exposes exactly these three tools:
161
+ DSH owns reasoning and tool orchestration. BailingHub Core owns trusted identity, governance,
162
+ approvals, invocation state, and audit. The SDK owns browser authorization, secure credentials,
163
+ and HTTP mapping. This plugin only adapts DSH sessions, prompts, commands, tools, and visible events;
164
+ it does not call your business API directly or govern unrelated DSH tools.
224
165
 
225
- ```text
226
- mcp__bailinghub__submit_governed_job
227
- mcp__bailinghub__get_governed_job
228
- mcp__bailinghub__wait_for_governed_job
229
- ```
166
+ Existing business integrations continue exposing the same capabilities and authorizing each
167
+ identity separately. Custom DSH hosts must implement the [scope selection and restore APIs](docs/AGENT_CLIENT_CONTRACT.md#host-owned-session-scope-api)
168
+ and display confirmation before the first message. The native slash commands already use those
169
+ APIs. Tool envelopes, persistence, event schemas, and recovery limits are documented in the
170
+ [Agent Client contract](docs/AGENT_CLIENT_CONTRACT.md).
230
171
 
231
- The 0.3 Agent Client does not automatically consume or migrate the 0.1 Client Token. Keep versions
232
- explicit and follow the [0.1-to-0.3 migration boundary](docs/MIGRATION_VNEXT.md) when testing or
233
- rolling back.
172
+ Use Native Tool Mode. DSH Code Mode is deliberately degraded because it cannot safely present the
173
+ current-turn dynamic schemas. See the [compatibility matrix](docs/COMPATIBILITY.md).
234
174
 
235
- ## Compatibility and feedback
175
+ ## Legacy 0.1.1 and feedback
236
176
 
237
- Version 0.3.0 is verified only against the versions listed in
238
- [docs/COMPATIBILITY.md](docs/COMPATIBILITY.md). DeepSeek Harness remains a developer preview, so
239
- every Harness release requires a new native lifecycle smoke test.
177
+ Public `dsh-bailinghub@0.1.1` remains the separate static MCP compatibility path. It starts
178
+ `bailinghub-mcp-server@0.1.1`, uses one operator-provided route-scoped Client Token, and leaves
179
+ orchestration in BailingHub. The native plugin does not read or convert that credential. Keep the exact
180
+ legacy version when using that path and follow the [migration guide](docs/MIGRATION_VNEXT.md).
240
181
 
241
- Report problems through [GitHub Issues](https://github.com/bailinghub/bailinghub-dsh-plugin/issues).
242
- Never include tokens, private deployment URLs, personal information, or production business
243
- payloads.
182
+ Report issues at [GitHub Issues](https://github.com/bailinghub/bailinghub-dsh-plugin/issues) with
183
+ versions and redacted errors. Do not include tokens, private URLs, personal data, or production
184
+ payloads. Compatibility tests and package downloads are not evidence of production adoption.
package/SECURITY.md CHANGED
@@ -4,6 +4,39 @@ Report vulnerabilities through a private GitHub Security Advisory in this reposi
4
4
  Do not put tokens, private deployment URLs, personal information, or raw business payloads
5
5
  in a public issue.
6
6
 
7
+ ## Cross-system scope in 0.5.0
8
+
9
+ Different applications/workspaces may participate only through a frozen same-Hub target set,
10
+ with a distinct original Session per target. Capability support must be explicitly negotiated;
11
+ unsupported Core/SDK combinations cannot start cross-system business runs. Each member keeps
12
+ its own app/workspace binding, credential checks, approval rules and original invocations.
13
+ The SDK verifies the full expected binding before target HTTP dispatch, including refresh.
14
+
15
+ Capability search requires an explicit target and sends a model-authored, task-specific query;
16
+ it cannot fan out to all systems by omitting a selector. Identical tool names or schemas in
17
+ different systems do not establish shared semantics. Scoped aliases map back to an immutable
18
+ original capability and an allowed authorization set. The host enforces target membership;
19
+ it does not automatically prove the business meaning of model-generated queries or arguments.
20
+
21
+ All original members must remain valid. Temporary validation failure closes a retryable gate;
22
+ confirmed identity replacement or revocation blocks the complete selection. Cancellation and
23
+ late responses cannot reactivate ended-turn tools. Scope/outbox v2 retains original membership,
24
+ event IDs and CAS; a downgrade cannot reinterpret that state as v1. Full transcript reading
25
+ remains in the Hub's management audit boundary, not an individual member's Agent bearer.
26
+
27
+ ## System descriptions and authorization names
28
+
29
+ System purpose comes from controlled Client/route metadata and is read only for selected original
30
+ bindings before capability search. It is descriptive data, not executable instructions or a grant
31
+ of tools. Business backends supply subject display names for the actual approved identity; names
32
+ remain separate from internal keys, original Sessions and the system description. Only the name
33
+ field is projected, with bounded length, valid Unicode and no control or line-separator characters.
34
+
35
+ A duplicate or changed name cannot merge authorizations, replace scope members or rewrite archived
36
+ labels. SDK display-cache data is auxiliary and cannot validate credentials or mask a scope/archive
37
+ storage error. Missing or unsupported display metadata leaves existing tools unchanged; a confirmed
38
+ identity failure still blocks the complete selection.
39
+
7
40
  ## Public legacy 0.1.x boundary
8
41
 
9
42
  This bundle contributes configuration only. It has no custom runtime JavaScript, production
@@ -19,9 +52,9 @@ configuration and are never model tool arguments.
19
52
 
20
53
  Non-loopback HTTP is denied by default. Do not enable insecure HTTP on an untrusted network.
21
54
 
22
- ## Native 0.3.0 boundary
55
+ ## Native 0.5.0 boundary
23
56
 
24
- The native 0.3.0 plugin accepts only `hubUrl`, `clientAppId`, `workspace`, and
57
+ The native 0.5.0 plugin accepts only `hubUrl`, `clientAppId`, `workspace`, and
25
58
  `connectionName`. The generic SDK owns browser authorization, refresh, and secure credential
26
59
  storage; business endpoints and final authorization remain Core/business-system concerns. The
27
60
  Hub Client App owns one business authorization entry. That business page, not the plugin or model,
@@ -41,7 +74,7 @@ falsely report a complete logout.
41
74
  Tools are Agent/run scoped. Message ids are replaced by Core-safe hash aliases, invocation ids are
42
75
  stable 64-character digests, and an `accepted_unknown` outcome must resume that exact invocation
43
76
  instead of creating a replacement. Completion retries are bounded and reuse one frozen,
44
- visible-only payload. Version 0.3.0 installs `bailinghub-mcp-server@0.3.0` as an exact ordinary
77
+ visible-only payload. Version 0.5.0 installs `bailinghub-mcp-server@0.5.0` as an exact ordinary
45
78
  dependency and resolves its `./sdk` export. It does not depend on ambient modules, an optional
46
79
  peer, a range, a dist-tag, or a local path. Public `0.1.1` does not provide that facade.
47
80
 
@@ -49,3 +82,95 @@ Agent Session credentials use macOS Keychain or Windows CurrentUser DPAPI-protec
49
82
  LocalAppData. Windows PowerShell or DPAPI unavailability fails closed without a plaintext fallback.
50
83
  Linux and other POSIX hosts must explicitly enable the SDK's isolated mode-0600 file store. The
51
84
  plugin never receives the credential value and never writes one into Cordis configuration.
85
+
86
+ ## Same-system authorization selection
87
+
88
+ The same-system path introduced in 0.4.0 lets the model select a session-local `authorization_ref` from the current
89
+ conversation's directory. This is a constrained per-call selector, not a connection-management
90
+ tool or authority to supply a Hub, route, raw connection key, credential, or business identity.
91
+ The host must first explicitly select fixed connection keys for this conversation through
92
+ `setSessionScope` or the user-only `/bailinghub scope set <connection-key>...` command. Aliases are
93
+ not scope keys. Unset scope and `[]` (`/bailinghub scope none`) remain ordinary chat, without
94
+ BailingHub tools or runs. Authorization and registry defaults cannot grant conversation scope.
95
+ The selected bindings must share one Hub/client/workspace; unselected bindings are excluded.
96
+ The adapter never implements selection by changing the SDK's global current connection.
97
+
98
+ Hosts must await successful scope persistence and confirmation before sending the first user
99
+ message. The first `user/message` event freezes scope, with the inbox claim as a fallback, before
100
+ `startTurn`; an in-flight or
101
+ failed selection cannot admit business work. Subsequent changes require a new conversation.
102
+ The full selected group is checked before business input is sent. Any missing, revoked, replaced,
103
+ or unreadable selected authorization pauses the whole conversation's business access. The adapter
104
+ must not silently adopt a default or shrink the scope to the remaining valid authorizations.
105
+
106
+ Local connection names are untrusted display data. They do not prove tenant identity, widen an
107
+ authorization, or replace the business system's final permission checks. The directory is a
108
+ binding snapshot, not a credential snapshot: expired, removed, or revoked access must fail
109
+ without silently selecting another authorization. New authorizations and alias changes require
110
+ a new conversation.
111
+ The host checks the fixed connection key, workspace, and original Agent Session id before
112
+ transport operations. An Agent Session replacement also requires a new conversation, even if
113
+ the local alias or connection key remains unchanged.
114
+
115
+ Matching declarations share one typed tool. Conflicting same-name descriptions, schemas, or
116
+ governance are not merged for execution, and a shared declaration cannot confer another identity's permissions.
117
+ Each invocation binds its chosen authorization, Core run, and capability revision. Recovery
118
+ accepts only an invocation known to this conversation and resolves its original binding; the
119
+ model cannot provide a replacement authorization. Changing a default connection cannot retarget
120
+ an existing call.
121
+ This invocation map lasts only for the live conversation: later turns can recover its original
122
+ calls, while new conversations and process restarts must reject unknown invocation ids.
123
+
124
+ Only non-secret scope metadata belongs in the scope store. Its default file store uses SHA-256 session filenames,
125
+ mode-0600 files and mode-0700 directories on POSIX, bounded reads, rejection of symlinks/non-regular files,
126
+ revision compare-and-swap, a cross-process lock, and atomic replacement. Lock timeout reports a
127
+ conflict without deleting another process's lock. Corrupt data and I/O failure fail closed; they
128
+ are never interpreted as an absent selection or a reason to use memory storage. Before validating
129
+ a replacement scope, the coordinator attempts to persist `needs_selection`. Failure of that first
130
+ write can leave the previous draft on disk. Every unlocked snapshot loaded into a new runtime is
131
+ therefore blocked pending explicit selection, without checking its previous SDK authorizations;
132
+ restart safety does not assume that the failed write replaced the old record.
133
+
134
+ The host may inject a store with the same CAS semantics; the provided memory adapter is explicitly
135
+ non-persistent. `restoreSessionScope` restores only a valid locked selection after verifying its
136
+ keys, binding, and original Agent Session ids. Unlocked drafts require explicit selection again;
137
+ started conversations without valid locked scope stay blocked. History containing only metadata,
138
+ configuration, or seed markers does not prove that a conversation started. The lifecycle check
139
+ requires an actual user-sourced `user/message` or `turn/start` and uses seed/observation boundaries
140
+ to distinguish prior history from a new first message. It restores scope only, not invocations,
141
+ approvals, pending completions, or task execution. A new conversation is required to change an
142
+ already-started scope. No token, credential, prompt, or business payload belongs in the
143
+ scope snapshot.
144
+ The trusted host owns stable, unique conversation ids and the store namespace. Scope APIs and
145
+ records must not be exposed as model-controlled storage or allow an untrusted caller to select
146
+ another conversation's id. This plugin does not secure unrelated host filesystem tools; the host
147
+ must enforce that access boundary.
148
+
149
+ The adapter keeps authorization-specific instructions and context labeled, and each run receives
150
+ only its authorization's deterministic call summary. It does not broadcast a combined final
151
+ answer to every run. Visible user input and context do share the local conversation boundary;
152
+ see [Privacy](PRIVACY.md#same-system-authorization-selection).
153
+
154
+ The independent conversation-audit extension sends visible text for the complete frozen member
155
+ set through an optional SDK API. A durable random archive UUID supplies correlation, not authority:
156
+ the SDK/Core must validate every original member before confirming or appending, and Core owns the
157
+ aggregate read permission. Never expose mixed free text to a reader authorized for only one member
158
+ by assuming it can be safely redacted. The original run id and member Session bind run links;
159
+ archive synchronization cannot create or resume a business action. Late links remain attached to
160
+ their original turn.
161
+
162
+ The separate private outbox contains plaintext visible task text and must be protected from
163
+ untrusted host/model filesystem tools. It has bounded reads, no-follow regular-file checks,
164
+ CAS/lock/atomic-write semantics, and no credential or scope-store fallback. Payloads and ids remain
165
+ stable on ambiguous network retries. Local I/O failure can leave an unpersisted event: available
166
+ DSH history is compared after reopening, and missing events produce `recovery_gap`, not a claim
167
+ of a complete transcript. Hosts without history must show unverified coverage. This boundary is
168
+ not a distributed transaction or durable business-task recovery mechanism.
169
+
170
+ Transient transport failures do not prove that an original authorization was revoked. Scope
171
+ get/restore and archive retry may revalidate all original members on the same runtime, while
172
+ keeping business access and uploads closed until validation succeeds. Concurrent callers share
173
+ that validation. Confirmed revocation/replacement and storage/CAS conflicts remain terminally
174
+ blocked, with no default or subset fallback. The gate is rechecked after asynchronous archive
175
+ capability discovery and outbox opening; a late result cannot erase a confirmed revocation.
176
+ Known local storage errors and capture gaps remain visible even while network or scope checks block upload.