@yoooclaw/phone-notifications 1.8.0-beta.0 → 1.8.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.js CHANGED
@@ -3940,7 +3940,7 @@ function getAvailableEnvs() {
3940
3940
  }
3941
3941
 
3942
3942
  // src/light/sender.ts
3943
- async function sendLightEffect(apiKey, segments, logger, repeat) {
3943
+ async function sendLightEffect(apiKey, segments, logger, repeat, reason) {
3944
3944
  const apiUrl = getEnvUrls().lightApiUrl;
3945
3945
  const appKey = "7Q617S1G5WD274JI";
3946
3946
  const templateId = "1990771146010017788";
@@ -3957,7 +3957,7 @@ async function sendLightEffect(apiKey, segments, logger, repeat) {
3957
3957
  const bizUniqueId = randomUUID();
3958
3958
  const requestBody = {
3959
3959
  appKey,
3960
- bizMap: { noticeType: "APP_NOTIFICATION_IMPORTANT" },
3960
+ bizMap: { noticeType: "APP_NOTIFICATION_IMPORTANT", reason },
3961
3961
  bizUniqueId,
3962
3962
  paramsMap: { bizContent },
3963
3963
  pushType: "SPECIFY_PUSH",
@@ -5829,7 +5829,7 @@ function confirm(question) {
5829
5829
  });
5830
5830
  });
5831
5831
  }
5832
- async function runDoctor(ctx, json) {
5832
+ async function runDoctor(ctx, json, fix) {
5833
5833
  const stateDir = ctx.stateDir ?? resolveStateDir();
5834
5834
  const configPath = resolveConfigPath(stateDir);
5835
5835
  const cfg = readConfig(configPath);
@@ -5889,7 +5889,7 @@ async function runDoctor(ctx, json) {
5889
5889
  log(` \u2022 ${issue.title} \u2192 ${issue.fixDescription}`);
5890
5890
  }
5891
5891
  log();
5892
- const yes = await confirm("\u662F\u5426\u6267\u884C\u81EA\u52A8\u4FEE\u590D\uFF1F[y/N]: ");
5892
+ const yes = fix === true || await confirm("\u662F\u5426\u6267\u884C\u81EA\u52A8\u4FEE\u590D\uFF1F[y/N]: ");
5893
5893
  if (!yes) {
5894
5894
  log("\n\u5DF2\u53D6\u6D88\u3002\n");
5895
5895
  output({ ok: false, summary, fixed: 0 });
@@ -5921,8 +5921,8 @@ async function runDoctor(ctx, json) {
5921
5921
  if (fixed < fixable.length || manualCount > 0) process.exit(1);
5922
5922
  }
5923
5923
  function registerDoctor(ntf, ctx) {
5924
- ntf.command("doctor").description("\u81EA\u68C0\u73AF\u5883\u914D\u7F6E\uFF0C\u68C0\u6D4B\u5B89\u5168\u98CE\u9669\u548C\u5E38\u89C1\u95EE\u9898").option("--json", "\u4EE5 JSON \u683C\u5F0F\u8F93\u51FA\u7ED3\u679C\uFF08\u4F9B\u811A\u672C\u8C03\u7528\uFF09").action((opts) => {
5925
- return runDoctor(ctx, opts.json === true);
5924
+ ntf.command("doctor").description("\u81EA\u68C0\u73AF\u5883\u914D\u7F6E\uFF0C\u68C0\u6D4B\u5B89\u5168\u98CE\u9669\u548C\u5E38\u89C1\u95EE\u9898").option("--json", "\u4EE5 JSON \u683C\u5F0F\u8F93\u51FA\u7ED3\u679C\uFF08\u4F9B\u811A\u672C\u8C03\u7528\uFF09").option("--fix", "\u81EA\u52A8\u4FEE\u590D\u53EF\u4FEE\u590D\u7684\u95EE\u9898\uFF08\u8DF3\u8FC7\u786E\u8BA4\u63D0\u793A\uFF09").action((opts) => {
5925
+ return runDoctor(ctx, opts.json === true, opts.fix);
5926
5926
  });
5927
5927
  }
5928
5928
 
@@ -7389,7 +7389,7 @@ var index_default = {
7389
7389
  description: '\u63A7\u5236\u786C\u4EF6\u706F\u6548\uFF0C\u652F\u6301 1\u201312 \u6BB5\u987A\u5E8F\u706F\u6548\uFF0C\u6BCF\u6BB5\u72EC\u7ACB\u53C2\u6570\uFF085 \u79CD\u6A21\u5F0F\uFF1A\u6CE2\u6D6A/\u547C\u5438/\u9891\u95EA/\u5E38\u4EAE/\u6D41\u5149\uFF09\u3002Tool \u5185\u90E8\u81EA\u52A8\u91CF\u5316\u4E3A\u5D4C\u5165\u5F0F\u534F\u8BAE\u5B9A\u4E49\u7684\u79BB\u6563\u6863\u4F4D\uFF0C\u5E76\u6309\u6A21\u5F0F\u7CBE\u7B80\u4E3A\u53D8\u957F ANCS \u63A7\u5236\u5E8F\u5217\uFF0C\u901A\u8FC7 HTTP \u63A5\u53E3\u4E0B\u53D1\u706F\u6548\u6307\u4EE4\u3002\u5F53\u7528\u6237\u8BF4"\u5F00\u706F"\u3001"\u6362\u4E2A\u706F\u6548"\u3001"\u628A\u706F\u8C03\u6210\u7EA2\u8272"\u3001"\u8425\u9020\u6C1B\u56F4"\u7B49\u4E0E\u706F\u5149\u63A7\u5236\u76F8\u5173\u7684\u8868\u8FBE\u65F6\u8C03\u7528\u3002',
7390
7390
  parameters: {
7391
7391
  type: "object",
7392
- required: ["segments"],
7392
+ required: ["segments", "reason"],
7393
7393
  additionalProperties: false,
7394
7394
  properties: {
7395
7395
  segments: {
@@ -7491,6 +7491,10 @@ var index_default = {
7491
7491
  }
7492
7492
  }
7493
7493
  },
7494
+ reason: {
7495
+ type: "string",
7496
+ 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"
7497
+ },
7494
7498
  repeat: {
7495
7499
  type: "boolean",
7496
7500
  description: "true = \u65E0\u9650\u5FAA\u73AF\u64AD\u653E\uFF0Cfalse/\u4E0D\u586B = \u4EC5\u64AD\u653E\u4E00\u8F6E\u3002\u65E0\u9650\u5FAA\u73AF\u9002\u5408\u80CC\u666F\u5E38\u9A7B\u706F\u6548\uFF0C\u6CE8\u610F\u7701\u7535"
@@ -7507,8 +7511,9 @@ var index_default = {
7507
7511
  error: { code: "AUTH_REQUIRED", message: e.message }
7508
7512
  };
7509
7513
  }
7510
- const { segments, repeat } = params;
7511
- const result = await sendLightEffect(apiKey, segments, logger, repeat);
7514
+ const { segments, reason, repeat } = params;
7515
+ logger.info(`Light control reason: ${reason}`);
7516
+ const result = await sendLightEffect(apiKey, segments, logger, repeat, reason);
7512
7517
  if (!result.ok) {
7513
7518
  logger.warn(
7514
7519
  `Light control HTTP request failed: ${result.status} ${result.error}`