@taptap/maker 0.0.24 → 0.0.25-beta.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.
package/README.md CHANGED
@@ -30,4 +30,4 @@ This package contains only the Maker CLI/MCP bundle and Maker workflow skills.
30
30
  It does not include the legacy TapTap Open API MCP server, proxy, native signer,
31
31
  or OpenClaw plugin package contents.
32
32
 
33
- Version: 0.0.24
33
+ Version: 0.0.25-beta.1
package/dist/maker.js CHANGED
@@ -29288,11 +29288,10 @@ function createMakerAgentsPolicyBody() {
29288
29288
  "- `create_video_task` for game video assets or referenced image/video generation.",
29289
29289
  "- `query_video_task` for refreshing video task status and fetching completed videos.",
29290
29290
  "- `text_to_music` for game music or audio assets.",
29291
- "- `create_3d_model_task` for game 3D model assets.",
29292
- "- `query_3d_model_task` for polling 3D model tasks.",
29293
- "- For 3D characters that need skeletons, animation, or FBX output, ask whether to use",
29294
- " `rig=true`. Use it only for biped humanoid characters in A-pose or A-pose-compatible",
29295
- " front-view inputs; otherwise keep static model generation.",
29291
+ "- `create_3d_asset` for the complete 3D lifecycle: start, query, explicit review continuation,",
29292
+ " option inspection, and post-processing.",
29293
+ "- Never automatically continue a 3D review step. Show returned previews and wait for explicit",
29294
+ ' user approval before calling `create_3d_asset` with `action="continue"`.',
29296
29295
  "",
29297
29296
  "Follow each Maker tool schema for supported local path, remote URL, and data URL inputs.",
29298
29297
  "If the user references attached/local media, inspect the attachment or workspace file path",
@@ -29307,8 +29306,8 @@ function createMakerAgentsPolicyBody() {
29307
29306
  "Generated Maker proxy assets should stay in the Maker project asset workflow under",
29308
29307
  "`assets/image`, `assets/video`, `assets/audio`, or `assets/model`, with remote mappings",
29309
29308
  "preserved for later edits and builds.",
29310
- "3D model results save the original GLB/FBX, the MDL zip, extracted MDL assets, and rendered",
29311
- "preview images when those URLs are returned."
29309
+ "`create_3d_asset` local runtime `model_files` copy/extract instructions are materialized into",
29310
+ "`assets/model`. Use `local_delivery` for the usable local model path and preserve the remote result."
29312
29311
  ].join("\n");
29313
29312
  }
29314
29313
  function hashPolicyBody(body) {
@@ -32347,7 +32346,7 @@ function formatMakerSkillStatus(_options = {}) {
32347
32346
  "- If Maker proxy tools are missing, explain the session/configuration issue and available alternatives.",
32348
32347
  "- Use generate_image, batch_generate_images, edit_image for game image assets.",
32349
32348
  "- Use create_video_task, query_video_task, and text_to_music for game video/audio assets.",
32350
- "- Use create_3d_model_task and query_3d_model_task for game 3D model assets.",
32349
+ "- Use create_3d_asset with start/query/continue/post_process for game 3D model assets.",
32351
32350
  "- For any ad-related request, call get_ad_config first to get ad activation status and ad config.",
32352
32351
  "- Do not infer ad readiness from local SDK docs, .maker-mcp/config.json, or runtime callbacks.",
32353
32352
  "- If .project/project.json is missing, build once with maker_build_current_directory, then call get_ad_config again.",
@@ -32357,8 +32356,8 @@ function formatMakerSkillStatus(_options = {}) {
32357
32356
  "- Generated assets are saved under assets/image, assets/video, assets/audio, or assets/model with remote mappings.",
32358
32357
  "- Follow each tool schema for supported local path, remote URL, and data URL inputs.",
32359
32358
  "- Local proxy may convert resolvable local reference media to data URLs before forwarding.",
32360
- "- Generated 3D outputs save original GLB/FBX and MDL zip under assets/model.",
32361
- "- MDL zip contents are extracted into assets/Meshes, assets/Materials, assets/Textures, and assets/Prefabs.",
32359
+ "- create_3d_asset local runtime model_files copy/extract instructions are materialized under assets/model.",
32360
+ "- Use local_delivery for the usable local model path and preview_assets for local review images.",
32362
32361
  "Maker initialization next_step: execute `taptap-maker init`.",
32363
32362
  "Load these documents when the current AI client supports reading local guide files."
32364
32363
  ].join("\n");
@@ -33477,6 +33476,7 @@ var VIDEO_TASK_IMAGE_REFERENCE_MAX_BYTES = 30 * 1024 * 1024;
33477
33476
  var VIDEO_REFERENCE_MAX_BYTES = 50 * 1024 * 1024;
33478
33477
  var AUDIO_REFERENCE_MAX_BYTES = 15 * 1024 * 1024;
33479
33478
  var DEBUG_FEEDBACK_PATH_HINT = "Use local_dir/local_log_paths/local_screenshot_paths when they are returned. If only local_candidate_* is present, it is a possible project-relative location and must not be treated as a downloaded local file.";
33479
+ var CREATE_3D_ASSET_PROXY_TOOL_NAME = "create_3d_asset";
33480
33480
  var DATA_URL_MIME_BY_EXTENSION = {
33481
33481
  image: {
33482
33482
  ".gif": "image/gif",
@@ -33521,8 +33521,8 @@ function prepareRemoteProxyToolArgs(options) {
33521
33521
  if (options.toolName === "create_video_task") {
33522
33522
  return rewriteVideoReferenceAssetArgs(options.targetDir, options.args);
33523
33523
  }
33524
- if (options.toolName === "create_3d_model_task") {
33525
- return rewrite3dModelAssetArgs(options.targetDir, options.args);
33524
+ if (options.toolName === CREATE_3D_ASSET_PROXY_TOOL_NAME) {
33525
+ return rewriteCreate3dAssetArgs(options.targetDir, options.args);
33526
33526
  }
33527
33527
  return options.args;
33528
33528
  }
@@ -33586,8 +33586,7 @@ function shouldMaterializeRemoteProxyTool(toolName) {
33586
33586
  "create_video_task",
33587
33587
  "query_video_task",
33588
33588
  "text_to_music",
33589
- "create_3d_model_task",
33590
- "query_3d_model_task",
33589
+ CREATE_3D_ASSET_PROXY_TOOL_NAME,
33591
33590
  "get_debug_feedbacks"
33592
33591
  ].includes(toolName);
33593
33592
  }
@@ -33634,8 +33633,8 @@ async function materializeParsedProxyResult(options) {
33634
33633
  if (options.toolName === "text_to_music") {
33635
33634
  return await materializeMusicResult(options);
33636
33635
  }
33637
- if (options.toolName === "create_3d_model_task" || options.toolName === "query_3d_model_task") {
33638
- return await materialize3dModelResult(options, options.toolName);
33636
+ if (options.toolName === CREATE_3D_ASSET_PROXY_TOOL_NAME) {
33637
+ return await materializeCreate3dAssetResult(options);
33639
33638
  }
33640
33639
  if (options.toolName === "get_debug_feedbacks") {
33641
33640
  return await materializeDebugFeedbackResult(options);
@@ -34007,197 +34006,271 @@ async function materializeMusicResult(options) {
34007
34006
  })
34008
34007
  } : options.payload;
34009
34008
  }
34010
- async function materialize3dModelResult(options, toolName) {
34011
- if (options.payload.phase === 1) {
34012
- return await materialize3dPreviewResult(options);
34009
+ async function materializeCreate3dAssetResult(options) {
34010
+ var _a3;
34011
+ const payload = isRecord(options.payload.preview) ? await materializeCreate3dAssetPreviewResult(options) : options.payload;
34012
+ const modelFile = Array.isArray(payload.model_files) ? payload.model_files.find(isRecord) : void 0;
34013
+ if (!modelFile) {
34014
+ return payload;
34013
34015
  }
34014
- return await materialize3dFinalResult(options, toolName);
34015
- }
34016
- async function materialize3dPreviewResult(options) {
34017
- if (!isRecord(options.payload.preview_urls)) {
34018
- return options.payload;
34016
+ const assetId = stringField2(modelFile.assetId) || stringField2(payload.asset_id) || stringField2(payload.task_id) || "3d_asset";
34017
+ const remoteUrl = stringField2(modelFile.modelUrl);
34018
+ const format = (_a3 = stringField2(modelFile.format)) == null ? void 0 : _a3.toLowerCase();
34019
+ const materialization = stringField2(modelFile.materialization);
34020
+ if (!remoteUrl || !format || !materialization) {
34021
+ return {
34022
+ ...payload,
34023
+ local_delivery: create3dAssetDeliveryFailure(
34024
+ assetId,
34025
+ remoteUrl,
34026
+ format,
34027
+ materialization,
34028
+ "Invalid create_3d_asset model_files entry."
34029
+ )
34030
+ };
34019
34031
  }
34020
- let changed = false;
34032
+ const existing = findExistingCreate3dAssetDelivery({
34033
+ targetDir: options.targetDir,
34034
+ assetId,
34035
+ remoteUrl
34036
+ });
34037
+ if (existing) {
34038
+ return {
34039
+ ...payload,
34040
+ local_delivery: create3dAssetLocalDelivery({
34041
+ assetId,
34042
+ remoteUrl,
34043
+ format,
34044
+ materialization,
34045
+ materialized: existing,
34046
+ reused: true
34047
+ })
34048
+ };
34049
+ }
34050
+ const materialized = await materializeCreate3dAssetModelFile({
34051
+ ...options,
34052
+ assetId,
34053
+ modelFile,
34054
+ remoteUrl,
34055
+ format,
34056
+ materialization
34057
+ });
34058
+ if ("localPath" in materialized) {
34059
+ upsertGeneratedAssetRecord(options.targetDir, materialized.localPath, {
34060
+ tool: CREATE_3D_ASSET_PROXY_TOOL_NAME,
34061
+ name: assetId,
34062
+ assetKind: "model",
34063
+ assetId,
34064
+ taskId: stringField2(payload.task_id),
34065
+ cdnUrl: remoteUrl,
34066
+ previewUrl: remoteUrl,
34067
+ localPath: materialized.localPath,
34068
+ absolutePath: materialized.absolutePath,
34069
+ createdAt: options.now.toISOString(),
34070
+ modelCdnUrl: remoteUrl
34071
+ });
34072
+ }
34073
+ return {
34074
+ ...payload,
34075
+ local_delivery: create3dAssetLocalDelivery({
34076
+ assetId,
34077
+ remoteUrl,
34078
+ format,
34079
+ materialization,
34080
+ materialized,
34081
+ reused: false
34082
+ })
34083
+ };
34084
+ }
34085
+ async function materializeCreate3dAssetPreviewResult(options) {
34086
+ const preview = options.payload.preview;
34087
+ const assetId = stringField2(options.payload.asset_id) || "3d_asset";
34021
34088
  const previewAssets = {};
34022
- const taskId = get3dTaskId(options.payload);
34023
- const mode = stringField2(options.payload.mode);
34024
34089
  for (const view of THREE_D_MODEL_VIEWS) {
34025
- const url2 = stringField2(options.payload.preview_urls[view]);
34090
+ const url2 = stringField2(preview[view]);
34026
34091
  const materialized = await materializeAsset({
34027
34092
  targetDir: options.targetDir,
34028
34093
  url: url2,
34029
- baseName: `${taskId || "3d_model"}_${view}`,
34030
- relativeDir: "assets/image",
34094
+ baseName: `${assetId}_${view}`,
34095
+ relativeDir: IMAGE_ASSET_DIRS[0],
34031
34096
  extension: extensionFromUrl(url2) || "png",
34032
34097
  now: options.now,
34033
34098
  fetchImpl: options.fetchImpl
34034
34099
  });
34035
- if (!materialized) {
34036
- continue;
34037
- }
34038
- changed = true;
34100
+ if (!materialized) continue;
34039
34101
  previewAssets[view] = { ...materialized, cdnUrl: url2 };
34040
34102
  if ("localPath" in materialized && url2) {
34041
34103
  upsertGeneratedAssetRecord(options.targetDir, materialized.localPath, {
34042
- tool: "create_3d_model_task",
34043
- name: `${taskId || "3d_model"}_${view}`,
34104
+ tool: CREATE_3D_ASSET_PROXY_TOOL_NAME,
34105
+ name: `${assetId}_${view}`,
34106
+ assetId,
34044
34107
  cdnUrl: url2,
34045
34108
  previewUrl: url2,
34046
34109
  localPath: materialized.localPath,
34047
34110
  absolutePath: materialized.absolutePath,
34048
34111
  createdAt: options.now.toISOString(),
34049
- taskId,
34050
- mode,
34051
- phase: 1,
34052
34112
  view
34053
34113
  });
34054
34114
  }
34055
34115
  }
34056
- return {
34057
- ...options.payload,
34058
- ...changed ? { preview_assets: previewAssets } : {},
34059
- ...create3dPreviewReviewGuidance()
34060
- };
34061
- }
34062
- function create3dPreviewReviewGuidance() {
34063
- return {
34064
- workflow_state: "awaiting_user_review",
34065
- user_review_required: true,
34066
- next_action: "Show the four-view previews to the user and ask whether they approve them or want changes.",
34067
- approval_next_step: "If the user approves, continue the original 3D model generation flow by calling create_3d_model_task again with the approved four-view images.",
34068
- revision_next_step: "If the user requests changes, call create_3d_model_task again with the requested changes to regenerate the four-view previews before model generation.",
34069
- agent_instruction: "Do not stop after phase 1. The 3D model is not complete until the user approves the four-view previews and final model generation finishes."
34070
- };
34116
+ return Object.keys(previewAssets).length > 0 ? { ...options.payload, preview_assets: previewAssets } : options.payload;
34071
34117
  }
34072
- async function materialize3dFinalResult(options, toolName) {
34073
- if (options.payload.status !== "success") {
34074
- return options.payload;
34118
+ async function materializeCreate3dAssetModelFile(options) {
34119
+ var _a3;
34120
+ const targetDirectory = stringField2(options.modelFile.targetDirectory);
34121
+ const suggestedFileName = stringField2(options.modelFile.suggestedFileName);
34122
+ const targetAbsolutePath = targetDirectory ? resolveProjectRelativePath(options.targetDir, targetDirectory) : void 0;
34123
+ const modelAssetRoot = path16.resolve(options.targetDir, MODEL_ASSET_DIRS[0]);
34124
+ if (!targetDirectory || !targetAbsolutePath || !isKnownAssetPath(targetDirectory, MODEL_ASSET_DIRS) || !isPathWithinDirectory(modelAssetRoot, targetAbsolutePath) || !suggestedFileName || path16.posix.basename(suggestedFileName) !== suggestedFileName || suggestedFileName.includes("\\")) {
34125
+ return {
34126
+ download: { success: false, error: "Invalid create_3d_asset local target path." }
34127
+ };
34075
34128
  }
34076
- let changed = false;
34077
- const nextPayload = { ...options.payload };
34078
- const taskId = get3dTaskId(options.payload);
34079
- const modelCdnUrl = stringField2(options.payload.model_cdn_url);
34080
- const renderedImageUrl = stringField2(options.payload.rendered_image_url);
34081
- const mdlConversionError = stringField2(options.payload.mdl_conversion_error);
34082
- const modelMaterialized = await materializeAsset({
34083
- targetDir: options.targetDir,
34084
- url: modelCdnUrl,
34085
- baseName: taskId || "3d_model",
34086
- relativeDir: MODEL_ASSET_DIRS[0],
34087
- extension: extensionFromUrl(modelCdnUrl) || "glb",
34088
- now: options.now,
34089
- fetchImpl: options.fetchImpl
34090
- });
34091
- if (modelMaterialized) {
34092
- changed = true;
34093
- nextPayload.modelDownload = modelMaterialized.download;
34094
- if ("localPath" in modelMaterialized) {
34095
- nextPayload.modelLocalPath = modelMaterialized.localPath;
34096
- nextPayload.modelAbsolutePath = modelMaterialized.absolutePath;
34097
- if (modelCdnUrl) {
34098
- upsertGeneratedAssetRecord(options.targetDir, modelMaterialized.localPath, {
34099
- tool: toolName,
34100
- name: taskId,
34101
- assetKind: "model",
34102
- cdnUrl: modelCdnUrl,
34103
- previewUrl: renderedImageUrl || modelCdnUrl,
34104
- localPath: modelMaterialized.localPath,
34105
- absolutePath: modelMaterialized.absolutePath,
34106
- createdAt: options.now.toISOString(),
34107
- taskId,
34108
- modelCdnUrl,
34109
- renderedImageUrl,
34110
- mdlConversionError
34111
- });
34129
+ if (options.materialization === "copy") {
34130
+ return await materializeAssetAtPath({
34131
+ url: options.remoteUrl,
34132
+ relativePath: path16.posix.join(targetDirectory, suggestedFileName),
34133
+ targetDir: options.targetDir,
34134
+ fetchImpl: options.fetchImpl
34135
+ });
34136
+ }
34137
+ if (options.materialization !== "extract") {
34138
+ return {
34139
+ download: {
34140
+ success: false,
34141
+ error: `Unsupported create_3d_asset materialization: ${options.materialization}`
34112
34142
  }
34113
- }
34143
+ };
34114
34144
  }
34115
- const mdlUrl = stringField2(options.payload.mdl_cdn_url);
34116
- const mdlMaterialized = await materializeAsset({
34145
+ const archive = await materializeAsset({
34117
34146
  targetDir: options.targetDir,
34118
- url: mdlUrl,
34119
- baseName: taskId || "3d_model",
34120
- relativeDir: MODEL_ASSET_DIRS[0],
34121
- extension: extensionFromUrl(mdlUrl) || "zip",
34147
+ url: options.remoteUrl,
34148
+ baseName: options.assetId,
34149
+ relativeDir: ".maker/assets/downloads",
34150
+ extension: path16.extname(suggestedFileName).replace(/^\./, "") || "zip",
34122
34151
  now: options.now,
34123
34152
  fetchImpl: options.fetchImpl
34124
34153
  });
34125
- if (mdlMaterialized) {
34126
- changed = true;
34127
- nextPayload.mdlDownload = mdlMaterialized.download;
34128
- if ("localPath" in mdlMaterialized) {
34129
- nextPayload.mdlLocalPath = mdlMaterialized.localPath;
34130
- nextPayload.mdlAbsolutePath = mdlMaterialized.absolutePath;
34131
- let mdlExtractError;
34132
- try {
34133
- extractZip(
34134
- mdlMaterialized.absolutePath,
34135
- path16.join(options.targetDir, "assets"),
34136
- "3D model asset"
34137
- );
34138
- nextPayload.mdlExtracted = true;
34139
- nextPayload.mdlExtractedTo = "assets";
34140
- } catch (error2) {
34141
- mdlExtractError = `3D model asset extraction failed: ${error2 instanceof Error ? error2.message : String(error2)}`;
34142
- nextPayload.mdlExtracted = false;
34143
- nextPayload.mdlExtractError = mdlExtractError;
34144
- }
34145
- if (mdlUrl) {
34146
- upsertGeneratedAssetRecord(options.targetDir, mdlMaterialized.localPath, {
34147
- tool: toolName,
34148
- name: taskId,
34149
- assetKind: "mdl_zip",
34150
- cdnUrl: mdlUrl,
34151
- previewUrl: renderedImageUrl || mdlUrl,
34152
- localPath: mdlMaterialized.localPath,
34153
- absolutePath: mdlMaterialized.absolutePath,
34154
- createdAt: options.now.toISOString(),
34155
- taskId,
34156
- modelCdnUrl,
34157
- renderedImageUrl,
34158
- mdlConversionError,
34159
- mdlExtractError
34160
- });
34154
+ if (!archive || !("localPath" in archive)) {
34155
+ return archive ?? {
34156
+ download: { success: false, error: "Missing create_3d_asset model archive." }
34157
+ };
34158
+ }
34159
+ try {
34160
+ fs15.mkdirSync(targetAbsolutePath, { recursive: true });
34161
+ extractZip(archive.absolutePath, targetAbsolutePath, "3D model asset");
34162
+ const entrypointExtension = ((_a3 = stringField2(options.modelFile.entrypointExtension)) == null ? void 0 : _a3.toLowerCase()) || ".mdl";
34163
+ const entrypoint = findFileByExtension(targetAbsolutePath, entrypointExtension);
34164
+ if (!entrypoint) {
34165
+ throw new Error(`3D model archive contains no ${entrypointExtension} entrypoint.`);
34166
+ }
34167
+ const localPath = path16.relative(options.targetDir, entrypoint).split(path16.sep).join("/");
34168
+ return {
34169
+ localPath,
34170
+ absolutePath: entrypoint,
34171
+ download: archive.download
34172
+ };
34173
+ } catch (error2) {
34174
+ return {
34175
+ download: {
34176
+ success: false,
34177
+ error: `3D model asset extraction failed: ${error2 instanceof Error ? error2.message : String(error2)}`
34178
+ }
34179
+ };
34180
+ } finally {
34181
+ fs15.rmSync(archive.absolutePath, { force: true });
34182
+ }
34183
+ }
34184
+ async function materializeAssetAtPath(options) {
34185
+ const absolutePath = resolveProjectRelativePath(options.targetDir, options.relativePath);
34186
+ if (!absolutePath) {
34187
+ return { download: { success: false, error: "Asset target path escapes the project." } };
34188
+ }
34189
+ try {
34190
+ const response = await options.fetchImpl(options.url);
34191
+ if (!response.ok) {
34192
+ return {
34193
+ download: { success: false, error: `Asset download failed: HTTP ${response.status}` }
34194
+ };
34195
+ }
34196
+ fs15.mkdirSync(path16.dirname(absolutePath), { recursive: true });
34197
+ fs15.writeFileSync(absolutePath, Buffer.from(await response.arrayBuffer()));
34198
+ return { localPath: options.relativePath, absolutePath, download: { success: true } };
34199
+ } catch (error2) {
34200
+ return {
34201
+ download: {
34202
+ success: false,
34203
+ error: `Asset download failed: ${error2 instanceof Error ? error2.message : String(error2)}`
34161
34204
  }
34205
+ };
34206
+ }
34207
+ }
34208
+ function findFileByExtension(directory, extension) {
34209
+ const entries = fs15.readdirSync(directory, { withFileTypes: true }).sort((left, right) => left.name.localeCompare(right.name));
34210
+ for (const entry of entries) {
34211
+ const absolutePath = path16.join(directory, entry.name);
34212
+ if (entry.isDirectory()) {
34213
+ const nested = findFileByExtension(absolutePath, extension);
34214
+ if (nested) return nested;
34215
+ } else if (entry.isFile() && entry.name.toLowerCase().endsWith(extension)) {
34216
+ return absolutePath;
34162
34217
  }
34163
34218
  }
34164
- const renderedImageMaterialized = await materializeAsset({
34165
- targetDir: options.targetDir,
34166
- url: renderedImageUrl,
34167
- baseName: `${taskId || "3d_model"}_render`,
34168
- relativeDir: "assets/image",
34169
- extension: extensionFromUrl(renderedImageUrl) || "png",
34170
- now: options.now,
34171
- fetchImpl: options.fetchImpl
34219
+ return void 0;
34220
+ }
34221
+ function findExistingCreate3dAssetDelivery(options) {
34222
+ const registry2 = readGeneratedAssetRegistry(options.targetDir);
34223
+ const match = Object.entries(registry2).find(([, record3]) => {
34224
+ return record3.tool === CREATE_3D_ASSET_PROXY_TOOL_NAME && record3.assetId === options.assetId && record3.cdnUrl === options.remoteUrl && typeof record3.absolutePath === "string" && fs15.existsSync(record3.absolutePath);
34172
34225
  });
34173
- if (renderedImageMaterialized) {
34174
- changed = true;
34175
- nextPayload.renderedImageDownload = renderedImageMaterialized.download;
34176
- if ("localPath" in renderedImageMaterialized) {
34177
- nextPayload.renderedImageLocalPath = renderedImageMaterialized.localPath;
34178
- nextPayload.renderedImageAbsolutePath = renderedImageMaterialized.absolutePath;
34179
- if (renderedImageUrl) {
34180
- upsertGeneratedAssetRecord(options.targetDir, renderedImageMaterialized.localPath, {
34181
- tool: toolName,
34182
- name: `${taskId || "3d_model"}_render`,
34183
- assetKind: "render",
34184
- cdnUrl: renderedImageUrl,
34185
- previewUrl: renderedImageUrl,
34186
- localPath: renderedImageMaterialized.localPath,
34187
- absolutePath: renderedImageMaterialized.absolutePath,
34188
- createdAt: options.now.toISOString(),
34189
- taskId,
34190
- modelCdnUrl,
34191
- renderedImageUrl,
34192
- mdlConversionError
34193
- });
34226
+ if (!match) {
34227
+ return void 0;
34228
+ }
34229
+ const [localPath, record2] = match;
34230
+ return {
34231
+ localPath,
34232
+ absolutePath: record2.absolutePath,
34233
+ download: { success: true }
34234
+ };
34235
+ }
34236
+ function create3dAssetLocalDelivery(options) {
34237
+ if (!("localPath" in options.materialized)) {
34238
+ return {
34239
+ status: "failed",
34240
+ asset_id: options.assetId,
34241
+ model: {
34242
+ remote_url: options.remoteUrl,
34243
+ format: options.format,
34244
+ materialization: options.materialization,
34245
+ download: options.materialized.download
34194
34246
  }
34195
- }
34247
+ };
34196
34248
  }
34197
- return changed ? nextPayload : options.payload;
34249
+ return {
34250
+ status: "success",
34251
+ asset_id: options.assetId,
34252
+ model: {
34253
+ remote_url: options.remoteUrl,
34254
+ local_path: options.materialized.localPath,
34255
+ absolute_path: options.materialized.absolutePath,
34256
+ format: options.format,
34257
+ materialization: options.materialization,
34258
+ reused: options.reused,
34259
+ download: options.materialized.download
34260
+ }
34261
+ };
34198
34262
  }
34199
- function get3dTaskId(payload) {
34200
- return stringField2(payload.task_id) || stringField2(payload.taskId);
34263
+ function create3dAssetDeliveryFailure(assetId, remoteUrl, format, materialization, error2) {
34264
+ return {
34265
+ status: "failed",
34266
+ asset_id: assetId,
34267
+ model: {
34268
+ remote_url: remoteUrl,
34269
+ format,
34270
+ materialization,
34271
+ download: { success: false, error: error2 }
34272
+ }
34273
+ };
34201
34274
  }
34202
34275
  function persistMaterializedAsset(options) {
34203
34276
  const nextPayload = { ...options.payload, ...options.materialized };
@@ -34338,48 +34411,29 @@ function rewriteVideoReferenceAssetArgs(targetDir, args) {
34338
34411
  })
34339
34412
  };
34340
34413
  }
34341
- function rewrite3dModelAssetArgs(targetDir, args) {
34414
+ function rewriteCreate3dAssetArgs(targetDir, args) {
34415
+ if (!isRecord(args.payload) || !isRecord(args.payload.images)) {
34416
+ return args;
34417
+ }
34342
34418
  const registry2 = readGeneratedAssetRegistry(targetDir);
34343
34419
  const imageOptions = {
34344
34420
  assetDirs: IMAGE_ASSET_DIRS,
34345
34421
  mediaKind: "image",
34346
34422
  maxBytes: IMAGE_REFERENCE_MAX_BYTES
34347
34423
  };
34424
+ const images = args.payload.images;
34348
34425
  return {
34349
34426
  ...args,
34350
- image: rewriteGeneratedAssetReference(targetDir, args.image, registry2, imageOptions),
34351
- front_image: rewriteGeneratedAssetReference(
34352
- targetDir,
34353
- args.front_image,
34354
- registry2,
34355
- imageOptions
34356
- ),
34357
- left_image: rewriteGeneratedAssetReference(targetDir, args.left_image, registry2, imageOptions),
34358
- back_image: rewriteGeneratedAssetReference(targetDir, args.back_image, registry2, imageOptions),
34359
- right_image: rewriteGeneratedAssetReference(
34360
- targetDir,
34361
- args.right_image,
34362
- registry2,
34363
- imageOptions
34364
- ),
34365
- confirmed_image_paths: rewrite3dConfirmedImagePaths(
34366
- targetDir,
34367
- args.confirmed_image_paths,
34368
- registry2,
34369
- imageOptions
34370
- )
34371
- };
34372
- }
34373
- function rewrite3dConfirmedImagePaths(targetDir, value, registry2, options) {
34374
- if (!isRecord(value)) {
34375
- return value;
34376
- }
34377
- return {
34378
- ...value,
34379
- front: rewriteGeneratedAssetReference(targetDir, value.front, registry2, options),
34380
- left: rewriteGeneratedAssetReference(targetDir, value.left, registry2, options),
34381
- back: rewriteGeneratedAssetReference(targetDir, value.back, registry2, options),
34382
- right: rewriteGeneratedAssetReference(targetDir, value.right, registry2, options)
34427
+ payload: {
34428
+ ...args.payload,
34429
+ images: {
34430
+ ...images,
34431
+ front: rewriteGeneratedAssetReference(targetDir, images.front, registry2, imageOptions),
34432
+ left: rewriteGeneratedAssetReference(targetDir, images.left, registry2, imageOptions),
34433
+ back: rewriteGeneratedAssetReference(targetDir, images.back, registry2, imageOptions),
34434
+ right: rewriteGeneratedAssetReference(targetDir, images.right, registry2, imageOptions)
34435
+ }
34436
+ }
34383
34437
  };
34384
34438
  }
34385
34439
  function rewriteUrlObjectArray(targetDir, value, registry2, options) {
@@ -34546,6 +34600,10 @@ function resolveProjectRelativePath(targetDir, value) {
34546
34600
  }
34547
34601
  return void 0;
34548
34602
  }
34603
+ function isPathWithinDirectory(rootDir, candidatePath) {
34604
+ const relativePath = path16.relative(path16.resolve(rootDir), path16.resolve(candidatePath));
34605
+ return relativePath === "" || relativePath !== ".." && !relativePath.startsWith(`..${path16.sep}`) && !path16.isAbsolute(relativePath);
34606
+ }
34549
34607
  function dataUrlMimeForPath(filePath, mediaKind) {
34550
34608
  return DATA_URL_MIME_BY_EXTENSION[mediaKind][path16.extname(filePath).toLowerCase()];
34551
34609
  }
@@ -34767,7 +34825,7 @@ function applyDefaults(config2) {
34767
34825
  }
34768
34826
 
34769
34827
  // src/maker/server/mcp.ts
34770
- var VERSION = true ? "0.0.24" : "dev";
34828
+ var VERSION = true ? "0.0.25-beta.1" : "dev";
34771
34829
  var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
34772
34830
  var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
34773
34831
  var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
@@ -34782,8 +34840,7 @@ var MAKER_REMOTE_PROXY_EXPOSED_TOOL_NAMES = [
34782
34840
  "create_video_task",
34783
34841
  "query_video_task",
34784
34842
  "text_to_music",
34785
- "create_3d_model_task",
34786
- "query_3d_model_task",
34843
+ CREATE_3D_ASSET_PROXY_TOOL_NAME,
34787
34844
  "generate_test_qrcode",
34788
34845
  "get_ad_config",
34789
34846
  "get_debug_feedbacks"
@@ -35025,6 +35082,14 @@ function remoteProxyToolGuidance(toolName) {
35025
35082
  "**Maker asset workflow hint:** Prefer this Maker MCP proxy tool for Maker music generation so generated audio can be materialized into the project and recorded for later Maker references.",
35026
35083
  failurePolicy
35027
35084
  ].join(" ");
35085
+ case CREATE_3D_ASSET_PROXY_TOOL_NAME:
35086
+ return [
35087
+ "**Maker asset workflow hint:** Use this tool for the complete Maker 3D asset lifecycle: start, query, continue after explicit user review, inspect options, and post-process completed assets.",
35088
+ "Local image paths in payload.images are forwarded as data URLs when they resolve inside the Maker project. Unknown server response fields are preserved. In local runtime query results, model_files copy/extract instructions are materialized into assets/model and local_delivery reports the usable local model path.",
35089
+ "Review preview URLs are materialized into assets/image and returned in preview_assets when possible.",
35090
+ 'Do not automatically approve review steps; show the returned previews to the user and wait for explicit confirmation before action="continue".',
35091
+ failurePolicy
35092
+ ].join(" ");
35028
35093
  case "get_ad_config":
35029
35094
  return [
35030
35095
  "**Maker hint:** Trigger this tool for any ad-related request (广告, 激励视频, 播放广告, ad ID, ad placement, ShowRewardVideoAd, ad status, or ad config). Call it first to get the current Maker project ad activation status and ad config; do not infer ad readiness from local SDK docs, .maker-mcp/config.json, or runtime callbacks. If .project/project.json is missing, build the project once with maker_build_current_directory to initialize it, then call this tool again. If this tool says app_id or developer_id is missing, call generate_test_qrcode once to generate test QR code metadata, then call this tool again.",
@@ -37017,19 +37082,37 @@ function formatToolException(toolName, error2) {
37017
37082
  ].join("\n");
37018
37083
  }
37019
37084
  if (error2 instanceof RemoteProxyToolResultError) {
37085
+ const displayResult = flattenNestedMcpErrorPrefixes(error2.result);
37086
+ const remoteMessage = extractRemoteProxyErrorMessage(displayResult);
37020
37087
  return [
37021
37088
  "✗ Maker MCP proxy tool failed",
37022
37089
  "",
37023
37090
  `- tool: ${toolName}`,
37024
37091
  "- reason: remote_proxy_tool_result_error",
37025
37092
  `- error_name: ${error2.name}`,
37026
- `- message: ${firstLine(error2.message)}`,
37093
+ `- message: ${remoteMessage ?? firstLine(error2.message)}`,
37027
37094
  "",
37028
- formatRemoteProxyToolResult(error2.result),
37095
+ formatRemoteProxyToolResult(displayResult),
37029
37096
  "",
37030
37097
  "next_action: 远端 proxy tool 已返回失败结果;请把 remote_result 原样反馈给开发者,方便排查 server 返回内容。"
37031
37098
  ].join("\n");
37032
37099
  }
37100
+ if (isExposedRemoteProxyTool(toolName)) {
37101
+ return [
37102
+ "✗ Maker MCP proxy tool failed",
37103
+ "",
37104
+ `- tool: ${toolName}`,
37105
+ "- reason: remote_proxy_tool_call_error",
37106
+ `- error_name: ${error2 instanceof Error ? error2.name : typeof error2}`,
37107
+ `- message: ${stripNestedMcpErrorPrefixes(message)}`,
37108
+ ...formatUnknownExceptionDetailLines(error2),
37109
+ "",
37110
+ "debug:",
37111
+ stack ? indent2(stack) : indent2(message),
37112
+ "",
37113
+ "next_action: 请根据上面的简化 message 判断失败原因;参数或能力不支持时不要重复调用,并保留 error_details/debug 反馈给开发者。"
37114
+ ].join("\n");
37115
+ }
37033
37116
  return [
37034
37117
  "✗ Maker MCP tool failed",
37035
37118
  "",
@@ -37044,6 +37127,68 @@ function formatToolException(toolName, error2) {
37044
37127
  "next_action: 请把上面的完整错误反馈给开发者;如果本地已有 commit 但 push 未完成,不要重复 commit,直接重试 maker_build_current_directory。"
37045
37128
  ].join("\n");
37046
37129
  }
37130
+ function stripNestedMcpErrorPrefixes(message) {
37131
+ const prefix = /^MCP error -?\d+:\s*/i;
37132
+ let concise = message.trim();
37133
+ while (prefix.test(concise)) {
37134
+ concise = concise.replace(prefix, "");
37135
+ }
37136
+ return concise || message;
37137
+ }
37138
+ function flattenNestedMcpErrorPrefixes(value) {
37139
+ if (typeof value === "string") {
37140
+ return stripNestedMcpErrorPrefixes(value);
37141
+ }
37142
+ if (Array.isArray(value)) {
37143
+ return value.map((item) => flattenNestedMcpErrorPrefixes(item));
37144
+ }
37145
+ if (isPlainRecord(value)) {
37146
+ return Object.fromEntries(
37147
+ Object.entries(value).map(([key, nestedValue]) => [
37148
+ key,
37149
+ flattenNestedMcpErrorPrefixes(nestedValue)
37150
+ ])
37151
+ );
37152
+ }
37153
+ return value;
37154
+ }
37155
+ function extractRemoteProxyErrorMessage(result) {
37156
+ if (!isPlainRecord(result) || !Array.isArray(result.content)) {
37157
+ return void 0;
37158
+ }
37159
+ for (const item of result.content) {
37160
+ if (!isPlainRecord(item) || typeof item.text !== "string") {
37161
+ continue;
37162
+ }
37163
+ const text = item.text.trim();
37164
+ if (!text) {
37165
+ continue;
37166
+ }
37167
+ try {
37168
+ const parsed = JSON.parse(text);
37169
+ const structuredMessage = extractStructuredErrorMessage(parsed);
37170
+ if (structuredMessage) {
37171
+ return firstLine(structuredMessage);
37172
+ }
37173
+ return void 0;
37174
+ } catch {
37175
+ return firstLine(text);
37176
+ }
37177
+ }
37178
+ return void 0;
37179
+ }
37180
+ function extractStructuredErrorMessage(value) {
37181
+ if (!isPlainRecord(value)) {
37182
+ return void 0;
37183
+ }
37184
+ for (const key of ["message", "error", "detail"]) {
37185
+ const candidate = value[key];
37186
+ if (typeof candidate === "string" && candidate.trim()) {
37187
+ return stripNestedMcpErrorPrefixes(candidate);
37188
+ }
37189
+ }
37190
+ return void 0;
37191
+ }
37047
37192
  function firstLine(value) {
37048
37193
  return value.split("\n")[0] || value;
37049
37194
  }
@@ -37245,7 +37390,7 @@ function formatError2(error2) {
37245
37390
  }
37246
37391
 
37247
37392
  // src/maker/cli/commands.ts
37248
- var VERSION2 = true ? "0.0.24" : "dev";
37393
+ var VERSION2 = true ? "0.0.25-beta.1" : "dev";
37249
37394
  var DEFAULT_MCP_NAME = "taptap-maker";
37250
37395
  var MAKER_NPM_PACKAGE = "@taptap/maker";
37251
37396
  var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs", "python", "lua-lsp", "agents"]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taptap/maker",
3
- "version": "0.0.24",
3
+ "version": "0.0.25-beta.1",
4
4
  "type": "module",
5
5
  "description": "TapTap Maker local development CLI and MCP server",
6
6
  "main": "dist/maker.js",
@@ -152,8 +152,13 @@ This guidance helps users prefer Maker-managed tools for Maker game assets.
152
152
  - Local proxy may convert resolvable local reference media to data URLs before forwarding.
153
153
  - If a Maker proxy tool returns an error or `isError`, report the full remote result/error payload.
154
154
  Include the server response payload so developers can diagnose the issue.
155
- - Use `create_3d_model_task` for game 3D models.
156
- - Use `query_3d_model_task` for polling 3D model tasks.
155
+ - Use `create_3d_asset` for the complete 3D asset lifecycle. Start with `action="start"`, poll
156
+ with `action="query"`, and use `action="continue"` only after explicit user approval of a
157
+ returned review step. Use `action="post_process"` for rigging, texturing, retopology, or format
158
+ conversion when supported by the remote schema.
159
+ - Preserve and inspect the complete remote 3D response. When `local_delivery.status` is `success`,
160
+ use the returned local model path. The local proxy materializes only the `model_files` copy/extract
161
+ instructions returned by the local runtime; report `delivery_failures` when no model can be delivered.
157
162
  - For any ad-related request such as 广告, rewarded videos, play ads, ad ID, ad placement,
158
163
  ad status, ad config, or `ShowRewardVideoAd`, call `get_ad_config` first to get the
159
164
  current project ad activation status and ad config.
@@ -179,10 +184,10 @@ This guidance helps users prefer Maker-managed tools for Maker game assets.
179
184
  - Do not call `edit_image` without an image path or CDN URL.
180
185
 
181
186
  Generated assets should be saved by Maker MCP under `assets/image`, `assets/video`, or
182
- `assets/audio`; generated 3D model outputs save the original GLB/FBX and MDL zip under
183
- `assets/model`, then extract MDL contents into `assets/Meshes`, `assets/Materials`,
184
- `assets/Textures`, and `assets/Prefabs`. Do not prefer client-native image generation when the user
185
- is asking for Maker game assets in a bound project.
187
+ `assets/audio`. `create_3d_asset` local runtime `model_files` instructions are materialized under
188
+ `assets/model`; use `local_delivery` for the usable model path and `preview_assets` for local review images.
189
+ Do not prefer client-native image generation when the user is asking for Maker game assets in a
190
+ bound project.
186
191
 
187
192
  ## Project Detection
188
193
 
@@ -230,8 +235,8 @@ directory.
230
235
  ### Proxy Tools Missing From The Current Session
231
236
 
232
237
  If the user is in a bound Maker project but `generate_image`, `batch_generate_images`, `edit_image`,
233
- `create_video_task`, `query_video_task`, `text_to_music`, `create_3d_model_task`,
234
- `query_3d_model_task`, `generate_test_qrcode`, `get_ad_config`, or `get_debug_feedbacks`
238
+ `create_video_task`, `query_video_task`, `text_to_music`, `create_3d_asset`,
239
+ `generate_test_qrcode`, `get_ad_config`, or `get_debug_feedbacks`
235
240
  are missing from the current AI tool list, diagnose the MCP cwd before
236
241
  suggesting repeated restarts:
237
242