xabot-cli 1.4.2
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/LICENSE +21 -0
- package/README.md +126 -0
- package/README.zh-CN.md +126 -0
- package/dist/bridge/index.d.ts +93 -0
- package/dist/bridge/index.d.ts.map +1 -0
- package/dist/bridge/index.js +811 -0
- package/dist/bridge/index.js.map +1 -0
- package/dist/bridge/input-parser.d.ts +16 -0
- package/dist/bridge/input-parser.d.ts.map +1 -0
- package/dist/bridge/input-parser.js +20 -0
- package/dist/bridge/input-parser.js.map +1 -0
- package/dist/cli/chat.d.ts +38 -0
- package/dist/cli/chat.d.ts.map +1 -0
- package/dist/cli/chat.js +147 -0
- package/dist/cli/chat.js.map +1 -0
- package/dist/cli/feishu.d.ts +3 -0
- package/dist/cli/feishu.d.ts.map +1 -0
- package/dist/cli/feishu.js +79 -0
- package/dist/cli/feishu.js.map +1 -0
- package/dist/cli/health.d.ts +15 -0
- package/dist/cli/health.d.ts.map +1 -0
- package/dist/cli/health.js +26 -0
- package/dist/cli/health.js.map +1 -0
- package/dist/cli/index.d.ts +13 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +43 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/run.d.ts +20 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +43 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/wechat.d.ts +3 -0
- package/dist/cli/wechat.d.ts.map +1 -0
- package/dist/cli/wechat.js +86 -0
- package/dist/cli/wechat.js.map +1 -0
- package/dist/core/client.d.ts +31 -0
- package/dist/core/client.d.ts.map +1 -0
- package/dist/core/client.js +2 -0
- package/dist/core/client.js.map +1 -0
- package/dist/core/error.d.ts +11 -0
- package/dist/core/error.d.ts.map +1 -0
- package/dist/core/error.js +21 -0
- package/dist/core/error.js.map +1 -0
- package/dist/core/fs-utils.d.ts +17 -0
- package/dist/core/fs-utils.d.ts.map +1 -0
- package/dist/core/fs-utils.js +84 -0
- package/dist/core/fs-utils.js.map +1 -0
- package/dist/core/logger.d.ts +10 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/logger.js +44 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/pairing.d.ts +10 -0
- package/dist/core/pairing.d.ts.map +1 -0
- package/dist/core/pairing.js +22 -0
- package/dist/core/pairing.js.map +1 -0
- package/dist/core/types.d.ts +50 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +11 -0
- package/dist/core/types.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/platforms/feishu/client.d.ts +49 -0
- package/dist/platforms/feishu/client.d.ts.map +1 -0
- package/dist/platforms/feishu/client.js +296 -0
- package/dist/platforms/feishu/client.js.map +1 -0
- package/dist/platforms/feishu/message.d.ts +49 -0
- package/dist/platforms/feishu/message.d.ts.map +1 -0
- package/dist/platforms/feishu/message.js +131 -0
- package/dist/platforms/feishu/message.js.map +1 -0
- package/dist/platforms/feishu/upload.d.ts +11 -0
- package/dist/platforms/feishu/upload.d.ts.map +1 -0
- package/dist/platforms/feishu/upload.js +60 -0
- package/dist/platforms/feishu/upload.js.map +1 -0
- package/dist/platforms/wechat/client.d.ts +53 -0
- package/dist/platforms/wechat/client.d.ts.map +1 -0
- package/dist/platforms/wechat/client.js +301 -0
- package/dist/platforms/wechat/client.js.map +1 -0
- package/dist/platforms/wechat/crypto.d.ts +23 -0
- package/dist/platforms/wechat/crypto.d.ts.map +1 -0
- package/dist/platforms/wechat/crypto.js +46 -0
- package/dist/platforms/wechat/crypto.js.map +1 -0
- package/dist/platforms/wechat/login.d.ts +19 -0
- package/dist/platforms/wechat/login.d.ts.map +1 -0
- package/dist/platforms/wechat/login.js +71 -0
- package/dist/platforms/wechat/login.js.map +1 -0
- package/dist/platforms/wechat/message.d.ts +102 -0
- package/dist/platforms/wechat/message.d.ts.map +1 -0
- package/dist/platforms/wechat/message.js +212 -0
- package/dist/platforms/wechat/message.js.map +1 -0
- package/dist/platforms/wechat/upload.d.ts +10 -0
- package/dist/platforms/wechat/upload.d.ts.map +1 -0
- package/dist/platforms/wechat/upload.js +86 -0
- package/dist/platforms/wechat/upload.js.map +1 -0
- package/dist/xacpp/establish-handler.d.ts +58 -0
- package/dist/xacpp/establish-handler.d.ts.map +1 -0
- package/dist/xacpp/establish-handler.js +152 -0
- package/dist/xacpp/establish-handler.js.map +1 -0
- package/dist/xacpp/index.d.ts +3 -0
- package/dist/xacpp/index.d.ts.map +1 -0
- package/dist/xacpp/index.js +3 -0
- package/dist/xacpp/index.js.map +1 -0
- package/dist/xacpp/initiator-session-handler.d.ts +30 -0
- package/dist/xacpp/initiator-session-handler.d.ts.map +1 -0
- package/dist/xacpp/initiator-session-handler.js +233 -0
- package/dist/xacpp/initiator-session-handler.js.map +1 -0
- package/dist/xacpp/session-handler.d.ts +17 -0
- package/dist/xacpp/session-handler.d.ts.map +1 -0
- package/dist/xacpp/session-handler.js +27 -0
- package/dist/xacpp/session-handler.js.map +1 -0
- package/dist/xacpp/stdin-router.d.ts +23 -0
- package/dist/xacpp/stdin-router.d.ts.map +1 -0
- package/dist/xacpp/stdin-router.js +46 -0
- package/dist/xacpp/stdin-router.js.map +1 -0
- package/package.json +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 drodreo
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
**[中文文档](README.zh-CN.md)**
|
|
2
|
+
|
|
3
|
+
# xabot
|
|
4
|
+
|
|
5
|
+
Bidirectional message bridge connecting XACPP-enabled Agents to Feishu and WeChat.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Cloud IM (Feishu / WeChat) ←→ xabot ←→ Agent (XACPP)
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
xabot is the **XACPP Responder** — it passively accepts establish requests from downstream XACPP Initiators and routes messages to/from cloud IM platforms. xabot only works with [XACPP-compatible](#xacpp-protocol) peers.
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g xabot
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Or build from source:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
git clone https://github.com/drodreo/xabot.git
|
|
23
|
+
cd xabot
|
|
24
|
+
npm install
|
|
25
|
+
npm run build
|
|
26
|
+
npm install -g .
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
CLI is organized by platform subcommands:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
xabot feishu --app-id <ID> --app-secret <SECRET> <action>
|
|
35
|
+
xabot wechat <action>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Actions
|
|
39
|
+
|
|
40
|
+
| Action | Lifecycle | Description |
|
|
41
|
+
|--------|-----------|-------------|
|
|
42
|
+
| `health` | One-shot | Verify credentials and connectivity |
|
|
43
|
+
| `run` | Long-running | Production: stdio ↔ platform bidirectional bridge |
|
|
44
|
+
| `chat` | Long-running | Interactive debug: terminal ↔ Agent ↔ platform |
|
|
45
|
+
|
|
46
|
+
### Feishu
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Health check
|
|
50
|
+
xabot feishu --app-id <ID> --app-secret <SECRET> health
|
|
51
|
+
|
|
52
|
+
# Production bridge
|
|
53
|
+
xabot feishu --app-id <ID> --app-secret <SECRET> run
|
|
54
|
+
|
|
55
|
+
# Interactive chat
|
|
56
|
+
xabot feishu --app-id <ID> --app-secret <SECRET> chat
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### WeChat
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Health check (requires a previously obtained token)
|
|
63
|
+
xabot wechat health --token <TOKEN>
|
|
64
|
+
|
|
65
|
+
# Production bridge (auto QR-code login on first start)
|
|
66
|
+
xabot wechat run
|
|
67
|
+
|
|
68
|
+
# Interactive chat
|
|
69
|
+
xabot wechat chat
|
|
70
|
+
|
|
71
|
+
# Reconnect with existing credentials
|
|
72
|
+
xabot wechat chat --credentials <CREDENTIALS>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### chat Terminal Commands
|
|
76
|
+
|
|
77
|
+
In `chat` mode, text input is parsed into commands or plain messages:
|
|
78
|
+
|
|
79
|
+
| Input | Action |
|
|
80
|
+
|-------|--------|
|
|
81
|
+
| Plain text | Send to Agent as `invoke_activity` |
|
|
82
|
+
| `/new [prompt]` | Create a new Activity |
|
|
83
|
+
| `/compact` | Compress current Activity context |
|
|
84
|
+
| `/cancel` | Cancel current Activity |
|
|
85
|
+
|
|
86
|
+
## Development
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npm install
|
|
90
|
+
npm run build # Compile TypeScript → dist/
|
|
91
|
+
npm test # Run all tests (vitest)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Architecture
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
xabot/
|
|
98
|
+
├── src/
|
|
99
|
+
│ ├── core/ # Platform client interface, types, pairing
|
|
100
|
+
│ ├── xacpp/ # XACPP EstablishHandler & SessionHandler
|
|
101
|
+
│ ├── platforms/
|
|
102
|
+
│ │ ├── feishu/ # Feishu client (WebSocket)
|
|
103
|
+
│ │ └── wechat/ # WeChat client (HTTP long-polling)
|
|
104
|
+
│ ├── bridge/ # Bidirectional message routing: cloud ↔ XACPP
|
|
105
|
+
│ └── cli/ # CLI entry point & subcommands (commander)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Key design points:
|
|
109
|
+
- **No persistence** — credentials are passed via CLI arguments
|
|
110
|
+
- **chatId via Establish handshake** — obtained dynamically, no hardcoded IDs
|
|
111
|
+
- **Activity ↔ chatId** — each chatId maps to exactly one XACPP activity
|
|
112
|
+
|
|
113
|
+
## XACPP Protocol
|
|
114
|
+
|
|
115
|
+
xabot implements the Responder side of the XACPP (eXtensible Agent Control Plane Protocol). The downstream Agent connects as the Initiator.
|
|
116
|
+
|
|
117
|
+
Protocol SDKs:
|
|
118
|
+
|
|
119
|
+
| SDK | Language | Repository |
|
|
120
|
+
|-----|----------|------------|
|
|
121
|
+
| xacpp-ts | TypeScript | https://github.com/drodreo/xacpp-ts |
|
|
122
|
+
| xacpp-rs | Rust | https://github.com/drodreo/xacpp-rs |
|
|
123
|
+
|
|
124
|
+
## License
|
|
125
|
+
|
|
126
|
+
MIT
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
**[English](README.md)**
|
|
2
|
+
|
|
3
|
+
# xabot
|
|
4
|
+
|
|
5
|
+
连接 XACPP Agent 与飞书、微信的双向消息桥接工具。
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
云端 IM(飞书 / 微信)←→ xabot ←→ Agent (XACPP)
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
xabot 是 **XACPP Responder** — 被动接受下游 XACPP Initiator 的 establish 请求,在云端 IM 平台与 Agent 之间路由消息。xabot 仅兼容 [XACPP 协议](#xacpp-协议)对等端。
|
|
12
|
+
|
|
13
|
+
## 安装
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g xabot
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
或从源码构建:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
git clone https://github.com/drodreo/xabot.git
|
|
23
|
+
cd xabot
|
|
24
|
+
npm install
|
|
25
|
+
npm run build
|
|
26
|
+
npm install -g .
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 使用
|
|
30
|
+
|
|
31
|
+
CLI 按平台组织为子命令:
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
xabot feishu --app-id <ID> --app-secret <SECRET> <action>
|
|
35
|
+
xabot wechat <action>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 命令
|
|
39
|
+
|
|
40
|
+
| 命令 | 生命周期 | 说明 |
|
|
41
|
+
|------|---------|------|
|
|
42
|
+
| `health` | 单次 | 验证凭证与连通性 |
|
|
43
|
+
| `run` | 长连接 | 正式模式:stdio ↔ 平台双向桥接 |
|
|
44
|
+
| `chat` | 长连接 | 交互调试:终端 ↔ Agent ↔ 平台 |
|
|
45
|
+
|
|
46
|
+
### 飞书
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# 健康检查
|
|
50
|
+
xabot feishu --app-id <ID> --app-secret <SECRET> health
|
|
51
|
+
|
|
52
|
+
# 正式桥接
|
|
53
|
+
xabot feishu --app-id <ID> --app-secret <SECRET> run
|
|
54
|
+
|
|
55
|
+
# 交互式聊天
|
|
56
|
+
xabot feishu --app-id <ID> --app-secret <SECRET> chat
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 微信
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# 健康检查(需要已获取的 token)
|
|
63
|
+
xabot wechat health --token <TOKEN>
|
|
64
|
+
|
|
65
|
+
# 正式桥接(首次启动自动触发扫码登录)
|
|
66
|
+
xabot wechat run
|
|
67
|
+
|
|
68
|
+
# 交互式聊天
|
|
69
|
+
xabot wechat chat
|
|
70
|
+
|
|
71
|
+
# 使用已有凭证重新连接
|
|
72
|
+
xabot wechat chat --credentials <CREDENTIALS>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### chat 终端命令
|
|
76
|
+
|
|
77
|
+
在 `chat` 模式下,文本输入会被解析为命令或普通消息:
|
|
78
|
+
|
|
79
|
+
| 输入 | 动作 |
|
|
80
|
+
|------|------|
|
|
81
|
+
| 纯文本 | 作为 `invoke_activity` 发送给 Agent |
|
|
82
|
+
| `/new [prompt]` | 创建新 Activity |
|
|
83
|
+
| `/compact` | 压缩当前 Activity 上下文 |
|
|
84
|
+
| `/cancel` | 取消当前 Activity |
|
|
85
|
+
|
|
86
|
+
## 开发
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npm install
|
|
90
|
+
npm run build # 编译 TypeScript → dist/
|
|
91
|
+
npm test # 运行全量测试 (vitest)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## 架构
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
xabot/
|
|
98
|
+
├── src/
|
|
99
|
+
│ ├── core/ # 平台 Client 接口、类型、配对码
|
|
100
|
+
│ ├── xacpp/ # XACPP EstablishHandler & SessionHandler
|
|
101
|
+
│ ├── platforms/
|
|
102
|
+
│ │ ├── feishu/ # 飞书 Client(WebSocket 长连接)
|
|
103
|
+
│ │ └── wechat/ # 微信 Client(HTTP 长轮询)
|
|
104
|
+
│ ├── bridge/ # 双向消息路由:云端 ↔ XACPP
|
|
105
|
+
│ └── cli/ # CLI 入口 & 子命令(commander)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
核心设计:
|
|
109
|
+
- **无持久化** — 凭证通过 CLI 参数传入
|
|
110
|
+
- **chatId 通过 Establish 握手获取** — 动态获取,无需硬编码
|
|
111
|
+
- **Activity ↔ chatId** — 每个 chatId 对应唯一一个 XACPP activity
|
|
112
|
+
|
|
113
|
+
## XACPP 协议
|
|
114
|
+
|
|
115
|
+
xabot 实现 XACPP(eXtensible Agent Control Plane Protocol)的 Responder 侧。下游 Agent 作为 Initiator 连接。
|
|
116
|
+
|
|
117
|
+
协议 SDK:
|
|
118
|
+
|
|
119
|
+
| SDK | 语言 | 仓库 |
|
|
120
|
+
|-----|------|------|
|
|
121
|
+
| xacpp-ts | TypeScript | https://github.com/drodreo/xacpp-ts |
|
|
122
|
+
| xacpp-rs | Rust | https://github.com/drodreo/xacpp-rs |
|
|
123
|
+
|
|
124
|
+
## 许可
|
|
125
|
+
|
|
126
|
+
MIT
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { ChannelId } from '../core/types.js';
|
|
2
|
+
import type { PlatformClient } from '../core/client.js';
|
|
3
|
+
import type { XacppSession, XacppTransport, XacppActivityEvent, XacppCommand, XacppResponse } from 'xacpp';
|
|
4
|
+
/**
|
|
5
|
+
* Bridge — bidirectional message loop between cloud platform and XACPP agents.
|
|
6
|
+
*
|
|
7
|
+
* Cloud → Agent: reads cloud messages, resolves/creates activity,
|
|
8
|
+
* sends invoke_activity command via session.
|
|
9
|
+
* Agent → Cloud: reads agent events, routes content_delta/complete/notify
|
|
10
|
+
* back to the corresponding chatId.
|
|
11
|
+
*/
|
|
12
|
+
export declare class Bridge {
|
|
13
|
+
private cloud;
|
|
14
|
+
private readonly transport;
|
|
15
|
+
private readonly cloudReady;
|
|
16
|
+
private cloudReadyResolve;
|
|
17
|
+
/** chatId → (senderId → activityId) */
|
|
18
|
+
private readonly chatUserToActivity;
|
|
19
|
+
/** activityId → { chatId, senderId } */
|
|
20
|
+
private readonly activityToTarget;
|
|
21
|
+
/** Obtained after establish, used to proactively send command/event */
|
|
22
|
+
private session;
|
|
23
|
+
/** chatId bound to the established session (from session.credentials) */
|
|
24
|
+
private sessionChatId;
|
|
25
|
+
/** targetKey (chatId:senderId) → pending queue state */
|
|
26
|
+
private readonly pendingQueues;
|
|
27
|
+
/** targetKey → buffered media ContentParts awaiting next text invoke */
|
|
28
|
+
private readonly pendingMediaByTarget;
|
|
29
|
+
private abortCtrl;
|
|
30
|
+
private closed;
|
|
31
|
+
private runPromise;
|
|
32
|
+
/** Whether the establish handshake has completed. */
|
|
33
|
+
private established;
|
|
34
|
+
/** Reference to the establish handler — Phase 1 feeds discovered challenges to it. */
|
|
35
|
+
private establishHandler;
|
|
36
|
+
private verbose;
|
|
37
|
+
constructor(transport: XacppTransport, options?: {
|
|
38
|
+
cloud?: PlatformClient;
|
|
39
|
+
verbose?: boolean;
|
|
40
|
+
});
|
|
41
|
+
/** Replace the cloud PlatformClient (used after Establish login creates a new client). */
|
|
42
|
+
replaceCloud(cloud: PlatformClient): void;
|
|
43
|
+
/** Call after establish succeeds to inject session reference. */
|
|
44
|
+
setSession(session: XacppSession): void;
|
|
45
|
+
/** Set the establish handler — Phase 1 feeds discovered challenges to it. */
|
|
46
|
+
setEstablishHandler(handler: {
|
|
47
|
+
submitChallenge(challenge: string, chatId: ChannelId): void;
|
|
48
|
+
}): void;
|
|
49
|
+
/** Generate targetKey for pending queue lookup. */
|
|
50
|
+
private targetKey;
|
|
51
|
+
/** Get or create pending queue for a target. */
|
|
52
|
+
private ensureQueue;
|
|
53
|
+
/** Create a PendingItem from an event. */
|
|
54
|
+
private createPendingItem;
|
|
55
|
+
/** Format action_request for cloud display. */
|
|
56
|
+
private formatActionMessage;
|
|
57
|
+
/** Format question for cloud display. */
|
|
58
|
+
private formatQuestionMessage;
|
|
59
|
+
/** Format sensitive_info_operation for cloud display. */
|
|
60
|
+
private formatSensitiveInfoMessage;
|
|
61
|
+
/** Parse user text into a pending response, or null if unrecognized. */
|
|
62
|
+
private tryParsePendingResponse;
|
|
63
|
+
/** Get or create senderId→activityId sub-map for a chatId. */
|
|
64
|
+
private ensureUserMap;
|
|
65
|
+
/** Look up activityId for (chatId, senderId). */
|
|
66
|
+
private getActivityForUser;
|
|
67
|
+
/** Bind activityId ↔ (chatId, senderId) bidirectionally. */
|
|
68
|
+
private bindActivity;
|
|
69
|
+
/** Unbind activityId for (chatId, senderId). */
|
|
70
|
+
private unbindActivity;
|
|
71
|
+
/** activityId → state (processingMessageId, thinkingStart, toolActiveStart, expressingStart) */
|
|
72
|
+
private readonly activityStates;
|
|
73
|
+
private setTypingIndicatorIfNeeded;
|
|
74
|
+
private releaseTypingIndicatorForActivity;
|
|
75
|
+
private endThinking;
|
|
76
|
+
/** Send a single ContentPart to the cloud platform. */
|
|
77
|
+
private _sendContentPart;
|
|
78
|
+
/** Handle Command from downstream Agent (forwarded via XabotSessionHandler.onCommand). */
|
|
79
|
+
handleCommand(command: XacppCommand): Promise<XacppResponse>;
|
|
80
|
+
/** Handle Event from downstream Agent (forwarded via XabotSessionHandler.onEvent). */
|
|
81
|
+
handleEvent(activityId: string, event: XacppActivityEvent): Promise<XacppResponse>;
|
|
82
|
+
/** Send the next queued pending item to cloud. */
|
|
83
|
+
private sendNextPending;
|
|
84
|
+
/** Resolve a pending request and drive the queue forward. */
|
|
85
|
+
resolvePending(requestId: string, response: XacppResponse): void;
|
|
86
|
+
/** Cloud message loop: two-phase consumption (idempotent). */
|
|
87
|
+
run(): Promise<void>;
|
|
88
|
+
private _run;
|
|
89
|
+
/** Mark the establish handshake as completed — switches to Phase 2 routing. */
|
|
90
|
+
markEstablished(): void;
|
|
91
|
+
close(): Promise<void>;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=index.d.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