Skip to content

Commit e67e8a9

Browse files
CopilotKSemenenko
andcommitted
Changes before error encountered
Co-authored-by: KSemenenko <4385716+KSemenenko@users.noreply.github.com>
1 parent ac22186 commit e67e8a9

File tree

4 files changed

+105
-5
lines changed

4 files changed

+105
-5
lines changed

CodexSharpSDK.Tests/Unit/CodexExecTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ public async Task BuildCommandArgs_MapsExtendedCliFlags()
128128
Color = ExecOutputColor.Never,
129129
ProgressCursor = true,
130130
OutputLastMessageFile = "/tmp/last-message.txt",
131-
EnabledFeatures = ["multi_agent", "unified_exec"],
132-
DisabledFeatures = ["steer"],
131+
EnabledFeatures = [CodexFeatureKeys.MultiAgent, CodexFeatureKeys.UnifiedExec],
132+
DisabledFeatures = [CodexFeatureKeys.Steer],
133133
AdditionalCliArguments = ["--some-future-flag", "custom-value"],
134134
});
135135

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

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

150150
await Assert.That(commandArgs.Contains("--some-future-flag")).IsTrue();
151151
await Assert.That(commandArgs.Contains("custom-value")).IsTrue();
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using System.Reflection;
2+
using ManagedCode.CodexSharpSDK.Models;
3+
4+
namespace ManagedCode.CodexSharpSDK.Tests.Unit;
5+
6+
public class CodexFeatureKeysTests
7+
{
8+
[Test]
9+
public async Task ToolCallMcpElicitation_HasCorrectValue()
10+
{
11+
var key = CodexFeatureKeys.ToolCallMcpElicitation;
12+
await Assert.That(key).IsEqualTo("tool_call_mcp_elicitation");
13+
}
14+
15+
[Test]
16+
public async Task AllFeatureKeys_AreNonEmptyStrings()
17+
{
18+
var keys = GetAllFeatureKeyValues();
19+
foreach (var key in keys)
20+
{
21+
await Assert.That(string.IsNullOrWhiteSpace(key)).IsFalse();
22+
}
23+
}
24+
25+
[Test]
26+
public async Task AllFeatureKeys_AreUnique()
27+
{
28+
var keys = GetAllFeatureKeyValues();
29+
var duplicates = keys
30+
.GroupBy(k => k, StringComparer.Ordinal)
31+
.Where(g => g.Count() > 1)
32+
.Select(g => g.Key)
33+
.ToArray();
34+
35+
await Assert.That(duplicates).IsEmpty();
36+
}
37+
38+
private static string[] GetAllFeatureKeyValues()
39+
{
40+
return typeof(CodexFeatureKeys)
41+
.GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly)
42+
.Where(field => field is { IsLiteral: true, IsInitOnly: false, FieldType: not null } && field.FieldType == typeof(string))
43+
.Select(field => (string)field.GetRawConstantValue()!)
44+
.ToArray();
45+
}
46+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
namespace ManagedCode.CodexSharpSDK.Models;
2+
3+
/// <summary>
4+
/// Known Codex CLI feature flag keys for use with <see cref="Client.ThreadOptions.EnabledFeatures"/>
5+
/// and <see cref="Client.ThreadOptions.DisabledFeatures"/>.
6+
/// Keys are sourced from <c>codex-rs/core/src/features.rs</c> in the upstream <c>openai/codex</c> repository.
7+
/// </summary>
8+
public static class CodexFeatureKeys
9+
{
10+
public const string Undo = "undo";
11+
public const string ShellTool = "shell_tool";
12+
public const string UnifiedExec = "unified_exec";
13+
public const string ShellZshFork = "shell_zsh_fork";
14+
public const string ShellSnapshot = "shell_snapshot";
15+
public const string JsRepl = "js_repl";
16+
public const string JsReplToolsOnly = "js_repl_tools_only";
17+
public const string WebSearchRequest = "web_search_request";
18+
public const string WebSearchCached = "web_search_cached";
19+
public const string SearchTool = "search_tool";
20+
public const string CodexGitCommit = "codex_git_commit";
21+
public const string RuntimeMetrics = "runtime_metrics";
22+
public const string Sqlite = "sqlite";
23+
public const string Memories = "memories";
24+
public const string ChildAgentsMd = "child_agents_md";
25+
public const string ImageDetailOriginal = "image_detail_original";
26+
public const string ApplyPatchFreeform = "apply_patch_freeform";
27+
public const string RequestPermissions = "request_permissions";
28+
public const string UseLinuxSandboxBwrap = "use_linux_sandbox_bwrap";
29+
public const string RequestRule = "request_rule";
30+
public const string ExperimentalWindowsSandbox = "experimental_windows_sandbox";
31+
public const string ElevatedWindowsSandbox = "elevated_windows_sandbox";
32+
public const string RemoteModels = "remote_models";
33+
public const string PowershellUtf8 = "powershell_utf8";
34+
public const string EnableRequestCompression = "enable_request_compression";
35+
public const string MultiAgent = "multi_agent";
36+
public const string Apps = "apps";
37+
public const string Plugins = "plugins";
38+
public const string ImageGeneration = "image_generation";
39+
public const string AppsMcpGateway = "apps_mcp_gateway";
40+
public const string SkillMcpDependencyInstall = "skill_mcp_dependency_install";
41+
public const string SkillEnvVarDependencyPrompt = "skill_env_var_dependency_prompt";
42+
public const string Steer = "steer";
43+
public const string DefaultModeRequestUserInput = "default_mode_request_user_input";
44+
public const string CollaborationModes = "collaboration_modes";
45+
public const string ToolCallMcpElicitation = "tool_call_mcp_elicitation";
46+
public const string Personality = "personality";
47+
public const string Artifact = "artifact";
48+
public const string FastMode = "fast_mode";
49+
public const string VoiceTranscription = "voice_transcription";
50+
public const string RealtimeConversation = "realtime_conversation";
51+
public const string PreventIdleSleep = "prevent_idle_sleep";
52+
public const string ResponsesWebsockets = "responses_websockets";
53+
public const string ResponsesWebsocketsV2 = "responses_websockets_v2";
54+
}

submodules/openai-codex

Submodule openai-codex updated 275 files

0 commit comments

Comments
 (0)