@yoooclaw/phone-notifications 1.11.2-beta.1 → 1.11.2-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 +213 -179
- package/dist/index.cjs.map +1 -1
- package/package.json +1 -1
- package/skills/notification-monitor/SKILL.md +5 -5
package/dist/index.cjs
CHANGED
|
@@ -271,7 +271,7 @@ var init_env = __esm({
|
|
|
271
271
|
appNameMapUrl: "https://openclaw-service-dev.yoooclaw.com/api/application-config/app-package/config-all",
|
|
272
272
|
modelProxyLongRecordingSubmitTaskUrl: "https://openclaw-service-dev.yoooclaw.com/api/model-proxy/long-recording/submit-task",
|
|
273
273
|
modelProxyLongRecordingQueryTaskResultBaseUrl: "https://openclaw-service-dev.yoooclaw.com/api/model-proxy/long-recording/query-task-result",
|
|
274
|
-
accountFileDeleteUrl: "https://openclaw-service-dev.yoooclaw.com/account/file/delete"
|
|
274
|
+
accountFileDeleteUrl: "https://openclaw-service-dev.yoooclaw.com/api/account/file/delete"
|
|
275
275
|
},
|
|
276
276
|
production: {
|
|
277
277
|
lightApiUrl: "https://openclaw-service.yoootek.com/api/message/tob/sendMessage",
|
|
@@ -279,7 +279,7 @@ var init_env = __esm({
|
|
|
279
279
|
appNameMapUrl: "https://openclaw-service.yoootek.com/api/application-config/app-package/config-all",
|
|
280
280
|
modelProxyLongRecordingSubmitTaskUrl: "https://openclaw-service.yoootek.com/api/model-proxy/long-recording/submit-task",
|
|
281
281
|
modelProxyLongRecordingQueryTaskResultBaseUrl: "https://openclaw-service.yoootek.com/api/model-proxy/long-recording/query-task-result",
|
|
282
|
-
accountFileDeleteUrl: "https://openclaw-service.yoootek.com/account/file/delete"
|
|
282
|
+
accountFileDeleteUrl: "https://openclaw-service.yoootek.com/api/account/file/delete"
|
|
283
283
|
}
|
|
284
284
|
};
|
|
285
285
|
VALID_ENVS = new Set(Object.keys(ENV_CONFIG));
|
|
@@ -5438,7 +5438,7 @@ function readBuildInjectedVersion() {
|
|
|
5438
5438
|
if (false) {
|
|
5439
5439
|
return void 0;
|
|
5440
5440
|
}
|
|
5441
|
-
const version = "1.11.2-beta.
|
|
5441
|
+
const version = "1.11.2-beta.2".trim();
|
|
5442
5442
|
return version || void 0;
|
|
5443
5443
|
}
|
|
5444
5444
|
function readPluginVersionFromPackageJson() {
|
|
@@ -6002,6 +6002,32 @@ function isRecord(value) {
|
|
|
6002
6002
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
6003
6003
|
}
|
|
6004
6004
|
|
|
6005
|
+
// src/light-rules/names.ts
|
|
6006
|
+
var LIGHT_RULE_GATEWAY_METHODS = {
|
|
6007
|
+
list: "lightrules.list",
|
|
6008
|
+
create: "lightrules.create",
|
|
6009
|
+
update: "lightrules.update",
|
|
6010
|
+
delete: "lightrules.delete"
|
|
6011
|
+
};
|
|
6012
|
+
var LIGHT_RULE_GATEWAY_METHOD_LIST = [
|
|
6013
|
+
LIGHT_RULE_GATEWAY_METHODS.list,
|
|
6014
|
+
LIGHT_RULE_GATEWAY_METHODS.create,
|
|
6015
|
+
LIGHT_RULE_GATEWAY_METHODS.update,
|
|
6016
|
+
LIGHT_RULE_GATEWAY_METHODS.delete
|
|
6017
|
+
];
|
|
6018
|
+
var LIGHT_RULE_TOOL_NAMES = {
|
|
6019
|
+
list: "lightrules_list",
|
|
6020
|
+
create: "lightrules_create",
|
|
6021
|
+
update: "lightrules_update",
|
|
6022
|
+
delete: "lightrules_delete"
|
|
6023
|
+
};
|
|
6024
|
+
var LIGHT_RULE_TOOL_NAME_LIST = [
|
|
6025
|
+
LIGHT_RULE_TOOL_NAMES.list,
|
|
6026
|
+
LIGHT_RULE_TOOL_NAMES.create,
|
|
6027
|
+
LIGHT_RULE_TOOL_NAMES.update,
|
|
6028
|
+
LIGHT_RULE_TOOL_NAMES.delete
|
|
6029
|
+
];
|
|
6030
|
+
|
|
6005
6031
|
// src/light-rules/storage.ts
|
|
6006
6032
|
var import_node_fs4 = require("fs");
|
|
6007
6033
|
var import_node_path3 = require("path");
|
|
@@ -6190,7 +6216,7 @@ function registerLightRulesGateway(api, registry, logger, rememberBroadcast) {
|
|
|
6190
6216
|
return handler(opts);
|
|
6191
6217
|
});
|
|
6192
6218
|
};
|
|
6193
|
-
registerGatewayMethodWithBroadcastCapture(
|
|
6219
|
+
registerGatewayMethodWithBroadcastCapture(LIGHT_RULE_GATEWAY_METHODS.list, async ({ respond }) => {
|
|
6194
6220
|
try {
|
|
6195
6221
|
registry.reload();
|
|
6196
6222
|
const rules = registry.list().map((rule) => ({
|
|
@@ -6199,92 +6225,26 @@ function registerLightRulesGateway(api, registry, logger, rememberBroadcast) {
|
|
|
6199
6225
|
}));
|
|
6200
6226
|
respond(true, { ok: true, rules });
|
|
6201
6227
|
} catch (err2) {
|
|
6202
|
-
logger.warn(
|
|
6228
|
+
logger.warn(`${LIGHT_RULE_GATEWAY_METHODS.list} failed: ${err2?.message}`);
|
|
6203
6229
|
respond(false, null, {
|
|
6204
6230
|
code: "INTERNAL_ERROR",
|
|
6205
6231
|
message: err2?.message ?? "Unknown error"
|
|
6206
6232
|
});
|
|
6207
6233
|
}
|
|
6208
6234
|
});
|
|
6209
|
-
registerGatewayMethodWithBroadcastCapture(
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
if (!validation.valid) {
|
|
6222
|
-
respond(false, null, {
|
|
6223
|
-
code: "VALIDATION_FAILED",
|
|
6224
|
-
message: JSON.stringify(validation.errors)
|
|
6225
|
-
});
|
|
6226
|
-
return;
|
|
6227
|
-
}
|
|
6228
|
-
let repeatTimes;
|
|
6229
|
-
try {
|
|
6230
|
-
repeatTimes = normalizeRepeatTimes({ repeat, repeat_times });
|
|
6231
|
-
assertAncsRepeatTimes(repeatTimes);
|
|
6232
|
-
} catch (err2) {
|
|
6233
|
-
respond(false, null, { code: "VALIDATION_FAILED", message: err2?.message ?? "Unknown error" });
|
|
6234
|
-
return;
|
|
6235
|
-
}
|
|
6236
|
-
try {
|
|
6237
|
-
const result = await registry.create({
|
|
6238
|
-
name,
|
|
6239
|
-
title: resolvedTitle,
|
|
6240
|
-
description,
|
|
6241
|
-
segments: validation.segments,
|
|
6242
|
-
repeat_times: repeatTimes
|
|
6243
|
-
});
|
|
6244
|
-
logger.info(`Light rule created: ${name}`);
|
|
6245
|
-
respond(true, {
|
|
6246
|
-
ok: true,
|
|
6247
|
-
id: result.meta.name,
|
|
6248
|
-
name: result.meta.name,
|
|
6249
|
-
title: result.meta.title,
|
|
6250
|
-
rule: result.meta
|
|
6251
|
-
});
|
|
6252
|
-
} catch (err2) {
|
|
6253
|
-
if (err2 instanceof LightRuleError) {
|
|
6254
|
-
respond(false, null, { code: err2.code, message: err2.message });
|
|
6255
|
-
} else {
|
|
6256
|
-
logger.warn(`lightrules.create failed: ${err2?.message}`);
|
|
6257
|
-
respond(false, null, { code: "INTERNAL_ERROR", message: err2?.message ?? "Unknown error" });
|
|
6235
|
+
registerGatewayMethodWithBroadcastCapture(
|
|
6236
|
+
LIGHT_RULE_GATEWAY_METHODS.create,
|
|
6237
|
+
async ({ params, respond }) => {
|
|
6238
|
+
const { name, title, description, segments, repeat, repeat_times } = params;
|
|
6239
|
+
const resolvedTitle = typeof title === "string" && title.trim() ? title.trim() : name;
|
|
6240
|
+
if (!name || typeof name !== "string") {
|
|
6241
|
+
respond(false, null, { code: "INVALID_PARAMS", message: "name is required" });
|
|
6242
|
+
return;
|
|
6243
|
+
}
|
|
6244
|
+
if (!description || typeof description !== "string") {
|
|
6245
|
+
respond(false, null, { code: "INVALID_PARAMS", message: "description is required" });
|
|
6246
|
+
return;
|
|
6258
6247
|
}
|
|
6259
|
-
}
|
|
6260
|
-
});
|
|
6261
|
-
registerGatewayMethodWithBroadcastCapture("lightrules.update", async ({ params, respond }) => {
|
|
6262
|
-
const { title, description, segments, repeat, repeat_times, enabled } = params;
|
|
6263
|
-
const name = resolveRuleIdentifier(params);
|
|
6264
|
-
const resolvedTitle = typeof title === "string" ? title.trim() : void 0;
|
|
6265
|
-
if (!name) {
|
|
6266
|
-
respond(false, null, {
|
|
6267
|
-
code: "INVALID_PARAMS",
|
|
6268
|
-
message: "name is required (or provide id/ruleId/ruleName)"
|
|
6269
|
-
});
|
|
6270
|
-
return;
|
|
6271
|
-
}
|
|
6272
|
-
if (title !== void 0 && !resolvedTitle) {
|
|
6273
|
-
respond(false, null, {
|
|
6274
|
-
code: "INVALID_PARAMS",
|
|
6275
|
-
message: "title must be a non-empty string"
|
|
6276
|
-
});
|
|
6277
|
-
return;
|
|
6278
|
-
}
|
|
6279
|
-
if (description !== void 0 && typeof description !== "string") {
|
|
6280
|
-
respond(false, null, {
|
|
6281
|
-
code: "INVALID_PARAMS",
|
|
6282
|
-
message: "description must be a string"
|
|
6283
|
-
});
|
|
6284
|
-
return;
|
|
6285
|
-
}
|
|
6286
|
-
let validatedSegments;
|
|
6287
|
-
if (segments !== void 0) {
|
|
6288
6248
|
const validation = validateSegments(segments);
|
|
6289
6249
|
if (!validation.valid) {
|
|
6290
6250
|
respond(false, null, {
|
|
@@ -6293,72 +6253,162 @@ function registerLightRulesGateway(api, registry, logger, rememberBroadcast) {
|
|
|
6293
6253
|
});
|
|
6294
6254
|
return;
|
|
6295
6255
|
}
|
|
6296
|
-
|
|
6297
|
-
}
|
|
6298
|
-
let repeatTimes;
|
|
6299
|
-
if (repeat !== void 0 || repeat_times !== void 0) {
|
|
6256
|
+
let repeatTimes;
|
|
6300
6257
|
try {
|
|
6301
6258
|
repeatTimes = normalizeRepeatTimes({ repeat, repeat_times });
|
|
6302
6259
|
assertAncsRepeatTimes(repeatTimes);
|
|
6303
6260
|
} catch (err2) {
|
|
6304
|
-
respond(false, null, {
|
|
6261
|
+
respond(false, null, {
|
|
6262
|
+
code: "VALIDATION_FAILED",
|
|
6263
|
+
message: err2?.message ?? "Unknown error"
|
|
6264
|
+
});
|
|
6305
6265
|
return;
|
|
6306
6266
|
}
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
6330
|
-
|
|
6331
|
-
|
|
6267
|
+
try {
|
|
6268
|
+
const result = await registry.create({
|
|
6269
|
+
name,
|
|
6270
|
+
title: resolvedTitle,
|
|
6271
|
+
description,
|
|
6272
|
+
segments: validation.segments,
|
|
6273
|
+
repeat_times: repeatTimes
|
|
6274
|
+
});
|
|
6275
|
+
logger.info(`Light rule created: ${name}`);
|
|
6276
|
+
respond(true, {
|
|
6277
|
+
ok: true,
|
|
6278
|
+
id: result.meta.name,
|
|
6279
|
+
name: result.meta.name,
|
|
6280
|
+
title: result.meta.title,
|
|
6281
|
+
rule: result.meta
|
|
6282
|
+
});
|
|
6283
|
+
} catch (err2) {
|
|
6284
|
+
if (err2 instanceof LightRuleError) {
|
|
6285
|
+
respond(false, null, { code: err2.code, message: err2.message });
|
|
6286
|
+
} else {
|
|
6287
|
+
logger.warn(`${LIGHT_RULE_GATEWAY_METHODS.create} failed: ${err2?.message}`);
|
|
6288
|
+
respond(false, null, {
|
|
6289
|
+
code: "INTERNAL_ERROR",
|
|
6290
|
+
message: err2?.message ?? "Unknown error"
|
|
6291
|
+
});
|
|
6292
|
+
}
|
|
6332
6293
|
}
|
|
6333
6294
|
}
|
|
6334
|
-
|
|
6335
|
-
registerGatewayMethodWithBroadcastCapture(
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6295
|
+
);
|
|
6296
|
+
registerGatewayMethodWithBroadcastCapture(
|
|
6297
|
+
LIGHT_RULE_GATEWAY_METHODS.update,
|
|
6298
|
+
async ({ params, respond }) => {
|
|
6299
|
+
const { title, description, segments, repeat, repeat_times, enabled } = params;
|
|
6300
|
+
const name = resolveRuleIdentifier(params);
|
|
6301
|
+
const resolvedTitle = typeof title === "string" ? title.trim() : void 0;
|
|
6302
|
+
if (!name) {
|
|
6303
|
+
respond(false, null, {
|
|
6304
|
+
code: "INVALID_PARAMS",
|
|
6305
|
+
message: "name is required (or provide id/ruleId/ruleName)"
|
|
6306
|
+
});
|
|
6307
|
+
return;
|
|
6308
|
+
}
|
|
6309
|
+
if (title !== void 0 && !resolvedTitle) {
|
|
6310
|
+
respond(false, null, {
|
|
6311
|
+
code: "INVALID_PARAMS",
|
|
6312
|
+
message: "title must be a non-empty string"
|
|
6313
|
+
});
|
|
6314
|
+
return;
|
|
6315
|
+
}
|
|
6316
|
+
if (description !== void 0 && typeof description !== "string") {
|
|
6317
|
+
respond(false, null, {
|
|
6318
|
+
code: "INVALID_PARAMS",
|
|
6319
|
+
message: "description must be a string"
|
|
6320
|
+
});
|
|
6321
|
+
return;
|
|
6322
|
+
}
|
|
6323
|
+
let validatedSegments;
|
|
6324
|
+
if (segments !== void 0) {
|
|
6325
|
+
const validation = validateSegments(segments);
|
|
6326
|
+
if (!validation.valid) {
|
|
6327
|
+
respond(false, null, {
|
|
6328
|
+
code: "VALIDATION_FAILED",
|
|
6329
|
+
message: JSON.stringify(validation.errors)
|
|
6330
|
+
});
|
|
6331
|
+
return;
|
|
6332
|
+
}
|
|
6333
|
+
validatedSegments = validation.segments;
|
|
6334
|
+
}
|
|
6335
|
+
let repeatTimes;
|
|
6336
|
+
if (repeat !== void 0 || repeat_times !== void 0) {
|
|
6337
|
+
try {
|
|
6338
|
+
repeatTimes = normalizeRepeatTimes({ repeat, repeat_times });
|
|
6339
|
+
assertAncsRepeatTimes(repeatTimes);
|
|
6340
|
+
} catch (err2) {
|
|
6341
|
+
respond(false, null, {
|
|
6342
|
+
code: "VALIDATION_FAILED",
|
|
6343
|
+
message: err2?.message ?? "Unknown error"
|
|
6344
|
+
});
|
|
6345
|
+
return;
|
|
6346
|
+
}
|
|
6347
|
+
}
|
|
6348
|
+
try {
|
|
6349
|
+
const result = await registry.update({
|
|
6350
|
+
name,
|
|
6351
|
+
title: resolvedTitle,
|
|
6352
|
+
description,
|
|
6353
|
+
segments: validatedSegments,
|
|
6354
|
+
repeat_times: repeatTimes,
|
|
6355
|
+
enabled
|
|
6356
|
+
});
|
|
6357
|
+
logger.info(`Light rule updated: ${name}`);
|
|
6358
|
+
respond(true, {
|
|
6359
|
+
ok: true,
|
|
6360
|
+
id: result.meta.name,
|
|
6361
|
+
name: result.meta.name,
|
|
6362
|
+
title: result.meta.title,
|
|
6363
|
+
updated: true,
|
|
6364
|
+
rule: result.meta
|
|
6365
|
+
});
|
|
6366
|
+
} catch (err2) {
|
|
6367
|
+
if (err2 instanceof LightRuleError) {
|
|
6368
|
+
respond(false, null, { code: err2.code, message: err2.message });
|
|
6369
|
+
} else {
|
|
6370
|
+
logger.warn(`${LIGHT_RULE_GATEWAY_METHODS.update} failed: ${err2?.message}`);
|
|
6371
|
+
respond(false, null, {
|
|
6372
|
+
code: "INTERNAL_ERROR",
|
|
6373
|
+
message: err2?.message ?? "Unknown error"
|
|
6374
|
+
});
|
|
6375
|
+
}
|
|
6376
|
+
}
|
|
6343
6377
|
}
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6378
|
+
);
|
|
6379
|
+
registerGatewayMethodWithBroadcastCapture(
|
|
6380
|
+
LIGHT_RULE_GATEWAY_METHODS.delete,
|
|
6381
|
+
async ({ params, respond }) => {
|
|
6382
|
+
const name = resolveRuleIdentifier(params);
|
|
6383
|
+
if (!name) {
|
|
6384
|
+
respond(false, null, {
|
|
6385
|
+
code: "INVALID_PARAMS",
|
|
6386
|
+
message: "name is required (or provide id/ruleId/ruleName)"
|
|
6387
|
+
});
|
|
6388
|
+
return;
|
|
6389
|
+
}
|
|
6390
|
+
try {
|
|
6391
|
+
const result = await registry.delete(name);
|
|
6392
|
+
logger.info(`Light rule deleted: ${result.name}`);
|
|
6393
|
+
respond(true, {
|
|
6394
|
+
ok: true,
|
|
6395
|
+
id: result.name,
|
|
6396
|
+
name: result.name,
|
|
6397
|
+
deleted: true
|
|
6398
|
+
});
|
|
6399
|
+
} catch (err2) {
|
|
6400
|
+
if (err2 instanceof LightRuleError) {
|
|
6401
|
+
respond(false, null, { code: err2.code, message: err2.message });
|
|
6402
|
+
} else {
|
|
6403
|
+
logger.warn(`${LIGHT_RULE_GATEWAY_METHODS.delete} failed: ${err2?.message}`);
|
|
6404
|
+
respond(false, null, {
|
|
6405
|
+
code: "INTERNAL_ERROR",
|
|
6406
|
+
message: err2?.message ?? "Unknown error"
|
|
6407
|
+
});
|
|
6408
|
+
}
|
|
6359
6409
|
}
|
|
6360
6410
|
}
|
|
6361
|
-
|
|
6411
|
+
);
|
|
6362
6412
|
}
|
|
6363
6413
|
|
|
6364
6414
|
// src/light-rules/registry.ts
|
|
@@ -6759,17 +6809,11 @@ function err(code, message) {
|
|
|
6759
6809
|
const data = { ok: false, error: { code, message } };
|
|
6760
6810
|
return { content: [{ type: "text", text: JSON.stringify(data) }], details: data };
|
|
6761
6811
|
}
|
|
6762
|
-
function registerToolWithAliases(api, tool, aliases) {
|
|
6763
|
-
api.registerTool(tool);
|
|
6764
|
-
for (const alias of aliases) {
|
|
6765
|
-
api.registerTool({ ...tool, name: alias });
|
|
6766
|
-
}
|
|
6767
|
-
}
|
|
6768
6812
|
function registerLightRulesTools(api, registry, logger) {
|
|
6769
|
-
|
|
6770
|
-
name:
|
|
6813
|
+
api.registerTool({
|
|
6814
|
+
name: LIGHT_RULE_TOOL_NAMES.list,
|
|
6771
6815
|
label: "List Light Rules",
|
|
6772
|
-
description: '\u5217\u51FA\u6240\u6709\u706F\u6548\u89C4\u5219\uFF08\u5305\u542B enabled/disabled \u72B6\u6001\uFF09\u3002\u5F53\u7528\u6237\u8BF4"\u5217\u51FA\u706F\u6548\u89C4\u5219"\u3001"\u6709\u54EA\u4E9B\u706F\u6548\u89C4\u5219"\u3001"\u67E5\u770B\u89C4\u5219"\u7B49\u65F6\u8C03\u7528\u3002\u6CE8\u610F\uFF1A\u706F\u6548\u89C4\u5219\u7684\u6240\u6709 CRUD \u64CD\u4F5C\u5FC5\u987B\u901A\u8FC7
|
|
6816
|
+
description: '\u5217\u51FA\u6240\u6709\u706F\u6548\u89C4\u5219\uFF08\u5305\u542B enabled/disabled \u72B6\u6001\uFF09\u3002\u5F53\u7528\u6237\u8BF4"\u5217\u51FA\u706F\u6548\u89C4\u5219"\u3001"\u6709\u54EA\u4E9B\u706F\u6548\u89C4\u5219"\u3001"\u67E5\u770B\u89C4\u5219"\u7B49\u65F6\u8C03\u7528\u3002\u6CE8\u610F\uFF1A\u706F\u6548\u89C4\u5219\u7684\u6240\u6709 CRUD \u64CD\u4F5C\u5FC5\u987B\u901A\u8FC7 lightrules_* \u5DE5\u5177\u5B8C\u6210\uFF0C\u7981\u6B62\u76F4\u63A5\u7528 write/edit \u4FEE\u6539 tasks/*/meta.json\u3002',
|
|
6773
6817
|
parameters: { type: "object", properties: {}, additionalProperties: false },
|
|
6774
6818
|
async execute(_toolCallId, _params) {
|
|
6775
6819
|
try {
|
|
@@ -6777,13 +6821,13 @@ function registerLightRulesTools(api, registry, logger) {
|
|
|
6777
6821
|
const rules = registry.list().map((rule) => ({ ...rule, id: rule.name }));
|
|
6778
6822
|
return ok({ ok: true, rules });
|
|
6779
6823
|
} catch (e) {
|
|
6780
|
-
logger.warn(
|
|
6824
|
+
logger.warn(`${LIGHT_RULE_TOOL_NAMES.list} tool failed: ${e?.message}`);
|
|
6781
6825
|
return err("INTERNAL_ERROR", e?.message ?? "Unknown error");
|
|
6782
6826
|
}
|
|
6783
6827
|
}
|
|
6784
|
-
}
|
|
6785
|
-
|
|
6786
|
-
name:
|
|
6828
|
+
});
|
|
6829
|
+
api.registerTool({
|
|
6830
|
+
name: LIGHT_RULE_TOOL_NAMES.create,
|
|
6787
6831
|
label: "Create Light Rule",
|
|
6788
6832
|
description: '\u521B\u5EFA\u4E00\u6761\u6301\u4E45\u706F\u6548\u89C4\u5219\uFF0C\u6307\u5B9A\u5185\u90E8\u6807\u8BC6 name\u3001\u5C55\u793A\u540D title\u3001\u81EA\u7136\u8BED\u8A00\u89E6\u53D1\u63CF\u8FF0\u548C\u706F\u6548\u53C2\u6570\u3002\u89C4\u5219\u4F1A\u4FDD\u5B58\u5230 tasks/<name>/meta.json\uFF0C\u5E76\u7531\u901A\u77E5\u5230\u8FBE\u540E\u7684\u4E8B\u4EF6\u9A71\u52A8\u8BC4\u4F30\u89E6\u53D1\u3002\u5F53\u7528\u6237\u8BF4"\u6536\u5230\u67D0\u7C7B\u901A\u77E5/\u6D88\u606F\u65F6\u4EAE\u706F/\u95EA\u706F/\u53D8\u706F\u6548"\u3001"\u5F53\u8001\u677F\u53D1\u6D88\u606F\u4EAE\u7EA2\u706F"\u3001"\u65B0\u589E/\u521B\u5EFA\u706F\u6548\u89C4\u5219"\u7B49\u65F6\u8C03\u7528\u3002\u4E0D\u8981\u76F4\u63A5\u8C03\u7528 light_control \u4EE3\u66FF\u521B\u5EFA\u89C4\u5219\uFF1Blight_control \u53EA\u4F1A\u7ACB\u5373\u4EAE\u4E00\u6B21\u706F\uFF0C\u4E0D\u4F1A\u51FA\u73B0\u5728\u706F\u6548\u89C4\u5219\u67E5\u8BE2\u4E2D\u3002',
|
|
6789
6833
|
parameters: {
|
|
@@ -6834,7 +6878,7 @@ function registerLightRulesTools(api, registry, logger) {
|
|
|
6834
6878
|
segments: validation.segments,
|
|
6835
6879
|
repeat_times: repeatTimes
|
|
6836
6880
|
});
|
|
6837
|
-
logger.info(
|
|
6881
|
+
logger.info(`${LIGHT_RULE_TOOL_NAMES.create} tool: created ${name}`);
|
|
6838
6882
|
return ok({
|
|
6839
6883
|
ok: true,
|
|
6840
6884
|
id: result.meta.name,
|
|
@@ -6844,13 +6888,13 @@ function registerLightRulesTools(api, registry, logger) {
|
|
|
6844
6888
|
});
|
|
6845
6889
|
} catch (e) {
|
|
6846
6890
|
if (e instanceof LightRuleError) return err(e.code, e.message);
|
|
6847
|
-
logger.warn(
|
|
6891
|
+
logger.warn(`${LIGHT_RULE_TOOL_NAMES.create} tool failed: ${e?.message}`);
|
|
6848
6892
|
return err("INTERNAL_ERROR", e?.message ?? "Unknown error");
|
|
6849
6893
|
}
|
|
6850
6894
|
}
|
|
6851
|
-
}
|
|
6852
|
-
|
|
6853
|
-
name:
|
|
6895
|
+
});
|
|
6896
|
+
api.registerTool({
|
|
6897
|
+
name: LIGHT_RULE_TOOL_NAMES.update,
|
|
6854
6898
|
label: "Update Light Rule",
|
|
6855
6899
|
description: '\u4FEE\u6539\u706F\u6548\u89C4\u5219\uFF08\u542F\u7528/\u7981\u7528\u3001\u6539 title\u3001\u6539\u63CF\u8FF0\u3001\u6539\u706F\u6548\u53C2\u6570\uFF09\u3002\u5F53\u7528\u6237\u8BF4"\u7981\u7528\u67D0\u6761\u89C4\u5219"\u3001"\u542F\u7528\u89C4\u5219"\u3001"\u4FEE\u6539\u706F\u6548\u89C4\u5219"\u7B49\u65F6\u8C03\u7528\u3002',
|
|
6856
6900
|
parameters: {
|
|
@@ -6902,7 +6946,7 @@ function registerLightRulesTools(api, registry, logger) {
|
|
|
6902
6946
|
repeat_times: repeatTimes,
|
|
6903
6947
|
enabled
|
|
6904
6948
|
});
|
|
6905
|
-
logger.info(
|
|
6949
|
+
logger.info(`${LIGHT_RULE_TOOL_NAMES.update} tool: updated ${name}`);
|
|
6906
6950
|
return ok({
|
|
6907
6951
|
ok: true,
|
|
6908
6952
|
name: result.meta.name,
|
|
@@ -6912,13 +6956,13 @@ function registerLightRulesTools(api, registry, logger) {
|
|
|
6912
6956
|
});
|
|
6913
6957
|
} catch (e) {
|
|
6914
6958
|
if (e instanceof LightRuleError) return err(e.code, e.message);
|
|
6915
|
-
logger.warn(
|
|
6959
|
+
logger.warn(`${LIGHT_RULE_TOOL_NAMES.update} tool failed: ${e?.message}`);
|
|
6916
6960
|
return err("INTERNAL_ERROR", e?.message ?? "Unknown error");
|
|
6917
6961
|
}
|
|
6918
6962
|
}
|
|
6919
|
-
}
|
|
6920
|
-
|
|
6921
|
-
name:
|
|
6963
|
+
});
|
|
6964
|
+
api.registerTool({
|
|
6965
|
+
name: LIGHT_RULE_TOOL_NAMES.delete,
|
|
6922
6966
|
label: "Delete Light Rule",
|
|
6923
6967
|
description: '\u5220\u9664\u4E00\u6761\u706F\u6548\u89C4\u5219\uFF08\u4E0D\u53EF\u6062\u590D\uFF09\u3002\u5F53\u7528\u6237\u8BF4"\u5220\u9664\u706F\u6548\u89C4\u5219"\u3001"\u79FB\u9664\u89C4\u5219"\u7B49\u65F6\u8C03\u7528\u3002',
|
|
6924
6968
|
parameters: {
|
|
@@ -6935,15 +6979,15 @@ function registerLightRulesTools(api, registry, logger) {
|
|
|
6935
6979
|
return err("INVALID_PARAMS", "name is required");
|
|
6936
6980
|
try {
|
|
6937
6981
|
const result = await registry.delete(name);
|
|
6938
|
-
logger.info(
|
|
6982
|
+
logger.info(`${LIGHT_RULE_TOOL_NAMES.delete} tool: deleted ${name}`);
|
|
6939
6983
|
return ok({ ok: true, name: result.name, deleted: true });
|
|
6940
6984
|
} catch (e) {
|
|
6941
6985
|
if (e instanceof LightRuleError) return err(e.code, e.message);
|
|
6942
|
-
logger.warn(
|
|
6986
|
+
logger.warn(`${LIGHT_RULE_TOOL_NAMES.delete} tool failed: ${e?.message}`);
|
|
6943
6987
|
return err("INTERNAL_ERROR", e?.message ?? "Unknown error");
|
|
6944
6988
|
}
|
|
6945
6989
|
}
|
|
6946
|
-
}
|
|
6990
|
+
});
|
|
6947
6991
|
}
|
|
6948
6992
|
|
|
6949
6993
|
// src/light-rules/inline-evaluator.ts
|
|
@@ -8291,17 +8335,7 @@ function resolveConfigPath2() {
|
|
|
8291
8335
|
if (fromEnv) return fromEnv;
|
|
8292
8336
|
return (0, import_node_path11.join)((0, import_node_os2.homedir)(), ".openclaw", "openclaw.json");
|
|
8293
8337
|
}
|
|
8294
|
-
var LIGHT_TOOLS = [
|
|
8295
|
-
"light_control",
|
|
8296
|
-
"lightrules.list",
|
|
8297
|
-
"lightrules.create",
|
|
8298
|
-
"lightrules.update",
|
|
8299
|
-
"lightrules.delete",
|
|
8300
|
-
"lightrules_list",
|
|
8301
|
-
"lightrules_create",
|
|
8302
|
-
"lightrules_update",
|
|
8303
|
-
"lightrules_delete"
|
|
8304
|
-
];
|
|
8338
|
+
var LIGHT_TOOLS = ["light_control", ...LIGHT_RULE_TOOL_NAME_LIST];
|
|
8305
8339
|
function upsertLightControlAlsoAllow(cfg) {
|
|
8306
8340
|
if (!isObject(cfg.tools)) cfg.tools = {};
|
|
8307
8341
|
const toolsAlsoAllow = ensureArray(cfg.tools, "alsoAllow");
|
|
@@ -9458,7 +9492,7 @@ function registerLightControlTool(api, logger) {
|
|
|
9458
9492
|
api.registerTool({
|
|
9459
9493
|
name: "light_control",
|
|
9460
9494
|
label: "Light Control",
|
|
9461
|
-
description:
|
|
9495
|
+
description: `\u7ACB\u5373\u63A7\u5236\u786C\u4EF6\u706F\u6548\uFF08\u4E00\u6B21\u6027\u6267\u884C\uFF0C\u4E0D\u4F1A\u521B\u5EFA\u6216\u4FDD\u5B58\u901A\u77E5\u89E6\u53D1\u89C4\u5219\uFF09\uFF0C\u652F\u6301 1\u201312 \u6BB5\u987A\u5E8F\u706F\u6548\uFF0C\u6BCF\u6BB5\u72EC\u7ACB\u53C2\u6570\uFF086 \u79CD\u6A21\u5F0F\uFF1A\u6CE2\u6D6A/\u547C\u5438/\u9891\u95EA/\u5E38\u4EAE/\u6D41\u5149/\u9010\u7EC4\u50CF\u7D20\u5E27\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"\u3001"\u6D4B\u8BD5/\u9884\u89C8\u706F\u6548"\u7B49\u4E0E\u5F53\u524D\u5373\u65F6\u706F\u5149\u63A7\u5236\u76F8\u5173\u7684\u8868\u8FBE\u65F6\u8C03\u7528\u3002\u5982\u679C\u7528\u6237\u8BF4"\u6536\u5230\u67D0\u7C7B\u901A\u77E5/\u6D88\u606F\u65F6\u4EAE\u706F/\u95EA\u706F/\u53D8\u706F\u6548"\uFF0C\u90A3\u662F\u6301\u4E45\u706F\u6548\u89C4\u5219\uFF0C\u6539\u7528 ${LIGHT_RULE_TOOL_NAMES.create} \u6216 ${LIGHT_RULE_TOOL_NAMES.update}\u3002`,
|
|
9462
9496
|
parameters: lightControlParameters,
|
|
9463
9497
|
async execute(_toolCallId, params) {
|
|
9464
9498
|
let apiKey;
|
|
@@ -13193,9 +13227,9 @@ function isPluginCliInvocation(argv = process.argv) {
|
|
|
13193
13227
|
// src/index.ts
|
|
13194
13228
|
var LIGHT_RULE_PROMPT_GUIDANCE = [
|
|
13195
13229
|
"\u706F\u6548\u89C4\u5219\u8DEF\u7531\u63D0\u793A\uFF1A",
|
|
13196
|
-
|
|
13230
|
+
`- \u5F53\u7528\u6237\u8868\u8FBE\u201C\u6536\u5230/\u5F53/\u5982\u679C/\u6709\u67D0\u7C7B\u901A\u77E5\u6216\u6D88\u606F\u65F6\uFF0C\u4EAE\u706F/\u95EA\u706F/\u53D8\u6210\u67D0\u79CD\u706F\u6548\u201D\u65F6\uFF0C\u8FD9\u662F\u6301\u4E45\u706F\u6548\u89C4\u5219\u8BF7\u6C42\uFF0C\u5FC5\u987B\u8C03\u7528 ${LIGHT_RULE_TOOL_NAMES.create} \u6216 ${LIGHT_RULE_TOOL_NAMES.update}\u3002`,
|
|
13197
13231
|
"- \u4E0D\u8981\u4E3A\u8FD9\u7C7B\u901A\u77E5\u89E6\u53D1\u89C4\u5219\u76F4\u63A5\u8C03\u7528 light_control\uFF1Blight_control \u53EA\u7528\u4E8E\u5F53\u524D\u7ACB\u5373\u6267\u884C\u7684\u4E00\u6B21\u6027\u706F\u6548\u3001\u6D4B\u8BD5\u6216\u9884\u89C8\u3002",
|
|
13198
|
-
"- \u4E0D\u8981\u624B\u5199\u6216\u7F16\u8F91 tasks/*/meta.json\uFF1B\u706F\u6548\u89C4\u5219\u7684\u521B\u5EFA\u3001\u4FEE\u6539\u3001\u5220\u9664\u548C\u67E5\u8BE2\u90FD\u8D70
|
|
13232
|
+
"- \u4E0D\u8981\u624B\u5199\u6216\u7F16\u8F91 tasks/*/meta.json\uFF1B\u706F\u6548\u89C4\u5219\u7684\u521B\u5EFA\u3001\u4FEE\u6539\u3001\u5220\u9664\u548C\u67E5\u8BE2\u90FD\u8D70 lightrules_* \u5DE5\u5177\u3002"
|
|
13199
13233
|
].join("\n");
|
|
13200
13234
|
var index_default = {
|
|
13201
13235
|
id: "phone-notifications",
|
|
@@ -13330,7 +13364,7 @@ var index_default = {
|
|
|
13330
13364
|
registerLightRulesGateway(api, lightRuleRegistry, logger, cacheBroadcast);
|
|
13331
13365
|
registerLightRulesTools(api, lightRuleRegistry, logger);
|
|
13332
13366
|
logger.info(
|
|
13333
|
-
|
|
13367
|
+
`\u706F\u6548\u89C4\u5219\u65B9\u6CD5\u5DF2\u6CE8\u518C: gateway=${LIGHT_RULE_GATEWAY_METHOD_LIST.join(", ")}; tools=${LIGHT_RULE_TOOL_NAME_LIST.join(", ")}`
|
|
13334
13368
|
);
|
|
13335
13369
|
autoUpdateLifecycle = registerAutoUpdateLifecycle({
|
|
13336
13370
|
api,
|