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
28 changes: 27 additions & 1 deletion dotnet/src/Generated/Rpc.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions go/rpc/zrpc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------------------------------------------*/

// AUTO-GENERATED FILE - DO NOT EDIT
// Generated from: api.schema.json

package com.github.copilot.generated.rpc;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.copilot.CopilotExperimental;
import java.util.List;
import javax.annotation.processing.Generated;

/**
* Slash commands available in the session, after applying any include/exclude filters.
*
* @apiNote This method is experimental and may change in a future version.
* @since 1.0.0
*/
@CopilotExperimental
@javax.annotation.processing.Generated("copilot-sdk-codegen")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public record CommandsListResult(
/** Commands available in this session */
@JsonProperty("commands") List<SlashCommandInfo> commands
) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------------------------------------------*/

// AUTO-GENERATED FILE - DO NOT EDIT
// Generated from: api.schema.json

package com.github.copilot.generated.rpc;

import com.github.copilot.CopilotExperimental;
import java.util.concurrent.CompletableFuture;
import javax.annotation.processing.Generated;

/**
* API methods for the {@code commands} namespace.
*
* @since 1.0.0
*/
@javax.annotation.processing.Generated("copilot-sdk-codegen")
public final class ServerCommandsApi {

private final RpcCaller caller;

/** @param caller the RPC transport function */
ServerCommandsApi(RpcCaller caller) {
this.caller = caller;
}

/**
* Slash commands available in the session, after applying any include/exclude filters.
*
* @apiNote This method is experimental and may change in a future version.
* @since 1.0.0
*/
@CopilotExperimental
public CompletableFuture<CommandsListResult> list() {
return caller.invoke("commands.list", java.util.Map.of(), CommandsListResult.class);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public final class ServerRpc {
public final ServerAgentsApi agents;
/** API methods for the {@code instructions} namespace. */
public final ServerInstructionsApi instructions;
/** API methods for the {@code commands} namespace. */
public final ServerCommandsApi commands;
/** API methods for the {@code user} namespace. */
public final ServerUserApi user;
/** API methods for the {@code runtime} namespace. */
Expand Down Expand Up @@ -72,6 +74,7 @@ public ServerRpc(RpcCaller caller) {
this.skills = new ServerSkillsApi(caller);
this.agents = new ServerAgentsApi(caller);
this.instructions = new ServerInstructionsApi(caller);
this.commands = new ServerCommandsApi(caller);
this.user = new ServerUserApi(caller);
this.runtime = new ServerRuntimeApi(caller);
this.sessionFs = new ServerSessionFsApi(caller);
Expand Down
10 changes: 10 additions & 0 deletions nodejs/src/generated/rpc.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions nodejs/test/e2e/rpc_server.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,26 @@ describe("Server-scoped RPC", async () => {
}
});

it("should call rpc commands list with well-known session-start commands", async () => {
await client.start();
const result = await client.rpc.commands.list();
expect(result.commands).toBeDefined();
expect(result.commands.length).toBeGreaterThan(0);

const names = result.commands.map((command) => command.name);
// Well-known commands that work as the first message in a new session.
expect(names).toContain("plan");
expect(names).toContain("env");
// Commands that require an active session must not be listed.
expect(names).not.toContain("compact");
expect(names).not.toContain("usage");

for (const command of result.commands) {
expect(command.name).toBeTruthy();
expect(command.kind).toBe("builtin");
}
});

it("should call rpc sessionFs setProvider with typed result", async () => {
const fsClient = createClientWithEnv({});
await fsClient.start();
Expand Down
12 changes: 12 additions & 0 deletions python/copilot/generated/rpc.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions rust/src/generated/api_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ pub mod rpc_methods {
pub const INSTRUCTIONS_DISCOVER: &str = "instructions.discover";
/// `instructions.getDiscoveryPaths`
pub const INSTRUCTIONS_GETDISCOVERYPATHS: &str = "instructions.getDiscoveryPaths";
/// `commands.list`
pub const COMMANDS_LIST: &str = "commands.list";
/// `user.settings.reload`
pub const USER_SETTINGS_RELOAD: &str = "user.settings.reload";
/// `user.settings.get`
Expand Down Expand Up @@ -15476,6 +15478,21 @@ pub struct InstructionsGetDiscoveryPathsResult {
pub paths: Vec<InstructionDiscoveryPath>,
}

/// Slash commands available in the session, after applying any include/exclude filters.
///
/// <div class="warning">
///
/// **Experimental.** This type is part of an experimental wire-protocol surface
/// and may change or be removed in future SDK or CLI releases.
///
/// </div>
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CommandsListResult {
/// Commands available in this session
pub commands: Vec<SlashCommandInfo>,
}

/// Result of opening a session.
///
/// <div class="warning">
Expand Down
39 changes: 39 additions & 0 deletions rust/src/generated/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ impl<'a> ClientRpc<'a> {
}
}

/// `commands.*` sub-namespace.
pub fn commands(&self) -> ClientRpcCommands<'a> {
ClientRpcCommands {
client: self.client,
}
}

/// `instructions.*` sub-namespace.
pub fn instructions(&self) -> ClientRpcInstructions<'a> {
ClientRpcInstructions {
Expand Down Expand Up @@ -457,6 +464,38 @@ impl<'a> ClientRpcAgents<'a> {
}
}

/// `commands.*` RPCs.
#[derive(Clone, Copy)]
pub struct ClientRpcCommands<'a> {
pub(crate) client: &'a Client,
}

impl<'a> ClientRpcCommands<'a> {
/// Lists the well-known built-in slash commands that work as the first message in a new session (e.g. /plan, /env), without requiring an active session. Commands that depend on session state, authentication, or a synced session are omitted.
///
/// Wire method: `commands.list`.
///
/// # Returns
///
/// Slash commands available in the session, after applying any include/exclude filters.
///
/// <div class="warning">
///
/// **Experimental.** This API is part of an experimental wire-protocol surface
/// and may change or be removed in future SDK or CLI releases. Pin both the
/// SDK and CLI versions if your code depends on it.
///
/// </div>
pub async fn list(&self) -> Result<CommandList, Error> {
let wire_params = serde_json::json!({});
let _value = self
.client
.call(rpc_methods::COMMANDS_LIST, Some(wire_params))
.await?;
Ok(serde_json::from_value(_value)?)
}
}

/// `instructions.*` RPCs.
#[derive(Clone, Copy)]
pub struct ClientRpcInstructions<'a> {
Expand Down
Loading