@cortexkit/opencode-anthropic-auth 2.2.1 → 2.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,6 +10,7 @@ import { createComponent as _$createComponent } from "opentui:runtime-module:%40
10
10
 
11
11
  import { custodyStatusLabel } from "@cortexkit/anthropic-auth-core";
12
12
  import { formatPrimeCost, formatPrimeTime } from "../sidebar-state.js";
13
+ import { SIGN_IN_LINK_TITLE, SignInLink } from "./sign-in-link.js";
13
14
 
14
15
  /** Render menu sections, accounts and action inputs; send changes to the host instead of writing credentials here. */
15
16
  export function openNativeMenuDialog(api, payload, apply, isCurrentSession) {
@@ -113,6 +114,32 @@ export function openNativeMenuDialog(api, payload, apply, isCurrentSession) {
113
114
  return _el$3;
114
115
  })());
115
116
  };
117
+
118
+ /** The sign-in link stays on screen until the person goes back or closes it. */
119
+ const showSignIn = (url, back) => {
120
+ if (!active()) return;
121
+ api.ui.dialog.setSize('xlarge');
122
+ api.ui.dialog.replace(() => (() => {
123
+ var _el$5 = _$createElement("box");
124
+ _$setProp(_el$5, "flexDirection", 'column');
125
+ _$setProp(_el$5, "paddingTop", 1);
126
+ _$insert(_el$5, _$createComponent(SignInLink, {
127
+ url: url,
128
+ title: SIGN_IN_LINK_TITLE
129
+ }), null);
130
+ _$insert(_el$5, _$createComponent(DialogSelect, {
131
+ title: "Continue",
132
+ options: [{
133
+ title: 'Back',
134
+ value: '__back'
135
+ }],
136
+ onSelect: () => {
137
+ if (active()) back();
138
+ }
139
+ }), null);
140
+ return _el$5;
141
+ })());
142
+ };
116
143
  const collect = (section, action, item) => {
117
144
  const values = {};
118
145
  const back = () => {
@@ -122,6 +149,10 @@ export function openNativeMenuDialog(api, payload, apply, isCurrentSession) {
122
149
  const submit = async () => {
123
150
  if (!active()) return;
124
151
  inFlight = true;
152
+ // Set after a successful OAuth start: its link is shown in a lasting
153
+ // dialog instead of a toast, which would vanish before it could be
154
+ // copied and sit behind the menu.
155
+ let signInUrl;
125
156
  try {
126
157
  const result = await apply({
127
158
  command: menu.command,
@@ -139,7 +170,7 @@ export function openNativeMenuDialog(api, payload, apply, isCurrentSession) {
139
170
  });
140
171
  if (!isCurrentSession()) return;
141
172
  menu = result.menu;
142
- api.ui.toast({
173
+ if (typeof result.authorizationUrl === 'string') signInUrl = result.authorizationUrl;else api.ui.toast({
143
174
  message: result.text
144
175
  });
145
176
  } catch {
@@ -151,7 +182,8 @@ export function openNativeMenuDialog(api, payload, apply, isCurrentSession) {
151
182
  inFlight = false;
152
183
  if (isCurrentSession()) {
153
184
  const refreshed = menu.sections.find(entry => entry.id === section.id);
154
- if (refreshed) showSection(refreshed);else root();
185
+ const back = () => refreshed ? showSection(refreshed) : root();
186
+ if (signInUrl !== undefined) showSignIn(signInUrl, back);else back();
155
187
  }
156
188
  }
157
189
  };
@@ -209,12 +241,12 @@ export function openNativeMenuDialog(api, payload, apply, isCurrentSession) {
209
241
  return knob.label;
210
242
  },
211
243
  description: () => (() => {
212
- var _el$5 = _$createElement("text");
213
- _$insert(_el$5, (() => {
244
+ var _el$6 = _$createElement("text");
245
+ _$insert(_el$6, (() => {
214
246
  var _c$ = _$memo(() => !!(knob.kind === 'text' && knob.masked));
215
247
  return () => _c$() ? 'This host prompt displays input. Avoid screen sharing; the value is not echoed in menu results.' : knob.required ? 'Required input' : 'Optional; leave empty for the default';
216
248
  })());
217
- return _el$5;
249
+ return _el$6;
218
250
  })(),
219
251
  get value() {
220
252
  return _$memo(() => !!(knob.kind === 'text' && knob.masked))() ? '' : _$memo(() => knob.value === undefined)() ? '' : String(knob.value);
@@ -401,14 +433,14 @@ export function retainAccountDialogProjection(current, incoming) {
401
433
  function showText(api, text) {
402
434
  api.ui.dialog.setSize('xlarge');
403
435
  api.ui.dialog.replace(() => (() => {
404
- var _el$6 = _$createElement("box"),
405
- _el$7 = _$createElement("text");
406
- _$insertNode(_el$6, _el$7);
407
- _$setProp(_el$6, "flexDirection", 'column');
408
- _$setProp(_el$6, "padding", 1);
409
- _$setProp(_el$6, "width", '100%');
410
- _$insert(_el$7, text);
411
- return _el$6;
436
+ var _el$7 = _$createElement("box"),
437
+ _el$8 = _$createElement("text");
438
+ _$insertNode(_el$7, _el$8);
439
+ _$setProp(_el$7, "flexDirection", 'column');
440
+ _$setProp(_el$7, "padding", 1);
441
+ _$setProp(_el$7, "width", '100%');
442
+ _$insert(_el$8, text);
443
+ return _el$7;
412
444
  })());
413
445
  }
414
446
 
@@ -556,9 +588,9 @@ export function openCommandDialog(api, payload, apply) {
556
588
  api.ui.dialog.replace(() => _$createComponent(DialogPrompt, {
557
589
  title: "Claude cachekeep schedule",
558
590
  description: () => (() => {
559
- var _el$8 = _$createElement("text");
560
- _$insert(_el$8, () => payload.text);
561
- return _el$8;
591
+ var _el$9 = _$createElement("text");
592
+ _$insert(_el$9, () => payload.text);
593
+ return _el$9;
562
594
  })(),
563
595
  placeholder: "'always', HH-HH (e.g. 08-20), or 'off'",
564
596
  value: seed,
@@ -587,17 +619,17 @@ export function openCommandDialog(api, payload, apply) {
587
619
  const statusText = `Claude prime status:\n\n${lines.join('\n')}`;
588
620
  api.ui.dialog.setSize('xlarge');
589
621
  api.ui.dialog.replace(() => (() => {
590
- var _el$9 = _$createElement("box"),
591
- _el$0 = _$createElement("text"),
592
- _el$1 = _$createElement("box");
593
- _$insertNode(_el$9, _el$0);
594
- _$insertNode(_el$9, _el$1);
595
- _$setProp(_el$9, "flexDirection", 'column');
596
- _$setProp(_el$9, "padding", 1);
597
- _$setProp(_el$9, "width", '100%');
598
- _$insert(_el$0, statusText);
599
- _$setProp(_el$1, "marginTop", 1);
600
- _$insert(_el$1, _$createComponent(DialogSelect, {
622
+ var _el$0 = _$createElement("box"),
623
+ _el$1 = _$createElement("text"),
624
+ _el$10 = _$createElement("box");
625
+ _$insertNode(_el$0, _el$1);
626
+ _$insertNode(_el$0, _el$10);
627
+ _$setProp(_el$0, "flexDirection", 'column');
628
+ _$setProp(_el$0, "padding", 1);
629
+ _$setProp(_el$0, "width", '100%');
630
+ _$insert(_el$1, statusText);
631
+ _$setProp(_el$10, "marginTop", 1);
632
+ _$insert(_el$10, _$createComponent(DialogSelect, {
601
633
  title: "Claude prime \u2014 status",
602
634
  current: "back",
603
635
  options: [{
@@ -606,7 +638,7 @@ export function openCommandDialog(api, payload, apply) {
606
638
  }],
607
639
  onSelect: option => handlePrimeStatusOption(option, renderMain)
608
640
  }));
609
- return _el$9;
641
+ return _el$0;
610
642
  })());
611
643
  };
612
644
  const renderMain = () => {
@@ -653,9 +685,9 @@ export function openCommandDialog(api, payload, apply) {
653
685
  api.ui.dialog.replace(() => _$createComponent(DialogPrompt, {
654
686
  title: "Killswitch thresholds",
655
687
  description: () => (() => {
656
- var _el$10 = _$createElement("text");
657
- _$insert(_el$10, () => payload.text);
658
- return _el$10;
688
+ var _el$11 = _$createElement("text");
689
+ _$insert(_el$11, () => payload.text);
690
+ return _el$11;
659
691
  })(),
660
692
  placeholder: "main:5,10,0 work-alt:5,10,0",
661
693
  value: seed,
@@ -718,40 +750,40 @@ export function openCommandDialog(api, payload, apply) {
718
750
  });
719
751
  api.ui.dialog.setSize('xlarge');
720
752
  api.ui.dialog.replace(() => (() => {
721
- var _el$11 = _$createElement("box"),
722
- _el$12 = _$createElement("text"),
753
+ var _el$12 = _$createElement("box"),
723
754
  _el$13 = _$createElement("text"),
724
- _el$14 = _$createElement("box");
725
- _$insertNode(_el$11, _el$12);
726
- _$insertNode(_el$11, _el$13);
727
- _$insertNode(_el$11, _el$14);
728
- _$setProp(_el$11, "flexDirection", 'column');
729
- _$setProp(_el$11, "padding", 1);
730
- _$setProp(_el$11, "width", '100%');
731
- _$insert(_el$12, () => `Claustrum: ${normalizeAccountDialogPayload(accountKnobs).claustrumDetection}`);
732
- _$insert(_el$13, () => l1.header);
733
- _$insert(_el$11, (() => {
755
+ _el$14 = _$createElement("text"),
756
+ _el$15 = _$createElement("box");
757
+ _$insertNode(_el$12, _el$13);
758
+ _$insertNode(_el$12, _el$14);
759
+ _$insertNode(_el$12, _el$15);
760
+ _$setProp(_el$12, "flexDirection", 'column');
761
+ _$setProp(_el$12, "padding", 1);
762
+ _$setProp(_el$12, "width", '100%');
763
+ _$insert(_el$13, () => `Claustrum: ${normalizeAccountDialogPayload(accountKnobs).claustrumDetection}`);
764
+ _$insert(_el$14, () => l1.header);
765
+ _$insert(_el$12, (() => {
734
766
  var _c$2 = _$memo(() => !!l1.enrollmentStatus);
735
767
  return () => _c$2() && (() => {
736
- var _el$15 = _$createElement("box"),
737
- _el$16 = _$createElement("text");
738
- _$insertNode(_el$15, _el$16);
739
- _$setProp(_el$15, "marginTop", 1);
740
- _$insert(_el$16, () => l1.enrollmentStatus);
741
- return _el$15;
768
+ var _el$16 = _$createElement("box"),
769
+ _el$17 = _$createElement("text");
770
+ _$insertNode(_el$16, _el$17);
771
+ _$setProp(_el$16, "marginTop", 1);
772
+ _$insert(_el$17, () => l1.enrollmentStatus);
773
+ return _el$16;
742
774
  })();
743
- })(), _el$14);
744
- _$insert(_el$11, statusMessage && (() => {
745
- var _el$17 = _$createElement("box"),
746
- _el$18 = _$createElement("text");
747
- _$insertNode(_el$17, _el$18);
748
- _$setProp(_el$17, "marginTop", 1);
749
- _$insert(_el$18, () => statusMessage.text);
750
- _$effect(_$p => _$setProp(_el$18, "fg", statusMessage.error ? '#ef4444' : '#22c55e', _$p));
751
- return _el$17;
752
- })(), _el$14);
753
- _$setProp(_el$14, "marginTop", 1);
754
- _$insert(_el$14, _$createComponent(DialogSelect, {
775
+ })(), _el$15);
776
+ _$insert(_el$12, statusMessage && (() => {
777
+ var _el$18 = _$createElement("box"),
778
+ _el$19 = _$createElement("text");
779
+ _$insertNode(_el$18, _el$19);
780
+ _$setProp(_el$18, "marginTop", 1);
781
+ _$insert(_el$19, () => statusMessage.text);
782
+ _$effect(_$p => _$setProp(_el$19, "fg", statusMessage.error ? '#ef4444' : '#22c55e', _$p));
783
+ return _el$18;
784
+ })(), _el$15);
785
+ _$setProp(_el$15, "marginTop", 1);
786
+ _$insert(_el$15, _$createComponent(DialogSelect, {
755
787
  title: "Claude accounts",
756
788
  get options() {
757
789
  return l1.options;
@@ -802,7 +834,7 @@ export function openCommandDialog(api, payload, apply) {
802
834
  openManage(account, false);
803
835
  }
804
836
  }));
805
- return _el$11;
837
+ return _el$12;
806
838
  })());
807
839
  };
808
840
 
@@ -847,9 +879,9 @@ export function openCommandDialog(api, payload, apply) {
847
879
  api.ui.dialog.replace(() => _$createComponent(DialogPrompt, {
848
880
  title: "Add API key account \\u2014 API key",
849
881
  description: () => (() => {
850
- var _el$19 = _$createElement("text");
851
- _$insertNode(_el$19, _$createTextNode(`Paste your API key (required).`));
852
- return _el$19;
882
+ var _el$20 = _$createElement("text");
883
+ _$insertNode(_el$20, _$createTextNode(`Paste your API key (required).`));
884
+ return _el$20;
853
885
  })(),
854
886
  placeholder: "sk-ant-...",
855
887
  value: "",
@@ -871,9 +903,9 @@ export function openCommandDialog(api, payload, apply) {
871
903
  api.ui.dialog.replace(() => _$createComponent(DialogPrompt, {
872
904
  title: "Add API key account \\u2014 base URL",
873
905
  description: () => (() => {
874
- var _el$21 = _$createElement("text");
875
- _$insertNode(_el$21, _$createTextNode(`Anthropic-compatible API base URL. Default: https://api.kie.ai/claude`));
876
- return _el$21;
906
+ var _el$22 = _$createElement("text");
907
+ _$insertNode(_el$22, _$createTextNode(`Anthropic-compatible API base URL. Default: https://api.kie.ai/claude`));
908
+ return _el$22;
877
909
  })(),
878
910
  placeholder: "https://api.kie.ai/claude",
879
911
  value: "",
@@ -911,9 +943,9 @@ export function openCommandDialog(api, payload, apply) {
911
943
  api.ui.dialog.replace(() => _$createComponent(DialogPrompt, {
912
944
  title: "Add API key account \\u2014 label",
913
945
  description: () => (() => {
914
- var _el$23 = _$createElement("text");
915
- _$insertNode(_el$23, _$createTextNode(`A short name for this account (optional).`));
916
- return _el$23;
946
+ var _el$24 = _$createElement("text");
947
+ _$insertNode(_el$24, _$createTextNode(`A short name for this account (optional).`));
948
+ return _el$24;
917
949
  })(),
918
950
  placeholder: "e.g. Work API",
919
951
  value: "",
@@ -964,42 +996,51 @@ export function openCommandDialog(api, payload, apply) {
964
996
  const openOAuthUrlScreen = oauthUrl => {
965
997
  const DialogSelect = api.ui.DialogSelect;
966
998
  api.ui.dialog.setSize('xlarge');
967
- api.ui.dialog.replace(() => _$createComponent(DialogSelect, {
968
- title: "OAuth sign-in",
969
- options: [{
970
- title: 'Copy URL to clipboard',
971
- value: 'copy',
972
- description: oauthUrl
973
- }, {
974
- title: 'Enter sign-in code',
975
- value: 'code',
976
- description: 'Open the URL in your browser, sign in, then paste the callback URL or code'
977
- }, {
978
- title: 'Cancel',
979
- value: 'cancel'
980
- }],
981
- onSelect: option => {
982
- if (option.value === 'cancel') {
983
- buildL1();
984
- return;
985
- }
986
- if (option.value === 'copy') {
987
- const ok = api.renderer.copyToClipboardOSC52(oauthUrl);
988
- if (ok) {
989
- api.ui.toast({
990
- message: 'URL copied to clipboard'
991
- });
992
- } else {
993
- api.ui.toast({
994
- message: 'Copy unavailable \u2014 select the URL text above to copy'
995
- });
999
+ api.ui.dialog.replace(() => (() => {
1000
+ var _el$26 = _$createElement("box");
1001
+ _$setProp(_el$26, "flexDirection", 'column');
1002
+ _$setProp(_el$26, "paddingTop", 1);
1003
+ _$insert(_el$26, _$createComponent(SignInLink, {
1004
+ url: oauthUrl,
1005
+ instructions: "Open this link in your browser and sign in, then choose Enter sign-in code and paste the callback URL or code."
1006
+ }), null);
1007
+ _$insert(_el$26, _$createComponent(DialogSelect, {
1008
+ title: "OAuth sign-in",
1009
+ options: [{
1010
+ title: 'Copy URL to clipboard',
1011
+ value: 'copy'
1012
+ }, {
1013
+ title: 'Enter sign-in code',
1014
+ value: 'code',
1015
+ description: 'Open the URL in your browser, sign in, then paste the callback URL or code'
1016
+ }, {
1017
+ title: 'Cancel',
1018
+ value: 'cancel'
1019
+ }],
1020
+ onSelect: option => {
1021
+ if (option.value === 'cancel') {
1022
+ buildL1();
1023
+ return;
996
1024
  }
997
- openOAuthUrlScreen(oauthUrl);
998
- return;
1025
+ if (option.value === 'copy') {
1026
+ const ok = api.renderer.copyToClipboardOSC52(oauthUrl);
1027
+ if (ok) {
1028
+ api.ui.toast({
1029
+ message: 'URL copied to clipboard'
1030
+ });
1031
+ } else {
1032
+ api.ui.toast({
1033
+ message: 'Copy unavailable \u2014 select the URL text above to copy'
1034
+ });
1035
+ }
1036
+ openOAuthUrlScreen(oauthUrl);
1037
+ return;
1038
+ }
1039
+ openOAuthCodePrompt(oauthUrl);
999
1040
  }
1000
- openOAuthCodePrompt(oauthUrl);
1001
- }
1002
- }));
1041
+ }), null);
1042
+ return _el$26;
1043
+ })());
1003
1044
  };
1004
1045
  const openOAuthCodePrompt = oauthUrl => {
1005
1046
  const DialogPrompt = api.ui.DialogPrompt;
@@ -1007,9 +1048,9 @@ export function openCommandDialog(api, payload, apply) {
1007
1048
  api.ui.dialog.replace(() => _$createComponent(DialogPrompt, {
1008
1049
  title: "OAuth sign-in \\u2014 enter code",
1009
1050
  description: () => (() => {
1010
- var _el$25 = _$createElement("text");
1011
- _$insertNode(_el$25, _$createTextNode(`After signing in you will be redirected. Paste the full callback URL or authorization code below.`));
1012
- return _el$25;
1051
+ var _el$27 = _$createElement("text");
1052
+ _$insertNode(_el$27, _$createTextNode(`After signing in you will be redirected. Paste the full callback URL or authorization code below.`));
1053
+ return _el$27;
1013
1054
  })(),
1014
1055
  placeholder: "Paste callback URL or code here",
1015
1056
  value: "",
@@ -1030,9 +1071,9 @@ export function openCommandDialog(api, payload, apply) {
1030
1071
  api.ui.dialog.replace(() => _$createComponent(DialogPrompt, {
1031
1072
  title: "OAuth sign-in \\u2014 label",
1032
1073
  description: () => (() => {
1033
- var _el$27 = _$createElement("text");
1034
- _$insertNode(_el$27, _$createTextNode(`A short name for this account (optional).`));
1035
- return _el$27;
1074
+ var _el$29 = _$createElement("text");
1075
+ _$insertNode(_el$29, _$createTextNode(`A short name for this account (optional).`));
1076
+ return _el$29;
1036
1077
  })(),
1037
1078
  placeholder: "e.g. work",
1038
1079
  value: "",
@@ -0,0 +1,105 @@
1
+ import { createComponent as _$createComponent } from "opentui:runtime-module:%40opentui%2Fsolid";
2
+ import { effect as _$effect } from "opentui:runtime-module:%40opentui%2Fsolid";
3
+ import { insertNode as _$insertNode } from "opentui:runtime-module:%40opentui%2Fsolid";
4
+ import { insert as _$insert } from "opentui:runtime-module:%40opentui%2Fsolid";
5
+ import { memo as _$memo } from "opentui:runtime-module:%40opentui%2Fsolid";
6
+ import { setProp as _$setProp } from "opentui:runtime-module:%40opentui%2Fsolid";
7
+ import { createElement as _$createElement } from "opentui:runtime-module:%40opentui%2Fsolid";
8
+ /** @jsxImportSource @opentui/solid */
9
+
10
+ // The OAuth sign-in link dialog, shared by the OpenCode 1 and OpenCode 2 TUIs.
11
+ // The link is drawn as its own text block with nothing beside it, so however
12
+ // narrow the dialog is, the rows it wraps onto hold only link characters and
13
+ // selecting those rows copies the whole link. The dialog stays open until the
14
+ // person closes it.
15
+
16
+ /** Optional text colors; without them the host's default text color is used. */
17
+
18
+ export const SIGN_IN_LINK_TITLE = 'Claude sign-in';
19
+ export const SIGN_IN_LINK_INSTRUCTIONS = 'Open this link in your browser and sign in. Then choose Finish OAuth sign-in in the Accounts menu and paste the code Claude shows you.';
20
+
21
+ /** The sign-in instructions and the link, without any dialog chrome. */
22
+ export function SignInLink(props) {
23
+ return (() => {
24
+ var _el$ = _$createElement("box"),
25
+ _el$2 = _$createElement("text"),
26
+ _el$3 = _$createElement("box"),
27
+ _el$4 = _$createElement("text");
28
+ _$insertNode(_el$, _el$2);
29
+ _$insertNode(_el$, _el$3);
30
+ _$setProp(_el$, "flexDirection", 'column');
31
+ _$setProp(_el$, "paddingLeft", 2);
32
+ _$setProp(_el$, "paddingRight", 2);
33
+ _$insert(_el$, (() => {
34
+ var _c$ = _$memo(() => !!props.title);
35
+ return () => _c$() ? (() => {
36
+ var _el$5 = _$createElement("box"),
37
+ _el$6 = _$createElement("text");
38
+ _$insertNode(_el$5, _el$6);
39
+ _$setProp(_el$5, "paddingBottom", 1);
40
+ _$insert(_el$6, () => props.title);
41
+ _$effect(_$p => _$setProp(_el$6, "fg", props.colors?.text, _$p));
42
+ return _el$5;
43
+ })() : null;
44
+ })(), _el$2);
45
+ _$insert(_el$2, () => props.instructions ?? SIGN_IN_LINK_INSTRUCTIONS);
46
+ _$insertNode(_el$3, _el$4);
47
+ _$setProp(_el$3, "paddingTop", 1);
48
+ _$setProp(_el$3, "paddingBottom", 1);
49
+ _$setProp(_el$4, "wrapMode", 'char');
50
+ _$insert(_el$4, () => props.url);
51
+ _$insert(_el$, (() => {
52
+ var _c$2 = _$memo(() => !!props.footer);
53
+ return () => _c$2() ? (() => {
54
+ var _el$7 = _$createElement("text");
55
+ _$insert(_el$7, () => props.footer);
56
+ _$effect(_$p => _$setProp(_el$7, "fg", props.colors?.muted, _$p));
57
+ return _el$7;
58
+ })() : null;
59
+ })(), null);
60
+ _$effect(_p$ => {
61
+ var _v$ = props.colors?.muted,
62
+ _v$2 = props.colors?.link;
63
+ _v$ !== _p$.e && (_p$.e = _$setProp(_el$2, "fg", _v$, _p$.e));
64
+ _v$2 !== _p$.t && (_p$.t = _$setProp(_el$4, "fg", _v$2, _p$.t));
65
+ return _p$;
66
+ }, {
67
+ e: undefined,
68
+ t: undefined
69
+ });
70
+ return _el$;
71
+ })();
72
+ }
73
+
74
+ // --- OpenCode 2 -------------------------------------------------------------
75
+
76
+ /** The OpenCode 2 TUI context members the sign-in dialog uses. */
77
+
78
+ /**
79
+ * Shows the sign-in link in an OpenCode 2 dialog. The returned promise
80
+ * settles when the person closes the dialog, or when `signal` aborts.
81
+ */
82
+ export function showSignInLinkDialog(host, url, signal) {
83
+ return new Promise(resolve => {
84
+ if (signal?.aborted) return resolve();
85
+ signal?.addEventListener('abort', () => resolve(), {
86
+ once: true
87
+ });
88
+ host.ui.dialog.show(() => _$createComponent(SignInLink, {
89
+ url: url,
90
+ title: SIGN_IN_LINK_TITLE,
91
+ get colors() {
92
+ return {
93
+ text: host.theme.text.base,
94
+ muted: host.theme.text.muted,
95
+ link: host.theme.text.action.primary.base
96
+ };
97
+ },
98
+ footer: "Press Esc to close."
99
+ }), () => resolve());
100
+ // The widest dialog wraps the link onto the fewest rows.
101
+ host.ui.dialog.set({
102
+ size: 'xlarge'
103
+ });
104
+ });
105
+ }
@@ -1,2 +0,0 @@
1
- import{I as $}from"./index-xbwa4x53.js";var D=(f)=>f!==null&&typeof f==="object"&&!Array.isArray(f),F=(f)=>D(f)&&typeof f.sessionId==="string"&&f.sessionId.length>0,A=(f)=>{if(!F(f)||!D(f)||f.command!=="claude"||typeof f.sectionId!=="string"||typeof f.actionId!=="string")return!1;if(f.itemId!==void 0&&typeof f.itemId!=="string")return!1;if(f.confirmed!==void 0&&typeof f.confirmed!=="boolean")return!1;if(f.values!==void 0&&(!D(f.values)||!Object.values(f.values).every((q)=>q===null||typeof q==="string"||typeof q==="boolean"||typeof q==="number"&&Number.isFinite(q))))return!1;return!0};function B(f){return{"~standard":{version:1,vendor:"cortexkit-native",validate:(q)=>f(q)?{value:q}:{issues:[{message:"Invalid native menu payload"}]}}}}var Z=(f)=>D(f)&&f.command==="claude"&&D(f.menu)&&f.menu.command==="claude"&&typeof f.menu.title==="string"&&Array.isArray(f.menu.sections),L=(f)=>D(f)&&f.command==="claude"&&typeof f.ok==="boolean"&&typeof f.text==="string"&&D(f.menu)&&Array.isArray(f.menu.sections),M={"~standard":{version:1,vendor:"cortexkit-native",validate:(f)=>({value:$(f)})}},P={id:"cortexkit-anthropic-native",methods:{open:{input:B(F),output:B(Z)},apply:{input:B(A),output:B(L)},sidebar:{input:B(F),output:M}},events:{opened:{schema:B((f)=>F(f)&&Z(f.payload))},notification:{schema:B((f)=>F(f)&&typeof f.message==="string"&&["info","warning","error"].includes(String(f.kind)))}}};async function U(f,q,Q){let W=new AbortController,J=(j)=>({sessionId:j,notify(H,K="info"){G.events.emit("notification",{sessionId:j,message:H,kind:K}).catch(()=>{})}}),G=await f.rpc.register(P,{open:(j)=>q.open(J(j.sessionId)),apply:(j)=>q.apply(j,J(j.sessionId)),sidebar:(j)=>Q.readSidebar(j.sessionId)}),X;try{X=await f.command.transform((j)=>j.add({name:"claude",description:"Native Claude accounts and settings",async execute(H){let K=await q.open(J(H.sessionID));await G.events.emit("opened",{sessionId:H.sessionID,payload:K})}}))}catch(j){throw await G.dispose(),j}let z=(async()=>{try{for await(let j of f.event.subscribe({signal:W.signal}))if(j.type==="session.deleted")Q.forgetSession(j.data.sessionID)}catch{}})(),Y=!1;return{async dispose(){if(Y)return;Y=!0,W.abort(),await Promise.all([G.dispose(),X.dispose(),z])}}}
2
- export{P as t,U as u};