MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / getState

Method getState

src/core/webview/ClineProvider.ts:2509–2693  ·  view source on GitHub ↗

* Storage * https://dev.to/kompotkot/how-to-use-secretstorage-in-your-vscode-extensions-2hco * https://www.eliostruyf.com/devhack-code-extension-storage-options/

()

Source from the content-addressed store, hash-verified

2507 */
2508
2509 async getState(): Promise<
2510 Omit<
2511 ExtensionState,
2512 "clineMessages" | "renderContext" | "hasOpenedModeSelector" | "version" | "shouldShowAnnouncement"
2513 >
2514 > {
2515 const stateValues = this.contextProxy.getValues()
2516 const customModes = await this.customModesManager.getCustomModes()
2517
2518 // Determine apiProvider with the same logic as before, while filtering retired providers.
2519 const apiProvider: ProviderName =
2520 stateValues.apiProvider && !isRetiredProvider(stateValues.apiProvider)
2521 ? stateValues.apiProvider
2522 : "anthropic"
2523
2524 // Build the apiConfiguration object combining state values and secrets.
2525 const providerSettings = this.contextProxy.getProviderSettings()
2526
2527 // Ensure apiProvider is set properly if not already in state
2528 if (!providerSettings.apiProvider) {
2529 providerSettings.apiProvider = apiProvider
2530 }
2531
2532 let organizationAllowList = ORGANIZATION_ALLOW_ALL
2533
2534 try {
2535 organizationAllowList = await CloudService.instance.getAllowList()
2536 } catch (error) {
2537 console.error(
2538 `[getState] failed to get organization allow list: ${error instanceof Error ? error.message : String(error)}`,
2539 )
2540 }
2541
2542 let cloudUserInfo: CloudUserInfo | null = null
2543
2544 try {
2545 cloudUserInfo = CloudService.instance.getUserInfo()
2546 } catch (error) {
2547 console.error(
2548 `[getState] failed to get cloud user info: ${error instanceof Error ? error.message : String(error)}`,
2549 )
2550 }
2551
2552 let cloudIsAuthenticated: boolean = false
2553
2554 try {
2555 cloudIsAuthenticated = CloudService.instance.isAuthenticated()
2556 } catch (error) {
2557 console.error(
2558 `[getState] failed to get cloud authentication state: ${error instanceof Error ? error.message : String(error)}`,
2559 )
2560 }
2561
2562 const sharingEnabled: boolean = false
2563
2564 const publicSharingEnabled: boolean = false
2565
2566 let organizationSettingsVersion: number = -1

Callers 15

addClineToStackMethod · 0.95
resolveWebviewViewMethod · 0.95
getHMRHtmlContentMethod · 0.95
getHtmlContentMethod · 0.95
upsertProviderProfileMethod · 0.95
handleZooCodeCallbackMethod · 0.95
createTaskMethod · 0.95

Calls 15

isRetiredProviderFunction · 0.90
formatLanguageFunction · 0.90
getCustomModesMethod · 0.80
getProviderSettingsMethod · 0.80
getAllServersMethod · 0.80
getAllowListMethod · 0.65
errorMethod · 0.65
getUserInfoMethod · 0.65
isAuthenticatedMethod · 0.65
getMethod · 0.65
StringInterface · 0.50

Tested by

no test coverage detected