@agentistics/mcp 2.204.1 → 2.204.3

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.
@@ -60,6 +60,1453 @@ function deliveryCalendarQuery(a) {
60
60
  return q.toString() ? `?${q}` : "";
61
61
  }
62
62
 
63
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/constants.js
64
+ var daysInYear = 365.2425;
65
+ var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1000;
66
+ var minTime = -maxTime;
67
+ var millisecondsInWeek = 604800000;
68
+ var millisecondsInDay = 86400000;
69
+ var secondsInHour = 3600;
70
+ var secondsInDay = secondsInHour * 24;
71
+ var secondsInWeek = secondsInDay * 7;
72
+ var secondsInYear = secondsInDay * daysInYear;
73
+ var secondsInMonth = secondsInYear / 12;
74
+ var secondsInQuarter = secondsInMonth * 3;
75
+ var constructFromSymbol = Symbol.for("constructDateFrom");
76
+
77
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/constructFrom.js
78
+ function constructFrom(date, value) {
79
+ if (typeof date === "function")
80
+ return date(value);
81
+ if (date && typeof date === "object" && constructFromSymbol in date)
82
+ return date[constructFromSymbol](value);
83
+ if (date instanceof Date)
84
+ return new date.constructor(value);
85
+ return new Date(value);
86
+ }
87
+
88
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/toDate.js
89
+ function toDate(argument, context) {
90
+ return constructFrom(context || argument, argument);
91
+ }
92
+
93
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/addDays.js
94
+ function addDays(date, amount, options) {
95
+ const _date = toDate(date, options?.in);
96
+ if (isNaN(amount))
97
+ return constructFrom(options?.in || date, NaN);
98
+ if (!amount)
99
+ return _date;
100
+ _date.setDate(_date.getDate() + amount);
101
+ return _date;
102
+ }
103
+
104
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/_lib/defaultOptions.js
105
+ var defaultOptions = {};
106
+ function getDefaultOptions() {
107
+ return defaultOptions;
108
+ }
109
+
110
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/startOfWeek.js
111
+ function startOfWeek(date, options) {
112
+ const defaultOptions = getDefaultOptions();
113
+ const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0;
114
+ const _date = toDate(date, options?.in);
115
+ const day = _date.getDay();
116
+ const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
117
+ _date.setDate(_date.getDate() - diff);
118
+ _date.setHours(0, 0, 0, 0);
119
+ return _date;
120
+ }
121
+
122
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/startOfISOWeek.js
123
+ function startOfISOWeek(date, options) {
124
+ return startOfWeek(date, { ...options, weekStartsOn: 1 });
125
+ }
126
+
127
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/getISOWeekYear.js
128
+ function getISOWeekYear(date, options) {
129
+ const _date = toDate(date, options?.in);
130
+ const year = _date.getFullYear();
131
+ const fourthOfJanuaryOfNextYear = constructFrom(_date, 0);
132
+ fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4);
133
+ fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0);
134
+ const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear);
135
+ const fourthOfJanuaryOfThisYear = constructFrom(_date, 0);
136
+ fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4);
137
+ fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0);
138
+ const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear);
139
+ if (_date.getTime() >= startOfNextYear.getTime()) {
140
+ return year + 1;
141
+ } else if (_date.getTime() >= startOfThisYear.getTime()) {
142
+ return year;
143
+ } else {
144
+ return year - 1;
145
+ }
146
+ }
147
+
148
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js
149
+ function getTimezoneOffsetInMilliseconds(date) {
150
+ const _date = toDate(date);
151
+ const utcDate = new Date(Date.UTC(_date.getFullYear(), _date.getMonth(), _date.getDate(), _date.getHours(), _date.getMinutes(), _date.getSeconds(), _date.getMilliseconds()));
152
+ utcDate.setUTCFullYear(_date.getFullYear());
153
+ return +date - +utcDate;
154
+ }
155
+
156
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/_lib/normalizeDates.js
157
+ function normalizeDates(context, ...dates) {
158
+ const normalize = constructFrom.bind(null, context || dates.find((date) => typeof date === "object"));
159
+ return dates.map(normalize);
160
+ }
161
+
162
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/startOfDay.js
163
+ function startOfDay(date, options) {
164
+ const _date = toDate(date, options?.in);
165
+ _date.setHours(0, 0, 0, 0);
166
+ return _date;
167
+ }
168
+
169
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/differenceInCalendarDays.js
170
+ function differenceInCalendarDays(laterDate, earlierDate, options) {
171
+ const [laterDate_, earlierDate_] = normalizeDates(options?.in, laterDate, earlierDate);
172
+ const laterStartOfDay = startOfDay(laterDate_);
173
+ const earlierStartOfDay = startOfDay(earlierDate_);
174
+ const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay);
175
+ const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay);
176
+ return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay);
177
+ }
178
+
179
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/startOfISOWeekYear.js
180
+ function startOfISOWeekYear(date, options) {
181
+ const year = getISOWeekYear(date, options);
182
+ const fourthOfJanuary = constructFrom(options?.in || date, 0);
183
+ fourthOfJanuary.setFullYear(year, 0, 4);
184
+ fourthOfJanuary.setHours(0, 0, 0, 0);
185
+ return startOfISOWeek(fourthOfJanuary);
186
+ }
187
+
188
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/isDate.js
189
+ function isDate(value) {
190
+ return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]";
191
+ }
192
+
193
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/isValid.js
194
+ function isValid(date) {
195
+ return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date)));
196
+ }
197
+
198
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/startOfYear.js
199
+ function startOfYear(date, options) {
200
+ const date_ = toDate(date, options?.in);
201
+ date_.setFullYear(date_.getFullYear(), 0, 1);
202
+ date_.setHours(0, 0, 0, 0);
203
+ return date_;
204
+ }
205
+
206
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/formatDistance.js
207
+ var formatDistanceLocale = {
208
+ lessThanXSeconds: {
209
+ one: "less than a second",
210
+ other: "less than {{count}} seconds"
211
+ },
212
+ xSeconds: {
213
+ one: "1 second",
214
+ other: "{{count}} seconds"
215
+ },
216
+ halfAMinute: "half a minute",
217
+ lessThanXMinutes: {
218
+ one: "less than a minute",
219
+ other: "less than {{count}} minutes"
220
+ },
221
+ xMinutes: {
222
+ one: "1 minute",
223
+ other: "{{count}} minutes"
224
+ },
225
+ aboutXHours: {
226
+ one: "about 1 hour",
227
+ other: "about {{count}} hours"
228
+ },
229
+ xHours: {
230
+ one: "1 hour",
231
+ other: "{{count}} hours"
232
+ },
233
+ xDays: {
234
+ one: "1 day",
235
+ other: "{{count}} days"
236
+ },
237
+ aboutXWeeks: {
238
+ one: "about 1 week",
239
+ other: "about {{count}} weeks"
240
+ },
241
+ xWeeks: {
242
+ one: "1 week",
243
+ other: "{{count}} weeks"
244
+ },
245
+ aboutXMonths: {
246
+ one: "about 1 month",
247
+ other: "about {{count}} months"
248
+ },
249
+ xMonths: {
250
+ one: "1 month",
251
+ other: "{{count}} months"
252
+ },
253
+ aboutXYears: {
254
+ one: "about 1 year",
255
+ other: "about {{count}} years"
256
+ },
257
+ xYears: {
258
+ one: "1 year",
259
+ other: "{{count}} years"
260
+ },
261
+ overXYears: {
262
+ one: "over 1 year",
263
+ other: "over {{count}} years"
264
+ },
265
+ almostXYears: {
266
+ one: "almost 1 year",
267
+ other: "almost {{count}} years"
268
+ }
269
+ };
270
+ var formatDistance = (token, count, options) => {
271
+ let result;
272
+ const tokenValue = formatDistanceLocale[token];
273
+ if (typeof tokenValue === "string") {
274
+ result = tokenValue;
275
+ } else if (count === 1) {
276
+ result = tokenValue.one;
277
+ } else {
278
+ result = tokenValue.other.replace("{{count}}", count.toString());
279
+ }
280
+ if (options?.addSuffix) {
281
+ if (options.comparison && options.comparison > 0) {
282
+ return "in " + result;
283
+ } else {
284
+ return result + " ago";
285
+ }
286
+ }
287
+ return result;
288
+ };
289
+
290
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildFormatLongFn.js
291
+ function buildFormatLongFn(args) {
292
+ return (options = {}) => {
293
+ const width = options.width ? String(options.width) : args.defaultWidth;
294
+ const format = args.formats[width] || args.formats[args.defaultWidth];
295
+ return format;
296
+ };
297
+ }
298
+
299
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/formatLong.js
300
+ var dateFormats = {
301
+ full: "EEEE, MMMM do, y",
302
+ long: "MMMM do, y",
303
+ medium: "MMM d, y",
304
+ short: "MM/dd/yyyy"
305
+ };
306
+ var timeFormats = {
307
+ full: "h:mm:ss a zzzz",
308
+ long: "h:mm:ss a z",
309
+ medium: "h:mm:ss a",
310
+ short: "h:mm a"
311
+ };
312
+ var dateTimeFormats = {
313
+ full: "{{date}} 'at' {{time}}",
314
+ long: "{{date}} 'at' {{time}}",
315
+ medium: "{{date}}, {{time}}",
316
+ short: "{{date}}, {{time}}"
317
+ };
318
+ var formatLong = {
319
+ date: buildFormatLongFn({
320
+ formats: dateFormats,
321
+ defaultWidth: "full"
322
+ }),
323
+ time: buildFormatLongFn({
324
+ formats: timeFormats,
325
+ defaultWidth: "full"
326
+ }),
327
+ dateTime: buildFormatLongFn({
328
+ formats: dateTimeFormats,
329
+ defaultWidth: "full"
330
+ })
331
+ };
332
+
333
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/formatRelative.js
334
+ var formatRelativeLocale = {
335
+ lastWeek: "'last' eeee 'at' p",
336
+ yesterday: "'yesterday at' p",
337
+ today: "'today at' p",
338
+ tomorrow: "'tomorrow at' p",
339
+ nextWeek: "eeee 'at' p",
340
+ other: "P"
341
+ };
342
+ var formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token];
343
+
344
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildLocalizeFn.js
345
+ function buildLocalizeFn(args) {
346
+ return (value, options) => {
347
+ const context = options?.context ? String(options.context) : "standalone";
348
+ let valuesArray;
349
+ if (context === "formatting" && args.formattingValues) {
350
+ const defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
351
+ const width = options?.width ? String(options.width) : defaultWidth;
352
+ valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
353
+ } else {
354
+ const defaultWidth = args.defaultWidth;
355
+ const width = options?.width ? String(options.width) : args.defaultWidth;
356
+ valuesArray = args.values[width] || args.values[defaultWidth];
357
+ }
358
+ const index = args.argumentCallback ? args.argumentCallback(value) : value;
359
+ return valuesArray[index];
360
+ };
361
+ }
362
+
363
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/localize.js
364
+ var eraValues = {
365
+ narrow: ["B", "A"],
366
+ abbreviated: ["BC", "AD"],
367
+ wide: ["Before Christ", "Anno Domini"]
368
+ };
369
+ var quarterValues = {
370
+ narrow: ["1", "2", "3", "4"],
371
+ abbreviated: ["Q1", "Q2", "Q3", "Q4"],
372
+ wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
373
+ };
374
+ var monthValues = {
375
+ narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
376
+ abbreviated: [
377
+ "Jan",
378
+ "Feb",
379
+ "Mar",
380
+ "Apr",
381
+ "May",
382
+ "Jun",
383
+ "Jul",
384
+ "Aug",
385
+ "Sep",
386
+ "Oct",
387
+ "Nov",
388
+ "Dec"
389
+ ],
390
+ wide: [
391
+ "January",
392
+ "February",
393
+ "March",
394
+ "April",
395
+ "May",
396
+ "June",
397
+ "July",
398
+ "August",
399
+ "September",
400
+ "October",
401
+ "November",
402
+ "December"
403
+ ]
404
+ };
405
+ var dayValues = {
406
+ narrow: ["S", "M", "T", "W", "T", "F", "S"],
407
+ short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
408
+ abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
409
+ wide: [
410
+ "Sunday",
411
+ "Monday",
412
+ "Tuesday",
413
+ "Wednesday",
414
+ "Thursday",
415
+ "Friday",
416
+ "Saturday"
417
+ ]
418
+ };
419
+ var dayPeriodValues = {
420
+ narrow: {
421
+ am: "a",
422
+ pm: "p",
423
+ midnight: "mi",
424
+ noon: "n",
425
+ morning: "morning",
426
+ afternoon: "afternoon",
427
+ evening: "evening",
428
+ night: "night"
429
+ },
430
+ abbreviated: {
431
+ am: "AM",
432
+ pm: "PM",
433
+ midnight: "midnight",
434
+ noon: "noon",
435
+ morning: "morning",
436
+ afternoon: "afternoon",
437
+ evening: "evening",
438
+ night: "night"
439
+ },
440
+ wide: {
441
+ am: "a.m.",
442
+ pm: "p.m.",
443
+ midnight: "midnight",
444
+ noon: "noon",
445
+ morning: "morning",
446
+ afternoon: "afternoon",
447
+ evening: "evening",
448
+ night: "night"
449
+ }
450
+ };
451
+ var formattingDayPeriodValues = {
452
+ narrow: {
453
+ am: "a",
454
+ pm: "p",
455
+ midnight: "mi",
456
+ noon: "n",
457
+ morning: "in the morning",
458
+ afternoon: "in the afternoon",
459
+ evening: "in the evening",
460
+ night: "at night"
461
+ },
462
+ abbreviated: {
463
+ am: "AM",
464
+ pm: "PM",
465
+ midnight: "midnight",
466
+ noon: "noon",
467
+ morning: "in the morning",
468
+ afternoon: "in the afternoon",
469
+ evening: "in the evening",
470
+ night: "at night"
471
+ },
472
+ wide: {
473
+ am: "a.m.",
474
+ pm: "p.m.",
475
+ midnight: "midnight",
476
+ noon: "noon",
477
+ morning: "in the morning",
478
+ afternoon: "in the afternoon",
479
+ evening: "in the evening",
480
+ night: "at night"
481
+ }
482
+ };
483
+ var ordinalNumber = (dirtyNumber, _options) => {
484
+ const number = Number(dirtyNumber);
485
+ const rem100 = number % 100;
486
+ if (rem100 > 20 || rem100 < 10) {
487
+ switch (rem100 % 10) {
488
+ case 1:
489
+ return number + "st";
490
+ case 2:
491
+ return number + "nd";
492
+ case 3:
493
+ return number + "rd";
494
+ }
495
+ }
496
+ return number + "th";
497
+ };
498
+ var localize = {
499
+ ordinalNumber,
500
+ era: buildLocalizeFn({
501
+ values: eraValues,
502
+ defaultWidth: "wide"
503
+ }),
504
+ quarter: buildLocalizeFn({
505
+ values: quarterValues,
506
+ defaultWidth: "wide",
507
+ argumentCallback: (quarter) => quarter - 1
508
+ }),
509
+ month: buildLocalizeFn({
510
+ values: monthValues,
511
+ defaultWidth: "wide"
512
+ }),
513
+ day: buildLocalizeFn({
514
+ values: dayValues,
515
+ defaultWidth: "wide"
516
+ }),
517
+ dayPeriod: buildLocalizeFn({
518
+ values: dayPeriodValues,
519
+ defaultWidth: "wide",
520
+ formattingValues: formattingDayPeriodValues,
521
+ defaultFormattingWidth: "wide"
522
+ })
523
+ };
524
+
525
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildMatchFn.js
526
+ function buildMatchFn(args) {
527
+ return (string, options = {}) => {
528
+ const width = options.width;
529
+ const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
530
+ const matchResult = string.match(matchPattern);
531
+ if (!matchResult) {
532
+ return null;
533
+ }
534
+ const matchedString = matchResult[0];
535
+ const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
536
+ const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : findKey(parsePatterns, (pattern) => pattern.test(matchedString));
537
+ let value;
538
+ value = args.valueCallback ? args.valueCallback(key) : key;
539
+ value = options.valueCallback ? options.valueCallback(value) : value;
540
+ const rest = string.slice(matchedString.length);
541
+ return { value, rest };
542
+ };
543
+ }
544
+ function findKey(object, predicate) {
545
+ for (const key in object) {
546
+ if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) {
547
+ return key;
548
+ }
549
+ }
550
+ return;
551
+ }
552
+ function findIndex(array, predicate) {
553
+ for (let key = 0;key < array.length; key++) {
554
+ if (predicate(array[key])) {
555
+ return key;
556
+ }
557
+ }
558
+ return;
559
+ }
560
+
561
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js
562
+ function buildMatchPatternFn(args) {
563
+ return (string, options = {}) => {
564
+ const matchResult = string.match(args.matchPattern);
565
+ if (!matchResult)
566
+ return null;
567
+ const matchedString = matchResult[0];
568
+ const parseResult = string.match(args.parsePattern);
569
+ if (!parseResult)
570
+ return null;
571
+ let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
572
+ value = options.valueCallback ? options.valueCallback(value) : value;
573
+ const rest = string.slice(matchedString.length);
574
+ return { value, rest };
575
+ };
576
+ }
577
+
578
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/locale/en-US/_lib/match.js
579
+ var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
580
+ var parseOrdinalNumberPattern = /\d+/i;
581
+ var matchEraPatterns = {
582
+ narrow: /^(b|a)/i,
583
+ abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
584
+ wide: /^(before christ|before common era|anno domini|common era)/i
585
+ };
586
+ var parseEraPatterns = {
587
+ any: [/^b/i, /^(a|c)/i]
588
+ };
589
+ var matchQuarterPatterns = {
590
+ narrow: /^[1234]/i,
591
+ abbreviated: /^q[1234]/i,
592
+ wide: /^[1234](th|st|nd|rd)? quarter/i
593
+ };
594
+ var parseQuarterPatterns = {
595
+ any: [/1/i, /2/i, /3/i, /4/i]
596
+ };
597
+ var matchMonthPatterns = {
598
+ narrow: /^[jfmasond]/i,
599
+ abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
600
+ wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
601
+ };
602
+ var parseMonthPatterns = {
603
+ narrow: [
604
+ /^j/i,
605
+ /^f/i,
606
+ /^m/i,
607
+ /^a/i,
608
+ /^m/i,
609
+ /^j/i,
610
+ /^j/i,
611
+ /^a/i,
612
+ /^s/i,
613
+ /^o/i,
614
+ /^n/i,
615
+ /^d/i
616
+ ],
617
+ any: [
618
+ /^ja/i,
619
+ /^f/i,
620
+ /^mar/i,
621
+ /^ap/i,
622
+ /^may/i,
623
+ /^jun/i,
624
+ /^jul/i,
625
+ /^au/i,
626
+ /^s/i,
627
+ /^o/i,
628
+ /^n/i,
629
+ /^d/i
630
+ ]
631
+ };
632
+ var matchDayPatterns = {
633
+ narrow: /^[smtwf]/i,
634
+ short: /^(su|mo|tu|we|th|fr|sa)/i,
635
+ abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
636
+ wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
637
+ };
638
+ var parseDayPatterns = {
639
+ narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
640
+ any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
641
+ };
642
+ var matchDayPeriodPatterns = {
643
+ narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
644
+ any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
645
+ };
646
+ var parseDayPeriodPatterns = {
647
+ any: {
648
+ am: /^a/i,
649
+ pm: /^p/i,
650
+ midnight: /^mi/i,
651
+ noon: /^no/i,
652
+ morning: /morning/i,
653
+ afternoon: /afternoon/i,
654
+ evening: /evening/i,
655
+ night: /night/i
656
+ }
657
+ };
658
+ var match = {
659
+ ordinalNumber: buildMatchPatternFn({
660
+ matchPattern: matchOrdinalNumberPattern,
661
+ parsePattern: parseOrdinalNumberPattern,
662
+ valueCallback: (value) => parseInt(value, 10)
663
+ }),
664
+ era: buildMatchFn({
665
+ matchPatterns: matchEraPatterns,
666
+ defaultMatchWidth: "wide",
667
+ parsePatterns: parseEraPatterns,
668
+ defaultParseWidth: "any"
669
+ }),
670
+ quarter: buildMatchFn({
671
+ matchPatterns: matchQuarterPatterns,
672
+ defaultMatchWidth: "wide",
673
+ parsePatterns: parseQuarterPatterns,
674
+ defaultParseWidth: "any",
675
+ valueCallback: (index) => index + 1
676
+ }),
677
+ month: buildMatchFn({
678
+ matchPatterns: matchMonthPatterns,
679
+ defaultMatchWidth: "wide",
680
+ parsePatterns: parseMonthPatterns,
681
+ defaultParseWidth: "any"
682
+ }),
683
+ day: buildMatchFn({
684
+ matchPatterns: matchDayPatterns,
685
+ defaultMatchWidth: "wide",
686
+ parsePatterns: parseDayPatterns,
687
+ defaultParseWidth: "any"
688
+ }),
689
+ dayPeriod: buildMatchFn({
690
+ matchPatterns: matchDayPeriodPatterns,
691
+ defaultMatchWidth: "any",
692
+ parsePatterns: parseDayPeriodPatterns,
693
+ defaultParseWidth: "any"
694
+ })
695
+ };
696
+
697
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/locale/en-US.js
698
+ var enUS = {
699
+ code: "en-US",
700
+ formatDistance,
701
+ formatLong,
702
+ formatRelative,
703
+ localize,
704
+ match,
705
+ options: {
706
+ weekStartsOn: 0,
707
+ firstWeekContainsDate: 1
708
+ }
709
+ };
710
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/getDayOfYear.js
711
+ function getDayOfYear(date, options) {
712
+ const _date = toDate(date, options?.in);
713
+ const diff = differenceInCalendarDays(_date, startOfYear(_date));
714
+ const dayOfYear = diff + 1;
715
+ return dayOfYear;
716
+ }
717
+
718
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/getISOWeek.js
719
+ function getISOWeek(date, options) {
720
+ const _date = toDate(date, options?.in);
721
+ const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date);
722
+ return Math.round(diff / millisecondsInWeek) + 1;
723
+ }
724
+
725
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/getWeekYear.js
726
+ function getWeekYear(date, options) {
727
+ const _date = toDate(date, options?.in);
728
+ const year = _date.getFullYear();
729
+ const defaultOptions = getDefaultOptions();
730
+ const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions.firstWeekContainsDate ?? defaultOptions.locale?.options?.firstWeekContainsDate ?? 1;
731
+ const firstWeekOfNextYear = constructFrom(options?.in || date, 0);
732
+ firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
733
+ firstWeekOfNextYear.setHours(0, 0, 0, 0);
734
+ const startOfNextYear = startOfWeek(firstWeekOfNextYear, options);
735
+ const firstWeekOfThisYear = constructFrom(options?.in || date, 0);
736
+ firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate);
737
+ firstWeekOfThisYear.setHours(0, 0, 0, 0);
738
+ const startOfThisYear = startOfWeek(firstWeekOfThisYear, options);
739
+ if (+_date >= +startOfNextYear) {
740
+ return year + 1;
741
+ } else if (+_date >= +startOfThisYear) {
742
+ return year;
743
+ } else {
744
+ return year - 1;
745
+ }
746
+ }
747
+
748
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/startOfWeekYear.js
749
+ function startOfWeekYear(date, options) {
750
+ const defaultOptions = getDefaultOptions();
751
+ const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions.firstWeekContainsDate ?? defaultOptions.locale?.options?.firstWeekContainsDate ?? 1;
752
+ const year = getWeekYear(date, options);
753
+ const firstWeek = constructFrom(options?.in || date, 0);
754
+ firstWeek.setFullYear(year, 0, firstWeekContainsDate);
755
+ firstWeek.setHours(0, 0, 0, 0);
756
+ const _date = startOfWeek(firstWeek, options);
757
+ return _date;
758
+ }
759
+
760
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/getWeek.js
761
+ function getWeek(date, options) {
762
+ const _date = toDate(date, options?.in);
763
+ const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options);
764
+ return Math.round(diff / millisecondsInWeek) + 1;
765
+ }
766
+
767
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/_lib/addLeadingZeros.js
768
+ function addLeadingZeros(number, targetLength) {
769
+ const sign = number < 0 ? "-" : "";
770
+ const output = Math.abs(number).toString().padStart(targetLength, "0");
771
+ return sign + output;
772
+ }
773
+
774
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/_lib/format/lightFormatters.js
775
+ var lightFormatters = {
776
+ y(date, token) {
777
+ const signedYear = date.getFullYear();
778
+ const year = signedYear > 0 ? signedYear : 1 - signedYear;
779
+ return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
780
+ },
781
+ M(date, token) {
782
+ const month = date.getMonth();
783
+ return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
784
+ },
785
+ d(date, token) {
786
+ return addLeadingZeros(date.getDate(), token.length);
787
+ },
788
+ a(date, token) {
789
+ const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am";
790
+ switch (token) {
791
+ case "a":
792
+ case "aa":
793
+ return dayPeriodEnumValue.toUpperCase();
794
+ case "aaa":
795
+ return dayPeriodEnumValue;
796
+ case "aaaaa":
797
+ return dayPeriodEnumValue[0];
798
+ case "aaaa":
799
+ default:
800
+ return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
801
+ }
802
+ },
803
+ h(date, token) {
804
+ return addLeadingZeros(date.getHours() % 12 || 12, token.length);
805
+ },
806
+ H(date, token) {
807
+ return addLeadingZeros(date.getHours(), token.length);
808
+ },
809
+ m(date, token) {
810
+ return addLeadingZeros(date.getMinutes(), token.length);
811
+ },
812
+ s(date, token) {
813
+ return addLeadingZeros(date.getSeconds(), token.length);
814
+ },
815
+ S(date, token) {
816
+ const numberOfDigits = token.length;
817
+ const milliseconds = date.getMilliseconds();
818
+ const fractionalSeconds = Math.trunc(milliseconds * Math.pow(10, numberOfDigits - 3));
819
+ return addLeadingZeros(fractionalSeconds, token.length);
820
+ }
821
+ };
822
+
823
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/_lib/format/formatters.js
824
+ var dayPeriodEnum = {
825
+ am: "am",
826
+ pm: "pm",
827
+ midnight: "midnight",
828
+ noon: "noon",
829
+ morning: "morning",
830
+ afternoon: "afternoon",
831
+ evening: "evening",
832
+ night: "night"
833
+ };
834
+ var formatters = {
835
+ G: function(date, token, localize) {
836
+ const era = date.getFullYear() > 0 ? 1 : 0;
837
+ switch (token) {
838
+ case "G":
839
+ case "GG":
840
+ case "GGG":
841
+ return localize.era(era, { width: "abbreviated" });
842
+ case "GGGGG":
843
+ return localize.era(era, { width: "narrow" });
844
+ case "GGGG":
845
+ default:
846
+ return localize.era(era, { width: "wide" });
847
+ }
848
+ },
849
+ y: function(date, token, localize) {
850
+ if (token === "yo") {
851
+ const signedYear = date.getFullYear();
852
+ const year = signedYear > 0 ? signedYear : 1 - signedYear;
853
+ return localize.ordinalNumber(year, { unit: "year" });
854
+ }
855
+ return lightFormatters.y(date, token);
856
+ },
857
+ Y: function(date, token, localize, options) {
858
+ const signedWeekYear = getWeekYear(date, options);
859
+ const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
860
+ if (token === "YY") {
861
+ const twoDigitYear = weekYear % 100;
862
+ return addLeadingZeros(twoDigitYear, 2);
863
+ }
864
+ if (token === "Yo") {
865
+ return localize.ordinalNumber(weekYear, { unit: "year" });
866
+ }
867
+ return addLeadingZeros(weekYear, token.length);
868
+ },
869
+ R: function(date, token) {
870
+ const isoWeekYear = getISOWeekYear(date);
871
+ return addLeadingZeros(isoWeekYear, token.length);
872
+ },
873
+ u: function(date, token) {
874
+ const year = date.getFullYear();
875
+ return addLeadingZeros(year, token.length);
876
+ },
877
+ Q: function(date, token, localize) {
878
+ const quarter = Math.ceil((date.getMonth() + 1) / 3);
879
+ switch (token) {
880
+ case "Q":
881
+ return String(quarter);
882
+ case "QQ":
883
+ return addLeadingZeros(quarter, 2);
884
+ case "Qo":
885
+ return localize.ordinalNumber(quarter, { unit: "quarter" });
886
+ case "QQQ":
887
+ return localize.quarter(quarter, {
888
+ width: "abbreviated",
889
+ context: "formatting"
890
+ });
891
+ case "QQQQQ":
892
+ return localize.quarter(quarter, {
893
+ width: "narrow",
894
+ context: "formatting"
895
+ });
896
+ case "QQQQ":
897
+ default:
898
+ return localize.quarter(quarter, {
899
+ width: "wide",
900
+ context: "formatting"
901
+ });
902
+ }
903
+ },
904
+ q: function(date, token, localize) {
905
+ const quarter = Math.ceil((date.getMonth() + 1) / 3);
906
+ switch (token) {
907
+ case "q":
908
+ return String(quarter);
909
+ case "qq":
910
+ return addLeadingZeros(quarter, 2);
911
+ case "qo":
912
+ return localize.ordinalNumber(quarter, { unit: "quarter" });
913
+ case "qqq":
914
+ return localize.quarter(quarter, {
915
+ width: "abbreviated",
916
+ context: "standalone"
917
+ });
918
+ case "qqqqq":
919
+ return localize.quarter(quarter, {
920
+ width: "narrow",
921
+ context: "standalone"
922
+ });
923
+ case "qqqq":
924
+ default:
925
+ return localize.quarter(quarter, {
926
+ width: "wide",
927
+ context: "standalone"
928
+ });
929
+ }
930
+ },
931
+ M: function(date, token, localize) {
932
+ const month = date.getMonth();
933
+ switch (token) {
934
+ case "M":
935
+ case "MM":
936
+ return lightFormatters.M(date, token);
937
+ case "Mo":
938
+ return localize.ordinalNumber(month + 1, { unit: "month" });
939
+ case "MMM":
940
+ return localize.month(month, {
941
+ width: "abbreviated",
942
+ context: "formatting"
943
+ });
944
+ case "MMMMM":
945
+ return localize.month(month, {
946
+ width: "narrow",
947
+ context: "formatting"
948
+ });
949
+ case "MMMM":
950
+ default:
951
+ return localize.month(month, { width: "wide", context: "formatting" });
952
+ }
953
+ },
954
+ L: function(date, token, localize) {
955
+ const month = date.getMonth();
956
+ switch (token) {
957
+ case "L":
958
+ return String(month + 1);
959
+ case "LL":
960
+ return addLeadingZeros(month + 1, 2);
961
+ case "Lo":
962
+ return localize.ordinalNumber(month + 1, { unit: "month" });
963
+ case "LLL":
964
+ return localize.month(month, {
965
+ width: "abbreviated",
966
+ context: "standalone"
967
+ });
968
+ case "LLLLL":
969
+ return localize.month(month, {
970
+ width: "narrow",
971
+ context: "standalone"
972
+ });
973
+ case "LLLL":
974
+ default:
975
+ return localize.month(month, { width: "wide", context: "standalone" });
976
+ }
977
+ },
978
+ w: function(date, token, localize, options) {
979
+ const week = getWeek(date, options);
980
+ if (token === "wo") {
981
+ return localize.ordinalNumber(week, { unit: "week" });
982
+ }
983
+ return addLeadingZeros(week, token.length);
984
+ },
985
+ I: function(date, token, localize) {
986
+ const isoWeek = getISOWeek(date);
987
+ if (token === "Io") {
988
+ return localize.ordinalNumber(isoWeek, { unit: "week" });
989
+ }
990
+ return addLeadingZeros(isoWeek, token.length);
991
+ },
992
+ d: function(date, token, localize) {
993
+ if (token === "do") {
994
+ return localize.ordinalNumber(date.getDate(), { unit: "date" });
995
+ }
996
+ return lightFormatters.d(date, token);
997
+ },
998
+ D: function(date, token, localize) {
999
+ const dayOfYear = getDayOfYear(date);
1000
+ if (token === "Do") {
1001
+ return localize.ordinalNumber(dayOfYear, { unit: "dayOfYear" });
1002
+ }
1003
+ return addLeadingZeros(dayOfYear, token.length);
1004
+ },
1005
+ E: function(date, token, localize) {
1006
+ const dayOfWeek = date.getDay();
1007
+ switch (token) {
1008
+ case "E":
1009
+ case "EE":
1010
+ case "EEE":
1011
+ return localize.day(dayOfWeek, {
1012
+ width: "abbreviated",
1013
+ context: "formatting"
1014
+ });
1015
+ case "EEEEE":
1016
+ return localize.day(dayOfWeek, {
1017
+ width: "narrow",
1018
+ context: "formatting"
1019
+ });
1020
+ case "EEEEEE":
1021
+ return localize.day(dayOfWeek, {
1022
+ width: "short",
1023
+ context: "formatting"
1024
+ });
1025
+ case "EEEE":
1026
+ default:
1027
+ return localize.day(dayOfWeek, {
1028
+ width: "wide",
1029
+ context: "formatting"
1030
+ });
1031
+ }
1032
+ },
1033
+ e: function(date, token, localize, options) {
1034
+ const dayOfWeek = date.getDay();
1035
+ const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
1036
+ switch (token) {
1037
+ case "e":
1038
+ return String(localDayOfWeek);
1039
+ case "ee":
1040
+ return addLeadingZeros(localDayOfWeek, 2);
1041
+ case "eo":
1042
+ return localize.ordinalNumber(localDayOfWeek, { unit: "day" });
1043
+ case "eee":
1044
+ return localize.day(dayOfWeek, {
1045
+ width: "abbreviated",
1046
+ context: "formatting"
1047
+ });
1048
+ case "eeeee":
1049
+ return localize.day(dayOfWeek, {
1050
+ width: "narrow",
1051
+ context: "formatting"
1052
+ });
1053
+ case "eeeeee":
1054
+ return localize.day(dayOfWeek, {
1055
+ width: "short",
1056
+ context: "formatting"
1057
+ });
1058
+ case "eeee":
1059
+ default:
1060
+ return localize.day(dayOfWeek, {
1061
+ width: "wide",
1062
+ context: "formatting"
1063
+ });
1064
+ }
1065
+ },
1066
+ c: function(date, token, localize, options) {
1067
+ const dayOfWeek = date.getDay();
1068
+ const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
1069
+ switch (token) {
1070
+ case "c":
1071
+ return String(localDayOfWeek);
1072
+ case "cc":
1073
+ return addLeadingZeros(localDayOfWeek, token.length);
1074
+ case "co":
1075
+ return localize.ordinalNumber(localDayOfWeek, { unit: "day" });
1076
+ case "ccc":
1077
+ return localize.day(dayOfWeek, {
1078
+ width: "abbreviated",
1079
+ context: "standalone"
1080
+ });
1081
+ case "ccccc":
1082
+ return localize.day(dayOfWeek, {
1083
+ width: "narrow",
1084
+ context: "standalone"
1085
+ });
1086
+ case "cccccc":
1087
+ return localize.day(dayOfWeek, {
1088
+ width: "short",
1089
+ context: "standalone"
1090
+ });
1091
+ case "cccc":
1092
+ default:
1093
+ return localize.day(dayOfWeek, {
1094
+ width: "wide",
1095
+ context: "standalone"
1096
+ });
1097
+ }
1098
+ },
1099
+ i: function(date, token, localize) {
1100
+ const dayOfWeek = date.getDay();
1101
+ const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
1102
+ switch (token) {
1103
+ case "i":
1104
+ return String(isoDayOfWeek);
1105
+ case "ii":
1106
+ return addLeadingZeros(isoDayOfWeek, token.length);
1107
+ case "io":
1108
+ return localize.ordinalNumber(isoDayOfWeek, { unit: "day" });
1109
+ case "iii":
1110
+ return localize.day(dayOfWeek, {
1111
+ width: "abbreviated",
1112
+ context: "formatting"
1113
+ });
1114
+ case "iiiii":
1115
+ return localize.day(dayOfWeek, {
1116
+ width: "narrow",
1117
+ context: "formatting"
1118
+ });
1119
+ case "iiiiii":
1120
+ return localize.day(dayOfWeek, {
1121
+ width: "short",
1122
+ context: "formatting"
1123
+ });
1124
+ case "iiii":
1125
+ default:
1126
+ return localize.day(dayOfWeek, {
1127
+ width: "wide",
1128
+ context: "formatting"
1129
+ });
1130
+ }
1131
+ },
1132
+ a: function(date, token, localize) {
1133
+ const hours = date.getHours();
1134
+ const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
1135
+ switch (token) {
1136
+ case "a":
1137
+ case "aa":
1138
+ return localize.dayPeriod(dayPeriodEnumValue, {
1139
+ width: "abbreviated",
1140
+ context: "formatting"
1141
+ });
1142
+ case "aaa":
1143
+ return localize.dayPeriod(dayPeriodEnumValue, {
1144
+ width: "abbreviated",
1145
+ context: "formatting"
1146
+ }).toLowerCase();
1147
+ case "aaaaa":
1148
+ return localize.dayPeriod(dayPeriodEnumValue, {
1149
+ width: "narrow",
1150
+ context: "formatting"
1151
+ });
1152
+ case "aaaa":
1153
+ default:
1154
+ return localize.dayPeriod(dayPeriodEnumValue, {
1155
+ width: "wide",
1156
+ context: "formatting"
1157
+ });
1158
+ }
1159
+ },
1160
+ b: function(date, token, localize) {
1161
+ const hours = date.getHours();
1162
+ let dayPeriodEnumValue;
1163
+ if (hours === 12) {
1164
+ dayPeriodEnumValue = dayPeriodEnum.noon;
1165
+ } else if (hours === 0) {
1166
+ dayPeriodEnumValue = dayPeriodEnum.midnight;
1167
+ } else {
1168
+ dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
1169
+ }
1170
+ switch (token) {
1171
+ case "b":
1172
+ case "bb":
1173
+ return localize.dayPeriod(dayPeriodEnumValue, {
1174
+ width: "abbreviated",
1175
+ context: "formatting"
1176
+ });
1177
+ case "bbb":
1178
+ return localize.dayPeriod(dayPeriodEnumValue, {
1179
+ width: "abbreviated",
1180
+ context: "formatting"
1181
+ }).toLowerCase();
1182
+ case "bbbbb":
1183
+ return localize.dayPeriod(dayPeriodEnumValue, {
1184
+ width: "narrow",
1185
+ context: "formatting"
1186
+ });
1187
+ case "bbbb":
1188
+ default:
1189
+ return localize.dayPeriod(dayPeriodEnumValue, {
1190
+ width: "wide",
1191
+ context: "formatting"
1192
+ });
1193
+ }
1194
+ },
1195
+ B: function(date, token, localize) {
1196
+ const hours = date.getHours();
1197
+ let dayPeriodEnumValue;
1198
+ if (hours >= 17) {
1199
+ dayPeriodEnumValue = dayPeriodEnum.evening;
1200
+ } else if (hours >= 12) {
1201
+ dayPeriodEnumValue = dayPeriodEnum.afternoon;
1202
+ } else if (hours >= 4) {
1203
+ dayPeriodEnumValue = dayPeriodEnum.morning;
1204
+ } else {
1205
+ dayPeriodEnumValue = dayPeriodEnum.night;
1206
+ }
1207
+ switch (token) {
1208
+ case "B":
1209
+ case "BB":
1210
+ case "BBB":
1211
+ return localize.dayPeriod(dayPeriodEnumValue, {
1212
+ width: "abbreviated",
1213
+ context: "formatting"
1214
+ });
1215
+ case "BBBBB":
1216
+ return localize.dayPeriod(dayPeriodEnumValue, {
1217
+ width: "narrow",
1218
+ context: "formatting"
1219
+ });
1220
+ case "BBBB":
1221
+ default:
1222
+ return localize.dayPeriod(dayPeriodEnumValue, {
1223
+ width: "wide",
1224
+ context: "formatting"
1225
+ });
1226
+ }
1227
+ },
1228
+ h: function(date, token, localize) {
1229
+ if (token === "ho") {
1230
+ let hours = date.getHours() % 12;
1231
+ if (hours === 0)
1232
+ hours = 12;
1233
+ return localize.ordinalNumber(hours, { unit: "hour" });
1234
+ }
1235
+ return lightFormatters.h(date, token);
1236
+ },
1237
+ H: function(date, token, localize) {
1238
+ if (token === "Ho") {
1239
+ return localize.ordinalNumber(date.getHours(), { unit: "hour" });
1240
+ }
1241
+ return lightFormatters.H(date, token);
1242
+ },
1243
+ K: function(date, token, localize) {
1244
+ const hours = date.getHours() % 12;
1245
+ if (token === "Ko") {
1246
+ return localize.ordinalNumber(hours, { unit: "hour" });
1247
+ }
1248
+ return addLeadingZeros(hours, token.length);
1249
+ },
1250
+ k: function(date, token, localize) {
1251
+ let hours = date.getHours();
1252
+ if (hours === 0)
1253
+ hours = 24;
1254
+ if (token === "ko") {
1255
+ return localize.ordinalNumber(hours, { unit: "hour" });
1256
+ }
1257
+ return addLeadingZeros(hours, token.length);
1258
+ },
1259
+ m: function(date, token, localize) {
1260
+ if (token === "mo") {
1261
+ return localize.ordinalNumber(date.getMinutes(), { unit: "minute" });
1262
+ }
1263
+ return lightFormatters.m(date, token);
1264
+ },
1265
+ s: function(date, token, localize) {
1266
+ if (token === "so") {
1267
+ return localize.ordinalNumber(date.getSeconds(), { unit: "second" });
1268
+ }
1269
+ return lightFormatters.s(date, token);
1270
+ },
1271
+ S: function(date, token) {
1272
+ return lightFormatters.S(date, token);
1273
+ },
1274
+ X: function(date, token, _localize) {
1275
+ const timezoneOffset = date.getTimezoneOffset();
1276
+ if (timezoneOffset === 0) {
1277
+ return "Z";
1278
+ }
1279
+ switch (token) {
1280
+ case "X":
1281
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
1282
+ case "XXXX":
1283
+ case "XX":
1284
+ return formatTimezone(timezoneOffset);
1285
+ case "XXXXX":
1286
+ case "XXX":
1287
+ default:
1288
+ return formatTimezone(timezoneOffset, ":");
1289
+ }
1290
+ },
1291
+ x: function(date, token, _localize) {
1292
+ const timezoneOffset = date.getTimezoneOffset();
1293
+ switch (token) {
1294
+ case "x":
1295
+ return formatTimezoneWithOptionalMinutes(timezoneOffset);
1296
+ case "xxxx":
1297
+ case "xx":
1298
+ return formatTimezone(timezoneOffset);
1299
+ case "xxxxx":
1300
+ case "xxx":
1301
+ default:
1302
+ return formatTimezone(timezoneOffset, ":");
1303
+ }
1304
+ },
1305
+ O: function(date, token, _localize) {
1306
+ const timezoneOffset = date.getTimezoneOffset();
1307
+ switch (token) {
1308
+ case "O":
1309
+ case "OO":
1310
+ case "OOO":
1311
+ return "GMT" + formatTimezoneShort(timezoneOffset, ":");
1312
+ case "OOOO":
1313
+ default:
1314
+ return "GMT" + formatTimezone(timezoneOffset, ":");
1315
+ }
1316
+ },
1317
+ z: function(date, token, _localize) {
1318
+ const timezoneOffset = date.getTimezoneOffset();
1319
+ switch (token) {
1320
+ case "z":
1321
+ case "zz":
1322
+ case "zzz":
1323
+ return "GMT" + formatTimezoneShort(timezoneOffset, ":");
1324
+ case "zzzz":
1325
+ default:
1326
+ return "GMT" + formatTimezone(timezoneOffset, ":");
1327
+ }
1328
+ },
1329
+ t: function(date, token, _localize) {
1330
+ const timestamp = Math.trunc(+date / 1000);
1331
+ return addLeadingZeros(timestamp, token.length);
1332
+ },
1333
+ T: function(date, token, _localize) {
1334
+ return addLeadingZeros(+date, token.length);
1335
+ }
1336
+ };
1337
+ function formatTimezoneShort(offset, delimiter = "") {
1338
+ const sign = offset > 0 ? "-" : "+";
1339
+ const absOffset = Math.abs(offset);
1340
+ const hours = Math.trunc(absOffset / 60);
1341
+ const minutes = absOffset % 60;
1342
+ if (minutes === 0) {
1343
+ return sign + String(hours);
1344
+ }
1345
+ return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
1346
+ }
1347
+ function formatTimezoneWithOptionalMinutes(offset, delimiter) {
1348
+ if (offset % 60 === 0) {
1349
+ const sign = offset > 0 ? "-" : "+";
1350
+ return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
1351
+ }
1352
+ return formatTimezone(offset, delimiter);
1353
+ }
1354
+ function formatTimezone(offset, delimiter = "") {
1355
+ const sign = offset > 0 ? "-" : "+";
1356
+ const absOffset = Math.abs(offset);
1357
+ const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
1358
+ const minutes = addLeadingZeros(absOffset % 60, 2);
1359
+ return sign + hours + delimiter + minutes;
1360
+ }
1361
+
1362
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/_lib/format/longFormatters.js
1363
+ var dateLongFormatter = (pattern, formatLong) => {
1364
+ switch (pattern) {
1365
+ case "P":
1366
+ return formatLong.date({ width: "short" });
1367
+ case "PP":
1368
+ return formatLong.date({ width: "medium" });
1369
+ case "PPP":
1370
+ return formatLong.date({ width: "long" });
1371
+ case "PPPP":
1372
+ default:
1373
+ return formatLong.date({ width: "full" });
1374
+ }
1375
+ };
1376
+ var timeLongFormatter = (pattern, formatLong) => {
1377
+ switch (pattern) {
1378
+ case "p":
1379
+ return formatLong.time({ width: "short" });
1380
+ case "pp":
1381
+ return formatLong.time({ width: "medium" });
1382
+ case "ppp":
1383
+ return formatLong.time({ width: "long" });
1384
+ case "pppp":
1385
+ default:
1386
+ return formatLong.time({ width: "full" });
1387
+ }
1388
+ };
1389
+ var dateTimeLongFormatter = (pattern, formatLong) => {
1390
+ const matchResult = pattern.match(/(P+)(p+)?/) || [];
1391
+ const datePattern = matchResult[1];
1392
+ const timePattern = matchResult[2];
1393
+ if (!timePattern) {
1394
+ return dateLongFormatter(pattern, formatLong);
1395
+ }
1396
+ let dateTimeFormat;
1397
+ switch (datePattern) {
1398
+ case "P":
1399
+ dateTimeFormat = formatLong.dateTime({ width: "short" });
1400
+ break;
1401
+ case "PP":
1402
+ dateTimeFormat = formatLong.dateTime({ width: "medium" });
1403
+ break;
1404
+ case "PPP":
1405
+ dateTimeFormat = formatLong.dateTime({ width: "long" });
1406
+ break;
1407
+ case "PPPP":
1408
+ default:
1409
+ dateTimeFormat = formatLong.dateTime({ width: "full" });
1410
+ break;
1411
+ }
1412
+ return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong)).replace("{{time}}", timeLongFormatter(timePattern, formatLong));
1413
+ };
1414
+ var longFormatters = {
1415
+ p: timeLongFormatter,
1416
+ P: dateTimeLongFormatter
1417
+ };
1418
+
1419
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/_lib/protectedTokens.js
1420
+ var dayOfYearTokenRE = /^D+$/;
1421
+ var weekYearTokenRE = /^Y+$/;
1422
+ var throwTokens = ["D", "DD", "YY", "YYYY"];
1423
+ function isProtectedDayOfYearToken(token) {
1424
+ return dayOfYearTokenRE.test(token);
1425
+ }
1426
+ function isProtectedWeekYearToken(token) {
1427
+ return weekYearTokenRE.test(token);
1428
+ }
1429
+ function warnOrThrowProtectedError(token, format, input) {
1430
+ const _message = message(token, format, input);
1431
+ console.warn(_message);
1432
+ if (throwTokens.includes(token))
1433
+ throw new RangeError(_message);
1434
+ }
1435
+ function message(token, format, input) {
1436
+ const subject = token[0] === "Y" ? "years" : "days of the month";
1437
+ return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
1438
+ }
1439
+
1440
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/format.js
1441
+ var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
1442
+ var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
1443
+ var escapedStringRegExp = /^'([^]*?)'?$/;
1444
+ var doubleQuoteRegExp = /''/g;
1445
+ var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
1446
+ function format(date, formatStr, options) {
1447
+ const defaultOptions = getDefaultOptions();
1448
+ const locale = options?.locale ?? defaultOptions.locale ?? enUS;
1449
+ const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions.firstWeekContainsDate ?? defaultOptions.locale?.options?.firstWeekContainsDate ?? 1;
1450
+ const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions.weekStartsOn ?? defaultOptions.locale?.options?.weekStartsOn ?? 0;
1451
+ const originalDate = toDate(date, options?.in);
1452
+ if (!isValid(originalDate)) {
1453
+ throw new RangeError("Invalid time value");
1454
+ }
1455
+ let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => {
1456
+ const firstCharacter = substring[0];
1457
+ if (firstCharacter === "p" || firstCharacter === "P") {
1458
+ const longFormatter = longFormatters[firstCharacter];
1459
+ return longFormatter(substring, locale.formatLong);
1460
+ }
1461
+ return substring;
1462
+ }).join("").match(formattingTokensRegExp).map((substring) => {
1463
+ if (substring === "''") {
1464
+ return { isToken: false, value: "'" };
1465
+ }
1466
+ const firstCharacter = substring[0];
1467
+ if (firstCharacter === "'") {
1468
+ return { isToken: false, value: cleanEscapedString(substring) };
1469
+ }
1470
+ if (formatters[firstCharacter]) {
1471
+ return { isToken: true, value: substring };
1472
+ }
1473
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
1474
+ throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`");
1475
+ }
1476
+ return { isToken: false, value: substring };
1477
+ });
1478
+ if (locale.localize.preprocessor) {
1479
+ parts = locale.localize.preprocessor(originalDate, parts);
1480
+ }
1481
+ const formatterOptions = {
1482
+ firstWeekContainsDate,
1483
+ weekStartsOn,
1484
+ locale
1485
+ };
1486
+ return parts.map((part) => {
1487
+ if (!part.isToken)
1488
+ return part.value;
1489
+ const token = part.value;
1490
+ if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token) || !options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) {
1491
+ warnOrThrowProtectedError(token, formatStr, String(date));
1492
+ }
1493
+ const formatter = formatters[token[0]];
1494
+ return formatter(originalDate, token, locale.localize, formatterOptions);
1495
+ }).join("");
1496
+ }
1497
+ function cleanEscapedString(input) {
1498
+ const matched = input.match(escapedStringRegExp);
1499
+ if (!matched) {
1500
+ return input;
1501
+ }
1502
+ return matched[1].replace(doubleQuoteRegExp, "'");
1503
+ }
1504
+
1505
+ // ../../node_modules/.bun/date-fns@4.1.0/node_modules/date-fns/subDays.js
1506
+ function subDays(date, amount, options) {
1507
+ return addDays(date, -amount, options);
1508
+ }
1509
+
63
1510
  // ../core/src/local-models.ts
64
1511
  var LOCAL_RUNTIME_PREFIXES = [
65
1512
  "ollama",
@@ -84,7 +1531,7 @@ var HARNESS_CAPABILITIES = {
84
1531
  copilot: { tokens: true, cost: true, model: true, tools: true, agents: false, gitLines: true, dynamicWorkflows: false, activeTime: true, contextWindow: false, compaction: false, skills: false, mcpServers: false },
85
1532
  antigravity: { tokens: true, cost: true, model: true, tools: true, agents: false, gitLines: false, dynamicWorkflows: false, activeTime: true, contextWindow: true, compaction: false, skills: false, mcpServers: false },
86
1533
  kimi: { tokens: true, cost: true, model: true, tools: true, agents: false, gitLines: false, dynamicWorkflows: false, activeTime: true, contextWindow: true, compaction: false, skills: false, mcpServers: true },
87
- opencode: { tokens: true, cost: true, model: true, tools: false, agents: false, gitLines: false, dynamicWorkflows: false, activeTime: true, contextWindow: true, compaction: false, skills: false, mcpServers: false },
1534
+ opencode: { tokens: true, cost: true, model: true, tools: true, agents: false, gitLines: false, dynamicWorkflows: false, activeTime: true, contextWindow: true, compaction: false, skills: false, mcpServers: false },
88
1535
  hermes: { tokens: false, cost: false, model: false, tools: false, agents: false, gitLines: false, dynamicWorkflows: false, activeTime: false, contextWindow: false, compaction: false, skills: false, mcpServers: false },
89
1536
  agentistics: { tokens: true, cost: true, model: true, tools: true, agents: false, gitLines: false, dynamicWorkflows: false, activeTime: false, contextWindow: false, compaction: false, skills: false, mcpServers: false }
90
1537
  };
@@ -214,24 +1661,33 @@ function sessionCostUSD(s, fallbackModel) {
214
1661
  const entries = sessionModelUsage(s, fallbackModel);
215
1662
  if (entries.length === 0)
216
1663
  return null;
217
- const priced = entries.filter(([model]) => !isUnpricedModel(model));
1664
+ const priced = entries.filter(([model, u]) => u.costSource !== undefined || !isUnpricedModel(model));
218
1665
  if (priced.length === 0)
219
1666
  return null;
220
- return priced.reduce((sum, [model, u]) => sum + calcCost(u, model), 0);
1667
+ return priced.reduce((sum, [model, u]) => sum + (modelCostUSD(u, model) ?? 0), 0);
221
1668
  }
222
1669
  var usageTokens = (u) => u.inputTokens + u.outputTokens + u.cacheReadInputTokens + u.cacheCreationInputTokens;
223
1670
  function unpricedTokens(from, fallbackModel) {
224
1671
  if (Array.isArray(from)) {
225
- return from.reduce((sum, [model, u]) => sum + (isUnpricedModel(model) ? usageTokens(u) : 0), 0);
1672
+ return from.reduce((sum, [model, u]) => sum + (u.costSource !== undefined ? u.unpricedTokens ?? 0 : isUnpricedModel(model) ? usageTokens(u) : 0), 0);
226
1673
  }
227
1674
  const sess = from;
228
1675
  const entries = sessionModelUsage(sess, fallbackModel);
229
1676
  if (entries.length === 0) {
230
1677
  return (sess.input_tokens ?? 0) + (sess.output_tokens ?? 0) + (sess.cache_read_input_tokens ?? 0) + (sess.cache_creation_input_tokens ?? 0);
231
1678
  }
232
- return entries.reduce((sum, [model, u]) => sum + (isUnpricedModel(model) ? usageTokens(u) : 0), 0);
1679
+ return entries.reduce((sum, [model, u]) => sum + (u.costSource !== undefined ? u.unpricedTokens ?? 0 : isUnpricedModel(model) ? usageTokens(u) : 0), 0);
1680
+ }
1681
+ function modelCostUSD(usage, modelId) {
1682
+ if (usage.costSource !== undefined)
1683
+ return usage.costUSD;
1684
+ if (isUnpricedModel(modelId))
1685
+ return null;
1686
+ return calcCost(usage, modelId);
233
1687
  }
234
1688
  function calcCost(usage, modelId) {
1689
+ if (usage.costSource !== undefined)
1690
+ return usage.costUSD;
235
1691
  const price = getModelPrice(modelId);
236
1692
  const hasTtlBreakdown = usage.cacheCreation1hInputTokens !== undefined && usage.cacheCreation5mInputTokens !== undefined;
237
1693
  const cacheWriteCost = hasTtlBreakdown ? (usage.cacheCreation1hInputTokens ?? 0) / 1e6 * price.cacheWrite1h + (usage.cacheCreation5mInputTokens ?? 0) / 1e6 * price.cacheWrite : usage.cacheCreationInputTokens / 1e6 * price.cacheWrite;
@@ -312,6 +1768,18 @@ function totalTokens(b) {
312
1768
  function usageTokenTotal(u) {
313
1769
  return totalTokens(usageTokens2(u));
314
1770
  }
1771
+ // ../core/src/streak.ts
1772
+ function calcStreak(activeDates, today = new Date) {
1773
+ let streak = 0;
1774
+ for (let i = 0;i <= 365; i++) {
1775
+ const dateStr = format(subDays(today, i), "yyyy-MM-dd");
1776
+ if (activeDates.has(dateStr))
1777
+ streak++;
1778
+ else if (i > 0)
1779
+ break;
1780
+ }
1781
+ return streak;
1782
+ }
315
1783
  // ../core/src/team.ts
316
1784
  var DEFAULT_TEAM = Object.freeze({
317
1785
  schema: 2,
@@ -559,8 +2027,11 @@ async function allMetricGroups(q, params) {
559
2027
  groups.push(...a.body.groups);
560
2028
  basis = a.body.basis;
561
2029
  cursor = a.body.page.nextCursor;
562
- if (!cursor)
2030
+ if (!cursor) {
2031
+ if (groups.length === 0 && basis?.freshness?.journalHead === 0)
2032
+ throw new ProjectionUnavailable(200, "journal_empty");
563
2033
  return { groups, basis };
2034
+ }
564
2035
  }
565
2036
  throw new Error(`metrics query did not finish in ${MAX_PAGES} pages`);
566
2037
  }
@@ -1326,6 +2797,12 @@ var LOWER = "abcdefghijkmnopqrstuvwxyz";
1326
2797
  var DIGITS = "23456789";
1327
2798
  var SPECIALS = "!@#$%&*+-=?_";
1328
2799
  var ALL = UPPER + LOWER + DIGITS + SPECIALS;
2800
+ // ../core/src/costCell.ts
2801
+ function costState(unpriced, tokens) {
2802
+ if (!(unpriced > 0))
2803
+ return "priced";
2804
+ return unpriced >= tokens ? "unknown" : "partial";
2805
+ }
1329
2806
  // flow-status.ts
1330
2807
  function flowStatusRunId(runId) {
1331
2808
  if (!isFlowRunId(runId))
@@ -1406,6 +2883,7 @@ function sessionTokens2(s) {
1406
2883
  const priced = {
1407
2884
  model: s.model,
1408
2885
  model_usage: s.model_usage,
2886
+ tokens_unavailable: s.tokens_unavailable,
1409
2887
  input_tokens: input,
1410
2888
  output_tokens: output,
1411
2889
  cache_read_input_tokens: cacheRead,
@@ -1868,6 +3346,7 @@ function legacySummary(data, harness) {
1868
3346
  const modelTokens = {};
1869
3347
  const projectSessions = {};
1870
3348
  const activeDates = new Set;
3349
+ const localDates = new Set;
1871
3350
  for (const s of allSessions) {
1872
3351
  const { input, output, cacheRead, cacheWrite, cost, unpriced, tokensUnavailable } = sessionTokens2(s);
1873
3352
  totalUnpriced += unpriced;
@@ -1884,9 +3363,15 @@ function legacySummary(data, harness) {
1884
3363
  const root = canonicalProjectPath(s.project_path);
1885
3364
  projectSessions[root] = (projectSessions[root] ?? 0) + 1;
1886
3365
  }
1887
- if (s.start_time)
3366
+ if (s.start_time) {
1888
3367
  activeDates.add(String(s.start_time).slice(0, 10));
3368
+ const d = new Date(s.start_time);
3369
+ if (!Number.isNaN(d.getTime()))
3370
+ localDates.add(`${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`);
3371
+ }
1889
3372
  }
3373
+ const grandTokens = totalInput + totalOutput + totalCacheRead + totalCacheWrite;
3374
+ const allUnpriced = totalUnpriced > 0 && totalUnpriced >= grandTokens && totalCostUSD === 0 && !(unified || harness === "claude" ? totals.cost : 0);
1890
3375
  const claudeFallback = unified || harness === "claude";
1891
3376
  const topModel = Object.entries(modelTokens).sort(([, a], [, b]) => b - a)[0]?.[0] ?? (claudeFallback ? totals.topModel ?? "—" : "—");
1892
3377
  const topProject = Object.entries(projectSessions).sort(([, a], [, b]) => b - a)[0]?.[0] ?? "—";
@@ -1896,13 +3381,13 @@ function legacySummary(data, harness) {
1896
3381
  totalOutputTokens: totalOutput || (claudeFallback ? totals.output : 0),
1897
3382
  totalCacheReadTokens: totalCacheRead || (claudeFallback ? totals.cacheRead : 0),
1898
3383
  totalCacheWriteTokens: totalCacheWrite || (claudeFallback ? totals.cacheWrite : 0),
1899
- estimatedCostUSD: Math.round((totalCostUSD || (claudeFallback ? totals.cost : 0)) * 100) / 100,
3384
+ estimatedCostUSD: allUnpriced ? null : Math.round((totalCostUSD || (claudeFallback ? totals.cost : 0)) * 100) / 100,
1900
3385
  ...totalUnpriced > 0 ? { unpricedTokens: totalUnpriced, costNote: "estimatedCostUSD excludes usage of models with no price (+ unpriced usage)" } : {},
1901
3386
  totalSessions: allSessions.length,
1902
3387
  topModel,
1903
3388
  topProject,
1904
3389
  activeDays: activeDates.size || (claudeFallback ? sc.activeDays ?? 0 : 0),
1905
- currentStreak: claudeFallback ? sc.currentStreak ?? 0 : null
3390
+ currentStreak: unified ? Math.max(localDates.size > 0 ? calcStreak(localDates) : 0, sc.currentStreak ?? 0) : harness === "claude" ? sc.currentStreak ?? 0 : localDates.size > 0 ? calcStreak(localDates) : null
1906
3391
  };
1907
3392
  }
1908
3393
  function legacyHarnesses(data) {
@@ -1910,9 +3395,10 @@ function legacyHarnesses(data) {
1910
3395
  const sessions = data.sessions ?? [];
1911
3396
  const rows = present.map((h) => {
1912
3397
  const hs = sessions.filter((s) => sessionHarness(s) === h);
1913
- let input = 0, output = 0, cacheRead = 0, cacheWrite = 0, cost = 0, messages = 0, lastActive = "";
3398
+ let input = 0, output = 0, cacheRead = 0, cacheWrite = 0, cost = 0, unpricedSum = 0, messages = 0, lastActive = "";
1914
3399
  for (const s of hs) {
1915
3400
  const t = sessionTokens2(s);
3401
+ unpricedSum += t.unpriced;
1916
3402
  if (!t.tokensUnavailable) {
1917
3403
  input += t.input;
1918
3404
  output += t.output;
@@ -1933,7 +3419,8 @@ function legacyHarnesses(data) {
1933
3419
  cacheReadTokens: cacheRead,
1934
3420
  cacheWriteTokens: cacheWrite,
1935
3421
  totalTokens: input + output + cacheRead + cacheWrite,
1936
- estimatedCostUSD: Math.round(cost * 100) / 100,
3422
+ estimatedCostUSD: costState(unpricedSum, input + output + cacheRead + cacheWrite) === "unknown" ? null : Math.round(cost * 100) / 100,
3423
+ ...unpricedSum > 0 ? { unpricedTokens: unpricedSum } : {},
1937
3424
  lastActive: lastActive || null
1938
3425
  };
1939
3426
  }).sort((a, b) => b.totalTokens - a.totalTokens);
@@ -1947,10 +3434,11 @@ function legacyProjects(data, harness) {
1947
3434
  if (!key)
1948
3435
  continue;
1949
3436
  if (!byPath[key])
1950
- byPath[key] = { sessions: 0, inputTokens: 0, outputTokens: 0, cacheRead: 0, cacheWrite: 0, costUSD: 0, messages: 0, lastActive: "", languages: [] };
3437
+ byPath[key] = { sessions: 0, inputTokens: 0, outputTokens: 0, cacheRead: 0, cacheWrite: 0, costUSD: 0, unpriced: 0, messages: 0, lastActive: "", languages: [] };
1951
3438
  const agg = byPath[key];
1952
- const { input, output, cacheRead, cacheWrite, cost, tokensUnavailable } = sessionTokens2(s);
3439
+ const { input, output, cacheRead, cacheWrite, cost, unpriced, tokensUnavailable } = sessionTokens2(s);
1953
3440
  agg.sessions += 1;
3441
+ agg.unpriced += unpriced;
1954
3442
  if (!tokensUnavailable) {
1955
3443
  agg.inputTokens += input;
1956
3444
  agg.outputTokens += output;
@@ -1976,7 +3464,7 @@ function legacyProjects(data, harness) {
1976
3464
  }
1977
3465
  const projects = [...roots.values()];
1978
3466
  const summary = projects.filter((p) => !harness || harness === "all" || byPath[p.path]).map((p) => {
1979
- const agg = byPath[p.path] ?? { sessions: 0, inputTokens: 0, outputTokens: 0, cacheRead: 0, cacheWrite: 0, costUSD: 0, messages: 0, lastActive: "", languages: [] };
3467
+ const agg = byPath[p.path] ?? { sessions: 0, inputTokens: 0, outputTokens: 0, cacheRead: 0, cacheWrite: 0, costUSD: 0, unpriced: 0, messages: 0, lastActive: "", languages: [] };
1980
3468
  return {
1981
3469
  name: p.name,
1982
3470
  path: p.path,
@@ -1985,7 +3473,8 @@ function legacyProjects(data, harness) {
1985
3473
  inputTokens: agg.inputTokens,
1986
3474
  outputTokens: agg.outputTokens,
1987
3475
  totalTokens: agg.inputTokens + agg.outputTokens,
1988
- estimatedCostUSD: Math.round(agg.costUSD * 1e4) / 1e4,
3476
+ estimatedCostUSD: costState(agg.unpriced, agg.inputTokens + agg.outputTokens + agg.cacheRead + agg.cacheWrite) === "unknown" ? null : Math.round(agg.costUSD * 1e4) / 1e4,
3477
+ ...agg.unpriced > 0 ? { unpricedTokens: agg.unpriced } : {},
1989
3478
  lastActive: agg.lastActive || null,
1990
3479
  languages: agg.languages
1991
3480
  };
@@ -2038,10 +3527,11 @@ function legacyRepos(data, harness) {
2038
3527
  for (const s of allSessions) {
2039
3528
  const key = s.git_remote || "";
2040
3529
  if (!byRemote[key])
2041
- byRemote[key] = { sessions: 0, messages: 0, inputTokens: 0, outputTokens: 0, cacheRead: 0, cacheWrite: 0, costUSD: 0, lastActive: "" };
3530
+ byRemote[key] = { sessions: 0, messages: 0, inputTokens: 0, outputTokens: 0, cacheRead: 0, cacheWrite: 0, costUSD: 0, unpriced: 0, lastActive: "" };
2042
3531
  const agg = byRemote[key];
2043
- const { input, output, cacheRead, cacheWrite, cost, tokensUnavailable } = sessionTokens2(s);
3532
+ const { input, output, cacheRead, cacheWrite, cost, unpriced, tokensUnavailable } = sessionTokens2(s);
2044
3533
  agg.sessions += 1;
3534
+ agg.unpriced += unpriced;
2045
3535
  agg.messages += sessionMessages(s);
2046
3536
  if (!tokensUnavailable) {
2047
3537
  agg.inputTokens += input;
@@ -2061,7 +3551,8 @@ function legacyRepos(data, harness) {
2061
3551
  inputTokens: agg.inputTokens,
2062
3552
  outputTokens: agg.outputTokens,
2063
3553
  totalTokens: agg.inputTokens + agg.outputTokens + agg.cacheRead + agg.cacheWrite,
2064
- estimatedCostUSD: Math.round(agg.costUSD * 1e4) / 1e4,
3554
+ estimatedCostUSD: costState(agg.unpriced, agg.inputTokens + agg.outputTokens + agg.cacheRead + agg.cacheWrite) === "unknown" ? null : Math.round(agg.costUSD * 1e4) / 1e4,
3555
+ ...agg.unpriced > 0 ? { unpricedTokens: agg.unpriced } : {},
2065
3556
  lastActive: agg.lastActive || null
2066
3557
  })).sort((a, b) => b.totalTokens - a.totalTokens);
2067
3558
  return rows;
@@ -2497,7 +3988,7 @@ var TOOLS = [
2497
3988
  id: { type: "string" },
2498
3989
  done: {
2499
3990
  type: "boolean",
2500
- description: "Send ALONE with `id` (no other field) for the tick — `{id, done}` is a fast path straight to the done/todo transition. Sent TOGETHER with `parentGroupId` (or any other named field below) in the same call, `done` is silently dropped rather than applied — this tool forwards only the named fields when one is present. Send them as two separate calls instead: join/leave the group first, then set `done` in its own call."
3991
+ description: "Send with `id` to tick (true -> status `done`) or untick (false -> `todo`). Alone it is the fast path; together with named fields (title, dates, status, parentGroupId, …) it is applied in the SAME edit — never dropped. A `status` that contradicts it (done=true with status `in_review`) is refused. With `parentGroupId` the tool joins the group first and then closes. `done` is still refused without a session filed under the subtask (done_needs_session)."
2501
3992
  },
2502
3993
  status: {
2503
3994
  type: "string",
@@ -2516,7 +4007,7 @@ var TOOLS = [
2516
4007
  },
2517
4008
  parentGroupId: {
2518
4009
  type: "string",
2519
- description: "Join this subtask (named by `id`) to the group whose id this names — a group of the SAME parent task. Pass an empty string to leave the current group. Refused (422, `invalid_group`) if the id is not an actual group of this task, or if this subtask is itself a group. Refused (422, `subtask_has_sessions`) if this subtask already has a session filed on it — detach it first. **Do not send `done` in this same call** — see `done`'s own description; make it a second call."
4010
+ description: "Join this subtask (named by `id`) to the group whose id this names — a group of the SAME parent task. Pass an empty string to leave the current group. Refused (422, `invalid_group`) if the id is not an actual group of this task, or if this subtask is itself a group. Refused (422, `subtask_has_sessions`) if this subtask already has a session filed on it — detach it first. **With `done` in the same call the tool joins first and then closes, in order.**"
2520
4011
  }
2521
4012
  },
2522
4013
  required: ["ref"]
@@ -2587,7 +4078,7 @@ var TOOLS = [
2587
4078
  },
2588
4079
  {
2589
4080
  name: "agentistics_live_delivery",
2590
- description: 'What is being DELIVERED right now — the Live Delivery line, the same source as the screen. Use it to answer "what is running", "when does X ship" and "is anything stalled". Returns a `summary` (active deliveries, agents working, stalled, the next delivery with an estimate), the active `deliveries` with their stage (queue, running, qa, adjust, leader, merge, published), the agents on each (harness, model, account, live state), time in the stage and in total, the step inside the stage (`step`, with `stepSource` = `reported` or `signals` and `stepSignal` naming the observed fact — null `step` means nothing is observable, say so; the screen then draws no percent), the ETA with its source and confidence (`kind: none` means there is NO estimate — say so, never invent a time), the last action, and the `leaders` band (each leader\'s current action, its workers and what waits on a decision — leaders are never deliveries). Each delivery carries its Agentask `priority` (urgent | high | medium | low; a subtask inherits its task\'s). Filters: `task` (id or part of the title), `stage`, `stalledOnly`, and the screen\'s own tabs — `tab`: `active` (Em andamento: only what has an agent working or waiting), `queue` (Na fila), `published` (Publicado) or `all` (Tudo: every piece in its real column, old legacy reviews marked `old`; the default here, while the screen opens on `active`) — and `period`, the Publicado period: `24h` (default), `7d`, `30d` or `all`. The answer\'s `view` carries `{tab, period, counts, defaulted, capped}`: `tab`/`period` are the EFFECTIVE values (a missing or invalid one falls back to `all` / `24h`, and `defaulted` names which did), `counts` is the count of EVERY tab under the same `task` filter and period, the very numbers the screen\'s tabs print, and `capped` (`{cap, omitted}`, else null) says the list was cut at 400 pieces per kind and that many older ones are NOT in the answer — then a count is not the total. Plus `sort` (how each stage lists its cards; default `priority`, highest first, ties by longest in the stage). Stage names on screen: queue = Na fila, running = Em desenvolvimento, qa = QA. There is no Histórico column any more: a piece published earlier is in `deliveries` whenever `period` covers it.',
4081
+ description: 'What is being DELIVERED right now — the Live Delivery line, the same source as the screen. Use it to answer "what is running", "when does X ship" and "is anything stalled". Returns a `summary` (active deliveries, agents working, stalled, the next delivery with an estimate), the active `deliveries` with their stage (queue, running, qa, adjust, leader, merge, published), the agents on each (harness, model, account, live state), time in the stage and in total, the step inside the stage (`step`, with `stepSource` = `reported` or `signals` and `stepSignal` naming the observed fact — null `step` means nothing is observable, say so; the screen then draws no percent), the ETA with its source and confidence (`kind: none` means there is NO estimate — say so, never invent a time), the last action, and the `leaders` band (each leader\'s current action, its workers and what waits on a decision — leaders are not deliveries while the task has an open piece of its own; a leader working alone on a task with none gets ONE piece, `leaderPiece: true`, on the leader session\'s own clock). Each delivery carries its Agentask `priority` (urgent | high | medium | low; a subtask inherits its task\'s). Filters: `task` (id or part of the title), `stage`, `stalledOnly`, and the screen\'s own tabs — `tab`: `active` (Em andamento: every stage except queue, published, completed and old — a blocked or adjusting piece with no agent on it is in), `queue` (Na fila), `published` (Publicado) or `all` (Tudo: every piece in its real column, old legacy reviews marked `old`; the default here, while the screen opens on `active`) — and `period`, the Publicado period: `24h` (default), `7d`, `30d` or `all`. The answer\'s `view` carries `{tab, period, counts, defaulted, capped}`: `tab`/`period` are the EFFECTIVE values (a missing or invalid one falls back to `all` / `24h`, and `defaulted` names which did), `counts` is the count of EVERY tab under the same `task` filter and period, the very numbers the screen\'s tabs print, and `capped` (`{cap, omitted}`, else null) says the list was cut at 400 pieces per kind and that many older ones are NOT in the answer — then a count is not the total. Plus `sort` (how each stage lists its cards; default `priority`, highest first, ties by longest in the stage). Stage names on screen: queue = Na fila, running = Em desenvolvimento, qa = QA. There is no Histórico column any more: a piece published earlier is in `deliveries` whenever `period` covers it.',
2591
4082
  inputSchema: {
2592
4083
  type: "object",
2593
4084
  properties: {
@@ -3243,7 +4734,25 @@ async function callTool(req) {
3243
4734
  const cols = ["status", "dueDate", "startDate", "title", "parentGroupId"];
3244
4735
  const named = cols.filter((c) => typeof a?.[c] === "string");
3245
4736
  const blockedBy = Array.isArray(a?.blockedBy) ? { blockedBy: a.blockedBy } : {};
3246
- const payload = a?.id !== undefined ? named.length > 0 || Array.isArray(a?.blockedBy) ? { id: a.id, ...Object.fromEntries(named.map((c) => [c, a[c]])), ...blockedBy } : { id: a.id, done: a?.done === true } : { title: a?.title, ...a?.isGroup === true ? { isGroup: true } : {} };
4737
+ const wantsDone = typeof a?.done === "boolean" ? a.done : undefined;
4738
+ const doneStatus = wantsDone === undefined ? undefined : wantsDone ? "done" : "todo";
4739
+ if (a?.id !== undefined && doneStatus !== undefined && named.length > 0 && typeof a?.status === "string" && (wantsDone ? a.status !== "done" : a.status === "done")) {
4740
+ throw new Error(`agentistics_task_subtask: done=${wantsDone} conflicts with status="${a.status}" — send one of them (status "${doneStatus}" is what done=${wantsDone} means).`);
4741
+ }
4742
+ const edit = (withStatus, omit = []) => ({
4743
+ id: a.id,
4744
+ ...Object.fromEntries(named.filter((c) => !omit.includes(c) && (c !== "status" || withStatus)).map((c) => [c, a[c]])),
4745
+ ...withStatus && doneStatus !== undefined && typeof a?.status !== "string" ? { status: doneStatus } : {},
4746
+ ...blockedBy
4747
+ });
4748
+ const joining = a?.id !== undefined && doneStatus !== undefined && typeof a?.parentGroupId === "string" && a.parentGroupId !== "";
4749
+ if (joining) {
4750
+ const path = `/api/tasks/${encodeURIComponent(String(a?.ref))}/subtasks`;
4751
+ await apiSend("POST", path, edit(false));
4752
+ const body = await apiSend("POST", path, { id: a.id, status: typeof a?.status === "string" ? a.status : doneStatus });
4753
+ return { content: [{ type: "text", text: JSON.stringify(body, null, 2) }] };
4754
+ }
4755
+ const payload = a?.id !== undefined ? named.length > 0 || Array.isArray(a?.blockedBy) ? edit(true) : { id: a.id, done: a?.done === true } : { title: a?.title, ...a?.isGroup === true ? { isGroup: true } : {} };
3247
4756
  const body = await apiSend("POST", `/api/tasks/${encodeURIComponent(String(a?.ref))}/subtasks`, payload);
3248
4757
  return { content: [{ type: "text", text: JSON.stringify(body, null, 2) }] };
3249
4758
  }
@@ -3598,6 +5107,8 @@ async function callTool(req) {
3598
5107
  ...unpriced > 0 ? { unpricedTokens: unpriced } : {},
3599
5108
  model: s.model ?? null,
3600
5109
  ...contextFields(s),
5110
+ ...s.tokens_unavailable ? { usageNote: "usage not reported" } : {},
5111
+ ...Object.values(s.model_usage ?? {}).some((u) => u.costSource === "harness") ? { costSource: "harness", costNote: "declared by the harness" } : {},
3601
5112
  ...startedBy.get(s.session_id) ? { startedBy: startedBy.get(s.session_id) } : {},
3602
5113
  ...delivered.get(s.session_id) ? { deliveredStillOpen: delivered.get(s.session_id) } : {}
3603
5114
  };