@withgateway/sdk 0.6.0 → 0.9.1

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 (119) hide show
  1. package/dist/agents/index.d.mts +573 -0
  2. package/dist/agents/index.d.ts +573 -0
  3. package/dist/agents/index.js +1443 -0
  4. package/dist/agents/index.js.map +1 -0
  5. package/dist/agents/index.mjs +1394 -0
  6. package/dist/agents/index.mjs.map +1 -0
  7. package/dist/apiError-DHpfbmdx.d.mts +17 -0
  8. package/dist/apiError-DHpfbmdx.d.ts +17 -0
  9. package/dist/cli.js +5019 -1599
  10. package/dist/cli.js.map +1 -1
  11. package/dist/cli.mjs +5003 -1584
  12. package/dist/cli.mjs.map +1 -1
  13. package/dist/files/index.d.mts +3 -1
  14. package/dist/files/index.d.ts +3 -1
  15. package/dist/files/index.js +371 -102
  16. package/dist/files/index.js.map +1 -1
  17. package/dist/files/index.mjs +371 -102
  18. package/dist/files/index.mjs.map +1 -1
  19. package/dist/hooks/index.js +346 -136
  20. package/dist/hooks/index.js.map +1 -1
  21. package/dist/hooks/index.mjs +346 -136
  22. package/dist/hooks/index.mjs.map +1 -1
  23. package/dist/{index-LA-PMRJT.d.ts → index-DIN14Lhg.d.ts} +1 -1
  24. package/dist/{index-Di9nNqOY.d.mts → index-DuB-eQ0Z.d.mts} +1 -1
  25. package/dist/index.d.mts +7 -4
  26. package/dist/index.d.ts +7 -4
  27. package/dist/index.js +2689 -401
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.mjs +2650 -394
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/media-CQUC7TkS.d.mts +39 -0
  32. package/dist/media-DQnBloaX.d.ts +39 -0
  33. package/dist/traces/index.d.mts +3 -1
  34. package/dist/traces/index.d.ts +3 -1
  35. package/dist/traces/index.js +371 -102
  36. package/dist/traces/index.js.map +1 -1
  37. package/dist/traces/index.mjs +371 -102
  38. package/dist/traces/index.mjs.map +1 -1
  39. package/dist/tracing/index.d.mts +3 -2
  40. package/dist/tracing/index.d.ts +3 -2
  41. package/dist/tracing/index.js +257 -16
  42. package/dist/tracing/index.js.map +1 -1
  43. package/dist/tracing/index.mjs +257 -16
  44. package/dist/tracing/index.mjs.map +1 -1
  45. package/dist/transport-CpRe7zgd.d.mts +123 -0
  46. package/dist/transport-CpRe7zgd.d.ts +123 -0
  47. package/dist/worlds/index.d.mts +1983 -1745
  48. package/dist/worlds/index.d.ts +1983 -1745
  49. package/dist/worlds/index.js +1295 -226
  50. package/dist/worlds/index.js.map +1 -1
  51. package/dist/worlds/index.mjs +1290 -222
  52. package/dist/worlds/index.mjs.map +1 -1
  53. package/package.json +6 -1
  54. package/runtime/gatewaysdk/environment/bundle_manifest.py +243 -0
  55. package/runtime/gatewaysdk/environment/schema/__main__.py +2 -2
  56. package/runtime/gatewaysdk/environment/schema/_slack_fidelity.py +8 -23
  57. package/runtime/gatewaysdk/environment/schema/api.py +3 -4
  58. package/runtime/gatewaysdk/environment/schema/assertions.py +7 -1
  59. package/runtime/gatewaysdk/environment/schema/bundle_runtime.py +1 -0
  60. package/runtime/gatewaysdk/environment/schema/call_log.py +20 -0
  61. package/runtime/gatewaysdk/environment/schema/database/base.py +2 -2
  62. package/runtime/gatewaysdk/environment/schema/host.py +74 -11
  63. package/runtime/gatewaysdk/environment/schema/host_browser.py +48 -0
  64. package/runtime/gatewaysdk/environment/schema/host_control.py +33 -2
  65. package/runtime/gatewaysdk/environment/schema/host_handoff.py +4 -1
  66. package/runtime/gatewaysdk/environment/schema/host_requests.py +14 -0
  67. package/runtime/gatewaysdk/environment/schema/host_session.py +13 -2
  68. package/runtime/gatewaysdk/environment/schema/host_surfaces.py +6 -0
  69. package/runtime/gatewaysdk/environment/schema/host_versions.py +96 -19
  70. package/runtime/gatewaysdk/environment/schema/journal.py +7 -2
  71. package/runtime/gatewaysdk/environment/schema/local.py +32 -7
  72. package/runtime/gatewaysdk/environment/schema/page_checks.py +123 -0
  73. package/runtime/gatewaysdk/environment/schema/platform.py +23 -267
  74. package/runtime/gatewaysdk/environment/schema/platform_templates.py +332 -0
  75. package/runtime/gatewaysdk/environment/schema/request_ledger.py +4 -1
  76. package/runtime/gatewaysdk/environment/schema/run_parameters.py +25 -0
  77. package/runtime/gatewaysdk/environment/schema/runtime.py +43 -5
  78. package/runtime/gatewaysdk/environment/schema/scaffold.py +367 -217
  79. package/runtime/gatewaysdk/environment/schema/session_files.py +13 -2
  80. package/runtime/gatewaysdk/environment/schema/skills/benchmarks-getting-started/SKILL.md +1 -1
  81. package/runtime/gatewaysdk/environment/schema/skills/connector-schema-authoring/SKILL.md +1 -2
  82. package/runtime/gatewaysdk/environment/schema/skills/world-data-ingestion/SKILL.md +4 -2
  83. package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/SKILL.md +7 -7
  84. package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/cli-mcp-map.md +32 -2
  85. package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/gotchas.md +6 -6
  86. package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/journal-checks.md +17 -2
  87. package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/new-world-sandbox.md +1 -1
  88. package/runtime/gatewaysdk/environment/schema/skills/worlds-getting-started/references/ui-map.md +3 -2
  89. package/runtime/gatewaysdk/environment/schema/slack.py +55 -10
  90. package/runtime/gatewaysdk/environment/schema/snapshot.py +28 -2
  91. package/runtime/gatewaysdk/environment/schema/tasks.py +25 -2
  92. package/runtime/gatewaysdk/environment/schema/template_record.py +131 -0
  93. package/runtime/gatewaysdk/environment/schema/tools_world.py +7 -5
  94. package/runtime/gatewaysdk/environment/schema/ui.py +54 -33
  95. package/runtime/gatewaysdk/environment/schema/ui_interactions.py +419 -0
  96. package/runtime/gatewaysdk/environment/schema/ui_recorder.js +895 -0
  97. package/runtime/gatewaysdk/environment/schema/ui_replay.py +366 -0
  98. package/runtime/gatewaysdk/environment/schema/ui_replay_record.LICENSE +25 -0
  99. package/runtime/gatewaysdk/environment/schema/ui_replay_record.js +109 -0
  100. package/runtime/gatewaysdk/environment/schema/validation.py +10 -1
  101. package/runtime/gatewaysdk/environment/schema/worker.py +5 -1
  102. package/runtime/gatewaysdk/environment/schema/workers.py +8 -1
  103. package/runtime/gatewaysdk/environment/schema/world_host.py +44 -15
  104. package/runtime/gatewaysdk/environment/secret_values.py +1 -1
  105. package/runtime/gatewaysdk/environment/world.py +34 -43
  106. package/runtime/gatewaysdk/environment/world_session_contract.py +7 -34
  107. package/skills/benchmarks-getting-started/SKILL.md +1 -1
  108. package/skills/connector-schema-authoring/SKILL.md +1 -2
  109. package/skills/connector-schema-authoring/connector-worlds.md +2 -2
  110. package/skills/connector-schema-authoring/world-schema.md +29 -23
  111. package/skills/world-data-ingestion/SKILL.md +4 -2
  112. package/skills/worlds-getting-started/SKILL.md +7 -7
  113. package/skills/worlds-getting-started/references/cli-mcp-map.md +32 -2
  114. package/skills/worlds-getting-started/references/gotchas.md +6 -6
  115. package/skills/worlds-getting-started/references/journal-checks.md +17 -2
  116. package/skills/worlds-getting-started/references/new-world-sandbox.md +1 -1
  117. package/skills/worlds-getting-started/references/ui-map.md +3 -2
  118. package/dist/media-BIApiPzS.d.mts +0 -102
  119. package/dist/media-BIApiPzS.d.ts +0 -102
@@ -1331,172 +1331,382 @@ function mirrorHandle(handle, identity) {
1331
1331
  var fs = __toESM(require("fs"));
1332
1332
 
1333
1333
  // src/cli/platform/worldData/toml.ts
1334
+ var TomlDateTime = class {
1335
+ constructor(text) {
1336
+ this.text = text;
1337
+ }
1338
+ text;
1339
+ toString() {
1340
+ return this.text;
1341
+ }
1342
+ };
1334
1343
  var TomlError = class extends Error {
1335
1344
  };
1336
1345
  function parseToml(text) {
1337
- const root = {};
1338
- let current = root;
1339
- const lines = joinContinuations(text);
1340
- for (const [number, rawLine] of lines.entries()) {
1341
- const line = stripComment(rawLine).trim();
1342
- if (!line) continue;
1343
- const arrayTable = /^\[\[\s*([^\]]+?)\s*\]\]$/.exec(line);
1344
- if (arrayTable) {
1345
- const parent = tableAt(root, keyPath(arrayTable[1]).slice(0, -1));
1346
- const name = keyPath(arrayTable[1]).at(-1);
1347
- const list = parent[name] ??= [];
1348
- if (!Array.isArray(list)) throw new TomlError(`line ${number + 1}: ${name} is not an array of tables`);
1349
- current = {};
1350
- list.push(current);
1351
- continue;
1352
- }
1353
- const table = /^\[\s*([^\]]+?)\s*\]$/.exec(line);
1354
- if (table) {
1355
- current = tableAt(root, keyPath(table[1]));
1356
- continue;
1357
- }
1358
- const eq = line.indexOf("=");
1359
- if (eq === -1) throw new TomlError(`line ${number + 1}: expected key = value`);
1360
- const key2 = unquoteKey(line.slice(0, eq).trim());
1361
- const [value, rest] = readValue(line.slice(eq + 1).trim(), number + 1);
1362
- if (rest.trim()) throw new TomlError(`line ${number + 1}: unexpected text after value`);
1363
- current[key2] = value;
1364
- }
1365
- return root;
1346
+ return new TomlReader(text).read();
1366
1347
  }
1367
- function keyPath(header) {
1368
- return header.split(".").map((part) => unquoteKey(part.trim()));
1369
- }
1370
- function unquoteKey(key2) {
1371
- if (key2.startsWith('"') && key2.endsWith('"') || key2.startsWith("'") && key2.endsWith("'")) return key2.slice(1, -1);
1372
- return key2;
1348
+ var BARE_KEY = /^[A-Za-z0-9_-]+$/;
1349
+ var CONTROL = /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/;
1350
+ var COMMENT_CONTROL = /[\x00-\x08\x0a-\x1f\x7f]/;
1351
+ var DEC_INT = /^[+-]?(?:0|[1-9](?:_?\d)*)$/;
1352
+ var RADIX_INT = [
1353
+ [/^0x[0-9A-Fa-f](?:_?[0-9A-Fa-f])*$/, 16],
1354
+ [/^0o[0-7](?:_?[0-7])*$/, 8],
1355
+ [/^0b[01](?:_?[01])*$/, 2]
1356
+ ];
1357
+ var FLOAT = /^[+-]?(?:0|[1-9](?:_?\d)*)(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?$/;
1358
+ var SPECIAL_FLOAT = /^([+-]?)(inf|nan)$/;
1359
+ var DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})(?:[Tt ](\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:[Zz]|[+-](\d{2}):(\d{2}))?)?/;
1360
+ var LOCAL_TIME = /^(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?/;
1361
+ var INLINE = /* @__PURE__ */ new WeakSet();
1362
+ var newTable = () => /* @__PURE__ */ Object.create(null);
1363
+ var own = (table, key2) => Object.prototype.hasOwnProperty.call(table, key2) ? table[key2] : void 0;
1364
+ var isTomlTable = (value) => value !== void 0 && typeof value === "object" && Object.getPrototypeOf(value) === null;
1365
+ var stripBlank = (text) => text.replace(/^[ \t]+|[ \t]+$/g, "");
1366
+ var TomlReader = class {
1367
+ constructor(text) {
1368
+ this.text = text;
1369
+ }
1370
+ text;
1371
+ root = newTable();
1372
+ current = this.root;
1373
+ defined = /* @__PURE__ */ new WeakSet();
1374
+ byHeader = /* @__PURE__ */ new WeakSet();
1375
+ byDottedKey = /* @__PURE__ */ new WeakSet();
1376
+ tableArrays = /* @__PURE__ */ new WeakSet();
1377
+ read() {
1378
+ for (const { text, line } of logicalLines(this.text)) this.statement(stripBlank(text), line);
1379
+ return this.root;
1380
+ }
1381
+ statement(text, line) {
1382
+ if (!text) return;
1383
+ const arrayTable = /^\[\[[ \t]*(.+?)[ \t]*\]\]$/.exec(text);
1384
+ if (arrayTable) return this.arrayTable(keyPath(arrayTable[1], line), line);
1385
+ const header = /^\[[ \t]*(.+?)[ \t]*\]$/.exec(text);
1386
+ if (header) return this.header(keyPath(header[1], line), line);
1387
+ const eq = outsideQuotes(text, "=");
1388
+ if (eq === -1) throw new TomlError(`line ${line}: expected key = value`);
1389
+ const path4 = keyPath(text.slice(0, eq), line);
1390
+ const [value, rest] = readValue(text.slice(eq + 1), line);
1391
+ if (stripBlank(rest)) throw new TomlError(`line ${line}: unexpected text after value`);
1392
+ assign(this.descend(this.current, path4.slice(0, -1), line, "key"), path4, value, line);
1393
+ }
1394
+ header(path4, line) {
1395
+ const parent = this.descend(this.root, path4.slice(0, -1), line, "header");
1396
+ const name = path4.at(-1);
1397
+ const table = own(parent, name) ?? newTable();
1398
+ const fresh = isTomlTable(table) && !INLINE.has(table) && !this.byDottedKey.has(table) && !this.defined.has(table);
1399
+ if (!fresh) throw new TomlError(`line ${line}: [${path4.join(".")}] is defined twice`);
1400
+ parent[name] = table;
1401
+ this.open(table);
1402
+ }
1403
+ arrayTable(path4, line) {
1404
+ const parent = this.descend(this.root, path4.slice(0, -1), line, "header");
1405
+ const name = path4.at(-1);
1406
+ const existing = own(parent, name);
1407
+ if (existing !== void 0 && !(Array.isArray(existing) && this.tableArrays.has(existing)))
1408
+ throw new TomlError(`line ${line}: ${path4.join(".")} is not an array of tables`);
1409
+ const list = existing ?? [];
1410
+ this.tableArrays.add(list);
1411
+ parent[name] = list;
1412
+ const table = newTable();
1413
+ list.push(table);
1414
+ this.open(table);
1415
+ }
1416
+ open(table) {
1417
+ this.defined.add(table);
1418
+ this.byHeader.add(table);
1419
+ this.current = table;
1420
+ }
1421
+ descend(from, parts2, line, via) {
1422
+ let node = from;
1423
+ for (const part of parts2) {
1424
+ const next = own(node, part);
1425
+ node = next === void 0 ? this.make(node, part, via) : this.enter(next, part, line, via);
1426
+ }
1427
+ return node;
1428
+ }
1429
+ make(parent, part, via) {
1430
+ const table = newTable();
1431
+ (via === "header" ? this.byHeader : this.byDottedKey).add(table);
1432
+ parent[part] = table;
1433
+ return table;
1434
+ }
1435
+ enter(value, part, line, via) {
1436
+ const target = via === "header" && Array.isArray(value) && this.tableArrays.has(value) ? value.at(-1) : value;
1437
+ const open = isTomlTable(target) && !INLINE.has(target) && !(via === "key" && this.defined.has(target));
1438
+ if (!open) throw new TomlError(`line ${line}: ${part} is already defined and cannot be extended here`);
1439
+ if (via === "key") this.byDottedKey.add(target);
1440
+ return target;
1441
+ }
1442
+ };
1443
+ function assign(table, path4, value, line) {
1444
+ const key2 = path4.at(-1);
1445
+ if (own(table, key2) !== void 0) throw new TomlError(`line ${line}: key ${path4.join(".")} is defined twice`);
1446
+ table[key2] = value;
1373
1447
  }
1374
- function tableAt(root, parts2) {
1375
- let node = root;
1448
+ function inlineAt(table, parts2, line) {
1449
+ let node = table;
1376
1450
  for (const part of parts2) {
1377
- const next = node[part] ??= {};
1378
- if (Array.isArray(next)) {
1379
- const last = next[next.length - 1];
1380
- if (!last || typeof last !== "object" || Array.isArray(last)) throw new TomlError(`${part} is not a table`);
1381
- node = last;
1382
- } else if (typeof next !== "object") throw new TomlError(`${part} is not a table`);
1383
- else node = next;
1451
+ const next = own(node, part) ?? newTable();
1452
+ if (!isTomlTable(next) || INLINE.has(next))
1453
+ throw new TomlError(`line ${line}: ${part} is already defined and cannot be extended here`);
1454
+ node[part] = next;
1455
+ node = next;
1384
1456
  }
1385
1457
  return node;
1386
1458
  }
1387
- function joinContinuations(text) {
1388
- const out = [];
1389
- let pending = "";
1390
- let depth = 0;
1391
- for (const physical of text.split(/\r?\n/)) {
1392
- const raw = stripComment(physical);
1393
- const line = pending ? pending + "\n" + raw : raw;
1394
- depth = bracketDepth(line);
1395
- if (depth > 0) {
1396
- pending = line;
1397
- continue;
1398
- }
1399
- pending = "";
1400
- out.push(line);
1459
+ function keyPath(text, line) {
1460
+ const parts2 = [];
1461
+ let rest = text;
1462
+ for (; ; ) {
1463
+ const dot = outsideQuotes(rest, ".");
1464
+ parts2.push(readKey(stripBlank(dot === -1 ? rest : rest.slice(0, dot)), line));
1465
+ if (dot === -1) return parts2;
1466
+ rest = rest.slice(dot + 1);
1401
1467
  }
1402
- if (pending) out.push(pending);
1403
- return out;
1404
1468
  }
1405
- function bracketDepth(line) {
1406
- let depth = 0;
1469
+ function readKey(part, line) {
1470
+ const quote = openingQuote(part, 0);
1471
+ if (quote === null && BARE_KEY.test(part)) return part;
1472
+ const read = quote?.length === 1 ? readString(part, line) : null;
1473
+ if (!read || read[1] !== "") throw new TomlError(`line ${line}: \`${part}\` is not a key; quote it`);
1474
+ return read[0];
1475
+ }
1476
+ function outsideQuotes(text, char) {
1407
1477
  let quote = null;
1408
- for (let i = 0; i < line.length; i++) {
1409
- const c = line[i];
1478
+ for (let i = 0; i < text.length; i++) {
1479
+ const c = text[i];
1410
1480
  if (quote) {
1411
1481
  if (c === "\\" && quote === '"') i++;
1412
1482
  else if (c === quote) quote = null;
1413
1483
  continue;
1414
1484
  }
1415
1485
  if (c === '"' || c === "'") quote = c;
1416
- else if (c === "[" || c === "{") depth++;
1417
- else if (c === "]" || c === "}") depth--;
1486
+ else if (c === char) return i;
1418
1487
  }
1419
- return depth;
1488
+ return -1;
1420
1489
  }
1421
- function stripComment(line) {
1422
- let quote = null;
1423
- for (let i = 0; i < line.length; i++) {
1424
- const c = line[i];
1425
- if (quote) {
1426
- if (c === "\\" && quote === '"') i++;
1427
- else if (c === quote) quote = null;
1428
- continue;
1429
- }
1430
- if (c === '"' || c === "'") quote = c;
1431
- else if (c === "#") return line.slice(0, i);
1490
+ function openingQuote(text, i) {
1491
+ const c = text[i];
1492
+ if (c !== '"' && c !== "'") return null;
1493
+ return text.startsWith(c.repeat(3), i) ? c.repeat(3) : c;
1494
+ }
1495
+ function quoteRun(text, i, quote, line) {
1496
+ let run = 0;
1497
+ while (text[i + run] === quote) run++;
1498
+ if (run > 5) throw new TomlError(`line ${line}: too many quotes close a multi-line string`);
1499
+ return run;
1500
+ }
1501
+ var LogicalLines = class {
1502
+ constructor(text) {
1503
+ this.text = text;
1504
+ }
1505
+ text;
1506
+ out = [];
1507
+ brackets = [];
1508
+ buffer = "";
1509
+ start = 1;
1510
+ line = 1;
1511
+ quote = null;
1512
+ i = 0;
1513
+ split() {
1514
+ if (this.text.startsWith("\uFEFF")) throw new TomlError("line 1: a byte order mark is not TOML");
1515
+ for (; this.i < this.text.length; this.i++) this.step(this.text[this.i]);
1516
+ if (this.quote) throw new TomlError(`line ${this.start}: unterminated string`);
1517
+ if (this.brackets.length > 0) throw new TomlError(`line ${this.start}: a bracket or brace is never closed`);
1518
+ this.out.push({ text: this.buffer, line: this.start });
1519
+ return this.out;
1520
+ }
1521
+ step(c) {
1522
+ if (c === "\n") this.line++;
1523
+ if (this.quote) return this.inString(c, this.quote);
1524
+ if (c === "#") return this.skipComment();
1525
+ const opened = openingQuote(this.text, this.i);
1526
+ if (opened) return this.openString(opened);
1527
+ this.outside(c);
1528
+ }
1529
+ inString(c, quote) {
1530
+ if (c === "\n" && quote.length === 1) throw new TomlError(`line ${this.line - 1}: unterminated string`);
1531
+ if (c === "\\" && quote.startsWith('"')) return this.escape();
1532
+ if (this.text.startsWith(quote, this.i)) return this.closeString(quote);
1533
+ this.buffer += c;
1534
+ }
1535
+ escape() {
1536
+ const next = this.text[this.i + 1] ?? "";
1537
+ this.buffer += "\\" + next;
1538
+ if (next === "\n") this.line++;
1539
+ this.i++;
1540
+ }
1541
+ openString(opened) {
1542
+ this.quote = opened;
1543
+ this.buffer += opened;
1544
+ this.i += opened.length - 1;
1545
+ }
1546
+ closeString(quote) {
1547
+ const run = quote.length === 3 ? quoteRun(this.text, this.i, quote[0], this.line) : 1;
1548
+ this.buffer += this.text.slice(this.i, this.i + run);
1549
+ this.i += run - 1;
1550
+ this.quote = null;
1551
+ }
1552
+ skipComment() {
1553
+ for (; this.i + 1 < this.text.length && this.text[this.i + 1] !== "\n"; this.i++)
1554
+ this.commentCharacter(this.text[this.i + 1]);
1555
+ }
1556
+ commentCharacter(c) {
1557
+ const lineEnd = c === "\r" && this.text[this.i + 2] === "\n";
1558
+ if (!lineEnd && COMMENT_CONTROL.test(c))
1559
+ throw new TomlError(`line ${this.line}: a comment holds a control character`);
1560
+ }
1561
+ outside(c) {
1562
+ if (c === "[" || c === "{") this.brackets.push(c);
1563
+ if (c === "]" || c === "}") this.brackets.pop();
1564
+ if (c === "\n" && this.brackets.at(-1) === "{")
1565
+ throw new TomlError(`line ${this.line - 1}: an inline table must be on one line`);
1566
+ if (c === "\n" && this.brackets.length === 0) return this.endLine();
1567
+ this.buffer += c;
1568
+ }
1569
+ endLine() {
1570
+ this.out.push({ text: this.buffer.replace(/\r$/, ""), line: this.start });
1571
+ this.buffer = "";
1572
+ this.start = this.line;
1432
1573
  }
1433
- return line;
1574
+ };
1575
+ function logicalLines(text) {
1576
+ return new LogicalLines(text).split();
1434
1577
  }
1435
- function readValue(text, line) {
1436
- const s = text.trimStart();
1437
- if (s.startsWith('"')) {
1438
- let out = "";
1439
- for (let i = 1; i < s.length; i++) {
1440
- const c = s[i];
1441
- if (c === "\\") {
1442
- const e = s[++i];
1443
- const map = { n: "\n", t: " ", r: "\r", '"': '"', "\\": "\\", b: "\b", f: "\f" };
1444
- if (e === "u" || e === "U") {
1445
- const width = e === "u" ? 4 : 8;
1446
- out += String.fromCodePoint(parseInt(s.slice(i + 1, i + 1 + width), 16));
1447
- i += width;
1448
- } else if (e !== void 0 && e in map) out += map[e];
1449
- else throw new TomlError(`line ${line}: unsupported escape \\${e ?? ""}`);
1450
- continue;
1451
- }
1452
- if (c === '"') return [out, s.slice(i + 1)];
1578
+ var ESCAPES = { n: "\n", t: " ", r: "\r", '"': '"', "\\": "\\", b: "\b", f: "\f" };
1579
+ function unicodeEscape(body, at, width, line) {
1580
+ const digits = body.slice(at, at + width);
1581
+ const code = /^[0-9A-Fa-f]+$/.test(digits) && digits.length === width ? parseInt(digits, 16) : -1;
1582
+ const scalar = code >= 0 && code <= 1114111 && (code < 55296 || code > 57343);
1583
+ if (!scalar) throw new TomlError(`line ${line}: \\${width === 4 ? "u" : "U"}${digits} is not a Unicode scalar value`);
1584
+ return String.fromCodePoint(code);
1585
+ }
1586
+ function decodeBasic(body, line, multiline) {
1587
+ let out = "";
1588
+ for (let i = 0; i < body.length; i++) {
1589
+ const c = body[i];
1590
+ if (c !== "\\") {
1453
1591
  out += c;
1592
+ continue;
1593
+ }
1594
+ const e = body[++i];
1595
+ if (multiline && /^[ \t]*\r?\n/.test(body.slice(i))) {
1596
+ while (i + 1 < body.length && /[ \t\r\n]/.test(body[i + 1])) i++;
1597
+ continue;
1454
1598
  }
1455
- throw new TomlError(`line ${line}: unterminated string`);
1456
- }
1457
- if (s.startsWith("'")) {
1458
- const end = s.indexOf("'", 1);
1459
- if (end === -1) throw new TomlError(`line ${line}: unterminated string`);
1460
- return [s.slice(1, end), s.slice(end + 1)];
1461
- }
1462
- if (s.startsWith("[")) {
1463
- const items = [];
1464
- let rest2 = s.slice(1);
1465
- for (; ; ) {
1466
- rest2 = rest2.replace(/^[\s\n]+/, "");
1467
- if (rest2.startsWith("]")) return [items, rest2.slice(1)];
1468
- const [item, after] = readValue(rest2, line);
1469
- items.push(item);
1470
- rest2 = after.replace(/^[\s\n]+/, "");
1471
- if (rest2.startsWith(",")) rest2 = rest2.slice(1);
1472
- else if (!rest2.startsWith("]")) throw new TomlError(`line ${line}: expected , or ] in array`);
1599
+ if (e === "u" || e === "U") {
1600
+ const width = e === "u" ? 4 : 8;
1601
+ out += unicodeEscape(body, i + 1, width, line);
1602
+ i += width;
1603
+ } else if (e !== void 0 && e in ESCAPES) out += ESCAPES[e];
1604
+ else throw new TomlError(`line ${line}: unsupported escape \\${e ?? ""}`);
1605
+ }
1606
+ return out;
1607
+ }
1608
+ function checkControls(body, line, multiline) {
1609
+ const broken = CONTROL.test(body) || (multiline ? /\r(?!\n)/.test(body) : /[\r\n]/.test(body));
1610
+ if (broken) throw new TomlError(`line ${line}: a string holds a control character`);
1611
+ }
1612
+ function readString(s, line) {
1613
+ const quote = openingQuote(s, 0);
1614
+ if (!quote) return null;
1615
+ let end = quote.length;
1616
+ for (; end < s.length; end++) {
1617
+ if (quote.startsWith('"') && s[end] === "\\") {
1618
+ end++;
1619
+ continue;
1473
1620
  }
1621
+ if (s.startsWith(quote, end)) break;
1622
+ }
1623
+ if (end >= s.length) throw new TomlError(`line ${line}: unterminated string`);
1624
+ if (quote.length === 3) end += quoteRun(s, end, quote[0], line) - 3;
1625
+ const raw = s.slice(quote.length, end);
1626
+ const multiline = quote.length === 3;
1627
+ const body = multiline ? raw.replace(/^\r?\n/, "") : raw;
1628
+ checkControls(body, line, multiline);
1629
+ const text = quote.startsWith('"') ? decodeBasic(body, line, multiline) : body;
1630
+ return [text, s.slice(end + quote.length)];
1631
+ }
1632
+ function readArray(s, line) {
1633
+ const items = [];
1634
+ let rest = s.slice(1);
1635
+ for (; ; ) {
1636
+ rest = rest.replace(/^[ \t\r\n]+/, "");
1637
+ if (rest.startsWith("]")) return [items, rest.slice(1)];
1638
+ const [item, after] = readValue(rest, line);
1639
+ items.push(item);
1640
+ rest = after.replace(/^[ \t\r\n]+/, "");
1641
+ if (rest.startsWith(",")) rest = rest.slice(1);
1642
+ else if (!rest.startsWith("]")) throw new TomlError(`line ${line}: expected , or ] in array`);
1474
1643
  }
1475
- if (s.startsWith("{")) {
1476
- const table = {};
1477
- let rest2 = s.slice(1);
1478
- for (; ; ) {
1479
- rest2 = rest2.replace(/^[\s\n]+/, "");
1480
- if (rest2.startsWith("}")) return [table, rest2.slice(1)];
1481
- const eq = rest2.indexOf("=");
1482
- if (eq === -1) throw new TomlError(`line ${line}: expected key = value in inline table`);
1483
- const key2 = unquoteKey(rest2.slice(0, eq).trim());
1484
- const [value, after] = readValue(rest2.slice(eq + 1), line);
1485
- table[key2] = value;
1486
- rest2 = after.replace(/^[\s\n]+/, "");
1487
- if (rest2.startsWith(",")) rest2 = rest2.slice(1);
1488
- else if (!rest2.startsWith("}")) throw new TomlError(`line ${line}: expected , or } in inline table`);
1644
+ }
1645
+ function readInlineTable(s, line) {
1646
+ const table = newTable();
1647
+ let rest = s.slice(1).replace(/^[ \t]+/, "");
1648
+ if (rest.startsWith("}")) {
1649
+ INLINE.add(table);
1650
+ return [table, rest.slice(1)];
1651
+ }
1652
+ for (; ; ) {
1653
+ const eq = outsideQuotes(rest, "=");
1654
+ if (eq === -1) throw new TomlError(`line ${line}: expected key = value in inline table`);
1655
+ const path4 = keyPath(rest.slice(0, eq), line);
1656
+ const [value, after] = readValue(rest.slice(eq + 1), line);
1657
+ assign(inlineAt(table, path4.slice(0, -1), line), path4, value, line);
1658
+ rest = after.replace(/^[ \t]+/, "");
1659
+ if (rest.startsWith("}")) {
1660
+ INLINE.add(table);
1661
+ return [table, rest.slice(1)];
1489
1662
  }
1663
+ if (!rest.startsWith(",")) throw new TomlError(`line ${line}: expected , or } in inline table`);
1664
+ rest = rest.slice(1).replace(/^[ \t]+/, "");
1665
+ if (rest.startsWith("}")) throw new TomlError(`line ${line}: an inline table takes no trailing comma`);
1490
1666
  }
1491
- const scalar = /^([^,\]}\s]+)/.exec(s);
1667
+ }
1668
+ function inRange(value, low, high) {
1669
+ return value === void 0 || Number(value) >= low && Number(value) <= high;
1670
+ }
1671
+ function readDateTime(s, line) {
1672
+ const full = DATE_TIME.exec(s);
1673
+ const time = full ? null : LOCAL_TIME.exec(s);
1674
+ const match = full ?? time;
1675
+ if (!match) return null;
1676
+ const [y, mo, d, h, mi, se, oh, om] = full ? full.slice(1) : [void 0, void 0, void 0, ...time.slice(1)];
1677
+ const day = y === void 0 ? null : new Date(Date.UTC(Number(y), Number(mo) - 1, Number(d)));
1678
+ const dateOk = day === null || day.getUTCMonth() === Number(mo) - 1 && day.getUTCDate() === Number(d);
1679
+ const timeOk = inRange(h, 0, 23) && inRange(mi, 0, 59) && inRange(se, 0, 59) && inRange(oh, 0, 23) && inRange(om, 0, 59);
1680
+ if (!dateOk || !timeOk) throw new TomlError(`line ${line}: ${match[0]} is not a valid date or time`);
1681
+ return [new TomlDateTime(match[0]), s.slice(match[0].length)];
1682
+ }
1683
+ function readNumber(token) {
1684
+ const plain = token.replace(/_/g, "");
1685
+ if (DEC_INT.test(token)) return Number(plain);
1686
+ for (const [pattern, radix] of RADIX_INT) if (pattern.test(token)) return parseInt(plain.slice(2), radix);
1687
+ if (FLOAT.test(token) && /[.eE]/.test(token)) return Number(plain);
1688
+ const special = SPECIAL_FLOAT.exec(token);
1689
+ if (!special) return null;
1690
+ if (special[2] === "nan") return NaN;
1691
+ return special[1] === "-" ? -Infinity : Infinity;
1692
+ }
1693
+ function readValue(text, line) {
1694
+ const s = text.replace(/^[ \t]+/, "");
1695
+ const string = readString(s, line);
1696
+ if (string) return string;
1697
+ if (s.startsWith("[")) return readArray(s, line);
1698
+ if (s.startsWith("{")) return readInlineTable(s, line);
1699
+ const date = readDateTime(s, line);
1700
+ if (date) return date;
1701
+ const scalar = /^([^,\]}\s#]+)/.exec(s);
1492
1702
  if (!scalar) throw new TomlError(`line ${line}: expected a value`);
1493
1703
  const token = scalar[1];
1494
1704
  const rest = s.slice(token.length);
1495
1705
  if (token === "true") return [true, rest];
1496
1706
  if (token === "false") return [false, rest];
1497
- if (/^[+-]?\d[\d_]*$/.test(token)) return [Number(token.replace(/_/g, "")), rest];
1498
- if (/^[+-]?(\d[\d_]*)?\.?\d[\d_]*([eE][+-]?\d+)?$/.test(token)) return [Number(token.replace(/_/g, "")), rest];
1499
- throw new TomlError(`line ${line}: unsupported value ${token}`);
1707
+ const number = readNumber(token);
1708
+ if (number === null) throw new TomlError(`line ${line}: unsupported value ${token}`);
1709
+ return [number, rest];
1500
1710
  }
1501
1711
 
1502
1712
  // src/hooks/events.ts
@@ -2199,7 +2409,7 @@ function loadHookConfig(file) {
2199
2409
  }
2200
2410
  return parseHookConfig(data, file);
2201
2411
  }
2202
- var isObject2 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
2412
+ var isObject2 = (v) => typeof v === "object" && v !== null && [null, Object.prototype].includes(Object.getPrototypeOf(v));
2203
2413
  function parseHookConfig(data, source) {
2204
2414
  const where = source ?? "config";
2205
2415
  if (!isObject2(data))
@@ -3541,8 +3751,8 @@ function readConnection(root) {
3541
3751
  };
3542
3752
  }
3543
3753
  return {
3544
- slug: connector.slug ?? path2.basename(root),
3545
- baseUrl: (connector.base_url ?? "").replace(/\/+$/, ""),
3754
+ slug: typeof connector.slug === "string" ? connector.slug : path2.basename(root),
3755
+ baseUrl: (typeof connector.base_url === "string" ? connector.base_url : "").replace(/\/+$/, ""),
3546
3756
  scheme: carrier.scheme,
3547
3757
  carrier,
3548
3758
  ...typeof auth.secret_env === "string" ? { secretEnv: auth.secret_env } : {},