bcode_command 0.0.1-alpha.0

Command contract types and service interface for bcode
// BPDL reference contract for Bcode command registry services.
//
// This is the first small Bcode service modeled in BPDL so future command
// registry clients/providers can use generated request/response bindings
// instead of handwritten envelopes.

plugin bcode.cmd version 1;

capability COMMAND_REGISTRY = bcode.cmd.registry;

@capability(COMMAND_REGISTRY)
interface command-registry-query {
    enum command-surface {
        palette,
        slash,
        keybinding,
    }

    enum command-owner-kind {
        host,
        plugin_owner,
    }

    record command-owner {
        kind: command-owner-kind,
        plugin_id: string?,
    }

    enum command-action-kind {
        host,
        plugin_action,
        service,
    }

    record command-action {
        kind: command-action-kind,
        route: string?,
        plugin_id: string?,
        command_name: string?,
        interface_id: string?,
        operation: string?,
        payload: bytes?,
    }

    record command-contribution {
        id: string,
        title: string,
        description: string?,
        category: string?,
        surfaces: list<command-surface>,
        slash_name: string?,
        slash_aliases: list<string>,
        argument_names: list<string>,
        session_requirement: string,
        owner: command-owner,
        action: command-action,
    }

    record list-commands-input {
        surface: command-surface?,
    }

    record list-commands-output {
        commands: list<command-contribution>,
    }

    query list-commands(request: list-commands-input) -> list-commands-output;
}

@capability(COMMAND_REGISTRY)
interface command-registry-command {
    record command-contribution {
        id: string,
        title: string,
        description: string?,
        category: string?,
        slash_name: string?,
        slash_aliases: list<string>,
        argument_names: list<string>,
        session_requirement: string,
    }

    record register-command-input {
        contribution: command-contribution,
    }

    record invoke-command-input {
        command_id: string,
        args_json: string?,
    }

    record invoke-command-output {
        output_json: string?,
    }

    command register(request: register-command-input) -> unit;
    command invoke(request: invoke-command-input) -> invoke-command-output;
}