@taptap/maker 0.0.18-beta.1 → 0.0.18

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
@@ -26,4 +26,4 @@ This package contains only the Maker CLI/MCP bundle and Maker workflow skills.
26
26
  It does not include the legacy TapTap Open API MCP server, proxy, native signer,
27
27
  or OpenClaw plugin package contents.
28
28
 
29
- Version: 0.0.18-beta.1
29
+ Version: 0.0.18
package/dist/maker.js CHANGED
@@ -29437,33 +29437,28 @@ function createMakerAssetPolicyBlock() {
29437
29437
  MAKER_ASSET_POLICY_BEGIN,
29438
29438
  "",
29439
29439
  "This is a bound TapTap Maker project. For game asset generation or editing in this project,",
29440
- "the local AI/Agent MUST use Maker MCP proxy tools first:",
29440
+ "the local AI/Agent should prefer Maker MCP proxy tools when they are available:",
29441
29441
  "",
29442
29442
  "- `generate_image` for one image asset.",
29443
29443
  "- `batch_generate_images` for multiple image assets.",
29444
29444
  "- `edit_image` for modifying existing project images.",
29445
29445
  "- `create_video_task` for game video assets or referenced image/video generation.",
29446
+ "- `query_video_task` for refreshing video task status and fetching completed videos.",
29446
29447
  "- `text_to_music` for game music or audio assets.",
29447
- "- `create_3d_model_task` for game 3D model assets.",
29448
- "- `query_3d_model_task` for polling 3D model tasks.",
29449
29448
  "",
29450
- "Before calling `edit_image`, resolve dragged or referenced images to a local project image path",
29451
- "or CDN URL first. If the user references an attached/local image, inspect the attachment or",
29452
- "workspace file path before calling the tool.",
29453
- "If the image is under `assets/image`, pass that path. If only a file name is given, search",
29454
- "`assets/image` for the matching file. Do not call `edit_image` without an image path or CDN URL.",
29449
+ "Follow each Maker tool schema for supported local path, remote URL, and data URL inputs.",
29450
+ "If the user references attached/local media, inspect the attachment or workspace file path",
29451
+ "before calling the tool. Local proxy may convert resolvable local reference media to data URLs",
29452
+ "before forwarding to the remote Maker MCP server.",
29455
29453
  "",
29456
- "This policy overrides imagegen, built-in image tools, built-in video tools, built-in audio",
29457
- "tools, and other client-native media generation for Maker game assets.",
29454
+ "If the required Maker proxy tool is not exposed in the current AI session, explain that the",
29455
+ "Maker proxy tool is unavailable and suggest checking/reconnecting the Maker MCP session.",
29456
+ "Other client media tools may still be usable when their output is passed back through a supported",
29457
+ "local path, remote URL, or data URL input.",
29458
29458
  "",
29459
- "DO NOT invoke imagegen or native media tools for Maker game assets when the Maker proxy tool is",
29460
- "callable. If the required Maker proxy tool is not exposed in the current AI session, stop and",
29461
- "tell the user to restart/check the Maker MCP session. DO NOT fall back to generic imagegen or",
29462
- "native media generation unless the user explicitly asks to leave the Maker asset workflow.",
29463
- "",
29464
- "Generated assets must stay in the Maker project asset workflow under `assets/image`,",
29465
- "`assets/video`, `assets/audio`, or `assets/model`, with CDN mappings preserved for later edits",
29466
- "and builds.",
29459
+ "Generated Maker proxy assets should stay in the Maker project asset workflow under",
29460
+ "`assets/image`, `assets/video`, or `assets/audio`, with remote mappings preserved for later",
29461
+ "edits and builds.",
29467
29462
  "",
29468
29463
  MAKER_ASSET_POLICY_END
29469
29464
  ].join("\n");
@@ -29680,7 +29675,7 @@ async function downloadAndExtractDevKit(url2, fetchImpl = fetch, timeoutMs = DEF
29680
29675
  fs5.rmSync(zipPath, { force: true });
29681
29676
  return tempDir;
29682
29677
  }
29683
- function extractZip(zipPath, targetDir, label = "AI dev kit") {
29678
+ function extractZip(zipPath, targetDir) {
29684
29679
  if (process.platform === "win32") {
29685
29680
  const result = spawnSync2(
29686
29681
  "powershell.exe",
@@ -29697,11 +29692,11 @@ function extractZip(zipPath, targetDir, label = "AI dev kit") {
29697
29692
  { encoding: "utf8" }
29698
29693
  );
29699
29694
  if (result.status !== 0) {
29700
- throw new Error(`Failed to extract ${label} zip: ${formatSpawnFailure(result)}`);
29695
+ throw new Error(`Failed to extract AI dev kit zip: ${formatSpawnFailure(result)}`);
29701
29696
  }
29702
29697
  return;
29703
29698
  }
29704
- const unzipResult = spawnSync2("unzip", ["-oq", zipPath, "-d", targetDir], { encoding: "utf8" });
29699
+ const unzipResult = spawnSync2("unzip", ["-q", zipPath, "-d", targetDir], { encoding: "utf8" });
29705
29700
  if (unzipResult.status === 0) {
29706
29701
  return;
29707
29702
  }
@@ -29719,7 +29714,7 @@ function extractZip(zipPath, targetDir, label = "AI dev kit") {
29719
29714
  }
29720
29715
  throw new Error(
29721
29716
  [
29722
- `Failed to extract ${label} zip: unzip: ${formatSpawnFailure(unzipResult)}`,
29717
+ `Failed to extract AI dev kit zip: unzip: ${formatSpawnFailure(unzipResult)}`,
29723
29718
  ...pythonFailures
29724
29719
  ].join("; ")
29725
29720
  );
@@ -29934,35 +29929,6 @@ async function listMakerProjects(options) {
29934
29929
  }
29935
29930
  return normalizeProjectsResponse(json2);
29936
29931
  }
29937
- async function createMakerProject(options) {
29938
- const name = options.name.trim();
29939
- if (!name) {
29940
- throw new Error("Maker project name is required.");
29941
- }
29942
- const response = await fetch(`${getMakerApiBase()}/apps`, {
29943
- method: "POST",
29944
- headers: {
29945
- Authorization: `Bearer ${options.pat}`,
29946
- Accept: "application/json",
29947
- "Content-Type": "application/json"
29948
- },
29949
- body: JSON.stringify({
29950
- name,
29951
- gameType: options.gameType || "sce"
29952
- })
29953
- });
29954
- const json2 = await response.json();
29955
- if (!response.ok) {
29956
- throw new Error(`Maker project create failed: HTTP ${response.status} ${JSON.stringify(json2)}`);
29957
- }
29958
- const body = json2;
29959
- const projects = normalizeProjectsResponse(body.app ? { apps: [body.app] } : json2);
29960
- const project = projects[0];
29961
- if (!(project == null ? void 0 : project.id)) {
29962
- throw new Error(`Maker project create returned no app id: ${JSON.stringify(json2)}`);
29963
- }
29964
- return project;
29965
- }
29966
29932
  async function cloneMakerProject(options) {
29967
29933
  var _a3, _b, _c, _d, _e, _f, _g, _h;
29968
29934
  const target = path7.resolve(options.targetDir);
@@ -32223,16 +32189,12 @@ function formatMakerSkillStatus(_options = {}) {
32223
32189
  "Maker creative asset tool policy",
32224
32190
  `- entry: ${MAKER_LOCAL_SKILL_NAME} > Maker Creative Asset Tool Policy`,
32225
32191
  "- Prefer Maker MCP proxy tools over native AI image/video/audio tools for bound Maker projects.",
32226
- "- This policy overrides generic imagegen or native media skills for Maker game assets.",
32227
- "- Do not invoke imagegen, built-in image/video/audio tools, or other native media generation.",
32228
- "- Do not fall back to generic imagegen when Maker proxy tools are unavailable in the session.",
32192
+ "- If Maker proxy tools are missing, explain the session/configuration issue and available alternatives.",
32229
32193
  "- Use generate_image, batch_generate_images, edit_image for game image assets.",
32230
- "- Use create_video_task and text_to_music for game video/audio assets.",
32231
- "- Use create_3d_model_task and query_3d_model_task for game 3D model assets.",
32232
- "- Generated assets are saved under assets/image, assets/video, assets/audio, or assets/model with CDN mappings.",
32233
- "- Before edit_image, resolve dragged or referenced images to a local project image path or CDN URL.",
32234
- "- If only a file name is given, search assets/image for the matching file before calling edit_image.",
32235
- "- Do not call edit_image without an image path or CDN URL.",
32194
+ "- Use create_video_task, query_video_task, and text_to_music for game video/audio assets.",
32195
+ "- Generated assets are saved under assets/image, assets/video, or assets/audio with remote mappings.",
32196
+ "- Follow each tool schema for supported local path, remote URL, and data URL inputs.",
32197
+ "- Local proxy may convert resolvable local reference media to data URLs before forwarding.",
32236
32198
  "Maker initialization next_step: execute `taptap-maker init`.",
32237
32199
  "Load these documents when the current AI client supports reading local guide files."
32238
32200
  ].join("\n");
@@ -32642,8 +32604,41 @@ import path12 from "node:path";
32642
32604
  var IMAGE_ASSET_DIRS = ["assets/image"];
32643
32605
  var VIDEO_ASSET_DIRS = ["assets/video"];
32644
32606
  var AUDIO_ASSET_DIRS = ["assets/audio"];
32645
- var MODEL_ASSET_DIRS = ["assets/model"];
32646
- var THREE_D_MODEL_VIEWS = ["front", "left", "back", "right"];
32607
+ var IMAGE_REFERENCE_MAX_BYTES = 10 * 1024 * 1024;
32608
+ var VIDEO_TASK_IMAGE_REFERENCE_MAX_BYTES = 30 * 1024 * 1024;
32609
+ var VIDEO_REFERENCE_MAX_BYTES = 50 * 1024 * 1024;
32610
+ var AUDIO_REFERENCE_MAX_BYTES = 15 * 1024 * 1024;
32611
+ var DATA_URL_MIME_BY_EXTENSION = {
32612
+ image: {
32613
+ ".gif": "image/gif",
32614
+ ".jpeg": "image/jpeg",
32615
+ ".jpg": "image/jpeg",
32616
+ ".png": "image/png",
32617
+ ".webp": "image/webp"
32618
+ },
32619
+ video: {
32620
+ ".mov": "video/quicktime",
32621
+ ".mp4": "video/mp4"
32622
+ },
32623
+ audio: {
32624
+ ".mp3": "audio/mpeg",
32625
+ ".wav": "audio/wav"
32626
+ }
32627
+ };
32628
+ var RemoteProxyToolResultError = class extends Error {
32629
+ constructor(toolName, result) {
32630
+ super(
32631
+ [
32632
+ `Remote proxy tool ${toolName} returned an error result.`,
32633
+ "",
32634
+ formatRemoteProxyToolResult(result)
32635
+ ].join("\n")
32636
+ );
32637
+ this.name = "RemoteProxyToolResultError";
32638
+ this.toolName = toolName;
32639
+ this.result = result;
32640
+ }
32641
+ };
32647
32642
  function prepareRemoteProxyToolArgs(options) {
32648
32643
  if (options.toolName === "edit_image") {
32649
32644
  return rewriteEditImageAssetArgs(options.targetDir, options.args);
@@ -32651,15 +32646,18 @@ function prepareRemoteProxyToolArgs(options) {
32651
32646
  if (options.toolName === "generate_image") {
32652
32647
  return normalizeImageReferenceAssetArgs(options.targetDir, options.args);
32653
32648
  }
32649
+ if (options.toolName === "batch_generate_images") {
32650
+ return normalizeBatchImageReferenceAssetArgs(options.targetDir, options.args);
32651
+ }
32654
32652
  if (options.toolName === "create_video_task") {
32655
32653
  return rewriteVideoReferenceAssetArgs(options.targetDir, options.args);
32656
32654
  }
32657
- if (options.toolName === "create_3d_model_task") {
32658
- return rewrite3dModelAssetArgs(options.targetDir, options.args);
32659
- }
32660
32655
  return options.args;
32661
32656
  }
32662
32657
  async function materializeRemoteProxyToolAssets(options) {
32658
+ if (isRemoteProxyToolErrorResult(options.result)) {
32659
+ throw new RemoteProxyToolResultError(options.toolName, options.result);
32660
+ }
32663
32661
  if (!shouldMaterializeRemoteProxyTool(options.toolName)) {
32664
32662
  return options.result;
32665
32663
  }
@@ -32704,14 +32702,29 @@ function shouldMaterializeRemoteProxyTool(toolName) {
32704
32702
  "batch_generate_images",
32705
32703
  "edit_image",
32706
32704
  "create_video_task",
32707
- "text_to_music",
32708
- "create_3d_model_task",
32709
- "query_3d_model_task"
32705
+ "query_video_task",
32706
+ "text_to_music"
32710
32707
  ].includes(toolName);
32711
32708
  }
32712
32709
  function isTextContent(item) {
32713
32710
  return typeof item === "object" && item !== null && item.type === "text" && typeof item.text === "string";
32714
32711
  }
32712
+ function isRemoteProxyToolErrorResult(result) {
32713
+ return Boolean(result.isError);
32714
+ }
32715
+ function formatRemoteProxyToolResult(result) {
32716
+ return ["remote_result:", indent(formatUnknownForDiagnostics(result))].join("\n");
32717
+ }
32718
+ function formatUnknownForDiagnostics(value) {
32719
+ try {
32720
+ return JSON.stringify(value, null, 2) || String(value);
32721
+ } catch {
32722
+ return String(value);
32723
+ }
32724
+ }
32725
+ function indent(value) {
32726
+ return value.split("\n").map((line) => ` ${line}`).join("\n");
32727
+ }
32715
32728
  function parseJsonObject(text) {
32716
32729
  try {
32717
32730
  const parsed = JSON.parse(text);
@@ -32730,15 +32743,12 @@ async function materializeParsedProxyResult(options) {
32730
32743
  if (options.toolName === "edit_image") {
32731
32744
  return await materializeSingleImageResult(options, "edit_image");
32732
32745
  }
32733
- if (options.toolName === "create_video_task") {
32734
- return await materializeVideoResult(options);
32746
+ if (options.toolName === "create_video_task" || options.toolName === "query_video_task") {
32747
+ return await materializeVideoResult(options, options.toolName);
32735
32748
  }
32736
32749
  if (options.toolName === "text_to_music") {
32737
32750
  return await materializeMusicResult(options);
32738
32751
  }
32739
- if (options.toolName === "create_3d_model_task" || options.toolName === "query_3d_model_task") {
32740
- return await materialize3dModelResult(options, options.toolName);
32741
- }
32742
32752
  return options.payload;
32743
32753
  }
32744
32754
  async function materializeSingleImageResult(options, toolName) {
@@ -32795,14 +32805,27 @@ async function materializeBatchImageResult(options) {
32795
32805
  }
32796
32806
  return { ...options.payload, results };
32797
32807
  }
32798
- async function materializeVideoResult(options) {
32808
+ async function materializeVideoResult(options, toolName) {
32799
32809
  if (options.payload.status !== "succeeded") {
32800
32810
  return options.payload;
32801
32811
  }
32812
+ const taskId = stringField2(options.payload.task_id);
32813
+ const cdnUrl = stringField2(options.payload.cdn_url);
32814
+ const existing = findExistingMaterializedVideo(options.targetDir, {
32815
+ taskId,
32816
+ cdnUrl
32817
+ });
32818
+ if (existing) {
32819
+ return {
32820
+ ...options.payload,
32821
+ ...existing,
32822
+ download: { success: true }
32823
+ };
32824
+ }
32802
32825
  const materialized = await materializeAsset({
32803
32826
  targetDir: options.targetDir,
32804
- url: stringField2(options.payload.cdn_url),
32805
- baseName: stringField2(options.payload.task_id),
32827
+ url: cdnUrl,
32828
+ baseName: taskId,
32806
32829
  relativeDir: "assets/video",
32807
32830
  extension: "mp4",
32808
32831
  now: options.now,
@@ -32810,16 +32833,51 @@ async function materializeVideoResult(options) {
32810
32833
  });
32811
32834
  return materialized ? persistMaterializedAsset({
32812
32835
  targetDir: options.targetDir,
32813
- toolName: "create_video_task",
32836
+ toolName,
32814
32837
  payload: options.payload,
32815
32838
  materialized,
32816
32839
  cdnUrl: stringField2(options.payload.cdn_url),
32817
32840
  now: options.now,
32818
32841
  extraRegistryFields: {
32819
- taskId: stringField2(options.payload.task_id)
32842
+ taskId
32820
32843
  }
32821
32844
  }) : options.payload;
32822
32845
  }
32846
+ function findExistingMaterializedVideo(targetDir, options) {
32847
+ if (!options.taskId || !options.cdnUrl) {
32848
+ return void 0;
32849
+ }
32850
+ const registry2 = readGeneratedAssetRegistry(targetDir);
32851
+ for (const record2 of Object.values(registry2)) {
32852
+ const localPath = stringField2(record2.localPath);
32853
+ const recordCdnUrl = stringField2(record2.cdnUrl) || stringField2(record2.previewUrl);
32854
+ if (stringField2(record2.taskId) !== options.taskId || recordCdnUrl !== options.cdnUrl || !localPath.startsWith("assets/video/")) {
32855
+ continue;
32856
+ }
32857
+ const absolutePath = resolveExistingMaterializedAssetPath(targetDir, record2, localPath);
32858
+ if (absolutePath) {
32859
+ return { localPath, absolutePath };
32860
+ }
32861
+ }
32862
+ return void 0;
32863
+ }
32864
+ function resolveExistingMaterializedAssetPath(targetDir, record2, localPath) {
32865
+ const candidates = [];
32866
+ const absolutePath = stringField2(record2.absolutePath);
32867
+ if (absolutePath && path12.isAbsolute(absolutePath)) {
32868
+ candidates.push(absolutePath);
32869
+ }
32870
+ candidates.push(path12.join(targetDir, ...localPath.split("/")));
32871
+ for (const candidate of candidates) {
32872
+ try {
32873
+ if (fs11.statSync(candidate).isFile()) {
32874
+ return candidate;
32875
+ }
32876
+ } catch {
32877
+ }
32878
+ }
32879
+ return void 0;
32880
+ }
32823
32881
  async function materializeMusicResult(options) {
32824
32882
  if (options.payload.success !== true) {
32825
32883
  return options.payload;
@@ -32852,155 +32910,6 @@ async function materializeMusicResult(options) {
32852
32910
  })
32853
32911
  } : options.payload;
32854
32912
  }
32855
- async function materialize3dModelResult(options, toolName) {
32856
- if (options.payload.phase === 1) {
32857
- return await materialize3dPreviewResult(options);
32858
- }
32859
- return await materialize3dFinalResult(options, toolName);
32860
- }
32861
- async function materialize3dPreviewResult(options) {
32862
- if (!isRecord(options.payload.preview_urls)) {
32863
- return options.payload;
32864
- }
32865
- let changed = false;
32866
- const previewAssets = {};
32867
- const taskId = get3dTaskId(options.payload);
32868
- const mode = stringField2(options.payload.mode);
32869
- for (const view of THREE_D_MODEL_VIEWS) {
32870
- const url2 = stringField2(options.payload.preview_urls[view]);
32871
- const materialized = await materializeAsset({
32872
- targetDir: options.targetDir,
32873
- url: url2,
32874
- baseName: `${taskId || "3d_model"}_${view}`,
32875
- relativeDir: "assets/image",
32876
- extension: extensionFromUrl(url2) || "png",
32877
- now: options.now,
32878
- fetchImpl: options.fetchImpl
32879
- });
32880
- if (!materialized) {
32881
- continue;
32882
- }
32883
- changed = true;
32884
- previewAssets[view] = { ...materialized, cdnUrl: url2 };
32885
- if ("localPath" in materialized && url2) {
32886
- upsertGeneratedAssetRecord(options.targetDir, materialized.localPath, {
32887
- tool: "create_3d_model_task",
32888
- name: `${taskId || "3d_model"}_${view}`,
32889
- cdnUrl: url2,
32890
- previewUrl: url2,
32891
- localPath: materialized.localPath,
32892
- absolutePath: materialized.absolutePath,
32893
- createdAt: options.now.toISOString(),
32894
- taskId,
32895
- mode,
32896
- phase: 1,
32897
- view
32898
- });
32899
- }
32900
- }
32901
- return {
32902
- ...options.payload,
32903
- ...changed ? { preview_assets: previewAssets } : {},
32904
- ...create3dPreviewReviewGuidance()
32905
- };
32906
- }
32907
- function create3dPreviewReviewGuidance() {
32908
- return {
32909
- workflow_state: "awaiting_user_review",
32910
- user_review_required: true,
32911
- next_action: "Show the four-view previews to the user and ask whether they approve them or want changes.",
32912
- 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.",
32913
- 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.",
32914
- 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."
32915
- };
32916
- }
32917
- async function materialize3dFinalResult(options, toolName) {
32918
- if (options.payload.status !== "success") {
32919
- return options.payload;
32920
- }
32921
- let changed = false;
32922
- const nextPayload = { ...options.payload };
32923
- const taskId = get3dTaskId(options.payload);
32924
- const modelCdnUrl = stringField2(options.payload.model_cdn_url);
32925
- const renderedImageUrl = stringField2(options.payload.rendered_image_url);
32926
- const mdlConversionError = stringField2(options.payload.mdl_conversion_error);
32927
- const mdlUrl = stringField2(options.payload.mdl_cdn_url);
32928
- const mdlMaterialized = await materializeAsset({
32929
- targetDir: options.targetDir,
32930
- url: mdlUrl,
32931
- baseName: taskId || "3d_model",
32932
- relativeDir: MODEL_ASSET_DIRS[0],
32933
- extension: extensionFromUrl(mdlUrl) || "zip",
32934
- now: options.now,
32935
- fetchImpl: options.fetchImpl
32936
- });
32937
- if (mdlMaterialized) {
32938
- changed = true;
32939
- nextPayload.mdlDownload = mdlMaterialized.download;
32940
- if ("localPath" in mdlMaterialized) {
32941
- nextPayload.mdlLocalPath = mdlMaterialized.localPath;
32942
- nextPayload.mdlAbsolutePath = mdlMaterialized.absolutePath;
32943
- extractZip(
32944
- mdlMaterialized.absolutePath,
32945
- path12.join(options.targetDir, "assets"),
32946
- "3D model asset"
32947
- );
32948
- nextPayload.mdlExtracted = true;
32949
- nextPayload.mdlExtractedTo = "assets";
32950
- if (mdlUrl) {
32951
- upsertGeneratedAssetRecord(options.targetDir, mdlMaterialized.localPath, {
32952
- tool: toolName,
32953
- name: taskId,
32954
- cdnUrl: mdlUrl,
32955
- previewUrl: renderedImageUrl || mdlUrl,
32956
- localPath: mdlMaterialized.localPath,
32957
- absolutePath: mdlMaterialized.absolutePath,
32958
- createdAt: options.now.toISOString(),
32959
- taskId,
32960
- modelCdnUrl,
32961
- renderedImageUrl,
32962
- mdlConversionError
32963
- });
32964
- }
32965
- }
32966
- }
32967
- const renderedImageMaterialized = await materializeAsset({
32968
- targetDir: options.targetDir,
32969
- url: renderedImageUrl,
32970
- baseName: `${taskId || "3d_model"}_render`,
32971
- relativeDir: "assets/image",
32972
- extension: extensionFromUrl(renderedImageUrl) || "png",
32973
- now: options.now,
32974
- fetchImpl: options.fetchImpl
32975
- });
32976
- if (renderedImageMaterialized) {
32977
- changed = true;
32978
- nextPayload.renderedImageDownload = renderedImageMaterialized.download;
32979
- if ("localPath" in renderedImageMaterialized) {
32980
- nextPayload.renderedImageLocalPath = renderedImageMaterialized.localPath;
32981
- nextPayload.renderedImageAbsolutePath = renderedImageMaterialized.absolutePath;
32982
- if (renderedImageUrl) {
32983
- upsertGeneratedAssetRecord(options.targetDir, renderedImageMaterialized.localPath, {
32984
- tool: toolName,
32985
- name: `${taskId || "3d_model"}_render`,
32986
- cdnUrl: renderedImageUrl,
32987
- previewUrl: renderedImageUrl,
32988
- localPath: renderedImageMaterialized.localPath,
32989
- absolutePath: renderedImageMaterialized.absolutePath,
32990
- createdAt: options.now.toISOString(),
32991
- taskId,
32992
- modelCdnUrl,
32993
- renderedImageUrl,
32994
- mdlConversionError
32995
- });
32996
- }
32997
- }
32998
- }
32999
- return changed ? nextPayload : options.payload;
33000
- }
33001
- function get3dTaskId(payload) {
33002
- return stringField2(payload.task_id) || stringField2(payload.taskId);
33003
- }
33004
32913
  function persistMaterializedAsset(options) {
33005
32914
  const nextPayload = { ...options.payload, ...options.materialized };
33006
32915
  if (!("localPath" in options.materialized) || !options.cdnUrl) {
@@ -33071,9 +32980,17 @@ function rewriteEditImageAssetArgs(targetDir, args) {
33071
32980
  const registry2 = readGeneratedAssetRegistry(targetDir);
33072
32981
  return {
33073
32982
  ...args,
33074
- image: rewriteGeneratedAssetReference(targetDir, args.image, registry2, IMAGE_ASSET_DIRS),
32983
+ image: rewriteGeneratedAssetReference(targetDir, args.image, registry2, {
32984
+ assetDirs: IMAGE_ASSET_DIRS,
32985
+ mediaKind: "image",
32986
+ maxBytes: IMAGE_REFERENCE_MAX_BYTES
32987
+ }),
33075
32988
  reference_images: Array.isArray(args.reference_images) ? args.reference_images.map(
33076
- (item) => rewriteGeneratedAssetReference(targetDir, item, registry2, IMAGE_ASSET_DIRS)
32989
+ (item) => rewriteGeneratedAssetReference(targetDir, item, registry2, {
32990
+ assetDirs: IMAGE_ASSET_DIRS,
32991
+ mediaKind: "image",
32992
+ maxBytes: IMAGE_REFERENCE_MAX_BYTES
32993
+ })
33077
32994
  ) : args.reference_images
33078
32995
  };
33079
32996
  }
@@ -33081,94 +32998,89 @@ function normalizeImageReferenceAssetArgs(targetDir, args) {
33081
32998
  const registry2 = readGeneratedAssetRegistry(targetDir);
33082
32999
  return {
33083
33000
  ...args,
33084
- image: normalizeLocalAssetReference(targetDir, args.image, registry2, IMAGE_ASSET_DIRS),
33001
+ image: rewriteGeneratedAssetReference(targetDir, args.image, registry2, {
33002
+ assetDirs: IMAGE_ASSET_DIRS,
33003
+ mediaKind: "image",
33004
+ maxBytes: IMAGE_REFERENCE_MAX_BYTES
33005
+ }),
33006
+ reference_image: rewriteGeneratedAssetReference(targetDir, args.reference_image, registry2, {
33007
+ assetDirs: IMAGE_ASSET_DIRS,
33008
+ mediaKind: "image",
33009
+ maxBytes: IMAGE_REFERENCE_MAX_BYTES
33010
+ }),
33085
33011
  reference_images: Array.isArray(args.reference_images) ? args.reference_images.map(
33086
- (item) => normalizeLocalAssetReference(targetDir, item, registry2, IMAGE_ASSET_DIRS)
33012
+ (item) => rewriteGeneratedAssetReference(targetDir, item, registry2, {
33013
+ assetDirs: IMAGE_ASSET_DIRS,
33014
+ mediaKind: "image",
33015
+ maxBytes: IMAGE_REFERENCE_MAX_BYTES
33016
+ })
33087
33017
  ) : args.reference_images
33088
33018
  };
33089
33019
  }
33090
- function rewriteVideoReferenceAssetArgs(targetDir, args) {
33091
- const registry2 = readGeneratedAssetRegistry(targetDir);
33020
+ function normalizeBatchImageReferenceAssetArgs(targetDir, args) {
33021
+ if (!Array.isArray(args.images)) {
33022
+ return args;
33023
+ }
33092
33024
  return {
33093
33025
  ...args,
33094
- images: rewriteUrlObjectArray(targetDir, args.images, registry2, IMAGE_ASSET_DIRS),
33095
- videos: rewriteUrlObjectArray(targetDir, args.videos, registry2, VIDEO_ASSET_DIRS),
33096
- audios: rewriteUrlObjectArray(targetDir, args.audios, registry2, AUDIO_ASSET_DIRS)
33026
+ images: args.images.map(
33027
+ (item) => isRecord(item) ? normalizeImageReferenceAssetArgs(targetDir, item) : item
33028
+ )
33097
33029
  };
33098
33030
  }
33099
- function rewrite3dModelAssetArgs(targetDir, args) {
33031
+ function rewriteVideoReferenceAssetArgs(targetDir, args) {
33100
33032
  const registry2 = readGeneratedAssetRegistry(targetDir);
33101
33033
  return {
33102
33034
  ...args,
33103
- image: rewriteGeneratedAssetReference(targetDir, args.image, registry2, IMAGE_ASSET_DIRS),
33104
- front_image: rewriteGeneratedAssetReference(
33105
- targetDir,
33106
- args.front_image,
33107
- registry2,
33108
- IMAGE_ASSET_DIRS
33109
- ),
33110
- left_image: rewriteGeneratedAssetReference(
33111
- targetDir,
33112
- args.left_image,
33113
- registry2,
33114
- IMAGE_ASSET_DIRS
33115
- ),
33116
- back_image: rewriteGeneratedAssetReference(
33117
- targetDir,
33118
- args.back_image,
33119
- registry2,
33120
- IMAGE_ASSET_DIRS
33121
- ),
33122
- right_image: rewriteGeneratedAssetReference(
33123
- targetDir,
33124
- args.right_image,
33125
- registry2,
33126
- IMAGE_ASSET_DIRS
33127
- ),
33128
- confirmed_image_paths: rewrite3dConfirmedImagePaths(
33129
- targetDir,
33130
- args.confirmed_image_paths,
33131
- registry2
33132
- )
33133
- };
33134
- }
33135
- function rewrite3dConfirmedImagePaths(targetDir, value, registry2) {
33136
- if (!isRecord(value)) {
33137
- return value;
33138
- }
33139
- return {
33140
- ...value,
33141
- front: rewriteGeneratedAssetReference(targetDir, value.front, registry2, IMAGE_ASSET_DIRS),
33142
- left: rewriteGeneratedAssetReference(targetDir, value.left, registry2, IMAGE_ASSET_DIRS),
33143
- back: rewriteGeneratedAssetReference(targetDir, value.back, registry2, IMAGE_ASSET_DIRS),
33144
- right: rewriteGeneratedAssetReference(targetDir, value.right, registry2, IMAGE_ASSET_DIRS)
33035
+ images: rewriteUrlObjectArray(targetDir, args.images, registry2, {
33036
+ assetDirs: IMAGE_ASSET_DIRS,
33037
+ mediaKind: "image",
33038
+ maxBytes: VIDEO_TASK_IMAGE_REFERENCE_MAX_BYTES
33039
+ }),
33040
+ videos: rewriteUrlObjectArray(targetDir, args.videos, registry2, {
33041
+ assetDirs: VIDEO_ASSET_DIRS,
33042
+ mediaKind: "video",
33043
+ maxBytes: VIDEO_REFERENCE_MAX_BYTES
33044
+ }),
33045
+ audios: rewriteUrlObjectArray(targetDir, args.audios, registry2, {
33046
+ assetDirs: AUDIO_ASSET_DIRS,
33047
+ mediaKind: "audio",
33048
+ maxBytes: AUDIO_REFERENCE_MAX_BYTES
33049
+ })
33145
33050
  };
33146
33051
  }
33147
- function rewriteUrlObjectArray(targetDir, value, registry2, assetDirs) {
33052
+ function rewriteUrlObjectArray(targetDir, value, registry2, options) {
33148
33053
  if (!Array.isArray(value)) {
33149
33054
  return value;
33150
33055
  }
33151
33056
  return value.map(
33152
33057
  (item) => isRecord(item) ? {
33153
33058
  ...item,
33154
- url: rewriteGeneratedAssetReference(targetDir, item.url, registry2, assetDirs)
33059
+ url: rewriteGeneratedAssetReference(targetDir, item.url, registry2, options)
33155
33060
  } : item
33156
33061
  );
33157
33062
  }
33158
- function rewriteGeneratedAssetReference(targetDir, value, registry2, assetDirs) {
33063
+ function rewriteGeneratedAssetReference(targetDir, value, registry2, options) {
33159
33064
  var _a3, _b;
33160
33065
  if (typeof value !== "string") {
33161
33066
  return value;
33162
33067
  }
33163
- const localPath = resolveLocalAssetReference(targetDir, value, registry2, assetDirs);
33164
- const cdnUrl = localPath ? ((_a3 = registry2[localPath]) == null ? void 0 : _a3.cdnUrl) || ((_b = registry2[localPath]) == null ? void 0 : _b.previewUrl) : void 0;
33165
- return cdnUrl || localPath || value;
33166
- }
33167
- function normalizeLocalAssetReference(targetDir, value, registry2, assetDirs) {
33168
- if (typeof value !== "string") {
33068
+ if (/^https?:\/\//i.test(value) || value.startsWith("data:")) {
33169
33069
  return value;
33170
33070
  }
33171
- return resolveLocalAssetReference(targetDir, value, registry2, assetDirs) || value;
33071
+ const localPath = resolveLocalAssetReference(targetDir, value, registry2, options.assetDirs);
33072
+ const cdnUrl = localPath ? ((_a3 = registry2[localPath]) == null ? void 0 : _a3.cdnUrl) || ((_b = registry2[localPath]) == null ? void 0 : _b.previewUrl) : void 0;
33073
+ if (cdnUrl) {
33074
+ return cdnUrl;
33075
+ }
33076
+ const dataUrl = localAssetReferenceToDataUrl({
33077
+ targetDir,
33078
+ value,
33079
+ localPath,
33080
+ mediaKind: options.mediaKind,
33081
+ maxBytes: options.maxBytes
33082
+ });
33083
+ return dataUrl || value;
33172
33084
  }
33173
33085
  function resolveLocalAssetReference(targetDir, value, registry2, assetDirs) {
33174
33086
  if (/^https?:\/\//i.test(value) || value.startsWith("data:")) {
@@ -33244,6 +33156,66 @@ function isKnownAssetPath(relativePath, assetDirs) {
33244
33156
  function isBareAssetName(value) {
33245
33157
  return !value.includes("/") && !value.includes("\\");
33246
33158
  }
33159
+ function localAssetReferenceToDataUrl(options) {
33160
+ const absolutePath = resolveLocalAssetAbsolutePath(options.targetDir, {
33161
+ value: options.value,
33162
+ localPath: options.localPath
33163
+ });
33164
+ if (!absolutePath) {
33165
+ return void 0;
33166
+ }
33167
+ const mime = dataUrlMimeForPath(absolutePath, options.mediaKind);
33168
+ if (!mime) {
33169
+ return void 0;
33170
+ }
33171
+ let stat;
33172
+ try {
33173
+ stat = fs11.statSync(absolutePath);
33174
+ } catch {
33175
+ return void 0;
33176
+ }
33177
+ if (!stat.isFile() || stat.size > options.maxBytes) {
33178
+ return void 0;
33179
+ }
33180
+ const bytes = fs11.readFileSync(absolutePath);
33181
+ return `data:${mime};base64,${bytes.toString("base64")}`;
33182
+ }
33183
+ function resolveLocalAssetAbsolutePath(targetDir, options) {
33184
+ const candidates = [];
33185
+ if (options.localPath) {
33186
+ const localPath = resolveProjectRelativePath(targetDir, options.localPath);
33187
+ if (localPath) {
33188
+ candidates.push(localPath);
33189
+ }
33190
+ }
33191
+ if (path12.isAbsolute(options.value)) {
33192
+ candidates.push(options.value);
33193
+ } else {
33194
+ const localPath = resolveProjectRelativePath(targetDir, options.value);
33195
+ if (localPath) {
33196
+ candidates.push(localPath);
33197
+ }
33198
+ }
33199
+ for (const candidate of candidates) {
33200
+ if (fs11.existsSync(candidate)) {
33201
+ return candidate;
33202
+ }
33203
+ }
33204
+ return void 0;
33205
+ }
33206
+ function resolveProjectRelativePath(targetDir, value) {
33207
+ const root = path12.resolve(targetDir);
33208
+ const absolutePath = path12.resolve(root, value);
33209
+ const relativePath = path12.relative(root, absolutePath);
33210
+ const escapesRoot = relativePath === ".." || relativePath.startsWith(`..${path12.sep}`) || path12.isAbsolute(relativePath);
33211
+ if (!escapesRoot) {
33212
+ return absolutePath;
33213
+ }
33214
+ return void 0;
33215
+ }
33216
+ function dataUrlMimeForPath(filePath, mediaKind) {
33217
+ return DATA_URL_MIME_BY_EXTENSION[mediaKind][path12.extname(filePath).toLowerCase()];
33218
+ }
33247
33219
  function upsertGeneratedAssetRecord(targetDir, localPath, record2) {
33248
33220
  const registry2 = readGeneratedAssetRegistry(targetDir);
33249
33221
  registry2[localPath] = record2;
@@ -33309,8 +33281,9 @@ function extensionFromUrl(url2) {
33309
33281
  }
33310
33282
 
33311
33283
  // src/maker/server/mcp.ts
33312
- var VERSION = true ? "0.0.18-beta.1" : "dev";
33284
+ var VERSION = true ? "0.0.18" : "dev";
33313
33285
  var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
33286
+ var REMOTE_PROXY_FORWARD_TIMEOUT_MS = 60 * 60 * 1e3;
33314
33287
  var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
33315
33288
  var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
33316
33289
  var PREVIEW_REFRESH_TIMEOUT_MS = 15 * 1e3;
@@ -33322,9 +33295,8 @@ var MAKER_REMOTE_PROXY_EXPOSED_TOOL_NAMES = [
33322
33295
  "batch_generate_images",
33323
33296
  "edit_image",
33324
33297
  "create_video_task",
33325
- "text_to_music",
33326
- "create_3d_model_task",
33327
- "query_3d_model_task"
33298
+ "query_video_task",
33299
+ "text_to_music"
33328
33300
  ];
33329
33301
  var MakerCloneFailedError = class extends Error {
33330
33302
  constructor(targetDir, originalError) {
@@ -33338,7 +33310,7 @@ var MakerCloneFailedError = class extends Error {
33338
33310
  var tools = [
33339
33311
  {
33340
33312
  name: "maker_status_lite",
33341
- description: "Compatibility status surface for clients using tool output instead of the maker://status resource. Prefer reading maker://status when resources are available. Shows local Maker status for the user current working directory, including Git, Python runtime readiness, maker-lua-lsp readiness for local Lua diagnostics, PAT/TapTap auth, project binding, AI dev kit status, Maker proxy tools status and failures, Maker Git Workflow Policy guidance, Maker Creative Asset Tool Policy guidance to prefer Maker MCP proxy tools for bound game assets and override generic imagegen/native media tools, edit_image guidance to resolve dragged/referenced images to a local path or CDN URL before calling the tool, and bundled workflow guide document paths. Maker initialization next_step: taptap-maker init.",
33313
+ description: "Compatibility status surface for clients using tool output instead of the maker://status resource. Prefer reading maker://status when resources are available. Shows local Maker status for the user current working directory, including Git, Python runtime readiness, maker-lua-lsp readiness for local Lua diagnostics, PAT/TapTap auth, project binding, AI dev kit status, Maker proxy tools status and failures, Maker Git Workflow Policy guidance, Maker Creative Asset Tool Policy guidance to prefer Maker MCP proxy tools for bound game assets, supported local path/remote URL/data URL media inputs, and bundled workflow guide document paths. Maker initialization next_step: taptap-maker init.",
33342
33314
  inputSchema: {
33343
33315
  type: "object",
33344
33316
  properties: {
@@ -33429,7 +33401,9 @@ async function listMakerTools(options) {
33429
33401
  serverUrl: options.serverUrl,
33430
33402
  env: options.env
33431
33403
  }));
33432
- remoteTools = filterExposedRemoteProxyTools(await listedRemoteTools());
33404
+ remoteTools = filterExposedRemoteProxyTools(await listedRemoteTools()).map(
33405
+ decorateRemoteProxyToolDefinition
33406
+ );
33433
33407
  } catch {
33434
33408
  remoteTools = [];
33435
33409
  }
@@ -33441,6 +33415,54 @@ function filterExposedRemoteProxyTools(toolsToFilter) {
33441
33415
  const exposedToolNames = new Set(MAKER_REMOTE_PROXY_EXPOSED_TOOL_NAMES);
33442
33416
  return toolsToFilter.filter((tool) => exposedToolNames.has(tool.name));
33443
33417
  }
33418
+ function decorateRemoteProxyToolDefinition(tool) {
33419
+ const guidance = remoteProxyToolGuidance(tool.name);
33420
+ if (!guidance) {
33421
+ return tool;
33422
+ }
33423
+ return {
33424
+ ...tool,
33425
+ description: [tool.description, guidance].filter(Boolean).join("\n\n")
33426
+ };
33427
+ }
33428
+ function remoteProxyToolGuidance(toolName) {
33429
+ const failurePolicy = "If this Maker proxy tool fails or returns isError, include the full remote_result/error payload from the server so developers can diagnose the issue.";
33430
+ const localMediaSizeHint = "Large local/data URL media can be slow or fail: image inputs are commonly limited to about 10 MB, video-task image inputs to about 30 MB, video inputs to about 50 MB, and audio inputs to about 15 MB.";
33431
+ switch (toolName) {
33432
+ case "generate_image":
33433
+ case "batch_generate_images":
33434
+ return [
33435
+ "**Maker asset workflow hint:** In a bound Maker project, prefer this Maker MCP proxy tool for Maker project assets. Successful results are downloaded into the Maker project and recorded with remote mapping for later edits or video references.",
33436
+ localMediaSizeHint,
33437
+ failurePolicy
33438
+ ].join(" ");
33439
+ case "edit_image":
33440
+ return [
33441
+ "**Maker asset workflow hint:** In a bound Maker project, prefer this Maker MCP proxy tool for image editing.",
33442
+ localMediaSizeHint,
33443
+ failurePolicy
33444
+ ].join(" ");
33445
+ case "create_video_task":
33446
+ return [
33447
+ "**Maker asset workflow hint:** Prefer this Maker MCP proxy tool for Maker video generation. Image, video, and audio references may use remote URLs, existing data URLs, or resolvable local files that the local proxy can forward as data URLs.",
33448
+ localMediaSizeHint,
33449
+ failurePolicy
33450
+ ].join(" ");
33451
+ case "query_video_task":
33452
+ return [
33453
+ "**Maker asset workflow hint:** Prefer this Maker MCP proxy tool to refresh video task status, release completed task quota, and materialize successful video results into the Maker project.",
33454
+ "Use this Maker MCP proxy tool to refresh video task status when create_video_task returns a task_id or reports video concurrency limits.",
33455
+ failurePolicy
33456
+ ].join(" ");
33457
+ case "text_to_music":
33458
+ return [
33459
+ "**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.",
33460
+ failurePolicy
33461
+ ].join(" ");
33462
+ default:
33463
+ return void 0;
33464
+ }
33465
+ }
33444
33466
  function isExposedRemoteProxyTool(name) {
33445
33467
  return MAKER_REMOTE_PROXY_EXPOSED_TOOL_NAMES.includes(name);
33446
33468
  }
@@ -33515,15 +33537,9 @@ async function callRemoteProxyTool(options) {
33515
33537
  },
33516
33538
  void 0,
33517
33539
  {
33518
- timeout: DEFAULT_BUILD_TIMEOUT_MS,
33540
+ timeout: REMOTE_PROXY_FORWARD_TIMEOUT_MS,
33519
33541
  resetTimeoutOnProgress: true,
33520
- onprogress: options.progressToken ? (progress) => {
33521
- options.extra.sendNotification({
33522
- method: "notifications/progress",
33523
- params: { progressToken: options.progressToken, ...progress }
33524
- }).catch(() => {
33525
- });
33526
- } : void 0
33542
+ onprogress: createRemoteProxyProgressHandler(options.progressToken, options.extra)
33527
33543
  }
33528
33544
  );
33529
33545
  } finally {
@@ -33552,6 +33568,19 @@ async function callRemoteProxyTool(options) {
33552
33568
  result
33553
33569
  });
33554
33570
  }
33571
+ function createRemoteProxyProgressHandler(progressToken, extra) {
33572
+ if (progressToken === void 0) {
33573
+ return () => {
33574
+ };
33575
+ }
33576
+ return (progress) => {
33577
+ extra.sendNotification({
33578
+ method: "notifications/progress",
33579
+ params: { progressToken, ...progress }
33580
+ }).catch(() => {
33581
+ });
33582
+ };
33583
+ }
33555
33584
  async function startMakerMcpServer() {
33556
33585
  const server = new Server(
33557
33586
  {
@@ -33948,7 +33977,7 @@ function formatMakerRemoteSyncStatusLines(status) {
33948
33977
  ((_a3 = status.failure) == null ? void 0 : _a3.retryable) !== void 0 ? `- failure_retryable: ${status.failure.retryable ? "yes" : "no"}` : "",
33949
33978
  ((_b = status.failure) == null ? void 0 : _b.retryReason) ? `- failure_retry_reason: ${status.failure.retryReason}` : "",
33950
33979
  ((_c = status.failure) == null ? void 0 : _c.stderr) ? `- failure_stderr:
33951
- ${indent(status.failure.stderr)}` : "",
33980
+ ${indent2(status.failure.stderr)}` : "",
33952
33981
  `- next_action: ${status.nextAction}`
33953
33982
  ].filter(Boolean);
33954
33983
  }
@@ -34156,6 +34185,8 @@ function createRemoteProxyContext(options) {
34156
34185
  },
34157
34186
  options: {
34158
34187
  verbose: true,
34188
+ reset_timeout_on_progress: true,
34189
+ force_inject_progress_token: true,
34159
34190
  exposed_tools: options.exposedTools
34160
34191
  }
34161
34192
  };
@@ -34952,7 +34983,7 @@ function formatBuildResult(result, progressSummary) {
34952
34983
  ...formatMakerBuildFailureLines(result.buildFailure),
34953
34984
  "",
34954
34985
  "remote_result:",
34955
- indent(result.buildResult.resultText)
34986
+ indent2(result.buildResult.resultText)
34956
34987
  ].filter(Boolean).join("\n");
34957
34988
  }
34958
34989
  if (result.mode === "submit_failed_before_build") {
@@ -35031,7 +35062,7 @@ function formatBuildResult(result, progressSummary) {
35031
35062
  if (submitLines.length > 0) {
35032
35063
  lines.push(...submitLines);
35033
35064
  }
35034
- lines.push("remote_result:", indent(result.resultText));
35065
+ lines.push("remote_result:", indent2(result.resultText));
35035
35066
  return lines.join("\n");
35036
35067
  }
35037
35068
  function formatPreviewRefreshLines(result) {
@@ -35122,7 +35153,7 @@ function formatMakerBuildFailureLines(failure) {
35122
35153
  `- error_name: ${failure.name}`,
35123
35154
  `- message: ${failure.message}`,
35124
35155
  failure.stack ? `- stack:
35125
- ${indent(failure.stack)}` : ""
35156
+ ${indent2(failure.stack)}` : ""
35126
35157
  ].filter(Boolean);
35127
35158
  }
35128
35159
  function formatMakerFailureLines(failure) {
@@ -35136,9 +35167,9 @@ function formatMakerFailureLines(failure) {
35136
35167
  `- exit_code: ${failure.exitCode ?? "(none)"}`,
35137
35168
  failure.command ? `- command: ${failure.command}` : "",
35138
35169
  failure.stderr ? `- stderr:
35139
- ${indent(failure.stderr)}` : "",
35170
+ ${indent2(failure.stderr)}` : "",
35140
35171
  failure.stdout ? `- stdout:
35141
- ${indent(failure.stdout)}` : "",
35172
+ ${indent2(failure.stdout)}` : "",
35142
35173
  `- next_action: ${failure.nextAction}`
35143
35174
  ].filter(Boolean);
35144
35175
  }
@@ -35170,25 +35201,86 @@ function formatToolException(toolName, error2) {
35170
35201
  ...formatClonePartialStateLines(error2.targetDir),
35171
35202
  "",
35172
35203
  "debug:",
35173
- originalStack ? indent(originalStack) : indent(message),
35204
+ originalStack ? indent2(originalStack) : indent2(message),
35174
35205
  "",
35175
35206
  "next_action: 请根据 partial_state 判断是否直接重试;不要删除用户文件。若用户不懂目录状态,优先建议新建独立目录重新 clone。"
35176
35207
  ].join("\n");
35177
35208
  }
35209
+ if (error2 instanceof RemoteProxyToolResultError) {
35210
+ return [
35211
+ "✗ Maker MCP proxy tool failed",
35212
+ "",
35213
+ `- tool: ${toolName}`,
35214
+ "- reason: remote_proxy_tool_result_error",
35215
+ `- error_name: ${error2.name}`,
35216
+ `- message: ${firstLine(error2.message)}`,
35217
+ "",
35218
+ formatRemoteProxyToolResult(error2.result),
35219
+ "",
35220
+ "next_action: 远端 proxy tool 已返回失败结果;请把 remote_result 原样反馈给开发者,方便排查 server 返回内容。"
35221
+ ].join("\n");
35222
+ }
35178
35223
  return [
35179
35224
  "✗ Maker MCP tool failed",
35180
35225
  "",
35181
35226
  `- tool: ${toolName}`,
35182
35227
  `- error_name: ${error2 instanceof Error ? error2.name : typeof error2}`,
35183
35228
  `- message: ${message}`,
35229
+ ...formatUnknownExceptionDetailLines(error2),
35184
35230
  "",
35185
35231
  "debug:",
35186
- stack ? indent(stack) : indent(message),
35232
+ stack ? indent2(stack) : indent2(message),
35187
35233
  "",
35188
35234
  "next_action: 请把上面的完整错误反馈给开发者;如果本地已有 commit 但 push 未完成,不要重复 commit,直接重试 maker_build_current_directory。"
35189
35235
  ].join("\n");
35190
35236
  }
35191
- function indent(value) {
35237
+ function firstLine(value) {
35238
+ return value.split("\n")[0] || value;
35239
+ }
35240
+ function formatUnknownExceptionDetailLines(error2) {
35241
+ if (!(error2 instanceof Error)) {
35242
+ return [];
35243
+ }
35244
+ const details = errorOwnDiagnosticFields(error2);
35245
+ if (Object.keys(details).length === 0) {
35246
+ return [];
35247
+ }
35248
+ return ["", "error_details:", indent2(formatDiagnosticJson(details))];
35249
+ }
35250
+ function errorOwnDiagnosticFields(error2) {
35251
+ const details = {};
35252
+ for (const key of Object.getOwnPropertyNames(error2)) {
35253
+ if (key === "name" || key === "message" || key === "stack") {
35254
+ continue;
35255
+ }
35256
+ details[key] = sanitizeDiagnosticValue(error2[key]);
35257
+ }
35258
+ return details;
35259
+ }
35260
+ function sanitizeDiagnosticValue(value) {
35261
+ if (Array.isArray(value)) {
35262
+ return value.map((item) => sanitizeDiagnosticValue(item));
35263
+ }
35264
+ if (value && typeof value === "object") {
35265
+ const result = {};
35266
+ for (const [key, nestedValue] of Object.entries(value)) {
35267
+ result[key] = isSensitiveDiagnosticKey(key) ? "<redacted>" : sanitizeDiagnosticValue(nestedValue);
35268
+ }
35269
+ return result;
35270
+ }
35271
+ return value;
35272
+ }
35273
+ function isSensitiveDiagnosticKey(key) {
35274
+ return /token|secret|mac[_-]?key|authorization|cookie|(^|[_-])pat($|[_-])/i.test(key);
35275
+ }
35276
+ function formatDiagnosticJson(value) {
35277
+ try {
35278
+ return JSON.stringify(value, null, 2);
35279
+ } catch {
35280
+ return String(value);
35281
+ }
35282
+ }
35283
+ function indent2(value) {
35192
35284
  return value.split("\n").map((line) => ` ${line}`).join("\n");
35193
35285
  }
35194
35286
 
@@ -35354,7 +35446,6 @@ var BOOLEAN_OPTIONS = /* @__PURE__ */ new Set([
35354
35446
  "pat_from_stdin",
35355
35447
  "reset",
35356
35448
  "all",
35357
- "create",
35358
35449
  "h",
35359
35450
  "help"
35360
35451
  ]);
@@ -35500,7 +35591,6 @@ async function runInit(parsed, ctx) {
35500
35591
  });
35501
35592
  const selected = await resolveProjectSelection(parsed, projects, {
35502
35593
  existingProjectConfig,
35503
- pat,
35504
35594
  skipConfirm
35505
35595
  });
35506
35596
  emit(ctx, "app", "Maker app selected", {
@@ -36081,7 +36171,7 @@ async function runMcpVerify(parsed, ctx) {
36081
36171
  payload.explanation ? `- explanation: ${payload.explanation}` : "",
36082
36172
  payload.error ? `- error: ${payload.error}` : "",
36083
36173
  payload.stderr ? `- stderr:
36084
- ${indent2(payload.stderr)}` : "",
36174
+ ${indent3(payload.stderr)}` : "",
36085
36175
  payload.next_steps ? ["Next steps:", ...payload.next_steps.map((step, index) => `${index + 1}. ${step}`)].join(
36086
36176
  "\n"
36087
36177
  ) : "",
@@ -36291,13 +36381,6 @@ async function resolvePat(parsed, ctx) {
36291
36381
  async function resolveProjectSelection(parsed, projects, options) {
36292
36382
  var _a3;
36293
36383
  const appId = stringOption(parsed, "app_id") || parsed.positionals[0];
36294
- const createNewProject = booleanOption(parsed, "create");
36295
- if (createNewProject && appId) {
36296
- throw new Error("Cannot use --create together with --app-id or a positional app id.");
36297
- }
36298
- if (createNewProject) {
36299
- return createProjectFromInit(parsed, options);
36300
- }
36301
36384
  if (appId) {
36302
36385
  return projects.find((project) => project.id === appId) || { id: appId };
36303
36386
  }
@@ -36310,12 +36393,7 @@ async function resolveProjectSelection(parsed, projects, options) {
36310
36393
  };
36311
36394
  }
36312
36395
  if (projects.length === 0) {
36313
- if (options.skipConfirm) {
36314
- throw new Error("No Maker apps found for this PAT. Use --create --name to create one.");
36315
- }
36316
- process.stdout.write(`${formatMakerProjectList(projects)}
36317
- `);
36318
- return createProjectFromInit(parsed, options);
36396
+ throw new Error("No Maker apps found for this PAT.");
36319
36397
  }
36320
36398
  if (options.skipConfirm) {
36321
36399
  throw new Error("Missing --app-id in non-interactive init mode.");
@@ -36325,7 +36403,7 @@ async function resolveProjectSelection(parsed, projects, options) {
36325
36403
  for (; ; ) {
36326
36404
  process.stdout.write(`${formatMakerProjectList(orderedProjects, { showAll })}
36327
36405
  `);
36328
- const answer = await promptRequired("Choose app by index, app_id, 'new', or 'all' to show all");
36406
+ const answer = await promptRequired("Choose app by index, app_id, or 'all' to show all");
36329
36407
  const normalized = answer.trim().toLowerCase();
36330
36408
  if (["a", "all"].includes(normalized)) {
36331
36409
  if (showAll) {
@@ -36335,9 +36413,6 @@ async function resolveProjectSelection(parsed, projects, options) {
36335
36413
  }
36336
36414
  continue;
36337
36415
  }
36338
- if (["0", "n", "new", "create"].includes(normalized)) {
36339
- return createProjectFromInit(parsed, options);
36340
- }
36341
36416
  const visibleCount = showAll ? orderedProjects.length : Math.min(MAKER_PROJECT_DEFAULT_TEXT_LIMIT, orderedProjects.length);
36342
36417
  const byIndex = Number(answer);
36343
36418
  if (Number.isInteger(byIndex) && byIndex >= 1 && byIndex <= visibleCount) {
@@ -36350,31 +36425,6 @@ async function resolveProjectSelection(parsed, projects, options) {
36350
36425
  return selected;
36351
36426
  }
36352
36427
  }
36353
- async function createProjectFromInit(parsed, options) {
36354
- var _a3;
36355
- const existingProjectId = (_a3 = options.existingProjectConfig) == null ? void 0 : _a3.project_id;
36356
- if (existingProjectId) {
36357
- throw new Error(
36358
- [
36359
- `Current directory is already bound to Maker project ${existingProjectId}.`,
36360
- "A Maker workspace directory can only be bound to one project at a time.",
36361
- "Please create/open a new empty directory before creating a new Maker project."
36362
- ].join("\n")
36363
- );
36364
- }
36365
- const name = stringOption(parsed, "name") || stringOption(parsed, "project_name");
36366
- if (!name && options.skipConfirm) {
36367
- throw new Error("Missing --name in non-interactive create mode.");
36368
- }
36369
- const projectName = name || await promptRequired("Enter new Maker project name");
36370
- return createMakerProject({
36371
- name: projectName,
36372
- gameType: "sce",
36373
- pat: options.pat
36374
- }).catch((error2) => {
36375
- throw appendPatRecoveryUrl(error2, parsed);
36376
- });
36377
- }
36378
36428
  function ensureInitTargetCanRecordProject(targetDir, existingProjectId, selectedProjectId) {
36379
36429
  if (!existingProjectId || existingProjectId === selectedProjectId) {
36380
36430
  return;
@@ -36753,7 +36803,7 @@ function rejectRemovedAppsPaginationOptions(parsed) {
36753
36803
  }
36754
36804
  function formatMakerProjectList(projects, options = {}) {
36755
36805
  if (projects.length === 0) {
36756
- return ["No Maker apps found.", "", "0. Create a new Maker project"].join("\n");
36806
+ return "No Maker apps found.";
36757
36807
  }
36758
36808
  const sortedProjects = sortProjectsByRecentActivity(projects);
36759
36809
  const showAll = options.showAll === true;
@@ -36763,9 +36813,7 @@ function formatMakerProjectList(projects, options = {}) {
36763
36813
  `Maker apps (${projects.length})`,
36764
36814
  hiddenCount > 0 ? `Showing ${visibleProjects.length} most recently active apps, sorted by last activity. ${hiddenCount} more hidden. Run \`taptap-maker apps --all\` to show all, or use \`--json\` for the complete machine-readable list.` : `Showing all ${visibleProjects.length} Maker apps, sorted by last activity.`,
36765
36815
  "",
36766
- ...visibleProjects.map((project, index) => formatProjectListItem(project, index)),
36767
- "",
36768
- "0. Create a new Maker project"
36816
+ ...visibleProjects.map((project, index) => formatProjectListItem(project, index))
36769
36817
  ].filter((line) => line !== "").join("\n");
36770
36818
  }
36771
36819
  function emit(ctx, step, message, data) {
@@ -36888,7 +36936,7 @@ function escapeToml(value) {
36888
36936
  function isTomlBareKey(value) {
36889
36937
  return /^[A-Za-z0-9_-]+$/.test(value);
36890
36938
  }
36891
- function indent2(value) {
36939
+ function indent3(value) {
36892
36940
  return value.split("\n").map((line) => ` ${line}`).join("\n");
36893
36941
  }
36894
36942
  function formatShellCommand(parts) {
@@ -36900,7 +36948,6 @@ function printHelp() {
36900
36948
  "Usage:",
36901
36949
  " taptap-maker Start MCP server mode",
36902
36950
  " taptap-maker init [--env rnd|production] [--app-id ID] [--target-dir DIR] [--pat PAT]",
36903
- " [--create --name NAME]",
36904
36951
  " [--skip-confirm] [--skip-mcp-install] [--register-mcp codex,cursor,claude]",
36905
36952
  " [--json]",
36906
36953
  " taptap-maker doctor [--target-dir DIR] [--env rnd|production] [--json]",
@@ -36940,6 +36987,7 @@ function formatCliError(error2) {
36940
36987
  }
36941
36988
 
36942
36989
  // src/mcp-proxy/config.ts
36990
+ var DEFAULT_TOOL_CALL_TIMEOUT_MS = 60 * 60 * 1e3;
36943
36991
  function readStdin() {
36944
36992
  return new Promise((resolve, reject) => {
36945
36993
  const chunks = [];
@@ -37063,8 +37111,7 @@ function applyDefaults(config2) {
37063
37111
  verbose,
37064
37112
  reconnect_interval: ((_b = config2.options) == null ? void 0 : _b.reconnect_interval) ?? 5e3,
37065
37113
  request_timeout: ((_c = config2.options) == null ? void 0 : _c.request_timeout) ?? 3e4,
37066
- tool_call_timeout: ((_d = config2.options) == null ? void 0 : _d.tool_call_timeout) ?? 3e5,
37067
- // 5 分钟
37114
+ tool_call_timeout: ((_d = config2.options) == null ? void 0 : _d.tool_call_timeout) ?? DEFAULT_TOOL_CALL_TIMEOUT_MS,
37068
37115
  reset_timeout_on_progress: ((_e = config2.options) == null ? void 0 : _e.reset_timeout_on_progress) ?? true,
37069
37116
  health_check_interval: ((_f = config2.options) == null ? void 0 : _f.health_check_interval) ?? 3e4,
37070
37117
  enable_cookie_sticky: ((_g = config2.options) == null ? void 0 : _g.enable_cookie_sticky) ?? true,
@@ -39362,7 +39409,7 @@ var TapTapMCPProxy = class {
39362
39409
  void 0,
39363
39410
  // resultSchema
39364
39411
  {
39365
- timeout: ((_b = this.config.options) == null ? void 0 : _b.tool_call_timeout) ?? 3e5,
39412
+ timeout: ((_b = this.config.options) == null ? void 0 : _b.tool_call_timeout) ?? DEFAULT_TOOL_CALL_TIMEOUT_MS,
39366
39413
  resetTimeoutOnProgress: ((_c = this.config.options) == null ? void 0 : _c.reset_timeout_on_progress) ?? true,
39367
39414
  onprogress: req.onprogress
39368
39415
  }
@@ -39448,7 +39495,7 @@ var TapTapMCPProxy = class {
39448
39495
  }
39449
39496
  const progressToken = (_c = request.params._meta) == null ? void 0 : _c.progressToken;
39450
39497
  const callToolOptions = {
39451
- timeout: ((_d = this.config.options) == null ? void 0 : _d.tool_call_timeout) ?? 3e5,
39498
+ timeout: ((_d = this.config.options) == null ? void 0 : _d.tool_call_timeout) ?? DEFAULT_TOOL_CALL_TIMEOUT_MS,
39452
39499
  resetTimeoutOnProgress: ((_e = this.config.options) == null ? void 0 : _e.reset_timeout_on_progress) ?? true
39453
39500
  };
39454
39501
  const forceInjectProgressToken = ((_f = this.config.options) == null ? void 0 : _f.force_inject_progress_token) ?? false;
@@ -39565,7 +39612,6 @@ function printHelp2() {
39565
39612
  "Usage:",
39566
39613
  " taptap-maker Start MCP server mode",
39567
39614
  " taptap-maker init [--env rnd|production] [--app-id ID] [--target-dir DIR] [--pat PAT]",
39568
- " [--create --name NAME]",
39569
39615
  " [--skip-confirm] [--skip-mcp-install] [--register-mcp codex,cursor,claude]",
39570
39616
  " [--json]",
39571
39617
  " taptap-maker doctor [--target-dir DIR] [--env rnd|production] [--json]",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taptap/maker",
3
- "version": "0.0.18-beta.1",
3
+ "version": "0.0.18",
4
4
  "type": "module",
5
5
  "description": "TapTap Maker local development CLI and MCP server",
6
6
  "main": "dist/maker.js",
@@ -74,35 +74,30 @@ selected files.
74
74
  ## Maker Creative Asset Tool Policy
75
75
 
76
76
  When the current directory is a bound Maker project, use Maker MCP for game asset generation and
77
- editing. Prefer Maker MCP proxy tools over native AI image/video/audio tools. These Maker tools keep
78
- generated files inside the project and record CDN mappings for later editing, video references,
79
- submit, and build workflows.
77
+ editing when possible. Prefer Maker MCP proxy tools over native AI image/video/audio tools. These
78
+ Maker tools keep generated files inside the project, record remote mappings for later editing, and
79
+ can forward resolvable local reference media as data URLs when the remote tool schema supports it.
80
80
 
81
- This policy overrides generic imagegen or native media skills for Maker game assets.
81
+ This guidance helps users prefer Maker-managed tools for Maker game assets.
82
82
 
83
- - Do not invoke imagegen, built-in image tools, built-in video tools, or built-in audio tools for
84
- Maker project asset requests when the Maker proxy tool is callable.
85
- - If the required Maker proxy tool is not exposed in the current AI session, stop and tell the user
86
- that Maker proxy tools are unavailable in this session.
87
- - Do not fall back to generic imagegen or native media generation unless the user explicitly asks to
88
- leave the Maker asset workflow.
83
+ - Prefer Maker proxy tools for Maker project asset requests when the Maker proxy tool is callable.
84
+ - If the required Maker proxy tool is not exposed in the current AI session, tell the user that
85
+ Maker proxy tools are unavailable in this session.
89
86
 
90
87
  - Use `generate_image` for one image.
91
88
  - Use `batch_generate_images` for multiple images.
92
89
  - Use `edit_image` for modifying project images.
93
90
  - Use `create_video_task` for game videos and image/video referenced generation.
91
+ - Use `query_video_task` to refresh video task status, release completed task quota, and fetch final videos.
94
92
  - Use `text_to_music` for game music or audio.
95
- - Use `create_3d_model_task` for game 3D models.
96
- - Use `query_3d_model_task` for polling 3D model tasks.
97
- - Before `edit_image`, resolve dragged or referenced images to a local project image path or CDN
98
- URL. If the user references an attached/local image, inspect the attachment or workspace file path
99
- first. If the image is under `assets/image`, pass that path. If only a file name is given, search
100
- `assets/image` for the matching file.
101
- - Do not call `edit_image` without an image path or CDN URL.
93
+ - Follow each tool schema for supported local path, remote URL, and data URL inputs.
94
+ - Local proxy may convert resolvable local reference media to data URLs before forwarding.
95
+ - If a Maker proxy tool returns an error or `isError`, report the full remote result/error payload.
96
+ Include the server response payload so developers can diagnose the issue.
102
97
 
103
98
  Generated assets should be saved by Maker MCP under `assets/image`, `assets/video`, or
104
- `assets/audio`; generated 3D MDL zip files are saved under `assets/model`. Do not prefer
105
- client-native image generation when the user is asking for Maker game assets in a bound project.
99
+ `assets/audio`. Prefer Maker proxy tools when the user is asking for Maker game assets in a bound
100
+ project.
106
101
 
107
102
  ## Project Detection
108
103
 
@@ -143,8 +138,8 @@ directory.
143
138
  ### Proxy Tools Missing From The Current Session
144
139
 
145
140
  If the user is in a bound Maker project but `generate_image`, `batch_generate_images`, `edit_image`,
146
- `create_video_task`, `text_to_music`, `create_3d_model_task`, or `query_3d_model_task` are missing
147
- from the current AI tool list, diagnose the MCP cwd before suggesting repeated restarts:
141
+ `create_video_task`, `query_video_task`, or `text_to_music` are missing from the current AI tool list,
142
+ diagnose the MCP cwd before suggesting repeated restarts:
148
143
 
149
144
  1. Read `maker://status` or call `maker_status_lite` without `target_dir` to see the MCP server cwd.
150
145
  2. If the user provides or the client exposes the real Maker project directory, call
@@ -157,8 +152,8 @@ from the current AI tool list, diagnose the MCP cwd before suggesting repeated r
157
152
  `taptap-maker` MCP config `cwd` to the Maker project directory, then reconnect `taptap-maker`
158
153
  from the client's MCP UI such as `/mcp`.
159
154
 
160
- Do not fall back to generic image/video/music tools when Maker proxy tools are missing. The missing
161
- tools indicate a session/configuration problem that must be fixed first.
155
+ When Maker proxy tools are missing, explain that this is likely a session/configuration problem and
156
+ that Maker tools are preferred for Maker game assets.
162
157
 
163
158
  ## Initialization Workflow
164
159
 
@@ -192,12 +187,8 @@ Workflow:
192
187
  login/project clone/MCP config, then guide the user to retry `taptap-maker python setup` with
193
188
  the current AI or install Python 3.12 manually and run `taptap-maker python doctor`.
194
189
  5. Run `taptap-maker init` in the user's intended Maker directory. The CLI will request PAT if
195
- missing, fetch TapTap token, show a paged app preview, ask the user to choose or create a Maker
196
- project, clone the Maker project, prepare the AI dev kit, and install/verify MCP config.
197
- The app preview always includes `0. Create a new Maker project` at the bottom. This row must
198
- remain visible when an AI summarizes or truncates a long app list. Users can choose `0`/`new`
199
- and enter a project name, or use `taptap-maker init --create --name "my-local-game"` for
200
- non-interactive runs.
190
+ missing, fetch TapTap token, show a paged app preview, ask the user to choose, prepare the AI dev
191
+ kit, clone the Maker project, and install/verify MCP config.
201
192
  The generated MCP config pins the selected Maker project directory as `cwd` when the target
202
193
  client supports it. If a user manually reinstalls MCP config later, prefer
203
194
  `taptap-maker mcp install --target-dir <PROJECT_DIR>`.
@@ -293,8 +284,7 @@ a Maker project, or when the user explicitly asks to switch or re-clone.
293
284
 
294
285
  If the current directory is already bound, app lists from `taptap-maker apps` are reference only.
295
286
  Continue operating on the current bound project. When the user explicitly requests a different
296
- project or wants to create a new project, require a new independent directory before starting the
297
- project selection or creation flow.
287
+ project, start the project selection flow for that request.
298
288
 
299
289
  When app selection is needed, show the returned app preview and total count, then ask the user to
300
290
  choose by index, app id, or name. The default preview shows the 40 most recently active apps.
@@ -303,21 +293,17 @@ full list, or run `taptap-maker apps --all` for a one-shot human-readable dump;
303
293
  `taptap-maker apps --json` only when AI / scripts need the machine-readable list. If the
304
294
  chat/client width is enough, you may present the preview as a compact two-column layout;
305
295
  otherwise keep a single column. Keep app_id visible in every app row, and include the preview
306
- details instead of only a summary such as "40 apps are available". Always preserve the final
307
- `0. Create a new Maker project` row, because it is the supported creation entry even when the app
308
- preview is cropped.
296
+ details instead of only a summary such as "40 apps are available".
309
297
 
310
298
  Selection confirmation:
311
299
 
312
300
  - Ask the user to choose by index, app id, or name.
313
- - If the user wants a new project, tell them to choose `0`/`new` in `taptap-maker init` and enter a
314
- project name; do not invent a project name unless the user explicitly asks the AI to name it.
315
301
  - Treat the user's explicit reply as the selected app.
316
302
  - If there is only one app, still ask for confirmation before selecting it.
317
303
 
318
- After the user chooses or creates a project, route the next action to `taptap-maker init` so the
319
- Maker initialization workflow can continue. For non-interactive CLI runs, pass the selected app id
320
- through the supported CLI option, or use `--create --name <NAME>` for creation.
304
+ After the user chooses, route the next action to `taptap-maker init` so the Maker initialization
305
+ workflow can continue with the selected app. For non-interactive CLI runs, pass the selected app id
306
+ through the supported CLI option.
321
307
 
322
308
  ## Working Directory Compliance Check
323
309
 
@@ -331,8 +317,6 @@ After `taptap-maker doctor`, decide whether the directory is suitable for clone:
331
317
 
332
318
  - If the directory is already bound to a Maker project, do not clone again unless the user
333
319
  explicitly asks to switch or re-clone.
334
- - If the directory is already bound to a Maker project and the user wants a new project, stop and
335
- require a new independent directory; do not create a new Maker project into the existing binding.
336
320
  - If Git is missing, stop and tell the user to install Git first.
337
321
  - If `Maker Git directory` reports `inside_parent_git_repo` or `target_is_git_root: no` with an
338
322
  outer `git_root`, explain that the directory is under another Git repository. Recommend a