@yoooclaw/phone-notifications 1.11.2-beta.2 → 1.11.2-beta.3

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/dist/index.cjs CHANGED
@@ -265,13 +265,13 @@ var init_env = __esm({
265
265
  init_credentials();
266
266
  init_host();
267
267
  ENV_CONFIG = {
268
- development: {
269
- lightApiUrl: "https://openclaw-service-dev.yoooclaw.com/api/message/tob/sendMessage",
270
- relayTunnelUrl: "wss://openclaw-service-dev.yoooclaw.com/message/messages/ws/plugin",
271
- appNameMapUrl: "https://openclaw-service-dev.yoooclaw.com/api/application-config/app-package/config-all",
272
- modelProxyLongRecordingSubmitTaskUrl: "https://openclaw-service-dev.yoooclaw.com/api/model-proxy/long-recording/submit-task",
273
- modelProxyLongRecordingQueryTaskResultBaseUrl: "https://openclaw-service-dev.yoooclaw.com/api/model-proxy/long-recording/query-task-result",
274
- accountFileDeleteUrl: "https://openclaw-service-dev.yoooclaw.com/api/account/file/delete"
268
+ test: {
269
+ lightApiUrl: "https://openclaw-service-test.yoooclaw.com/api/message/tob/sendMessage",
270
+ relayTunnelUrl: "wss://openclaw-service-test.yoooclaw.com/message/messages/ws/plugin",
271
+ appNameMapUrl: "https://openclaw-service-test.yoooclaw.com/api/application-config/app-package/config-all",
272
+ modelProxyLongRecordingSubmitTaskUrl: "https://openclaw-service-test.yoooclaw.com/api/model-proxy/long-recording/submit-task",
273
+ modelProxyLongRecordingQueryTaskResultBaseUrl: "https://openclaw-service-test.yoooclaw.com/api/model-proxy/long-recording/query-task-result",
274
+ accountFileDeleteUrl: "https://openclaw-service-test.yoooclaw.com/api/account/file/delete"
275
275
  },
276
276
  production: {
277
277
  lightApiUrl: "https://openclaw-service.yoootek.com/api/message/tob/sendMessage",
@@ -5438,7 +5438,7 @@ function readBuildInjectedVersion() {
5438
5438
  if (false) {
5439
5439
  return void 0;
5440
5440
  }
5441
- const version = "1.11.2-beta.2".trim();
5441
+ const version = "1.11.2-beta.3".trim();
5442
5442
  return version || void 0;
5443
5443
  }
5444
5444
  function readPluginVersionFromPackageJson() {
@@ -7309,7 +7309,7 @@ function resolveUpdateChannel(params) {
7309
7309
  if (params.currentVersion.includes("-")) {
7310
7310
  return "beta";
7311
7311
  }
7312
- return params.envName === "development" ? "beta" : "latest";
7312
+ return params.envName === "test" ? "beta" : "latest";
7313
7313
  }
7314
7314
 
7315
7315
  // src/update/index.ts
@@ -8989,7 +8989,8 @@ function registerRecList(rec, ctx) {
8989
8989
  has_audio: !!r.audioFile,
8990
8990
  has_transcript: !!r.transcriptFile,
8991
8991
  created_at: r.metadata.created_at,
8992
- updated_at: r.updatedAt
8992
+ updated_at: r.updatedAt,
8993
+ error: r.lastError ?? null
8993
8994
  }));
8994
8995
  output({ ok: true, total: items.length, recordings: items });
8995
8996
  });
@@ -9022,6 +9023,7 @@ function registerRecStatus(rec, ctx) {
9022
9023
  transcriptFile: entry.transcriptFile ?? null,
9023
9024
  summaryFile: entry.summaryFile ?? null,
9024
9025
  title: entry.title ?? null,
9026
+ error: entry.lastError ?? null,
9025
9027
  ingestedAt: entry.ingestedAt,
9026
9028
  updatedAt: entry.updatedAt
9027
9029
  }
@@ -10010,7 +10012,8 @@ var VALID_TRANSITIONS = /* @__PURE__ */ new Map([
10010
10012
  ["pending_oss_upload", /* @__PURE__ */ new Set(["uploading_oss"])],
10011
10013
  ["uploading_oss", /* @__PURE__ */ new Set(["oss_uploaded"])],
10012
10014
  ["oss_uploaded", /* @__PURE__ */ new Set(["syncing_openclaw"])],
10013
- ["syncing_openclaw", /* @__PURE__ */ new Set(["synced"])],
10015
+ ["syncing_openclaw", /* @__PURE__ */ new Set(["synced", "sync_failed"])],
10016
+ ["sync_failed", /* @__PURE__ */ new Set(["syncing_openclaw"])],
10014
10017
  ["synced", /* @__PURE__ */ new Set(["transcribing"])],
10015
10018
  ["transcribing", /* @__PURE__ */ new Set(["transcribed", "transcribe_failed"])],
10016
10019
  ["transcribe_failed", /* @__PURE__ */ new Set(["transcribing"])],
@@ -10168,7 +10171,7 @@ var RecordingStorage = class {
10168
10171
  const existing = this.findById(id);
10169
10172
  if (existing) {
10170
10173
  const sameAudioUrl = existing.metadata.oss_audio_url === metadata.oss_audio_url;
10171
- const canPreserveSyncState = sameAudioUrl && !!existing.audioFile && existing.status !== "syncing_openclaw";
10174
+ const canPreserveSyncState = sameAudioUrl && !!existing.audioFile && existing.status !== "syncing_openclaw" && existing.status !== "sync_failed";
10172
10175
  if (canPreserveSyncState) {
10173
10176
  existing.metadata = metadata;
10174
10177
  existing.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
@@ -10193,6 +10196,7 @@ var RecordingStorage = class {
10193
10196
  existing.transcriptFile = void 0;
10194
10197
  existing.summaryFile = void 0;
10195
10198
  existing.title = void 0;
10199
+ existing.lastError = void 0;
10196
10200
  existing.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
10197
10201
  this.logger.info(`\u5F55\u97F3\u5143\u6570\u636E\u5DF2\u66F4\u65B0: ${id}`);
10198
10202
  } else {
@@ -10297,6 +10301,16 @@ var RecordingStorage = class {
10297
10301
  entry.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
10298
10302
  this.saveIndex();
10299
10303
  }
10304
+ /**
10305
+ * 记录最近一次失败原因;传 undefined 表示清除错误
10306
+ */
10307
+ setLastError(recordingId, error) {
10308
+ const entry = this.findById(recordingId);
10309
+ if (!entry) return;
10310
+ entry.lastError = error?.trim() || void 0;
10311
+ entry.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
10312
+ this.saveIndex();
10313
+ }
10300
10314
  /**
10301
10315
  * 读取摘要文本
10302
10316
  */
@@ -10565,6 +10579,9 @@ var RecordingStorage = class {
10565
10579
  needsRewrite = true;
10566
10580
  }
10567
10581
  }
10582
+ if (typeof entry.lastError === "string" && entry.lastError.trim()) {
10583
+ compacted.lastError = entry.lastError.trim();
10584
+ }
10568
10585
  return compacted;
10569
10586
  });
10570
10587
  const hadLargeFields = raw.recordings.some(
@@ -10763,6 +10780,7 @@ function emitRecordingStatus(recordingId, storage, logger, notifyStatus, error,
10763
10780
  return;
10764
10781
  }
10765
10782
  const title = extras?.title?.trim() || entry.title?.trim() || entry.metadata.name?.trim() || entry.id;
10783
+ const persistedError = entry.lastError?.trim() || void 0;
10766
10784
  try {
10767
10785
  notifyStatus({
10768
10786
  recordingId: entry.id,
@@ -10775,7 +10793,7 @@ function emitRecordingStatus(recordingId, storage, logger, notifyStatus, error,
10775
10793
  summary: extras?.summary,
10776
10794
  title,
10777
10795
  updatedAt: entry.updatedAt,
10778
- error
10796
+ error: error ?? persistedError
10779
10797
  });
10780
10798
  } catch (err2) {
10781
10799
  logger.error(
@@ -10802,6 +10820,8 @@ async function runRecordingSyncInBackground(metadata, recordingId, storage, asrC
10802
10820
  if (!downloadResult.audio.ok) {
10803
10821
  const error = `\u97F3\u9891\u4E0B\u8F7D\u5931\u8D25: ${downloadResult.audio.error}`;
10804
10822
  logger.error(`[recording-sync] ${error}: ${recordingId}`);
10823
+ storage.updateStatus(recordingId, "sync_failed");
10824
+ storage.setLastError(recordingId, error);
10805
10825
  emitRecordingStatus(
10806
10826
  recordingId,
10807
10827
  storage,
@@ -10811,6 +10831,7 @@ async function runRecordingSyncInBackground(metadata, recordingId, storage, asrC
10811
10831
  );
10812
10832
  return;
10813
10833
  }
10834
+ storage.setLastError(recordingId, void 0);
10814
10835
  storage.setAudioFile(
10815
10836
  recordingId,
10816
10837
  storage.buildAudioFilename(recordingId, metadata.oss_audio_url)
@@ -10833,7 +10854,7 @@ async function runRecordingSyncInBackground(metadata, recordingId, storage, asrC
10833
10854
  }
10834
10855
  async function handleRecordingSync(recordingId, metadata, storage, asrConfig, logger, options = {}) {
10835
10856
  const existing = storage.findById(recordingId);
10836
- const shouldDownloadAndSync = !existing || existing.metadata.oss_audio_url !== metadata.oss_audio_url || !existing.audioFile || existing.status === "syncing_openclaw";
10857
+ const shouldDownloadAndSync = !existing || existing.metadata.oss_audio_url !== metadata.oss_audio_url || !existing.audioFile || existing.status === "syncing_openclaw" || existing.status === "sync_failed";
10837
10858
  storage.ingest(recordingId, metadata);
10838
10859
  if (shouldDownloadAndSync) {
10839
10860
  runRecordingSyncInBackground(
@@ -10846,6 +10867,11 @@ async function handleRecordingSync(recordingId, metadata, storage, asrConfig, lo
10846
10867
  ).catch((err2) => {
10847
10868
  const error = `\u5F55\u97F3\u540C\u6B65\u5931\u8D25: ${err2?.message ?? err2}`;
10848
10869
  logger.error(`[recording-sync] ${error}: ${recordingId}`);
10870
+ const current2 = storage.findById(recordingId);
10871
+ if (current2?.status === "syncing_openclaw") {
10872
+ storage.updateStatus(recordingId, "sync_failed");
10873
+ }
10874
+ storage.setLastError(recordingId, error);
10849
10875
  emitRecordingStatus(
10850
10876
  recordingId,
10851
10877
  storage,
@@ -10859,8 +10885,8 @@ async function handleRecordingSync(recordingId, metadata, storage, asrConfig, lo
10859
10885
  `[recording-sync] \u5F55\u97F3\u5DF2\u5B58\u5728\u4E14\u97F3\u9891\u672A\u53D8\u5316\uFF0C\u8DF3\u8FC7\u91CD\u590D\u4E0B\u8F7D: ${recordingId}`
10860
10886
  );
10861
10887
  emitRecordingStatus(recordingId, storage, logger, options.notifyStatus);
10862
- const current = storage.findById(recordingId);
10863
- if (current?.status === "synced" && isAsrConfigured(asrConfig)) {
10888
+ const current2 = storage.findById(recordingId);
10889
+ if (current2?.status === "synced" && isAsrConfigured(asrConfig)) {
10864
10890
  triggerTranscription(
10865
10891
  recordingId,
10866
10892
  storage,
@@ -10874,10 +10900,12 @@ async function handleRecordingSync(recordingId, metadata, storage, asrConfig, lo
10874
10900
  });
10875
10901
  }
10876
10902
  }
10903
+ const current = storage.findById(recordingId);
10877
10904
  return {
10878
10905
  ok: true,
10879
10906
  recordingId,
10880
- transfer_status: storage.findById(recordingId)?.status ?? "syncing_openclaw"
10907
+ transfer_status: current?.status ?? "syncing_openclaw",
10908
+ ...current?.lastError ? { error: current.lastError } : {}
10881
10909
  };
10882
10910
  }
10883
10911
  async function triggerTranscription(recordingId, storage, asrConfig, logger, options = {}) {
@@ -10893,6 +10921,7 @@ async function triggerTranscription(recordingId, storage, asrConfig, logger, opt
10893
10921
  return;
10894
10922
  }
10895
10923
  storage.updateStatus(recordingId, "transcribing");
10924
+ storage.setLastError(recordingId, void 0);
10896
10925
  emitRecordingStatus(recordingId, storage, logger, options.notifyStatus);
10897
10926
  const audioFilePath = storage.getAudioFilePath(recordingId);
10898
10927
  const result = await runTranscriptionWorkflow({
@@ -10944,6 +10973,7 @@ async function triggerTranscription(recordingId, storage, asrConfig, logger, opt
10944
10973
  }
10945
10974
  } else {
10946
10975
  storage.updateStatus(recordingId, "transcribe_failed");
10976
+ storage.setLastError(recordingId, result.error);
10947
10977
  emitRecordingStatus(
10948
10978
  recordingId,
10949
10979
  storage,
@@ -12778,6 +12808,7 @@ var RECORDING_TRANSFER_STATUSES = /* @__PURE__ */ new Set([
12778
12808
  "uploading_oss",
12779
12809
  "oss_uploaded",
12780
12810
  "syncing_openclaw",
12811
+ "sync_failed",
12781
12812
  "synced",
12782
12813
  "transcribing",
12783
12814
  "transcribe_failed",
@@ -12801,7 +12832,8 @@ function buildRecordingListItem(entry) {
12801
12832
  audioFile: entry.audioFile,
12802
12833
  transcriptDataFile: entry.transcriptDataFile,
12803
12834
  transcriptFile: entry.transcriptFile,
12804
- updatedAt: entry.updatedAt
12835
+ updatedAt: entry.updatedAt,
12836
+ ...entry.lastError ? { error: entry.lastError } : {}
12805
12837
  };
12806
12838
  }
12807
12839
  function isRelayInternalHttpRequest2(req) {
@@ -12834,7 +12866,8 @@ function buildRecordingDetail(entry, extras) {
12834
12866
  transcript: extras?.transcript,
12835
12867
  transcriptData: extras?.transcriptData,
12836
12868
  ingestedAt: entry.ingestedAt,
12837
- updatedAt: entry.updatedAt
12869
+ updatedAt: entry.updatedAt,
12870
+ ...entry.lastError ? { error: entry.lastError } : {}
12838
12871
  };
12839
12872
  }
12840
12873
  function registerRecordingInterfaces(deps) {