@@ -2,7 +2,7 @@ import type { EventEmitter } from "events"
22import type { Socket } from "net"
33
44import type { RooCodeEvents } from "./events.js"
5- import type { RooCodeSettings } from "./global-settings.js"
5+ import type { GlobalState , RooCodeSettings } from "./global-settings.js"
66import type { HistoryItem } from "./history.js"
77import type { ProviderSettingsEntry , ProviderSettings } from "./provider-settings.js"
88import type { IpcMessage , IpcServerEvents } from "./ipc.js"
@@ -21,18 +21,21 @@ export interface RooCodeAPI extends EventEmitter<RooCodeAPIEvents> {
2121 * Starts a new task with an optional initial message and images.
2222 * @param task Optional initial task message.
2323 * @param images Optional array of image data URIs (e.g., "data:image/webp;base64,...").
24+ * @param preserveOpenTabs When true, skips the new-tab editor cleanup (revert + close-all), preserving open tabs and dirty/unsaved editors.
2425 * @returns The ID of the new task.
2526 */
2627 startNewTask ( {
2728 configuration,
2829 text,
2930 images,
3031 newTab,
32+ preserveOpenTabs,
3133 } : {
3234 configuration ?: RooCodeSettings
3335 text ?: string
3436 images ?: string [ ]
3537 newTab ?: boolean
38+ preserveOpenTabs ?: boolean
3639 } ) : Promise < string >
3740 /**
3841 * Resumes a task with the given ID.
@@ -119,7 +122,9 @@ export interface RooCodeAPI extends EventEmitter<RooCodeAPIEvents> {
119122 */
120123 getConfiguration ( ) : RooCodeSettings
121124 /**
122- * Sets the configuration for the current task.
125+ * Sets the configuration for the extension. Writes target the extension-host (sidebar) view:
126+ * view-local values are pinned to the sidebar's per-view state, while global values are
127+ * written to the shared ContextProxy.
123128 * @param values An object containing key-value pairs to set.
124129 */
125130 setConfiguration ( values : RooCodeSettings ) : Promise < void >
@@ -186,6 +191,38 @@ export interface RooCodeAPI extends EventEmitter<RooCodeAPIEvents> {
186191 setTerminalProfile ( name : string | undefined ) : void
187192}
188193
194+ /**
195+ * Test-only extension API surface.
196+ *
197+ * These methods expose raw global-state reads and task ask control by ID that
198+ * production callers must not rely on. The implementation is gated at runtime
199+ * against VS Code ExtensionMode.Production, so only test hosts and the e2e
200+ * harness keep access.
201+ */
202+ export interface RooCodeTestOnlyApi {
203+ /**
204+ * Programmatically approves the pending ask for a task by ID. Intended for use in tests only.
205+ */
206+ approveTaskAsk ( taskId : string ) : Promise < boolean >
207+ /**
208+ * Programmatically denies the pending ask for a task by ID. Intended for use in tests only.
209+ */
210+ denyTaskAsk ( taskId : string ) : Promise < boolean >
211+ /**
212+ * Simulates selecting a follow-up suggestion for a task by ID, including its optional mode switch.
213+ * Intended for use in tests only.
214+ */
215+ selectTaskFollowupSuggestion ( options : { taskId : string ; answer : string ; mode ?: string } ) : Promise < boolean >
216+ /**
217+ * Returns a value from VS Code globalState. Intended for use in tests only.
218+ */
219+ getGlobalState < K extends keyof GlobalState > ( key : K ) : GlobalState [ K ]
220+ /**
221+ * Writes a value to VS Code globalState. Intended for use in tests only.
222+ */
223+ setGlobalState < K extends keyof GlobalState > ( key : K , value : GlobalState [ K ] ) : Promise < void >
224+ }
225+
189226export interface RooCodeTestAPI extends RooCodeAPI {
190227 captureWebviewThemeFixture ( ) : Promise < WebviewThemeFixture >
191228 getLatestAnnouncementId ( ) : string
0 commit comments