@yoooclaw/phone-notifications 1.11.2-beta.0 → 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
CHANGED
|
@@ -270,14 +270,16 @@ var init_env = __esm({
|
|
|
270
270
|
relayTunnelUrl: "wss://openclaw-service-dev.yoooclaw.com/message/messages/ws/plugin",
|
|
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
|
-
modelProxyLongRecordingQueryTaskResultBaseUrl: "https://openclaw-service-dev.yoooclaw.com/api/model-proxy/long-recording/query-task-result"
|
|
273
|
+
modelProxyLongRecordingQueryTaskResultBaseUrl: "https://openclaw-service-dev.yoooclaw.com/api/model-proxy/long-recording/query-task-result",
|
|
274
|
+
accountFileDeleteUrl: "https://openclaw-service-dev.yoooclaw.com/api/account/file/delete"
|
|
274
275
|
},
|
|
275
276
|
production: {
|
|
276
277
|
lightApiUrl: "https://openclaw-service.yoootek.com/api/message/tob/sendMessage",
|
|
277
278
|
relayTunnelUrl: "wss://openclaw-service.yoootek.com/message/messages/ws/plugin",
|
|
278
279
|
appNameMapUrl: "https://openclaw-service.yoootek.com/api/application-config/app-package/config-all",
|
|
279
280
|
modelProxyLongRecordingSubmitTaskUrl: "https://openclaw-service.yoootek.com/api/model-proxy/long-recording/submit-task",
|
|
280
|
-
modelProxyLongRecordingQueryTaskResultBaseUrl: "https://openclaw-service.yoootek.com/api/model-proxy/long-recording/query-task-result"
|
|
281
|
+
modelProxyLongRecordingQueryTaskResultBaseUrl: "https://openclaw-service.yoootek.com/api/model-proxy/long-recording/query-task-result",
|
|
282
|
+
accountFileDeleteUrl: "https://openclaw-service.yoootek.com/api/account/file/delete"
|
|
281
283
|
}
|
|
282
284
|
};
|
|
283
285
|
VALID_ENVS = new Set(Object.keys(ENV_CONFIG));
|
|
@@ -1796,7 +1798,7 @@ var init_asr = __esm({
|
|
|
1796
1798
|
init_env();
|
|
1797
1799
|
init_transcript_document();
|
|
1798
1800
|
DEFAULT_LONG_RECORDING_POLL_INTERVAL_MS = 2e3;
|
|
1799
|
-
DEFAULT_LONG_RECORDING_MAX_POLL_ATTEMPTS =
|
|
1801
|
+
DEFAULT_LONG_RECORDING_MAX_POLL_ATTEMPTS = 3600;
|
|
1800
1802
|
LONG_RECORDING_RUNNING_STATUSES = /* @__PURE__ */ new Set(["PENDING", "RUNNING", "SUSPENDED"]);
|
|
1801
1803
|
LONG_RECORDING_TERMINAL_FAILURE_STATUSES = /* @__PURE__ */ new Set(["FAILED", "CANCELED", "UNKNOWN"]);
|
|
1802
1804
|
}
|
|
@@ -5436,7 +5438,7 @@ function readBuildInjectedVersion() {
|
|
|
5436
5438
|
if (false) {
|
|
5437
5439
|
return void 0;
|
|
5438
5440
|
}
|
|
5439
|
-
const version = "1.11.2-beta.
|
|
5441
|
+
const version = "1.11.2-beta.2".trim();
|
|
5440
5442
|
return version || void 0;
|
|
5441
5443
|
}
|
|
5442
5444
|
function readPluginVersionFromPackageJson() {
|
|
@@ -6000,6 +6002,32 @@ function isRecord(value) {
|
|
|
6000
6002
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
6001
6003
|
}
|
|
6002
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
|
+
|
|
6003
6031
|
// src/light-rules/storage.ts
|
|
6004
6032
|
var import_node_fs4 = require("fs");
|
|
6005
6033
|
var import_node_path3 = require("path");
|
|
@@ -6188,7 +6216,7 @@ function registerLightRulesGateway(api, registry, logger, rememberBroadcast) {
|
|
|
6188
6216
|
return handler(opts);
|
|
6189
6217
|
});
|
|
6190
6218
|
};
|
|
6191
|
-
registerGatewayMethodWithBroadcastCapture(
|
|
6219
|
+
registerGatewayMethodWithBroadcastCapture(LIGHT_RULE_GATEWAY_METHODS.list, async ({ respond }) => {
|
|
6192
6220
|
try {
|
|
6193
6221
|
registry.reload();
|
|
6194
6222
|
const rules = registry.list().map((rule) => ({
|
|
@@ -6197,92 +6225,26 @@ function registerLightRulesGateway(api, registry, logger, rememberBroadcast) {
|
|
|
6197
6225
|
}));
|
|
6198
6226
|
respond(true, { ok: true, rules });
|
|
6199
6227
|
} catch (err2) {
|
|
6200
|
-
logger.warn(
|
|
6228
|
+
logger.warn(`${LIGHT_RULE_GATEWAY_METHODS.list} failed: ${err2?.message}`);
|
|
6201
6229
|
respond(false, null, {
|
|
6202
6230
|
code: "INTERNAL_ERROR",
|
|
6203
6231
|
message: err2?.message ?? "Unknown error"
|
|
6204
6232
|
});
|
|
6205
6233
|
}
|
|
6206
6234
|
});
|
|
6207
|
-
registerGatewayMethodWithBroadcastCapture(
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
if (!validation.valid) {
|
|
6220
|
-
respond(false, null, {
|
|
6221
|
-
code: "VALIDATION_FAILED",
|
|
6222
|
-
message: JSON.stringify(validation.errors)
|
|
6223
|
-
});
|
|
6224
|
-
return;
|
|
6225
|
-
}
|
|
6226
|
-
let repeatTimes;
|
|
6227
|
-
try {
|
|
6228
|
-
repeatTimes = normalizeRepeatTimes({ repeat, repeat_times });
|
|
6229
|
-
assertAncsRepeatTimes(repeatTimes);
|
|
6230
|
-
} catch (err2) {
|
|
6231
|
-
respond(false, null, { code: "VALIDATION_FAILED", message: err2?.message ?? "Unknown error" });
|
|
6232
|
-
return;
|
|
6233
|
-
}
|
|
6234
|
-
try {
|
|
6235
|
-
const result = await registry.create({
|
|
6236
|
-
name,
|
|
6237
|
-
title: resolvedTitle,
|
|
6238
|
-
description,
|
|
6239
|
-
segments: validation.segments,
|
|
6240
|
-
repeat_times: repeatTimes
|
|
6241
|
-
});
|
|
6242
|
-
logger.info(`Light rule created: ${name}`);
|
|
6243
|
-
respond(true, {
|
|
6244
|
-
ok: true,
|
|
6245
|
-
id: result.meta.name,
|
|
6246
|
-
name: result.meta.name,
|
|
6247
|
-
title: result.meta.title,
|
|
6248
|
-
rule: result.meta
|
|
6249
|
-
});
|
|
6250
|
-
} catch (err2) {
|
|
6251
|
-
if (err2 instanceof LightRuleError) {
|
|
6252
|
-
respond(false, null, { code: err2.code, message: err2.message });
|
|
6253
|
-
} else {
|
|
6254
|
-
logger.warn(`lightrules.create failed: ${err2?.message}`);
|
|
6255
|
-
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;
|
|
6256
6247
|
}
|
|
6257
|
-
}
|
|
6258
|
-
});
|
|
6259
|
-
registerGatewayMethodWithBroadcastCapture("lightrules.update", async ({ params, respond }) => {
|
|
6260
|
-
const { title, description, segments, repeat, repeat_times, enabled } = params;
|
|
6261
|
-
const name = resolveRuleIdentifier(params);
|
|
6262
|
-
const resolvedTitle = typeof title === "string" ? title.trim() : void 0;
|
|
6263
|
-
if (!name) {
|
|
6264
|
-
respond(false, null, {
|
|
6265
|
-
code: "INVALID_PARAMS",
|
|
6266
|
-
message: "name is required (or provide id/ruleId/ruleName)"
|
|
6267
|
-
});
|
|
6268
|
-
return;
|
|
6269
|
-
}
|
|
6270
|
-
if (title !== void 0 && !resolvedTitle) {
|
|
6271
|
-
respond(false, null, {
|
|
6272
|
-
code: "INVALID_PARAMS",
|
|
6273
|
-
message: "title must be a non-empty string"
|
|
6274
|
-
});
|
|
6275
|
-
return;
|
|
6276
|
-
}
|
|
6277
|
-
if (description !== void 0 && typeof description !== "string") {
|
|
6278
|
-
respond(false, null, {
|
|
6279
|
-
code: "INVALID_PARAMS",
|
|
6280
|
-
message: "description must be a string"
|
|
6281
|
-
});
|
|
6282
|
-
return;
|
|
6283
|
-
}
|
|
6284
|
-
let validatedSegments;
|
|
6285
|
-
if (segments !== void 0) {
|
|
6286
6248
|
const validation = validateSegments(segments);
|
|
6287
6249
|
if (!validation.valid) {
|
|
6288
6250
|
respond(false, null, {
|
|
@@ -6291,72 +6253,162 @@ function registerLightRulesGateway(api, registry, logger, rememberBroadcast) {
|
|
|
6291
6253
|
});
|
|
6292
6254
|
return;
|
|
6293
6255
|
}
|
|
6294
|
-
|
|
6295
|
-
}
|
|
6296
|
-
let repeatTimes;
|
|
6297
|
-
if (repeat !== void 0 || repeat_times !== void 0) {
|
|
6256
|
+
let repeatTimes;
|
|
6298
6257
|
try {
|
|
6299
6258
|
repeatTimes = normalizeRepeatTimes({ repeat, repeat_times });
|
|
6300
6259
|
assertAncsRepeatTimes(repeatTimes);
|
|
6301
6260
|
} catch (err2) {
|
|
6302
|
-
respond(false, null, {
|
|
6261
|
+
respond(false, null, {
|
|
6262
|
+
code: "VALIDATION_FAILED",
|
|
6263
|
+
message: err2?.message ?? "Unknown error"
|
|
6264
|
+
});
|
|
6303
6265
|
return;
|
|
6304
6266
|
}
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
|
|
6325
|
-
|
|
6326
|
-
|
|
6327
|
-
|
|
6328
|
-
|
|
6329
|
-
|
|
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
|
+
}
|
|
6330
6293
|
}
|
|
6331
6294
|
}
|
|
6332
|
-
|
|
6333
|
-
registerGatewayMethodWithBroadcastCapture(
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6338
|
-
|
|
6339
|
-
|
|
6340
|
-
|
|
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
|
+
}
|
|
6341
6377
|
}
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
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
|
+
}
|
|
6357
6409
|
}
|
|
6358
6410
|
}
|
|
6359
|
-
|
|
6411
|
+
);
|
|
6360
6412
|
}
|
|
6361
6413
|
|
|
6362
6414
|
// src/light-rules/registry.ts
|
|
@@ -6757,17 +6809,11 @@ function err(code, message) {
|
|
|
6757
6809
|
const data = { ok: false, error: { code, message } };
|
|
6758
6810
|
return { content: [{ type: "text", text: JSON.stringify(data) }], details: data };
|
|
6759
6811
|
}
|
|
6760
|
-
function registerToolWithAliases(api, tool, aliases) {
|
|
6761
|
-
api.registerTool(tool);
|
|
6762
|
-
for (const alias of aliases) {
|
|
6763
|
-
api.registerTool({ ...tool, name: alias });
|
|
6764
|
-
}
|
|
6765
|
-
}
|
|
6766
6812
|
function registerLightRulesTools(api, registry, logger) {
|
|
6767
|
-
|
|
6768
|
-
name:
|
|
6813
|
+
api.registerTool({
|
|
6814
|
+
name: LIGHT_RULE_TOOL_NAMES.list,
|
|
6769
6815
|
label: "List Light Rules",
|
|
6770
|
-
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',
|
|
6771
6817
|
parameters: { type: "object", properties: {}, additionalProperties: false },
|
|
6772
6818
|
async execute(_toolCallId, _params) {
|
|
6773
6819
|
try {
|
|
@@ -6775,13 +6821,13 @@ function registerLightRulesTools(api, registry, logger) {
|
|
|
6775
6821
|
const rules = registry.list().map((rule) => ({ ...rule, id: rule.name }));
|
|
6776
6822
|
return ok({ ok: true, rules });
|
|
6777
6823
|
} catch (e) {
|
|
6778
|
-
logger.warn(
|
|
6824
|
+
logger.warn(`${LIGHT_RULE_TOOL_NAMES.list} tool failed: ${e?.message}`);
|
|
6779
6825
|
return err("INTERNAL_ERROR", e?.message ?? "Unknown error");
|
|
6780
6826
|
}
|
|
6781
6827
|
}
|
|
6782
|
-
}
|
|
6783
|
-
|
|
6784
|
-
name:
|
|
6828
|
+
});
|
|
6829
|
+
api.registerTool({
|
|
6830
|
+
name: LIGHT_RULE_TOOL_NAMES.create,
|
|
6785
6831
|
label: "Create Light Rule",
|
|
6786
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',
|
|
6787
6833
|
parameters: {
|
|
@@ -6832,7 +6878,7 @@ function registerLightRulesTools(api, registry, logger) {
|
|
|
6832
6878
|
segments: validation.segments,
|
|
6833
6879
|
repeat_times: repeatTimes
|
|
6834
6880
|
});
|
|
6835
|
-
logger.info(
|
|
6881
|
+
logger.info(`${LIGHT_RULE_TOOL_NAMES.create} tool: created ${name}`);
|
|
6836
6882
|
return ok({
|
|
6837
6883
|
ok: true,
|
|
6838
6884
|
id: result.meta.name,
|
|
@@ -6842,13 +6888,13 @@ function registerLightRulesTools(api, registry, logger) {
|
|
|
6842
6888
|
});
|
|
6843
6889
|
} catch (e) {
|
|
6844
6890
|
if (e instanceof LightRuleError) return err(e.code, e.message);
|
|
6845
|
-
logger.warn(
|
|
6891
|
+
logger.warn(`${LIGHT_RULE_TOOL_NAMES.create} tool failed: ${e?.message}`);
|
|
6846
6892
|
return err("INTERNAL_ERROR", e?.message ?? "Unknown error");
|
|
6847
6893
|
}
|
|
6848
6894
|
}
|
|
6849
|
-
}
|
|
6850
|
-
|
|
6851
|
-
name:
|
|
6895
|
+
});
|
|
6896
|
+
api.registerTool({
|
|
6897
|
+
name: LIGHT_RULE_TOOL_NAMES.update,
|
|
6852
6898
|
label: "Update Light Rule",
|
|
6853
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',
|
|
6854
6900
|
parameters: {
|
|
@@ -6900,7 +6946,7 @@ function registerLightRulesTools(api, registry, logger) {
|
|
|
6900
6946
|
repeat_times: repeatTimes,
|
|
6901
6947
|
enabled
|
|
6902
6948
|
});
|
|
6903
|
-
logger.info(
|
|
6949
|
+
logger.info(`${LIGHT_RULE_TOOL_NAMES.update} tool: updated ${name}`);
|
|
6904
6950
|
return ok({
|
|
6905
6951
|
ok: true,
|
|
6906
6952
|
name: result.meta.name,
|
|
@@ -6910,13 +6956,13 @@ function registerLightRulesTools(api, registry, logger) {
|
|
|
6910
6956
|
});
|
|
6911
6957
|
} catch (e) {
|
|
6912
6958
|
if (e instanceof LightRuleError) return err(e.code, e.message);
|
|
6913
|
-
logger.warn(
|
|
6959
|
+
logger.warn(`${LIGHT_RULE_TOOL_NAMES.update} tool failed: ${e?.message}`);
|
|
6914
6960
|
return err("INTERNAL_ERROR", e?.message ?? "Unknown error");
|
|
6915
6961
|
}
|
|
6916
6962
|
}
|
|
6917
|
-
}
|
|
6918
|
-
|
|
6919
|
-
name:
|
|
6963
|
+
});
|
|
6964
|
+
api.registerTool({
|
|
6965
|
+
name: LIGHT_RULE_TOOL_NAMES.delete,
|
|
6920
6966
|
label: "Delete Light Rule",
|
|
6921
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',
|
|
6922
6968
|
parameters: {
|
|
@@ -6933,15 +6979,15 @@ function registerLightRulesTools(api, registry, logger) {
|
|
|
6933
6979
|
return err("INVALID_PARAMS", "name is required");
|
|
6934
6980
|
try {
|
|
6935
6981
|
const result = await registry.delete(name);
|
|
6936
|
-
logger.info(
|
|
6982
|
+
logger.info(`${LIGHT_RULE_TOOL_NAMES.delete} tool: deleted ${name}`);
|
|
6937
6983
|
return ok({ ok: true, name: result.name, deleted: true });
|
|
6938
6984
|
} catch (e) {
|
|
6939
6985
|
if (e instanceof LightRuleError) return err(e.code, e.message);
|
|
6940
|
-
logger.warn(
|
|
6986
|
+
logger.warn(`${LIGHT_RULE_TOOL_NAMES.delete} tool failed: ${e?.message}`);
|
|
6941
6987
|
return err("INTERNAL_ERROR", e?.message ?? "Unknown error");
|
|
6942
6988
|
}
|
|
6943
6989
|
}
|
|
6944
|
-
}
|
|
6990
|
+
});
|
|
6945
6991
|
}
|
|
6946
6992
|
|
|
6947
6993
|
// src/light-rules/inline-evaluator.ts
|
|
@@ -8289,17 +8335,7 @@ function resolveConfigPath2() {
|
|
|
8289
8335
|
if (fromEnv) return fromEnv;
|
|
8290
8336
|
return (0, import_node_path11.join)((0, import_node_os2.homedir)(), ".openclaw", "openclaw.json");
|
|
8291
8337
|
}
|
|
8292
|
-
var LIGHT_TOOLS = [
|
|
8293
|
-
"light_control",
|
|
8294
|
-
"lightrules.list",
|
|
8295
|
-
"lightrules.create",
|
|
8296
|
-
"lightrules.update",
|
|
8297
|
-
"lightrules.delete",
|
|
8298
|
-
"lightrules_list",
|
|
8299
|
-
"lightrules_create",
|
|
8300
|
-
"lightrules_update",
|
|
8301
|
-
"lightrules_delete"
|
|
8302
|
-
];
|
|
8338
|
+
var LIGHT_TOOLS = ["light_control", ...LIGHT_RULE_TOOL_NAME_LIST];
|
|
8303
8339
|
function upsertLightControlAlsoAllow(cfg) {
|
|
8304
8340
|
if (!isObject(cfg.tools)) cfg.tools = {};
|
|
8305
8341
|
const toolsAlsoAllow = ensureArray(cfg.tools, "alsoAllow");
|
|
@@ -9456,7 +9492,7 @@ function registerLightControlTool(api, logger) {
|
|
|
9456
9492
|
api.registerTool({
|
|
9457
9493
|
name: "light_control",
|
|
9458
9494
|
label: "Light Control",
|
|
9459
|
-
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`,
|
|
9460
9496
|
parameters: lightControlParameters,
|
|
9461
9497
|
async execute(_toolCallId, params) {
|
|
9462
9498
|
let apiKey;
|
|
@@ -10661,6 +10697,63 @@ init_whisper_local();
|
|
|
10661
10697
|
|
|
10662
10698
|
// src/recording/handler.ts
|
|
10663
10699
|
init_asr();
|
|
10700
|
+
|
|
10701
|
+
// src/recording/account-oss.ts
|
|
10702
|
+
init_credentials();
|
|
10703
|
+
init_env();
|
|
10704
|
+
async function deleteAccountOssFile(fileUrl, logger) {
|
|
10705
|
+
const trimmed = fileUrl?.trim();
|
|
10706
|
+
if (!trimmed) {
|
|
10707
|
+
return { ok: false, error: "fileUrl is empty" };
|
|
10708
|
+
}
|
|
10709
|
+
const apiKey = loadApiKey();
|
|
10710
|
+
if (!apiKey) {
|
|
10711
|
+
return { ok: false, error: "API Key \u672A\u8BBE\u7F6E\uFF0C\u8DF3\u8FC7 OSS \u6587\u4EF6\u5220\u9664" };
|
|
10712
|
+
}
|
|
10713
|
+
const endpoint = getEnvUrls().accountFileDeleteUrl;
|
|
10714
|
+
const headerKey = apiKey.startsWith("Bearer ") ? apiKey.slice("Bearer ".length) : apiKey;
|
|
10715
|
+
const body = new URLSearchParams({ fileUrl: trimmed }).toString();
|
|
10716
|
+
logger.info(`[account-oss-delete] \u63D0\u4EA4 OSS \u6587\u4EF6\u5220\u9664: endpoint=${endpoint}, fileUrl=${trimmed}`);
|
|
10717
|
+
let res;
|
|
10718
|
+
try {
|
|
10719
|
+
res = await fetch(endpoint, {
|
|
10720
|
+
method: "POST",
|
|
10721
|
+
headers: {
|
|
10722
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
10723
|
+
"X-Api-Key-Id": headerKey
|
|
10724
|
+
},
|
|
10725
|
+
body
|
|
10726
|
+
});
|
|
10727
|
+
} catch (err2) {
|
|
10728
|
+
const error = err2?.message ?? String(err2);
|
|
10729
|
+
logger.warn(`[account-oss-delete] \u7F51\u7EDC\u5F02\u5E38: ${error}`);
|
|
10730
|
+
return { ok: false, error };
|
|
10731
|
+
}
|
|
10732
|
+
const text = await res.text();
|
|
10733
|
+
if (!res.ok) {
|
|
10734
|
+
logger.warn(
|
|
10735
|
+
`[account-oss-delete] HTTP \u9519\u8BEF: status=${res.status}, body=${text.slice(0, 300)}`
|
|
10736
|
+
);
|
|
10737
|
+
return { ok: false, error: `HTTP ${res.status} ${text.slice(0, 200)}` };
|
|
10738
|
+
}
|
|
10739
|
+
let payload;
|
|
10740
|
+
try {
|
|
10741
|
+
payload = text ? JSON.parse(text) : void 0;
|
|
10742
|
+
} catch {
|
|
10743
|
+
logger.warn(`[account-oss-delete] \u54CD\u5E94\u975E JSON: body=${text.slice(0, 300)}`);
|
|
10744
|
+
return { ok: false, error: "response is not JSON" };
|
|
10745
|
+
}
|
|
10746
|
+
const code = typeof payload?.code === "number" ? String(payload.code) : payload?.code?.trim?.();
|
|
10747
|
+
if (code !== "000000") {
|
|
10748
|
+
const msg = payload?.msg?.trim?.() || text.slice(0, 200);
|
|
10749
|
+
logger.warn(`[account-oss-delete] \u4E1A\u52A1\u5931\u8D25: code=${code ?? "n/a"}, msg=${msg}`);
|
|
10750
|
+
return { ok: false, error: `${code ?? "unknown"} ${msg}`.trim() };
|
|
10751
|
+
}
|
|
10752
|
+
logger.info(`[account-oss-delete] OSS \u6587\u4EF6\u5DF2\u5220\u9664: fileUrl=${trimmed}`);
|
|
10753
|
+
return { ok: true };
|
|
10754
|
+
}
|
|
10755
|
+
|
|
10756
|
+
// src/recording/handler.ts
|
|
10664
10757
|
function emitRecordingStatus(recordingId, storage, logger, notifyStatus, error, extras) {
|
|
10665
10758
|
if (!notifyStatus) {
|
|
10666
10759
|
return;
|
|
@@ -10841,6 +10934,14 @@ async function triggerTranscription(recordingId, storage, asrConfig, logger, opt
|
|
|
10841
10934
|
logger.info(
|
|
10842
10935
|
`[asr-trigger] \u8F6C\u5199\u5B8C\u6210: ${recordingId}, summary="${result.summary}"`
|
|
10843
10936
|
);
|
|
10937
|
+
const ossAudioUrl = entry.metadata.oss_audio_url?.trim();
|
|
10938
|
+
if (ossAudioUrl) {
|
|
10939
|
+
void deleteAccountOssFile(ossAudioUrl, logger).catch((err2) => {
|
|
10940
|
+
logger.warn(
|
|
10941
|
+
`[asr-trigger] OSS \u97F3\u9891\u6E05\u7406\u5F02\u5E38 (\u975E\u81F4\u547D): ${recordingId}, ${err2?.message ?? err2}`
|
|
10942
|
+
);
|
|
10943
|
+
});
|
|
10944
|
+
}
|
|
10844
10945
|
} else {
|
|
10845
10946
|
storage.updateStatus(recordingId, "transcribe_failed");
|
|
10846
10947
|
emitRecordingStatus(
|
|
@@ -13126,9 +13227,9 @@ function isPluginCliInvocation(argv = process.argv) {
|
|
|
13126
13227
|
// src/index.ts
|
|
13127
13228
|
var LIGHT_RULE_PROMPT_GUIDANCE = [
|
|
13128
13229
|
"\u706F\u6548\u89C4\u5219\u8DEF\u7531\u63D0\u793A\uFF1A",
|
|
13129
|
-
|
|
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`,
|
|
13130
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",
|
|
13131
|
-
"- \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"
|
|
13132
13233
|
].join("\n");
|
|
13133
13234
|
var index_default = {
|
|
13134
13235
|
id: "phone-notifications",
|
|
@@ -13263,7 +13364,7 @@ var index_default = {
|
|
|
13263
13364
|
registerLightRulesGateway(api, lightRuleRegistry, logger, cacheBroadcast);
|
|
13264
13365
|
registerLightRulesTools(api, lightRuleRegistry, logger);
|
|
13265
13366
|
logger.info(
|
|
13266
|
-
|
|
13367
|
+
`\u706F\u6548\u89C4\u5219\u65B9\u6CD5\u5DF2\u6CE8\u518C: gateway=${LIGHT_RULE_GATEWAY_METHOD_LIST.join(", ")}; tools=${LIGHT_RULE_TOOL_NAME_LIST.join(", ")}`
|
|
13267
13368
|
);
|
|
13268
13369
|
autoUpdateLifecycle = registerAutoUpdateLifecycle({
|
|
13269
13370
|
api,
|