Skip to content

mxyhi/ok-skills / kimi-webbridge

kimi-webbridge

Unverified

Kimi Browser Extension(Kimi 浏览器扩展,原 Kimi WebBridge)lets AI control the user's real browser — navigate, click, type, read, screenshot, and interact with any website using the user's actual login sessions. Use this skill whenever the user wants to interact with websites, automate browser tasks, scrape web content, or perform any action requiring a real browser. Also use when the user mentions "browser", "webpage", "open URL", "screenshot", asks to read/interact with any website, or wants a reusable CLI tool or script that automates a specific website. Use even for simple-sounding browser requests — the daemon handles all complexity.

references/cli-creator/go-layout.md

View on GitHub
# Go CLI Layout

A standalone Go CLI project that can live in any directory.

## Contents

- Init
- Directory structure
- browser/client.go — daemon client, tab reuse
- output/output.go — JSON envelope
- cmd/root.go — `--daemon-url`, command registration
- Build and run

## Init

```bash
mkdir {platform}-cli && cd {platform}-cli
go mod init {platform}-cli
go get github.com/spf13/cobra
```

## Directory structure

```
{platform}-cli/
├── go.mod
├── main.go                  # calls cmd.Execute(), exits 1 on error
├── browser/
│   └── client.go            # daemon HTTP client
├── output/
│   └── output.go            # JSON output envelope
├── {platform}/
│   ├── login.go             # login status (if the site requires login)
│   └── {feature}.go         # one file per feature
├── cmd/
│   └── root.go              # cobra command registration
└── skill/
    └── {platform}-cli/
        └── SKILL.md         # companion skill (Phase 4)
```

## browser/client.go

```go
package browser

import (
    "bytes"
    "encoding/json"
    "fmt"
    "net/http"
    "time"
)

const DefaultDaemonURL = "http://127.0.0.1:10086"

type Client struct {
    baseURL string
    session string
    http    *http.Client
}

func NewClient(baseURL, session string) *Client {
    return &Client{
        baseURL: baseURL,
        session: session,
        http:    &http.Client{Timeout: 90 * time.Second},
    }
}

func (c *Client) Call(action string, args map[string]any) (json.RawMessage, error) {
    body, _ := json.Marshal(map[string]any{
        "action":  action,
        "session": c.session,
        "args":    args,
    })
    resp, err := c.http.Post(c.baseURL+"/command", "application/json", bytes.NewReader(body))
    if err != nil {
        return nil, fmt.Errorf("daemon unreachable: %w", err)
    }
    defer resp.Body.Close()
    var result struct {
        OK    bool            `json:"ok"`
        Data  json.RawMessage `json:"data"`
        Error *struct {
            Code    string `json:"code"`
            Message string `json:"message"`
        } `json:"error"`
    }
    if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
        return nil, err
    }
    if !result.OK {
        if result.Error == nil {
            return nil, fmt.Errorf("unexpected reply from %s: not the kimi-webbridge daemon?", c.baseURL)
        }
        return nil, fmt.Errorf("%s: %s", result.Error.Code, result.Error.Message)
    }
    return result.Data, nil
}

// OpenTab reuses the CLI's tab when it is still open, so repeated runs
// don't pile up tabs.
func (c *Client) OpenTab(url string) error {
    if _, err := c.Call("find_tab", map[string]any{"url": url}); err == nil {
        return nil
    }
    _, err := c.Call("navigate", map[string]any{"url": url, "newTab": true})
    return err
}

func (c *Client) Evaluate(code string) (json.RawMessage, error) {
    return c.Call("evaluate", map[string]any{"code": code})
}
```

## output/output.go

```go
package output

import (
    "encoding/json"
    "fmt"
    "os"
)

func Success(data any) {
    printJSON(map[string]any{"ok": true, "data": data})
}

func Error(code, message string) {
    printJSON(map[string]any{"ok": false, "error": map[string]any{"code": code, "message": message}})
}

func printJSON(v any) {
    enc := json.NewEncoder(os.Stdout)
    enc.SetEscapeHTML(false)
    enc.SetIndent("", "  ")
    if err := enc.Encode(v); err != nil {
        fmt.Fprintf(os.Stderr, "output error: %v\n", err)
    }
}
```

## cmd/root.go

```go
package cmd

import (
    "os"

    "github.com/spf13/cobra"
    "{platform}-cli/browser"
    "{platform}-cli/output"
    "{platform}-cli/{platform}"
)

var daemonURL string

var rootCmd = &cobra.Command{
    Use:   "{platform}-cli",
    Short: "{Platform} automation CLI",
}

func Execute() error {
    return rootCmd.Execute()
}

func newClient() *browser.Client {
    return browser.NewClient(daemonURL, "{platform}")
}

func init() {
    rootCmd.PersistentFlags().StringVar(&daemonURL, "daemon-url", browser.DefaultDaemonURL, "address of the kimi-webbridge daemon")

    searchCmd := &cobra.Command{
        Use:   "search <query>",
        Short: "Search {Platform}",
        Args:  cobra.ExactArgs(1),
        Run: func(cmd *cobra.Command, args []string) {
            limit, _ := cmd.Flags().GetInt("limit")
            items, err := {platform}.Search(newClient(), args[0], limit)
            if err != nil {
                output.Error("search_error", err.Error())
                os.Exit(1)
            }
            output.Success(items)
        },
    }
    searchCmd.Flags().Int("limit", 20, "max items to return")
    rootCmd.AddCommand(searchCmd)
}
```

## Build and run

```bash
go build -o {platform}-cli .
./{platform}-cli --help
./{platform}-cli search "keyword" --limit 5
```
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall