@fangyb/ahchat-bridge 0.1.42 → 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.
@@ -31266,6 +31266,7 @@ function parseLogLevel(value, fallback = "INFO") {
31266
31266
 
31267
31267
  // ../logger/src/logger.ts
31268
31268
  var REDACTED = "***";
31269
+ var REDACTED_PATH = "[path]";
31269
31270
  var SENSITIVE_KEY_RE = /(token|apikey|authorization|password|secret|cookie)/i;
31270
31271
  function shouldRedactKey(key) {
31271
31272
  const normalized = key.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
@@ -31273,8 +31274,20 @@ function shouldRedactKey(key) {
31273
31274
  if (normalized.endsWith("hash")) return false;
31274
31275
  return SENSITIVE_KEY_RE.test(normalized);
31275
31276
  }
31277
+ function redactFilesystemPaths(value) {
31278
+ return value.replace(/\b[A-Za-z]:\\[^\s"'`<>|]+/g, REDACTED_PATH).replace(/\\\\[^\\\s"'`<>|]+\\[^\s"'`<>|]+/g, REDACTED_PATH).replace(
31279
+ /(^|[\s"'`(=])\/(?:home|Users)\/[^\s"'`<>]+/g,
31280
+ (_match, prefix) => `${prefix}${REDACTED_PATH}`
31281
+ );
31282
+ }
31276
31283
  function redactString(value) {
31277
- return value.replace(/([?&](?:token|api_?key|access_token|refresh_token)=)[^&#\s"']+/gi, `$1${REDACTED}`).replace(/("(?:apiKey|token|bridgeToken|authorization|password|secret|cookie|access_token|refresh_token)"\s*:\s*")[^"]*/gi, `$1${REDACTED}`).replace(/((?:apiKey|token|bridgeToken|authorization|password|secret|cookie|access_token|refresh_token)=)[^\s&"']+/gi, `$1${REDACTED}`).replace(/\b(Bearer\s+)[A-Za-z0-9._~+/=-]+/gi, `$1${REDACTED}`).replace(/\bsk-[A-Za-z0-9._-]{6,}\b/g, "sk-***");
31284
+ return redactFilesystemPaths(value).replace(/([?&](?:token|api_?key|access_token|refresh_token)=)[^&#\s"']+/gi, `$1${REDACTED}`).replace(
31285
+ /("(?:apiKey|token|bridgeToken|authorization|password|secret|cookie|access_token|refresh_token)"\s*:\s*")[^"]*/gi,
31286
+ `$1${REDACTED}`
31287
+ ).replace(
31288
+ /((?:apiKey|token|bridgeToken|authorization|password|secret|cookie|access_token|refresh_token)=)[^\s&"']+/gi,
31289
+ `$1${REDACTED}`
31290
+ ).replace(/\b(Bearer\s+)[A-Za-z0-9._~+/=-]+/gi, `$1${REDACTED}`).replace(/\bsk-[A-Za-z0-9._-]{6,}\b/g, "sk-***");
31278
31291
  }
31279
31292
  function serializeError(err) {
31280
31293
  if (err instanceof Error) {
@@ -33032,14 +33045,20 @@ function createServer() {
33032
33045
  },
33033
33046
  async (input) => {
33034
33047
  const validationError = validateCreateTaskInput(input);
33035
- if (validationError) return errorResult(validationError);
33048
+ if (validationError) return errorResult(validationError, "video.create");
33036
33049
  try {
33037
33050
  const normalized = normalizeCreateTaskInput(input);
33038
33051
  await consumeOfficialMcpDailyQuota("seedance", "seedance_create_task");
33039
33052
  const result = await createSeedanceTask(normalized);
33040
33053
  const payload = {
33041
33054
  state: "submitted",
33055
+ ok: true,
33056
+ status: "accepted",
33057
+ statusText: "\u5DF2\u63D0\u4EA4",
33058
+ operation: "video.create",
33059
+ terminal: false,
33042
33060
  task_id: result.id,
33061
+ resourceId: result.id,
33043
33062
  model: normalized.model,
33044
33063
  duration: normalized.duration,
33045
33064
  ratio: normalized.ratio,
@@ -33052,7 +33071,7 @@ function createServer() {
33052
33071
  structuredContent: payload
33053
33072
  };
33054
33073
  } catch (error51) {
33055
- return errorResult(formatApiError(error51));
33074
+ return errorResult(formatApiError(error51), "video.create");
33056
33075
  }
33057
33076
  }
33058
33077
  );
@@ -33072,9 +33091,16 @@ function createServer() {
33072
33091
  try {
33073
33092
  const parsed = checkTaskInputSchema.parse(input);
33074
33093
  const result = await withDownloadedSeedanceVideo(await checkSeedanceTask(parsed.task_id));
33094
+ const normalizedStatus = normalizeSeedanceTaskStatus(result.status, result.failReason);
33075
33095
  const payload = {
33076
33096
  task_id: result.id,
33097
+ resourceId: result.id,
33077
33098
  status: result.status,
33099
+ ok: normalizedStatus.ok,
33100
+ normalizedStatus: normalizedStatus.status,
33101
+ statusText: normalizedStatus.statusText,
33102
+ operation: "video.check",
33103
+ terminal: normalizedStatus.terminal,
33078
33104
  video_url: result.videoUrl,
33079
33105
  last_frame_url: result.lastFrameUrl,
33080
33106
  local_path: result.localPath,
@@ -33088,7 +33114,7 @@ function createServer() {
33088
33114
  structuredContent: payload
33089
33115
  };
33090
33116
  } catch (error51) {
33091
- return errorResult(formatApiError(error51));
33117
+ return errorResult(formatApiError(error51), "video.check");
33092
33118
  }
33093
33119
  }
33094
33120
  );
@@ -33410,10 +33436,29 @@ function formatApiError(error51) {
33410
33436
  if (error51 instanceof Error) return error51.message;
33411
33437
  return String(error51);
33412
33438
  }
33413
- 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") {
33414
33450
  return {
33415
33451
  content: [{ type: "text", text: message }],
33416
- 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
+ }
33417
33462
  };
33418
33463
  }
33419
33464
  function usageGuide() {