@celljs/ta-bots 4.9.0 → 4.10.0
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/extension/index.mjs +46 -0
- package/host/index.mjs +46 -0
- package/package.json +3 -3
package/extension/index.mjs
CHANGED
|
@@ -135,6 +135,21 @@ var TaLocation;
|
|
|
135
135
|
return name || (remote === null || remote === undefined ? undefined : remote.host) || location;
|
|
136
136
|
}
|
|
137
137
|
TaLocation2.basename = basename;
|
|
138
|
+
function homeRelative(location) {
|
|
139
|
+
var _a;
|
|
140
|
+
const remote = parse(location);
|
|
141
|
+
const path2 = remote ? remote.path ? remote.path.slice(1) : "~" : location;
|
|
142
|
+
const match = /^~(?:[\\/]+(.*))?$/.exec(path2);
|
|
143
|
+
return match ? ((_a = match[1]) !== null && _a !== undefined ? _a : "").replace(/[\\/]+$/, "") : undefined;
|
|
144
|
+
}
|
|
145
|
+
TaLocation2.homeRelative = homeRelative;
|
|
146
|
+
function isAbsolute(location) {
|
|
147
|
+
if (homeRelative(location) !== undefined) {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
return isRemote(location) || /^([\\/]|[A-Za-z]:)/.test(location);
|
|
151
|
+
}
|
|
152
|
+
TaLocation2.isAbsolute = isAbsolute;
|
|
138
153
|
function parentPath(path2) {
|
|
139
154
|
const trimmed = path2.replace(/[\\/]+$/, "");
|
|
140
155
|
const at = Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\"));
|
|
@@ -203,6 +218,37 @@ ${message}`;
|
|
|
203
218
|
}
|
|
204
219
|
TaMessageContext2.strip = strip;
|
|
205
220
|
})(TaMessageContext || (TaMessageContext = {}));
|
|
221
|
+
var TaImageNote;
|
|
222
|
+
(function(TaImageNote2) {
|
|
223
|
+
const NOTE = /^\[Image: original \d+x\d+, displayed at \d+x\d+\. Multiply coordinates by [\d.]+ to map to original image\.\]$|^\[Image converted from [^\]]+ to [^\]]+\.\]$/;
|
|
224
|
+
function strip(text) {
|
|
225
|
+
const lines = text.split(`
|
|
226
|
+
`);
|
|
227
|
+
const kept = lines.filter((line) => !NOTE.test(line.trim()));
|
|
228
|
+
if (kept.length === lines.length) {
|
|
229
|
+
return text;
|
|
230
|
+
}
|
|
231
|
+
return kept.join(`
|
|
232
|
+
`).replace(/\n+$/, "").replace(/^\n+/, "");
|
|
233
|
+
}
|
|
234
|
+
TaImageNote2.strip = strip;
|
|
235
|
+
})(TaImageNote || (TaImageNote = {}));
|
|
236
|
+
var TaAgentSummary;
|
|
237
|
+
(function(TaAgentSummary2) {
|
|
238
|
+
const START = /^\s*<conversation_history_summary>/;
|
|
239
|
+
const BLOCK = /^\s*<conversation_history_summary>[\s\S]*?(?:<\/conversation_history_summary>\s*|$)/;
|
|
240
|
+
function read(text) {
|
|
241
|
+
if (!START.test(text)) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
return text.replace(/<\/?(?:conversation_history_summary|summary)>/g, "").replace(/<\/?\w*$/, "").trim();
|
|
245
|
+
}
|
|
246
|
+
TaAgentSummary2.read = read;
|
|
247
|
+
function strip(text) {
|
|
248
|
+
return text.replace(BLOCK, "");
|
|
249
|
+
}
|
|
250
|
+
TaAgentSummary2.strip = strip;
|
|
251
|
+
})(TaAgentSummary || (TaAgentSummary = {}));
|
|
206
252
|
var TaSkillUse;
|
|
207
253
|
(function(TaSkillUse2) {
|
|
208
254
|
const BLOCK = /^<skill name="([^"]+)" location="([^"]+)">\n([\s\S]*?)\n<\/skill>(?:\n\n([\s\S]+))?$/;
|
package/host/index.mjs
CHANGED
|
@@ -335,6 +335,21 @@ var TaLocation;
|
|
|
335
335
|
return name || (remote === null || remote === undefined ? undefined : remote.host) || location;
|
|
336
336
|
}
|
|
337
337
|
TaLocation2.basename = basename;
|
|
338
|
+
function homeRelative(location) {
|
|
339
|
+
var _a;
|
|
340
|
+
const remote = parse(location);
|
|
341
|
+
const path2 = remote ? remote.path ? remote.path.slice(1) : "~" : location;
|
|
342
|
+
const match = /^~(?:[\\/]+(.*))?$/.exec(path2);
|
|
343
|
+
return match ? ((_a = match[1]) !== null && _a !== undefined ? _a : "").replace(/[\\/]+$/, "") : undefined;
|
|
344
|
+
}
|
|
345
|
+
TaLocation2.homeRelative = homeRelative;
|
|
346
|
+
function isAbsolute(location) {
|
|
347
|
+
if (homeRelative(location) !== undefined) {
|
|
348
|
+
return false;
|
|
349
|
+
}
|
|
350
|
+
return isRemote(location) || /^([\\/]|[A-Za-z]:)/.test(location);
|
|
351
|
+
}
|
|
352
|
+
TaLocation2.isAbsolute = isAbsolute;
|
|
338
353
|
function parentPath(path2) {
|
|
339
354
|
const trimmed = path2.replace(/[\\/]+$/, "");
|
|
340
355
|
const at = Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\"));
|
|
@@ -403,6 +418,37 @@ ${message}`;
|
|
|
403
418
|
}
|
|
404
419
|
TaMessageContext2.strip = strip;
|
|
405
420
|
})(TaMessageContext || (TaMessageContext = {}));
|
|
421
|
+
var TaImageNote;
|
|
422
|
+
(function(TaImageNote2) {
|
|
423
|
+
const NOTE = /^\[Image: original \d+x\d+, displayed at \d+x\d+\. Multiply coordinates by [\d.]+ to map to original image\.\]$|^\[Image converted from [^\]]+ to [^\]]+\.\]$/;
|
|
424
|
+
function strip(text) {
|
|
425
|
+
const lines = text.split(`
|
|
426
|
+
`);
|
|
427
|
+
const kept = lines.filter((line) => !NOTE.test(line.trim()));
|
|
428
|
+
if (kept.length === lines.length) {
|
|
429
|
+
return text;
|
|
430
|
+
}
|
|
431
|
+
return kept.join(`
|
|
432
|
+
`).replace(/\n+$/, "").replace(/^\n+/, "");
|
|
433
|
+
}
|
|
434
|
+
TaImageNote2.strip = strip;
|
|
435
|
+
})(TaImageNote || (TaImageNote = {}));
|
|
436
|
+
var TaAgentSummary;
|
|
437
|
+
(function(TaAgentSummary2) {
|
|
438
|
+
const START = /^\s*<conversation_history_summary>/;
|
|
439
|
+
const BLOCK = /^\s*<conversation_history_summary>[\s\S]*?(?:<\/conversation_history_summary>\s*|$)/;
|
|
440
|
+
function read(text) {
|
|
441
|
+
if (!START.test(text)) {
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
return text.replace(/<\/?(?:conversation_history_summary|summary)>/g, "").replace(/<\/?\w*$/, "").trim();
|
|
445
|
+
}
|
|
446
|
+
TaAgentSummary2.read = read;
|
|
447
|
+
function strip(text) {
|
|
448
|
+
return text.replace(BLOCK, "");
|
|
449
|
+
}
|
|
450
|
+
TaAgentSummary2.strip = strip;
|
|
451
|
+
})(TaAgentSummary || (TaAgentSummary = {}));
|
|
406
452
|
var TaSkillUse;
|
|
407
453
|
(function(TaSkillUse2) {
|
|
408
454
|
const BLOCK = /^<skill name="([^"]+)" location="([^"]+)">\n([\s\S]*?)\n<\/skill>(?:\n\n([\s\S]+))?$/;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-bots",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.10.0",
|
|
4
4
|
"description": "A pi package for Ta: bots of WeChat (ClawBot) and WeCom connected to the double, an agent or a conversation, messages and files both ways",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package"
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@celljs/ta-protocol": "4.
|
|
31
|
-
"@celljs/ta-web": "4.
|
|
30
|
+
"@celljs/ta-protocol": "4.10.0",
|
|
31
|
+
"@celljs/ta-web": "4.10.0",
|
|
32
32
|
"@types/react": "^19.3.0"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|