Skip to main content

Abstract Class: BaseProviderPlugin

Defined in: base/BaseProviderPlugin.ts:45

AI Provider Plugin interface.

Extends the base OmniscribePlugin with provider-specific concerns: capabilities, CLI detection, command building, and status parsing.

Required methods (minimum viable provider):

  • detectCli() - Check if the CLI tool is installed
  • buildLaunchCommand() - Build the command to start a new session
  • parseTerminalStatus() - Parse terminal output into session status

Optional methods (gated by capabilities):

  • parseUsage() - Fetch usage data (requires supportsUsage)
  • readSessionHistory() - Read past sessions (requires supportsSessionHistory)
  • buildResumeCommand() - Resume a session (requires supportedOperations.has('resume'))
  • buildForkCommand() - Fork a session (requires supportedOperations.has('fork'))
  • buildContinueCommand() - Continue latest session (requires supportedOperations.has('continue'))
  • getMcpConfig() - Provide MCP config (requires supportsMcp)
  • getSystemPromptAdditions() - Append to system prompt

Example

class MyProvider extends BaseProviderPlugin {
readonly id = 'my-provider';
readonly displayName = 'My AI Tool';
readonly aiMode = 'my-tool';

async detectCli(): Promise<CliDetectionResult> {
// Check if 'my-tool' CLI is installed
}

buildLaunchCommand(context: LaunchContext): CliCommandConfig {
return { command: 'my-tool', args: ['chat', '--project', context.projectPath] };
}

parseTerminalStatus(output: string): ProviderSessionStatus | null {
if (output.includes('> ')) return 'idle';
if (output.includes('Thinking...')) return 'working';
return null;
}
}

Extended by

Implements

Constructors

Constructor

new BaseProviderPlugin(): BaseProviderPlugin

Returns

BaseProviderPlugin

Properties

aiMode

abstract readonly aiMode: string

Defined in: base/BaseProviderPlugin.ts:61

The AI mode identifier this provider handles. Must be unique across all loaded providers.

Implementation of

AiProviderPlugin.aiMode


displayName

abstract readonly displayName: string

Defined in: base/BaseProviderPlugin.ts:55

Human-readable display name shown in the UI.

Implementation of

AiProviderPlugin.displayName


id

abstract readonly id: string

Defined in: base/BaseProviderPlugin.ts:50

Unique plugin identifier. Must match the id field in the plugin's package.json omniscribe manifest.

Implementation of

AiProviderPlugin.id


type

readonly type: "provider" | "both" = 'provider'

Defined in: base/BaseProviderPlugin.ts:67

Plugin type. Base provider plugins are always 'provider'. Override to 'both' in a subclass that also implements frontend contributions.

Implementation of

AiProviderPlugin.type

Accessors

activationEvents

Get Signature

get activationEvents(): PluginActivation[]

Defined in: base/BaseProviderPlugin.ts:73

Default activation events: activate when a session with this provider's AI mode is created. Override to customize activation behavior.

Returns

PluginActivation[]

Events that trigger this plugin's activation. Provider plugins typically use onSessionCreateWithMode to activate only when a session with their AI mode is created.

Implementation of

AiProviderPlugin.activationEvents


capabilities

Get Signature

get capabilities(): ProviderCapabilities

Defined in: base/BaseProviderPlugin.ts:93

Default capabilities: all optional features disabled. Override this getter to declare supported capabilities.

Example
get capabilities(): ProviderCapabilities {
return {
supportsMcp: true,
supportsUsage: true,
supportsSessionHistory: true,
supportedOperations: new Set(['resume', 'fork', 'continue']),
};
}
Returns

ProviderCapabilities

Declares what optional features this provider supports

Implementation of

AiProviderPlugin.capabilities

Methods

activate()

activate(_context): Promise<void>

Defined in: base/BaseProviderPlugin.ts:129

Called when the plugin is activated. No-op by default. Override to initialize resources, register event listeners, etc.

Parameters

ParameterType
_contextPluginContext

Returns

Promise<void>

Implementation of

AiProviderPlugin.activate


buildLaunchCommand()

abstract buildLaunchCommand(context): CliCommandConfig

Defined in: base/BaseProviderPlugin.ts:114

Build the shell command to launch a new session.

Parameters

ParameterType
contextLaunchContext

Returns

CliCommandConfig

Implementation of

AiProviderPlugin.buildLaunchCommand


deactivate()

deactivate(): Promise<void>

Defined in: base/BaseProviderPlugin.ts:137

Called when the plugin is deactivated. No-op by default. Override to clean up resources not tracked via context.subscriptions.

Returns

Promise<void>

Implementation of

AiProviderPlugin.deactivate


detectCli()

abstract detectCli(): Promise<CliDetectionResult>

Defined in: base/BaseProviderPlugin.ts:109

Detect whether this provider's CLI tool is installed and configured.

Returns

Promise<CliDetectionResult>

Implementation of

AiProviderPlugin.detectCli


getMcpConfig()

getMcpConfig(_sessionId, _projectPath): Promise<McpConfigContribution | null>

Defined in: base/BaseProviderPlugin.ts:158

Get MCP configuration this provider needs written before session launch. No-op by default. Override to contribute MCP config if the provider supports MCP.

Parameters

ParameterType
_sessionIdstring
_projectPathstring

Returns

Promise<McpConfigContribution | null>

Implementation of

AiProviderPlugin.getMcpConfig


getSystemPromptAdditions()

getSystemPromptAdditions(_context): string[]

Defined in: base/BaseProviderPlugin.ts:179

Get additional system prompt text to append for this provider. No-op by default. Override to inject provider-specific instructions.

Parameters

ParameterType
_contextLaunchContext

Returns

string[]

Implementation of

AiProviderPlugin.getSystemPromptAdditions


parseTerminalStatus()

abstract parseTerminalStatus(output): ProviderSessionStatus | null

Defined in: base/BaseProviderPlugin.ts:119

Parse terminal output to determine session status.

Parameters

ParameterType
outputstring

Returns

ProviderSessionStatus | null

Implementation of

AiProviderPlugin.parseTerminalStatus


parseUsage()

parseUsage(_workingDir): Promise<ProviderUsageData | null>

Defined in: base/BaseProviderPlugin.ts:170

Fetch usage data for display in the usage panel. No-op by default. Override to return usage metrics if the provider supports usage tracking.

Parameters

ParameterType
_workingDirstring

Returns

Promise<ProviderUsageData | null>

Implementation of

AiProviderPlugin.parseUsage


readSessionHistory()

readSessionHistory(_projectPath): Promise<ProviderSessionEntry[]>

Defined in: base/BaseProviderPlugin.ts:149

Read past session history for the given project. No-op by default. Override to return session entries if the provider supports session history.

Parameters

ParameterType
_projectPathstring

Returns

Promise<ProviderSessionEntry[]>

Implementation of

AiProviderPlugin.readSessionHistory