@supatest/cli 0.0.16 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/claude-code-cli.js +1639 -1823
- package/dist/index.js +1212 -892
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -371,75 +371,62 @@ var init_planner = __esm({
|
|
|
371
371
|
"src/prompts/planner.ts"() {
|
|
372
372
|
"use strict";
|
|
373
373
|
plannerPrompt = `<role>
|
|
374
|
-
You are
|
|
374
|
+
You are Supatest AI, a Senior QA Engineer planning E2E tests. You think in user journeys and business risk, not code coverage. Your job: minimum tests for maximum confidence.
|
|
375
375
|
</role>
|
|
376
376
|
|
|
377
|
-
<
|
|
377
|
+
<core_principles>
|
|
378
|
+
Before planning ANY test, ask:
|
|
379
|
+
1. "What user journey does this protect?" - Test workflows, not UI components
|
|
380
|
+
2. "What's the risk if this breaks?" - High risk \u2192 thorough; Low risk \u2192 smoke test or skip
|
|
381
|
+
3. "Would a user notice?" - If no, don't test it
|
|
382
|
+
4. "Can one test cover this?" - Prefer ONE journey test over MANY element tests
|
|
383
|
+
5. "What's the maintenance cost?" - Every selector is a break point
|
|
384
|
+
|
|
385
|
+
Risk levels:
|
|
386
|
+
- **High** (auth, payments, data mutations, core workflows) \u2192 Thorough coverage
|
|
387
|
+
- **Medium** (forms, navigation, search) \u2192 Happy path only
|
|
388
|
+
- **Low** (read-only dashboards, static pages) \u2192 Single smoke test or skip
|
|
389
|
+
</core_principles>
|
|
390
|
+
|
|
391
|
+
<code_first>
|
|
378
392
|
**Code Answers Everything.** Before asking ANY question:
|
|
379
393
|
1. Search for the relevant component/API
|
|
380
394
|
2. Read the implementation
|
|
381
395
|
3. Check conditionals, handlers, and data flow
|
|
382
396
|
|
|
383
|
-
Only ask about undefined business logic or incomplete implementations
|
|
397
|
+
Only ask about undefined business logic or incomplete implementations.
|
|
384
398
|
Never ask about routing, data scope, UI interactions, empty states, or error handling - these are in the code.
|
|
385
|
-
</
|
|
386
|
-
|
|
387
|
-
<
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
- High-risk areas (complex logic, integrations)
|
|
407
|
-
- Error handling and validation
|
|
408
|
-
|
|
409
|
-
**What NOT to cover:**
|
|
410
|
-
- Every edge case permutation
|
|
411
|
-
- Implementation details
|
|
412
|
-
- Trivial functionality
|
|
413
|
-
- Same pattern repeated across features
|
|
414
|
-
</test_coverage>
|
|
415
|
-
|
|
416
|
-
<analysis_tasks>
|
|
417
|
-
- Explore the application structure and routes
|
|
418
|
-
- Identify key UI components and their interactions
|
|
419
|
-
- Map user authentication and authorization flows
|
|
420
|
-
- Document form validations and error handling
|
|
421
|
-
- Identify async operations that need proper waits
|
|
422
|
-
- Note any third-party integrations or API dependencies
|
|
423
|
-
</analysis_tasks>
|
|
424
|
-
|
|
425
|
-
<plan_output>
|
|
426
|
-
Your E2E test plan should include:
|
|
427
|
-
1. Test suite overview - what user flows are being tested
|
|
428
|
-
2. Test cases with clear descriptions and priority levels
|
|
429
|
-
3. Step-by-step test actions (click, type, navigate, assert)
|
|
430
|
-
4. Expected outcomes and assertions for each test
|
|
431
|
-
5. Test data requirements (users, fixtures, mock data)
|
|
432
|
-
6. Selector strategy (data-testid, aria-labels, etc.)
|
|
433
|
-
7. Setup and teardown requirements
|
|
434
|
-
8. Potential flakiness risks and mitigation strategies
|
|
435
|
-
</plan_output>
|
|
399
|
+
</code_first>
|
|
400
|
+
|
|
401
|
+
<output_format>
|
|
402
|
+
**Risk Assessment**: [HIGH/MEDIUM/LOW] - one line justification
|
|
403
|
+
**User Journeys**: "User can [action] to [achieve goal]"
|
|
404
|
+
**Test Cases**: Name, assertions, test data needs
|
|
405
|
+
**Not Testing**: What you're skipping and why (shows judgment)
|
|
406
|
+
</output_format>
|
|
407
|
+
|
|
408
|
+
<example>
|
|
409
|
+
**Scenario**: Read-only analytics dashboard
|
|
410
|
+
|
|
411
|
+
**Risk Assessment**: LOW - Read-only display, no mutations, no business-critical actions
|
|
412
|
+
|
|
413
|
+
**User Journeys**: User can view their analytics dashboard
|
|
414
|
+
|
|
415
|
+
**Test Cases**:
|
|
416
|
+
1. "displays dashboard with data" - Page loads, chart visible, metrics shown
|
|
417
|
+
|
|
418
|
+
**Not Testing**: Individual chart details, tooltip interactions, loading skeletons (implementation details, not user value)
|
|
419
|
+
</example>
|
|
436
420
|
|
|
437
421
|
<constraints>
|
|
438
|
-
-
|
|
439
|
-
- Do NOT write tests
|
|
440
|
-
-
|
|
441
|
-
|
|
442
|
-
|
|
422
|
+
- ONLY use read-only tools: Read, Glob, Grep, Task
|
|
423
|
+
- Do NOT write tests or modify files
|
|
424
|
+
- Present findings for user review before implementation
|
|
425
|
+
</constraints>
|
|
426
|
+
|
|
427
|
+
<golden_rule>
|
|
428
|
+
The best test plan catches meaningful regressions with minimum maintenance burden. One good journey test beats ten shallow element tests.
|
|
429
|
+
</golden_rule>`;
|
|
443
430
|
}
|
|
444
431
|
});
|
|
445
432
|
|
|
@@ -488,25 +475,25 @@ var init_config = __esm({
|
|
|
488
475
|
});
|
|
489
476
|
|
|
490
477
|
// ../shared/dist/shared.es.mjs
|
|
491
|
-
function Be(t) {
|
|
492
|
-
return t.replace(/-\d{8}$/, "");
|
|
493
|
-
}
|
|
494
478
|
function We(t) {
|
|
495
|
-
|
|
496
|
-
return Ee.find((r) => r.id === e);
|
|
479
|
+
return t.replace(qe, "");
|
|
497
480
|
}
|
|
498
|
-
function
|
|
481
|
+
function Ge(t) {
|
|
499
482
|
const e = We(t);
|
|
483
|
+
return ke.find((r) => r.id === e);
|
|
484
|
+
}
|
|
485
|
+
function St(t) {
|
|
486
|
+
const e = Ge(t);
|
|
500
487
|
return (e == null ? void 0 : e.name) ?? t;
|
|
501
488
|
}
|
|
502
|
-
function
|
|
503
|
-
return
|
|
489
|
+
function Lt(t) {
|
|
490
|
+
return ke.some((e) => t === e.id || t.startsWith(`${e.id}-`));
|
|
504
491
|
}
|
|
505
|
-
function
|
|
506
|
-
return
|
|
492
|
+
function _e() {
|
|
493
|
+
return Qe;
|
|
507
494
|
}
|
|
508
|
-
function
|
|
509
|
-
const r =
|
|
495
|
+
function u(t, e) {
|
|
496
|
+
const r = _e(), n = pe({
|
|
510
497
|
issueData: e,
|
|
511
498
|
data: t.data,
|
|
512
499
|
path: t.path,
|
|
@@ -517,7 +504,7 @@ function d(t, e) {
|
|
|
517
504
|
// then schema-bound map if available
|
|
518
505
|
r,
|
|
519
506
|
// then global override map
|
|
520
|
-
r ===
|
|
507
|
+
r === ee ? void 0 : ee
|
|
521
508
|
// then global default map
|
|
522
509
|
].filter((s) => !!s)
|
|
523
510
|
});
|
|
@@ -530,29 +517,29 @@ function g(t) {
|
|
|
530
517
|
if (e && (r || n))
|
|
531
518
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
532
519
|
return e ? { errorMap: e, description: s } : { errorMap: (i, o) => {
|
|
533
|
-
const { message:
|
|
534
|
-
return i.code === "invalid_enum_value" ? { message:
|
|
520
|
+
const { message: f } = t;
|
|
521
|
+
return i.code === "invalid_enum_value" ? { message: f ?? o.defaultError } : typeof o.data > "u" ? { message: f ?? n ?? o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: f ?? r ?? o.defaultError };
|
|
535
522
|
}, description: s };
|
|
536
523
|
}
|
|
537
|
-
function
|
|
524
|
+
function Ve(t) {
|
|
538
525
|
let e = "[0-5]\\d";
|
|
539
526
|
t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`);
|
|
540
527
|
const r = t.precision ? "+" : "?";
|
|
541
528
|
return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`;
|
|
542
529
|
}
|
|
543
|
-
function
|
|
544
|
-
return new RegExp(`^${
|
|
530
|
+
function ht(t) {
|
|
531
|
+
return new RegExp(`^${Ve(t)}$`);
|
|
545
532
|
}
|
|
546
|
-
function
|
|
547
|
-
let e = `${
|
|
533
|
+
function ft(t) {
|
|
534
|
+
let e = `${$e}T${Ve(t)}`;
|
|
548
535
|
const r = [];
|
|
549
536
|
return r.push(t.local ? "Z?" : "Z"), t.offset && r.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${r.join("|")})`, new RegExp(`^${e}$`);
|
|
550
537
|
}
|
|
551
|
-
function
|
|
552
|
-
return !!((e === "v4" || !e) &&
|
|
538
|
+
function mt(t, e) {
|
|
539
|
+
return !!((e === "v4" || !e) && at.test(t) || (e === "v6" || !e) && ot.test(t));
|
|
553
540
|
}
|
|
554
|
-
function
|
|
555
|
-
if (!
|
|
541
|
+
function _t(t, e) {
|
|
542
|
+
if (!tt.test(t))
|
|
556
543
|
return false;
|
|
557
544
|
try {
|
|
558
545
|
const [r] = t.split(".");
|
|
@@ -564,19 +551,19 @@ function ft(t, e) {
|
|
|
564
551
|
return false;
|
|
565
552
|
}
|
|
566
553
|
}
|
|
567
|
-
function
|
|
568
|
-
return !!((e === "v4" || !e) &&
|
|
554
|
+
function pt(t, e) {
|
|
555
|
+
return !!((e === "v4" || !e) && it.test(t) || (e === "v6" || !e) && ct.test(t));
|
|
569
556
|
}
|
|
570
|
-
function
|
|
557
|
+
function yt(t, e) {
|
|
571
558
|
const r = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = r > n ? r : n, a = Number.parseInt(t.toFixed(s).replace(".", "")), i = Number.parseInt(e.toFixed(s).replace(".", ""));
|
|
572
559
|
return a % i / 10 ** s;
|
|
573
560
|
}
|
|
574
|
-
function
|
|
561
|
+
function Y(t) {
|
|
575
562
|
if (t instanceof x) {
|
|
576
563
|
const e = {};
|
|
577
564
|
for (const r in t.shape) {
|
|
578
565
|
const n = t.shape[r];
|
|
579
|
-
e[r] =
|
|
566
|
+
e[r] = Z.create(Y(n));
|
|
580
567
|
}
|
|
581
568
|
return new x({
|
|
582
569
|
...t._def,
|
|
@@ -584,43 +571,43 @@ function G(t) {
|
|
|
584
571
|
});
|
|
585
572
|
} else return t instanceof D ? new D({
|
|
586
573
|
...t._def,
|
|
587
|
-
type:
|
|
588
|
-
}) : t instanceof
|
|
574
|
+
type: Y(t.element)
|
|
575
|
+
}) : t instanceof Z ? Z.create(Y(t.unwrap())) : t instanceof q ? q.create(Y(t.unwrap())) : t instanceof P ? P.create(t.items.map((e) => Y(e))) : t;
|
|
589
576
|
}
|
|
590
|
-
function
|
|
577
|
+
function ve(t, e) {
|
|
591
578
|
const r = j(t), n = j(e);
|
|
592
579
|
if (t === e)
|
|
593
580
|
return { valid: true, data: t };
|
|
594
|
-
if (r ===
|
|
595
|
-
const s =
|
|
581
|
+
if (r === l.object && n === l.object) {
|
|
582
|
+
const s = k.objectKeys(e), a = k.objectKeys(t).filter((o) => s.indexOf(o) !== -1), i = { ...t, ...e };
|
|
596
583
|
for (const o of a) {
|
|
597
|
-
const
|
|
598
|
-
if (!
|
|
584
|
+
const f = ve(t[o], e[o]);
|
|
585
|
+
if (!f.valid)
|
|
599
586
|
return { valid: false };
|
|
600
|
-
i[o] =
|
|
587
|
+
i[o] = f.data;
|
|
601
588
|
}
|
|
602
589
|
return { valid: true, data: i };
|
|
603
|
-
} else if (r ===
|
|
590
|
+
} else if (r === l.array && n === l.array) {
|
|
604
591
|
if (t.length !== e.length)
|
|
605
592
|
return { valid: false };
|
|
606
593
|
const s = [];
|
|
607
594
|
for (let a = 0; a < t.length; a++) {
|
|
608
|
-
const i = t[a], o = e[a],
|
|
609
|
-
if (!
|
|
595
|
+
const i = t[a], o = e[a], f = ve(i, o);
|
|
596
|
+
if (!f.valid)
|
|
610
597
|
return { valid: false };
|
|
611
|
-
s.push(
|
|
598
|
+
s.push(f.data);
|
|
612
599
|
}
|
|
613
600
|
return { valid: true, data: s };
|
|
614
|
-
} else return r ===
|
|
601
|
+
} else return r === l.date && n === l.date && +t == +e ? { valid: true, data: t } : { valid: false };
|
|
615
602
|
}
|
|
616
|
-
function
|
|
617
|
-
return new
|
|
603
|
+
function Fe(t, e) {
|
|
604
|
+
return new z({
|
|
618
605
|
values: t,
|
|
619
606
|
typeName: p.ZodEnum,
|
|
620
607
|
...g(e)
|
|
621
608
|
});
|
|
622
609
|
}
|
|
623
|
-
function
|
|
610
|
+
function or(t) {
|
|
624
611
|
return {
|
|
625
612
|
Grep: "Search",
|
|
626
613
|
Glob: "Search",
|
|
@@ -628,11 +615,11 @@ function er(t) {
|
|
|
628
615
|
BashOutput: "Command Output"
|
|
629
616
|
}[t] || t;
|
|
630
617
|
}
|
|
631
|
-
var
|
|
618
|
+
var ke, Mt, qe, Ut, k, Re, l, j, c, R, ee, Qe, pe, O, _, J, A, Ie, we, X, ne, m, M, De, v, Xe, Ke, Je, He, et, tt, rt, nt, st, me, at, it, ot, ct, dt, ut, $e, lt, w, V, F, se, K, Me, ye, ge, Se, Q, C, Le, D, x, ae, U, xe, ie, P, oe, Ue, te, H, Te, ce, z, Ee, re, B, Z, q, de, ue, Ze, ze, be, le, p, d, E, Oe, I, G, S, y, gt, Be, $, Pe, b, L, vt, he, je, Zt, Pt, jt, Ct, $t, Tt, Ce, Ae, Vt, Ft, Et, zt, Bt, kt, qt, xt, bt, Ot, At, Nt, Rt, W, Gt, Yt, Qt, Xt, Kt, Jt, Ht, It, wt, Dt, er, tr;
|
|
632
619
|
var init_shared_es = __esm({
|
|
633
620
|
"../shared/dist/shared.es.mjs"() {
|
|
634
621
|
"use strict";
|
|
635
|
-
|
|
622
|
+
ke = [
|
|
636
623
|
{
|
|
637
624
|
id: "claude-sonnet-4-5",
|
|
638
625
|
name: "Sonnet 4.5",
|
|
@@ -652,9 +639,10 @@ var init_shared_es = __esm({
|
|
|
652
639
|
contextWindow: 2e5
|
|
653
640
|
}
|
|
654
641
|
];
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
642
|
+
Mt = "claude-sonnet-4-5";
|
|
643
|
+
qe = /-\d{8}$/;
|
|
644
|
+
Ut = Object.fromEntries(
|
|
645
|
+
ke.map((t) => [t.id, t.contextWindow])
|
|
658
646
|
);
|
|
659
647
|
(function(t) {
|
|
660
648
|
t.assertEqual = (s) => {
|
|
@@ -691,15 +679,15 @@ var init_shared_es = __esm({
|
|
|
691
679
|
return s.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
|
|
692
680
|
}
|
|
693
681
|
t.joinValues = n, t.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
|
|
694
|
-
})(
|
|
682
|
+
})(k || (k = {}));
|
|
695
683
|
(function(t) {
|
|
696
684
|
t.mergeShapes = (e, r) => ({
|
|
697
685
|
...e,
|
|
698
686
|
...r
|
|
699
687
|
// second overwrites first
|
|
700
688
|
});
|
|
701
|
-
})(
|
|
702
|
-
|
|
689
|
+
})(Re || (Re = {}));
|
|
690
|
+
l = k.arrayToEnum([
|
|
703
691
|
"string",
|
|
704
692
|
"nan",
|
|
705
693
|
"number",
|
|
@@ -724,26 +712,26 @@ var init_shared_es = __esm({
|
|
|
724
712
|
j = (t) => {
|
|
725
713
|
switch (typeof t) {
|
|
726
714
|
case "undefined":
|
|
727
|
-
return
|
|
715
|
+
return l.undefined;
|
|
728
716
|
case "string":
|
|
729
|
-
return
|
|
717
|
+
return l.string;
|
|
730
718
|
case "number":
|
|
731
|
-
return Number.isNaN(t) ?
|
|
719
|
+
return Number.isNaN(t) ? l.nan : l.number;
|
|
732
720
|
case "boolean":
|
|
733
|
-
return
|
|
721
|
+
return l.boolean;
|
|
734
722
|
case "function":
|
|
735
|
-
return
|
|
723
|
+
return l.function;
|
|
736
724
|
case "bigint":
|
|
737
|
-
return
|
|
725
|
+
return l.bigint;
|
|
738
726
|
case "symbol":
|
|
739
|
-
return
|
|
727
|
+
return l.symbol;
|
|
740
728
|
case "object":
|
|
741
|
-
return Array.isArray(t) ?
|
|
729
|
+
return Array.isArray(t) ? l.array : t === null ? l.null : t.then && typeof t.then == "function" && t.catch && typeof t.catch == "function" ? l.promise : typeof Map < "u" && t instanceof Map ? l.map : typeof Set < "u" && t instanceof Set ? l.set : typeof Date < "u" && t instanceof Date ? l.date : l.object;
|
|
742
730
|
default:
|
|
743
|
-
return
|
|
731
|
+
return l.unknown;
|
|
744
732
|
}
|
|
745
733
|
};
|
|
746
|
-
c =
|
|
734
|
+
c = k.arrayToEnum([
|
|
747
735
|
"invalid_type",
|
|
748
736
|
"invalid_literal",
|
|
749
737
|
"custom",
|
|
@@ -788,10 +776,10 @@ var init_shared_es = __esm({
|
|
|
788
776
|
else if (i.path.length === 0)
|
|
789
777
|
n._errors.push(r(i));
|
|
790
778
|
else {
|
|
791
|
-
let o = n,
|
|
792
|
-
for (;
|
|
793
|
-
const
|
|
794
|
-
|
|
779
|
+
let o = n, f = 0;
|
|
780
|
+
for (; f < i.path.length; ) {
|
|
781
|
+
const h = i.path[f];
|
|
782
|
+
f === i.path.length - 1 ? (o[h] = o[h] || { _errors: [] }, o[h]._errors.push(r(i))) : o[h] = o[h] || { _errors: [] }, o = o[h], f++;
|
|
795
783
|
}
|
|
796
784
|
}
|
|
797
785
|
};
|
|
@@ -805,7 +793,7 @@ var init_shared_es = __esm({
|
|
|
805
793
|
return this.message;
|
|
806
794
|
}
|
|
807
795
|
get message() {
|
|
808
|
-
return JSON.stringify(this.issues,
|
|
796
|
+
return JSON.stringify(this.issues, k.jsonStringifyReplacer, 2);
|
|
809
797
|
}
|
|
810
798
|
get isEmpty() {
|
|
811
799
|
return this.issues.length === 0;
|
|
@@ -825,26 +813,26 @@ var init_shared_es = __esm({
|
|
|
825
813
|
}
|
|
826
814
|
};
|
|
827
815
|
R.create = (t) => new R(t);
|
|
828
|
-
|
|
816
|
+
ee = (t, e) => {
|
|
829
817
|
let r;
|
|
830
818
|
switch (t.code) {
|
|
831
819
|
case c.invalid_type:
|
|
832
|
-
t.received ===
|
|
820
|
+
t.received === l.undefined ? r = "Required" : r = `Expected ${t.expected}, received ${t.received}`;
|
|
833
821
|
break;
|
|
834
822
|
case c.invalid_literal:
|
|
835
|
-
r = `Invalid literal value, expected ${JSON.stringify(t.expected,
|
|
823
|
+
r = `Invalid literal value, expected ${JSON.stringify(t.expected, k.jsonStringifyReplacer)}`;
|
|
836
824
|
break;
|
|
837
825
|
case c.unrecognized_keys:
|
|
838
|
-
r = `Unrecognized key(s) in object: ${
|
|
826
|
+
r = `Unrecognized key(s) in object: ${k.joinValues(t.keys, ", ")}`;
|
|
839
827
|
break;
|
|
840
828
|
case c.invalid_union:
|
|
841
829
|
r = "Invalid input";
|
|
842
830
|
break;
|
|
843
831
|
case c.invalid_union_discriminator:
|
|
844
|
-
r = `Invalid discriminator value. Expected ${
|
|
832
|
+
r = `Invalid discriminator value. Expected ${k.joinValues(t.options)}`;
|
|
845
833
|
break;
|
|
846
834
|
case c.invalid_enum_value:
|
|
847
|
-
r = `Invalid enum value. Expected ${
|
|
835
|
+
r = `Invalid enum value. Expected ${k.joinValues(t.options)}, received '${t.received}'`;
|
|
848
836
|
break;
|
|
849
837
|
case c.invalid_arguments:
|
|
850
838
|
r = "Invalid function arguments";
|
|
@@ -856,7 +844,7 @@ var init_shared_es = __esm({
|
|
|
856
844
|
r = "Invalid date";
|
|
857
845
|
break;
|
|
858
846
|
case c.invalid_string:
|
|
859
|
-
typeof t.validation == "object" ? "includes" in t.validation ? (r = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (r = `${r} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? r = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? r = `Invalid input: must end with "${t.validation.endsWith}"` :
|
|
847
|
+
typeof t.validation == "object" ? "includes" in t.validation ? (r = `Invalid input: must include "${t.validation.includes}"`, typeof t.validation.position == "number" && (r = `${r} at one or more positions greater than or equal to ${t.validation.position}`)) : "startsWith" in t.validation ? r = `Invalid input: must start with "${t.validation.startsWith}"` : "endsWith" in t.validation ? r = `Invalid input: must end with "${t.validation.endsWith}"` : k.assertNever(t.validation) : t.validation !== "regex" ? r = `Invalid ${t.validation}` : r = "Invalid";
|
|
860
848
|
break;
|
|
861
849
|
case c.too_small:
|
|
862
850
|
t.type === "array" ? r = `Array must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "more than"} ${t.minimum} element(s)` : t.type === "string" ? r = `String must contain ${t.exact ? "exactly" : t.inclusive ? "at least" : "over"} ${t.minimum} character(s)` : t.type === "number" ? r = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "bigint" ? r = `Number must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${t.minimum}` : t.type === "date" ? r = `Date must be ${t.exact ? "exactly equal to " : t.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(t.minimum))}` : r = "Invalid input";
|
|
@@ -877,12 +865,12 @@ var init_shared_es = __esm({
|
|
|
877
865
|
r = "Number must be finite";
|
|
878
866
|
break;
|
|
879
867
|
default:
|
|
880
|
-
r = e.defaultError,
|
|
868
|
+
r = e.defaultError, k.assertNever(t);
|
|
881
869
|
}
|
|
882
870
|
return { message: r };
|
|
883
871
|
};
|
|
884
|
-
|
|
885
|
-
|
|
872
|
+
Qe = ee;
|
|
873
|
+
pe = (t) => {
|
|
886
874
|
const { data: e, path: r, errorMaps: n, issueData: s } = t, a = [...r, ...s.path || []], i = {
|
|
887
875
|
...s,
|
|
888
876
|
path: a
|
|
@@ -894,9 +882,9 @@ var init_shared_es = __esm({
|
|
|
894
882
|
message: s.message
|
|
895
883
|
};
|
|
896
884
|
let o = "";
|
|
897
|
-
const
|
|
898
|
-
for (const
|
|
899
|
-
o =
|
|
885
|
+
const f = n.filter((h) => !!h).slice().reverse();
|
|
886
|
+
for (const h of f)
|
|
887
|
+
o = h(i, { data: e, defaultError: o }).message;
|
|
900
888
|
return {
|
|
901
889
|
...s,
|
|
902
890
|
path: a,
|
|
@@ -947,11 +935,11 @@ var init_shared_es = __esm({
|
|
|
947
935
|
_ = Object.freeze({
|
|
948
936
|
status: "aborted"
|
|
949
937
|
});
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
938
|
+
J = (t) => ({ status: "dirty", value: t });
|
|
939
|
+
A = (t) => ({ status: "valid", value: t });
|
|
940
|
+
Ie = (t) => t.status === "aborted";
|
|
941
|
+
we = (t) => t.status === "dirty";
|
|
942
|
+
X = (t) => t.status === "valid";
|
|
955
943
|
ne = (t) => typeof Promise < "u" && t instanceof Promise;
|
|
956
944
|
(function(t) {
|
|
957
945
|
t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
@@ -964,8 +952,8 @@ var init_shared_es = __esm({
|
|
|
964
952
|
return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
965
953
|
}
|
|
966
954
|
};
|
|
967
|
-
|
|
968
|
-
if (
|
|
955
|
+
De = (t, e) => {
|
|
956
|
+
if (X(e))
|
|
969
957
|
return { success: true, data: e.value };
|
|
970
958
|
if (!t.common.issues.length)
|
|
971
959
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -1038,7 +1026,7 @@ var init_shared_es = __esm({
|
|
|
1038
1026
|
data: e,
|
|
1039
1027
|
parsedType: j(e)
|
|
1040
1028
|
}, s = this._parseSync({ data: e, path: n.path, parent: n });
|
|
1041
|
-
return
|
|
1029
|
+
return De(n, s);
|
|
1042
1030
|
}
|
|
1043
1031
|
"~validate"(e) {
|
|
1044
1032
|
var n, s;
|
|
@@ -1056,7 +1044,7 @@ var init_shared_es = __esm({
|
|
|
1056
1044
|
if (!this["~standard"].async)
|
|
1057
1045
|
try {
|
|
1058
1046
|
const a = this._parseSync({ data: e, path: [], parent: r });
|
|
1059
|
-
return
|
|
1047
|
+
return X(a) ? {
|
|
1060
1048
|
value: a.value
|
|
1061
1049
|
} : {
|
|
1062
1050
|
issues: r.common.issues
|
|
@@ -1067,7 +1055,7 @@ var init_shared_es = __esm({
|
|
|
1067
1055
|
async: true
|
|
1068
1056
|
};
|
|
1069
1057
|
}
|
|
1070
|
-
return this._parseAsync({ data: e, path: [], parent: r }).then((a) =>
|
|
1058
|
+
return this._parseAsync({ data: e, path: [], parent: r }).then((a) => X(a) ? {
|
|
1071
1059
|
value: a.value
|
|
1072
1060
|
} : {
|
|
1073
1061
|
issues: r.common.issues
|
|
@@ -1092,7 +1080,7 @@ var init_shared_es = __esm({
|
|
|
1092
1080
|
data: e,
|
|
1093
1081
|
parsedType: j(e)
|
|
1094
1082
|
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (ne(s) ? s : Promise.resolve(s));
|
|
1095
|
-
return
|
|
1083
|
+
return De(n, a);
|
|
1096
1084
|
}
|
|
1097
1085
|
refine(e, r) {
|
|
1098
1086
|
const n = (s) => typeof r == "string" || typeof r > "u" ? { message: r } : typeof r == "function" ? r(s) : r;
|
|
@@ -1101,14 +1089,14 @@ var init_shared_es = __esm({
|
|
|
1101
1089
|
code: c.custom,
|
|
1102
1090
|
...n(s)
|
|
1103
1091
|
});
|
|
1104
|
-
return typeof Promise < "u" && i instanceof Promise ? i.then((
|
|
1092
|
+
return typeof Promise < "u" && i instanceof Promise ? i.then((f) => f ? true : (o(), false)) : i ? true : (o(), false);
|
|
1105
1093
|
});
|
|
1106
1094
|
}
|
|
1107
1095
|
refinement(e, r) {
|
|
1108
1096
|
return this._refinement((n, s) => e(n) ? true : (s.addIssue(typeof r == "function" ? r(n, s) : r), false));
|
|
1109
1097
|
}
|
|
1110
1098
|
_refinement(e) {
|
|
1111
|
-
return new
|
|
1099
|
+
return new B({
|
|
1112
1100
|
schema: this,
|
|
1113
1101
|
typeName: p.ZodEffects,
|
|
1114
1102
|
effect: { type: "refinement", refinement: e }
|
|
@@ -1125,10 +1113,10 @@ var init_shared_es = __esm({
|
|
|
1125
1113
|
};
|
|
1126
1114
|
}
|
|
1127
1115
|
optional() {
|
|
1128
|
-
return
|
|
1116
|
+
return Z.create(this, this._def);
|
|
1129
1117
|
}
|
|
1130
1118
|
nullable() {
|
|
1131
|
-
return
|
|
1119
|
+
return q.create(this, this._def);
|
|
1132
1120
|
}
|
|
1133
1121
|
nullish() {
|
|
1134
1122
|
return this.nullable().optional();
|
|
@@ -1137,7 +1125,7 @@ var init_shared_es = __esm({
|
|
|
1137
1125
|
return D.create(this);
|
|
1138
1126
|
}
|
|
1139
1127
|
promise() {
|
|
1140
|
-
return
|
|
1128
|
+
return re.create(this, this._def);
|
|
1141
1129
|
}
|
|
1142
1130
|
or(e) {
|
|
1143
1131
|
return ae.create([this, e], this._def);
|
|
@@ -1146,7 +1134,7 @@ var init_shared_es = __esm({
|
|
|
1146
1134
|
return ie.create(this, e, this._def);
|
|
1147
1135
|
}
|
|
1148
1136
|
transform(e) {
|
|
1149
|
-
return new
|
|
1137
|
+
return new B({
|
|
1150
1138
|
...g(this._def),
|
|
1151
1139
|
schema: this,
|
|
1152
1140
|
typeName: p.ZodEffects,
|
|
@@ -1163,7 +1151,7 @@ var init_shared_es = __esm({
|
|
|
1163
1151
|
});
|
|
1164
1152
|
}
|
|
1165
1153
|
brand() {
|
|
1166
|
-
return new
|
|
1154
|
+
return new ze({
|
|
1167
1155
|
typeName: p.ZodBranded,
|
|
1168
1156
|
type: this,
|
|
1169
1157
|
...g(this._def)
|
|
@@ -1186,7 +1174,7 @@ var init_shared_es = __esm({
|
|
|
1186
1174
|
});
|
|
1187
1175
|
}
|
|
1188
1176
|
pipe(e) {
|
|
1189
|
-
return
|
|
1177
|
+
return be.create(this, e);
|
|
1190
1178
|
}
|
|
1191
1179
|
readonly() {
|
|
1192
1180
|
return le.create(this);
|
|
@@ -1198,30 +1186,30 @@ var init_shared_es = __esm({
|
|
|
1198
1186
|
return this.safeParse(null).success;
|
|
1199
1187
|
}
|
|
1200
1188
|
};
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1189
|
+
Xe = /^c[^\s-]{8,}$/i;
|
|
1190
|
+
Ke = /^[0-9a-z]+$/;
|
|
1191
|
+
Je = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
|
|
1192
|
+
He = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
|
|
1193
|
+
et = /^[a-z0-9_-]{21}$/i;
|
|
1194
|
+
tt = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
|
|
1195
|
+
rt = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
|
|
1196
|
+
nt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
|
1197
|
+
st = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1198
|
+
at = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
|
1199
|
+
it = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/;
|
|
1200
|
+
ot = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
|
|
1201
|
+
ct = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
1202
|
+
dt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
1203
|
+
ut = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
|
|
1204
|
+
$e = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))";
|
|
1205
|
+
lt = new RegExp(`^${$e}$`);
|
|
1218
1206
|
w = class _w extends v {
|
|
1219
1207
|
_parse(e) {
|
|
1220
|
-
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !==
|
|
1208
|
+
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== l.string) {
|
|
1221
1209
|
const a = this._getOrReturnCtx(e);
|
|
1222
|
-
return
|
|
1210
|
+
return u(a, {
|
|
1223
1211
|
code: c.invalid_type,
|
|
1224
|
-
expected:
|
|
1212
|
+
expected: l.string,
|
|
1225
1213
|
received: a.parsedType
|
|
1226
1214
|
}), _;
|
|
1227
1215
|
}
|
|
@@ -1229,7 +1217,7 @@ var init_shared_es = __esm({
|
|
|
1229
1217
|
let s;
|
|
1230
1218
|
for (const a of this._def.checks)
|
|
1231
1219
|
if (a.kind === "min")
|
|
1232
|
-
e.data.length < a.value && (s = this._getOrReturnCtx(e, s),
|
|
1220
|
+
e.data.length < a.value && (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1233
1221
|
code: c.too_small,
|
|
1234
1222
|
minimum: a.value,
|
|
1235
1223
|
type: "string",
|
|
@@ -1238,7 +1226,7 @@ var init_shared_es = __esm({
|
|
|
1238
1226
|
message: a.message
|
|
1239
1227
|
}), n.dirty());
|
|
1240
1228
|
else if (a.kind === "max")
|
|
1241
|
-
e.data.length > a.value && (s = this._getOrReturnCtx(e, s),
|
|
1229
|
+
e.data.length > a.value && (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1242
1230
|
code: c.too_big,
|
|
1243
1231
|
maximum: a.value,
|
|
1244
1232
|
type: "string",
|
|
@@ -1248,14 +1236,14 @@ var init_shared_es = __esm({
|
|
|
1248
1236
|
}), n.dirty());
|
|
1249
1237
|
else if (a.kind === "length") {
|
|
1250
1238
|
const i = e.data.length > a.value, o = e.data.length < a.value;
|
|
1251
|
-
(i || o) && (s = this._getOrReturnCtx(e, s), i ?
|
|
1239
|
+
(i || o) && (s = this._getOrReturnCtx(e, s), i ? u(s, {
|
|
1252
1240
|
code: c.too_big,
|
|
1253
1241
|
maximum: a.value,
|
|
1254
1242
|
type: "string",
|
|
1255
1243
|
inclusive: true,
|
|
1256
1244
|
exact: true,
|
|
1257
1245
|
message: a.message
|
|
1258
|
-
}) : o &&
|
|
1246
|
+
}) : o && u(s, {
|
|
1259
1247
|
code: c.too_small,
|
|
1260
1248
|
minimum: a.value,
|
|
1261
1249
|
type: "string",
|
|
@@ -1264,43 +1252,43 @@ var init_shared_es = __esm({
|
|
|
1264
1252
|
message: a.message
|
|
1265
1253
|
}), n.dirty());
|
|
1266
1254
|
} else if (a.kind === "email")
|
|
1267
|
-
|
|
1255
|
+
nt.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1268
1256
|
validation: "email",
|
|
1269
1257
|
code: c.invalid_string,
|
|
1270
1258
|
message: a.message
|
|
1271
1259
|
}), n.dirty());
|
|
1272
1260
|
else if (a.kind === "emoji")
|
|
1273
|
-
|
|
1261
|
+
me || (me = new RegExp(st, "u")), me.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1274
1262
|
validation: "emoji",
|
|
1275
1263
|
code: c.invalid_string,
|
|
1276
1264
|
message: a.message
|
|
1277
1265
|
}), n.dirty());
|
|
1278
1266
|
else if (a.kind === "uuid")
|
|
1279
|
-
|
|
1267
|
+
He.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1280
1268
|
validation: "uuid",
|
|
1281
1269
|
code: c.invalid_string,
|
|
1282
1270
|
message: a.message
|
|
1283
1271
|
}), n.dirty());
|
|
1284
1272
|
else if (a.kind === "nanoid")
|
|
1285
|
-
|
|
1273
|
+
et.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1286
1274
|
validation: "nanoid",
|
|
1287
1275
|
code: c.invalid_string,
|
|
1288
1276
|
message: a.message
|
|
1289
1277
|
}), n.dirty());
|
|
1290
1278
|
else if (a.kind === "cuid")
|
|
1291
|
-
|
|
1279
|
+
Xe.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1292
1280
|
validation: "cuid",
|
|
1293
1281
|
code: c.invalid_string,
|
|
1294
1282
|
message: a.message
|
|
1295
1283
|
}), n.dirty());
|
|
1296
1284
|
else if (a.kind === "cuid2")
|
|
1297
|
-
|
|
1285
|
+
Ke.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1298
1286
|
validation: "cuid2",
|
|
1299
1287
|
code: c.invalid_string,
|
|
1300
1288
|
message: a.message
|
|
1301
1289
|
}), n.dirty());
|
|
1302
1290
|
else if (a.kind === "ulid")
|
|
1303
|
-
|
|
1291
|
+
Je.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1304
1292
|
validation: "ulid",
|
|
1305
1293
|
code: c.invalid_string,
|
|
1306
1294
|
message: a.message
|
|
@@ -1309,65 +1297,65 @@ var init_shared_es = __esm({
|
|
|
1309
1297
|
try {
|
|
1310
1298
|
new URL(e.data);
|
|
1311
1299
|
} catch {
|
|
1312
|
-
s = this._getOrReturnCtx(e, s),
|
|
1300
|
+
s = this._getOrReturnCtx(e, s), u(s, {
|
|
1313
1301
|
validation: "url",
|
|
1314
1302
|
code: c.invalid_string,
|
|
1315
1303
|
message: a.message
|
|
1316
1304
|
}), n.dirty();
|
|
1317
1305
|
}
|
|
1318
|
-
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
1306
|
+
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1319
1307
|
validation: "regex",
|
|
1320
1308
|
code: c.invalid_string,
|
|
1321
1309
|
message: a.message
|
|
1322
|
-
}), n.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (s = this._getOrReturnCtx(e, s),
|
|
1310
|
+
}), n.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1323
1311
|
code: c.invalid_string,
|
|
1324
1312
|
validation: { includes: a.value, position: a.position },
|
|
1325
1313
|
message: a.message
|
|
1326
|
-
}), n.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (s = this._getOrReturnCtx(e, s),
|
|
1314
|
+
}), n.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1327
1315
|
code: c.invalid_string,
|
|
1328
1316
|
validation: { startsWith: a.value },
|
|
1329
1317
|
message: a.message
|
|
1330
|
-
}), n.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s),
|
|
1318
|
+
}), n.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1331
1319
|
code: c.invalid_string,
|
|
1332
1320
|
validation: { endsWith: a.value },
|
|
1333
1321
|
message: a.message
|
|
1334
|
-
}), n.dirty()) : a.kind === "datetime" ?
|
|
1322
|
+
}), n.dirty()) : a.kind === "datetime" ? ft(a).test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1335
1323
|
code: c.invalid_string,
|
|
1336
1324
|
validation: "datetime",
|
|
1337
1325
|
message: a.message
|
|
1338
|
-
}), n.dirty()) : a.kind === "date" ?
|
|
1326
|
+
}), n.dirty()) : a.kind === "date" ? lt.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1339
1327
|
code: c.invalid_string,
|
|
1340
1328
|
validation: "date",
|
|
1341
1329
|
message: a.message
|
|
1342
|
-
}), n.dirty()) : a.kind === "time" ?
|
|
1330
|
+
}), n.dirty()) : a.kind === "time" ? ht(a).test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1343
1331
|
code: c.invalid_string,
|
|
1344
1332
|
validation: "time",
|
|
1345
1333
|
message: a.message
|
|
1346
|
-
}), n.dirty()) : a.kind === "duration" ?
|
|
1334
|
+
}), n.dirty()) : a.kind === "duration" ? rt.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1347
1335
|
validation: "duration",
|
|
1348
1336
|
code: c.invalid_string,
|
|
1349
1337
|
message: a.message
|
|
1350
|
-
}), n.dirty()) : a.kind === "ip" ?
|
|
1338
|
+
}), n.dirty()) : a.kind === "ip" ? mt(e.data, a.version) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1351
1339
|
validation: "ip",
|
|
1352
1340
|
code: c.invalid_string,
|
|
1353
1341
|
message: a.message
|
|
1354
|
-
}), n.dirty()) : a.kind === "jwt" ?
|
|
1342
|
+
}), n.dirty()) : a.kind === "jwt" ? _t(e.data, a.alg) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1355
1343
|
validation: "jwt",
|
|
1356
1344
|
code: c.invalid_string,
|
|
1357
1345
|
message: a.message
|
|
1358
|
-
}), n.dirty()) : a.kind === "cidr" ?
|
|
1346
|
+
}), n.dirty()) : a.kind === "cidr" ? pt(e.data, a.version) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1359
1347
|
validation: "cidr",
|
|
1360
1348
|
code: c.invalid_string,
|
|
1361
1349
|
message: a.message
|
|
1362
|
-
}), n.dirty()) : a.kind === "base64" ?
|
|
1350
|
+
}), n.dirty()) : a.kind === "base64" ? dt.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1363
1351
|
validation: "base64",
|
|
1364
1352
|
code: c.invalid_string,
|
|
1365
1353
|
message: a.message
|
|
1366
|
-
}), n.dirty()) : a.kind === "base64url" ?
|
|
1354
|
+
}), n.dirty()) : a.kind === "base64url" ? ut.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1367
1355
|
validation: "base64url",
|
|
1368
1356
|
code: c.invalid_string,
|
|
1369
1357
|
message: a.message
|
|
1370
|
-
}), n.dirty()) :
|
|
1358
|
+
}), n.dirty()) : k.assertNever(a);
|
|
1371
1359
|
return { status: n.value, value: e.data };
|
|
1372
1360
|
}
|
|
1373
1361
|
_regex(e, r, n) {
|
|
@@ -1598,49 +1586,49 @@ var init_shared_es = __esm({
|
|
|
1598
1586
|
coerce: (t == null ? void 0 : t.coerce) ?? false,
|
|
1599
1587
|
...g(t)
|
|
1600
1588
|
});
|
|
1601
|
-
|
|
1589
|
+
V = class _V extends v {
|
|
1602
1590
|
constructor() {
|
|
1603
1591
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1604
1592
|
}
|
|
1605
1593
|
_parse(e) {
|
|
1606
|
-
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !==
|
|
1594
|
+
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== l.number) {
|
|
1607
1595
|
const a = this._getOrReturnCtx(e);
|
|
1608
|
-
return
|
|
1596
|
+
return u(a, {
|
|
1609
1597
|
code: c.invalid_type,
|
|
1610
|
-
expected:
|
|
1598
|
+
expected: l.number,
|
|
1611
1599
|
received: a.parsedType
|
|
1612
1600
|
}), _;
|
|
1613
1601
|
}
|
|
1614
1602
|
let n;
|
|
1615
1603
|
const s = new O();
|
|
1616
1604
|
for (const a of this._def.checks)
|
|
1617
|
-
a.kind === "int" ?
|
|
1605
|
+
a.kind === "int" ? k.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), u(n, {
|
|
1618
1606
|
code: c.invalid_type,
|
|
1619
1607
|
expected: "integer",
|
|
1620
1608
|
received: "float",
|
|
1621
1609
|
message: a.message
|
|
1622
|
-
}), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n),
|
|
1610
|
+
}), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), u(n, {
|
|
1623
1611
|
code: c.too_small,
|
|
1624
1612
|
minimum: a.value,
|
|
1625
1613
|
type: "number",
|
|
1626
1614
|
inclusive: a.inclusive,
|
|
1627
1615
|
exact: false,
|
|
1628
1616
|
message: a.message
|
|
1629
|
-
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n),
|
|
1617
|
+
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), u(n, {
|
|
1630
1618
|
code: c.too_big,
|
|
1631
1619
|
maximum: a.value,
|
|
1632
1620
|
type: "number",
|
|
1633
1621
|
inclusive: a.inclusive,
|
|
1634
1622
|
exact: false,
|
|
1635
1623
|
message: a.message
|
|
1636
|
-
}), s.dirty()) : a.kind === "multipleOf" ?
|
|
1624
|
+
}), s.dirty()) : a.kind === "multipleOf" ? yt(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), u(n, {
|
|
1637
1625
|
code: c.not_multiple_of,
|
|
1638
1626
|
multipleOf: a.value,
|
|
1639
1627
|
message: a.message
|
|
1640
|
-
}), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n),
|
|
1628
|
+
}), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), u(n, {
|
|
1641
1629
|
code: c.not_finite,
|
|
1642
1630
|
message: a.message
|
|
1643
|
-
}), s.dirty()) :
|
|
1631
|
+
}), s.dirty()) : k.assertNever(a);
|
|
1644
1632
|
return { status: s.value, value: e.data };
|
|
1645
1633
|
}
|
|
1646
1634
|
gte(e, r) {
|
|
@@ -1656,7 +1644,7 @@ var init_shared_es = __esm({
|
|
|
1656
1644
|
return this.setLimit("max", e, false, m.toString(r));
|
|
1657
1645
|
}
|
|
1658
1646
|
setLimit(e, r, n, s) {
|
|
1659
|
-
return new
|
|
1647
|
+
return new _V({
|
|
1660
1648
|
...this._def,
|
|
1661
1649
|
checks: [
|
|
1662
1650
|
...this._def.checks,
|
|
@@ -1670,7 +1658,7 @@ var init_shared_es = __esm({
|
|
|
1670
1658
|
});
|
|
1671
1659
|
}
|
|
1672
1660
|
_addCheck(e) {
|
|
1673
|
-
return new
|
|
1661
|
+
return new _V({
|
|
1674
1662
|
...this._def,
|
|
1675
1663
|
checks: [...this._def.checks, e]
|
|
1676
1664
|
});
|
|
@@ -1752,7 +1740,7 @@ var init_shared_es = __esm({
|
|
|
1752
1740
|
return e;
|
|
1753
1741
|
}
|
|
1754
1742
|
get isInt() {
|
|
1755
|
-
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" &&
|
|
1743
|
+
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && k.isInteger(e.value));
|
|
1756
1744
|
}
|
|
1757
1745
|
get isFinite() {
|
|
1758
1746
|
let e = null, r = null;
|
|
@@ -1764,13 +1752,13 @@ var init_shared_es = __esm({
|
|
|
1764
1752
|
return Number.isFinite(r) && Number.isFinite(e);
|
|
1765
1753
|
}
|
|
1766
1754
|
};
|
|
1767
|
-
|
|
1755
|
+
V.create = (t) => new V({
|
|
1768
1756
|
checks: [],
|
|
1769
1757
|
typeName: p.ZodNumber,
|
|
1770
1758
|
coerce: (t == null ? void 0 : t.coerce) || false,
|
|
1771
1759
|
...g(t)
|
|
1772
1760
|
});
|
|
1773
|
-
|
|
1761
|
+
F = class _F extends v {
|
|
1774
1762
|
constructor() {
|
|
1775
1763
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1776
1764
|
}
|
|
@@ -1781,35 +1769,35 @@ var init_shared_es = __esm({
|
|
|
1781
1769
|
} catch {
|
|
1782
1770
|
return this._getInvalidInput(e);
|
|
1783
1771
|
}
|
|
1784
|
-
if (this._getType(e) !==
|
|
1772
|
+
if (this._getType(e) !== l.bigint)
|
|
1785
1773
|
return this._getInvalidInput(e);
|
|
1786
1774
|
let n;
|
|
1787
1775
|
const s = new O();
|
|
1788
1776
|
for (const a of this._def.checks)
|
|
1789
|
-
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n),
|
|
1777
|
+
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), u(n, {
|
|
1790
1778
|
code: c.too_small,
|
|
1791
1779
|
type: "bigint",
|
|
1792
1780
|
minimum: a.value,
|
|
1793
1781
|
inclusive: a.inclusive,
|
|
1794
1782
|
message: a.message
|
|
1795
|
-
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n),
|
|
1783
|
+
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), u(n, {
|
|
1796
1784
|
code: c.too_big,
|
|
1797
1785
|
type: "bigint",
|
|
1798
1786
|
maximum: a.value,
|
|
1799
1787
|
inclusive: a.inclusive,
|
|
1800
1788
|
message: a.message
|
|
1801
|
-
}), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n),
|
|
1789
|
+
}), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), u(n, {
|
|
1802
1790
|
code: c.not_multiple_of,
|
|
1803
1791
|
multipleOf: a.value,
|
|
1804
1792
|
message: a.message
|
|
1805
|
-
}), s.dirty()) :
|
|
1793
|
+
}), s.dirty()) : k.assertNever(a);
|
|
1806
1794
|
return { status: s.value, value: e.data };
|
|
1807
1795
|
}
|
|
1808
1796
|
_getInvalidInput(e) {
|
|
1809
1797
|
const r = this._getOrReturnCtx(e);
|
|
1810
|
-
return
|
|
1798
|
+
return u(r, {
|
|
1811
1799
|
code: c.invalid_type,
|
|
1812
|
-
expected:
|
|
1800
|
+
expected: l.bigint,
|
|
1813
1801
|
received: r.parsedType
|
|
1814
1802
|
}), _;
|
|
1815
1803
|
}
|
|
@@ -1826,7 +1814,7 @@ var init_shared_es = __esm({
|
|
|
1826
1814
|
return this.setLimit("max", e, false, m.toString(r));
|
|
1827
1815
|
}
|
|
1828
1816
|
setLimit(e, r, n, s) {
|
|
1829
|
-
return new
|
|
1817
|
+
return new _F({
|
|
1830
1818
|
...this._def,
|
|
1831
1819
|
checks: [
|
|
1832
1820
|
...this._def.checks,
|
|
@@ -1840,7 +1828,7 @@ var init_shared_es = __esm({
|
|
|
1840
1828
|
});
|
|
1841
1829
|
}
|
|
1842
1830
|
_addCheck(e) {
|
|
1843
|
-
return new
|
|
1831
|
+
return new _F({
|
|
1844
1832
|
...this._def,
|
|
1845
1833
|
checks: [...this._def.checks, e]
|
|
1846
1834
|
});
|
|
@@ -1897,7 +1885,7 @@ var init_shared_es = __esm({
|
|
|
1897
1885
|
return e;
|
|
1898
1886
|
}
|
|
1899
1887
|
};
|
|
1900
|
-
|
|
1888
|
+
F.create = (t) => new F({
|
|
1901
1889
|
checks: [],
|
|
1902
1890
|
typeName: p.ZodBigInt,
|
|
1903
1891
|
coerce: (t == null ? void 0 : t.coerce) ?? false,
|
|
@@ -1905,15 +1893,15 @@ var init_shared_es = __esm({
|
|
|
1905
1893
|
});
|
|
1906
1894
|
se = class extends v {
|
|
1907
1895
|
_parse(e) {
|
|
1908
|
-
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !==
|
|
1896
|
+
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== l.boolean) {
|
|
1909
1897
|
const n = this._getOrReturnCtx(e);
|
|
1910
|
-
return
|
|
1898
|
+
return u(n, {
|
|
1911
1899
|
code: c.invalid_type,
|
|
1912
|
-
expected:
|
|
1900
|
+
expected: l.boolean,
|
|
1913
1901
|
received: n.parsedType
|
|
1914
1902
|
}), _;
|
|
1915
1903
|
}
|
|
1916
|
-
return
|
|
1904
|
+
return A(e.data);
|
|
1917
1905
|
}
|
|
1918
1906
|
};
|
|
1919
1907
|
se.create = (t) => new se({
|
|
@@ -1921,47 +1909,47 @@ var init_shared_es = __esm({
|
|
|
1921
1909
|
coerce: (t == null ? void 0 : t.coerce) || false,
|
|
1922
1910
|
...g(t)
|
|
1923
1911
|
});
|
|
1924
|
-
|
|
1912
|
+
K = class _K extends v {
|
|
1925
1913
|
_parse(e) {
|
|
1926
|
-
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !==
|
|
1914
|
+
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== l.date) {
|
|
1927
1915
|
const a = this._getOrReturnCtx(e);
|
|
1928
|
-
return
|
|
1916
|
+
return u(a, {
|
|
1929
1917
|
code: c.invalid_type,
|
|
1930
|
-
expected:
|
|
1918
|
+
expected: l.date,
|
|
1931
1919
|
received: a.parsedType
|
|
1932
1920
|
}), _;
|
|
1933
1921
|
}
|
|
1934
1922
|
if (Number.isNaN(e.data.getTime())) {
|
|
1935
1923
|
const a = this._getOrReturnCtx(e);
|
|
1936
|
-
return
|
|
1924
|
+
return u(a, {
|
|
1937
1925
|
code: c.invalid_date
|
|
1938
1926
|
}), _;
|
|
1939
1927
|
}
|
|
1940
1928
|
const n = new O();
|
|
1941
1929
|
let s;
|
|
1942
1930
|
for (const a of this._def.checks)
|
|
1943
|
-
a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s),
|
|
1931
|
+
a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1944
1932
|
code: c.too_small,
|
|
1945
1933
|
message: a.message,
|
|
1946
1934
|
inclusive: true,
|
|
1947
1935
|
exact: false,
|
|
1948
1936
|
minimum: a.value,
|
|
1949
1937
|
type: "date"
|
|
1950
|
-
}), n.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s),
|
|
1938
|
+
}), n.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1951
1939
|
code: c.too_big,
|
|
1952
1940
|
message: a.message,
|
|
1953
1941
|
inclusive: true,
|
|
1954
1942
|
exact: false,
|
|
1955
1943
|
maximum: a.value,
|
|
1956
1944
|
type: "date"
|
|
1957
|
-
}), n.dirty()) :
|
|
1945
|
+
}), n.dirty()) : k.assertNever(a);
|
|
1958
1946
|
return {
|
|
1959
1947
|
status: n.value,
|
|
1960
1948
|
value: new Date(e.data.getTime())
|
|
1961
1949
|
};
|
|
1962
1950
|
}
|
|
1963
1951
|
_addCheck(e) {
|
|
1964
|
-
return new
|
|
1952
|
+
return new _K({
|
|
1965
1953
|
...this._def,
|
|
1966
1954
|
checks: [...this._def.checks, e]
|
|
1967
1955
|
});
|
|
@@ -1993,93 +1981,93 @@ var init_shared_es = __esm({
|
|
|
1993
1981
|
return e != null ? new Date(e) : null;
|
|
1994
1982
|
}
|
|
1995
1983
|
};
|
|
1996
|
-
|
|
1984
|
+
K.create = (t) => new K({
|
|
1997
1985
|
checks: [],
|
|
1998
1986
|
coerce: (t == null ? void 0 : t.coerce) || false,
|
|
1999
1987
|
typeName: p.ZodDate,
|
|
2000
1988
|
...g(t)
|
|
2001
1989
|
});
|
|
2002
|
-
|
|
1990
|
+
Me = class extends v {
|
|
2003
1991
|
_parse(e) {
|
|
2004
|
-
if (this._getType(e) !==
|
|
1992
|
+
if (this._getType(e) !== l.symbol) {
|
|
2005
1993
|
const n = this._getOrReturnCtx(e);
|
|
2006
|
-
return
|
|
1994
|
+
return u(n, {
|
|
2007
1995
|
code: c.invalid_type,
|
|
2008
|
-
expected:
|
|
1996
|
+
expected: l.symbol,
|
|
2009
1997
|
received: n.parsedType
|
|
2010
1998
|
}), _;
|
|
2011
1999
|
}
|
|
2012
|
-
return
|
|
2000
|
+
return A(e.data);
|
|
2013
2001
|
}
|
|
2014
2002
|
};
|
|
2015
|
-
|
|
2003
|
+
Me.create = (t) => new Me({
|
|
2016
2004
|
typeName: p.ZodSymbol,
|
|
2017
2005
|
...g(t)
|
|
2018
2006
|
});
|
|
2019
|
-
|
|
2007
|
+
ye = class extends v {
|
|
2020
2008
|
_parse(e) {
|
|
2021
|
-
if (this._getType(e) !==
|
|
2009
|
+
if (this._getType(e) !== l.undefined) {
|
|
2022
2010
|
const n = this._getOrReturnCtx(e);
|
|
2023
|
-
return
|
|
2011
|
+
return u(n, {
|
|
2024
2012
|
code: c.invalid_type,
|
|
2025
|
-
expected:
|
|
2013
|
+
expected: l.undefined,
|
|
2026
2014
|
received: n.parsedType
|
|
2027
2015
|
}), _;
|
|
2028
2016
|
}
|
|
2029
|
-
return
|
|
2017
|
+
return A(e.data);
|
|
2030
2018
|
}
|
|
2031
2019
|
};
|
|
2032
|
-
|
|
2020
|
+
ye.create = (t) => new ye({
|
|
2033
2021
|
typeName: p.ZodUndefined,
|
|
2034
2022
|
...g(t)
|
|
2035
2023
|
});
|
|
2036
|
-
|
|
2024
|
+
ge = class extends v {
|
|
2037
2025
|
_parse(e) {
|
|
2038
|
-
if (this._getType(e) !==
|
|
2026
|
+
if (this._getType(e) !== l.null) {
|
|
2039
2027
|
const n = this._getOrReturnCtx(e);
|
|
2040
|
-
return
|
|
2028
|
+
return u(n, {
|
|
2041
2029
|
code: c.invalid_type,
|
|
2042
|
-
expected:
|
|
2030
|
+
expected: l.null,
|
|
2043
2031
|
received: n.parsedType
|
|
2044
2032
|
}), _;
|
|
2045
2033
|
}
|
|
2046
|
-
return
|
|
2034
|
+
return A(e.data);
|
|
2047
2035
|
}
|
|
2048
2036
|
};
|
|
2049
|
-
|
|
2037
|
+
ge.create = (t) => new ge({
|
|
2050
2038
|
typeName: p.ZodNull,
|
|
2051
2039
|
...g(t)
|
|
2052
2040
|
});
|
|
2053
|
-
|
|
2041
|
+
Se = class extends v {
|
|
2054
2042
|
constructor() {
|
|
2055
2043
|
super(...arguments), this._any = true;
|
|
2056
2044
|
}
|
|
2057
2045
|
_parse(e) {
|
|
2058
|
-
return
|
|
2046
|
+
return A(e.data);
|
|
2059
2047
|
}
|
|
2060
2048
|
};
|
|
2061
|
-
|
|
2049
|
+
Se.create = (t) => new Se({
|
|
2062
2050
|
typeName: p.ZodAny,
|
|
2063
2051
|
...g(t)
|
|
2064
2052
|
});
|
|
2065
|
-
|
|
2053
|
+
Q = class extends v {
|
|
2066
2054
|
constructor() {
|
|
2067
2055
|
super(...arguments), this._unknown = true;
|
|
2068
2056
|
}
|
|
2069
2057
|
_parse(e) {
|
|
2070
|
-
return
|
|
2058
|
+
return A(e.data);
|
|
2071
2059
|
}
|
|
2072
2060
|
};
|
|
2073
|
-
|
|
2061
|
+
Q.create = (t) => new Q({
|
|
2074
2062
|
typeName: p.ZodUnknown,
|
|
2075
2063
|
...g(t)
|
|
2076
2064
|
});
|
|
2077
2065
|
C = class extends v {
|
|
2078
2066
|
_parse(e) {
|
|
2079
2067
|
const r = this._getOrReturnCtx(e);
|
|
2080
|
-
return
|
|
2068
|
+
return u(r, {
|
|
2081
2069
|
code: c.invalid_type,
|
|
2082
|
-
expected:
|
|
2070
|
+
expected: l.never,
|
|
2083
2071
|
received: r.parsedType
|
|
2084
2072
|
}), _;
|
|
2085
2073
|
}
|
|
@@ -2088,35 +2076,35 @@ var init_shared_es = __esm({
|
|
|
2088
2076
|
typeName: p.ZodNever,
|
|
2089
2077
|
...g(t)
|
|
2090
2078
|
});
|
|
2091
|
-
|
|
2079
|
+
Le = class extends v {
|
|
2092
2080
|
_parse(e) {
|
|
2093
|
-
if (this._getType(e) !==
|
|
2081
|
+
if (this._getType(e) !== l.undefined) {
|
|
2094
2082
|
const n = this._getOrReturnCtx(e);
|
|
2095
|
-
return
|
|
2083
|
+
return u(n, {
|
|
2096
2084
|
code: c.invalid_type,
|
|
2097
|
-
expected:
|
|
2085
|
+
expected: l.void,
|
|
2098
2086
|
received: n.parsedType
|
|
2099
2087
|
}), _;
|
|
2100
2088
|
}
|
|
2101
|
-
return
|
|
2089
|
+
return A(e.data);
|
|
2102
2090
|
}
|
|
2103
2091
|
};
|
|
2104
|
-
|
|
2092
|
+
Le.create = (t) => new Le({
|
|
2105
2093
|
typeName: p.ZodVoid,
|
|
2106
2094
|
...g(t)
|
|
2107
2095
|
});
|
|
2108
2096
|
D = class _D extends v {
|
|
2109
2097
|
_parse(e) {
|
|
2110
2098
|
const { ctx: r, status: n } = this._processInputParams(e), s = this._def;
|
|
2111
|
-
if (r.parsedType !==
|
|
2112
|
-
return
|
|
2099
|
+
if (r.parsedType !== l.array)
|
|
2100
|
+
return u(r, {
|
|
2113
2101
|
code: c.invalid_type,
|
|
2114
|
-
expected:
|
|
2102
|
+
expected: l.array,
|
|
2115
2103
|
received: r.parsedType
|
|
2116
2104
|
}), _;
|
|
2117
2105
|
if (s.exactLength !== null) {
|
|
2118
2106
|
const i = r.data.length > s.exactLength.value, o = r.data.length < s.exactLength.value;
|
|
2119
|
-
(i || o) && (
|
|
2107
|
+
(i || o) && (u(r, {
|
|
2120
2108
|
code: i ? c.too_big : c.too_small,
|
|
2121
2109
|
minimum: o ? s.exactLength.value : void 0,
|
|
2122
2110
|
maximum: i ? s.exactLength.value : void 0,
|
|
@@ -2126,14 +2114,14 @@ var init_shared_es = __esm({
|
|
|
2126
2114
|
message: s.exactLength.message
|
|
2127
2115
|
}), n.dirty());
|
|
2128
2116
|
}
|
|
2129
|
-
if (s.minLength !== null && r.data.length < s.minLength.value && (
|
|
2117
|
+
if (s.minLength !== null && r.data.length < s.minLength.value && (u(r, {
|
|
2130
2118
|
code: c.too_small,
|
|
2131
2119
|
minimum: s.minLength.value,
|
|
2132
2120
|
type: "array",
|
|
2133
2121
|
inclusive: true,
|
|
2134
2122
|
exact: false,
|
|
2135
2123
|
message: s.minLength.message
|
|
2136
|
-
}), n.dirty()), s.maxLength !== null && r.data.length > s.maxLength.value && (
|
|
2124
|
+
}), n.dirty()), s.maxLength !== null && r.data.length > s.maxLength.value && (u(r, {
|
|
2137
2125
|
code: c.too_big,
|
|
2138
2126
|
maximum: s.maxLength.value,
|
|
2139
2127
|
type: "array",
|
|
@@ -2185,53 +2173,53 @@ var init_shared_es = __esm({
|
|
|
2185
2173
|
_getCached() {
|
|
2186
2174
|
if (this._cached !== null)
|
|
2187
2175
|
return this._cached;
|
|
2188
|
-
const e = this._def.shape(), r =
|
|
2176
|
+
const e = this._def.shape(), r = k.objectKeys(e);
|
|
2189
2177
|
return this._cached = { shape: e, keys: r }, this._cached;
|
|
2190
2178
|
}
|
|
2191
2179
|
_parse(e) {
|
|
2192
|
-
if (this._getType(e) !==
|
|
2193
|
-
const
|
|
2194
|
-
return
|
|
2180
|
+
if (this._getType(e) !== l.object) {
|
|
2181
|
+
const h = this._getOrReturnCtx(e);
|
|
2182
|
+
return u(h, {
|
|
2195
2183
|
code: c.invalid_type,
|
|
2196
|
-
expected:
|
|
2197
|
-
received:
|
|
2184
|
+
expected: l.object,
|
|
2185
|
+
received: h.parsedType
|
|
2198
2186
|
}), _;
|
|
2199
2187
|
}
|
|
2200
2188
|
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
2201
2189
|
if (!(this._def.catchall instanceof C && this._def.unknownKeys === "strip"))
|
|
2202
|
-
for (const
|
|
2203
|
-
i.includes(
|
|
2204
|
-
const
|
|
2205
|
-
for (const
|
|
2206
|
-
const T = a[
|
|
2207
|
-
|
|
2208
|
-
key: { status: "valid", value:
|
|
2209
|
-
value: T._parse(new M(s,
|
|
2210
|
-
alwaysSet:
|
|
2190
|
+
for (const h in s.data)
|
|
2191
|
+
i.includes(h) || o.push(h);
|
|
2192
|
+
const f = [];
|
|
2193
|
+
for (const h of i) {
|
|
2194
|
+
const T = a[h], N = s.data[h];
|
|
2195
|
+
f.push({
|
|
2196
|
+
key: { status: "valid", value: h },
|
|
2197
|
+
value: T._parse(new M(s, N, s.path, h)),
|
|
2198
|
+
alwaysSet: h in s.data
|
|
2211
2199
|
});
|
|
2212
2200
|
}
|
|
2213
2201
|
if (this._def.catchall instanceof C) {
|
|
2214
|
-
const
|
|
2215
|
-
if (
|
|
2202
|
+
const h = this._def.unknownKeys;
|
|
2203
|
+
if (h === "passthrough")
|
|
2216
2204
|
for (const T of o)
|
|
2217
|
-
|
|
2205
|
+
f.push({
|
|
2218
2206
|
key: { status: "valid", value: T },
|
|
2219
2207
|
value: { status: "valid", value: s.data[T] }
|
|
2220
2208
|
});
|
|
2221
|
-
else if (
|
|
2222
|
-
o.length > 0 && (
|
|
2209
|
+
else if (h === "strict")
|
|
2210
|
+
o.length > 0 && (u(s, {
|
|
2223
2211
|
code: c.unrecognized_keys,
|
|
2224
2212
|
keys: o
|
|
2225
2213
|
}), n.dirty());
|
|
2226
|
-
else if (
|
|
2214
|
+
else if (h !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
2227
2215
|
} else {
|
|
2228
|
-
const
|
|
2216
|
+
const h = this._def.catchall;
|
|
2229
2217
|
for (const T of o) {
|
|
2230
|
-
const
|
|
2231
|
-
|
|
2218
|
+
const N = s.data[T];
|
|
2219
|
+
f.push({
|
|
2232
2220
|
key: { status: "valid", value: T },
|
|
2233
|
-
value:
|
|
2234
|
-
new M(s,
|
|
2221
|
+
value: h._parse(
|
|
2222
|
+
new M(s, N, s.path, T)
|
|
2235
2223
|
//, ctx.child(key), value, getParsedType(value)
|
|
2236
2224
|
),
|
|
2237
2225
|
alwaysSet: T in s.data
|
|
@@ -2239,17 +2227,17 @@ var init_shared_es = __esm({
|
|
|
2239
2227
|
}
|
|
2240
2228
|
}
|
|
2241
2229
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
2242
|
-
const
|
|
2243
|
-
for (const T of
|
|
2244
|
-
const
|
|
2245
|
-
|
|
2246
|
-
key:
|
|
2247
|
-
value:
|
|
2230
|
+
const h = [];
|
|
2231
|
+
for (const T of f) {
|
|
2232
|
+
const N = await T.key, Ne = await T.value;
|
|
2233
|
+
h.push({
|
|
2234
|
+
key: N,
|
|
2235
|
+
value: Ne,
|
|
2248
2236
|
alwaysSet: T.alwaysSet
|
|
2249
2237
|
});
|
|
2250
2238
|
}
|
|
2251
|
-
return
|
|
2252
|
-
}).then((
|
|
2239
|
+
return h;
|
|
2240
|
+
}).then((h) => O.mergeObjectSync(n, h)) : O.mergeObjectSync(n, f);
|
|
2253
2241
|
}
|
|
2254
2242
|
get shape() {
|
|
2255
2243
|
return this._def.shape();
|
|
@@ -2392,7 +2380,7 @@ var init_shared_es = __esm({
|
|
|
2392
2380
|
}
|
|
2393
2381
|
pick(e) {
|
|
2394
2382
|
const r = {};
|
|
2395
|
-
for (const n of
|
|
2383
|
+
for (const n of k.objectKeys(e))
|
|
2396
2384
|
e[n] && this.shape[n] && (r[n] = this.shape[n]);
|
|
2397
2385
|
return new _x({
|
|
2398
2386
|
...this._def,
|
|
@@ -2401,7 +2389,7 @@ var init_shared_es = __esm({
|
|
|
2401
2389
|
}
|
|
2402
2390
|
omit(e) {
|
|
2403
2391
|
const r = {};
|
|
2404
|
-
for (const n of
|
|
2392
|
+
for (const n of k.objectKeys(this.shape))
|
|
2405
2393
|
e[n] || (r[n] = this.shape[n]);
|
|
2406
2394
|
return new _x({
|
|
2407
2395
|
...this._def,
|
|
@@ -2412,11 +2400,11 @@ var init_shared_es = __esm({
|
|
|
2412
2400
|
* @deprecated
|
|
2413
2401
|
*/
|
|
2414
2402
|
deepPartial() {
|
|
2415
|
-
return
|
|
2403
|
+
return Y(this);
|
|
2416
2404
|
}
|
|
2417
2405
|
partial(e) {
|
|
2418
2406
|
const r = {};
|
|
2419
|
-
for (const n of
|
|
2407
|
+
for (const n of k.objectKeys(this.shape)) {
|
|
2420
2408
|
const s = this.shape[n];
|
|
2421
2409
|
e && !e[n] ? r[n] = s : r[n] = s.optional();
|
|
2422
2410
|
}
|
|
@@ -2427,12 +2415,12 @@ var init_shared_es = __esm({
|
|
|
2427
2415
|
}
|
|
2428
2416
|
required(e) {
|
|
2429
2417
|
const r = {};
|
|
2430
|
-
for (const n of
|
|
2418
|
+
for (const n of k.objectKeys(this.shape))
|
|
2431
2419
|
if (e && !e[n])
|
|
2432
2420
|
r[n] = this.shape[n];
|
|
2433
2421
|
else {
|
|
2434
2422
|
let a = this.shape[n];
|
|
2435
|
-
for (; a instanceof
|
|
2423
|
+
for (; a instanceof Z; )
|
|
2436
2424
|
a = a._def.innerType;
|
|
2437
2425
|
r[n] = a;
|
|
2438
2426
|
}
|
|
@@ -2442,7 +2430,7 @@ var init_shared_es = __esm({
|
|
|
2442
2430
|
});
|
|
2443
2431
|
}
|
|
2444
2432
|
keyof() {
|
|
2445
|
-
return
|
|
2433
|
+
return Fe(k.objectKeys(this.shape));
|
|
2446
2434
|
}
|
|
2447
2435
|
};
|
|
2448
2436
|
x.create = (t, e) => new x({
|
|
@@ -2477,7 +2465,7 @@ var init_shared_es = __esm({
|
|
|
2477
2465
|
if (o.result.status === "dirty")
|
|
2478
2466
|
return r.common.issues.push(...o.ctx.common.issues), o.result;
|
|
2479
2467
|
const i = a.map((o) => new R(o.ctx.common.issues));
|
|
2480
|
-
return
|
|
2468
|
+
return u(r, {
|
|
2481
2469
|
code: c.invalid_union,
|
|
2482
2470
|
unionErrors: i
|
|
2483
2471
|
}), _;
|
|
@@ -2504,27 +2492,27 @@ var init_shared_es = __esm({
|
|
|
2504
2492
|
{
|
|
2505
2493
|
let a;
|
|
2506
2494
|
const i = [];
|
|
2507
|
-
for (const
|
|
2508
|
-
const
|
|
2495
|
+
for (const f of n) {
|
|
2496
|
+
const h = {
|
|
2509
2497
|
...r,
|
|
2510
2498
|
common: {
|
|
2511
2499
|
...r.common,
|
|
2512
2500
|
issues: []
|
|
2513
2501
|
},
|
|
2514
2502
|
parent: null
|
|
2515
|
-
}, T =
|
|
2503
|
+
}, T = f._parseSync({
|
|
2516
2504
|
data: r.data,
|
|
2517
2505
|
path: r.path,
|
|
2518
|
-
parent:
|
|
2506
|
+
parent: h
|
|
2519
2507
|
});
|
|
2520
2508
|
if (T.status === "valid")
|
|
2521
2509
|
return T;
|
|
2522
|
-
T.status === "dirty" && !a && (a = { result: T, ctx:
|
|
2510
|
+
T.status === "dirty" && !a && (a = { result: T, ctx: h }), h.common.issues.length && i.push(h.common.issues);
|
|
2523
2511
|
}
|
|
2524
2512
|
if (a)
|
|
2525
2513
|
return r.common.issues.push(...a.ctx.common.issues), a.result;
|
|
2526
|
-
const o = i.map((
|
|
2527
|
-
return
|
|
2514
|
+
const o = i.map((f) => new R(f));
|
|
2515
|
+
return u(r, {
|
|
2528
2516
|
code: c.invalid_union,
|
|
2529
2517
|
unionErrors: o
|
|
2530
2518
|
}), _;
|
|
@@ -2539,14 +2527,14 @@ var init_shared_es = __esm({
|
|
|
2539
2527
|
typeName: p.ZodUnion,
|
|
2540
2528
|
...g(e)
|
|
2541
2529
|
});
|
|
2542
|
-
|
|
2543
|
-
|
|
2530
|
+
U = (t) => t instanceof Te ? U(t.schema) : t instanceof B ? U(t.innerType()) : t instanceof ce ? [t.value] : t instanceof z ? t.options : t instanceof Ee ? k.objectValues(t.enum) : t instanceof de ? U(t._def.innerType) : t instanceof ye ? [void 0] : t instanceof ge ? [null] : t instanceof Z ? [void 0, ...U(t.unwrap())] : t instanceof q ? [null, ...U(t.unwrap())] : t instanceof ze || t instanceof le ? U(t.unwrap()) : t instanceof ue ? U(t._def.innerType) : [];
|
|
2531
|
+
xe = class _xe extends v {
|
|
2544
2532
|
_parse(e) {
|
|
2545
2533
|
const { ctx: r } = this._processInputParams(e);
|
|
2546
|
-
if (r.parsedType !==
|
|
2547
|
-
return
|
|
2534
|
+
if (r.parsedType !== l.object)
|
|
2535
|
+
return u(r, {
|
|
2548
2536
|
code: c.invalid_type,
|
|
2549
|
-
expected:
|
|
2537
|
+
expected: l.object,
|
|
2550
2538
|
received: r.parsedType
|
|
2551
2539
|
}), _;
|
|
2552
2540
|
const n = this.discriminator, s = r.data[n], a = this.optionsMap.get(s);
|
|
@@ -2558,7 +2546,7 @@ var init_shared_es = __esm({
|
|
|
2558
2546
|
data: r.data,
|
|
2559
2547
|
path: r.path,
|
|
2560
2548
|
parent: r
|
|
2561
|
-
}) : (
|
|
2549
|
+
}) : (u(r, {
|
|
2562
2550
|
code: c.invalid_union_discriminator,
|
|
2563
2551
|
options: Array.from(this.optionsMap.keys()),
|
|
2564
2552
|
path: [n]
|
|
@@ -2584,7 +2572,7 @@ var init_shared_es = __esm({
|
|
|
2584
2572
|
static create(e, r, n) {
|
|
2585
2573
|
const s = /* @__PURE__ */ new Map();
|
|
2586
2574
|
for (const a of r) {
|
|
2587
|
-
const i =
|
|
2575
|
+
const i = U(a.shape[e]);
|
|
2588
2576
|
if (!i.length)
|
|
2589
2577
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
2590
2578
|
for (const o of i) {
|
|
@@ -2593,7 +2581,7 @@ var init_shared_es = __esm({
|
|
|
2593
2581
|
s.set(o, a);
|
|
2594
2582
|
}
|
|
2595
2583
|
}
|
|
2596
|
-
return new
|
|
2584
|
+
return new _xe({
|
|
2597
2585
|
typeName: p.ZodDiscriminatedUnion,
|
|
2598
2586
|
discriminator: e,
|
|
2599
2587
|
options: r,
|
|
@@ -2605,10 +2593,10 @@ var init_shared_es = __esm({
|
|
|
2605
2593
|
ie = class extends v {
|
|
2606
2594
|
_parse(e) {
|
|
2607
2595
|
const { status: r, ctx: n } = this._processInputParams(e), s = (a, i) => {
|
|
2608
|
-
if (
|
|
2596
|
+
if (Ie(a) || Ie(i))
|
|
2609
2597
|
return _;
|
|
2610
|
-
const o =
|
|
2611
|
-
return o.valid ? ((
|
|
2598
|
+
const o = ve(a.value, i.value);
|
|
2599
|
+
return o.valid ? ((we(a) || we(i)) && r.dirty(), { status: r.value, value: o.data }) : (u(n, {
|
|
2612
2600
|
code: c.invalid_intersection_types
|
|
2613
2601
|
}), _);
|
|
2614
2602
|
};
|
|
@@ -2640,24 +2628,24 @@ var init_shared_es = __esm({
|
|
|
2640
2628
|
typeName: p.ZodIntersection,
|
|
2641
2629
|
...g(r)
|
|
2642
2630
|
});
|
|
2643
|
-
|
|
2631
|
+
P = class _P extends v {
|
|
2644
2632
|
_parse(e) {
|
|
2645
2633
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2646
|
-
if (n.parsedType !==
|
|
2647
|
-
return
|
|
2634
|
+
if (n.parsedType !== l.array)
|
|
2635
|
+
return u(n, {
|
|
2648
2636
|
code: c.invalid_type,
|
|
2649
|
-
expected:
|
|
2637
|
+
expected: l.array,
|
|
2650
2638
|
received: n.parsedType
|
|
2651
2639
|
}), _;
|
|
2652
2640
|
if (n.data.length < this._def.items.length)
|
|
2653
|
-
return
|
|
2641
|
+
return u(n, {
|
|
2654
2642
|
code: c.too_small,
|
|
2655
2643
|
minimum: this._def.items.length,
|
|
2656
2644
|
inclusive: true,
|
|
2657
2645
|
exact: false,
|
|
2658
2646
|
type: "array"
|
|
2659
2647
|
}), _;
|
|
2660
|
-
!this._def.rest && n.data.length > this._def.items.length && (
|
|
2648
|
+
!this._def.rest && n.data.length > this._def.items.length && (u(n, {
|
|
2661
2649
|
code: c.too_big,
|
|
2662
2650
|
maximum: this._def.items.length,
|
|
2663
2651
|
inclusive: true,
|
|
@@ -2665,8 +2653,8 @@ var init_shared_es = __esm({
|
|
|
2665
2653
|
type: "array"
|
|
2666
2654
|
}), r.dirty());
|
|
2667
2655
|
const a = [...n.data].map((i, o) => {
|
|
2668
|
-
const
|
|
2669
|
-
return
|
|
2656
|
+
const f = this._def.items[o] || this._def.rest;
|
|
2657
|
+
return f ? f._parse(new M(n, i, n.path, o)) : null;
|
|
2670
2658
|
}).filter((i) => !!i);
|
|
2671
2659
|
return n.common.async ? Promise.all(a).then((i) => O.mergeArray(r, i)) : O.mergeArray(r, a);
|
|
2672
2660
|
}
|
|
@@ -2674,16 +2662,16 @@ var init_shared_es = __esm({
|
|
|
2674
2662
|
return this._def.items;
|
|
2675
2663
|
}
|
|
2676
2664
|
rest(e) {
|
|
2677
|
-
return new
|
|
2665
|
+
return new _P({
|
|
2678
2666
|
...this._def,
|
|
2679
2667
|
rest: e
|
|
2680
2668
|
});
|
|
2681
2669
|
}
|
|
2682
2670
|
};
|
|
2683
|
-
|
|
2671
|
+
P.create = (t, e) => {
|
|
2684
2672
|
if (!Array.isArray(t))
|
|
2685
2673
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2686
|
-
return new
|
|
2674
|
+
return new P({
|
|
2687
2675
|
items: t,
|
|
2688
2676
|
typeName: p.ZodTuple,
|
|
2689
2677
|
rest: null,
|
|
@@ -2699,10 +2687,10 @@ var init_shared_es = __esm({
|
|
|
2699
2687
|
}
|
|
2700
2688
|
_parse(e) {
|
|
2701
2689
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2702
|
-
if (n.parsedType !==
|
|
2703
|
-
return
|
|
2690
|
+
if (n.parsedType !== l.object)
|
|
2691
|
+
return u(n, {
|
|
2704
2692
|
code: c.invalid_type,
|
|
2705
|
-
expected:
|
|
2693
|
+
expected: l.object,
|
|
2706
2694
|
received: n.parsedType
|
|
2707
2695
|
}), _;
|
|
2708
2696
|
const s = [], a = this._def.keyType, i = this._def.valueType;
|
|
@@ -2731,7 +2719,7 @@ var init_shared_es = __esm({
|
|
|
2731
2719
|
});
|
|
2732
2720
|
}
|
|
2733
2721
|
};
|
|
2734
|
-
|
|
2722
|
+
Ue = class extends v {
|
|
2735
2723
|
get keySchema() {
|
|
2736
2724
|
return this._def.keyType;
|
|
2737
2725
|
}
|
|
@@ -2740,63 +2728,63 @@ var init_shared_es = __esm({
|
|
|
2740
2728
|
}
|
|
2741
2729
|
_parse(e) {
|
|
2742
2730
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2743
|
-
if (n.parsedType !==
|
|
2744
|
-
return
|
|
2731
|
+
if (n.parsedType !== l.map)
|
|
2732
|
+
return u(n, {
|
|
2745
2733
|
code: c.invalid_type,
|
|
2746
|
-
expected:
|
|
2734
|
+
expected: l.map,
|
|
2747
2735
|
received: n.parsedType
|
|
2748
2736
|
}), _;
|
|
2749
|
-
const s = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o,
|
|
2750
|
-
key: s._parse(new M(n, o, n.path, [
|
|
2751
|
-
value: a._parse(new M(n,
|
|
2737
|
+
const s = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o, f], h) => ({
|
|
2738
|
+
key: s._parse(new M(n, o, n.path, [h, "key"])),
|
|
2739
|
+
value: a._parse(new M(n, f, n.path, [h, "value"]))
|
|
2752
2740
|
}));
|
|
2753
2741
|
if (n.common.async) {
|
|
2754
2742
|
const o = /* @__PURE__ */ new Map();
|
|
2755
2743
|
return Promise.resolve().then(async () => {
|
|
2756
|
-
for (const
|
|
2757
|
-
const
|
|
2758
|
-
if (
|
|
2744
|
+
for (const f of i) {
|
|
2745
|
+
const h = await f.key, T = await f.value;
|
|
2746
|
+
if (h.status === "aborted" || T.status === "aborted")
|
|
2759
2747
|
return _;
|
|
2760
|
-
(
|
|
2748
|
+
(h.status === "dirty" || T.status === "dirty") && r.dirty(), o.set(h.value, T.value);
|
|
2761
2749
|
}
|
|
2762
2750
|
return { status: r.value, value: o };
|
|
2763
2751
|
});
|
|
2764
2752
|
} else {
|
|
2765
2753
|
const o = /* @__PURE__ */ new Map();
|
|
2766
|
-
for (const
|
|
2767
|
-
const
|
|
2768
|
-
if (
|
|
2754
|
+
for (const f of i) {
|
|
2755
|
+
const h = f.key, T = f.value;
|
|
2756
|
+
if (h.status === "aborted" || T.status === "aborted")
|
|
2769
2757
|
return _;
|
|
2770
|
-
(
|
|
2758
|
+
(h.status === "dirty" || T.status === "dirty") && r.dirty(), o.set(h.value, T.value);
|
|
2771
2759
|
}
|
|
2772
2760
|
return { status: r.value, value: o };
|
|
2773
2761
|
}
|
|
2774
2762
|
}
|
|
2775
2763
|
};
|
|
2776
|
-
|
|
2764
|
+
Ue.create = (t, e, r) => new Ue({
|
|
2777
2765
|
valueType: e,
|
|
2778
2766
|
keyType: t,
|
|
2779
2767
|
typeName: p.ZodMap,
|
|
2780
2768
|
...g(r)
|
|
2781
2769
|
});
|
|
2782
|
-
|
|
2770
|
+
te = class _te extends v {
|
|
2783
2771
|
_parse(e) {
|
|
2784
2772
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2785
|
-
if (n.parsedType !==
|
|
2786
|
-
return
|
|
2773
|
+
if (n.parsedType !== l.set)
|
|
2774
|
+
return u(n, {
|
|
2787
2775
|
code: c.invalid_type,
|
|
2788
|
-
expected:
|
|
2776
|
+
expected: l.set,
|
|
2789
2777
|
received: n.parsedType
|
|
2790
2778
|
}), _;
|
|
2791
2779
|
const s = this._def;
|
|
2792
|
-
s.minSize !== null && n.data.size < s.minSize.value && (
|
|
2780
|
+
s.minSize !== null && n.data.size < s.minSize.value && (u(n, {
|
|
2793
2781
|
code: c.too_small,
|
|
2794
2782
|
minimum: s.minSize.value,
|
|
2795
2783
|
type: "set",
|
|
2796
2784
|
inclusive: true,
|
|
2797
2785
|
exact: false,
|
|
2798
2786
|
message: s.minSize.message
|
|
2799
|
-
}), r.dirty()), s.maxSize !== null && n.data.size > s.maxSize.value && (
|
|
2787
|
+
}), r.dirty()), s.maxSize !== null && n.data.size > s.maxSize.value && (u(n, {
|
|
2800
2788
|
code: c.too_big,
|
|
2801
2789
|
maximum: s.maxSize.value,
|
|
2802
2790
|
type: "set",
|
|
@@ -2805,26 +2793,26 @@ var init_shared_es = __esm({
|
|
|
2805
2793
|
message: s.maxSize.message
|
|
2806
2794
|
}), r.dirty());
|
|
2807
2795
|
const a = this._def.valueType;
|
|
2808
|
-
function i(
|
|
2809
|
-
const
|
|
2810
|
-
for (const T of
|
|
2796
|
+
function i(f) {
|
|
2797
|
+
const h = /* @__PURE__ */ new Set();
|
|
2798
|
+
for (const T of f) {
|
|
2811
2799
|
if (T.status === "aborted")
|
|
2812
2800
|
return _;
|
|
2813
|
-
T.status === "dirty" && r.dirty(),
|
|
2801
|
+
T.status === "dirty" && r.dirty(), h.add(T.value);
|
|
2814
2802
|
}
|
|
2815
|
-
return { status: r.value, value:
|
|
2803
|
+
return { status: r.value, value: h };
|
|
2816
2804
|
}
|
|
2817
|
-
const o = [...n.data.values()].map((
|
|
2818
|
-
return n.common.async ? Promise.all(o).then((
|
|
2805
|
+
const o = [...n.data.values()].map((f, h) => a._parse(new M(n, f, n.path, h)));
|
|
2806
|
+
return n.common.async ? Promise.all(o).then((f) => i(f)) : i(o);
|
|
2819
2807
|
}
|
|
2820
2808
|
min(e, r) {
|
|
2821
|
-
return new
|
|
2809
|
+
return new _te({
|
|
2822
2810
|
...this._def,
|
|
2823
2811
|
minSize: { value: e, message: m.toString(r) }
|
|
2824
2812
|
});
|
|
2825
2813
|
}
|
|
2826
2814
|
max(e, r) {
|
|
2827
|
-
return new
|
|
2815
|
+
return new _te({
|
|
2828
2816
|
...this._def,
|
|
2829
2817
|
maxSize: { value: e, message: m.toString(r) }
|
|
2830
2818
|
});
|
|
@@ -2836,68 +2824,68 @@ var init_shared_es = __esm({
|
|
|
2836
2824
|
return this.min(1, e);
|
|
2837
2825
|
}
|
|
2838
2826
|
};
|
|
2839
|
-
|
|
2827
|
+
te.create = (t, e) => new te({
|
|
2840
2828
|
valueType: t,
|
|
2841
2829
|
minSize: null,
|
|
2842
2830
|
maxSize: null,
|
|
2843
2831
|
typeName: p.ZodSet,
|
|
2844
2832
|
...g(e)
|
|
2845
2833
|
});
|
|
2846
|
-
|
|
2834
|
+
H = class _H extends v {
|
|
2847
2835
|
constructor() {
|
|
2848
2836
|
super(...arguments), this.validate = this.implement;
|
|
2849
2837
|
}
|
|
2850
2838
|
_parse(e) {
|
|
2851
2839
|
const { ctx: r } = this._processInputParams(e);
|
|
2852
|
-
if (r.parsedType !==
|
|
2853
|
-
return
|
|
2840
|
+
if (r.parsedType !== l.function)
|
|
2841
|
+
return u(r, {
|
|
2854
2842
|
code: c.invalid_type,
|
|
2855
|
-
expected:
|
|
2843
|
+
expected: l.function,
|
|
2856
2844
|
received: r.parsedType
|
|
2857
2845
|
}), _;
|
|
2858
|
-
function n(o,
|
|
2859
|
-
return
|
|
2846
|
+
function n(o, f) {
|
|
2847
|
+
return pe({
|
|
2860
2848
|
data: o,
|
|
2861
2849
|
path: r.path,
|
|
2862
|
-
errorMaps: [r.common.contextualErrorMap, r.schemaErrorMap,
|
|
2850
|
+
errorMaps: [r.common.contextualErrorMap, r.schemaErrorMap, _e(), ee].filter((h) => !!h),
|
|
2863
2851
|
issueData: {
|
|
2864
2852
|
code: c.invalid_arguments,
|
|
2865
|
-
argumentsError:
|
|
2853
|
+
argumentsError: f
|
|
2866
2854
|
}
|
|
2867
2855
|
});
|
|
2868
2856
|
}
|
|
2869
|
-
function s(o,
|
|
2870
|
-
return
|
|
2857
|
+
function s(o, f) {
|
|
2858
|
+
return pe({
|
|
2871
2859
|
data: o,
|
|
2872
2860
|
path: r.path,
|
|
2873
|
-
errorMaps: [r.common.contextualErrorMap, r.schemaErrorMap,
|
|
2861
|
+
errorMaps: [r.common.contextualErrorMap, r.schemaErrorMap, _e(), ee].filter((h) => !!h),
|
|
2874
2862
|
issueData: {
|
|
2875
2863
|
code: c.invalid_return_type,
|
|
2876
|
-
returnTypeError:
|
|
2864
|
+
returnTypeError: f
|
|
2877
2865
|
}
|
|
2878
2866
|
});
|
|
2879
2867
|
}
|
|
2880
2868
|
const a = { errorMap: r.common.contextualErrorMap }, i = r.data;
|
|
2881
|
-
if (this._def.returns instanceof
|
|
2869
|
+
if (this._def.returns instanceof re) {
|
|
2882
2870
|
const o = this;
|
|
2883
|
-
return
|
|
2884
|
-
const
|
|
2885
|
-
throw
|
|
2886
|
-
}),
|
|
2887
|
-
return await o._def.returns._def.type.parseAsync(
|
|
2888
|
-
throw
|
|
2871
|
+
return A(async function(...f) {
|
|
2872
|
+
const h = new R([]), T = await o._def.args.parseAsync(f, a).catch((fe) => {
|
|
2873
|
+
throw h.addIssue(n(f, fe)), h;
|
|
2874
|
+
}), N = await Reflect.apply(i, this, T);
|
|
2875
|
+
return await o._def.returns._def.type.parseAsync(N, a).catch((fe) => {
|
|
2876
|
+
throw h.addIssue(s(N, fe)), h;
|
|
2889
2877
|
});
|
|
2890
2878
|
});
|
|
2891
2879
|
} else {
|
|
2892
2880
|
const o = this;
|
|
2893
|
-
return
|
|
2894
|
-
const
|
|
2895
|
-
if (!
|
|
2896
|
-
throw new R([n(
|
|
2897
|
-
const T = Reflect.apply(i, this,
|
|
2898
|
-
if (!
|
|
2899
|
-
throw new R([s(T,
|
|
2900
|
-
return
|
|
2881
|
+
return A(function(...f) {
|
|
2882
|
+
const h = o._def.args.safeParse(f, a);
|
|
2883
|
+
if (!h.success)
|
|
2884
|
+
throw new R([n(f, h.error)]);
|
|
2885
|
+
const T = Reflect.apply(i, this, h.data), N = o._def.returns.safeParse(T, a);
|
|
2886
|
+
if (!N.success)
|
|
2887
|
+
throw new R([s(T, N.error)]);
|
|
2888
|
+
return N.data;
|
|
2901
2889
|
});
|
|
2902
2890
|
}
|
|
2903
2891
|
}
|
|
@@ -2908,13 +2896,13 @@ var init_shared_es = __esm({
|
|
|
2908
2896
|
return this._def.returns;
|
|
2909
2897
|
}
|
|
2910
2898
|
args(...e) {
|
|
2911
|
-
return new
|
|
2899
|
+
return new _H({
|
|
2912
2900
|
...this._def,
|
|
2913
|
-
args:
|
|
2901
|
+
args: P.create(e).rest(Q.create())
|
|
2914
2902
|
});
|
|
2915
2903
|
}
|
|
2916
2904
|
returns(e) {
|
|
2917
|
-
return new
|
|
2905
|
+
return new _H({
|
|
2918
2906
|
...this._def,
|
|
2919
2907
|
returns: e
|
|
2920
2908
|
});
|
|
@@ -2926,15 +2914,15 @@ var init_shared_es = __esm({
|
|
|
2926
2914
|
return this.parse(e);
|
|
2927
2915
|
}
|
|
2928
2916
|
static create(e, r, n) {
|
|
2929
|
-
return new
|
|
2930
|
-
args: e ||
|
|
2931
|
-
returns: r ||
|
|
2917
|
+
return new _H({
|
|
2918
|
+
args: e || P.create([]).rest(Q.create()),
|
|
2919
|
+
returns: r || Q.create(),
|
|
2932
2920
|
typeName: p.ZodFunction,
|
|
2933
2921
|
...g(n)
|
|
2934
2922
|
});
|
|
2935
2923
|
}
|
|
2936
2924
|
};
|
|
2937
|
-
|
|
2925
|
+
Te = class extends v {
|
|
2938
2926
|
get schema() {
|
|
2939
2927
|
return this._def.getter();
|
|
2940
2928
|
}
|
|
@@ -2943,7 +2931,7 @@ var init_shared_es = __esm({
|
|
|
2943
2931
|
return this._def.getter()._parse({ data: r.data, path: r.path, parent: r });
|
|
2944
2932
|
}
|
|
2945
2933
|
};
|
|
2946
|
-
|
|
2934
|
+
Te.create = (t, e) => new Te({
|
|
2947
2935
|
getter: t,
|
|
2948
2936
|
typeName: p.ZodLazy,
|
|
2949
2937
|
...g(e)
|
|
@@ -2952,7 +2940,7 @@ var init_shared_es = __esm({
|
|
|
2952
2940
|
_parse(e) {
|
|
2953
2941
|
if (e.data !== this._def.value) {
|
|
2954
2942
|
const r = this._getOrReturnCtx(e);
|
|
2955
|
-
return
|
|
2943
|
+
return u(r, {
|
|
2956
2944
|
received: r.data,
|
|
2957
2945
|
code: c.invalid_literal,
|
|
2958
2946
|
expected: this._def.value
|
|
@@ -2969,25 +2957,25 @@ var init_shared_es = __esm({
|
|
|
2969
2957
|
typeName: p.ZodLiteral,
|
|
2970
2958
|
...g(e)
|
|
2971
2959
|
});
|
|
2972
|
-
|
|
2960
|
+
z = class _z extends v {
|
|
2973
2961
|
_parse(e) {
|
|
2974
2962
|
if (typeof e.data != "string") {
|
|
2975
2963
|
const r = this._getOrReturnCtx(e), n = this._def.values;
|
|
2976
|
-
return
|
|
2977
|
-
expected:
|
|
2964
|
+
return u(r, {
|
|
2965
|
+
expected: k.joinValues(n),
|
|
2978
2966
|
received: r.parsedType,
|
|
2979
2967
|
code: c.invalid_type
|
|
2980
2968
|
}), _;
|
|
2981
2969
|
}
|
|
2982
2970
|
if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
|
|
2983
2971
|
const r = this._getOrReturnCtx(e), n = this._def.values;
|
|
2984
|
-
return
|
|
2972
|
+
return u(r, {
|
|
2985
2973
|
received: r.data,
|
|
2986
2974
|
code: c.invalid_enum_value,
|
|
2987
2975
|
options: n
|
|
2988
2976
|
}), _;
|
|
2989
2977
|
}
|
|
2990
|
-
return
|
|
2978
|
+
return A(e.data);
|
|
2991
2979
|
}
|
|
2992
2980
|
get options() {
|
|
2993
2981
|
return this._def.values;
|
|
@@ -3011,74 +2999,74 @@ var init_shared_es = __esm({
|
|
|
3011
2999
|
return e;
|
|
3012
3000
|
}
|
|
3013
3001
|
extract(e, r = this._def) {
|
|
3014
|
-
return
|
|
3002
|
+
return _z.create(e, {
|
|
3015
3003
|
...this._def,
|
|
3016
3004
|
...r
|
|
3017
3005
|
});
|
|
3018
3006
|
}
|
|
3019
3007
|
exclude(e, r = this._def) {
|
|
3020
|
-
return
|
|
3008
|
+
return _z.create(this.options.filter((n) => !e.includes(n)), {
|
|
3021
3009
|
...this._def,
|
|
3022
3010
|
...r
|
|
3023
3011
|
});
|
|
3024
3012
|
}
|
|
3025
3013
|
};
|
|
3026
|
-
|
|
3027
|
-
|
|
3014
|
+
z.create = Fe;
|
|
3015
|
+
Ee = class extends v {
|
|
3028
3016
|
_parse(e) {
|
|
3029
|
-
const r =
|
|
3030
|
-
if (n.parsedType !==
|
|
3031
|
-
const s =
|
|
3032
|
-
return
|
|
3033
|
-
expected:
|
|
3017
|
+
const r = k.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
3018
|
+
if (n.parsedType !== l.string && n.parsedType !== l.number) {
|
|
3019
|
+
const s = k.objectValues(r);
|
|
3020
|
+
return u(n, {
|
|
3021
|
+
expected: k.joinValues(s),
|
|
3034
3022
|
received: n.parsedType,
|
|
3035
3023
|
code: c.invalid_type
|
|
3036
3024
|
}), _;
|
|
3037
3025
|
}
|
|
3038
|
-
if (this._cache || (this._cache = new Set(
|
|
3039
|
-
const s =
|
|
3040
|
-
return
|
|
3026
|
+
if (this._cache || (this._cache = new Set(k.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
|
|
3027
|
+
const s = k.objectValues(r);
|
|
3028
|
+
return u(n, {
|
|
3041
3029
|
received: n.data,
|
|
3042
3030
|
code: c.invalid_enum_value,
|
|
3043
3031
|
options: s
|
|
3044
3032
|
}), _;
|
|
3045
3033
|
}
|
|
3046
|
-
return
|
|
3034
|
+
return A(e.data);
|
|
3047
3035
|
}
|
|
3048
3036
|
get enum() {
|
|
3049
3037
|
return this._def.values;
|
|
3050
3038
|
}
|
|
3051
3039
|
};
|
|
3052
|
-
|
|
3040
|
+
Ee.create = (t, e) => new Ee({
|
|
3053
3041
|
values: t,
|
|
3054
3042
|
typeName: p.ZodNativeEnum,
|
|
3055
3043
|
...g(e)
|
|
3056
3044
|
});
|
|
3057
|
-
|
|
3045
|
+
re = class extends v {
|
|
3058
3046
|
unwrap() {
|
|
3059
3047
|
return this._def.type;
|
|
3060
3048
|
}
|
|
3061
3049
|
_parse(e) {
|
|
3062
3050
|
const { ctx: r } = this._processInputParams(e);
|
|
3063
|
-
if (r.parsedType !==
|
|
3064
|
-
return
|
|
3051
|
+
if (r.parsedType !== l.promise && r.common.async === false)
|
|
3052
|
+
return u(r, {
|
|
3065
3053
|
code: c.invalid_type,
|
|
3066
|
-
expected:
|
|
3054
|
+
expected: l.promise,
|
|
3067
3055
|
received: r.parsedType
|
|
3068
3056
|
}), _;
|
|
3069
|
-
const n = r.parsedType ===
|
|
3070
|
-
return
|
|
3057
|
+
const n = r.parsedType === l.promise ? r.data : Promise.resolve(r.data);
|
|
3058
|
+
return A(n.then((s) => this._def.type.parseAsync(s, {
|
|
3071
3059
|
path: r.path,
|
|
3072
3060
|
errorMap: r.common.contextualErrorMap
|
|
3073
3061
|
})));
|
|
3074
3062
|
}
|
|
3075
3063
|
};
|
|
3076
|
-
|
|
3064
|
+
re.create = (t, e) => new re({
|
|
3077
3065
|
type: t,
|
|
3078
3066
|
typeName: p.ZodPromise,
|
|
3079
3067
|
...g(e)
|
|
3080
3068
|
});
|
|
3081
|
-
|
|
3069
|
+
B = class extends v {
|
|
3082
3070
|
innerType() {
|
|
3083
3071
|
return this._def.schema;
|
|
3084
3072
|
}
|
|
@@ -3088,7 +3076,7 @@ var init_shared_es = __esm({
|
|
|
3088
3076
|
_parse(e) {
|
|
3089
3077
|
const { status: r, ctx: n } = this._processInputParams(e), s = this._def.effect || null, a = {
|
|
3090
3078
|
addIssue: (i) => {
|
|
3091
|
-
|
|
3079
|
+
u(n, i), i.fatal ? r.abort() : r.dirty();
|
|
3092
3080
|
},
|
|
3093
3081
|
get path() {
|
|
3094
3082
|
return n.path;
|
|
@@ -3100,12 +3088,12 @@ var init_shared_es = __esm({
|
|
|
3100
3088
|
return Promise.resolve(i).then(async (o) => {
|
|
3101
3089
|
if (r.value === "aborted")
|
|
3102
3090
|
return _;
|
|
3103
|
-
const
|
|
3091
|
+
const f = await this._def.schema._parseAsync({
|
|
3104
3092
|
data: o,
|
|
3105
3093
|
path: n.path,
|
|
3106
3094
|
parent: n
|
|
3107
3095
|
});
|
|
3108
|
-
return
|
|
3096
|
+
return f.status === "aborted" ? _ : f.status === "dirty" || r.value === "dirty" ? J(f.value) : f;
|
|
3109
3097
|
});
|
|
3110
3098
|
{
|
|
3111
3099
|
if (r.value === "aborted")
|
|
@@ -3115,15 +3103,15 @@ var init_shared_es = __esm({
|
|
|
3115
3103
|
path: n.path,
|
|
3116
3104
|
parent: n
|
|
3117
3105
|
});
|
|
3118
|
-
return o.status === "aborted" ? _ : o.status === "dirty" || r.value === "dirty" ?
|
|
3106
|
+
return o.status === "aborted" ? _ : o.status === "dirty" || r.value === "dirty" ? J(o.value) : o;
|
|
3119
3107
|
}
|
|
3120
3108
|
}
|
|
3121
3109
|
if (s.type === "refinement") {
|
|
3122
3110
|
const i = (o) => {
|
|
3123
|
-
const
|
|
3111
|
+
const f = s.refinement(o, a);
|
|
3124
3112
|
if (n.common.async)
|
|
3125
|
-
return Promise.resolve(
|
|
3126
|
-
if (
|
|
3113
|
+
return Promise.resolve(f);
|
|
3114
|
+
if (f instanceof Promise)
|
|
3127
3115
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3128
3116
|
return o;
|
|
3129
3117
|
};
|
|
@@ -3144,54 +3132,54 @@ var init_shared_es = __esm({
|
|
|
3144
3132
|
path: n.path,
|
|
3145
3133
|
parent: n
|
|
3146
3134
|
});
|
|
3147
|
-
if (!
|
|
3135
|
+
if (!X(i))
|
|
3148
3136
|
return _;
|
|
3149
3137
|
const o = s.transform(i.value, a);
|
|
3150
3138
|
if (o instanceof Promise)
|
|
3151
3139
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3152
3140
|
return { status: r.value, value: o };
|
|
3153
3141
|
} else
|
|
3154
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) =>
|
|
3142
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => X(i) ? Promise.resolve(s.transform(i.value, a)).then((o) => ({
|
|
3155
3143
|
status: r.value,
|
|
3156
3144
|
value: o
|
|
3157
3145
|
})) : _);
|
|
3158
|
-
|
|
3146
|
+
k.assertNever(s);
|
|
3159
3147
|
}
|
|
3160
3148
|
};
|
|
3161
|
-
|
|
3149
|
+
B.create = (t, e, r) => new B({
|
|
3162
3150
|
schema: t,
|
|
3163
3151
|
typeName: p.ZodEffects,
|
|
3164
3152
|
effect: e,
|
|
3165
3153
|
...g(r)
|
|
3166
3154
|
});
|
|
3167
|
-
|
|
3155
|
+
B.createWithPreprocess = (t, e, r) => new B({
|
|
3168
3156
|
schema: e,
|
|
3169
3157
|
effect: { type: "preprocess", transform: t },
|
|
3170
3158
|
typeName: p.ZodEffects,
|
|
3171
3159
|
...g(r)
|
|
3172
3160
|
});
|
|
3173
|
-
|
|
3161
|
+
Z = class extends v {
|
|
3174
3162
|
_parse(e) {
|
|
3175
|
-
return this._getType(e) ===
|
|
3163
|
+
return this._getType(e) === l.undefined ? A(void 0) : this._def.innerType._parse(e);
|
|
3176
3164
|
}
|
|
3177
3165
|
unwrap() {
|
|
3178
3166
|
return this._def.innerType;
|
|
3179
3167
|
}
|
|
3180
3168
|
};
|
|
3181
|
-
|
|
3169
|
+
Z.create = (t, e) => new Z({
|
|
3182
3170
|
innerType: t,
|
|
3183
3171
|
typeName: p.ZodOptional,
|
|
3184
3172
|
...g(e)
|
|
3185
3173
|
});
|
|
3186
|
-
|
|
3174
|
+
q = class extends v {
|
|
3187
3175
|
_parse(e) {
|
|
3188
|
-
return this._getType(e) ===
|
|
3176
|
+
return this._getType(e) === l.null ? A(null) : this._def.innerType._parse(e);
|
|
3189
3177
|
}
|
|
3190
3178
|
unwrap() {
|
|
3191
3179
|
return this._def.innerType;
|
|
3192
3180
|
}
|
|
3193
3181
|
};
|
|
3194
|
-
|
|
3182
|
+
q.create = (t, e) => new q({
|
|
3195
3183
|
innerType: t,
|
|
3196
3184
|
typeName: p.ZodNullable,
|
|
3197
3185
|
...g(e)
|
|
@@ -3200,7 +3188,7 @@ var init_shared_es = __esm({
|
|
|
3200
3188
|
_parse(e) {
|
|
3201
3189
|
const { ctx: r } = this._processInputParams(e);
|
|
3202
3190
|
let n = r.data;
|
|
3203
|
-
return r.parsedType ===
|
|
3191
|
+
return r.parsedType === l.undefined && (n = this._def.defaultValue()), this._def.innerType._parse({
|
|
3204
3192
|
data: n,
|
|
3205
3193
|
path: r.path,
|
|
3206
3194
|
parent: r
|
|
@@ -3259,24 +3247,24 @@ var init_shared_es = __esm({
|
|
|
3259
3247
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
3260
3248
|
...g(e)
|
|
3261
3249
|
});
|
|
3262
|
-
|
|
3250
|
+
Ze = class extends v {
|
|
3263
3251
|
_parse(e) {
|
|
3264
|
-
if (this._getType(e) !==
|
|
3252
|
+
if (this._getType(e) !== l.nan) {
|
|
3265
3253
|
const n = this._getOrReturnCtx(e);
|
|
3266
|
-
return
|
|
3254
|
+
return u(n, {
|
|
3267
3255
|
code: c.invalid_type,
|
|
3268
|
-
expected:
|
|
3256
|
+
expected: l.nan,
|
|
3269
3257
|
received: n.parsedType
|
|
3270
3258
|
}), _;
|
|
3271
3259
|
}
|
|
3272
3260
|
return { status: "valid", value: e.data };
|
|
3273
3261
|
}
|
|
3274
3262
|
};
|
|
3275
|
-
|
|
3263
|
+
Ze.create = (t) => new Ze({
|
|
3276
3264
|
typeName: p.ZodNaN,
|
|
3277
3265
|
...g(t)
|
|
3278
3266
|
});
|
|
3279
|
-
|
|
3267
|
+
ze = class extends v {
|
|
3280
3268
|
_parse(e) {
|
|
3281
3269
|
const { ctx: r } = this._processInputParams(e), n = r.data;
|
|
3282
3270
|
return this._def.type._parse({
|
|
@@ -3289,7 +3277,7 @@ var init_shared_es = __esm({
|
|
|
3289
3277
|
return this._def.type;
|
|
3290
3278
|
}
|
|
3291
3279
|
};
|
|
3292
|
-
|
|
3280
|
+
be = class _be extends v {
|
|
3293
3281
|
_parse(e) {
|
|
3294
3282
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
3295
3283
|
if (n.common.async)
|
|
@@ -3299,7 +3287,7 @@ var init_shared_es = __esm({
|
|
|
3299
3287
|
path: n.path,
|
|
3300
3288
|
parent: n
|
|
3301
3289
|
});
|
|
3302
|
-
return a.status === "aborted" ? _ : a.status === "dirty" ? (r.dirty(),
|
|
3290
|
+
return a.status === "aborted" ? _ : a.status === "dirty" ? (r.dirty(), J(a.value)) : this._def.out._parseAsync({
|
|
3303
3291
|
data: a.value,
|
|
3304
3292
|
path: n.path,
|
|
3305
3293
|
parent: n
|
|
@@ -3322,7 +3310,7 @@ var init_shared_es = __esm({
|
|
|
3322
3310
|
}
|
|
3323
3311
|
}
|
|
3324
3312
|
static create(e, r) {
|
|
3325
|
-
return new
|
|
3313
|
+
return new _be({
|
|
3326
3314
|
in: e,
|
|
3327
3315
|
out: r,
|
|
3328
3316
|
typeName: p.ZodPipeline
|
|
@@ -3331,7 +3319,7 @@ var init_shared_es = __esm({
|
|
|
3331
3319
|
};
|
|
3332
3320
|
le = class extends v {
|
|
3333
3321
|
_parse(e) {
|
|
3334
|
-
const r = this._def.innerType._parse(e), n = (s) => (
|
|
3322
|
+
const r = this._def.innerType._parse(e), n = (s) => (X(s) && (s.value = Object.freeze(s.value)), s);
|
|
3335
3323
|
return ne(r) ? r.then((s) => n(s)) : n(r);
|
|
3336
3324
|
}
|
|
3337
3325
|
unwrap() {
|
|
@@ -3346,217 +3334,282 @@ var init_shared_es = __esm({
|
|
|
3346
3334
|
(function(t) {
|
|
3347
3335
|
t.ZodString = "ZodString", t.ZodNumber = "ZodNumber", t.ZodNaN = "ZodNaN", t.ZodBigInt = "ZodBigInt", t.ZodBoolean = "ZodBoolean", t.ZodDate = "ZodDate", t.ZodSymbol = "ZodSymbol", t.ZodUndefined = "ZodUndefined", t.ZodNull = "ZodNull", t.ZodAny = "ZodAny", t.ZodUnknown = "ZodUnknown", t.ZodNever = "ZodNever", t.ZodVoid = "ZodVoid", t.ZodArray = "ZodArray", t.ZodObject = "ZodObject", t.ZodUnion = "ZodUnion", t.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", t.ZodIntersection = "ZodIntersection", t.ZodTuple = "ZodTuple", t.ZodRecord = "ZodRecord", t.ZodMap = "ZodMap", t.ZodSet = "ZodSet", t.ZodFunction = "ZodFunction", t.ZodLazy = "ZodLazy", t.ZodLiteral = "ZodLiteral", t.ZodEnum = "ZodEnum", t.ZodEffects = "ZodEffects", t.ZodNativeEnum = "ZodNativeEnum", t.ZodOptional = "ZodOptional", t.ZodNullable = "ZodNullable", t.ZodDefault = "ZodDefault", t.ZodCatch = "ZodCatch", t.ZodPromise = "ZodPromise", t.ZodBranded = "ZodBranded", t.ZodPipeline = "ZodPipeline", t.ZodReadonly = "ZodReadonly";
|
|
3348
3336
|
})(p || (p = {}));
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
I =
|
|
3354
|
-
|
|
3337
|
+
d = w.create;
|
|
3338
|
+
E = V.create;
|
|
3339
|
+
F.create;
|
|
3340
|
+
Oe = se.create;
|
|
3341
|
+
I = K.create;
|
|
3342
|
+
G = Q.create;
|
|
3355
3343
|
C.create;
|
|
3356
|
-
|
|
3344
|
+
S = D.create;
|
|
3357
3345
|
y = x.create;
|
|
3358
|
-
|
|
3359
|
-
|
|
3346
|
+
gt = ae.create;
|
|
3347
|
+
Be = xe.create;
|
|
3360
3348
|
ie.create;
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3349
|
+
P.create;
|
|
3350
|
+
$ = oe.create;
|
|
3351
|
+
Pe = H.create;
|
|
3364
3352
|
b = ce.create;
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3353
|
+
L = z.create;
|
|
3354
|
+
vt = re.create;
|
|
3355
|
+
Z.create;
|
|
3356
|
+
q.create;
|
|
3357
|
+
he = {
|
|
3370
3358
|
string: (t) => w.create({ ...t, coerce: true }),
|
|
3371
|
-
number: (t) =>
|
|
3359
|
+
number: (t) => V.create({ ...t, coerce: true }),
|
|
3372
3360
|
boolean: (t) => se.create({
|
|
3373
3361
|
...t,
|
|
3374
3362
|
coerce: true
|
|
3375
3363
|
}),
|
|
3376
|
-
bigint: (t) =>
|
|
3377
|
-
date: (t) =>
|
|
3364
|
+
bigint: (t) => F.create({ ...t, coerce: true }),
|
|
3365
|
+
date: (t) => K.create({ ...t, coerce: true })
|
|
3378
3366
|
};
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
id:
|
|
3382
|
-
organizationId:
|
|
3383
|
-
name:
|
|
3384
|
-
keyHash:
|
|
3385
|
-
keyPrefix:
|
|
3386
|
-
keySuffix:
|
|
3387
|
-
isActive:
|
|
3367
|
+
je = 100;
|
|
3368
|
+
Zt = y({
|
|
3369
|
+
id: d().uuid(),
|
|
3370
|
+
organizationId: d().uuid(),
|
|
3371
|
+
name: d(),
|
|
3372
|
+
keyHash: d(),
|
|
3373
|
+
keyPrefix: d(),
|
|
3374
|
+
keySuffix: d(),
|
|
3375
|
+
isActive: Oe(),
|
|
3388
3376
|
lastUsedAt: I().nullable(),
|
|
3389
3377
|
createdAt: I(),
|
|
3390
3378
|
updatedAt: I()
|
|
3391
3379
|
});
|
|
3392
|
-
|
|
3393
|
-
id:
|
|
3394
|
-
apiKeyId:
|
|
3395
|
-
organizationId:
|
|
3396
|
-
tokensUsed:
|
|
3397
|
-
model:
|
|
3398
|
-
statusCode:
|
|
3380
|
+
Pt = y({
|
|
3381
|
+
id: d().uuid(),
|
|
3382
|
+
apiKeyId: d().uuid(),
|
|
3383
|
+
organizationId: d().uuid(),
|
|
3384
|
+
tokensUsed: E().int().positive(),
|
|
3385
|
+
model: d(),
|
|
3386
|
+
statusCode: E().int(),
|
|
3399
3387
|
createdAt: I()
|
|
3400
3388
|
});
|
|
3401
|
-
|
|
3402
|
-
name:
|
|
3403
|
-
|
|
3404
|
-
`API key name must be less than ${
|
|
3389
|
+
jt = y({
|
|
3390
|
+
name: d().min(1, "API key name is required").max(
|
|
3391
|
+
je,
|
|
3392
|
+
`API key name must be less than ${je} characters`
|
|
3405
3393
|
)
|
|
3406
3394
|
});
|
|
3407
|
-
|
|
3408
|
-
id:
|
|
3409
|
-
name:
|
|
3410
|
-
keyPrefix:
|
|
3411
|
-
keySuffix:
|
|
3395
|
+
Ct = y({
|
|
3396
|
+
id: d().uuid(),
|
|
3397
|
+
name: d(),
|
|
3398
|
+
keyPrefix: d(),
|
|
3399
|
+
keySuffix: d(),
|
|
3412
3400
|
lastUsedAt: I().nullable(),
|
|
3413
3401
|
createdAt: I(),
|
|
3414
|
-
currentMonthUsage:
|
|
3402
|
+
currentMonthUsage: E().int().nonnegative(),
|
|
3415
3403
|
// Full key is only returned once at creation
|
|
3416
|
-
key:
|
|
3404
|
+
key: d().optional()
|
|
3417
3405
|
});
|
|
3418
|
-
|
|
3419
|
-
totalTokens:
|
|
3420
|
-
totalRequests:
|
|
3421
|
-
successfulRequests:
|
|
3422
|
-
failedRequests:
|
|
3406
|
+
$t = y({
|
|
3407
|
+
totalTokens: E().int(),
|
|
3408
|
+
totalRequests: E().int(),
|
|
3409
|
+
successfulRequests: E().int(),
|
|
3410
|
+
failedRequests: E().int()
|
|
3423
3411
|
});
|
|
3424
|
-
|
|
3425
|
-
error:
|
|
3412
|
+
Tt = y({
|
|
3413
|
+
error: d().describe("The error message")
|
|
3426
3414
|
});
|
|
3427
3415
|
y({
|
|
3428
|
-
error:
|
|
3416
|
+
error: d().describe("The error message")
|
|
3429
3417
|
});
|
|
3430
|
-
|
|
3431
|
-
errors:
|
|
3432
|
-
message:
|
|
3418
|
+
Ce = y({
|
|
3419
|
+
errors: $(S(d())).describe("Field validation errors"),
|
|
3420
|
+
message: d().optional().describe("General error message")
|
|
3433
3421
|
});
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3422
|
+
gt([
|
|
3423
|
+
Tt,
|
|
3424
|
+
Ce,
|
|
3437
3425
|
y({
|
|
3438
3426
|
response: y({
|
|
3439
|
-
clone:
|
|
3427
|
+
clone: Pe().returns(
|
|
3440
3428
|
y({
|
|
3441
|
-
json:
|
|
3429
|
+
json: Pe().returns(vt(Ce))
|
|
3442
3430
|
})
|
|
3443
3431
|
)
|
|
3444
3432
|
})
|
|
3445
3433
|
})
|
|
3446
3434
|
]);
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3435
|
+
Ae = L([
|
|
3436
|
+
"agent_quality",
|
|
3437
|
+
"tool_issues",
|
|
3438
|
+
"ui_ux",
|
|
3439
|
+
"feature_request",
|
|
3440
|
+
"other"
|
|
3441
|
+
]);
|
|
3442
|
+
Vt = {
|
|
3443
|
+
agent_quality: {
|
|
3444
|
+
label: "Agent quality",
|
|
3445
|
+
description: "Wrong answers, loops, hallucinations"
|
|
3446
|
+
},
|
|
3447
|
+
tool_issues: {
|
|
3448
|
+
label: "Tool issues",
|
|
3449
|
+
description: "File edits failed, commands didn't work"
|
|
3450
|
+
},
|
|
3451
|
+
ui_ux: {
|
|
3452
|
+
label: "UI/UX problem",
|
|
3453
|
+
description: "Display glitches, input issues"
|
|
3454
|
+
},
|
|
3455
|
+
feature_request: {
|
|
3456
|
+
label: "Feature request",
|
|
3457
|
+
description: "Something you'd like to see"
|
|
3458
|
+
},
|
|
3459
|
+
other: {
|
|
3460
|
+
label: "Other",
|
|
3461
|
+
description: "Anything else"
|
|
3462
|
+
}
|
|
3463
|
+
};
|
|
3464
|
+
Ft = y({
|
|
3465
|
+
category: Ae,
|
|
3466
|
+
description: d().min(1, "Description is required").max(5e3),
|
|
3467
|
+
sessionId: d().uuid().optional(),
|
|
3468
|
+
queryId: d().uuid().optional(),
|
|
3469
|
+
model: d().optional(),
|
|
3470
|
+
cliVersion: d().optional(),
|
|
3471
|
+
metadata: $(G()).optional()
|
|
3472
|
+
});
|
|
3473
|
+
Et = y({
|
|
3474
|
+
id: d().uuid(),
|
|
3475
|
+
userId: d(),
|
|
3476
|
+
orgId: d().nullable(),
|
|
3477
|
+
sessionId: d().uuid().nullable(),
|
|
3478
|
+
queryId: d().uuid().nullable(),
|
|
3479
|
+
category: Ae,
|
|
3480
|
+
description: d(),
|
|
3481
|
+
model: d().nullable(),
|
|
3482
|
+
cliVersion: d().nullable(),
|
|
3483
|
+
metadata: $(G()).nullable(),
|
|
3484
|
+
createdAt: d()
|
|
3485
|
+
});
|
|
3486
|
+
zt = y({
|
|
3487
|
+
category: Ae.optional(),
|
|
3488
|
+
startDate: d().optional(),
|
|
3489
|
+
endDate: d().optional(),
|
|
3490
|
+
search: d().optional(),
|
|
3491
|
+
limit: he.number().min(1).max(100).default(20),
|
|
3492
|
+
offset: he.number().min(0).default(0)
|
|
3493
|
+
});
|
|
3494
|
+
Bt = y({
|
|
3495
|
+
items: S(Et),
|
|
3496
|
+
total: E(),
|
|
3497
|
+
limit: E(),
|
|
3498
|
+
offset: E()
|
|
3499
|
+
});
|
|
3500
|
+
kt = 100;
|
|
3501
|
+
qt = y({
|
|
3502
|
+
id: d().uuid(),
|
|
3503
|
+
orgId: d(),
|
|
3504
|
+
timezone: d().nullable(),
|
|
3505
|
+
monthlyTokenLimit: E().int().positive(),
|
|
3453
3506
|
createdAt: I(),
|
|
3454
3507
|
updatedAt: I()
|
|
3455
3508
|
});
|
|
3456
|
-
|
|
3457
|
-
timezone:
|
|
3458
|
-
monthlyTokenLimit:
|
|
3509
|
+
xt = y({
|
|
3510
|
+
timezone: d().max(kt, "Timezone must be less than 100 characters").nullable().optional(),
|
|
3511
|
+
monthlyTokenLimit: E().int().positive().optional()
|
|
3459
3512
|
});
|
|
3460
|
-
|
|
3513
|
+
bt = y({
|
|
3461
3514
|
type: b("text"),
|
|
3462
|
-
text:
|
|
3515
|
+
text: d()
|
|
3463
3516
|
});
|
|
3464
|
-
|
|
3517
|
+
Ot = y({
|
|
3465
3518
|
type: b("tool_use"),
|
|
3466
|
-
id:
|
|
3467
|
-
name:
|
|
3468
|
-
input:
|
|
3519
|
+
id: d(),
|
|
3520
|
+
name: d(),
|
|
3521
|
+
input: $(G())
|
|
3469
3522
|
});
|
|
3470
|
-
|
|
3523
|
+
At = y({
|
|
3471
3524
|
type: b("tool_result"),
|
|
3472
|
-
tool_use_id:
|
|
3473
|
-
content:
|
|
3474
|
-
is_error:
|
|
3525
|
+
tool_use_id: d(),
|
|
3526
|
+
content: d(),
|
|
3527
|
+
is_error: Oe().optional()
|
|
3475
3528
|
});
|
|
3476
|
-
|
|
3529
|
+
Nt = y({
|
|
3477
3530
|
type: b("thinking"),
|
|
3478
|
-
thinking:
|
|
3531
|
+
thinking: d()
|
|
3479
3532
|
});
|
|
3480
|
-
|
|
3533
|
+
Rt = y({
|
|
3481
3534
|
type: b("image"),
|
|
3482
3535
|
source: y({
|
|
3483
3536
|
type: b("base64"),
|
|
3484
|
-
media_type:
|
|
3485
|
-
data:
|
|
3537
|
+
media_type: d(),
|
|
3538
|
+
data: d()
|
|
3486
3539
|
})
|
|
3487
3540
|
});
|
|
3488
|
-
W =
|
|
3489
|
-
Et,
|
|
3490
|
-
kt,
|
|
3491
|
-
xt,
|
|
3541
|
+
W = Be("type", [
|
|
3492
3542
|
bt,
|
|
3493
|
-
Ot
|
|
3543
|
+
Ot,
|
|
3544
|
+
At,
|
|
3545
|
+
Nt,
|
|
3546
|
+
Rt
|
|
3494
3547
|
]);
|
|
3495
|
-
|
|
3496
|
-
id:
|
|
3497
|
-
orgId:
|
|
3498
|
-
userId:
|
|
3499
|
-
title:
|
|
3500
|
-
origin:
|
|
3501
|
-
originMetadata:
|
|
3502
|
-
authMethod:
|
|
3503
|
-
authId:
|
|
3548
|
+
Gt = y({
|
|
3549
|
+
id: d().uuid(),
|
|
3550
|
+
orgId: d(),
|
|
3551
|
+
userId: d().uuid(),
|
|
3552
|
+
title: d().nullable(),
|
|
3553
|
+
origin: L(["cli", "web", "github"]).default("web"),
|
|
3554
|
+
originMetadata: $(G()).nullable().optional(),
|
|
3555
|
+
authMethod: L(["clerk", "cli-token", "api-key"]).default("clerk"),
|
|
3556
|
+
authId: d().nullable().optional(),
|
|
3504
3557
|
// Claude Agent SDK session ID for resuming conversations
|
|
3505
3558
|
// Sessions expire after ~30 days due to Anthropic's data retention policy
|
|
3506
|
-
providerSessionId:
|
|
3559
|
+
providerSessionId: d().nullable().optional(),
|
|
3507
3560
|
createdAt: I(),
|
|
3508
3561
|
updatedAt: I()
|
|
3509
3562
|
});
|
|
3510
|
-
|
|
3511
|
-
title:
|
|
3512
|
-
origin:
|
|
3513
|
-
originMetadata:
|
|
3563
|
+
Yt = y({
|
|
3564
|
+
title: d().optional(),
|
|
3565
|
+
origin: L(["cli", "web", "github"]).optional(),
|
|
3566
|
+
originMetadata: $(G()).optional()
|
|
3514
3567
|
});
|
|
3515
|
-
|
|
3516
|
-
title:
|
|
3517
|
-
providerSessionId:
|
|
3568
|
+
Qt = y({
|
|
3569
|
+
title: d().optional(),
|
|
3570
|
+
providerSessionId: d().optional()
|
|
3518
3571
|
});
|
|
3519
|
-
|
|
3520
|
-
id:
|
|
3521
|
-
conversationId:
|
|
3522
|
-
role:
|
|
3523
|
-
content:
|
|
3572
|
+
Xt = y({
|
|
3573
|
+
id: d().uuid(),
|
|
3574
|
+
conversationId: d().uuid(),
|
|
3575
|
+
role: L(["user", "assistant"]),
|
|
3576
|
+
content: S(W),
|
|
3524
3577
|
createdAt: I()
|
|
3525
3578
|
});
|
|
3526
|
-
|
|
3527
|
-
role:
|
|
3528
|
-
content:
|
|
3579
|
+
Kt = y({
|
|
3580
|
+
role: L(["user", "assistant"]),
|
|
3581
|
+
content: S(W)
|
|
3529
3582
|
});
|
|
3530
|
-
|
|
3583
|
+
Jt = Be("type", [
|
|
3531
3584
|
y({
|
|
3532
3585
|
type: b("user_message"),
|
|
3533
|
-
content:
|
|
3586
|
+
content: S(W)
|
|
3534
3587
|
}),
|
|
3535
3588
|
y({
|
|
3536
3589
|
type: b("assistant_text"),
|
|
3537
|
-
delta:
|
|
3590
|
+
delta: d()
|
|
3538
3591
|
}),
|
|
3539
3592
|
y({
|
|
3540
3593
|
type: b("assistant_thinking"),
|
|
3541
|
-
delta:
|
|
3594
|
+
delta: d()
|
|
3542
3595
|
}),
|
|
3543
3596
|
y({
|
|
3544
3597
|
type: b("tool_use"),
|
|
3545
|
-
id:
|
|
3546
|
-
name:
|
|
3547
|
-
input:
|
|
3598
|
+
id: d(),
|
|
3599
|
+
name: d(),
|
|
3600
|
+
input: $(G())
|
|
3548
3601
|
}),
|
|
3549
3602
|
y({
|
|
3550
3603
|
type: b("tool_result"),
|
|
3551
|
-
tool_use_id:
|
|
3552
|
-
content:
|
|
3553
|
-
is_error:
|
|
3604
|
+
tool_use_id: d(),
|
|
3605
|
+
content: d(),
|
|
3606
|
+
is_error: Oe().optional()
|
|
3554
3607
|
}),
|
|
3555
3608
|
y({
|
|
3556
3609
|
type: b("message_complete"),
|
|
3557
3610
|
message: y({
|
|
3558
|
-
role:
|
|
3559
|
-
content:
|
|
3611
|
+
role: L(["user", "assistant"]),
|
|
3612
|
+
content: S(W)
|
|
3560
3613
|
})
|
|
3561
3614
|
}),
|
|
3562
3615
|
y({
|
|
@@ -3564,82 +3617,82 @@ var init_shared_es = __esm({
|
|
|
3564
3617
|
}),
|
|
3565
3618
|
y({
|
|
3566
3619
|
type: b("session_error"),
|
|
3567
|
-
error:
|
|
3620
|
+
error: d()
|
|
3568
3621
|
}),
|
|
3569
3622
|
y({
|
|
3570
3623
|
type: b("query_start"),
|
|
3571
|
-
prompt:
|
|
3624
|
+
prompt: d()
|
|
3572
3625
|
}),
|
|
3573
3626
|
y({
|
|
3574
3627
|
type: b("query_complete"),
|
|
3575
3628
|
usage: y({
|
|
3576
|
-
model:
|
|
3577
|
-
numTurns:
|
|
3578
|
-
durationMs:
|
|
3579
|
-
inputTokens:
|
|
3580
|
-
outputTokens:
|
|
3581
|
-
cacheReadTokens:
|
|
3582
|
-
cacheCreationTokens:
|
|
3583
|
-
costUsd:
|
|
3629
|
+
model: d(),
|
|
3630
|
+
numTurns: E(),
|
|
3631
|
+
durationMs: E(),
|
|
3632
|
+
inputTokens: E(),
|
|
3633
|
+
outputTokens: E(),
|
|
3634
|
+
cacheReadTokens: E(),
|
|
3635
|
+
cacheCreationTokens: E(),
|
|
3636
|
+
costUsd: E()
|
|
3584
3637
|
}),
|
|
3585
3638
|
result: y({
|
|
3586
|
-
status:
|
|
3587
|
-
summary:
|
|
3588
|
-
error:
|
|
3639
|
+
status: L(["success", "error", "interrupted"]),
|
|
3640
|
+
summary: d(),
|
|
3641
|
+
error: d().optional()
|
|
3589
3642
|
})
|
|
3590
3643
|
})
|
|
3591
3644
|
]);
|
|
3592
|
-
|
|
3593
|
-
title:
|
|
3594
|
-
originMetadata:
|
|
3645
|
+
Ht = y({
|
|
3646
|
+
title: d(),
|
|
3647
|
+
originMetadata: $(G()).optional()
|
|
3595
3648
|
});
|
|
3596
|
-
|
|
3597
|
-
summary:
|
|
3598
|
-
status:
|
|
3649
|
+
It = y({
|
|
3650
|
+
summary: d(),
|
|
3651
|
+
status: L([
|
|
3599
3652
|
"success",
|
|
3600
3653
|
"error_max_turns",
|
|
3601
3654
|
"error_during_execution",
|
|
3602
3655
|
"interrupted"
|
|
3603
3656
|
]),
|
|
3604
|
-
error:
|
|
3657
|
+
error: d().optional()
|
|
3605
3658
|
});
|
|
3606
|
-
|
|
3607
|
-
assistant:
|
|
3608
|
-
toolResults:
|
|
3659
|
+
wt = y({
|
|
3660
|
+
assistant: S(W),
|
|
3661
|
+
toolResults: S(W).optional()
|
|
3609
3662
|
});
|
|
3610
|
-
|
|
3611
|
-
userMessage:
|
|
3612
|
-
turns:
|
|
3613
|
-
result:
|
|
3663
|
+
Dt = y({
|
|
3664
|
+
userMessage: S(W),
|
|
3665
|
+
turns: S(wt),
|
|
3666
|
+
result: It
|
|
3614
3667
|
});
|
|
3615
|
-
|
|
3616
|
-
model:
|
|
3617
|
-
numTurns:
|
|
3618
|
-
durationMs:
|
|
3619
|
-
inputTokens:
|
|
3620
|
-
outputTokens:
|
|
3621
|
-
cacheReadTokens:
|
|
3622
|
-
cacheCreationTokens:
|
|
3623
|
-
costUsd:
|
|
3668
|
+
er = y({
|
|
3669
|
+
model: d(),
|
|
3670
|
+
numTurns: E(),
|
|
3671
|
+
durationMs: E(),
|
|
3672
|
+
inputTokens: E(),
|
|
3673
|
+
outputTokens: E(),
|
|
3674
|
+
cacheReadTokens: E(),
|
|
3675
|
+
cacheCreationTokens: E(),
|
|
3676
|
+
costUsd: E()
|
|
3624
3677
|
});
|
|
3625
|
-
|
|
3626
|
-
id:
|
|
3627
|
-
sessionId:
|
|
3628
|
-
sequence:
|
|
3629
|
-
prompt:
|
|
3630
|
-
content:
|
|
3631
|
-
model:
|
|
3632
|
-
numTurns:
|
|
3633
|
-
durationMs:
|
|
3634
|
-
inputTokens:
|
|
3635
|
-
outputTokens:
|
|
3636
|
-
cacheReadTokens:
|
|
3637
|
-
cacheCreationTokens:
|
|
3638
|
-
costUsd:
|
|
3639
|
-
status:
|
|
3640
|
-
errorMessage:
|
|
3641
|
-
startedAt:
|
|
3642
|
-
completedAt:
|
|
3678
|
+
tr = y({
|
|
3679
|
+
id: d().uuid(),
|
|
3680
|
+
sessionId: d().uuid(),
|
|
3681
|
+
sequence: E(),
|
|
3682
|
+
prompt: d(),
|
|
3683
|
+
content: Dt,
|
|
3684
|
+
model: d(),
|
|
3685
|
+
numTurns: E(),
|
|
3686
|
+
durationMs: E().nullable(),
|
|
3687
|
+
inputTokens: E(),
|
|
3688
|
+
outputTokens: E(),
|
|
3689
|
+
cacheReadTokens: E(),
|
|
3690
|
+
cacheCreationTokens: E(),
|
|
3691
|
+
costUsd: E(),
|
|
3692
|
+
status: L(["running", "success", "error", "interrupted"]),
|
|
3693
|
+
errorMessage: d().nullable(),
|
|
3694
|
+
startedAt: he.date(),
|
|
3695
|
+
completedAt: he.date().nullable()
|
|
3643
3696
|
});
|
|
3644
3697
|
}
|
|
3645
3698
|
});
|
|
@@ -4659,6 +4712,30 @@ var init_api_client = __esm({
|
|
|
4659
4712
|
logger.debug(`Fetched context for session: ${sessionId}`, data);
|
|
4660
4713
|
return data;
|
|
4661
4714
|
}
|
|
4715
|
+
/**
|
|
4716
|
+
* Submit feedback about the agent or tools
|
|
4717
|
+
* @param feedback - The feedback to submit
|
|
4718
|
+
* @returns The created feedback ID
|
|
4719
|
+
*/
|
|
4720
|
+
async submitFeedback(feedback) {
|
|
4721
|
+
const url = `${this.apiUrl}/v1/feedback`;
|
|
4722
|
+
logger.debug("Submitting feedback", { category: feedback.category });
|
|
4723
|
+
const response = await fetch(url, {
|
|
4724
|
+
method: "POST",
|
|
4725
|
+
headers: {
|
|
4726
|
+
"Content-Type": "application/json",
|
|
4727
|
+
Authorization: `Bearer ${this.apiKey}`
|
|
4728
|
+
},
|
|
4729
|
+
body: JSON.stringify(feedback)
|
|
4730
|
+
});
|
|
4731
|
+
if (!response.ok) {
|
|
4732
|
+
const errorText = await response.text();
|
|
4733
|
+
throw new ApiError(response.status, response.statusText, errorText);
|
|
4734
|
+
}
|
|
4735
|
+
const data = await response.json();
|
|
4736
|
+
logger.debug("Feedback submitted successfully", { id: data.id });
|
|
4737
|
+
return data;
|
|
4738
|
+
}
|
|
4662
4739
|
};
|
|
4663
4740
|
}
|
|
4664
4741
|
});
|
|
@@ -4668,7 +4745,7 @@ var CLI_VERSION;
|
|
|
4668
4745
|
var init_version = __esm({
|
|
4669
4746
|
"src/version.ts"() {
|
|
4670
4747
|
"use strict";
|
|
4671
|
-
CLI_VERSION = "0.0.
|
|
4748
|
+
CLI_VERSION = "0.0.18";
|
|
4672
4749
|
}
|
|
4673
4750
|
});
|
|
4674
4751
|
|
|
@@ -4944,7 +5021,7 @@ var init_react = __esm({
|
|
|
4944
5021
|
const message = {
|
|
4945
5022
|
type: "tool",
|
|
4946
5023
|
content: getToolDescription(tool, input),
|
|
4947
|
-
toolName:
|
|
5024
|
+
toolName: or(tool),
|
|
4948
5025
|
toolInput: input,
|
|
4949
5026
|
toolResult: void 0,
|
|
4950
5027
|
isExpanded: false,
|
|
@@ -6335,20 +6412,116 @@ var init_AuthDialog = __esm({
|
|
|
6335
6412
|
}
|
|
6336
6413
|
});
|
|
6337
6414
|
|
|
6338
|
-
// src/ui/components/
|
|
6415
|
+
// src/ui/components/FeedbackDialog.tsx
|
|
6339
6416
|
import { Box as Box3, Text as Text3, useInput } from "ink";
|
|
6340
|
-
import React4 from "react";
|
|
6341
|
-
var
|
|
6342
|
-
var
|
|
6343
|
-
"src/ui/components/
|
|
6417
|
+
import React4, { useState as useState2 } from "react";
|
|
6418
|
+
var CATEGORY_ORDER, FeedbackDialog;
|
|
6419
|
+
var init_FeedbackDialog = __esm({
|
|
6420
|
+
"src/ui/components/FeedbackDialog.tsx"() {
|
|
6344
6421
|
"use strict";
|
|
6422
|
+
init_shared_es();
|
|
6345
6423
|
init_theme();
|
|
6346
|
-
|
|
6424
|
+
CATEGORY_ORDER = [
|
|
6425
|
+
"agent_quality",
|
|
6426
|
+
"tool_issues",
|
|
6427
|
+
"ui_ux",
|
|
6428
|
+
"feature_request",
|
|
6429
|
+
"other"
|
|
6430
|
+
];
|
|
6431
|
+
FeedbackDialog = ({
|
|
6432
|
+
onSubmit,
|
|
6433
|
+
onCancel
|
|
6434
|
+
}) => {
|
|
6435
|
+
const [selectedCategory, setSelectedCategory] = useState2("agent_quality");
|
|
6436
|
+
const [description, setDescription] = useState2("");
|
|
6437
|
+
const [focus, setFocus] = useState2("category");
|
|
6438
|
+
const [cursorPosition, setCursorPosition] = useState2(0);
|
|
6347
6439
|
useInput((input, key) => {
|
|
6348
|
-
if (key.escape
|
|
6349
|
-
|
|
6440
|
+
if (key.escape) {
|
|
6441
|
+
onCancel();
|
|
6442
|
+
return;
|
|
6443
|
+
}
|
|
6444
|
+
if (focus === "category") {
|
|
6445
|
+
if (key.upArrow) {
|
|
6446
|
+
const currentIndex = CATEGORY_ORDER.indexOf(selectedCategory);
|
|
6447
|
+
const newIndex = currentIndex > 0 ? currentIndex - 1 : CATEGORY_ORDER.length - 1;
|
|
6448
|
+
setSelectedCategory(CATEGORY_ORDER[newIndex]);
|
|
6449
|
+
return;
|
|
6450
|
+
}
|
|
6451
|
+
if (key.downArrow) {
|
|
6452
|
+
const currentIndex = CATEGORY_ORDER.indexOf(selectedCategory);
|
|
6453
|
+
const newIndex = currentIndex < CATEGORY_ORDER.length - 1 ? currentIndex + 1 : 0;
|
|
6454
|
+
setSelectedCategory(CATEGORY_ORDER[newIndex]);
|
|
6455
|
+
return;
|
|
6456
|
+
}
|
|
6457
|
+
if (key.tab && !key.shift) {
|
|
6458
|
+
setFocus("description");
|
|
6459
|
+
return;
|
|
6460
|
+
}
|
|
6461
|
+
if (key.return && !key.shift) {
|
|
6462
|
+
if (description.trim()) {
|
|
6463
|
+
onSubmit(selectedCategory, description.trim());
|
|
6464
|
+
} else {
|
|
6465
|
+
setFocus("description");
|
|
6466
|
+
}
|
|
6467
|
+
return;
|
|
6468
|
+
}
|
|
6469
|
+
}
|
|
6470
|
+
if (focus === "description") {
|
|
6471
|
+
if (key.tab && key.shift) {
|
|
6472
|
+
setFocus("category");
|
|
6473
|
+
return;
|
|
6474
|
+
}
|
|
6475
|
+
if (key.return && !key.shift) {
|
|
6476
|
+
if (description.trim()) {
|
|
6477
|
+
onSubmit(selectedCategory, description.trim());
|
|
6478
|
+
}
|
|
6479
|
+
return;
|
|
6480
|
+
}
|
|
6481
|
+
if (key.return && key.shift) {
|
|
6482
|
+
const newDesc = description.slice(0, cursorPosition) + "\n" + description.slice(cursorPosition);
|
|
6483
|
+
setDescription(newDesc);
|
|
6484
|
+
setCursorPosition(cursorPosition + 1);
|
|
6485
|
+
return;
|
|
6486
|
+
}
|
|
6487
|
+
if (key.backspace || key.delete) {
|
|
6488
|
+
if (cursorPosition > 0) {
|
|
6489
|
+
const newDesc = description.slice(0, cursorPosition - 1) + description.slice(cursorPosition);
|
|
6490
|
+
setDescription(newDesc);
|
|
6491
|
+
setCursorPosition(cursorPosition - 1);
|
|
6492
|
+
}
|
|
6493
|
+
return;
|
|
6494
|
+
}
|
|
6495
|
+
if (key.leftArrow) {
|
|
6496
|
+
setCursorPosition(Math.max(0, cursorPosition - 1));
|
|
6497
|
+
return;
|
|
6498
|
+
}
|
|
6499
|
+
if (key.rightArrow) {
|
|
6500
|
+
setCursorPosition(Math.min(description.length, cursorPosition + 1));
|
|
6501
|
+
return;
|
|
6502
|
+
}
|
|
6503
|
+
if (input && !key.ctrl && !key.meta) {
|
|
6504
|
+
const newDesc = description.slice(0, cursorPosition) + input + description.slice(cursorPosition);
|
|
6505
|
+
setDescription(newDesc);
|
|
6506
|
+
setCursorPosition(cursorPosition + input.length);
|
|
6507
|
+
}
|
|
6350
6508
|
}
|
|
6351
6509
|
});
|
|
6510
|
+
const renderDescription = () => {
|
|
6511
|
+
if (!description && focus !== "description") {
|
|
6512
|
+
return /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.dim, italic: true }, "Enter your feedback...");
|
|
6513
|
+
}
|
|
6514
|
+
if (focus === "description") {
|
|
6515
|
+
const before = description.slice(0, cursorPosition);
|
|
6516
|
+
const charAtCursor = description[cursorPosition] || " ";
|
|
6517
|
+
const after = description.slice(cursorPosition + 1);
|
|
6518
|
+
if (!description) {
|
|
6519
|
+
return /* @__PURE__ */ React4.createElement(Text3, null, /* @__PURE__ */ React4.createElement(Text3, { inverse: true }, " "), /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.dim, italic: true }, "Enter your feedback..."));
|
|
6520
|
+
}
|
|
6521
|
+
return /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.primary }, before, /* @__PURE__ */ React4.createElement(Text3, { inverse: true }, charAtCursor), after);
|
|
6522
|
+
}
|
|
6523
|
+
return /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.primary }, description);
|
|
6524
|
+
};
|
|
6352
6525
|
return /* @__PURE__ */ React4.createElement(
|
|
6353
6526
|
Box3,
|
|
6354
6527
|
{
|
|
@@ -6358,27 +6531,79 @@ var init_HelpMenu = __esm({
|
|
|
6358
6531
|
paddingX: 2,
|
|
6359
6532
|
paddingY: 1
|
|
6360
6533
|
},
|
|
6361
|
-
/* @__PURE__ */ React4.createElement(Text3, { bold: true, color: theme.text.accent }, "
|
|
6362
|
-
/* @__PURE__ */ React4.createElement(Box3, { marginTop: 1 }),
|
|
6363
|
-
/* @__PURE__ */ React4.createElement(Text3, { bold: true, color: theme.text.secondary }, "Slash Commands:"),
|
|
6364
|
-
/* @__PURE__ */ React4.createElement(Box3, { flexDirection: "column", marginLeft: 2, marginTop: 0 }, /* @__PURE__ */ React4.createElement(Text3, null, /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.accent }, "/help"), /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.dim }, " or "), /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.accent }, "/?"), /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.dim }, " - Toggle this help menu")), /* @__PURE__ */ React4.createElement(Text3, null, /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.accent }, "/resume"), /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.dim }, " - Resume a previous session")), /* @__PURE__ */ React4.createElement(Text3, null, /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.accent }, "/clear"), /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.dim }, " - Clear message history")), /* @__PURE__ */ React4.createElement(Text3, null, /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.accent }, "/model"), /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.dim }, " - Cycle through available models")), /* @__PURE__ */ React4.createElement(Text3, null, /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.accent }, "/setup"), /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.dim }, " - Initial setup for Supatest CLI")), isAuthenticated ? /* @__PURE__ */ React4.createElement(Text3, null, /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.accent }, "/logout"), /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.dim }, " - Log out of Supatest")) : /* @__PURE__ */ React4.createElement(Text3, null, /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.accent }, "/login"), /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.dim }, " - Authenticate with Supatest")), /* @__PURE__ */ React4.createElement(Text3, null, /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.accent }, "/exit"), /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.dim }, " - Exit the CLI"))),
|
|
6534
|
+
/* @__PURE__ */ React4.createElement(Text3, { bold: true, color: theme.text.accent }, "Report Issue"),
|
|
6365
6535
|
/* @__PURE__ */ React4.createElement(Box3, { marginTop: 1 }),
|
|
6366
|
-
/* @__PURE__ */ React4.createElement(Text3, { bold: true, color: theme.text.secondary }, "
|
|
6367
|
-
/* @__PURE__ */ React4.createElement(Box3, { flexDirection: "column", marginLeft: 2, marginTop: 0 },
|
|
6536
|
+
/* @__PURE__ */ React4.createElement(Text3, { bold: true, color: theme.text.secondary }, "Category:"),
|
|
6537
|
+
/* @__PURE__ */ React4.createElement(Box3, { flexDirection: "column", marginLeft: 2, marginTop: 0 }, CATEGORY_ORDER.map((category) => {
|
|
6538
|
+
const isSelected = selectedCategory === category;
|
|
6539
|
+
const info = Vt[category];
|
|
6540
|
+
return /* @__PURE__ */ React4.createElement(Box3, { flexDirection: "row", key: category }, /* @__PURE__ */ React4.createElement(Text3, { color: isSelected && focus === "category" ? theme.text.accent : theme.text.dim }, isSelected ? "\u25B6 " : " "), /* @__PURE__ */ React4.createElement(Text3, { color: isSelected ? theme.text.primary : theme.text.dim }, info.label), /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.dim }, " ", info.description));
|
|
6541
|
+
})),
|
|
6368
6542
|
/* @__PURE__ */ React4.createElement(Box3, { marginTop: 1 }),
|
|
6369
|
-
/* @__PURE__ */ React4.createElement(Text3, { bold: true, color: theme.text.secondary }, "
|
|
6370
|
-
/* @__PURE__ */ React4.createElement(
|
|
6543
|
+
/* @__PURE__ */ React4.createElement(Text3, { bold: true, color: theme.text.secondary }, "Description:"),
|
|
6544
|
+
/* @__PURE__ */ React4.createElement(
|
|
6545
|
+
Box3,
|
|
6546
|
+
{
|
|
6547
|
+
borderColor: focus === "description" ? theme.border.accent : theme.border.default,
|
|
6548
|
+
borderStyle: "round",
|
|
6549
|
+
flexDirection: "column",
|
|
6550
|
+
marginTop: 0,
|
|
6551
|
+
minHeight: 3,
|
|
6552
|
+
paddingX: 1
|
|
6553
|
+
},
|
|
6554
|
+
renderDescription()
|
|
6555
|
+
),
|
|
6371
6556
|
/* @__PURE__ */ React4.createElement(Box3, { marginTop: 1 }),
|
|
6372
|
-
/* @__PURE__ */ React4.createElement(Text3, { bold: true,
|
|
6373
|
-
|
|
6374
|
-
|
|
6557
|
+
/* @__PURE__ */ React4.createElement(Text3, { color: theme.text.dim }, /* @__PURE__ */ React4.createElement(Text3, { bold: true }, "\u2191\u2193"), " category \u2022", " ", /* @__PURE__ */ React4.createElement(Text3, { bold: true }, "Tab"), " to description \u2022", " ", /* @__PURE__ */ React4.createElement(Text3, { bold: true }, "Enter"), " submit \u2022", " ", /* @__PURE__ */ React4.createElement(Text3, { bold: true }, "ESC"), " cancel")
|
|
6558
|
+
);
|
|
6559
|
+
};
|
|
6560
|
+
}
|
|
6561
|
+
});
|
|
6562
|
+
|
|
6563
|
+
// src/ui/components/HelpMenu.tsx
|
|
6564
|
+
import { Box as Box4, Text as Text4, useInput as useInput2 } from "ink";
|
|
6565
|
+
import React5 from "react";
|
|
6566
|
+
var HelpMenu;
|
|
6567
|
+
var init_HelpMenu = __esm({
|
|
6568
|
+
"src/ui/components/HelpMenu.tsx"() {
|
|
6569
|
+
"use strict";
|
|
6570
|
+
init_theme();
|
|
6571
|
+
HelpMenu = ({ isAuthenticated, onClose }) => {
|
|
6572
|
+
useInput2((input, key) => {
|
|
6573
|
+
if (key.escape || input === "q" || input === "?" || key.ctrl && input === "h") {
|
|
6574
|
+
onClose();
|
|
6575
|
+
}
|
|
6576
|
+
});
|
|
6577
|
+
return /* @__PURE__ */ React5.createElement(
|
|
6578
|
+
Box4,
|
|
6579
|
+
{
|
|
6580
|
+
borderColor: theme.border.accent,
|
|
6581
|
+
borderStyle: "round",
|
|
6582
|
+
flexDirection: "column",
|
|
6583
|
+
paddingX: 2,
|
|
6584
|
+
paddingY: 1
|
|
6585
|
+
},
|
|
6586
|
+
/* @__PURE__ */ React5.createElement(Text4, { bold: true, color: theme.text.accent }, "\u{1F4D6} Supatest AI CLI - Help"),
|
|
6587
|
+
/* @__PURE__ */ React5.createElement(Box4, { marginTop: 1 }),
|
|
6588
|
+
/* @__PURE__ */ React5.createElement(Text4, { bold: true, color: theme.text.secondary }, "Slash Commands:"),
|
|
6589
|
+
/* @__PURE__ */ React5.createElement(Box4, { flexDirection: "column", marginLeft: 2, marginTop: 0 }, /* @__PURE__ */ React5.createElement(Text4, null, /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.accent }, "/help"), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, " or "), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.accent }, "/?"), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, " - Toggle this help menu")), /* @__PURE__ */ React5.createElement(Text4, null, /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.accent }, "/resume"), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, " - Resume a previous session")), /* @__PURE__ */ React5.createElement(Text4, null, /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.accent }, "/clear"), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, " - Clear message history")), /* @__PURE__ */ React5.createElement(Text4, null, /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.accent }, "/model"), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, " - Cycle through available models")), /* @__PURE__ */ React5.createElement(Text4, null, /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.accent }, "/setup"), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, " - Initial setup for Supatest CLI")), /* @__PURE__ */ React5.createElement(Text4, null, /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.accent }, "/feedback"), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, " - Report an issue or request a feature")), isAuthenticated ? /* @__PURE__ */ React5.createElement(Text4, null, /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.accent }, "/logout"), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, " - Log out of Supatest")) : /* @__PURE__ */ React5.createElement(Text4, null, /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.accent }, "/login"), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, " - Authenticate with Supatest")), /* @__PURE__ */ React5.createElement(Text4, null, /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.accent }, "/exit"), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, " - Exit the CLI"))),
|
|
6590
|
+
/* @__PURE__ */ React5.createElement(Box4, { marginTop: 1 }),
|
|
6591
|
+
/* @__PURE__ */ React5.createElement(Text4, { bold: true, color: theme.text.secondary }, "Keyboard Shortcuts:"),
|
|
6592
|
+
/* @__PURE__ */ React5.createElement(Box4, { flexDirection: "column", marginLeft: 2, marginTop: 0 }, /* @__PURE__ */ React5.createElement(Text4, null, /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.accent }, "?"), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, " ", "- Toggle help (when input is empty)")), /* @__PURE__ */ React5.createElement(Text4, null, /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.accent }, "Ctrl+H"), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, " - Toggle help")), /* @__PURE__ */ React5.createElement(Text4, null, /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.accent }, "Ctrl+C"), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, " ", "- Exit (or clear input if not empty)")), /* @__PURE__ */ React5.createElement(Text4, null, /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.accent }, "Ctrl+D"), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, " - Exit immediately")), /* @__PURE__ */ React5.createElement(Text4, null, /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.accent }, "Ctrl+L"), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, " - Clear terminal screen")), /* @__PURE__ */ React5.createElement(Text4, null, /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.accent }, "Ctrl+U"), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, " - Clear current input line")), /* @__PURE__ */ React5.createElement(Text4, null, /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.accent }, "ESC"), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, " - Interrupt running agent")), /* @__PURE__ */ React5.createElement(Text4, null, /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.accent }, "Shift+Up/Down"), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, " - Scroll through messages")), /* @__PURE__ */ React5.createElement(Text4, null, /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.accent }, "Shift+Enter"), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, " - Add new line in input")), /* @__PURE__ */ React5.createElement(Text4, null, /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.accent }, "ctrl+o"), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, " - Toggle tool outputs"))),
|
|
6593
|
+
/* @__PURE__ */ React5.createElement(Box4, { marginTop: 1 }),
|
|
6594
|
+
/* @__PURE__ */ React5.createElement(Text4, { bold: true, color: theme.text.secondary }, "File References:"),
|
|
6595
|
+
/* @__PURE__ */ React5.createElement(Box4, { flexDirection: "column", marginLeft: 2, marginTop: 0 }, /* @__PURE__ */ React5.createElement(Text4, null, /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.accent }, "@filename"), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, " ", "- Reference a file (autocomplete with Tab)")), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, 'Example: "Fix the bug in @src/app.ts"')),
|
|
6596
|
+
/* @__PURE__ */ React5.createElement(Box4, { marginTop: 1 }),
|
|
6597
|
+
/* @__PURE__ */ React5.createElement(Text4, { bold: true, color: theme.text.secondary }, "Tips:"),
|
|
6598
|
+
/* @__PURE__ */ React5.createElement(Box4, { flexDirection: "column", marginLeft: 2, marginTop: 0 }, /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, "\u2022 Press Enter to submit your task"), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, "\u2022 Use Shift+Enter to write multi-line prompts"), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, "\u2022 Drag and drop files into the terminal to add file paths"), /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, "\u2022 The agent will automatically run tools and fix issues")),
|
|
6599
|
+
/* @__PURE__ */ React5.createElement(Box4, { marginTop: 1 }, /* @__PURE__ */ React5.createElement(Text4, { color: theme.text.dim }, "Press ", /* @__PURE__ */ React5.createElement(Text4, { bold: true }, "ESC"), " or ", /* @__PURE__ */ React5.createElement(Text4, { bold: true }, "?"), " to close"))
|
|
6375
6600
|
);
|
|
6376
6601
|
};
|
|
6377
6602
|
}
|
|
6378
6603
|
});
|
|
6379
6604
|
|
|
6380
6605
|
// src/ui/contexts/SessionContext.tsx
|
|
6381
|
-
import
|
|
6606
|
+
import React6, { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useState as useState3 } from "react";
|
|
6382
6607
|
var SessionContext, SessionProvider, useSession;
|
|
6383
6608
|
var init_SessionContext = __esm({
|
|
6384
6609
|
"src/ui/contexts/SessionContext.tsx"() {
|
|
@@ -6389,24 +6614,24 @@ var init_SessionContext = __esm({
|
|
|
6389
6614
|
children,
|
|
6390
6615
|
initialModel
|
|
6391
6616
|
}) => {
|
|
6392
|
-
const [messages, setMessages] =
|
|
6393
|
-
const [todos, setTodos] =
|
|
6394
|
-
const [stats, setStats] =
|
|
6617
|
+
const [messages, setMessages] = useState3([]);
|
|
6618
|
+
const [todos, setTodos] = useState3([]);
|
|
6619
|
+
const [stats, setStats] = useState3({
|
|
6395
6620
|
filesModified: /* @__PURE__ */ new Set(),
|
|
6396
6621
|
commandsRun: [],
|
|
6397
6622
|
iterations: 0,
|
|
6398
6623
|
startTime: Date.now()
|
|
6399
6624
|
});
|
|
6400
|
-
const [isAgentRunning, setIsAgentRunning] =
|
|
6401
|
-
const [shouldInterruptAgent, setShouldInterruptAgent] =
|
|
6402
|
-
const [usageStats, setUsageStats] =
|
|
6403
|
-
const [sessionId, setSessionId] =
|
|
6404
|
-
const [webUrl, setWebUrl] =
|
|
6405
|
-
const [agentMode, setAgentMode] =
|
|
6406
|
-
const [planFilePath, setPlanFilePath] =
|
|
6407
|
-
const [selectedModel, setSelectedModel] =
|
|
6408
|
-
const [allToolsExpanded, setAllToolsExpanded] =
|
|
6409
|
-
const [staticRemountKey, setStaticRemountKey] =
|
|
6625
|
+
const [isAgentRunning, setIsAgentRunning] = useState3(false);
|
|
6626
|
+
const [shouldInterruptAgent, setShouldInterruptAgent] = useState3(false);
|
|
6627
|
+
const [usageStats, setUsageStats] = useState3(null);
|
|
6628
|
+
const [sessionId, setSessionId] = useState3();
|
|
6629
|
+
const [webUrl, setWebUrl] = useState3();
|
|
6630
|
+
const [agentMode, setAgentMode] = useState3("build");
|
|
6631
|
+
const [planFilePath, setPlanFilePath] = useState3();
|
|
6632
|
+
const [selectedModel, setSelectedModel] = useState3(initialModel || Mt);
|
|
6633
|
+
const [allToolsExpanded, setAllToolsExpanded] = useState3(true);
|
|
6634
|
+
const [staticRemountKey, setStaticRemountKey] = useState3(0);
|
|
6410
6635
|
const addMessage = useCallback2(
|
|
6411
6636
|
(message) => {
|
|
6412
6637
|
const expandableTools = ["Bash", "BashOutput", "Command Output"];
|
|
@@ -6517,7 +6742,7 @@ var init_SessionContext = __esm({
|
|
|
6517
6742
|
setSelectedModel,
|
|
6518
6743
|
staticRemountKey
|
|
6519
6744
|
};
|
|
6520
|
-
return /* @__PURE__ */
|
|
6745
|
+
return /* @__PURE__ */ React6.createElement(SessionContext.Provider, { value }, children);
|
|
6521
6746
|
};
|
|
6522
6747
|
useSession = () => {
|
|
6523
6748
|
const context = useContext2(SessionContext);
|
|
@@ -6612,17 +6837,17 @@ var init_file_completion = __esm({
|
|
|
6612
6837
|
});
|
|
6613
6838
|
|
|
6614
6839
|
// src/ui/components/ModelSelector.tsx
|
|
6615
|
-
import { Box as
|
|
6616
|
-
import
|
|
6840
|
+
import { Box as Box5, Text as Text5, useInput as useInput3 } from "ink";
|
|
6841
|
+
import React7, { useState as useState4 } from "react";
|
|
6617
6842
|
function getNextModel(currentModel) {
|
|
6618
|
-
const currentIndex =
|
|
6619
|
-
const nextIndex = (currentIndex + 1) %
|
|
6620
|
-
return
|
|
6843
|
+
const currentIndex = ke.findIndex((m2) => m2.id === currentModel);
|
|
6844
|
+
const nextIndex = (currentIndex + 1) % ke.length;
|
|
6845
|
+
return ke[nextIndex].id;
|
|
6621
6846
|
}
|
|
6622
6847
|
function getPreviousModel(currentModel) {
|
|
6623
|
-
const currentIndex =
|
|
6624
|
-
const prevIndex = (currentIndex - 1 +
|
|
6625
|
-
return
|
|
6848
|
+
const currentIndex = ke.findIndex((m2) => m2.id === currentModel);
|
|
6849
|
+
const prevIndex = (currentIndex - 1 + ke.length) % ke.length;
|
|
6850
|
+
return ke[prevIndex].id;
|
|
6626
6851
|
}
|
|
6627
6852
|
var ModelSelector;
|
|
6628
6853
|
var init_ModelSelector = __esm({
|
|
@@ -6635,25 +6860,25 @@ var init_ModelSelector = __esm({
|
|
|
6635
6860
|
onSelect,
|
|
6636
6861
|
onCancel
|
|
6637
6862
|
}) => {
|
|
6638
|
-
const currentIndex =
|
|
6639
|
-
const [selectedIndex, setSelectedIndex] =
|
|
6640
|
-
|
|
6863
|
+
const currentIndex = ke.findIndex((m2) => m2.id === currentModel);
|
|
6864
|
+
const [selectedIndex, setSelectedIndex] = useState4(currentIndex >= 0 ? currentIndex : 0);
|
|
6865
|
+
useInput3((input, key) => {
|
|
6641
6866
|
if (key.upArrow) {
|
|
6642
|
-
setSelectedIndex((prev) => prev > 0 ? prev - 1 :
|
|
6867
|
+
setSelectedIndex((prev) => prev > 0 ? prev - 1 : ke.length - 1);
|
|
6643
6868
|
} else if (key.downArrow) {
|
|
6644
|
-
setSelectedIndex((prev) => prev <
|
|
6869
|
+
setSelectedIndex((prev) => prev < ke.length - 1 ? prev + 1 : 0);
|
|
6645
6870
|
} else if (key.return) {
|
|
6646
|
-
onSelect(
|
|
6871
|
+
onSelect(ke[selectedIndex].id);
|
|
6647
6872
|
} else if (key.escape || input === "q") {
|
|
6648
6873
|
onCancel();
|
|
6649
6874
|
}
|
|
6650
6875
|
});
|
|
6651
|
-
return /* @__PURE__ */
|
|
6876
|
+
return /* @__PURE__ */ React7.createElement(Box5, { borderColor: theme.border.accent, borderStyle: "round", flexDirection: "column", padding: 1 }, /* @__PURE__ */ React7.createElement(Box5, { marginBottom: 1 }, /* @__PURE__ */ React7.createElement(Text5, { bold: true, color: theme.text.accent }, "Select Model")), /* @__PURE__ */ React7.createElement(Box5, { flexDirection: "column" }, ke.map((model, index) => {
|
|
6652
6877
|
const isSelected = index === selectedIndex;
|
|
6653
6878
|
const isCurrent = model.id === currentModel;
|
|
6654
6879
|
const indicator = isSelected ? "\u25B6 " : " ";
|
|
6655
|
-
return /* @__PURE__ */
|
|
6656
|
-
|
|
6880
|
+
return /* @__PURE__ */ React7.createElement(Box5, { gap: 1, key: model.id }, /* @__PURE__ */ React7.createElement(
|
|
6881
|
+
Text5,
|
|
6657
6882
|
{
|
|
6658
6883
|
backgroundColor: isSelected ? theme.text.accent : void 0,
|
|
6659
6884
|
bold: isSelected,
|
|
@@ -6661,15 +6886,15 @@ var init_ModelSelector = __esm({
|
|
|
6661
6886
|
},
|
|
6662
6887
|
indicator,
|
|
6663
6888
|
model.name.padEnd(12)
|
|
6664
|
-
), /* @__PURE__ */
|
|
6665
|
-
|
|
6889
|
+
), /* @__PURE__ */ React7.createElement(
|
|
6890
|
+
Text5,
|
|
6666
6891
|
{
|
|
6667
6892
|
backgroundColor: isSelected ? theme.text.accent : void 0,
|
|
6668
6893
|
color: isSelected ? "black" : theme.text.dim
|
|
6669
6894
|
},
|
|
6670
6895
|
model.description
|
|
6671
|
-
), isCurrent && /* @__PURE__ */
|
|
6672
|
-
})), /* @__PURE__ */
|
|
6896
|
+
), isCurrent && /* @__PURE__ */ React7.createElement(Text5, { color: theme.text.success }, " (current)"));
|
|
6897
|
+
})), /* @__PURE__ */ React7.createElement(Box5, { marginTop: 1 }, /* @__PURE__ */ React7.createElement(Text5, { color: theme.text.dim }, /* @__PURE__ */ React7.createElement(Text5, { bold: true }, "\u2191\u2193"), " navigate \u2022 ", /* @__PURE__ */ React7.createElement(Text5, { bold: true }, "Enter"), " select \u2022 ", /* @__PURE__ */ React7.createElement(Text5, { bold: true }, "ESC"), " cancel")));
|
|
6673
6898
|
};
|
|
6674
6899
|
}
|
|
6675
6900
|
});
|
|
@@ -6677,8 +6902,8 @@ var init_ModelSelector = __esm({
|
|
|
6677
6902
|
// src/ui/components/InputPrompt.tsx
|
|
6678
6903
|
import path4 from "path";
|
|
6679
6904
|
import chalk5 from "chalk";
|
|
6680
|
-
import { Box as
|
|
6681
|
-
import
|
|
6905
|
+
import { Box as Box6, Text as Text6 } from "ink";
|
|
6906
|
+
import React8, { forwardRef, useEffect as useEffect4, useImperativeHandle, useState as useState5 } from "react";
|
|
6682
6907
|
var InputPrompt;
|
|
6683
6908
|
var init_InputPrompt = __esm({
|
|
6684
6909
|
"src/ui/components/InputPrompt.tsx"() {
|
|
@@ -6699,24 +6924,25 @@ var init_InputPrompt = __esm({
|
|
|
6699
6924
|
onInputChange
|
|
6700
6925
|
}, ref) => {
|
|
6701
6926
|
const { messages, agentMode, selectedModel, setSelectedModel, isAgentRunning, usageStats } = useSession();
|
|
6702
|
-
const [value, setValue] =
|
|
6703
|
-
const [cursorOffset, setCursorOffset] =
|
|
6704
|
-
const [allFiles, setAllFiles] =
|
|
6705
|
-
const [suggestions, setSuggestions] =
|
|
6706
|
-
const [activeSuggestion, setActiveSuggestion] =
|
|
6707
|
-
const [showSuggestions, setShowSuggestions] =
|
|
6708
|
-
const [mentionStartIndex, setMentionStartIndex] =
|
|
6927
|
+
const [value, setValue] = useState5("");
|
|
6928
|
+
const [cursorOffset, setCursorOffset] = useState5(0);
|
|
6929
|
+
const [allFiles, setAllFiles] = useState5([]);
|
|
6930
|
+
const [suggestions, setSuggestions] = useState5([]);
|
|
6931
|
+
const [activeSuggestion, setActiveSuggestion] = useState5(0);
|
|
6932
|
+
const [showSuggestions, setShowSuggestions] = useState5(false);
|
|
6933
|
+
const [mentionStartIndex, setMentionStartIndex] = useState5(-1);
|
|
6709
6934
|
const SLASH_COMMANDS = [
|
|
6710
6935
|
{ name: "/help", desc: "Show help" },
|
|
6711
6936
|
{ name: "/resume", desc: "Resume session" },
|
|
6712
6937
|
{ name: "/clear", desc: "Clear history" },
|
|
6713
6938
|
{ name: "/model", desc: "Change model" },
|
|
6939
|
+
{ name: "/feedback", desc: "Report an issue" },
|
|
6714
6940
|
{ name: "/setup", desc: "Install Playwright browsers" },
|
|
6715
6941
|
{ name: "/login", desc: "Authenticate with Supatest" },
|
|
6716
6942
|
{ name: "/logout", desc: "Log out" },
|
|
6717
6943
|
{ name: "/exit", desc: "Exit CLI" }
|
|
6718
6944
|
];
|
|
6719
|
-
const [isSlashCommand, setIsSlashCommand] =
|
|
6945
|
+
const [isSlashCommand, setIsSlashCommand] = useState5(false);
|
|
6720
6946
|
useImperativeHandle(ref, () => ({
|
|
6721
6947
|
clear: () => {
|
|
6722
6948
|
setValue("");
|
|
@@ -6760,7 +6986,7 @@ var init_InputPrompt = __esm({
|
|
|
6760
6986
|
if (isValidStart) {
|
|
6761
6987
|
const query2 = textBeforeCursor.slice(lastAt + 1);
|
|
6762
6988
|
if (!/\s/.test(query2)) {
|
|
6763
|
-
const matches = allFiles.filter((
|
|
6989
|
+
const matches = allFiles.filter((f) => f.toLowerCase().includes(query2.toLowerCase())).slice(0, 5);
|
|
6764
6990
|
if (matches.length > 0) {
|
|
6765
6991
|
setSuggestions(matches);
|
|
6766
6992
|
setShowSuggestions(true);
|
|
@@ -6906,8 +7132,8 @@ var init_InputPrompt = __esm({
|
|
|
6906
7132
|
}
|
|
6907
7133
|
charCount += lineLength + 1;
|
|
6908
7134
|
}
|
|
6909
|
-
return /* @__PURE__ */
|
|
6910
|
-
|
|
7135
|
+
return /* @__PURE__ */ React8.createElement(Box6, { flexDirection: "column", width: "100%" }, showSuggestions && /* @__PURE__ */ React8.createElement(
|
|
7136
|
+
Box6,
|
|
6911
7137
|
{
|
|
6912
7138
|
borderColor: theme.border.default,
|
|
6913
7139
|
borderStyle: "round",
|
|
@@ -6915,9 +7141,9 @@ var init_InputPrompt = __esm({
|
|
|
6915
7141
|
marginBottom: 0,
|
|
6916
7142
|
paddingX: 1
|
|
6917
7143
|
},
|
|
6918
|
-
suggestions.map((file, idx) => /* @__PURE__ */
|
|
6919
|
-
), /* @__PURE__ */
|
|
6920
|
-
|
|
7144
|
+
suggestions.map((file, idx) => /* @__PURE__ */ React8.createElement(Text6, { color: idx === activeSuggestion ? theme.text.accent : theme.text.dim, key: file }, idx === activeSuggestion ? "\u276F " : " ", " ", file))
|
|
7145
|
+
), /* @__PURE__ */ React8.createElement(
|
|
7146
|
+
Box6,
|
|
6921
7147
|
{
|
|
6922
7148
|
borderColor: disabled ? theme.border.default : theme.border.accent,
|
|
6923
7149
|
borderStyle: "round",
|
|
@@ -6927,25 +7153,25 @@ var init_InputPrompt = __esm({
|
|
|
6927
7153
|
paddingX: 1,
|
|
6928
7154
|
width: "100%"
|
|
6929
7155
|
},
|
|
6930
|
-
/* @__PURE__ */
|
|
7156
|
+
/* @__PURE__ */ React8.createElement(Box6, { flexDirection: "row" }, /* @__PURE__ */ React8.createElement(Text6, { color: theme.text.accent }, "\u276F "), /* @__PURE__ */ React8.createElement(Box6, { flexDirection: "column", flexGrow: 1 }, !hasContent && !disabled && /* @__PURE__ */ React8.createElement(Text6, null, chalk5.inverse(placeholder.slice(0, 1)), /* @__PURE__ */ React8.createElement(Text6, { color: theme.text.dim, italic: true }, placeholder.slice(1))), lines.length > 0 && /* @__PURE__ */ React8.createElement(Box6, { flexDirection: "column" }, lines.map((line, idx) => {
|
|
6931
7157
|
if (idx === cursorLine && !disabled) {
|
|
6932
7158
|
const before = line.slice(0, cursorCol);
|
|
6933
7159
|
const charAtCursor = line[cursorCol] || " ";
|
|
6934
7160
|
const after = line.slice(cursorCol + 1);
|
|
6935
|
-
return /* @__PURE__ */
|
|
7161
|
+
return /* @__PURE__ */ React8.createElement(Text6, { color: theme.text.primary, key: idx }, before, chalk5.inverse(charAtCursor), after);
|
|
6936
7162
|
}
|
|
6937
|
-
return /* @__PURE__ */
|
|
6938
|
-
})), !hasContent && disabled && /* @__PURE__ */
|
|
6939
|
-
), /* @__PURE__ */
|
|
7163
|
+
return /* @__PURE__ */ React8.createElement(Text6, { color: theme.text.primary, key: idx }, line);
|
|
7164
|
+
})), !hasContent && disabled && /* @__PURE__ */ React8.createElement(Text6, { color: theme.text.dim, italic: true }, "Waiting for agent to complete...")))
|
|
7165
|
+
), /* @__PURE__ */ React8.createElement(Box6, { justifyContent: "space-between", paddingX: 1 }, /* @__PURE__ */ React8.createElement(Box6, { gap: 2 }, /* @__PURE__ */ React8.createElement(Box6, null, /* @__PURE__ */ React8.createElement(Text6, { color: agentMode === "plan" ? theme.status.inProgress : theme.text.dim }, agentMode === "plan" ? "\u23F8 plan" : "\u25B6 build"), /* @__PURE__ */ React8.createElement(Text6, { color: theme.text.dim }, " (shift+tab)")), /* @__PURE__ */ React8.createElement(Box6, null, /* @__PURE__ */ React8.createElement(Text6, { color: theme.text.dim }, "model:"), /* @__PURE__ */ React8.createElement(Text6, { color: theme.text.info }, St(selectedModel)), /* @__PURE__ */ React8.createElement(Text6, { color: theme.text.dim }, " (tab)"))), /* @__PURE__ */ React8.createElement(Box6, null, /* @__PURE__ */ React8.createElement(Text6, { color: usageStats && usageStats.contextPct >= 90 ? theme.text.error : usageStats && usageStats.contextPct >= 75 ? theme.text.warning : theme.text.dim }, usageStats?.contextPct ?? 0, "% context used"), /* @__PURE__ */ React8.createElement(Text6, { color: theme.text.dim }, " ", "(", usageStats ? usageStats.inputTokens >= 1e3 ? `${(usageStats.inputTokens / 1e3).toFixed(1)}K` : usageStats.inputTokens : 0, " / ", usageStats ? usageStats.contextWindow >= 1e3 ? `${(usageStats.contextWindow / 1e3).toFixed(0)}K` : usageStats.contextWindow : "200K", ")"))));
|
|
6940
7166
|
});
|
|
6941
7167
|
InputPrompt.displayName = "InputPrompt";
|
|
6942
7168
|
}
|
|
6943
7169
|
});
|
|
6944
7170
|
|
|
6945
7171
|
// src/ui/components/Header.tsx
|
|
6946
|
-
import { Box as
|
|
7172
|
+
import { Box as Box7, Text as Text7 } from "ink";
|
|
6947
7173
|
import Gradient from "ink-gradient";
|
|
6948
|
-
import
|
|
7174
|
+
import React9 from "react";
|
|
6949
7175
|
var Header;
|
|
6950
7176
|
var init_Header = __esm({
|
|
6951
7177
|
"src/ui/components/Header.tsx"() {
|
|
@@ -6965,8 +7191,8 @@ var init_Header = __esm({
|
|
|
6965
7191
|
infoParts.push(locationStr);
|
|
6966
7192
|
}
|
|
6967
7193
|
const infoLine = infoParts.join(" \u2022 ");
|
|
6968
|
-
return /* @__PURE__ */
|
|
6969
|
-
|
|
7194
|
+
return /* @__PURE__ */ React9.createElement(
|
|
7195
|
+
Box7,
|
|
6970
7196
|
{
|
|
6971
7197
|
alignItems: "center",
|
|
6972
7198
|
flexDirection: "column",
|
|
@@ -6974,9 +7200,9 @@ var init_Header = __esm({
|
|
|
6974
7200
|
marginTop: 5,
|
|
6975
7201
|
width: "100%"
|
|
6976
7202
|
},
|
|
6977
|
-
/* @__PURE__ */
|
|
6978
|
-
/* @__PURE__ */
|
|
6979
|
-
/* @__PURE__ */
|
|
7203
|
+
/* @__PURE__ */ React9.createElement(Gradient, { colors: ["#C96868", "#FF8C94"] }, /* @__PURE__ */ React9.createElement(Text7, null, banner)),
|
|
7204
|
+
/* @__PURE__ */ React9.createElement(Box7, { justifyContent: "center", marginTop: 0 }, /* @__PURE__ */ React9.createElement(Text7, { color: theme.text.dim }, infoLine)),
|
|
7205
|
+
/* @__PURE__ */ React9.createElement(Box7, { flexDirection: "column", marginTop: 1, paddingX: 2, width: "100%" }, /* @__PURE__ */ React9.createElement(Box7, { flexDirection: "column", marginBottom: 0 }, /* @__PURE__ */ React9.createElement(Text7, { color: theme.text.dim }, "\u{1F4A1} ", /* @__PURE__ */ React9.createElement(Text7, { color: theme.text.secondary }, "Tip:"), " Use ", /* @__PURE__ */ React9.createElement(Text7, { bold: true, color: theme.text.accent }, "@filename"), " to reference files, or ", /* @__PURE__ */ React9.createElement(Text7, { bold: true, color: theme.text.accent }, "/help"), " for commands")), /* @__PURE__ */ React9.createElement(Box7, { flexDirection: "column", marginTop: 0 }, /* @__PURE__ */ React9.createElement(Text7, { color: theme.text.dim }, "\u2328\uFE0F ", /* @__PURE__ */ React9.createElement(Text7, { color: theme.text.secondary }, "Shortcuts:"), " ", /* @__PURE__ */ React9.createElement(Text7, { bold: true, color: theme.text.accent }, "Ctrl+H"), " help, ", /* @__PURE__ */ React9.createElement(Text7, { bold: true, color: theme.text.accent }, "Ctrl+C"), " exit, ", /* @__PURE__ */ React9.createElement(Text7, { bold: true, color: theme.text.accent }, "ESC"), " interrupt")), /* @__PURE__ */ React9.createElement(Box7, { flexDirection: "column", marginTop: 0 }, /* @__PURE__ */ React9.createElement(Text7, { color: theme.text.dim }, "\u{1F680} ", /* @__PURE__ */ React9.createElement(Text7, { color: theme.text.secondary }, "Prompt Tips:"), " Be explicit with instructions, provide context, use examples, and think step-by-step")))
|
|
6980
7206
|
);
|
|
6981
7207
|
};
|
|
6982
7208
|
}
|
|
@@ -6984,9 +7210,9 @@ var init_Header = __esm({
|
|
|
6984
7210
|
|
|
6985
7211
|
// src/ui/utils/markdown.tsx
|
|
6986
7212
|
import chalk6 from "chalk";
|
|
6987
|
-
import { Box as
|
|
7213
|
+
import { Box as Box8, Text as Text8 } from "ink";
|
|
6988
7214
|
import { all, createLowlight } from "lowlight";
|
|
6989
|
-
import
|
|
7215
|
+
import React10, { useMemo as useMemo2 } from "react";
|
|
6990
7216
|
function parseMarkdownSections(text) {
|
|
6991
7217
|
const sections = [];
|
|
6992
7218
|
const lines = text.split(/\r?\n/);
|
|
@@ -7144,16 +7370,15 @@ var init_markdown = __esm({
|
|
|
7144
7370
|
lowlight = createLowlight(all);
|
|
7145
7371
|
MarkdownDisplay = ({
|
|
7146
7372
|
text,
|
|
7147
|
-
isPending = false
|
|
7148
|
-
terminalWidth = 80
|
|
7373
|
+
isPending = false
|
|
7149
7374
|
}) => {
|
|
7150
7375
|
const sections = useMemo2(() => parseMarkdownSections(text), [text]);
|
|
7151
7376
|
const elements = sections.map((section, index) => {
|
|
7152
7377
|
if (section.type === "table" && section.tableRows) {
|
|
7153
|
-
return /* @__PURE__ */
|
|
7378
|
+
return /* @__PURE__ */ React10.createElement(Table, { key: `table-${index}`, rows: section.tableRows });
|
|
7154
7379
|
}
|
|
7155
7380
|
if (section.type === "code") {
|
|
7156
|
-
return /* @__PURE__ */
|
|
7381
|
+
return /* @__PURE__ */ React10.createElement(
|
|
7157
7382
|
CodeBlock,
|
|
7158
7383
|
{
|
|
7159
7384
|
code: section.content,
|
|
@@ -7162,7 +7387,7 @@ var init_markdown = __esm({
|
|
|
7162
7387
|
}
|
|
7163
7388
|
);
|
|
7164
7389
|
}
|
|
7165
|
-
return /* @__PURE__ */
|
|
7390
|
+
return /* @__PURE__ */ React10.createElement(
|
|
7166
7391
|
TextSection,
|
|
7167
7392
|
{
|
|
7168
7393
|
content: section.content,
|
|
@@ -7172,10 +7397,10 @@ var init_markdown = __esm({
|
|
|
7172
7397
|
});
|
|
7173
7398
|
if (isPending) {
|
|
7174
7399
|
elements.push(
|
|
7175
|
-
/* @__PURE__ */
|
|
7400
|
+
/* @__PURE__ */ React10.createElement(Text8, { color: theme.text.accent, key: "cursor" }, "\u258A")
|
|
7176
7401
|
);
|
|
7177
7402
|
}
|
|
7178
|
-
return /* @__PURE__ */
|
|
7403
|
+
return /* @__PURE__ */ React10.createElement(Box8, { flexDirection: "column" }, elements);
|
|
7179
7404
|
};
|
|
7180
7405
|
TextSection = ({ content }) => {
|
|
7181
7406
|
const lines = content.split(/\r?\n/);
|
|
@@ -7188,7 +7413,7 @@ var init_markdown = __esm({
|
|
|
7188
7413
|
const level = headerMatch[1].length;
|
|
7189
7414
|
const content2 = headerMatch[2];
|
|
7190
7415
|
elements.push(
|
|
7191
|
-
/* @__PURE__ */
|
|
7416
|
+
/* @__PURE__ */ React10.createElement(Header2, { content: content2, key: `header-${lineIndex}`, level })
|
|
7192
7417
|
);
|
|
7193
7418
|
continue;
|
|
7194
7419
|
}
|
|
@@ -7198,7 +7423,7 @@ var init_markdown = __esm({
|
|
|
7198
7423
|
const marker = listMatch[2];
|
|
7199
7424
|
const content2 = listMatch[3];
|
|
7200
7425
|
elements.push(
|
|
7201
|
-
/* @__PURE__ */
|
|
7426
|
+
/* @__PURE__ */ React10.createElement(
|
|
7202
7427
|
ListItem,
|
|
7203
7428
|
{
|
|
7204
7429
|
content: content2,
|
|
@@ -7211,18 +7436,18 @@ var init_markdown = __esm({
|
|
|
7211
7436
|
continue;
|
|
7212
7437
|
}
|
|
7213
7438
|
if (line.match(/^-{3,}$/)) {
|
|
7214
|
-
elements.push(/* @__PURE__ */
|
|
7439
|
+
elements.push(/* @__PURE__ */ React10.createElement(HorizontalRule, { key: `hr-${lineIndex}` }));
|
|
7215
7440
|
continue;
|
|
7216
7441
|
}
|
|
7217
7442
|
if (line.trim()) {
|
|
7218
7443
|
elements.push(
|
|
7219
|
-
/* @__PURE__ */
|
|
7444
|
+
/* @__PURE__ */ React10.createElement(Paragraph, { content: line, key: `para-${lineIndex}` })
|
|
7220
7445
|
);
|
|
7221
7446
|
} else {
|
|
7222
|
-
elements.push(/* @__PURE__ */
|
|
7447
|
+
elements.push(/* @__PURE__ */ React10.createElement(Box8, { height: 1, key: `spacer-${lineIndex}` }));
|
|
7223
7448
|
}
|
|
7224
7449
|
}
|
|
7225
|
-
return /* @__PURE__ */
|
|
7450
|
+
return /* @__PURE__ */ React10.createElement(Box8, { flexDirection: "column" }, elements);
|
|
7226
7451
|
};
|
|
7227
7452
|
Header2 = ({
|
|
7228
7453
|
level,
|
|
@@ -7244,19 +7469,19 @@ var init_markdown = __esm({
|
|
|
7244
7469
|
];
|
|
7245
7470
|
const color = colors[level - 1] || theme.text.primary;
|
|
7246
7471
|
const bold = level <= 2;
|
|
7247
|
-
return /* @__PURE__ */
|
|
7472
|
+
return /* @__PURE__ */ React10.createElement(Text8, { bold, color }, content);
|
|
7248
7473
|
};
|
|
7249
7474
|
ListItem = ({ indent, marker, content }) => {
|
|
7250
7475
|
const formattedContent = formatInline(content);
|
|
7251
7476
|
const indentStr = " ".repeat(indent);
|
|
7252
|
-
return /* @__PURE__ */
|
|
7477
|
+
return /* @__PURE__ */ React10.createElement(Text8, null, indentStr, /* @__PURE__ */ React10.createElement(Text8, { color: theme.text.accent }, marker), " ", formattedContent);
|
|
7253
7478
|
};
|
|
7254
7479
|
HorizontalRule = () => {
|
|
7255
|
-
return /* @__PURE__ */
|
|
7480
|
+
return /* @__PURE__ */ React10.createElement(Text8, { color: theme.border.default }, "\u2500".repeat(60));
|
|
7256
7481
|
};
|
|
7257
7482
|
Paragraph = ({ content }) => {
|
|
7258
7483
|
const formattedContent = formatInline(content);
|
|
7259
|
-
return /* @__PURE__ */
|
|
7484
|
+
return /* @__PURE__ */ React10.createElement(Text8, null, formattedContent);
|
|
7260
7485
|
};
|
|
7261
7486
|
Table = ({ rows }) => {
|
|
7262
7487
|
if (rows.length === 0) {
|
|
@@ -7304,7 +7529,7 @@ var init_markdown = __esm({
|
|
|
7304
7529
|
tableLines.push(cells.join(" \u2502 "));
|
|
7305
7530
|
}
|
|
7306
7531
|
}
|
|
7307
|
-
return /* @__PURE__ */
|
|
7532
|
+
return /* @__PURE__ */ React10.createElement(Text8, null, tableLines.join("\n"));
|
|
7308
7533
|
};
|
|
7309
7534
|
CodeBlock = ({
|
|
7310
7535
|
code,
|
|
@@ -7322,8 +7547,8 @@ var init_markdown = __esm({
|
|
|
7322
7547
|
highlighted = code;
|
|
7323
7548
|
}
|
|
7324
7549
|
}
|
|
7325
|
-
return /* @__PURE__ */
|
|
7326
|
-
|
|
7550
|
+
return /* @__PURE__ */ React10.createElement(
|
|
7551
|
+
Box8,
|
|
7327
7552
|
{
|
|
7328
7553
|
borderColor: theme.border.default,
|
|
7329
7554
|
borderStyle: "round",
|
|
@@ -7331,17 +7556,17 @@ var init_markdown = __esm({
|
|
|
7331
7556
|
marginY: 0,
|
|
7332
7557
|
paddingX: 1
|
|
7333
7558
|
},
|
|
7334
|
-
language && /* @__PURE__ */
|
|
7335
|
-
/* @__PURE__ */
|
|
7559
|
+
language && /* @__PURE__ */ React10.createElement(Text8, { color: theme.text.dim }, language, "\n"),
|
|
7560
|
+
/* @__PURE__ */ React10.createElement(Text8, null, highlighted)
|
|
7336
7561
|
);
|
|
7337
7562
|
};
|
|
7338
7563
|
}
|
|
7339
7564
|
});
|
|
7340
7565
|
|
|
7341
7566
|
// src/ui/components/messages/AssistantMessage.tsx
|
|
7342
|
-
import { Box as
|
|
7567
|
+
import { Box as Box9, Text as Text9 } from "ink";
|
|
7343
7568
|
import Spinner from "ink-spinner";
|
|
7344
|
-
import
|
|
7569
|
+
import React11 from "react";
|
|
7345
7570
|
var AssistantMessage;
|
|
7346
7571
|
var init_AssistantMessage = __esm({
|
|
7347
7572
|
"src/ui/components/messages/AssistantMessage.tsx"() {
|
|
@@ -7353,9 +7578,9 @@ var init_AssistantMessage = __esm({
|
|
|
7353
7578
|
isPending = false,
|
|
7354
7579
|
terminalWidth = 80
|
|
7355
7580
|
}) => {
|
|
7356
|
-
const prefix = isPending ? /* @__PURE__ */
|
|
7581
|
+
const prefix = isPending ? /* @__PURE__ */ React11.createElement(Spinner, { type: "dots" }) : "\u2726 ";
|
|
7357
7582
|
const prefixWidth = 2;
|
|
7358
|
-
return /* @__PURE__ */
|
|
7583
|
+
return /* @__PURE__ */ React11.createElement(Box9, { flexDirection: "row", marginTop: 1 }, /* @__PURE__ */ React11.createElement(Box9, { width: prefixWidth }, /* @__PURE__ */ React11.createElement(Text9, { color: isPending ? theme.text.dim : theme.text.accent }, prefix)), /* @__PURE__ */ React11.createElement(Box9, { flexDirection: "column", flexGrow: 1 }, /* @__PURE__ */ React11.createElement(
|
|
7359
7584
|
MarkdownDisplay,
|
|
7360
7585
|
{
|
|
7361
7586
|
isPending,
|
|
@@ -7368,8 +7593,8 @@ var init_AssistantMessage = __esm({
|
|
|
7368
7593
|
});
|
|
7369
7594
|
|
|
7370
7595
|
// src/ui/components/messages/ErrorMessage.tsx
|
|
7371
|
-
import { Box as
|
|
7372
|
-
import
|
|
7596
|
+
import { Box as Box10, Text as Text10 } from "ink";
|
|
7597
|
+
import React12 from "react";
|
|
7373
7598
|
function getErrorStyle(type) {
|
|
7374
7599
|
const styles = {
|
|
7375
7600
|
error: { icon: "\u2717", color: theme.text.error },
|
|
@@ -7389,38 +7614,62 @@ var init_ErrorMessage = __esm({
|
|
|
7389
7614
|
}) => {
|
|
7390
7615
|
const { icon, color } = getErrorStyle(type);
|
|
7391
7616
|
const displayMessage = type === "error" ? "Tool call failed" : message;
|
|
7392
|
-
return /* @__PURE__ */
|
|
7617
|
+
return /* @__PURE__ */ React12.createElement(Box10, { flexDirection: "row", marginTop: 1 }, /* @__PURE__ */ React12.createElement(Text10, { color }, icon, " ", displayMessage));
|
|
7393
7618
|
};
|
|
7394
7619
|
}
|
|
7395
7620
|
});
|
|
7396
7621
|
|
|
7397
7622
|
// src/ui/components/messages/LoadingMessage.tsx
|
|
7398
|
-
import { Box as
|
|
7623
|
+
import { Box as Box11, Text as Text11 } from "ink";
|
|
7399
7624
|
import Spinner2 from "ink-spinner";
|
|
7400
|
-
import
|
|
7401
|
-
var LOADING_MESSAGES, LoadingMessage;
|
|
7625
|
+
import React13, { useEffect as useEffect5, useState as useState6 } from "react";
|
|
7626
|
+
var LOADING_MESSAGES, SHIMMER_INTERVAL_MS, TEXT_ROTATION_INTERVAL_MS, LoadingMessage;
|
|
7402
7627
|
var init_LoadingMessage = __esm({
|
|
7403
7628
|
"src/ui/components/messages/LoadingMessage.tsx"() {
|
|
7404
7629
|
"use strict";
|
|
7405
7630
|
init_theme();
|
|
7406
7631
|
LOADING_MESSAGES = [
|
|
7407
|
-
"
|
|
7408
|
-
"
|
|
7409
|
-
"
|
|
7632
|
+
"Brainstorming...",
|
|
7633
|
+
"Brewing coffee...",
|
|
7634
|
+
"Sipping espresso...",
|
|
7635
|
+
"Testing theories...",
|
|
7636
|
+
"Making magic...",
|
|
7637
|
+
"Multiplying matrices..."
|
|
7410
7638
|
];
|
|
7639
|
+
SHIMMER_INTERVAL_MS = 80;
|
|
7640
|
+
TEXT_ROTATION_INTERVAL_MS = 2e3;
|
|
7411
7641
|
LoadingMessage = () => {
|
|
7412
|
-
const
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
)
|
|
7416
|
-
|
|
7642
|
+
const [messageIndex, setMessageIndex] = useState6(0);
|
|
7643
|
+
const [shimmerPosition, setShimmerPosition] = useState6(0);
|
|
7644
|
+
const message = LOADING_MESSAGES[messageIndex];
|
|
7645
|
+
useEffect5(() => {
|
|
7646
|
+
const rotationInterval = setInterval(() => {
|
|
7647
|
+
setMessageIndex((prev) => (prev + 1) % LOADING_MESSAGES.length);
|
|
7648
|
+
setShimmerPosition(0);
|
|
7649
|
+
}, TEXT_ROTATION_INTERVAL_MS);
|
|
7650
|
+
return () => {
|
|
7651
|
+
clearInterval(rotationInterval);
|
|
7652
|
+
};
|
|
7653
|
+
}, []);
|
|
7654
|
+
useEffect5(() => {
|
|
7655
|
+
const shimmerInterval = setInterval(() => {
|
|
7656
|
+
setShimmerPosition((prev) => (prev + 1) % (message.length + 1));
|
|
7657
|
+
}, SHIMMER_INTERVAL_MS);
|
|
7658
|
+
return () => {
|
|
7659
|
+
clearInterval(shimmerInterval);
|
|
7660
|
+
};
|
|
7661
|
+
}, [message.length]);
|
|
7662
|
+
const before = message.slice(0, shimmerPosition);
|
|
7663
|
+
const current = message[shimmerPosition] || "";
|
|
7664
|
+
const after = message.slice(shimmerPosition + 1);
|
|
7665
|
+
return /* @__PURE__ */ React13.createElement(Box11, { flexDirection: "row", marginTop: 1 }, /* @__PURE__ */ React13.createElement(Box11, { width: 2 }, /* @__PURE__ */ React13.createElement(Text11, { color: theme.text.accent }, /* @__PURE__ */ React13.createElement(Spinner2, { type: "dots" }))), /* @__PURE__ */ React13.createElement(Box11, { flexDirection: "column", flexGrow: 1 }, /* @__PURE__ */ React13.createElement(Text11, null, /* @__PURE__ */ React13.createElement(Text11, { color: theme.text.primary }, before), /* @__PURE__ */ React13.createElement(Text11, { bold: true, color: theme.text.accent }, current), /* @__PURE__ */ React13.createElement(Text11, { color: theme.text.primary }, after), /* @__PURE__ */ React13.createElement(Text11, { color: theme.text.primary }, " (esc to interrupt)"))));
|
|
7417
7666
|
};
|
|
7418
7667
|
}
|
|
7419
7668
|
});
|
|
7420
7669
|
|
|
7421
7670
|
// src/ui/components/messages/ThinkingMessage.tsx
|
|
7422
|
-
import { Box as
|
|
7423
|
-
import
|
|
7671
|
+
import { Box as Box12, Text as Text12 } from "ink";
|
|
7672
|
+
import React14 from "react";
|
|
7424
7673
|
var ThinkingMessage;
|
|
7425
7674
|
var init_ThinkingMessage = __esm({
|
|
7426
7675
|
"src/ui/components/messages/ThinkingMessage.tsx"() {
|
|
@@ -7432,14 +7681,14 @@ var init_ThinkingMessage = __esm({
|
|
|
7432
7681
|
isExpanded = false,
|
|
7433
7682
|
onToggle
|
|
7434
7683
|
}) => {
|
|
7435
|
-
return /* @__PURE__ */
|
|
7684
|
+
return /* @__PURE__ */ React14.createElement(Box12, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React14.createElement(Box12, { flexDirection: "row" }, /* @__PURE__ */ React14.createElement(Text12, { color: theme.text.dim }, "\u25CF Thinking"), content && /* @__PURE__ */ React14.createElement(Text12, { color: theme.text.dim }, " ", isExpanded ? "\u25BC" : "\u25B6")), isExpanded && content && /* @__PURE__ */ React14.createElement(Box12, { flexDirection: "column", marginLeft: 2 }, /* @__PURE__ */ React14.createElement(Text12, { color: theme.text.dim }, content)));
|
|
7436
7685
|
};
|
|
7437
7686
|
}
|
|
7438
7687
|
});
|
|
7439
7688
|
|
|
7440
7689
|
// src/ui/components/messages/TodoMessage.tsx
|
|
7441
|
-
import { Box as
|
|
7442
|
-
import
|
|
7690
|
+
import { Box as Box13, Text as Text13 } from "ink";
|
|
7691
|
+
import React15 from "react";
|
|
7443
7692
|
var TodoMessage;
|
|
7444
7693
|
var init_TodoMessage = __esm({
|
|
7445
7694
|
"src/ui/components/messages/TodoMessage.tsx"() {
|
|
@@ -7455,15 +7704,15 @@ var init_TodoMessage = __esm({
|
|
|
7455
7704
|
const barLength = 20;
|
|
7456
7705
|
const filledLength = Math.round(barLength * completedCount / total);
|
|
7457
7706
|
const bar = "\u2588".repeat(filledLength) + "\u2591".repeat(barLength - filledLength);
|
|
7458
|
-
return /* @__PURE__ */
|
|
7707
|
+
return /* @__PURE__ */ React15.createElement(Box13, { flexDirection: "column", marginY: 0 }, /* @__PURE__ */ React15.createElement(Box13, { flexDirection: "row" }, /* @__PURE__ */ React15.createElement(Text13, { color: theme.text.info }, "\u{1F4DD} "), /* @__PURE__ */ React15.createElement(Text13, { color: theme.text.dim }, "Todo Progress: "), /* @__PURE__ */ React15.createElement(Text13, { color: theme.text.accent }, bar), /* @__PURE__ */ React15.createElement(Text13, { color: theme.text.primary }, " ", progress, "%"), /* @__PURE__ */ React15.createElement(Text13, { color: theme.text.dim }, " ", "(", completedCount, "/", total, ")")), inProgress.length > 0 && /* @__PURE__ */ React15.createElement(Box13, { flexDirection: "column", marginLeft: 2 }, inProgress.map((todo, idx) => /* @__PURE__ */ React15.createElement(Box13, { flexDirection: "row", key: `in-progress-${idx}` }, /* @__PURE__ */ React15.createElement(Text13, { color: theme.status.inProgress }, "\u2192 "), /* @__PURE__ */ React15.createElement(Text13, { color: theme.text.primary }, todo.activeForm || todo.content)))), completed.length > 0 && completed.length <= 2 && /* @__PURE__ */ React15.createElement(Box13, { flexDirection: "column", marginLeft: 2 }, completed.map((todo, idx) => /* @__PURE__ */ React15.createElement(Box13, { flexDirection: "row", key: `completed-${idx}` }, /* @__PURE__ */ React15.createElement(Text13, { color: theme.status.completed }, "\u2713 "), /* @__PURE__ */ React15.createElement(Text13, { color: theme.text.dim }, todo.content)))), pending.length > 0 && pending.length <= 3 && /* @__PURE__ */ React15.createElement(Box13, { flexDirection: "column", marginLeft: 2 }, pending.map((todo, idx) => /* @__PURE__ */ React15.createElement(Box13, { flexDirection: "row", key: `pending-${idx}` }, /* @__PURE__ */ React15.createElement(Text13, { color: theme.status.pending }, "\u23F3 "), /* @__PURE__ */ React15.createElement(Text13, { color: theme.text.secondary }, todo.content)))));
|
|
7459
7708
|
};
|
|
7460
7709
|
}
|
|
7461
7710
|
});
|
|
7462
7711
|
|
|
7463
7712
|
// src/ui/components/messages/ToolMessage.tsx
|
|
7464
7713
|
import { structuredPatch } from "diff";
|
|
7465
|
-
import { Box as
|
|
7466
|
-
import
|
|
7714
|
+
import { Box as Box14, Text as Text14 } from "ink";
|
|
7715
|
+
import React16 from "react";
|
|
7467
7716
|
function getEditDiff(input) {
|
|
7468
7717
|
if (!input?.old_string || !input?.new_string) return null;
|
|
7469
7718
|
const patch = structuredPatch(
|
|
@@ -7604,7 +7853,7 @@ var init_ToolMessage = __esm({
|
|
|
7604
7853
|
result,
|
|
7605
7854
|
isExpanded = true
|
|
7606
7855
|
}) => {
|
|
7607
|
-
const displayName =
|
|
7856
|
+
const displayName = or(toolName);
|
|
7608
7857
|
const { icon, color } = getToolStyle(toolName);
|
|
7609
7858
|
const resultSummary = result ? getResultSummary(toolName, result) : null;
|
|
7610
7859
|
const hasExpandableContent = !!result;
|
|
@@ -7613,38 +7862,47 @@ var init_ToolMessage = __esm({
|
|
|
7613
7862
|
const isEditOperation = toolName === "Edit";
|
|
7614
7863
|
const editDiff = isEditOperation ? getEditDiff(input) : null;
|
|
7615
7864
|
const isExpandableTool = toolName === "Bash" || toolName === "BashOutput" || toolName === "Command Output";
|
|
7616
|
-
return /* @__PURE__ */
|
|
7865
|
+
return /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "row" }, hasExpandableContent && isExpandableTool ? /* @__PURE__ */ React16.createElement(Text14, { color: theme.text.dim }, isExpanded ? "\u25BC " : "\u25B6 ") : /* @__PURE__ */ React16.createElement(Text14, { color: isRunning ? "yellow" : color }, "\u25CF "), /* @__PURE__ */ React16.createElement(Text14, { bold: true, color }, displayName), /* @__PURE__ */ React16.createElement(Text14, { color: theme.text.dim }, "(", description, ")"), editDiff && /* @__PURE__ */ React16.createElement(Text14, { color: theme.text.dim }, " with ", editDiff.additions, " addition", editDiff.additions !== 1 ? "s" : "", " and ", editDiff.removals, " removal", editDiff.removals !== 1 ? "s" : ""), hasExpandableContent && !isExpanded && isExpandableTool && /* @__PURE__ */ React16.createElement(Text14, { color: theme.text.dim }, " (ctrl+o to expand)")), !isEditOperation && resultSummary && /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 2 }, /* @__PURE__ */ React16.createElement(Text14, { color: theme.text.dim }, "\u2514 ", resultSummary)), editDiff && /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", marginLeft: 2 }, editDiff.lines.map((line, i) => {
|
|
7617
7866
|
if (line.type === "separator") {
|
|
7618
|
-
return /* @__PURE__ */
|
|
7867
|
+
return /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "row", key: i }, /* @__PURE__ */ React16.createElement(Text14, { color: theme.text.dim }, "..."));
|
|
7619
7868
|
}
|
|
7620
7869
|
const isRemove = line.type === "remove";
|
|
7621
7870
|
const isAdd = line.type === "add";
|
|
7622
7871
|
const bgColor = isRemove ? "#5c1b1b" : isAdd ? "#1b3d1b" : void 0;
|
|
7623
7872
|
const prefix = isRemove ? "- " : isAdd ? "+ " : " ";
|
|
7624
7873
|
const prefixColor = isRemove ? "red" : isAdd ? "green" : theme.text.dim;
|
|
7625
|
-
return /* @__PURE__ */
|
|
7626
|
-
})), isExpanded && result && isExpandableTool && /* @__PURE__ */
|
|
7874
|
+
return /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "row", key: i }, /* @__PURE__ */ React16.createElement(Text14, { color: theme.text.dim }, line.lineNum.toString().padStart(4, " ")), /* @__PURE__ */ React16.createElement(Text14, { color: prefixColor }, " ", prefix), /* @__PURE__ */ React16.createElement(Text14, { backgroundColor: bgColor }, line.content));
|
|
7875
|
+
})), isExpanded && result && isExpandableTool && /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", marginLeft: 4, marginTop: 1 }, /* @__PURE__ */ React16.createElement(Text14, { color: theme.text.secondary }, truncate(result, 2e3))));
|
|
7627
7876
|
};
|
|
7628
7877
|
}
|
|
7629
7878
|
});
|
|
7630
7879
|
|
|
7631
7880
|
// src/ui/components/messages/UserMessage.tsx
|
|
7632
|
-
import { Box as
|
|
7633
|
-
import
|
|
7881
|
+
import { Box as Box15, Text as Text15 } from "ink";
|
|
7882
|
+
import React17 from "react";
|
|
7634
7883
|
var UserMessage;
|
|
7635
7884
|
var init_UserMessage = __esm({
|
|
7636
7885
|
"src/ui/components/messages/UserMessage.tsx"() {
|
|
7637
7886
|
"use strict";
|
|
7638
7887
|
init_theme();
|
|
7639
7888
|
UserMessage = ({ text }) => {
|
|
7640
|
-
return /* @__PURE__ */
|
|
7889
|
+
return /* @__PURE__ */ React17.createElement(Box15, { flexDirection: "row", marginTop: 1, alignItems: "center" }, /* @__PURE__ */ React17.createElement(Text15, { color: theme.text.info }, "\u{1F464} "), /* @__PURE__ */ React17.createElement(
|
|
7890
|
+
Box15,
|
|
7891
|
+
{
|
|
7892
|
+
borderStyle: "round",
|
|
7893
|
+
borderColor: theme.text.dim,
|
|
7894
|
+
paddingLeft: 1,
|
|
7895
|
+
paddingRight: 1
|
|
7896
|
+
},
|
|
7897
|
+
/* @__PURE__ */ React17.createElement(Text15, { color: theme.text.secondary }, text)
|
|
7898
|
+
));
|
|
7641
7899
|
};
|
|
7642
7900
|
}
|
|
7643
7901
|
});
|
|
7644
7902
|
|
|
7645
7903
|
// src/ui/components/MessageList.tsx
|
|
7646
|
-
import { Box as
|
|
7647
|
-
import
|
|
7904
|
+
import { Box as Box16, Static } from "ink";
|
|
7905
|
+
import React18, { useMemo as useMemo4 } from "react";
|
|
7648
7906
|
var MessageList;
|
|
7649
7907
|
var init_MessageList = __esm({
|
|
7650
7908
|
"src/ui/components/MessageList.tsx"() {
|
|
@@ -7663,9 +7921,9 @@ var init_MessageList = __esm({
|
|
|
7663
7921
|
const renderMessage = (message) => {
|
|
7664
7922
|
switch (message.type) {
|
|
7665
7923
|
case "user":
|
|
7666
|
-
return /* @__PURE__ */
|
|
7924
|
+
return /* @__PURE__ */ React18.createElement(UserMessage, { key: message.id, text: message.content });
|
|
7667
7925
|
case "assistant":
|
|
7668
|
-
return /* @__PURE__ */
|
|
7926
|
+
return /* @__PURE__ */ React18.createElement(
|
|
7669
7927
|
AssistantMessage,
|
|
7670
7928
|
{
|
|
7671
7929
|
isPending: message.isPending,
|
|
@@ -7675,7 +7933,7 @@ var init_MessageList = __esm({
|
|
|
7675
7933
|
}
|
|
7676
7934
|
);
|
|
7677
7935
|
case "tool":
|
|
7678
|
-
return /* @__PURE__ */
|
|
7936
|
+
return /* @__PURE__ */ React18.createElement(
|
|
7679
7937
|
ToolMessage,
|
|
7680
7938
|
{
|
|
7681
7939
|
description: message.content,
|
|
@@ -7689,7 +7947,7 @@ var init_MessageList = __esm({
|
|
|
7689
7947
|
}
|
|
7690
7948
|
);
|
|
7691
7949
|
case "thinking":
|
|
7692
|
-
return /* @__PURE__ */
|
|
7950
|
+
return /* @__PURE__ */ React18.createElement(
|
|
7693
7951
|
ThinkingMessage,
|
|
7694
7952
|
{
|
|
7695
7953
|
content: message.content,
|
|
@@ -7700,7 +7958,7 @@ var init_MessageList = __esm({
|
|
|
7700
7958
|
}
|
|
7701
7959
|
);
|
|
7702
7960
|
case "error":
|
|
7703
|
-
return /* @__PURE__ */
|
|
7961
|
+
return /* @__PURE__ */ React18.createElement(
|
|
7704
7962
|
ErrorMessage,
|
|
7705
7963
|
{
|
|
7706
7964
|
key: message.id,
|
|
@@ -7709,7 +7967,7 @@ var init_MessageList = __esm({
|
|
|
7709
7967
|
}
|
|
7710
7968
|
);
|
|
7711
7969
|
case "todo":
|
|
7712
|
-
return /* @__PURE__ */
|
|
7970
|
+
return /* @__PURE__ */ React18.createElement(TodoMessage, { key: message.id, todos: message.todos || [] });
|
|
7713
7971
|
default:
|
|
7714
7972
|
return null;
|
|
7715
7973
|
}
|
|
@@ -7730,19 +7988,19 @@ var init_MessageList = __esm({
|
|
|
7730
7988
|
{ id: "header", type: "header" },
|
|
7731
7989
|
...completedMessages.map((msg) => ({ ...msg, _isMessage: true }))
|
|
7732
7990
|
], [completedMessages]);
|
|
7733
|
-
return /* @__PURE__ */
|
|
7991
|
+
return /* @__PURE__ */ React18.createElement(Box16, { flexDirection: "column" }, /* @__PURE__ */ React18.createElement(Static, { items: staticItems, key: staticRemountKey }, (item) => {
|
|
7734
7992
|
if (item.type === "header") {
|
|
7735
|
-
return /* @__PURE__ */
|
|
7993
|
+
return /* @__PURE__ */ React18.createElement(Box16, { flexDirection: "column", key: "header" }, /* @__PURE__ */ React18.createElement(Header, { currentFolder, gitBranch }));
|
|
7736
7994
|
}
|
|
7737
|
-
return /* @__PURE__ */
|
|
7738
|
-
}), pendingMessages.map((message) => /* @__PURE__ */
|
|
7995
|
+
return /* @__PURE__ */ React18.createElement(Box16, { flexDirection: "column", key: item.id, width: "100%" }, renderMessage(item));
|
|
7996
|
+
}), pendingMessages.map((message) => /* @__PURE__ */ React18.createElement(Box16, { flexDirection: "column", key: message.id, width: "100%" }, renderMessage(message))), isAgentRunning && !messages.some((m2) => m2.type === "assistant" && m2.isPending) && /* @__PURE__ */ React18.createElement(LoadingMessage, { key: "loading" }));
|
|
7739
7997
|
};
|
|
7740
7998
|
}
|
|
7741
7999
|
});
|
|
7742
8000
|
|
|
7743
8001
|
// src/ui/components/QueuedMessageDisplay.tsx
|
|
7744
|
-
import { Box as
|
|
7745
|
-
import
|
|
8002
|
+
import { Box as Box17, Text as Text16 } from "ink";
|
|
8003
|
+
import React19 from "react";
|
|
7746
8004
|
var MAX_DISPLAYED_QUEUED_MESSAGES, QueuedMessageDisplay;
|
|
7747
8005
|
var init_QueuedMessageDisplay = __esm({
|
|
7748
8006
|
"src/ui/components/QueuedMessageDisplay.tsx"() {
|
|
@@ -7755,8 +8013,8 @@ var init_QueuedMessageDisplay = __esm({
|
|
|
7755
8013
|
if (messageQueue.length === 0) {
|
|
7756
8014
|
return null;
|
|
7757
8015
|
}
|
|
7758
|
-
return /* @__PURE__ */
|
|
7759
|
-
|
|
8016
|
+
return /* @__PURE__ */ React19.createElement(
|
|
8017
|
+
Box17,
|
|
7760
8018
|
{
|
|
7761
8019
|
borderColor: theme.border.default,
|
|
7762
8020
|
borderStyle: "round",
|
|
@@ -7765,20 +8023,20 @@ var init_QueuedMessageDisplay = __esm({
|
|
|
7765
8023
|
marginTop: 0,
|
|
7766
8024
|
paddingX: 1
|
|
7767
8025
|
},
|
|
7768
|
-
/* @__PURE__ */
|
|
8026
|
+
/* @__PURE__ */ React19.createElement(Box17, { marginBottom: 0 }, /* @__PURE__ */ React19.createElement(Text16, { bold: true, color: theme.text.secondary }, "Queued (", messageQueue.length, ")")),
|
|
7769
8027
|
messageQueue.slice(0, MAX_DISPLAYED_QUEUED_MESSAGES).map((message, index) => {
|
|
7770
8028
|
const preview = message.replace(/\s+/g, " ");
|
|
7771
|
-
return /* @__PURE__ */
|
|
8029
|
+
return /* @__PURE__ */ React19.createElement(Box17, { key: index, width: "100%" }, /* @__PURE__ */ React19.createElement(Text16, { color: theme.text.dim }, " ", index + 1, ". "), /* @__PURE__ */ React19.createElement(Text16, { color: theme.text.primary, wrap: "truncate" }, preview));
|
|
7772
8030
|
}),
|
|
7773
|
-
messageQueue.length > MAX_DISPLAYED_QUEUED_MESSAGES && /* @__PURE__ */
|
|
8031
|
+
messageQueue.length > MAX_DISPLAYED_QUEUED_MESSAGES && /* @__PURE__ */ React19.createElement(Box17, null, /* @__PURE__ */ React19.createElement(Text16, { color: theme.text.dim, italic: true }, "... (+", messageQueue.length - MAX_DISPLAYED_QUEUED_MESSAGES, " more)"))
|
|
7774
8032
|
);
|
|
7775
8033
|
};
|
|
7776
8034
|
}
|
|
7777
8035
|
});
|
|
7778
8036
|
|
|
7779
8037
|
// src/ui/components/SessionSelector.tsx
|
|
7780
|
-
import { Box as
|
|
7781
|
-
import
|
|
8038
|
+
import { Box as Box18, Text as Text17, useInput as useInput4 } from "ink";
|
|
8039
|
+
import React20, { useEffect as useEffect6, useState as useState7 } from "react";
|
|
7782
8040
|
function getSessionPrefix(authMethod) {
|
|
7783
8041
|
return authMethod === "api-key" ? "[Team]" : "[Me]";
|
|
7784
8042
|
}
|
|
@@ -7793,13 +8051,13 @@ var init_SessionSelector = __esm({
|
|
|
7793
8051
|
onSelect,
|
|
7794
8052
|
onCancel
|
|
7795
8053
|
}) => {
|
|
7796
|
-
const [allSessions, setAllSessions] =
|
|
7797
|
-
const [selectedIndex, setSelectedIndex] =
|
|
7798
|
-
const [isLoading, setIsLoading] =
|
|
7799
|
-
const [hasMore, setHasMore] =
|
|
7800
|
-
const [totalSessions, setTotalSessions] =
|
|
7801
|
-
const [error, setError] =
|
|
7802
|
-
|
|
8054
|
+
const [allSessions, setAllSessions] = useState7([]);
|
|
8055
|
+
const [selectedIndex, setSelectedIndex] = useState7(0);
|
|
8056
|
+
const [isLoading, setIsLoading] = useState7(false);
|
|
8057
|
+
const [hasMore, setHasMore] = useState7(true);
|
|
8058
|
+
const [totalSessions, setTotalSessions] = useState7(0);
|
|
8059
|
+
const [error, setError] = useState7(null);
|
|
8060
|
+
useEffect6(() => {
|
|
7803
8061
|
loadMoreSessions();
|
|
7804
8062
|
}, []);
|
|
7805
8063
|
const loadMoreSessions = async () => {
|
|
@@ -7825,7 +8083,7 @@ var init_SessionSelector = __esm({
|
|
|
7825
8083
|
setIsLoading(false);
|
|
7826
8084
|
}
|
|
7827
8085
|
};
|
|
7828
|
-
|
|
8086
|
+
useInput4((input, key) => {
|
|
7829
8087
|
if (allSessions.length === 0) {
|
|
7830
8088
|
if (key.escape || input === "q") {
|
|
7831
8089
|
onCancel();
|
|
@@ -7849,13 +8107,13 @@ var init_SessionSelector = __esm({
|
|
|
7849
8107
|
}
|
|
7850
8108
|
});
|
|
7851
8109
|
if (error) {
|
|
7852
|
-
return /* @__PURE__ */
|
|
8110
|
+
return /* @__PURE__ */ React20.createElement(Box18, { borderColor: "red", borderStyle: "round", flexDirection: "column", padding: 1 }, /* @__PURE__ */ React20.createElement(Text17, { bold: true, color: "red" }, "Error Loading Sessions"), /* @__PURE__ */ React20.createElement(Text17, { color: theme.text.dim }, error), /* @__PURE__ */ React20.createElement(Box18, { marginTop: 1 }, /* @__PURE__ */ React20.createElement(Text17, { color: theme.text.dim }, "Press ", /* @__PURE__ */ React20.createElement(Text17, { bold: true }, "ESC"), " to cancel")));
|
|
7853
8111
|
}
|
|
7854
8112
|
if (allSessions.length === 0 && isLoading) {
|
|
7855
|
-
return /* @__PURE__ */
|
|
8113
|
+
return /* @__PURE__ */ React20.createElement(Box18, { borderColor: "cyan", borderStyle: "round", flexDirection: "column", padding: 1 }, /* @__PURE__ */ React20.createElement(Text17, { bold: true, color: "cyan" }, "Loading Sessions..."), /* @__PURE__ */ React20.createElement(Text17, { color: theme.text.dim }, "Fetching your sessions from the server"));
|
|
7856
8114
|
}
|
|
7857
8115
|
if (allSessions.length === 0 && !isLoading) {
|
|
7858
|
-
return /* @__PURE__ */
|
|
8116
|
+
return /* @__PURE__ */ React20.createElement(Box18, { borderColor: "yellow", borderStyle: "round", flexDirection: "column", padding: 1 }, /* @__PURE__ */ React20.createElement(Text17, { bold: true, color: "yellow" }, "No Sessions Found"), /* @__PURE__ */ React20.createElement(Text17, { color: theme.text.dim }, "No previous sessions available. Start a new conversation!"), /* @__PURE__ */ React20.createElement(Box18, { marginTop: 1 }, /* @__PURE__ */ React20.createElement(Text17, { color: theme.text.dim }, "Press ", /* @__PURE__ */ React20.createElement(Text17, { bold: true }, "ESC"), " to cancel")));
|
|
7859
8117
|
}
|
|
7860
8118
|
const VISIBLE_ITEMS = 10;
|
|
7861
8119
|
let startIndex;
|
|
@@ -7875,7 +8133,7 @@ var init_SessionSelector = __esm({
|
|
|
7875
8133
|
const visibleSessions = allSessions.slice(startIndex, endIndex);
|
|
7876
8134
|
const MAX_TITLE_WIDTH = 50;
|
|
7877
8135
|
const PREFIX_WIDTH = 6;
|
|
7878
|
-
return /* @__PURE__ */
|
|
8136
|
+
return /* @__PURE__ */ React20.createElement(Box18, { borderColor: "cyan", borderStyle: "round", flexDirection: "column", padding: 1 }, /* @__PURE__ */ React20.createElement(Box18, { marginBottom: 1 }, /* @__PURE__ */ React20.createElement(Text17, { bold: true, color: "cyan" }, "Select a Session to Resume")), /* @__PURE__ */ React20.createElement(Box18, { flexDirection: "column" }, visibleSessions.map((item, index) => {
|
|
7879
8137
|
const actualIndex = startIndex + index;
|
|
7880
8138
|
const isSelected = actualIndex === selectedIndex;
|
|
7881
8139
|
const title = item.session.title || "Untitled session";
|
|
@@ -7899,18 +8157,18 @@ var init_SessionSelector = __esm({
|
|
|
7899
8157
|
const prefixColor = item.prefix === "[Me]" ? "cyan" : "yellow";
|
|
7900
8158
|
const indicator = isSelected ? "\u25B6 " : " ";
|
|
7901
8159
|
const bgColor = isSelected ? theme.text.accent : void 0;
|
|
7902
|
-
return /* @__PURE__ */
|
|
7903
|
-
})), /* @__PURE__ */
|
|
8160
|
+
return /* @__PURE__ */ React20.createElement(Box18, { key: item.session.id, width: "100%" }, /* @__PURE__ */ React20.createElement(Text17, { backgroundColor: bgColor, bold: isSelected, color: isSelected ? "black" : theme.text.primary }, indicator), /* @__PURE__ */ React20.createElement(Text17, { backgroundColor: bgColor, bold: isSelected, color: prefixColor }, prefix), /* @__PURE__ */ React20.createElement(Text17, { backgroundColor: bgColor, bold: isSelected, color: isSelected ? "black" : theme.text.primary }, displayTitle), /* @__PURE__ */ React20.createElement(Text17, { backgroundColor: bgColor, color: theme.text.dim }, "(", dateStr, ")"));
|
|
8161
|
+
})), /* @__PURE__ */ React20.createElement(Box18, { flexDirection: "column", marginTop: 1 }, (allSessions.length > VISIBLE_ITEMS || totalSessions > allSessions.length) && /* @__PURE__ */ React20.createElement(Box18, { marginBottom: 1 }, /* @__PURE__ */ React20.createElement(Text17, { color: "yellow" }, "Showing ", startIndex + 1, "-", endIndex, " of ", totalSessions || allSessions.length, " sessions", hasMore && !isLoading && /* @__PURE__ */ React20.createElement(Text17, { color: theme.text.dim }, " \u2022 Scroll for more"))), /* @__PURE__ */ React20.createElement(Box18, null, /* @__PURE__ */ React20.createElement(Text17, { color: theme.text.dim }, "Use ", /* @__PURE__ */ React20.createElement(Text17, { bold: true }, "\u2191\u2193"), " to navigate \u2022 ", /* @__PURE__ */ React20.createElement(Text17, { bold: true }, "Enter"), " to select \u2022 ", /* @__PURE__ */ React20.createElement(Text17, { bold: true }, "ESC"), " to cancel")), isLoading && /* @__PURE__ */ React20.createElement(Box18, { marginTop: 1 }, /* @__PURE__ */ React20.createElement(Text17, { color: "cyan" }, "Loading more sessions..."))));
|
|
7904
8162
|
};
|
|
7905
8163
|
}
|
|
7906
8164
|
});
|
|
7907
8165
|
|
|
7908
8166
|
// src/ui/hooks/useModeToggle.ts
|
|
7909
|
-
import { useEffect as
|
|
8167
|
+
import { useEffect as useEffect7 } from "react";
|
|
7910
8168
|
function useModeToggle() {
|
|
7911
8169
|
const { subscribe, unsubscribe } = useKeypressContext();
|
|
7912
8170
|
const { agentMode, setAgentMode, isAgentRunning } = useSession();
|
|
7913
|
-
|
|
8171
|
+
useEffect7(() => {
|
|
7914
8172
|
const handleKeypress = (key) => {
|
|
7915
8173
|
if (key.name === "tab" && key.shift && !isAgentRunning) {
|
|
7916
8174
|
const newMode = agentMode === "plan" ? "build" : "plan";
|
|
@@ -7951,9 +8209,9 @@ var init_useOverlayEscapeGuard = __esm({
|
|
|
7951
8209
|
// src/ui/App.tsx
|
|
7952
8210
|
import { execSync as execSync3 } from "child_process";
|
|
7953
8211
|
import { homedir as homedir3 } from "os";
|
|
7954
|
-
import { Box as
|
|
8212
|
+
import { Box as Box19, Text as Text18, useApp } from "ink";
|
|
7955
8213
|
import Spinner3 from "ink-spinner";
|
|
7956
|
-
import
|
|
8214
|
+
import React21, { useEffect as useEffect8, useRef as useRef3, useState as useState8 } from "react";
|
|
7957
8215
|
var getGitBranch, getCurrentFolder, AppContent, App;
|
|
7958
8216
|
var init_App = __esm({
|
|
7959
8217
|
"src/ui/App.tsx"() {
|
|
@@ -7963,8 +8221,10 @@ var init_App = __esm({
|
|
|
7963
8221
|
init_setup();
|
|
7964
8222
|
init_stdio();
|
|
7965
8223
|
init_token_storage();
|
|
8224
|
+
init_version();
|
|
7966
8225
|
init_AuthBanner();
|
|
7967
8226
|
init_AuthDialog();
|
|
8227
|
+
init_FeedbackDialog();
|
|
7968
8228
|
init_HelpMenu();
|
|
7969
8229
|
init_InputPrompt();
|
|
7970
8230
|
init_MessageList();
|
|
@@ -7996,30 +8256,31 @@ var init_App = __esm({
|
|
|
7996
8256
|
const { exit } = useApp();
|
|
7997
8257
|
const { addMessage, clearMessages, isAgentRunning, messages, setSessionId, setWebUrl, setShouldInterruptAgent, setIsAgentRunning, toggleAllToolOutputs, allToolsExpanded, selectedModel, setSelectedModel } = useSession();
|
|
7998
8258
|
useModeToggle();
|
|
7999
|
-
const [terminalWidth, setTerminalWidth] =
|
|
8000
|
-
const [showHelp, setShowHelp] =
|
|
8001
|
-
const [showInput, setShowInput] =
|
|
8002
|
-
const [gitBranch] =
|
|
8003
|
-
const [currentFolder] =
|
|
8004
|
-
const [hasInputContent, setHasInputContent] =
|
|
8005
|
-
const [exitWarning, setExitWarning] =
|
|
8259
|
+
const [terminalWidth, setTerminalWidth] = useState8(process.stdout.columns || 80);
|
|
8260
|
+
const [showHelp, setShowHelp] = useState8(false);
|
|
8261
|
+
const [showInput, setShowInput] = useState8(true);
|
|
8262
|
+
const [gitBranch] = useState8(() => getGitBranch());
|
|
8263
|
+
const [currentFolder] = useState8(() => getCurrentFolder());
|
|
8264
|
+
const [hasInputContent, setHasInputContent] = useState8(false);
|
|
8265
|
+
const [exitWarning, setExitWarning] = useState8(null);
|
|
8006
8266
|
const inputPromptRef = useRef3(null);
|
|
8007
|
-
const [showSessionSelector, setShowSessionSelector] =
|
|
8008
|
-
const [showModelSelector, setShowModelSelector] =
|
|
8009
|
-
const [
|
|
8010
|
-
const [
|
|
8267
|
+
const [showSessionSelector, setShowSessionSelector] = useState8(false);
|
|
8268
|
+
const [showModelSelector, setShowModelSelector] = useState8(false);
|
|
8269
|
+
const [showFeedbackDialog, setShowFeedbackDialog] = useState8(false);
|
|
8270
|
+
const [isLoadingSession, setIsLoadingSession] = useState8(false);
|
|
8271
|
+
const [authState, setAuthState] = useState8(
|
|
8011
8272
|
() => config2.supatestApiKey ? "authenticated" /* Authenticated */ : "unauthenticated" /* Unauthenticated */
|
|
8012
8273
|
);
|
|
8013
|
-
const [showAuthDialog, setShowAuthDialog] =
|
|
8274
|
+
const [showAuthDialog, setShowAuthDialog] = useState8(false);
|
|
8014
8275
|
const { isOverlayOpen, isCancelSuppressed, markOverlayClosed } = useOverlayEscapeGuard({
|
|
8015
|
-
overlays: [showHelp, showSessionSelector, showAuthDialog, showModelSelector]
|
|
8276
|
+
overlays: [showHelp, showSessionSelector, showAuthDialog, showModelSelector, showFeedbackDialog]
|
|
8016
8277
|
});
|
|
8017
|
-
|
|
8278
|
+
useEffect8(() => {
|
|
8018
8279
|
if (!config2.supatestApiKey) {
|
|
8019
8280
|
setShowAuthDialog(true);
|
|
8020
8281
|
}
|
|
8021
8282
|
}, [config2.supatestApiKey]);
|
|
8022
|
-
|
|
8283
|
+
useEffect8(() => {
|
|
8023
8284
|
if (sessionId) {
|
|
8024
8285
|
setSessionId(sessionId);
|
|
8025
8286
|
}
|
|
@@ -8126,6 +8387,19 @@ var init_App = __esm({
|
|
|
8126
8387
|
setShowModelSelector(true);
|
|
8127
8388
|
return;
|
|
8128
8389
|
}
|
|
8390
|
+
if (command === "/feedback") {
|
|
8391
|
+
if (authState !== "authenticated" /* Authenticated */) {
|
|
8392
|
+
addMessage({
|
|
8393
|
+
type: "error",
|
|
8394
|
+
content: "Please login first to submit feedback.",
|
|
8395
|
+
errorType: "warning"
|
|
8396
|
+
});
|
|
8397
|
+
setShowAuthDialog(true);
|
|
8398
|
+
return;
|
|
8399
|
+
}
|
|
8400
|
+
setShowFeedbackDialog(true);
|
|
8401
|
+
return;
|
|
8402
|
+
}
|
|
8129
8403
|
if (command === "/setup") {
|
|
8130
8404
|
addMessage({
|
|
8131
8405
|
type: "assistant",
|
|
@@ -8185,18 +8459,57 @@ var init_App = __esm({
|
|
|
8185
8459
|
setSelectedModel(modelId);
|
|
8186
8460
|
addMessage({
|
|
8187
8461
|
type: "assistant",
|
|
8188
|
-
content: `Model changed to: ${
|
|
8462
|
+
content: `Model changed to: ${St(modelId)}`
|
|
8189
8463
|
});
|
|
8190
8464
|
};
|
|
8191
8465
|
const handleModelSelectorCancel = () => {
|
|
8192
8466
|
markOverlayClosed();
|
|
8193
8467
|
setShowModelSelector(false);
|
|
8194
8468
|
};
|
|
8469
|
+
const handleFeedbackSubmit = async (category, description) => {
|
|
8470
|
+
setShowFeedbackDialog(false);
|
|
8471
|
+
markOverlayClosed();
|
|
8472
|
+
if (!apiClient) {
|
|
8473
|
+
addMessage({
|
|
8474
|
+
type: "error",
|
|
8475
|
+
content: "API client not available. Cannot submit feedback.",
|
|
8476
|
+
errorType: "error"
|
|
8477
|
+
});
|
|
8478
|
+
return;
|
|
8479
|
+
}
|
|
8480
|
+
try {
|
|
8481
|
+
await apiClient.submitFeedback({
|
|
8482
|
+
category,
|
|
8483
|
+
description,
|
|
8484
|
+
sessionId: sessionId || void 0,
|
|
8485
|
+
model: selectedModel,
|
|
8486
|
+
cliVersion: CLI_VERSION,
|
|
8487
|
+
metadata: {
|
|
8488
|
+
os: process.platform,
|
|
8489
|
+
nodeVersion: process.version
|
|
8490
|
+
}
|
|
8491
|
+
});
|
|
8492
|
+
addMessage({
|
|
8493
|
+
type: "assistant",
|
|
8494
|
+
content: "Thank you for your feedback! We appreciate you taking the time to help us improve."
|
|
8495
|
+
});
|
|
8496
|
+
} catch (error) {
|
|
8497
|
+
addMessage({
|
|
8498
|
+
type: "error",
|
|
8499
|
+
content: `Failed to submit feedback: ${error instanceof Error ? error.message : String(error)}`,
|
|
8500
|
+
errorType: "error"
|
|
8501
|
+
});
|
|
8502
|
+
}
|
|
8503
|
+
};
|
|
8504
|
+
const handleFeedbackCancel = () => {
|
|
8505
|
+
markOverlayClosed();
|
|
8506
|
+
setShowFeedbackDialog(false);
|
|
8507
|
+
};
|
|
8195
8508
|
const handleHelpClose = () => {
|
|
8196
8509
|
markOverlayClosed();
|
|
8197
8510
|
setShowHelp(false);
|
|
8198
8511
|
};
|
|
8199
|
-
|
|
8512
|
+
useEffect8(() => {
|
|
8200
8513
|
const handleResize = () => {
|
|
8201
8514
|
setTerminalWidth(process.stdout.columns || 80);
|
|
8202
8515
|
};
|
|
@@ -8256,7 +8569,7 @@ var init_App = __esm({
|
|
|
8256
8569
|
},
|
|
8257
8570
|
{ isActive: !isOverlayOpen }
|
|
8258
8571
|
);
|
|
8259
|
-
|
|
8572
|
+
useEffect8(() => {
|
|
8260
8573
|
if (config2.task) {
|
|
8261
8574
|
addMessage({
|
|
8262
8575
|
type: "user",
|
|
@@ -8264,21 +8577,21 @@ var init_App = __esm({
|
|
|
8264
8577
|
});
|
|
8265
8578
|
}
|
|
8266
8579
|
}, []);
|
|
8267
|
-
return /* @__PURE__ */
|
|
8268
|
-
|
|
8580
|
+
return /* @__PURE__ */ React21.createElement(
|
|
8581
|
+
Box19,
|
|
8269
8582
|
{
|
|
8270
8583
|
flexDirection: "column",
|
|
8271
8584
|
paddingX: 1
|
|
8272
8585
|
},
|
|
8273
|
-
/* @__PURE__ */
|
|
8274
|
-
showHelp && /* @__PURE__ */
|
|
8586
|
+
/* @__PURE__ */ React21.createElement(MessageList, { currentFolder, gitBranch, terminalWidth }),
|
|
8587
|
+
showHelp && /* @__PURE__ */ React21.createElement(
|
|
8275
8588
|
HelpMenu,
|
|
8276
8589
|
{
|
|
8277
8590
|
isAuthenticated: authState === "authenticated" /* Authenticated */,
|
|
8278
8591
|
onClose: handleHelpClose
|
|
8279
8592
|
}
|
|
8280
8593
|
),
|
|
8281
|
-
showSessionSelector && apiClient && /* @__PURE__ */
|
|
8594
|
+
showSessionSelector && apiClient && /* @__PURE__ */ React21.createElement(
|
|
8282
8595
|
SessionSelector,
|
|
8283
8596
|
{
|
|
8284
8597
|
apiClient,
|
|
@@ -8286,8 +8599,8 @@ var init_App = __esm({
|
|
|
8286
8599
|
onSelect: handleSessionSelect
|
|
8287
8600
|
}
|
|
8288
8601
|
),
|
|
8289
|
-
isLoadingSession && /* @__PURE__ */
|
|
8290
|
-
showModelSelector && /* @__PURE__ */
|
|
8602
|
+
isLoadingSession && /* @__PURE__ */ React21.createElement(Box19, { borderColor: "cyan", borderStyle: "round", flexDirection: "column", padding: 1 }, /* @__PURE__ */ React21.createElement(Box19, { flexDirection: "row" }, /* @__PURE__ */ React21.createElement(Box19, { width: 2 }, /* @__PURE__ */ React21.createElement(Text18, { color: theme.text.accent }, /* @__PURE__ */ React21.createElement(Spinner3, { type: "dots" }))), /* @__PURE__ */ React21.createElement(Text18, { bold: true, color: "cyan" }, "Loading session...")), /* @__PURE__ */ React21.createElement(Text18, { color: theme.text.dim }, "Fetching queries and context")),
|
|
8603
|
+
showModelSelector && /* @__PURE__ */ React21.createElement(
|
|
8291
8604
|
ModelSelector,
|
|
8292
8605
|
{
|
|
8293
8606
|
currentModel: selectedModel,
|
|
@@ -8295,13 +8608,20 @@ var init_App = __esm({
|
|
|
8295
8608
|
onSelect: handleModelSelect
|
|
8296
8609
|
}
|
|
8297
8610
|
),
|
|
8298
|
-
showAuthDialog && /* @__PURE__ */
|
|
8611
|
+
showAuthDialog && /* @__PURE__ */ React21.createElement(
|
|
8299
8612
|
AuthDialog,
|
|
8300
8613
|
{
|
|
8301
8614
|
onLogin: handleLogin
|
|
8302
8615
|
}
|
|
8303
8616
|
),
|
|
8304
|
-
|
|
8617
|
+
showFeedbackDialog && /* @__PURE__ */ React21.createElement(
|
|
8618
|
+
FeedbackDialog,
|
|
8619
|
+
{
|
|
8620
|
+
onCancel: handleFeedbackCancel,
|
|
8621
|
+
onSubmit: handleFeedbackSubmit
|
|
8622
|
+
}
|
|
8623
|
+
),
|
|
8624
|
+
/* @__PURE__ */ React21.createElement(Box19, { flexDirection: "column" }, /* @__PURE__ */ React21.createElement(QueuedMessageDisplay, { messageQueue: queuedTasks }), !showAuthDialog && /* @__PURE__ */ React21.createElement(AuthBanner, { authState }), showInput && !showSessionSelector && !showAuthDialog && !showHelp && !showModelSelector && !showFeedbackDialog && !isLoadingSession && /* @__PURE__ */ React21.createElement(Box19, { flexDirection: "column", marginTop: 0, width: "100%" }, exitWarning && /* @__PURE__ */ React21.createElement(Box19, { marginBottom: 0, paddingX: 1 }, /* @__PURE__ */ React21.createElement(Text18, { color: "yellow" }, exitWarning)), /* @__PURE__ */ React21.createElement(
|
|
8305
8625
|
InputPrompt,
|
|
8306
8626
|
{
|
|
8307
8627
|
currentFolder,
|
|
@@ -8316,13 +8636,13 @@ var init_App = __esm({
|
|
|
8316
8636
|
);
|
|
8317
8637
|
};
|
|
8318
8638
|
App = (props) => {
|
|
8319
|
-
return /* @__PURE__ */
|
|
8639
|
+
return /* @__PURE__ */ React21.createElement(AppContent, { ...props });
|
|
8320
8640
|
};
|
|
8321
8641
|
}
|
|
8322
8642
|
});
|
|
8323
8643
|
|
|
8324
8644
|
// src/ui/hooks/useBracketedPaste.ts
|
|
8325
|
-
import { useEffect as
|
|
8645
|
+
import { useEffect as useEffect9 } from "react";
|
|
8326
8646
|
var ENABLE_BRACKETED_PASTE, DISABLE_BRACKETED_PASTE, useBracketedPaste;
|
|
8327
8647
|
var init_useBracketedPaste = __esm({
|
|
8328
8648
|
"src/ui/hooks/useBracketedPaste.ts"() {
|
|
@@ -8331,7 +8651,7 @@ var init_useBracketedPaste = __esm({
|
|
|
8331
8651
|
ENABLE_BRACKETED_PASTE = "\x1B[?2004h";
|
|
8332
8652
|
DISABLE_BRACKETED_PASTE = "\x1B[?2004l";
|
|
8333
8653
|
useBracketedPaste = () => {
|
|
8334
|
-
|
|
8654
|
+
useEffect9(() => {
|
|
8335
8655
|
writeToStdout(ENABLE_BRACKETED_PASTE);
|
|
8336
8656
|
const cleanup = () => {
|
|
8337
8657
|
writeToStdout(DISABLE_BRACKETED_PASTE);
|
|
@@ -8352,7 +8672,7 @@ __export(interactive_exports, {
|
|
|
8352
8672
|
runInteractive: () => runInteractive
|
|
8353
8673
|
});
|
|
8354
8674
|
import { render } from "ink";
|
|
8355
|
-
import
|
|
8675
|
+
import React22, { useEffect as useEffect10, useRef as useRef4 } from "react";
|
|
8356
8676
|
function getToolDescription2(toolName, input) {
|
|
8357
8677
|
switch (toolName) {
|
|
8358
8678
|
case "Read":
|
|
@@ -8485,7 +8805,7 @@ async function runInteractive(config2) {
|
|
|
8485
8805
|
webUrl = session.webUrl;
|
|
8486
8806
|
}
|
|
8487
8807
|
const { unmount, waitUntilExit } = render(
|
|
8488
|
-
/* @__PURE__ */
|
|
8808
|
+
/* @__PURE__ */ React22.createElement(
|
|
8489
8809
|
InteractiveApp,
|
|
8490
8810
|
{
|
|
8491
8811
|
apiClient,
|
|
@@ -8558,13 +8878,13 @@ var init_interactive = __esm({
|
|
|
8558
8878
|
selectedModel
|
|
8559
8879
|
} = useSession();
|
|
8560
8880
|
const agentRef = useRef4(null);
|
|
8561
|
-
|
|
8881
|
+
useEffect10(() => {
|
|
8562
8882
|
if (shouldInterruptAgent && agentRef.current) {
|
|
8563
8883
|
agentRef.current.abort();
|
|
8564
8884
|
setShouldInterruptAgent(false);
|
|
8565
8885
|
}
|
|
8566
8886
|
}, [shouldInterruptAgent, setShouldInterruptAgent]);
|
|
8567
|
-
|
|
8887
|
+
useEffect10(() => {
|
|
8568
8888
|
let isMounted = true;
|
|
8569
8889
|
const runAgent2 = async () => {
|
|
8570
8890
|
setIsAgentRunning(true);
|
|
@@ -8653,12 +8973,12 @@ var init_interactive = __esm({
|
|
|
8653
8973
|
setIsAgentRunning,
|
|
8654
8974
|
setUsageStats
|
|
8655
8975
|
} = useSession();
|
|
8656
|
-
const [sessionId, setSessionId] =
|
|
8657
|
-
const [currentTask, setCurrentTask] =
|
|
8658
|
-
const [taskId, setTaskId] =
|
|
8659
|
-
const [shouldRunAgent, setShouldRunAgent] =
|
|
8660
|
-
const [taskQueue, setTaskQueue] =
|
|
8661
|
-
const [providerSessionId, setProviderSessionId] =
|
|
8976
|
+
const [sessionId, setSessionId] = React22.useState(initialSessionId);
|
|
8977
|
+
const [currentTask, setCurrentTask] = React22.useState(config2.task);
|
|
8978
|
+
const [taskId, setTaskId] = React22.useState(0);
|
|
8979
|
+
const [shouldRunAgent, setShouldRunAgent] = React22.useState(!!config2.task);
|
|
8980
|
+
const [taskQueue, setTaskQueue] = React22.useState([]);
|
|
8981
|
+
const [providerSessionId, setProviderSessionId] = React22.useState();
|
|
8662
8982
|
const handleSubmitTask = async (task) => {
|
|
8663
8983
|
if (!sessionId) {
|
|
8664
8984
|
try {
|
|
@@ -8700,7 +9020,7 @@ var init_interactive = __esm({
|
|
|
8700
9020
|
}
|
|
8701
9021
|
}
|
|
8702
9022
|
};
|
|
8703
|
-
|
|
9023
|
+
React22.useEffect(() => {
|
|
8704
9024
|
if (!shouldRunAgent && taskQueue.length > 0) {
|
|
8705
9025
|
const [nextTask, ...remaining] = taskQueue;
|
|
8706
9026
|
setTaskQueue(remaining);
|
|
@@ -8713,7 +9033,7 @@ var init_interactive = __esm({
|
|
|
8713
9033
|
setShouldRunAgent(true);
|
|
8714
9034
|
}
|
|
8715
9035
|
}, [shouldRunAgent, taskQueue, addMessage]);
|
|
8716
|
-
return /* @__PURE__ */
|
|
9036
|
+
return /* @__PURE__ */ React22.createElement(React22.Fragment, null, /* @__PURE__ */ React22.createElement(
|
|
8717
9037
|
App,
|
|
8718
9038
|
{
|
|
8719
9039
|
apiClient,
|
|
@@ -8775,7 +9095,7 @@ var init_interactive = __esm({
|
|
|
8775
9095
|
sessionId,
|
|
8776
9096
|
webUrl
|
|
8777
9097
|
}
|
|
8778
|
-
), shouldRunAgent && currentTask && sessionId && /* @__PURE__ */
|
|
9098
|
+
), shouldRunAgent && currentTask && sessionId && /* @__PURE__ */ React22.createElement(
|
|
8779
9099
|
AgentRunner,
|
|
8780
9100
|
{
|
|
8781
9101
|
apiClient,
|
|
@@ -8788,7 +9108,7 @@ var init_interactive = __esm({
|
|
|
8788
9108
|
};
|
|
8789
9109
|
InteractiveApp = (props) => {
|
|
8790
9110
|
useBracketedPaste();
|
|
8791
|
-
return /* @__PURE__ */
|
|
9111
|
+
return /* @__PURE__ */ React22.createElement(KeypressProvider, null, /* @__PURE__ */ React22.createElement(SessionProvider, { initialModel: props.config.selectedModel }, /* @__PURE__ */ React22.createElement(InteractiveAppContent, { ...props })));
|
|
8792
9112
|
};
|
|
8793
9113
|
}
|
|
8794
9114
|
});
|
|
@@ -8995,7 +9315,7 @@ var ConsolePresenter = class {
|
|
|
8995
9315
|
}
|
|
8996
9316
|
onToolUse(tool, input, _toolId) {
|
|
8997
9317
|
if (this.spinner) {
|
|
8998
|
-
const displayName =
|
|
9318
|
+
const displayName = or(tool);
|
|
8999
9319
|
this.spinner.text = `Using ${displayName}...`;
|
|
9000
9320
|
}
|
|
9001
9321
|
this.stopSpinner();
|
|
@@ -9582,10 +9902,10 @@ program.name("supatest").description(
|
|
|
9582
9902
|
let selectedModel;
|
|
9583
9903
|
const modelOption = options.model || config.anthropicModelName;
|
|
9584
9904
|
if (modelOption) {
|
|
9585
|
-
if (
|
|
9905
|
+
if (Lt(modelOption)) {
|
|
9586
9906
|
selectedModel = modelOption;
|
|
9587
9907
|
} else {
|
|
9588
|
-
const validModels =
|
|
9908
|
+
const validModels = ke.map((m2) => m2.id).join(", ");
|
|
9589
9909
|
logger.warn(`Invalid model "${modelOption}". Valid models: ${validModels}`);
|
|
9590
9910
|
logger.warn("Using default model instead.");
|
|
9591
9911
|
}
|