@avernet-plugin/deepseek-harness-channel-bcn 0.1.0 → 0.2.1

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
@@ -3,25 +3,44 @@
3
3
  DeepSeek Harness channel bundle for connecting a DSH Bot to the Avernet Bot
4
4
  Collaboration Network (BCN).
5
5
 
6
+ ## 0.2.1
7
+
8
+ Fix approval and question routing for BCN-owned Agents when the DSH Web UI is
9
+ also enabled. BCN interaction handlers now run before the Web UI fallback, so
10
+ pending requests reach BCN instead of waiting only in the native Web UI.
11
+ Other Agents retain their existing interaction handlers.
12
+
6
13
  ## Compatibility
7
14
 
8
- - DeepSeek Harness baseline: `@deepseek-ai/dsh 0.1.1-rc.2`
9
- - BCN Bot WebSocket protocol: V2
15
+ - DeepSeek Harness declared compatibility: `>=0.2.0-rc.2 <=0.2.1-alpha.2`
16
+ - DeepSeek Harness development/test baseline: `@deepseek-ai/dsh 0.2.1-alpha.2`
17
+ - BCN Bot WebSocket protocol: V3
10
18
  - Node.js: `>=22.19.0`
11
19
 
12
- This release deliberately negotiates BCN V2. Because V2 `session_key` can be
13
- shared by every conversation in a group, the adapter uses the session-scoped
14
- V2 `bcs_group_id` as the DSH identity when present and falls back to
15
- `session_key` only for legacy group frames. A future V3 `bcs_session_id` takes
16
- precedence without changing the rest of the bridge.
20
+ This release requires BCN V3. Every `chat.send` and `chat.inject` must carry the canonical
21
+ `bcs_session_id`; uplink events use the shared Run Event envelope with
22
+ `runId`, `sessionId`, `seq`, and `ts`. The adapter still keeps the historical
23
+ session-key mapping helper for persisted sessions created by older releases.
17
24
 
18
25
  ## Capabilities
19
26
 
20
- - Automatic registration and descriptor onboarding through DSH Credentials
27
+ First-time setup exchanges the human Token through `POST /register`. That
28
+ endpoint creates the Bot and establishes its display name and ownership. On
29
+ restart, the plugin reuses the saved Bot Session and connects directly to
30
+ `/ws/bot`; it does not re-register or require a separate `/bots/onboard` call.
31
+
32
+ Current registration only publishes the Bot name and ownership. The configured
33
+ `summary`, `domains`, `skills`, and `scopes` are not synchronized by this plugin;
34
+ do not rely on these settings for skill-based discovery. Descriptor synchronization
35
+ and propagation of server-side onboarding persistence failures require a separate
36
+ registration contract update. A successful `/register` response currently cannot
37
+ prove that the server persisted its optional descriptor.
38
+
39
+ - Automatic registration and persistent Bot credentials through DSH Credentials
21
40
  - Persistent Bot Session storage through the official `ctx.credentials` seam
22
- - `chat.send` and `chat.inject` downlink handling
41
+ - `chat.send`, `chat.inject`, and exact-run `chat.abort` downlink handling
23
42
  - Isolated DSH Agent/Session reuse for each BCN conversation, including
24
- multiple V2 sessions that share one group-level `session_key`
43
+ multiple sessions that share one group-level `session_key`
25
44
  - DSH Agent preset composition matching Web sessions; new BCN sessions use the
26
45
  configured default preset and resumed sessions restore their recorded preset
27
46
  - Assistant delta, final, error, and aborted uplink events
@@ -31,14 +50,44 @@ precedence without changing the rest of the bridge.
31
50
  - `bcs_route` capture with routing metadata attached to the final chat event
32
51
  - Manager-worker `task.dispatch`, `task.message`, and `task.complete` support
33
52
  - Heartbeat, exponential reconnect, token rotation, and lifecycle cleanup
53
+ - Agent-scoped execution approvals and structured questions through BCN
54
+ `interaction` events and authenticated `interaction.resolve` requests
34
55
 
35
56
  The plugin does not create an OpenClaw-style `.bcs/session.json` file or any
36
57
  other private session directory.
37
58
 
38
- The initial release does not implement `chat.abort` or `chat.history`.
59
+ This release does not implement `chat.history`.
39
60
  Unsupported BCN requests receive the WebSocket client's standard `NOT_FOUND`
40
61
  response, and unsolicited unsupported events are ignored.
41
62
 
63
+ `chat.abort` requires `session_key` (the canonical BCN session ID) and
64
+ `run_id`. It cancels only that run: pending agent creation cannot deliver after
65
+ the abort, queued input is removed by message ID, and active turns use
66
+ `cancel({ kind: 'user' }, { keepInbox: true })`. Other queued runs survive.
67
+ Repeated aborts acknowledge an empty `aborted_run_ids`; unknown runs and
68
+ cross-session requests fail. Terminal events are emitted once.
69
+
70
+ DSH 0.2 uses scoped live events and V4 tool-result messages. This adapter
71
+ subscribes in each owned Agent's setup, reads tool identity from the message's
72
+ top-level `toolCallId`, and never subscribes to replayed history. Assistant
73
+ text is forwarded as deltas after each durable `assistant/message` commit,
74
+ including interrupted prefixes. Failed/retried `assistant/attempt` output and
75
+ raw reasoning are excluded; this deliberately buffers text until a step
76
+ commits because BCN's append-only delta stream cannot retract a failed attempt.
77
+ The scoped `agent/assistant-stream` feed retains only the current attempt's
78
+ visible text so an explicit abort can preserve its partial answer.
79
+ The historical `bcn-v2-*` DSH session IDs remain unchanged. DSH's own storage
80
+ migration handles old session formats; the plugin never rewrites session logs.
81
+
82
+ Execution approvals offer only `allow_once` and `deny`. Question options use
83
+ their DSH labels as wire values; free-text answers return as `custom`.
84
+ Cancellation and unload settle pending waits without granting approval.
85
+ Timed questions attach to DSH's official foreground wait and respect its
86
+ remaining duration. Late answers after that foreground wait closes are not
87
+ accepted by this adapter. Mode-switch interactions are not implemented.
88
+ These hooks are installed only on BCN-owned Agents and do not intercept Web
89
+ sessions or subagents.
90
+
42
91
  BCN messages run in a dedicated in-process DSH Agent created through
43
92
  `ctx.agents.create` or restored through `ctx.agents.resume`; they do not reuse a
44
93
  browser tab's live Agent. The plugin mounts that session's DSH Agent preset
@@ -57,6 +106,9 @@ The manager/worker decision uses only the server-delivered
57
106
  participants, environment variables, or model input. A manager receives its
58
107
  task tools even before workers join the group, but `bcs_assign_task` can only
59
108
  succeed after its `target_bot` resolves to a worker accepted by BCS.
109
+ Task RPCs carry the canonical `group:session` identity in their existing
110
+ `group_id` wire field, which BCS unwraps into group and conversation scope.
111
+ They do not fall back to a shared group's default conversation.
60
112
 
61
113
  With DSH's default `standard` preset the base tool set includes the Bash,
62
114
  filesystem, search, Skills, planning, subagent, and workflow capabilities
@@ -71,13 +123,29 @@ After this package is published, install, configure, and start a DSH profile
71
123
  with the repository installer:
72
124
 
73
125
  ```bash
74
- curl -fsSL https://raw.githubusercontent.com/inclusionAI/Avernet/dev/src/bcs/crates/plugins/deepseek-harness-channel-bcn/install-dsh.sh | \
126
+ curl -fsSL https://raw.githubusercontent.com/inclusionAI/Avernet/dev/apps/bcs/crates/plugins/deepseek-harness-channel-bcn/install-dsh.sh | \
75
127
  BCN_ONBOARDING_TOKEN='<registration-token>' bash -s -- \
76
128
  --endpoint http://127.0.0.1:21000/ \
77
129
  --profile web \
78
130
  --bot-name 'DeepSeek Harness Bot'
79
131
  ```
80
132
 
133
+ The installer first checks whether the `dsh` executable is available. If it is
134
+ missing, it exits without consuming the registration Token and prints the
135
+ matching CLI installation command:
136
+
137
+ ```bash
138
+ npm install --global @deepseek-ai/dsh@0.2.1-alpha.2
139
+ ```
140
+
141
+ Run the generated onboarding command again after installing the CLI. When DSH
142
+ is present, the same command installs this plugin, configures the `web` profile,
143
+ and starts DSH so the plugin can complete onboarding with the injected Token.
144
+ The DSH plugin manager checks the peer compatibility range declared in this
145
+ package (`>=0.2.0-rc.2 <=0.2.1-alpha.2`) before activation. Existing
146
+ `0.1.1-rc.2` installations must be upgraded first. Development dependencies
147
+ remain pinned to `0.2.1-alpha.2` so builds and unit tests remain reproducible.
148
+
81
149
  The registration Token is removed from the package-manager and configuration
82
150
  helper environments and is passed only to the final DSH process. The installer
83
151
  does not print or persist it. If the command is generated by a trusted BCN
@@ -100,7 +168,7 @@ From a checkout, build the package and add its directory to an isolated DSH
100
168
  profile:
101
169
 
102
170
  ```bash
103
- cd src/bcs/crates/plugins/deepseek-harness-channel-bcn
171
+ cd apps/bcs/crates/plugins/deepseek-harness-channel-bcn
104
172
  npm install --ignore-scripts --no-package-lock
105
173
  npm run build
106
174
  dsh plugin --profile bcn-local add "$(pwd)"
@@ -111,13 +179,13 @@ To exercise the exact prebuilt artifact that will be published:
111
179
  ```bash
112
180
  mkdir -p /tmp/dsh-bcn-pack
113
181
  npm pack --pack-destination /tmp/dsh-bcn-pack
114
- dsh plugin --profile bcn-tarball add /tmp/dsh-bcn-pack/avernet-plugin-deepseek-harness-channel-bcn-0.1.0.tgz
182
+ dsh plugin --profile bcn-tarball add /tmp/dsh-bcn-pack/avernet-plugin-deepseek-harness-channel-bcn-0.2.1.tgz
115
183
  ```
116
184
 
117
185
  After publication, the installation command will be:
118
186
 
119
187
  ```bash
120
- dsh plugin --profile <profile> add @avernet-plugin/deepseek-harness-channel-bcn
188
+ dsh plugin --profile <profile> add @avernet-plugin/deepseek-harness-channel-bcn@0.2.1
121
189
  ```
122
190
 
123
191
  The bundle patch adds the plugin in a disabled state, so installing it never
@@ -212,14 +280,14 @@ sends:
212
280
  - assistant-visible text and final routing metadata.
213
281
 
214
282
  Calls to `bcs_assign_task`, `bcs_send_task_message`, and `bcs_task_complete`
215
- use the existing BCN V2 `task.dispatch`, `task.message`, and `task.complete`
283
+ use the existing BCN `task.dispatch`, `task.message`, and `task.complete`
216
284
  requests. Their arguments and model-visible results also appear through the
217
285
  same canonical `agent/tool` telemetry as other DSH tools.
218
286
 
219
287
  The plugin does not send raw reasoning, credentials, internal exception stacks,
220
288
  or tool-private metadata. Tool arguments and results are not copied into normal
221
289
  plugin logs. It emits only canonical `agent/tool` events and does not duplicate
222
- them as `chat.event tool_call_start/tool_call_end` events.
290
+ them as legacy `chat.event tool_call_start/tool_call_end` events.
223
291
 
224
292
  ## Verify
225
293
 
package/dist/bridge.d.ts CHANGED
@@ -1,9 +1,19 @@
1
1
  import type { Context } from '@deepseek-ai/cordis';
2
2
  import { type Agent } from '@deepseek-ai/dsh-agent';
3
- import type { JsonValue } from '@deepseek-ai/dsh-session';
4
3
  import type { Config } from './config.js';
5
4
  import { type RouteSelector } from './protocol.js';
6
5
  import type { BcnWsClient } from './ws-client.js';
6
+ type JsonValue = null | boolean | number | string | JsonValue[] | {
7
+ [key: string]: JsonValue;
8
+ };
9
+ declare module '@deepseek-ai/dsh-llm' {
10
+ interface MessageSourceMap {
11
+ /** @persistenceAttribution */
12
+ 'bcn-channel': {
13
+ kind: 'bcn-channel';
14
+ };
15
+ }
16
+ }
7
17
  export declare class BcnBridge {
8
18
  private readonly ctx;
9
19
  private readonly client;
@@ -19,6 +29,7 @@ export declare class BcnBridge {
19
29
  private completedRunIds;
20
30
  private disposers;
21
31
  private disposed;
32
+ private interactions;
22
33
  constructor(ctx: Context, client: BcnWsClient, config: Config, log?: {
23
34
  info(message: string): void;
24
35
  warn(message: string): void;
@@ -34,9 +45,11 @@ export declare class BcnBridge {
34
45
  completeTask(agent: Agent | undefined, summary: string, signal: AbortSignal): Promise<JsonValue>;
35
46
  private handleChatSend;
36
47
  private handleChatInject;
48
+ private handleChatAbort;
37
49
  private handleInboxClaimed;
38
50
  private handleInboxDiscarded;
39
51
  private handleSessionEvent;
52
+ private handleAssistantStream;
40
53
  private appendDelta;
41
54
  private captureAssistantMessage;
42
55
  private captureToolCall;
@@ -48,4 +61,5 @@ export declare class BcnBridge {
48
61
  private activeRunForTaskTool;
49
62
  private sendTaskRequest;
50
63
  }
64
+ export {};
51
65
  //# sourceMappingURL=bridge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAEL,KAAK,KAAK,EAGX,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,SAAS,EAAmD,MAAM,0BAA0B,CAAC;AAE3G,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAYL,KAAK,aAAa,EACnB,MAAM,eAAe,CAAC;AAQvB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAuDlD,qBAAa,SAAS;IAalB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;IAfvB,OAAO,CAAC,aAAa,CAA4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