tripo-cli 0.1.0 → 0.2.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.
Files changed (65) hide show
  1. package/README.md +20 -4
  2. package/dist/commands/completion.js +1 -1
  3. package/dist/commands/config-cmd.js +32 -17
  4. package/dist/commands/doctor.js +6 -5
  5. package/dist/commands/home.js +4 -2
  6. package/dist/commands/login.js +201 -39
  7. package/dist/config/config.js +103 -14
  8. package/dist/core/client.js +16 -2
  9. package/dist/core/device-auth.js +41 -9
  10. package/dist/program.js +21 -1
  11. package/package.json +2 -2
  12. package/skill/SKILL.md +13 -1
  13. package/skill/commands/account.md +19 -5
  14. package/dist/src/ai/experts.js +0 -115
  15. package/dist/src/ai/llm.js +0 -88
  16. package/dist/src/ai/plan-card.js +0 -79
  17. package/dist/src/ai/wizard.js +0 -104
  18. package/dist/src/cli.js +0 -7
  19. package/dist/src/commands/account.js +0 -27
  20. package/dist/src/commands/ai.js +0 -113
  21. package/dist/src/commands/batch.js +0 -148
  22. package/dist/src/commands/completion.js +0 -84
  23. package/dist/src/commands/config-cmd.js +0 -84
  24. package/dist/src/commands/docs.js +0 -30
  25. package/dist/src/commands/doctor.js +0 -94
  26. package/dist/src/commands/generate.js +0 -81
  27. package/dist/src/commands/home.js +0 -68
  28. package/dist/src/commands/login.js +0 -225
  29. package/dist/src/commands/make.js +0 -142
  30. package/dist/src/commands/mcp.js +0 -194
  31. package/dist/src/commands/process-groups.js +0 -164
  32. package/dist/src/commands/shared.js +0 -75
  33. package/dist/src/commands/task.js +0 -127
  34. package/dist/src/commands/topup.js +0 -61
  35. package/dist/src/commands/view.js +0 -97
  36. package/dist/src/config/config.js +0 -79
  37. package/dist/src/config/context.js +0 -44
  38. package/dist/src/config/history.js +0 -104
  39. package/dist/src/core/client.js +0 -120
  40. package/dist/src/core/download.js +0 -107
  41. package/dist/src/core/errors.js +0 -64
  42. package/dist/src/core/output.js +0 -72
  43. package/dist/src/core/requests.js +0 -169
  44. package/dist/src/core/task-service.js +0 -161
  45. package/dist/src/core/upload.js +0 -36
  46. package/dist/src/core/viewer-assets.js +0 -24
  47. package/dist/src/core/viewer.js +0 -59
  48. package/dist/src/core/watch.js +0 -41
  49. package/dist/src/i18n.js +0 -19
  50. package/dist/src/knowledge/chains.js +0 -152
  51. package/dist/src/knowledge/error-catalog.js +0 -91
  52. package/dist/src/knowledge/models.js +0 -110
  53. package/dist/src/knowledge/params.js +0 -174
  54. package/dist/src/knowledge/scenarios.js +0 -112
  55. package/dist/src/pipeline/make.js +0 -233
  56. package/dist/src/pipeline/runner.js +0 -73
  57. package/dist/src/pipeline/stdin.js +0 -40
  58. package/dist/src/program.js +0 -147
  59. package/dist/src/types.js +0 -2
  60. package/dist/src/util/input-detect.js +0 -92
  61. package/dist/src/util/notify.js +0 -17
  62. package/dist/src/util/open.js +0 -18
  63. package/dist/src/util/spinner.js +0 -62
  64. package/dist/src/util/term-image.js +0 -28
  65. package/dist/src/version.js +0 -10
@@ -1,91 +0,0 @@
1
- /**
2
- * V3 error-code catalog: human translations (zh/en), retryability, and the
3
- * CLI exit code each error maps to.
4
- *
5
- * Source of truth: backend ErrorCode enum (platform-common .../error/ErrorCode.java,
6
- * itself aligned with openapi-server errors.gen.go). Note the public docs page
7
- * is stale for 1000/1001 — the server actually sends 1002 for auth failures;
8
- * 1000/1001 are 5xx server-side errors.
9
- */
10
- export const EXIT = {
11
- OK: 0,
12
- FATAL: 1,
13
- USAGE: 2,
14
- AUTH: 3,
15
- BALANCE: 4,
16
- CONTENT_POLICY: 5,
17
- TASK_FAILED: 6,
18
- NETWORK: 7,
19
- NOT_FOUND: 8,
20
- RATE_LIMIT: 9,
21
- };
22
- export const ERROR_CATALOG = [
23
- { code: 1000, zh: '服务端未知错误,请携带 request_id 联系支持', en: 'Unknown server-side error; contact support with the request id', retryable: true, exitCode: EXIT.NETWORK },
24
- { code: 1001, zh: '服务端严重错误,请携带 request_id 联系支持', en: 'Fatal server-side error; contact support with the request id', retryable: false, exitCode: EXIT.NETWORK },
25
- { code: 1002, zh: '认证失败:API Key 无效或未正确设置', en: 'Authentication failed: the API key is invalid or not set correctly', retryable: false, exitCode: EXIT.AUTH },
26
- { code: 1003, zh: '请求体格式不合法', en: 'The request body is malformed', retryable: false, exitCode: EXIT.USAGE },
27
- { code: 1004, zh: '一个或多个参数不合法,请对照文档检查', en: 'One or more parameters are invalid (check the docs)', retryable: false, exitCode: EXIT.USAGE },
28
- { code: 1005, zh: '无权访问该资源,请检查账号权限', en: 'Not allowed to access this resource (check permissions)', retryable: false, exitCode: EXIT.AUTH },
29
- { code: 1007, zh: '请求过于频繁,触发全局速率限制', en: 'Rate limit exceeded — too many requests in a short time', retryable: true, exitCode: EXIT.RATE_LIMIT },
30
- { code: 2000, zh: '触发生成并发上限,同系列任务共享并发池', en: 'Generation concurrency limit hit (task families share a pool)', retryable: true, exitCode: EXIT.RATE_LIMIT },
31
- { code: 2001, zh: '任务不存在(确认任务属于当前 Key、区域正确)', en: 'Task not found (same key that created it? right region?)', retryable: false, exitCode: EXIT.NOT_FOUND },
32
- { code: 2002, zh: '该任务类型不受支持', en: 'This task type is not supported', retryable: false, exitCode: EXIT.USAGE },
33
- { code: 2003, zh: '输入图片文件为空,请检查文件是否损坏', en: 'The image file is empty (corrupted upload?)', retryable: false, exitCode: EXIT.USAGE },
34
- { code: 2004, zh: '不支持的图片文件类型', en: 'Unsupported image file type', retryable: false, exitCode: EXIT.USAGE },
35
- { code: 2005, zh: 'draft 任务不是成功状态,请用成功的任务重试', en: 'The draft task is not a success; retry with a successful one', retryable: false, exitCode: EXIT.USAGE },
36
- { code: 2006, zh: '上游任务类型不受支持,请检查任务链', en: 'The original task type is not supported for this operation', retryable: false, exitCode: EXIT.USAGE },
37
- { code: 2007, zh: '上游任务不是成功状态', en: 'The original task has not succeeded', retryable: false, exitCode: EXIT.USAGE },
38
- { code: 2008, zh: '输入违反内容政策,请更换输入', en: 'Input violates the content policy; change the input', retryable: false, exitCode: EXIT.CONTENT_POLICY },
39
- { code: 2009, zh: 'prompt 含有非法字符,请修改后重试', en: 'The prompt contains invalid characters', retryable: false, exitCode: EXIT.USAGE },
40
- { code: 2010, zh: '积分不足', en: 'Insufficient credits', retryable: false, exitCode: EXIT.BALANCE },
41
- { code: 2011, zh: 'rig-check 的输入任务没有模型产物', en: 'The rig-check input task has no model output', retryable: false, exitCode: EXIT.USAGE },
42
- { code: 2012, zh: 'retarget 只接受 rig 任务作为输入', en: 'retarget only accepts a rig task as input', retryable: false, exitCode: EXIT.USAGE },
43
- { code: 2013, zh: 'priority 取值无效(更高优先级需联系支持)', en: 'Invalid priority (contact support for higher priority)', retryable: false, exitCode: EXIT.USAGE },
44
- { code: 2014, zh: '内容审核过程出错,请联系支持', en: 'Error occurred during content auditing; contact support', retryable: false, exitCode: EXIT.FATAL },
45
- { code: 2015, zh: '模型版本已弃用,请升级 model 参数', en: 'Model version deprecated; upgrade the model parameter', retryable: false, exitCode: EXIT.USAGE },
46
- { code: 2016, zh: '该请求类型已弃用,请改用其他类型', en: 'This request type is deprecated; use an alternative', retryable: false, exitCode: EXIT.USAGE },
47
- { code: 2017, zh: 'model 版本取值无效', en: 'The model version value is invalid', retryable: false, exitCode: EXIT.USAGE },
48
- { code: 2018, zh: '模型太复杂无法重网格化,降低 face_limit 或简化输入', en: 'Model too complex to remesh; lower face_limit or simplify input', retryable: false, exitCode: EXIT.USAGE },
49
- { code: 2019, zh: '文件不存在,请确认上传是否成功、file_token 是否过期', en: 'File not found (upload succeeded? token expired?)', retryable: false, exitCode: EXIT.NOT_FOUND },
50
- { code: 2020, zh: '图片 URL 无效,请确认可公开访问', en: 'The image URL is invalid (must be publicly reachable)', retryable: false, exitCode: EXIT.USAGE },
51
- { code: 2021, zh: '文件大小超过上限,请压缩后重试', en: 'File size exceeds the limit; reduce and retry', retryable: false, exitCode: EXIT.USAGE },
52
- { code: 2022, zh: '图片尺寸超过上限,请缩小后重试', en: 'Image size exceeds the limit; reduce and retry', retryable: false, exitCode: EXIT.USAGE },
53
- { code: 4001, zh: '请求的接口不存在,请检查 API 路径', en: 'The requested endpoint does not exist (check the API path)', retryable: false, exitCode: EXIT.NOT_FOUND },
54
- ];
55
- const byCode = new Map(ERROR_CATALOG.map((e) => [e.code, e]));
56
- export function lookupError(code) {
57
- return byCode.get(code);
58
- }
59
- /** Map an API error code + HTTP status to a stable CLI exit code. */
60
- export function exitCodeFor(apiCode, httpStatus) {
61
- if (apiCode !== undefined) {
62
- const info = byCode.get(apiCode);
63
- if (info)
64
- return info.exitCode;
65
- }
66
- if (httpStatus === 401)
67
- return EXIT.AUTH;
68
- if (httpStatus === 403)
69
- return EXIT.AUTH;
70
- if (httpStatus === 404)
71
- return EXIT.NOT_FOUND;
72
- if (httpStatus === 429)
73
- return EXIT.RATE_LIMIT;
74
- if (httpStatus !== undefined && httpStatus >= 500)
75
- return EXIT.NETWORK;
76
- if (httpStatus !== undefined && httpStatus >= 400)
77
- return EXIT.USAGE;
78
- return EXIT.FATAL;
79
- }
80
- export function isRetryable(apiCode, httpStatus) {
81
- if (apiCode !== undefined) {
82
- const info = byCode.get(apiCode);
83
- if (info)
84
- return info.retryable;
85
- }
86
- if (httpStatus === 429)
87
- return true;
88
- if (httpStatus !== undefined && httpStatus >= 500)
89
- return true;
90
- return false;
91
- }
@@ -1,110 +0,0 @@
1
- /**
2
- * Dual-model strategy — the single source of truth for 3D model selection.
3
- *
4
- * Rule (one branch, no exceptions): explicit low-poly intent or a face budget
5
- * <= 20000 selects P1; everything else selects v3.1. Explicit --model wins but
6
- * still goes through constraint validation.
7
- */
8
- export const MODEL_V31 = 'tripo-v3.1';
9
- export const MODEL_P1 = 'tripo-p1';
10
- /** Wire aliases accepted by the API for the two production models. */
11
- export const MODEL_ALIASES = {
12
- 'v3.1': MODEL_V31,
13
- 'v3.1-20260211': MODEL_V31,
14
- 'tripo-v3.1': MODEL_V31,
15
- p1: MODEL_P1,
16
- P1: MODEL_P1,
17
- 'P1-20260311': MODEL_P1,
18
- 'tripo-p1': MODEL_P1,
19
- };
20
- /** Other versions the API accepts; the CLI passes them through when explicit. */
21
- export const LEGACY_3D_MODELS = ['tripo-turbo', 'tripo-v3.0', 'tripo-v2.5', 'tripo-v2.0'];
22
- export const P1_FACE_LIMIT = { min: 48, max: 20000 };
23
- /** Parameters the server rejects for P1 — stripped locally with a warning. */
24
- export const P1_FORBIDDEN_PARAMS = [
25
- 'quad',
26
- 'smart_low_poly',
27
- 'generate_parts',
28
- 'geometry_quality',
29
- ];
30
- /** Default versions for non-generation capabilities. */
31
- export const CAPABILITY_DEFAULTS = {
32
- texture: 'v3.0-20250812',
33
- /** Server default is rig-v1.0 (biped-only presets); the CLI defaults to
34
- * rig-v2.0 which has presets for all seven body types. */
35
- rig: 'rig-v2.0',
36
- segment: 'v1.0-20250506',
37
- textToImage: 'seedream_v4',
38
- imageToImage: 'seedream_v5',
39
- };
40
- export const RIG_TYPES = [
41
- 'biped',
42
- 'quadruped',
43
- 'hexapod',
44
- 'octopod',
45
- 'avian',
46
- 'serpentine',
47
- 'aquatic',
48
- ];
49
- export const RIG_SPECS = ['tripo', 'mixamo'];
50
- export const IMAGE_MODELS = [
51
- 'seedream_v4',
52
- 'seedream_v5',
53
- 'banana',
54
- 'banana_pro',
55
- 'banana2',
56
- 'chat_image_1',
57
- 'chat_image_1.5',
58
- 'chat_image_2',
59
- ];
60
- export const IMAGE_TEMPLATES = [
61
- 'asset_extraction',
62
- 'character_completion',
63
- 't_pose',
64
- 'head_extraction',
65
- '3d_enhance',
66
- 'variants',
67
- 'print_clay',
68
- 'figure',
69
- ];
70
- export const CONVERT_FORMATS = ['GLTF', 'USDZ', 'FBX', 'OBJ', 'STL', '3MF'];
71
- export const TEXTURE_FORMATS = [
72
- 'BMP',
73
- 'DPX',
74
- 'HDR',
75
- 'JPEG',
76
- 'OPEN_EXR',
77
- 'PNG',
78
- 'TARGA',
79
- 'TIFF',
80
- 'WEBP',
81
- ];
82
- export const FBX_PRESETS = ['blender', '3dsmax', 'mixamo'];
83
- export const EXPORT_ORIENTATIONS = ['+x', '-x', '+y', '-y'];
84
- export const STYLIZE_STYLES = ['lego', 'voxel', 'voronoi', 'minecraft'];
85
- export const TEXTURE_QUALITIES = ['standard', 'detailed', 'extreme'];
86
- /** Normalize any accepted alias to the canonical wire value; unknown values pass through. */
87
- export function normalizeModel(input) {
88
- return MODEL_ALIASES[input] ?? input;
89
- }
90
- export function isP1(model) {
91
- return normalizeModel(model) === MODEL_P1;
92
- }
93
- /** The one rule. Returns the model plus a human-readable reason. */
94
- export function chooseModel(intent) {
95
- if (intent.explicit) {
96
- return { model: normalizeModel(intent.explicit), reason: 'explicit --model' };
97
- }
98
- if (intent.lowPoly) {
99
- return { model: MODEL_P1, reason: 'low-poly intent → P1' };
100
- }
101
- if (intent.faceLimit !== undefined && intent.faceLimit <= P1_FACE_LIMIT.max) {
102
- return { model: MODEL_P1, reason: `face budget ${intent.faceLimit} ≤ ${P1_FACE_LIMIT.max} → P1` };
103
- }
104
- return { model: MODEL_V31, reason: 'default high-fidelity → v3.1' };
105
- }
106
- /** Keywords that signal low-poly intent in a prompt (used by make/ai). */
107
- const LOW_POLY_HINTS = [/low[\s_-]?poly/i, /低模/, /低面/, /手游/, /voxel/i, /像素风/];
108
- export function detectLowPolyIntent(text) {
109
- return LOW_POLY_HINTS.some((re) => re.test(text));
110
- }
@@ -1,174 +0,0 @@
1
- /**
2
- * Parameter linkage rules distilled from server-side validation
3
- * (TextImageModelValidation / ModelPostProcessValidation / handlers).
4
- *
5
- * Every rule here prevents a guaranteed 400 or a silently wasted credit.
6
- * Rules marked [hard] mirror server enforcement; [soft] are CLI smart defaults.
7
- */
8
- import { CONVERT_FORMATS, EXPORT_ORIENTATIONS, FBX_PRESETS, P1_FACE_LIMIT, P1_FORBIDDEN_PARAMS, TEXTURE_FORMATS, TEXTURE_QUALITIES, isP1, } from './models.js';
9
- const PROMPT_MAX = 1024;
10
- const NEGATIVE_PROMPT_MAX = 255;
11
- /** Validate + auto-fix parameters for 3D generation (text/image/multiview-to-model). */
12
- export function validateGenerationParams(model, input) {
13
- const params = { ...input };
14
- const warnings = [];
15
- const errors = [];
16
- if (typeof params.prompt === 'string' && params.prompt.length > PROMPT_MAX) {
17
- errors.push(`prompt exceeds ${PROMPT_MAX} characters (${params.prompt.length})`);
18
- }
19
- if (typeof params.negative_prompt === 'string' && params.negative_prompt.length > NEGATIVE_PROMPT_MAX) {
20
- errors.push(`negative_prompt exceeds ${NEGATIVE_PROMPT_MAX} characters`);
21
- }
22
- // [hard] pbr=true forces texture=true (PBR is a superset of texturing).
23
- if (params.pbr === true && params.texture === false) {
24
- params.texture = true;
25
- warnings.push('pbr=true forces texture=true (adjusted)');
26
- }
27
- // [hard] generate_parts outputs bare geometry: texture/pbr/quad must be off.
28
- if (params.generate_parts === true) {
29
- for (const key of ['texture', 'pbr', 'quad']) {
30
- if (params[key] === true) {
31
- params[key] = false;
32
- warnings.push(`generate_parts=true disables ${key} (adjusted; run "tripo model texture" afterwards)`);
33
- }
34
- }
35
- }
36
- // [hard] P1 constraints: strip forbidden params, enforce face_limit range.
37
- if (isP1(model)) {
38
- for (const key of P1_FORBIDDEN_PARAMS) {
39
- if (params[key] !== undefined) {
40
- delete params[key];
41
- warnings.push(`P1 does not support ${key} (removed)`);
42
- }
43
- }
44
- const face = params.face_limit;
45
- if (typeof face === 'number') {
46
- if (face < P1_FACE_LIMIT.min || face > P1_FACE_LIMIT.max) {
47
- errors.push(`P1 face_limit must be within ${P1_FACE_LIMIT.min}–${P1_FACE_LIMIT.max} (got ${face}); ` +
48
- `use tripo-v3.1 for higher budgets`);
49
- }
50
- }
51
- }
52
- else {
53
- // [hard] smart_low_poly face_limit windows: 500–20000 tri / 500–10000 quad.
54
- if (params.smart_low_poly === true && typeof params.face_limit === 'number') {
55
- const max = params.quad === true ? 10000 : 20000;
56
- if (params.face_limit < 500 || params.face_limit > max) {
57
- errors.push(`smart_low_poly requires face_limit 500–${max}${params.quad === true ? ' (quad halves the budget)' : ''}`);
58
- }
59
- }
60
- }
61
- if (params.texture_quality !== undefined &&
62
- !TEXTURE_QUALITIES.includes(params.texture_quality)) {
63
- errors.push(`texture_quality must be one of ${TEXTURE_QUALITIES.join('/')}`);
64
- }
65
- // [hard] quad topology cannot be stored in GLB → output will be FBX.
66
- if (params.quad === true) {
67
- warnings.push('quad=true forces FBX output (quad topology cannot be stored in GLB)');
68
- }
69
- return { params, warnings, errors };
70
- }
71
- /** Validate parameters for models/convert. */
72
- export function validateConvertParams(input) {
73
- const params = { ...input };
74
- const warnings = [];
75
- const errors = [];
76
- const format = typeof params.format === 'string' ? params.format.toUpperCase() : undefined;
77
- if (!format) {
78
- errors.push(`convert requires format (${CONVERT_FORMATS.join('/')})`);
79
- }
80
- else if (!CONVERT_FORMATS.includes(format)) {
81
- errors.push(`unsupported format "${params.format}" (${CONVERT_FORMATS.join('/')})`);
82
- }
83
- else {
84
- params.format = format;
85
- }
86
- // [hard] quad topology cannot live in GLTF/GLB.
87
- if (params.quad === true && format === 'GLTF') {
88
- errors.push('quad=true cannot export GLTF (quad topology is not storable in glTF); use FBX/OBJ/USDZ');
89
- }
90
- if (params.force_symmetry === true && params.quad !== true) {
91
- delete params.force_symmetry;
92
- warnings.push('force_symmetry only applies with quad=true (removed)');
93
- }
94
- if (params.texture_format !== undefined &&
95
- !TEXTURE_FORMATS.includes(String(params.texture_format).toUpperCase())) {
96
- errors.push(`texture_format must be one of ${TEXTURE_FORMATS.join('/')}`);
97
- }
98
- else if (typeof params.texture_format === 'string') {
99
- params.texture_format = params.texture_format.toUpperCase();
100
- }
101
- // [hard] vertex colors only survive in OBJ/GLTF exports.
102
- if (params.export_vertex_colors === true && format && !['OBJ', 'GLTF'].includes(format)) {
103
- delete params.export_vertex_colors;
104
- warnings.push(`export_vertex_colors only applies to OBJ/GLTF (removed for ${format})`);
105
- }
106
- if (params.fbx_preset !== undefined) {
107
- if (!FBX_PRESETS.includes(params.fbx_preset)) {
108
- errors.push(`fbx_preset must be one of ${FBX_PRESETS.join('/')}`);
109
- }
110
- else if (format !== 'FBX') {
111
- delete params.fbx_preset;
112
- warnings.push('fbx_preset only applies to FBX exports (removed)');
113
- }
114
- }
115
- if (params.export_orientation !== undefined &&
116
- !EXPORT_ORIENTATIONS.includes(params.export_orientation)) {
117
- errors.push(`export_orientation must be one of ${EXPORT_ORIENTATIONS.join('/')}`);
118
- }
119
- // [soft] cost transparency: any non-default option upgrades billing to
120
- // convert_model_complex.
121
- const defaults = {
122
- texture_size: 4096,
123
- texture_format: 'JPEG',
124
- bake: true,
125
- pack_uv: false,
126
- export_vertex_colors: false,
127
- pivot_to_center_bottom: false,
128
- scale_factor: 1,
129
- with_animation: true,
130
- animate_in_place: false,
131
- export_orientation: '+x',
132
- fbx_preset: 'blender',
133
- quad: false,
134
- flatten_bottom: false,
135
- force_symmetry: false,
136
- };
137
- const complex = Object.entries(defaults).some(([k, dv]) => params[k] !== undefined && params[k] !== dv) || params.face_limit !== undefined || params.part_names !== undefined;
138
- if (complex) {
139
- warnings.push('non-default convert options use the "complex convert" price tier');
140
- }
141
- return { params, warnings, errors };
142
- }
143
- /** Validate parameters for mesh/decimate. */
144
- export function validateDecimateParams(input) {
145
- const params = { ...input };
146
- const warnings = [];
147
- const errors = [];
148
- if (typeof params.face_limit === 'number' && (params.face_limit < 500 || params.face_limit > 20000)) {
149
- errors.push('decimate face_limit must be within 500–20000');
150
- }
151
- return { params, warnings, errors };
152
- }
153
- /** Validate retarget animations list. */
154
- export function validateRetargetParams(input) {
155
- const params = { ...input };
156
- const warnings = [];
157
- const errors = [];
158
- const anims = params.animations;
159
- if (Array.isArray(anims)) {
160
- if (anims.length === 0)
161
- errors.push('animations must not be empty');
162
- if (anims.length > 5)
163
- errors.push(`retarget accepts at most 5 animations per task (got ${anims.length}); billing is per animation`);
164
- if (anims.length === 1) {
165
- // Server accepts either `animation` (single) or `animations` (list).
166
- params.animation = anims[0];
167
- delete params.animations;
168
- }
169
- }
170
- else if (typeof params.animation !== 'string') {
171
- errors.push('retarget requires animation (single) or animations (list)');
172
- }
173
- return { params, warnings, errors };
174
- }
@@ -1,112 +0,0 @@
1
- /**
2
- * Scenario decision matrix: --for presets and the AI wizard both read this
3
- * table. Changing production strategy means editing data here, not logic.
4
- */
5
- import { MODEL_P1, MODEL_V31 } from './models.js';
6
- export const SCENARIOS = [
7
- {
8
- id: 'game-mobile',
9
- label: { zh: '手游/低模', en: 'Mobile game / low-poly' },
10
- description: { zh: '移动端游戏资产,面数预算严格,干净拓扑', en: 'Mobile game assets with strict face budgets and clean topology' },
11
- model: MODEL_P1,
12
- genParams: { texture: true, pbr: true, texture_quality: 'standard', face_limit: 15000 },
13
- chain: [{ step: 'convert', args: { format: 'FBX', texture_size: 2048 } }],
14
- deliverables: ['FBX', 'GLB'],
15
- notes: {
16
- zh: ['P1 原生低模,拓扑干净', '2K 贴图适配移动端', '需要骨骼时追加 --then rig'],
17
- en: ['P1 native low-poly with clean topology', '2K textures for mobile budgets', 'append --then rig if you need a skeleton'],
18
- },
19
- },
20
- {
21
- id: 'game-pc',
22
- label: { zh: '端游/主机', en: 'PC / console game' },
23
- description: { zh: '高预算引擎资产,PBR 全开', en: 'High-budget engine assets with full PBR' },
24
- model: MODEL_V31,
25
- genParams: { texture: true, pbr: true, texture_quality: 'detailed' },
26
- chain: [{ step: 'convert', args: { format: 'FBX' } }],
27
- deliverables: ['FBX', 'GLTF'],
28
- notes: {
29
- zh: ['v3.1 高精度 + detailed 贴图', '需要 LOD 时追加 --then decimate:5000', '进 Blender/3dsMax 用 fbx_preset 对齐'],
30
- en: ['v3.1 high fidelity + detailed textures', 'append --then decimate:5000 for LODs', 'use fbx_preset to match Blender/3dsMax'],
31
- },
32
- },
33
- {
34
- id: 'film',
35
- label: { zh: '影视/离线渲染', en: 'Film / offline rendering' },
36
- description: { zh: '细分友好四边面,规格拉满', en: 'Subdivision-friendly quads, maximum quality' },
37
- model: MODEL_V31,
38
- genParams: { texture: true, pbr: true, quad: true, geometry_quality: 'detailed', texture_quality: 'detailed' },
39
- chain: [],
40
- deliverables: ['FBX (quad)', 'USDZ/OBJ via convert'],
41
- notes: {
42
- zh: ['quad=true 输出 FBX(quad 进不了 GLB)', 'geometry detailed 加收 HD credit', '进 USD 管线追加 --then convert:usdz'],
43
- en: ['quad=true outputs FBX (quads cannot be stored in GLB)', 'geometry detailed bills an extra HD credit', 'append --then convert:usdz for USD pipelines'],
44
- },
45
- },
46
- {
47
- id: 'print',
48
- label: { zh: '3D 打印', en: '3D printing' },
49
- description: { zh: '水密可打印几何,免贴图省积分', en: 'Watertight printable geometry, skipping textures saves credits' },
50
- model: MODEL_V31,
51
- genParams: { texture: false, pbr: false },
52
- chain: [{ step: 'convert', args: { format: 'STL', flatten_bottom: true } }],
53
- deliverables: ['STL', '3MF (colored)'],
54
- notes: {
55
- zh: ['白模生成,不花贴图积分', 'flatten_bottom 平底利于 FDM', '彩色打印改 --then convert:3mf,export_vertex_colors=true'],
56
- en: ['bare geometry: no texture credits spent', 'flatten_bottom helps FDM adhesion', 'for color prints use --then convert:3mf,export_vertex_colors=true'],
57
- },
58
- },
59
- {
60
- id: 'ar-web',
61
- label: { zh: 'AR/Web/电商', en: 'AR / Web / e-commerce' },
62
- description: { zh: '移动端性能预算,glb+usdz 双交付', en: 'Mobile performance budgets with dual glb+usdz delivery' },
63
- model: MODEL_V31,
64
- genParams: { texture: true, pbr: true },
65
- chain: [
66
- { step: 'decimate', args: { face_limit: 20000 } },
67
- { step: 'convert', args: { format: 'USDZ' } },
68
- ],
69
- deliverables: ['GLB', 'USDZ'],
70
- notes: {
71
- zh: ['v3.1 生成后减面到 2 万内', 'iOS QuickLook 需要 USDZ', 'decimate 默认 bake 烘焙贴图到低模'],
72
- en: ['generate with v3.1, then decimate under 20k faces', 'iOS QuickLook requires USDZ', 'decimate bakes textures onto the low-poly by default'],
73
- },
74
- },
75
- {
76
- id: 'anim',
77
- label: { zh: '角色动画', en: 'Character animation' },
78
- description: { zh: '绑骨+动作重定向全链路', en: 'Full rig + retarget pipeline' },
79
- model: MODEL_V31,
80
- genParams: { texture: true, pbr: true },
81
- chain: [
82
- { step: 'rig-check', args: {} },
83
- { step: 'rig', args: { model: 'rig-v2.0', spec: 'tripo', out_format: 'glb' } },
84
- { step: 'retarget', args: { animations: ['preset:idle', 'preset:walk'] } },
85
- ],
86
- deliverables: ['GLB', 'FBX'],
87
- notes: {
88
- zh: ['先 rig-check 预检,不可绑骨即止损', '接 Mixamo/Unity Humanoid 用 rig:spec=mixamo', '提示词建议 T-pose 站姿,或先 text-to-image template=t_pose'],
89
- en: ['rig-check first: stop early if not riggable', 'use rig:spec=mixamo for Mixamo/Unity Humanoid', 'prompt for a T-pose, or pre-generate with text-to-image template=t_pose'],
90
- },
91
- },
92
- {
93
- id: 'toy',
94
- label: { zh: '风格化摆件', en: 'Stylized toy / desk piece' },
95
- description: { zh: '低模可爱风或积木/体素风格化', en: 'Cute low-poly or brick/voxel stylization' },
96
- model: MODEL_P1,
97
- genParams: { texture: true, pbr: true, face_limit: 20000 },
98
- chain: [],
99
- deliverables: ['GLB', 'STL via convert'],
100
- notes: {
101
- zh: ['P1 出干净低模', '积木/体素风追加 --then stylize:lego 或 stylize:voxel', '要打印实物追加 --then convert:stl'],
102
- en: ['P1 produces clean low-poly', 'append --then stylize:lego or stylize:voxel for brick/voxel looks', 'append --then convert:stl to print it'],
103
- },
104
- },
105
- ];
106
- const byId = new Map(SCENARIOS.map((s) => [s.id, s]));
107
- export function getScenario(id) {
108
- return byId.get(id);
109
- }
110
- export function scenarioIds() {
111
- return SCENARIOS.map((s) => s.id);
112
- }