@craft_eco/craft-mcp 0.1.21 → 0.1.25
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 +8 -8
- package/bin/craft-mcp.mjs +6 -0
- package/dist-server/game-workflow/draft-uploads.mjs +26 -8
- package/dist-server/game-workflow/publication-materials.mjs +48 -21
- package/dist-server/game-workflow/publications.mjs +35 -17
- package/dist-server/game-workflow/publish-capture.mjs +57 -21
- package/dist-server/mcp/publication-page.html +4 -3
- package/dist-server/mcp/publication-page.mjs +85 -24
- package/dist-server/mcp/publish-panel.mjs +54 -33
- package/dist-server/mcp/server.mjs +5 -4
- package/dist-server/upstream/craft-aigc.mjs +1 -1
- package/dist-server/upstream/publication-transport.mjs +37 -17
- package/package.json +3 -2
- package/vendor/agent-cli/dist/src/artifacts/preinstalled-dependencies.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/preinstalled-dependencies.js +69 -5
- package/vendor/agent-cli/dist/src/artifacts/preinstalled-dependencies.js.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/process-artifacts.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/process-artifacts.js +5 -0
- package/vendor/agent-cli/dist/src/artifacts/process-artifacts.js.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/restore.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/restore.js +3 -2
- package/vendor/agent-cli/dist/src/artifacts/restore.js.map +1 -1
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-delivery.d.ts +7 -0
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-delivery.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-delivery.js +145 -0
- package/vendor/agent-cli/dist/src/artifacts/scene-asset-delivery.js.map +1 -0
- package/vendor/agent-cli/dist/src/context/template-cache.d.ts +5 -1
- package/vendor/agent-cli/dist/src/context/template-cache.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/context/template-cache.js.map +1 -1
- package/vendor/agent-cli/dist/src/context/template-refresh.d.ts +6 -0
- package/vendor/agent-cli/dist/src/context/template-refresh.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/context/template-refresh.js +45 -0
- package/vendor/agent-cli/dist/src/context/template-refresh.js.map +1 -0
- package/vendor/agent-cli/dist/src/context/template-seed.d.ts +13 -3
- package/vendor/agent-cli/dist/src/context/template-seed.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/context/template-seed.js +22 -4
- package/vendor/agent-cli/dist/src/context/template-seed.js.map +1 -1
- package/vendor/agent-cli/dist/src/context/template-sync.d.ts +11 -0
- package/vendor/agent-cli/dist/src/context/template-sync.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/context/template-sync.js +167 -0
- package/vendor/agent-cli/dist/src/context/template-sync.js.map +1 -0
- package/vendor/agent-cli/dist/src/index.d.ts +1 -0
- package/vendor/agent-cli/dist/src/index.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/index.js +1 -0
- package/vendor/agent-cli/dist/src/index.js.map +1 -1
- package/vendor/agent-cli/dist/src/protocol/messages/messages.gen.d.ts +2 -0
- package/vendor/agent-cli/dist/src/protocol/messages/messages.gen.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/protocol/messages/messages.gen.js +1 -0
- package/vendor/agent-cli/dist/src/protocol/messages/messages.gen.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/client.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/client.js +3 -1
- package/vendor/agent-cli/dist/src/session/client.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/link-session.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/link-session.js +4 -1
- package/vendor/agent-cli/dist/src/session/link-session.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/process-environment.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/process-environment.js +11 -0
- package/vendor/agent-cli/dist/src/session/process-environment.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/process-lifecycle.js +1 -1
- package/vendor/agent-cli/dist/src/session/process-lifecycle.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/process-request.d.ts +1 -0
- package/vendor/agent-cli/dist/src/session/process-request.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/process-request.js +12 -28
- package/vendor/agent-cli/dist/src/session/process-request.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/process-summary-output.d.ts +15 -0
- package/vendor/agent-cli/dist/src/session/process-summary-output.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/session/process-summary-output.js +46 -0
- package/vendor/agent-cli/dist/src/session/process-summary-output.js.map +1 -0
- package/vendor/agent-cli/dist/src/session/run-setup.d.ts +2 -0
- package/vendor/agent-cli/dist/src/session/run-setup.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/run-setup.js +2 -0
- package/vendor/agent-cli/dist/src/session/run-setup.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/run-start-body.d.ts +1 -0
- package/vendor/agent-cli/dist/src/session/run-start-body.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/run-start-body.js +1 -0
- package/vendor/agent-cli/dist/src/session/run-start-body.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/tool-scheduler.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/tool-scheduler.js +2 -1
- package/vendor/agent-cli/dist/src/session/tool-scheduler.js.map +1 -1
- package/vendor/agent-cli/dist/src/session/user-choice-policy.d.ts +25 -0
- package/vendor/agent-cli/dist/src/session/user-choice-policy.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/session/user-choice-policy.js +70 -0
- package/vendor/agent-cli/dist/src/session/user-choice-policy.js.map +1 -0
- package/vendor/agent-cli/dist/src/session/user-choice.d.ts +3 -2
- package/vendor/agent-cli/dist/src/session/user-choice.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/session/user-choice.js +30 -9
- package/vendor/agent-cli/dist/src/session/user-choice.js.map +1 -1
- package/vendor/agent-cli/dist/src/shared/replace-file.d.ts +3 -0
- package/vendor/agent-cli/dist/src/shared/replace-file.d.ts.map +1 -0
- package/vendor/agent-cli/dist/src/shared/replace-file.js +34 -0
- package/vendor/agent-cli/dist/src/shared/replace-file.js.map +1 -0
- package/vendor/agent-cli/dist/src/shared/types.d.ts +9 -1
- package/vendor/agent-cli/dist/src/shared/types.d.ts.map +1 -1
- package/vendor/agent-cli/dist/src/shared/user-choice.d.ts +21 -2
- package/vendor/agent-cli/dist/src/shared/user-choice.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -9,13 +9,13 @@ Craft MCP 是面向支持本地 stdio MCP 的 AI IDE 的游戏制作服务,例
|
|
|
9
9
|
以下命令只打印本页后退出;如果正在读取 guide 的输出,直接继续配置步骤:
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
|
-
npx --yes --prefer-online --registry=https://registry.npmjs.org/ @craft_eco/craft-mcp@
|
|
12
|
+
npx --yes --prefer-online --registry=https://registry.npmjs.org/ @craft_eco/craft-mcp@stable guide
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
1. 识别当前 AI IDE 的 MCP
|
|
15
|
+
1. 识别当前 AI IDE 的 MCP 设置入口和配置格式,按下方示例配置 Craft。已有同包名、同 npm 源和同平台的 Craft 服务时,更新该服务的启动参数,保留其他服务。
|
|
16
16
|
2. 若无权修改宿主配置,展示匹配该宿主的配置让用户添加。不要把 JSON 写入 TOML,也不要覆盖用户整个配置文件。
|
|
17
17
|
3. 在 AI IDE 中启用并重连 MCP 服务。普通终端执行启动命令不代表宿主已加载工具;服务参数不添加 guide。
|
|
18
|
-
4. 调用 craft_game_info
|
|
18
|
+
4. 调用 craft_game_info,将实际版本与 `npm view @craft_eco/craft-mcp@stable version --prefer-online --registry=https://registry.npmjs.org/` 的结果对照,确认平台为 https://pre.craft.qq.com。制作游戏前完整读取 context.engine.entrypoint 返回的 AGENTS.md 及其按需引用。
|
|
19
19
|
5. 需要登录时调用 craft_auth_open,让用户只在返回的本机页面填写 CLI Key;凭据不进入聊天、游戏工程或共享配置。
|
|
20
20
|
|
|
21
21
|
### Codex:TOML 配置
|
|
@@ -25,11 +25,11 @@ npx --yes --prefer-online --registry=https://registry.npmjs.org/ @craft_eco/craf
|
|
|
25
25
|
```toml
|
|
26
26
|
[mcp_servers.craft]
|
|
27
27
|
command = "npx"
|
|
28
|
-
args = ["--yes","--prefer-online","--registry=https://registry.npmjs.org/","@craft_eco/craft-mcp@
|
|
28
|
+
args = ["--yes","--prefer-online","--registry=https://registry.npmjs.org/","@craft_eco/craft-mcp@stable"]
|
|
29
29
|
startup_timeout_sec = 120
|
|
30
30
|
|
|
31
31
|
[mcp_servers.craft.env]
|
|
32
|
-
CRAFT_WEB_URL = "https://
|
|
32
|
+
CRAFT_WEB_URL = "https://pre.craft.qq.com"
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
### Trae、WorkBuddy 与支持 mcpServers JSON 的宿主
|
|
@@ -45,10 +45,10 @@ CRAFT_WEB_URL = "https://test.craft.qq.com"
|
|
|
45
45
|
"--yes",
|
|
46
46
|
"--prefer-online",
|
|
47
47
|
"--registry=https://registry.npmjs.org/",
|
|
48
|
-
"@craft_eco/craft-mcp@
|
|
48
|
+
"@craft_eco/craft-mcp@stable"
|
|
49
49
|
],
|
|
50
50
|
"env": {
|
|
51
|
-
"CRAFT_WEB_URL": "https://
|
|
51
|
+
"CRAFT_WEB_URL": "https://pre.craft.qq.com"
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -65,6 +65,6 @@ CRAFT_WEB_URL = "https://test.craft.qq.com"
|
|
|
65
65
|
|
|
66
66
|
私有上传使用 craft_game_upload;draft_ready 仅表示私有草稿已上传。公开发布使用 craft_game_publish_open 打开本地发布页,审阅具体文案、图片、目标版本和 revision,由用户确认后才上传公开图片并提审。
|
|
67
67
|
|
|
68
|
-
当前业务平台是 https://
|
|
68
|
+
当前业务平台是 https://pre.craft.qq.com。npm 程序公开可下载不代表生产环境或公开发布开关已启用;上传和提审需要匹配的 Web 服务与审核配置。
|
|
69
69
|
|
|
70
70
|
发布图片上传后可公开访问,游戏审核通过后可能公开。平台审核覆盖提交的文案与图片,不会扫描或执行整个游戏压缩包。
|
package/bin/craft-mcp.mjs
CHANGED
|
@@ -9,6 +9,12 @@ if (major < 22 || (major === 22 && minor < 12)) {
|
|
|
9
9
|
|
|
10
10
|
const args = process.argv.slice(2);
|
|
11
11
|
if (args.length === 0) {
|
|
12
|
+
// A supplied token or profile may belong to another environment. Use the
|
|
13
|
+
// packaged default only for ordinary startup without either override.
|
|
14
|
+
if (!process.env.CRAFT_WEB_URL && !process.env.CLIENT_DATA_DIR && !Object.hasOwn(process.env,'CRAFT_TOKEN')) {
|
|
15
|
+
const { craftDefaultPlatform } = JSON.parse(await readFile(new URL('../package.json',import.meta.url),'utf8'));
|
|
16
|
+
if (craftDefaultPlatform) process.env.CRAFT_WEB_URL = craftDefaultPlatform;
|
|
17
|
+
}
|
|
12
18
|
await import('../dist-server/mcp/start.mjs');
|
|
13
19
|
} else if (args.length === 1 && args[0] === 'guide') {
|
|
14
20
|
process.stdout.write(await readFile(new URL('../README.md', import.meta.url), 'utf8'));
|
|
@@ -48,6 +48,20 @@ export class DraftUploads {
|
|
|
48
48
|
|
|
49
49
|
async hasRequest(name, id, owner) { return Boolean(await this.#record(name,id,owner)); }
|
|
50
50
|
|
|
51
|
+
async publicationTarget(check, owner) {
|
|
52
|
+
const { name,task_id:id,result:{ engine } } = check;
|
|
53
|
+
const record = await this.#record(name,id,owner);
|
|
54
|
+
if (record) {
|
|
55
|
+
if (record.engine !== engine) throw new Error('Draft upload engine changed');
|
|
56
|
+
return record.conversation_id ?? record.prepare_input?.conversation_id;
|
|
57
|
+
}
|
|
58
|
+
const scope = this.#scope(name,engine,owner);
|
|
59
|
+
const binding = await this.bindings.read(scope);
|
|
60
|
+
if (binding?.conversation_id) return binding.conversation_id;
|
|
61
|
+
const latest = binding ? binding.pending ?? binding.migration?.[0] : (await this.#history(scope))[0];
|
|
62
|
+
return latest?.conversation_id ?? latest?.prepare_input?.conversation_id;
|
|
63
|
+
}
|
|
64
|
+
|
|
51
65
|
async publicationSource(name, id, owner, signal) {
|
|
52
66
|
const record = await this.#record(name,id,owner);
|
|
53
67
|
if (!record) throw new Error('Upload this checked build before preparing publication');
|
|
@@ -105,18 +119,22 @@ export class DraftUploads {
|
|
|
105
119
|
return record;
|
|
106
120
|
}
|
|
107
121
|
|
|
122
|
+
async #history(scope) {
|
|
123
|
+
const history = (await this.store.list()).filter(record=>
|
|
124
|
+
Object.entries(scope).every(([key,value])=>record[key] === value) && record.state !== 'expired');
|
|
125
|
+
if (history.some(record=>!Number.isFinite(Date.parse(record.created_at)))) throw new Error('Invalid draft upload history timestamp');
|
|
126
|
+
history.sort((a,b)=>Date.parse(b.created_at)-Date.parse(a.created_at));
|
|
127
|
+
if (history.some((record,index)=>index && Date.parse(record.created_at) === Date.parse(history[index-1].created_at))) {
|
|
128
|
+
throw new Error('Ambiguous draft upload history; cannot choose the original project');
|
|
129
|
+
}
|
|
130
|
+
return history;
|
|
131
|
+
}
|
|
132
|
+
|
|
108
133
|
async #loadBinding(scope) {
|
|
109
134
|
let binding = await this.bindings.read(scope);
|
|
110
135
|
if (!binding) {
|
|
111
|
-
const history = (await this.store.list()).filter(record=>
|
|
112
|
-
Object.entries(scope).every(([key,value])=>record[key] === value) && record.state !== 'expired');
|
|
113
|
-
if (history.some(record=>!Number.isFinite(Date.parse(record.created_at)))) throw new Error('Invalid draft upload history timestamp');
|
|
114
|
-
history.sort((a,b)=>Date.parse(b.created_at)-Date.parse(a.created_at));
|
|
115
|
-
if (history.some((record,index)=>index && Date.parse(record.created_at) === Date.parse(history[index-1].created_at))) {
|
|
116
|
-
throw new Error('Ambiguous draft upload history; cannot choose the original project');
|
|
117
|
-
}
|
|
118
136
|
// Persist the migration queue as well: a crash or profile switch must not lose older receipts.
|
|
119
|
-
binding = await this.bindings.save(scope,{ schema:1,...scope,migration:history });
|
|
137
|
+
binding = await this.bindings.save(scope,{ schema:1,...scope,migration:await this.#history(scope) });
|
|
120
138
|
}
|
|
121
139
|
return binding;
|
|
122
140
|
}
|
|
@@ -2,33 +2,36 @@ import path from 'node:path';
|
|
|
2
2
|
import { constants } from 'node:fs';
|
|
3
3
|
import { open, mkdir, writeFile } from 'node:fs/promises';
|
|
4
4
|
import { createHash } from 'node:crypto';
|
|
5
|
+
import { boundedBody } from '../upstream/craft-aigc.mjs';
|
|
5
6
|
import { safeProjectFile } from './asset-import.mjs';
|
|
6
7
|
import { imageExtension } from './asset-formats.mjs';
|
|
7
8
|
import { digest } from './request-store.mjs';
|
|
8
9
|
|
|
9
10
|
const text = (value, max, label) => {
|
|
10
|
-
if (typeof value !== 'string' || !value.trim() || [...value].length > max || /[\x00-\x08\x0b\x0c\x0e-\x1f]/.test(value)) throw new Error(
|
|
11
|
+
if (typeof value !== 'string' || !value.trim() || [...value].length > max || /[\x00-\x08\x0b\x0c\x0e-\x1f]/.test(value)) throw new Error(`请填写有效的${label},最多 ${max} 个字符。`);
|
|
11
12
|
return value.trim();
|
|
12
13
|
};
|
|
14
|
+
const imageLimit = 2 * 1024 * 1024;
|
|
15
|
+
const imageFormatMessage = '请选择 PNG 或 JPEG 格式的发布图片。';
|
|
13
16
|
|
|
14
17
|
export function publicationMaterials(input) {
|
|
15
18
|
const allowed = ['game_name','instructions','game_type','art_styles','play_tags','open_to_recreate','cover_path','cover_image_source'];
|
|
16
|
-
if (!input || Array.isArray(input) || typeof input !== 'object' || Object.keys(input).some(key=>!allowed.includes(key))) throw new Error('
|
|
17
|
-
const result = { game_name:text(input.game_name,40,'
|
|
18
|
-
for (const key of ['art_styles','play_tags']) {
|
|
19
|
+
if (!input || Array.isArray(input) || typeof input !== 'object' || Object.keys(input).some(key=>!allowed.includes(key))) throw new Error('发布资料格式无效。请检查资料后再提交。');
|
|
20
|
+
const result = { game_name:text(input.game_name,40,'游戏名称'), instructions:text(input.instructions,8000,'玩法说明'),game_type:text(input.game_type,100,'游戏类型') };
|
|
21
|
+
for (const [key,label] of [['art_styles','美术风格'],['play_tags','玩法标签']]) {
|
|
19
22
|
const values = input[key] ?? [];
|
|
20
|
-
if (!Array.isArray(values) || values.length > 12) throw new Error(
|
|
21
|
-
result[key] = [...new Set(values.map(value=>text(value,50,
|
|
23
|
+
if (!Array.isArray(values) || values.length > 12) throw new Error(`请选择有效的${label},最多 12 项。`);
|
|
24
|
+
result[key] = [...new Set(values.map(value=>text(value,50,label)))];
|
|
22
25
|
}
|
|
23
|
-
if (Buffer.byteLength(JSON.stringify({ game_type:result.game_type,art_styles:result.art_styles,play_tags:result.play_tags })) > 1900) throw new Error('
|
|
24
|
-
if (input.open_to_recreate !== undefined && typeof input.open_to_recreate !== 'boolean') throw new Error('
|
|
25
|
-
if (input.open_to_recreate === true) throw new Error('
|
|
26
|
+
if (Buffer.byteLength(JSON.stringify({ game_type:result.game_type,art_styles:result.art_styles,play_tags:result.play_tags })) > 1900) throw new Error('分类和标签超出平台长度限制。请减少标签后再试。');
|
|
27
|
+
if (input.open_to_recreate !== undefined && typeof input.open_to_recreate !== 'boolean') throw new Error('开放二创选项无效。请关闭开放二创后再试。');
|
|
28
|
+
if (input.open_to_recreate === true) throw new Error('当前版本不包含可编辑源码。请关闭开放二创后再试。');
|
|
26
29
|
result.open_to_recreate = input.open_to_recreate ?? false;
|
|
27
|
-
if (input.cover_image_source !== undefined && ![1,2].includes(input.cover_image_source)) throw new Error('
|
|
30
|
+
if (input.cover_image_source !== undefined && ![1,2].includes(input.cover_image_source)) throw new Error('封面来源无效。请重新选择封面。');
|
|
28
31
|
result.cover_image_source = input.cover_image_source ?? 2;
|
|
29
32
|
if (input.cover_path !== undefined) {
|
|
30
|
-
const value = text(input.cover_path,512,'
|
|
31
|
-
if (path.isAbsolute(value) || /[\\:\x00]/.test(value) || value.split('/').some(part=>!part || part.startsWith('.'))) throw new Error('
|
|
33
|
+
const value = text(input.cover_path,512,'封面路径');
|
|
34
|
+
if (path.isAbsolute(value) || /[\\:\x00]/.test(value) || value.split('/').some(part=>!part || part.startsWith('.'))) throw new Error('请使用工程内的相对路径指定 PNG 或 JPEG 封面。');
|
|
32
35
|
result.cover_path = value;
|
|
33
36
|
}
|
|
34
37
|
return result;
|
|
@@ -40,25 +43,49 @@ export async function readMaterial(root, relative, expected) {
|
|
|
40
43
|
let data;
|
|
41
44
|
try {
|
|
42
45
|
const stat = await handle.stat();
|
|
43
|
-
if (!stat.isFile() || stat.size < 1 || stat.size >
|
|
46
|
+
if (!stat.isFile() || stat.size < 1 || stat.size > imageLimit) throw new Error('请选择大小在 2 MiB 以内的非空发布图片。');
|
|
44
47
|
data = await handle.readFile();
|
|
45
|
-
if (data.length !== stat.size) throw new Error('
|
|
48
|
+
if (data.length !== stat.size) throw new Error('发布图片在读取时发生变化。请重新准备发布材料。');
|
|
46
49
|
} finally { await handle.close(); }
|
|
47
|
-
const
|
|
48
|
-
if (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
return { data,extension,sha256,bytes:data.length };
|
|
50
|
+
const image = inspectImage(data);
|
|
51
|
+
if (expected && (image.sha256 !== expected.sha256 || image.bytes !== expected.bytes ||
|
|
52
|
+
(expected.extension !== undefined && image.extension !== expected.extension))) throw new Error('发布材料已变化。请重新准备并确认材料。');
|
|
53
|
+
return image;
|
|
52
54
|
}
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
function inspectImage(data) {
|
|
57
|
+
let extension;
|
|
58
|
+
try { extension = imageExtension(data); } catch { throw new Error(imageFormatMessage); }
|
|
59
|
+
if (!['png','jpg'].includes(extension)) throw new Error(imageFormatMessage);
|
|
60
|
+
return { data,extension,sha256:createHash('sha256').update(data).digest('hex'),bytes:data.length };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export async function readPublishedCover(url, signal) {
|
|
64
|
+
try {
|
|
65
|
+
const response = await fetch(url,{ redirect:'error',credentials:'omit',
|
|
66
|
+
signal:AbortSignal.any([signal,AbortSignal.timeout(15000)]) });
|
|
67
|
+
if (!response.ok) {
|
|
68
|
+
await response.body?.cancel();
|
|
69
|
+
throw new Error('上次发布的封面下载失败。');
|
|
70
|
+
}
|
|
71
|
+
return inspectImage(await boundedBody(response,imageLimit));
|
|
72
|
+
} catch {
|
|
73
|
+
signal.throwIfAborted();
|
|
74
|
+
throw new Error('无法读取上次发布的封面。请上传新封面,或取消沿用以使用本次试玩截图。');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export async function writeMaterial(directory, name, purpose, image) {
|
|
56
79
|
await mkdir(directory,{ recursive:true,mode:0o700 });
|
|
57
80
|
const filename = `${name}.${image.extension}`;
|
|
58
81
|
await writeFile(path.join(directory,filename),image.data,{ flag:'wx',mode:0o600 });
|
|
59
82
|
return { file:filename,purpose,sha256:image.sha256,bytes:image.bytes,extension:image.extension };
|
|
60
83
|
}
|
|
61
84
|
|
|
85
|
+
export async function copyMaterial(root, relative, directory, name, purpose, expected) {
|
|
86
|
+
return writeMaterial(directory,name,purpose,await readMaterial(root,relative,expected));
|
|
87
|
+
}
|
|
88
|
+
|
|
62
89
|
export function publicationRevision(record) {
|
|
63
90
|
return digest({ request_id:record.request_id,workspace:record.workspace,name:record.name,owner:record.owner,platform:record.platform,
|
|
64
91
|
check_task_id:record.check_task_id,conversation_id:record.conversation_id,version_id:record.version_id,
|
|
@@ -2,7 +2,7 @@ import path from 'node:path';
|
|
|
2
2
|
import { randomUUID } from 'node:crypto';
|
|
3
3
|
import { mkdir } from 'node:fs/promises';
|
|
4
4
|
import { capturePublishMaterial } from './publish-capture.mjs';
|
|
5
|
-
import { publicationMaterials, copyMaterial, readMaterial, publicationRevision } from './publication-materials.mjs';
|
|
5
|
+
import { publicationMaterials, copyMaterial, readMaterial, readPublishedCover, writeMaterial, publicationRevision } from './publication-materials.mjs';
|
|
6
6
|
|
|
7
7
|
function view(record, remote) {
|
|
8
8
|
const matched = remote?.client_request_id === record.request_id;
|
|
@@ -30,31 +30,49 @@ export class Publications {
|
|
|
30
30
|
async #record(name, id, owner) {
|
|
31
31
|
const record = await this.store.read(id);
|
|
32
32
|
if (this.platform.account().user_id !== owner || record.name !== name || record.owner !== owner || record.platform !== this.platform.base || record.revision !== publicationRevision(record)) {
|
|
33
|
-
throw new Error('
|
|
33
|
+
throw new Error('发布记录与当前项目、账号、平台或材料版本不一致。请回到 WorkBuddy 重新打开对应的发布页。');
|
|
34
34
|
}
|
|
35
35
|
return record;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
#directory(record) { return path.join(this.store.directory,record.request_id); }
|
|
39
39
|
|
|
40
|
-
async
|
|
40
|
+
async previous(check, owner, signal) {
|
|
41
|
+
const conversation_id = await this.drafts.publicationTarget(check,owner);
|
|
42
|
+
if (!conversation_id) return;
|
|
43
|
+
const previous = await this.platform.publicationSession(owner)('previous',{ conversation_id },signal);
|
|
44
|
+
if (previous?.cover_url && new URL(previous.cover_url).origin !== await this.platform.assetOrigin()) delete previous.cover_url;
|
|
45
|
+
return previous;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async prepare(check, project, input, owner, signal, stagedCover, previousCover) {
|
|
41
49
|
const materials = publicationMaterials(input);
|
|
42
|
-
if (stagedCover && materials.cover_path) throw new Error('
|
|
50
|
+
if (stagedCover && materials.cover_path) throw new Error('请选择一种发布封面来源。');
|
|
43
51
|
const source = await this.drafts.publicationSource(check.name,check.task_id,owner,signal);
|
|
44
|
-
if (source.state !== 'draft_ready' || !/^[0-9a-f]{64}$/.test(source.external_manifest_sha256 ?? '')) throw new Error('
|
|
52
|
+
if (source.state !== 'draft_ready' || !/^[0-9a-f]{64}$/.test(source.external_manifest_sha256 ?? '')) throw new Error('未收到当前验收版本的草稿上传回执或构建校验值。请回到 WorkBuddy 检查私有草稿的上传状态。');
|
|
45
53
|
const existing = await this.platform.publicationSession(owner)('status',{ version_id:source.version_id },signal);
|
|
46
|
-
if (existing.state !== 'not_submitted' && (existing.conversation_id !== source.conversation_id || existing.external_manifest_sha256 !== source.external_manifest_sha256)) throw new Error('
|
|
47
|
-
if (existing.state === 'share_completed') throw new Error('
|
|
48
|
-
|
|
54
|
+
if (existing.state !== 'not_submitted' && (existing.conversation_id !== source.conversation_id || existing.external_manifest_sha256 !== source.external_manifest_sha256)) throw new Error('平台返回的发布状态与已上传的游戏版本不一致。请回到 WorkBuddy 核对当前验收结果。');
|
|
55
|
+
if (existing.state === 'share_completed') throw Object.assign(new Error('当前版本已发布。请回到 WorkBuddy 重新验收同一个游戏,再用新的验收结果打开发布页。'),
|
|
56
|
+
{ detail:{ reason:'publication_version_already_published' } });
|
|
57
|
+
if (['sharing','share_repacking'].includes(existing.state)) throw Object.assign(new Error('当前版本正在审核或发布处理中。请回到 WorkBuddy 查看原发布记录,等待处理结果。'),
|
|
58
|
+
{ detail:{ reason:'publication_review_in_progress' } });
|
|
59
|
+
let reusedCover;
|
|
60
|
+
if (previousCover && !stagedCover && !materials.cover_path) {
|
|
61
|
+
if (previousCover.conversation_id !== source.conversation_id || previousCover.version_id === source.version_id ||
|
|
62
|
+
new URL(previousCover.cover_url).origin !== await this.platform.assetOrigin()) throw new Error('上次发布的封面与当前项目或版本不匹配,请刷新进度后重试。');
|
|
63
|
+
reusedCover = await readPublishedCover(previousCover.cover_url,signal);
|
|
64
|
+
materials.cover_image_source = previousCover.cover_image_source;
|
|
65
|
+
}
|
|
49
66
|
const capture = await this.capture(check,this.evidence,signal);
|
|
50
67
|
if (capture.archive_sha256 !== source.archive_sha256 || !Number.isInteger(capture.playtest_seconds) || capture.playtest_seconds < 30 ||
|
|
51
68
|
!Array.isArray(capture.screenshots) || capture.screenshots.length < 1 || capture.screenshots.length > 5 ||
|
|
52
|
-
!Array.isArray(capture.audit_screenshots) || capture.audit_screenshots.length < 3 || capture.audit_screenshots.length > 30) throw new Error('
|
|
69
|
+
!Array.isArray(capture.audit_screenshots) || capture.audit_screenshots.length < 3 || capture.audit_screenshots.length > 30) throw new Error('试玩采集结果不完整,或与已上传的验收版本不一致。');
|
|
53
70
|
const id = randomUUID(), directory = path.join(this.store.directory,id);
|
|
54
71
|
await mkdir(directory,{ mode:0o700 });
|
|
55
72
|
const images = [];
|
|
56
73
|
if (stagedCover) images.push(await copyMaterial(stagedCover.directory,stagedCover.file,directory,'cover','cover',stagedCover));
|
|
57
74
|
else if (materials.cover_path) images.push(await copyMaterial(project,materials.cover_path,directory,'cover','cover'));
|
|
75
|
+
else if (reusedCover) images.push(await writeMaterial(directory,'cover','cover',reusedCover));
|
|
58
76
|
else {
|
|
59
77
|
const file = capture.screenshots[0];
|
|
60
78
|
images.push(await copyMaterial(path.dirname(file),path.basename(file),directory,'cover','cover',capture.screenshot_files?.[0]));
|
|
@@ -65,7 +83,7 @@ export class Publications {
|
|
|
65
83
|
signal.throwIfAborted();
|
|
66
84
|
// Capture paths are produced inside the private evidence directory by our browser worker.
|
|
67
85
|
const relative = path.relative(this.evidence,file);
|
|
68
|
-
if (relative === '..' || relative.startsWith('..' + path.sep) || path.isAbsolute(relative)) throw new Error('
|
|
86
|
+
if (relative === '..' || relative.startsWith('..' + path.sep) || path.isAbsolute(relative)) throw new Error('截图文件不在本次验收的采集目录内。');
|
|
69
87
|
const source = await readMaterial(path.dirname(file),path.basename(file),metadata?.[index]);
|
|
70
88
|
if (purpose === 'screenshot' && seen.has(source.sha256)) continue;
|
|
71
89
|
seen.add(source.sha256);
|
|
@@ -74,7 +92,7 @@ export class Publications {
|
|
|
74
92
|
}
|
|
75
93
|
delete materials.cover_path;
|
|
76
94
|
signal.throwIfAborted();
|
|
77
|
-
if (this.platform.account().user_id !== owner) throw new Error('Craft
|
|
95
|
+
if (this.platform.account().user_id !== owner) throw new Error('Craft 登录账号已变更。请回到 WorkBuddy 重新打开发布页。');
|
|
78
96
|
const record = await this.store.create({ request_id:id,name:check.name,owner,platform:this.platform.base,engine:check.result.engine,
|
|
79
97
|
check_task_id:check.task_id,conversation_id:source.conversation_id,version_id:source.version_id,
|
|
80
98
|
external_manifest_sha256:source.external_manifest_sha256,archive_sha256:source.archive_sha256,
|
|
@@ -92,25 +110,25 @@ export class Publications {
|
|
|
92
110
|
}
|
|
93
111
|
record.reviewed_revision = record.revision;
|
|
94
112
|
await this.store.save(record);
|
|
95
|
-
if (this.platform.account().user_id !== owner) throw new Error('Craft
|
|
113
|
+
if (this.platform.account().user_id !== owner) throw new Error('审阅材料时 Craft 登录账号已变更。请回到 WorkBuddy 重新打开发布页。');
|
|
96
114
|
return { content:[{ type:'text',text:JSON.stringify({ ...view(record),review:'Show these final materials to the user. Confirm the exact revision, game version, public image uploads and open_to_recreate choice before submitting to ACE.' }) },...content] };
|
|
97
115
|
}
|
|
98
116
|
|
|
99
117
|
async #status(record, request, signal) {
|
|
100
118
|
const remote = await request('status',{ version_id:record.version_id },signal);
|
|
101
119
|
if (remote.state !== 'not_submitted' && (remote.version_id !== record.version_id || remote.conversation_id !== record.conversation_id ||
|
|
102
|
-
remote.external_manifest_sha256 !== record.external_manifest_sha256)) throw new Error('
|
|
120
|
+
remote.external_manifest_sha256 !== record.external_manifest_sha256)) throw new Error('平台返回的发布状态与当前项目或构建校验值不一致。');
|
|
103
121
|
return remote;
|
|
104
122
|
}
|
|
105
123
|
|
|
106
124
|
async submit(name, id, revision, confirmed, owner, signal) {
|
|
107
125
|
const record = await this.#record(name,id,owner);
|
|
108
|
-
if (confirmed !== true || revision !== record.revision || record.reviewed_revision !== revision) throw new Error('
|
|
126
|
+
if (confirmed !== true || revision !== record.revision || record.reviewed_revision !== revision) throw new Error('提交前请审阅发布图片,并确认当前这份材料。');
|
|
109
127
|
const request = this.platform.publicationSession(owner);
|
|
110
128
|
const previous = await this.#status(record,request,signal);
|
|
111
129
|
if (previous.client_request_id === record.request_id && previous.state !== 'external_draft') {
|
|
112
130
|
if (!previous.finalization_retry_required) return view(record,previous);
|
|
113
|
-
if (!record.share_input) throw new Error('
|
|
131
|
+
if (!record.share_input) throw new Error('缺少原始提交材料,暂时无法重试发布收尾。请回到 WorkBuddy 查看原发布记录。');
|
|
114
132
|
await request('submit',{ input:record.share_input },signal);
|
|
115
133
|
record.state = 'submitted';
|
|
116
134
|
await this.store.save(record);
|
|
@@ -123,7 +141,7 @@ export class Publications {
|
|
|
123
141
|
const receipt = await request('image',{ image:data,purpose:image.purpose,conversation_id:record.conversation_id,
|
|
124
142
|
version_id:record.version_id,external_manifest_sha256:record.external_manifest_sha256 },signal);
|
|
125
143
|
if (receipt.sha256 !== image.sha256 || receipt.bytes !== image.bytes ||
|
|
126
|
-
(record.image_receipts[image.file] && record.image_receipts[image.file].cover_url !== receipt.cover_url)) throw new Error('
|
|
144
|
+
(record.image_receipts[image.file] && record.image_receipts[image.file].cover_url !== receipt.cover_url)) throw new Error('平台返回的图片回执与已确认材料不一致。请先刷新进度。');
|
|
127
145
|
record.image_receipts[image.file] = receipt;
|
|
128
146
|
await this.store.save(record);
|
|
129
147
|
}
|
|
@@ -131,7 +149,7 @@ export class Publications {
|
|
|
131
149
|
const input = { client_request_id:record.request_id,conversation_id:record.conversation_id,version_id:record.version_id,
|
|
132
150
|
external_manifest_sha256:record.external_manifest_sha256,...record.materials,
|
|
133
151
|
cover_image_url:urls('cover')[0],screenshots:urls('screenshot'),audit_screenshot_urls:urls('audit-shot'),playtest_seconds:record.playtest_seconds };
|
|
134
|
-
if (record.share_input && JSON.stringify(record.share_input) !== JSON.stringify(input)) throw new Error('
|
|
152
|
+
if (record.share_input && JSON.stringify(record.share_input) !== JSON.stringify(input)) throw new Error('提交材料在确认后发生变化。请回到 WorkBuddy 查看原发布记录。');
|
|
135
153
|
record.share_input = input; record.state = 'submitting';
|
|
136
154
|
await this.store.save(record);
|
|
137
155
|
await request('submit',{ input },signal);
|
|
@@ -11,6 +11,11 @@ import { validateSteps } from './check.mjs';
|
|
|
11
11
|
const environmentKeys = new Set(['PATH','HOME','USERPROFILE','APPDATA','LOCALAPPDATA','SYSTEMROOT','WINDIR',
|
|
12
12
|
'COMSPEC','TEMP','TMP','TMPDIR','XDG_CACHE_HOME','NODE_PATH','PLAYWRIGHT_PACKAGE_ROOT',
|
|
13
13
|
'PLAYWRIGHT_BROWSERS_PATH','CRAFT_BROWSER_EXECUTABLE','CRAFT_RUNTIME_POLICY']);
|
|
14
|
+
const captureReasons = new Set([
|
|
15
|
+
'加载层未在采集期限内收起,首屏可能仍是进度条',
|
|
16
|
+
'截图时仍有资源请求未完成,加载相关画面未验证',
|
|
17
|
+
'字体或界面过渡未在采集期限内完成',
|
|
18
|
+
]);
|
|
14
19
|
|
|
15
20
|
// The SDK browser preparer merges the parent environment. Undefined overrides
|
|
16
21
|
// deliberately erase every other inherited key, including unknown credentials.
|
|
@@ -19,56 +24,87 @@ export function publishCaptureEnvironment(source = process.env) {
|
|
|
19
24
|
}
|
|
20
25
|
|
|
21
26
|
async function ordinaryJson(file, maximum = 256 * 1024) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
try {
|
|
28
|
+
const stat = await lstat(file);
|
|
29
|
+
if (!stat.isFile() || stat.isSymbolicLink() || stat.size > maximum) throw new Error('发布采集记录格式无效。');
|
|
30
|
+
return JSON.parse(await readFile(file,'utf8'));
|
|
31
|
+
} catch (cause) {
|
|
32
|
+
throw new Error('无法读取发布采集记录。',{ cause });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async function captureFailure(directory, timedOut) {
|
|
37
|
+
if (timedOut) return '发布试玩采集超时。';
|
|
38
|
+
// The private capture record may also include browser errors and game data.
|
|
39
|
+
// Only share the exact built-in reasons, never raw worker output.
|
|
40
|
+
const capture = await ordinaryJson(path.join(directory,'capture.json')).catch(()=>undefined);
|
|
41
|
+
const reasons = Array.isArray(capture?.unverified) ? [...new Set(capture.unverified.filter(reason=>captureReasons.has(reason)))] : [];
|
|
42
|
+
if (reasons.length) return '发布试玩采集未通过。' + reasons.join(';') + '。';
|
|
43
|
+
if (Array.isArray(capture?.errors) && capture.errors.length) return '发布试玩时游戏出现运行错误,请回到 WorkBuddy 检查游戏运行情况。';
|
|
44
|
+
return '未能完成发布试玩采集,请确认游戏可以正常运行。';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async function captureArchive(evidence, result, signal) {
|
|
48
|
+
try { return await checkedDraftArchive(evidence,result.snapshot_id,result.artifacts,signal); }
|
|
49
|
+
catch (cause) {
|
|
50
|
+
signal.throwIfAborted();
|
|
51
|
+
throw new Error('验收产物已变更或无法读取,请回到 WorkBuddy 重新验收游戏。',{ cause });
|
|
52
|
+
}
|
|
25
53
|
}
|
|
26
54
|
|
|
27
55
|
async function checkedImage(image, directory) {
|
|
28
56
|
if (!image || typeof image.path !== 'string' || path.dirname(image.path) !== directory ||
|
|
29
|
-
!/^shot-[0-8]\.jpg$/.test(path.basename(image.path))) throw new Error('
|
|
57
|
+
!/^shot-[0-8]\.jpg$/.test(path.basename(image.path))) throw new Error('发布截图记录无效。');
|
|
30
58
|
const stat = await lstat(image.path);
|
|
31
|
-
if (!stat.isFile() || stat.isSymbolicLink() || stat.size < 4 || stat.size > 2 * 1024 * 1024) throw new Error('
|
|
59
|
+
if (!stat.isFile() || stat.isSymbolicLink() || stat.size < 4 || stat.size > 2 * 1024 * 1024) throw new Error('发布截图无效或超过 2 MiB。');
|
|
32
60
|
const data = await readFile(image.path);
|
|
33
61
|
if (data[0] !== 0xff || data[1] !== 0xd8 || data[2] !== 0xff ||
|
|
34
|
-
data.length !== image.bytes || createHash('sha256').update(data).digest('hex') !== image.sha256) throw new Error('
|
|
62
|
+
data.length !== image.bytes || createHash('sha256').update(data).digest('hex') !== image.sha256) throw new Error('发布截图已变更,请重新采集。');
|
|
35
63
|
}
|
|
36
64
|
|
|
37
65
|
export async function capturePublishMaterial(check, evidence, signal) {
|
|
38
66
|
signal.throwIfAborted();
|
|
39
67
|
const result = check?.result;
|
|
40
68
|
if (check?.kind !== 'check' || check.status !== 'completed' || !result?.gate?.passed ||
|
|
41
|
-
!/^[0-9a-f-]{36}$/.test(check.task_id)) throw new Error('
|
|
42
|
-
engineDefinition(result.engine);
|
|
43
|
-
|
|
69
|
+
!/^[0-9a-f-]{36}$/.test(check.task_id)) throw new Error('采集发布截图前,请回到 WorkBuddy 完成游戏验收。');
|
|
70
|
+
try { engineDefinition(result.engine); }
|
|
71
|
+
catch (cause) { throw new Error('验收结果中的游戏引擎无效,请回到 WorkBuddy 重新验收游戏。',{ cause }); }
|
|
72
|
+
const archive = await captureArchive(evidence,result,signal);
|
|
44
73
|
const evidenceRoot = await realpath(evidence), snapshot = path.join(evidenceRoot,result.snapshot_id);
|
|
45
74
|
const original = await ordinaryJson(path.join(snapshot,'request.json'));
|
|
46
|
-
if (original.engine !== result.engine) throw new Error('
|
|
47
|
-
validateSteps(original.steps);
|
|
75
|
+
if (original.engine !== result.engine) throw new Error('发布采集与验收结果的游戏引擎不一致,请回到 WorkBuddy 重新验收游戏。');
|
|
76
|
+
try { validateSteps(original.steps); }
|
|
77
|
+
catch (cause) { throw new Error('验收结果中的试玩步骤无效,请回到 WorkBuddy 重新验收游戏。',{ cause }); }
|
|
48
78
|
const directory = path.join(snapshot,'publish-' + randomUUID());
|
|
49
79
|
await mkdir(directory,{ mode:0o700 });
|
|
50
80
|
const requestFile = path.join(directory,'request.json');
|
|
51
81
|
await atomicJson(requestFile,{ check_task_id:check.task_id, snapshot_id:result.snapshot_id, engine:result.engine,
|
|
52
82
|
evidence:evidenceRoot, artifacts:result.artifacts, archive_sha256:archive.sha256, steps:original.steps });
|
|
53
|
-
const safe = publishCaptureEnvironment();
|
|
54
|
-
const browser = await prepareBrowserEnvironment({ cwd:snapshot,env:safe,signal });
|
|
55
|
-
const env = Object.fromEntries(Object.entries({ ...safe,...browser }).filter(([,value])=>value !== undefined));
|
|
56
83
|
const resources = process.env.CRAFT_MCP_RESOURCES_DIR || fileURLToPath(new URL('../../resources/',import.meta.url));
|
|
57
84
|
const runner = path.join(resources,'game_visual_qa.mjs');
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
85
|
+
let run;
|
|
86
|
+
try {
|
|
87
|
+
const safe = publishCaptureEnvironment();
|
|
88
|
+
const browser = await prepareBrowserEnvironment({ cwd:snapshot,env:safe,signal });
|
|
89
|
+
const env = Object.fromEntries(Object.entries({ ...safe,...browser }).filter(([,value])=>value !== undefined));
|
|
90
|
+
run = await runProcess(process.execPath,[fileURLToPath(new URL('./publish-capture-worker.mjs',import.meta.url)),runner,requestFile],{
|
|
91
|
+
cwd:snapshot,env,signal,timeoutMs:200000,
|
|
92
|
+
});
|
|
93
|
+
} catch (cause) {
|
|
94
|
+
signal.throwIfAborted();
|
|
95
|
+
throw new Error('无法启动发布试玩采集,请确认本机浏览器可以正常使用。',{ cause });
|
|
96
|
+
}
|
|
61
97
|
signal.throwIfAborted();
|
|
62
|
-
if (run.exitCode !== 0 || run.timedOut || run.aborted) throw new Error(
|
|
98
|
+
if (run.exitCode !== 0 || run.timedOut || run.aborted) throw new Error(await captureFailure(directory,run.timedOut));
|
|
63
99
|
const receipt = await ordinaryJson(path.join(directory,'receipt.json'));
|
|
64
100
|
if (receipt.check_task_id !== check.task_id || receipt.snapshot_id !== result.snapshot_id ||
|
|
65
101
|
receipt.engine !== result.engine || receipt.archive_sha256 !== archive.sha256 ||
|
|
66
102
|
!Number.isFinite(receipt.playtest_seconds) || receipt.playtest_seconds < 30 ||
|
|
67
103
|
!Array.isArray(receipt.screenshots) || receipt.screenshots.length !== 4 ||
|
|
68
|
-
!Array.isArray(receipt.audit_screenshots) || receipt.audit_screenshots.length !== 9) throw new Error('
|
|
104
|
+
!Array.isArray(receipt.audit_screenshots) || receipt.audit_screenshots.length !== 9) throw new Error('发布试玩采集结果不完整。');
|
|
69
105
|
for (const image of [...receipt.screenshots,...receipt.audit_screenshots]) await checkedImage(image,directory);
|
|
70
|
-
const after = await
|
|
71
|
-
if (after.sha256 !== archive.sha256) throw new Error('
|
|
106
|
+
const after = await captureArchive(evidenceRoot,result,signal);
|
|
107
|
+
if (after.sha256 !== archive.sha256) throw new Error('采集期间验收产物已变更,请回到 WorkBuddy 重新验收游戏。');
|
|
72
108
|
return { ...receipt, screenshot_files:receipt.screenshots,audit_screenshot_files:receipt.audit_screenshots,
|
|
73
109
|
screenshots:receipt.screenshots.map(image=>image.path),audit_screenshots:receipt.audit_screenshots.map(image=>image.path),
|
|
74
110
|
receipt_path:path.join(directory,'receipt.json') };
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
<body>
|
|
25
25
|
<main>
|
|
26
26
|
<header class="topline">
|
|
27
|
-
<div><h1>发布到 Craft</h1><p class="intro">先在本机准备和审阅材料,确认后再公开上传图片并提交审核。</p></div>
|
|
27
|
+
<div><h1 id="page-title">发布到 Craft</h1><p class="intro">先在本机准备和审阅材料,确认后再公开上传图片并提交审核。</p></div>
|
|
28
28
|
<button id="refresh" type="button" class="secondary">刷新进度</button>
|
|
29
29
|
</header>
|
|
30
30
|
<ol class="steps" aria-label="发布步骤">
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
<h2 id="context-title">当前游戏</h2><dl id="context" class="context"></dl><span id="status" class="state">尚未准备发布材料</span>
|
|
39
39
|
</section>
|
|
40
40
|
<section class="card" aria-labelledby="form-title">
|
|
41
|
-
<h2 id="form-title">发布资料</h2><p class="section-intro">修改文案或封面后,需要重新准备并确认材料。关闭页面不会自动提交。</p>
|
|
41
|
+
<h2 id="form-title">发布资料</h2><p id="form-intro" class="section-intro">修改文案或封面后,需要重新准备并确认材料。关闭页面不会自动提交。</p>
|
|
42
42
|
<form id="materials-form">
|
|
43
43
|
<fieldset id="materials-fields" disabled>
|
|
44
44
|
<label class="field" for="game-name"><span>游戏名称</span><input id="game-name" type="text" maxlength="40" required autocomplete="off"><small>最多 40 个字符</small></label>
|
|
@@ -46,7 +46,8 @@
|
|
|
46
46
|
<label class="field" for="game-type"><span>游戏分类</span><select id="game-type" required><option value="">请选择分类</option></select></label>
|
|
47
47
|
<fieldset class="tag-group"><legend>美术风格 <small>可不选,最多 12 项</small></legend><div id="art-styles" class="tags"></div></fieldset>
|
|
48
48
|
<fieldset class="tag-group"><legend>玩法标签 <small>可不选,最多 12 项</small></legend><div id="play-tags" class="tags"></div></fieldset>
|
|
49
|
-
<label class="field" for="cover-file"><span>封面图片(可选)</span><input id="cover-file" type="file" accept="image/png,image/jpeg"><small>PNG / JPEG,最大 2 MiB。留空使用本次试玩截图;选图只在本机预览。</small></label>
|
|
49
|
+
<label class="field" for="cover-file"><span>封面图片(可选)</span><input id="cover-file" type="file" accept="image/png,image/jpeg"><small id="cover-help">PNG / JPEG,最大 2 MiB。留空使用本次试玩截图;选图只在本机预览。</small></label>
|
|
50
|
+
<div id="previous-cover" hidden><label class="field" for="reuse-previous-cover"><input id="reuse-previous-cover" type="checkbox" checked> 沿用上次发布的封面<small>取消勾选且未选新图片时,使用本次试玩截图。</small></label></div>
|
|
50
51
|
<div id="cover-selection" hidden><img id="cover-preview" class="cover-preview" alt="本地封面预览"><div class="cover-actions"><small id="cover-name"></small><button id="clear-cover" type="button" class="quiet">移除封面</button></div></div>
|
|
51
52
|
<p class="privacy-note">此版本仅包含游戏成品,二创保持关闭。准备阶段不会公开上传封面或截图。</p>
|
|
52
53
|
<div class="actions"><button id="prepare" type="submit">准备发布材料</button></div>
|