dscord 0.0.0-stage → 0.2.0-alpha.1
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 +86 -2
- package/bin/dscord.mjs +87 -0
- package/dist/web/assets/apple-touch-icon-BVvy03qx.png +0 -0
- package/dist/web/assets/icon-C8lhqe5n.svg +6 -0
- package/dist/web/assets/index-D2MsIF_C.js +20 -0
- package/dist/web/assets/index-DpwihgYi.css +1 -0
- package/dist/web/assets/manifest-eq_1S_IC.webmanifest +31 -0
- package/dist/web/icons/apple-touch-icon.png +0 -0
- package/dist/web/icons/icon-192.png +0 -0
- package/dist/web/icons/icon-512.png +0 -0
- package/dist/web/icons/icon.svg +6 -0
- package/dist/web/index.html +28 -0
- package/dist/web/licenses/lucide.txt +43 -0
- package/dist/web/manifest.webmanifest +31 -0
- package/dist/web/sw.js +132 -0
- package/dist/web/theme.js +44 -0
- package/dsh-plugin/README.md +50 -0
- package/dsh-plugin/index.mjs +31 -0
- package/dsh-plugin/package.json +8 -0
- package/dsh-plugin/runtime-dependencies-lock.json +40 -0
- package/dsh-plugin/runtime-dependencies.json +8 -0
- package/dsh-plugin/runtime-rules.mjs +16 -0
- package/dsh-plugin/runtime.mjs +518 -0
- package/dsh-plugin/work-files.mjs +182 -0
- package/package.json +41 -4
- package/scripts/dsh-node.mjs +187 -0
- package/scripts/file-work.mjs +58 -0
- package/scripts/matrix.mjs +364 -0
- package/scripts/runtime-config.mjs +107 -0
- package/scripts/server-admin.mjs +70 -0
- package/scripts/server-bootstrap.mjs +78 -0
- package/scripts/server-init.mjs +85 -0
- package/scripts/service.mjs +104 -0
- package/src/bot-node.mjs +756 -0
- package/src/budget.mjs +71 -0
- package/src/core.mjs +434 -0
- package/src/delivery-policy.mjs +171 -0
- package/src/file-formats.mjs +402 -0
- package/src/matrix-client.mjs +147 -0
- package/src/media.mjs +184 -0
- package/src/mentions.mjs +268 -0
- package/src/node-delivery.mjs +255 -0
- package/src/node-files.mjs +187 -0
- package/src/node-request.mjs +33 -0
- package/src/node-store.mjs +402 -0
- package/src/paths.mjs +9 -0
- package/src/push.mjs +350 -0
- package/src/tasks.mjs +213 -0
- package/vendor/ds-bot/LICENSE +201 -0
- package/vendor/ds-bot/NOTICE +135 -0
- package/vendor/ds-bot/README.md +258 -0
- package/vendor/ds-bot/UPSTREAM.json +9 -0
- package/vendor/ds-bot/client.js +22861 -0
- package/vendor/ds-bot/cordis.patch.yml +19 -0
- package/vendor/ds-bot/index.js +82 -0
- package/vendor/ds-bot/office.js +8889 -0
- package/vendor/ds-bot/package.json +73 -0
- package/vendor/ds-bot/src/host/agents.js +129 -0
- package/vendor/ds-bot/src/host/approvals.js +69 -0
- package/vendor/ds-bot/src/host/avatar-library.js +131 -0
- package/vendor/ds-bot/src/host/avatar.js +107 -0
- package/vendor/ds-bot/src/host/browser/gate.js +3 -0
- package/vendor/ds-bot/src/host/browser/loop.js +95 -0
- package/vendor/ds-bot/src/host/browser/mount.js +177 -0
- package/vendor/ds-bot/src/host/browser/refs.js +151 -0
- package/vendor/ds-bot/src/host/browser/script.js +38 -0
- package/vendor/ds-bot/src/host/browser/session-model.js +205 -0
- package/vendor/ds-bot/src/host/browser/session.js +765 -0
- package/vendor/ds-bot/src/host/browser/task.js +64 -0
- package/vendor/ds-bot/src/host/browser-plugins.js +174 -0
- package/vendor/ds-bot/src/host/browser.js +287 -0
- package/vendor/ds-bot/src/host/btw.js +372 -0
- package/vendor/ds-bot/src/host/capabilities.js +542 -0
- package/vendor/ds-bot/src/host/channel.js +647 -0
- package/vendor/ds-bot/src/host/chat-index.js +293 -0
- package/vendor/ds-bot/src/host/connectors.js +169 -0
- package/vendor/ds-bot/src/host/constants.js +96 -0
- package/vendor/ds-bot/src/host/delivery.js +171 -0
- package/vendor/ds-bot/src/host/diagnostics.js +257 -0
- package/vendor/ds-bot/src/host/dsh-update.js +172 -0
- package/vendor/ds-bot/src/host/feed.js +115 -0
- package/vendor/ds-bot/src/host/files.js +27 -0
- package/vendor/ds-bot/src/host/folders.js +230 -0
- package/vendor/ds-bot/src/host/goal-skills.js +48 -0
- package/vendor/ds-bot/src/host/goals.js +812 -0
- package/vendor/ds-bot/src/host/groups.js +1466 -0
- package/vendor/ds-bot/src/host/handoffs.js +330 -0
- package/vendor/ds-bot/src/host/home-lock.js +98 -0
- package/vendor/ds-bot/src/host/images.js +212 -0
- package/vendor/ds-bot/src/host/learning.js +781 -0
- package/vendor/ds-bot/src/host/links.js +39 -0
- package/vendor/ds-bot/src/host/memory-pending.js +95 -0
- package/vendor/ds-bot/src/host/memory.js +2050 -0
- package/vendor/ds-bot/src/host/models.js +314 -0
- package/vendor/ds-bot/src/host/office-skills.js +78 -0
- package/vendor/ds-bot/src/host/parts.js +1473 -0
- package/vendor/ds-bot/src/host/permissions.js +117 -0
- package/vendor/ds-bot/src/host/privacy.js +368 -0
- package/vendor/ds-bot/src/host/prompt.js +73 -0
- package/vendor/ds-bot/src/host/providers.js +226 -0
- package/vendor/ds-bot/src/host/requests.js +141 -0
- package/vendor/ds-bot/src/host/resume.js +445 -0
- package/vendor/ds-bot/src/host/roster.js +776 -0
- package/vendor/ds-bot/src/host/schedules.js +154 -0
- package/vendor/ds-bot/src/host/secrets.js +586 -0
- package/vendor/ds-bot/src/host/side.js +406 -0
- package/vendor/ds-bot/src/host/skills/goal-grill/SKILL.md +37 -0
- package/vendor/ds-bot/src/host/steer.js +265 -0
- package/vendor/ds-bot/src/host/steward.js +165 -0
- package/vendor/ds-bot/src/host/store.js +512 -0
- package/vendor/ds-bot/src/host/text.js +49 -0
- package/vendor/ds-bot/src/host/thinking.js +55 -0
- package/vendor/ds-bot/src/host/time-context.js +46 -0
- package/vendor/ds-bot/src/host/tools.js +1105 -0
- package/vendor/ds-bot/src/host/turns.js +1126 -0
- package/vendor/ds-bot/src/host/update.js +315 -0
- package/vendor/ds-bot/src/host/usage.js +653 -0
- package/vendor/ds-bot/src/office/check.js +329 -0
- package/vendor/ds-bot/src/office/cli.js +193 -0
- package/vendor/ds-bot/src/office/docx.js +644 -0
- package/vendor/ds-bot/src/office/package.js +238 -0
- package/vendor/ds-bot/src/office/png.js +183 -0
- package/vendor/ds-bot/src/office/pptx.js +408 -0
- package/vendor/ds-bot/src/office/skills/office/SKILL.md +18 -0
- package/vendor/ds-bot/src/office/skills/office-tools/SKILL.md +41 -0
- package/vendor/ds-bot/src/office/xlsx.js +119 -0
- package/vendor/ds-bot/src/office/xml.js +128 -0
- package/vendor/ds-bot/src/office/zip.js +146 -0
- package/vendor/ds-bot/src/shared/group-replies.js +69 -0
- package/vendor/ds-bot/src/shared/mentions.js +72 -0
- package/vendor/ds-bot/web-search.js +775 -0
- package/web/mention-tokens.js +72 -0
package/README.md
CHANGED
|
@@ -1,3 +1,87 @@
|
|
|
1
|
-
#
|
|
1
|
+
# DSCord
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
人类与独立 Bot 共同参与的聊天协作框架,原项目名为 DS-Group。npm 包包含 Node 服务端、预构建 React PWA、Matrix 接入器、DSH 桥接和固定 DS-Bot 0.2.7。
|
|
4
|
+
|
|
5
|
+
当前为 `0.2.0-alpha.1`,使用 `alpha` 标签发布。服务器发行目标为 Linux amd64/arm64,要求 Node 24.19.0 及以上的 24.x。Bot 节点另外需要 DSH 0.2.1-rc.5 和 `opencode-go/deepseek-v4.1-flash` 模型配置。
|
|
6
|
+
|
|
7
|
+
## 安装
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install --global dscord@alpha
|
|
11
|
+
dscord --help
|
|
12
|
+
dscord --version
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
服务端与网页已经随包提供。运行时通过 `DS_GROUP_DATA_DIR` 指定数据目录,默认使用执行命令时所在目录下的 `.dscord`。在多个终端管理同一实例时,设置相同的绝对数据路径。`DS_GROUP_*` 是当前配置接口。
|
|
16
|
+
|
|
17
|
+
## 启动本机服务器
|
|
18
|
+
|
|
19
|
+
以下步骤使用 Docker 运行独立 Synapse,核心通过 Node 启动。先安装 Docker Engine 并启动 Docker 服务。
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
export DS_GROUP_DATA_DIR="$HOME/.local/share/dscord"
|
|
23
|
+
export DS_GROUP_SERVER_NAME=localhost
|
|
24
|
+
export DS_GROUP_MATRIX_URL=http://127.0.0.1:18008
|
|
25
|
+
export DS_GROUP_MATRIX_PUBLIC_URL=http://localhost:18008
|
|
26
|
+
export DS_GROUP_PUBLIC_URL=http://localhost:18100
|
|
27
|
+
dscord init
|
|
28
|
+
|
|
29
|
+
docker run --detach --name dscord-synapse \
|
|
30
|
+
--user "$(id -u):$(id -g)" \
|
|
31
|
+
--publish 127.0.0.1:18008:8008 \
|
|
32
|
+
--mount "type=bind,source=$DS_GROUP_DATA_DIR/synapse,target=/data" \
|
|
33
|
+
ghcr.io/element-hq/synapse@sha256:f0df87cff259872637b4b5e5174b9977e5e3046dd421505407803b5e45c5f842
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
等待 Synapse 的 `http://127.0.0.1:18008/_matrix/client/versions` 返回成功,再执行。
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
dscord bootstrap
|
|
40
|
+
dscord admin credentials alice
|
|
41
|
+
dscord server
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
浏览器访问 `http://localhost:18100`,使用上一步在管理员终端显示的 Alice 登录信息。初始化会创建 Alice、Bob、财务和人事四个独立成员。Bot 在各自节点接入后上线。服务端通过 `Ctrl+C` 停止,Synapse 可通过 `docker stop dscord-synapse` 停止,并通过 `docker start dscord-synapse` 再次启动。
|
|
45
|
+
|
|
46
|
+
HTTPS、Docker Compose、备份恢复与 systemd 的完整部署流程见源码仓库中的部署指南。手机 PWA 安装和通知需要可信 HTTPS。[服务器部署指南](https://github.com/MixGeekers/ds_group/blob/main/apps/ds-group/deploy/README.md)
|
|
47
|
+
|
|
48
|
+
## 连接 Bot 节点
|
|
49
|
+
|
|
50
|
+
先按服务器部署指南配置 HTTPS 反向代理,使核心 API 和 Matrix API 可从 Bot 机器访问。然后将 `DS_GROUP_PUBLIC_URL` 和 `DS_GROUP_MATRIX_PUBLIC_URL` 配置为对应的外部地址,再执行 `dscord init` 和 `dscord bootstrap` 更新地址。使用目标 Bot 的名称导出节点配置。
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
umask 077
|
|
54
|
+
dscord admin export-node finance > finance-node.json
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
将配置文件传到 Bot 机器,在该机器安装 `dscord@alpha` 和 DSH,再执行。
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
npm install --global @deepseek-ai/dsh@0.2.1-rc.5
|
|
61
|
+
export DS_GROUP_DATA_DIR="$HOME/.local/share/dscord-finance"
|
|
62
|
+
dscord admin import-node finance-node.json "$DS_GROUP_DATA_DIR"
|
|
63
|
+
read -r -s OPENCODE_API_KEY
|
|
64
|
+
export OPENCODE_API_KEY
|
|
65
|
+
dscord service up finance
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
`OPENCODE_API_KEY` 在本地终端输入。人事节点使用 `hr` 及独立数据目录。使用以下命令停止财务节点及其 DSH。
|
|
69
|
+
|
|
70
|
+
```sh
|
|
71
|
+
dscord service down finance
|
|
72
|
+
dscord dsh stop finance
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
当前 npm 入口提供 CLI 部署。DSH 桌面“添加插件”中的直接安装与自动接入仍待实现。
|
|
76
|
+
|
|
77
|
+
## 包内组件
|
|
78
|
+
|
|
79
|
+
- `dscord server` 启动核心 API 和预构建 PWA。
|
|
80
|
+
- `dscord init` 与 `dscord bootstrap` 管理服务器初始化和 Matrix 成员。
|
|
81
|
+
- `dscord admin` 读取账号、导出和导入节点配置。
|
|
82
|
+
- `dscord node` 运行 Matrix 适配进程。
|
|
83
|
+
- `dscord dsh` 管理独立 DSH 运行时。
|
|
84
|
+
- `dscord service` 管理本机核心和 Bot 进程。
|
|
85
|
+
- `dscord path` 显示安装目录。
|
|
86
|
+
|
|
87
|
+
上游 DS-Bot 的 Apache-2.0 LICENSE 与 NOTICE 位于 `vendor/ds-bot/`。Lucide 的 ISC 与 Feather MIT 许可位于 `dist/web/licenses/lucide.txt`。
|
package/bin/dscord.mjs
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawn } from 'node:child_process';
|
|
3
|
+
import { readFile } from 'node:fs/promises';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
|
|
7
|
+
const packageRoot = fileURLToPath(new URL('../', import.meta.url));
|
|
8
|
+
const [command = 'help', ...args] = process.argv.slice(2);
|
|
9
|
+
const entries = new Map([
|
|
10
|
+
['server', 'src/core.mjs'],
|
|
11
|
+
['init', 'scripts/server-init.mjs'],
|
|
12
|
+
['bootstrap', 'scripts/server-bootstrap.mjs'],
|
|
13
|
+
['admin', 'scripts/server-admin.mjs'],
|
|
14
|
+
['node', 'src/bot-node.mjs'],
|
|
15
|
+
['dsh', 'scripts/dsh-node.mjs'],
|
|
16
|
+
['service', 'scripts/service.mjs'],
|
|
17
|
+
]);
|
|
18
|
+
const help = `Usage: dscord <command> [arguments]
|
|
19
|
+
|
|
20
|
+
server Run the core server and PWA
|
|
21
|
+
init Prepare server and Synapse configuration
|
|
22
|
+
bootstrap Register initial members on the configured Synapse
|
|
23
|
+
admin <arguments> Manage server credentials and node exports
|
|
24
|
+
node <arguments> Run a Matrix Bot adapter
|
|
25
|
+
dsh <arguments> Manage a Bot's DSH host
|
|
26
|
+
service <arguments> Manage explicitly selected local services
|
|
27
|
+
path Print the installed package directory
|
|
28
|
+
version Print the installed version
|
|
29
|
+
help Show this help
|
|
30
|
+
|
|
31
|
+
DS_GROUP_DATA_DIR defaults to .dscord in the current directory.
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
async function run() {
|
|
35
|
+
if (['help', '--help', '-h'].includes(command)) {
|
|
36
|
+
process.stdout.write(help);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (['version', '--version', '-v'].includes(command)) {
|
|
40
|
+
const manifest = JSON.parse(await readFile(path.join(packageRoot, 'package.json'), 'utf8'));
|
|
41
|
+
console.log(manifest.version);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (command === 'path') {
|
|
45
|
+
console.log(path.resolve(packageRoot));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const entry = entries.get(command);
|
|
49
|
+
if (!entry) throw new Error(`Unknown command "${command}". Run dscord help.`);
|
|
50
|
+
if (command === 'service' && ['up', 'down', 'restart'].includes(args[0]) && !args[1]) {
|
|
51
|
+
throw new Error('Choose a service component explicitly: all, core, finance, or hr.');
|
|
52
|
+
}
|
|
53
|
+
if (command === 'dsh' && args.length < 2) {
|
|
54
|
+
throw new Error('Use dscord dsh <start|run|stop|status|prepare> <finance|hr>.');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const env = { ...process.env };
|
|
58
|
+
env.DS_GROUP_DATA_DIR = path.resolve(env.DS_GROUP_DATA_DIR || '.dscord');
|
|
59
|
+
env.DS_GROUP_SYNAPSE_DIR = path.resolve(env.DS_GROUP_SYNAPSE_DIR || path.join(env.DS_GROUP_DATA_DIR, 'synapse'));
|
|
60
|
+
env.DS_GROUP_MATRIX_REPORT = path.resolve(env.DS_GROUP_MATRIX_REPORT || path.join(env.DS_GROUP_DATA_DIR, 'matrix-smoke.json'));
|
|
61
|
+
for (const name of ['DS_GROUP_CORE_CONFIG_PATH', 'DS_GROUP_MATRIX_SETUP_PATH', 'DS_GROUP_WEB_DIR',
|
|
62
|
+
'DS_GROUP_DSH_SOURCE_HOME', 'DS_GROUP_DSH_RUNTIME', 'DS_GROUP_RUNTIME_DEPS_DIR']) {
|
|
63
|
+
if (env[name]) env[name] = path.resolve(env[name]);
|
|
64
|
+
}
|
|
65
|
+
if (env.DS_GROUP_DSH_CLI && /[\\/]/.test(env.DS_GROUP_DSH_CLI)) env.DS_GROUP_DSH_CLI = path.resolve(env.DS_GROUP_DSH_CLI);
|
|
66
|
+
if (command === 'init' || command === 'bootstrap') env.DS_GROUP_MATRIX_URL ||= 'http://127.0.0.1:18008';
|
|
67
|
+
|
|
68
|
+
const child = spawn(process.execPath, [path.join(packageRoot, entry), ...args], { stdio: 'inherit', env });
|
|
69
|
+
const handlers = new Map(['SIGINT', 'SIGTERM', 'SIGHUP'].map(signal => [signal, () => child.kill(signal)]));
|
|
70
|
+
for (const [signal, handler] of handlers) process.on(signal, handler);
|
|
71
|
+
let result;
|
|
72
|
+
try {
|
|
73
|
+
result = await new Promise((resolve, reject) => {
|
|
74
|
+
child.once('error', reject);
|
|
75
|
+
child.once('close', (code, signal) => resolve({ code, signal }));
|
|
76
|
+
});
|
|
77
|
+
} finally {
|
|
78
|
+
for (const [signal, handler] of handlers) process.off(signal, handler);
|
|
79
|
+
}
|
|
80
|
+
if (result.signal) process.kill(process.pid, result.signal);
|
|
81
|
+
else process.exitCode = result.code ?? 1;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
run().catch(error => {
|
|
85
|
+
console.error(error.message);
|
|
86
|
+
process.exitCode = 1;
|
|
87
|
+
});
|
|
Binary file
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512" role="img" aria-label="DS-Group">
|
|
2
|
+
<rect width="512" height="512" fill="#1d1f26"/>
|
|
3
|
+
<rect x="32" y="32" width="448" height="448" rx="128" fill="#7781e8"/>
|
|
4
|
+
<path fill="#fff" fill-rule="evenodd" transform="translate(9 0) scale(.86 1)" d="M126 166h62c60 0 95 34 95 90s-35 90-95 90h-62V166Zm41 36v108h19c36 0 55-19 55-54s-19-54-55-54h-19Z"/>
|
|
5
|
+
<path fill="#fff" transform="translate(7 0)" d="M365 208c-11-8-25-12-40-12-18 0-29 7-29 19 0 11 10 16 31 21l17 4c36 8 53 24 53 51 0 35-28 58-72 58-28 0-51-8-69-21l20-31c14 11 31 17 50 17 20 0 31-7 31-20 0-10-8-16-30-21l-18-4c-35-8-53-25-53-52 0-34 29-56 70-56 25 0 46 6 63 17l-24 30Z"/>
|
|
6
|
+
</svg>
|