@celljs/ta-channels 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.
Files changed (2) hide show
  1. package/host/index.mjs +41 -3
  2. package/package.json +4 -4
package/host/index.mjs CHANGED
@@ -46,15 +46,47 @@ var TaLanguageUtil;
46
46
  var TaLocation;
47
47
  (function(TaLocation2) {
48
48
  TaLocation2.SSH = "ssh://";
49
+ TaLocation2.CLOUD = "ta://";
50
+ const CLOUD_NAME = /^[a-z0-9][a-z0-9-]{0,39}$/;
49
51
  const HOST = /^(?!-)[\w.@:%+[\]-]+$/;
50
52
  function isRemote(location) {
51
- return location.startsWith(TaLocation2.SSH);
53
+ return location.startsWith(TaLocation2.SSH) || location.startsWith(TaLocation2.CLOUD);
52
54
  }
53
55
  TaLocation2.isRemote = isRemote;
56
+ function isCloud(host2) {
57
+ return !!host2 && host2.startsWith(TaLocation2.CLOUD);
58
+ }
59
+ TaLocation2.isCloud = isCloud;
60
+ function isCloudName(name) {
61
+ return CLOUD_NAME.test(name);
62
+ }
63
+ TaLocation2.isCloudName = isCloudName;
64
+ function cloud(name, path2 = "") {
65
+ return `${TaLocation2.CLOUD}${name}${path2 ? normalize(path2) : ""}`;
66
+ }
67
+ TaLocation2.cloud = cloud;
68
+ function cloudName(hostOrLocation) {
69
+ if (!hostOrLocation.startsWith(TaLocation2.CLOUD)) {
70
+ return;
71
+ }
72
+ const rest = hostOrLocation.slice(TaLocation2.CLOUD.length);
73
+ const slash = rest.indexOf("/");
74
+ return slash < 0 ? rest : rest.slice(0, slash);
75
+ }
76
+ TaLocation2.cloudName = cloudName;
54
77
  function parse(location) {
78
+ var _a;
55
79
  if (!isRemote(location)) {
56
80
  return;
57
81
  }
82
+ if (location.startsWith(TaLocation2.CLOUD)) {
83
+ const name = (_a = cloudName(location)) !== null && _a !== undefined ? _a : "";
84
+ if (!isCloudName(name)) {
85
+ throw new Error(`${JSON.stringify(location)} names no cloud workspace: write ta://<name>/<path>.`);
86
+ }
87
+ const path3 = location.slice(TaLocation2.CLOUD.length + name.length);
88
+ return { host: `${TaLocation2.CLOUD}${name}`, path: path3 ? normalize(path3) : "" };
89
+ }
58
90
  const rest = location.slice(TaLocation2.SSH.length);
59
91
  const slash = rest.indexOf("/");
60
92
  const host2 = slash < 0 ? rest : rest.slice(0, slash);
@@ -66,7 +98,7 @@ var TaLocation;
66
98
  }
67
99
  TaLocation2.parse = parse;
68
100
  function isHost(host2) {
69
- return HOST.test(host2);
101
+ return isCloud(host2) ? isCloudName(host2.slice(TaLocation2.CLOUD.length)) : HOST.test(host2);
70
102
  }
71
103
  TaLocation2.isHost = isHost;
72
104
  const FLAGS = /^-[46AaCfGgKkMNnqsTtVvXxYy]+$/;
@@ -130,10 +162,13 @@ var TaLocation;
130
162
  }
131
163
  TaLocation2.readHost = readHost;
132
164
  function ssh(host2, path2 = "") {
133
- return `${TaLocation2.SSH}${host2}${path2 ? normalize(path2) : ""}`;
165
+ return isCloud(host2) ? `${host2}${path2 ? normalize(path2) : ""}` : `${TaLocation2.SSH}${host2}${path2 ? normalize(path2) : ""}`;
134
166
  }
135
167
  TaLocation2.ssh = ssh;
136
168
  function hostLabel(host2) {
169
+ if (isCloud(host2)) {
170
+ return host2.slice(TaLocation2.CLOUD.length);
171
+ }
137
172
  const name = host2.replace(/^[^@]*@/, "").replace(/^\[(.*)\](?::\d+)?$/, "$1").replace(/^([^:]*):\d+$/, "$1");
138
173
  return /^[\d.]+$/.test(name) || name.includes(":") ? name : name.split(".")[0] || name;
139
174
  }
@@ -238,6 +273,7 @@ var TaErrorCode = {
238
273
  CANCELLED: "CELL_TA_CANCELLED",
239
274
  NOT_SIGNED_IN: "CELL_TA_NOT_SIGNED_IN",
240
275
  ENVIRONMENT_FAILED: "CELL_TA_ENVIRONMENT_FAILED",
276
+ RATE_LIMITED: "CELL_TA_RATE_LIMITED",
241
277
  FORBIDDEN: "CELL_TA_FORBIDDEN",
242
278
  LIMIT: "CELL_TA_LIMIT",
243
279
  CONNECTION_LOST: "CELL_TA_CONNECTION_LOST"
@@ -684,6 +720,8 @@ var TaActionUtil;
684
720
  }
685
721
  TaActionUtil2.inside = inside;
686
722
  })(TaActionUtil || (TaActionUtil = {}));
723
+ // ../ta-protocol/esm/common/usage-protocol.js
724
+ var TaUsageServer = Symbol("TaUsageServer");
687
725
  // ../ta-protocol/esm/common/workspace-protocol.js
688
726
  var TaWorkspaceServer = Symbol("TaWorkspaceServer");
689
727
  var TaTerminalServer = Symbol("TaTerminalServer");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celljs/ta-channels",
3
- "version": "4.15.1",
3
+ "version": "4.16.0",
4
4
  "description": "A pi package for Ta: agents with roles of their own and channels where the user, Ta and the agents talk; Ta builds the team for what the user wants",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -27,9 +27,9 @@
27
27
  "watch": "tsc -b -w --preserveWatchOutput"
28
28
  },
29
29
  "devDependencies": {
30
- "@celljs/ta-protocol": "4.15.1",
31
- "@celljs/ta-relay": "4.15.1",
32
- "@celljs/ta-web": "4.15.1",
30
+ "@celljs/ta-protocol": "4.16.0",
31
+ "@celljs/ta-relay": "4.16.0",
32
+ "@celljs/ta-web": "4.16.0",
33
33
  "@types/react": "^19.3.0"
34
34
  },
35
35
  "publishConfig": {