@brainbase-labs/cli 0.39.0 → 0.40.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.
Files changed (3) hide show
  1. package/README.md +16 -0
  2. package/dist/index.js +685 -549
  3. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -24570,7 +24570,7 @@ var require_permessage_deflate = __commonJS((exports, module) => {
24570
24570
  acceptAsServer(offers) {
24571
24571
  const opts = this._options;
24572
24572
  const accepted = offers.find((params) => {
24573
- if (opts.serverNoContextTakeover === false && params.server_no_context_takeover || params.server_max_window_bits && (opts.serverMaxWindowBits === false || typeof opts.serverMaxWindowBits === "number" && opts.serverMaxWindowBits > params.server_max_window_bits) || typeof opts.clientMaxWindowBits === "number" && !params.client_max_window_bits) {
24573
+ if (opts.serverNoContextTakeover === false && params.server_no_context_takeover || params.server_max_window_bits && (opts.serverMaxWindowBits === false || typeof opts.serverMaxWindowBits === "number" && opts.serverMaxWindowBits > params.server_max_window_bits) || typeof opts.clientMaxWindowBits === "number" && (typeof params.client_max_window_bits === "number" ? opts.clientMaxWindowBits > params.client_max_window_bits : !params.client_max_window_bits)) {
24574
24574
  return false;
24575
24575
  }
24576
24576
  return true;
@@ -24977,6 +24977,8 @@ var require_receiver = __commonJS((exports, module) => {
24977
24977
  this._binaryType = options.binaryType || BINARY_TYPES[0];
24978
24978
  this._extensions = options.extensions || {};
24979
24979
  this._isServer = !!options.isServer;
24980
+ this._maxBufferedChunks = options.maxBufferedChunks | 0;
24981
+ this._maxFragments = options.maxFragments | 0;
24980
24982
  this._maxPayload = options.maxPayload | 0;
24981
24983
  this._skipUTF8Validation = !!options.skipUTF8Validation;
24982
24984
  this[kWebSocket] = undefined;
@@ -24991,6 +24993,7 @@ var require_receiver = __commonJS((exports, module) => {
24991
24993
  this._opcode = 0;
24992
24994
  this._totalPayloadLength = 0;
24993
24995
  this._messageLength = 0;
24996
+ this._numFragments = 0;
24994
24997
  this._fragments = [];
24995
24998
  this._errored = false;
24996
24999
  this._loop = false;
@@ -24999,6 +25002,10 @@ var require_receiver = __commonJS((exports, module) => {
24999
25002
  _write(chunk2, encoding, cb) {
25000
25003
  if (this._opcode === 8 && this._state == GET_INFO)
25001
25004
  return cb();
25005
+ if (this._maxBufferedChunks > 0 && this._buffers.length >= this._maxBufferedChunks) {
25006
+ cb(this.createError(RangeError, "Too many buffered chunks", false, 1008, "WS_ERR_TOO_MANY_BUFFERED_PARTS"));
25007
+ return;
25008
+ }
25002
25009
  this._bufferedBytes += chunk2.length;
25003
25010
  this._buffers.push(chunk2);
25004
25011
  this.startLoop(cb);
@@ -25196,6 +25203,11 @@ var require_receiver = __commonJS((exports, module) => {
25196
25203
  this.controlMessage(data, cb);
25197
25204
  return;
25198
25205
  }
25206
+ if (this._maxFragments > 0 && ++this._numFragments > this._maxFragments) {
25207
+ const error = this.createError(RangeError, "Too many message fragments", false, 1008, "WS_ERR_TOO_MANY_BUFFERED_PARTS");
25208
+ cb(error);
25209
+ return;
25210
+ }
25199
25211
  if (this._compressed) {
25200
25212
  this._state = INFLATING;
25201
25213
  this.decompress(data, cb);
@@ -25236,6 +25248,7 @@ var require_receiver = __commonJS((exports, module) => {
25236
25248
  this._totalPayloadLength = 0;
25237
25249
  this._messageLength = 0;
25238
25250
  this._fragmented = 0;
25251
+ this._numFragments = 0;
25239
25252
  this._fragments = [];
25240
25253
  if (this._opcode === 2) {
25241
25254
  let data;
@@ -25334,6 +25347,9 @@ var require_receiver = __commonJS((exports, module) => {
25334
25347
  var require_sender = __commonJS((exports, module) => {
25335
25348
  var { Duplex } = __require("stream");
25336
25349
  var { randomFillSync } = __require("crypto");
25350
+ var {
25351
+ types: { isUint8Array }
25352
+ } = __require("util");
25337
25353
  var PerMessageDeflate = require_permessage_deflate();
25338
25354
  var { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants2();
25339
25355
  var { isBlob, isValidStatusCode } = require_validation();
@@ -25453,8 +25469,10 @@ var require_sender = __commonJS((exports, module) => {
25453
25469
  buf.writeUInt16BE(code, 0);
25454
25470
  if (typeof data === "string") {
25455
25471
  buf.write(data, 2);
25456
- } else {
25472
+ } else if (isUint8Array(data)) {
25457
25473
  buf.set(data, 2);
25474
+ } else {
25475
+ throw new TypeError("Second argument must be a string or a Uint8Array");
25458
25476
  }
25459
25477
  }
25460
25478
  const options = {
@@ -26057,11 +26075,23 @@ var require_websocket = __commonJS((exports, module) => {
26057
26075
  this._isServer = false;
26058
26076
  this._redirects = 0;
26059
26077
  if (protocols === undefined) {
26060
- protocols = [];
26078
+ if (!options || options.protocols === undefined) {
26079
+ protocols = [];
26080
+ } else if (Array.isArray(options.protocols)) {
26081
+ protocols = options.protocols;
26082
+ } else {
26083
+ protocols = [options.protocols];
26084
+ }
26061
26085
  } else if (!Array.isArray(protocols)) {
26062
26086
  if (typeof protocols === "object" && protocols !== null) {
26063
26087
  options = protocols;
26064
- protocols = [];
26088
+ if (options.protocols === undefined) {
26089
+ protocols = [];
26090
+ } else if (Array.isArray(options.protocols)) {
26091
+ protocols = options.protocols;
26092
+ } else {
26093
+ protocols = [options.protocols];
26094
+ }
26065
26095
  } else {
26066
26096
  protocols = [protocols];
26067
26097
  }
@@ -26121,6 +26151,8 @@ var require_websocket = __commonJS((exports, module) => {
26121
26151
  binaryType: this.binaryType,
26122
26152
  extensions: this._extensions,
26123
26153
  isServer: this._isServer,
26154
+ maxBufferedChunks: options.maxBufferedChunks,
26155
+ maxFragments: options.maxFragments,
26124
26156
  maxPayload: options.maxPayload,
26125
26157
  skipUTF8Validation: options.skipUTF8Validation
26126
26158
  });
@@ -26178,7 +26210,6 @@ var require_websocket = __commonJS((exports, module) => {
26178
26210
  }
26179
26211
  return;
26180
26212
  }
26181
- this._readyState = WebSocket.CLOSING;
26182
26213
  this._sender.close(code, data, !this._isServer, (err) => {
26183
26214
  if (err)
26184
26215
  return;
@@ -26187,6 +26218,7 @@ var require_websocket = __commonJS((exports, module) => {
26187
26218
  this._socket.end();
26188
26219
  }
26189
26220
  });
26221
+ this._readyState = WebSocket.CLOSING;
26190
26222
  setCloseTimer(this);
26191
26223
  }
26192
26224
  pause() {
@@ -26363,6 +26395,8 @@ var require_websocket = __commonJS((exports, module) => {
26363
26395
  autoPong: true,
26364
26396
  closeTimeout: CLOSE_TIMEOUT,
26365
26397
  protocolVersion: protocolVersions[1],
26398
+ maxBufferedChunks: 256 * 1024,
26399
+ maxFragments: 16 * 1024,
26366
26400
  maxPayload: 100 * 1024 * 1024,
26367
26401
  skipUTF8Validation: false,
26368
26402
  perMessageDeflate: true,
@@ -26372,6 +26406,7 @@ var require_websocket = __commonJS((exports, module) => {
26372
26406
  socketPath: undefined,
26373
26407
  hostname: undefined,
26374
26408
  protocol: undefined,
26409
+ protocols: undefined,
26375
26410
  timeout: undefined,
26376
26411
  method: "GET",
26377
26412
  host: undefined,
@@ -26601,6 +26636,8 @@ var require_websocket = __commonJS((exports, module) => {
26601
26636
  websocket.setSocket(socket, head3, {
26602
26637
  allowSynchronousEvents: opts.allowSynchronousEvents,
26603
26638
  generateMask: opts.generateMask,
26639
+ maxBufferedChunks: opts.maxBufferedChunks,
26640
+ maxFragments: opts.maxFragments,
26604
26641
  maxPayload: opts.maxPayload,
26605
26642
  skipUTF8Validation: opts.skipUTF8Validation
26606
26643
  });
@@ -26936,6 +26973,8 @@ var require_websocket_server = __commonJS((exports, module) => {
26936
26973
  options = {
26937
26974
  allowSynchronousEvents: true,
26938
26975
  autoPong: true,
26976
+ maxBufferedChunks: 256 * 1024,
26977
+ maxFragments: 16 * 1024,
26939
26978
  maxPayload: 100 * 1024 * 1024,
26940
26979
  skipUTF8Validation: false,
26941
26980
  perMessageDeflate: false,
@@ -27162,6 +27201,8 @@ var require_websocket_server = __commonJS((exports, module) => {
27162
27201
  socket.removeListener("error", socketOnError);
27163
27202
  ws.setSocket(socket, head3, {
27164
27203
  allowSynchronousEvents: this.options.allowSynchronousEvents,
27204
+ maxBufferedChunks: this.options.maxBufferedChunks,
27205
+ maxFragments: this.options.maxFragments,
27165
27206
  maxPayload: this.options.maxPayload,
27166
27207
  skipUTF8Validation: this.options.skipUTF8Validation
27167
27208
  });
@@ -36018,7 +36059,7 @@ function padStart(s, n) {
36018
36059
  // package.json
36019
36060
  var package_default = {
36020
36061
  name: "@brainbase-labs/cli",
36021
- version: "0.39.0",
36062
+ version: "0.40.0",
36022
36063
  description: "Pack, share, and install agent templates across harnesses (Claude Code, Codex, ...).",
36023
36064
  type: "module",
36024
36065
  bin: {
@@ -36065,7 +36106,7 @@ var package_default = {
36065
36106
  ink: "^5.1.0",
36066
36107
  picocolors: "^1.0.0",
36067
36108
  react: "^18.3.1",
36068
- "smol-toml": "^1.6.1",
36109
+ "smol-toml": "^1.9.1",
36069
36110
  tar: "^7.5.22",
36070
36111
  yaml: "^2.8.4",
36071
36112
  zod: "^3.23.8"
@@ -42338,11 +42379,11 @@ import fs14 from "node:fs";
42338
42379
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42339
42380
  */
42340
42381
  function getLineColFromPtr(string, ptr) {
42341
- let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
42382
+ let lines = string.slice(0, ptr).split(/\r?\n/);
42342
42383
  return [lines.length, lines.pop().length + 1];
42343
42384
  }
42344
42385
  function makeCodeBlock(string, line, column) {
42345
- let lines = string.split(/\r\n|\n|\r/g);
42386
+ let lines = string.split(/\r?\n/);
42346
42387
  let codeblock = "";
42347
42388
  let numberLen = (Math.log10(line + 1) | 0) + 1;
42348
42389
  for (let i = line - 1;i <= line + 1; i++) {
@@ -42377,9 +42418,12 @@ ${codeblock}`, options);
42377
42418
  this.column = column;
42378
42419
  this.codeblock = codeblock;
42379
42420
  }
42421
+ static x(message, ctx, ptr) {
42422
+ throw new TomlError(message, { toml: ctx.s, ptr: ptr ?? ctx.p });
42423
+ }
42380
42424
  }
42381
42425
 
42382
- // node_modules/smol-toml/dist/util.js
42426
+ // node_modules/smol-toml/dist/primitive.js
42383
42427
  /*!
42384
42428
  * Copyright (c) Squirrel Chat et al., All rights reserved.
42385
42429
  * SPDX-License-Identifier: BSD-3-Clause
@@ -42407,89 +42451,96 @@ ${codeblock}`, options);
42407
42451
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
42408
42452
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42409
42453
  */
42410
- function isEscaped(str, ptr) {
42411
- let i = 0;
42412
- while (str[ptr - ++i] === "\\")
42413
- ;
42414
- return --i && i % 2;
42415
- }
42416
- function indexOfNewline(str, start = 0, end = str.length) {
42417
- let idx = str.indexOf(`
42418
- `, start);
42419
- if (str[idx - 1] === "\r")
42420
- idx--;
42421
- return idx <= end ? idx : -1;
42422
- }
42423
- function skipComment(str, ptr) {
42424
- for (let i = ptr;i < str.length; i++) {
42425
- let c2 = str[i];
42426
- if (c2 === `
42427
- `)
42428
- return i;
42429
- if (c2 === "\r" && str[i + 1] === `
42430
- `)
42431
- return i + 1;
42432
- if (c2 < " " && c2 !== "\t" || c2 === "") {
42433
- throw new TomlError("control characters are not allowed in comments", {
42434
- toml: str,
42435
- ptr
42436
- });
42437
- }
42438
- }
42439
- return str.length;
42440
- }
42441
- function skipVoid(str, ptr, banNewLines, banComments) {
42442
- let c2;
42443
- while (true) {
42444
- while ((c2 = str[ptr]) === " " || c2 === "\t" || !banNewLines && (c2 === `
42445
- ` || c2 === "\r" && str[ptr + 1] === `
42446
- `))
42447
- ptr++;
42448
- if (banComments || c2 !== "#")
42449
- break;
42450
- ptr = skipComment(str, ptr);
42451
- }
42452
- return ptr;
42453
- }
42454
- function skipUntil(str, ptr, sep, end, banNewLines = false) {
42455
- if (!end) {
42456
- ptr = indexOfNewline(str, ptr);
42457
- return ptr < 0 ? str.length : ptr;
42458
- }
42459
- for (let i = ptr;i < str.length; i++) {
42460
- let c2 = str[i];
42461
- if (c2 === "#") {
42462
- i = indexOfNewline(str, i);
42463
- } else if (c2 === sep) {
42464
- return i + 1;
42465
- } else if (c2 === end || banNewLines && (c2 === `
42466
- ` || c2 === "\r" && str[i + 1] === `
42467
- `)) {
42468
- return i;
42469
- }
42454
+ function parseString(ctx) {
42455
+ let startPtr = ctx.p;
42456
+ let c2 = ctx.s.charCodeAt(ctx.p++);
42457
+ let first = c2;
42458
+ let isLiteral = c2 === 39;
42459
+ let isMultiline = c2 === ctx.s.charCodeAt(ctx.p) && c2 === ctx.s.charCodeAt(ctx.p + 1);
42460
+ if (isMultiline) {
42461
+ if ((c2 = ctx.s.charCodeAt(ctx.p += 2)) === 10)
42462
+ ctx.p++;
42463
+ else if (c2 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)
42464
+ ctx.p += 2;
42470
42465
  }
42471
- throw new TomlError("cannot find end of structure", {
42472
- toml: str,
42473
- ptr
42474
- });
42475
- }
42476
- function getStringEnd(str, seek) {
42477
- let first = str[seek];
42478
- let target = first === str[seek + 1] && str[seek + 1] === str[seek + 2] ? str.slice(seek, seek + 3) : first;
42479
- seek += target.length - 1;
42480
- do
42481
- seek = str.indexOf(target, ++seek);
42482
- while (seek > -1 && first !== "'" && isEscaped(str, seek));
42483
- if (seek > -1) {
42484
- seek += target.length;
42485
- if (target.length > 1) {
42486
- if (str[seek] === first)
42487
- seek++;
42488
- if (str[seek] === first)
42489
- seek++;
42466
+ let parsed = "";
42467
+ let sliceStart = ctx.p;
42468
+ let state = 0;
42469
+ for (;ctx.p < ctx.s.length; ctx.p++) {
42470
+ c2 = ctx.s.charCodeAt(ctx.p);
42471
+ if (isMultiline && (c2 === 10 || c2 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) {
42472
+ state = state && 3;
42473
+ } else if (c2 < 32 && c2 !== 9 || c2 === 127) {
42474
+ TomlError.x("control characters are not allowed in strings", ctx);
42475
+ } else if ((!state || state === 3) && c2 === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
42476
+ if (isMultiline) {
42477
+ if (ctx.s.charCodeAt(ctx.p + 3) === first)
42478
+ ctx.p++;
42479
+ if (ctx.s.charCodeAt(ctx.p + 3) === first)
42480
+ ctx.p++;
42481
+ }
42482
+ if (!state) {
42483
+ let s = ctx.s.slice(sliceStart, ctx.p);
42484
+ parsed = parsed ? parsed + s : s;
42485
+ }
42486
+ ctx.p += isMultiline ? 3 : 1;
42487
+ return parsed;
42488
+ } else if (!state) {
42489
+ if (!isLiteral && c2 === 92) {
42490
+ parsed += ctx.s.slice(sliceStart, sliceStart = ctx.p);
42491
+ state = 1;
42492
+ }
42493
+ } else if (state === 1) {
42494
+ if (c2 === 120 || c2 === 117 || c2 === 85) {
42495
+ let errPtr = ctx.p++ - 1;
42496
+ let value = 0;
42497
+ let len = c2 === 120 ? 2 : c2 === 117 ? 4 : 8;
42498
+ for (let j2 = 0;j2 < len; j2++, ctx.p++) {
42499
+ let hex = ctx.s.charCodeAt(ctx.p);
42500
+ let digit = hex >= 48 && hex <= 57 ? hex - 48 : hex >= 65 && hex <= 70 ? hex - 65 + 10 : hex >= 97 && hex <= 102 ? hex - 97 + 10 : -1;
42501
+ if (digit < 0)
42502
+ TomlError.x("invalid non-hex character in unicode escape", ctx);
42503
+ value = value << 4 | digit;
42504
+ }
42505
+ if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) {
42506
+ TomlError.x("invalid unicode escape", ctx, errPtr);
42507
+ }
42508
+ parsed += String.fromCodePoint(value);
42509
+ sliceStart = ctx.p--;
42510
+ state = 0;
42511
+ } else if (isMultiline && (c2 === 32 || c2 === 9)) {
42512
+ state = 2;
42513
+ } else {
42514
+ if (c2 === 98)
42515
+ parsed += "\b";
42516
+ else if (c2 === 116)
42517
+ parsed += "\t";
42518
+ else if (c2 === 110)
42519
+ parsed += `
42520
+ `;
42521
+ else if (c2 === 102)
42522
+ parsed += "\f";
42523
+ else if (c2 === 114)
42524
+ parsed += "\r";
42525
+ else if (c2 === 101)
42526
+ parsed += "\x1B";
42527
+ else if (c2 === 34)
42528
+ parsed += '"';
42529
+ else if (c2 === 92)
42530
+ parsed += "\\";
42531
+ else
42532
+ TomlError.x("unrecognised escape sequence", ctx);
42533
+ sliceStart = ctx.p + 1;
42534
+ state = 0;
42535
+ }
42536
+ } else if (c2 !== 32 && c2 !== 9) {
42537
+ if (state === 2)
42538
+ TomlError.x("invalid escape: only line-ending whitespace may be escaped", ctx, sliceStart);
42539
+ state = !isLiteral && c2 === 92 ? 1 : 0;
42540
+ sliceStart = ctx.p;
42490
42541
  }
42491
42542
  }
42492
- return seek;
42543
+ TomlError.x("unfinished string", ctx, startPtr);
42493
42544
  }
42494
42545
 
42495
42546
  // node_modules/smol-toml/dist/date.js
@@ -42520,35 +42571,58 @@ function getStringEnd(str, seek) {
42520
42571
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
42521
42572
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42522
42573
  */
42523
- var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
42574
+ var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[Tt ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|z|[-+]\d{2}:\d{2})?$/i;
42524
42575
 
42525
42576
  class TomlDate extends Date {
42526
42577
  #hasDate = false;
42527
42578
  #hasTime = false;
42528
42579
  #offset = null;
42529
- constructor(date) {
42580
+ constructor(date, fasttype, unsafeDelim) {
42530
42581
  let hasDate = true;
42531
42582
  let hasTime = true;
42532
42583
  let offset = "Z";
42584
+ let c2;
42533
42585
  if (typeof date === "string") {
42534
- let match = date.match(DATE_TIME_RE);
42535
- if (match) {
42536
- if (!match[1]) {
42537
- hasDate = false;
42538
- date = `0000-01-01T${date}`;
42539
- }
42540
- hasTime = !!match[2];
42541
- hasTime && date[10] === " " && (date = date.replace(" ", "T"));
42542
- if (match[2] && +match[2] > 23) {
42543
- date = "";
42586
+ if (fasttype)
42587
+ prep: {
42588
+ if (fasttype < 3) {
42589
+ if (+date.slice(11, 13) > 23) {
42590
+ date = "";
42591
+ break prep;
42592
+ }
42593
+ if (fasttype === 2) {
42594
+ offset = null;
42595
+ date += "Z";
42596
+ } else if ((c2 = date.charCodeAt(date.length - 1)) !== 90 && c2 !== 122) {
42597
+ offset = date.slice(date.length - 6);
42598
+ }
42599
+ if (unsafeDelim)
42600
+ date = date.slice(0, 10) + "T" + date.slice(11);
42601
+ } else if (fasttype === 4) {
42602
+ date = +date.slice(0, 2) > 23 ? "" : `0000-01-01T${date}Z`;
42603
+ }
42604
+ hasDate = fasttype !== 4;
42605
+ hasTime = fasttype !== 3;
42606
+ }
42607
+ else {
42608
+ let match = date.match(DATE_TIME_RE);
42609
+ if (match) {
42610
+ if (!match[1]) {
42611
+ hasDate = false;
42612
+ date = `0000-01-01T${date}`;
42613
+ }
42614
+ hasTime = !!match[2];
42615
+ hasTime && date[10] === " " && (date = date.replace(" ", "T"));
42616
+ if (match[2] && +match[2] > 23) {
42617
+ date = "";
42618
+ } else {
42619
+ offset = match[3] || null;
42620
+ if (!offset && hasTime)
42621
+ date += "Z";
42622
+ }
42544
42623
  } else {
42545
- offset = match[3] || null;
42546
- date = date.toUpperCase();
42547
- if (!offset && hasTime)
42548
- date += "Z";
42624
+ date = "";
42549
42625
  }
42550
- } else {
42551
- date = "";
42552
42626
  }
42553
42627
  }
42554
42628
  super(date);
@@ -42581,7 +42655,7 @@ class TomlDate extends Date {
42581
42655
  return iso.slice(11, 23);
42582
42656
  if (this.#offset === null)
42583
42657
  return iso.slice(0, -1);
42584
- if (this.#offset === "Z")
42658
+ if (this.#offset === "Z" || this.#offset === "z")
42585
42659
  return iso;
42586
42660
  let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
42587
42661
  offset = this.#offset[0] === "-" ? offset : -offset;
@@ -42612,7 +42686,7 @@ class TomlDate extends Date {
42612
42686
  }
42613
42687
  }
42614
42688
 
42615
- // node_modules/smol-toml/dist/primitive.js
42689
+ // node_modules/smol-toml/dist/extract.js
42616
42690
  /*!
42617
42691
  * Copyright (c) Squirrel Chat et al., All rights reserved.
42618
42692
  * SPDX-License-Identifier: BSD-3-Clause
@@ -42640,151 +42714,213 @@ class TomlDate extends Date {
42640
42714
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
42641
42715
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42642
42716
  */
42643
- var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
42644
- var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
42645
- var LEADING_ZERO = /^[+-]?0[0-9_]/;
42646
- var ESCAPE_REGEX = /^[0-9a-f]{2,8}$/i;
42647
- var ESC_MAP = {
42648
- b: "\b",
42649
- t: "\t",
42650
- n: `
42651
- `,
42652
- f: "\f",
42653
- r: "\r",
42654
- e: "\x1B",
42655
- '"': '"',
42656
- "\\": "\\"
42657
- };
42658
- function parseString(str, ptr = 0, endPtr = str.length) {
42659
- let isLiteral = str[ptr] === "'";
42660
- let isMultiline = str[ptr++] === str[ptr] && str[ptr] === str[ptr + 1];
42661
- if (isMultiline) {
42662
- endPtr -= 2;
42663
- if (str[ptr += 2] === "\r")
42664
- ptr++;
42665
- if (str[ptr] === `
42666
- `)
42667
- ptr++;
42717
+ function isDigit(char, base = 10) {
42718
+ return base === 16 ? char > 47 && char < 58 || char > 64 && char < 71 || char > 96 && char < 103 : char > 47 && char < 48 + base;
42719
+ }
42720
+ function isEndOfValue(char, delim) {
42721
+ return char === 32 || char === 9 || char === 10 || char === 13 || delim && (char === delim || char === 44) || char === 35;
42722
+ }
42723
+ function extractValue(ctx, end) {
42724
+ let errPtr = ctx.p;
42725
+ let c2 = ctx.s.charCodeAt(ctx.p);
42726
+ if (c2 === 91 || c2 === 123) {
42727
+ ctx.d-- || TomlError.x("document contains excessively nested structures. aborting.", ctx);
42728
+ let value = c2 === 91 ? parseArray(ctx) : parseInlineTable(ctx);
42729
+ ctx.d++;
42730
+ return value;
42668
42731
  }
42669
- let tmp = 0;
42670
- let isEscape;
42671
- let parsed = "";
42672
- let sliceStart = ptr;
42673
- while (ptr < endPtr - 1) {
42674
- let c2 = str[ptr++];
42675
- if (c2 === `
42676
- ` || c2 === "\r" && str[ptr] === `
42677
- `) {
42678
- if (!isMultiline) {
42679
- throw new TomlError("newlines are not allowed in strings", {
42680
- toml: str,
42681
- ptr: ptr - 1
42682
- });
42683
- }
42684
- } else if (c2 < " " && c2 !== "\t" || c2 === "") {
42685
- throw new TomlError("control characters are not allowed in strings", {
42686
- toml: str,
42687
- ptr: ptr - 1
42688
- });
42732
+ if (c2 === 34 || c2 === 39) {
42733
+ return parseString(ctx);
42734
+ }
42735
+ if (c2 === 116) {
42736
+ if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101)
42737
+ TomlError.x("invalid value", ctx, errPtr);
42738
+ return ctx.p++, true;
42739
+ }
42740
+ if (c2 === 102) {
42741
+ if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 108 || ctx.s.charCodeAt(++ctx.p) !== 115 || ctx.s.charCodeAt(++ctx.p) !== 101)
42742
+ TomlError.x("invalid value", ctx, errPtr);
42743
+ return ctx.p++, false;
42744
+ }
42745
+ if (c2 === 43 || c2 === 45) {
42746
+ return parseNumber(ctx, ctx.p, ctx.s.charCodeAt(++ctx.p), 44 - c2, end);
42747
+ }
42748
+ if (ctx.s.charCodeAt(ctx.p + 4) === 45 && ctx.s.charCodeAt(ctx.p + 7) === 45) {
42749
+ return parseDate(ctx, c2, end);
42750
+ }
42751
+ if (ctx.s.charCodeAt(ctx.p + 2) === 58) {
42752
+ return parseTime(ctx, c2, end);
42753
+ }
42754
+ return parseNumber(ctx, ctx.p, c2, 0, end);
42755
+ }
42756
+ function parseNumber(ctx, startPtr, startChr, sign, endChr) {
42757
+ let c2 = startChr;
42758
+ let state = 0;
42759
+ let hasUnderscores = false;
42760
+ if (c2 === 105) {
42761
+ if (ctx.s.charCodeAt(++ctx.p) !== 110 || ctx.s.charCodeAt(++ctx.p) !== 102)
42762
+ TomlError.x("invalid value", ctx, startPtr);
42763
+ return ctx.p++, (sign || 1) / 0;
42764
+ }
42765
+ if (c2 === 110) {
42766
+ if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 110)
42767
+ TomlError.x("invalid value", ctx, startPtr);
42768
+ return ctx.p++, NaN;
42769
+ }
42770
+ if (c2 === 48) {
42771
+ if (++ctx.p >= ctx.s.length || isEndOfValue(c2 = ctx.s.charCodeAt(ctx.p), endChr))
42772
+ return ctx.bi === true ? 0n : 0;
42773
+ if (!sign) {
42774
+ if (c2 === 120)
42775
+ return parseIntegerBaseN(ctx, startPtr, 16, endChr);
42776
+ else if (c2 === 98)
42777
+ return parseIntegerBaseN(ctx, startPtr, 2, endChr);
42778
+ else if (c2 === 111)
42779
+ return parseIntegerBaseN(ctx, startPtr, 8, endChr);
42780
+ }
42781
+ if (c2 === 46)
42782
+ state = 2;
42783
+ else if (c2 === 101 || c2 === 69)
42784
+ state = 4;
42785
+ else
42786
+ TomlError.x("illegal leading zero", ctx, startPtr);
42787
+ } else if (!isDigit(c2))
42788
+ TomlError.x("invalid value", ctx, startPtr);
42789
+ while (++ctx.p < ctx.s.length && (c2 = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c2, endChr))) {
42790
+ if (!state)
42791
+ state = 1;
42792
+ if (c2 === 95) {
42793
+ if (!(state & 1))
42794
+ TomlError.x("illegal underscore", ctx);
42795
+ state += 11;
42796
+ hasUnderscores = true;
42797
+ } else if (state === 1 && c2 === 46)
42798
+ state = 2;
42799
+ else if ((state === 1 || state === 3) && (c2 === 101 || c2 === 69))
42800
+ state = 4;
42801
+ else if (state === 4 && (c2 === 43 || c2 === 45)) {
42802
+ state = 6;
42803
+ } else if (!isDigit(c2))
42804
+ TomlError.x(`illegal character in numeric literal`, ctx);
42805
+ else if (state > 9)
42806
+ state -= 11;
42807
+ else if (!(state & 1))
42808
+ state++;
42809
+ }
42810
+ if (!state) {
42811
+ let val = (startChr - 48) * (sign || 1);
42812
+ return ctx.bi === true ? BigInt(val) : val;
42813
+ }
42814
+ if (!(state & 1))
42815
+ TomlError.x("unfinished numeric value", ctx, startPtr);
42816
+ let str = ctx.s.slice(startPtr, ctx.p);
42817
+ if (hasUnderscores)
42818
+ str = str.replaceAll("_", "");
42819
+ return state > 1 ? parseFloat(str) : parseInteger(ctx, str, 10, startPtr);
42820
+ }
42821
+ function parseIntegerBaseN(ctx, startPtr, base, endChr) {
42822
+ let c2, underscore = 1;
42823
+ while (++ctx.p < ctx.s.length && (c2 = ctx.s.charCodeAt(ctx.p), !isEndOfValue(c2, endChr))) {
42824
+ if (c2 === 95) {
42825
+ if (underscore & 1)
42826
+ TomlError.x("illegal underscore", ctx);
42827
+ underscore = 3;
42828
+ } else if (!isDigit(c2, base))
42829
+ TomlError.x(`illegal character in numeric literal`, ctx);
42830
+ else if (underscore & 1)
42831
+ underscore--;
42832
+ }
42833
+ if (underscore & 1)
42834
+ TomlError.x("unfinished numeric value", ctx);
42835
+ let str = ctx.s.slice(startPtr + 2, ctx.p);
42836
+ if (underscore)
42837
+ str = str.replaceAll("_", "");
42838
+ return parseInteger(ctx, str, base, startPtr);
42839
+ }
42840
+ function parseInteger(ctx, str, base, startPtr) {
42841
+ if (ctx.bi !== true)
42842
+ int: {
42843
+ let val = parseInt(str, base);
42844
+ if (!Number.isSafeInteger(val)) {
42845
+ if (ctx.bi)
42846
+ break int;
42847
+ TomlError.x("integer value cannot be represented losslessly", ctx, startPtr);
42848
+ }
42849
+ return val;
42850
+ }
42851
+ return base === 10 ? BigInt(str) : BigInt((base === 2 ? "0b" : base === 8 ? "0o" : "0x") + str);
42852
+ }
42853
+ function parseDate(ctx, c2, endChr) {
42854
+ let startPtr = ctx.p++, unsafeSeparator;
42855
+ if (!isDigit(c2) || !isDigit(ctx.s.charCodeAt(ctx.p++)) || !isDigit(ctx.s.charCodeAt(ctx.p++)) || !isDigit(ctx.s.charCodeAt(ctx.p++))) {
42856
+ return parseNumber(ctx, ctx.p = startPtr, c2, 0, endChr);
42857
+ }
42858
+ ctx.p += 5;
42859
+ if (!isDigit(ctx.s.charCodeAt(ctx.p++)))
42860
+ TomlError.x("invalid date-time: date part is malformed", ctx, startPtr);
42861
+ if (ctx.p >= ctx.s.length || ((c2 = ctx.s.charCodeAt(ctx.p)) !== 32 || (unsafeSeparator = true, !isDigit(ctx.s.charCodeAt(ctx.p + 1)))) && c2 !== 84 && c2 !== 116) {
42862
+ let t2 = ctx.s.slice(startPtr, ctx.p);
42863
+ return readDate(ctx, t2, 3, false, startPtr);
42864
+ }
42865
+ if (ctx.s.charCodeAt(ctx.p += 3) !== 58)
42866
+ TomlError.x("invalid date-time: time part is malformed", ctx, startPtr);
42867
+ if (ctx.s.charCodeAt(ctx.p += 3) === 58)
42868
+ ctx.p += 3;
42869
+ if (ctx.s.charCodeAt(ctx.p) === 46)
42870
+ while (isDigit(ctx.s.charCodeAt(++ctx.p)))
42871
+ ;
42872
+ if (c2 = ctx.s.charCodeAt(ctx.p)) {
42873
+ if (c2 === 90 || c2 === 122) {
42874
+ let t2 = ctx.s.slice(startPtr, ++ctx.p);
42875
+ return readDate(ctx, t2, 1, unsafeSeparator, startPtr, "[+00:00]");
42689
42876
  }
42690
- if (isEscape) {
42691
- isEscape = false;
42692
- if (c2 === "x" || c2 === "u" || c2 === "U") {
42693
- let code = str.slice(ptr, ptr += c2 === "x" ? 2 : c2 === "u" ? 4 : 8);
42694
- if (!ESCAPE_REGEX.test(code)) {
42695
- throw new TomlError("invalid unicode escape", {
42696
- toml: str,
42697
- ptr: tmp
42698
- });
42699
- }
42700
- try {
42701
- parsed += String.fromCodePoint(parseInt(code, 16));
42702
- } catch {
42703
- throw new TomlError("invalid unicode escape", {
42704
- toml: str,
42705
- ptr: tmp
42706
- });
42707
- }
42708
- } else if (isMultiline && (c2 === `
42709
- ` || c2 === " " || c2 === "\t" || c2 === "\r")) {
42710
- ptr = skipVoid(str, ptr - 1, true);
42711
- if (str[ptr] !== `
42712
- ` && str[ptr] !== "\r") {
42713
- throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
42714
- toml: str,
42715
- ptr: tmp
42716
- });
42717
- }
42718
- ptr = skipVoid(str, ptr);
42719
- } else if (c2 in ESC_MAP) {
42720
- parsed += ESC_MAP[c2];
42721
- } else {
42722
- throw new TomlError("unrecognized escape sequence", {
42723
- toml: str,
42724
- ptr: tmp
42725
- });
42726
- }
42727
- sliceStart = ptr;
42728
- } else if (!isLiteral && c2 === "\\") {
42729
- tmp = ptr - 1;
42730
- isEscape = true;
42731
- parsed += str.slice(sliceStart, tmp);
42877
+ if (c2 === 43 || c2 === 45) {
42878
+ let t2 = ctx.s.slice(startPtr, ctx.p += 6);
42879
+ return readDate(ctx, t2, 1, unsafeSeparator, startPtr, !ctx.ld && "[" + ctx.s.slice(ctx.p - 6, ctx.p) + "]");
42732
42880
  }
42733
42881
  }
42734
- return parsed + str.slice(sliceStart, endPtr - 1);
42882
+ let t = ctx.s.slice(startPtr, ctx.p);
42883
+ return readDate(ctx, t, 2, unsafeSeparator, startPtr);
42735
42884
  }
42736
- function parseValue(value, toml, ptr, integersAsBigInt) {
42737
- if (value === "true")
42738
- return true;
42739
- if (value === "false")
42740
- return false;
42741
- if (value === "-inf")
42742
- return -Infinity;
42743
- if (value === "inf" || value === "+inf")
42744
- return Infinity;
42745
- if (value === "nan" || value === "+nan" || value === "-nan")
42746
- return NaN;
42747
- if (value === "-0")
42748
- return integersAsBigInt ? 0n : 0;
42749
- let isInt = INT_REGEX.test(value);
42750
- if (isInt || FLOAT_REGEX.test(value)) {
42751
- if (LEADING_ZERO.test(value)) {
42752
- throw new TomlError("leading zeroes are not allowed", {
42753
- toml,
42754
- ptr
42755
- });
42756
- }
42757
- value = value.replace(/_/g, "");
42758
- let numeric = +value;
42759
- if (isNaN(numeric)) {
42760
- throw new TomlError("invalid number", {
42761
- toml,
42762
- ptr
42763
- });
42764
- }
42765
- if (isInt) {
42766
- if ((isInt = !Number.isSafeInteger(numeric)) && !integersAsBigInt) {
42767
- throw new TomlError("integer value cannot be represented losslessly", {
42768
- toml,
42769
- ptr
42770
- });
42771
- }
42772
- if (isInt || integersAsBigInt === true)
42773
- numeric = BigInt(value);
42774
- }
42775
- return numeric;
42885
+ function parseTime(ctx, c2, endChr) {
42886
+ let start = ctx.p;
42887
+ if (!isDigit(c2) || !isDigit(ctx.s.charCodeAt(++ctx.p))) {
42888
+ return parseNumber(ctx, --ctx.p, c2, 0, endChr);
42776
42889
  }
42777
- const date = new TomlDate(value);
42778
- if (!date.isValid()) {
42779
- throw new TomlError("invalid value", {
42780
- toml,
42781
- ptr
42782
- });
42890
+ if (ctx.s.charCodeAt(ctx.p += 4) === 58)
42891
+ ctx.p += 3;
42892
+ if (ctx.s.charCodeAt(ctx.p) === 46)
42893
+ while (isDigit(ctx.s.charCodeAt(++ctx.p)))
42894
+ ;
42895
+ let t = ctx.s.slice(start, ctx.p);
42896
+ return readDate(ctx, t, 4, false, start);
42897
+ }
42898
+ function readDate(ctx, str, type, unsafeDelim, errPtr, temporalSuffix) {
42899
+ if (ctx.ld) {
42900
+ let date = new TomlDate(str, type, unsafeDelim);
42901
+ if (!date.isValid())
42902
+ TomlError.x("invalid date", ctx, errPtr);
42903
+ return date;
42904
+ }
42905
+ try {
42906
+ if (temporalSuffix)
42907
+ str += temporalSuffix;
42908
+ switch (type) {
42909
+ case 1:
42910
+ return Temporal.ZonedDateTime.from(str);
42911
+ case 2:
42912
+ return Temporal.PlainDateTime.from(str);
42913
+ case 3:
42914
+ return Temporal.PlainDate.from(str);
42915
+ case 4:
42916
+ return Temporal.PlainTime.from(str);
42917
+ }
42918
+ } catch (e2) {
42919
+ TomlError.x(e2 instanceof Error ? e2.message : "" + e2, ctx, errPtr);
42783
42920
  }
42784
- return date;
42785
42921
  }
42786
42922
 
42787
- // node_modules/smol-toml/dist/extract.js
42923
+ // node_modules/smol-toml/dist/util.js
42788
42924
  /*!
42789
42925
  * Copyright (c) Squirrel Chat et al., All rights reserved.
42790
42926
  * SPDX-License-Identifier: BSD-3-Clause
@@ -42812,71 +42948,29 @@ function parseValue(value, toml, ptr, integersAsBigInt) {
42812
42948
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
42813
42949
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42814
42950
  */
42815
- function sliceAndTrimEndOf(str, startPtr, endPtr) {
42816
- let value = str.slice(startPtr, endPtr);
42817
- let commentIdx = value.indexOf("#");
42818
- if (commentIdx > -1) {
42819
- skipComment(str, commentIdx);
42820
- value = value.slice(0, commentIdx);
42821
- }
42822
- return [value.trimEnd(), commentIdx];
42823
- }
42824
- function extractValue(str, ptr, end, depth, integersAsBigInt) {
42825
- if (depth === 0) {
42826
- throw new TomlError("document contains excessively nested structures. aborting.", {
42827
- toml: str,
42828
- ptr
42829
- });
42830
- }
42831
- let c2 = str[ptr];
42832
- if (c2 === "[" || c2 === "{") {
42833
- let [value, endPtr2] = c2 === "[" ? parseArray(str, ptr, depth, integersAsBigInt) : parseInlineTable(str, ptr, depth, integersAsBigInt);
42834
- if (end) {
42835
- endPtr2 = skipVoid(str, endPtr2);
42836
- if (str[endPtr2] === ",")
42837
- endPtr2++;
42838
- else if (str[endPtr2] !== end) {
42839
- throw new TomlError("expected comma or end of structure", {
42840
- toml: str,
42841
- ptr: endPtr2
42842
- });
42843
- }
42951
+ function skipComment(ctx) {
42952
+ for (;ctx.p < ctx.s.length; ctx.p++) {
42953
+ let c2 = ctx.s.charCodeAt(ctx.p);
42954
+ if (c2 === 10)
42955
+ break;
42956
+ if (c2 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
42957
+ ctx.p++;
42958
+ break;
42844
42959
  }
42845
- return [value, endPtr2];
42846
- }
42847
- let endPtr;
42848
- if (c2 === '"' || c2 === "'") {
42849
- endPtr = getStringEnd(str, ptr);
42850
- let parsed = parseString(str, ptr, endPtr);
42851
- if (end) {
42852
- endPtr = skipVoid(str, endPtr);
42853
- if (str[endPtr] && str[endPtr] !== "," && str[endPtr] !== end && str[endPtr] !== `
42854
- ` && str[endPtr] !== "\r") {
42855
- throw new TomlError("unexpected character encountered", {
42856
- toml: str,
42857
- ptr: endPtr
42858
- });
42859
- }
42860
- endPtr += +(str[endPtr] === ",");
42960
+ if (c2 < 32 && c2 !== 9 || c2 === 127) {
42961
+ TomlError.x("control characters are not allowed in comments", ctx);
42861
42962
  }
42862
- return [parsed, endPtr];
42863
- }
42864
- endPtr = skipUntil(str, ptr, ",", end);
42865
- let slice = sliceAndTrimEndOf(str, ptr, endPtr - +(str[endPtr - 1] === ","));
42866
- if (!slice[0]) {
42867
- throw new TomlError("incomplete key-value declaration: no value specified", {
42868
- toml: str,
42869
- ptr
42870
- });
42871
42963
  }
42872
- if (end && slice[1] > -1) {
42873
- endPtr = skipVoid(str, ptr + slice[1]);
42874
- endPtr += +(str[endPtr] === ",");
42964
+ }
42965
+ function skipVoid(ctx, banNewLines, banComments) {
42966
+ let c2;
42967
+ while (ctx.p < ctx.s.length) {
42968
+ while (ctx.p < ctx.s.length && ((c2 = ctx.s.charCodeAt(ctx.p)) === 32 || c2 === 9 || !banNewLines && (c2 === 10 || c2 === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)))
42969
+ ctx.p++;
42970
+ if (banComments || c2 !== 35)
42971
+ break;
42972
+ skipComment(ctx);
42875
42973
  }
42876
- return [
42877
- parseValue(slice[0], str, ptr, integersAsBigInt),
42878
- endPtr
42879
- ];
42880
42974
  }
42881
42975
 
42882
42976
  // node_modules/smol-toml/dist/struct.js
@@ -42907,153 +43001,112 @@ function extractValue(str, ptr, end, depth, integersAsBigInt) {
42907
43001
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
42908
43002
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42909
43003
  */
42910
- var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
42911
- function parseKey(str, ptr, end = "=") {
42912
- let dot = ptr - 1;
43004
+ function parseKey(ctx, end = 61) {
43005
+ let startPtr;
43006
+ let state = 0;
42913
43007
  let parsed = [];
42914
- let endPtr = str.indexOf(end, ptr);
42915
- if (endPtr < 0) {
42916
- throw new TomlError("incomplete key-value: cannot find end of key", {
42917
- toml: str,
42918
- ptr
42919
- });
42920
- }
43008
+ let sliceStart;
43009
+ let c2 = ctx.s.charCodeAt(startPtr = ctx.p);
42921
43010
  do {
42922
- let c2 = str[ptr = ++dot];
42923
- if (c2 !== " " && c2 !== "\t") {
42924
- if (c2 === '"' || c2 === "'") {
42925
- if (c2 === str[ptr + 1] && c2 === str[ptr + 2]) {
42926
- throw new TomlError("multiline strings are not allowed in keys", {
42927
- toml: str,
42928
- ptr
42929
- });
42930
- }
42931
- let eos = getStringEnd(str, ptr);
42932
- if (eos < 0) {
42933
- throw new TomlError("unfinished string encountered", {
42934
- toml: str,
42935
- ptr
42936
- });
42937
- }
42938
- dot = str.indexOf(".", eos);
42939
- let strEnd = str.slice(eos, dot < 0 || dot > endPtr ? endPtr : dot);
42940
- let newLine = indexOfNewline(strEnd);
42941
- if (newLine > -1) {
42942
- throw new TomlError("newlines are not allowed in keys", {
42943
- toml: str,
42944
- ptr: ptr + dot + newLine
42945
- });
42946
- }
42947
- if (strEnd.trimStart()) {
42948
- throw new TomlError("found extra tokens after the string part", {
42949
- toml: str,
42950
- ptr: eos
42951
- });
42952
- }
42953
- if (endPtr < eos) {
42954
- endPtr = str.indexOf(end, eos);
42955
- if (endPtr < 0) {
42956
- throw new TomlError("incomplete key-value: cannot find end of key", {
42957
- toml: str,
42958
- ptr
42959
- });
42960
- }
42961
- }
42962
- parsed.push(parseString(str, ptr, eos));
42963
- } else {
42964
- dot = str.indexOf(".", ptr);
42965
- let part = str.slice(ptr, dot < 0 || dot > endPtr ? endPtr : dot);
42966
- if (!KEY_PART_RE.test(part)) {
42967
- throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
42968
- toml: str,
42969
- ptr
42970
- });
42971
- }
42972
- parsed.push(part.trimEnd());
42973
- }
42974
- }
42975
- } while (dot + 1 && dot < endPtr);
42976
- return [parsed, skipVoid(str, endPtr + 1, true, true)];
42977
- }
42978
- function parseInlineTable(str, ptr, depth, integersAsBigInt) {
42979
- let res = {};
43011
+ if (c2 === end) {
43012
+ if (!state)
43013
+ TomlError.x("unexpected end of key", ctx);
43014
+ if (state === 1)
43015
+ parsed.push(ctx.s.slice(sliceStart, ctx.p));
43016
+ return ctx.p++, parsed;
43017
+ } else if (c2 === 46) {
43018
+ if (!state)
43019
+ TomlError.x("illegal empty bare key", ctx);
43020
+ if (state === 1)
43021
+ parsed.push(ctx.s.slice(sliceStart, ctx.p));
43022
+ state = 0;
43023
+ } else if (!state && (c2 === 34 || c2 === 39)) {
43024
+ if (c2 === ctx.s.charCodeAt(ctx.p + 1) && c2 === ctx.s.charCodeAt(ctx.p + 2))
43025
+ TomlError.x("illegal quoted key: multiline strings are not allowed", ctx);
43026
+ parsed.push(parseString(ctx));
43027
+ state = 2;
43028
+ ctx.p--;
43029
+ } else if (c2 === 32 || c2 === 9) {
43030
+ if (state === 1) {
43031
+ parsed.push(ctx.s.slice(sliceStart, ctx.p));
43032
+ state = 2;
43033
+ }
43034
+ } else if (state === 2 || c2 < 48 && c2 !== 45 || c2 > 57 && c2 < 65 || c2 > 90 && c2 < 97 && c2 !== 95 || c2 > 122) {
43035
+ TomlError.x("illegal character in key", ctx);
43036
+ } else if (!state) {
43037
+ state = 1;
43038
+ sliceStart = ctx.p;
43039
+ }
43040
+ } while (c2 = ctx.s.charCodeAt(++ctx.p));
43041
+ TomlError.x("incomplete key-value: cannot find end of key", ctx, startPtr);
43042
+ }
43043
+ function parseInlineTable(ctx) {
43044
+ let startPtr = ctx.p++;
43045
+ let res = Object.create(null);
42980
43046
  let seen = new Set;
42981
43047
  let c2;
42982
- ptr++;
42983
- while ((c2 = str[ptr++]) !== "}" && c2) {
42984
- if (c2 === ",") {
42985
- throw new TomlError("expected value, found comma", {
42986
- toml: str,
42987
- ptr: ptr - 1
42988
- });
42989
- } else if (c2 === "#")
42990
- ptr = skipComment(str, ptr);
42991
- else if (c2 !== " " && c2 !== "\t" && c2 !== `
42992
- ` && c2 !== "\r") {
42993
- let k2;
42994
- let t = res;
42995
- let hasOwn = false;
42996
- let [key, keyEndPtr] = parseKey(str, ptr - 1);
42997
- for (let i = 0;i < key.length; i++) {
42998
- if (i)
42999
- t = hasOwn ? t[k2] : t[k2] = {};
43000
- k2 = key[i];
43001
- if ((hasOwn = Object.hasOwn(t, k2)) && (typeof t[k2] !== "object" || seen.has(t[k2]))) {
43002
- throw new TomlError("trying to redefine an already defined value", {
43003
- toml: str,
43004
- ptr
43005
- });
43006
- }
43007
- if (!hasOwn && k2 === "__proto__") {
43008
- Object.defineProperty(t, k2, { enumerable: true, configurable: true, writable: true });
43009
- }
43048
+ while (ctx.p < ctx.s.length) {
43049
+ skipVoid(ctx);
43050
+ if ((c2 = ctx.s.charCodeAt(ctx.p)) === 125) {
43051
+ ctx.p++;
43052
+ return res;
43053
+ }
43054
+ let k2;
43055
+ let t = res;
43056
+ let hasOwn = false;
43057
+ let errPtr = ctx.p;
43058
+ let key = parseKey(ctx);
43059
+ for (let i = 0;i < key.length; i++) {
43060
+ if (i)
43061
+ t = hasOwn ? t[k2] : t[k2] = Object.create(null);
43062
+ k2 = key[i];
43063
+ if ((hasOwn = Object.hasOwn(t, k2)) && (typeof t[k2] !== "object" || seen.has(t[k2]))) {
43064
+ TomlError.x("trying to redefine an already defined value", ctx, errPtr);
43065
+ }
43066
+ let unsafe = k2 === "__proto__";
43067
+ if (ctx.uk && (unsafe || k2 === "constructor")) {
43068
+ t = ctx.uk !== 1 && TomlError.x("document contains an unsafe property", ctx, errPtr);
43069
+ break;
43010
43070
  }
43011
- if (hasOwn) {
43012
- throw new TomlError("trying to redefine an already defined value", {
43013
- toml: str,
43014
- ptr
43015
- });
43071
+ if (!hasOwn && unsafe) {
43072
+ Object.defineProperty(t, k2, { enumerable: true, configurable: true, writable: true });
43016
43073
  }
43017
- let [value, valueEndPtr] = extractValue(str, keyEndPtr, "}", depth - 1, integersAsBigInt);
43074
+ }
43075
+ if (hasOwn) {
43076
+ TomlError.x("trying to redefine an already defined value", ctx, errPtr);
43077
+ }
43078
+ skipVoid(ctx, true, true);
43079
+ let value = extractValue(ctx, 125);
43080
+ if (t && typeof (t[k2] = value) === "object")
43018
43081
  seen.add(value);
43019
- t[k2] = value;
43020
- ptr = valueEndPtr;
43082
+ skipVoid(ctx);
43083
+ if ((c2 = ctx.s.charCodeAt(ctx.p++)) === 125) {
43084
+ return res;
43021
43085
  }
43086
+ if (c2 !== 44)
43087
+ TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
43022
43088
  }
43023
- if (!c2) {
43024
- throw new TomlError("unfinished table encountered", {
43025
- toml: str,
43026
- ptr
43027
- });
43028
- }
43029
- return [res, ptr];
43089
+ TomlError.x("unfinished table", ctx, startPtr);
43030
43090
  }
43031
- function parseArray(str, ptr, depth, integersAsBigInt) {
43091
+ function parseArray(ctx) {
43092
+ let startPtr = ctx.p++;
43032
43093
  let res = [];
43033
43094
  let c2;
43034
- ptr++;
43035
- while ((c2 = str[ptr++]) !== "]" && c2) {
43036
- if (c2 === ",") {
43037
- throw new TomlError("expected value, found comma", {
43038
- toml: str,
43039
- ptr: ptr - 1
43040
- });
43041
- } else if (c2 === "#")
43042
- ptr = skipComment(str, ptr);
43043
- else if (c2 !== " " && c2 !== "\t" && c2 !== `
43044
- ` && c2 !== "\r") {
43045
- let e2 = extractValue(str, ptr - 1, "]", depth - 1, integersAsBigInt);
43046
- res.push(e2[0]);
43047
- ptr = e2[1];
43095
+ while (ctx.p < ctx.s.length) {
43096
+ skipVoid(ctx);
43097
+ if ((c2 = ctx.s.charCodeAt(ctx.p)) === 93) {
43098
+ ctx.p++;
43099
+ return res;
43048
43100
  }
43101
+ res.push(extractValue(ctx, 93));
43102
+ skipVoid(ctx);
43103
+ if ((c2 = ctx.s.charCodeAt(ctx.p++)) === 93) {
43104
+ return res;
43105
+ }
43106
+ if (c2 !== 44)
43107
+ TomlError.x("expected comma or end of structure", ctx, ctx.p - 1);
43049
43108
  }
43050
- if (!c2) {
43051
- throw new TomlError("unfinished array encountered", {
43052
- toml: str,
43053
- ptr
43054
- });
43055
- }
43056
- return [res, ptr];
43109
+ TomlError.x("unfinished array", ctx, startPtr);
43057
43110
  }
43058
43111
 
43059
43112
  // node_modules/smol-toml/dist/parse.js
@@ -43084,7 +43137,7 @@ function parseArray(str, ptr, depth, integersAsBigInt) {
43084
43137
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
43085
43138
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43086
43139
  */
43087
- function peekTable(key, table, meta, type) {
43140
+ function peekTable(ctx, key, table, meta, type) {
43088
43141
  let t = table;
43089
43142
  let m2 = meta;
43090
43143
  let k2;
@@ -43092,7 +43145,7 @@ function peekTable(key, table, meta, type) {
43092
43145
  let state;
43093
43146
  for (let i = 0;i < key.length; i++) {
43094
43147
  if (i) {
43095
- t = hasOwn ? t[k2] : t[k2] = {};
43148
+ t = hasOwn ? t[k2] : t[k2] = Object.create(null);
43096
43149
  m2 = (state = m2[k2]).c;
43097
43150
  if (type === 0 && (state.t === 1 || state.t === 2)) {
43098
43151
  return null;
@@ -43108,7 +43161,10 @@ function peekTable(key, table, meta, type) {
43108
43161
  return null;
43109
43162
  }
43110
43163
  if (!hasOwn) {
43111
- if (k2 === "__proto__") {
43164
+ let unsafe = k2 === "__proto__";
43165
+ if (ctx.uk && (unsafe || k2 === "constructor"))
43166
+ return false;
43167
+ if (unsafe) {
43112
43168
  Object.defineProperty(t, k2, { enumerable: true, configurable: true, writable: true });
43113
43169
  Object.defineProperty(m2, k2, { enumerable: true, configurable: true, writable: true });
43114
43170
  }
@@ -43116,7 +43172,7 @@ function peekTable(key, table, meta, type) {
43116
43172
  t: i < key.length - 1 && type === 2 ? 3 : type,
43117
43173
  d: false,
43118
43174
  i: 0,
43119
- c: {}
43175
+ c: Object.create(null)
43120
43176
  };
43121
43177
  }
43122
43178
  }
@@ -43129,70 +43185,78 @@ function peekTable(key, table, meta, type) {
43129
43185
  state.d = true;
43130
43186
  t[k2] = [];
43131
43187
  }
43132
- t[k2].push(t = {});
43133
- state.c[state.i++] = state = { t: 1, d: false, i: 0, c: {} };
43188
+ t[k2].push(t = Object.create(null));
43189
+ state.c[state.i++] = state = { t: 1, d: false, i: 0, c: Object.create(null) };
43134
43190
  }
43135
43191
  if (state.d) {
43136
43192
  return null;
43137
43193
  }
43138
43194
  state.d = true;
43139
43195
  if (type === 1) {
43140
- t = hasOwn ? t[k2] : t[k2] = {};
43196
+ t = hasOwn ? t[k2] : t[k2] = Object.create(null);
43141
43197
  } else if (type === 0 && hasOwn) {
43142
43198
  return null;
43143
43199
  }
43144
43200
  return [k2, t, state.c];
43145
43201
  }
43146
- function parse(toml, { maxDepth = 1000, integersAsBigInt } = {}) {
43147
- let res = {};
43148
- let meta = {};
43202
+ function validateTablePeek(ctx, peek, ptr) {
43203
+ if (peek === null || ctx.uk === 2)
43204
+ TomlError.x(peek === null ? "trying to redefine an already defined table or value" : "document contains an unsafe property", ctx, ptr);
43205
+ }
43206
+ function parse(toml, options = {}) {
43207
+ let ctx = {
43208
+ s: toml,
43209
+ p: 0,
43210
+ d: options.maxDepth ?? 1000,
43211
+ bi: options.integersAsBigInt ?? false,
43212
+ ld: options.useLegacyDate ?? true,
43213
+ uk: options.unsafeKeyBehaviour === "throw" ? 2 : options.unsafeKeyBehaviour === "drop" ? 1 : 0
43214
+ };
43215
+ let res = Object.create(null);
43216
+ let meta = Object.create(null);
43217
+ let tmp;
43218
+ let skipping = false;
43149
43219
  let tbl = res;
43150
43220
  let m2 = meta;
43151
- for (let ptr = skipVoid(toml, 0);ptr < toml.length; ) {
43152
- if (toml[ptr] === "[") {
43153
- let isTableArray = toml[++ptr] === "[";
43154
- let k2 = parseKey(toml, ptr += +isTableArray, "]");
43221
+ if (toml.charCodeAt(0) === 65279)
43222
+ ctx.p++;
43223
+ skipVoid(ctx);
43224
+ while (ctx.p < toml.length) {
43225
+ if (toml.charCodeAt(ctx.p) === 91) {
43226
+ let isTableArray = toml.charCodeAt(++ctx.p) === 91;
43227
+ tmp = ctx.p += +isTableArray;
43228
+ skipping = false;
43229
+ let k2 = parseKey(ctx, 93);
43155
43230
  if (isTableArray) {
43156
- if (toml[k2[1] - 1] !== "]") {
43157
- throw new TomlError("expected end of table declaration", {
43158
- toml,
43159
- ptr: k2[1] - 1
43160
- });
43231
+ if (toml.charCodeAt(ctx.p) !== 93) {
43232
+ TomlError.x("expected end of table array declaration", ctx);
43161
43233
  }
43162
- k2[1]++;
43234
+ ctx.p++;
43163
43235
  }
43164
- let p = peekTable(k2[0], res, meta, isTableArray ? 2 : 1);
43236
+ let p = peekTable(ctx, k2, res, meta, isTableArray ? 2 : 1);
43165
43237
  if (!p) {
43166
- throw new TomlError("trying to redefine an already defined table or value", {
43167
- toml,
43168
- ptr
43169
- });
43238
+ validateTablePeek(ctx, p, tmp);
43239
+ skipping = true;
43240
+ } else {
43241
+ m2 = p[2];
43242
+ tbl = p[1];
43170
43243
  }
43171
- m2 = p[2];
43172
- tbl = p[1];
43173
- ptr = k2[1];
43174
43244
  } else {
43175
- let k2 = parseKey(toml, ptr);
43176
- let p = peekTable(k2[0], tbl, m2, 0);
43177
- if (!p) {
43178
- throw new TomlError("trying to redefine an already defined table or value", {
43179
- toml,
43180
- ptr
43181
- });
43182
- }
43183
- let v2 = extractValue(toml, k2[1], undefined, maxDepth, integersAsBigInt);
43184
- p[1][p[0]] = v2[0];
43185
- ptr = v2[1];
43186
- }
43187
- ptr = skipVoid(toml, ptr, true);
43188
- if (toml[ptr] && toml[ptr] !== `
43189
- ` && toml[ptr] !== "\r") {
43190
- throw new TomlError("each key-value declaration must be followed by an end-of-line", {
43191
- toml,
43192
- ptr
43193
- });
43194
- }
43195
- ptr = skipVoid(toml, ptr);
43245
+ tmp = ctx.p;
43246
+ let k2 = parseKey(ctx);
43247
+ let p = peekTable(ctx, k2, tbl, m2, 0);
43248
+ if (!p && !skipping)
43249
+ validateTablePeek(ctx, p, tmp);
43250
+ skipVoid(ctx, true, true);
43251
+ let v2 = extractValue(ctx, undefined);
43252
+ if (p && !skipping)
43253
+ p[1][p[0]] = v2;
43254
+ }
43255
+ skipVoid(ctx, true);
43256
+ if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && (tmp !== 13 || toml.charCodeAt(ctx.p + 1) !== 10)) {
43257
+ TomlError.x("each key-value declaration must be followed by an end-of-line", ctx);
43258
+ }
43259
+ skipVoid(ctx);
43196
43260
  }
43197
43261
  return res;
43198
43262
  }
@@ -43226,13 +43290,28 @@ function parse(toml, { maxDepth = 1000, integersAsBigInt } = {}) {
43226
43290
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43227
43291
  */
43228
43292
  var BARE_KEY = /^[a-z0-9-_]+$/i;
43293
+ var HAS_WELLFORMED = !!"".isWellFormed;
43229
43294
  function extendedTypeOf(obj) {
43230
43295
  let type = typeof obj;
43231
43296
  if (type === "object") {
43232
43297
  if (Array.isArray(obj))
43233
43298
  return "array";
43234
- if (obj instanceof Date)
43299
+ if (typeof obj.getUTCDate === "function" && obj instanceof Date)
43235
43300
  return "date";
43301
+ if (globalThis.Temporal) {
43302
+ if (obj.until) {
43303
+ if (obj instanceof Temporal.ZonedDateTime)
43304
+ return "temporal/tz+uc";
43305
+ if (obj instanceof Temporal.PlainDateTime || obj instanceof Temporal.PlainDate)
43306
+ return "temporal/uc";
43307
+ if (obj instanceof Temporal.PlainTime || obj instanceof Temporal.Instant)
43308
+ return "temporal";
43309
+ if (obj instanceof Temporal.PlainYearMonth)
43310
+ return "temporal/x";
43311
+ } else if (obj.toPlainDate && obj instanceof Temporal.PlainMonthDay || obj.negated && obj instanceof Temporal.Duration) {
43312
+ return "temporal/x";
43313
+ }
43314
+ }
43236
43315
  }
43237
43316
  return type;
43238
43317
  }
@@ -43243,44 +43322,67 @@ function isArrayOfTables(obj) {
43243
43322
  }
43244
43323
  return obj.length != 0;
43245
43324
  }
43325
+ function formatWellFormedStringUnchecked(s) {
43326
+ return JSON.stringify(s).replaceAll("", "\\u007f");
43327
+ }
43246
43328
  function formatString(s) {
43247
- return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
43329
+ return formatWellFormedStringUnchecked(HAS_WELLFORMED ? s.toWellFormed() : s);
43248
43330
  }
43249
- function stringifyValue(val, type, depth, numberAsFloat) {
43331
+ function formatKey(s) {
43332
+ if (BARE_KEY.test(s))
43333
+ return s;
43334
+ if (HAS_WELLFORMED && !s.isWellFormed())
43335
+ throw new RangeError("key contains illegal lone surrogates");
43336
+ return formatWellFormedStringUnchecked(s);
43337
+ }
43338
+ function stringifyValue(val, type, depth, numberAsFloat, strictTemporal) {
43250
43339
  if (depth === 0) {
43251
43340
  throw new Error("Could not stringify the object: maximum object depth exceeded");
43252
43341
  }
43253
- if (type === "number") {
43254
- if (isNaN(val))
43255
- return "nan";
43256
- if (val === Infinity)
43257
- return "inf";
43258
- if (val === -Infinity)
43259
- return "-inf";
43260
- if (numberAsFloat && Number.isInteger(val))
43261
- return val.toFixed(1);
43262
- return val.toString();
43263
- }
43264
- if (type === "bigint" || type === "boolean") {
43265
- return val.toString();
43266
- }
43267
- if (type === "string") {
43268
- return formatString(val);
43269
- }
43270
- if (type === "date") {
43271
- if (isNaN(val.getTime())) {
43272
- throw new TypeError("cannot serialize invalid date");
43273
- }
43274
- return val.toISOString();
43275
- }
43276
- if (type === "object") {
43277
- return stringifyInlineTable(val, depth, numberAsFloat);
43278
- }
43279
- if (type === "array") {
43280
- return stringifyArray(val, depth, numberAsFloat);
43342
+ switch (type) {
43343
+ case "number":
43344
+ if (isNaN(val))
43345
+ return "nan";
43346
+ if (val === Infinity)
43347
+ return "inf";
43348
+ if (val === -Infinity)
43349
+ return "-inf";
43350
+ if (Number.isInteger(val) && (numberAsFloat || !Number.isSafeInteger(val)))
43351
+ return val.toFixed(1);
43352
+ case "bigint":
43353
+ case "boolean":
43354
+ case "temporal":
43355
+ return val.toString();
43356
+ case "string":
43357
+ return formatString(val);
43358
+ case "date":
43359
+ if (isNaN(val.getTime()))
43360
+ throw new TypeError("cannot serialize invalid date");
43361
+ return val.toISOString();
43362
+ case "object":
43363
+ return stringifyInlineTable(val, depth, numberAsFloat, strictTemporal);
43364
+ case "array":
43365
+ return stringifyArray(val, depth, numberAsFloat, strictTemporal);
43366
+ case "temporal/tz+uc":
43367
+ if (strictTemporal) {
43368
+ let tz = val.timeZoneId;
43369
+ let tzc = tz.charCodeAt(0);
43370
+ if (tzc !== 43 && tzc !== 45 && (tzc !== 85 && tzc !== 71 && tzc !== 90 && tzc !== 69 || tz !== "UTC" && tz !== "UCT" && tz !== "Universal" && tz !== "Zulu" && !tz.startsWith("GMT") && tz !== "Greenwich" && !tz.startsWith("Etc/"))) {
43371
+ throw new TypeError("Temporal objects with an IANA timezone are not allowed in Temporal strict mode");
43372
+ }
43373
+ }
43374
+ case "temporal/uc":
43375
+ if (strictTemporal && val.calendarId !== "iso8601")
43376
+ throw new TypeError("Temporal objects with a non-default calendar are not allowed in Temporal strict mode");
43377
+ return val.toString({
43378
+ calendarName: "never",
43379
+ timeZoneName: "never"
43380
+ });
43381
+ case "temporal/x":
43382
+ throw new TypeError("Unsupported " + val[Symbol.toStringTag]);
43281
43383
  }
43282
43384
  }
43283
- function stringifyInlineTable(obj, depth, numberAsFloat) {
43385
+ function stringifyInlineTable(obj, depth, numberAsFloat, strictTemporal) {
43284
43386
  let keys = Object.keys(obj);
43285
43387
  if (keys.length === 0)
43286
43388
  return "{}";
@@ -43289,13 +43391,11 @@ function stringifyInlineTable(obj, depth, numberAsFloat) {
43289
43391
  let k2 = keys[i];
43290
43392
  if (i)
43291
43393
  res += ", ";
43292
- res += BARE_KEY.test(k2) ? k2 : formatString(k2);
43293
- res += " = ";
43294
- res += stringifyValue(obj[k2], extendedTypeOf(obj[k2]), depth - 1, numberAsFloat);
43394
+ res += formatKey(k2) + " = " + stringifyValue(obj[k2], extendedTypeOf(obj[k2]), depth - 1, numberAsFloat, strictTemporal);
43295
43395
  }
43296
43396
  return res + " }";
43297
43397
  }
43298
- function stringifyArray(array, depth, numberAsFloat) {
43398
+ function stringifyArray(array, depth, numberAsFloat, strictTemporal) {
43299
43399
  if (array.length === 0)
43300
43400
  return "[]";
43301
43401
  let res = "[ ";
@@ -43305,11 +43405,11 @@ function stringifyArray(array, depth, numberAsFloat) {
43305
43405
  if (array[i] === null || array[i] === undefined) {
43306
43406
  throw new TypeError("arrays cannot contain null or undefined values");
43307
43407
  }
43308
- res += stringifyValue(array[i], extendedTypeOf(array[i]), depth - 1, numberAsFloat);
43408
+ res += stringifyValue(array[i], extendedTypeOf(array[i]), depth - 1, numberAsFloat, strictTemporal);
43309
43409
  }
43310
43410
  return res + " ]";
43311
43411
  }
43312
- function stringifyArrayTable(array, key, depth, numberAsFloat) {
43412
+ function stringifyArrayTable(array, key, depth, numberAsFloat, strictTemporal) {
43313
43413
  if (depth === 0) {
43314
43414
  throw new Error("Could not stringify the object: maximum object depth exceeded");
43315
43415
  }
@@ -43318,11 +43418,11 @@ function stringifyArrayTable(array, key, depth, numberAsFloat) {
43318
43418
  res += `${res && `
43319
43419
  `}[[${key}]]
43320
43420
  `;
43321
- res += stringifyTable(0, array[i], key, depth, numberAsFloat);
43421
+ res += stringifyTable(0, array[i], key, depth, numberAsFloat, strictTemporal);
43322
43422
  }
43323
43423
  return res;
43324
43424
  }
43325
- function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
43425
+ function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat, strictTemporal) {
43326
43426
  if (depth === 0) {
43327
43427
  throw new Error("Could not stringify the object: maximum object depth exceeded");
43328
43428
  }
@@ -43336,18 +43436,18 @@ function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
43336
43436
  if (type === "symbol" || type === "function") {
43337
43437
  throw new TypeError(`cannot serialize values of type '${type}'`);
43338
43438
  }
43339
- let key = BARE_KEY.test(k2) ? k2 : formatString(k2);
43439
+ let key = formatKey(k2);
43340
43440
  if (type === "array" && isArrayOfTables(obj[k2])) {
43341
43441
  tables += (tables && `
43342
- `) + stringifyArrayTable(obj[k2], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat);
43442
+ `) + stringifyArrayTable(obj[k2], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat, strictTemporal);
43343
43443
  } else if (type === "object") {
43344
43444
  let tblKey = prefix ? `${prefix}.${key}` : key;
43345
43445
  tables += (tables && `
43346
- `) + stringifyTable(tblKey, obj[k2], tblKey, depth - 1, numberAsFloat);
43446
+ `) + stringifyTable(tblKey, obj[k2], tblKey, depth - 1, numberAsFloat, strictTemporal);
43347
43447
  } else {
43348
43448
  preamble += key;
43349
43449
  preamble += " = ";
43350
- preamble += stringifyValue(obj[k2], type, depth, numberAsFloat);
43450
+ preamble += stringifyValue(obj[k2], type, depth, numberAsFloat, strictTemporal);
43351
43451
  preamble += `
43352
43452
  `;
43353
43453
  }
@@ -43359,11 +43459,11 @@ ${preamble}` : `[${tableKey}]`;
43359
43459
  return preamble && tables ? `${preamble}
43360
43460
  ${tables}` : preamble || tables;
43361
43461
  }
43362
- function stringify(obj, { maxDepth = 1000, numbersAsFloat = false } = {}) {
43462
+ function stringify(obj, { maxDepth = 1000, numbersAsFloat = false, strictTemporal = false } = {}) {
43363
43463
  if (extendedTypeOf(obj) !== "object") {
43364
43464
  throw new TypeError("stringify can only be called with an object");
43365
43465
  }
43366
- let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat);
43466
+ let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat, strictTemporal);
43367
43467
  if (str[str.length - 1] !== `
43368
43468
  `)
43369
43469
  return str + `
@@ -64130,6 +64230,20 @@ async function attachToExistingAgent(cwd2, agentId, args, existing) {
64130
64230
  handleApiError(err);
64131
64231
  process.exit(1);
64132
64232
  }
64233
+ const link2 = await bindFetchedAgent(cwd2, agent, args, existing);
64234
+ $e(`Linked to ${import_picocolors22.default.bold(agent.name)}.`);
64235
+ await printLinkCard(link2);
64236
+ }
64237
+ async function linkFetchedAgent(cwd2, agentId, agent, args) {
64238
+ const existing = readLink(cwd2);
64239
+ if (existing && existing.agent_id === agentId) {
64240
+ f2.info(`Already linked to ${import_picocolors22.default.bold(existing.name)} (${existing.slug}).`);
64241
+ return;
64242
+ }
64243
+ await bindFetchedAgent(cwd2, agent, args, existing);
64244
+ f2.success(`Linked to ${import_picocolors22.default.bold(agent.name)}.`);
64245
+ }
64246
+ async function bindFetchedAgent(cwd2, agent, args, existing) {
64133
64247
  const harness = normalizeHarnessId(agent.harness ?? "claude-code");
64134
64248
  if (!agent.harness) {
64135
64249
  f2.warn(`Agent does not have a harness set on the cloud. Defaulting to ${import_picocolors22.default.bold("claude-code")}.`);
@@ -64201,8 +64315,7 @@ async function attachToExistingAgent(cwd2, agentId, args, existing) {
64201
64315
  tracking
64202
64316
  };
64203
64317
  writeLink(cwd2, link2);
64204
- $e(`Linked to ${import_picocolors22.default.bold(agent.name)}.`);
64205
- await printLinkCard(link2);
64318
+ return link2;
64206
64319
  }
64207
64320
  async function tearDownTracking(cwd2, link2) {
64208
64321
  if (!link2.tracking)
@@ -66175,23 +66288,28 @@ async function runAgentPull(cwd2, args) {
66175
66288
  if (!resolution)
66176
66289
  return;
66177
66290
  const { agentId, override } = resolution;
66291
+ let { existingManifest, lock, localComponents } = readLocalPullState(cwd2, override);
66178
66292
  const sp = de();
66179
66293
  sp.start("Fetching agent…");
66294
+ const agentRequest = inFlight(api.getAgent(agentId));
66295
+ const manifestRequest = inFlight(api.getAgentManifest(agentId));
66296
+ const secretsRequest = pullReachesSecrets(args, existingManifest, lock, localComponents) ? inFlight(api.getAgentSecrets(agentId)) : undefined;
66180
66297
  let cloudAgent;
66181
66298
  let cloud;
66182
66299
  try {
66183
- cloudAgent = await api.getAgent(agentId);
66184
- cloud = await api.getAgentManifest(agentId);
66300
+ cloudAgent = await agentRequest;
66301
+ cloud = await manifestRequest;
66185
66302
  sp.stop(`Cloud revision ${cloud.revision}.`);
66186
66303
  } catch (err) {
66187
66304
  sp.stop("Failed.");
66188
66305
  handleApiError2(err);
66189
66306
  return;
66190
66307
  }
66308
+ if (args.link) {
66309
+ await linkFetchedAgent(cwd2, agentId, cloudAgent, { noTracking: args.noTracking });
66310
+ ({ existingManifest, lock, localComponents } = readLocalPullState(cwd2, override));
66311
+ }
66191
66312
  const harness = normalizeHarnessId(cloudAgent.harness ?? "claude-code");
66192
- const existingManifest = !override && hasManifest(cwd2) ? safeReadManifest(cwd2) : null;
66193
- const lock = override ? null : readSyncState(cwd2);
66194
- const localComponents = existingManifest ? readLocalComponents(cwd2, existingManifest) : [];
66195
66313
  const rows = threeWayDiff({
66196
66314
  local: localComponents,
66197
66315
  lock: lock?.components ?? [],
@@ -66345,7 +66463,7 @@ async function runAgentPull(cwd2, args) {
66345
66463
  const skippedMcpSlugs = new Set;
66346
66464
  const justInstalledFingerprints = new Map;
66347
66465
  try {
66348
- const availableSecrets = await pullSecrets(cwd2, agentId);
66466
+ const availableSecrets = await pullSecrets(cwd2, agentId, secretsRequest);
66349
66467
  if (installComponents.length > 0 || builtinInstall.length > 0) {
66350
66468
  const installSpinner = de();
66351
66469
  installSpinner.start("Applying updates…");
@@ -66516,6 +66634,19 @@ function resolveTargetAgentId(cwd2, args) {
66516
66634
  }
66517
66635
  return null;
66518
66636
  }
66637
+ function readLocalPullState(cwd2, override) {
66638
+ const existingManifest = !override && hasManifest(cwd2) ? safeReadManifest(cwd2) : null;
66639
+ const lock = override ? null : readSyncState(cwd2);
66640
+ const localComponents = existingManifest ? readLocalComponents(cwd2, existingManifest) : [];
66641
+ return { existingManifest, lock, localComponents };
66642
+ }
66643
+ function pullReachesSecrets(args, existingManifest, lock, localComponents) {
66644
+ return autoProceed(args.yes) && lock === null && localComponents.length === 0 && existingManifest?.machine_kind === undefined && existingManifest?.default_model === undefined;
66645
+ }
66646
+ function inFlight(request2) {
66647
+ request2.catch(() => {});
66648
+ return request2;
66649
+ }
66519
66650
  function safeReadManifest(cwd2) {
66520
66651
  try {
66521
66652
  return readManifest(cwd2);
@@ -66835,13 +66966,13 @@ async function runEntrypointIfPresent(cwd2, manifest, execute) {
66835
66966
  f2.warn(`Entrypoint exited ${exitCode} — continuing. Log at ${import_picocolors26.default.dim(path88.relative(cwd2, logPath))}.`);
66836
66967
  }
66837
66968
  }
66838
- async function pullSecrets(cwd2, agentId) {
66969
+ async function pullSecrets(cwd2, agentId, prefetched) {
66839
66970
  const localSecrets = readLocalSecrets(cwd2);
66840
66971
  let cloudSecrets;
66841
66972
  const sp = de();
66842
66973
  sp.start("Fetching secrets…");
66843
66974
  try {
66844
- const res = await api.getAgentSecrets(agentId);
66975
+ const res = await (prefetched ?? api.getAgentSecrets(agentId));
66845
66976
  cloudSecrets = res.secrets;
66846
66977
  sp.stop(Object.keys(cloudSecrets).length === 0 ? "No secrets on cloud." : `Got ${Object.keys(cloudSecrets).length} secret${Object.keys(cloudSecrets).length === 1 ? "" : "s"}.`);
66847
66978
  } catch (err) {
@@ -69708,7 +69839,9 @@ async function runAgent(cwd2, sub, args, opts) {
69708
69839
  agentIdArg: args[0],
69709
69840
  force: opts.force,
69710
69841
  runEntrypoint: opts.runEntrypoint,
69711
- acp: opts.acp
69842
+ acp: opts.acp,
69843
+ link: opts.link,
69844
+ noTracking: opts.noTracking
69712
69845
  });
69713
69846
  return;
69714
69847
  case "push":
@@ -69774,7 +69907,7 @@ function printHelp() {
69774
69907
  out.push(` ${import_picocolors39.default.cyan("list")} ${import_picocolors39.default.dim("show the agents in a team, with the ids `brainbase link` takes (--json for scripts)")}`);
69775
69908
  out.push(` ${import_picocolors39.default.cyan("init")} ${import_picocolors39.default.dim("write a starter brainbase.agent.yaml here — offline, no login (--full for a commented template, --force to overwrite)")}`);
69776
69909
  out.push(` ${import_picocolors39.default.cyan("create")} ${import_picocolors39.default.dim("claim an unclaimed brainbase.agent.yaml and create the cloud agent (scaffolds one if the folder has none)")}`);
69777
- out.push(` ${import_picocolors39.default.cyan("pull")} ${import_picocolors39.default.dim("[<id>]")} ${import_picocolors39.default.dim("apply cloud changes into this folder — pass <id> to switch (--force to override); --run-entrypoint to also execute the agent entrypoint")}`);
69910
+ out.push(` ${import_picocolors39.default.cyan("pull")} ${import_picocolors39.default.dim("[<id>]")} ${import_picocolors39.default.dim("apply cloud changes into this folder — pass <id> to switch (--force to override); --run-entrypoint to also execute the agent entrypoint; --link to first link this folder like `brainbase link --agent <id> --yes` (--no-tracking applies)")}`);
69778
69911
  out.push(` ${import_picocolors39.default.cyan("push")} ${import_picocolors39.default.dim("send local changes to the cloud — instructions, playbooks, skills, MCPs, evals, entrypoint (--force to overwrite cloud-side conflicts with local)")}`);
69779
69912
  out.push(` ${import_picocolors39.default.cyan("unpack")} ${import_picocolors39.default.dim("install the claimed agent into a harness layout (--harness to override)")}`);
69780
69913
  out.push(` ${import_picocolors39.default.cyan("status")} ${import_picocolors39.default.dim("show what would push, what would pull, and which manifest blocks are ignored (--json for scripts)")}`);
@@ -90444,7 +90577,7 @@ function help() {
90444
90577
  out.push("");
90445
90578
  out.push(` ${import_picocolors61.default.cyan("agent init")} ${import_picocolors61.default.dim("write a starter brainbase.agent.yaml here — offline, no login needed")}`);
90446
90579
  out.push(` ${import_picocolors61.default.cyan("agent create")} ${import_picocolors61.default.dim("claim an unclaimed brainbase.agent.yaml and create the cloud agent")}`);
90447
- out.push(` ${import_picocolors61.default.cyan("agent pull")} ${import_picocolors61.default.dim("[<id>]")} ${import_picocolors61.default.dim("bring cloud changes into this folder (--force to override; --run-entrypoint to also execute the agent entrypoint)")}`);
90580
+ out.push(` ${import_picocolors61.default.cyan("agent pull")} ${import_picocolors61.default.dim("[<id>]")} ${import_picocolors61.default.dim("bring cloud changes into this folder (--force to override; --run-entrypoint to also execute the agent entrypoint; --link to link first)")}`);
90448
90581
  out.push(` ${import_picocolors61.default.cyan("agent push")} ${import_picocolors61.default.dim("send local changes to the cloud (--force to overwrite cloud-side conflicts with local)")}`);
90449
90582
  out.push(` ${import_picocolors61.default.cyan("agent unpack")} ${import_picocolors61.default.dim("install the claimed agent into a harness layout")}`);
90450
90583
  out.push(` ${import_picocolors61.default.cyan("link")} ${import_picocolors61.default.dim("attach this folder to an existing agent")}`);
@@ -90542,7 +90675,8 @@ function help() {
90542
90675
  out.push(` ${import_picocolors61.default.dim("--org <id-or-slug>")} pick the organization (team/agent list, agent create, orchestration create/list)`);
90543
90676
  out.push(` ${import_picocolors61.default.dim("--team <id>")} pick the team, same commands (works without --org)`);
90544
90677
  out.push(` ${import_picocolors61.default.dim("--json")} machine-readable output for supported commands`);
90545
- out.push(` ${import_picocolors61.default.dim("--no-tracking")} for link: skip routing LLM traffic through brainbase`);
90678
+ out.push(` ${import_picocolors61.default.dim("--no-tracking")} for link / agent pull --link: skip routing LLM traffic through brainbase`);
90679
+ out.push(` ${import_picocolors61.default.dim("--link")} for agent pull: link this folder to the agent first, as \`brainbase link --agent <id> --yes\` would, in one process`);
90546
90680
  out.push(` ${import_picocolors61.default.dim("--track")} for agent create: enable tracking non-interactively (off without a TTY)`);
90547
90681
  out.push(` ${import_picocolors61.default.dim("--shell <sh|fish>")} for agent env: pick output format (auto-detected from $SHELL)`);
90548
90682
  out.push(` ${import_picocolors61.default.dim("--bot-token <t>")} for agent connect slack (or BRAINBASE_SLACK_BOT_TOKEN, or stdin)`);
@@ -90800,6 +90934,7 @@ async function main() {
90800
90934
  const noPushFlag = hasFlag2(sharedArgs, "--no-push");
90801
90935
  const jsonFlag = hasFlag2(sharedArgs, "--json");
90802
90936
  const acpFlag = hasFlag2(sharedArgs, "--acp");
90937
+ const linkFlag = hasFlag2(sharedArgs, "--link");
90803
90938
  const botTokenFlag = getFlag(sharedArgs, "--bot-token");
90804
90939
  const signingSecretFlag = getFlag(sharedArgs, "--signing-secret");
90805
90940
  const appIdFlag = getFlag(sharedArgs, "--app-id");
@@ -90897,6 +91032,7 @@ async function main() {
90897
91032
  force: forceFlag,
90898
91033
  runEntrypoint: runEntrypointFlag,
90899
91034
  acp: acpFlag,
91035
+ link: linkFlag,
90900
91036
  botToken: botTokenFlag,
90901
91037
  signingSecret: signingSecretFlag,
90902
91038
  appId: appIdFlag,