返回 AiToEarn
README.md
1 # Aitoearn — DeepSeek Harness 插件
2
3 自媒体运营增长变现专家。帮你生成文案/图文/短视频,一键分发抖音、快手、小红书、公众号、bilibili、Facebook、TikTok 等海内外平台,覆盖从内容创作、内容发布到内容变现全链路。
4
5 ## 功能
6
7 - **OAuth 2.1 鉴权**:授权码 + PKCE(S256),设备码兜底,令牌自动刷新
8 - **动态客户端注册**(RFC 7591),也可用 `AITOEARN_OAUTH_CLIENT_ID` 指定已有客户端
9 - **MCP 连接**:插件自维护 Streamable HTTP 客户端,逐请求注入 Authorization 头,401/403 时强制刷新并重试
10 - **自动工具同步**:检测到令牌变化后自动重新同步,无需重装
11 - **13 个子技能**:文案生成、图片创作、视频生成/剪辑、语音转写、多平台发布等
12
13 ## 目录结构
14
15 ```
16 dsh-plugin-aitoearn/
17 ├── package.json # dsh.bundle,从 GitHub 子目录安装,不发布 npm
18 ├── cordis.patch.yml # bundle patch
19 ├── cordis.patch.yml.tpl # 国内站配置模板
20 ├── 安装提示词.md # 交给 AI 执行的安装指令
21 ├── locale/ # 插件管理面板元数据
22 ├── lib/
23 │ ├── index.js # 技能提供方 + MCP 生命周期
24 │ ├── oauth.js # 发现 / DCR / PKCE / 设备码 / 刷新 / 存储
25 │ ├── mcp.js # Streamable HTTP MCP 客户端
26 │ └── tool-bridge.js # 工具命名与注册
27 ├── scripts/aitoearn.mjs # login / status / refresh / logout
28 ├── skills/aitoearn/ # 技能与子技能
29 └── registry/data/plugins/ # awesome-dsh-plugin 收录条目
30 ```
31
32 ## 安装
33
34 本插件不发布到 npm。它在 AiToEarn 仓库的 `skills/dsh-plugin-aitoearn`。仓库根目录没有 `dsh.bundle`,不要安装根目录。
35
36 ### 更新已有安装
37
38 如果以前安装或配置过 AiToEarn,先删除旧的 `dsh-plugin-aitoearn` 插件及 profile 中对应的依赖、bundle 和符号链接,再删除 `cordis.patch.yml` 中旧的 AiToEarn MCP 条目;仅处理 `aitoearn`、`aitoearn-cn` 或指向旧 AiToEarn 地址的条目,不要删除其他服务。旧条目中的旧版 MCP 地址、认证请求头、环境变量和 API Key 也必须移除,然后再按下方步骤安装。
39
40 ```bash
41 dsh plugin --profile desktop add "github:yikart/AiToEarn#path:/skills/dsh-plugin-aitoearn"
42 ```
43
44 `desktop` 换成实际使用的 profile 名。`dsh web` 一般是 `web`。源码已经是可运行的 JavaScript,不需要先构建。
45
46 ### 手动拉取
47
48 ```bash
49 git clone https://github.com/yikart/AiToEarn.git
50 ```
51
52 插件目录是克隆结果里的 `skills/dsh-plugin-aitoearn`。
53
54 1. 把这个子目录复制到 `~/.dsh/plugins/dsh-plugin-aitoearn`
55 2. 编辑 `~/.dsh/profiles/desktop/package.json`:
56 - `dependencies` 增加 `"dsh-plugin-aitoearn": "file:$HOME/.dsh/plugins/dsh-plugin-aitoearn"`
57 - `dsh.profile.bundles` 追加 `"dsh-plugin-aitoearn"`
58 3. 建立符号链接:
59 `ln -sfn ~/.dsh/plugins/dsh-plugin-aitoearn ~/.dsh/profiles/desktop/node_modules/dsh-plugin-aitoearn`
60 4. 若 `cordis.patch.yml` 已存在,合并本包的条目(id 不要重复)
61 5. 完全退出并重新打开 DeepSeek Harness
62
63 也可以交给 AI 安装:把 `安装提示词.md` 发给支持文件读写的客户端。
64
65 ## OAuth 授权
66
67 登录前请用户自己选择站点。两个站点的授权不能混用。
68
69 | 站点 | 地址 | 登录参数 |
70 | --- | --- | --- |
71 | 国内站 | `https://aitoearn.cn/api/ai/agent/mcp` | 不加参数,或 `--site cn` |
72 | 海外站 | `https://aitoearn.ai/api/ai/agent/mcp` | `--site ai` |
73
74 未指定站点时默认国内站。
75
76 市场安装后,用装进该 profile 的命令。`<profile>` 与安装时的 `--profile` 相同,`dsh web` 一般是 `web`:
77
78 ```bash
79 # 国内站
80 ~/.dsh/profiles/<profile>/node_modules/.bin/aitoearn login
81
82 # 海外站
83 ~/.dsh/profiles/<profile>/node_modules/.bin/aitoearn login --site ai
84 ```
85
86 手工复制到 `~/.dsh/plugins/dsh-plugin-aitoearn` 时:
87
88 ```bash
89 # 国内站
90 node ~/.dsh/plugins/dsh-plugin-aitoearn/scripts/aitoearn.mjs login
91
92 # 海外站
93 node ~/.dsh/plugins/dsh-plugin-aitoearn/scripts/aitoearn.mjs login --site ai
94 ```
95
96 令牌写入 `~/.aitoearn/oauth.json`(0600),内容不会打印。其他命令:`status`、`refresh`、`logout`。
97
98 ### 环境变量
99
100 | 变量 | 用途 |
101 |---|---|
102 | `AITOEARN_OAUTH_STORE` | 令牌文件路径,默认 `~/.aitoearn/oauth.json` |
103 | `AITOEARN_OAUTH_ISSUER` | 授权服务器 issuer |
104 | `AITOEARN_OAUTH_AUTHORIZE_URL` | 授权端点(覆盖自动发现) |
105 | `AITOEARN_OAUTH_TOKEN_URL` | 令牌端点(覆盖自动发现) |
106 | `AITOEARN_OAUTH_REGISTRATION_URL` | 动态客户端注册端点 |
107 | `AITOEARN_OAUTH_DEVICE_AUTHORIZATION_URL` | 设备码端点 |
108 | `AITOEARN_OAUTH_CLIENT_ID` / `_CLIENT_SECRET` | 使用已有客户端 |
109 | `AITOEARN_OAUTH_SCOPE` | 授权 scope |
110 | `AITOEARN_OAUTH_CALLBACK_PORT` | 本地回调固定端口,默认随机 |
111 | `AITOEARN_OAUTH_OPEN_BROWSER=0` | 不自动打开浏览器 |
112 | `AITOEARN_MCP_URL` | 覆盖 MCP 端点 |
113
114 ## 验证
115
116 ```bash
117 node scripts/aitoearn.mjs status
118 npm pack --dry-run
119 ```
120
121 `npm pack --dry-run` 应包含 `lib/`、`scripts/`、`skills/`、`locale/`、`cordis.patch.yml`、`安装提示词.md` 与 `registry/`。
122
123 ## 卸载
124
125 删除 `~/.dsh/plugins/dsh-plugin-aitoearn`、profile 里的依赖 / bundles 条目与符号链接。
126 如需清除授权:`aitoearn logout`。
127
127 lines MARKDOWN