@qwen-code/channel-base 0.19.2 → 0.19.3-nightly.20260701.a974594d7

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
@@ -1,6 +1,6 @@
1
1
  # @qwen-code/channel-base
2
2
 
3
- Base infrastructure for building Qwen Code channel adapters. Provides the abstract base class, access control, session routing, and the ACP bridge that communicates with the agent.
3
+ Base infrastructure for building Qwen Code channel adapters. Provides the abstract base class, access control, session routing, and the adapter-facing bridge interface used to communicate with the agent.
4
4
 
5
5
  If you're building a channel plugin, this is your only dependency.
6
6
 
@@ -17,12 +17,22 @@ Subclass `ChannelBase` and implement three methods:
17
17
  ```typescript
18
18
  import { ChannelBase } from '@qwen-code/channel-base';
19
19
  import type {
20
+ ChannelAgentBridge,
21
+ ChannelBaseOptions,
20
22
  ChannelConfig,
21
23
  Envelope,
22
- AcpBridge,
23
24
  } from '@qwen-code/channel-base';
24
25
 
25
26
  class MyChannel extends ChannelBase {
27
+ constructor(
28
+ name: string,
29
+ config: ChannelConfig,
30
+ bridge: ChannelAgentBridge,
31
+ options?: ChannelBaseOptions,
32
+ ) {
33
+ super(name, config, bridge, options);
34
+ }
35
+
26
36
  async connect(): Promise<void> {
27
37
  // Connect to platform API, register message handlers.
28
38
  // When a message arrives, build an Envelope and call:
@@ -55,6 +65,8 @@ export const plugin: ChannelPlugin = {
55
65
 
56
66
  For a complete working example, see [`@qwen-code/channel-plugin-example`](../plugin-example/).
57
67
 
68
+ Migration note for existing TypeScript plugins: if your adapter constructor or factory explicitly types `bridge` as `AcpBridge`, change that annotation to `ChannelAgentBridge` and keep using only the methods exposed by that contract. JavaScript plugins are unaffected at runtime, and standalone `qwen channel start` still passes the current `AcpBridge` implementation.
69
+
58
70
  ## Architecture
59
71
 
60
72
  ```
@@ -63,9 +75,9 @@ Inbound: Platform message
63
75
  → GroupGate (group policy + mention gating)
64
76
  → SenderGate (allowlist / pairing / open)
65
77
  → Slash commands (/clear, /help, /status)
66
- → SessionRouter (resolve or create ACP session)
78
+ → SessionRouter (resolve or create agent session)
67
79
  → Resolve attachments (images → bridge, files → prompt text)
68
- → AcpBridge.prompt() → agent
80
+ → ChannelAgentBridge.prompt() → agent
69
81
 
70
82
  Outbound: Agent response
71
83
  → BlockStreamer (if enabled: split into blocks at paragraph boundaries)
@@ -78,36 +90,39 @@ Everything between `handleInbound()` and `sendMessage()` is handled by the base
78
90
 
79
91
  ### Classes
80
92
 
81
- | Class | Purpose |
82
- | --------------- | ---------------------------------------------------------------- |
83
- | `ChannelBase` | Abstract base class — extend this to build a channel adapter |
84
- | `AcpBridge` | Spawns and communicates with the `qwen-code --acp` agent process |
85
- | `BlockStreamer` | Progressive multi-message delivery for block streaming |
86
- | `SessionRouter` | Maps senders to ACP sessions with configurable scoping |
87
- | `SenderGate` | DM access control (allowlist / pairing / open) |
88
- | `GroupGate` | Group chat policy and @mention gating |
89
- | `PairingStore` | Pairing code generation, approval, and allowlist persistence |
93
+ | Class | Purpose |
94
+ | --------------- | ------------------------------------------------------------------------------------ |
95
+ | `ChannelBase` | Abstract base class — extend this to build a channel adapter |
96
+ | `AcpBridge` | Current standalone `qwen channel start` bridge implementation over `qwen-code --acp` |
97
+ | `BlockStreamer` | Progressive multi-message delivery for block streaming |
98
+ | `SessionRouter` | Maps senders to agent sessions with configurable scoping |
99
+ | `SenderGate` | DM access control (allowlist / pairing / open) |
100
+ | `GroupGate` | Group chat policy and @mention gating |
101
+ | `PairingStore` | Pairing code generation, approval, and allowlist persistence |
90
102
 
91
103
  ### Types
92
104
 
93
- | Type | Description |
94
- | --------------- | ---------------------------------------------- |
95
- | `Attachment` | Structured file/image/audio/video attachment |
96
- | `ChannelConfig` | Channel configuration from `settings.json` |
97
- | `ChannelPlugin` | Plugin factory interface (what you export) |
98
- | `Envelope` | Normalized inbound message format |
99
- | `SenderPolicy` | `'allowlist' \| 'pairing' \| 'open'` |
100
- | `GroupPolicy` | `'disabled' \| 'allowlist' \| 'open'` |
101
- | `SessionScope` | `'user' \| 'thread' \| 'single'` |
102
- | `GroupConfig` | Per-group settings (e.g. `requireMention`) |
103
- | `SessionTarget` | Maps a session back to its channel/sender/chat |
105
+ | Type | Description |
106
+ | -------------------- | ------------------------------------------------------------------------ |
107
+ | `Attachment` | Structured file/image/audio/video attachment |
108
+ | `AvailableCommand` | Agent command advertised through the bridge |
109
+ | `ChannelAgentBridge` | Adapter-facing bridge contract used by `ChannelBase` and `SessionRouter` |
110
+ | `ChannelConfig` | Channel configuration from `settings.json` |
111
+ | `ChannelPlugin` | Plugin factory interface (what you export) |
112
+ | `Envelope` | Normalized inbound message format |
113
+ | `SenderPolicy` | `'allowlist' \| 'pairing' \| 'open'` |
114
+ | `GroupPolicy` | `'disabled' \| 'allowlist' \| 'open'` |
115
+ | `SessionScope` | `'user' \| 'thread' \| 'single'` |
116
+ | `GroupConfig` | Per-group settings (e.g. `requireMention`) |
117
+ | `SessionTarget` | Maps a session back to its channel/sender/chat |
118
+ | `ToolCallEvent` | Agent tool-call event delivered to adapters |
104
119
 
105
120
  ## API reference
106
121
 
107
122
  ### ChannelBase
108
123
 
109
124
  ```typescript
110
- constructor(name: string, config: ChannelConfig, bridge: AcpBridge, options?: ChannelBaseOptions)
125
+ constructor(name: string, config: ChannelConfig, bridge: ChannelAgentBridge, options?: ChannelBaseOptions)
111
126
  ```
112
127
 
113
128
  **Abstract methods** (you must implement):
@@ -123,7 +138,7 @@ constructor(name: string, config: ChannelConfig, bridge: AcpBridge, options?: Ch
123
138
  | Method | Description |
124
139
  | ------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
125
140
  | `handleInbound(envelope)` | Route an inbound message through the full pipeline (gate checks, commands, session, prompt). Call this from your message handler. |
126
- | `setBridge(bridge)` | Replace the ACP bridge after crash recovery |
141
+ | `setBridge(bridge)` | Replace the agent bridge after crash recovery |
127
142
  | `registerCommand(name, handler)` | Register a custom slash command (e.g. `/mycommand`) |
128
143
  | `onToolCall(chatId, event)` | Hook called on agent tool invocations — override to show indicators |
129
144
  | `onResponseChunk(chatId, chunk, sessionId)` | Hook called per streaming text chunk — override for progressive display (default: no-op) |
@@ -133,9 +148,58 @@ constructor(name: string, config: ChannelConfig, bridge: AcpBridge, options?: Ch
133
148
 
134
149
  **Built-in slash commands:** `/clear` (`/reset`, `/new`), `/help`, `/status`
135
150
 
151
+ **ChannelBaseOptions:**
152
+
153
+ | Option | Description |
154
+ | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
155
+ | `router` | Optional `SessionRouter`. Omit for the default standalone router. |
156
+ | `proxy` | Optional proxy URL made available to adapters. |
157
+ | `registerBridgeEvents` | Set only when the adapter owns a supplied router and `ChannelBase` should consume bridge events directly. Leave unset for routers supplied by the gateway. |
158
+
159
+ ### ChannelAgentBridge
160
+
161
+ `ChannelAgentBridge` is the adapter-facing contract. Channel adapters, channel plugins, `ChannelBase`, and `SessionRouter` should depend on this type instead of a concrete bridge implementation.
162
+
163
+ ```typescript
164
+ interface ChannelAgentBridge {
165
+ readonly availableCommands: AvailableCommand[];
166
+ on(eventName: 'toolCall', listener: (event: ToolCallEvent) => void): unknown;
167
+ on(
168
+ eventName: 'textChunk',
169
+ listener: (sessionId: string, chunk: string) => void,
170
+ ): unknown;
171
+ on(
172
+ eventName: 'sessionDied',
173
+ listener: (event: { sessionId: string; reason?: string }) => void,
174
+ ): unknown;
175
+ off(eventName: 'toolCall', listener: (event: ToolCallEvent) => void): unknown;
176
+ off(
177
+ eventName: 'textChunk',
178
+ listener: (sessionId: string, chunk: string) => void,
179
+ ): unknown;
180
+ off(
181
+ eventName: 'sessionDied',
182
+ listener: (event: { sessionId: string; reason?: string }) => void,
183
+ ): unknown;
184
+ newSession(cwd: string): Promise<string>;
185
+ loadSession(sessionId: string, cwd: string): Promise<string>;
186
+ prompt(
187
+ sessionId: string,
188
+ text: string,
189
+ options?: { imageBase64?: string; imageMimeType?: string },
190
+ ): Promise<string>;
191
+ cancelSession(sessionId: string): Promise<void>;
192
+ shellCommand?(
193
+ sessionId: string,
194
+ command: string,
195
+ signal?: AbortSignal,
196
+ ): Promise<{ exitCode: number | null; output: string; aborted: boolean }>;
197
+ }
198
+ ```
199
+
136
200
  ### AcpBridge
137
201
 
138
- Manages the `qwen-code --acp` child process and ACP sessions.
202
+ `AcpBridge` is the current implementation used by standalone `qwen channel start`. It manages the `qwen-code --acp` child process and implements `ChannelAgentBridge`.
139
203
 
140
204
  ```typescript
141
205
  constructor(options: { cliEntryPath: string; cwd: string; model?: string })
@@ -160,10 +224,10 @@ constructor(options: { cliEntryPath: string; cwd: string; model?: string })
160
224
 
161
225
  ### SessionRouter
162
226
 
163
- Maps senders to ACP sessions based on the configured scope.
227
+ Maps senders to agent sessions based on the configured scope.
164
228
 
165
229
  ```typescript
166
- constructor(bridge: AcpBridge, defaultCwd: string, scope?: SessionScope, persistPath?: string)
230
+ constructor(bridge: ChannelAgentBridge, defaultCwd: string, scope?: SessionScope, persistPath?: string)
167
231
  ```
168
232
 
169
233
  **Routing keys by scope:**
@@ -174,12 +238,13 @@ constructor(bridge: AcpBridge, defaultCwd: string, scope?: SessionScope, persist
174
238
  | `thread` | `channel:threadId` | One session per thread |
175
239
  | `single` | `channel:__single__` | One shared session for the entire channel |
176
240
 
177
- | Method | Description |
178
- | --------------------------------------------------------- | ----------------------------------------------------------- |
179
- | `resolve(channelName, senderId, chatId, threadId?, cwd?)` | Get or create a session for the given sender |
180
- | `removeSession(channelName, senderId, chatId?)` | Remove session(s) — used by `/clear` |
181
- | `restoreSessions()` | Reload sessions from disk after bridge restart |
182
- | `clearAll()` | Clear all sessions and delete persist file (clean shutdown) |
241
+ | Method | Description |
242
+ | ---------------------------------------------------------- | ----------------------------------------------------------- |
243
+ | `resolve(channelName, senderId, chatId, threadId?, cwd?)` | Get or create a session for the given sender |
244
+ | `removeSession(channelName, senderId, chatId?, threadId?)` | Remove session(s) — used by `/clear` |
245
+ | `removeSessionId(sessionId)` | Remove all routing state for a bridge session ID |
246
+ | `restoreSessions()` | Reload sessions from disk after bridge restart |
247
+ | `clearAll()` | Clear all sessions and delete persist file (clean shutdown) |
183
248
 
184
249
  ### SenderGate
185
250
 
@@ -1,25 +1,19 @@
1
1
  import { EventEmitter } from 'node:events';
2
+ import type { AvailableCommand, ChannelAgentBridge } from './ChannelAgentBridge.js';
3
+ export type { AvailableCommand, ToolCallEvent } from './ChannelAgentBridge.js';
2
4
  export interface AcpBridgeOptions {
3
5
  cliEntryPath: string;
4
6
  cwd: string;
5
7
  model?: string;
6
8
  }
7
- export interface AvailableCommand {
8
- name: string;
9
- description: string;
10
- input?: {
11
- hint: string;
12
- } | null;
13
- }
14
- export interface ToolCallEvent {
15
- sessionId: string;
16
- toolCallId: string;
17
- kind: string;
18
- title: string;
19
- status: string;
20
- rawInput?: Record<string, unknown>;
21
- }
22
- export declare class AcpBridge extends EventEmitter {
9
+ /**
10
+ * Read a command's aliases off a raw wire `available_commands_update` entry. ACP
11
+ * carries them in `_meta` (its only extension point); a top-level `altNames` is
12
+ * also accepted for forward-compat. Returns undefined when absent so the field
13
+ * stays optional and entries without aliases are left byte-identical.
14
+ */
15
+ export declare function readAvailableCommandAltNames(raw: unknown): string[] | undefined;
16
+ export declare class AcpBridge extends EventEmitter implements ChannelAgentBridge {
23
17
  private child;
24
18
  private connection;
25
19
  private options;
package/dist/AcpBridge.js CHANGED
@@ -2,6 +2,30 @@ import { spawn } from 'node:child_process';
2
2
  import { Readable, Writable } from 'node:stream';
3
3
  import { EventEmitter } from 'node:events';
4
4
  import { ClientSideConnection, ndJsonStream, PROTOCOL_VERSION, } from '@agentclientprotocol/sdk';
5
+ /**
6
+ * Read a command's aliases off a raw wire `available_commands_update` entry. ACP
7
+ * carries them in `_meta` (its only extension point); a top-level `altNames` is
8
+ * also accepted for forward-compat. Returns undefined when absent so the field
9
+ * stays optional and entries without aliases are left byte-identical.
10
+ */
11
+ export function readAvailableCommandAltNames(raw) {
12
+ if (typeof raw !== 'object' || raw === null)
13
+ return undefined;
14
+ const record = raw;
15
+ const meta = record['_meta'];
16
+ const fromMeta = typeof meta === 'object' && meta !== null
17
+ ? meta['altNames']
18
+ : undefined;
19
+ const source = Array.isArray(record['altNames'])
20
+ ? record['altNames']
21
+ : Array.isArray(fromMeta)
22
+ ? fromMeta
23
+ : undefined;
24
+ if (!source)
25
+ return undefined;
26
+ const names = source.filter((n) => typeof n === 'string');
27
+ return names.length > 0 ? names : undefined;
28
+ }
5
29
  export class AcpBridge extends EventEmitter {
6
30
  child = null;
7
31
  connection = null;
@@ -38,6 +62,8 @@ export class AcpBridge extends EventEmitter {
38
62
  });
39
63
  this.child.on('exit', (code, signal) => {
40
64
  process.stderr.write(`[AcpBridge] Process exited (code=${code}, signal=${signal})\n`);
65
+ // Do not emit sessionDied here: a full ACP process exit is handled by
66
+ // channel start crash recovery, which reloads the persisted sessions.
41
67
  this.connection = null;
42
68
  this.child = null;
43
69
  this.emit('disconnected', code, signal);
@@ -154,7 +180,10 @@ export class AcpBridge extends EventEmitter {
154
180
  }
155
181
  case 'available_commands_update': {
156
182
  if (Array.isArray(update['availableCommands'])) {
157
- this._availableCommands = update['availableCommands'];
183
+ this._availableCommands = update['availableCommands'].map((cmd) => {
184
+ const altNames = readAvailableCommandAltNames(cmd);
185
+ return altNames ? { ...cmd, altNames } : cmd;
186
+ });
158
187
  }
159
188
  break;
160
189
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AcpBridge.js","sourceRoot":"","sources":["../src/AcpBridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,gBAAgB,GACjB,MAAM,0BAA0B,CAAC;AA6BlC,MAAM,OAAO,SAAU,SAAQ,YAAY;IACjC,KAAK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C,4BAA4B,CAAC,CAAC;QAChD,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;CACF"}
@@ -36,6 +36,8 @@ export declare class BlockStreamer {
36
36
  push(chunk: string): void;
37
37
  /** Flush all remaining buffered text. Awaits all pending sends. */
38
38
  flush(): Promise<void>;
39
+ /** Drop buffered text and cancel future idle emission. */
40
+ stop(): void;
39
41
  private checkEmit;
40
42
  private onIdle;
41
43
  private emitBlock;
@@ -42,6 +42,11 @@ export class BlockStreamer {
42
42
  }
43
43
  await this.sending;
44
44
  }
45
+ /** Drop buffered text and cancel future idle emission. */
46
+ stop() {
47
+ this.clearIdleTimer();
48
+ this.buffer = '';
49
+ }
45
50
  // ---------------------------------------------------------------------------
46
51
  // Internal
47
52
  // ---------------------------------------------------------------------------
@@ -1 +1 @@
1
- {"version":3,"file":"BlockStreamer.js","sourceRoot":"","sources":["../src/BlockStreamer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAaH,MAAM,OAAO,aAAa;IAChB,MAAM,GAAG,EAAE,CAAC;IACZ,SAAS,GAAyC,IAAI,CAAC;IACvD,OAAO,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3C,IAAI,CAAuB;IAEnC,uCAAuC;IACvC,UAAU,GAAG,CAAC,CAAC;IAEf,YAAY,IAA0B;QACpC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,mDAAmD;IACnD,IAAI,CAAC,KAAa;QAChB,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC;QACrB,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,SAAS,EAAE,CAAC;QAEjB,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnD,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,M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AAC,MAAM,CAAC,CAAC;QACrC,IAAI,IAAI,GAAG,CAAC;YAAE,OAAO,IAAI,GAAG,CAAC,CAAC;QAC9B,MAAM,EAAE,GAAG,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,EAAE,GAAG,CAAC;YAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAC1B,MAAM,EAAE,GAAG,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,EAAE,GAAG,CAAC;YAAE,OAAO,EAAE,GAAG,CAAC,CAAC;QAC1B,OAAO,MAAM,CAAC;IAChB,CAAC;IAEO,cAAc;QACpB,IAAI,IAAI,CAAC,SAAS,KAAK,IAAI,EAAE,CAAC;YAC5B,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC7B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACxB,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,47 @@
1
+ export interface AvailableCommand {
2
+ name: string;
3
+ description: string;
4
+ input?: {
5
+ hint: string;
6
+ } | null;
7
+ /**
8
+ * Aliases the agent's parser also accepts for this command (for example
9
+ * `summarize` for `compress`).
10
+ */
11
+ altNames?: string[];
12
+ }
13
+ export interface ToolCallEvent {
14
+ sessionId: string;
15
+ toolCallId: string;
16
+ kind: string;
17
+ title: string;
18
+ status: string;
19
+ rawInput?: Record<string, unknown>;
20
+ }
21
+ export interface SessionDiedEvent {
22
+ sessionId: string;
23
+ reason?: string;
24
+ }
25
+ interface ChannelAgentBridgeEventMap {
26
+ sessionDied: [SessionDiedEvent];
27
+ textChunk: [sessionId: string, chunk: string];
28
+ toolCall: [ToolCallEvent];
29
+ }
30
+ export interface ChannelAgentBridge {
31
+ readonly availableCommands: AvailableCommand[];
32
+ on<K extends keyof ChannelAgentBridgeEventMap>(eventName: K, listener: (...args: ChannelAgentBridgeEventMap[K]) => void): unknown;
33
+ off<K extends keyof ChannelAgentBridgeEventMap>(eventName: K, listener: (...args: ChannelAgentBridgeEventMap[K]) => void): unknown;
34
+ newSession(cwd: string): Promise<string>;
35
+ loadSession(sessionId: string, cwd: string): Promise<string>;
36
+ prompt(sessionId: string, text: string, options?: {
37
+ imageBase64?: string;
38
+ imageMimeType?: string;
39
+ }): Promise<string>;
40
+ cancelSession(sessionId: string): Promise<void>;
41
+ shellCommand?(sessionId: string, command: string, signal?: AbortSignal): Promise<{
42
+ exitCode: number | null;
43
+ output: string;
44
+ aborted: boolean;
45
+ }>;
46
+ }
47
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ChannelAgentBridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChannelAgentBridge.js","sourceRoot":"","sources":["../src/ChannelAgentBridge.ts"],"names":[],"mappings":""}
@@ -2,16 +2,30 @@ import type { ChannelConfig, Envelope } from './types.js';
2
2
  import { GroupGate } from './GroupGate.js';
3
3
  import { SenderGate } from './SenderGate.js';
4
4
  import { SessionRouter } from './SessionRouter.js';
5
- import type { AcpBridge, ToolCallEvent } from './AcpBridge.js';
5
+ import type { ChannelAgentBridge, ToolCallEvent } from './ChannelAgentBridge.js';
6
+ /**
7
+ * Max time /clear waits for a cancelled in-flight turn to wind down before
8
+ * purging anyway. A wedged ACP child (stuck tool call, not reading stdin, or
9
+ * crashed without closing) can leave active.done unresolved forever; without
10
+ * this bound /clear — and the whole channel — would hang. Safe because the
11
+ * purge runs regardless and the generation is bumped, so a turn that settles
12
+ * later is already invalidated.
13
+ */
14
+ export declare const CLEAR_CANCEL_TIMEOUT_MS = 3000;
6
15
  export interface ChannelBaseOptions {
7
16
  router?: SessionRouter;
8
17
  proxy?: string;
18
+ /**
19
+ * Set when a channel owns a supplied router and should consume bridge
20
+ * events directly.
21
+ */
22
+ registerBridgeEvents?: boolean;
9
23
  }
10
24
  /** Handler for a slash command. Return true if handled, false to forward to agent. */
11
25
  type CommandHandler = (envelope: Envelope, args: string) => Promise<boolean>;
12
26
  export declare abstract class ChannelBase {
13
27
  protected config: ChannelConfig;
14
- protected bridge: AcpBridge;
28
+ protected bridge: ChannelAgentBridge;
15
29
  protected groupGate: GroupGate;
16
30
  protected gate: SenderGate;
17
31
  protected router: SessionRouter;
@@ -22,17 +36,29 @@ export declare abstract class ChannelBase {
22
36
  private commands;
23
37
  /** Per-session promise chain to serialize prompt + send (followup mode). */
24
38
  private sessionQueues;
39
+ private readonly registerBridgeEvents;
40
+ /**
41
+ * Per-session generation, bumped by /clear. A queued followup turn captures the
42
+ * generation when it enqueues and bails if /clear bumped it before the turn ran,
43
+ * so a cleared session can't be resurrected by an already-queued prompt.
44
+ */
45
+ private sessionGenerations;
25
46
  /** Per-session active prompt tracking for dispatch modes. */
26
47
  private activePrompts;
27
48
  /** Per-session message buffer for collect mode. */
28
49
  private collectBuffers;
29
- constructor(name: string, config: ChannelConfig, bridge: AcpBridge, options?: ChannelBaseOptions);
50
+ private readonly bridgeToolCallListener;
51
+ private readonly bridgeSessionDiedListener;
52
+ constructor(name: string, config: ChannelConfig, bridge: ChannelAgentBridge, options?: ChannelBaseOptions);
30
53
  abstract connect(): Promise<void>;
31
54
  abstract sendMessage(chatId: string, text: string): Promise<void>;
32
55
  abstract disconnect(): void;
33
56
  /** Replace the bridge instance (used after crash recovery restart). */
34
- setBridge(bridge: AcpBridge): void;
57
+ setBridge(bridge: ChannelAgentBridge): void;
35
58
  onToolCall(_chatId: string, _event: ToolCallEvent): void;
59
+ onSessionDied(sessionId: string): void;
60
+ private attachBridgeEvents;
61
+ private detachBridgeEvents;
36
62
  /**
37
63
  * Called when a prompt actually begins processing (inside the session queue).
38
64
  * Override to show a platform-specific working indicator (e.g., typing, reaction).
@@ -62,15 +88,90 @@ export declare abstract class ChannelBase {
62
88
  * Overrides shared commands if the same name is registered.
63
89
  */
64
90
  protected registerCommand(name: string, handler: CommandHandler): void;
91
+ protected registerCancelCommand(name?: string): void;
65
92
  /** Register shared slash commands. Called from constructor. */
66
93
  private registerSharedCommands;
67
94
  /** Check if a message text matches a registered local command. */
68
95
  protected isLocalCommand(text: string): boolean;
96
+ private findActiveSessionId;
97
+ /**
98
+ * Whether the resolved session is SHARED across senders. `single` collapses
99
+ * the whole channel to one `__single__` session for EVERY sender — group OR
100
+ * DM — so it is ALWAYS shared (even a DM maps to `__single__`). `thread` is
101
+ * shared only in a group (a DM maps to the lone caller's own chat). `user` is
102
+ * per-sender, never shared. Drives both the destructive-/clear confirm gate
103
+ * and the host-shell (`!`) gate.
104
+ */
105
+ private isSharedSession;
106
+ /**
107
+ * Whether `envelope.senderId` may act on the resolved session's destructive or
108
+ * workspace-leaking commands (/clear, /who). A SHARED session with a non-empty
109
+ * allowedUsers list is restricted to those members; a per-user session, or one
110
+ * with no allowlist, is unrestricted. Shared verbatim by /clear and /who so the
111
+ * gate can't drift; each caller sends its own rejection wording.
112
+ */
113
+ private isAuthorizedForSharedSession;
114
+ private stopActiveStreaming;
115
+ /**
116
+ * Cancel the active turn and wait (bounded) for it to wind down. Stops the
117
+ * BlockStreamer so buffered text can't leak via the idle timer, then fires a
118
+ * best-effort cancelSession (NOT awaited — a wedged child/daemon can leave the
119
+ * request pending forever). Returns true if active.done settled first, false
120
+ * if the CLEAR_CANCEL_TIMEOUT_MS bound won (the turn never wound down). Used by
121
+ * /clear, which genuinely EVICTS the session and so must proceed even when the
122
+ * turn is wedged. Steer no longer uses this: it best-effort cancels then chains
123
+ * the new turn behind the old one (see handleInbound), so it never needs to
124
+ * proceed past a still-active turn.
125
+ */
126
+ private cancelAndAwaitActive;
69
127
  /**
70
128
  * Parse a slash command from message text.
71
- * Returns { command, args } or null if not a slash command.
129
+ * Returns { command, raw, args } or null if not a slash command. `command` is
130
+ * lowercased for case-insensitive LOCAL dispatch (registerCommand lowercases the
131
+ * names it stores); `raw` keeps the typed case so agent-command matching can be
132
+ * CASE-SENSITIVE, mirroring the CLI's parseSlashCommand (`cmd.name === part`).
72
133
  */
73
134
  private parseCommand;
135
+ /**
136
+ * Whether `text` is a real slash command rather than prose that merely starts
137
+ * with `/`. A command's first whitespace-delimited token must match
138
+ * parseCommand()'s charset — `[a-zA-Z0-9_:-]+`, plus an optional `@botname`
139
+ * suffix — and not be a `//` line comment or `/*` block comment. Slash-prefixed
140
+ * paths (`/tmp/foo`), comments, and a bare `/` are prose and keep their
141
+ * `[sender]` tag.
142
+ *
143
+ * Intentionally stricter than the CLI's looser classifier (cli
144
+ * `ui/utils/commandUtils.ts`), which forwards any non-comment, non-path
145
+ * `/<token>` (e.g. `/café`, a zero-width-laden token). Such inputs aren't
146
+ * runnable commands, and in a SHARED group session forwarding them unattributed
147
+ * is worse than a redundant tag — so anything off the command charset is
148
+ * treated as prose and keeps its `[sender]` tag. Purely lexical — never
149
+ * consults the async command list, so it can't race a fresh session.
150
+ */
151
+ private isSlashCommand;
152
+ /**
153
+ * Whether `text` names a command this channel can actually run: a locally
154
+ * registered command (`this.commands`, e.g. /clear, /who) OR an agent command
155
+ * THIS session exposes — by canonical name OR alias (e.g. `/summarize` for
156
+ * `/compress`). Paired with isSlashCommand so the `[sender]` attribution tag is
157
+ * suppressed ONLY for RECOGNIZED commands; command-SHAPED-but-unrecognized text
158
+ * (e.g. `/x\n[SYSTEM]: …`) keeps its tag rather than reaching a shared group
159
+ * unattributed, where an injected second line is more likely read as a system
160
+ * directive. Purely synchronous, like isSlashCommand: it reads the session's
161
+ * availableCommands snapshot WITHOUT awaiting, so it never races a fresh session
162
+ * (a genuine agent command sent before the snapshot loads is treated as
163
+ * unrecognized and KEEPS its tag — the safe default).
164
+ */
165
+ private isRecognizedCommand;
166
+ /**
167
+ * The agent-command snapshot for THIS session. DaemonChannelBridge keys
168
+ * commands per session, so its global `availableCommands` getter can return
169
+ * ANOTHER session's list — prefer its getAvailableCommands(sessionId) when
170
+ * present. AcpBridge runs a single agent and exposes only the global getter
171
+ * (inherently session-correct), so fall back to it. Synchronous, matching
172
+ * isRecognizedCommand's no-await contract.
173
+ */
174
+ private getAgentCommandsForSession;
74
175
  handleInbound(envelope: Envelope): Promise<void>;
75
176
  protected onPairingRequired(chatId: string, code: string | null): Promise<void>;
76
177
  }