tripo-cli 0.7.2 → 0.8.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.
Files changed (59) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +16 -14
  3. package/dist/ai/experts.js +26 -20
  4. package/dist/ai/plan-card.js +73 -34
  5. package/dist/ai/wizard.js +19 -19
  6. package/dist/commands/account.js +2 -6
  7. package/dist/commands/ai.js +18 -16
  8. package/dist/commands/batch.js +58 -18
  9. package/dist/commands/completion.js +1 -1
  10. package/dist/commands/config-cmd.js +1 -1
  11. package/dist/commands/doctor.js +1 -3
  12. package/dist/commands/generate.js +50 -8
  13. package/dist/commands/home.js +12 -13
  14. package/dist/commands/login.js +125 -182
  15. package/dist/commands/make.js +50 -25
  16. package/dist/commands/mcp.js +8 -3
  17. package/dist/commands/process-groups.js +29 -18
  18. package/dist/commands/shared.js +22 -13
  19. package/dist/commands/task.js +12 -11
  20. package/dist/commands/topup.js +6 -10
  21. package/dist/commands/update.js +23 -11
  22. package/dist/commands/view.js +3 -4
  23. package/dist/config/config.js +1 -1
  24. package/dist/core/analytics.js +39 -16
  25. package/dist/core/client.js +53 -21
  26. package/dist/core/device-auth.js +49 -1
  27. package/dist/core/download.js +2 -1
  28. package/dist/core/errors.js +24 -14
  29. package/dist/core/output.js +0 -4
  30. package/dist/core/requests.js +94 -31
  31. package/dist/core/task-service.js +21 -20
  32. package/dist/core/upload.js +23 -5
  33. package/dist/core/watch.js +3 -0
  34. package/dist/knowledge/chains.js +16 -17
  35. package/dist/knowledge/error-catalog.js +39 -37
  36. package/dist/knowledge/models.js +147 -27
  37. package/dist/knowledge/params.js +143 -32
  38. package/dist/knowledge/scenarios.js +32 -55
  39. package/dist/pipeline/make.js +38 -30
  40. package/dist/pipeline/runner.js +27 -8
  41. package/dist/pipeline/stdin.js +40 -3
  42. package/dist/program.js +3 -10
  43. package/dist/util/input-detect.js +10 -1
  44. package/package.json +3 -2
  45. package/skill/SKILL.md +52 -15
  46. package/skill/commands/account.md +8 -3
  47. package/skill/commands/batch.md +13 -3
  48. package/skill/commands/generate.md +57 -23
  49. package/skill/commands/make.md +43 -16
  50. package/skill/commands/process.md +29 -24
  51. package/skill/commands/task.md +4 -4
  52. package/skill/commands/view.md +1 -1
  53. package/skill/common-errors.md +14 -10
  54. package/skill/examples/animation.md +4 -2
  55. package/skill/examples/ar-web.md +6 -4
  56. package/skill/examples/game-asset.md +18 -7
  57. package/skill/examples/pipes.md +2 -2
  58. package/skill/examples/print.md +7 -3
  59. package/dist/i18n.js +0 -19
@@ -2,105 +2,82 @@
2
2
  * Scenario decision matrix: --for presets and the AI wizard both read this
3
3
  * table. Changing production strategy means editing data here, not logic.
4
4
  */
5
- import { MODEL_P1, MODEL_V31, RIG_MODEL_V25 } from './models.js';
5
+ import { CAPABILITY_DEFAULTS, MODEL_P2, MODEL_V31 } from './models.js';
6
6
  export const SCENARIOS = [
7
7
  {
8
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,
9
+ label: 'Mobile game / low-poly',
10
+ description: 'Mobile game assets with strict face budgets and clean topology',
11
+ model: MODEL_P2,
12
12
  genParams: { texture: true, pbr: true, texture_quality: 'standard', face_limit: 15000 },
13
13
  chain: [{ step: 'convert', args: { format: 'FBX', texture_size: 2048 } }],
14
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
- },
15
+ notes: ['P2 editable low-poly topology', '2K textures for mobile budgets', 'P2 costs more credits than H/P1; check credits before running', 'append --then rig if you need a skeleton'],
19
16
  },
20
17
  {
21
18
  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,
19
+ label: 'PC / console game',
20
+ description: 'Editable real-time engine assets with full PBR',
21
+ model: MODEL_P2,
25
22
  genParams: { texture: true, pbr: true, texture_quality: 'detailed' },
26
23
  chain: [{ step: 'convert', args: { format: 'FBX' } }],
27
24
  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
- },
25
+ notes: ['P2 editable topology + detailed textures', 'append --then decimate:5000 for LODs', 'P2 costs more credits than H/P1; check credits before running', 'use fbx_preset to match Blender/3dsMax'],
32
26
  },
33
27
  {
34
28
  id: 'film',
35
- label: { zh: '影视/离线渲染', en: 'Film / offline rendering' },
36
- description: { zh: '细分友好四边面,规格拉满', en: 'Subdivision-friendly quads, maximum quality' },
29
+ label: 'Film / offline rendering',
30
+ description: 'Subdivision-friendly quads, maximum quality',
37
31
  model: MODEL_V31,
38
32
  genParams: { texture: true, pbr: true, quad: true, geometry_quality: 'detailed', texture_quality: 'detailed' },
39
33
  chain: [],
40
34
  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
- },
35
+ notes: ['quad=true outputs FBX (quads cannot be stored in GLB)', 'geometry detailed bills an extra HD credit', 'append --then convert:usdz for USD pipelines'],
45
36
  },
46
37
  {
47
38
  id: 'print',
48
- label: { zh: '3D 打印', en: '3D printing' },
49
- description: { zh: '水密可打印几何,免贴图省积分', en: 'Watertight printable geometry, skipping textures saves credits' },
39
+ label: '3D printing',
40
+ description: 'Watertight printable geometry, skipping textures saves credits',
50
41
  model: MODEL_V31,
51
42
  genParams: { texture: false, pbr: false },
52
43
  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
- },
44
+ deliverables: ['STL'],
45
+ notes: ['bare geometry: no texture credits spent', 'flatten_bottom helps FDM adhesion', 'for color prints add -p texture=true and --then convert:format=OBJ,export_vertex_colors=true (API 3MF output is single color)'],
58
46
  },
59
47
  {
60
48
  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
- ],
49
+ label: 'AR / Web / e-commerce',
50
+ description: 'Mobile performance budgets with dual glb+usdz delivery',
51
+ model: MODEL_P2,
52
+ genParams: { texture: true, pbr: true, face_limit: 20000 },
53
+ chain: [{ step: 'convert', args: { format: 'USDZ' } }],
54
+ downloadGeneration: true,
69
55
  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
- },
56
+ notes: ['P2 generates under 20k faces directly (no decimate step)', 'iOS QuickLook requires USDZ', 'P2 costs more credits than H/P1; check credits before running', 'downloads both the generated GLB and the USDZ'],
74
57
  },
75
58
  {
76
59
  id: 'anim',
77
- label: { zh: '角色动画', en: 'Character animation' },
78
- description: { zh: '绑骨+动作重定向全链路', en: 'Full rig + retarget pipeline' },
79
- model: MODEL_V31,
60
+ label: 'Character animation',
61
+ description: 'Full rig + retarget pipeline',
62
+ model: MODEL_P2,
80
63
  genParams: { texture: true, pbr: true },
81
64
  chain: [
82
65
  { step: 'rig-check', args: {} },
83
- { step: 'rig', args: { model: RIG_MODEL_V25, spec: 'tripo', out_format: 'glb' } },
66
+ { step: 'rig', args: { model: CAPABILITY_DEFAULTS.rig, out_format: 'glb' } },
84
67
  { step: 'retarget', args: { animations: ['preset:idle', 'preset:walk'] } },
85
68
  ],
86
69
  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
- },
70
+ notes: ['P2 costs more credits than H/P1; check credits before running', 'rig-check first: stop early if not riggable', 'use rig:spec=mixamo for Mixamo, spec=unity / spec=unreal for Unity Humanoid / Unreal', 'prompt for a T-pose, or pre-generate with text-to-image template=t_pose'],
91
71
  },
92
72
  {
93
73
  id: 'toy',
94
- label: { zh: '风格化摆件', en: 'Stylized toy / desk piece' },
95
- description: { zh: '低模可爱风摆件', en: 'Cute low-poly desk piece' },
96
- model: MODEL_P1,
74
+ label: 'Stylized toy / desk piece',
75
+ description: 'Cute low-poly desk piece',
76
+ model: MODEL_P2,
97
77
  genParams: { texture: true, pbr: true, face_limit: 20000 },
98
78
  chain: [],
99
79
  deliverables: ['GLB', 'STL via convert'],
100
- notes: {
101
- zh: ['P1 出干净低模', '要打印实物追加 --then convert:stl'],
102
- en: ['P1 produces clean low-poly', 'append --then convert:stl to print it'],
103
- },
80
+ notes: ['P2 produces editable low-poly', 'P2 costs more credits than H/P1; check credits before running', 'append --then convert:stl to print it'],
104
81
  },
105
82
  ];
106
83
  const byId = new Map(SCENARIOS.map((s) => [s.id, s]));
@@ -1,22 +1,38 @@
1
1
  /**
2
2
  * The `make` orchestrator — one entry point that turns any input (text /
3
3
  * image / multiview / model file / task ref) into finished artifacts,
4
- * applying the dual-model rule, scenario presets, and the processing chain.
4
+ * applying model routing, scenario presets, and the processing chain.
5
5
  * Shared by `tripo make`, `tripo ai`, `tripo redo`, batch, and the MCP server.
6
6
  */
7
7
  import { basename } from 'node:path';
8
8
  import { UsageError } from '../core/errors.js';
9
9
  import { log, warn } from '../core/output.js';
10
- import { buildImageToModel, buildMultiviewToModel, buildStepRequest, buildTextToModel, } from '../core/requests.js';
10
+ import { buildImageToModel, buildMultiviewToModel, buildStepRequest, buildTextToModel, validateChainRequests, } from '../core/requests.js';
11
11
  import { precheckBalance, resolveInputValue, runTask } from '../core/task-service.js';
12
- import { t } from '../i18n.js';
13
12
  import { validateChain, ChainError } from '../knowledge/chains.js';
14
- import { chooseModel, detectLowPolyIntent } from '../knowledge/models.js';
13
+ import { chooseModel, detectDenseGeometryIntent, detectLowPolyIntent, detectRealtimeIntent } from '../knowledge/models.js';
15
14
  import { getScenario } from '../knowledge/scenarios.js';
16
15
  import { classifyInputs } from '../util/input-detect.js';
17
16
  import { runChain, assertSourceReady } from './runner.js';
18
- /** Build the full plan (no network calls except none): what model, what chain, why. */
17
+ function chooseGenerationModel(options, scenario, genParams, prompt) {
18
+ return chooseModel({
19
+ explicit: options.model,
20
+ preferred: scenario?.model,
21
+ faceLimit: typeof genParams.face_limit === 'number' ? genParams.face_limit : undefined,
22
+ quad: genParams.quad === true,
23
+ lowPoly: prompt ? detectLowPolyIntent(prompt) : false,
24
+ realtime: prompt ? detectRealtimeIntent(prompt) : false,
25
+ denseGeometry: prompt ? detectDenseGeometryIntent(prompt) : false,
26
+ params: genParams,
27
+ });
28
+ }
29
+ /** Validate the entire plan without side effects before resolving uploads. */
19
30
  export async function planMake(client, options) {
31
+ const preview = await prepareMake(client, { ...options, dryRun: true });
32
+ checkPlanChain(preview);
33
+ return options.dryRun ? preview : prepareMake(client, options);
34
+ }
35
+ async function prepareMake(client, options) {
20
36
  const classified = classifyInputs(options.inputs);
21
37
  const scenario = options.scenario ? getScenario(options.scenario) : undefined;
22
38
  if (options.scenario && !scenario) {
@@ -25,25 +41,21 @@ export async function planMake(client, options) {
25
41
  const userParams = options.params ?? {};
26
42
  const genParams = { ...(scenario?.genParams ?? {}), ...userParams };
27
43
  const chain = options.chain && options.chain.length > 0 ? options.chain : (scenario?.chain ?? []);
44
+ // --then replaces the scenario chain, so its dual-delivery promise no longer holds.
45
+ const downloadGeneration = scenario?.downloadGeneration === true && !(options.chain && options.chain.length > 0);
28
46
  const warnings = [];
29
47
  if (options.chain && options.chain.length > 0 && scenario && scenario.chain.length > 0) {
30
- warnings.push(t({
31
- zh: `--then 覆盖了 ${scenario.id} 场景默认加工链`,
32
- en: `--then overrides the default ${scenario.id} processing chain`,
33
- }));
48
+ warnings.push(`--then overrides the default ${scenario.id} processing chain`);
34
49
  }
35
50
  switch (classified.kind) {
36
51
  case 'text': {
37
52
  const prompt = classified.values[0].value;
38
- const choice = chooseModel({
39
- explicit: options.model ?? scenario?.model,
40
- faceLimit: typeof genParams.face_limit === 'number' ? genParams.face_limit : undefined,
41
- lowPoly: detectLowPolyIntent(prompt),
42
- });
53
+ const choice = chooseGenerationModel(options, scenario, genParams, prompt);
43
54
  const generation = buildTextToModel(prompt, choice.model, genParams);
44
55
  return {
45
56
  generation,
46
57
  chain,
58
+ downloadGeneration,
47
59
  model: choice.model,
48
60
  modelReason: choice.reason,
49
61
  name: options.name ?? prompt,
@@ -54,14 +66,12 @@ export async function planMake(client, options) {
54
66
  case 'url-image': {
55
67
  const raw = classified.values[0].value;
56
68
  const { value } = await resolveInputValue(client, raw, { dryRun: options.dryRun });
57
- const choice = chooseModel({
58
- explicit: options.model ?? scenario?.model,
59
- faceLimit: typeof genParams.face_limit === 'number' ? genParams.face_limit : undefined,
60
- });
69
+ const choice = chooseGenerationModel(options, scenario, genParams);
61
70
  const generation = buildImageToModel(value, choice.model, genParams);
62
71
  return {
63
72
  generation,
64
73
  chain,
74
+ downloadGeneration,
65
75
  model: choice.model,
66
76
  modelReason: choice.reason,
67
77
  name: options.name ?? basename(raw),
@@ -70,14 +80,12 @@ export async function planMake(client, options) {
70
80
  }
71
81
  case 'multiview': {
72
82
  const views = await assignViews(client, classified.values.map((v) => v.value), { dryRun: options.dryRun });
73
- const choice = chooseModel({
74
- explicit: options.model ?? scenario?.model,
75
- faceLimit: typeof genParams.face_limit === 'number' ? genParams.face_limit : undefined,
76
- });
83
+ const choice = chooseGenerationModel(options, scenario, genParams);
77
84
  const generation = buildMultiviewToModel(views, choice.model, genParams);
78
85
  return {
79
86
  generation,
80
87
  chain,
88
+ downloadGeneration,
81
89
  model: choice.model,
82
90
  modelReason: choice.reason,
83
91
  name: options.name ?? basename(classified.values[0].value),
@@ -89,10 +97,7 @@ export async function planMake(client, options) {
89
97
  const { value } = await resolveInputValue(client, raw, { dryRun: options.dryRun });
90
98
  const generation = buildStepRequest('import', value, {});
91
99
  if (chain.length === 0) {
92
- warnings.push(t({
93
- zh: '导入模型后没有加工步骤;用 --then 指定(如 --then texture,rig)',
94
- en: 'importing a model with no processing steps; add --then (e.g. --then texture,rig)',
95
- }));
100
+ warnings.push('importing a model with no processing steps; add --then (e.g. --then texture,rig)');
96
101
  }
97
102
  return {
98
103
  generation,
@@ -121,6 +126,7 @@ export async function planMake(client, options) {
121
126
  * Skipped when the upstream type is unknown (raw task id without local history).
122
127
  */
123
128
  export function checkPlanChain(plan) {
129
+ validateChainRequests(plan.chain);
124
130
  if (plan.chain.length === 0)
125
131
  return;
126
132
  const upstream = plan.generation?.taskType ?? plan.sourceType;
@@ -147,7 +153,7 @@ export async function executeMake(client, plan, options) {
147
153
  let primary;
148
154
  if (plan.generation) {
149
155
  if (plan.model && plan.modelReason) {
150
- log(t({ zh: `模型选择:${plan.model}(${plan.modelReason})`, en: `model: ${plan.model} (${plan.modelReason})` }));
156
+ log(`model: ${plan.model} (${plan.modelReason})`);
151
157
  }
152
158
  primary = await runTask({
153
159
  client,
@@ -156,10 +162,11 @@ export async function executeMake(client, plan, options) {
156
162
  name: plan.name,
157
163
  outDir: options.outDir,
158
164
  noWait: options.noWait,
159
- noDownload: options.noDownload || plan.chain.length > 0,
165
+ noDownload: options.noDownload || (plan.chain.length > 0 && !plan.downloadGeneration),
160
166
  timeoutMs: options.timeoutMs,
161
167
  notify: options.notify && plan.chain.length === 0,
162
168
  precheckBalance: false,
169
+ onCreated: options.onTaskCreated,
163
170
  });
164
171
  if (options.noWait)
165
172
  return { primary, chainResults: [] };
@@ -183,10 +190,11 @@ export async function executeMake(client, plan, options) {
183
190
  outDir: options.outDir,
184
191
  notify: false,
185
192
  timeoutMs: options.timeoutMs,
193
+ onTaskCreated: options.onTaskCreated,
186
194
  });
187
- // If the chain stopped early (not riggable) and nothing was downloaded yet,
195
+ // If the chain stopped early (not riggable) and no step downloaded a model,
188
196
  // fetch the source artifacts so the user still gets their model.
189
- if (stoppedEarly && plan.generation && !options.noDownload) {
197
+ if (stoppedEarly && plan.generation && !options.noDownload && !results.some((r) => r.model_file)) {
190
198
  const detail = await client.getTask(sourceTaskId);
191
199
  const { downloadArtifacts, defaultOutputDir } = await import('../core/download.js');
192
200
  const { slugify } = await import('../config/history.js');
@@ -5,23 +5,39 @@
5
5
  */
6
6
  import { UsageError } from '../core/errors.js';
7
7
  import { log, warn } from '../core/output.js';
8
- import { buildStepRequest } from '../core/requests.js';
8
+ import { buildStepRequest, validateChainRequests } from '../core/requests.js';
9
9
  import { runTask } from '../core/task-service.js';
10
- import { t } from '../i18n.js';
11
10
  import { getStep, validateChain } from '../knowledge/chains.js';
11
+ import { NON_BIPED_PRESETS } from '../knowledge/models.js';
12
12
  export async function runChain(options) {
13
13
  const { client, chain } = options;
14
14
  validateChain(chain, options.sourceType);
15
+ validateChainRequests(chain);
15
16
  const results = [];
16
17
  let currentTaskId = options.sourceTaskId;
17
18
  let rigTypeRecommendation;
19
+ let rigType;
18
20
  for (let i = 0; i < chain.length; i++) {
19
21
  const spec = chain[i];
20
22
  const args = { ...spec.args };
21
23
  if (spec.step === 'rig' && rigTypeRecommendation && args.rig_type === undefined) {
22
24
  args.rig_type = rigTypeRecommendation;
23
- log(t({ zh: `采用 rig-check 推荐体型:${rigTypeRecommendation}`, en: `using rig-check recommendation: ${rigTypeRecommendation}` }));
25
+ log(`using rig-check recommendation: ${rigTypeRecommendation}`);
24
26
  }
27
+ if (spec.step === 'rig')
28
+ rigType = String(args.rig_type ?? 'biped');
29
+ // Biped presets (preset:<name>) do not fit other bodies: use that rig type's own preset.
30
+ const bodyPresets = rigType ? NON_BIPED_PRESETS[rigType] : undefined;
31
+ if (spec.step === 'retarget' && bodyPresets) {
32
+ const requested = [args.animations ?? args.animation ?? []].flat().map(String);
33
+ if (requested.length > 0 && requested.every((a) => /^preset:[^:]+$/.test(a))) {
34
+ delete args.animation;
35
+ args.animations = bodyPresets;
36
+ log(`rig type is ${rigType}: biped presets swapped for ${bodyPresets.join(', ')}`);
37
+ }
38
+ }
39
+ // avian/others have no preset animations: the rigged model is the final output.
40
+ const noPresets = spec.step === 'rig' && chain[i + 1]?.step === 'retarget' && rigType !== 'biped' && !bodyPresets;
25
41
  const built = buildStepRequest(spec.step, currentTaskId, args);
26
42
  for (const w of built.warnings)
27
43
  warn(w);
@@ -34,20 +50,23 @@ export async function runChain(options) {
34
50
  notify: false,
35
51
  timeoutMs: options.timeoutMs,
36
52
  // Intermediate steps skip download; final step downloads.
37
- noDownload: i < chain.length - 1 && spec.step !== 'rig-check',
53
+ noDownload: i < chain.length - 1 && spec.step !== 'rig-check' && !noPresets,
38
54
  precheckBalance: false, // checked once by the caller
55
+ onCreated: options.onTaskCreated,
39
56
  });
40
57
  results.push(result);
58
+ if (noPresets) {
59
+ const message = `rig type ${rigType} has no preset animations; skipped retarget and kept the rigged model`;
60
+ warn(message);
61
+ return { results, stoppedEarly: message };
62
+ }
41
63
  if (spec.step === 'rig-check') {
42
64
  const verdict = await client.getTask(result.task_id);
43
65
  const output = verdict.output ?? {};
44
66
  const riggable = output.riggable;
45
67
  rigTypeRecommendation = typeof output.rig_type === 'string' ? output.rig_type : undefined;
46
68
  if (riggable === false) {
47
- const message = t({
48
- zh: 'rig-check 判定该模型不可绑骨,动画链止损停止(后续步骤未执行,未扣积分)',
49
- en: 'rig-check says this model is not riggable; stopping the chain early (no further credits spent)',
50
- });
69
+ const message = 'rig-check says this model is not riggable; stopping the chain early (no further credits spent)';
51
70
  warn(message);
52
71
  return { results, stoppedEarly: message };
53
72
  }
@@ -2,12 +2,48 @@
2
2
  * NDJSON pipe support: downstream commands read the upstream task result from
3
3
  * stdin, enabling `tripo make cat.png | tripo model texture | tripo anim rig`.
4
4
  */
5
- /** Read piped NDJSON/JSON from stdin; returns undefined on a TTY. */
5
+ import { CliError, UsageError } from '../core/errors.js';
6
+ import { EXIT } from '../knowledge/error-catalog.js';
7
+ /**
8
+ * Read piped NDJSON/JSON from stdin; returns undefined only on a TTY.
9
+ * Piped input that carries an upstream error or no task throws, so a broken
10
+ * pipeline never falls back to some other task and spends credits on it.
11
+ */
6
12
  export async function readPipedTask() {
7
13
  if (process.stdin.isTTY)
8
14
  return undefined;
9
15
  const raw = await readAll(process.stdin);
10
- return parsePipedText(raw);
16
+ const upstream = parsePipedError(raw);
17
+ if (upstream) {
18
+ const code = upstream.exit_code;
19
+ const exitCode = code !== undefined && Number.isInteger(code) && code >= 1 && code <= 9 ? code : EXIT.USAGE;
20
+ throw new CliError(`upstream command failed${code !== undefined ? ` (exit ${code})` : ''}: ${upstream.error}; nothing was submitted`, exitCode);
21
+ }
22
+ const task = parsePipedText(raw);
23
+ if (!task) {
24
+ throw new UsageError('no task on stdin (piped input was empty or carried no task_id); nothing was submitted', 'pass the input explicitly, e.g. "tripo model texture @last" or a task id');
25
+ }
26
+ return task;
27
+ }
28
+ /** The upstream error when the last JSON line is an error object (`{"error","exit_code"}`). */
29
+ export function parsePipedError(raw) {
30
+ const lines = raw.trim().split('\n').map((l) => l.trim()).filter(Boolean);
31
+ for (let i = lines.length - 1; i >= 0; i--) {
32
+ let obj;
33
+ try {
34
+ obj = JSON.parse(lines[i]);
35
+ }
36
+ catch {
37
+ continue;
38
+ }
39
+ if (typeof obj !== 'object' || obj === null)
40
+ continue;
41
+ const { error, exit_code: exitCode } = obj;
42
+ if (typeof error !== 'string')
43
+ return undefined;
44
+ return { error, exit_code: typeof exitCode === 'number' ? exitCode : undefined };
45
+ }
46
+ return undefined;
11
47
  }
12
48
  /** Parse piped text: JSON object, NDJSON (last task line wins), or a bare task id. */
13
49
  export function parsePipedText(raw) {
@@ -18,7 +54,8 @@ export function parsePipedText(raw) {
18
54
  for (let i = lines.length - 1; i >= 0; i--) {
19
55
  try {
20
56
  const obj = JSON.parse(lines[i]);
21
- if (typeof obj.task_id === 'string') {
57
+ // Error JSON may name the failed task; it is never an input.
58
+ if (typeof obj.task_id === 'string' && obj.error === undefined) {
22
59
  return { task_id: obj.task_id, type: typeof obj.type === 'string' ? obj.type : undefined };
23
60
  }
24
61
  }
package/dist/program.js CHANGED
@@ -18,11 +18,9 @@ import { registerTaskCommands } from './commands/task.js';
18
18
  import { registerTopupCommand } from './commands/topup.js';
19
19
  import { notifyIfOutdated, registerUpdateCommand } from './commands/update.js';
20
20
  import { registerViewCommands } from './commands/view.js';
21
- import { loadConfig } from './config/config.js';
22
21
  import { RefError } from './config/history.js';
23
- import { ApiError, CliError, UsageError } from './core/errors.js';
22
+ import { ApiError, ArtifactDownloadError, CliError, TaskFailedError, UsageError } from './core/errors.js';
24
23
  import { configureOutput, errorLine, isJsonMode } from './core/output.js';
25
- import { setLocale, t } from './i18n.js';
26
24
  import { EXIT } from './knowledge/error-catalog.js';
27
25
  import { cliVersion } from './version.js';
28
26
  import { beginOperation, finishOperation } from './core/analytics.js';
@@ -30,10 +28,7 @@ export function buildProgram() {
30
28
  const program = new Command();
31
29
  program
32
30
  .name('tripo')
33
- .description(t({
34
- zh: 'Tripo 3D 智能 CLI — 一句话/一张图,直出可进引擎的 3D 资产\n高频: make(生成) ai(专家规划) view(预览) topup(充值)',
35
- en: 'Tripo 3D intelligent CLI — turn a sentence or an image into engine-ready 3D assets\ntop commands: make · ai · view · topup',
36
- }))
31
+ .description('Tripo 3D intelligent CLI — turn a sentence or an image into engine-ready 3D assets\ntop commands: make · ai · view · topup')
37
32
  .version(cliVersion(), '-v, --version')
38
33
  .option('--json', 'machine-readable output on stdout (auto-enabled when piped)')
39
34
  .option('--yes', 'skip confirmations (auto-enabled when headless)')
@@ -54,9 +49,6 @@ export function buildProgram() {
54
49
  const profile = resolveGlobalString(actionCommand, 'profile');
55
50
  if (profile)
56
51
  process.env.TRIPO_PROFILE = profile;
57
- const lang = loadConfig().language;
58
- if (lang)
59
- setLocale(lang);
60
52
  const path = [];
61
53
  for (let command = actionCommand; command && command !== program; command = command.parent)
62
54
  path.unshift(command.name());
@@ -158,6 +150,7 @@ export function handleError(err) {
158
150
  ...(err instanceof ApiError
159
151
  ? { api_code: err.apiCode, request_id: err.requestId, http_status: err.httpStatus }
160
152
  : {}),
153
+ ...(err instanceof TaskFailedError || err instanceof ArtifactDownloadError ? { task_id: err.taskId } : {}),
161
154
  ...(err.suggestion ? { suggestion: err.suggestion } : {}),
162
155
  }) + '\n');
163
156
  }
@@ -59,7 +59,7 @@ export function classifyInputs(args) {
59
59
  case 'url':
60
60
  if (detected.length > 1)
61
61
  return { kind: 'multiview', values: detected };
62
- return { kind: 'url-image', values: detected };
62
+ return { kind: MODEL_EXTS.has(urlExtension(detected[0].value)) ? 'model' : 'url-image', values: detected };
63
63
  case 'task-id':
64
64
  case 'history-ref':
65
65
  case 'file-token':
@@ -76,6 +76,15 @@ export function classifyInputs(args) {
76
76
  }
77
77
  export class InputDetectError extends Error {
78
78
  }
79
+ /** Lower-cased extension of a URL's path ('' when it has none). */
80
+ export function urlExtension(url) {
81
+ try {
82
+ return extname(new URL(url).pathname).toLowerCase();
83
+ }
84
+ catch {
85
+ return '';
86
+ }
87
+ }
79
88
  function isExistingFile(p) {
80
89
  try {
81
90
  return existsSync(p) && statSync(p).isFile();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tripo-cli",
3
- "version": "0.7.2",
3
+ "version": "0.8.0",
4
4
  "description": "Tripo 3D intelligent CLI — turn a prompt or an image into engine-ready 3D assets from your terminal (Tripo V3 API)",
5
5
  "keywords": [
6
6
  "tripo",
@@ -20,6 +20,7 @@
20
20
  "files": [
21
21
  "dist",
22
22
  "skill",
23
+ "CHANGELOG.md",
23
24
  "README.md"
24
25
  ],
25
26
  "engines": {
@@ -48,7 +49,7 @@
48
49
  "@clack/prompts": "^1.7.0",
49
50
  "commander": "^15.0.0",
50
51
  "picocolors": "^1.1.1",
51
- "undici": "^6.28.0",
52
+ "undici": "^6.29.1",
52
53
  "yaml": "^2.9.0"
53
54
  },
54
55
  "devDependencies": {