Skip to main content

Interface: AiProviderPlugin

Defined in: types/provider.ts:63

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;
}
}

Extends

Properties

activationEvents

readonly activationEvents: PluginActivation[]

Defined in: types/provider.ts:83

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


aiMode

readonly aiMode: string

Defined in: types/provider.ts:76

The AI mode identifier this provider handles. Must be unique across all loaded providers. Used to route sessions to the correct provider.

Example

'claude' | 'codex' | 'aider'

capabilities

readonly capabilities: ProviderCapabilities

Defined in: types/provider.ts:68

Declares what optional features this provider supports


displayName

readonly displayName: string

Defined in: types/plugin.ts:24

Human-readable display name

Inherited from

OmniscribePlugin.displayName


id

readonly id: string

Defined in: types/plugin.ts:18

Unique plugin identifier matching the manifest id field

Inherited from

OmniscribePlugin.id


type

readonly type: "provider" | "both"

Defined in: types/provider.ts:65

Must be 'provider' or 'both'

Overrides

OmniscribePlugin.type

Methods

activate()

activate(context): Promise<void>

Defined in: types/plugin.ts:31

Called when the plugin is activated. Use the context to register contributions, subscribe to events, and initialize state. All disposables should be added to context.subscriptions for automatic cleanup.

Parameters

ParameterType
contextPluginContext

Returns

Promise<void>

Inherited from

OmniscribePlugin.activate


buildContinueCommand()?

optional buildContinueCommand(context): CliCommandConfig

Defined in: types/provider.ts:181

Build command to continue the most recent session for a project. Only called if capabilities.supportedOperations.has('continue').

Parameters

ParameterTypeDescription
contextLaunchContextLaunch context with paths and options

Returns

CliCommandConfig

CLI command configuration for continuing


buildForkCommand()?

optional buildForkCommand(sessionId, context): CliCommandConfig

Defined in: types/provider.ts:172

Build command to fork a new session from an existing one. Only called if capabilities.supportedOperations.has('fork').

Parameters

ParameterTypeDescription
sessionIdstringProvider-specific session ID to fork from
contextLaunchContextLaunch context with paths and options

Returns

CliCommandConfig

CLI command configuration for forking


buildLaunchCommand()

buildLaunchCommand(context): CliCommandConfig

Defined in: types/provider.ts:108

Build the shell command to launch a new session. Returns the executable, arguments, optional env vars, and working directory.

Parameters

ParameterTypeDescription
contextLaunchContextLaunch context with session ID, paths, model, and options

Returns

CliCommandConfig

CLI command configuration ready for PTY execution


buildResumeCommand()?

optional buildResumeCommand(sessionId, context): CliCommandConfig

Defined in: types/provider.ts:162

Build command to resume an existing session by ID. Only called if capabilities.supportedOperations.has('resume').

Parameters

ParameterTypeDescription
sessionIdstringProvider-specific session ID to resume
contextLaunchContextLaunch context with paths and options

Returns

CliCommandConfig

CLI command configuration for resuming


deactivate()

deactivate(): Promise<void>

Defined in: types/plugin.ts:37

Called when the plugin is deactivated. Clean up any resources not tracked via context.subscriptions.

Returns

Promise<void>

Inherited from

OmniscribePlugin.deactivate


detectCli()

detectCli(): Promise<CliDetectionResult>

Defined in: types/provider.ts:95

Detect whether this provider's CLI tool is installed and configured. Called during app initialization, settings display, and before session launch.

Returns

Promise<CliDetectionResult>

Detection result with install status, version, path, and auth info


getMcpConfig()?

optional getMcpConfig(sessionId, projectPath): Promise<McpConfigContribution | null>

Defined in: types/provider.ts:195

Get MCP configuration this provider needs written before session launch. Only called if capabilities.supportsMcp is true.

Parameters

ParameterTypeDescription
sessionIdstringOmniscribe session ID
projectPathstringProject path for scoped MCP config

Returns

Promise<McpConfigContribution | null>

MCP config contribution with path and content, or null


getSystemPromptAdditions()?

optional getSystemPromptAdditions(context): string[]

Defined in: types/provider.ts:208

Get additional system prompt text to append for this provider. Used to inject provider-specific instructions (e.g., MCP tool usage guidance).

Parameters

ParameterTypeDescription
contextLaunchContextLaunch context with session details

Returns

string[]

Array of prompt addition strings to append


parseTerminalStatus()

parseTerminalStatus(output): ProviderSessionStatus | null

Defined in: types/provider.ts:122

Parse terminal output to determine session status. Called on each chunk of terminal output from the PTY. Return null if the output doesn't indicate a status change.

Parameters

ParameterTypeDescription
outputstringRaw terminal output string

Returns

ProviderSessionStatus | null

Parsed status or null if no status change detected


parseUsage()?

optional parseUsage(workingDir): Promise<ProviderUsageData | null>

Defined in: types/provider.ts:135

Fetch usage data for display in the usage panel. Only called if capabilities.supportsUsage is true.

Parameters

ParameterTypeDescription
workingDirstringWorking directory context for CLI execution

Returns

Promise<ProviderUsageData | null>

Usage data with named metrics, or null if unavailable


readSessionHistory()?

optional readSessionHistory(projectPath): Promise<ProviderSessionEntry[]>

Defined in: types/provider.ts:148

Read past session history for the given project. Only called if capabilities.supportsSessionHistory is true.

Parameters

ParameterTypeDescription
projectPathstringProject path to read history for

Returns

Promise<ProviderSessionEntry[]>

Array of historical session entries