@celljs/ta-bots 4.15.1 → 4.16.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/host/index.mjs +40 -3
- package/package.json +3 -3
package/host/index.mjs
CHANGED
|
@@ -287,15 +287,47 @@ var TaGatewayServer = Symbol("TaGatewayServer");
|
|
|
287
287
|
var TaLocation;
|
|
288
288
|
(function(TaLocation2) {
|
|
289
289
|
TaLocation2.SSH = "ssh://";
|
|
290
|
+
TaLocation2.CLOUD = "ta://";
|
|
291
|
+
const CLOUD_NAME = /^[a-z0-9][a-z0-9-]{0,39}$/;
|
|
290
292
|
const HOST = /^(?!-)[\w.@:%+[\]-]+$/;
|
|
291
293
|
function isRemote(location) {
|
|
292
|
-
return location.startsWith(TaLocation2.SSH);
|
|
294
|
+
return location.startsWith(TaLocation2.SSH) || location.startsWith(TaLocation2.CLOUD);
|
|
293
295
|
}
|
|
294
296
|
TaLocation2.isRemote = isRemote;
|
|
297
|
+
function isCloud(host2) {
|
|
298
|
+
return !!host2 && host2.startsWith(TaLocation2.CLOUD);
|
|
299
|
+
}
|
|
300
|
+
TaLocation2.isCloud = isCloud;
|
|
301
|
+
function isCloudName(name) {
|
|
302
|
+
return CLOUD_NAME.test(name);
|
|
303
|
+
}
|
|
304
|
+
TaLocation2.isCloudName = isCloudName;
|
|
305
|
+
function cloud(name, path2 = "") {
|
|
306
|
+
return `${TaLocation2.CLOUD}${name}${path2 ? normalize(path2) : ""}`;
|
|
307
|
+
}
|
|
308
|
+
TaLocation2.cloud = cloud;
|
|
309
|
+
function cloudName(hostOrLocation) {
|
|
310
|
+
if (!hostOrLocation.startsWith(TaLocation2.CLOUD)) {
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
const rest = hostOrLocation.slice(TaLocation2.CLOUD.length);
|
|
314
|
+
const slash = rest.indexOf("/");
|
|
315
|
+
return slash < 0 ? rest : rest.slice(0, slash);
|
|
316
|
+
}
|
|
317
|
+
TaLocation2.cloudName = cloudName;
|
|
295
318
|
function parse(location) {
|
|
319
|
+
var _a;
|
|
296
320
|
if (!isRemote(location)) {
|
|
297
321
|
return;
|
|
298
322
|
}
|
|
323
|
+
if (location.startsWith(TaLocation2.CLOUD)) {
|
|
324
|
+
const name = (_a = cloudName(location)) !== null && _a !== undefined ? _a : "";
|
|
325
|
+
if (!isCloudName(name)) {
|
|
326
|
+
throw new Error(`${JSON.stringify(location)} names no cloud workspace: write ta://<name>/<path>.`);
|
|
327
|
+
}
|
|
328
|
+
const path3 = location.slice(TaLocation2.CLOUD.length + name.length);
|
|
329
|
+
return { host: `${TaLocation2.CLOUD}${name}`, path: path3 ? normalize(path3) : "" };
|
|
330
|
+
}
|
|
299
331
|
const rest = location.slice(TaLocation2.SSH.length);
|
|
300
332
|
const slash = rest.indexOf("/");
|
|
301
333
|
const host2 = slash < 0 ? rest : rest.slice(0, slash);
|
|
@@ -307,7 +339,7 @@ var TaLocation;
|
|
|
307
339
|
}
|
|
308
340
|
TaLocation2.parse = parse;
|
|
309
341
|
function isHost(host2) {
|
|
310
|
-
return HOST.test(host2);
|
|
342
|
+
return isCloud(host2) ? isCloudName(host2.slice(TaLocation2.CLOUD.length)) : HOST.test(host2);
|
|
311
343
|
}
|
|
312
344
|
TaLocation2.isHost = isHost;
|
|
313
345
|
const FLAGS = /^-[46AaCfGgKkMNnqsTtVvXxYy]+$/;
|
|
@@ -371,10 +403,13 @@ var TaLocation;
|
|
|
371
403
|
}
|
|
372
404
|
TaLocation2.readHost = readHost;
|
|
373
405
|
function ssh(host2, path2 = "") {
|
|
374
|
-
return `${TaLocation2.SSH}${host2}${path2 ? normalize(path2) : ""}`;
|
|
406
|
+
return isCloud(host2) ? `${host2}${path2 ? normalize(path2) : ""}` : `${TaLocation2.SSH}${host2}${path2 ? normalize(path2) : ""}`;
|
|
375
407
|
}
|
|
376
408
|
TaLocation2.ssh = ssh;
|
|
377
409
|
function hostLabel(host2) {
|
|
410
|
+
if (isCloud(host2)) {
|
|
411
|
+
return host2.slice(TaLocation2.CLOUD.length);
|
|
412
|
+
}
|
|
378
413
|
const name = host2.replace(/^[^@]*@/, "").replace(/^\[(.*)\](?::\d+)?$/, "$1").replace(/^([^:]*):\d+$/, "$1");
|
|
379
414
|
return /^[\d.]+$/.test(name) || name.includes(":") ? name : name.split(".")[0] || name;
|
|
380
415
|
}
|
|
@@ -907,6 +942,8 @@ var TaActionUtil;
|
|
|
907
942
|
}
|
|
908
943
|
TaActionUtil2.inside = inside;
|
|
909
944
|
})(TaActionUtil || (TaActionUtil = {}));
|
|
945
|
+
// ../ta-protocol/esm/common/usage-protocol.js
|
|
946
|
+
var TaUsageServer = Symbol("TaUsageServer");
|
|
910
947
|
// ../ta-protocol/esm/common/workspace-protocol.js
|
|
911
948
|
var TaWorkspaceServer = Symbol("TaWorkspaceServer");
|
|
912
949
|
var TaTerminalServer = Symbol("TaTerminalServer");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/ta-bots",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.16.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.16.0",
|
|
31
|
+
"@celljs/ta-web": "4.16.0",
|
|
32
32
|
"@types/react": "^19.3.0"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|