@yoooclaw/phone-notifications 1.11.0-beta.1 → 1.11.0-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.
package/dist/index.cjs CHANGED
@@ -290,7 +290,7 @@ function buildTranscriptDataFilename(recordingId) {
290
290
  }
291
291
  function buildTranscriptDocument(params) {
292
292
  const segments = normalizeSegments(params.segments);
293
- const text = normalizeOptionalText(params.text) ?? joinSegmentsText(segments) ?? "";
293
+ const text = normalizePossiblyEmptyText(params.text) ?? joinSegmentsText(segments) ?? "";
294
294
  return {
295
295
  schemaVersion: TRANSCRIPT_DOCUMENT_SCHEMA_VERSION,
296
296
  recordingId: params.recordingId,
@@ -304,7 +304,7 @@ function buildTranscriptDocument(params) {
304
304
  normalized: {
305
305
  title: normalizeOptionalText(params.title),
306
306
  category: normalizeOptionalText(params.category),
307
- summary: normalizeOptionalText(params.summary),
307
+ summary: normalizePossiblyEmptyText(params.summary),
308
308
  text,
309
309
  segments
310
310
  },
@@ -335,11 +335,11 @@ function parseTranscriptDocument(value) {
335
335
  }
336
336
  function extractTranscriptTextFromDocument(doc) {
337
337
  if (!doc) return void 0;
338
- return normalizeOptionalText(doc.normalized.text) ?? joinSegmentsText(doc.normalized.segments);
338
+ return normalizePossiblyEmptyText(doc.normalized.text) ?? joinSegmentsText(doc.normalized.segments);
339
339
  }
340
340
  function extractTranscriptSummaryFromDocument(doc) {
341
341
  if (!doc) return void 0;
342
- return normalizeOptionalText(doc.normalized.summary);
342
+ return normalizePossiblyEmptyText(doc.normalized.summary);
343
343
  }
344
344
  function extractTranscriptTitleFromDocument(doc) {
345
345
  if (!doc) return void 0;
@@ -392,14 +392,14 @@ function normalizeDocumentBody(value) {
392
392
  }
393
393
  const normalized = value;
394
394
  const segments = normalizeSegments(normalized.segments);
395
- const text = normalizeOptionalText(normalized.text) ?? joinSegmentsText(segments);
396
- if (!text) {
395
+ const text = normalizePossiblyEmptyText(normalized.text) ?? joinSegmentsText(segments);
396
+ if (text === void 0) {
397
397
  return void 0;
398
398
  }
399
399
  return {
400
400
  title: normalizeOptionalText(normalized.title),
401
401
  category: normalizeOptionalText(normalized.category),
402
- summary: normalizeOptionalText(normalized.summary),
402
+ summary: normalizePossiblyEmptyText(normalized.summary),
403
403
  text,
404
404
  segments
405
405
  };
@@ -465,6 +465,9 @@ function extractRawSourceTextList(raw) {
465
465
  function normalizeOptionalText(value) {
466
466
  return typeof value === "string" && value.trim() ? value.trim() : void 0;
467
467
  }
468
+ function normalizePossiblyEmptyText(value) {
469
+ return typeof value === "string" ? value.trim() : void 0;
470
+ }
468
471
  function normalizeOptionalNumber(value) {
469
472
  return typeof value === "number" && Number.isFinite(value) ? value : void 0;
470
473
  }
@@ -1342,7 +1345,7 @@ async function runTranscriptionWorkflow(params) {
1342
1345
  return { ok: false, error: result.error };
1343
1346
  }
1344
1347
  const title = normalizeOptionalText2(result.summary) ? normalizeOptionalText2(result.summary) : extractSummary(result.text ?? "");
1345
- const summary = normalizeOptionalText2(result.summaryText);
1348
+ const summary = result.summaryText ?? "";
1346
1349
  result.summary = title;
1347
1350
  const transcriptData = buildTranscriptDocument({
1348
1351
  recordingId,
@@ -1603,16 +1606,11 @@ function buildLongRecordingSuccessResult(taskId, requestId, data, logger) {
1603
1606
  );
1604
1607
  const listResult = extractLongRecordingTextFromList(sourceTextList);
1605
1608
  const sourceText = normalizeOptionalText2(data?.recordResult?.sourceText);
1606
- const summaryText = normalizeOptionalText2(data?.recordResult?.summaryResult);
1609
+ const summaryText = normalizeOptionalText2(data?.recordResult?.summaryResult) ?? "";
1607
1610
  const title = normalizeOptionalText2(data?.recordResult?.title);
1608
1611
  const category = normalizeOptionalText2(data?.recordResult?.category);
1609
1612
  const text = listResult.text ?? sourceText ?? summaryText;
1610
- if (!text) {
1611
- return {
1612
- ok: false,
1613
- error: "Model Proxy ASR \u4EFB\u52A1\u5DF2\u5B8C\u6210\uFF0C\u4F46\u672A\u8FD4\u56DE sourceTextList\u3001sourceText \u6216 summaryResult"
1614
- };
1615
- }
1613
+ const status = normalizeLongRecordingStatus(data?.status) ?? "SUCCEEDED";
1616
1614
  if (!listResult.text && !sourceText && summaryText) {
1617
1615
  logger.warn(
1618
1616
  `[asr] Model Proxy \u957F\u5F55\u97F3\u7ED3\u679C\u7F3A\u5C11 sourceTextList/sourceText\uFF0C\u5DF2\u56DE\u9000\u4F7F\u7528 summaryResult \u4F5C\u4E3A\u8F6C\u5199\u6587\u672C: taskId=${taskId}`
@@ -1632,7 +1630,7 @@ function buildLongRecordingSuccessResult(taskId, requestId, data, logger) {
1632
1630
  provider: "model-proxy",
1633
1631
  taskId,
1634
1632
  requestId,
1635
- status: "SUCCEEDED"
1633
+ status
1636
1634
  },
1637
1635
  rawResponse: data
1638
1636
  };
@@ -5424,7 +5422,7 @@ function readBuildInjectedVersion() {
5424
5422
  if (false) {
5425
5423
  return void 0;
5426
5424
  }
5427
- const version = "1.11.0-beta.1".trim();
5425
+ const version = "1.11.0-beta.2".trim();
5428
5426
  return version || void 0;
5429
5427
  }
5430
5428
  function readPluginVersionFromPackageJson() {
@@ -6693,16 +6691,21 @@ var MODE_TO_INDEX = {
6693
6691
  wave_rainbow: 4,
6694
6692
  pixel_frame: 5
6695
6693
  };
6696
- function buildLightEffectApnsBody(segments, repeatInput) {
6694
+ function buildLightEffectApnsBody(segments, repeatInput, visibleTextOverride) {
6697
6695
  assertSegmentCount(segments);
6698
6696
  assertSegmentsValid(segments);
6699
6697
  const repeatTimes = normalizeRepeatTimes(repeatInput);
6700
6698
  assertAncsRepeatTimes(repeatTimes);
6701
- const visibleText = summarizeSegments(segments);
6699
+ const visibleText = resolveVisibleText(visibleTextOverride, segments);
6702
6700
  const separator = repeatTimes === 0 ? LED_SEPARATOR_LOOP : LED_SEPARATOR_ONCE;
6703
6701
  const payload = segments.map((segment) => encodeSegment(segment)).join("");
6704
6702
  return `${visibleText}${separator}${payload}`;
6705
6703
  }
6704
+ function resolveVisibleText(override, segments) {
6705
+ const trimmed = override?.trim();
6706
+ if (trimmed) return trimmed;
6707
+ return summarizeSegments(segments);
6708
+ }
6706
6709
  function assertSegmentCount(segments) {
6707
6710
  if (segments.length < 1 || segments.length > MAX_LIGHT_SEGMENTS) {
6708
6711
  throw new Error(`light_control supports 1-${MAX_LIGHT_SEGMENTS} segments`);
@@ -7116,7 +7119,7 @@ async function sendLightEffect(apiKey, segments, logger, repeatInput, reason) {
7116
7119
  }
7117
7120
  let bizContent;
7118
7121
  try {
7119
- bizContent = buildLightEffectApnsBody(segments, repeatInput);
7122
+ bizContent = buildLightEffectApnsBody(segments, repeatInput, reason);
7120
7123
  } catch (error) {
7121
7124
  return { ok: false, error: error?.message ?? String(error) };
7122
7125
  }
@@ -10363,7 +10366,7 @@ var RecordingStorage = class {
10363
10366
  if (entry.transcriptDataFile) {
10364
10367
  const transcriptDoc = this.readRelativeTranscriptDocument(entry.transcriptDataFile);
10365
10368
  const transcriptFromJson = extractTranscriptTextFromDocument(transcriptDoc);
10366
- if (transcriptFromJson) {
10369
+ if (transcriptFromJson !== void 0) {
10367
10370
  return transcriptFromJson;
10368
10371
  }
10369
10372
  }