Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions CodexSharpSDK.Tests/Unit/CodexExecTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ public async Task BuildCommandArgs_MapsExtendedCliFlags()
Color = ExecOutputColor.Never,
ProgressCursor = true,
OutputLastMessageFile = "/tmp/last-message.txt",
EnabledFeatures = ["multi_agent", "unified_exec"],
DisabledFeatures = ["steer"],
EnabledFeatures = [CodexFeatureKeys.MultiAgent, CodexFeatureKeys.UnifiedExec],
DisabledFeatures = [CodexFeatureKeys.Steer],
AdditionalCliArguments = ["--some-future-flag", "custom-value"],
});

Expand All @@ -144,8 +144,8 @@ public async Task BuildCommandArgs_MapsExtendedCliFlags()
await Assert.That(commandArgs.Contains("--ephemeral")).IsTrue();
await Assert.That(commandArgs.Contains("--progress-cursor")).IsTrue();

await Assert.That(CollectFlagValues(commandArgs, "--enable")).IsEquivalentTo(["multi_agent", "unified_exec"]);
await Assert.That(CollectFlagValues(commandArgs, "--disable")).IsEquivalentTo(["steer"]);
await Assert.That(CollectFlagValues(commandArgs, "--enable")).IsEquivalentTo([CodexFeatureKeys.MultiAgent, CodexFeatureKeys.UnifiedExec]);
await Assert.That(CollectFlagValues(commandArgs, "--disable")).IsEquivalentTo([CodexFeatureKeys.Steer]);

await Assert.That(commandArgs.Contains("--some-future-flag")).IsTrue();
await Assert.That(commandArgs.Contains("custom-value")).IsTrue();
Expand Down
46 changes: 46 additions & 0 deletions CodexSharpSDK.Tests/Unit/CodexFeatureKeysTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System.Reflection;
using ManagedCode.CodexSharpSDK.Models;

namespace ManagedCode.CodexSharpSDK.Tests.Unit;

public class CodexFeatureKeysTests
{
[Test]
public async Task ToolCallMcpElicitation_HasCorrectValue()
{
var key = CodexFeatureKeys.ToolCallMcpElicitation;
await Assert.That(key).IsEqualTo("tool_call_mcp_elicitation");
}

[Test]
public async Task AllFeatureKeys_AreNonEmptyStrings()
{
var keys = GetAllFeatureKeyValues();
foreach (var key in keys)
{
await Assert.That(string.IsNullOrWhiteSpace(key)).IsFalse();
}
}

[Test]
public async Task AllFeatureKeys_AreUnique()
{
var keys = GetAllFeatureKeyValues();
var duplicates = keys
.GroupBy(k => k, StringComparer.Ordinal)
.Where(g => g.Count() > 1)
.Select(g => g.Key)
.ToArray();

await Assert.That(duplicates).IsEmpty();
}

private static string[] GetAllFeatureKeyValues()
{
return typeof(CodexFeatureKeys)
.GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly)
.Where(field => field is { IsLiteral: true, IsInitOnly: false, FieldType: not null } && field.FieldType == typeof(string))
.Select(field => (string)field.GetRawConstantValue()!)
.ToArray();
}
}
54 changes: 54 additions & 0 deletions CodexSharpSDK/Models/CodexFeatureKeys.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
namespace ManagedCode.CodexSharpSDK.Models;

/// <summary>
/// Known Codex CLI feature flag keys for use with <see cref="Client.ThreadOptions.EnabledFeatures"/>
/// and <see cref="Client.ThreadOptions.DisabledFeatures"/>.
/// Keys are sourced from <c>codex-rs/core/src/features.rs</c> in the upstream <c>openai/codex</c> repository.
/// </summary>
public static class CodexFeatureKeys
{
public const string Undo = "undo";
public const string ShellTool = "shell_tool";
public const string UnifiedExec = "unified_exec";
public const string ShellZshFork = "shell_zsh_fork";
public const string ShellSnapshot = "shell_snapshot";
public const string JsRepl = "js_repl";
public const string JsReplToolsOnly = "js_repl_tools_only";
public const string WebSearchRequest = "web_search_request";
public const string WebSearchCached = "web_search_cached";
public const string SearchTool = "search_tool";
public const string CodexGitCommit = "codex_git_commit";
public const string RuntimeMetrics = "runtime_metrics";
public const string Sqlite = "sqlite";
public const string Memories = "memories";
public const string ChildAgentsMd = "child_agents_md";
public const string ImageDetailOriginal = "image_detail_original";
public const string ApplyPatchFreeform = "apply_patch_freeform";
public const string RequestPermissions = "request_permissions";
public const string UseLinuxSandboxBwrap = "use_linux_sandbox_bwrap";
public const string RequestRule = "request_rule";
public const string ExperimentalWindowsSandbox = "experimental_windows_sandbox";
public const string ElevatedWindowsSandbox = "elevated_windows_sandbox";
public const string RemoteModels = "remote_models";
public const string PowershellUtf8 = "powershell_utf8";
public const string EnableRequestCompression = "enable_request_compression";
public const string MultiAgent = "multi_agent";
public const string Apps = "apps";
public const string Plugins = "plugins";
public const string ImageGeneration = "image_generation";
public const string AppsMcpGateway = "apps_mcp_gateway";
public const string SkillMcpDependencyInstall = "skill_mcp_dependency_install";
public const string SkillEnvVarDependencyPrompt = "skill_env_var_dependency_prompt";
public const string Steer = "steer";
public const string DefaultModeRequestUserInput = "default_mode_request_user_input";
public const string CollaborationModes = "collaboration_modes";
public const string ToolCallMcpElicitation = "tool_call_mcp_elicitation";
public const string Personality = "personality";
public const string Artifact = "artifact";
public const string FastMode = "fast_mode";
public const string VoiceTranscription = "voice_transcription";
public const string RealtimeConversation = "realtime_conversation";
public const string PreventIdleSleep = "prevent_idle_sleep";
public const string ResponsesWebsockets = "responses_websockets";
public const string ResponsesWebsocketsV2 = "responses_websockets_v2";
}
2 changes: 1 addition & 1 deletion submodules/openai-codex
Submodule openai-codex updated 275 files