@factiii/runner 0.9.2 → 0.9.4

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/index/index.js CHANGED
@@ -3112,7 +3112,6 @@ var require_utils = __commonJS({
3112
3112
  var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
3113
3113
  var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
3114
3114
  var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
3115
- var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/?]$/iu);
3116
3115
  function stringArrayToHexStripped(input) {
3117
3116
  let acc = "";
3118
3117
  let code = 0;
@@ -3255,7 +3254,7 @@ var require_utils = __commonJS({
3255
3254
  continue;
3256
3255
  }
3257
3256
  } else if (input[0] === "/") {
3258
- if (input[1] === ".") {
3257
+ if (input[1] === "." || input[1] === "/") {
3259
3258
  output.push("/");
3260
3259
  break;
3261
3260
  }
@@ -3337,30 +3336,10 @@ var require_utils = __commonJS({
3337
3336
  }
3338
3337
  return output;
3339
3338
  }
3340
- var BYTE_HEX = new Array(256);
3341
- {
3342
- const HEX_DIGITS = "0123456789ABCDEF";
3343
- for (let i = 0; i < 256; i++) {
3344
- BYTE_HEX[i] = "%" + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 15];
3345
- }
3346
- }
3347
- function isEscapeSafe(cp2) {
3348
- return cp2 >= 48 && cp2 <= 57 || cp2 >= 65 && cp2 <= 90 || cp2 >= 97 && cp2 <= 122 || cp2 === 42 || cp2 === 43 || cp2 === 45 || cp2 === 46 || cp2 === 47 || cp2 === 64 || cp2 === 95;
3349
- }
3350
- function percentEncodeNonAscii(cp2) {
3351
- if (cp2 < 2048) {
3352
- return BYTE_HEX[192 | cp2 >> 6] + BYTE_HEX[128 | cp2 & 63];
3353
- }
3354
- if (cp2 < 65536) {
3355
- return BYTE_HEX[224 | cp2 >> 12] + BYTE_HEX[128 | cp2 >> 6 & 63] + BYTE_HEX[128 | cp2 & 63];
3356
- }
3357
- return BYTE_HEX[240 | cp2 >> 18] + BYTE_HEX[128 | cp2 >> 12 & 63] + BYTE_HEX[128 | cp2 >> 6 & 63] + BYTE_HEX[128 | cp2 & 63];
3358
- }
3359
3339
  function normalizePathEncoding(input) {
3360
3340
  let output = "";
3361
3341
  for (let i = 0; i < input.length; i++) {
3362
- const ch2 = input[i];
3363
- if (ch2 === "%" && i + 2 < input.length) {
3342
+ if (input[i] === "%" && i + 2 < input.length) {
3364
3343
  const hex = input.slice(i + 1, i + 3);
3365
3344
  if (isHexPair(hex)) {
3366
3345
  const normalizedHex = hex.toUpperCase();
@@ -3374,66 +3353,10 @@ var require_utils = __commonJS({
3374
3353
  continue;
3375
3354
  }
3376
3355
  }
3377
- if (isPathCharacter(ch2)) {
3378
- output += ch2;
3379
- } else {
3380
- const code = input.charCodeAt(i);
3381
- if (code < 128) {
3382
- output += isEscapeSafe(code) ? ch2 : BYTE_HEX[code];
3383
- } else if (code < 55296 || code > 57343) {
3384
- output += percentEncodeNonAscii(code);
3385
- } else if (code <= 56319 && i + 1 < input.length) {
3386
- const low = input.charCodeAt(i + 1);
3387
- if (low >= 56320 && low <= 57343) {
3388
- output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
3389
- i++;
3390
- } else {
3391
- output += percentEncodeNonAscii(65533);
3392
- }
3393
- } else {
3394
- output += percentEncodeNonAscii(65533);
3395
- }
3396
- }
3397
- }
3398
- return output;
3399
- }
3400
- function normalizeQueryFragmentEncoding(input) {
3401
- let output = "";
3402
- for (let i = 0; i < input.length; i++) {
3403
- const ch2 = input[i];
3404
- if (ch2 === "%" && i + 2 < input.length) {
3405
- const hex = input.slice(i + 1, i + 3);
3406
- if (isHexPair(hex)) {
3407
- const normalizedHex = hex.toUpperCase();
3408
- const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
3409
- if (isUnreserved(decoded)) {
3410
- output += decoded;
3411
- } else {
3412
- output += "%" + normalizedHex;
3413
- }
3414
- i += 2;
3415
- continue;
3416
- }
3417
- }
3418
- if (isQueryFragmentCharacter(ch2)) {
3419
- output += ch2;
3356
+ if (isPathCharacter(input[i])) {
3357
+ output += input[i];
3420
3358
  } else {
3421
- const code = input.charCodeAt(i);
3422
- if (code < 128) {
3423
- output += isEscapeSafe(code) ? ch2 : BYTE_HEX[code];
3424
- } else if (code < 55296 || code > 57343) {
3425
- output += percentEncodeNonAscii(code);
3426
- } else if (code <= 56319 && i + 1 < input.length) {
3427
- const low = input.charCodeAt(i + 1);
3428
- if (low >= 56320 && low <= 57343) {
3429
- output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
3430
- i++;
3431
- } else {
3432
- output += percentEncodeNonAscii(65533);
3433
- }
3434
- } else {
3435
- output += percentEncodeNonAscii(65533);
3436
- }
3359
+ output += escape(input[i]);
3437
3360
  }
3438
3361
  }
3439
3362
  return output;
@@ -3441,8 +3364,7 @@ var require_utils = __commonJS({
3441
3364
  function escapePreservingEscapes(input) {
3442
3365
  let output = "";
3443
3366
  for (let i = 0; i < input.length; i++) {
3444
- const ch2 = input[i];
3445
- if (ch2 === "%" && i + 2 < input.length) {
3367
+ if (input[i] === "%" && i + 2 < input.length) {
3446
3368
  const hex = input.slice(i + 1, i + 3);
3447
3369
  if (isHexPair(hex)) {
3448
3370
  output += "%" + hex.toUpperCase();
@@ -3450,22 +3372,7 @@ var require_utils = __commonJS({
3450
3372
  continue;
3451
3373
  }
3452
3374
  }
3453
- const code = input.charCodeAt(i);
3454
- if (code < 128) {
3455
- output += isEscapeSafe(code) ? ch2 : BYTE_HEX[code];
3456
- } else if (code < 55296 || code > 57343) {
3457
- output += percentEncodeNonAscii(code);
3458
- } else if (code <= 56319 && i + 1 < input.length) {
3459
- const low = input.charCodeAt(i + 1);
3460
- if (low >= 56320 && low <= 57343) {
3461
- output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
3462
- i++;
3463
- } else {
3464
- output += percentEncodeNonAscii(65533);
3465
- }
3466
- } else {
3467
- output += percentEncodeNonAscii(65533);
3468
- }
3375
+ output += escape(input[i]);
3469
3376
  }
3470
3377
  return output;
3471
3378
  }
@@ -3499,7 +3406,6 @@ var require_utils = __commonJS({
3499
3406
  reescapeHostDelimiters,
3500
3407
  normalizePercentEncoding,
3501
3408
  normalizePathEncoding,
3502
- normalizeQueryFragmentEncoding,
3503
3409
  escapePreservingEscapes,
3504
3410
  removeDotSegments,
3505
3411
  isIPv4,
@@ -3724,7 +3630,7 @@ var require_schemes = __commonJS({
3724
3630
  var require_fast_uri = __commonJS({
3725
3631
  "../../node_modules/fast-uri/index.js"(exports2, module2) {
3726
3632
  "use strict";
3727
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, normalizeQueryFragmentEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3633
+ var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
3728
3634
  var { SCHEMES, getSchemeHandler } = require_schemes();
3729
3635
  function normalize(uri, options) {
3730
3636
  if (typeof uri === "string") {
@@ -3738,7 +3644,12 @@ var require_fast_uri = __commonJS({
3738
3644
  }
3739
3645
  function resolve(baseURI, relativeURI, options) {
3740
3646
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
3741
- const resolved = resolveComponent(parse3(baseURI, schemelessOptions), parse3(relativeURI, schemelessOptions), schemelessOptions, true);
3647
+ const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed } = parseWithStatus(baseURI, schemelessOptions);
3648
+ const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed } = parseWithStatus(relativeURI, schemelessOptions);
3649
+ if (baseMalformed || relativeMalformed) {
3650
+ throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
3651
+ }
3652
+ const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
3742
3653
  schemelessOptions.skipEscape = true;
3743
3654
  return serialize(resolved, schemelessOptions);
3744
3655
  }
@@ -3864,6 +3775,7 @@ var require_fast_uri = __commonJS({
3864
3775
  }
3865
3776
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
3866
3777
  var AUTHORITY_PREFIX = /^(?:[^#/:?]+:)?\/\/([^/?#]*)/;
3778
+ var AUTHORITY_INTRODUCER_REGION = /^(?:[^#/:?]+:)?([/\\\t\n\r]*)/;
3867
3779
  function getParseError(parsed, matches) {
3868
3780
  if (matches[2] !== void 0 && parsed.path && parsed.path[0] !== "/") {
3869
3781
  return 'URI path must start with "/" when authority is present.';
@@ -3898,9 +3810,23 @@ var require_fast_uri = __commonJS({
3898
3810
  parsed.error = "URI authority must not contain a literal backslash.";
3899
3811
  malformedAuthorityOrPort = true;
3900
3812
  }
3813
+ const introducerMatch = uri.match(AUTHORITY_INTRODUCER_REGION);
3814
+ if (introducerMatch !== null) {
3815
+ const region = introducerMatch[1];
3816
+ const normalizedRegion = region.replace(/[\t\n\r]/g, "");
3817
+ if (normalizedRegion.length >= 2) {
3818
+ if (normalizedRegion.slice(0, 2) !== "//") {
3819
+ parsed.error = parsed.error || "URI authority must not contain a literal backslash.";
3820
+ malformedAuthorityOrPort = true;
3821
+ } else if (region.length !== normalizedRegion.length) {
3822
+ parsed.error = parsed.error || "URI authority introducer must not contain whitespace.";
3823
+ malformedAuthorityOrPort = true;
3824
+ }
3825
+ }
3826
+ }
3901
3827
  const matches = uri.match(URI_PARSE);
3902
3828
  if (matches) {
3903
- parsed.scheme = matches[1] === void 0 ? void 0 : matches[1].toLowerCase();
3829
+ parsed.scheme = matches[1];
3904
3830
  parsed.userinfo = matches[3];
3905
3831
  parsed.host = matches[4];
3906
3832
  parsed.port = parseInt(matches[5], 10);
@@ -3959,11 +3885,12 @@ var require_fast_uri = __commonJS({
3959
3885
  if (parsed.path) {
3960
3886
  parsed.path = normalizePathEncoding(parsed.path);
3961
3887
  }
3962
- if (parsed.query) {
3963
- parsed.query = normalizeQueryFragmentEncoding(parsed.query);
3964
- }
3965
3888
  if (parsed.fragment) {
3966
- parsed.fragment = normalizeQueryFragmentEncoding(parsed.fragment);
3889
+ try {
3890
+ parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
3891
+ } catch {
3892
+ parsed.error = parsed.error || "URI malformed";
3893
+ }
3967
3894
  }
3968
3895
  }
3969
3896
  if (schemeHandler && schemeHandler.parse) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@factiii/runner",
3
- "version": "0.9.2",
3
+ "version": "0.9.4",
4
4
  "description": "Factiii Runner, run Board AI agents on a machine you control. Pairs with the Factiii web/mobile clients over WebRTC.",
5
5
  "license": "ISC",
6
6
  "keywords": [
@@ -31,18 +31,6 @@
31
31
  "vendor/frpc-darwin-arm64",
32
32
  "README.md"
33
33
  ],
34
- "dependencies": {
35
- "node-datachannel": "^0.12.0"
36
- },
37
- "devDependencies": {
38
- "@types/node": "^20.0.0",
39
- "commander": "^12.1.0",
40
- "esbuild": "*",
41
- "socket.io-client": "^4.8.1",
42
- "tsx": "^4.22.4",
43
- "typescript": "5.9.3",
44
- "@shared/all": "0.0.0"
45
- },
46
34
  "scripts": {
47
35
  "build": "node build.mjs",
48
36
  "check-types": "tsc --noEmit",
@@ -53,6 +41,19 @@
53
41
  "start": "node dist/cli.js",
54
42
  "fetch:frpc": "bash scripts/fetch-frpc.sh",
55
43
  "bundle:index": "pnpm --filter @factiii/index build && rm -rf index && cp -r ../index/image index",
56
- "pack": "node build.mjs && pnpm bundle:index && bash scripts/fetch-frpc.sh && pnpm pack"
44
+ "pack": "node build.mjs && pnpm bundle:index && bash scripts/fetch-frpc.sh && pnpm pack",
45
+ "prepublishOnly": "node build.mjs && pnpm bundle:index && bash scripts/fetch-frpc.sh"
46
+ },
47
+ "dependencies": {
48
+ "node-datachannel": "^0.12.0"
49
+ },
50
+ "devDependencies": {
51
+ "@shared/all": "workspace:*",
52
+ "@types/node": "^20.0.0",
53
+ "commander": "^12.1.0",
54
+ "esbuild": "*",
55
+ "socket.io-client": "^4.8.3",
56
+ "tsx": "^4.22.4",
57
+ "typescript": "catalog:"
57
58
  }
58
- }
59
+ }
File without changes
File without changes
File without changes
File without changes