@ottocode/web-sdk 0.1.311 → 0.1.312

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.
@@ -9,6 +9,7 @@ export declare const xaiLogo = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 40
9
9
  export declare const zaiLogo = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 40 40\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M20.1312 7.50002L17.4088 11.1913H5.81625L8.5375 7.50002H20.1325H20.1312ZM34.0675 28.81L31.3475 32.5H19.795L22.5125 28.81H34.0675ZM35 7.50002L16.58 32.5H5L23.42 7.50002H35Z\" fill=\"currentColor\"/>\n</svg>";
10
10
  export declare const ottorouterLogo = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 100 100\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M55.0151 11H45.7732C42.9871 11 41.594 11 40.5458 11.7564C39.4977 12.5128 39.0587 13.8349 38.1807 16.479L28.4934 45.6545C26.899 50.4561 26.1019 52.8569 27.2993 54.5162C28.4967 56.1754 31.0264 56.1754 36.0858 56.1754H38.1307C41.9554 56.1754 43.8677 56.1754 45.0206 57.2527C45.2855 57.5002 45.5155 57.7825 45.7043 58.092C46.5262 59.4389 46.1395 61.3117 45.3662 65.0574C42.291 79.9519 40.7534 87.3991 43.0079 88.8933C43.4871 89.2109 44.0292 89.4215 44.5971 89.5107C47.2691 89.9303 51.1621 83.398 58.9481 70.3336L70.7118 50.5949C72.8831 46.9517 73.9687 45.13 73.6853 43.639C73.5201 42.7697 73.0712 41.9797 72.4091 41.3927C71.2734 40.386 69.1528 40.386 64.9115 40.386C61.2258 40.386 59.3829 40.386 58.2863 39.5068C57.6438 38.9916 57.176 38.2907 56.9467 37.4998C56.5553 36.1498 57.2621 34.4479 58.6757 31.044L62.4033 22.0683C64.4825 17.0618 65.5221 14.5585 64.3345 12.7793C63.1468 11 60.4362 11 55.0151 11Z\" fill=\"currentColor\"/>\n</svg>";
11
11
  export declare const minimaxLogo = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 40 40\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M6 32V12L13 22L20 12V32H17V20L13 26L9 20V32H6ZM22 32V12L29 22L36 12V32H33V20L29 26L25 20V32H22Z\" fill=\"currentColor\"/>\n</svg>";
12
+ export declare const kimiLogo = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z\" fill=\"currentColor\"/>\n<path d=\"M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z\" fill=\"currentColor\"/>\n</svg>";
12
13
  export declare const opencodeLogo = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n<path opacity=\"0.2\" d=\"M19.2002 17.4H8.40017V13.8H15.6002V10.2H19.2002V17.4ZM8.40017 13.8H4.80017V10.2H8.40017V13.8Z\" fill=\"currentColor\"/>\n<path d=\"M8.40005 17.4H19.2001V21H4.80005V13.8H8.40005V17.4ZM15.6001 10.2V13.8H8.40005V10.2H15.6001ZM19.2001 10.2H15.6001V6.6H4.80005V3H19.2001V10.2Z\" fill=\"currentColor\"/>\n</svg>";
13
14
  export declare const copilotLogo = "<svg width=\"24\" height=\"24\" viewBox=\"0 0 40 40\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M35.3993 26.4544C34.2871 28.3855 27.8314 32.9425 20 32.9425C12.1686 32.9425 5.71288 28.3855 4.60075 26.4544C4.5427 26.3532 4.50826 26.2401 4.5 26.1237V22.418C4.51199 22.3209 4.53496 22.2256 4.56846 22.1338C5.04896 20.9261 6.30833 19.1733 7.93325 18.7031C8.14896 18.149 8.468 17.3404 8.76508 16.7437C8.71727 16.2776 8.69485 15.8094 8.69792 15.3409C8.69792 13.6217 9.06217 12.113 10.1601 10.9906C10.6729 10.4662 11.3097 10.0644 12.064 9.76091C13.871 8.29357 16.4453 7.05745 19.9716 7.05745C23.4978 7.05745 26.129 8.29357 27.936 9.76091C28.6903 10.0644 29.3271 10.4662 29.8399 10.9906C30.9378 12.113 31.3021 13.6217 31.3021 15.3409C31.3021 15.8162 31.284 16.2877 31.2349 16.7437C31.532 17.3404 31.851 18.149 32.0667 18.7031C33.6917 19.1733 34.951 20.9261 35.4315 22.1338C35.4677 22.2248 35.4908 22.3205 35.5 22.418V26.1237C35.4917 26.2401 35.4573 26.3532 35.3993 26.4544ZM20.2222 18.7147H19.7778C19.6422 18.945 19.4889 19.1644 19.3193 19.3709C18.3247 20.5941 16.8419 21.2981 14.7881 21.2981C12.56 21.2981 10.9273 20.8344 9.90304 19.6719C9.86495 19.6283 9.82833 19.5835 9.79325 19.5375L9.66667 19.6719V28.1775C11.5202 29.1837 15.4972 30.992 20 30.992C24.5028 30.992 28.4798 29.1837 30.3333 28.1775V19.6719L30.2067 19.5375C30.2067 19.5375 30.1641 19.5957 30.097 19.6719C29.0727 20.8344 27.44 21.2981 25.2119 21.2981C23.1581 21.2981 21.6753 20.5941 20.6807 19.3709C20.5111 19.1644 20.3578 18.945 20.2222 18.7147ZM23.2292 22.9127C23.9383 22.9127 24.5208 23.4952 24.5208 24.2043V26.7877C24.5208 27.4968 23.9383 28.0793 23.2292 28.0793C22.52 28.0793 21.9375 27.4968 21.9375 26.7877V24.2043C21.9375 23.4952 22.52 22.9127 23.2292 22.9127ZM16.7708 22.9127C17.48 22.9127 18.0625 23.4952 18.0625 24.2043V26.7877C18.0625 27.4968 17.48 28.0793 16.7708 28.0793C16.0617 28.0793 15.4792 27.4968 15.4792 26.7877V24.2043C15.4792 23.4952 16.0617 22.9127 16.7708 22.9127ZM21.0501 14.9237C21.2258 16.289 21.5707 17.3947 22.1842 18.149C22.7551 18.8517 23.649 19.3606 25.2119 19.3606C27.2437 19.3606 28.1724 18.9253 28.6438 18.3905C29.1398 17.8287 29.3646 16.9051 29.3646 15.3409C29.3646 13.8684 29.0507 12.9552 28.454 12.3455C27.8378 11.7152 26.7502 11.2321 24.8063 11.0216C22.8856 10.8136 21.975 11.1998 21.5345 11.7049C21.187 12.1014 20.97 12.7485 20.9688 13.7431V13.7702C20.9688 14.1121 20.9959 14.4966 21.0501 14.9237ZM18.9499 14.9237C19.0041 14.4966 19.0312 14.1117 19.0312 13.7689V13.7431C19.03 12.7485 18.813 12.1014 18.4655 11.7049C18.025 11.1998 17.1144 10.8136 15.1937 11.0216C13.2498 11.2321 12.1622 11.7152 11.546 12.3455C10.9493 12.9552 10.6354 13.8684 10.6354 15.3409C10.6354 16.9051 10.8615 17.8287 11.3562 18.3905C11.8276 18.9253 12.7563 19.3606 14.7881 19.3606C16.351 19.3606 17.2449 18.8517 17.8158 18.149C18.4293 17.3947 18.7742 16.289 18.9499 14.9237Z\" fill=\"currentColor\"/>\n</svg>";
14
15
  //# sourceMappingURL=provider-logos.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider-logos.d.ts","sourceRoot":"","sources":["../../src/assets/provider-logos.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,sXAEnB,CAAC;AAER,eAAO,MAAM,UAAU,ioHAEhB,CAAC;AAER,eAAO,MAAM,UAAU,+VAEhB,CAAC;AAER,eAAO,MAAM,eAAe,2lLAMrB,CAAC;AAER,eAAO,MAAM,cAAc,yrCAOpB,CAAC;AAER,eAAO,MAAM,QAAQ,0rBAEd,CAAC;AAER,eAAO,MAAM,YAAY,y2HAElB,CAAC;AAER,eAAO,MAAM,OAAO,8XAEb,CAAC;AAER,eAAO,MAAM,OAAO,yTAEb,CAAC;AAER,eAAO,MAAM,cAAc,iiCAEpB,CAAC;AAER,eAAO,MAAM,WAAW,6OAEjB,CAAC;AAER,eAAO,MAAM,YAAY,2bAGlB,CAAC;AAER,eAAO,MAAM,WAAW,w0FAEjB,CAAC"}
1
+ {"version":3,"file":"provider-logos.d.ts","sourceRoot":"","sources":["../../src/assets/provider-logos.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,sXAEnB,CAAC;AAER,eAAO,MAAM,UAAU,ioHAEhB,CAAC;AAER,eAAO,MAAM,UAAU,+VAEhB,CAAC;AAER,eAAO,MAAM,eAAe,2lLAMrB,CAAC;AAER,eAAO,MAAM,cAAc,yrCAOpB,CAAC;AAER,eAAO,MAAM,QAAQ,0rBAEd,CAAC;AAER,eAAO,MAAM,YAAY,y2HAElB,CAAC;AAER,eAAO,MAAM,OAAO,8XAEb,CAAC;AAER,eAAO,MAAM,OAAO,yTAEb,CAAC;AAER,eAAO,MAAM,cAAc,iiCAEpB,CAAC;AAER,eAAO,MAAM,WAAW,6OAEjB,CAAC;AAER,eAAO,MAAM,QAAQ,4uBAGd,CAAC;AAER,eAAO,MAAM,YAAY,2bAGlB,CAAC;AAER,eAAO,MAAM,WAAW,w0FAEjB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ProviderLogo.d.ts","sourceRoot":"","sources":["../../../src/components/common/ProviderLogo.tsx"],"names":[],"mappings":"AAoCA,UAAU,iBAAiB;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,YAAY,yDAoCvB,CAAC"}
1
+ {"version":3,"file":"ProviderLogo.d.ts","sourceRoot":"","sources":["../../../src/components/common/ProviderLogo.tsx"],"names":[],"mappings":"AAuCA,UAAU,iBAAiB;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,YAAY,yDAoCvB,CAAC"}
@@ -2520,6 +2520,8 @@ import {
2520
2520
  pollOpenAiDeviceFlow as apiPollOpenAiDeviceFlow,
2521
2521
  startCopilotDeviceFlow as apiStartCopilotDeviceFlow,
2522
2522
  pollCopilotDeviceFlow as apiPollCopilotDeviceFlow,
2523
+ startKimiDeviceFlow as apiStartKimiDeviceFlow,
2524
+ pollKimiDeviceFlow as apiPollKimiDeviceFlow,
2523
2525
  getCopilotAuthMethods as apiGetCopilotAuthMethods,
2524
2526
  saveCopilotToken as apiSaveCopilotToken,
2525
2527
  importCopilotTokenFromGh as apiImportCopilotTokenFromGh,
@@ -2626,6 +2628,20 @@ var authMixin = {
2626
2628
  throw new Error(extractErrorMessage(response.error));
2627
2629
  return response.data;
2628
2630
  },
2631
+ async startKimiDeviceFlow() {
2632
+ const response = await apiStartKimiDeviceFlow();
2633
+ if (response.error)
2634
+ throw new Error(extractErrorMessage(response.error));
2635
+ return response.data;
2636
+ },
2637
+ async pollKimiDeviceFlow(sessionId) {
2638
+ const response = await apiPollKimiDeviceFlow({
2639
+ body: { sessionId }
2640
+ });
2641
+ if (response.error)
2642
+ throw new Error(extractErrorMessage(response.error));
2643
+ return response.data;
2644
+ },
2629
2645
  async getCopilotAuthMethods() {
2630
2646
  const response = await apiGetCopilotAuthMethods();
2631
2647
  if (response.error)
@@ -2938,6 +2954,8 @@ class ApiClient {
2938
2954
  pollOpenAIDeviceFlow = authMixin.pollOpenAIDeviceFlow;
2939
2955
  startCopilotDeviceFlow = authMixin.startCopilotDeviceFlow;
2940
2956
  pollCopilotDeviceFlow = authMixin.pollCopilotDeviceFlow;
2957
+ startKimiDeviceFlow = authMixin.startKimiDeviceFlow;
2958
+ pollKimiDeviceFlow = authMixin.pollKimiDeviceFlow;
2941
2959
  getCopilotAuthMethods = authMixin.getCopilotAuthMethods;
2942
2960
  saveCopilotToken = authMixin.saveCopilotToken;
2943
2961
  importCopilotTokenFromGh = authMixin.importCopilotTokenFromGh;
@@ -3924,6 +3942,10 @@ var ottorouterLogo = `<svg width="24" height="24" viewBox="0 0 100 100" fill="no
3924
3942
  var minimaxLogo = `<svg width="24" height="24" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg">
3925
3943
  <path d="M6 32V12L13 22L20 12V32H17V20L13 26L9 20V32H6ZM22 32V12L29 22L36 12V32H33V20L29 26L25 20V32H22Z" fill="currentColor"/>
3926
3944
  </svg>`;
3945
+ var kimiLogo = `<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
3946
+ <path d="M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z" fill="currentColor"/>
3947
+ <path d="M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z" fill="currentColor"/>
3948
+ </svg>`;
3927
3949
  var opencodeLogo = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
3928
3950
  <path opacity="0.2" d="M19.2002 17.4H8.40017V13.8H15.6002V10.2H19.2002V17.4ZM8.40017 13.8H4.80017V10.2H8.40017V13.8Z" fill="currentColor"/>
3929
3951
  <path d="M8.40005 17.4H19.2001V21H4.80005V13.8H8.40005V17.4ZM15.6001 10.2V13.8H8.40005V10.2H15.6001ZM19.2001 10.2H15.6001V6.6H4.80005V3H19.2001V10.2Z" fill="currentColor"/>
@@ -3948,6 +3970,8 @@ var providerLogos = {
3948
3970
  "zai-coding": zaiLogo,
3949
3971
  ottorouter: ottorouterLogo,
3950
3972
  minimax: minimaxLogo,
3973
+ moonshot: kimiLogo,
3974
+ kimi: kimiLogo,
3951
3975
  opencode: opencodeLogo,
3952
3976
  copilot: copilotLogo
3953
3977
  };
@@ -32613,6 +32637,13 @@ function useAuthStatus() {
32613
32637
  }
32614
32638
  return result;
32615
32639
  }, [fetchAuthStatus]);
32640
+ const pollKimiDeviceFlow = useCallback42(async (sessionId) => {
32641
+ const result = await apiClient.pollKimiDeviceFlow(sessionId);
32642
+ if (result.status === "complete") {
32643
+ await fetchAuthStatus();
32644
+ }
32645
+ return result;
32646
+ }, [fetchAuthStatus]);
32616
32647
  const saveCopilotToken = useCallback42(async (token) => {
32617
32648
  setLoading(true);
32618
32649
  setError(null);
@@ -32662,6 +32693,8 @@ function useAuthStatus() {
32662
32693
  pollOpenAIDeviceFlow,
32663
32694
  startCopilotDeviceFlow: apiClient.startCopilotDeviceFlow.bind(apiClient),
32664
32695
  pollCopilotDeviceFlow,
32696
+ startKimiDeviceFlow: apiClient.startKimiDeviceFlow.bind(apiClient),
32697
+ pollKimiDeviceFlow,
32665
32698
  getCopilotAuthMethods: apiClient.getCopilotAuthMethods.bind(apiClient),
32666
32699
  saveCopilotToken,
32667
32700
  importCopilotTokenFromGh,
@@ -41329,6 +41362,8 @@ var ProviderSetupStep = memo75(function ProviderSetupStep2({
41329
41362
  hideHeader = false,
41330
41363
  onStartCopilotDeviceFlow,
41331
41364
  onPollCopilotDeviceFlow,
41365
+ onStartKimiDeviceFlow,
41366
+ onPollKimiDeviceFlow,
41332
41367
  onGetCopilotAuthMethods,
41333
41368
  onSaveCopilotToken,
41334
41369
  onImportCopilotTokenFromGh,
@@ -41380,6 +41415,12 @@ var ProviderSetupStep = memo75(function ProviderSetupStep2({
41380
41415
  const [copilotCodeCopied, setCopilotCodeCopied] = useState69(false);
41381
41416
  const [copilotModalOpen, setCopilotModalOpen] = useState69(false);
41382
41417
  const [copilotLoading, setCopilotLoading] = useState69(false);
41418
+ const [kimiDevice, setKimiDevice] = useState69(null);
41419
+ const [kimiPolling, setKimiPolling] = useState69(false);
41420
+ const [kimiError, setKimiError] = useState69(null);
41421
+ const [kimiCodeCopied, setKimiCodeCopied] = useState69(false);
41422
+ const [kimiModalOpen, setKimiModalOpen] = useState69(false);
41423
+ const [kimiLoading, setKimiLoading] = useState69(false);
41383
41424
  const copilotPollRef = useRef49(undefined);
41384
41425
  const copilotCancelledRef = useRef49(false);
41385
41426
  const copilotPollFnRef = useRef49(onPollCopilotDeviceFlow);
@@ -41388,6 +41429,10 @@ var ProviderSetupStep = memo75(function ProviderSetupStep2({
41388
41429
  const openAICancelledRef = useRef49(false);
41389
41430
  const openAIPollFnRef = useRef49(onPollOpenAIDeviceFlow);
41390
41431
  openAIPollFnRef.current = onPollOpenAIDeviceFlow;
41432
+ const kimiPollRef = useRef49(undefined);
41433
+ const kimiCancelledRef = useRef49(false);
41434
+ const kimiPollFnRef = useRef49(onPollKimiDeviceFlow);
41435
+ kimiPollFnRef.current = onPollKimiDeviceFlow;
41391
41436
  const balance = useOttoRouterStore((s) => s.balance);
41392
41437
  const usdcBalance = useOttoRouterStore((s) => s.usdcBalance);
41393
41438
  const payg = useOttoRouterStore((s) => s.payg);
@@ -41518,6 +41563,51 @@ var ProviderSetupStep = memo75(function ProviderSetupStep2({
41518
41563
  clearTimeout(timeout);
41519
41564
  };
41520
41565
  }, [openAIPolling, openAIDevice]);
41566
+ useEffect71(() => {
41567
+ if (!kimiPolling || !kimiDevice || !kimiPollFnRef.current)
41568
+ return;
41569
+ kimiCancelledRef.current = false;
41570
+ const pollIntervalMs = Math.max((kimiDevice.interval || 5) * 1000 + 2000, 7000);
41571
+ const schedulePoll = () => {
41572
+ kimiPollRef.current = setTimeout(async () => {
41573
+ if (kimiCancelledRef.current)
41574
+ return;
41575
+ try {
41576
+ const pollFn = kimiPollFnRef.current;
41577
+ if (!pollFn)
41578
+ return;
41579
+ const result = await pollFn(kimiDevice.sessionId);
41580
+ if (kimiCancelledRef.current)
41581
+ return;
41582
+ if (result.status === "complete") {
41583
+ setKimiDevice(null);
41584
+ setKimiPolling(false);
41585
+ setKimiError(null);
41586
+ setKimiModalOpen(false);
41587
+ } else if (result.status === "error") {
41588
+ setKimiError(result.error || "Authorization failed");
41589
+ setKimiPolling(false);
41590
+ } else {
41591
+ schedulePoll();
41592
+ }
41593
+ } catch {
41594
+ if (!kimiCancelledRef.current)
41595
+ schedulePoll();
41596
+ }
41597
+ }, pollIntervalMs);
41598
+ };
41599
+ schedulePoll();
41600
+ const timeout = setTimeout(() => {
41601
+ setKimiPolling(false);
41602
+ setKimiError("Authorization timed out. Please try again.");
41603
+ }, 15 * 60 * 1000);
41604
+ return () => {
41605
+ kimiCancelledRef.current = true;
41606
+ if (kimiPollRef.current)
41607
+ clearTimeout(kimiPollRef.current);
41608
+ clearTimeout(timeout);
41609
+ };
41610
+ }, [kimiPolling, kimiDevice]);
41521
41611
  const handleCopy = async () => {
41522
41612
  if (authStatus.ottorouter.publicKey) {
41523
41613
  await navigator.clipboard.writeText(authStatus.ottorouter.publicKey);
@@ -41654,6 +41744,19 @@ var ProviderSetupStep = memo75(function ProviderSetupStep2({
41654
41744
  setOpenAILoading(false);
41655
41745
  });
41656
41746
  };
41747
+ const startKimiDeviceAuthorization = () => {
41748
+ if (!onStartKimiDeviceFlow)
41749
+ return;
41750
+ setKimiLoading(true);
41751
+ setKimiError(null);
41752
+ onStartKimiDeviceFlow().then((data) => {
41753
+ setKimiDevice(data);
41754
+ setKimiLoading(false);
41755
+ }).catch((err) => {
41756
+ setKimiError(err instanceof Error ? err.message : "Failed to start device flow");
41757
+ setKimiLoading(false);
41758
+ });
41759
+ };
41657
41760
  const handleStartOAuth = async (providerId, mode) => {
41658
41761
  if (providerId === "anthropic") {
41659
41762
  setOauthSession({ provider: providerId, sessionId: null, mode });
@@ -41664,6 +41767,13 @@ var ProviderSetupStep = memo75(function ProviderSetupStep2({
41664
41767
  setOpenAICodeCopied(false);
41665
41768
  setOpenAIAuthMode("choice");
41666
41769
  setOpenAIModalOpen(true);
41770
+ } else if (providerId === "moonshot" && onStartKimiDeviceFlow) {
41771
+ setKimiPolling(false);
41772
+ setKimiDevice(null);
41773
+ setKimiError(null);
41774
+ setKimiCodeCopied(false);
41775
+ setKimiModalOpen(true);
41776
+ startKimiDeviceAuthorization();
41667
41777
  } else if (providerId === "copilot") {
41668
41778
  setCopilotAuthMode("oauth");
41669
41779
  setCopilotTokenInput("");
@@ -41746,6 +41856,32 @@ var ProviderSetupStep = memo75(function ProviderSetupStep2({
41746
41856
  openAIPollRef.current = undefined;
41747
41857
  }
41748
41858
  };
41859
+ const handleKimiOpenAuth = () => {
41860
+ if (!kimiDevice)
41861
+ return;
41862
+ openUrl(kimiDevice.verificationUri);
41863
+ setKimiPolling(true);
41864
+ };
41865
+ const handleKimiCopyCode = async () => {
41866
+ if (!kimiDevice)
41867
+ return;
41868
+ await navigator.clipboard.writeText(kimiDevice.userCode);
41869
+ setKimiCodeCopied(true);
41870
+ setTimeout(() => setKimiCodeCopied(false), 2000);
41871
+ };
41872
+ const handleCancelKimi = () => {
41873
+ setKimiDevice(null);
41874
+ setKimiPolling(false);
41875
+ setKimiError(null);
41876
+ setKimiCodeCopied(false);
41877
+ setKimiModalOpen(false);
41878
+ setKimiLoading(false);
41879
+ kimiCancelledRef.current = true;
41880
+ if (kimiPollRef.current) {
41881
+ clearTimeout(kimiPollRef.current);
41882
+ kimiPollRef.current = undefined;
41883
+ }
41884
+ };
41749
41885
  const handleCopilotOpenGithub = () => {
41750
41886
  if (!copilotDevice)
41751
41887
  return;
@@ -41890,6 +42026,23 @@ var ProviderSetupStep = memo75(function ProviderSetupStep2({
41890
42026
  }
41891
42027
  return;
41892
42028
  }
42029
+ if (kimiModalOpen) {
42030
+ markHandled();
42031
+ if (!kimiLoading) {
42032
+ setKimiDevice(null);
42033
+ setKimiPolling(false);
42034
+ setKimiError(null);
42035
+ setKimiCodeCopied(false);
42036
+ setKimiModalOpen(false);
42037
+ setKimiLoading(false);
42038
+ kimiCancelledRef.current = true;
42039
+ if (kimiPollRef.current) {
42040
+ clearTimeout(kimiPollRef.current);
42041
+ kimiPollRef.current = undefined;
42042
+ }
42043
+ }
42044
+ return;
42045
+ }
41893
42046
  if (addingProvider) {
41894
42047
  markHandled();
41895
42048
  setAddingProvider(null);
@@ -41916,6 +42069,8 @@ var ProviderSetupStep = memo75(function ProviderSetupStep2({
41916
42069
  isImportingWallet,
41917
42070
  isImportModalOpen,
41918
42071
  isOpeningPopup,
42072
+ kimiLoading,
42073
+ kimiModalOpen,
41919
42074
  oauthSession
41920
42075
  ]);
41921
42076
  const handleImportWallet = async () => {
@@ -43007,6 +43162,103 @@ var ProviderSetupStep = memo75(function ProviderSetupStep2({
43007
43162
  ]
43008
43163
  })
43009
43164
  }),
43165
+ kimiModalOpen && /* @__PURE__ */ jsx154("div", {
43166
+ "data-otto-nested-modal": "true",
43167
+ className: "fixed inset-0 z-[9999] flex items-center justify-center bg-black/60 backdrop-blur-sm",
43168
+ children: /* @__PURE__ */ jsxs134("div", {
43169
+ className: "bg-background border border-border rounded-xl w-full max-w-lg mx-6 shadow-2xl",
43170
+ children: [
43171
+ /* @__PURE__ */ jsxs134("div", {
43172
+ className: "flex items-center gap-3 p-6 border-b border-border",
43173
+ children: [
43174
+ /* @__PURE__ */ jsx154(ProviderLogo, {
43175
+ provider: "moonshot",
43176
+ size: 24
43177
+ }),
43178
+ /* @__PURE__ */ jsx154("h3", {
43179
+ className: "text-lg font-semibold",
43180
+ children: "Connect Kimi"
43181
+ })
43182
+ ]
43183
+ }),
43184
+ /* @__PURE__ */ jsxs134("div", {
43185
+ className: "p-6 space-y-4",
43186
+ children: [
43187
+ /* @__PURE__ */ jsx154("p", {
43188
+ className: "text-sm text-muted-foreground",
43189
+ children: "Open the Kimi sign-in page, then enter this one-time code. This works from remote browsers, tunnels, and SSH sessions."
43190
+ }),
43191
+ /* @__PURE__ */ jsx154("div", {
43192
+ className: "flex items-center justify-center gap-3",
43193
+ children: kimiLoading ? /* @__PURE__ */ jsx154("div", {
43194
+ className: "bg-muted px-6 py-3 rounded-lg animate-pulse",
43195
+ children: /* @__PURE__ */ jsx154("div", {
43196
+ className: "h-9 w-48 bg-muted-foreground/20 rounded"
43197
+ })
43198
+ }) : kimiDevice ? /* @__PURE__ */ jsxs134(Fragment60, {
43199
+ children: [
43200
+ /* @__PURE__ */ jsx154("code", {
43201
+ className: "text-3xl font-mono font-bold tracking-widest text-foreground bg-muted px-6 py-3 rounded-lg select-all",
43202
+ children: kimiDevice.userCode
43203
+ }),
43204
+ /* @__PURE__ */ jsx154("button", {
43205
+ type: "button",
43206
+ onClick: handleKimiCopyCode,
43207
+ className: "p-2 text-muted-foreground hover:text-foreground transition-colors",
43208
+ children: kimiCodeCopied ? /* @__PURE__ */ jsx154(Check17, {
43209
+ className: "w-5 h-5 text-green-500"
43210
+ }) : /* @__PURE__ */ jsx154(Copy5, {
43211
+ className: "w-5 h-5"
43212
+ })
43213
+ })
43214
+ ]
43215
+ }) : null
43216
+ }),
43217
+ kimiError && /* @__PURE__ */ jsx154("p", {
43218
+ className: "text-sm text-red-500 text-center",
43219
+ children: kimiError
43220
+ }),
43221
+ kimiPolling && /* @__PURE__ */ jsxs134("div", {
43222
+ className: "flex items-center justify-center gap-2 text-sm text-muted-foreground",
43223
+ children: [
43224
+ /* @__PURE__ */ jsx154(StableSpinner, {
43225
+ title: "Waiting for Kimi authorization"
43226
+ }),
43227
+ "Waiting for authorization..."
43228
+ ]
43229
+ }),
43230
+ /* @__PURE__ */ jsxs134("div", {
43231
+ className: "flex gap-3",
43232
+ children: [
43233
+ /* @__PURE__ */ jsx154("button", {
43234
+ type: "button",
43235
+ onClick: handleCancelKimi,
43236
+ className: "flex-1 h-11 px-4 bg-transparent border border-border text-foreground rounded-lg font-medium hover:bg-muted/50 transition-colors",
43237
+ children: "Cancel"
43238
+ }),
43239
+ /* @__PURE__ */ jsx154("button", {
43240
+ type: "button",
43241
+ onClick: handleKimiOpenAuth,
43242
+ disabled: kimiPolling || kimiLoading,
43243
+ className: "flex-1 h-11 px-4 bg-foreground text-background rounded-lg font-medium hover:bg-foreground/90 transition-colors disabled:opacity-50 flex items-center justify-center gap-2",
43244
+ children: kimiPolling || kimiLoading ? /* @__PURE__ */ jsx154(StableSpinner, {
43245
+ title: "Opening Kimi"
43246
+ }) : /* @__PURE__ */ jsxs134(Fragment60, {
43247
+ children: [
43248
+ "Open Kimi",
43249
+ /* @__PURE__ */ jsx154(ExternalLink13, {
43250
+ className: "w-4 h-4"
43251
+ })
43252
+ ]
43253
+ })
43254
+ })
43255
+ ]
43256
+ })
43257
+ ]
43258
+ })
43259
+ ]
43260
+ })
43261
+ }),
43010
43262
  copilotModalOpen && /* @__PURE__ */ jsx154("div", {
43011
43263
  "data-otto-nested-modal": "true",
43012
43264
  className: "fixed inset-0 z-[9999] flex items-center justify-center bg-black/60 backdrop-blur-sm",
@@ -43571,6 +43823,8 @@ var OnboardingModal = memo77(function OnboardingModal2({
43571
43823
  pollOpenAIDeviceFlow,
43572
43824
  startCopilotDeviceFlow,
43573
43825
  pollCopilotDeviceFlow,
43826
+ startKimiDeviceFlow,
43827
+ pollKimiDeviceFlow,
43574
43828
  getCopilotAuthMethods,
43575
43829
  saveCopilotToken,
43576
43830
  importCopilotTokenFromGh,
@@ -43644,6 +43898,8 @@ var OnboardingModal = memo77(function OnboardingModal2({
43644
43898
  hideHeader,
43645
43899
  onStartCopilotDeviceFlow: startCopilotDeviceFlow,
43646
43900
  onPollCopilotDeviceFlow: pollCopilotDeviceFlow,
43901
+ onStartKimiDeviceFlow: startKimiDeviceFlow,
43902
+ onPollKimiDeviceFlow: pollKimiDeviceFlow,
43647
43903
  onGetCopilotAuthMethods: getCopilotAuthMethods,
43648
43904
  onSaveCopilotToken: saveCopilotToken,
43649
43905
  onImportCopilotTokenFromGh: importCopilotTokenFromGh,
@@ -44725,4 +44981,4 @@ export {
44725
44981
  AgentProviderModelFields
44726
44982
  };
44727
44983
 
44728
- //# debugId=298156C914040B7964756E2164756E21
44984
+ //# debugId=4F518AFA5E675B1164756E2164756E21