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

Method initializeTaskMode

src/core/task/Task.ts:635–646  ·  view source on GitHub ↗

* Initialize the task mode from the provider state. * This method handles async initialization with proper error handling. * * ## Flow * 1. Attempts to fetch the current mode from provider state * 2. Sets `_taskMode` to the fetched mode or `defaultModeSlug` if unavailable * 3. Handles er

(provider: ClineProvider)

Source from the content-addressed store, hash-verified

633 * @returns Promise that resolves when initialization is complete
634 */
635 private async initializeTaskMode(provider: ClineProvider): Promise<void> {
636 try {
637 const state = await provider.getState()
638 this._taskMode = state?.mode || defaultModeSlug
639 } catch (error) {
640 // If there's an error getting state, use the default mode
641 this._taskMode = defaultModeSlug
642 // Use the provider's log method for better error visibility
643 const errorMessage = `Failed to initialize task mode: ${error instanceof Error ? error.message : String(error)}`
644 provider.log(errorMessage)
645 }
646 }
647
648 /**
649 * Initialize the task API config name from the provider state.

Callers 1

constructorMethod · 0.95

Calls 3

getStateMethod · 0.65
logMethod · 0.65
StringInterface · 0.50

Tested by

no test coverage detected