Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .claude/skills/tryagi-openai/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dnx tryAGI.OpenAI.CLI <group> --help

| Group | Operations | Summary |
|-------|-----------:|---------|
| `agent` | 34 | |
| `agent` | 35 | |
| `assistant` | 18 | Build Assistants that can call models and use tools. |
| `audio` | 9 | Turn audio into text or text into audio. |
| `audit-log` | 1 | List user actions and configuration changes within this organization. |
Expand Down
1 change: 1 addition & 0 deletions .claude/skills/tryagi-openai/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Full per-command reference derived from the OpenAPI spec. For the short overview
| `list-agent-session-subagent-turns` | `GET /agents/sessions/{session_id}/subagents/{subagent_id}/turns` | List subagent turns |
| `list-agent-session-subagents` | `GET /agents/sessions/{session_id}/subagents` | List session subagents |
| `list-agent-session-traces` | `GET /agents/sessions/{session_id}/traces` | List agent session traces |
| `list-agent-session-turn-items` | `GET /agents/sessions/{session_id}/turns/{turn_id}/items` | List agent session turn items |
| `list-agent-session-turns` | `GET /agents/sessions/{session_id}/turns` | List agent session turns |
| `list-agent-sessions` | `GET /agents/sessions` | List agent sessions |
| `list-agents` | `GET /agents` | List agents |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public static Command Create()
command.Subcommands.Add(AgentsListAgentSessionSubagentTurnsCommandApiCommand.Create());
command.Subcommands.Add(AgentsListAgentSessionSubagentsCommandApiCommand.Create());
command.Subcommands.Add(AgentsListAgentSessionTracesCommandApiCommand.Create());
command.Subcommands.Add(AgentsListAgentSessionTurnItemsCommandApiCommand.Create());
command.Subcommands.Add(AgentsListAgentSessionTurnsCommandApiCommand.Create());
command.Subcommands.Add(AgentsListAgentSessionsCommandApiCommand.Create());
command.Subcommands.Add(AgentsListAgentsCommandApiCommand.Create());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
#nullable enable
#pragma warning disable CS0618

using System.CommandLine;

namespace tryAGI.OpenAI.Cli.GeneratedApi.Commands;

internal static partial class AgentsListAgentSessionTurnItemsCommandApiCommand
{
private static Argument<string> SessionId { get; } = new(
name: @"session-id")
{
Description = @"The ID of the session that owns the turn.",
};

private static Argument<string> TurnId { get; } = new(
name: @"turn-id")
{
Description = @"The ID of the turn.",
};

private static Option<long?> Limit { get; } = new(
name: @"--limit")
{
Description = @"The maximum number of resources to return, between 1 and 100. Defaults to 20.",
};

private static Option<global::tryAGI.OpenAI.ListOrderParam?> Order { get; } = new(
name: @"--order")
{
Description = @"The order in which resources are returned. Defaults to `desc`.",
};

private static Option<string?> After { get; } = new(
name: @"--after")
{
Description = @"Return resources after this resource ID in the selected order.",
};

private static string FormatResponse(ParseResult parseResult, global::tryAGI.OpenAI.SessionItemListResource value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings)
{
string? text = null;
CustomizeResponseText(parseResult, value, ref text);
if (!string.IsNullOrWhiteSpace(text))
{
return text;
}

var hints = new Dictionary<string, CliFormatHint>(StringComparer.OrdinalIgnoreCase)
{
};
CustomizeResponseFormatHints(hints);
return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints);
}

static partial void CustomizeResponseText(ParseResult parseResult, global::tryAGI.OpenAI.SessionItemListResource value, ref string? text);
static partial void CustomizeResponseFormatHints(Dictionary<string, CliFormatHint> hints);


static partial void CustomizeCommand(ref Command command);

public static Command Create(string? commandName = null)
{
var command = new Command(commandName ?? @"list-agent-session-turn-items", @"List agent session turn items
Lists items belonging to one root-agent turn, including its interactions with subagents. See [inspecting agent output](https://developers.openai.com/api/docs/guides/agents-api/observability).");
command.Arguments.Add(SessionId);
command.Arguments.Add(TurnId);
command.Options.Add(Limit);
command.Options.Add(Order);
command.Options.Add(After);


command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) =>
await CliRuntime.RunAsync(async () =>
{
var sessionId = parseResult.GetRequiredValue(SessionId);
var turnId = parseResult.GetRequiredValue(TurnId);
var limit = parseResult.GetValue(Limit);
var order = parseResult.GetValue(Order);
var after = parseResult.GetValue(After);
using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false);


var response = await client.Agents.ListAgentSessionTurnItemsAsync(
sessionId: sessionId,
turnId: turnId,
limit: limit,
order: order,
after: after,
cancellationToken: cancellationToken).ConfigureAwait(false);


if (!await CliRuntime.TryWriteOutputDirectoryAsync(
parseResult,
response,
global::tryAGI.OpenAI.SourceGenerationContext.Default,
@"Data",
cancellationToken).ConfigureAwait(false))
{
await CliRuntime.WriteResponseAsync(
parseResult,
response,
global::tryAGI.OpenAI.SourceGenerationContext.Default,
FormatResponse,
cancellationToken).ConfigureAwait(false);
}
}, cancellationToken).ConfigureAwait(false));
CustomizeCommand(ref command);
return command;
}
}
Loading
Loading