@taptap/maker 0.0.24-beta.1 → 0.0.24-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/dist/maker.js +254 -29
  3. package/package.json +1 -1
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-beta.1
33
+ Version: 0.0.24-beta.2
package/dist/maker.js CHANGED
@@ -33264,7 +33264,7 @@ function inspectMakerProjectInitialization(projectRoot) {
33264
33264
  };
33265
33265
  }
33266
33266
  const missingFields = ["app_id", "developer_id"].filter(
33267
- (field) => !hasNonEmptyField(projectJson, field)
33267
+ (field) => !hasNonEmptyIdentityField(projectJson, field)
33268
33268
  );
33269
33269
  if (missingFields.length > 0) {
33270
33270
  return {
@@ -33305,29 +33305,34 @@ function formatMakerProjectInitializationStatus(status) {
33305
33305
  "- next_action: 检查 .project/project.json 内容;必要时先调用 maker_build_current_directory 重新生成项目配置。"
33306
33306
  ].filter(Boolean).join("\n");
33307
33307
  }
33308
- return [
33309
- "Maker project initialization",
33310
- "",
33311
- "- status: missing_project_json",
33312
- `- config: ${status.projectJsonPath}`,
33313
- "- impact: get_ad_config and other remote project-config tools cannot read project metadata yet.",
33314
- "- next_action: 先调用 maker_build_current_directory 构建一次,生成 .project/project.json 后再重试。"
33315
- ].join("\n");
33308
+ if (status.status === "missing_project_json") {
33309
+ return [
33310
+ "Maker project initialization",
33311
+ "",
33312
+ "- status: missing_project_json",
33313
+ `- config: ${status.projectJsonPath}`,
33314
+ "- impact: get_ad_config and other remote project-config tools cannot read project metadata yet.",
33315
+ "- next_action: 先调用 maker_build_current_directory 构建一次,生成 .project/project.json 后再重试。"
33316
+ ].join("\n");
33317
+ }
33318
+ return "";
33316
33319
  }
33317
- function hasNonEmptyField(value, fieldName) {
33320
+ function hasNonEmptyIdentityField(value, fieldName) {
33318
33321
  if (!value || typeof value !== "object") {
33319
33322
  return false;
33320
33323
  }
33321
- if (Object.prototype.hasOwnProperty.call(value, fieldName)) {
33322
- const fieldValue = value[fieldName];
33323
- if (fieldValue !== void 0 && fieldValue !== null && String(fieldValue).trim() !== "") {
33324
- return true;
33325
- }
33324
+ const record2 = value;
33325
+ if (isNonEmptyStringLike(record2[fieldName])) {
33326
+ return true;
33326
33327
  }
33327
- if (Array.isArray(value)) {
33328
- return value.some((item) => hasNonEmptyField(item, fieldName));
33328
+ const taptapPublish = record2.taptap_publish;
33329
+ if (!taptapPublish || typeof taptapPublish !== "object" || Array.isArray(taptapPublish)) {
33330
+ return false;
33329
33331
  }
33330
- return Object.values(value).some((item) => hasNonEmptyField(item, fieldName));
33332
+ return isNonEmptyStringLike(taptapPublish[fieldName]);
33333
+ }
33334
+ function isNonEmptyStringLike(value) {
33335
+ return value !== void 0 && value !== null && String(value).trim() !== "";
33331
33336
  }
33332
33337
 
33333
33338
  // src/maker/server/proxyAssets.ts
@@ -33342,6 +33347,7 @@ var IMAGE_REFERENCE_MAX_BYTES = 10 * 1024 * 1024;
33342
33347
  var VIDEO_TASK_IMAGE_REFERENCE_MAX_BYTES = 30 * 1024 * 1024;
33343
33348
  var VIDEO_REFERENCE_MAX_BYTES = 50 * 1024 * 1024;
33344
33349
  var AUDIO_REFERENCE_MAX_BYTES = 15 * 1024 * 1024;
33350
+ 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.";
33345
33351
  var DATA_URL_MIME_BY_EXTENSION = {
33346
33352
  image: {
33347
33353
  ".gif": "image/gif",
@@ -33452,7 +33458,8 @@ function shouldMaterializeRemoteProxyTool(toolName) {
33452
33458
  "query_video_task",
33453
33459
  "text_to_music",
33454
33460
  "create_3d_model_task",
33455
- "query_3d_model_task"
33461
+ "query_3d_model_task",
33462
+ "get_debug_feedbacks"
33456
33463
  ].includes(toolName);
33457
33464
  }
33458
33465
  function isTextContent(item) {
@@ -33501,8 +33508,217 @@ async function materializeParsedProxyResult(options) {
33501
33508
  if (options.toolName === "create_3d_model_task" || options.toolName === "query_3d_model_task") {
33502
33509
  return await materialize3dModelResult(options, options.toolName);
33503
33510
  }
33511
+ if (options.toolName === "get_debug_feedbacks") {
33512
+ return await materializeDebugFeedbackResult(options);
33513
+ }
33504
33514
  return options.payload;
33505
33515
  }
33516
+ async function materializeDebugFeedbackResult(options) {
33517
+ if (options.payload.success !== true) {
33518
+ return options.payload;
33519
+ }
33520
+ const feedbacks = getDebugFeedbackItems(options.payload);
33521
+ const remoteSaveDir = getDebugFeedbackSaveDir(options.payload);
33522
+ if (feedbacks.length === 0 && !remoteSaveDir) {
33523
+ return options.payload;
33524
+ }
33525
+ const nextFeedbacks = [];
33526
+ for (const feedback of feedbacks) {
33527
+ const remoteDir = stringField2(feedback.dir);
33528
+ const localCandidateDir = remoteDir ? resolveDebugFeedbackCandidatePath(options.targetDir, remoteDir) : void 0;
33529
+ const materialized = await materializeDebugFeedbackArtifacts({
33530
+ targetDir: options.targetDir,
33531
+ feedback,
33532
+ fetchImpl: options.fetchImpl
33533
+ });
33534
+ nextFeedbacks.push({
33535
+ ...feedback,
33536
+ ...localCandidateDir ? { local_candidate_dir: localCandidateDir } : {},
33537
+ ...materialized
33538
+ });
33539
+ }
33540
+ const localCandidateSaveDir = remoteSaveDir ? resolveDebugFeedbackCandidatePath(options.targetDir, remoteSaveDir) : feedbacks.some(hasDebugFeedbackArtifactUrls) ? path15.join(options.targetDir, "logs", "feed_back") : void 0;
33541
+ const filesVerifiedLocally = nextFeedbacks.some(
33542
+ (feedback) => numberField2(feedback.artifacts_downloaded) > 0
33543
+ );
33544
+ return {
33545
+ ...replaceDebugFeedbackItems(options.payload, nextFeedbacks),
33546
+ local_path_hint: {
33547
+ remote_save_dir: remoteSaveDir,
33548
+ local_candidate_save_dir: localCandidateSaveDir,
33549
+ local_project_dir: options.targetDir,
33550
+ files_verified_locally: filesVerifiedLocally,
33551
+ note: DEBUG_FEEDBACK_PATH_HINT
33552
+ }
33553
+ };
33554
+ }
33555
+ async function materializeDebugFeedbackArtifacts(options) {
33556
+ const feedbackId = stringField2(options.feedback.feedback_id) || String(options.feedback.feedback_id || "");
33557
+ if (!feedbackId) {
33558
+ return {};
33559
+ }
33560
+ const logUrls = stringArrayField(options.feedback.log_file_urls);
33561
+ const screenshotUrls = stringArrayField(options.feedback.screenshots);
33562
+ const extraUrls = stringArrayField(options.feedback.download_urls).filter(
33563
+ (url2) => !logUrls.includes(url2) && !screenshotUrls.includes(url2)
33564
+ );
33565
+ if (logUrls.length === 0 && screenshotUrls.length === 0 && extraUrls.length === 0) {
33566
+ return {};
33567
+ }
33568
+ const localDir = path15.join(options.targetDir, "logs", "feed_back", `feedback_${feedbackId}`);
33569
+ const localLogPaths = [];
33570
+ const localScreenshotPaths = [];
33571
+ const localDownloadPaths = [];
33572
+ const errors = [];
33573
+ for (const [index, url2] of logUrls.entries()) {
33574
+ const result = await downloadDebugFeedbackArtifact({
33575
+ url: url2,
33576
+ directory: path15.join(localDir, "logs"),
33577
+ fallbackName: `log_${index + 1}.log`,
33578
+ fetchImpl: options.fetchImpl
33579
+ });
33580
+ if (result.success) {
33581
+ localLogPaths.push(result.path);
33582
+ } else {
33583
+ errors.push(result.error);
33584
+ }
33585
+ }
33586
+ for (const [index, url2] of screenshotUrls.entries()) {
33587
+ const result = await downloadDebugFeedbackArtifact({
33588
+ url: url2,
33589
+ directory: path15.join(localDir, "screenshots"),
33590
+ fallbackName: `screenshot_${index + 1}.png`,
33591
+ fetchImpl: options.fetchImpl
33592
+ });
33593
+ if (result.success) {
33594
+ localScreenshotPaths.push(result.path);
33595
+ } else {
33596
+ errors.push(result.error);
33597
+ }
33598
+ }
33599
+ for (const [index, url2] of extraUrls.entries()) {
33600
+ const result = await downloadDebugFeedbackArtifact({
33601
+ url: url2,
33602
+ directory: path15.join(localDir, "downloads"),
33603
+ fallbackName: `artifact_${index + 1}`,
33604
+ fetchImpl: options.fetchImpl
33605
+ });
33606
+ if (result.success) {
33607
+ localDownloadPaths.push(result.path);
33608
+ } else {
33609
+ errors.push(result.error);
33610
+ }
33611
+ }
33612
+ return {
33613
+ local_dir: localDir,
33614
+ local_log_paths: localLogPaths,
33615
+ local_screenshot_paths: localScreenshotPaths,
33616
+ local_download_paths: localDownloadPaths,
33617
+ artifacts_downloaded: localLogPaths.length + localScreenshotPaths.length + localDownloadPaths.length,
33618
+ artifact_download_errors: errors
33619
+ };
33620
+ }
33621
+ async function downloadDebugFeedbackArtifact(options) {
33622
+ try {
33623
+ const response = await options.fetchImpl(options.url);
33624
+ if (!response.ok) {
33625
+ return {
33626
+ success: false,
33627
+ error: `${options.url}: HTTP ${response.status}`
33628
+ };
33629
+ }
33630
+ fs14.mkdirSync(options.directory, { recursive: true });
33631
+ const filePath = allocateDebugFeedbackArtifactPath(
33632
+ options.directory,
33633
+ options.url,
33634
+ options.fallbackName
33635
+ );
33636
+ const bytes = Buffer.from(await response.arrayBuffer());
33637
+ fs14.writeFileSync(filePath, bytes);
33638
+ return { success: true, path: filePath };
33639
+ } catch (error2) {
33640
+ return {
33641
+ success: false,
33642
+ error: `${options.url}: ${error2 instanceof Error ? error2.message : String(error2)}`
33643
+ };
33644
+ }
33645
+ }
33646
+ function allocateDebugFeedbackArtifactPath(directory, url2, fallbackName) {
33647
+ const rawName = fileNameFromUrl(url2) || fallbackName;
33648
+ const rawExtension = path15.extname(rawName);
33649
+ const finalExtension = rawExtension && rawExtension !== "." ? rawExtension.replace(/[^A-Za-z0-9.]/g, "_") : "";
33650
+ const rawStem = finalExtension ? rawName.slice(0, -rawExtension.length) : rawName;
33651
+ const stem = sanitizeAssetBaseName(rawStem);
33652
+ for (let index = 1; index <= 9999; index += 1) {
33653
+ const suffix = index === 1 ? "" : `_${index}`;
33654
+ const candidate = path15.join(directory, `${stem}${suffix}${finalExtension}`);
33655
+ if (!fs14.existsSync(candidate)) {
33656
+ return candidate;
33657
+ }
33658
+ }
33659
+ throw new Error(`Unable to allocate debug feedback artifact path for ${stem}${finalExtension}`);
33660
+ }
33661
+ function fileNameFromUrl(url2) {
33662
+ try {
33663
+ const pathname = new URL(url2).pathname;
33664
+ const name = decodeURIComponent(path15.basename(pathname));
33665
+ return name && name !== "/" ? name : void 0;
33666
+ } catch {
33667
+ return void 0;
33668
+ }
33669
+ }
33670
+ function hasDebugFeedbackArtifactUrls(feedback) {
33671
+ return stringArrayField(feedback.log_file_urls).length > 0 || stringArrayField(feedback.screenshots).length > 0 || stringArrayField(feedback.download_urls).length > 0;
33672
+ }
33673
+ function getDebugFeedbackSaveDir(payload) {
33674
+ const summary = payload.summary;
33675
+ return stringField2(payload.save_dir) || (isRecord(summary) ? stringField2(summary.save_dir) : void 0);
33676
+ }
33677
+ function resolveDebugFeedbackCandidatePath(targetDir, remotePath) {
33678
+ if (path15.isAbsolute(remotePath)) {
33679
+ return void 0;
33680
+ }
33681
+ const trimmedRemotePath = remotePath.replace(/[\\/]+$/, "");
33682
+ return path15.normalize(path15.join(targetDir, trimmedRemotePath || "."));
33683
+ }
33684
+ function replaceDebugFeedbackItems(payload, nextFeedbacks) {
33685
+ const summary = payload.summary;
33686
+ if (isRecord(summary) && Array.isArray(summary.feedbacks)) {
33687
+ return {
33688
+ ...payload,
33689
+ summary: {
33690
+ ...summary,
33691
+ feedbacks: nextFeedbacks
33692
+ }
33693
+ };
33694
+ }
33695
+ if (Array.isArray(payload.feedbacks)) {
33696
+ return {
33697
+ ...payload,
33698
+ feedbacks: nextFeedbacks
33699
+ };
33700
+ }
33701
+ if (Array.isArray(payload.list)) {
33702
+ return {
33703
+ ...payload,
33704
+ list: nextFeedbacks
33705
+ };
33706
+ }
33707
+ return payload;
33708
+ }
33709
+ function getDebugFeedbackItems(payload) {
33710
+ const summary = payload.summary;
33711
+ if (isRecord(summary) && Array.isArray(summary.feedbacks)) {
33712
+ return summary.feedbacks.filter(isRecord);
33713
+ }
33714
+ if (Array.isArray(payload.feedbacks)) {
33715
+ return payload.feedbacks.filter(isRecord);
33716
+ }
33717
+ if (Array.isArray(payload.list)) {
33718
+ return payload.list.filter(isRecord);
33719
+ }
33720
+ return [];
33721
+ }
33506
33722
  async function materializeSingleImageResult(options, toolName) {
33507
33723
  if (options.payload.success !== true) {
33508
33724
  return options.payload;
@@ -34240,9 +34456,19 @@ function isRecord(value) {
34240
34456
  function stringField2(value) {
34241
34457
  return typeof value === "string" && value.trim() ? value : void 0;
34242
34458
  }
34459
+ function stringArrayField(value) {
34460
+ return Array.isArray(value) ? value.filter((item) => Boolean(stringField2(item))) : [];
34461
+ }
34462
+ function numberField2(value) {
34463
+ return typeof value === "number" && Number.isFinite(value) ? value : 0;
34464
+ }
34243
34465
  function sanitizeAssetBaseName(value) {
34244
- const sanitized = value.trim().replace(/\s+/g, "_").replace(/[/\\:*?"<>|]+/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "");
34245
- return sanitized || "asset";
34466
+ const sanitized = replaceControlCharacters(value).trim().replace(/\s+/g, "_").replace(/[/\\:*?"<>|]+/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "").replace(/[. ]+$/g, "");
34467
+ const safeName = sanitized || "asset";
34468
+ return /^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i.test(safeName) ? `_${safeName}` : safeName;
34469
+ }
34470
+ function replaceControlCharacters(value) {
34471
+ return Array.from(value).map((character) => character.charCodeAt(0) < 32 ? "_" : character).join("");
34246
34472
  }
34247
34473
  function formatAssetTimestamp(date5) {
34248
34474
  const pad = (value) => String(value).padStart(2, "0");
@@ -34412,7 +34638,7 @@ function applyDefaults(config2) {
34412
34638
  }
34413
34639
 
34414
34640
  // src/maker/server/mcp.ts
34415
- var VERSION = true ? "0.0.24-beta.1" : "dev";
34641
+ var VERSION = true ? "0.0.24-beta.2" : "dev";
34416
34642
  var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
34417
34643
  var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
34418
34644
  var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
@@ -34630,7 +34856,7 @@ function remoteProxyToolGuidance(toolName) {
34630
34856
  ].join(" ");
34631
34857
  case "get_debug_feedbacks":
34632
34858
  return [
34633
- "**Maker hint:** Fetch remote player feedback for the current Maker project, including related device logs and screenshots when available.",
34859
+ "**Maker hint:** Fetch online player feedback for the current Maker project. When logs or screenshots can be downloaded, this tool saves them under logs/feed_back/feedback_<id>/ in the local Maker project and returns local_dir/local_log_paths/local_screenshot_paths. Read those returned local paths before diagnosing the issue. Do not guess drive letters or fixed directories; only treat attachments as local files when local_* paths are returned.",
34634
34860
  failurePolicy
34635
34861
  ].join(" ");
34636
34862
  default:
@@ -34962,6 +35188,9 @@ async function formatStatus(options = {}) {
34962
35188
  allowRemoteFetch: false
34963
35189
  })
34964
35190
  );
35191
+ const projectInitializationText = identify.projectRoot ? formatMakerProjectInitializationStatus(
35192
+ inspectMakerProjectInitialization(identify.projectRoot)
35193
+ ) : "";
34965
35194
  const projectSection = identify.projectId ? [
34966
35195
  "目标目录已绑定 Maker 项目。",
34967
35196
  "请继续在当前绑定项目上执行状态、提交、构建等操作;用户明确要求切换或重新拉取项目时,再进入项目选择流程。",
@@ -34992,11 +35221,7 @@ async function formatStatus(options = {}) {
34992
35221
  packageUpdateText,
34993
35222
  "",
34994
35223
  formatMakerGitDirectoryStatus(gitDirectoryStatus),
34995
- "",
34996
- identify.projectRoot ? formatMakerProjectInitializationStatus(
34997
- inspectMakerProjectInitialization(identify.projectRoot)
34998
- ) : "",
34999
- "",
35224
+ ...projectInitializationText ? ["", projectInitializationText, ""] : [""],
35000
35225
  formatMakerClientRootsStatus(projectContext.roots),
35001
35226
  "",
35002
35227
  projectContext.source === "client_roots" ? "" : formatMakerToolRegistrationCwdStatus({
@@ -36817,7 +37042,7 @@ function formatError2(error2) {
36817
37042
  }
36818
37043
 
36819
37044
  // src/maker/cli/commands.ts
36820
- var VERSION2 = true ? "0.0.24-beta.1" : "dev";
37045
+ var VERSION2 = true ? "0.0.24-beta.2" : "dev";
36821
37046
  var DEFAULT_MCP_NAME = "taptap-maker";
36822
37047
  var MAKER_NPM_PACKAGE = "@taptap/maker";
36823
37048
  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-beta.1",
3
+ "version": "0.0.24-beta.2",
4
4
  "type": "module",
5
5
  "description": "TapTap Maker local development CLI and MCP server",
6
6
  "main": "dist/maker.js",