exthook

package
v0.11.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package exthook runs optional external processes for experimental client-side automation. See CLIENT_HOOKS.md in the repo root for the full protocol and security notes. Hook-related MARCHAT_* variables appear in marchat-client -doctor output; receive/send paths are validated there when set.

Enable with environment variables (no config file yet):

MARCHAT_CLIENT_HOOK_RECEIVE: absolute path to executable (one JSON line on stdin)
MARCHAT_CLIENT_HOOK_SEND: same for outbound chat-related sends
MARCHAT_CLIENT_HOOK_TIMEOUT_SEC: optional, default 5
MARCHAT_CLIENT_HOOK_RECEIVE_TYPING=1: include typing indicators in receive hook (default: off)
MARCHAT_CLIENT_HOOK_DEBUG=1: log successful hook runs (duration, optional stdout preview)

Security: only absolute paths are accepted. Hooks see plaintext after decrypt (receive) or plaintext before wire send (send). Do not point at untrusted binaries.

Index

Constants

View Source
const (
	EventMessageReceived = "message_received"
	EventMessageSend     = "message_send"
)

Event names are stable for trial integrations; not yet a public protocol.

Variables

This section is empty.

Functions

func FireReceive

func FireReceive(msg shared.Message)

FireReceive runs asynchronously after the client has prepared a chat message (including decrypt).

func FireSend

func FireSend(msg shared.Message)

FireSend runs asynchronously before the corresponding wire send (plaintext).

func ValidateHookExecutable

func ValidateHookExecutable(path string) (string, error)

ValidateHookExecutable checks that path is non-empty, absolute, and refers to an existing regular file. It returns the cleaned path. Used by client diagnostics (-doctor).

Types

This section is empty.

Directories

Path Synopsis
Example stdin hook: append each JSON line to a log file for spike testing.
Example stdin hook: append each JSON line to a log file for spike testing.

Jump to

Keyboard shortcuts

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