@supatest/cli 0.0.16 → 0.0.17
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/index.js +1352 -889
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -371,10 +371,38 @@ var init_planner = __esm({
|
|
|
371
371
|
"src/prompts/planner.ts"() {
|
|
372
372
|
"use strict";
|
|
373
373
|
plannerPrompt = `<role>
|
|
374
|
-
You are
|
|
374
|
+
You are a Senior QA Engineer planning E2E tests called, Supatest AI. You think in terms of user value and business risk, not code coverage. Your job is to identify the minimum set of tests that provide maximum confidence.
|
|
375
375
|
</role>
|
|
376
376
|
|
|
377
|
-
<
|
|
377
|
+
<context>
|
|
378
|
+
E2E tests are expensive: slow to run, prone to flakiness, and costly to maintain. Every test you recommend must justify its existence. The goal is confidence with minimal overhead.
|
|
379
|
+
</context>
|
|
380
|
+
|
|
381
|
+
<core_principles>
|
|
382
|
+
Before planning ANY test, ask yourself:
|
|
383
|
+
|
|
384
|
+
1. **"What user journey does this protect?"**
|
|
385
|
+
Tests should map to real user workflows, not UI components.
|
|
386
|
+
Bad: "Test that the submit button exists"
|
|
387
|
+
Good: "Test that a user can complete checkout"
|
|
388
|
+
|
|
389
|
+
2. **"What's the risk if this breaks?"**
|
|
390
|
+
Assess: Likelihood of breaking \xD7 Business impact if broken
|
|
391
|
+
- High risk (auth, payments, core workflows) \u2192 Thorough coverage
|
|
392
|
+
- Medium risk (secondary features) \u2192 Happy path only
|
|
393
|
+
- Low risk (read-only, static, informational) \u2192 Smoke test or skip
|
|
394
|
+
|
|
395
|
+
3. **"Would a user notice if this breaks?"**
|
|
396
|
+
If no user would notice or care, don't write the test.
|
|
397
|
+
|
|
398
|
+
4. **"Can one test cover this journey?"**
|
|
399
|
+
Prefer ONE test that completes a full user journey over MANY tests that check individual elements. Tests that always pass/fail together should be one test.
|
|
400
|
+
|
|
401
|
+
5. **"What's the maintenance cost?"**
|
|
402
|
+
Every selector is a potential break point. Every test is code to maintain. Minimize both.
|
|
403
|
+
</core_principles>
|
|
404
|
+
|
|
405
|
+
<code_first>
|
|
378
406
|
**Code Answers Everything.** Before asking ANY question:
|
|
379
407
|
1. Search for the relevant component/API
|
|
380
408
|
2. Read the implementation
|
|
@@ -382,64 +410,168 @@ You are an E2E Test Planning Agent. Your job is to analyze applications, researc
|
|
|
382
410
|
|
|
383
411
|
Only ask about undefined business logic or incomplete implementations (TODOs).
|
|
384
412
|
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
|
-
-
|
|
407
|
-
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
413
|
+
</code_first>
|
|
414
|
+
|
|
415
|
+
<risk_assessment>
|
|
416
|
+
Categorize features before planning tests:
|
|
417
|
+
|
|
418
|
+
**High Risk** (thorough testing):
|
|
419
|
+
- Authentication and authorization
|
|
420
|
+
- Payment processing
|
|
421
|
+
- Data mutations (create, update, delete)
|
|
422
|
+
- Business-critical workflows
|
|
423
|
+
- Features with complex conditional logic
|
|
424
|
+
|
|
425
|
+
**Medium Risk** (key paths only):
|
|
426
|
+
- Forms with validation
|
|
427
|
+
- Interactive features
|
|
428
|
+
- Navigation flows
|
|
429
|
+
- Search and filtering
|
|
430
|
+
|
|
431
|
+
**Low Risk** (smoke test or skip):
|
|
432
|
+
- Read-only dashboards
|
|
433
|
+
- Static content pages
|
|
434
|
+
- Informational displays
|
|
435
|
+
- Admin-only features with low usage
|
|
436
|
+
</risk_assessment>
|
|
437
|
+
|
|
438
|
+
<planning_process>
|
|
439
|
+
When analyzing a feature, think through:
|
|
440
|
+
|
|
441
|
+
1. What is this feature's purpose from the user's perspective?
|
|
442
|
+
2. What are the critical user journeys?
|
|
443
|
+
3. What's the risk level? (high/medium/low)
|
|
444
|
+
4. What's the minimum test set that catches meaningful regressions?
|
|
445
|
+
5. What should explicitly NOT be tested (and why)?
|
|
446
|
+
|
|
447
|
+
Then provide your plan.
|
|
448
|
+
</planning_process>
|
|
449
|
+
|
|
450
|
+
<output_format>
|
|
451
|
+
Structure your test plan as:
|
|
452
|
+
|
|
453
|
+
**Summary**: One paragraph explaining what user flows are being tested and why they matter.
|
|
454
|
+
|
|
455
|
+
**Risk Assessment**: Feature risk level (high/medium/low) with justification.
|
|
456
|
+
|
|
457
|
+
**User Journeys**: List each critical user journey to test.
|
|
458
|
+
Format: "User can [action] to [achieve goal]"
|
|
459
|
+
|
|
460
|
+
**Test Cases**: For each test include:
|
|
461
|
+
- Name (action-oriented, e.g., "completes checkout with valid payment")
|
|
462
|
+
- User journey it protects
|
|
463
|
+
- Key assertions (what user-visible outcomes to verify)
|
|
464
|
+
- Test data needs
|
|
465
|
+
|
|
466
|
+
**Not Testing**: What you're deliberately NOT testing and why. This demonstrates senior judgment.
|
|
467
|
+
|
|
468
|
+
**Flakiness Risks**: Potential concerns and mitigation strategies.
|
|
469
|
+
</output_format>
|
|
470
|
+
|
|
471
|
+
<examples>
|
|
472
|
+
<example_good>
|
|
473
|
+
<scenario>Read-only analytics dashboard showing charts and metrics</scenario>
|
|
474
|
+
<analysis>
|
|
475
|
+
This is a read-only dashboard. Risk level: LOW.
|
|
476
|
+
- No data mutations
|
|
477
|
+
- No user inputs
|
|
478
|
+
- Breaking this wouldn't block any workflows
|
|
479
|
+
- Users would notice if completely broken, but not minor visual issues
|
|
480
|
+
|
|
481
|
+
Minimum confidence needed: Page loads and shows data.
|
|
482
|
+
</analysis>
|
|
483
|
+
<plan>
|
|
484
|
+
**Summary**: Single smoke test verifying the dashboard loads and displays its primary sections. This is a read-only view with no user interactions beyond viewing.
|
|
485
|
+
|
|
486
|
+
**Risk Assessment**: LOW - Read-only display, no business-critical actions, no data mutations.
|
|
487
|
+
|
|
488
|
+
**Test Cases**:
|
|
489
|
+
1. "displays dashboard with analytics data"
|
|
490
|
+
- Journey: User views their analytics
|
|
491
|
+
- Assertions: Page loads, primary chart visible, at least one metric displayed
|
|
492
|
+
- Data: Any user with historical data
|
|
493
|
+
|
|
494
|
+
**Not Testing**:
|
|
495
|
+
- Individual chart rendering details (implementation, not user value)
|
|
496
|
+
- Specific metric calculations (unit test territory)
|
|
497
|
+
- Tooltip interactions (low risk, visual detail)
|
|
498
|
+
- Responsive layouts (unless specifically required)
|
|
499
|
+
</plan>
|
|
500
|
+
</example_good>
|
|
501
|
+
|
|
502
|
+
<example_good>
|
|
503
|
+
<scenario>E-commerce checkout flow</scenario>
|
|
504
|
+
<analysis>
|
|
505
|
+
This is the checkout flow. Risk level: HIGH.
|
|
506
|
+
- Direct revenue impact if broken
|
|
507
|
+
- Handles payment data
|
|
508
|
+
- Multiple steps with validation
|
|
509
|
+
- Users absolutely notice if this breaks
|
|
510
|
+
|
|
511
|
+
This needs thorough coverage of the happy path and critical error states.
|
|
512
|
+
</analysis>
|
|
513
|
+
<plan>
|
|
514
|
+
**Summary**: Comprehensive checkout flow testing covering the complete purchase journey and critical failure modes. This is the highest-risk flow in the application.
|
|
515
|
+
|
|
516
|
+
**Risk Assessment**: HIGH - Revenue-critical, payment processing, user trust, multiple integration points.
|
|
517
|
+
|
|
518
|
+
**User Journeys**:
|
|
519
|
+
1. User can complete a purchase with valid payment
|
|
520
|
+
2. User receives clear feedback when payment fails
|
|
521
|
+
3. User can modify cart during checkout
|
|
522
|
+
|
|
523
|
+
**Test Cases**:
|
|
524
|
+
1. "completes purchase with valid credit card"
|
|
525
|
+
- Journey: Full checkout happy path
|
|
526
|
+
- Assertions: Order confirmation shown, order ID generated, confirmation email referenced
|
|
527
|
+
- Data: Test user, test product, test card (4242...)
|
|
528
|
+
|
|
529
|
+
2. "shows clear error for declined card"
|
|
530
|
+
- Journey: Payment failure recovery
|
|
531
|
+
- Assertions: User-friendly error message, can retry, cart preserved
|
|
532
|
+
- Data: Test user, decline test card
|
|
533
|
+
|
|
534
|
+
3. "preserves cart when returning to edit"
|
|
535
|
+
- Journey: Cart modification mid-checkout
|
|
536
|
+
- Assertions: Items retained, quantities correct, can proceed again
|
|
537
|
+
- Data: Test user, multiple products
|
|
538
|
+
|
|
539
|
+
**Not Testing**:
|
|
540
|
+
- Every validation message (covered by unit tests)
|
|
541
|
+
- Every payment provider error code (too many permutations)
|
|
542
|
+
- Address autocomplete (third-party, low impact)
|
|
543
|
+
</plan>
|
|
544
|
+
</example_good>
|
|
545
|
+
|
|
546
|
+
<example_bad>
|
|
547
|
+
<scenario>Read-only dashboard - OVER-ENGINEERED</scenario>
|
|
548
|
+
<what_went_wrong>
|
|
549
|
+
This planner created 30 tests for a simple read-only dashboard:
|
|
550
|
+
- 4 tests for "page load and layout"
|
|
551
|
+
- 4 tests for "metric cards display" (one per card)
|
|
552
|
+
- 5 tests for "chart interactions"
|
|
553
|
+
- Separate tests for loading states, empty states, each tooltip
|
|
554
|
+
|
|
555
|
+
Problems:
|
|
556
|
+
1. Tests implementation details, not user value
|
|
557
|
+
2. 30 tests = 30 maintenance points for a low-risk feature
|
|
558
|
+
3. Tests that always pass/fail together should be ONE test
|
|
559
|
+
4. No risk assessment was performed
|
|
560
|
+
5. "Loading skeleton displays" is not a user journey
|
|
561
|
+
</what_went_wrong>
|
|
562
|
+
</example_bad>
|
|
563
|
+
</examples>
|
|
436
564
|
|
|
437
565
|
<constraints>
|
|
438
566
|
- You can ONLY use read-only tools: Read, Glob, Grep, Task
|
|
439
567
|
- Do NOT write tests, modify files, or run commands
|
|
440
568
|
- Focus on research and planning, not implementation
|
|
441
|
-
- Present findings
|
|
442
|
-
</constraints
|
|
569
|
+
- Present findings for user review before any test writing
|
|
570
|
+
</constraints>
|
|
571
|
+
|
|
572
|
+
<golden_rule>
|
|
573
|
+
The best test plan isn't the one with the most tests\u2014it's the one that catches meaningful regressions with the minimum maintenance burden.
|
|
574
|
+
</golden_rule>`;
|
|
443
575
|
}
|
|
444
576
|
});
|
|
445
577
|
|
|
@@ -488,25 +620,25 @@ var init_config = __esm({
|
|
|
488
620
|
});
|
|
489
621
|
|
|
490
622
|
// ../shared/dist/shared.es.mjs
|
|
491
|
-
function Be(t) {
|
|
492
|
-
return t.replace(/-\d{8}$/, "");
|
|
493
|
-
}
|
|
494
623
|
function We(t) {
|
|
495
|
-
|
|
496
|
-
return Ee.find((r) => r.id === e);
|
|
624
|
+
return t.replace(qe, "");
|
|
497
625
|
}
|
|
498
|
-
function
|
|
626
|
+
function Ge(t) {
|
|
499
627
|
const e = We(t);
|
|
628
|
+
return ke.find((r) => r.id === e);
|
|
629
|
+
}
|
|
630
|
+
function St(t) {
|
|
631
|
+
const e = Ge(t);
|
|
500
632
|
return (e == null ? void 0 : e.name) ?? t;
|
|
501
633
|
}
|
|
502
|
-
function
|
|
503
|
-
return
|
|
634
|
+
function Lt(t) {
|
|
635
|
+
return ke.some((e) => t === e.id || t.startsWith(`${e.id}-`));
|
|
504
636
|
}
|
|
505
|
-
function
|
|
506
|
-
return
|
|
637
|
+
function _e() {
|
|
638
|
+
return Qe;
|
|
507
639
|
}
|
|
508
|
-
function
|
|
509
|
-
const r =
|
|
640
|
+
function u(t, e) {
|
|
641
|
+
const r = _e(), n = pe({
|
|
510
642
|
issueData: e,
|
|
511
643
|
data: t.data,
|
|
512
644
|
path: t.path,
|
|
@@ -517,7 +649,7 @@ function d(t, e) {
|
|
|
517
649
|
// then schema-bound map if available
|
|
518
650
|
r,
|
|
519
651
|
// then global override map
|
|
520
|
-
r ===
|
|
652
|
+
r === ee ? void 0 : ee
|
|
521
653
|
// then global default map
|
|
522
654
|
].filter((s) => !!s)
|
|
523
655
|
});
|
|
@@ -530,29 +662,29 @@ function g(t) {
|
|
|
530
662
|
if (e && (r || n))
|
|
531
663
|
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
532
664
|
return e ? { errorMap: e, description: s } : { errorMap: (i, o) => {
|
|
533
|
-
const { message:
|
|
534
|
-
return i.code === "invalid_enum_value" ? { message:
|
|
665
|
+
const { message: f } = t;
|
|
666
|
+
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
667
|
}, description: s };
|
|
536
668
|
}
|
|
537
|
-
function
|
|
669
|
+
function Ve(t) {
|
|
538
670
|
let e = "[0-5]\\d";
|
|
539
671
|
t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`);
|
|
540
672
|
const r = t.precision ? "+" : "?";
|
|
541
673
|
return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`;
|
|
542
674
|
}
|
|
543
|
-
function
|
|
544
|
-
return new RegExp(`^${
|
|
675
|
+
function ht(t) {
|
|
676
|
+
return new RegExp(`^${Ve(t)}$`);
|
|
545
677
|
}
|
|
546
|
-
function
|
|
547
|
-
let e = `${
|
|
678
|
+
function ft(t) {
|
|
679
|
+
let e = `${$e}T${Ve(t)}`;
|
|
548
680
|
const r = [];
|
|
549
681
|
return r.push(t.local ? "Z?" : "Z"), t.offset && r.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${r.join("|")})`, new RegExp(`^${e}$`);
|
|
550
682
|
}
|
|
551
|
-
function
|
|
552
|
-
return !!((e === "v4" || !e) &&
|
|
683
|
+
function mt(t, e) {
|
|
684
|
+
return !!((e === "v4" || !e) && at.test(t) || (e === "v6" || !e) && ot.test(t));
|
|
553
685
|
}
|
|
554
|
-
function
|
|
555
|
-
if (!
|
|
686
|
+
function _t(t, e) {
|
|
687
|
+
if (!tt.test(t))
|
|
556
688
|
return false;
|
|
557
689
|
try {
|
|
558
690
|
const [r] = t.split(".");
|
|
@@ -564,19 +696,19 @@ function ft(t, e) {
|
|
|
564
696
|
return false;
|
|
565
697
|
}
|
|
566
698
|
}
|
|
567
|
-
function
|
|
568
|
-
return !!((e === "v4" || !e) &&
|
|
699
|
+
function pt(t, e) {
|
|
700
|
+
return !!((e === "v4" || !e) && it.test(t) || (e === "v6" || !e) && ct.test(t));
|
|
569
701
|
}
|
|
570
|
-
function
|
|
702
|
+
function yt(t, e) {
|
|
571
703
|
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
704
|
return a % i / 10 ** s;
|
|
573
705
|
}
|
|
574
|
-
function
|
|
706
|
+
function Y(t) {
|
|
575
707
|
if (t instanceof x) {
|
|
576
708
|
const e = {};
|
|
577
709
|
for (const r in t.shape) {
|
|
578
710
|
const n = t.shape[r];
|
|
579
|
-
e[r] =
|
|
711
|
+
e[r] = Z.create(Y(n));
|
|
580
712
|
}
|
|
581
713
|
return new x({
|
|
582
714
|
...t._def,
|
|
@@ -584,43 +716,43 @@ function G(t) {
|
|
|
584
716
|
});
|
|
585
717
|
} else return t instanceof D ? new D({
|
|
586
718
|
...t._def,
|
|
587
|
-
type:
|
|
588
|
-
}) : t instanceof
|
|
719
|
+
type: Y(t.element)
|
|
720
|
+
}) : 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
721
|
}
|
|
590
|
-
function
|
|
722
|
+
function ve(t, e) {
|
|
591
723
|
const r = j(t), n = j(e);
|
|
592
724
|
if (t === e)
|
|
593
725
|
return { valid: true, data: t };
|
|
594
|
-
if (r ===
|
|
595
|
-
const s =
|
|
726
|
+
if (r === l.object && n === l.object) {
|
|
727
|
+
const s = k.objectKeys(e), a = k.objectKeys(t).filter((o) => s.indexOf(o) !== -1), i = { ...t, ...e };
|
|
596
728
|
for (const o of a) {
|
|
597
|
-
const
|
|
598
|
-
if (!
|
|
729
|
+
const f = ve(t[o], e[o]);
|
|
730
|
+
if (!f.valid)
|
|
599
731
|
return { valid: false };
|
|
600
|
-
i[o] =
|
|
732
|
+
i[o] = f.data;
|
|
601
733
|
}
|
|
602
734
|
return { valid: true, data: i };
|
|
603
|
-
} else if (r ===
|
|
735
|
+
} else if (r === l.array && n === l.array) {
|
|
604
736
|
if (t.length !== e.length)
|
|
605
737
|
return { valid: false };
|
|
606
738
|
const s = [];
|
|
607
739
|
for (let a = 0; a < t.length; a++) {
|
|
608
|
-
const i = t[a], o = e[a],
|
|
609
|
-
if (!
|
|
740
|
+
const i = t[a], o = e[a], f = ve(i, o);
|
|
741
|
+
if (!f.valid)
|
|
610
742
|
return { valid: false };
|
|
611
|
-
s.push(
|
|
743
|
+
s.push(f.data);
|
|
612
744
|
}
|
|
613
745
|
return { valid: true, data: s };
|
|
614
|
-
} else return r ===
|
|
746
|
+
} else return r === l.date && n === l.date && +t == +e ? { valid: true, data: t } : { valid: false };
|
|
615
747
|
}
|
|
616
|
-
function
|
|
617
|
-
return new
|
|
748
|
+
function Fe(t, e) {
|
|
749
|
+
return new z({
|
|
618
750
|
values: t,
|
|
619
751
|
typeName: p.ZodEnum,
|
|
620
752
|
...g(e)
|
|
621
753
|
});
|
|
622
754
|
}
|
|
623
|
-
function
|
|
755
|
+
function or(t) {
|
|
624
756
|
return {
|
|
625
757
|
Grep: "Search",
|
|
626
758
|
Glob: "Search",
|
|
@@ -628,11 +760,11 @@ function er(t) {
|
|
|
628
760
|
BashOutput: "Command Output"
|
|
629
761
|
}[t] || t;
|
|
630
762
|
}
|
|
631
|
-
var
|
|
763
|
+
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
764
|
var init_shared_es = __esm({
|
|
633
765
|
"../shared/dist/shared.es.mjs"() {
|
|
634
766
|
"use strict";
|
|
635
|
-
|
|
767
|
+
ke = [
|
|
636
768
|
{
|
|
637
769
|
id: "claude-sonnet-4-5",
|
|
638
770
|
name: "Sonnet 4.5",
|
|
@@ -652,9 +784,10 @@ var init_shared_es = __esm({
|
|
|
652
784
|
contextWindow: 2e5
|
|
653
785
|
}
|
|
654
786
|
];
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
787
|
+
Mt = "claude-sonnet-4-5";
|
|
788
|
+
qe = /-\d{8}$/;
|
|
789
|
+
Ut = Object.fromEntries(
|
|
790
|
+
ke.map((t) => [t.id, t.contextWindow])
|
|
658
791
|
);
|
|
659
792
|
(function(t) {
|
|
660
793
|
t.assertEqual = (s) => {
|
|
@@ -691,15 +824,15 @@ var init_shared_es = __esm({
|
|
|
691
824
|
return s.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
|
|
692
825
|
}
|
|
693
826
|
t.joinValues = n, t.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
|
|
694
|
-
})(
|
|
827
|
+
})(k || (k = {}));
|
|
695
828
|
(function(t) {
|
|
696
829
|
t.mergeShapes = (e, r) => ({
|
|
697
830
|
...e,
|
|
698
831
|
...r
|
|
699
832
|
// second overwrites first
|
|
700
833
|
});
|
|
701
|
-
})(
|
|
702
|
-
|
|
834
|
+
})(Re || (Re = {}));
|
|
835
|
+
l = k.arrayToEnum([
|
|
703
836
|
"string",
|
|
704
837
|
"nan",
|
|
705
838
|
"number",
|
|
@@ -724,26 +857,26 @@ var init_shared_es = __esm({
|
|
|
724
857
|
j = (t) => {
|
|
725
858
|
switch (typeof t) {
|
|
726
859
|
case "undefined":
|
|
727
|
-
return
|
|
860
|
+
return l.undefined;
|
|
728
861
|
case "string":
|
|
729
|
-
return
|
|
862
|
+
return l.string;
|
|
730
863
|
case "number":
|
|
731
|
-
return Number.isNaN(t) ?
|
|
864
|
+
return Number.isNaN(t) ? l.nan : l.number;
|
|
732
865
|
case "boolean":
|
|
733
|
-
return
|
|
866
|
+
return l.boolean;
|
|
734
867
|
case "function":
|
|
735
|
-
return
|
|
868
|
+
return l.function;
|
|
736
869
|
case "bigint":
|
|
737
|
-
return
|
|
870
|
+
return l.bigint;
|
|
738
871
|
case "symbol":
|
|
739
|
-
return
|
|
872
|
+
return l.symbol;
|
|
740
873
|
case "object":
|
|
741
|
-
return Array.isArray(t) ?
|
|
874
|
+
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
875
|
default:
|
|
743
|
-
return
|
|
876
|
+
return l.unknown;
|
|
744
877
|
}
|
|
745
878
|
};
|
|
746
|
-
c =
|
|
879
|
+
c = k.arrayToEnum([
|
|
747
880
|
"invalid_type",
|
|
748
881
|
"invalid_literal",
|
|
749
882
|
"custom",
|
|
@@ -788,10 +921,10 @@ var init_shared_es = __esm({
|
|
|
788
921
|
else if (i.path.length === 0)
|
|
789
922
|
n._errors.push(r(i));
|
|
790
923
|
else {
|
|
791
|
-
let o = n,
|
|
792
|
-
for (;
|
|
793
|
-
const
|
|
794
|
-
|
|
924
|
+
let o = n, f = 0;
|
|
925
|
+
for (; f < i.path.length; ) {
|
|
926
|
+
const h = i.path[f];
|
|
927
|
+
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
928
|
}
|
|
796
929
|
}
|
|
797
930
|
};
|
|
@@ -805,7 +938,7 @@ var init_shared_es = __esm({
|
|
|
805
938
|
return this.message;
|
|
806
939
|
}
|
|
807
940
|
get message() {
|
|
808
|
-
return JSON.stringify(this.issues,
|
|
941
|
+
return JSON.stringify(this.issues, k.jsonStringifyReplacer, 2);
|
|
809
942
|
}
|
|
810
943
|
get isEmpty() {
|
|
811
944
|
return this.issues.length === 0;
|
|
@@ -825,26 +958,26 @@ var init_shared_es = __esm({
|
|
|
825
958
|
}
|
|
826
959
|
};
|
|
827
960
|
R.create = (t) => new R(t);
|
|
828
|
-
|
|
961
|
+
ee = (t, e) => {
|
|
829
962
|
let r;
|
|
830
963
|
switch (t.code) {
|
|
831
964
|
case c.invalid_type:
|
|
832
|
-
t.received ===
|
|
965
|
+
t.received === l.undefined ? r = "Required" : r = `Expected ${t.expected}, received ${t.received}`;
|
|
833
966
|
break;
|
|
834
967
|
case c.invalid_literal:
|
|
835
|
-
r = `Invalid literal value, expected ${JSON.stringify(t.expected,
|
|
968
|
+
r = `Invalid literal value, expected ${JSON.stringify(t.expected, k.jsonStringifyReplacer)}`;
|
|
836
969
|
break;
|
|
837
970
|
case c.unrecognized_keys:
|
|
838
|
-
r = `Unrecognized key(s) in object: ${
|
|
971
|
+
r = `Unrecognized key(s) in object: ${k.joinValues(t.keys, ", ")}`;
|
|
839
972
|
break;
|
|
840
973
|
case c.invalid_union:
|
|
841
974
|
r = "Invalid input";
|
|
842
975
|
break;
|
|
843
976
|
case c.invalid_union_discriminator:
|
|
844
|
-
r = `Invalid discriminator value. Expected ${
|
|
977
|
+
r = `Invalid discriminator value. Expected ${k.joinValues(t.options)}`;
|
|
845
978
|
break;
|
|
846
979
|
case c.invalid_enum_value:
|
|
847
|
-
r = `Invalid enum value. Expected ${
|
|
980
|
+
r = `Invalid enum value. Expected ${k.joinValues(t.options)}, received '${t.received}'`;
|
|
848
981
|
break;
|
|
849
982
|
case c.invalid_arguments:
|
|
850
983
|
r = "Invalid function arguments";
|
|
@@ -856,7 +989,7 @@ var init_shared_es = __esm({
|
|
|
856
989
|
r = "Invalid date";
|
|
857
990
|
break;
|
|
858
991
|
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}"` :
|
|
992
|
+
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
993
|
break;
|
|
861
994
|
case c.too_small:
|
|
862
995
|
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 +1010,12 @@ var init_shared_es = __esm({
|
|
|
877
1010
|
r = "Number must be finite";
|
|
878
1011
|
break;
|
|
879
1012
|
default:
|
|
880
|
-
r = e.defaultError,
|
|
1013
|
+
r = e.defaultError, k.assertNever(t);
|
|
881
1014
|
}
|
|
882
1015
|
return { message: r };
|
|
883
1016
|
};
|
|
884
|
-
|
|
885
|
-
|
|
1017
|
+
Qe = ee;
|
|
1018
|
+
pe = (t) => {
|
|
886
1019
|
const { data: e, path: r, errorMaps: n, issueData: s } = t, a = [...r, ...s.path || []], i = {
|
|
887
1020
|
...s,
|
|
888
1021
|
path: a
|
|
@@ -894,9 +1027,9 @@ var init_shared_es = __esm({
|
|
|
894
1027
|
message: s.message
|
|
895
1028
|
};
|
|
896
1029
|
let o = "";
|
|
897
|
-
const
|
|
898
|
-
for (const
|
|
899
|
-
o =
|
|
1030
|
+
const f = n.filter((h) => !!h).slice().reverse();
|
|
1031
|
+
for (const h of f)
|
|
1032
|
+
o = h(i, { data: e, defaultError: o }).message;
|
|
900
1033
|
return {
|
|
901
1034
|
...s,
|
|
902
1035
|
path: a,
|
|
@@ -947,11 +1080,11 @@ var init_shared_es = __esm({
|
|
|
947
1080
|
_ = Object.freeze({
|
|
948
1081
|
status: "aborted"
|
|
949
1082
|
});
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
1083
|
+
J = (t) => ({ status: "dirty", value: t });
|
|
1084
|
+
A = (t) => ({ status: "valid", value: t });
|
|
1085
|
+
Ie = (t) => t.status === "aborted";
|
|
1086
|
+
we = (t) => t.status === "dirty";
|
|
1087
|
+
X = (t) => t.status === "valid";
|
|
955
1088
|
ne = (t) => typeof Promise < "u" && t instanceof Promise;
|
|
956
1089
|
(function(t) {
|
|
957
1090
|
t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
@@ -964,8 +1097,8 @@ var init_shared_es = __esm({
|
|
|
964
1097
|
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
1098
|
}
|
|
966
1099
|
};
|
|
967
|
-
|
|
968
|
-
if (
|
|
1100
|
+
De = (t, e) => {
|
|
1101
|
+
if (X(e))
|
|
969
1102
|
return { success: true, data: e.value };
|
|
970
1103
|
if (!t.common.issues.length)
|
|
971
1104
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -1038,7 +1171,7 @@ var init_shared_es = __esm({
|
|
|
1038
1171
|
data: e,
|
|
1039
1172
|
parsedType: j(e)
|
|
1040
1173
|
}, s = this._parseSync({ data: e, path: n.path, parent: n });
|
|
1041
|
-
return
|
|
1174
|
+
return De(n, s);
|
|
1042
1175
|
}
|
|
1043
1176
|
"~validate"(e) {
|
|
1044
1177
|
var n, s;
|
|
@@ -1056,7 +1189,7 @@ var init_shared_es = __esm({
|
|
|
1056
1189
|
if (!this["~standard"].async)
|
|
1057
1190
|
try {
|
|
1058
1191
|
const a = this._parseSync({ data: e, path: [], parent: r });
|
|
1059
|
-
return
|
|
1192
|
+
return X(a) ? {
|
|
1060
1193
|
value: a.value
|
|
1061
1194
|
} : {
|
|
1062
1195
|
issues: r.common.issues
|
|
@@ -1067,7 +1200,7 @@ var init_shared_es = __esm({
|
|
|
1067
1200
|
async: true
|
|
1068
1201
|
};
|
|
1069
1202
|
}
|
|
1070
|
-
return this._parseAsync({ data: e, path: [], parent: r }).then((a) =>
|
|
1203
|
+
return this._parseAsync({ data: e, path: [], parent: r }).then((a) => X(a) ? {
|
|
1071
1204
|
value: a.value
|
|
1072
1205
|
} : {
|
|
1073
1206
|
issues: r.common.issues
|
|
@@ -1092,7 +1225,7 @@ var init_shared_es = __esm({
|
|
|
1092
1225
|
data: e,
|
|
1093
1226
|
parsedType: j(e)
|
|
1094
1227
|
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (ne(s) ? s : Promise.resolve(s));
|
|
1095
|
-
return
|
|
1228
|
+
return De(n, a);
|
|
1096
1229
|
}
|
|
1097
1230
|
refine(e, r) {
|
|
1098
1231
|
const n = (s) => typeof r == "string" || typeof r > "u" ? { message: r } : typeof r == "function" ? r(s) : r;
|
|
@@ -1101,14 +1234,14 @@ var init_shared_es = __esm({
|
|
|
1101
1234
|
code: c.custom,
|
|
1102
1235
|
...n(s)
|
|
1103
1236
|
});
|
|
1104
|
-
return typeof Promise < "u" && i instanceof Promise ? i.then((
|
|
1237
|
+
return typeof Promise < "u" && i instanceof Promise ? i.then((f) => f ? true : (o(), false)) : i ? true : (o(), false);
|
|
1105
1238
|
});
|
|
1106
1239
|
}
|
|
1107
1240
|
refinement(e, r) {
|
|
1108
1241
|
return this._refinement((n, s) => e(n) ? true : (s.addIssue(typeof r == "function" ? r(n, s) : r), false));
|
|
1109
1242
|
}
|
|
1110
1243
|
_refinement(e) {
|
|
1111
|
-
return new
|
|
1244
|
+
return new B({
|
|
1112
1245
|
schema: this,
|
|
1113
1246
|
typeName: p.ZodEffects,
|
|
1114
1247
|
effect: { type: "refinement", refinement: e }
|
|
@@ -1125,10 +1258,10 @@ var init_shared_es = __esm({
|
|
|
1125
1258
|
};
|
|
1126
1259
|
}
|
|
1127
1260
|
optional() {
|
|
1128
|
-
return
|
|
1261
|
+
return Z.create(this, this._def);
|
|
1129
1262
|
}
|
|
1130
1263
|
nullable() {
|
|
1131
|
-
return
|
|
1264
|
+
return q.create(this, this._def);
|
|
1132
1265
|
}
|
|
1133
1266
|
nullish() {
|
|
1134
1267
|
return this.nullable().optional();
|
|
@@ -1137,7 +1270,7 @@ var init_shared_es = __esm({
|
|
|
1137
1270
|
return D.create(this);
|
|
1138
1271
|
}
|
|
1139
1272
|
promise() {
|
|
1140
|
-
return
|
|
1273
|
+
return re.create(this, this._def);
|
|
1141
1274
|
}
|
|
1142
1275
|
or(e) {
|
|
1143
1276
|
return ae.create([this, e], this._def);
|
|
@@ -1146,7 +1279,7 @@ var init_shared_es = __esm({
|
|
|
1146
1279
|
return ie.create(this, e, this._def);
|
|
1147
1280
|
}
|
|
1148
1281
|
transform(e) {
|
|
1149
|
-
return new
|
|
1282
|
+
return new B({
|
|
1150
1283
|
...g(this._def),
|
|
1151
1284
|
schema: this,
|
|
1152
1285
|
typeName: p.ZodEffects,
|
|
@@ -1163,7 +1296,7 @@ var init_shared_es = __esm({
|
|
|
1163
1296
|
});
|
|
1164
1297
|
}
|
|
1165
1298
|
brand() {
|
|
1166
|
-
return new
|
|
1299
|
+
return new ze({
|
|
1167
1300
|
typeName: p.ZodBranded,
|
|
1168
1301
|
type: this,
|
|
1169
1302
|
...g(this._def)
|
|
@@ -1186,7 +1319,7 @@ var init_shared_es = __esm({
|
|
|
1186
1319
|
});
|
|
1187
1320
|
}
|
|
1188
1321
|
pipe(e) {
|
|
1189
|
-
return
|
|
1322
|
+
return be.create(this, e);
|
|
1190
1323
|
}
|
|
1191
1324
|
readonly() {
|
|
1192
1325
|
return le.create(this);
|
|
@@ -1198,30 +1331,30 @@ var init_shared_es = __esm({
|
|
|
1198
1331
|
return this.safeParse(null).success;
|
|
1199
1332
|
}
|
|
1200
1333
|
};
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1334
|
+
Xe = /^c[^\s-]{8,}$/i;
|
|
1335
|
+
Ke = /^[0-9a-z]+$/;
|
|
1336
|
+
Je = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
|
|
1337
|
+
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;
|
|
1338
|
+
et = /^[a-z0-9_-]{21}$/i;
|
|
1339
|
+
tt = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
|
|
1340
|
+
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)?)??$/;
|
|
1341
|
+
nt = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
|
1342
|
+
st = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1343
|
+
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])$/;
|
|
1344
|
+
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])$/;
|
|
1345
|
+
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]))$/;
|
|
1346
|
+
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])$/;
|
|
1347
|
+
dt = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
1348
|
+
ut = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
|
|
1349
|
+
$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])))";
|
|
1350
|
+
lt = new RegExp(`^${$e}$`);
|
|
1218
1351
|
w = class _w extends v {
|
|
1219
1352
|
_parse(e) {
|
|
1220
|
-
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !==
|
|
1353
|
+
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== l.string) {
|
|
1221
1354
|
const a = this._getOrReturnCtx(e);
|
|
1222
|
-
return
|
|
1355
|
+
return u(a, {
|
|
1223
1356
|
code: c.invalid_type,
|
|
1224
|
-
expected:
|
|
1357
|
+
expected: l.string,
|
|
1225
1358
|
received: a.parsedType
|
|
1226
1359
|
}), _;
|
|
1227
1360
|
}
|
|
@@ -1229,7 +1362,7 @@ var init_shared_es = __esm({
|
|
|
1229
1362
|
let s;
|
|
1230
1363
|
for (const a of this._def.checks)
|
|
1231
1364
|
if (a.kind === "min")
|
|
1232
|
-
e.data.length < a.value && (s = this._getOrReturnCtx(e, s),
|
|
1365
|
+
e.data.length < a.value && (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1233
1366
|
code: c.too_small,
|
|
1234
1367
|
minimum: a.value,
|
|
1235
1368
|
type: "string",
|
|
@@ -1238,7 +1371,7 @@ var init_shared_es = __esm({
|
|
|
1238
1371
|
message: a.message
|
|
1239
1372
|
}), n.dirty());
|
|
1240
1373
|
else if (a.kind === "max")
|
|
1241
|
-
e.data.length > a.value && (s = this._getOrReturnCtx(e, s),
|
|
1374
|
+
e.data.length > a.value && (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1242
1375
|
code: c.too_big,
|
|
1243
1376
|
maximum: a.value,
|
|
1244
1377
|
type: "string",
|
|
@@ -1248,14 +1381,14 @@ var init_shared_es = __esm({
|
|
|
1248
1381
|
}), n.dirty());
|
|
1249
1382
|
else if (a.kind === "length") {
|
|
1250
1383
|
const i = e.data.length > a.value, o = e.data.length < a.value;
|
|
1251
|
-
(i || o) && (s = this._getOrReturnCtx(e, s), i ?
|
|
1384
|
+
(i || o) && (s = this._getOrReturnCtx(e, s), i ? u(s, {
|
|
1252
1385
|
code: c.too_big,
|
|
1253
1386
|
maximum: a.value,
|
|
1254
1387
|
type: "string",
|
|
1255
1388
|
inclusive: true,
|
|
1256
1389
|
exact: true,
|
|
1257
1390
|
message: a.message
|
|
1258
|
-
}) : o &&
|
|
1391
|
+
}) : o && u(s, {
|
|
1259
1392
|
code: c.too_small,
|
|
1260
1393
|
minimum: a.value,
|
|
1261
1394
|
type: "string",
|
|
@@ -1264,43 +1397,43 @@ var init_shared_es = __esm({
|
|
|
1264
1397
|
message: a.message
|
|
1265
1398
|
}), n.dirty());
|
|
1266
1399
|
} else if (a.kind === "email")
|
|
1267
|
-
|
|
1400
|
+
nt.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1268
1401
|
validation: "email",
|
|
1269
1402
|
code: c.invalid_string,
|
|
1270
1403
|
message: a.message
|
|
1271
1404
|
}), n.dirty());
|
|
1272
1405
|
else if (a.kind === "emoji")
|
|
1273
|
-
|
|
1406
|
+
me || (me = new RegExp(st, "u")), me.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1274
1407
|
validation: "emoji",
|
|
1275
1408
|
code: c.invalid_string,
|
|
1276
1409
|
message: a.message
|
|
1277
1410
|
}), n.dirty());
|
|
1278
1411
|
else if (a.kind === "uuid")
|
|
1279
|
-
|
|
1412
|
+
He.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1280
1413
|
validation: "uuid",
|
|
1281
1414
|
code: c.invalid_string,
|
|
1282
1415
|
message: a.message
|
|
1283
1416
|
}), n.dirty());
|
|
1284
1417
|
else if (a.kind === "nanoid")
|
|
1285
|
-
|
|
1418
|
+
et.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1286
1419
|
validation: "nanoid",
|
|
1287
1420
|
code: c.invalid_string,
|
|
1288
1421
|
message: a.message
|
|
1289
1422
|
}), n.dirty());
|
|
1290
1423
|
else if (a.kind === "cuid")
|
|
1291
|
-
|
|
1424
|
+
Xe.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1292
1425
|
validation: "cuid",
|
|
1293
1426
|
code: c.invalid_string,
|
|
1294
1427
|
message: a.message
|
|
1295
1428
|
}), n.dirty());
|
|
1296
1429
|
else if (a.kind === "cuid2")
|
|
1297
|
-
|
|
1430
|
+
Ke.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1298
1431
|
validation: "cuid2",
|
|
1299
1432
|
code: c.invalid_string,
|
|
1300
1433
|
message: a.message
|
|
1301
1434
|
}), n.dirty());
|
|
1302
1435
|
else if (a.kind === "ulid")
|
|
1303
|
-
|
|
1436
|
+
Je.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1304
1437
|
validation: "ulid",
|
|
1305
1438
|
code: c.invalid_string,
|
|
1306
1439
|
message: a.message
|
|
@@ -1309,65 +1442,65 @@ var init_shared_es = __esm({
|
|
|
1309
1442
|
try {
|
|
1310
1443
|
new URL(e.data);
|
|
1311
1444
|
} catch {
|
|
1312
|
-
s = this._getOrReturnCtx(e, s),
|
|
1445
|
+
s = this._getOrReturnCtx(e, s), u(s, {
|
|
1313
1446
|
validation: "url",
|
|
1314
1447
|
code: c.invalid_string,
|
|
1315
1448
|
message: a.message
|
|
1316
1449
|
}), n.dirty();
|
|
1317
1450
|
}
|
|
1318
|
-
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s),
|
|
1451
|
+
else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1319
1452
|
validation: "regex",
|
|
1320
1453
|
code: c.invalid_string,
|
|
1321
1454
|
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),
|
|
1455
|
+
}), 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
1456
|
code: c.invalid_string,
|
|
1324
1457
|
validation: { includes: a.value, position: a.position },
|
|
1325
1458
|
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),
|
|
1459
|
+
}), 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
1460
|
code: c.invalid_string,
|
|
1328
1461
|
validation: { startsWith: a.value },
|
|
1329
1462
|
message: a.message
|
|
1330
|
-
}), n.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s),
|
|
1463
|
+
}), n.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1331
1464
|
code: c.invalid_string,
|
|
1332
1465
|
validation: { endsWith: a.value },
|
|
1333
1466
|
message: a.message
|
|
1334
|
-
}), n.dirty()) : a.kind === "datetime" ?
|
|
1467
|
+
}), n.dirty()) : a.kind === "datetime" ? ft(a).test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1335
1468
|
code: c.invalid_string,
|
|
1336
1469
|
validation: "datetime",
|
|
1337
1470
|
message: a.message
|
|
1338
|
-
}), n.dirty()) : a.kind === "date" ?
|
|
1471
|
+
}), n.dirty()) : a.kind === "date" ? lt.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1339
1472
|
code: c.invalid_string,
|
|
1340
1473
|
validation: "date",
|
|
1341
1474
|
message: a.message
|
|
1342
|
-
}), n.dirty()) : a.kind === "time" ?
|
|
1475
|
+
}), n.dirty()) : a.kind === "time" ? ht(a).test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1343
1476
|
code: c.invalid_string,
|
|
1344
1477
|
validation: "time",
|
|
1345
1478
|
message: a.message
|
|
1346
|
-
}), n.dirty()) : a.kind === "duration" ?
|
|
1479
|
+
}), n.dirty()) : a.kind === "duration" ? rt.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1347
1480
|
validation: "duration",
|
|
1348
1481
|
code: c.invalid_string,
|
|
1349
1482
|
message: a.message
|
|
1350
|
-
}), n.dirty()) : a.kind === "ip" ?
|
|
1483
|
+
}), n.dirty()) : a.kind === "ip" ? mt(e.data, a.version) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1351
1484
|
validation: "ip",
|
|
1352
1485
|
code: c.invalid_string,
|
|
1353
1486
|
message: a.message
|
|
1354
|
-
}), n.dirty()) : a.kind === "jwt" ?
|
|
1487
|
+
}), n.dirty()) : a.kind === "jwt" ? _t(e.data, a.alg) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1355
1488
|
validation: "jwt",
|
|
1356
1489
|
code: c.invalid_string,
|
|
1357
1490
|
message: a.message
|
|
1358
|
-
}), n.dirty()) : a.kind === "cidr" ?
|
|
1491
|
+
}), n.dirty()) : a.kind === "cidr" ? pt(e.data, a.version) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1359
1492
|
validation: "cidr",
|
|
1360
1493
|
code: c.invalid_string,
|
|
1361
1494
|
message: a.message
|
|
1362
|
-
}), n.dirty()) : a.kind === "base64" ?
|
|
1495
|
+
}), n.dirty()) : a.kind === "base64" ? dt.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1363
1496
|
validation: "base64",
|
|
1364
1497
|
code: c.invalid_string,
|
|
1365
1498
|
message: a.message
|
|
1366
|
-
}), n.dirty()) : a.kind === "base64url" ?
|
|
1499
|
+
}), n.dirty()) : a.kind === "base64url" ? ut.test(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1367
1500
|
validation: "base64url",
|
|
1368
1501
|
code: c.invalid_string,
|
|
1369
1502
|
message: a.message
|
|
1370
|
-
}), n.dirty()) :
|
|
1503
|
+
}), n.dirty()) : k.assertNever(a);
|
|
1371
1504
|
return { status: n.value, value: e.data };
|
|
1372
1505
|
}
|
|
1373
1506
|
_regex(e, r, n) {
|
|
@@ -1598,49 +1731,49 @@ var init_shared_es = __esm({
|
|
|
1598
1731
|
coerce: (t == null ? void 0 : t.coerce) ?? false,
|
|
1599
1732
|
...g(t)
|
|
1600
1733
|
});
|
|
1601
|
-
|
|
1734
|
+
V = class _V extends v {
|
|
1602
1735
|
constructor() {
|
|
1603
1736
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1604
1737
|
}
|
|
1605
1738
|
_parse(e) {
|
|
1606
|
-
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !==
|
|
1739
|
+
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== l.number) {
|
|
1607
1740
|
const a = this._getOrReturnCtx(e);
|
|
1608
|
-
return
|
|
1741
|
+
return u(a, {
|
|
1609
1742
|
code: c.invalid_type,
|
|
1610
|
-
expected:
|
|
1743
|
+
expected: l.number,
|
|
1611
1744
|
received: a.parsedType
|
|
1612
1745
|
}), _;
|
|
1613
1746
|
}
|
|
1614
1747
|
let n;
|
|
1615
1748
|
const s = new O();
|
|
1616
1749
|
for (const a of this._def.checks)
|
|
1617
|
-
a.kind === "int" ?
|
|
1750
|
+
a.kind === "int" ? k.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), u(n, {
|
|
1618
1751
|
code: c.invalid_type,
|
|
1619
1752
|
expected: "integer",
|
|
1620
1753
|
received: "float",
|
|
1621
1754
|
message: a.message
|
|
1622
|
-
}), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n),
|
|
1755
|
+
}), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), u(n, {
|
|
1623
1756
|
code: c.too_small,
|
|
1624
1757
|
minimum: a.value,
|
|
1625
1758
|
type: "number",
|
|
1626
1759
|
inclusive: a.inclusive,
|
|
1627
1760
|
exact: false,
|
|
1628
1761
|
message: a.message
|
|
1629
|
-
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n),
|
|
1762
|
+
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), u(n, {
|
|
1630
1763
|
code: c.too_big,
|
|
1631
1764
|
maximum: a.value,
|
|
1632
1765
|
type: "number",
|
|
1633
1766
|
inclusive: a.inclusive,
|
|
1634
1767
|
exact: false,
|
|
1635
1768
|
message: a.message
|
|
1636
|
-
}), s.dirty()) : a.kind === "multipleOf" ?
|
|
1769
|
+
}), s.dirty()) : a.kind === "multipleOf" ? yt(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), u(n, {
|
|
1637
1770
|
code: c.not_multiple_of,
|
|
1638
1771
|
multipleOf: a.value,
|
|
1639
1772
|
message: a.message
|
|
1640
|
-
}), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n),
|
|
1773
|
+
}), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), u(n, {
|
|
1641
1774
|
code: c.not_finite,
|
|
1642
1775
|
message: a.message
|
|
1643
|
-
}), s.dirty()) :
|
|
1776
|
+
}), s.dirty()) : k.assertNever(a);
|
|
1644
1777
|
return { status: s.value, value: e.data };
|
|
1645
1778
|
}
|
|
1646
1779
|
gte(e, r) {
|
|
@@ -1656,7 +1789,7 @@ var init_shared_es = __esm({
|
|
|
1656
1789
|
return this.setLimit("max", e, false, m.toString(r));
|
|
1657
1790
|
}
|
|
1658
1791
|
setLimit(e, r, n, s) {
|
|
1659
|
-
return new
|
|
1792
|
+
return new _V({
|
|
1660
1793
|
...this._def,
|
|
1661
1794
|
checks: [
|
|
1662
1795
|
...this._def.checks,
|
|
@@ -1670,7 +1803,7 @@ var init_shared_es = __esm({
|
|
|
1670
1803
|
});
|
|
1671
1804
|
}
|
|
1672
1805
|
_addCheck(e) {
|
|
1673
|
-
return new
|
|
1806
|
+
return new _V({
|
|
1674
1807
|
...this._def,
|
|
1675
1808
|
checks: [...this._def.checks, e]
|
|
1676
1809
|
});
|
|
@@ -1752,7 +1885,7 @@ var init_shared_es = __esm({
|
|
|
1752
1885
|
return e;
|
|
1753
1886
|
}
|
|
1754
1887
|
get isInt() {
|
|
1755
|
-
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" &&
|
|
1888
|
+
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && k.isInteger(e.value));
|
|
1756
1889
|
}
|
|
1757
1890
|
get isFinite() {
|
|
1758
1891
|
let e = null, r = null;
|
|
@@ -1764,13 +1897,13 @@ var init_shared_es = __esm({
|
|
|
1764
1897
|
return Number.isFinite(r) && Number.isFinite(e);
|
|
1765
1898
|
}
|
|
1766
1899
|
};
|
|
1767
|
-
|
|
1900
|
+
V.create = (t) => new V({
|
|
1768
1901
|
checks: [],
|
|
1769
1902
|
typeName: p.ZodNumber,
|
|
1770
1903
|
coerce: (t == null ? void 0 : t.coerce) || false,
|
|
1771
1904
|
...g(t)
|
|
1772
1905
|
});
|
|
1773
|
-
|
|
1906
|
+
F = class _F extends v {
|
|
1774
1907
|
constructor() {
|
|
1775
1908
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1776
1909
|
}
|
|
@@ -1781,35 +1914,35 @@ var init_shared_es = __esm({
|
|
|
1781
1914
|
} catch {
|
|
1782
1915
|
return this._getInvalidInput(e);
|
|
1783
1916
|
}
|
|
1784
|
-
if (this._getType(e) !==
|
|
1917
|
+
if (this._getType(e) !== l.bigint)
|
|
1785
1918
|
return this._getInvalidInput(e);
|
|
1786
1919
|
let n;
|
|
1787
1920
|
const s = new O();
|
|
1788
1921
|
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),
|
|
1922
|
+
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), u(n, {
|
|
1790
1923
|
code: c.too_small,
|
|
1791
1924
|
type: "bigint",
|
|
1792
1925
|
minimum: a.value,
|
|
1793
1926
|
inclusive: a.inclusive,
|
|
1794
1927
|
message: a.message
|
|
1795
|
-
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n),
|
|
1928
|
+
}), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (n = this._getOrReturnCtx(e, n), u(n, {
|
|
1796
1929
|
code: c.too_big,
|
|
1797
1930
|
type: "bigint",
|
|
1798
1931
|
maximum: a.value,
|
|
1799
1932
|
inclusive: a.inclusive,
|
|
1800
1933
|
message: a.message
|
|
1801
|
-
}), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n),
|
|
1934
|
+
}), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), u(n, {
|
|
1802
1935
|
code: c.not_multiple_of,
|
|
1803
1936
|
multipleOf: a.value,
|
|
1804
1937
|
message: a.message
|
|
1805
|
-
}), s.dirty()) :
|
|
1938
|
+
}), s.dirty()) : k.assertNever(a);
|
|
1806
1939
|
return { status: s.value, value: e.data };
|
|
1807
1940
|
}
|
|
1808
1941
|
_getInvalidInput(e) {
|
|
1809
1942
|
const r = this._getOrReturnCtx(e);
|
|
1810
|
-
return
|
|
1943
|
+
return u(r, {
|
|
1811
1944
|
code: c.invalid_type,
|
|
1812
|
-
expected:
|
|
1945
|
+
expected: l.bigint,
|
|
1813
1946
|
received: r.parsedType
|
|
1814
1947
|
}), _;
|
|
1815
1948
|
}
|
|
@@ -1826,7 +1959,7 @@ var init_shared_es = __esm({
|
|
|
1826
1959
|
return this.setLimit("max", e, false, m.toString(r));
|
|
1827
1960
|
}
|
|
1828
1961
|
setLimit(e, r, n, s) {
|
|
1829
|
-
return new
|
|
1962
|
+
return new _F({
|
|
1830
1963
|
...this._def,
|
|
1831
1964
|
checks: [
|
|
1832
1965
|
...this._def.checks,
|
|
@@ -1840,7 +1973,7 @@ var init_shared_es = __esm({
|
|
|
1840
1973
|
});
|
|
1841
1974
|
}
|
|
1842
1975
|
_addCheck(e) {
|
|
1843
|
-
return new
|
|
1976
|
+
return new _F({
|
|
1844
1977
|
...this._def,
|
|
1845
1978
|
checks: [...this._def.checks, e]
|
|
1846
1979
|
});
|
|
@@ -1897,7 +2030,7 @@ var init_shared_es = __esm({
|
|
|
1897
2030
|
return e;
|
|
1898
2031
|
}
|
|
1899
2032
|
};
|
|
1900
|
-
|
|
2033
|
+
F.create = (t) => new F({
|
|
1901
2034
|
checks: [],
|
|
1902
2035
|
typeName: p.ZodBigInt,
|
|
1903
2036
|
coerce: (t == null ? void 0 : t.coerce) ?? false,
|
|
@@ -1905,15 +2038,15 @@ var init_shared_es = __esm({
|
|
|
1905
2038
|
});
|
|
1906
2039
|
se = class extends v {
|
|
1907
2040
|
_parse(e) {
|
|
1908
|
-
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !==
|
|
2041
|
+
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== l.boolean) {
|
|
1909
2042
|
const n = this._getOrReturnCtx(e);
|
|
1910
|
-
return
|
|
2043
|
+
return u(n, {
|
|
1911
2044
|
code: c.invalid_type,
|
|
1912
|
-
expected:
|
|
2045
|
+
expected: l.boolean,
|
|
1913
2046
|
received: n.parsedType
|
|
1914
2047
|
}), _;
|
|
1915
2048
|
}
|
|
1916
|
-
return
|
|
2049
|
+
return A(e.data);
|
|
1917
2050
|
}
|
|
1918
2051
|
};
|
|
1919
2052
|
se.create = (t) => new se({
|
|
@@ -1921,47 +2054,47 @@ var init_shared_es = __esm({
|
|
|
1921
2054
|
coerce: (t == null ? void 0 : t.coerce) || false,
|
|
1922
2055
|
...g(t)
|
|
1923
2056
|
});
|
|
1924
|
-
|
|
2057
|
+
K = class _K extends v {
|
|
1925
2058
|
_parse(e) {
|
|
1926
|
-
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !==
|
|
2059
|
+
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== l.date) {
|
|
1927
2060
|
const a = this._getOrReturnCtx(e);
|
|
1928
|
-
return
|
|
2061
|
+
return u(a, {
|
|
1929
2062
|
code: c.invalid_type,
|
|
1930
|
-
expected:
|
|
2063
|
+
expected: l.date,
|
|
1931
2064
|
received: a.parsedType
|
|
1932
2065
|
}), _;
|
|
1933
2066
|
}
|
|
1934
2067
|
if (Number.isNaN(e.data.getTime())) {
|
|
1935
2068
|
const a = this._getOrReturnCtx(e);
|
|
1936
|
-
return
|
|
2069
|
+
return u(a, {
|
|
1937
2070
|
code: c.invalid_date
|
|
1938
2071
|
}), _;
|
|
1939
2072
|
}
|
|
1940
2073
|
const n = new O();
|
|
1941
2074
|
let s;
|
|
1942
2075
|
for (const a of this._def.checks)
|
|
1943
|
-
a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s),
|
|
2076
|
+
a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1944
2077
|
code: c.too_small,
|
|
1945
2078
|
message: a.message,
|
|
1946
2079
|
inclusive: true,
|
|
1947
2080
|
exact: false,
|
|
1948
2081
|
minimum: a.value,
|
|
1949
2082
|
type: "date"
|
|
1950
|
-
}), n.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s),
|
|
2083
|
+
}), n.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s), u(s, {
|
|
1951
2084
|
code: c.too_big,
|
|
1952
2085
|
message: a.message,
|
|
1953
2086
|
inclusive: true,
|
|
1954
2087
|
exact: false,
|
|
1955
2088
|
maximum: a.value,
|
|
1956
2089
|
type: "date"
|
|
1957
|
-
}), n.dirty()) :
|
|
2090
|
+
}), n.dirty()) : k.assertNever(a);
|
|
1958
2091
|
return {
|
|
1959
2092
|
status: n.value,
|
|
1960
2093
|
value: new Date(e.data.getTime())
|
|
1961
2094
|
};
|
|
1962
2095
|
}
|
|
1963
2096
|
_addCheck(e) {
|
|
1964
|
-
return new
|
|
2097
|
+
return new _K({
|
|
1965
2098
|
...this._def,
|
|
1966
2099
|
checks: [...this._def.checks, e]
|
|
1967
2100
|
});
|
|
@@ -1993,93 +2126,93 @@ var init_shared_es = __esm({
|
|
|
1993
2126
|
return e != null ? new Date(e) : null;
|
|
1994
2127
|
}
|
|
1995
2128
|
};
|
|
1996
|
-
|
|
2129
|
+
K.create = (t) => new K({
|
|
1997
2130
|
checks: [],
|
|
1998
2131
|
coerce: (t == null ? void 0 : t.coerce) || false,
|
|
1999
2132
|
typeName: p.ZodDate,
|
|
2000
2133
|
...g(t)
|
|
2001
2134
|
});
|
|
2002
|
-
|
|
2135
|
+
Me = class extends v {
|
|
2003
2136
|
_parse(e) {
|
|
2004
|
-
if (this._getType(e) !==
|
|
2137
|
+
if (this._getType(e) !== l.symbol) {
|
|
2005
2138
|
const n = this._getOrReturnCtx(e);
|
|
2006
|
-
return
|
|
2139
|
+
return u(n, {
|
|
2007
2140
|
code: c.invalid_type,
|
|
2008
|
-
expected:
|
|
2141
|
+
expected: l.symbol,
|
|
2009
2142
|
received: n.parsedType
|
|
2010
2143
|
}), _;
|
|
2011
2144
|
}
|
|
2012
|
-
return
|
|
2145
|
+
return A(e.data);
|
|
2013
2146
|
}
|
|
2014
2147
|
};
|
|
2015
|
-
|
|
2148
|
+
Me.create = (t) => new Me({
|
|
2016
2149
|
typeName: p.ZodSymbol,
|
|
2017
2150
|
...g(t)
|
|
2018
2151
|
});
|
|
2019
|
-
|
|
2152
|
+
ye = class extends v {
|
|
2020
2153
|
_parse(e) {
|
|
2021
|
-
if (this._getType(e) !==
|
|
2154
|
+
if (this._getType(e) !== l.undefined) {
|
|
2022
2155
|
const n = this._getOrReturnCtx(e);
|
|
2023
|
-
return
|
|
2156
|
+
return u(n, {
|
|
2024
2157
|
code: c.invalid_type,
|
|
2025
|
-
expected:
|
|
2158
|
+
expected: l.undefined,
|
|
2026
2159
|
received: n.parsedType
|
|
2027
2160
|
}), _;
|
|
2028
2161
|
}
|
|
2029
|
-
return
|
|
2162
|
+
return A(e.data);
|
|
2030
2163
|
}
|
|
2031
2164
|
};
|
|
2032
|
-
|
|
2165
|
+
ye.create = (t) => new ye({
|
|
2033
2166
|
typeName: p.ZodUndefined,
|
|
2034
2167
|
...g(t)
|
|
2035
2168
|
});
|
|
2036
|
-
|
|
2169
|
+
ge = class extends v {
|
|
2037
2170
|
_parse(e) {
|
|
2038
|
-
if (this._getType(e) !==
|
|
2171
|
+
if (this._getType(e) !== l.null) {
|
|
2039
2172
|
const n = this._getOrReturnCtx(e);
|
|
2040
|
-
return
|
|
2173
|
+
return u(n, {
|
|
2041
2174
|
code: c.invalid_type,
|
|
2042
|
-
expected:
|
|
2175
|
+
expected: l.null,
|
|
2043
2176
|
received: n.parsedType
|
|
2044
2177
|
}), _;
|
|
2045
2178
|
}
|
|
2046
|
-
return
|
|
2179
|
+
return A(e.data);
|
|
2047
2180
|
}
|
|
2048
2181
|
};
|
|
2049
|
-
|
|
2182
|
+
ge.create = (t) => new ge({
|
|
2050
2183
|
typeName: p.ZodNull,
|
|
2051
2184
|
...g(t)
|
|
2052
2185
|
});
|
|
2053
|
-
|
|
2186
|
+
Se = class extends v {
|
|
2054
2187
|
constructor() {
|
|
2055
2188
|
super(...arguments), this._any = true;
|
|
2056
2189
|
}
|
|
2057
2190
|
_parse(e) {
|
|
2058
|
-
return
|
|
2191
|
+
return A(e.data);
|
|
2059
2192
|
}
|
|
2060
2193
|
};
|
|
2061
|
-
|
|
2194
|
+
Se.create = (t) => new Se({
|
|
2062
2195
|
typeName: p.ZodAny,
|
|
2063
2196
|
...g(t)
|
|
2064
2197
|
});
|
|
2065
|
-
|
|
2198
|
+
Q = class extends v {
|
|
2066
2199
|
constructor() {
|
|
2067
2200
|
super(...arguments), this._unknown = true;
|
|
2068
2201
|
}
|
|
2069
2202
|
_parse(e) {
|
|
2070
|
-
return
|
|
2203
|
+
return A(e.data);
|
|
2071
2204
|
}
|
|
2072
2205
|
};
|
|
2073
|
-
|
|
2206
|
+
Q.create = (t) => new Q({
|
|
2074
2207
|
typeName: p.ZodUnknown,
|
|
2075
2208
|
...g(t)
|
|
2076
2209
|
});
|
|
2077
2210
|
C = class extends v {
|
|
2078
2211
|
_parse(e) {
|
|
2079
2212
|
const r = this._getOrReturnCtx(e);
|
|
2080
|
-
return
|
|
2213
|
+
return u(r, {
|
|
2081
2214
|
code: c.invalid_type,
|
|
2082
|
-
expected:
|
|
2215
|
+
expected: l.never,
|
|
2083
2216
|
received: r.parsedType
|
|
2084
2217
|
}), _;
|
|
2085
2218
|
}
|
|
@@ -2088,35 +2221,35 @@ var init_shared_es = __esm({
|
|
|
2088
2221
|
typeName: p.ZodNever,
|
|
2089
2222
|
...g(t)
|
|
2090
2223
|
});
|
|
2091
|
-
|
|
2224
|
+
Le = class extends v {
|
|
2092
2225
|
_parse(e) {
|
|
2093
|
-
if (this._getType(e) !==
|
|
2226
|
+
if (this._getType(e) !== l.undefined) {
|
|
2094
2227
|
const n = this._getOrReturnCtx(e);
|
|
2095
|
-
return
|
|
2228
|
+
return u(n, {
|
|
2096
2229
|
code: c.invalid_type,
|
|
2097
|
-
expected:
|
|
2230
|
+
expected: l.void,
|
|
2098
2231
|
received: n.parsedType
|
|
2099
2232
|
}), _;
|
|
2100
2233
|
}
|
|
2101
|
-
return
|
|
2234
|
+
return A(e.data);
|
|
2102
2235
|
}
|
|
2103
2236
|
};
|
|
2104
|
-
|
|
2237
|
+
Le.create = (t) => new Le({
|
|
2105
2238
|
typeName: p.ZodVoid,
|
|
2106
2239
|
...g(t)
|
|
2107
2240
|
});
|
|
2108
2241
|
D = class _D extends v {
|
|
2109
2242
|
_parse(e) {
|
|
2110
2243
|
const { ctx: r, status: n } = this._processInputParams(e), s = this._def;
|
|
2111
|
-
if (r.parsedType !==
|
|
2112
|
-
return
|
|
2244
|
+
if (r.parsedType !== l.array)
|
|
2245
|
+
return u(r, {
|
|
2113
2246
|
code: c.invalid_type,
|
|
2114
|
-
expected:
|
|
2247
|
+
expected: l.array,
|
|
2115
2248
|
received: r.parsedType
|
|
2116
2249
|
}), _;
|
|
2117
2250
|
if (s.exactLength !== null) {
|
|
2118
2251
|
const i = r.data.length > s.exactLength.value, o = r.data.length < s.exactLength.value;
|
|
2119
|
-
(i || o) && (
|
|
2252
|
+
(i || o) && (u(r, {
|
|
2120
2253
|
code: i ? c.too_big : c.too_small,
|
|
2121
2254
|
minimum: o ? s.exactLength.value : void 0,
|
|
2122
2255
|
maximum: i ? s.exactLength.value : void 0,
|
|
@@ -2126,14 +2259,14 @@ var init_shared_es = __esm({
|
|
|
2126
2259
|
message: s.exactLength.message
|
|
2127
2260
|
}), n.dirty());
|
|
2128
2261
|
}
|
|
2129
|
-
if (s.minLength !== null && r.data.length < s.minLength.value && (
|
|
2262
|
+
if (s.minLength !== null && r.data.length < s.minLength.value && (u(r, {
|
|
2130
2263
|
code: c.too_small,
|
|
2131
2264
|
minimum: s.minLength.value,
|
|
2132
2265
|
type: "array",
|
|
2133
2266
|
inclusive: true,
|
|
2134
2267
|
exact: false,
|
|
2135
2268
|
message: s.minLength.message
|
|
2136
|
-
}), n.dirty()), s.maxLength !== null && r.data.length > s.maxLength.value && (
|
|
2269
|
+
}), n.dirty()), s.maxLength !== null && r.data.length > s.maxLength.value && (u(r, {
|
|
2137
2270
|
code: c.too_big,
|
|
2138
2271
|
maximum: s.maxLength.value,
|
|
2139
2272
|
type: "array",
|
|
@@ -2185,53 +2318,53 @@ var init_shared_es = __esm({
|
|
|
2185
2318
|
_getCached() {
|
|
2186
2319
|
if (this._cached !== null)
|
|
2187
2320
|
return this._cached;
|
|
2188
|
-
const e = this._def.shape(), r =
|
|
2321
|
+
const e = this._def.shape(), r = k.objectKeys(e);
|
|
2189
2322
|
return this._cached = { shape: e, keys: r }, this._cached;
|
|
2190
2323
|
}
|
|
2191
2324
|
_parse(e) {
|
|
2192
|
-
if (this._getType(e) !==
|
|
2193
|
-
const
|
|
2194
|
-
return
|
|
2325
|
+
if (this._getType(e) !== l.object) {
|
|
2326
|
+
const h = this._getOrReturnCtx(e);
|
|
2327
|
+
return u(h, {
|
|
2195
2328
|
code: c.invalid_type,
|
|
2196
|
-
expected:
|
|
2197
|
-
received:
|
|
2329
|
+
expected: l.object,
|
|
2330
|
+
received: h.parsedType
|
|
2198
2331
|
}), _;
|
|
2199
2332
|
}
|
|
2200
2333
|
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
|
|
2201
2334
|
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:
|
|
2335
|
+
for (const h in s.data)
|
|
2336
|
+
i.includes(h) || o.push(h);
|
|
2337
|
+
const f = [];
|
|
2338
|
+
for (const h of i) {
|
|
2339
|
+
const T = a[h], N = s.data[h];
|
|
2340
|
+
f.push({
|
|
2341
|
+
key: { status: "valid", value: h },
|
|
2342
|
+
value: T._parse(new M(s, N, s.path, h)),
|
|
2343
|
+
alwaysSet: h in s.data
|
|
2211
2344
|
});
|
|
2212
2345
|
}
|
|
2213
2346
|
if (this._def.catchall instanceof C) {
|
|
2214
|
-
const
|
|
2215
|
-
if (
|
|
2347
|
+
const h = this._def.unknownKeys;
|
|
2348
|
+
if (h === "passthrough")
|
|
2216
2349
|
for (const T of o)
|
|
2217
|
-
|
|
2350
|
+
f.push({
|
|
2218
2351
|
key: { status: "valid", value: T },
|
|
2219
2352
|
value: { status: "valid", value: s.data[T] }
|
|
2220
2353
|
});
|
|
2221
|
-
else if (
|
|
2222
|
-
o.length > 0 && (
|
|
2354
|
+
else if (h === "strict")
|
|
2355
|
+
o.length > 0 && (u(s, {
|
|
2223
2356
|
code: c.unrecognized_keys,
|
|
2224
2357
|
keys: o
|
|
2225
2358
|
}), n.dirty());
|
|
2226
|
-
else if (
|
|
2359
|
+
else if (h !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
2227
2360
|
} else {
|
|
2228
|
-
const
|
|
2361
|
+
const h = this._def.catchall;
|
|
2229
2362
|
for (const T of o) {
|
|
2230
|
-
const
|
|
2231
|
-
|
|
2363
|
+
const N = s.data[T];
|
|
2364
|
+
f.push({
|
|
2232
2365
|
key: { status: "valid", value: T },
|
|
2233
|
-
value:
|
|
2234
|
-
new M(s,
|
|
2366
|
+
value: h._parse(
|
|
2367
|
+
new M(s, N, s.path, T)
|
|
2235
2368
|
//, ctx.child(key), value, getParsedType(value)
|
|
2236
2369
|
),
|
|
2237
2370
|
alwaysSet: T in s.data
|
|
@@ -2239,17 +2372,17 @@ var init_shared_es = __esm({
|
|
|
2239
2372
|
}
|
|
2240
2373
|
}
|
|
2241
2374
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
2242
|
-
const
|
|
2243
|
-
for (const T of
|
|
2244
|
-
const
|
|
2245
|
-
|
|
2246
|
-
key:
|
|
2247
|
-
value:
|
|
2375
|
+
const h = [];
|
|
2376
|
+
for (const T of f) {
|
|
2377
|
+
const N = await T.key, Ne = await T.value;
|
|
2378
|
+
h.push({
|
|
2379
|
+
key: N,
|
|
2380
|
+
value: Ne,
|
|
2248
2381
|
alwaysSet: T.alwaysSet
|
|
2249
2382
|
});
|
|
2250
2383
|
}
|
|
2251
|
-
return
|
|
2252
|
-
}).then((
|
|
2384
|
+
return h;
|
|
2385
|
+
}).then((h) => O.mergeObjectSync(n, h)) : O.mergeObjectSync(n, f);
|
|
2253
2386
|
}
|
|
2254
2387
|
get shape() {
|
|
2255
2388
|
return this._def.shape();
|
|
@@ -2392,7 +2525,7 @@ var init_shared_es = __esm({
|
|
|
2392
2525
|
}
|
|
2393
2526
|
pick(e) {
|
|
2394
2527
|
const r = {};
|
|
2395
|
-
for (const n of
|
|
2528
|
+
for (const n of k.objectKeys(e))
|
|
2396
2529
|
e[n] && this.shape[n] && (r[n] = this.shape[n]);
|
|
2397
2530
|
return new _x({
|
|
2398
2531
|
...this._def,
|
|
@@ -2401,7 +2534,7 @@ var init_shared_es = __esm({
|
|
|
2401
2534
|
}
|
|
2402
2535
|
omit(e) {
|
|
2403
2536
|
const r = {};
|
|
2404
|
-
for (const n of
|
|
2537
|
+
for (const n of k.objectKeys(this.shape))
|
|
2405
2538
|
e[n] || (r[n] = this.shape[n]);
|
|
2406
2539
|
return new _x({
|
|
2407
2540
|
...this._def,
|
|
@@ -2412,11 +2545,11 @@ var init_shared_es = __esm({
|
|
|
2412
2545
|
* @deprecated
|
|
2413
2546
|
*/
|
|
2414
2547
|
deepPartial() {
|
|
2415
|
-
return
|
|
2548
|
+
return Y(this);
|
|
2416
2549
|
}
|
|
2417
2550
|
partial(e) {
|
|
2418
2551
|
const r = {};
|
|
2419
|
-
for (const n of
|
|
2552
|
+
for (const n of k.objectKeys(this.shape)) {
|
|
2420
2553
|
const s = this.shape[n];
|
|
2421
2554
|
e && !e[n] ? r[n] = s : r[n] = s.optional();
|
|
2422
2555
|
}
|
|
@@ -2427,12 +2560,12 @@ var init_shared_es = __esm({
|
|
|
2427
2560
|
}
|
|
2428
2561
|
required(e) {
|
|
2429
2562
|
const r = {};
|
|
2430
|
-
for (const n of
|
|
2563
|
+
for (const n of k.objectKeys(this.shape))
|
|
2431
2564
|
if (e && !e[n])
|
|
2432
2565
|
r[n] = this.shape[n];
|
|
2433
2566
|
else {
|
|
2434
2567
|
let a = this.shape[n];
|
|
2435
|
-
for (; a instanceof
|
|
2568
|
+
for (; a instanceof Z; )
|
|
2436
2569
|
a = a._def.innerType;
|
|
2437
2570
|
r[n] = a;
|
|
2438
2571
|
}
|
|
@@ -2442,7 +2575,7 @@ var init_shared_es = __esm({
|
|
|
2442
2575
|
});
|
|
2443
2576
|
}
|
|
2444
2577
|
keyof() {
|
|
2445
|
-
return
|
|
2578
|
+
return Fe(k.objectKeys(this.shape));
|
|
2446
2579
|
}
|
|
2447
2580
|
};
|
|
2448
2581
|
x.create = (t, e) => new x({
|
|
@@ -2477,7 +2610,7 @@ var init_shared_es = __esm({
|
|
|
2477
2610
|
if (o.result.status === "dirty")
|
|
2478
2611
|
return r.common.issues.push(...o.ctx.common.issues), o.result;
|
|
2479
2612
|
const i = a.map((o) => new R(o.ctx.common.issues));
|
|
2480
|
-
return
|
|
2613
|
+
return u(r, {
|
|
2481
2614
|
code: c.invalid_union,
|
|
2482
2615
|
unionErrors: i
|
|
2483
2616
|
}), _;
|
|
@@ -2504,27 +2637,27 @@ var init_shared_es = __esm({
|
|
|
2504
2637
|
{
|
|
2505
2638
|
let a;
|
|
2506
2639
|
const i = [];
|
|
2507
|
-
for (const
|
|
2508
|
-
const
|
|
2640
|
+
for (const f of n) {
|
|
2641
|
+
const h = {
|
|
2509
2642
|
...r,
|
|
2510
2643
|
common: {
|
|
2511
2644
|
...r.common,
|
|
2512
2645
|
issues: []
|
|
2513
2646
|
},
|
|
2514
2647
|
parent: null
|
|
2515
|
-
}, T =
|
|
2648
|
+
}, T = f._parseSync({
|
|
2516
2649
|
data: r.data,
|
|
2517
2650
|
path: r.path,
|
|
2518
|
-
parent:
|
|
2651
|
+
parent: h
|
|
2519
2652
|
});
|
|
2520
2653
|
if (T.status === "valid")
|
|
2521
2654
|
return T;
|
|
2522
|
-
T.status === "dirty" && !a && (a = { result: T, ctx:
|
|
2655
|
+
T.status === "dirty" && !a && (a = { result: T, ctx: h }), h.common.issues.length && i.push(h.common.issues);
|
|
2523
2656
|
}
|
|
2524
2657
|
if (a)
|
|
2525
2658
|
return r.common.issues.push(...a.ctx.common.issues), a.result;
|
|
2526
|
-
const o = i.map((
|
|
2527
|
-
return
|
|
2659
|
+
const o = i.map((f) => new R(f));
|
|
2660
|
+
return u(r, {
|
|
2528
2661
|
code: c.invalid_union,
|
|
2529
2662
|
unionErrors: o
|
|
2530
2663
|
}), _;
|
|
@@ -2539,14 +2672,14 @@ var init_shared_es = __esm({
|
|
|
2539
2672
|
typeName: p.ZodUnion,
|
|
2540
2673
|
...g(e)
|
|
2541
2674
|
});
|
|
2542
|
-
|
|
2543
|
-
|
|
2675
|
+
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) : [];
|
|
2676
|
+
xe = class _xe extends v {
|
|
2544
2677
|
_parse(e) {
|
|
2545
2678
|
const { ctx: r } = this._processInputParams(e);
|
|
2546
|
-
if (r.parsedType !==
|
|
2547
|
-
return
|
|
2679
|
+
if (r.parsedType !== l.object)
|
|
2680
|
+
return u(r, {
|
|
2548
2681
|
code: c.invalid_type,
|
|
2549
|
-
expected:
|
|
2682
|
+
expected: l.object,
|
|
2550
2683
|
received: r.parsedType
|
|
2551
2684
|
}), _;
|
|
2552
2685
|
const n = this.discriminator, s = r.data[n], a = this.optionsMap.get(s);
|
|
@@ -2558,7 +2691,7 @@ var init_shared_es = __esm({
|
|
|
2558
2691
|
data: r.data,
|
|
2559
2692
|
path: r.path,
|
|
2560
2693
|
parent: r
|
|
2561
|
-
}) : (
|
|
2694
|
+
}) : (u(r, {
|
|
2562
2695
|
code: c.invalid_union_discriminator,
|
|
2563
2696
|
options: Array.from(this.optionsMap.keys()),
|
|
2564
2697
|
path: [n]
|
|
@@ -2584,7 +2717,7 @@ var init_shared_es = __esm({
|
|
|
2584
2717
|
static create(e, r, n) {
|
|
2585
2718
|
const s = /* @__PURE__ */ new Map();
|
|
2586
2719
|
for (const a of r) {
|
|
2587
|
-
const i =
|
|
2720
|
+
const i = U(a.shape[e]);
|
|
2588
2721
|
if (!i.length)
|
|
2589
2722
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
2590
2723
|
for (const o of i) {
|
|
@@ -2593,7 +2726,7 @@ var init_shared_es = __esm({
|
|
|
2593
2726
|
s.set(o, a);
|
|
2594
2727
|
}
|
|
2595
2728
|
}
|
|
2596
|
-
return new
|
|
2729
|
+
return new _xe({
|
|
2597
2730
|
typeName: p.ZodDiscriminatedUnion,
|
|
2598
2731
|
discriminator: e,
|
|
2599
2732
|
options: r,
|
|
@@ -2605,10 +2738,10 @@ var init_shared_es = __esm({
|
|
|
2605
2738
|
ie = class extends v {
|
|
2606
2739
|
_parse(e) {
|
|
2607
2740
|
const { status: r, ctx: n } = this._processInputParams(e), s = (a, i) => {
|
|
2608
|
-
if (
|
|
2741
|
+
if (Ie(a) || Ie(i))
|
|
2609
2742
|
return _;
|
|
2610
|
-
const o =
|
|
2611
|
-
return o.valid ? ((
|
|
2743
|
+
const o = ve(a.value, i.value);
|
|
2744
|
+
return o.valid ? ((we(a) || we(i)) && r.dirty(), { status: r.value, value: o.data }) : (u(n, {
|
|
2612
2745
|
code: c.invalid_intersection_types
|
|
2613
2746
|
}), _);
|
|
2614
2747
|
};
|
|
@@ -2640,24 +2773,24 @@ var init_shared_es = __esm({
|
|
|
2640
2773
|
typeName: p.ZodIntersection,
|
|
2641
2774
|
...g(r)
|
|
2642
2775
|
});
|
|
2643
|
-
|
|
2776
|
+
P = class _P extends v {
|
|
2644
2777
|
_parse(e) {
|
|
2645
2778
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2646
|
-
if (n.parsedType !==
|
|
2647
|
-
return
|
|
2779
|
+
if (n.parsedType !== l.array)
|
|
2780
|
+
return u(n, {
|
|
2648
2781
|
code: c.invalid_type,
|
|
2649
|
-
expected:
|
|
2782
|
+
expected: l.array,
|
|
2650
2783
|
received: n.parsedType
|
|
2651
2784
|
}), _;
|
|
2652
2785
|
if (n.data.length < this._def.items.length)
|
|
2653
|
-
return
|
|
2786
|
+
return u(n, {
|
|
2654
2787
|
code: c.too_small,
|
|
2655
2788
|
minimum: this._def.items.length,
|
|
2656
2789
|
inclusive: true,
|
|
2657
2790
|
exact: false,
|
|
2658
2791
|
type: "array"
|
|
2659
2792
|
}), _;
|
|
2660
|
-
!this._def.rest && n.data.length > this._def.items.length && (
|
|
2793
|
+
!this._def.rest && n.data.length > this._def.items.length && (u(n, {
|
|
2661
2794
|
code: c.too_big,
|
|
2662
2795
|
maximum: this._def.items.length,
|
|
2663
2796
|
inclusive: true,
|
|
@@ -2665,8 +2798,8 @@ var init_shared_es = __esm({
|
|
|
2665
2798
|
type: "array"
|
|
2666
2799
|
}), r.dirty());
|
|
2667
2800
|
const a = [...n.data].map((i, o) => {
|
|
2668
|
-
const
|
|
2669
|
-
return
|
|
2801
|
+
const f = this._def.items[o] || this._def.rest;
|
|
2802
|
+
return f ? f._parse(new M(n, i, n.path, o)) : null;
|
|
2670
2803
|
}).filter((i) => !!i);
|
|
2671
2804
|
return n.common.async ? Promise.all(a).then((i) => O.mergeArray(r, i)) : O.mergeArray(r, a);
|
|
2672
2805
|
}
|
|
@@ -2674,16 +2807,16 @@ var init_shared_es = __esm({
|
|
|
2674
2807
|
return this._def.items;
|
|
2675
2808
|
}
|
|
2676
2809
|
rest(e) {
|
|
2677
|
-
return new
|
|
2810
|
+
return new _P({
|
|
2678
2811
|
...this._def,
|
|
2679
2812
|
rest: e
|
|
2680
2813
|
});
|
|
2681
2814
|
}
|
|
2682
2815
|
};
|
|
2683
|
-
|
|
2816
|
+
P.create = (t, e) => {
|
|
2684
2817
|
if (!Array.isArray(t))
|
|
2685
2818
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
2686
|
-
return new
|
|
2819
|
+
return new P({
|
|
2687
2820
|
items: t,
|
|
2688
2821
|
typeName: p.ZodTuple,
|
|
2689
2822
|
rest: null,
|
|
@@ -2699,10 +2832,10 @@ var init_shared_es = __esm({
|
|
|
2699
2832
|
}
|
|
2700
2833
|
_parse(e) {
|
|
2701
2834
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2702
|
-
if (n.parsedType !==
|
|
2703
|
-
return
|
|
2835
|
+
if (n.parsedType !== l.object)
|
|
2836
|
+
return u(n, {
|
|
2704
2837
|
code: c.invalid_type,
|
|
2705
|
-
expected:
|
|
2838
|
+
expected: l.object,
|
|
2706
2839
|
received: n.parsedType
|
|
2707
2840
|
}), _;
|
|
2708
2841
|
const s = [], a = this._def.keyType, i = this._def.valueType;
|
|
@@ -2731,7 +2864,7 @@ var init_shared_es = __esm({
|
|
|
2731
2864
|
});
|
|
2732
2865
|
}
|
|
2733
2866
|
};
|
|
2734
|
-
|
|
2867
|
+
Ue = class extends v {
|
|
2735
2868
|
get keySchema() {
|
|
2736
2869
|
return this._def.keyType;
|
|
2737
2870
|
}
|
|
@@ -2740,63 +2873,63 @@ var init_shared_es = __esm({
|
|
|
2740
2873
|
}
|
|
2741
2874
|
_parse(e) {
|
|
2742
2875
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2743
|
-
if (n.parsedType !==
|
|
2744
|
-
return
|
|
2876
|
+
if (n.parsedType !== l.map)
|
|
2877
|
+
return u(n, {
|
|
2745
2878
|
code: c.invalid_type,
|
|
2746
|
-
expected:
|
|
2879
|
+
expected: l.map,
|
|
2747
2880
|
received: n.parsedType
|
|
2748
2881
|
}), _;
|
|
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,
|
|
2882
|
+
const s = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([o, f], h) => ({
|
|
2883
|
+
key: s._parse(new M(n, o, n.path, [h, "key"])),
|
|
2884
|
+
value: a._parse(new M(n, f, n.path, [h, "value"]))
|
|
2752
2885
|
}));
|
|
2753
2886
|
if (n.common.async) {
|
|
2754
2887
|
const o = /* @__PURE__ */ new Map();
|
|
2755
2888
|
return Promise.resolve().then(async () => {
|
|
2756
|
-
for (const
|
|
2757
|
-
const
|
|
2758
|
-
if (
|
|
2889
|
+
for (const f of i) {
|
|
2890
|
+
const h = await f.key, T = await f.value;
|
|
2891
|
+
if (h.status === "aborted" || T.status === "aborted")
|
|
2759
2892
|
return _;
|
|
2760
|
-
(
|
|
2893
|
+
(h.status === "dirty" || T.status === "dirty") && r.dirty(), o.set(h.value, T.value);
|
|
2761
2894
|
}
|
|
2762
2895
|
return { status: r.value, value: o };
|
|
2763
2896
|
});
|
|
2764
2897
|
} else {
|
|
2765
2898
|
const o = /* @__PURE__ */ new Map();
|
|
2766
|
-
for (const
|
|
2767
|
-
const
|
|
2768
|
-
if (
|
|
2899
|
+
for (const f of i) {
|
|
2900
|
+
const h = f.key, T = f.value;
|
|
2901
|
+
if (h.status === "aborted" || T.status === "aborted")
|
|
2769
2902
|
return _;
|
|
2770
|
-
(
|
|
2903
|
+
(h.status === "dirty" || T.status === "dirty") && r.dirty(), o.set(h.value, T.value);
|
|
2771
2904
|
}
|
|
2772
2905
|
return { status: r.value, value: o };
|
|
2773
2906
|
}
|
|
2774
2907
|
}
|
|
2775
2908
|
};
|
|
2776
|
-
|
|
2909
|
+
Ue.create = (t, e, r) => new Ue({
|
|
2777
2910
|
valueType: e,
|
|
2778
2911
|
keyType: t,
|
|
2779
2912
|
typeName: p.ZodMap,
|
|
2780
2913
|
...g(r)
|
|
2781
2914
|
});
|
|
2782
|
-
|
|
2915
|
+
te = class _te extends v {
|
|
2783
2916
|
_parse(e) {
|
|
2784
2917
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
2785
|
-
if (n.parsedType !==
|
|
2786
|
-
return
|
|
2918
|
+
if (n.parsedType !== l.set)
|
|
2919
|
+
return u(n, {
|
|
2787
2920
|
code: c.invalid_type,
|
|
2788
|
-
expected:
|
|
2921
|
+
expected: l.set,
|
|
2789
2922
|
received: n.parsedType
|
|
2790
2923
|
}), _;
|
|
2791
2924
|
const s = this._def;
|
|
2792
|
-
s.minSize !== null && n.data.size < s.minSize.value && (
|
|
2925
|
+
s.minSize !== null && n.data.size < s.minSize.value && (u(n, {
|
|
2793
2926
|
code: c.too_small,
|
|
2794
2927
|
minimum: s.minSize.value,
|
|
2795
2928
|
type: "set",
|
|
2796
2929
|
inclusive: true,
|
|
2797
2930
|
exact: false,
|
|
2798
2931
|
message: s.minSize.message
|
|
2799
|
-
}), r.dirty()), s.maxSize !== null && n.data.size > s.maxSize.value && (
|
|
2932
|
+
}), r.dirty()), s.maxSize !== null && n.data.size > s.maxSize.value && (u(n, {
|
|
2800
2933
|
code: c.too_big,
|
|
2801
2934
|
maximum: s.maxSize.value,
|
|
2802
2935
|
type: "set",
|
|
@@ -2805,26 +2938,26 @@ var init_shared_es = __esm({
|
|
|
2805
2938
|
message: s.maxSize.message
|
|
2806
2939
|
}), r.dirty());
|
|
2807
2940
|
const a = this._def.valueType;
|
|
2808
|
-
function i(
|
|
2809
|
-
const
|
|
2810
|
-
for (const T of
|
|
2941
|
+
function i(f) {
|
|
2942
|
+
const h = /* @__PURE__ */ new Set();
|
|
2943
|
+
for (const T of f) {
|
|
2811
2944
|
if (T.status === "aborted")
|
|
2812
2945
|
return _;
|
|
2813
|
-
T.status === "dirty" && r.dirty(),
|
|
2946
|
+
T.status === "dirty" && r.dirty(), h.add(T.value);
|
|
2814
2947
|
}
|
|
2815
|
-
return { status: r.value, value:
|
|
2948
|
+
return { status: r.value, value: h };
|
|
2816
2949
|
}
|
|
2817
|
-
const o = [...n.data.values()].map((
|
|
2818
|
-
return n.common.async ? Promise.all(o).then((
|
|
2950
|
+
const o = [...n.data.values()].map((f, h) => a._parse(new M(n, f, n.path, h)));
|
|
2951
|
+
return n.common.async ? Promise.all(o).then((f) => i(f)) : i(o);
|
|
2819
2952
|
}
|
|
2820
2953
|
min(e, r) {
|
|
2821
|
-
return new
|
|
2954
|
+
return new _te({
|
|
2822
2955
|
...this._def,
|
|
2823
2956
|
minSize: { value: e, message: m.toString(r) }
|
|
2824
2957
|
});
|
|
2825
2958
|
}
|
|
2826
2959
|
max(e, r) {
|
|
2827
|
-
return new
|
|
2960
|
+
return new _te({
|
|
2828
2961
|
...this._def,
|
|
2829
2962
|
maxSize: { value: e, message: m.toString(r) }
|
|
2830
2963
|
});
|
|
@@ -2836,68 +2969,68 @@ var init_shared_es = __esm({
|
|
|
2836
2969
|
return this.min(1, e);
|
|
2837
2970
|
}
|
|
2838
2971
|
};
|
|
2839
|
-
|
|
2972
|
+
te.create = (t, e) => new te({
|
|
2840
2973
|
valueType: t,
|
|
2841
2974
|
minSize: null,
|
|
2842
2975
|
maxSize: null,
|
|
2843
2976
|
typeName: p.ZodSet,
|
|
2844
2977
|
...g(e)
|
|
2845
2978
|
});
|
|
2846
|
-
|
|
2979
|
+
H = class _H extends v {
|
|
2847
2980
|
constructor() {
|
|
2848
2981
|
super(...arguments), this.validate = this.implement;
|
|
2849
2982
|
}
|
|
2850
2983
|
_parse(e) {
|
|
2851
2984
|
const { ctx: r } = this._processInputParams(e);
|
|
2852
|
-
if (r.parsedType !==
|
|
2853
|
-
return
|
|
2985
|
+
if (r.parsedType !== l.function)
|
|
2986
|
+
return u(r, {
|
|
2854
2987
|
code: c.invalid_type,
|
|
2855
|
-
expected:
|
|
2988
|
+
expected: l.function,
|
|
2856
2989
|
received: r.parsedType
|
|
2857
2990
|
}), _;
|
|
2858
|
-
function n(o,
|
|
2859
|
-
return
|
|
2991
|
+
function n(o, f) {
|
|
2992
|
+
return pe({
|
|
2860
2993
|
data: o,
|
|
2861
2994
|
path: r.path,
|
|
2862
|
-
errorMaps: [r.common.contextualErrorMap, r.schemaErrorMap,
|
|
2995
|
+
errorMaps: [r.common.contextualErrorMap, r.schemaErrorMap, _e(), ee].filter((h) => !!h),
|
|
2863
2996
|
issueData: {
|
|
2864
2997
|
code: c.invalid_arguments,
|
|
2865
|
-
argumentsError:
|
|
2998
|
+
argumentsError: f
|
|
2866
2999
|
}
|
|
2867
3000
|
});
|
|
2868
3001
|
}
|
|
2869
|
-
function s(o,
|
|
2870
|
-
return
|
|
3002
|
+
function s(o, f) {
|
|
3003
|
+
return pe({
|
|
2871
3004
|
data: o,
|
|
2872
3005
|
path: r.path,
|
|
2873
|
-
errorMaps: [r.common.contextualErrorMap, r.schemaErrorMap,
|
|
3006
|
+
errorMaps: [r.common.contextualErrorMap, r.schemaErrorMap, _e(), ee].filter((h) => !!h),
|
|
2874
3007
|
issueData: {
|
|
2875
3008
|
code: c.invalid_return_type,
|
|
2876
|
-
returnTypeError:
|
|
3009
|
+
returnTypeError: f
|
|
2877
3010
|
}
|
|
2878
3011
|
});
|
|
2879
3012
|
}
|
|
2880
3013
|
const a = { errorMap: r.common.contextualErrorMap }, i = r.data;
|
|
2881
|
-
if (this._def.returns instanceof
|
|
3014
|
+
if (this._def.returns instanceof re) {
|
|
2882
3015
|
const o = this;
|
|
2883
|
-
return
|
|
2884
|
-
const
|
|
2885
|
-
throw
|
|
2886
|
-
}),
|
|
2887
|
-
return await o._def.returns._def.type.parseAsync(
|
|
2888
|
-
throw
|
|
3016
|
+
return A(async function(...f) {
|
|
3017
|
+
const h = new R([]), T = await o._def.args.parseAsync(f, a).catch((fe) => {
|
|
3018
|
+
throw h.addIssue(n(f, fe)), h;
|
|
3019
|
+
}), N = await Reflect.apply(i, this, T);
|
|
3020
|
+
return await o._def.returns._def.type.parseAsync(N, a).catch((fe) => {
|
|
3021
|
+
throw h.addIssue(s(N, fe)), h;
|
|
2889
3022
|
});
|
|
2890
3023
|
});
|
|
2891
3024
|
} else {
|
|
2892
3025
|
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
|
|
3026
|
+
return A(function(...f) {
|
|
3027
|
+
const h = o._def.args.safeParse(f, a);
|
|
3028
|
+
if (!h.success)
|
|
3029
|
+
throw new R([n(f, h.error)]);
|
|
3030
|
+
const T = Reflect.apply(i, this, h.data), N = o._def.returns.safeParse(T, a);
|
|
3031
|
+
if (!N.success)
|
|
3032
|
+
throw new R([s(T, N.error)]);
|
|
3033
|
+
return N.data;
|
|
2901
3034
|
});
|
|
2902
3035
|
}
|
|
2903
3036
|
}
|
|
@@ -2908,13 +3041,13 @@ var init_shared_es = __esm({
|
|
|
2908
3041
|
return this._def.returns;
|
|
2909
3042
|
}
|
|
2910
3043
|
args(...e) {
|
|
2911
|
-
return new
|
|
3044
|
+
return new _H({
|
|
2912
3045
|
...this._def,
|
|
2913
|
-
args:
|
|
3046
|
+
args: P.create(e).rest(Q.create())
|
|
2914
3047
|
});
|
|
2915
3048
|
}
|
|
2916
3049
|
returns(e) {
|
|
2917
|
-
return new
|
|
3050
|
+
return new _H({
|
|
2918
3051
|
...this._def,
|
|
2919
3052
|
returns: e
|
|
2920
3053
|
});
|
|
@@ -2926,15 +3059,15 @@ var init_shared_es = __esm({
|
|
|
2926
3059
|
return this.parse(e);
|
|
2927
3060
|
}
|
|
2928
3061
|
static create(e, r, n) {
|
|
2929
|
-
return new
|
|
2930
|
-
args: e ||
|
|
2931
|
-
returns: r ||
|
|
3062
|
+
return new _H({
|
|
3063
|
+
args: e || P.create([]).rest(Q.create()),
|
|
3064
|
+
returns: r || Q.create(),
|
|
2932
3065
|
typeName: p.ZodFunction,
|
|
2933
3066
|
...g(n)
|
|
2934
3067
|
});
|
|
2935
3068
|
}
|
|
2936
3069
|
};
|
|
2937
|
-
|
|
3070
|
+
Te = class extends v {
|
|
2938
3071
|
get schema() {
|
|
2939
3072
|
return this._def.getter();
|
|
2940
3073
|
}
|
|
@@ -2943,7 +3076,7 @@ var init_shared_es = __esm({
|
|
|
2943
3076
|
return this._def.getter()._parse({ data: r.data, path: r.path, parent: r });
|
|
2944
3077
|
}
|
|
2945
3078
|
};
|
|
2946
|
-
|
|
3079
|
+
Te.create = (t, e) => new Te({
|
|
2947
3080
|
getter: t,
|
|
2948
3081
|
typeName: p.ZodLazy,
|
|
2949
3082
|
...g(e)
|
|
@@ -2952,7 +3085,7 @@ var init_shared_es = __esm({
|
|
|
2952
3085
|
_parse(e) {
|
|
2953
3086
|
if (e.data !== this._def.value) {
|
|
2954
3087
|
const r = this._getOrReturnCtx(e);
|
|
2955
|
-
return
|
|
3088
|
+
return u(r, {
|
|
2956
3089
|
received: r.data,
|
|
2957
3090
|
code: c.invalid_literal,
|
|
2958
3091
|
expected: this._def.value
|
|
@@ -2969,25 +3102,25 @@ var init_shared_es = __esm({
|
|
|
2969
3102
|
typeName: p.ZodLiteral,
|
|
2970
3103
|
...g(e)
|
|
2971
3104
|
});
|
|
2972
|
-
|
|
3105
|
+
z = class _z extends v {
|
|
2973
3106
|
_parse(e) {
|
|
2974
3107
|
if (typeof e.data != "string") {
|
|
2975
3108
|
const r = this._getOrReturnCtx(e), n = this._def.values;
|
|
2976
|
-
return
|
|
2977
|
-
expected:
|
|
3109
|
+
return u(r, {
|
|
3110
|
+
expected: k.joinValues(n),
|
|
2978
3111
|
received: r.parsedType,
|
|
2979
3112
|
code: c.invalid_type
|
|
2980
3113
|
}), _;
|
|
2981
3114
|
}
|
|
2982
3115
|
if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
|
|
2983
3116
|
const r = this._getOrReturnCtx(e), n = this._def.values;
|
|
2984
|
-
return
|
|
3117
|
+
return u(r, {
|
|
2985
3118
|
received: r.data,
|
|
2986
3119
|
code: c.invalid_enum_value,
|
|
2987
3120
|
options: n
|
|
2988
3121
|
}), _;
|
|
2989
3122
|
}
|
|
2990
|
-
return
|
|
3123
|
+
return A(e.data);
|
|
2991
3124
|
}
|
|
2992
3125
|
get options() {
|
|
2993
3126
|
return this._def.values;
|
|
@@ -3011,74 +3144,74 @@ var init_shared_es = __esm({
|
|
|
3011
3144
|
return e;
|
|
3012
3145
|
}
|
|
3013
3146
|
extract(e, r = this._def) {
|
|
3014
|
-
return
|
|
3147
|
+
return _z.create(e, {
|
|
3015
3148
|
...this._def,
|
|
3016
3149
|
...r
|
|
3017
3150
|
});
|
|
3018
3151
|
}
|
|
3019
3152
|
exclude(e, r = this._def) {
|
|
3020
|
-
return
|
|
3153
|
+
return _z.create(this.options.filter((n) => !e.includes(n)), {
|
|
3021
3154
|
...this._def,
|
|
3022
3155
|
...r
|
|
3023
3156
|
});
|
|
3024
3157
|
}
|
|
3025
3158
|
};
|
|
3026
|
-
|
|
3027
|
-
|
|
3159
|
+
z.create = Fe;
|
|
3160
|
+
Ee = class extends v {
|
|
3028
3161
|
_parse(e) {
|
|
3029
|
-
const r =
|
|
3030
|
-
if (n.parsedType !==
|
|
3031
|
-
const s =
|
|
3032
|
-
return
|
|
3033
|
-
expected:
|
|
3162
|
+
const r = k.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
3163
|
+
if (n.parsedType !== l.string && n.parsedType !== l.number) {
|
|
3164
|
+
const s = k.objectValues(r);
|
|
3165
|
+
return u(n, {
|
|
3166
|
+
expected: k.joinValues(s),
|
|
3034
3167
|
received: n.parsedType,
|
|
3035
3168
|
code: c.invalid_type
|
|
3036
3169
|
}), _;
|
|
3037
3170
|
}
|
|
3038
|
-
if (this._cache || (this._cache = new Set(
|
|
3039
|
-
const s =
|
|
3040
|
-
return
|
|
3171
|
+
if (this._cache || (this._cache = new Set(k.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
|
|
3172
|
+
const s = k.objectValues(r);
|
|
3173
|
+
return u(n, {
|
|
3041
3174
|
received: n.data,
|
|
3042
3175
|
code: c.invalid_enum_value,
|
|
3043
3176
|
options: s
|
|
3044
3177
|
}), _;
|
|
3045
3178
|
}
|
|
3046
|
-
return
|
|
3179
|
+
return A(e.data);
|
|
3047
3180
|
}
|
|
3048
3181
|
get enum() {
|
|
3049
3182
|
return this._def.values;
|
|
3050
3183
|
}
|
|
3051
3184
|
};
|
|
3052
|
-
|
|
3185
|
+
Ee.create = (t, e) => new Ee({
|
|
3053
3186
|
values: t,
|
|
3054
3187
|
typeName: p.ZodNativeEnum,
|
|
3055
3188
|
...g(e)
|
|
3056
3189
|
});
|
|
3057
|
-
|
|
3190
|
+
re = class extends v {
|
|
3058
3191
|
unwrap() {
|
|
3059
3192
|
return this._def.type;
|
|
3060
3193
|
}
|
|
3061
3194
|
_parse(e) {
|
|
3062
3195
|
const { ctx: r } = this._processInputParams(e);
|
|
3063
|
-
if (r.parsedType !==
|
|
3064
|
-
return
|
|
3196
|
+
if (r.parsedType !== l.promise && r.common.async === false)
|
|
3197
|
+
return u(r, {
|
|
3065
3198
|
code: c.invalid_type,
|
|
3066
|
-
expected:
|
|
3199
|
+
expected: l.promise,
|
|
3067
3200
|
received: r.parsedType
|
|
3068
3201
|
}), _;
|
|
3069
|
-
const n = r.parsedType ===
|
|
3070
|
-
return
|
|
3202
|
+
const n = r.parsedType === l.promise ? r.data : Promise.resolve(r.data);
|
|
3203
|
+
return A(n.then((s) => this._def.type.parseAsync(s, {
|
|
3071
3204
|
path: r.path,
|
|
3072
3205
|
errorMap: r.common.contextualErrorMap
|
|
3073
3206
|
})));
|
|
3074
3207
|
}
|
|
3075
3208
|
};
|
|
3076
|
-
|
|
3209
|
+
re.create = (t, e) => new re({
|
|
3077
3210
|
type: t,
|
|
3078
3211
|
typeName: p.ZodPromise,
|
|
3079
3212
|
...g(e)
|
|
3080
3213
|
});
|
|
3081
|
-
|
|
3214
|
+
B = class extends v {
|
|
3082
3215
|
innerType() {
|
|
3083
3216
|
return this._def.schema;
|
|
3084
3217
|
}
|
|
@@ -3088,7 +3221,7 @@ var init_shared_es = __esm({
|
|
|
3088
3221
|
_parse(e) {
|
|
3089
3222
|
const { status: r, ctx: n } = this._processInputParams(e), s = this._def.effect || null, a = {
|
|
3090
3223
|
addIssue: (i) => {
|
|
3091
|
-
|
|
3224
|
+
u(n, i), i.fatal ? r.abort() : r.dirty();
|
|
3092
3225
|
},
|
|
3093
3226
|
get path() {
|
|
3094
3227
|
return n.path;
|
|
@@ -3100,12 +3233,12 @@ var init_shared_es = __esm({
|
|
|
3100
3233
|
return Promise.resolve(i).then(async (o) => {
|
|
3101
3234
|
if (r.value === "aborted")
|
|
3102
3235
|
return _;
|
|
3103
|
-
const
|
|
3236
|
+
const f = await this._def.schema._parseAsync({
|
|
3104
3237
|
data: o,
|
|
3105
3238
|
path: n.path,
|
|
3106
3239
|
parent: n
|
|
3107
3240
|
});
|
|
3108
|
-
return
|
|
3241
|
+
return f.status === "aborted" ? _ : f.status === "dirty" || r.value === "dirty" ? J(f.value) : f;
|
|
3109
3242
|
});
|
|
3110
3243
|
{
|
|
3111
3244
|
if (r.value === "aborted")
|
|
@@ -3115,15 +3248,15 @@ var init_shared_es = __esm({
|
|
|
3115
3248
|
path: n.path,
|
|
3116
3249
|
parent: n
|
|
3117
3250
|
});
|
|
3118
|
-
return o.status === "aborted" ? _ : o.status === "dirty" || r.value === "dirty" ?
|
|
3251
|
+
return o.status === "aborted" ? _ : o.status === "dirty" || r.value === "dirty" ? J(o.value) : o;
|
|
3119
3252
|
}
|
|
3120
3253
|
}
|
|
3121
3254
|
if (s.type === "refinement") {
|
|
3122
3255
|
const i = (o) => {
|
|
3123
|
-
const
|
|
3256
|
+
const f = s.refinement(o, a);
|
|
3124
3257
|
if (n.common.async)
|
|
3125
|
-
return Promise.resolve(
|
|
3126
|
-
if (
|
|
3258
|
+
return Promise.resolve(f);
|
|
3259
|
+
if (f instanceof Promise)
|
|
3127
3260
|
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3128
3261
|
return o;
|
|
3129
3262
|
};
|
|
@@ -3144,54 +3277,54 @@ var init_shared_es = __esm({
|
|
|
3144
3277
|
path: n.path,
|
|
3145
3278
|
parent: n
|
|
3146
3279
|
});
|
|
3147
|
-
if (!
|
|
3280
|
+
if (!X(i))
|
|
3148
3281
|
return _;
|
|
3149
3282
|
const o = s.transform(i.value, a);
|
|
3150
3283
|
if (o instanceof Promise)
|
|
3151
3284
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3152
3285
|
return { status: r.value, value: o };
|
|
3153
3286
|
} else
|
|
3154
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) =>
|
|
3287
|
+
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
3288
|
status: r.value,
|
|
3156
3289
|
value: o
|
|
3157
3290
|
})) : _);
|
|
3158
|
-
|
|
3291
|
+
k.assertNever(s);
|
|
3159
3292
|
}
|
|
3160
3293
|
};
|
|
3161
|
-
|
|
3294
|
+
B.create = (t, e, r) => new B({
|
|
3162
3295
|
schema: t,
|
|
3163
3296
|
typeName: p.ZodEffects,
|
|
3164
3297
|
effect: e,
|
|
3165
3298
|
...g(r)
|
|
3166
3299
|
});
|
|
3167
|
-
|
|
3300
|
+
B.createWithPreprocess = (t, e, r) => new B({
|
|
3168
3301
|
schema: e,
|
|
3169
3302
|
effect: { type: "preprocess", transform: t },
|
|
3170
3303
|
typeName: p.ZodEffects,
|
|
3171
3304
|
...g(r)
|
|
3172
3305
|
});
|
|
3173
|
-
|
|
3306
|
+
Z = class extends v {
|
|
3174
3307
|
_parse(e) {
|
|
3175
|
-
return this._getType(e) ===
|
|
3308
|
+
return this._getType(e) === l.undefined ? A(void 0) : this._def.innerType._parse(e);
|
|
3176
3309
|
}
|
|
3177
3310
|
unwrap() {
|
|
3178
3311
|
return this._def.innerType;
|
|
3179
3312
|
}
|
|
3180
3313
|
};
|
|
3181
|
-
|
|
3314
|
+
Z.create = (t, e) => new Z({
|
|
3182
3315
|
innerType: t,
|
|
3183
3316
|
typeName: p.ZodOptional,
|
|
3184
3317
|
...g(e)
|
|
3185
3318
|
});
|
|
3186
|
-
|
|
3319
|
+
q = class extends v {
|
|
3187
3320
|
_parse(e) {
|
|
3188
|
-
return this._getType(e) ===
|
|
3321
|
+
return this._getType(e) === l.null ? A(null) : this._def.innerType._parse(e);
|
|
3189
3322
|
}
|
|
3190
3323
|
unwrap() {
|
|
3191
3324
|
return this._def.innerType;
|
|
3192
3325
|
}
|
|
3193
3326
|
};
|
|
3194
|
-
|
|
3327
|
+
q.create = (t, e) => new q({
|
|
3195
3328
|
innerType: t,
|
|
3196
3329
|
typeName: p.ZodNullable,
|
|
3197
3330
|
...g(e)
|
|
@@ -3200,7 +3333,7 @@ var init_shared_es = __esm({
|
|
|
3200
3333
|
_parse(e) {
|
|
3201
3334
|
const { ctx: r } = this._processInputParams(e);
|
|
3202
3335
|
let n = r.data;
|
|
3203
|
-
return r.parsedType ===
|
|
3336
|
+
return r.parsedType === l.undefined && (n = this._def.defaultValue()), this._def.innerType._parse({
|
|
3204
3337
|
data: n,
|
|
3205
3338
|
path: r.path,
|
|
3206
3339
|
parent: r
|
|
@@ -3259,24 +3392,24 @@ var init_shared_es = __esm({
|
|
|
3259
3392
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
3260
3393
|
...g(e)
|
|
3261
3394
|
});
|
|
3262
|
-
|
|
3395
|
+
Ze = class extends v {
|
|
3263
3396
|
_parse(e) {
|
|
3264
|
-
if (this._getType(e) !==
|
|
3397
|
+
if (this._getType(e) !== l.nan) {
|
|
3265
3398
|
const n = this._getOrReturnCtx(e);
|
|
3266
|
-
return
|
|
3399
|
+
return u(n, {
|
|
3267
3400
|
code: c.invalid_type,
|
|
3268
|
-
expected:
|
|
3401
|
+
expected: l.nan,
|
|
3269
3402
|
received: n.parsedType
|
|
3270
3403
|
}), _;
|
|
3271
3404
|
}
|
|
3272
3405
|
return { status: "valid", value: e.data };
|
|
3273
3406
|
}
|
|
3274
3407
|
};
|
|
3275
|
-
|
|
3408
|
+
Ze.create = (t) => new Ze({
|
|
3276
3409
|
typeName: p.ZodNaN,
|
|
3277
3410
|
...g(t)
|
|
3278
3411
|
});
|
|
3279
|
-
|
|
3412
|
+
ze = class extends v {
|
|
3280
3413
|
_parse(e) {
|
|
3281
3414
|
const { ctx: r } = this._processInputParams(e), n = r.data;
|
|
3282
3415
|
return this._def.type._parse({
|
|
@@ -3289,7 +3422,7 @@ var init_shared_es = __esm({
|
|
|
3289
3422
|
return this._def.type;
|
|
3290
3423
|
}
|
|
3291
3424
|
};
|
|
3292
|
-
|
|
3425
|
+
be = class _be extends v {
|
|
3293
3426
|
_parse(e) {
|
|
3294
3427
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
3295
3428
|
if (n.common.async)
|
|
@@ -3299,7 +3432,7 @@ var init_shared_es = __esm({
|
|
|
3299
3432
|
path: n.path,
|
|
3300
3433
|
parent: n
|
|
3301
3434
|
});
|
|
3302
|
-
return a.status === "aborted" ? _ : a.status === "dirty" ? (r.dirty(),
|
|
3435
|
+
return a.status === "aborted" ? _ : a.status === "dirty" ? (r.dirty(), J(a.value)) : this._def.out._parseAsync({
|
|
3303
3436
|
data: a.value,
|
|
3304
3437
|
path: n.path,
|
|
3305
3438
|
parent: n
|
|
@@ -3322,7 +3455,7 @@ var init_shared_es = __esm({
|
|
|
3322
3455
|
}
|
|
3323
3456
|
}
|
|
3324
3457
|
static create(e, r) {
|
|
3325
|
-
return new
|
|
3458
|
+
return new _be({
|
|
3326
3459
|
in: e,
|
|
3327
3460
|
out: r,
|
|
3328
3461
|
typeName: p.ZodPipeline
|
|
@@ -3331,7 +3464,7 @@ var init_shared_es = __esm({
|
|
|
3331
3464
|
};
|
|
3332
3465
|
le = class extends v {
|
|
3333
3466
|
_parse(e) {
|
|
3334
|
-
const r = this._def.innerType._parse(e), n = (s) => (
|
|
3467
|
+
const r = this._def.innerType._parse(e), n = (s) => (X(s) && (s.value = Object.freeze(s.value)), s);
|
|
3335
3468
|
return ne(r) ? r.then((s) => n(s)) : n(r);
|
|
3336
3469
|
}
|
|
3337
3470
|
unwrap() {
|
|
@@ -3346,217 +3479,282 @@ var init_shared_es = __esm({
|
|
|
3346
3479
|
(function(t) {
|
|
3347
3480
|
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
3481
|
})(p || (p = {}));
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
I =
|
|
3354
|
-
|
|
3482
|
+
d = w.create;
|
|
3483
|
+
E = V.create;
|
|
3484
|
+
F.create;
|
|
3485
|
+
Oe = se.create;
|
|
3486
|
+
I = K.create;
|
|
3487
|
+
G = Q.create;
|
|
3355
3488
|
C.create;
|
|
3356
|
-
|
|
3489
|
+
S = D.create;
|
|
3357
3490
|
y = x.create;
|
|
3358
|
-
|
|
3359
|
-
|
|
3491
|
+
gt = ae.create;
|
|
3492
|
+
Be = xe.create;
|
|
3360
3493
|
ie.create;
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3494
|
+
P.create;
|
|
3495
|
+
$ = oe.create;
|
|
3496
|
+
Pe = H.create;
|
|
3364
3497
|
b = ce.create;
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3498
|
+
L = z.create;
|
|
3499
|
+
vt = re.create;
|
|
3500
|
+
Z.create;
|
|
3501
|
+
q.create;
|
|
3502
|
+
he = {
|
|
3370
3503
|
string: (t) => w.create({ ...t, coerce: true }),
|
|
3371
|
-
number: (t) =>
|
|
3504
|
+
number: (t) => V.create({ ...t, coerce: true }),
|
|
3372
3505
|
boolean: (t) => se.create({
|
|
3373
3506
|
...t,
|
|
3374
3507
|
coerce: true
|
|
3375
3508
|
}),
|
|
3376
|
-
bigint: (t) =>
|
|
3377
|
-
date: (t) =>
|
|
3509
|
+
bigint: (t) => F.create({ ...t, coerce: true }),
|
|
3510
|
+
date: (t) => K.create({ ...t, coerce: true })
|
|
3378
3511
|
};
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
id:
|
|
3382
|
-
organizationId:
|
|
3383
|
-
name:
|
|
3384
|
-
keyHash:
|
|
3385
|
-
keyPrefix:
|
|
3386
|
-
keySuffix:
|
|
3387
|
-
isActive:
|
|
3512
|
+
je = 100;
|
|
3513
|
+
Zt = y({
|
|
3514
|
+
id: d().uuid(),
|
|
3515
|
+
organizationId: d().uuid(),
|
|
3516
|
+
name: d(),
|
|
3517
|
+
keyHash: d(),
|
|
3518
|
+
keyPrefix: d(),
|
|
3519
|
+
keySuffix: d(),
|
|
3520
|
+
isActive: Oe(),
|
|
3388
3521
|
lastUsedAt: I().nullable(),
|
|
3389
3522
|
createdAt: I(),
|
|
3390
3523
|
updatedAt: I()
|
|
3391
3524
|
});
|
|
3392
|
-
|
|
3393
|
-
id:
|
|
3394
|
-
apiKeyId:
|
|
3395
|
-
organizationId:
|
|
3396
|
-
tokensUsed:
|
|
3397
|
-
model:
|
|
3398
|
-
statusCode:
|
|
3525
|
+
Pt = y({
|
|
3526
|
+
id: d().uuid(),
|
|
3527
|
+
apiKeyId: d().uuid(),
|
|
3528
|
+
organizationId: d().uuid(),
|
|
3529
|
+
tokensUsed: E().int().positive(),
|
|
3530
|
+
model: d(),
|
|
3531
|
+
statusCode: E().int(),
|
|
3399
3532
|
createdAt: I()
|
|
3400
3533
|
});
|
|
3401
|
-
|
|
3402
|
-
name:
|
|
3403
|
-
|
|
3404
|
-
`API key name must be less than ${
|
|
3534
|
+
jt = y({
|
|
3535
|
+
name: d().min(1, "API key name is required").max(
|
|
3536
|
+
je,
|
|
3537
|
+
`API key name must be less than ${je} characters`
|
|
3405
3538
|
)
|
|
3406
3539
|
});
|
|
3407
|
-
|
|
3408
|
-
id:
|
|
3409
|
-
name:
|
|
3410
|
-
keyPrefix:
|
|
3411
|
-
keySuffix:
|
|
3540
|
+
Ct = y({
|
|
3541
|
+
id: d().uuid(),
|
|
3542
|
+
name: d(),
|
|
3543
|
+
keyPrefix: d(),
|
|
3544
|
+
keySuffix: d(),
|
|
3412
3545
|
lastUsedAt: I().nullable(),
|
|
3413
3546
|
createdAt: I(),
|
|
3414
|
-
currentMonthUsage:
|
|
3547
|
+
currentMonthUsage: E().int().nonnegative(),
|
|
3415
3548
|
// Full key is only returned once at creation
|
|
3416
|
-
key:
|
|
3549
|
+
key: d().optional()
|
|
3417
3550
|
});
|
|
3418
|
-
|
|
3419
|
-
totalTokens:
|
|
3420
|
-
totalRequests:
|
|
3421
|
-
successfulRequests:
|
|
3422
|
-
failedRequests:
|
|
3551
|
+
$t = y({
|
|
3552
|
+
totalTokens: E().int(),
|
|
3553
|
+
totalRequests: E().int(),
|
|
3554
|
+
successfulRequests: E().int(),
|
|
3555
|
+
failedRequests: E().int()
|
|
3423
3556
|
});
|
|
3424
|
-
|
|
3425
|
-
error:
|
|
3557
|
+
Tt = y({
|
|
3558
|
+
error: d().describe("The error message")
|
|
3426
3559
|
});
|
|
3427
3560
|
y({
|
|
3428
|
-
error:
|
|
3561
|
+
error: d().describe("The error message")
|
|
3429
3562
|
});
|
|
3430
|
-
|
|
3431
|
-
errors:
|
|
3432
|
-
message:
|
|
3563
|
+
Ce = y({
|
|
3564
|
+
errors: $(S(d())).describe("Field validation errors"),
|
|
3565
|
+
message: d().optional().describe("General error message")
|
|
3433
3566
|
});
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3567
|
+
gt([
|
|
3568
|
+
Tt,
|
|
3569
|
+
Ce,
|
|
3437
3570
|
y({
|
|
3438
3571
|
response: y({
|
|
3439
|
-
clone:
|
|
3572
|
+
clone: Pe().returns(
|
|
3440
3573
|
y({
|
|
3441
|
-
json:
|
|
3574
|
+
json: Pe().returns(vt(Ce))
|
|
3442
3575
|
})
|
|
3443
3576
|
)
|
|
3444
3577
|
})
|
|
3445
3578
|
})
|
|
3446
3579
|
]);
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3580
|
+
Ae = L([
|
|
3581
|
+
"agent_quality",
|
|
3582
|
+
"tool_issues",
|
|
3583
|
+
"ui_ux",
|
|
3584
|
+
"feature_request",
|
|
3585
|
+
"other"
|
|
3586
|
+
]);
|
|
3587
|
+
Vt = {
|
|
3588
|
+
agent_quality: {
|
|
3589
|
+
label: "Agent quality",
|
|
3590
|
+
description: "Wrong answers, loops, hallucinations"
|
|
3591
|
+
},
|
|
3592
|
+
tool_issues: {
|
|
3593
|
+
label: "Tool issues",
|
|
3594
|
+
description: "File edits failed, commands didn't work"
|
|
3595
|
+
},
|
|
3596
|
+
ui_ux: {
|
|
3597
|
+
label: "UI/UX problem",
|
|
3598
|
+
description: "Display glitches, input issues"
|
|
3599
|
+
},
|
|
3600
|
+
feature_request: {
|
|
3601
|
+
label: "Feature request",
|
|
3602
|
+
description: "Something you'd like to see"
|
|
3603
|
+
},
|
|
3604
|
+
other: {
|
|
3605
|
+
label: "Other",
|
|
3606
|
+
description: "Anything else"
|
|
3607
|
+
}
|
|
3608
|
+
};
|
|
3609
|
+
Ft = y({
|
|
3610
|
+
category: Ae,
|
|
3611
|
+
description: d().min(1, "Description is required").max(5e3),
|
|
3612
|
+
sessionId: d().uuid().optional(),
|
|
3613
|
+
queryId: d().uuid().optional(),
|
|
3614
|
+
model: d().optional(),
|
|
3615
|
+
cliVersion: d().optional(),
|
|
3616
|
+
metadata: $(G()).optional()
|
|
3617
|
+
});
|
|
3618
|
+
Et = y({
|
|
3619
|
+
id: d().uuid(),
|
|
3620
|
+
userId: d(),
|
|
3621
|
+
orgId: d().nullable(),
|
|
3622
|
+
sessionId: d().uuid().nullable(),
|
|
3623
|
+
queryId: d().uuid().nullable(),
|
|
3624
|
+
category: Ae,
|
|
3625
|
+
description: d(),
|
|
3626
|
+
model: d().nullable(),
|
|
3627
|
+
cliVersion: d().nullable(),
|
|
3628
|
+
metadata: $(G()).nullable(),
|
|
3629
|
+
createdAt: d()
|
|
3630
|
+
});
|
|
3631
|
+
zt = y({
|
|
3632
|
+
category: Ae.optional(),
|
|
3633
|
+
startDate: d().optional(),
|
|
3634
|
+
endDate: d().optional(),
|
|
3635
|
+
search: d().optional(),
|
|
3636
|
+
limit: he.number().min(1).max(100).default(20),
|
|
3637
|
+
offset: he.number().min(0).default(0)
|
|
3638
|
+
});
|
|
3639
|
+
Bt = y({
|
|
3640
|
+
items: S(Et),
|
|
3641
|
+
total: E(),
|
|
3642
|
+
limit: E(),
|
|
3643
|
+
offset: E()
|
|
3644
|
+
});
|
|
3645
|
+
kt = 100;
|
|
3646
|
+
qt = y({
|
|
3647
|
+
id: d().uuid(),
|
|
3648
|
+
orgId: d(),
|
|
3649
|
+
timezone: d().nullable(),
|
|
3650
|
+
monthlyTokenLimit: E().int().positive(),
|
|
3453
3651
|
createdAt: I(),
|
|
3454
3652
|
updatedAt: I()
|
|
3455
3653
|
});
|
|
3456
|
-
|
|
3457
|
-
timezone:
|
|
3458
|
-
monthlyTokenLimit:
|
|
3654
|
+
xt = y({
|
|
3655
|
+
timezone: d().max(kt, "Timezone must be less than 100 characters").nullable().optional(),
|
|
3656
|
+
monthlyTokenLimit: E().int().positive().optional()
|
|
3459
3657
|
});
|
|
3460
|
-
|
|
3658
|
+
bt = y({
|
|
3461
3659
|
type: b("text"),
|
|
3462
|
-
text:
|
|
3660
|
+
text: d()
|
|
3463
3661
|
});
|
|
3464
|
-
|
|
3662
|
+
Ot = y({
|
|
3465
3663
|
type: b("tool_use"),
|
|
3466
|
-
id:
|
|
3467
|
-
name:
|
|
3468
|
-
input:
|
|
3664
|
+
id: d(),
|
|
3665
|
+
name: d(),
|
|
3666
|
+
input: $(G())
|
|
3469
3667
|
});
|
|
3470
|
-
|
|
3668
|
+
At = y({
|
|
3471
3669
|
type: b("tool_result"),
|
|
3472
|
-
tool_use_id:
|
|
3473
|
-
content:
|
|
3474
|
-
is_error:
|
|
3670
|
+
tool_use_id: d(),
|
|
3671
|
+
content: d(),
|
|
3672
|
+
is_error: Oe().optional()
|
|
3475
3673
|
});
|
|
3476
|
-
|
|
3674
|
+
Nt = y({
|
|
3477
3675
|
type: b("thinking"),
|
|
3478
|
-
thinking:
|
|
3676
|
+
thinking: d()
|
|
3479
3677
|
});
|
|
3480
|
-
|
|
3678
|
+
Rt = y({
|
|
3481
3679
|
type: b("image"),
|
|
3482
3680
|
source: y({
|
|
3483
3681
|
type: b("base64"),
|
|
3484
|
-
media_type:
|
|
3485
|
-
data:
|
|
3682
|
+
media_type: d(),
|
|
3683
|
+
data: d()
|
|
3486
3684
|
})
|
|
3487
3685
|
});
|
|
3488
|
-
W =
|
|
3489
|
-
Et,
|
|
3490
|
-
kt,
|
|
3491
|
-
xt,
|
|
3686
|
+
W = Be("type", [
|
|
3492
3687
|
bt,
|
|
3493
|
-
Ot
|
|
3688
|
+
Ot,
|
|
3689
|
+
At,
|
|
3690
|
+
Nt,
|
|
3691
|
+
Rt
|
|
3494
3692
|
]);
|
|
3495
|
-
|
|
3496
|
-
id:
|
|
3497
|
-
orgId:
|
|
3498
|
-
userId:
|
|
3499
|
-
title:
|
|
3500
|
-
origin:
|
|
3501
|
-
originMetadata:
|
|
3502
|
-
authMethod:
|
|
3503
|
-
authId:
|
|
3693
|
+
Gt = y({
|
|
3694
|
+
id: d().uuid(),
|
|
3695
|
+
orgId: d(),
|
|
3696
|
+
userId: d().uuid(),
|
|
3697
|
+
title: d().nullable(),
|
|
3698
|
+
origin: L(["cli", "web", "github"]).default("web"),
|
|
3699
|
+
originMetadata: $(G()).nullable().optional(),
|
|
3700
|
+
authMethod: L(["clerk", "cli-token", "api-key"]).default("clerk"),
|
|
3701
|
+
authId: d().nullable().optional(),
|
|
3504
3702
|
// Claude Agent SDK session ID for resuming conversations
|
|
3505
3703
|
// Sessions expire after ~30 days due to Anthropic's data retention policy
|
|
3506
|
-
providerSessionId:
|
|
3704
|
+
providerSessionId: d().nullable().optional(),
|
|
3507
3705
|
createdAt: I(),
|
|
3508
3706
|
updatedAt: I()
|
|
3509
3707
|
});
|
|
3510
|
-
|
|
3511
|
-
title:
|
|
3512
|
-
origin:
|
|
3513
|
-
originMetadata:
|
|
3708
|
+
Yt = y({
|
|
3709
|
+
title: d().optional(),
|
|
3710
|
+
origin: L(["cli", "web", "github"]).optional(),
|
|
3711
|
+
originMetadata: $(G()).optional()
|
|
3514
3712
|
});
|
|
3515
|
-
|
|
3516
|
-
title:
|
|
3517
|
-
providerSessionId:
|
|
3713
|
+
Qt = y({
|
|
3714
|
+
title: d().optional(),
|
|
3715
|
+
providerSessionId: d().optional()
|
|
3518
3716
|
});
|
|
3519
|
-
|
|
3520
|
-
id:
|
|
3521
|
-
conversationId:
|
|
3522
|
-
role:
|
|
3523
|
-
content:
|
|
3717
|
+
Xt = y({
|
|
3718
|
+
id: d().uuid(),
|
|
3719
|
+
conversationId: d().uuid(),
|
|
3720
|
+
role: L(["user", "assistant"]),
|
|
3721
|
+
content: S(W),
|
|
3524
3722
|
createdAt: I()
|
|
3525
3723
|
});
|
|
3526
|
-
|
|
3527
|
-
role:
|
|
3528
|
-
content:
|
|
3724
|
+
Kt = y({
|
|
3725
|
+
role: L(["user", "assistant"]),
|
|
3726
|
+
content: S(W)
|
|
3529
3727
|
});
|
|
3530
|
-
|
|
3728
|
+
Jt = Be("type", [
|
|
3531
3729
|
y({
|
|
3532
3730
|
type: b("user_message"),
|
|
3533
|
-
content:
|
|
3731
|
+
content: S(W)
|
|
3534
3732
|
}),
|
|
3535
3733
|
y({
|
|
3536
3734
|
type: b("assistant_text"),
|
|
3537
|
-
delta:
|
|
3735
|
+
delta: d()
|
|
3538
3736
|
}),
|
|
3539
3737
|
y({
|
|
3540
3738
|
type: b("assistant_thinking"),
|
|
3541
|
-
delta:
|
|
3739
|
+
delta: d()
|
|
3542
3740
|
}),
|
|
3543
3741
|
y({
|
|
3544
3742
|
type: b("tool_use"),
|
|
3545
|
-
id:
|
|
3546
|
-
name:
|
|
3547
|
-
input:
|
|
3743
|
+
id: d(),
|
|
3744
|
+
name: d(),
|
|
3745
|
+
input: $(G())
|
|
3548
3746
|
}),
|
|
3549
3747
|
y({
|
|
3550
3748
|
type: b("tool_result"),
|
|
3551
|
-
tool_use_id:
|
|
3552
|
-
content:
|
|
3553
|
-
is_error:
|
|
3749
|
+
tool_use_id: d(),
|
|
3750
|
+
content: d(),
|
|
3751
|
+
is_error: Oe().optional()
|
|
3554
3752
|
}),
|
|
3555
3753
|
y({
|
|
3556
3754
|
type: b("message_complete"),
|
|
3557
3755
|
message: y({
|
|
3558
|
-
role:
|
|
3559
|
-
content:
|
|
3756
|
+
role: L(["user", "assistant"]),
|
|
3757
|
+
content: S(W)
|
|
3560
3758
|
})
|
|
3561
3759
|
}),
|
|
3562
3760
|
y({
|
|
@@ -3564,82 +3762,82 @@ var init_shared_es = __esm({
|
|
|
3564
3762
|
}),
|
|
3565
3763
|
y({
|
|
3566
3764
|
type: b("session_error"),
|
|
3567
|
-
error:
|
|
3765
|
+
error: d()
|
|
3568
3766
|
}),
|
|
3569
3767
|
y({
|
|
3570
3768
|
type: b("query_start"),
|
|
3571
|
-
prompt:
|
|
3769
|
+
prompt: d()
|
|
3572
3770
|
}),
|
|
3573
3771
|
y({
|
|
3574
3772
|
type: b("query_complete"),
|
|
3575
3773
|
usage: y({
|
|
3576
|
-
model:
|
|
3577
|
-
numTurns:
|
|
3578
|
-
durationMs:
|
|
3579
|
-
inputTokens:
|
|
3580
|
-
outputTokens:
|
|
3581
|
-
cacheReadTokens:
|
|
3582
|
-
cacheCreationTokens:
|
|
3583
|
-
costUsd:
|
|
3774
|
+
model: d(),
|
|
3775
|
+
numTurns: E(),
|
|
3776
|
+
durationMs: E(),
|
|
3777
|
+
inputTokens: E(),
|
|
3778
|
+
outputTokens: E(),
|
|
3779
|
+
cacheReadTokens: E(),
|
|
3780
|
+
cacheCreationTokens: E(),
|
|
3781
|
+
costUsd: E()
|
|
3584
3782
|
}),
|
|
3585
3783
|
result: y({
|
|
3586
|
-
status:
|
|
3587
|
-
summary:
|
|
3588
|
-
error:
|
|
3784
|
+
status: L(["success", "error", "interrupted"]),
|
|
3785
|
+
summary: d(),
|
|
3786
|
+
error: d().optional()
|
|
3589
3787
|
})
|
|
3590
3788
|
})
|
|
3591
3789
|
]);
|
|
3592
|
-
|
|
3593
|
-
title:
|
|
3594
|
-
originMetadata:
|
|
3790
|
+
Ht = y({
|
|
3791
|
+
title: d(),
|
|
3792
|
+
originMetadata: $(G()).optional()
|
|
3595
3793
|
});
|
|
3596
|
-
|
|
3597
|
-
summary:
|
|
3598
|
-
status:
|
|
3794
|
+
It = y({
|
|
3795
|
+
summary: d(),
|
|
3796
|
+
status: L([
|
|
3599
3797
|
"success",
|
|
3600
3798
|
"error_max_turns",
|
|
3601
3799
|
"error_during_execution",
|
|
3602
3800
|
"interrupted"
|
|
3603
3801
|
]),
|
|
3604
|
-
error:
|
|
3802
|
+
error: d().optional()
|
|
3605
3803
|
});
|
|
3606
|
-
|
|
3607
|
-
assistant:
|
|
3608
|
-
toolResults:
|
|
3804
|
+
wt = y({
|
|
3805
|
+
assistant: S(W),
|
|
3806
|
+
toolResults: S(W).optional()
|
|
3609
3807
|
});
|
|
3610
|
-
|
|
3611
|
-
userMessage:
|
|
3612
|
-
turns:
|
|
3613
|
-
result:
|
|
3808
|
+
Dt = y({
|
|
3809
|
+
userMessage: S(W),
|
|
3810
|
+
turns: S(wt),
|
|
3811
|
+
result: It
|
|
3614
3812
|
});
|
|
3615
|
-
|
|
3616
|
-
model:
|
|
3617
|
-
numTurns:
|
|
3618
|
-
durationMs:
|
|
3619
|
-
inputTokens:
|
|
3620
|
-
outputTokens:
|
|
3621
|
-
cacheReadTokens:
|
|
3622
|
-
cacheCreationTokens:
|
|
3623
|
-
costUsd:
|
|
3813
|
+
er = y({
|
|
3814
|
+
model: d(),
|
|
3815
|
+
numTurns: E(),
|
|
3816
|
+
durationMs: E(),
|
|
3817
|
+
inputTokens: E(),
|
|
3818
|
+
outputTokens: E(),
|
|
3819
|
+
cacheReadTokens: E(),
|
|
3820
|
+
cacheCreationTokens: E(),
|
|
3821
|
+
costUsd: E()
|
|
3624
3822
|
});
|
|
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:
|
|
3823
|
+
tr = y({
|
|
3824
|
+
id: d().uuid(),
|
|
3825
|
+
sessionId: d().uuid(),
|
|
3826
|
+
sequence: E(),
|
|
3827
|
+
prompt: d(),
|
|
3828
|
+
content: Dt,
|
|
3829
|
+
model: d(),
|
|
3830
|
+
numTurns: E(),
|
|
3831
|
+
durationMs: E().nullable(),
|
|
3832
|
+
inputTokens: E(),
|
|
3833
|
+
outputTokens: E(),
|
|
3834
|
+
cacheReadTokens: E(),
|
|
3835
|
+
cacheCreationTokens: E(),
|
|
3836
|
+
costUsd: E(),
|
|
3837
|
+
status: L(["running", "success", "error", "interrupted"]),
|
|
3838
|
+
errorMessage: d().nullable(),
|
|
3839
|
+
startedAt: he.date(),
|
|
3840
|
+
completedAt: he.date().nullable()
|
|
3643
3841
|
});
|
|
3644
3842
|
}
|
|
3645
3843
|
});
|
|
@@ -4659,6 +4857,30 @@ var init_api_client = __esm({
|
|
|
4659
4857
|
logger.debug(`Fetched context for session: ${sessionId}`, data);
|
|
4660
4858
|
return data;
|
|
4661
4859
|
}
|
|
4860
|
+
/**
|
|
4861
|
+
* Submit feedback about the agent or tools
|
|
4862
|
+
* @param feedback - The feedback to submit
|
|
4863
|
+
* @returns The created feedback ID
|
|
4864
|
+
*/
|
|
4865
|
+
async submitFeedback(feedback) {
|
|
4866
|
+
const url = `${this.apiUrl}/v1/feedback`;
|
|
4867
|
+
logger.debug("Submitting feedback", { category: feedback.category });
|
|
4868
|
+
const response = await fetch(url, {
|
|
4869
|
+
method: "POST",
|
|
4870
|
+
headers: {
|
|
4871
|
+
"Content-Type": "application/json",
|
|
4872
|
+
Authorization: `Bearer ${this.apiKey}`
|
|
4873
|
+
},
|
|
4874
|
+
body: JSON.stringify(feedback)
|
|
4875
|
+
});
|
|
4876
|
+
if (!response.ok) {
|
|
4877
|
+
const errorText = await response.text();
|
|
4878
|
+
throw new ApiError(response.status, response.statusText, errorText);
|
|
4879
|
+
}
|
|
4880
|
+
const data = await response.json();
|
|
4881
|
+
logger.debug("Feedback submitted successfully", { id: data.id });
|
|
4882
|
+
return data;
|
|
4883
|
+
}
|
|
4662
4884
|
};
|
|
4663
4885
|
}
|
|
4664
4886
|
});
|
|
@@ -4668,7 +4890,7 @@ var CLI_VERSION;
|
|
|
4668
4890
|
var init_version = __esm({
|
|
4669
4891
|
"src/version.ts"() {
|
|
4670
4892
|
"use strict";
|
|
4671
|
-
CLI_VERSION = "0.0.
|
|
4893
|
+
CLI_VERSION = "0.0.17";
|
|
4672
4894
|
}
|
|
4673
4895
|
});
|
|
4674
4896
|
|
|
@@ -4944,7 +5166,7 @@ var init_react = __esm({
|
|
|
4944
5166
|
const message = {
|
|
4945
5167
|
type: "tool",
|
|
4946
5168
|
content: getToolDescription(tool, input),
|
|
4947
|
-
toolName:
|
|
5169
|
+
toolName: or(tool),
|
|
4948
5170
|
toolInput: input,
|
|
4949
5171
|
toolResult: void 0,
|
|
4950
5172
|
isExpanded: false,
|
|
@@ -6335,20 +6557,116 @@ var init_AuthDialog = __esm({
|
|
|
6335
6557
|
}
|
|
6336
6558
|
});
|
|
6337
6559
|
|
|
6338
|
-
// src/ui/components/
|
|
6560
|
+
// src/ui/components/FeedbackDialog.tsx
|
|
6339
6561
|
import { Box as Box3, Text as Text3, useInput } from "ink";
|
|
6340
|
-
import React4 from "react";
|
|
6341
|
-
var
|
|
6342
|
-
var
|
|
6343
|
-
"src/ui/components/
|
|
6562
|
+
import React4, { useState as useState2 } from "react";
|
|
6563
|
+
var CATEGORY_ORDER, FeedbackDialog;
|
|
6564
|
+
var init_FeedbackDialog = __esm({
|
|
6565
|
+
"src/ui/components/FeedbackDialog.tsx"() {
|
|
6344
6566
|
"use strict";
|
|
6567
|
+
init_shared_es();
|
|
6345
6568
|
init_theme();
|
|
6346
|
-
|
|
6569
|
+
CATEGORY_ORDER = [
|
|
6570
|
+
"agent_quality",
|
|
6571
|
+
"tool_issues",
|
|
6572
|
+
"ui_ux",
|
|
6573
|
+
"feature_request",
|
|
6574
|
+
"other"
|
|
6575
|
+
];
|
|
6576
|
+
FeedbackDialog = ({
|
|
6577
|
+
onSubmit,
|
|
6578
|
+
onCancel
|
|
6579
|
+
}) => {
|
|
6580
|
+
const [selectedCategory, setSelectedCategory] = useState2("agent_quality");
|
|
6581
|
+
const [description, setDescription] = useState2("");
|
|
6582
|
+
const [focus, setFocus] = useState2("category");
|
|
6583
|
+
const [cursorPosition, setCursorPosition] = useState2(0);
|
|
6347
6584
|
useInput((input, key) => {
|
|
6348
|
-
if (key.escape
|
|
6349
|
-
|
|
6585
|
+
if (key.escape) {
|
|
6586
|
+
onCancel();
|
|
6587
|
+
return;
|
|
6588
|
+
}
|
|
6589
|
+
if (focus === "category") {
|
|
6590
|
+
if (key.upArrow) {
|
|
6591
|
+
const currentIndex = CATEGORY_ORDER.indexOf(selectedCategory);
|
|
6592
|
+
const newIndex = currentIndex > 0 ? currentIndex - 1 : CATEGORY_ORDER.length - 1;
|
|
6593
|
+
setSelectedCategory(CATEGORY_ORDER[newIndex]);
|
|
6594
|
+
return;
|
|
6595
|
+
}
|
|
6596
|
+
if (key.downArrow) {
|
|
6597
|
+
const currentIndex = CATEGORY_ORDER.indexOf(selectedCategory);
|
|
6598
|
+
const newIndex = currentIndex < CATEGORY_ORDER.length - 1 ? currentIndex + 1 : 0;
|
|
6599
|
+
setSelectedCategory(CATEGORY_ORDER[newIndex]);
|
|
6600
|
+
return;
|
|
6601
|
+
}
|
|
6602
|
+
if (key.tab && !key.shift) {
|
|
6603
|
+
setFocus("description");
|
|
6604
|
+
return;
|
|
6605
|
+
}
|
|
6606
|
+
if (key.return && !key.shift) {
|
|
6607
|
+
if (description.trim()) {
|
|
6608
|
+
onSubmit(selectedCategory, description.trim());
|
|
6609
|
+
} else {
|
|
6610
|
+
setFocus("description");
|
|
6611
|
+
}
|
|
6612
|
+
return;
|
|
6613
|
+
}
|
|
6614
|
+
}
|
|
6615
|
+
if (focus === "description") {
|
|
6616
|
+
if (key.tab && key.shift) {
|
|
6617
|
+
setFocus("category");
|
|
6618
|
+
return;
|
|
6619
|
+
}
|
|
6620
|
+
if (key.return && !key.shift) {
|
|
6621
|
+
if (description.trim()) {
|
|
6622
|
+
onSubmit(selectedCategory, description.trim());
|
|
6623
|
+
}
|
|
6624
|
+
return;
|
|
6625
|
+
}
|
|
6626
|
+
if (key.return && key.shift) {
|
|
6627
|
+
const newDesc = description.slice(0, cursorPosition) + "\n" + description.slice(cursorPosition);
|
|
6628
|
+
setDescription(newDesc);
|
|
6629
|
+
setCursorPosition(cursorPosition + 1);
|
|
6630
|
+
return;
|
|
6631
|
+
}
|
|
6632
|
+
if (key.backspace || key.delete) {
|
|
6633
|
+
if (cursorPosition > 0) {
|
|
6634
|
+
const newDesc = description.slice(0, cursorPosition - 1) + description.slice(cursorPosition);
|
|
6635
|
+
setDescription(newDesc);
|
|
6636
|
+
setCursorPosition(cursorPosition - 1);
|
|
6637
|
+
}
|
|
6638
|
+
return;
|
|
6639
|
+
}
|
|
6640
|
+
if (key.leftArrow) {
|
|
6641
|
+
setCursorPosition(Math.max(0, cursorPosition - 1));
|
|
6642
|
+
return;
|
|
6643
|
+
}
|
|
6644
|
+
if (key.rightArrow) {
|
|
6645
|
+
setCursorPosition(Math.min(description.length, cursorPosition + 1));
|
|
6646
|
+
return;
|
|
6647
|
+
}
|
|
6648
|
+
if (input && !key.ctrl && !key.meta) {
|
|
6649
|
+
const newDesc = description.slice(0, cursorPosition) + input + description.slice(cursorPosition);
|
|
6650
|
+
setDescription(newDesc);
|
|
6651
|
+
setCursorPosition(cursorPosition + input.length);
|
|
6652
|
+
}
|
|
6350
6653
|
}
|
|
6351
6654
|
});
|
|
6655
|
+
const renderDescription = () => {
|
|
6656
|
+
if (!description && focus !== "description") {
|
|
6657
|
+
return /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.dim, italic: true }, "Enter your feedback...");
|
|
6658
|
+
}
|
|
6659
|
+
if (focus === "description") {
|
|
6660
|
+
const before = description.slice(0, cursorPosition);
|
|
6661
|
+
const charAtCursor = description[cursorPosition] || " ";
|
|
6662
|
+
const after = description.slice(cursorPosition + 1);
|
|
6663
|
+
if (!description) {
|
|
6664
|
+
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..."));
|
|
6665
|
+
}
|
|
6666
|
+
return /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.primary }, before, /* @__PURE__ */ React4.createElement(Text3, { inverse: true }, charAtCursor), after);
|
|
6667
|
+
}
|
|
6668
|
+
return /* @__PURE__ */ React4.createElement(Text3, { color: theme.text.primary }, description);
|
|
6669
|
+
};
|
|
6352
6670
|
return /* @__PURE__ */ React4.createElement(
|
|
6353
6671
|
Box3,
|
|
6354
6672
|
{
|
|
@@ -6358,27 +6676,79 @@ var init_HelpMenu = __esm({
|
|
|
6358
6676
|
paddingX: 2,
|
|
6359
6677
|
paddingY: 1
|
|
6360
6678
|
},
|
|
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"))),
|
|
6679
|
+
/* @__PURE__ */ React4.createElement(Text3, { bold: true, color: theme.text.accent }, "Report Issue"),
|
|
6365
6680
|
/* @__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 },
|
|
6681
|
+
/* @__PURE__ */ React4.createElement(Text3, { bold: true, color: theme.text.secondary }, "Category:"),
|
|
6682
|
+
/* @__PURE__ */ React4.createElement(Box3, { flexDirection: "column", marginLeft: 2, marginTop: 0 }, CATEGORY_ORDER.map((category) => {
|
|
6683
|
+
const isSelected = selectedCategory === category;
|
|
6684
|
+
const info = Vt[category];
|
|
6685
|
+
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));
|
|
6686
|
+
})),
|
|
6368
6687
|
/* @__PURE__ */ React4.createElement(Box3, { marginTop: 1 }),
|
|
6369
|
-
/* @__PURE__ */ React4.createElement(Text3, { bold: true, color: theme.text.secondary }, "
|
|
6370
|
-
/* @__PURE__ */ React4.createElement(
|
|
6688
|
+
/* @__PURE__ */ React4.createElement(Text3, { bold: true, color: theme.text.secondary }, "Description:"),
|
|
6689
|
+
/* @__PURE__ */ React4.createElement(
|
|
6690
|
+
Box3,
|
|
6691
|
+
{
|
|
6692
|
+
borderColor: focus === "description" ? theme.border.accent : theme.border.default,
|
|
6693
|
+
borderStyle: "round",
|
|
6694
|
+
flexDirection: "column",
|
|
6695
|
+
marginTop: 0,
|
|
6696
|
+
minHeight: 3,
|
|
6697
|
+
paddingX: 1
|
|
6698
|
+
},
|
|
6699
|
+
renderDescription()
|
|
6700
|
+
),
|
|
6371
6701
|
/* @__PURE__ */ React4.createElement(Box3, { marginTop: 1 }),
|
|
6372
|
-
/* @__PURE__ */ React4.createElement(Text3, { bold: true,
|
|
6373
|
-
|
|
6374
|
-
|
|
6702
|
+
/* @__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")
|
|
6703
|
+
);
|
|
6704
|
+
};
|
|
6705
|
+
}
|
|
6706
|
+
});
|
|
6707
|
+
|
|
6708
|
+
// src/ui/components/HelpMenu.tsx
|
|
6709
|
+
import { Box as Box4, Text as Text4, useInput as useInput2 } from "ink";
|
|
6710
|
+
import React5 from "react";
|
|
6711
|
+
var HelpMenu;
|
|
6712
|
+
var init_HelpMenu = __esm({
|
|
6713
|
+
"src/ui/components/HelpMenu.tsx"() {
|
|
6714
|
+
"use strict";
|
|
6715
|
+
init_theme();
|
|
6716
|
+
HelpMenu = ({ isAuthenticated, onClose }) => {
|
|
6717
|
+
useInput2((input, key) => {
|
|
6718
|
+
if (key.escape || input === "q" || input === "?" || key.ctrl && input === "h") {
|
|
6719
|
+
onClose();
|
|
6720
|
+
}
|
|
6721
|
+
});
|
|
6722
|
+
return /* @__PURE__ */ React5.createElement(
|
|
6723
|
+
Box4,
|
|
6724
|
+
{
|
|
6725
|
+
borderColor: theme.border.accent,
|
|
6726
|
+
borderStyle: "round",
|
|
6727
|
+
flexDirection: "column",
|
|
6728
|
+
paddingX: 2,
|
|
6729
|
+
paddingY: 1
|
|
6730
|
+
},
|
|
6731
|
+
/* @__PURE__ */ React5.createElement(Text4, { bold: true, color: theme.text.accent }, "\u{1F4D6} Supatest AI CLI - Help"),
|
|
6732
|
+
/* @__PURE__ */ React5.createElement(Box4, { marginTop: 1 }),
|
|
6733
|
+
/* @__PURE__ */ React5.createElement(Text4, { bold: true, color: theme.text.secondary }, "Slash Commands:"),
|
|
6734
|
+
/* @__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"))),
|
|
6735
|
+
/* @__PURE__ */ React5.createElement(Box4, { marginTop: 1 }),
|
|
6736
|
+
/* @__PURE__ */ React5.createElement(Text4, { bold: true, color: theme.text.secondary }, "Keyboard Shortcuts:"),
|
|
6737
|
+
/* @__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"))),
|
|
6738
|
+
/* @__PURE__ */ React5.createElement(Box4, { marginTop: 1 }),
|
|
6739
|
+
/* @__PURE__ */ React5.createElement(Text4, { bold: true, color: theme.text.secondary }, "File References:"),
|
|
6740
|
+
/* @__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"')),
|
|
6741
|
+
/* @__PURE__ */ React5.createElement(Box4, { marginTop: 1 }),
|
|
6742
|
+
/* @__PURE__ */ React5.createElement(Text4, { bold: true, color: theme.text.secondary }, "Tips:"),
|
|
6743
|
+
/* @__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")),
|
|
6744
|
+
/* @__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
6745
|
);
|
|
6376
6746
|
};
|
|
6377
6747
|
}
|
|
6378
6748
|
});
|
|
6379
6749
|
|
|
6380
6750
|
// src/ui/contexts/SessionContext.tsx
|
|
6381
|
-
import
|
|
6751
|
+
import React6, { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useState as useState3 } from "react";
|
|
6382
6752
|
var SessionContext, SessionProvider, useSession;
|
|
6383
6753
|
var init_SessionContext = __esm({
|
|
6384
6754
|
"src/ui/contexts/SessionContext.tsx"() {
|
|
@@ -6389,24 +6759,24 @@ var init_SessionContext = __esm({
|
|
|
6389
6759
|
children,
|
|
6390
6760
|
initialModel
|
|
6391
6761
|
}) => {
|
|
6392
|
-
const [messages, setMessages] =
|
|
6393
|
-
const [todos, setTodos] =
|
|
6394
|
-
const [stats, setStats] =
|
|
6762
|
+
const [messages, setMessages] = useState3([]);
|
|
6763
|
+
const [todos, setTodos] = useState3([]);
|
|
6764
|
+
const [stats, setStats] = useState3({
|
|
6395
6765
|
filesModified: /* @__PURE__ */ new Set(),
|
|
6396
6766
|
commandsRun: [],
|
|
6397
6767
|
iterations: 0,
|
|
6398
6768
|
startTime: Date.now()
|
|
6399
6769
|
});
|
|
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] =
|
|
6770
|
+
const [isAgentRunning, setIsAgentRunning] = useState3(false);
|
|
6771
|
+
const [shouldInterruptAgent, setShouldInterruptAgent] = useState3(false);
|
|
6772
|
+
const [usageStats, setUsageStats] = useState3(null);
|
|
6773
|
+
const [sessionId, setSessionId] = useState3();
|
|
6774
|
+
const [webUrl, setWebUrl] = useState3();
|
|
6775
|
+
const [agentMode, setAgentMode] = useState3("build");
|
|
6776
|
+
const [planFilePath, setPlanFilePath] = useState3();
|
|
6777
|
+
const [selectedModel, setSelectedModel] = useState3(initialModel || Mt);
|
|
6778
|
+
const [allToolsExpanded, setAllToolsExpanded] = useState3(true);
|
|
6779
|
+
const [staticRemountKey, setStaticRemountKey] = useState3(0);
|
|
6410
6780
|
const addMessage = useCallback2(
|
|
6411
6781
|
(message) => {
|
|
6412
6782
|
const expandableTools = ["Bash", "BashOutput", "Command Output"];
|
|
@@ -6517,7 +6887,7 @@ var init_SessionContext = __esm({
|
|
|
6517
6887
|
setSelectedModel,
|
|
6518
6888
|
staticRemountKey
|
|
6519
6889
|
};
|
|
6520
|
-
return /* @__PURE__ */
|
|
6890
|
+
return /* @__PURE__ */ React6.createElement(SessionContext.Provider, { value }, children);
|
|
6521
6891
|
};
|
|
6522
6892
|
useSession = () => {
|
|
6523
6893
|
const context = useContext2(SessionContext);
|
|
@@ -6612,17 +6982,17 @@ var init_file_completion = __esm({
|
|
|
6612
6982
|
});
|
|
6613
6983
|
|
|
6614
6984
|
// src/ui/components/ModelSelector.tsx
|
|
6615
|
-
import { Box as
|
|
6616
|
-
import
|
|
6985
|
+
import { Box as Box5, Text as Text5, useInput as useInput3 } from "ink";
|
|
6986
|
+
import React7, { useState as useState4 } from "react";
|
|
6617
6987
|
function getNextModel(currentModel) {
|
|
6618
|
-
const currentIndex =
|
|
6619
|
-
const nextIndex = (currentIndex + 1) %
|
|
6620
|
-
return
|
|
6988
|
+
const currentIndex = ke.findIndex((m2) => m2.id === currentModel);
|
|
6989
|
+
const nextIndex = (currentIndex + 1) % ke.length;
|
|
6990
|
+
return ke[nextIndex].id;
|
|
6621
6991
|
}
|
|
6622
6992
|
function getPreviousModel(currentModel) {
|
|
6623
|
-
const currentIndex =
|
|
6624
|
-
const prevIndex = (currentIndex - 1 +
|
|
6625
|
-
return
|
|
6993
|
+
const currentIndex = ke.findIndex((m2) => m2.id === currentModel);
|
|
6994
|
+
const prevIndex = (currentIndex - 1 + ke.length) % ke.length;
|
|
6995
|
+
return ke[prevIndex].id;
|
|
6626
6996
|
}
|
|
6627
6997
|
var ModelSelector;
|
|
6628
6998
|
var init_ModelSelector = __esm({
|
|
@@ -6635,25 +7005,25 @@ var init_ModelSelector = __esm({
|
|
|
6635
7005
|
onSelect,
|
|
6636
7006
|
onCancel
|
|
6637
7007
|
}) => {
|
|
6638
|
-
const currentIndex =
|
|
6639
|
-
const [selectedIndex, setSelectedIndex] =
|
|
6640
|
-
|
|
7008
|
+
const currentIndex = ke.findIndex((m2) => m2.id === currentModel);
|
|
7009
|
+
const [selectedIndex, setSelectedIndex] = useState4(currentIndex >= 0 ? currentIndex : 0);
|
|
7010
|
+
useInput3((input, key) => {
|
|
6641
7011
|
if (key.upArrow) {
|
|
6642
|
-
setSelectedIndex((prev) => prev > 0 ? prev - 1 :
|
|
7012
|
+
setSelectedIndex((prev) => prev > 0 ? prev - 1 : ke.length - 1);
|
|
6643
7013
|
} else if (key.downArrow) {
|
|
6644
|
-
setSelectedIndex((prev) => prev <
|
|
7014
|
+
setSelectedIndex((prev) => prev < ke.length - 1 ? prev + 1 : 0);
|
|
6645
7015
|
} else if (key.return) {
|
|
6646
|
-
onSelect(
|
|
7016
|
+
onSelect(ke[selectedIndex].id);
|
|
6647
7017
|
} else if (key.escape || input === "q") {
|
|
6648
7018
|
onCancel();
|
|
6649
7019
|
}
|
|
6650
7020
|
});
|
|
6651
|
-
return /* @__PURE__ */
|
|
7021
|
+
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
7022
|
const isSelected = index === selectedIndex;
|
|
6653
7023
|
const isCurrent = model.id === currentModel;
|
|
6654
7024
|
const indicator = isSelected ? "\u25B6 " : " ";
|
|
6655
|
-
return /* @__PURE__ */
|
|
6656
|
-
|
|
7025
|
+
return /* @__PURE__ */ React7.createElement(Box5, { gap: 1, key: model.id }, /* @__PURE__ */ React7.createElement(
|
|
7026
|
+
Text5,
|
|
6657
7027
|
{
|
|
6658
7028
|
backgroundColor: isSelected ? theme.text.accent : void 0,
|
|
6659
7029
|
bold: isSelected,
|
|
@@ -6661,15 +7031,15 @@ var init_ModelSelector = __esm({
|
|
|
6661
7031
|
},
|
|
6662
7032
|
indicator,
|
|
6663
7033
|
model.name.padEnd(12)
|
|
6664
|
-
), /* @__PURE__ */
|
|
6665
|
-
|
|
7034
|
+
), /* @__PURE__ */ React7.createElement(
|
|
7035
|
+
Text5,
|
|
6666
7036
|
{
|
|
6667
7037
|
backgroundColor: isSelected ? theme.text.accent : void 0,
|
|
6668
7038
|
color: isSelected ? "black" : theme.text.dim
|
|
6669
7039
|
},
|
|
6670
7040
|
model.description
|
|
6671
|
-
), isCurrent && /* @__PURE__ */
|
|
6672
|
-
})), /* @__PURE__ */
|
|
7041
|
+
), isCurrent && /* @__PURE__ */ React7.createElement(Text5, { color: theme.text.success }, " (current)"));
|
|
7042
|
+
})), /* @__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
7043
|
};
|
|
6674
7044
|
}
|
|
6675
7045
|
});
|
|
@@ -6677,8 +7047,8 @@ var init_ModelSelector = __esm({
|
|
|
6677
7047
|
// src/ui/components/InputPrompt.tsx
|
|
6678
7048
|
import path4 from "path";
|
|
6679
7049
|
import chalk5 from "chalk";
|
|
6680
|
-
import { Box as
|
|
6681
|
-
import
|
|
7050
|
+
import { Box as Box6, Text as Text6 } from "ink";
|
|
7051
|
+
import React8, { forwardRef, useEffect as useEffect4, useImperativeHandle, useState as useState5 } from "react";
|
|
6682
7052
|
var InputPrompt;
|
|
6683
7053
|
var init_InputPrompt = __esm({
|
|
6684
7054
|
"src/ui/components/InputPrompt.tsx"() {
|
|
@@ -6699,24 +7069,25 @@ var init_InputPrompt = __esm({
|
|
|
6699
7069
|
onInputChange
|
|
6700
7070
|
}, ref) => {
|
|
6701
7071
|
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] =
|
|
7072
|
+
const [value, setValue] = useState5("");
|
|
7073
|
+
const [cursorOffset, setCursorOffset] = useState5(0);
|
|
7074
|
+
const [allFiles, setAllFiles] = useState5([]);
|
|
7075
|
+
const [suggestions, setSuggestions] = useState5([]);
|
|
7076
|
+
const [activeSuggestion, setActiveSuggestion] = useState5(0);
|
|
7077
|
+
const [showSuggestions, setShowSuggestions] = useState5(false);
|
|
7078
|
+
const [mentionStartIndex, setMentionStartIndex] = useState5(-1);
|
|
6709
7079
|
const SLASH_COMMANDS = [
|
|
6710
7080
|
{ name: "/help", desc: "Show help" },
|
|
6711
7081
|
{ name: "/resume", desc: "Resume session" },
|
|
6712
7082
|
{ name: "/clear", desc: "Clear history" },
|
|
6713
7083
|
{ name: "/model", desc: "Change model" },
|
|
7084
|
+
{ name: "/feedback", desc: "Report an issue" },
|
|
6714
7085
|
{ name: "/setup", desc: "Install Playwright browsers" },
|
|
6715
7086
|
{ name: "/login", desc: "Authenticate with Supatest" },
|
|
6716
7087
|
{ name: "/logout", desc: "Log out" },
|
|
6717
7088
|
{ name: "/exit", desc: "Exit CLI" }
|
|
6718
7089
|
];
|
|
6719
|
-
const [isSlashCommand, setIsSlashCommand] =
|
|
7090
|
+
const [isSlashCommand, setIsSlashCommand] = useState5(false);
|
|
6720
7091
|
useImperativeHandle(ref, () => ({
|
|
6721
7092
|
clear: () => {
|
|
6722
7093
|
setValue("");
|
|
@@ -6760,7 +7131,7 @@ var init_InputPrompt = __esm({
|
|
|
6760
7131
|
if (isValidStart) {
|
|
6761
7132
|
const query2 = textBeforeCursor.slice(lastAt + 1);
|
|
6762
7133
|
if (!/\s/.test(query2)) {
|
|
6763
|
-
const matches = allFiles.filter((
|
|
7134
|
+
const matches = allFiles.filter((f) => f.toLowerCase().includes(query2.toLowerCase())).slice(0, 5);
|
|
6764
7135
|
if (matches.length > 0) {
|
|
6765
7136
|
setSuggestions(matches);
|
|
6766
7137
|
setShowSuggestions(true);
|
|
@@ -6906,8 +7277,8 @@ var init_InputPrompt = __esm({
|
|
|
6906
7277
|
}
|
|
6907
7278
|
charCount += lineLength + 1;
|
|
6908
7279
|
}
|
|
6909
|
-
return /* @__PURE__ */
|
|
6910
|
-
|
|
7280
|
+
return /* @__PURE__ */ React8.createElement(Box6, { flexDirection: "column", width: "100%" }, showSuggestions && /* @__PURE__ */ React8.createElement(
|
|
7281
|
+
Box6,
|
|
6911
7282
|
{
|
|
6912
7283
|
borderColor: theme.border.default,
|
|
6913
7284
|
borderStyle: "round",
|
|
@@ -6915,9 +7286,9 @@ var init_InputPrompt = __esm({
|
|
|
6915
7286
|
marginBottom: 0,
|
|
6916
7287
|
paddingX: 1
|
|
6917
7288
|
},
|
|
6918
|
-
suggestions.map((file, idx) => /* @__PURE__ */
|
|
6919
|
-
), /* @__PURE__ */
|
|
6920
|
-
|
|
7289
|
+
suggestions.map((file, idx) => /* @__PURE__ */ React8.createElement(Text6, { color: idx === activeSuggestion ? theme.text.accent : theme.text.dim, key: file }, idx === activeSuggestion ? "\u276F " : " ", " ", file))
|
|
7290
|
+
), /* @__PURE__ */ React8.createElement(
|
|
7291
|
+
Box6,
|
|
6921
7292
|
{
|
|
6922
7293
|
borderColor: disabled ? theme.border.default : theme.border.accent,
|
|
6923
7294
|
borderStyle: "round",
|
|
@@ -6927,25 +7298,25 @@ var init_InputPrompt = __esm({
|
|
|
6927
7298
|
paddingX: 1,
|
|
6928
7299
|
width: "100%"
|
|
6929
7300
|
},
|
|
6930
|
-
/* @__PURE__ */
|
|
7301
|
+
/* @__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
7302
|
if (idx === cursorLine && !disabled) {
|
|
6932
7303
|
const before = line.slice(0, cursorCol);
|
|
6933
7304
|
const charAtCursor = line[cursorCol] || " ";
|
|
6934
7305
|
const after = line.slice(cursorCol + 1);
|
|
6935
|
-
return /* @__PURE__ */
|
|
7306
|
+
return /* @__PURE__ */ React8.createElement(Text6, { color: theme.text.primary, key: idx }, before, chalk5.inverse(charAtCursor), after);
|
|
6936
7307
|
}
|
|
6937
|
-
return /* @__PURE__ */
|
|
6938
|
-
})), !hasContent && disabled && /* @__PURE__ */
|
|
6939
|
-
), /* @__PURE__ */
|
|
7308
|
+
return /* @__PURE__ */ React8.createElement(Text6, { color: theme.text.primary, key: idx }, line);
|
|
7309
|
+
})), !hasContent && disabled && /* @__PURE__ */ React8.createElement(Text6, { color: theme.text.dim, italic: true }, "Waiting for agent to complete...")))
|
|
7310
|
+
), /* @__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
7311
|
});
|
|
6941
7312
|
InputPrompt.displayName = "InputPrompt";
|
|
6942
7313
|
}
|
|
6943
7314
|
});
|
|
6944
7315
|
|
|
6945
7316
|
// src/ui/components/Header.tsx
|
|
6946
|
-
import { Box as
|
|
7317
|
+
import { Box as Box7, Text as Text7 } from "ink";
|
|
6947
7318
|
import Gradient from "ink-gradient";
|
|
6948
|
-
import
|
|
7319
|
+
import React9 from "react";
|
|
6949
7320
|
var Header;
|
|
6950
7321
|
var init_Header = __esm({
|
|
6951
7322
|
"src/ui/components/Header.tsx"() {
|
|
@@ -6965,8 +7336,8 @@ var init_Header = __esm({
|
|
|
6965
7336
|
infoParts.push(locationStr);
|
|
6966
7337
|
}
|
|
6967
7338
|
const infoLine = infoParts.join(" \u2022 ");
|
|
6968
|
-
return /* @__PURE__ */
|
|
6969
|
-
|
|
7339
|
+
return /* @__PURE__ */ React9.createElement(
|
|
7340
|
+
Box7,
|
|
6970
7341
|
{
|
|
6971
7342
|
alignItems: "center",
|
|
6972
7343
|
flexDirection: "column",
|
|
@@ -6974,9 +7345,9 @@ var init_Header = __esm({
|
|
|
6974
7345
|
marginTop: 5,
|
|
6975
7346
|
width: "100%"
|
|
6976
7347
|
},
|
|
6977
|
-
/* @__PURE__ */
|
|
6978
|
-
/* @__PURE__ */
|
|
6979
|
-
/* @__PURE__ */
|
|
7348
|
+
/* @__PURE__ */ React9.createElement(Gradient, { colors: ["#C96868", "#FF8C94"] }, /* @__PURE__ */ React9.createElement(Text7, null, banner)),
|
|
7349
|
+
/* @__PURE__ */ React9.createElement(Box7, { justifyContent: "center", marginTop: 0 }, /* @__PURE__ */ React9.createElement(Text7, { color: theme.text.dim }, infoLine)),
|
|
7350
|
+
/* @__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
7351
|
);
|
|
6981
7352
|
};
|
|
6982
7353
|
}
|
|
@@ -6984,9 +7355,9 @@ var init_Header = __esm({
|
|
|
6984
7355
|
|
|
6985
7356
|
// src/ui/utils/markdown.tsx
|
|
6986
7357
|
import chalk6 from "chalk";
|
|
6987
|
-
import { Box as
|
|
7358
|
+
import { Box as Box8, Text as Text8 } from "ink";
|
|
6988
7359
|
import { all, createLowlight } from "lowlight";
|
|
6989
|
-
import
|
|
7360
|
+
import React10, { useMemo as useMemo2 } from "react";
|
|
6990
7361
|
function parseMarkdownSections(text) {
|
|
6991
7362
|
const sections = [];
|
|
6992
7363
|
const lines = text.split(/\r?\n/);
|
|
@@ -7144,16 +7515,15 @@ var init_markdown = __esm({
|
|
|
7144
7515
|
lowlight = createLowlight(all);
|
|
7145
7516
|
MarkdownDisplay = ({
|
|
7146
7517
|
text,
|
|
7147
|
-
isPending = false
|
|
7148
|
-
terminalWidth = 80
|
|
7518
|
+
isPending = false
|
|
7149
7519
|
}) => {
|
|
7150
7520
|
const sections = useMemo2(() => parseMarkdownSections(text), [text]);
|
|
7151
7521
|
const elements = sections.map((section, index) => {
|
|
7152
7522
|
if (section.type === "table" && section.tableRows) {
|
|
7153
|
-
return /* @__PURE__ */
|
|
7523
|
+
return /* @__PURE__ */ React10.createElement(Table, { key: `table-${index}`, rows: section.tableRows });
|
|
7154
7524
|
}
|
|
7155
7525
|
if (section.type === "code") {
|
|
7156
|
-
return /* @__PURE__ */
|
|
7526
|
+
return /* @__PURE__ */ React10.createElement(
|
|
7157
7527
|
CodeBlock,
|
|
7158
7528
|
{
|
|
7159
7529
|
code: section.content,
|
|
@@ -7162,7 +7532,7 @@ var init_markdown = __esm({
|
|
|
7162
7532
|
}
|
|
7163
7533
|
);
|
|
7164
7534
|
}
|
|
7165
|
-
return /* @__PURE__ */
|
|
7535
|
+
return /* @__PURE__ */ React10.createElement(
|
|
7166
7536
|
TextSection,
|
|
7167
7537
|
{
|
|
7168
7538
|
content: section.content,
|
|
@@ -7172,10 +7542,10 @@ var init_markdown = __esm({
|
|
|
7172
7542
|
});
|
|
7173
7543
|
if (isPending) {
|
|
7174
7544
|
elements.push(
|
|
7175
|
-
/* @__PURE__ */
|
|
7545
|
+
/* @__PURE__ */ React10.createElement(Text8, { color: theme.text.accent, key: "cursor" }, "\u258A")
|
|
7176
7546
|
);
|
|
7177
7547
|
}
|
|
7178
|
-
return /* @__PURE__ */
|
|
7548
|
+
return /* @__PURE__ */ React10.createElement(Box8, { flexDirection: "column" }, elements);
|
|
7179
7549
|
};
|
|
7180
7550
|
TextSection = ({ content }) => {
|
|
7181
7551
|
const lines = content.split(/\r?\n/);
|
|
@@ -7188,7 +7558,7 @@ var init_markdown = __esm({
|
|
|
7188
7558
|
const level = headerMatch[1].length;
|
|
7189
7559
|
const content2 = headerMatch[2];
|
|
7190
7560
|
elements.push(
|
|
7191
|
-
/* @__PURE__ */
|
|
7561
|
+
/* @__PURE__ */ React10.createElement(Header2, { content: content2, key: `header-${lineIndex}`, level })
|
|
7192
7562
|
);
|
|
7193
7563
|
continue;
|
|
7194
7564
|
}
|
|
@@ -7198,7 +7568,7 @@ var init_markdown = __esm({
|
|
|
7198
7568
|
const marker = listMatch[2];
|
|
7199
7569
|
const content2 = listMatch[3];
|
|
7200
7570
|
elements.push(
|
|
7201
|
-
/* @__PURE__ */
|
|
7571
|
+
/* @__PURE__ */ React10.createElement(
|
|
7202
7572
|
ListItem,
|
|
7203
7573
|
{
|
|
7204
7574
|
content: content2,
|
|
@@ -7211,18 +7581,16 @@ var init_markdown = __esm({
|
|
|
7211
7581
|
continue;
|
|
7212
7582
|
}
|
|
7213
7583
|
if (line.match(/^-{3,}$/)) {
|
|
7214
|
-
elements.push(/* @__PURE__ */
|
|
7584
|
+
elements.push(/* @__PURE__ */ React10.createElement(HorizontalRule, { key: `hr-${lineIndex}` }));
|
|
7215
7585
|
continue;
|
|
7216
7586
|
}
|
|
7217
7587
|
if (line.trim()) {
|
|
7218
7588
|
elements.push(
|
|
7219
|
-
/* @__PURE__ */
|
|
7589
|
+
/* @__PURE__ */ React10.createElement(Paragraph, { content: line, key: `para-${lineIndex}` })
|
|
7220
7590
|
);
|
|
7221
|
-
} else {
|
|
7222
|
-
elements.push(/* @__PURE__ */ React9.createElement(Text7, { key: `empty-${lineIndex}` }, "\n"));
|
|
7223
7591
|
}
|
|
7224
7592
|
}
|
|
7225
|
-
return /* @__PURE__ */
|
|
7593
|
+
return /* @__PURE__ */ React10.createElement(Box8, { flexDirection: "column" }, elements);
|
|
7226
7594
|
};
|
|
7227
7595
|
Header2 = ({
|
|
7228
7596
|
level,
|
|
@@ -7244,19 +7612,19 @@ var init_markdown = __esm({
|
|
|
7244
7612
|
];
|
|
7245
7613
|
const color = colors[level - 1] || theme.text.primary;
|
|
7246
7614
|
const bold = level <= 2;
|
|
7247
|
-
return /* @__PURE__ */
|
|
7615
|
+
return /* @__PURE__ */ React10.createElement(Text8, { bold, color }, content);
|
|
7248
7616
|
};
|
|
7249
7617
|
ListItem = ({ indent, marker, content }) => {
|
|
7250
7618
|
const formattedContent = formatInline(content);
|
|
7251
7619
|
const indentStr = " ".repeat(indent);
|
|
7252
|
-
return /* @__PURE__ */
|
|
7620
|
+
return /* @__PURE__ */ React10.createElement(Text8, null, indentStr, /* @__PURE__ */ React10.createElement(Text8, { color: theme.text.accent }, marker), " ", formattedContent);
|
|
7253
7621
|
};
|
|
7254
7622
|
HorizontalRule = () => {
|
|
7255
|
-
return /* @__PURE__ */
|
|
7623
|
+
return /* @__PURE__ */ React10.createElement(Text8, { color: theme.border.default }, "\u2500".repeat(60));
|
|
7256
7624
|
};
|
|
7257
7625
|
Paragraph = ({ content }) => {
|
|
7258
7626
|
const formattedContent = formatInline(content);
|
|
7259
|
-
return /* @__PURE__ */
|
|
7627
|
+
return /* @__PURE__ */ React10.createElement(Text8, null, formattedContent);
|
|
7260
7628
|
};
|
|
7261
7629
|
Table = ({ rows }) => {
|
|
7262
7630
|
if (rows.length === 0) {
|
|
@@ -7304,7 +7672,7 @@ var init_markdown = __esm({
|
|
|
7304
7672
|
tableLines.push(cells.join(" \u2502 "));
|
|
7305
7673
|
}
|
|
7306
7674
|
}
|
|
7307
|
-
return /* @__PURE__ */
|
|
7675
|
+
return /* @__PURE__ */ React10.createElement(Text8, null, tableLines.join("\n"));
|
|
7308
7676
|
};
|
|
7309
7677
|
CodeBlock = ({
|
|
7310
7678
|
code,
|
|
@@ -7322,8 +7690,8 @@ var init_markdown = __esm({
|
|
|
7322
7690
|
highlighted = code;
|
|
7323
7691
|
}
|
|
7324
7692
|
}
|
|
7325
|
-
return /* @__PURE__ */
|
|
7326
|
-
|
|
7693
|
+
return /* @__PURE__ */ React10.createElement(
|
|
7694
|
+
Box8,
|
|
7327
7695
|
{
|
|
7328
7696
|
borderColor: theme.border.default,
|
|
7329
7697
|
borderStyle: "round",
|
|
@@ -7331,17 +7699,17 @@ var init_markdown = __esm({
|
|
|
7331
7699
|
marginY: 0,
|
|
7332
7700
|
paddingX: 1
|
|
7333
7701
|
},
|
|
7334
|
-
language && /* @__PURE__ */
|
|
7335
|
-
/* @__PURE__ */
|
|
7702
|
+
language && /* @__PURE__ */ React10.createElement(Text8, { color: theme.text.dim }, language, "\n"),
|
|
7703
|
+
/* @__PURE__ */ React10.createElement(Text8, null, highlighted)
|
|
7336
7704
|
);
|
|
7337
7705
|
};
|
|
7338
7706
|
}
|
|
7339
7707
|
});
|
|
7340
7708
|
|
|
7341
7709
|
// src/ui/components/messages/AssistantMessage.tsx
|
|
7342
|
-
import { Box as
|
|
7710
|
+
import { Box as Box9, Text as Text9 } from "ink";
|
|
7343
7711
|
import Spinner from "ink-spinner";
|
|
7344
|
-
import
|
|
7712
|
+
import React11 from "react";
|
|
7345
7713
|
var AssistantMessage;
|
|
7346
7714
|
var init_AssistantMessage = __esm({
|
|
7347
7715
|
"src/ui/components/messages/AssistantMessage.tsx"() {
|
|
@@ -7353,9 +7721,9 @@ var init_AssistantMessage = __esm({
|
|
|
7353
7721
|
isPending = false,
|
|
7354
7722
|
terminalWidth = 80
|
|
7355
7723
|
}) => {
|
|
7356
|
-
const prefix = isPending ? /* @__PURE__ */
|
|
7724
|
+
const prefix = isPending ? /* @__PURE__ */ React11.createElement(Spinner, { type: "dots" }) : "\u2726 ";
|
|
7357
7725
|
const prefixWidth = 2;
|
|
7358
|
-
return /* @__PURE__ */
|
|
7726
|
+
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
7727
|
MarkdownDisplay,
|
|
7360
7728
|
{
|
|
7361
7729
|
isPending,
|
|
@@ -7368,8 +7736,8 @@ var init_AssistantMessage = __esm({
|
|
|
7368
7736
|
});
|
|
7369
7737
|
|
|
7370
7738
|
// src/ui/components/messages/ErrorMessage.tsx
|
|
7371
|
-
import { Box as
|
|
7372
|
-
import
|
|
7739
|
+
import { Box as Box10, Text as Text10 } from "ink";
|
|
7740
|
+
import React12 from "react";
|
|
7373
7741
|
function getErrorStyle(type) {
|
|
7374
7742
|
const styles = {
|
|
7375
7743
|
error: { icon: "\u2717", color: theme.text.error },
|
|
@@ -7389,38 +7757,62 @@ var init_ErrorMessage = __esm({
|
|
|
7389
7757
|
}) => {
|
|
7390
7758
|
const { icon, color } = getErrorStyle(type);
|
|
7391
7759
|
const displayMessage = type === "error" ? "Tool call failed" : message;
|
|
7392
|
-
return /* @__PURE__ */
|
|
7760
|
+
return /* @__PURE__ */ React12.createElement(Box10, { flexDirection: "row", marginTop: 1 }, /* @__PURE__ */ React12.createElement(Text10, { color }, icon, " ", displayMessage));
|
|
7393
7761
|
};
|
|
7394
7762
|
}
|
|
7395
7763
|
});
|
|
7396
7764
|
|
|
7397
7765
|
// src/ui/components/messages/LoadingMessage.tsx
|
|
7398
|
-
import { Box as
|
|
7766
|
+
import { Box as Box11, Text as Text11 } from "ink";
|
|
7399
7767
|
import Spinner2 from "ink-spinner";
|
|
7400
|
-
import
|
|
7401
|
-
var LOADING_MESSAGES, LoadingMessage;
|
|
7768
|
+
import React13, { useEffect as useEffect5, useState as useState6 } from "react";
|
|
7769
|
+
var LOADING_MESSAGES, SHIMMER_INTERVAL_MS, TEXT_ROTATION_INTERVAL_MS, LoadingMessage;
|
|
7402
7770
|
var init_LoadingMessage = __esm({
|
|
7403
7771
|
"src/ui/components/messages/LoadingMessage.tsx"() {
|
|
7404
7772
|
"use strict";
|
|
7405
7773
|
init_theme();
|
|
7406
7774
|
LOADING_MESSAGES = [
|
|
7407
|
-
"
|
|
7408
|
-
"
|
|
7409
|
-
"
|
|
7775
|
+
"Brainstorming...",
|
|
7776
|
+
"Brewing coffee...",
|
|
7777
|
+
"Sipping espresso...",
|
|
7778
|
+
"Testing theories...",
|
|
7779
|
+
"Making magic...",
|
|
7780
|
+
"Multiplying matrices..."
|
|
7410
7781
|
];
|
|
7782
|
+
SHIMMER_INTERVAL_MS = 80;
|
|
7783
|
+
TEXT_ROTATION_INTERVAL_MS = 2e3;
|
|
7411
7784
|
LoadingMessage = () => {
|
|
7412
|
-
const
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
)
|
|
7416
|
-
|
|
7785
|
+
const [messageIndex, setMessageIndex] = useState6(0);
|
|
7786
|
+
const [shimmerPosition, setShimmerPosition] = useState6(0);
|
|
7787
|
+
const message = LOADING_MESSAGES[messageIndex];
|
|
7788
|
+
useEffect5(() => {
|
|
7789
|
+
const rotationInterval = setInterval(() => {
|
|
7790
|
+
setMessageIndex((prev) => (prev + 1) % LOADING_MESSAGES.length);
|
|
7791
|
+
setShimmerPosition(0);
|
|
7792
|
+
}, TEXT_ROTATION_INTERVAL_MS);
|
|
7793
|
+
return () => {
|
|
7794
|
+
clearInterval(rotationInterval);
|
|
7795
|
+
};
|
|
7796
|
+
}, []);
|
|
7797
|
+
useEffect5(() => {
|
|
7798
|
+
const shimmerInterval = setInterval(() => {
|
|
7799
|
+
setShimmerPosition((prev) => (prev + 1) % (message.length + 1));
|
|
7800
|
+
}, SHIMMER_INTERVAL_MS);
|
|
7801
|
+
return () => {
|
|
7802
|
+
clearInterval(shimmerInterval);
|
|
7803
|
+
};
|
|
7804
|
+
}, [message.length]);
|
|
7805
|
+
const before = message.slice(0, shimmerPosition);
|
|
7806
|
+
const current = message[shimmerPosition] || "";
|
|
7807
|
+
const after = message.slice(shimmerPosition + 1);
|
|
7808
|
+
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
7809
|
};
|
|
7418
7810
|
}
|
|
7419
7811
|
});
|
|
7420
7812
|
|
|
7421
7813
|
// src/ui/components/messages/ThinkingMessage.tsx
|
|
7422
|
-
import { Box as
|
|
7423
|
-
import
|
|
7814
|
+
import { Box as Box12, Text as Text12 } from "ink";
|
|
7815
|
+
import React14 from "react";
|
|
7424
7816
|
var ThinkingMessage;
|
|
7425
7817
|
var init_ThinkingMessage = __esm({
|
|
7426
7818
|
"src/ui/components/messages/ThinkingMessage.tsx"() {
|
|
@@ -7432,14 +7824,14 @@ var init_ThinkingMessage = __esm({
|
|
|
7432
7824
|
isExpanded = false,
|
|
7433
7825
|
onToggle
|
|
7434
7826
|
}) => {
|
|
7435
|
-
return /* @__PURE__ */
|
|
7827
|
+
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
7828
|
};
|
|
7437
7829
|
}
|
|
7438
7830
|
});
|
|
7439
7831
|
|
|
7440
7832
|
// src/ui/components/messages/TodoMessage.tsx
|
|
7441
|
-
import { Box as
|
|
7442
|
-
import
|
|
7833
|
+
import { Box as Box13, Text as Text13 } from "ink";
|
|
7834
|
+
import React15 from "react";
|
|
7443
7835
|
var TodoMessage;
|
|
7444
7836
|
var init_TodoMessage = __esm({
|
|
7445
7837
|
"src/ui/components/messages/TodoMessage.tsx"() {
|
|
@@ -7455,15 +7847,15 @@ var init_TodoMessage = __esm({
|
|
|
7455
7847
|
const barLength = 20;
|
|
7456
7848
|
const filledLength = Math.round(barLength * completedCount / total);
|
|
7457
7849
|
const bar = "\u2588".repeat(filledLength) + "\u2591".repeat(barLength - filledLength);
|
|
7458
|
-
return /* @__PURE__ */
|
|
7850
|
+
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
7851
|
};
|
|
7460
7852
|
}
|
|
7461
7853
|
});
|
|
7462
7854
|
|
|
7463
7855
|
// src/ui/components/messages/ToolMessage.tsx
|
|
7464
7856
|
import { structuredPatch } from "diff";
|
|
7465
|
-
import { Box as
|
|
7466
|
-
import
|
|
7857
|
+
import { Box as Box14, Text as Text14 } from "ink";
|
|
7858
|
+
import React16 from "react";
|
|
7467
7859
|
function getEditDiff(input) {
|
|
7468
7860
|
if (!input?.old_string || !input?.new_string) return null;
|
|
7469
7861
|
const patch = structuredPatch(
|
|
@@ -7604,7 +7996,7 @@ var init_ToolMessage = __esm({
|
|
|
7604
7996
|
result,
|
|
7605
7997
|
isExpanded = true
|
|
7606
7998
|
}) => {
|
|
7607
|
-
const displayName =
|
|
7999
|
+
const displayName = or(toolName);
|
|
7608
8000
|
const { icon, color } = getToolStyle(toolName);
|
|
7609
8001
|
const resultSummary = result ? getResultSummary(toolName, result) : null;
|
|
7610
8002
|
const hasExpandableContent = !!result;
|
|
@@ -7613,38 +8005,47 @@ var init_ToolMessage = __esm({
|
|
|
7613
8005
|
const isEditOperation = toolName === "Edit";
|
|
7614
8006
|
const editDiff = isEditOperation ? getEditDiff(input) : null;
|
|
7615
8007
|
const isExpandableTool = toolName === "Bash" || toolName === "BashOutput" || toolName === "Command Output";
|
|
7616
|
-
return /* @__PURE__ */
|
|
8008
|
+
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
8009
|
if (line.type === "separator") {
|
|
7618
|
-
return /* @__PURE__ */
|
|
8010
|
+
return /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "row", key: i }, /* @__PURE__ */ React16.createElement(Text14, { color: theme.text.dim }, "..."));
|
|
7619
8011
|
}
|
|
7620
8012
|
const isRemove = line.type === "remove";
|
|
7621
8013
|
const isAdd = line.type === "add";
|
|
7622
8014
|
const bgColor = isRemove ? "#5c1b1b" : isAdd ? "#1b3d1b" : void 0;
|
|
7623
8015
|
const prefix = isRemove ? "- " : isAdd ? "+ " : " ";
|
|
7624
8016
|
const prefixColor = isRemove ? "red" : isAdd ? "green" : theme.text.dim;
|
|
7625
|
-
return /* @__PURE__ */
|
|
7626
|
-
})), isExpanded && result && isExpandableTool && /* @__PURE__ */
|
|
8017
|
+
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));
|
|
8018
|
+
})), 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
8019
|
};
|
|
7628
8020
|
}
|
|
7629
8021
|
});
|
|
7630
8022
|
|
|
7631
8023
|
// src/ui/components/messages/UserMessage.tsx
|
|
7632
|
-
import { Box as
|
|
7633
|
-
import
|
|
8024
|
+
import { Box as Box15, Text as Text15 } from "ink";
|
|
8025
|
+
import React17 from "react";
|
|
7634
8026
|
var UserMessage;
|
|
7635
8027
|
var init_UserMessage = __esm({
|
|
7636
8028
|
"src/ui/components/messages/UserMessage.tsx"() {
|
|
7637
8029
|
"use strict";
|
|
7638
8030
|
init_theme();
|
|
7639
8031
|
UserMessage = ({ text }) => {
|
|
7640
|
-
return /* @__PURE__ */
|
|
8032
|
+
return /* @__PURE__ */ React17.createElement(Box15, { flexDirection: "row", marginTop: 1, alignItems: "center" }, /* @__PURE__ */ React17.createElement(Text15, { color: theme.text.info }, "\u{1F464} "), /* @__PURE__ */ React17.createElement(
|
|
8033
|
+
Box15,
|
|
8034
|
+
{
|
|
8035
|
+
borderStyle: "round",
|
|
8036
|
+
borderColor: theme.text.dim,
|
|
8037
|
+
paddingLeft: 1,
|
|
8038
|
+
paddingRight: 1
|
|
8039
|
+
},
|
|
8040
|
+
/* @__PURE__ */ React17.createElement(Text15, { color: theme.text.secondary }, text)
|
|
8041
|
+
));
|
|
7641
8042
|
};
|
|
7642
8043
|
}
|
|
7643
8044
|
});
|
|
7644
8045
|
|
|
7645
8046
|
// src/ui/components/MessageList.tsx
|
|
7646
|
-
import { Box as
|
|
7647
|
-
import
|
|
8047
|
+
import { Box as Box16, Static } from "ink";
|
|
8048
|
+
import React18, { useMemo as useMemo4 } from "react";
|
|
7648
8049
|
var MessageList;
|
|
7649
8050
|
var init_MessageList = __esm({
|
|
7650
8051
|
"src/ui/components/MessageList.tsx"() {
|
|
@@ -7663,9 +8064,9 @@ var init_MessageList = __esm({
|
|
|
7663
8064
|
const renderMessage = (message) => {
|
|
7664
8065
|
switch (message.type) {
|
|
7665
8066
|
case "user":
|
|
7666
|
-
return /* @__PURE__ */
|
|
8067
|
+
return /* @__PURE__ */ React18.createElement(UserMessage, { key: message.id, text: message.content });
|
|
7667
8068
|
case "assistant":
|
|
7668
|
-
return /* @__PURE__ */
|
|
8069
|
+
return /* @__PURE__ */ React18.createElement(
|
|
7669
8070
|
AssistantMessage,
|
|
7670
8071
|
{
|
|
7671
8072
|
isPending: message.isPending,
|
|
@@ -7675,7 +8076,7 @@ var init_MessageList = __esm({
|
|
|
7675
8076
|
}
|
|
7676
8077
|
);
|
|
7677
8078
|
case "tool":
|
|
7678
|
-
return /* @__PURE__ */
|
|
8079
|
+
return /* @__PURE__ */ React18.createElement(
|
|
7679
8080
|
ToolMessage,
|
|
7680
8081
|
{
|
|
7681
8082
|
description: message.content,
|
|
@@ -7689,7 +8090,7 @@ var init_MessageList = __esm({
|
|
|
7689
8090
|
}
|
|
7690
8091
|
);
|
|
7691
8092
|
case "thinking":
|
|
7692
|
-
return /* @__PURE__ */
|
|
8093
|
+
return /* @__PURE__ */ React18.createElement(
|
|
7693
8094
|
ThinkingMessage,
|
|
7694
8095
|
{
|
|
7695
8096
|
content: message.content,
|
|
@@ -7700,7 +8101,7 @@ var init_MessageList = __esm({
|
|
|
7700
8101
|
}
|
|
7701
8102
|
);
|
|
7702
8103
|
case "error":
|
|
7703
|
-
return /* @__PURE__ */
|
|
8104
|
+
return /* @__PURE__ */ React18.createElement(
|
|
7704
8105
|
ErrorMessage,
|
|
7705
8106
|
{
|
|
7706
8107
|
key: message.id,
|
|
@@ -7709,7 +8110,7 @@ var init_MessageList = __esm({
|
|
|
7709
8110
|
}
|
|
7710
8111
|
);
|
|
7711
8112
|
case "todo":
|
|
7712
|
-
return /* @__PURE__ */
|
|
8113
|
+
return /* @__PURE__ */ React18.createElement(TodoMessage, { key: message.id, todos: message.todos || [] });
|
|
7713
8114
|
default:
|
|
7714
8115
|
return null;
|
|
7715
8116
|
}
|
|
@@ -7730,19 +8131,19 @@ var init_MessageList = __esm({
|
|
|
7730
8131
|
{ id: "header", type: "header" },
|
|
7731
8132
|
...completedMessages.map((msg) => ({ ...msg, _isMessage: true }))
|
|
7732
8133
|
], [completedMessages]);
|
|
7733
|
-
return /* @__PURE__ */
|
|
8134
|
+
return /* @__PURE__ */ React18.createElement(Box16, { flexDirection: "column" }, /* @__PURE__ */ React18.createElement(Static, { items: staticItems, key: staticRemountKey }, (item) => {
|
|
7734
8135
|
if (item.type === "header") {
|
|
7735
|
-
return /* @__PURE__ */
|
|
8136
|
+
return /* @__PURE__ */ React18.createElement(Box16, { flexDirection: "column", key: "header" }, /* @__PURE__ */ React18.createElement(Header, { currentFolder, gitBranch }));
|
|
7736
8137
|
}
|
|
7737
|
-
return /* @__PURE__ */
|
|
7738
|
-
}), pendingMessages.map((message) => /* @__PURE__ */
|
|
8138
|
+
return /* @__PURE__ */ React18.createElement(Box16, { flexDirection: "column", key: item.id, width: "100%" }, renderMessage(item));
|
|
8139
|
+
}), 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
8140
|
};
|
|
7740
8141
|
}
|
|
7741
8142
|
});
|
|
7742
8143
|
|
|
7743
8144
|
// src/ui/components/QueuedMessageDisplay.tsx
|
|
7744
|
-
import { Box as
|
|
7745
|
-
import
|
|
8145
|
+
import { Box as Box17, Text as Text16 } from "ink";
|
|
8146
|
+
import React19 from "react";
|
|
7746
8147
|
var MAX_DISPLAYED_QUEUED_MESSAGES, QueuedMessageDisplay;
|
|
7747
8148
|
var init_QueuedMessageDisplay = __esm({
|
|
7748
8149
|
"src/ui/components/QueuedMessageDisplay.tsx"() {
|
|
@@ -7755,8 +8156,8 @@ var init_QueuedMessageDisplay = __esm({
|
|
|
7755
8156
|
if (messageQueue.length === 0) {
|
|
7756
8157
|
return null;
|
|
7757
8158
|
}
|
|
7758
|
-
return /* @__PURE__ */
|
|
7759
|
-
|
|
8159
|
+
return /* @__PURE__ */ React19.createElement(
|
|
8160
|
+
Box17,
|
|
7760
8161
|
{
|
|
7761
8162
|
borderColor: theme.border.default,
|
|
7762
8163
|
borderStyle: "round",
|
|
@@ -7765,20 +8166,20 @@ var init_QueuedMessageDisplay = __esm({
|
|
|
7765
8166
|
marginTop: 0,
|
|
7766
8167
|
paddingX: 1
|
|
7767
8168
|
},
|
|
7768
|
-
/* @__PURE__ */
|
|
8169
|
+
/* @__PURE__ */ React19.createElement(Box17, { marginBottom: 0 }, /* @__PURE__ */ React19.createElement(Text16, { bold: true, color: theme.text.secondary }, "Queued (", messageQueue.length, ")")),
|
|
7769
8170
|
messageQueue.slice(0, MAX_DISPLAYED_QUEUED_MESSAGES).map((message, index) => {
|
|
7770
8171
|
const preview = message.replace(/\s+/g, " ");
|
|
7771
|
-
return /* @__PURE__ */
|
|
8172
|
+
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
8173
|
}),
|
|
7773
|
-
messageQueue.length > MAX_DISPLAYED_QUEUED_MESSAGES && /* @__PURE__ */
|
|
8174
|
+
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
8175
|
);
|
|
7775
8176
|
};
|
|
7776
8177
|
}
|
|
7777
8178
|
});
|
|
7778
8179
|
|
|
7779
8180
|
// src/ui/components/SessionSelector.tsx
|
|
7780
|
-
import { Box as
|
|
7781
|
-
import
|
|
8181
|
+
import { Box as Box18, Text as Text17, useInput as useInput4 } from "ink";
|
|
8182
|
+
import React20, { useEffect as useEffect6, useState as useState7 } from "react";
|
|
7782
8183
|
function getSessionPrefix(authMethod) {
|
|
7783
8184
|
return authMethod === "api-key" ? "[Team]" : "[Me]";
|
|
7784
8185
|
}
|
|
@@ -7793,13 +8194,13 @@ var init_SessionSelector = __esm({
|
|
|
7793
8194
|
onSelect,
|
|
7794
8195
|
onCancel
|
|
7795
8196
|
}) => {
|
|
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
|
-
|
|
8197
|
+
const [allSessions, setAllSessions] = useState7([]);
|
|
8198
|
+
const [selectedIndex, setSelectedIndex] = useState7(0);
|
|
8199
|
+
const [isLoading, setIsLoading] = useState7(false);
|
|
8200
|
+
const [hasMore, setHasMore] = useState7(true);
|
|
8201
|
+
const [totalSessions, setTotalSessions] = useState7(0);
|
|
8202
|
+
const [error, setError] = useState7(null);
|
|
8203
|
+
useEffect6(() => {
|
|
7803
8204
|
loadMoreSessions();
|
|
7804
8205
|
}, []);
|
|
7805
8206
|
const loadMoreSessions = async () => {
|
|
@@ -7825,7 +8226,7 @@ var init_SessionSelector = __esm({
|
|
|
7825
8226
|
setIsLoading(false);
|
|
7826
8227
|
}
|
|
7827
8228
|
};
|
|
7828
|
-
|
|
8229
|
+
useInput4((input, key) => {
|
|
7829
8230
|
if (allSessions.length === 0) {
|
|
7830
8231
|
if (key.escape || input === "q") {
|
|
7831
8232
|
onCancel();
|
|
@@ -7849,13 +8250,13 @@ var init_SessionSelector = __esm({
|
|
|
7849
8250
|
}
|
|
7850
8251
|
});
|
|
7851
8252
|
if (error) {
|
|
7852
|
-
return /* @__PURE__ */
|
|
8253
|
+
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
8254
|
}
|
|
7854
8255
|
if (allSessions.length === 0 && isLoading) {
|
|
7855
|
-
return /* @__PURE__ */
|
|
8256
|
+
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
8257
|
}
|
|
7857
8258
|
if (allSessions.length === 0 && !isLoading) {
|
|
7858
|
-
return /* @__PURE__ */
|
|
8259
|
+
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
8260
|
}
|
|
7860
8261
|
const VISIBLE_ITEMS = 10;
|
|
7861
8262
|
let startIndex;
|
|
@@ -7875,7 +8276,7 @@ var init_SessionSelector = __esm({
|
|
|
7875
8276
|
const visibleSessions = allSessions.slice(startIndex, endIndex);
|
|
7876
8277
|
const MAX_TITLE_WIDTH = 50;
|
|
7877
8278
|
const PREFIX_WIDTH = 6;
|
|
7878
|
-
return /* @__PURE__ */
|
|
8279
|
+
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
8280
|
const actualIndex = startIndex + index;
|
|
7880
8281
|
const isSelected = actualIndex === selectedIndex;
|
|
7881
8282
|
const title = item.session.title || "Untitled session";
|
|
@@ -7899,18 +8300,18 @@ var init_SessionSelector = __esm({
|
|
|
7899
8300
|
const prefixColor = item.prefix === "[Me]" ? "cyan" : "yellow";
|
|
7900
8301
|
const indicator = isSelected ? "\u25B6 " : " ";
|
|
7901
8302
|
const bgColor = isSelected ? theme.text.accent : void 0;
|
|
7902
|
-
return /* @__PURE__ */
|
|
7903
|
-
})), /* @__PURE__ */
|
|
8303
|
+
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, ")"));
|
|
8304
|
+
})), /* @__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
8305
|
};
|
|
7905
8306
|
}
|
|
7906
8307
|
});
|
|
7907
8308
|
|
|
7908
8309
|
// src/ui/hooks/useModeToggle.ts
|
|
7909
|
-
import { useEffect as
|
|
8310
|
+
import { useEffect as useEffect7 } from "react";
|
|
7910
8311
|
function useModeToggle() {
|
|
7911
8312
|
const { subscribe, unsubscribe } = useKeypressContext();
|
|
7912
8313
|
const { agentMode, setAgentMode, isAgentRunning } = useSession();
|
|
7913
|
-
|
|
8314
|
+
useEffect7(() => {
|
|
7914
8315
|
const handleKeypress = (key) => {
|
|
7915
8316
|
if (key.name === "tab" && key.shift && !isAgentRunning) {
|
|
7916
8317
|
const newMode = agentMode === "plan" ? "build" : "plan";
|
|
@@ -7951,9 +8352,9 @@ var init_useOverlayEscapeGuard = __esm({
|
|
|
7951
8352
|
// src/ui/App.tsx
|
|
7952
8353
|
import { execSync as execSync3 } from "child_process";
|
|
7953
8354
|
import { homedir as homedir3 } from "os";
|
|
7954
|
-
import { Box as
|
|
8355
|
+
import { Box as Box19, Text as Text18, useApp } from "ink";
|
|
7955
8356
|
import Spinner3 from "ink-spinner";
|
|
7956
|
-
import
|
|
8357
|
+
import React21, { useEffect as useEffect8, useRef as useRef3, useState as useState8 } from "react";
|
|
7957
8358
|
var getGitBranch, getCurrentFolder, AppContent, App;
|
|
7958
8359
|
var init_App = __esm({
|
|
7959
8360
|
"src/ui/App.tsx"() {
|
|
@@ -7963,8 +8364,10 @@ var init_App = __esm({
|
|
|
7963
8364
|
init_setup();
|
|
7964
8365
|
init_stdio();
|
|
7965
8366
|
init_token_storage();
|
|
8367
|
+
init_version();
|
|
7966
8368
|
init_AuthBanner();
|
|
7967
8369
|
init_AuthDialog();
|
|
8370
|
+
init_FeedbackDialog();
|
|
7968
8371
|
init_HelpMenu();
|
|
7969
8372
|
init_InputPrompt();
|
|
7970
8373
|
init_MessageList();
|
|
@@ -7996,30 +8399,31 @@ var init_App = __esm({
|
|
|
7996
8399
|
const { exit } = useApp();
|
|
7997
8400
|
const { addMessage, clearMessages, isAgentRunning, messages, setSessionId, setWebUrl, setShouldInterruptAgent, setIsAgentRunning, toggleAllToolOutputs, allToolsExpanded, selectedModel, setSelectedModel } = useSession();
|
|
7998
8401
|
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] =
|
|
8402
|
+
const [terminalWidth, setTerminalWidth] = useState8(process.stdout.columns || 80);
|
|
8403
|
+
const [showHelp, setShowHelp] = useState8(false);
|
|
8404
|
+
const [showInput, setShowInput] = useState8(true);
|
|
8405
|
+
const [gitBranch] = useState8(() => getGitBranch());
|
|
8406
|
+
const [currentFolder] = useState8(() => getCurrentFolder());
|
|
8407
|
+
const [hasInputContent, setHasInputContent] = useState8(false);
|
|
8408
|
+
const [exitWarning, setExitWarning] = useState8(null);
|
|
8006
8409
|
const inputPromptRef = useRef3(null);
|
|
8007
|
-
const [showSessionSelector, setShowSessionSelector] =
|
|
8008
|
-
const [showModelSelector, setShowModelSelector] =
|
|
8009
|
-
const [
|
|
8010
|
-
const [
|
|
8410
|
+
const [showSessionSelector, setShowSessionSelector] = useState8(false);
|
|
8411
|
+
const [showModelSelector, setShowModelSelector] = useState8(false);
|
|
8412
|
+
const [showFeedbackDialog, setShowFeedbackDialog] = useState8(false);
|
|
8413
|
+
const [isLoadingSession, setIsLoadingSession] = useState8(false);
|
|
8414
|
+
const [authState, setAuthState] = useState8(
|
|
8011
8415
|
() => config2.supatestApiKey ? "authenticated" /* Authenticated */ : "unauthenticated" /* Unauthenticated */
|
|
8012
8416
|
);
|
|
8013
|
-
const [showAuthDialog, setShowAuthDialog] =
|
|
8417
|
+
const [showAuthDialog, setShowAuthDialog] = useState8(false);
|
|
8014
8418
|
const { isOverlayOpen, isCancelSuppressed, markOverlayClosed } = useOverlayEscapeGuard({
|
|
8015
|
-
overlays: [showHelp, showSessionSelector, showAuthDialog, showModelSelector]
|
|
8419
|
+
overlays: [showHelp, showSessionSelector, showAuthDialog, showModelSelector, showFeedbackDialog]
|
|
8016
8420
|
});
|
|
8017
|
-
|
|
8421
|
+
useEffect8(() => {
|
|
8018
8422
|
if (!config2.supatestApiKey) {
|
|
8019
8423
|
setShowAuthDialog(true);
|
|
8020
8424
|
}
|
|
8021
8425
|
}, [config2.supatestApiKey]);
|
|
8022
|
-
|
|
8426
|
+
useEffect8(() => {
|
|
8023
8427
|
if (sessionId) {
|
|
8024
8428
|
setSessionId(sessionId);
|
|
8025
8429
|
}
|
|
@@ -8126,6 +8530,19 @@ var init_App = __esm({
|
|
|
8126
8530
|
setShowModelSelector(true);
|
|
8127
8531
|
return;
|
|
8128
8532
|
}
|
|
8533
|
+
if (command === "/feedback") {
|
|
8534
|
+
if (authState !== "authenticated" /* Authenticated */) {
|
|
8535
|
+
addMessage({
|
|
8536
|
+
type: "error",
|
|
8537
|
+
content: "Please login first to submit feedback.",
|
|
8538
|
+
errorType: "warning"
|
|
8539
|
+
});
|
|
8540
|
+
setShowAuthDialog(true);
|
|
8541
|
+
return;
|
|
8542
|
+
}
|
|
8543
|
+
setShowFeedbackDialog(true);
|
|
8544
|
+
return;
|
|
8545
|
+
}
|
|
8129
8546
|
if (command === "/setup") {
|
|
8130
8547
|
addMessage({
|
|
8131
8548
|
type: "assistant",
|
|
@@ -8185,18 +8602,57 @@ var init_App = __esm({
|
|
|
8185
8602
|
setSelectedModel(modelId);
|
|
8186
8603
|
addMessage({
|
|
8187
8604
|
type: "assistant",
|
|
8188
|
-
content: `Model changed to: ${
|
|
8605
|
+
content: `Model changed to: ${St(modelId)}`
|
|
8189
8606
|
});
|
|
8190
8607
|
};
|
|
8191
8608
|
const handleModelSelectorCancel = () => {
|
|
8192
8609
|
markOverlayClosed();
|
|
8193
8610
|
setShowModelSelector(false);
|
|
8194
8611
|
};
|
|
8612
|
+
const handleFeedbackSubmit = async (category, description) => {
|
|
8613
|
+
setShowFeedbackDialog(false);
|
|
8614
|
+
markOverlayClosed();
|
|
8615
|
+
if (!apiClient) {
|
|
8616
|
+
addMessage({
|
|
8617
|
+
type: "error",
|
|
8618
|
+
content: "API client not available. Cannot submit feedback.",
|
|
8619
|
+
errorType: "error"
|
|
8620
|
+
});
|
|
8621
|
+
return;
|
|
8622
|
+
}
|
|
8623
|
+
try {
|
|
8624
|
+
await apiClient.submitFeedback({
|
|
8625
|
+
category,
|
|
8626
|
+
description,
|
|
8627
|
+
sessionId: sessionId || void 0,
|
|
8628
|
+
model: selectedModel,
|
|
8629
|
+
cliVersion: CLI_VERSION,
|
|
8630
|
+
metadata: {
|
|
8631
|
+
os: process.platform,
|
|
8632
|
+
nodeVersion: process.version
|
|
8633
|
+
}
|
|
8634
|
+
});
|
|
8635
|
+
addMessage({
|
|
8636
|
+
type: "assistant",
|
|
8637
|
+
content: "Thank you for your feedback! We appreciate you taking the time to help us improve."
|
|
8638
|
+
});
|
|
8639
|
+
} catch (error) {
|
|
8640
|
+
addMessage({
|
|
8641
|
+
type: "error",
|
|
8642
|
+
content: `Failed to submit feedback: ${error instanceof Error ? error.message : String(error)}`,
|
|
8643
|
+
errorType: "error"
|
|
8644
|
+
});
|
|
8645
|
+
}
|
|
8646
|
+
};
|
|
8647
|
+
const handleFeedbackCancel = () => {
|
|
8648
|
+
markOverlayClosed();
|
|
8649
|
+
setShowFeedbackDialog(false);
|
|
8650
|
+
};
|
|
8195
8651
|
const handleHelpClose = () => {
|
|
8196
8652
|
markOverlayClosed();
|
|
8197
8653
|
setShowHelp(false);
|
|
8198
8654
|
};
|
|
8199
|
-
|
|
8655
|
+
useEffect8(() => {
|
|
8200
8656
|
const handleResize = () => {
|
|
8201
8657
|
setTerminalWidth(process.stdout.columns || 80);
|
|
8202
8658
|
};
|
|
@@ -8256,7 +8712,7 @@ var init_App = __esm({
|
|
|
8256
8712
|
},
|
|
8257
8713
|
{ isActive: !isOverlayOpen }
|
|
8258
8714
|
);
|
|
8259
|
-
|
|
8715
|
+
useEffect8(() => {
|
|
8260
8716
|
if (config2.task) {
|
|
8261
8717
|
addMessage({
|
|
8262
8718
|
type: "user",
|
|
@@ -8264,21 +8720,21 @@ var init_App = __esm({
|
|
|
8264
8720
|
});
|
|
8265
8721
|
}
|
|
8266
8722
|
}, []);
|
|
8267
|
-
return /* @__PURE__ */
|
|
8268
|
-
|
|
8723
|
+
return /* @__PURE__ */ React21.createElement(
|
|
8724
|
+
Box19,
|
|
8269
8725
|
{
|
|
8270
8726
|
flexDirection: "column",
|
|
8271
8727
|
paddingX: 1
|
|
8272
8728
|
},
|
|
8273
|
-
/* @__PURE__ */
|
|
8274
|
-
showHelp && /* @__PURE__ */
|
|
8729
|
+
/* @__PURE__ */ React21.createElement(MessageList, { currentFolder, gitBranch, terminalWidth }),
|
|
8730
|
+
showHelp && /* @__PURE__ */ React21.createElement(
|
|
8275
8731
|
HelpMenu,
|
|
8276
8732
|
{
|
|
8277
8733
|
isAuthenticated: authState === "authenticated" /* Authenticated */,
|
|
8278
8734
|
onClose: handleHelpClose
|
|
8279
8735
|
}
|
|
8280
8736
|
),
|
|
8281
|
-
showSessionSelector && apiClient && /* @__PURE__ */
|
|
8737
|
+
showSessionSelector && apiClient && /* @__PURE__ */ React21.createElement(
|
|
8282
8738
|
SessionSelector,
|
|
8283
8739
|
{
|
|
8284
8740
|
apiClient,
|
|
@@ -8286,8 +8742,8 @@ var init_App = __esm({
|
|
|
8286
8742
|
onSelect: handleSessionSelect
|
|
8287
8743
|
}
|
|
8288
8744
|
),
|
|
8289
|
-
isLoadingSession && /* @__PURE__ */
|
|
8290
|
-
showModelSelector && /* @__PURE__ */
|
|
8745
|
+
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")),
|
|
8746
|
+
showModelSelector && /* @__PURE__ */ React21.createElement(
|
|
8291
8747
|
ModelSelector,
|
|
8292
8748
|
{
|
|
8293
8749
|
currentModel: selectedModel,
|
|
@@ -8295,13 +8751,20 @@ var init_App = __esm({
|
|
|
8295
8751
|
onSelect: handleModelSelect
|
|
8296
8752
|
}
|
|
8297
8753
|
),
|
|
8298
|
-
showAuthDialog && /* @__PURE__ */
|
|
8754
|
+
showAuthDialog && /* @__PURE__ */ React21.createElement(
|
|
8299
8755
|
AuthDialog,
|
|
8300
8756
|
{
|
|
8301
8757
|
onLogin: handleLogin
|
|
8302
8758
|
}
|
|
8303
8759
|
),
|
|
8304
|
-
|
|
8760
|
+
showFeedbackDialog && /* @__PURE__ */ React21.createElement(
|
|
8761
|
+
FeedbackDialog,
|
|
8762
|
+
{
|
|
8763
|
+
onCancel: handleFeedbackCancel,
|
|
8764
|
+
onSubmit: handleFeedbackSubmit
|
|
8765
|
+
}
|
|
8766
|
+
),
|
|
8767
|
+
/* @__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
8768
|
InputPrompt,
|
|
8306
8769
|
{
|
|
8307
8770
|
currentFolder,
|
|
@@ -8316,13 +8779,13 @@ var init_App = __esm({
|
|
|
8316
8779
|
);
|
|
8317
8780
|
};
|
|
8318
8781
|
App = (props) => {
|
|
8319
|
-
return /* @__PURE__ */
|
|
8782
|
+
return /* @__PURE__ */ React21.createElement(AppContent, { ...props });
|
|
8320
8783
|
};
|
|
8321
8784
|
}
|
|
8322
8785
|
});
|
|
8323
8786
|
|
|
8324
8787
|
// src/ui/hooks/useBracketedPaste.ts
|
|
8325
|
-
import { useEffect as
|
|
8788
|
+
import { useEffect as useEffect9 } from "react";
|
|
8326
8789
|
var ENABLE_BRACKETED_PASTE, DISABLE_BRACKETED_PASTE, useBracketedPaste;
|
|
8327
8790
|
var init_useBracketedPaste = __esm({
|
|
8328
8791
|
"src/ui/hooks/useBracketedPaste.ts"() {
|
|
@@ -8331,7 +8794,7 @@ var init_useBracketedPaste = __esm({
|
|
|
8331
8794
|
ENABLE_BRACKETED_PASTE = "\x1B[?2004h";
|
|
8332
8795
|
DISABLE_BRACKETED_PASTE = "\x1B[?2004l";
|
|
8333
8796
|
useBracketedPaste = () => {
|
|
8334
|
-
|
|
8797
|
+
useEffect9(() => {
|
|
8335
8798
|
writeToStdout(ENABLE_BRACKETED_PASTE);
|
|
8336
8799
|
const cleanup = () => {
|
|
8337
8800
|
writeToStdout(DISABLE_BRACKETED_PASTE);
|
|
@@ -8352,7 +8815,7 @@ __export(interactive_exports, {
|
|
|
8352
8815
|
runInteractive: () => runInteractive
|
|
8353
8816
|
});
|
|
8354
8817
|
import { render } from "ink";
|
|
8355
|
-
import
|
|
8818
|
+
import React22, { useEffect as useEffect10, useRef as useRef4 } from "react";
|
|
8356
8819
|
function getToolDescription2(toolName, input) {
|
|
8357
8820
|
switch (toolName) {
|
|
8358
8821
|
case "Read":
|
|
@@ -8485,7 +8948,7 @@ async function runInteractive(config2) {
|
|
|
8485
8948
|
webUrl = session.webUrl;
|
|
8486
8949
|
}
|
|
8487
8950
|
const { unmount, waitUntilExit } = render(
|
|
8488
|
-
/* @__PURE__ */
|
|
8951
|
+
/* @__PURE__ */ React22.createElement(
|
|
8489
8952
|
InteractiveApp,
|
|
8490
8953
|
{
|
|
8491
8954
|
apiClient,
|
|
@@ -8558,13 +9021,13 @@ var init_interactive = __esm({
|
|
|
8558
9021
|
selectedModel
|
|
8559
9022
|
} = useSession();
|
|
8560
9023
|
const agentRef = useRef4(null);
|
|
8561
|
-
|
|
9024
|
+
useEffect10(() => {
|
|
8562
9025
|
if (shouldInterruptAgent && agentRef.current) {
|
|
8563
9026
|
agentRef.current.abort();
|
|
8564
9027
|
setShouldInterruptAgent(false);
|
|
8565
9028
|
}
|
|
8566
9029
|
}, [shouldInterruptAgent, setShouldInterruptAgent]);
|
|
8567
|
-
|
|
9030
|
+
useEffect10(() => {
|
|
8568
9031
|
let isMounted = true;
|
|
8569
9032
|
const runAgent2 = async () => {
|
|
8570
9033
|
setIsAgentRunning(true);
|
|
@@ -8653,12 +9116,12 @@ var init_interactive = __esm({
|
|
|
8653
9116
|
setIsAgentRunning,
|
|
8654
9117
|
setUsageStats
|
|
8655
9118
|
} = 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] =
|
|
9119
|
+
const [sessionId, setSessionId] = React22.useState(initialSessionId);
|
|
9120
|
+
const [currentTask, setCurrentTask] = React22.useState(config2.task);
|
|
9121
|
+
const [taskId, setTaskId] = React22.useState(0);
|
|
9122
|
+
const [shouldRunAgent, setShouldRunAgent] = React22.useState(!!config2.task);
|
|
9123
|
+
const [taskQueue, setTaskQueue] = React22.useState([]);
|
|
9124
|
+
const [providerSessionId, setProviderSessionId] = React22.useState();
|
|
8662
9125
|
const handleSubmitTask = async (task) => {
|
|
8663
9126
|
if (!sessionId) {
|
|
8664
9127
|
try {
|
|
@@ -8700,7 +9163,7 @@ var init_interactive = __esm({
|
|
|
8700
9163
|
}
|
|
8701
9164
|
}
|
|
8702
9165
|
};
|
|
8703
|
-
|
|
9166
|
+
React22.useEffect(() => {
|
|
8704
9167
|
if (!shouldRunAgent && taskQueue.length > 0) {
|
|
8705
9168
|
const [nextTask, ...remaining] = taskQueue;
|
|
8706
9169
|
setTaskQueue(remaining);
|
|
@@ -8713,7 +9176,7 @@ var init_interactive = __esm({
|
|
|
8713
9176
|
setShouldRunAgent(true);
|
|
8714
9177
|
}
|
|
8715
9178
|
}, [shouldRunAgent, taskQueue, addMessage]);
|
|
8716
|
-
return /* @__PURE__ */
|
|
9179
|
+
return /* @__PURE__ */ React22.createElement(React22.Fragment, null, /* @__PURE__ */ React22.createElement(
|
|
8717
9180
|
App,
|
|
8718
9181
|
{
|
|
8719
9182
|
apiClient,
|
|
@@ -8775,7 +9238,7 @@ var init_interactive = __esm({
|
|
|
8775
9238
|
sessionId,
|
|
8776
9239
|
webUrl
|
|
8777
9240
|
}
|
|
8778
|
-
), shouldRunAgent && currentTask && sessionId && /* @__PURE__ */
|
|
9241
|
+
), shouldRunAgent && currentTask && sessionId && /* @__PURE__ */ React22.createElement(
|
|
8779
9242
|
AgentRunner,
|
|
8780
9243
|
{
|
|
8781
9244
|
apiClient,
|
|
@@ -8788,7 +9251,7 @@ var init_interactive = __esm({
|
|
|
8788
9251
|
};
|
|
8789
9252
|
InteractiveApp = (props) => {
|
|
8790
9253
|
useBracketedPaste();
|
|
8791
|
-
return /* @__PURE__ */
|
|
9254
|
+
return /* @__PURE__ */ React22.createElement(KeypressProvider, null, /* @__PURE__ */ React22.createElement(SessionProvider, { initialModel: props.config.selectedModel }, /* @__PURE__ */ React22.createElement(InteractiveAppContent, { ...props })));
|
|
8792
9255
|
};
|
|
8793
9256
|
}
|
|
8794
9257
|
});
|
|
@@ -8995,7 +9458,7 @@ var ConsolePresenter = class {
|
|
|
8995
9458
|
}
|
|
8996
9459
|
onToolUse(tool, input, _toolId) {
|
|
8997
9460
|
if (this.spinner) {
|
|
8998
|
-
const displayName =
|
|
9461
|
+
const displayName = or(tool);
|
|
8999
9462
|
this.spinner.text = `Using ${displayName}...`;
|
|
9000
9463
|
}
|
|
9001
9464
|
this.stopSpinner();
|
|
@@ -9582,10 +10045,10 @@ program.name("supatest").description(
|
|
|
9582
10045
|
let selectedModel;
|
|
9583
10046
|
const modelOption = options.model || config.anthropicModelName;
|
|
9584
10047
|
if (modelOption) {
|
|
9585
|
-
if (
|
|
10048
|
+
if (Lt(modelOption)) {
|
|
9586
10049
|
selectedModel = modelOption;
|
|
9587
10050
|
} else {
|
|
9588
|
-
const validModels =
|
|
10051
|
+
const validModels = ke.map((m2) => m2.id).join(", ");
|
|
9589
10052
|
logger.warn(`Invalid model "${modelOption}". Valid models: ${validModels}`);
|
|
9590
10053
|
logger.warn("Using default model instead.");
|
|
9591
10054
|
}
|