@wwkit/harness 1.0.4
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 +101 -0
- package/agents/extract.md +38 -0
- package/agents/query.md +54 -0
- package/agents/revise.md +40 -0
- package/package.json +55 -0
- package/plugin.js +19 -0
- package/readme/development.md +37 -0
- package/readme/publish.md +38 -0
- package/readme/testing.md +36 -0
- package/skills/extract/SKILL.md +100 -0
- package/skills/extract/references/build-xpath.js +31 -0
- package/skills/extract/references/clean-html.js +91 -0
- package/skills/extract/references/detail.md +60 -0
- package/skills/extract/references/detail.schema.json5 +49 -0
- package/skills/extract/references/extract-detail.js +72 -0
- package/skills/extract/references/extract-regex.js +82 -0
- package/skills/extract/references/extract-sample.js +49 -0
- package/skills/extract/references/format-aliases.json5 +22 -0
- package/skills/extract/references/input.schema.json5 +23 -0
- package/skills/extract/references/list-rule-gen.md +109 -0
- package/skills/extract/references/list.schema.json5 +34 -0
- package/skills/extract/references/list_from_html.md +74 -0
- package/skills/extract/references/list_from_json.md +52 -0
- package/skills/extract/references/list_from_text.md +60 -0
- package/skills/extract/references/navi.md +49 -0
- package/skills/extract/references/navi.schema.json5 +23 -0
- package/skills/extract/references/text.md +46 -0
- package/skills/extract/references/text.schema.json5 +22 -0
- package/skills/extract/references/to-text.js +21 -0
- package/skills/extract/references/validate-schema.js +40 -0
- package/skills/revise/SKILL.md +113 -0
- package/skills/revise/references/article.md +44 -0
- package/skills/revise/references/article.schema.json5 +40 -0
- package/skills/revise/references/format-aliases.json5 +22 -0
- package/skills/revise/references/gallery.md +43 -0
- package/skills/revise/references/gallery.schema.json5 +40 -0
- package/skills/revise/references/input.schema.json5 +28 -0
- package/skills/revise/references/question.md +41 -0
- package/skills/revise/references/question.schema.json5 +31 -0
- package/skills/revise/references/status.md +40 -0
- package/skills/revise/references/status.schema.json5 +27 -0
- package/skills/revise/references/validate-schema.js +40 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# 社交媒体风格问题创作 Prompt
|
|
2
|
+
|
|
3
|
+
## 任务
|
|
4
|
+
|
|
5
|
+
根据原始素材提取并创作一个**适合社交媒体传播的问题(question)**。
|
|
6
|
+
|
|
7
|
+
## 输入
|
|
8
|
+
|
|
9
|
+
- `source`:原始素材(文本或 JSON 字符串)
|
|
10
|
+
- `count`:生成的问题数量(默认 1,输出为数组)
|
|
11
|
+
- 创作格式要求见下方
|
|
12
|
+
|
|
13
|
+
## 输出格式
|
|
14
|
+
|
|
15
|
+
输出为 JSON **数组**,每个元素的结构必须严格符合 schema `references/question.schema.json5`(阶段 2 已读取)——字段、类型、必填项、数组数量、title/content 长度均以 schema 为准。
|
|
16
|
+
|
|
17
|
+
> 字数计算采用 **cn_length** 规则:中文字符算 1,非中文字符(英文/数字/符号)算 0.5,结果向上取整。
|
|
18
|
+
|
|
19
|
+
## 创作要求
|
|
20
|
+
|
|
21
|
+
1. **标题要尖锐**:有争议性、冲突点,能激发讨论欲和互动
|
|
22
|
+
2. **描述要简洁**:说明背景,引出矛盾点,不要太长
|
|
23
|
+
3. **图片按需提取**:从原始素材中提取图片地址,最多 5 张,元素为图片地址字符串;素材无图片时为空
|
|
24
|
+
4. **基于素材创作**:从素材中提取核心矛盾点,不能凭空编造
|
|
25
|
+
|
|
26
|
+
## 输出示例
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
[
|
|
30
|
+
{
|
|
31
|
+
"title": "为什么同样的努力,有人成功有人失败?",
|
|
32
|
+
"content": "在职场中发现,同样勤奋的两个人,结局却天差地别。差距到底在哪里?",
|
|
33
|
+
"images": ["https://example.com/pic1.jpg"]
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## 注意事项
|
|
39
|
+
|
|
40
|
+
- 仅输出 JSON 数组,不要包含任何解释、思考过程或额外文本
|
|
41
|
+
- 输出始终为数组,包含 count 个 item(默认 1),禁止输出单个对象
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
// 省略 $schema 字段,避免 bash -c "" 中 $ 展开问题
|
|
3
|
+
"title": "社交媒体问题格式",
|
|
4
|
+
"description": "社交媒体风格问题的输出校验 schema(数组,至少 1 个 item)",
|
|
5
|
+
"type": "array",
|
|
6
|
+
"minItems": 1,
|
|
7
|
+
"items": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"title": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "问题标题,10-30 cn_length"
|
|
13
|
+
},
|
|
14
|
+
"content": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"description": "问题描述,20-500 cn_length"
|
|
17
|
+
},
|
|
18
|
+
"images": {
|
|
19
|
+
"type": "array",
|
|
20
|
+
"description": "问题图片地址列表,最多 5 张",
|
|
21
|
+
"items": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"format": "uri"
|
|
24
|
+
},
|
|
25
|
+
"maxItems": 5
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"required": ["title", "content", "images"],
|
|
29
|
+
"additionalProperties": false
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# 社交媒体动态创作 Prompt
|
|
2
|
+
|
|
3
|
+
## 任务
|
|
4
|
+
|
|
5
|
+
根据原始素材提取并创作一条**适合社交媒体传播的动态(status)**。
|
|
6
|
+
|
|
7
|
+
## 输入
|
|
8
|
+
|
|
9
|
+
- `source`:原始素材(文本或 JSON 字符串)
|
|
10
|
+
- `count`:生成的动态数量(默认 1,输出为数组)
|
|
11
|
+
- 创作格式要求见下方
|
|
12
|
+
|
|
13
|
+
## 输出格式
|
|
14
|
+
|
|
15
|
+
输出为 JSON **数组**,每个元素的结构必须严格符合 schema `references/status.schema.json5`(阶段 2 已读取)——字段、类型、必填项、数组数量、content 长度均以 schema 为准。
|
|
16
|
+
|
|
17
|
+
> 字数计算采用 **cn_length** 规则:中文字符算 1,非中文字符(英文/数字/符号)算 0.5,结果向上取整。
|
|
18
|
+
|
|
19
|
+
## 创作要求
|
|
20
|
+
|
|
21
|
+
1. **正文要精炼**:短平快,提炼核心信息,避免大段照抄原文
|
|
22
|
+
2. **有观点、易互动**:口语化表达,带个人观点或情绪,能引发讨论和转发
|
|
23
|
+
3. **图片按需提取**:从原始素材中提取图片地址,最多 5 张,元素为图片地址字符串;素材无图片时为空
|
|
24
|
+
4. **基于素材创作**:从素材中提炼要点,不能凭空编造
|
|
25
|
+
|
|
26
|
+
## 输出示例
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
[
|
|
30
|
+
{
|
|
31
|
+
"content": "三星二季度营业利润预计同比暴涨18倍,AI存储需求成最大推手,你怎么看?",
|
|
32
|
+
"images": ["https://example.com/pic1.jpg"]
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## 注意事项
|
|
38
|
+
|
|
39
|
+
- 仅输出 JSON 数组,不要包含任何解释、思考过程或额外文本
|
|
40
|
+
- 输出始终为数组,包含 count 个 item(默认 1),禁止输出单个对象
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
// 省略 $schema 字段,避免 bash -c "" 中 $ 展开问题
|
|
3
|
+
"title": "动态格式",
|
|
4
|
+
"description": "社交媒体动态(status)输出校验 schema(数组,至少 1 个 item)",
|
|
5
|
+
"type": "array",
|
|
6
|
+
"minItems": 1,
|
|
7
|
+
"items": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"content": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "动态正文,20-500 cn_length"
|
|
13
|
+
},
|
|
14
|
+
"images": {
|
|
15
|
+
"type": "array",
|
|
16
|
+
"description": "动态配图地址列表,最多 5 张,素材无图片时可为空",
|
|
17
|
+
"items": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"format": "uri"
|
|
20
|
+
},
|
|
21
|
+
"maxItems": 5
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"required": ["content", "images"],
|
|
25
|
+
"additionalProperties": false
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { fileURLToPath } from 'url';
|
|
2
|
+
import { readFileSync } from 'fs';
|
|
3
|
+
import Ajv from 'ajv';
|
|
4
|
+
import json5 from 'json5';
|
|
5
|
+
|
|
6
|
+
const ajv = new Ajv({ strict: false, validateFormats: true });
|
|
7
|
+
ajv.addFormat('uri', /^[a-z][a-z0-9+.-]*:(\/\/)?[^\s]*$/i);
|
|
8
|
+
|
|
9
|
+
export function validateSchema(data, schemaPath) {
|
|
10
|
+
const schemaContent = readFileSync(schemaPath, 'utf-8');
|
|
11
|
+
let schema;
|
|
12
|
+
try {
|
|
13
|
+
schema = JSON.parse(schemaContent);
|
|
14
|
+
} catch {
|
|
15
|
+
schema = json5.parse(schemaContent);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const validate = ajv.compile(schema);
|
|
19
|
+
const valid = validate(data);
|
|
20
|
+
|
|
21
|
+
if (valid) return { valid: true, message: 'VALID' };
|
|
22
|
+
return { valid: false, message: 'INVALID: ' + (validate.errors?.[0]?.message || 'unknown error') };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function main() {
|
|
26
|
+
const chunks = [];
|
|
27
|
+
process.stdin.on('data', chunk => chunks.push(chunk));
|
|
28
|
+
process.stdin.on('end', () => {
|
|
29
|
+
try {
|
|
30
|
+
const input = JSON.parse(Buffer.concat(chunks).toString());
|
|
31
|
+
const result = validateSchema(input.data, input.schema_path);
|
|
32
|
+
console.log(result.message);
|
|
33
|
+
} catch (e) {
|
|
34
|
+
console.log('INVALID: ' + e.message);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export default validateSchema;
|
|
40
|
+
if (process.argv[1] === fileURLToPath(import.meta.url)) main();
|