clientbridge

package
v0.1.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package clientbridge reports pmock-cli operations to a running PMOCK desktop client so the client's UI can show the same "Agent is operating" badge and data-change refresh as its built-in MCP server.

The bridge is deliberately one-way and fail-open: it only POSTs a small, validated event to 127.0.0.1 with the token the client wrote to userData/mcp/runtime.json. It never executes a business action through the client and never blocks a CLI call for more than a short timeout.

Index

Constants

View Source
const (
	// EnvLink disables the bridge when set to 0/false/off/no.
	EnvLink = "PMOCK_CLIENT_LINK"
	// EnvRuntime overrides the runtime.json path (or its directory).
	EnvRuntime = "PMOCK_CLIENT_RUNTIME"
)

Environment variables.

Variables

This section is empty.

Functions

func Enabled

func Enabled() bool

Enabled reports whether the client bridge is allowed to report. It is on by default so an installed, running client lights up without extra flags.

func Report

func Report(ctx context.Context, event Event) error

Report sends one event to the running client. Errors are returned for tests and diagnostics; callers normally ignore them because the bridge is optional.

Types

type Event

type Event struct {
	Kind      string   `json:"kind"`
	Tool      string   `json:"tool,omitempty"`
	Action    string   `json:"action,omitempty"`
	PhoneID   string   `json:"phoneId,omitempty"`
	PhoneCode string   `json:"phoneCode,omitempty"`
	Scopes    []string `json:"scopes,omitempty"`
	PhoneIDs  []string `json:"phoneIds,omitempty"`
	SettleMS  int      `json:"settleMs,omitempty"`
	At        int64    `json:"at,omitempty"`
}

Event is the payload accepted by the client's POST /agent-event endpoint.

func Describe

func Describe(path []string, params map[string]any) []Event

Describe maps a CLI command path and its params to the client events that should be emitted. Activity is emitted before applied so the UI badge shows up even if the data refresh is coalesced.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL