Token导航 LogoToken导航

Agent Skill · 前端设计

add-rpc(添加远程过程调用)

add-rpc 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

add-rpc 是前端设计类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为执行命令;许可证信息还不明确,第三方扫描已通过,按安装量在前端设计类的 10,216 个 Skill 里排第 6,944。

总安装 441周安装 18GitHub Stars 19,422下载 143核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:add-rpc(添加远程过程调用)
来源仓库:https://github.com/wavetermdev/waveterm
仓库路径:skills/add-rpc
安装命令:
npx skills add https://github.com/wavetermdev/waveterm --skill add-rpc
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/wavetermdev/waveterm --skill add-rpc

这个 Skill 是做什么的

前端设计类 Skill 关注页面结构、视觉规范和组件写法,输出通常是可运行的界面代码。

为 Wave Terminal 添加新的 RPC(远程过程调用)命令,实现组件间通信。适用于扩展终端功能,如前端、后端或远程服务器间的数据交互。需遵循接口定义和类型约束,确保命令兼容现有系统。主要实现文件包括 wshserver.go、emain-wsh.ts 等,需按文档结构开发。

建议在 pkg/wshrpc 目录下创建新命令,并更新相关类型定义。

来源仓库内路径:skills/add-rpc

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/wavetermdev/waveterm --skill add-rpc;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要执行命令,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

add-rpc 怎么安装?

在终端执行 npx skills add https://github.com/wavetermdev/waveterm --skill add-rpc。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

add-rpc 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

add-rpc 需要什么权限?

权限级别是执行命令。安装流程涉及命令执行,可能通过 npx skills add https://github.com/wavetermdev/waveterm --skill add-rpc 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

add-rpc 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

add-rpc 用的人多吗?

公开数据是累计安装 441 次,近一周安装 18 次,下载 143 次,GitHub 19,422 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

add-rpc 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。
  • 来源仓库有 19,422 星,维护活跃度相对可查。

先想清楚的地方

  • 需要执行命令,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理前端设计类任务、又不想每次都手写提示词的人。

不太适合

  • 不能接受 Skill 在你机器上执行命令的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

前端设计类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
frontend-design

前端设计 · Codex、Claude

8,823,360126,072只读MIT通过
vercel-composition-patterns

Vercel 组合模式 · Codex、Claude

3,858,81625,893需要联网MIT通过
vercel-react-native-skills

Vercel React native skills 前端 · Codex、Claude

2,468,66425,878只读MIT通过
adapt

adapt 搜索 · Codex、Claude

2,027,04023,125操作浏览器未明确通过
bolder

bolder 分析 · Codex、Claude

2,004,28823,130只读未明确通过
add-rpc

添加远程过程调用 · 本页

44119,422执行命令未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Adding RPC Calls Guide

Overview

Wave Terminal uses a WebSocket-based RPC (Remote Procedure Call) system for communication between different components. The RPC system allows the frontend, backend, electron main process, remote servers, and terminal blocks to communicate with each other through well-defined commands.

This guide covers how to add a new RPC command to the system.

Key Files

  • pkg/wshrpc/wshrpctypes.go - RPC interface and type definitions
  • pkg/wshrpc/wshserver/wshserver.go - Main server implementation (most common)
  • emain/emain-wsh.ts - Electron main process implementation
  • frontend/app/store/tabrpcclient.ts - Frontend tab implementation
  • pkg/wshrpc/wshremote/wshremote.go - Remote server implementation
  • frontend/app/view/term/term-wsh.tsx - Terminal block implementation

RPC Command Structure

RPC commands in Wave Terminal follow these conventions:

  • Method names must end with Command
  • First parameter must be context.Context
  • Remaining parameters are a regular Go parameter list (zero or more typed args)
  • Return values can be either just an error, or one return value plus an error
  • Streaming commands return a channel instead of a direct value

Adding a New RPC Call

Step 1: Define the Command in the Interface

Add your command to the WshRpcInterface in pkg/wshrpc/wshrpctypes.go:

type WshRpcInterface interface {
    // ... existing commands ...

    // Add your new command
    YourNewCommand(ctx context.Context, data CommandYourNewData) (*YourNewResponse, error)
}

Method Signature Rules:

  • Method name must end with Command
  • First parameter must be ctx context.Context
  • Remaining parameters are a regular Go parameter list (zero or more)
  • Return either error or (ReturnType, error)
  • For streaming, return chan RespOrErrorUnion[T]

Step 2: Define Request and Response Types

If your command needs structured input or output, define types in the same file:

type CommandYourNewData struct {
    FieldOne   string `json:"fieldone"`
    FieldTwo   int    `json:"fieldtwo"`
    SomeId     string `json:"someid"`
}

type YourNewResponse struct {
    ResultField string `json:"resultfield"`
    Success     bool   `json:"success"`
}

Type Naming Conventions:

  • Request types: Command[Name]Data (e.g., CommandGetMetaData)
  • Response types: [Name]Response or Command[Name]RtnData (e.g., CommandResolveIdsRtnData)
  • Use json struct tags with lowercase field names
  • Follow existing patterns in the file for consistency

Step 3: Generate Bindings

After modifying pkg/wshrpc/wshrpctypes.go, run code generation to create TypeScript bindings and Go helper code:

task generate

This command will:

  • Generate TypeScript type definitions in frontend/types/gotypes.d.ts
  • Create RPC client bindings
  • Update routing code

Note: If generation fails, check that your method signature follows all the rules above.

Step 4: Implement the Command

Choose where to implement your command based on what it needs to do:

A. Main Server Implementation (Most Common)

Implement in pkg/wshrpc/wshserver/wshserver.go:

func (ws *WshServer) YourNewCommand(ctx context.Context, data wshrpc.CommandYourNewData) (*wshrpc.YourNewResponse, error) {
    // Validate input
    if data.SomeId == "" {
        return nil, fmt.Errorf("someid is required")
    }

    // Implement your logic
    result := doSomething(data)

    // Return response
    return &wshrpc.YourNewResponse{
        ResultField: result,
        Success:     true,
    }, nil
}

Use main server when:

  • Accessing the database
  • Managing blocks, tabs, or workspaces
  • Coordinating between components
  • Handling file operations on the main filesystem
B. Electron Implementation

Implement in emain/emain-wsh.ts:

async handle_yournew(rh: RpcResponseHelper, data: CommandYourNewData): Promise<YourNewResponse> {
    // Electron-specific logic
    const result = await electronAPI.doSomething(data);

    return {
        resultfield: result,
        success: true,
    };
}

Use Electron when:

  • Accessing native OS features
  • Managing application windows
  • Using Electron APIs (notifications, system tray, etc.)
  • Handling encryption/decryption with safeStorage
C. Frontend Tab Implementation

Implement in frontend/app/store/tabrpcclient.ts:

async handle_yournew(rh: RpcResponseHelper, data: CommandYourNewData): Promise<YourNewResponse> {
    // Access frontend state/models
    const layoutModel = getLayoutModelForStaticTab();

    // Implement tab-specific logic
    const result = layoutModel.doSomething(data);

    return {
        resultfield: result,
        success: true,
    };
}

Use tab client when:

  • Accessing React state or Jotai atoms
  • Manipulating UI layout
  • Capturing screenshots
  • Reading frontend-only data
D. Remote Server Implementation

Implement in pkg/wshrpc/wshremote/wshremote.go:

func (impl *ServerImpl) RemoteYourNewCommand(ctx context.Context, data wshrpc.CommandRemoteYourNewData) (*wshrpc.YourNewResponse, error) {
    // Remote filesystem or process operations
    result, err := performRemoteOperation(data)
    if err != nil {
        return nil, fmt.Errorf("remote operation failed: %w", err)
    }

    return &wshrpc.YourNewResponse{
        ResultField: result,
        Success:     true,
    }, nil
}

Use remote server when:

  • Operating on remote filesystems
  • Executing commands on remote hosts
  • Managing remote processes
  • Convention: prefix command name with Remote (e.g., RemoteGetInfoCommand)
E. Terminal Block Implementation

Implement in frontend/app/view/term/term-wsh.tsx:

async handle_yournew(rh: RpcResponseHelper, data: CommandYourNewData): Promise<YourNewResponse> {
    // Access terminal-specific data
    const termWrap = this.model.termRef.current;

    // Implement terminal logic
    const result = termWrap.doSomething(data);

    return {
        resultfield: result,
        success: true,
    };
}

Use terminal client when:

  • Accessing terminal buffer/scrollback
  • Managing VDOM contexts
  • Reading terminal-specific state
  • Interacting with xterm.js

Complete Example: Adding GetWaveInfo Command

1. Define Interface

In pkg/wshrpc/wshrpctypes.go:

type WshRpcInterface interface {
    // ... other commands ...
    WaveInfoCommand(ctx context.Context) (*WaveInfoData, error)
}

type WaveInfoData struct {
    Version      string            `json:"version"`
    BuildTime    string            `json:"buildtime"`
    ConfigPath   string            `json:"configpath"`
    DataPath     string            `json:"datapath"`
}

2. Generate Bindings

task generate

3. Implement in Main Server

In pkg/wshrpc/wshserver/wshserver.go:

func (ws *WshServer) WaveInfoCommand(ctx context.Context) (*wshrpc.WaveInfoData, error) {
    return &wshrpc.WaveInfoData{
        Version:    wavebase.WaveVersion,
        BuildTime:  wavebase.BuildTime,
        ConfigPath: wavebase.GetConfigDir(),
        DataPath:   wavebase.GetWaveDataDir(),
    }, nil
}

4. Call from Frontend

import { RpcApi } from "@/app/store/wshclientapi";

// Call the RPC
const info = await RpcApi.WaveInfoCommand(TabRpcClient);
console.log("Wave Version:", info.version);

Streaming Commands

For commands that return data progressively, use channels:

Define Streaming Interface

type WshRpcInterface interface {
    StreamYourDataCommand(ctx context.Context, request YourDataRequest) chan RespOrErrorUnion[YourDataType]
}

Implement Streaming Command

func (ws *WshServer) StreamYourDataCommand(ctx context.Context, request wshrpc.YourDataRequest) chan wshrpc.RespOrErrorUnion[wshrpc.YourDataType] {
    rtn := make(chan wshrpc.RespOrErrorUnion[wshrpc.YourDataType])

    go func() {
        defer close(rtn)
        defer func() {
            panichandler.PanicHandler("StreamYourDataCommand", recover())
        }()

        // Stream data
        for i := 0; i < 10; i++ {
            select {
            case <-ctx.Done():
                return
            default:
                rtn <- wshrpc.RespOrErrorUnion[wshrpc.YourDataType]{
                    Response: wshrpc.YourDataType{
                        Value: i,
                    },
                }
                time.Sleep(100 * time.Millisecond)
            }
        }
    }()

    return rtn
}

Best Practices

  1. Validation First: Always validate input parameters at the start of your implementation
  2. Descriptive Names: Use clear, action-oriented command names (e.g., GetFullConfigCommand, not ConfigCommand)
  3. Error Handling: Return descriptive errors with context: return nil, fmt.Errorf("error creating block: %w", err)
  4. Context Awareness: Respect context cancellation for long-running operations: select {case <-ctx.Done(): return ctx.Err() default: // continue}
  5. Consistent Types: Follow existing naming patterns for request/response types
  6. JSON Tags: Always use lowercase JSON tags matching frontend conventions
  7. Documentation: Add comments explaining complex commands or special behaviors
  8. Type Safety: Leverage TypeScript generation - your types will be checked on both ends
  9. Panic Recovery: Use panichandler.PanicHandler in goroutines to prevent crashes
  10. Route Awareness: For multi-route scenarios, use wshutil.GetRpcSourceFromContext(ctx) to identify callers

Common Command Patterns

Simple Query

func (ws *WshServer) GetSomethingCommand(ctx context.Context, id string) (*Something, error) {
    obj, err := wstore.DBGet[*Something](ctx, id)
    if err != nil {
        return nil, fmt.Errorf("error getting something: %w", err)
    }
    return obj, nil
}

Mutation with Updates

func (ws *WshServer) UpdateSomethingCommand(ctx context.Context, data wshrpc.CommandUpdateData) error {
    ctx = waveobj.ContextWithUpdates(ctx)

    // Make changes
    err := wstore.UpdateObject(ctx, data.ORef, data.Updates)
    if err != nil {
        return fmt.Errorf("error updating: %w", err)
    }

    // Broadcast updates
    updates := waveobj.ContextGetUpdatesRtn(ctx)
    wps.Broker.SendUpdateEvents(updates)

    return nil
}

Command with Side Effects

func (ws *WshServer) DoActionCommand(ctx context.Context, data wshrpc.CommandActionData) error {
    // Perform action
    result, err := performAction(data)
    if err != nil {
        return err
    }

    // Publish event about the action
    go func() {
        wps.Broker.Publish(wps.WaveEvent{
            Event: wps.Event_ActionComplete,
            Data:  result,
        })
    }()

    return nil
}

Troubleshooting

Command Not Found

  • Ensure method name ends with Command
  • Verify you ran task generate
  • Check that the interface is in WshRpcInterface

Type Mismatch Errors

  • Run task generate after changing types
  • Ensure JSON tags are lowercase
  • Verify TypeScript code is using generated types

Command Times Out

  • Check for blocking operations
  • Ensure context is passed through
  • Consider using a streaming command for long operations

Routing Issues

  • For remote commands, ensure they're implemented in correct location
  • Check route configuration in RpcContext
  • Verify authentication for secured routes

Quick Reference

When adding a new RPC command:

  • Add method to WshRpcInterface in pkg/wshrpc/wshrpctypes.go (must end with Command)
  • Define request/response types with JSON tags (if needed)
  • Run task generate to create bindings
  • Implement in appropriate location:

- wshserver.go for main server (most common) - emain-wsh.ts for Electron - tabrpcclient.ts for frontend - wshremote.go for remote (prefix with Remote) - term-wsh.tsx for terminal

  • Add input validation
  • Handle errors with context
  • Test the command end-to-end

Related Documentation

  • WPS Events: See the wps-events skill - Publishing events from RPC commands

平台分布

Codex

35.41%
按下载量换算51

Claude

31.7%
按下载量换算45

Cursor

16.6%
按下载量换算24

Gemini CLI

8.79%
按下载量换算13

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/wavetermdev/waveterm --skill add-rpc 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills