@celljs/ta-team 4.20.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.
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celljs/ta-team",
3
- "version": "4.20.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.20.0",
31
- "@celljs/ta-relay": "4.20.0",
32
- "@celljs/ta-web": "4.20.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);