proc

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package proc provides the CLI-side glue between session-creating commands (`ctm attach`, `ctm new`, `ctm yolo`, etc.) and the local `ctm serve` daemon: a fire-and-forget spawner that ensures serve is up, and a tiny HTTP client that POSTs lifecycle events to its /api/hooks/:event endpoint.

Both helpers are best-effort. Serve is observability — failures here log at WARN/DEBUG and never block the user-visible CLI flow.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureServeRunning

func EnsureServeRunning(ctx context.Context)

EnsureServeRunning probes /healthz; if no `ctm serve` listens, it spawns one as a detached child via setsid and waits up to 2 s for readiness, then returns. The caller never blocks past 2 s — if serve isn't up by then, subsequent PostEvent calls degrade silently.

func PostEvent

func PostEvent(event string, form url.Values)

PostEvent fires a hook event to the local serve daemon. event must match one of the names whitelisted in `internal/serve/api.Hooks` (session_new / session_attached / session_killed / on_yolo). The form is sent as `application/x-www-form-urlencoded`. No bearer token is needed — /api/hooks/* is unauthed (daemon binds 127.0.0.1 only).

Types

This section is empty.

Jump to

Keyboard shortcuts

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