@yoooclaw/phone-notifications 1.11.0 → 1.11.1

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
@@ -5422,7 +5422,7 @@ function readBuildInjectedVersion() {
5422
5422
  if (false) {
5423
5423
  return void 0;
5424
5424
  }
5425
- const version = "1.11.0".trim();
5425
+ const version = "1.11.1".trim();
5426
5426
  return version || void 0;
5427
5427
  }
5428
5428
  function readPluginVersionFromPackageJson() {
@@ -6939,12 +6939,13 @@ init_credentials();
6939
6939
  // src/light/sender.ts
6940
6940
  var import_node_crypto = require("crypto");
6941
6941
  init_env();
6942
- async function sendLightEffect(apiKey, segments, logger, repeatInput, reason) {
6942
+ async function sendLightEffect(apiKey, segments, logger, repeatInput, reason, title) {
6943
6943
  const apiUrl = getEnvUrls().lightApiUrl;
6944
6944
  const appKey = "7Q617S1G5WD274JI";
6945
6945
  const templateId = "1990771146010017800";
6946
+ const resolvedTitle = resolveLightTitle(title, reason, segments);
6946
6947
  logger?.info(
6947
- `Light sender: apiUrl=${apiUrl ?? "UNSET"}, appKey=${appKey ? appKey.substring(0, 8) + "\u2026" : "UNSET"}, templateId=${templateId ?? "UNSET"}, apiKey=${apiKey ? apiKey.substring(0, 20) + "\u2026" : "EMPTY"}, segments=${JSON.stringify(segments)}`
6948
+ `Light sender: apiUrl=${apiUrl ?? "UNSET"}, appKey=${appKey ? appKey.substring(0, 8) + "\u2026" : "UNSET"}, templateId=${templateId ?? "UNSET"}, apiKey=${apiKey ? apiKey.substring(0, 20) + "\u2026" : "EMPTY"}, title=${resolvedTitle}, reason=${reason ?? ""}, segments=${JSON.stringify(segments)}`
6948
6949
  );
6949
6950
  if (!apiUrl || !appKey || !templateId) {
6950
6951
  return {
@@ -6961,7 +6962,7 @@ async function sendLightEffect(apiKey, segments, logger, repeatInput, reason) {
6961
6962
  const bizUniqueId = (0, import_node_crypto.randomUUID)();
6962
6963
  const requestBody = {
6963
6964
  appKey,
6964
- bizMap: { noticeType: "APP_NOTIFICATION_IMPORTANT", reason },
6965
+ bizMap: { noticeType: "APP_NOTIFICATION_IMPORTANT", title: resolvedTitle, reason },
6965
6966
  bizUniqueId,
6966
6967
  paramsMap: { bizContent },
6967
6968
  pushType: "SPECIFY_PUSH",
@@ -6988,6 +6989,14 @@ async function sendLightEffect(apiKey, segments, logger, repeatInput, reason) {
6988
6989
  logger?.info(`Light sender: OK bizUniqueId=${bizUniqueId}, resBody=${resBody.substring(0, 200)}`);
6989
6990
  return { ok: true, bizUniqueId, response: JSON.parse(resBody) };
6990
6991
  }
6992
+ function resolveLightTitle(title, reason, segments) {
6993
+ const trimmedTitle = title?.trim();
6994
+ if (trimmedTitle) return trimmedTitle;
6995
+ const trimmedReason = reason?.trim();
6996
+ if (trimmedReason) return trimmedReason;
6997
+ const modeDesc = segments.map((segment) => segment.mode).join("+");
6998
+ return `Effect: ${modeDesc || "custom"}`;
6999
+ }
6991
7000
 
6992
7001
  // src/light-rules/inline-evaluator.ts
6993
7002
  var InlineLightRuleEvaluator = class {
@@ -7050,7 +7059,8 @@ var InlineLightRuleEvaluator = class {
7050
7059
  rule.segments,
7051
7060
  this.logger,
7052
7061
  { repeat_times: rule.repeat_times },
7053
- rule.description
7062
+ rule.description,
7063
+ rule.title
7054
7064
  );
7055
7065
  if (!result.ok) {
7056
7066
  this.logger.warn(
@@ -9468,6 +9478,10 @@ var lightControlParameters = {
9468
9478
  type: "string",
9469
9479
  description: "\u7ED3\u5408\u5BF9\u8BDD\u4E0A\u4E0B\u6587\uFF0C\u7B80\u8981\u8BF4\u660E\u4E3A\u4EC0\u4E48\u8981\u4EAE\u706F\uFF08\u4F8B\u5982\uFF1A\u7528\u6237\u5FC3\u60C5\u4F4E\u843D\u60F3\u8981\u6E29\u6696\u6C1B\u56F4\u3001\u5E86\u795D\u751F\u65E5\u3001\u63D0\u9192\u559D\u6C34\u7B49\uFF09\u3002\u8FD9\u4E2A\u5B57\u6BB5\u5E2E\u52A9\u8BB0\u5F55\u6BCF\u6B21\u4EAE\u706F\u7684\u610F\u56FE\u548C\u52A8\u673A\u3002"
9470
9480
  },
9481
+ title: {
9482
+ type: "string",
9483
+ description: "\u5BF9\u672C\u6B21\u4EAE\u706F\u7684\u7B80\u77ED\u6807\u9898/\u6458\u8981\uFF08\u4F8B\u5982\uFF1A\u6E29\u6696\u6C1B\u56F4\u3001\u751F\u65E5\u5E86\u795D\u3001\u559D\u6C34\u63D0\u9192\uFF09\u3002\u4E0D\u586B\u65F6\u9ED8\u8BA4\u56DE\u9000\u5230 reason\u3002"
9484
+ },
9471
9485
  repeat: {
9472
9486
  type: "boolean",
9473
9487
  description: "\u517C\u5BB9\u65E7\u53C2\u6570\u3002true = \u65E0\u9650\u5FAA\u73AF\uFF0Cfalse/\u4E0D\u586B = \u4E00\u8F6E\uFF1B\u82E5\u540C\u65F6\u63D0\u4F9B repeat_times\uFF0C\u5219\u4EE5\u540E\u8005\u4E3A\u51C6"
@@ -9495,7 +9509,7 @@ function registerLightControlTool(api, logger) {
9495
9509
  details: { ok: false, error: { code: "AUTH_REQUIRED", message: e.message } }
9496
9510
  };
9497
9511
  }
9498
- const { segments, reason, repeat, repeat_times } = params;
9512
+ const { segments, title, reason, repeat, repeat_times } = params;
9499
9513
  const validation = validateSegments(segments);
9500
9514
  if (!validation.valid) {
9501
9515
  return {
@@ -9519,13 +9533,14 @@ function registerLightControlTool(api, logger) {
9519
9533
  }
9520
9534
  };
9521
9535
  }
9522
- logger.info(`Light control reason: ${reason}`);
9536
+ logger.info(`Light control title: ${title ?? ""}, reason: ${reason}`);
9523
9537
  const result = await sendLightEffect(
9524
9538
  apiKey,
9525
9539
  validation.segments,
9526
9540
  logger,
9527
9541
  { repeat_times: repeatTimes },
9528
- reason
9542
+ reason,
9543
+ title
9529
9544
  );
9530
9545
  if (!result.ok) {
9531
9546
  logger.warn(