@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
@@ -1212,172 +1212,382 @@ function mirrorHandle(handle, identity) {
1212
1212
  import * as fs from "fs";
1213
1213
 
1214
1214
  // src/cli/platform/worldData/toml.ts
1215
+ var TomlDateTime = class {
1216
+ constructor(text) {
1217
+ this.text = text;
1218
+ }
1219
+ text;
1220
+ toString() {
1221
+ return this.text;
1222
+ }
1223
+ };
1215
1224
  var TomlError = class extends Error {
1216
1225
  };
1217
1226
  function parseToml(text) {
1218
- const root = {};
1219
- let current = root;
1220
- const lines = joinContinuations(text);
1221
- for (const [number, rawLine] of lines.entries()) {
1222
- const line = stripComment(rawLine).trim();
1223
- if (!line) continue;
1224
- const arrayTable = /^\[\[\s*([^\]]+?)\s*\]\]$/.exec(line);
1225
- if (arrayTable) {
1226
- const parent = tableAt(root, keyPath(arrayTable[1]).slice(0, -1));
1227
- const name = keyPath(arrayTable[1]).at(-1);
1228
- const list = parent[name] ??= [];
1229
- if (!Array.isArray(list)) throw new TomlError(`line ${number + 1}: ${name} is not an array of tables`);
1230
- current = {};
1231
- list.push(current);
1232
- continue;
1233
- }
1234
- const table = /^\[\s*([^\]]+?)\s*\]$/.exec(line);
1235
- if (table) {
1236
- current = tableAt(root, keyPath(table[1]));
1237
- continue;
1238
- }
1239
- const eq = line.indexOf("=");
1240
- if (eq === -1) throw new TomlError(`line ${number + 1}: expected key = value`);
1241
- const key2 = unquoteKey(line.slice(0, eq).trim());
1242
- const [value, rest] = readValue(line.slice(eq + 1).trim(), number + 1);
1243
- if (rest.trim()) throw new TomlError(`line ${number + 1}: unexpected text after value`);
1244
- current[key2] = value;
1245
- }
1246
- return root;
1227
+ return new TomlReader(text).read();
1247
1228
  }
1248
- function keyPath(header) {
1249
- return header.split(".").map((part) => unquoteKey(part.trim()));
1250
- }
1251
- function unquoteKey(key2) {
1252
- if (key2.startsWith('"') && key2.endsWith('"') || key2.startsWith("'") && key2.endsWith("'")) return key2.slice(1, -1);
1253
- return key2;
1229
+ var BARE_KEY = /^[A-Za-z0-9_-]+$/;
1230
+ var CONTROL = /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/;
1231
+ var COMMENT_CONTROL = /[\x00-\x08\x0a-\x1f\x7f]/;
1232
+ var DEC_INT = /^[+-]?(?:0|[1-9](?:_?\d)*)$/;
1233
+ var RADIX_INT = [
1234
+ [/^0x[0-9A-Fa-f](?:_?[0-9A-Fa-f])*$/, 16],
1235
+ [/^0o[0-7](?:_?[0-7])*$/, 8],
1236
+ [/^0b[01](?:_?[01])*$/, 2]
1237
+ ];
1238
+ var FLOAT = /^[+-]?(?:0|[1-9](?:_?\d)*)(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?$/;
1239
+ var SPECIAL_FLOAT = /^([+-]?)(inf|nan)$/;
1240
+ var DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})(?:[Tt ](\d{2}):(\d{2}):(\d{2})(?:\.\d+)?(?:[Zz]|[+-](\d{2}):(\d{2}))?)?/;
1241
+ var LOCAL_TIME = /^(\d{2}):(\d{2}):(\d{2})(?:\.\d+)?/;
1242
+ var INLINE = /* @__PURE__ */ new WeakSet();
1243
+ var newTable = () => /* @__PURE__ */ Object.create(null);
1244
+ var own = (table, key2) => Object.prototype.hasOwnProperty.call(table, key2) ? table[key2] : void 0;
1245
+ var isTomlTable = (value) => value !== void 0 && typeof value === "object" && Object.getPrototypeOf(value) === null;
1246
+ var stripBlank = (text) => text.replace(/^[ \t]+|[ \t]+$/g, "");
1247
+ var TomlReader = class {
1248
+ constructor(text) {
1249
+ this.text = text;
1250
+ }
1251
+ text;
1252
+ root = newTable();
1253
+ current = this.root;
1254
+ defined = /* @__PURE__ */ new WeakSet();
1255
+ byHeader = /* @__PURE__ */ new WeakSet();
1256
+ byDottedKey = /* @__PURE__ */ new WeakSet();
1257
+ tableArrays = /* @__PURE__ */ new WeakSet();
1258
+ read() {
1259
+ for (const { text, line } of logicalLines(this.text)) this.statement(stripBlank(text), line);
1260
+ return this.root;
1261
+ }
1262
+ statement(text, line) {
1263
+ if (!text) return;
1264
+ const arrayTable = /^\[\[[ \t]*(.+?)[ \t]*\]\]$/.exec(text);
1265
+ if (arrayTable) return this.arrayTable(keyPath(arrayTable[1], line), line);
1266
+ const header = /^\[[ \t]*(.+?)[ \t]*\]$/.exec(text);
1267
+ if (header) return this.header(keyPath(header[1], line), line);
1268
+ const eq = outsideQuotes(text, "=");
1269
+ if (eq === -1) throw new TomlError(`line ${line}: expected key = value`);
1270
+ const path4 = keyPath(text.slice(0, eq), line);
1271
+ const [value, rest] = readValue(text.slice(eq + 1), line);
1272
+ if (stripBlank(rest)) throw new TomlError(`line ${line}: unexpected text after value`);
1273
+ assign(this.descend(this.current, path4.slice(0, -1), line, "key"), path4, value, line);
1274
+ }
1275
+ header(path4, line) {
1276
+ const parent = this.descend(this.root, path4.slice(0, -1), line, "header");
1277
+ const name = path4.at(-1);
1278
+ const table = own(parent, name) ?? newTable();
1279
+ const fresh = isTomlTable(table) && !INLINE.has(table) && !this.byDottedKey.has(table) && !this.defined.has(table);
1280
+ if (!fresh) throw new TomlError(`line ${line}: [${path4.join(".")}] is defined twice`);
1281
+ parent[name] = table;
1282
+ this.open(table);
1283
+ }
1284
+ arrayTable(path4, line) {
1285
+ const parent = this.descend(this.root, path4.slice(0, -1), line, "header");
1286
+ const name = path4.at(-1);
1287
+ const existing = own(parent, name);
1288
+ if (existing !== void 0 && !(Array.isArray(existing) && this.tableArrays.has(existing)))
1289
+ throw new TomlError(`line ${line}: ${path4.join(".")} is not an array of tables`);
1290
+ const list = existing ?? [];
1291
+ this.tableArrays.add(list);
1292
+ parent[name] = list;
1293
+ const table = newTable();
1294
+ list.push(table);
1295
+ this.open(table);
1296
+ }
1297
+ open(table) {
1298
+ this.defined.add(table);
1299
+ this.byHeader.add(table);
1300
+ this.current = table;
1301
+ }
1302
+ descend(from, parts2, line, via) {
1303
+ let node = from;
1304
+ for (const part of parts2) {
1305
+ const next = own(node, part);
1306
+ node = next === void 0 ? this.make(node, part, via) : this.enter(next, part, line, via);
1307
+ }
1308
+ return node;
1309
+ }
1310
+ make(parent, part, via) {
1311
+ const table = newTable();
1312
+ (via === "header" ? this.byHeader : this.byDottedKey).add(table);
1313
+ parent[part] = table;
1314
+ return table;
1315
+ }
1316
+ enter(value, part, line, via) {
1317
+ const target = via === "header" && Array.isArray(value) && this.tableArrays.has(value) ? value.at(-1) : value;
1318
+ const open = isTomlTable(target) && !INLINE.has(target) && !(via === "key" && this.defined.has(target));
1319
+ if (!open) throw new TomlError(`line ${line}: ${part} is already defined and cannot be extended here`);
1320
+ if (via === "key") this.byDottedKey.add(target);
1321
+ return target;
1322
+ }
1323
+ };
1324
+ function assign(table, path4, value, line) {
1325
+ const key2 = path4.at(-1);
1326
+ if (own(table, key2) !== void 0) throw new TomlError(`line ${line}: key ${path4.join(".")} is defined twice`);
1327
+ table[key2] = value;
1254
1328
  }
1255
- function tableAt(root, parts2) {
1256
- let node = root;
1329
+ function inlineAt(table, parts2, line) {
1330
+ let node = table;
1257
1331
  for (const part of parts2) {
1258
- const next = node[part] ??= {};
1259
- if (Array.isArray(next)) {
1260
- const last = next[next.length - 1];
1261
- if (!last || typeof last !== "object" || Array.isArray(last)) throw new TomlError(`${part} is not a table`);
1262
- node = last;
1263
- } else if (typeof next !== "object") throw new TomlError(`${part} is not a table`);
1264
- else node = next;
1332
+ const next = own(node, part) ?? newTable();
1333
+ if (!isTomlTable(next) || INLINE.has(next))
1334
+ throw new TomlError(`line ${line}: ${part} is already defined and cannot be extended here`);
1335
+ node[part] = next;
1336
+ node = next;
1265
1337
  }
1266
1338
  return node;
1267
1339
  }
1268
- function joinContinuations(text) {
1269
- const out = [];
1270
- let pending = "";
1271
- let depth = 0;
1272
- for (const physical of text.split(/\r?\n/)) {
1273
- const raw = stripComment(physical);
1274
- const line = pending ? pending + "\n" + raw : raw;
1275
- depth = bracketDepth(line);
1276
- if (depth > 0) {
1277
- pending = line;
1278
- continue;
1279
- }
1280
- pending = "";
1281
- out.push(line);
1340
+ function keyPath(text, line) {
1341
+ const parts2 = [];
1342
+ let rest = text;
1343
+ for (; ; ) {
1344
+ const dot = outsideQuotes(rest, ".");
1345
+ parts2.push(readKey(stripBlank(dot === -1 ? rest : rest.slice(0, dot)), line));
1346
+ if (dot === -1) return parts2;
1347
+ rest = rest.slice(dot + 1);
1282
1348
  }
1283
- if (pending) out.push(pending);
1284
- return out;
1285
1349
  }
1286
- function bracketDepth(line) {
1287
- let depth = 0;
1350
+ function readKey(part, line) {
1351
+ const quote = openingQuote(part, 0);
1352
+ if (quote === null && BARE_KEY.test(part)) return part;
1353
+ const read = quote?.length === 1 ? readString(part, line) : null;
1354
+ if (!read || read[1] !== "") throw new TomlError(`line ${line}: \`${part}\` is not a key; quote it`);
1355
+ return read[0];
1356
+ }
1357
+ function outsideQuotes(text, char) {
1288
1358
  let quote = null;
1289
- for (let i = 0; i < line.length; i++) {
1290
- const c = line[i];
1359
+ for (let i = 0; i < text.length; i++) {
1360
+ const c = text[i];
1291
1361
  if (quote) {
1292
1362
  if (c === "\\" && quote === '"') i++;
1293
1363
  else if (c === quote) quote = null;
1294
1364
  continue;
1295
1365
  }
1296
1366
  if (c === '"' || c === "'") quote = c;
1297
- else if (c === "[" || c === "{") depth++;
1298
- else if (c === "]" || c === "}") depth--;
1367
+ else if (c === char) return i;
1299
1368
  }
1300
- return depth;
1369
+ return -1;
1301
1370
  }
1302
- function stripComment(line) {
1303
- let quote = null;
1304
- for (let i = 0; i < line.length; i++) {
1305
- const c = line[i];
1306
- if (quote) {
1307
- if (c === "\\" && quote === '"') i++;
1308
- else if (c === quote) quote = null;
1309
- continue;
1310
- }
1311
- if (c === '"' || c === "'") quote = c;
1312
- else if (c === "#") return line.slice(0, i);
1371
+ function openingQuote(text, i) {
1372
+ const c = text[i];
1373
+ if (c !== '"' && c !== "'") return null;
1374
+ return text.startsWith(c.repeat(3), i) ? c.repeat(3) : c;
1375
+ }
1376
+ function quoteRun(text, i, quote, line) {
1377
+ let run = 0;
1378
+ while (text[i + run] === quote) run++;
1379
+ if (run > 5) throw new TomlError(`line ${line}: too many quotes close a multi-line string`);
1380
+ return run;
1381
+ }
1382
+ var LogicalLines = class {
1383
+ constructor(text) {
1384
+ this.text = text;
1385
+ }
1386
+ text;
1387
+ out = [];
1388
+ brackets = [];
1389
+ buffer = "";
1390
+ start = 1;
1391
+ line = 1;
1392
+ quote = null;
1393
+ i = 0;
1394
+ split() {
1395
+ if (this.text.startsWith("\uFEFF")) throw new TomlError("line 1: a byte order mark is not TOML");
1396
+ for (; this.i < this.text.length; this.i++) this.step(this.text[this.i]);
1397
+ if (this.quote) throw new TomlError(`line ${this.start}: unterminated string`);
1398
+ if (this.brackets.length > 0) throw new TomlError(`line ${this.start}: a bracket or brace is never closed`);
1399
+ this.out.push({ text: this.buffer, line: this.start });
1400
+ return this.out;
1401
+ }
1402
+ step(c) {
1403
+ if (c === "\n") this.line++;
1404
+ if (this.quote) return this.inString(c, this.quote);
1405
+ if (c === "#") return this.skipComment();
1406
+ const opened = openingQuote(this.text, this.i);
1407
+ if (opened) return this.openString(opened);
1408
+ this.outside(c);
1409
+ }
1410
+ inString(c, quote) {
1411
+ if (c === "\n" && quote.length === 1) throw new TomlError(`line ${this.line - 1}: unterminated string`);
1412
+ if (c === "\\" && quote.startsWith('"')) return this.escape();
1413
+ if (this.text.startsWith(quote, this.i)) return this.closeString(quote);
1414
+ this.buffer += c;
1415
+ }
1416
+ escape() {
1417
+ const next = this.text[this.i + 1] ?? "";
1418
+ this.buffer += "\\" + next;
1419
+ if (next === "\n") this.line++;
1420
+ this.i++;
1421
+ }
1422
+ openString(opened) {
1423
+ this.quote = opened;
1424
+ this.buffer += opened;
1425
+ this.i += opened.length - 1;
1426
+ }
1427
+ closeString(quote) {
1428
+ const run = quote.length === 3 ? quoteRun(this.text, this.i, quote[0], this.line) : 1;
1429
+ this.buffer += this.text.slice(this.i, this.i + run);
1430
+ this.i += run - 1;
1431
+ this.quote = null;
1432
+ }
1433
+ skipComment() {
1434
+ for (; this.i + 1 < this.text.length && this.text[this.i + 1] !== "\n"; this.i++)
1435
+ this.commentCharacter(this.text[this.i + 1]);
1436
+ }
1437
+ commentCharacter(c) {
1438
+ const lineEnd = c === "\r" && this.text[this.i + 2] === "\n";
1439
+ if (!lineEnd && COMMENT_CONTROL.test(c))
1440
+ throw new TomlError(`line ${this.line}: a comment holds a control character`);
1441
+ }
1442
+ outside(c) {
1443
+ if (c === "[" || c === "{") this.brackets.push(c);
1444
+ if (c === "]" || c === "}") this.brackets.pop();
1445
+ if (c === "\n" && this.brackets.at(-1) === "{")
1446
+ throw new TomlError(`line ${this.line - 1}: an inline table must be on one line`);
1447
+ if (c === "\n" && this.brackets.length === 0) return this.endLine();
1448
+ this.buffer += c;
1449
+ }
1450
+ endLine() {
1451
+ this.out.push({ text: this.buffer.replace(/\r$/, ""), line: this.start });
1452
+ this.buffer = "";
1453
+ this.start = this.line;
1313
1454
  }
1314
- return line;
1455
+ };
1456
+ function logicalLines(text) {
1457
+ return new LogicalLines(text).split();
1315
1458
  }
1316
- function readValue(text, line) {
1317
- const s = text.trimStart();
1318
- if (s.startsWith('"')) {
1319
- let out = "";
1320
- for (let i = 1; i < s.length; i++) {
1321
- const c = s[i];
1322
- if (c === "\\") {
1323
- const e = s[++i];
1324
- const map = { n: "\n", t: " ", r: "\r", '"': '"', "\\": "\\", b: "\b", f: "\f" };
1325
- if (e === "u" || e === "U") {
1326
- const width = e === "u" ? 4 : 8;
1327
- out += String.fromCodePoint(parseInt(s.slice(i + 1, i + 1 + width), 16));
1328
- i += width;
1329
- } else if (e !== void 0 && e in map) out += map[e];
1330
- else throw new TomlError(`line ${line}: unsupported escape \\${e ?? ""}`);
1331
- continue;
1332
- }
1333
- if (c === '"') return [out, s.slice(i + 1)];
1459
+ var ESCAPES = { n: "\n", t: " ", r: "\r", '"': '"', "\\": "\\", b: "\b", f: "\f" };
1460
+ function unicodeEscape(body, at, width, line) {
1461
+ const digits = body.slice(at, at + width);
1462
+ const code = /^[0-9A-Fa-f]+$/.test(digits) && digits.length === width ? parseInt(digits, 16) : -1;
1463
+ const scalar = code >= 0 && code <= 1114111 && (code < 55296 || code > 57343);
1464
+ if (!scalar) throw new TomlError(`line ${line}: \\${width === 4 ? "u" : "U"}${digits} is not a Unicode scalar value`);
1465
+ return String.fromCodePoint(code);
1466
+ }
1467
+ function decodeBasic(body, line, multiline) {
1468
+ let out = "";
1469
+ for (let i = 0; i < body.length; i++) {
1470
+ const c = body[i];
1471
+ if (c !== "\\") {
1334
1472
  out += c;
1473
+ continue;
1474
+ }
1475
+ const e = body[++i];
1476
+ if (multiline && /^[ \t]*\r?\n/.test(body.slice(i))) {
1477
+ while (i + 1 < body.length && /[ \t\r\n]/.test(body[i + 1])) i++;
1478
+ continue;
1335
1479
  }
1336
- throw new TomlError(`line ${line}: unterminated string`);
1337
- }
1338
- if (s.startsWith("'")) {
1339
- const end = s.indexOf("'", 1);
1340
- if (end === -1) throw new TomlError(`line ${line}: unterminated string`);
1341
- return [s.slice(1, end), s.slice(end + 1)];
1342
- }
1343
- if (s.startsWith("[")) {
1344
- const items = [];
1345
- let rest2 = s.slice(1);
1346
- for (; ; ) {
1347
- rest2 = rest2.replace(/^[\s\n]+/, "");
1348
- if (rest2.startsWith("]")) return [items, rest2.slice(1)];
1349
- const [item, after] = readValue(rest2, line);
1350
- items.push(item);
1351
- rest2 = after.replace(/^[\s\n]+/, "");
1352
- if (rest2.startsWith(",")) rest2 = rest2.slice(1);
1353
- else if (!rest2.startsWith("]")) throw new TomlError(`line ${line}: expected , or ] in array`);
1480
+ if (e === "u" || e === "U") {
1481
+ const width = e === "u" ? 4 : 8;
1482
+ out += unicodeEscape(body, i + 1, width, line);
1483
+ i += width;
1484
+ } else if (e !== void 0 && e in ESCAPES) out += ESCAPES[e];
1485
+ else throw new TomlError(`line ${line}: unsupported escape \\${e ?? ""}`);
1486
+ }
1487
+ return out;
1488
+ }
1489
+ function checkControls(body, line, multiline) {
1490
+ const broken = CONTROL.test(body) || (multiline ? /\r(?!\n)/.test(body) : /[\r\n]/.test(body));
1491
+ if (broken) throw new TomlError(`line ${line}: a string holds a control character`);
1492
+ }
1493
+ function readString(s, line) {
1494
+ const quote = openingQuote(s, 0);
1495
+ if (!quote) return null;
1496
+ let end = quote.length;
1497
+ for (; end < s.length; end++) {
1498
+ if (quote.startsWith('"') && s[end] === "\\") {
1499
+ end++;
1500
+ continue;
1354
1501
  }
1502
+ if (s.startsWith(quote, end)) break;
1503
+ }
1504
+ if (end >= s.length) throw new TomlError(`line ${line}: unterminated string`);
1505
+ if (quote.length === 3) end += quoteRun(s, end, quote[0], line) - 3;
1506
+ const raw = s.slice(quote.length, end);
1507
+ const multiline = quote.length === 3;
1508
+ const body = multiline ? raw.replace(/^\r?\n/, "") : raw;
1509
+ checkControls(body, line, multiline);
1510
+ const text = quote.startsWith('"') ? decodeBasic(body, line, multiline) : body;
1511
+ return [text, s.slice(end + quote.length)];
1512
+ }
1513
+ function readArray(s, line) {
1514
+ const items = [];
1515
+ let rest = s.slice(1);
1516
+ for (; ; ) {
1517
+ rest = rest.replace(/^[ \t\r\n]+/, "");
1518
+ if (rest.startsWith("]")) return [items, rest.slice(1)];
1519
+ const [item, after] = readValue(rest, line);
1520
+ items.push(item);
1521
+ rest = after.replace(/^[ \t\r\n]+/, "");
1522
+ if (rest.startsWith(",")) rest = rest.slice(1);
1523
+ else if (!rest.startsWith("]")) throw new TomlError(`line ${line}: expected , or ] in array`);
1355
1524
  }
1356
- if (s.startsWith("{")) {
1357
- const table = {};
1358
- let rest2 = s.slice(1);
1359
- for (; ; ) {
1360
- rest2 = rest2.replace(/^[\s\n]+/, "");
1361
- if (rest2.startsWith("}")) return [table, rest2.slice(1)];
1362
- const eq = rest2.indexOf("=");
1363
- if (eq === -1) throw new TomlError(`line ${line}: expected key = value in inline table`);
1364
- const key2 = unquoteKey(rest2.slice(0, eq).trim());
1365
- const [value, after] = readValue(rest2.slice(eq + 1), line);
1366
- table[key2] = value;
1367
- rest2 = after.replace(/^[\s\n]+/, "");
1368
- if (rest2.startsWith(",")) rest2 = rest2.slice(1);
1369
- else if (!rest2.startsWith("}")) throw new TomlError(`line ${line}: expected , or } in inline table`);
1525
+ }
1526
+ function readInlineTable(s, line) {
1527
+ const table = newTable();
1528
+ let rest = s.slice(1).replace(/^[ \t]+/, "");
1529
+ if (rest.startsWith("}")) {
1530
+ INLINE.add(table);
1531
+ return [table, rest.slice(1)];
1532
+ }
1533
+ for (; ; ) {
1534
+ const eq = outsideQuotes(rest, "=");
1535
+ if (eq === -1) throw new TomlError(`line ${line}: expected key = value in inline table`);
1536
+ const path4 = keyPath(rest.slice(0, eq), line);
1537
+ const [value, after] = readValue(rest.slice(eq + 1), line);
1538
+ assign(inlineAt(table, path4.slice(0, -1), line), path4, value, line);
1539
+ rest = after.replace(/^[ \t]+/, "");
1540
+ if (rest.startsWith("}")) {
1541
+ INLINE.add(table);
1542
+ return [table, rest.slice(1)];
1370
1543
  }
1544
+ if (!rest.startsWith(",")) throw new TomlError(`line ${line}: expected , or } in inline table`);
1545
+ rest = rest.slice(1).replace(/^[ \t]+/, "");
1546
+ if (rest.startsWith("}")) throw new TomlError(`line ${line}: an inline table takes no trailing comma`);
1371
1547
  }
1372
- const scalar = /^([^,\]}\s]+)/.exec(s);
1548
+ }
1549
+ function inRange(value, low, high) {
1550
+ return value === void 0 || Number(value) >= low && Number(value) <= high;
1551
+ }
1552
+ function readDateTime(s, line) {
1553
+ const full = DATE_TIME.exec(s);
1554
+ const time = full ? null : LOCAL_TIME.exec(s);
1555
+ const match = full ?? time;
1556
+ if (!match) return null;
1557
+ const [y, mo, d, h, mi, se, oh, om] = full ? full.slice(1) : [void 0, void 0, void 0, ...time.slice(1)];
1558
+ const day = y === void 0 ? null : new Date(Date.UTC(Number(y), Number(mo) - 1, Number(d)));
1559
+ const dateOk = day === null || day.getUTCMonth() === Number(mo) - 1 && day.getUTCDate() === Number(d);
1560
+ const timeOk = inRange(h, 0, 23) && inRange(mi, 0, 59) && inRange(se, 0, 59) && inRange(oh, 0, 23) && inRange(om, 0, 59);
1561
+ if (!dateOk || !timeOk) throw new TomlError(`line ${line}: ${match[0]} is not a valid date or time`);
1562
+ return [new TomlDateTime(match[0]), s.slice(match[0].length)];
1563
+ }
1564
+ function readNumber(token) {
1565
+ const plain = token.replace(/_/g, "");
1566
+ if (DEC_INT.test(token)) return Number(plain);
1567
+ for (const [pattern, radix] of RADIX_INT) if (pattern.test(token)) return parseInt(plain.slice(2), radix);
1568
+ if (FLOAT.test(token) && /[.eE]/.test(token)) return Number(plain);
1569
+ const special = SPECIAL_FLOAT.exec(token);
1570
+ if (!special) return null;
1571
+ if (special[2] === "nan") return NaN;
1572
+ return special[1] === "-" ? -Infinity : Infinity;
1573
+ }
1574
+ function readValue(text, line) {
1575
+ const s = text.replace(/^[ \t]+/, "");
1576
+ const string = readString(s, line);
1577
+ if (string) return string;
1578
+ if (s.startsWith("[")) return readArray(s, line);
1579
+ if (s.startsWith("{")) return readInlineTable(s, line);
1580
+ const date = readDateTime(s, line);
1581
+ if (date) return date;
1582
+ const scalar = /^([^,\]}\s#]+)/.exec(s);
1373
1583
  if (!scalar) throw new TomlError(`line ${line}: expected a value`);
1374
1584
  const token = scalar[1];
1375
1585
  const rest = s.slice(token.length);
1376
1586
  if (token === "true") return [true, rest];
1377
1587
  if (token === "false") return [false, rest];
1378
- if (/^[+-]?\d[\d_]*$/.test(token)) return [Number(token.replace(/_/g, "")), rest];
1379
- if (/^[+-]?(\d[\d_]*)?\.?\d[\d_]*([eE][+-]?\d+)?$/.test(token)) return [Number(token.replace(/_/g, "")), rest];
1380
- throw new TomlError(`line ${line}: unsupported value ${token}`);
1588
+ const number = readNumber(token);
1589
+ if (number === null) throw new TomlError(`line ${line}: unsupported value ${token}`);
1590
+ return [number, rest];
1381
1591
  }
1382
1592
 
1383
1593
  // src/hooks/events.ts
@@ -2080,7 +2290,7 @@ function loadHookConfig(file) {
2080
2290
  }
2081
2291
  return parseHookConfig(data, file);
2082
2292
  }
2083
- var isObject2 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
2293
+ var isObject2 = (v) => typeof v === "object" && v !== null && [null, Object.prototype].includes(Object.getPrototypeOf(v));
2084
2294
  function parseHookConfig(data, source) {
2085
2295
  const where = source ?? "config";
2086
2296
  if (!isObject2(data))
@@ -3422,8 +3632,8 @@ function readConnection(root) {
3422
3632
  };
3423
3633
  }
3424
3634
  return {
3425
- slug: connector.slug ?? path2.basename(root),
3426
- baseUrl: (connector.base_url ?? "").replace(/\/+$/, ""),
3635
+ slug: typeof connector.slug === "string" ? connector.slug : path2.basename(root),
3636
+ baseUrl: (typeof connector.base_url === "string" ? connector.base_url : "").replace(/\/+$/, ""),
3427
3637
  scheme: carrier.scheme,
3428
3638
  carrier,
3429
3639
  ...typeof auth.secret_env === "string" ? { secretEnv: auth.secret_env } : {},