dsh-plugin-chuhai 0.0.0-stage → 0.1.0
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 +24 -2
- package/cordis.patch.yml +8 -0
- package/lib/index.js +115 -0
- package/package.json +49 -4
- package/skills/zimeiti-chuhai.md +27 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 adsorgcn
|
|
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
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-plugin-chuhai · 自媒体出海
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
iLang DSH 工具包的第一个官方插件。装上以后,对你的 DeepSeek Harness 说一句:
|
|
4
|
+
|
|
5
|
+
> 自媒体出海
|
|
6
|
+
|
|
7
|
+
它就从零带你做:装好工具包、写作人格、内容源、知识库、出文章、公众号走通,再到买海外服务器、配好设备、注册 X、开 Premium。你只做付款、扫码、登录、授权这几件事,其余它做。
|
|
8
|
+
|
|
9
|
+
目前进度:到 X 开 Premium。再往后的环在更新中,插件更新后再说一句就接着走。
|
|
10
|
+
|
|
11
|
+
## 怎么装
|
|
12
|
+
|
|
13
|
+
照 https://dsh.ilang.guide/ 上的三步做就行;工具包装完会顺手把这个插件装上。
|
|
14
|
+
|
|
15
|
+
手动装:DeepSeek Harness 侧栏「插件」→「添加插件」填 `dsh-plugin-chuhai`,或命令行 `dsh plugin --profile desktop add dsh-plugin-chuhai`。要求 DSH 0.2.1-rc.5 及以上的 0.2.x。
|
|
16
|
+
|
|
17
|
+
## 它做了什么
|
|
18
|
+
|
|
19
|
+
- 注册一个技能 `zimeiti-chuhai`:说「自媒体出海」时模型自己加载,照工具包里那本「AI全球自媒体」走第一段。
|
|
20
|
+
- 注册一个工具 `chuhai_book`:第二段(出海)的工程书放在 dsh.chuhai.express,带访问密码,插件替你的 DSH 带上密码取回来。不调用就没有任何网络请求。
|
|
21
|
+
- 不收集任何东西,不带你的钥匙,不改你的记忆。
|
|
22
|
+
|
|
23
|
+
## 许可
|
|
24
|
+
|
|
25
|
+
MIT。
|
package/cordis.patch.yml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# 自媒体出海:注册一个 skill「zimeiti-chuhai」和一个取书工具「chuhai_book」。
|
|
2
|
+
# pass 是 dsh.chuhai.express 的访问密码,插件替用户的 DSH 前置带上;bookUrl 一般不用改。
|
|
3
|
+
- insert:
|
|
4
|
+
- id: dsh-plugin-chuhai
|
|
5
|
+
name: 'dsh-plugin-chuhai'
|
|
6
|
+
config:
|
|
7
|
+
bookUrl: https://dsh.chuhai.express/book
|
|
8
|
+
pass: 8Jupj8VhBxZFD5vFylhmq2vp
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-plugin-chuhai — 自媒体出海 for DeepSeek Harness.
|
|
3
|
+
*
|
|
4
|
+
* Registers one skill, `zimeiti-chuhai`, that the model loads when the user says
|
|
5
|
+
* 自媒体出海 / AI全球自媒体, and one tool, `chuhai_book`, that fetches the
|
|
6
|
+
* second half of the journey (going global) from dsh.chuhai.express with the
|
|
7
|
+
* access key the plugin carries. Nothing else: no keys of the user's, no
|
|
8
|
+
* network traffic unless the tool is called.
|
|
9
|
+
*/
|
|
10
|
+
import fs from 'node:fs';
|
|
11
|
+
import path from 'node:path';
|
|
12
|
+
import { fileURLToPath } from 'node:url';
|
|
13
|
+
|
|
14
|
+
export const name = 'chuhai';
|
|
15
|
+
export const inject = ['skills', 'tools'];
|
|
16
|
+
|
|
17
|
+
const SKILL_NAME = 'zimeiti-chuhai';
|
|
18
|
+
const DEFAULT_BOOK_URL = 'https://dsh.chuhai.express/book';
|
|
19
|
+
const VERSION = readVersion();
|
|
20
|
+
|
|
21
|
+
function here() {
|
|
22
|
+
return path.dirname(fileURLToPath(import.meta.url));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function readVersion() {
|
|
26
|
+
try {
|
|
27
|
+
return JSON.parse(fs.readFileSync(path.join(here(), '..', 'package.json'), 'utf8')).version ?? '0.0.0';
|
|
28
|
+
} catch {
|
|
29
|
+
return '0.0.0';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The skill body ships as a Markdown file so it can be read and edited as text. */
|
|
34
|
+
export function skillContent() {
|
|
35
|
+
return fs.readFileSync(path.join(here(), '..', 'skills', SKILL_NAME + '.md'), 'utf8');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function normalize(config = {}) {
|
|
39
|
+
const bookUrl = typeof config.bookUrl === 'string' && config.bookUrl ? config.bookUrl : DEFAULT_BOOK_URL;
|
|
40
|
+
if (!/^https:\/\//.test(bookUrl)) throw new Error('chuhai: bookUrl must be https');
|
|
41
|
+
const pass = typeof config.pass === 'string' ? config.pass : '';
|
|
42
|
+
const timeoutMs = Number(config.timeoutMs ?? 30_000);
|
|
43
|
+
return { bookUrl, pass, timeoutMs: Number.isFinite(timeoutMs) && timeoutMs > 0 ? timeoutMs : 30_000 };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function skillDefinition() {
|
|
47
|
+
return {
|
|
48
|
+
name: SKILL_NAME,
|
|
49
|
+
description: '自媒体出海:用户说「自媒体出海」或「AI全球自媒体」、想做海外自媒体、想上 X 开蓝 V 时加载。从装好工具包开始一环一环带,走到海外平台。',
|
|
50
|
+
whenToUse: '用户提到自媒体出海、AI全球自媒体、出海、海外平台、X、推特、蓝 V、Premium,或问「接下来怎么做」时。',
|
|
51
|
+
source: 'runtime',
|
|
52
|
+
content: skillContent(),
|
|
53
|
+
metadata: { plugin: 'dsh-plugin-chuhai', version: VERSION },
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Fetch the book once; the caller owns retries. */
|
|
58
|
+
export async function fetchBook(options, fetchImpl = globalThis.fetch, signal) {
|
|
59
|
+
const controller = new AbortController();
|
|
60
|
+
const timer = setTimeout(() => controller.abort(), options.timeoutMs);
|
|
61
|
+
if (signal) signal.addEventListener('abort', () => controller.abort(), { once: true });
|
|
62
|
+
try {
|
|
63
|
+
let res;
|
|
64
|
+
try {
|
|
65
|
+
res = await fetchImpl(options.bookUrl, {
|
|
66
|
+
method: 'GET',
|
|
67
|
+
headers: { 'X-Pass': options.pass, 'Accept': 'text/markdown, text/plain;q=0.9, */*;q=0.1', 'User-Agent': 'dsh-plugin-chuhai/' + VERSION },
|
|
68
|
+
redirect: 'follow',
|
|
69
|
+
signal: controller.signal,
|
|
70
|
+
});
|
|
71
|
+
} catch (err) {
|
|
72
|
+
const cause = err?.cause?.code ?? err?.code ?? (err?.name === 'AbortError' ? 'TIMEOUT' : err?.message ?? String(err));
|
|
73
|
+
throw new Error('chuhai: 连不上 dsh.chuhai.express(' + cause + ')。先看这台电脑能不能打开网页,稍后再试一次;一直连不上就到 dsh.ilang.guide 看公告。');
|
|
74
|
+
}
|
|
75
|
+
if (res.status === 401) throw new Error('chuhai: 取书被拒(401)。插件带的密码和站上的不一致,请把插件更新到最新版本;更新后还不行就到 dsh.ilang.guide 看公告。');
|
|
76
|
+
if (!res.ok) throw new Error('chuhai: 取书失败,HTTP ' + res.status + '。稍后再试一次;一直失败就到 dsh.ilang.guide 看公告。');
|
|
77
|
+
const text = await res.text();
|
|
78
|
+
if (!text.includes('::ILANG::')) throw new Error('chuhai: 取回的不是工程书(没有 ::ILANG:: 标记)。稍后再试一次。');
|
|
79
|
+
return text;
|
|
80
|
+
} finally {
|
|
81
|
+
clearTimeout(timer);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function toolDefinition(options, fetchImpl) {
|
|
86
|
+
return {
|
|
87
|
+
name: 'chuhai_book',
|
|
88
|
+
description: '取「自媒体出海」后半段的工程书(出海:买海外服务器、装加速、客户端、注册 X、开 Premium)。只在 zimeiti-chuhai 技能让你取的时候调用;取回来照书从 M0 开始做。',
|
|
89
|
+
parameters: { type: 'object', properties: {}, additionalProperties: false },
|
|
90
|
+
output: {
|
|
91
|
+
schema: { type: 'object', properties: { content: { type: 'array', items: {} } }, required: ['content'], additionalProperties: false },
|
|
92
|
+
render(_args, value) { return value.content; },
|
|
93
|
+
},
|
|
94
|
+
async execute(_args, exec) {
|
|
95
|
+
const text = await fetchBook(options, fetchImpl, exec?.signal);
|
|
96
|
+
return { content: [{ type: 'text', text }] };
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function apply(ctx, config = {}) {
|
|
102
|
+
const options = normalize(config);
|
|
103
|
+
ctx.effect(() => {
|
|
104
|
+
const disposers = [];
|
|
105
|
+
try {
|
|
106
|
+
disposers.push(ctx.skills.register(skillDefinition()));
|
|
107
|
+
disposers.push(ctx.tools.register(toolDefinition(options)));
|
|
108
|
+
ctx.logger?.info?.('chuhai: skill ' + SKILL_NAME + ' and tool chuhai_book registered');
|
|
109
|
+
} catch (err) {
|
|
110
|
+
for (const d of disposers) { try { d(); } catch { /* ignore */ } }
|
|
111
|
+
throw err;
|
|
112
|
+
}
|
|
113
|
+
return () => { for (const d of disposers) { try { d(); } catch { /* ignore */ } } };
|
|
114
|
+
});
|
|
115
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-plugin-chuhai",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "自媒体出海 for DeepSeek Harness — 说一句「自媒体出海」,DSH 从零带你做到海外平台:装机、内容源、知识库、出文章、公众号走通,再到 X 开蓝 V。iLang DSH 工具包的第一个官方插件。",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./lib/index.js",
|
|
9
|
+
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
10
|
+
"./package.json": "./package.json"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"lib/*.js",
|
|
14
|
+
"skills/*.md",
|
|
15
|
+
"cordis.patch.yml",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE"
|
|
18
|
+
],
|
|
19
|
+
"keywords": [
|
|
20
|
+
"dsh",
|
|
21
|
+
"dsh-plugin",
|
|
22
|
+
"deepseek-harness",
|
|
23
|
+
"ilang",
|
|
24
|
+
"自媒体",
|
|
25
|
+
"出海",
|
|
26
|
+
"自媒体出海",
|
|
27
|
+
"AI全球自媒体"
|
|
28
|
+
],
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"author": "adsorgcn",
|
|
31
|
+
"homepage": "https://dsh.ilang.guide/",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/adsorgcn/dsh-plugin-chuhai.git"
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=20",
|
|
38
|
+
"dsh": ">=0.2.1-rc.5 <0.3.0"
|
|
39
|
+
},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"dsh": {
|
|
44
|
+
"bundle": {
|
|
45
|
+
"patch": "./cordis.patch.yml"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"test": "node --test test/plugin.test.mjs"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# 自媒体出海
|
|
2
|
+
|
|
3
|
+
你在带一个人从零做海外自媒体,走到 X 开蓝 V。这条路分两段,两段各有一本工程书,书里的规矩高于这里的话。
|
|
4
|
+
|
|
5
|
+
## 第一段:AI全球自媒体(工具包自带的书)
|
|
6
|
+
|
|
7
|
+
1. 看工作区里有没有 `.dsh/books/ai-global-media/BOOK.md`。
|
|
8
|
+
- 有:从它开始,照书一环一环做(人格、内容源、知识库、出文章、公众号走通)。中途断过的,从没做完的那一环接着做。
|
|
9
|
+
- 没有:说明还没装 iLang DSH 工具包。告诉用户去 https://dsh.ilang.guide/ 复制「那句话」贴给你;装完再说一句「自媒体出海」。不要自己从别处找书。
|
|
10
|
+
2. 用户只做付款、扫码、登录、授权这几件事;能你做的都你做。
|
|
11
|
+
|
|
12
|
+
## 第二段:出海(从 dsh.chuhai.express 取的书)
|
|
13
|
+
|
|
14
|
+
3. 第一段五环都走通了,或者用户明确说现在就要出海、要上 X:调用工具 `chuhai_book`,它会把出海那本书取回来。
|
|
15
|
+
- 取回来从 M0 开始照做:买海外服务器、装加速、在用户的设备上配客户端、注册 X、开 Premium。
|
|
16
|
+
- 取不回来:把工具返回的那句话原样告诉用户,别自己编一套步骤。
|
|
17
|
+
4. 这段里的秘密(服务器密码、钥匙)只在命令行或密码框里传,不进对话、不写明文文件。连接链接可以给用户看。
|
|
18
|
+
5. 连通与否只认真实页面:打开了 x.com 或 youtube.com 的真实页面才算,图标变绿不算;断开再连仍通才算稳定。
|
|
19
|
+
|
|
20
|
+
## 进度
|
|
21
|
+
|
|
22
|
+
- 目前到:X 开 Premium。再往后的环(用 Grok 做事、一稿多发、广告分成、卖课)在更新中。
|
|
23
|
+
- 插件更新以后,用户再说一句「自媒体出海」,你就按新书走。
|
|
24
|
+
|
|
25
|
+
## 汇报
|
|
26
|
+
|
|
27
|
+
每段做完照书里的汇报格式说,第二段是六行:结果、验了什么、改了什么、怎么用和怎么还原、剩什么、得分。
|