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 installedbuildLaunchCommand()- Build the command to start a new sessionparseTerminalStatus()- Parse terminal output into session status
Optional methods (gated by capabilities):
parseUsage()- Fetch usage data (requiressupportsUsage)readSessionHistory()- Read past sessions (requiressupportsSessionHistory)buildResumeCommand()- Resume a session (requiressupportedOperations.has('resume'))buildForkCommand()- Fork a session (requiressupportedOperations.has('fork'))buildContinueCommand()- Continue latest session (requiressupportedOperations.has('continue'))getMcpConfig()- Provide MCP config (requiressupportsMcp)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
readonlyactivationEvents: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
readonlyaiMode: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
readonlycapabilities:ProviderCapabilities
Defined in: types/provider.ts:68
Declares what optional features this provider supports
displayName
readonlydisplayName:string
Defined in: types/plugin.ts:24
Human-readable display name
Inherited from
id
readonlyid:string
Defined in: types/plugin.ts:18
Unique plugin identifier matching the manifest id field
Inherited from
type
readonlytype:"provider"|"both"
Defined in: types/provider.ts:65
Must be 'provider' or 'both'
Overrides
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
| Parameter | Type |
|---|---|
context | PluginContext |
Returns
Promise<void>
Inherited from
buildContinueCommand()?
optionalbuildContinueCommand(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
| Parameter | Type | Description |
|---|---|---|
context | LaunchContext | Launch context with paths and options |
Returns
CLI command configuration for continuing
buildForkCommand()?
optionalbuildForkCommand(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
| Parameter | Type | Description |
|---|---|---|
sessionId | string | Provider-specific session ID to fork from |
context | LaunchContext | Launch context with paths and options |
Returns
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
| Parameter | Type | Description |
|---|---|---|
context | LaunchContext | Launch context with session ID, paths, model, and options |
Returns
CLI command configuration ready for PTY execution
buildResumeCommand()?
optionalbuildResumeCommand(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
| Parameter | Type | Description |
|---|---|---|
sessionId | string | Provider-specific session ID to resume |
context | LaunchContext | Launch context with paths and options |
Returns
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
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()?
optionalgetMcpConfig(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
| Parameter | Type | Description |
|---|---|---|
sessionId | string | Omniscribe session ID |
projectPath | string | Project path for scoped MCP config |
Returns
Promise<McpConfigContribution | null>
MCP config contribution with path and content, or null
getSystemPromptAdditions()?
optionalgetSystemPromptAdditions(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
| Parameter | Type | Description |
|---|---|---|
context | LaunchContext | Launch 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
| Parameter | Type | Description |
|---|---|---|
output | string | Raw terminal output string |
Returns
ProviderSessionStatus | null
Parsed status or null if no status change detected
parseUsage()?
optionalparseUsage(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
| Parameter | Type | Description |
|---|---|---|
workingDir | string | Working directory context for CLI execution |
Returns
Promise<ProviderUsageData | null>
Usage data with named metrics, or null if unavailable
readSessionHistory()?
optionalreadSessionHistory(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
| Parameter | Type | Description |
|---|---|---|
projectPath | string | Project path to read history for |
Returns
Promise<ProviderSessionEntry[]>
Array of historical session entries