github-copilot-sdk 1.0.9

Rust SDK for programmatic control of the GitHub Copilot CLI via JSON-RPC.
Documentation
use github_copilot_sdk::rpc::UIEphemeralQueryRequest;

#[tokio::test]
async fn should_answer_ephemeral_query() {
    super::support::with_shared_e2e_context(
        &E2E,
        "rpc_ui_ephemeral_query",
        "should_answer_ephemeral_query",
        |ctx| {
            Box::pin(async move {
                ctx.set_default_copilot_user();
                let client = ctx.start_client().await;
                let session = client
                    .create_session(ctx.approve_all_session_config())
                    .await
                    .expect("create session");

                let mut request = UIEphemeralQueryRequest::default();
                request.question =
                    "In one word, what is the primary color of a clear daytime sky?".to_string();
                let result = session
                    .rpc()
                    .ui()
                    .ephemeral_query(request)
                    .await
                    .expect("answer ephemeral query");

                assert!(!result.answer.trim().is_empty());
                assert!(result.answer.to_ascii_lowercase().contains("blue"));

                session.disconnect().await.expect("disconnect session");
                client.stop().await.expect("stop client");
            })
        },
    )
    .await;
}
static E2E: super::support::SharedE2eGroup =
    super::support::SharedE2eGroup::standard("rpc_ui_ephemeral_query", 1);