@avernet-plugin/deepseek-harness-channel-bcn 0.1.0 → 0.2.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
@@ -5,23 +5,28 @@ Collaboration Network (BCN).
5
5
 
6
6
  ## Compatibility
7
7
 
8
- - DeepSeek Harness baseline: `@deepseek-ai/dsh 0.1.1-rc.2`
9
- - BCN Bot WebSocket protocol: V2
8
+ - DeepSeek Harness declared compatibility: `>=0.2.0-rc.2 <=0.2.1-alpha.2`
9
+ - DeepSeek Harness development/test baseline: `@deepseek-ai/dsh 0.2.1-alpha.2`
10
+ - BCN Bot WebSocket protocol: V3
10
11
  - Node.js: `>=22.19.0`
11
12
 
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.
13
+ This release requires BCN V3. Every `chat.send` and `chat.inject` must carry the canonical
14
+ `bcs_session_id`; uplink events use the shared Run Event envelope with
15
+ `runId`, `sessionId`, `seq`, and `ts`. The adapter still keeps the historical
16
+ session-key mapping helper for persisted sessions created by older releases.
17
17
 
18
18
  ## Capabilities
19
19
 
20
- - Automatic registration and descriptor onboarding through DSH Credentials
20
+ First-time setup exchanges the human Token through `POST /register`. That
21
+ endpoint creates the Bot and establishes its display name and ownership. On
22
+ restart, the plugin reuses the saved Bot Session and connects directly to
23
+ `/ws/bot`; it does not re-register or require a separate `/bots/onboard` call.
24
+
25
+ - Automatic registration and persistent Bot credentials through DSH Credentials
21
26
  - Persistent Bot Session storage through the official `ctx.credentials` seam
22
- - `chat.send` and `chat.inject` downlink handling
27
+ - `chat.send`, `chat.inject`, and exact-run `chat.abort` downlink handling
23
28
  - Isolated DSH Agent/Session reuse for each BCN conversation, including
24
- multiple V2 sessions that share one group-level `session_key`
29
+ multiple sessions that share one group-level `session_key`
25
30
  - DSH Agent preset composition matching Web sessions; new BCN sessions use the
26
31
  configured default preset and resumed sessions restore their recorded preset
27
32
  - Assistant delta, final, error, and aborted uplink events
@@ -31,14 +36,44 @@ precedence without changing the rest of the bridge.
31
36
  - `bcs_route` capture with routing metadata attached to the final chat event
32
37
  - Manager-worker `task.dispatch`, `task.message`, and `task.complete` support
33
38
  - Heartbeat, exponential reconnect, token rotation, and lifecycle cleanup
39
+ - Agent-scoped execution approvals and structured questions through BCN
40
+ `interaction` events and authenticated `interaction.resolve` requests
34
41
 
35
42
  The plugin does not create an OpenClaw-style `.bcs/session.json` file or any
36
43
  other private session directory.
37
44
 
38
- The initial release does not implement `chat.abort` or `chat.history`.
45
+ This release does not implement `chat.history`.
39
46
  Unsupported BCN requests receive the WebSocket client's standard `NOT_FOUND`
40
47
  response, and unsolicited unsupported events are ignored.
41
48
 
49
+ `chat.abort` requires `session_key` (the canonical BCN session ID) and
50
+ `run_id`. It cancels only that run: pending agent creation cannot deliver after
51
+ the abort, queued input is removed by message ID, and active turns use
52
+ `cancel({ kind: 'user' }, { keepInbox: true })`. Other queued runs survive.
53
+ Repeated aborts acknowledge an empty `aborted_run_ids`; unknown runs and
54
+ cross-session requests fail. Terminal events are emitted once.
55
+
56
+ DSH 0.2 uses scoped live events and V4 tool-result messages. This adapter
57
+ subscribes in each owned Agent's setup, reads tool identity from the message's
58
+ top-level `toolCallId`, and never subscribes to replayed history. Assistant
59
+ text is forwarded as deltas after each durable `assistant/message` commit,
60
+ including interrupted prefixes. Failed/retried `assistant/attempt` output and
61
+ raw reasoning are excluded; this deliberately buffers text until a step
62
+ commits because BCN's append-only delta stream cannot retract a failed attempt.
63
+ The scoped `agent/assistant-stream` feed retains only the current attempt's
64
+ visible text so an explicit abort can preserve its partial answer.
65
+ The historical `bcn-v2-*` DSH session IDs remain unchanged. DSH's own storage
66
+ migration handles old session formats; the plugin never rewrites session logs.
67
+
68
+ Execution approvals offer only `allow_once` and `deny`. Question options use
69
+ their DSH labels as wire values; free-text answers return as `custom`.
70
+ Cancellation and unload settle pending waits without granting approval.
71
+ Timed questions attach to DSH's official foreground wait and respect its
72
+ remaining duration. Late answers after that foreground wait closes are not
73
+ accepted by this adapter. Mode-switch interactions are not implemented.
74
+ These hooks are installed only on BCN-owned Agents and do not intercept Web
75
+ sessions or subagents.
76
+
42
77
  BCN messages run in a dedicated in-process DSH Agent created through
43
78
  `ctx.agents.create` or restored through `ctx.agents.resume`; they do not reuse a
44
79
  browser tab's live Agent. The plugin mounts that session's DSH Agent preset
@@ -57,6 +92,9 @@ The manager/worker decision uses only the server-delivered
57
92
  participants, environment variables, or model input. A manager receives its
58
93
  task tools even before workers join the group, but `bcs_assign_task` can only
59
94
  succeed after its `target_bot` resolves to a worker accepted by BCS.
95
+ Task RPCs carry the canonical `group:session` identity in their existing
96
+ `group_id` wire field, which BCS unwraps into group and conversation scope.
97
+ They do not fall back to a shared group's default conversation.
60
98
 
61
99
  With DSH's default `standard` preset the base tool set includes the Bash,
62
100
  filesystem, search, Skills, planning, subagent, and workflow capabilities
@@ -71,13 +109,29 @@ After this package is published, install, configure, and start a DSH profile
71
109
  with the repository installer:
72
110
 
73
111
  ```bash
74
- curl -fsSL https://raw.githubusercontent.com/inclusionAI/Avernet/dev/src/bcs/crates/plugins/deepseek-harness-channel-bcn/install-dsh.sh | \
112
+ curl -fsSL https://raw.githubusercontent.com/inclusionAI/Avernet/dev/apps/bcs/crates/plugins/deepseek-harness-channel-bcn/install-dsh.sh | \
75
113
  BCN_ONBOARDING_TOKEN='<registration-token>' bash -s -- \
76
114
  --endpoint http://127.0.0.1:21000/ \
77
115
  --profile web \
78
116
  --bot-name 'DeepSeek Harness Bot'
79
117
  ```
80
118
 
119
+ The installer first checks whether the `dsh` executable is available. If it is
120
+ missing, it exits without consuming the registration Token and prints the
121
+ matching CLI installation command:
122
+
123
+ ```bash
124
+ npm install --global @deepseek-ai/dsh@0.2.1-alpha.2
125
+ ```
126
+
127
+ Run the generated onboarding command again after installing the CLI. When DSH
128
+ is present, the same command installs this plugin, configures the `web` profile,
129
+ and starts DSH so the plugin can complete onboarding with the injected Token.
130
+ The DSH plugin manager checks the peer compatibility range declared in this
131
+ package (`>=0.2.0-rc.2 <=0.2.1-alpha.2`) before activation. Existing
132
+ `0.1.1-rc.2` installations must be upgraded first. Development dependencies
133
+ remain pinned to `0.2.1-alpha.2` so builds and unit tests remain reproducible.
134
+
81
135
  The registration Token is removed from the package-manager and configuration
82
136
  helper environments and is passed only to the final DSH process. The installer
83
137
  does not print or persist it. If the command is generated by a trusted BCN
@@ -100,7 +154,7 @@ From a checkout, build the package and add its directory to an isolated DSH
100
154
  profile:
101
155
 
102
156
  ```bash
103
- cd src/bcs/crates/plugins/deepseek-harness-channel-bcn
157
+ cd apps/bcs/crates/plugins/deepseek-harness-channel-bcn
104
158
  npm install --ignore-scripts --no-package-lock
105
159
  npm run build
106
160
  dsh plugin --profile bcn-local add "$(pwd)"
@@ -111,13 +165,13 @@ To exercise the exact prebuilt artifact that will be published:
111
165
  ```bash
112
166
  mkdir -p /tmp/dsh-bcn-pack
113
167
  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
168
+ dsh plugin --profile bcn-tarball add /tmp/dsh-bcn-pack/avernet-plugin-deepseek-harness-channel-bcn-0.2.0.tgz
115
169
  ```
116
170
 
117
171
  After publication, the installation command will be:
118
172
 
119
173
  ```bash
120
- dsh plugin --profile <profile> add @avernet-plugin/deepseek-harness-channel-bcn
174
+ dsh plugin --profile <profile> add @avernet-plugin/deepseek-harness-channel-bcn@0.2.0
121
175
  ```
122
176
 
123
177
  The bundle patch adds the plugin in a disabled state, so installing it never
@@ -212,14 +266,14 @@ sends:
212
266
  - assistant-visible text and final routing metadata.
213
267
 
214
268
  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`
269
+ use the existing BCN `task.dispatch`, `task.message`, and `task.complete`
216
270
  requests. Their arguments and model-visible results also appear through the
217
271
  same canonical `agent/tool` telemetry as other DSH tools.
218
272
 
219
273
  The plugin does not send raw reasoning, credentials, internal exception stacks,
220
274
  or tool-private metadata. Tool arguments and results are not copied into normal
221
275
  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.
276
+ them as legacy `chat.event tool_call_start/tool_call_end` events.
223
277
 
224
278
  ## Verify
225
279
 
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,CAA4C;IACjE,OAAO,CAAC,WAAW,CAA0B;IAC7C,OAAO,CAAC,0BAA0B,CAA6B;IAC/D,OAAO,CAAC,gBAAgB,CAA6B;IACrD,OAAO,CAAC,WAAW,CAA6B;IAChD,OAAO,CAAC,oBAAoB,CAA6B;IACzD,OAAO,CAAC,IAAI,CAAiC;IAC7C,OAAO,CAAC,eAAe,CAAgB;IACvC,OAAO,CAAC,SAAS,CAA4B;IAC7C,OAAO,CAAC,QAAQ,CAAS;gBAGN,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,MAAM,EACd,GAAG,CAAC,EAAE;QACrB,IAAI,CAAC,OAAO,EAAE,MA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