@celljs/ta-team 4.19.0 → 4.21.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.
@@ -50,6 +50,22 @@ var TaHostUtil;
50
50
  }
51
51
  TaHostUtil2.role = role;
52
52
  })(TaHostUtil || (TaHostUtil = {}));
53
+ var TA_DOUBLE_LOOK = {
54
+ name: "@celljs/ta-web",
55
+ key: "assistant.species",
56
+ given: ["trex", "triceratops", "stegosaurus", "brachiosaurus", "velociraptor", "ankylosaurus", "pteranodon", "parasaurolophus"]
57
+ };
58
+ var TaDoubleLookUtil;
59
+ (function(TaDoubleLookUtil2) {
60
+ function given(id) {
61
+ let hash = 2166136261;
62
+ for (let i = 0;i < id.length; i++) {
63
+ hash = Math.imul(hash ^ id.charCodeAt(i), 16777619);
64
+ }
65
+ return TA_DOUBLE_LOOK.given[(hash >>> 0) % TA_DOUBLE_LOOK.given.length];
66
+ }
67
+ TaDoubleLookUtil2.given = given;
68
+ })(TaDoubleLookUtil || (TaDoubleLookUtil = {}));
53
69
  var TA_ASK_ENTRY = "ta-ask";
54
70
  var TaAskUtil;
55
71
  (function(TaAskUtil2) {
package/host/index.mjs CHANGED
@@ -225,6 +225,15 @@ class TeamError extends Error {
225
225
  }
226
226
 
227
227
  // web-src/policy.ts
228
+ var UNICODE_SPACES = /[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g;
229
+ function fileUrlPath(given) {
230
+ try {
231
+ const url = new URL(given);
232
+ return url.hostname && url.hostname !== "localhost" ? `/~${url.hostname}${url.pathname}` : decodeURIComponent(url.pathname);
233
+ } catch {
234
+ return "/~";
235
+ }
236
+ }
228
237
  var SCOPED = new Set(["files.read", "files.write", "commands.run", "commands.terminal"]);
229
238
  var IMPLIES = {
230
239
  "agent.edit": ["agent.use", "agent.view"],
@@ -390,9 +399,16 @@ var TeamPolicy;
390
399
  return refuse(outside === "deny" ? "never" : "outside");
391
400
  }
392
401
  function resolve(cwd, path, home) {
393
- let given = typeof path === "string" && path.trim() ? path.trim() : ".";
394
- if (home && (given === "~" || given.startsWith("~/"))) {
395
- given = home.replace(/\/+$/, "") + given.slice(1);
402
+ let given = typeof path === "string" && path.trim() ? path.trim().replace(UNICODE_SPACES, " ") : ".";
403
+ if (given.startsWith("@")) {
404
+ given = given.slice(1) || ".";
405
+ }
406
+ if (given === "~" || given.startsWith("~/")) {
407
+ given = (home ? home.replace(/\/+$/, "") : "/~") + given.slice(1);
408
+ }
409
+ const file = /^file:\/\//.test(given) ? fileUrlPath(given) : undefined;
410
+ if (file !== undefined) {
411
+ return normalize(file);
396
412
  }
397
413
  if (given.startsWith("/") || /^[a-z][a-z0-9+.-]*:\/\//i.test(given)) {
398
414
  return normalize(given);
@@ -1019,6 +1035,22 @@ var TaHostUtil;
1019
1035
  TaHostUtil2.role = role;
1020
1036
  })(TaHostUtil || (TaHostUtil = {}));
1021
1037
  var TA_DOUBLE_FILE = { name: "@celljs/ta-web", key: "assistant.file" };
1038
+ var TA_DOUBLE_LOOK = {
1039
+ name: "@celljs/ta-web",
1040
+ key: "assistant.species",
1041
+ given: ["trex", "triceratops", "stegosaurus", "brachiosaurus", "velociraptor", "ankylosaurus", "pteranodon", "parasaurolophus"]
1042
+ };
1043
+ var TaDoubleLookUtil;
1044
+ (function(TaDoubleLookUtil2) {
1045
+ function given(id2) {
1046
+ let hash = 2166136261;
1047
+ for (let i = 0;i < id2.length; i++) {
1048
+ hash = Math.imul(hash ^ id2.charCodeAt(i), 16777619);
1049
+ }
1050
+ return TA_DOUBLE_LOOK.given[(hash >>> 0) % TA_DOUBLE_LOOK.given.length];
1051
+ }
1052
+ TaDoubleLookUtil2.given = given;
1053
+ })(TaDoubleLookUtil || (TaDoubleLookUtil = {}));
1022
1054
  var TA_ASK_ENTRY = "ta-ask";
1023
1055
  var TaAskUtil;
1024
1056
  (function(TaAskUtil2) {
@@ -1322,6 +1354,7 @@ var RELAY_PING_MS = 25000;
1322
1354
  var RELAY_PROOF = "ta-relay ready";
1323
1355
  var RELAY_HUB_MAX_VALUE = 96 * 1024;
1324
1356
  var RELAY_HUB_MAX_STATE = 3 * 1024 * 1024;
1357
+ var RELAY_PICTURE_MAX_CHARS = 16 * 1024;
1325
1358
 
1326
1359
  // ../ta-relay/esm/common/relay-pairing.js
1327
1360
  var RelayPairingUtil;
@@ -1688,6 +1721,10 @@ var RelayIdentityUtil;
1688
1721
  return typeof look === "string" && /^[a-z][a-z0-9-]{0,31}$/.test(look);
1689
1722
  }
1690
1723
  RelayIdentityUtil2.isLook = isLook;
1724
+ function isPicture(picture) {
1725
+ return typeof picture === "string" && picture.length <= RELAY_PICTURE_MAX_CHARS && /^data:image\/(png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/.test(picture);
1726
+ }
1727
+ RelayIdentityUtil2.isPicture = isPicture;
1691
1728
  function withLook(value, look) {
1692
1729
  const { look: _, ...rest } = value;
1693
1730
  return isLook(look) ? { ...rest, look } : rest;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celljs/ta-team",
3
- "version": "4.19.0",
3
+ "version": "4.21.0",
4
4
  "description": "A pi package for Ta: people let into your Ta by a link, each with a role (admin, collaborator, viewer, guest, or one of your own), what they may do checked by the Ta service for every call and every tool, asking for more and the answers, and a record",
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.19.0",
31
- "@celljs/ta-relay": "4.19.0",
32
- "@celljs/ta-web": "4.19.0",
30
+ "@celljs/ta-protocol": "4.21.0",
31
+ "@celljs/ta-relay": "4.21.0",
32
+ "@celljs/ta-web": "4.21.0",
33
33
  "@types/react": "^19.3.0"
34
34
  },
35
35
  "publishConfig": {
package/web/index.js CHANGED
@@ -1263,6 +1263,15 @@ class TeamError extends Error {
1263
1263
  }
1264
1264
 
1265
1265
  // web-src/policy.ts
1266
+ var UNICODE_SPACES = /[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g;
1267
+ function fileUrlPath(given) {
1268
+ try {
1269
+ const url = new URL(given);
1270
+ return url.hostname && url.hostname !== "localhost" ? `/~${url.hostname}${url.pathname}` : decodeURIComponent(url.pathname);
1271
+ } catch {
1272
+ return "/~";
1273
+ }
1274
+ }
1266
1275
  var SCOPED = new Set(["files.read", "files.write", "commands.run", "commands.terminal"]);
1267
1276
  var IMPLIES = {
1268
1277
  "agent.edit": ["agent.use", "agent.view"],
@@ -1428,9 +1437,16 @@ var TeamPolicy;
1428
1437
  return refuse(outside === "deny" ? "never" : "outside");
1429
1438
  }
1430
1439
  function resolve(cwd, path, home) {
1431
- let given = typeof path === "string" && path.trim() ? path.trim() : ".";
1432
- if (home && (given === "~" || given.startsWith("~/"))) {
1433
- given = home.replace(/\/+$/, "") + given.slice(1);
1440
+ let given = typeof path === "string" && path.trim() ? path.trim().replace(UNICODE_SPACES, " ") : ".";
1441
+ if (given.startsWith("@")) {
1442
+ given = given.slice(1) || ".";
1443
+ }
1444
+ if (given === "~" || given.startsWith("~/")) {
1445
+ given = (home ? home.replace(/\/+$/, "") : "/~") + given.slice(1);
1446
+ }
1447
+ const file = /^file:\/\//.test(given) ? fileUrlPath(given) : undefined;
1448
+ if (file !== undefined) {
1449
+ return normalize(file);
1434
1450
  }
1435
1451
  if (given.startsWith("/") || /^[a-z][a-z0-9+.-]*:\/\//i.test(given)) {
1436
1452
  return normalize(given);
@@ -1889,6 +1905,7 @@ var RELAY_PING_MS = 25000;
1889
1905
  var RELAY_PROOF = "ta-relay ready";
1890
1906
  var RELAY_HUB_MAX_VALUE = 96 * 1024;
1891
1907
  var RELAY_HUB_MAX_STATE = 3 * 1024 * 1024;
1908
+ var RELAY_PICTURE_MAX_CHARS = 16 * 1024;
1892
1909
 
1893
1910
  // ../ta-relay/esm/common/relay-pairing.js
1894
1911
  var RelayPairingUtil;
@@ -2367,6 +2384,10 @@ var RelayIdentityUtil;
2367
2384
  return typeof look === "string" && /^[a-z][a-z0-9-]{0,31}$/.test(look);
2368
2385
  }
2369
2386
  RelayIdentityUtil2.isLook = isLook;
2387
+ function isPicture(picture) {
2388
+ return typeof picture === "string" && picture.length <= RELAY_PICTURE_MAX_CHARS && /^data:image\/(png|jpeg|webp|svg\+xml);base64,[A-Za-z0-9+/]+={0,2}$/.test(picture);
2389
+ }
2390
+ RelayIdentityUtil2.isPicture = isPicture;
2370
2391
  function withLook(value, look) {
2371
2392
  const { look: _, ...rest } = value;
2372
2393
  return isLook(look) ? { ...rest, look } : rest;