@fangyb/ahchat-bridge 0.1.43 → 0.1.44

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.
@@ -33045,14 +33045,20 @@ function createServer() {
33045
33045
  },
33046
33046
  async (input) => {
33047
33047
  const validationError = validateCreateTaskInput(input);
33048
- if (validationError) return errorResult(validationError);
33048
+ if (validationError) return errorResult(validationError, "video.create");
33049
33049
  try {
33050
33050
  const normalized = normalizeCreateTaskInput(input);
33051
33051
  await consumeOfficialMcpDailyQuota("seedance", "seedance_create_task");
33052
33052
  const result = await createSeedanceTask(normalized);
33053
33053
  const payload = {
33054
33054
  state: "submitted",
33055
+ ok: true,
33056
+ status: "accepted",
33057
+ statusText: "\u5DF2\u63D0\u4EA4",
33058
+ operation: "video.create",
33059
+ terminal: false,
33055
33060
  task_id: result.id,
33061
+ resourceId: result.id,
33056
33062
  model: normalized.model,
33057
33063
  duration: normalized.duration,
33058
33064
  ratio: normalized.ratio,
@@ -33065,7 +33071,7 @@ function createServer() {
33065
33071
  structuredContent: payload
33066
33072
  };
33067
33073
  } catch (error51) {
33068
- return errorResult(formatApiError(error51));
33074
+ return errorResult(formatApiError(error51), "video.create");
33069
33075
  }
33070
33076
  }
33071
33077
  );
@@ -33085,9 +33091,16 @@ function createServer() {
33085
33091
  try {
33086
33092
  const parsed = checkTaskInputSchema.parse(input);
33087
33093
  const result = await withDownloadedSeedanceVideo(await checkSeedanceTask(parsed.task_id));
33094
+ const normalizedStatus = normalizeSeedanceTaskStatus(result.status, result.failReason);
33088
33095
  const payload = {
33089
33096
  task_id: result.id,
33097
+ resourceId: result.id,
33090
33098
  status: result.status,
33099
+ ok: normalizedStatus.ok,
33100
+ normalizedStatus: normalizedStatus.status,
33101
+ statusText: normalizedStatus.statusText,
33102
+ operation: "video.check",
33103
+ terminal: normalizedStatus.terminal,
33091
33104
  video_url: result.videoUrl,
33092
33105
  last_frame_url: result.lastFrameUrl,
33093
33106
  local_path: result.localPath,
@@ -33101,7 +33114,7 @@ function createServer() {
33101
33114
  structuredContent: payload
33102
33115
  };
33103
33116
  } catch (error51) {
33104
- return errorResult(formatApiError(error51));
33117
+ return errorResult(formatApiError(error51), "video.check");
33105
33118
  }
33106
33119
  }
33107
33120
  );
@@ -33423,10 +33436,29 @@ function formatApiError(error51) {
33423
33436
  if (error51 instanceof Error) return error51.message;
33424
33437
  return String(error51);
33425
33438
  }
33426
- function errorResult(message) {
33439
+ function normalizeSeedanceTaskStatus(rawStatus, failReason) {
33440
+ const status = rawStatus.toLowerCase();
33441
+ if (["succeeded", "success", "completed", "done"].includes(status)) {
33442
+ return { ok: true, status: "completed", statusText: "\u5DF2\u5B8C\u6210", terminal: true };
33443
+ }
33444
+ if (["failed", "failure", "error", "cancelled", "canceled"].includes(status) || Boolean(failReason)) {
33445
+ return { ok: false, status: "failed", statusText: "\u5931\u8D25", terminal: true };
33446
+ }
33447
+ return { ok: true, status: "running", statusText: "\u8FDB\u884C\u4E2D", terminal: false };
33448
+ }
33449
+ function errorResult(message, operation = "seedance") {
33427
33450
  return {
33428
33451
  content: [{ type: "text", text: message }],
33429
- isError: true
33452
+ isError: true,
33453
+ structuredContent: {
33454
+ ok: false,
33455
+ status: "failed",
33456
+ statusText: "\u5931\u8D25",
33457
+ operation,
33458
+ terminal: true,
33459
+ message,
33460
+ error: message
33461
+ }
33430
33462
  };
33431
33463
  }
33432
33464
  function usageGuide() {