IntelligenceX
Class

AppServerClient

Namespace IntelligenceX.OpenAI.AppServer
Assembly IntelligenceX
Implements
IDisposable
Modifiers sealed

Low-level client for the OpenAI app-server JSON-RPC protocol.

Inheritance

  • Object
  • AppServerClient

Methods

public Task ArchiveThreadAsync(String threadId, CancellationToken cancellationToken = null) #
Returns: Task

Archives a thread by id.

Parameters

threadId System.String
Thread id.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public Task<JsonValue> CallAsync(String method, JsonObject parameters, CancellationToken cancellationToken = null) #
Returns: Task<JsonValue>

Executes a raw JSON-RPC call.

Parameters

method System.String
Method name.
parameters IntelligenceX.Json.JsonObject
Optional parameters.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public virtual Void Dispose() #
Returns: Void

Disposes the app-server client and underlying process.

public async Task<CommandExecResult> ExecuteCommandAsync(CommandExecRequest request, CancellationToken cancellationToken = null) #
Returns: Task<CommandExecResult>

Executes a command through the app-server.

Parameters

request IntelligenceX.OpenAI.AppServer.Models.CommandExecRequest
Command execution request.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public async Task<ThreadInfo> ForkThreadAsync(String threadId, CancellationToken cancellationToken = null) #
Returns: Task<ThreadInfo>

Forks a thread by id.

Parameters

threadId System.String
Thread id.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public async Task<HealthCheckResult> HealthCheckAsync(String method = null, Nullable<TimeSpan> timeout = null, CancellationToken cancellationToken = null) #
Returns: Task<HealthCheckResult>

Executes a health check call.

Parameters

method System.String = null
Optional method override.
timeout System.Nullable{System.TimeSpan} = null
Optional timeout.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public async Task InitializeAsync(ClientInfo clientInfo, CancellationToken cancellationToken = null) #
Returns: Task

Initializes the app-server with client metadata.

Parameters

clientInfo IntelligenceX.OpenAI.AppServer.ClientInfo
Client identity information.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public Task InterruptTurnAsync(String threadId, String turnId, CancellationToken cancellationToken = null) #
Returns: Task

Interrupts an in-flight turn.

Parameters

threadId System.String
Thread id.
turnId System.String
Turn id.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public async Task<CollaborationModeListResult> ListCollaborationModesAsync(CancellationToken cancellationToken = null) #
Returns: Task<CollaborationModeListResult>

Lists available collaboration modes.

Parameters

cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public async Task<ThreadIdListResult> ListLoadedThreadsAsync(CancellationToken cancellationToken = null) #
Returns: Task<ThreadIdListResult>

Lists currently loaded thread ids.

Parameters

cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public async Task<McpServerStatusListResult> ListMcpServerStatusAsync(String cursor = null, Nullable<Int32> limit = null, CancellationToken cancellationToken = null) #
Returns: Task<McpServerStatusListResult>

Lists MCP server status entries.

Parameters

cursor System.String = null
Pagination cursor.
limit System.Nullable{System.Int32} = null
Maximum number of items.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public async Task<ModelListResult> ListModelsAsync(CancellationToken cancellationToken = null) #
Returns: Task<ModelListResult>

Lists available models.

Parameters

cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public async Task<SkillListResult> ListSkillsAsync(IReadOnlyList<String> cwds = null, Nullable<Boolean> forceReload = null, CancellationToken cancellationToken = null) #
Returns: Task<SkillListResult>

Lists available skills.

Parameters

cwds System.Collections.Generic.IReadOnlyList{System.String} = null
Optional working directories to query.
forceReload System.Nullable{System.Boolean} = null
Whether to force reload.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public async Task<ThreadListResult> ListThreadsAsync(String cursor = null, Nullable<Int32> limit = null, String sortKey = null, IReadOnlyList<String> modelProviders = null, CancellationToken cancellationToken = null) #
Returns: Task<ThreadListResult>

Lists threads with optional filters.

Parameters

cursor System.String = null
Pagination cursor.
limit System.Nullable{System.Int32} = null
Maximum number of items.
sortKey System.String = null
Sort key.
modelProviders System.Collections.Generic.IReadOnlyList{System.String} = null
Optional model provider filter.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public Task LoginWithApiKeyAsync(String apiKey, CancellationToken cancellationToken = null) #
Returns: Task

Logs in using an API key.

Parameters

apiKey System.String
API key.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public Task LogoutAsync(CancellationToken cancellationToken = null) #
Returns: Task

Logs out of the current session.

Parameters

cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public Task NotifyAsync(String method, JsonObject parameters, CancellationToken cancellationToken = null) #
Returns: Task

Sends a JSON-RPC notification.

Parameters

method System.String
Method name.
parameters IntelligenceX.Json.JsonObject
Optional parameters.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public async Task<AccountInfo> ReadAccountAsync(CancellationToken cancellationToken = null) #
Returns: Task<AccountInfo>

Reads account information.

Parameters

cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public async Task<ConfigReadResult> ReadConfigAsync(CancellationToken cancellationToken = null) #
Returns: Task<ConfigReadResult>

Reads the current configuration.

Parameters

cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public async Task<ConfigRequirementsReadResult> ReadConfigRequirementsAsync(CancellationToken cancellationToken = null) #
Returns: Task<ConfigRequirementsReadResult>

Reads configuration requirements.

Parameters

cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public async Task ReloadMcpServerConfigAsync(CancellationToken cancellationToken = null) #
Returns: Task

Reloads MCP server configuration.

Parameters

cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public async Task<UserInputResponse> RequestUserInputAsync(IReadOnlyList<String> questions, CancellationToken cancellationToken = null) #
Returns: Task<UserInputResponse>

Requests user input responses.

Parameters

questions System.Collections.Generic.IReadOnlyList{System.String}
Questions to prompt.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public async Task<ThreadInfo> ResumeThreadAsync(String threadId, CancellationToken cancellationToken = null) #
Returns: Task<ThreadInfo>

Resumes a thread by id.

Parameters

threadId System.String
Thread id.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public async Task<ThreadInfo> RollbackThreadAsync(String threadId, Int32 turns, CancellationToken cancellationToken = null) #
Returns: Task<ThreadInfo>

Rolls back a thread by a number of turns.

Parameters

threadId System.String
Thread id.
turns System.Int32
Number of turns to roll back.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public static async Task<AppServerClient> StartAsync(AppServerOptions options = null, CancellationToken cancellationToken = null) #
Returns: Task<AppServerClient>

Starts the app-server process and returns a connected client.

Parameters

options IntelligenceX.OpenAI.AppServer.AppServerOptions = null
Optional app-server options.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public async Task<ChatGptLoginStart> StartChatGptLoginAsync(CancellationToken cancellationToken = null) #
Returns: Task<ChatGptLoginStart>

Starts a ChatGPT login flow.

Parameters

cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public async Task<McpOauthLoginStart> StartMcpOauthLoginAsync(String serverId, String serverName = null, CancellationToken cancellationToken = null) #
Returns: Task<McpOauthLoginStart>

Starts an MCP OAuth login flow.

Parameters

serverId System.String
Optional server id.
serverName System.String = null
Optional server name.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public async Task<ReviewStartResult> StartReviewAsync(String threadId, String delivery, ReviewTarget target, CancellationToken cancellationToken = null) #
Returns: Task<ReviewStartResult>

Starts a review for a thread.

Parameters

threadId System.String
Thread id.
delivery System.String
Delivery channel.
target IntelligenceX.OpenAI.AppServer.Models.ReviewTarget
Review target.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public async Task<ThreadInfo> StartThreadAsync(String model, String currentDirectory = null, String approvalPolicy = null, String sandbox = null, CancellationToken cancellationToken = null) #
Returns: Task<ThreadInfo>

Starts a new chat thread.

Parameters

model System.String
Model name.
currentDirectory System.String = null
Optional working directory.
approvalPolicy System.String = null
Optional approval policy.
sandbox System.String = null
Optional sandbox mode.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
StartTurnAsync 3 overloads
public async Task<TurnInfo> StartTurnAsync(String threadId, String text, CancellationToken cancellationToken = null) #
Returns: Task<TurnInfo>

Starts a turn with a text-only input.

Parameters

threadId System.String
Thread id.
text System.String
Prompt text.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public async Task<TurnInfo> StartTurnAsync(String threadId, JsonArray input, String model, String currentDirectory, String approvalPolicy, SandboxPolicy sandboxPolicy, CancellationToken cancellationToken = null) #
Returns: Task<TurnInfo>

Starts a turn with a text-only input and optional overrides.

Parameters

threadId System.String
Thread id.
text System.String
Prompt text.
model System.String
Optional model override.
currentDirectory System.String
Optional working directory.
approvalPolicy System.String
Optional approval policy.
sandboxPolicy IntelligenceX.OpenAI.AppServer.SandboxPolicy
Optional sandbox policy.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
StartTurnAsync(System.String threadId, IntelligenceX.Json.JsonArray input, System.String model, System.String currentDirectory, System.String approvalPolicy, IntelligenceX.OpenAI.AppServer.SandboxPolicy sandboxPolicy, System.Threading.CancellationToken cancellationToken) #

Starts a turn with a structured input payload.

Parameters

threadId System.String
Thread id.
input IntelligenceX.Json.JsonArray
Input items.
model System.String
Optional model override.
currentDirectory System.String
Optional working directory.
approvalPolicy System.String
Optional approval policy.
sandboxPolicy IntelligenceX.OpenAI.AppServer.SandboxPolicy
Optional sandbox policy.
cancellationToken System.Threading.CancellationToken
Cancellation token.
public Task UploadFeedbackAsync(String content, CancellationToken cancellationToken = null) #
Returns: Task

Uploads feedback content.

Parameters

content System.String
Feedback content.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public Task WaitForLoginCompletionAsync(String loginId = null, CancellationToken cancellationToken = null) #
Returns: Task

Waits for a login completion notification.

Parameters

loginId System.String = null
Optional login id to match.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public Task WriteConfigBatchAsync(IReadOnlyList<ConfigEntry> entries, CancellationToken cancellationToken = null) #
Returns: Task

Writes a batch of configuration values.

Parameters

entries System.Collections.Generic.IReadOnlyList{IntelligenceX.OpenAI.AppServer.Models.ConfigEntry}
Entries to write.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public Task WriteConfigValueAsync(String key, JsonValue value, CancellationToken cancellationToken = null) #
Returns: Task

Writes a single configuration value.

Parameters

key System.String
Configuration key.
value IntelligenceX.Json.JsonValue
Configuration value.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public Task WriteSkillConfigAsync(String path, Boolean enabled, CancellationToken cancellationToken = null) #
Returns: Task

Writes a skill configuration entry.

Parameters

path System.String
Skill path.
enabled System.Boolean
Whether the skill is enabled.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.

Events

public event EventHandler<JsonRpcNotificationEventArgs> NotificationReceived #

Raised when a JSON-RPC notification is received.

public event EventHandler<JsonRpcRequestEventArgs> RequestReceived #

Raised when an inbound request is received.

public event EventHandler<Exception> ProtocolError #

Raised when a protocol parsing error occurs.

public event EventHandler<String> StandardErrorReceived #

Raised when a line is received on standard error.

public event EventHandler<String> ProtocolLineReceived #

Raised when a protocol line is received.

public event EventHandler<RpcCallStartedEventArgs> RpcCallStarted #

Raised when an RPC call starts.

public event EventHandler<RpcCallCompletedEventArgs> RpcCallCompleted #

Raised when an RPC call completes.

public event EventHandler<LoginEventArgs> LoginStarted #

Raised when a login flow starts.

public event EventHandler<LoginEventArgs> LoginCompleted #

Raised when a login flow completes.