@xopcai/xopc 0.0.43 → 0.0.45
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 +138 -102
- package/README.zh-CN.md +155 -67
- package/dist/extensions/dingtalk/src/plugin.js +1 -1
- package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
- package/dist/extensions/telegram/src/plugin.js +1 -1
- package/dist/extensions/telegram/src/routing-integration.js +2 -2
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/api/api.js +2 -2
- package/dist/extensions/weixin/src/auth/accounts.js +1 -1
- package/dist/extensions/weixin/src/cdn/upload.js +1 -1
- package/dist/extensions/weixin/src/media/data-url.js +1 -1
- package/dist/extensions/weixin/src/messaging/debug-mode.js +1 -1
- package/dist/extensions/weixin/src/messaging/inbound.js +1 -1
- package/dist/extensions/weixin/src/messaging/process-message.js +1 -1
- package/dist/extensions/weixin/src/plugin.js +1 -1
- package/dist/extensions/weixin/src/storage/sync-buf.js +1 -1
- package/dist/gateway/static/root/assets/agents-Bk2uuFvC.js +216 -0
- package/dist/gateway/static/root/assets/agents-Bk2uuFvC.js.map +1 -0
- package/dist/gateway/static/root/assets/{apps-page-Bco3oZzd.js → apps-page-CbSr8cvX.js} +2 -2
- package/dist/gateway/static/root/assets/{apps-page-Bco3oZzd.js.map → apps-page-CbSr8cvX.js.map} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-Dn-hIRl1.js +2 -0
- package/dist/gateway/static/root/assets/{channels-settings-CpTZxCKG.js.map → channels-settings-Dn-hIRl1.js.map} +1 -1
- package/dist/gateway/static/root/assets/{cron-api-YLqLzMDN.js → cron-dreaming-jobs-D460WnXB.js} +3 -3
- package/dist/gateway/static/root/assets/cron-dreaming-jobs-D460WnXB.js.map +1 -0
- package/dist/gateway/static/root/assets/cron-page-Df6AyXfn.js +2 -0
- package/dist/gateway/static/root/assets/cron-page-Df6AyXfn.js.map +1 -0
- package/dist/gateway/static/root/assets/dist-DN37Fw0E.js +2 -0
- package/dist/gateway/static/root/assets/{dist-4ClCuR-G.js.map → dist-DN37Fw0E.js.map} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-yNO3rwBQ.js → extension-debug-page-CqdKfBv_.js} +2 -2
- package/dist/gateway/static/root/assets/{extension-debug-page-yNO3rwBQ.js.map → extension-debug-page-CqdKfBv_.js.map} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-D0vOu9eC.js → extension-page-DhxjnfDf.js} +2 -2
- package/dist/gateway/static/root/assets/{extension-page-D0vOu9eC.js.map → extension-page-DhxjnfDf.js.map} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-B3uhrA_f.js +2 -0
- package/dist/gateway/static/root/assets/{extension-settings-page-DqaNWoo7.js.map → extension-settings-page-B3uhrA_f.js.map} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-config-api-z1kl5_rE.js +2 -0
- package/dist/gateway/static/root/assets/heartbeat-config-api-z1kl5_rE.js.map +1 -0
- package/dist/gateway/static/root/assets/{index-K0ZDwzeJ.css → index-B8G4Y9YY.css} +1 -1
- package/dist/gateway/static/root/assets/{index-KxjI2fjF.js → index-BUYGk2UT.js} +93 -93
- package/dist/gateway/static/root/assets/{index-KxjI2fjF.js.map → index-BUYGk2UT.js.map} +1 -1
- package/dist/gateway/static/root/assets/logs-page-Z9KRHWeO.js +2 -0
- package/dist/gateway/static/root/assets/{logs-page-DSdKuyeD.js.map → logs-page-Z9KRHWeO.js.map} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-TlMYZxuv.js +2 -0
- package/dist/gateway/static/root/assets/{sessions-page-Bfb-hZJb.js.map → sessions-page-TlMYZxuv.js.map} +1 -1
- package/dist/gateway/static/root/assets/settings-page-X8vVcB8e.js +2 -0
- package/dist/gateway/static/root/assets/settings-page-X8vVcB8e.js.map +1 -0
- package/dist/gateway/static/root/assets/skills-page-B-tO9-I7.js +3 -0
- package/dist/gateway/static/root/assets/skills-page-B-tO9-I7.js.map +1 -0
- package/dist/gateway/static/root/assets/{use-image-provider-credentials-Cu5zeVdn.js → use-image-provider-credentials-DsYECmye.js} +2 -2
- package/dist/gateway/static/root/assets/{use-image-provider-credentials-Cu5zeVdn.js.map → use-image-provider-credentials-DsYECmye.js.map} +1 -1
- package/dist/gateway/static/root/index.html +2 -2
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +6 -6
- package/dist/src/agent/context/workspace-seed.js +2 -2
- package/dist/src/agent/goals/post-turn.js +1 -1
- package/dist/src/agent/image/load-image-media.js +1 -1
- package/dist/src/agent/ipc/bus.js +1 -1
- package/dist/src/agent/ipc/inbox.js +2 -2
- package/dist/src/agent/ipc/socket.js +1 -1
- package/dist/src/agent/memory/builtin-memory-store.js +1 -1
- package/dist/src/agent/memory/dreaming/deep-promotion.js +1 -1
- package/dist/src/agent/memory/dreaming/events.js +1 -1
- package/dist/src/agent/memory/dreaming/last-run.js +1 -1
- package/dist/src/agent/memory/dreaming/light-sweep.js +1 -1
- package/dist/src/agent/memory/dreaming/preview.js +1 -1
- package/dist/src/agent/memory/dreaming/rem-patterns.js +1 -1
- package/dist/src/agent/memory/dreaming/short-term-store.js +1 -1
- package/dist/src/agent/memory/dreaming/utils.js +1 -1
- package/dist/src/agent/memory/plugin-discovery.js +1 -1
- package/dist/src/agent/models/manager.js +1 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +2 -2
- package/dist/src/agent/service.js +5 -5
- package/dist/src/agent/skills/config.js +1 -1
- package/dist/src/agent/skills/hub-hash.js +2 -2
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/skills/hub-pull.js +1 -1
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/scanner.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/skills/skill-manager.js +1 -1
- package/dist/src/agent/tools/dreaming-tool.js +1 -1
- package/dist/src/agent/tools/factory.js +1 -1
- package/dist/src/agent/tools/image-generate-tool.js +1 -1
- package/dist/src/agent/tools/send-media.js +1 -1
- package/dist/src/agent/tools/skill-manage-tool.js +1 -1
- package/dist/src/agent/tools/write.js +1 -1
- package/dist/src/auth/credentials.js +3 -3
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +1 -1
- package/dist/src/channels/attachments/inbound-persist.js +1 -1
- package/dist/src/channels/attachments/outbound-tts-persist.js +1 -1
- package/dist/src/channels/outbound/persist-store.js +1 -1
- package/dist/src/channels/pairing/allow-from-file.js +1 -1
- package/dist/src/channels/pairing/pairing-store.js +2 -2
- package/dist/src/chat-commands/builtins/config.js +2 -2
- package/dist/src/chat-commands/context.js +1 -1
- package/dist/src/cli/commands/agent.js +1 -1
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/config.js +1 -1
- package/dist/src/cli/commands/doctor/checks/config-health.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/doctor/checks/session-integrity.js +1 -1
- package/dist/src/cli/commands/doctor/checks/state-integrity.js +1 -1
- package/dist/src/cli/commands/doctor/checks/workspace-status.js +1 -1
- package/dist/src/cli/commands/extension-dev.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/extension-pack.js +1 -1
- package/dist/src/cli/commands/image.js +1 -1
- package/dist/src/cli/commands/init.js +4 -4
- package/dist/src/cli/utils/init-workspace.js +2 -2
- package/dist/src/config/index.js +2 -2
- package/dist/src/config/loader.js +2 -2
- package/dist/src/config/models-json.js +2 -2
- package/dist/src/config/profile.js +2 -2
- package/dist/src/cron/executor.js +2 -2
- package/dist/src/cron/persistence.js +1 -1
- package/dist/src/cron/run-log-store.js +1 -1
- package/dist/src/daemon/launchd.js +2 -2
- package/dist/src/daemon/systemd.js +2 -2
- package/dist/src/extensions/health.js +1 -1
- package/dist/src/extensions/loader.js +1 -1
- package/dist/src/extensions/lockfile.js +2 -2
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/hono/lib/extension-store.js +1 -1
- package/dist/src/gateway/hono/lib/static-ui.js +1 -1
- package/dist/src/gateway/hono/oauth.js +1 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/config.js +1 -1
- package/dist/src/gateway/hono/routes/dreaming.js +1 -1
- package/dist/src/gateway/hono/routes/host-fs.js +1 -1
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/workspace.js +3 -3
- package/dist/src/gateway/hono/sse.js +2 -2
- package/dist/src/gateway/lock.js +2 -2
- package/dist/src/gateway/service/run-gateway-agent.js +2 -2
- package/dist/src/gateway/service.js +5 -5
- package/dist/src/gateway/workspace-fs-file-list.js +1 -1
- package/dist/src/gateway/workspace-heartbeat-path.js +1 -1
- package/dist/src/infra/update-check.js +1 -1
- package/dist/src/infra/update-lock.js +3 -3
- package/dist/src/infra/update-runner.js +1 -1
- package/dist/src/infra/update-startup.js +2 -2
- package/dist/src/infra/write-file-atomic.js +2 -2
- package/dist/src/providers/auth-runtime/auth-profile-store.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/session/config-store.js +2 -2
- package/dist/src/session/search-index-cache.js +1 -1
- package/dist/src/session/search-index.js +1 -1
- package/dist/src/session/session-title.js +1 -1
- package/dist/src/session/store.js +5 -5
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/utils/logger/audit.js +1 -1
- package/dist/src/utils/logger/log-store.js +1 -1
- package/dist/src/utils/logger/rotation.js +1 -1
- package/dist/src/voice/tts/audio.js +1 -1
- package/dist/src/voice/tts/providers/edge-speech.js +1 -1
- package/package.json +2 -2
- package/dist/gateway/static/root/assets/agents-BDhkkT2o.js +0 -216
- package/dist/gateway/static/root/assets/agents-BDhkkT2o.js.map +0 -1
- package/dist/gateway/static/root/assets/channels-settings-CpTZxCKG.js +0 -2
- package/dist/gateway/static/root/assets/cron-api-YLqLzMDN.js.map +0 -1
- package/dist/gateway/static/root/assets/cron-page-aiDeJtJ-.js +0 -2
- package/dist/gateway/static/root/assets/cron-page-aiDeJtJ-.js.map +0 -1
- package/dist/gateway/static/root/assets/dist-4ClCuR-G.js +0 -2
- package/dist/gateway/static/root/assets/extension-settings-page-DqaNWoo7.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-DSdKuyeD.js +0 -2
- package/dist/gateway/static/root/assets/sessions-page-Bfb-hZJb.js +0 -2
- package/dist/gateway/static/root/assets/settings-page-B7NZPSpO.js +0 -2
- package/dist/gateway/static/root/assets/settings-page-B7NZPSpO.js.map +0 -1
- package/dist/gateway/static/root/assets/skills-page-D-AJTEVx.js +0 -3
- package/dist/gateway/static/root/assets/skills-page-D-AJTEVx.js.map +0 -1
package/README.zh-CN.md
CHANGED
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
<h1 align="center">xopc</h1>
|
|
7
7
|
|
|
8
8
|
<p align="center">
|
|
9
|
-
<strong
|
|
10
|
-
面向<strong
|
|
9
|
+
<strong>与你共同成长的 OPC 工作站。</strong><br />
|
|
10
|
+
面向<strong>一人公司</strong>的轻量<strong>个人 AI 助手</strong> —— <strong>本地部署</strong>、<strong>密钥自备(BYOK)</strong>,靠插件扩展能力,不必改核心代码。
|
|
11
11
|
</p>
|
|
12
12
|
|
|
13
13
|
<p align="center">
|
|
14
14
|
<a href="https://github.com/xopcai/xopc"><img src="https://img.shields.io/badge/GitHub-xopcai%2Fxopc-181717?style=for-the-badge&logo=github" alt="GitHub"></a>
|
|
15
15
|
<a href="https://xopcai.github.io/xopc/zh/"><img src="https://img.shields.io/badge/Docs-中文文档-228B22?style=for-the-badge" alt="中文文档"></a>
|
|
16
|
-
<a href="#quick-start
|
|
16
|
+
<a href="#quick-start"><img src="https://img.shields.io/badge/快速开始-CLI-blue?style=for-the-badge" alt="快速开始"></a>
|
|
17
17
|
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow?style=for-the-badge" alt="License"></a>
|
|
18
18
|
</p>
|
|
19
19
|
|
|
@@ -32,86 +32,148 @@
|
|
|
32
32
|
<a href="https://xopcai.github.io/xopc/zh/cli">CLI</a>
|
|
33
33
|
</p>
|
|
34
34
|
|
|
35
|
-
**CLI
|
|
35
|
+
**xopc** 是一套可**装在自己机器上**的智能体工具链:**命令行(CLI)**、全屏**终端界面(TUI)**、带网页后台的 **HTTP/WebSocket 网关**(控制台用 **React** 编写),以及可选的 **Electron** 桌面版(**macOS / Windows / Linux**),并内置 **Telegram、微信、飞书/Lark、钉钉** 等机器人插件。模型调用基于 **[@earendil-works/pi-ai](https://github.com/earendil-works/pi-mono)**,可对接 **20+** 家厂商。通过**扩展**加工具、接新机器人、接新模型;用 **SKILL.md** 管理技能;网页端还能用 **`@xopcai/xopc/extension-ui-sdk`** 做界面扩展。
|
|
36
36
|
|
|
37
37
|
---
|
|
38
38
|
|
|
39
|
-
##
|
|
39
|
+
## 主要特性
|
|
40
40
|
|
|
41
41
|
| | |
|
|
42
42
|
| --- | --- |
|
|
43
|
-
|
|
|
44
|
-
|
|
|
45
|
-
|
|
|
46
|
-
|
|
|
47
|
-
|
|
|
48
|
-
|
|
|
49
|
-
| **工作区工具** | 读/写/搜文件、网页搜索、可选浏览器工具、长任务进度反馈。 |
|
|
43
|
+
| **数据留在身边** | 服务跑在你自己电脑上;不接入会主动访问外网的机器人或联网插件时,数据默认不出本机。也**不必**绑死某一家公有云。 |
|
|
44
|
+
| **BYOK** | API Key、OAuth 等写在配置文件(`~/.xopc/xopc.json`)和环境变量里 —— 可用 DeepSeek(推荐)、 OpenAI、Anthropic、Google、**Ollama / LM Studio / vLLM**、Bedrock、Azure、OpenRouter、各类网关等。 |
|
|
45
|
+
| **多种用法** | **`xopc tui`**(全屏终端)、**`xopc agent`**(命令行里多轮聊)、**浏览器开网关网页**、**Electron 桌面版**(同一套界面)。 |
|
|
46
|
+
| **聊天机器人** | 内置 **Telegram**、**微信**、**飞书/Lark**、**钉钉**,以及网关自带的**网页对话**;私聊、群聊可做访问控制(配对、白名单等)。 |
|
|
47
|
+
| **图片与语音** | **图片**:识图、按需生图。**语音**:语音转文字、文字转语音(如 Telegram、网关等),详见文档。 |
|
|
48
|
+
| **可扩展** | **服务端**:`ChannelPlugin`、工具、定时任务(cron)、自定义模型接入。**界面**:用 **`@xopcai/xopc/extension-ui-sdk`** 扩展网关网页。 |
|
|
50
49
|
|
|
51
50
|
---
|
|
52
51
|
|
|
53
|
-
|
|
52
|
+
<a id="install"></a>
|
|
54
53
|
|
|
55
|
-
|
|
54
|
+
## 安装
|
|
55
|
+
|
|
56
|
+
**环境:** Node.js **≥ 22**(跑 CLI、起网关都需要)。在本仓库里开发时建议用 **pnpm**。
|
|
56
57
|
|
|
57
58
|
```bash
|
|
58
59
|
npm install -g @xopcai/xopc
|
|
59
60
|
# 或: pnpm add -g @xopcai/xopc
|
|
60
61
|
```
|
|
61
62
|
|
|
62
|
-
|
|
63
|
+
**装好后,**建议先跑一遍配置向导,把模型、密钥、机器人等一次配齐。
|
|
63
64
|
|
|
64
65
|
```bash
|
|
65
66
|
xopc onboard
|
|
66
|
-
#
|
|
67
|
+
# 只想快速选模型: xopc onboard --quick
|
|
67
68
|
```
|
|
68
69
|
|
|
69
|
-
然后在终端聊天,或启动网关以使用网页控制台与 IM 机器人。
|
|
70
|
-
|
|
71
70
|
---
|
|
72
71
|
|
|
73
|
-
<a id="quick-start
|
|
72
|
+
<a id="quick-start"></a>
|
|
74
73
|
|
|
75
|
-
##
|
|
74
|
+
## 快速上手
|
|
76
75
|
|
|
77
76
|
```bash
|
|
78
|
-
#
|
|
77
|
+
# 全屏终端:对话在本地跑,不必先起网关
|
|
78
|
+
xopc tui --local
|
|
79
|
+
|
|
80
|
+
# 命令行里多轮对话
|
|
79
81
|
xopc agent -i
|
|
80
82
|
|
|
81
|
-
#
|
|
83
|
+
# 只问一句
|
|
82
84
|
xopc agent -m "总结最近 5 条提交"
|
|
83
85
|
|
|
84
|
-
#
|
|
86
|
+
# 网关:REST/SSE + 内置网页控制台(地址看终端输出或配置里的 gateway)
|
|
85
87
|
xopc gateway
|
|
86
88
|
|
|
87
|
-
#
|
|
88
|
-
|
|
89
|
+
# 同一套网关,后台常驻(会打印 PID 和地址;停服:xopc gateway stop)
|
|
90
|
+
xopc gateway --background
|
|
89
91
|
```
|
|
90
92
|
|
|
91
|
-
|
|
93
|
+
**从源码开发:**
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
git clone https://github.com/xopcai/xopc.git && cd xopc
|
|
97
|
+
pnpm install && pnpm run dev -- agent -i # 开发阶段不必先 build
|
|
98
|
+
pnpm run build # 构建发布:Node + 网页 → dist/
|
|
99
|
+
```
|
|
92
100
|
|
|
93
101
|
---
|
|
94
102
|
|
|
95
|
-
|
|
103
|
+
<a id="electron-desktop"></a>
|
|
96
104
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
| 打开网页控制台 | 运行 `xopc gateway`,按日志或配置访问 |
|
|
101
|
-
| 使用 Telegram / 微信 | 在 `~/.xopc/xopc.json` 配置 `channels.telegram` / `channels.weixin` 并运行网关;微信可在网关主机执行 `xopc channels login --channel weixin` 扫码登录 |
|
|
102
|
-
| 引导配置 | `xopc onboard` |
|
|
103
|
-
| 定时任务 | 在配置中启用 `cron`;详见[文档](https://xopcai.github.io/xopc/zh/) |
|
|
105
|
+
## Electron 桌面版
|
|
106
|
+
|
|
107
|
+
### 从 GitHub Releases 下载
|
|
104
108
|
|
|
105
|
-
|
|
109
|
+
1. 打开 **[GitHub Releases](https://github.com/xopcai/xopc/releases)**。
|
|
110
|
+
2. 在最新版本里选本机系统对应的安装包(常见:**macOS** 用 `.dmg` / `.zip`,**Windows** 用 `.exe`,**Linux** 用 `.AppImage` / `.deb`)。
|
|
111
|
+
3. 像平时装软件一样安装或运行。macOS 若用语音相关功能,首次可能会要**麦克风**权限。
|
|
112
|
+
|
|
113
|
+
暂时没有适合你系统的安装包时,可先按上文 **[安装](#安装)** 装命令行版,再用 **`xopc gateway`**;需要桌面安装包可自行 **[从源码打包](#electron-desktop)**。
|
|
114
|
+
|
|
115
|
+
### 从源码打包
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
pnpm install
|
|
119
|
+
pnpm run electron:build # 输出在 dist/release/
|
|
120
|
+
```
|
|
106
121
|
|
|
107
122
|
---
|
|
108
123
|
|
|
109
|
-
##
|
|
124
|
+
## 怎么用?
|
|
125
|
+
|
|
126
|
+
| 方式 | 怎么用 | 适合谁 |
|
|
127
|
+
| --- | --- | --- |
|
|
128
|
+
| **TUI** | `xopc tui`、`xopc tui --local` 或 `xopc tui --url …` | 喜欢全屏终端,或要连远程网关 |
|
|
129
|
+
| **CLI** | `xopc agent -i` / `xopc agent -m "…"` | 写脚本、只要一个普通终端 |
|
|
130
|
+
| **网页** | 先 `xopc gateway`(前台)或 `xopc gateway --background`(后台),浏览器打开控制台地址 | 多人共用一台网关、习惯浏览器、要改各项设置 |
|
|
131
|
+
| **Electron** | **[Releases 下载安装包](#electron-desktop)** 或本地打包 | 要系统原生窗口(macOS / Windows / Linux) |
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## 内置频道(怎么配)
|
|
136
|
+
|
|
137
|
+
在 **`~/.xopc/xopc.json`** 里写 **`channels.*`**(配置文件路径可用环境变量 `XOPC_CONFIG` / `XOPC_CONFIG_PATH` 改掉)。各聊天机器人都要**先启动网关**;微信要在**跑网关的那台电脑**上扫码。
|
|
138
|
+
|
|
139
|
+
| 频道 | 对应配置 | 说明 |
|
|
140
|
+
| --- | --- | --- |
|
|
141
|
+
| **Telegram** | `channels.telegram` | 多账号、流式回复、语音、文件;私聊/群聊策略 |
|
|
142
|
+
| **微信** | `channels.weixin` | 在装网关的机器上扫码;私聊/群聊策略 |
|
|
143
|
+
| **飞书 / Lark** | `channels.feishu` | 机器人、Webhook 等,见文档 |
|
|
144
|
+
| **钉钉** | `channels.dingtalk` | Stream 模式;应用凭证见文档 |
|
|
145
|
+
| **网页** | *(随网关)* | 网关网页里的对话,不是单独再装一个 IM |
|
|
146
|
+
|
|
147
|
+
字段说明与安全默认值:**[频道](https://xopcai.github.io/xopc/zh/channels)**、**[配置](https://xopcai.github.io/xopc/zh/configuration)**。
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## 本地部署与 BYOK
|
|
152
|
+
|
|
153
|
+
- **密钥自己管:** 配置里写 `providers.*`,再配合各厂商环境变量(见 **[模型](https://xopcai.github.io/xopc/zh/models)**)。
|
|
154
|
+
- **纯本地推理:** 把默认模型指到 **Ollama**、**LM Studio**、**vLLM** 等兼容 OpenAI 接口的本地服务,可以不接公网大模型。
|
|
155
|
+
- **可选工具**(如浏览器自动化)默认**关闭**,要用再在配置里打开,并按需安装 Playwright Chromium 等。
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## 常用操作速查
|
|
160
|
+
|
|
161
|
+
| 想做什么 | 怎么做 |
|
|
162
|
+
| --- | --- |
|
|
163
|
+
| 在终端里聊 | `xopc tui --local` 或 `xopc agent -i` |
|
|
164
|
+
| 打开网页控制台 | `xopc gateway`,按终端或配置里的地址打开 |
|
|
165
|
+
| 网关放后台跑 | `xopc gateway --background`;可查 `xopc gateway status`、停 `xopc gateway stop`、重启 `xopc gateway restart`、看日志 `xopc gateway logs` |
|
|
166
|
+
| 接 Telegram / 微信 / 飞书 / 钉钉 | 配好 `channels.*` 并启动网关;微信:`xopc channels login --channel weixin` |
|
|
167
|
+
| 再跑一遍配置向导 | `xopc onboard` |
|
|
168
|
+
| 定时任务 | 在配置里启用 `cron` |
|
|
169
|
+
|
|
170
|
+
更多子命令见 **[CLI 参考](https://xopcai.github.io/xopc/zh/cli)**。
|
|
171
|
+
|
|
172
|
+
---
|
|
110
173
|
|
|
111
|
-
|
|
174
|
+
## 安全
|
|
112
175
|
|
|
113
|
-
|
|
114
|
-
- 网关令牌与监听地址:把网关当作管理面 API,注意绑定范围与保密。
|
|
176
|
+
从微信、Telegram 等渠道进来的消息都当作**不可信内容**。没摸清风险前,私聊建议用 **pairing(配对)** 或 **allowlist(白名单)**。网关监听地址、访问令牌(token)不要泄露 —— 详见 **[频道](https://xopcai.github.io/xopc/zh/channels)**。
|
|
115
177
|
|
|
116
178
|
---
|
|
117
179
|
|
|
@@ -119,48 +181,40 @@ pnpm install && pnpm run dev -- agent -i
|
|
|
119
181
|
|
|
120
182
|
| 指南 | 说明 |
|
|
121
183
|
| --- | --- |
|
|
122
|
-
| [快速开始](https://xopcai.github.io/xopc/zh/getting-started) |
|
|
123
|
-
| [配置](https://xopcai.github.io/xopc/zh/configuration) | `
|
|
184
|
+
| [快速开始](https://xopcai.github.io/xopc/zh/getting-started) | 安装、向导、第一次对话 |
|
|
185
|
+
| [配置](https://xopcai.github.io/xopc/zh/configuration) | `xopc.json` 字段说明 |
|
|
124
186
|
| [CLI](https://xopcai.github.io/xopc/zh/cli) | 命令与参数 |
|
|
125
|
-
| [频道](https://xopcai.github.io/xopc/zh/channels) |
|
|
126
|
-
| [扩展](https://xopcai.github.io/xopc/zh/extensions) |
|
|
187
|
+
| [频道](https://xopcai.github.io/xopc/zh/channels) | 各内置频道 |
|
|
188
|
+
| [扩展](https://xopcai.github.io/xopc/zh/extensions) | 扩展机制 |
|
|
127
189
|
| [工具](https://xopcai.github.io/xopc/zh/tools) | 内置工具 |
|
|
128
|
-
| [技能](https://xopcai.github.io/xopc/zh/skills) |
|
|
129
|
-
| [
|
|
190
|
+
| [技能](https://xopcai.github.io/xopc/zh/skills) | SKILL.md |
|
|
191
|
+
| [语音](https://xopcai.github.io/xopc/zh/voice) | 语音转文字、文字转语音 |
|
|
192
|
+
| [架构](https://xopcai.github.io/xopc/zh/architecture) | 整体结构 |
|
|
130
193
|
|
|
131
194
|
---
|
|
132
195
|
|
|
133
|
-
##
|
|
196
|
+
## 大模型厂商
|
|
134
197
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
| 频道 | 说明 |
|
|
138
|
-
| --- | --- |
|
|
139
|
-
| Telegram | 多账号、流式预览、语音(STT/TTS)、文件、白名单 / 群策略 |
|
|
140
|
-
| 微信(Weixin) | 在运行网关的机器上扫码登录、私聊/群策略、`channels.weixin` |
|
|
141
|
-
| 网页 | 网关自带的 React 控制台,通过浏览器使用 |
|
|
142
|
-
|
|
143
|
-
**不包含**飞书/Lark、Slack、Discord 等;若需支持,请自行开发并注册 `ChannelPlugin` 扩展。
|
|
198
|
+
**DeepSeek**(推荐)、OpenAI、Anthropic、Google、Groq、OpenRouter、Mistral、xAI、Bedrock、Azure、Vertex、Vercel AI Gateway、OAuth(如 Copilot/Codex)以及本地推理(由 pi-ai 统一接入)。详情:**[模型](https://xopcai.github.io/xopc/zh/models)**。
|
|
144
199
|
|
|
145
200
|
---
|
|
146
201
|
|
|
147
|
-
##
|
|
202
|
+
## 扩展与技能
|
|
148
203
|
|
|
149
204
|
```bash
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
pnpm run build # Node + 网页控制台 → dist
|
|
155
|
-
pnpm test
|
|
156
|
-
pnpm run lint
|
|
205
|
+
xopc extension install xopc-extension-weather
|
|
206
|
+
xopc extension create my-extension --kind tool
|
|
207
|
+
xopc skills list
|
|
208
|
+
xopc skills install <名称>
|
|
157
209
|
```
|
|
158
210
|
|
|
211
|
+
扩展里可以带**工具**、**新聊天频道**、**自定义模型**;要改网关网页界面用 **`@xopcai/xopc/extension-ui-sdk`**(代码在 `packages/extension-ui-sdk/`)。详见 **[扩展](https://xopcai.github.io/xopc/zh/extensions)**、**[技能](https://xopcai.github.io/xopc/zh/skills)**。
|
|
212
|
+
|
|
159
213
|
---
|
|
160
214
|
|
|
161
215
|
## 配置示例
|
|
162
216
|
|
|
163
|
-
默认配置文件:**`~/.xopc/xopc.json
|
|
217
|
+
默认配置文件:**`~/.xopc/xopc.json`**。
|
|
164
218
|
|
|
165
219
|
```json
|
|
166
220
|
{
|
|
@@ -186,14 +240,48 @@ pnpm run lint
|
|
|
186
240
|
}
|
|
187
241
|
```
|
|
188
242
|
|
|
189
|
-
|
|
243
|
+
要用微信、飞书、钉钉,再补上 **`channels.weixin`**、**`channels.feishu`**、**`channels.dingtalk`** —— 完整字段见 **[配置](https://xopcai.github.io/xopc/zh/configuration)** 与 **[频道](https://xopcai.github.io/xopc/zh/channels)**。
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## 代码目录结构
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
src/
|
|
251
|
+
├── agent/ # 智能体服务、工具、记忆、提示词
|
|
252
|
+
├── channels/ # 频道插件框架
|
|
253
|
+
├── cli/ # 命令行入口与各子命令
|
|
254
|
+
├── config/ # 配置 schema 与加载
|
|
255
|
+
├── cron/ # 定时任务
|
|
256
|
+
├── gateway/ # HTTP/WebSocket 服务
|
|
257
|
+
├── providers/ # 模型注册
|
|
258
|
+
├── session/ # 会话
|
|
259
|
+
├── tui/ # 终端 UI(pi-tui)
|
|
260
|
+
└── …
|
|
261
|
+
web/ # 网关控制台(React + Vite)
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
参与贡献请先读:**[AGENTS.md](./AGENTS.md)**。
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## 开发
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
pnpm install
|
|
272
|
+
pnpm run dev # 用 tsx 跑 CLI
|
|
273
|
+
pnpm run build # 构建 Node + 网页 → dist
|
|
274
|
+
pnpm test
|
|
275
|
+
pnpm run lint
|
|
276
|
+
```
|
|
190
277
|
|
|
191
278
|
---
|
|
192
279
|
|
|
193
280
|
## 致谢
|
|
194
281
|
|
|
195
|
-
-
|
|
196
|
-
-
|
|
282
|
+
- 大模型接入层:[@earendil-works/pi-ai](https://github.com/earendil-works/pi-mono)
|
|
283
|
+
- 智能体运行时:[@earendil-works/pi-agent-core](https://github.com/earendil-works/pi-mono)
|
|
284
|
+
- 灵感来自 [openclaw/openclaw](https://github.com/openclaw/openclaw) 与 [NousResearch/hermes-agent](https://github.com/NousResearch/hermes-agent)
|
|
197
285
|
|
|
198
286
|
---
|
|
199
287
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { DingtalkConfigSchema, init_config_schema } from "./config-schema.js";
|
|
1
2
|
import { createLogger } from "../../../src/utils/logger/index.js";
|
|
2
3
|
import { init_logger } from "../../../src/utils/logger.js";
|
|
3
|
-
import { DingtalkConfigSchema, init_config_schema } from "./config-schema.js";
|
|
4
4
|
import { resolveStandardAllowFromPath } from "../../../src/channels/pairing/paths.js";
|
|
5
5
|
import { readAllowFromIdsSync } from "../../../src/channels/pairing/allow-from-file.js";
|
|
6
6
|
import { evaluateAccess, resolveDmPolicy, resolveGroupPolicy } from "../../../src/channels/security.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getWorkspacePath, init_schema } from "../../../../src/config/schema.js";
|
|
2
2
|
import { checkFileSafety } from "../../../../src/agent/prompt/safety.js";
|
|
3
3
|
import { getMimeType } from "../../../../src/channels/media.js";
|
|
4
|
-
import { promises } from "node:fs";
|
|
5
4
|
import path from "node:path";
|
|
5
|
+
import { promises } from "node:fs";
|
|
6
6
|
import { Readable } from "node:stream";
|
|
7
7
|
//#region extensions/feishu/src/outbound/media-load.ts
|
|
8
8
|
init_schema();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { TelegramConfigSchema, init_config_schema } from "./config-schema.js";
|
|
1
2
|
import { createLogger } from "../../../src/utils/logger/index.js";
|
|
2
3
|
import { init_logger } from "../../../src/utils/logger.js";
|
|
3
|
-
import { TelegramConfigSchema, init_config_schema } from "./config-schema.js";
|
|
4
4
|
import { generateSessionKey } from "../../../src/chat-commands/session-key.js";
|
|
5
5
|
import { submitClarifyChoiceFromChannel } from "../../../src/gateway/clarify-runtime.js";
|
|
6
6
|
import { resolveStandardPairingPath } from "../../../src/channels/pairing/paths.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createLogger } from "../../../src/utils/logger/index.js";
|
|
2
|
-
import { init_logger } from "../../../src/utils/logger.js";
|
|
3
1
|
import { buildSessionKey } from "../../../src/routing/session-key.js";
|
|
4
2
|
import { applyIdentityLinks, resolveRoute } from "../../../src/routing/resolve-route.js";
|
|
3
|
+
import { createLogger } from "../../../src/utils/logger/index.js";
|
|
4
|
+
import { init_logger } from "../../../src/utils/logger.js";
|
|
5
5
|
//#region extensions/telegram/src/routing-integration.ts
|
|
6
6
|
init_logger();
|
|
7
7
|
const log = createLogger("TelegramRouting");
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "telegram",
|
|
3
3
|
"name": "Telegram Channel",
|
|
4
4
|
"description": "Bundled Telegram Bot channel (private workspace sources; ships inside @xopcai/xopc dist/)",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.45",
|
|
6
6
|
"kind": "channel",
|
|
7
7
|
"main": "src/index.ts",
|
|
8
8
|
"channels": ["telegram"],
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { logger } from "../util/logger.js";
|
|
2
2
|
import { redactBody, redactUrl } from "../util/redact.js";
|
|
3
|
-
import crypto from "node:crypto";
|
|
4
|
-
import fsSync from "node:fs";
|
|
5
3
|
import path from "node:path";
|
|
4
|
+
import fsSync from "node:fs";
|
|
5
|
+
import crypto from "node:crypto";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import { Agent, fetch as fetch$1 } from "undici";
|
|
8
8
|
//#region extensions/weixin/src/api/api.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { logger } from "../util/logger.js";
|
|
2
2
|
import { normalizeWeixinAccountId } from "./weixin-account-id.js";
|
|
3
3
|
import { resolveWeixinRootDir } from "../storage/state-dir.js";
|
|
4
|
-
import fsSync from "node:fs";
|
|
5
4
|
import path from "node:path";
|
|
5
|
+
import fsSync from "node:fs";
|
|
6
6
|
//#region extensions/weixin/src/auth/accounts.ts
|
|
7
7
|
const DEFAULT_BASE_URL = "https://ilinkai.weixin.qq.com";
|
|
8
8
|
const CDN_BASE_URL = "https://novac2c.cdn.weixin.qq.com/c2c";
|
|
@@ -6,9 +6,9 @@ import { getUploadUrl } from "../api/api.js";
|
|
|
6
6
|
import { getExtensionFromContentTypeOrUrl } from "../media/mime.js";
|
|
7
7
|
import { aesEcbPaddedSize } from "./aes-ecb.js";
|
|
8
8
|
import { uploadBufferToCdn } from "./cdn-upload.js";
|
|
9
|
+
import path from "node:path";
|
|
9
10
|
import crypto from "node:crypto";
|
|
10
11
|
import fs from "node:fs/promises";
|
|
11
|
-
import path from "node:path";
|
|
12
12
|
//#region extensions/weixin/src/cdn/upload.ts
|
|
13
13
|
/**
|
|
14
14
|
* Download a remote media URL (image, video, file) to a local temp file in destDir.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getExtensionFromMime } from "./mime.js";
|
|
2
|
+
import path from "node:path";
|
|
2
3
|
import { randomBytes } from "node:crypto";
|
|
3
4
|
import fs from "node:fs/promises";
|
|
4
|
-
import path from "node:path";
|
|
5
5
|
//#region extensions/weixin/src/media/data-url.ts
|
|
6
6
|
/**
|
|
7
7
|
* Parse `data:mime;base64,...` into buffer (aligned with Telegram `parseDataUrl`).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { logger } from "../util/logger.js";
|
|
2
2
|
import { resolveWeixinRootDir } from "../storage/state-dir.js";
|
|
3
|
-
import fsSync from "node:fs";
|
|
4
3
|
import path from "node:path";
|
|
4
|
+
import fsSync from "node:fs";
|
|
5
5
|
//#region extensions/weixin/src/messaging/debug-mode.ts
|
|
6
6
|
/**
|
|
7
7
|
* Per-bot debug mode toggle, persisted to disk so it survives gateway restarts.
|
|
@@ -3,8 +3,8 @@ import { generateId } from "../util/random.js";
|
|
|
3
3
|
import { MessageItemType } from "../api/types.js";
|
|
4
4
|
import { canonicalWeixinPeerId, normalizeWeixinAccountId } from "../auth/weixin-account-id.js";
|
|
5
5
|
import { resolveWeixinRootDir } from "../storage/state-dir.js";
|
|
6
|
-
import fsSync from "node:fs";
|
|
7
6
|
import path from "node:path";
|
|
7
|
+
import fsSync from "node:fs";
|
|
8
8
|
//#region extensions/weixin/src/messaging/inbound.ts
|
|
9
9
|
/**
|
|
10
10
|
* contextToken is issued per-message by the Weixin getupdates API and must
|
|
@@ -11,9 +11,9 @@ import { downloadMediaFromItem } from "../media/media-download.js";
|
|
|
11
11
|
import { isDebugMode } from "./debug-mode.js";
|
|
12
12
|
import { sendMessageWeixin } from "./send.js";
|
|
13
13
|
import { handleSlashCommand } from "./slash-commands.js";
|
|
14
|
+
import path from "node:path";
|
|
14
15
|
import { randomBytes } from "node:crypto";
|
|
15
16
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
16
|
-
import path from "node:path";
|
|
17
17
|
//#region extensions/weixin/src/messaging/process-message.ts
|
|
18
18
|
function extractTextBody(itemList) {
|
|
19
19
|
if (!itemList?.length) return "";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { WeixinConfigSchema, init_config_schema } from "./config-schema.js";
|
|
1
2
|
import { createLogger } from "../../../src/utils/logger/index.js";
|
|
2
3
|
import { init_logger } from "../../../src/utils/logger.js";
|
|
3
|
-
import { WeixinConfigSchema, init_config_schema } from "./config-schema.js";
|
|
4
4
|
import { evaluateAccess, resolveDmPolicy } from "../../../src/channels/security.js";
|
|
5
5
|
import { restoreContextTokens } from "./messaging/inbound.js";
|
|
6
6
|
import { listWeixinAccountIds, resolveWeixinAccount } from "./auth/accounts.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolveWeixinRootDir } from "./state-dir.js";
|
|
2
|
-
import fsSync from "node:fs";
|
|
3
2
|
import path from "node:path";
|
|
3
|
+
import fsSync from "node:fs";
|
|
4
4
|
//#region extensions/weixin/src/storage/sync-buf.ts
|
|
5
5
|
function resolveAccountsDir() {
|
|
6
6
|
return path.join(resolveWeixinRootDir(), "accounts");
|