mirror of
https://github.com/github/awesome-copilot.git
synced 2026-02-23 20:05:12 +00:00
Add SDK features to all Ralph loop recipes
- Add WorkingDirectory/working_directory to pin sessions to project root - Add OnPermissionRequest/on_permission_request for unattended operation - Add tool execution event logging for visibility - Add See Also cross-links to error-handling and persisting-sessions - Add best practices for WorkingDirectory and permission auto-approval - Consistent across all 4 languages (Node.js, Python, .NET, Go)
This commit is contained in:
@@ -43,14 +43,25 @@ try
|
||||
|
||||
// Fresh session — each task gets full context budget
|
||||
var session = await client.CreateSessionAsync(
|
||||
new SessionConfig { Model = "claude-sonnet-4.5" });
|
||||
new SessionConfig
|
||||
{
|
||||
Model = "claude-sonnet-4.5",
|
||||
// Pin the agent to the project directory
|
||||
WorkingDirectory = Environment.CurrentDirectory,
|
||||
// Auto-approve tool calls for unattended operation
|
||||
OnPermissionRequest = (_, _) => Task.FromResult(
|
||||
new PermissionRequestResult { Kind = "approved" }),
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
var done = new TaskCompletionSource<string>();
|
||||
session.On(evt =>
|
||||
{
|
||||
if (evt is AssistantMessageEvent msg)
|
||||
// Log tool usage for visibility
|
||||
if (evt is ToolExecutionStartEvent toolStart)
|
||||
Console.WriteLine($" ⚙ {toolStart.Data.ToolName}");
|
||||
else if (evt is AssistantMessageEvent msg)
|
||||
done.TrySetResult(msg.Data.Content);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user