@avernet-plugin/deepseek-harness-channel-bcn 0.1.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.
Files changed (54) hide show
  1. package/LEGAL.md +9 -0
  2. package/LICENSE +176 -0
  3. package/README.md +242 -0
  4. package/cordis.patch.yml +5 -0
  5. package/dist/bridge.d.ts +51 -0
  6. package/dist/bridge.d.ts.map +1 -0
  7. package/dist/bridge.js +695 -0
  8. package/dist/bridge.js.map +1 -0
  9. package/dist/config.d.ts +23 -0
  10. package/dist/config.d.ts.map +1 -0
  11. package/dist/config.js +60 -0
  12. package/dist/config.js.map +1 -0
  13. package/dist/configure.d.ts +18 -0
  14. package/dist/configure.d.ts.map +1 -0
  15. package/dist/configure.js +207 -0
  16. package/dist/configure.js.map +1 -0
  17. package/dist/credentials.d.ts +15 -0
  18. package/dist/credentials.d.ts.map +1 -0
  19. package/dist/credentials.js +44 -0
  20. package/dist/credentials.js.map +1 -0
  21. package/dist/endpoint.d.ts +21 -0
  22. package/dist/endpoint.d.ts.map +1 -0
  23. package/dist/endpoint.js +156 -0
  24. package/dist/endpoint.js.map +1 -0
  25. package/dist/http-client.d.ts +28 -0
  26. package/dist/http-client.d.ts.map +1 -0
  27. package/dist/http-client.js +106 -0
  28. package/dist/http-client.js.map +1 -0
  29. package/dist/index.d.ts +8 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.js +42 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/protocol.d.ts +107 -0
  34. package/dist/protocol.d.ts.map +1 -0
  35. package/dist/protocol.js +157 -0
  36. package/dist/protocol.js.map +1 -0
  37. package/dist/route-tool.d.ts +5 -0
  38. package/dist/route-tool.d.ts.map +1 -0
  39. package/dist/route-tool.js +38 -0
  40. package/dist/route-tool.js.map +1 -0
  41. package/dist/session-identity.d.ts +22 -0
  42. package/dist/session-identity.d.ts.map +1 -0
  43. package/dist/session-identity.js +35 -0
  44. package/dist/session-identity.js.map +1 -0
  45. package/dist/task-tools.d.ts +9 -0
  46. package/dist/task-tools.d.ts.map +1 -0
  47. package/dist/task-tools.js +81 -0
  48. package/dist/task-tools.js.map +1 -0
  49. package/dist/ws-client.d.ts +62 -0
  50. package/dist/ws-client.d.ts.map +1 -0
  51. package/dist/ws-client.js +433 -0
  52. package/dist/ws-client.js.map +1 -0
  53. package/install-dsh.sh +95 -0
  54. package/package.json +80 -0
package/LEGAL.md ADDED
@@ -0,0 +1,9 @@
1
+ Legal Disclaimer
2
+
3
+ Within this source code, the comments in Chinese shall be the original,
4
+ governing version. Any comment in other languages is for reference only. In
5
+ the event of a conflict, the Chinese version prevails.
6
+
7
+ 法律免责声明
8
+
9
+ 关于代码注释部分,中文注释为官方版本,其它语言注释仅做参考。中文注释可能与其它语言注释存在不一致,当中文注释与其它语言注释存在不一致时,请以中文注释为准。
package/LICENSE ADDED
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ https://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
package/README.md ADDED
@@ -0,0 +1,242 @@
1
+ # @avernet-plugin/deepseek-harness-channel-bcn
2
+
3
+ DeepSeek Harness channel bundle for connecting a DSH Bot to the Avernet Bot
4
+ Collaboration Network (BCN).
5
+
6
+ ## Compatibility
7
+
8
+ - DeepSeek Harness baseline: `@deepseek-ai/dsh 0.1.1-rc.2`
9
+ - BCN Bot WebSocket protocol: V2
10
+ - Node.js: `>=22.19.0`
11
+
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.
17
+
18
+ ## Capabilities
19
+
20
+ - Automatic registration and descriptor onboarding through DSH Credentials
21
+ - Persistent Bot Session storage through the official `ctx.credentials` seam
22
+ - `chat.send` and `chat.inject` downlink handling
23
+ - Isolated DSH Agent/Session reuse for each BCN conversation, including
24
+ multiple V2 sessions that share one group-level `session_key`
25
+ - DSH Agent preset composition matching Web sessions; new BCN sessions use the
26
+ configured default preset and resumed sessions restore their recorded preset
27
+ - Assistant delta, final, error, and aborted uplink events
28
+ - Canonical `agent/tool` start and result events for DSH tool calls
29
+ - BCN coordination tools selected from the authenticated group type and
30
+ recipient role carried by each downlink
31
+ - `bcs_route` capture with routing metadata attached to the final chat event
32
+ - Manager-worker `task.dispatch`, `task.message`, and `task.complete` support
33
+ - Heartbeat, exponential reconnect, token rotation, and lifecycle cleanup
34
+
35
+ The plugin does not create an OpenClaw-style `.bcs/session.json` file or any
36
+ other private session directory.
37
+
38
+ The initial release does not implement `chat.abort` or `chat.history`.
39
+ Unsupported BCN requests receive the WebSocket client's standard `NOT_FOUND`
40
+ response, and unsolicited unsupported events are ignored.
41
+
42
+ BCN messages run in a dedicated in-process DSH Agent created through
43
+ `ctx.agents.create` or restored through `ctx.agents.resume`; they do not reuse a
44
+ browser tab's live Agent. The plugin mounts that session's DSH Agent preset
45
+ before publishing the Agent, then adds only the BCN tools allowed for that
46
+ session:
47
+
48
+ | BCN session | BCN tools added by this plugin |
49
+ | --- | --- |
50
+ | Ordinary structured-routing group | `bcs_route` |
51
+ | Manager in a `manager_worker` group | `bcs_assign_task`, `bcs_task_complete` |
52
+ | Worker in a `manager_worker` group | `bcs_send_task_message` |
53
+ | Mention-routing group, or manager-worker session without a valid recipient role | None |
54
+
55
+ The manager/worker decision uses only the server-delivered
56
+ `session_context.recipient_role`; it does not infer authority from Bot names,
57
+ participants, environment variables, or model input. A manager receives its
58
+ task tools even before workers join the group, but `bcs_assign_task` can only
59
+ succeed after its `target_bot` resolves to a worker accepted by BCS.
60
+
61
+ With DSH's default `standard` preset the base tool set includes the Bash,
62
+ filesystem, search, Skills, planning, subagent, and workflow capabilities
63
+ selected by DSH. Actual command and file access remains governed by the host's
64
+ DSH sandbox and permission preset.
65
+
66
+ ## Install
67
+
68
+ ### One-command setup
69
+
70
+ After this package is published, install, configure, and start a DSH profile
71
+ with the repository installer:
72
+
73
+ ```bash
74
+ curl -fsSL https://raw.githubusercontent.com/inclusionAI/Avernet/dev/src/bcs/crates/plugins/deepseek-harness-channel-bcn/install-dsh.sh | \
75
+ BCN_ONBOARDING_TOKEN='<registration-token>' bash -s -- \
76
+ --endpoint http://127.0.0.1:21000/ \
77
+ --profile web \
78
+ --bot-name 'DeepSeek Harness Bot'
79
+ ```
80
+
81
+ The registration Token is removed from the package-manager and configuration
82
+ helper environments and is passed only to the final DSH process. The installer
83
+ does not print or persist it. If the command is generated by a trusted BCN
84
+ portal, avoid copying it into shared shell history or logs because the command
85
+ itself contains the short-lived Token.
86
+
87
+ Pass `--no-start` to install and configure without launching DSH. In that mode
88
+ the Token is deliberately discarded and must be supplied again on the first
89
+ start. `--package <directory-or-tarball>` replaces the npm package spec for
90
+ local and release-artifact testing.
91
+
92
+ The installer delegates profile changes to the packaged
93
+ `dsh-bcn-configure` command. That helper preserves unrelated patch rows and
94
+ `!!js` expressions, refuses symlinked profile configuration, writes atomically,
95
+ and rolls back if `dsh --dump-config` rejects the composed profile.
96
+
97
+ ### Manual and release-artifact setup
98
+
99
+ From a checkout, build the package and add its directory to an isolated DSH
100
+ profile:
101
+
102
+ ```bash
103
+ cd src/bcs/crates/plugins/deepseek-harness-channel-bcn
104
+ npm install --ignore-scripts --no-package-lock
105
+ npm run build
106
+ dsh plugin --profile bcn-local add "$(pwd)"
107
+ ```
108
+
109
+ To exercise the exact prebuilt artifact that will be published:
110
+
111
+ ```bash
112
+ mkdir -p /tmp/dsh-bcn-pack
113
+ 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
115
+ ```
116
+
117
+ After publication, the installation command will be:
118
+
119
+ ```bash
120
+ dsh plugin --profile <profile> add @avernet-plugin/deepseek-harness-channel-bcn
121
+ ```
122
+
123
+ The bundle patch adds the plugin in a disabled state, so installing it never
124
+ forces a network connection before credentials and endpoint configuration are
125
+ ready.
126
+
127
+ ## Configure
128
+
129
+ Enable and configure the inserted Cordis row in the target DSH profile:
130
+
131
+ ```yaml
132
+ - id: deepseek-harness-channel-bcn
133
+ name: '@avernet-plugin/deepseek-harness-channel-bcn'
134
+ config:
135
+ enabled: true
136
+ endpoint: http://127.0.0.1:21000/
137
+ botName: DeepSeek Harness Bot
138
+ summary: General-purpose DeepSeek Harness agent
139
+ domains:
140
+ - general
141
+ skills:
142
+ - chat
143
+ scopes:
144
+ - chat
145
+ onboardingTokenRef: BCN_ONBOARDING_TOKEN
146
+ botSessionRef: BCN_BOT_SESSION
147
+ ```
148
+
149
+ `endpoint` accepts both `http://` and `https://`. The matching WebSocket
150
+ transport is derived automatically (`ws://` or `wss://`) and an existing API
151
+ path prefix is preserved. HTTP is useful for local and controlled deployments;
152
+ use HTTPS when transport confidentiality is required because onboarding and Bot
153
+ credentials otherwise travel without TLS.
154
+
155
+ Remote endpoints may not resolve to private, link-local, or reserved addresses.
156
+ Exact loopback destinations are allowed for local development. DNS is resolved,
157
+ screened, and pinned before the HTTP or WebSocket connection to prevent DNS
158
+ rebinding from changing the validated destination.
159
+
160
+ The package contains no private endpoint and does not modify the BCS frontend.
161
+ An endpoint and registration Token can be supplied later by any trusted CLI,
162
+ portal, or BCS onboarding flow.
163
+
164
+ ## Credentials and Bot ownership
165
+
166
+ The configuration stores references only. The default references are POSIX
167
+ credential identifiers required by DSH:
168
+
169
+ - `BCN_ONBOARDING_TOKEN`
170
+ - `BCN_BOT_SESSION`
171
+
172
+ Provide the short-lived registration Token through the DSH credential provider
173
+ under `BCN_ONBOARDING_TOKEN`; an inherited environment variable is also an
174
+ official DSH credential source. On first start the plugin exchanges it for a Bot
175
+ Session and writes this JSON value under `BCN_BOT_SESSION` using
176
+ `ctx.credentials.set`:
177
+
178
+ ```json
179
+ {
180
+ "version": 1,
181
+ "endpoint": "http://127.0.0.1:21000/",
182
+ "botUuid": "<server-issued UUID>",
183
+ "botToken": "<server-issued Bot token>",
184
+ "botName": "DeepSeek Harness Bot"
185
+ }
186
+ ```
187
+
188
+ The local DSH credential provider persists writable values in its managed
189
+ `$DSH_HOME/.credentials.yaml`; that location and format belong to DSH, not this
190
+ plugin. The plugin never writes a dedicated session file. It also never stores
191
+ an additional copy of the registration Token: the source supplied by the caller
192
+ remains caller-managed.
193
+
194
+ Bot ownership is decided only by BCS when it validates the human registration
195
+ Token. No client-provided `ownerId` or `owner_id` is sent or trusted. The stored
196
+ Bot Session is bound to its canonical endpoint, and a later endpoint mismatch
197
+ fails before the Bot token can be sent elsewhere.
198
+
199
+ Do not supply `BCN_BOT_SESSION` through a read-only environment variable if the
200
+ server may rotate its Bot token: DSH intentionally rejects writes that are
201
+ shadowed by a read-only credential source. Let the managed credential provider
202
+ own this reference instead.
203
+
204
+ ## Data boundary
205
+
206
+ BCN is treated as a trusted receiver for observable tool activity. The plugin
207
+ sends:
208
+
209
+ - complete DSH `tool/call` arguments as parsed JSON, or the original string when
210
+ parsing is not possible;
211
+ - model-visible `tool/result` content and its `isError` flag;
212
+ - assistant-visible text and final routing metadata.
213
+
214
+ 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`
216
+ requests. Their arguments and model-visible results also appear through the
217
+ same canonical `agent/tool` telemetry as other DSH tools.
218
+
219
+ The plugin does not send raw reasoning, credentials, internal exception stacks,
220
+ or tool-private metadata. Tool arguments and results are not copied into normal
221
+ 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.
223
+
224
+ ## Verify
225
+
226
+ ```bash
227
+ npm run typecheck
228
+ npm test
229
+ npm run build
230
+ npm pack --dry-run
231
+ ```
232
+
233
+ For a fresh DSH profile, run `dsh --profile <profile> --dump-config` after
234
+ installation to verify that the bundle composes without a source checkout. A
235
+ full local integration uses a loopback BCS endpoint, enables the Cordis row, and
236
+ sets `BCN_ONBOARDING_TOKEN` through DSH Credentials before starting the profile.
237
+
238
+ The source package should be merged into Avernet and validated as a tarball
239
+ before npm publication. Any later listing on
240
+ [deepseek-harness-plugin.com](https://deepseek-harness-plugin.com/) is a
241
+ community directory entry, not an official DeepSeek review or marketplace
242
+ approval.
@@ -0,0 +1,5 @@
1
+ - insert:
2
+ - id: deepseek-harness-channel-bcn
3
+ name: '@avernet-plugin/deepseek-harness-channel-bcn'
4
+ config:
5
+ enabled: false
@@ -0,0 +1,51 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import { type Agent } from '@deepseek-ai/dsh-agent';
3
+ import type { JsonValue } from '@deepseek-ai/dsh-session';
4
+ import type { Config } from './config.js';
5
+ import { type RouteSelector } from './protocol.js';
6
+ import type { BcnWsClient } from './ws-client.js';
7
+ export declare class BcnBridge {
8
+ private readonly ctx;
9
+ private readonly client;
10
+ private readonly config;
11
+ private readonly log?;
12
+ private managedAgents;
13
+ private ownedAgents;
14
+ private sessionIdentityBySessionId;
15
+ private runIdByMessageId;
16
+ private runIdByTurn;
17
+ private activeRunBySessionId;
18
+ private runs;
19
+ private completedRunIds;
20
+ private disposers;
21
+ private disposed;
22
+ constructor(ctx: Context, client: BcnWsClient, config: Config, log?: {
23
+ info(message: string): void;
24
+ warn(message: string): void;
25
+ error(message: string): void;
26
+ debug?(message: string): void;
27
+ } | undefined);
28
+ start(): void;
29
+ get busy(): boolean;
30
+ dispose(): Promise<void>;
31
+ captureRoute(agent: Agent | undefined, selectors: RouteSelector[], reason: string, signal: AbortSignal): Promise<JsonValue>;
32
+ assignTask(agent: Agent | undefined, targetBot: string, message: string, responseMode: string | undefined, signal: AbortSignal): Promise<JsonValue>;
33
+ sendTaskMessage(agent: Agent | undefined, message: string, signal: AbortSignal): Promise<JsonValue>;
34
+ completeTask(agent: Agent | undefined, summary: string, signal: AbortSignal): Promise<JsonValue>;
35
+ private handleChatSend;
36
+ private handleChatInject;
37
+ private handleInboxClaimed;
38
+ private handleInboxDiscarded;
39
+ private handleSessionEvent;
40
+ private appendDelta;
41
+ private captureAssistantMessage;
42
+ private captureToolCall;
43
+ private captureToolResult;
44
+ private sendToolResult;
45
+ private sendTerminal;
46
+ private getOrCreateAgent;
47
+ private createAgent;
48
+ private activeRunForTaskTool;
49
+ private sendTaskRequest;
50
+ }
51
+ //# sourceMappingURL=bridge.d.ts.map
@@ -0,0 +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,aA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