@yoooclaw/phone-notifications 1.10.6 → 1.10.8

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.10.6".trim();
5425
+ const version = "1.10.8".trim();
5428
5426
  return version || void 0;
5429
5427
  }
5430
5428
  function readPluginVersionFromPackageJson() {
@@ -7009,16 +7007,21 @@ var MODE_TO_INDEX = {
7009
7007
  wave_rainbow: 4,
7010
7008
  pixel_frame: 5
7011
7009
  };
7012
- function buildLightEffectApnsBody(segments, repeatInput) {
7010
+ function buildLightEffectApnsBody(segments, repeatInput, visibleTextOverride) {
7013
7011
  assertSegmentCount(segments);
7014
7012
  assertSegmentsValid(segments);
7015
7013
  const repeatTimes = normalizeRepeatTimes(repeatInput);
7016
7014
  assertAncsRepeatTimes(repeatTimes);
7017
- const visibleText = summarizeSegments(segments);
7015
+ const visibleText = resolveVisibleText(visibleTextOverride, segments);
7018
7016
  const separator = repeatTimes === 0 ? LED_SEPARATOR_LOOP : LED_SEPARATOR_ONCE;
7019
7017
  const payload = segments.map((segment) => encodeSegment(segment)).join("");
7020
7018
  return `${visibleText}${separator}${payload}`;
7021
7019
  }
7020
+ function resolveVisibleText(override, segments) {
7021
+ const trimmed = override?.trim();
7022
+ if (trimmed) return trimmed;
7023
+ return summarizeSegments(segments);
7024
+ }
7022
7025
  function assertSegmentCount(segments) {
7023
7026
  if (segments.length < 1 || segments.length > MAX_LIGHT_SEGMENTS) {
7024
7027
  throw new Error(`light_control supports 1-${MAX_LIGHT_SEGMENTS} segments`);
@@ -8534,7 +8537,7 @@ async function sendLightEffect(apiKey, segments, logger, repeatInput, reason) {
8534
8537
  }
8535
8538
  let bizContent;
8536
8539
  try {
8537
- bizContent = buildLightEffectApnsBody(segments, repeatInput);
8540
+ bizContent = buildLightEffectApnsBody(segments, repeatInput, reason);
8538
8541
  } catch (error) {
8539
8542
  return { ok: false, error: error?.message ?? String(error) };
8540
8543
  }
@@ -10296,7 +10299,7 @@ var RecordingStorage = class {
10296
10299
  if (entry.transcriptDataFile) {
10297
10300
  const transcriptDoc = this.readRelativeTranscriptDocument(entry.transcriptDataFile);
10298
10301
  const transcriptFromJson = extractTranscriptTextFromDocument(transcriptDoc);
10299
- if (transcriptFromJson) {
10302
+ if (transcriptFromJson !== void 0) {
10300
10303
  return transcriptFromJson;
10301
10304
  }
10302
10305
  }