actionrunner

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package actionrunner executes a schema's Action against a live site. It is the runtime half of the registry: given a schema (loaded from the registry or a local file) and the name of an action the user wants to invoke, it resolves session state, runs the schema-supplied bootstrap and signer JS, fires the HTTP request through a Chrome-TLS fingerprinted client, and rotates Set-Cookie values back into the session store.

The runtime is deliberately site-agnostic — every piece of x.com / tiktok.com / etc. knowledge lives in the schema JSON. Adding a new Path-1 site is "push a schema to the registry", never "release a new CLI."

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

type Request struct {
	// Schema is the loaded schema for the target site.
	Schema *schema.Schema
	// ActionName is the schema.Action.Name to invoke.
	ActionName string
	// Args are user-supplied key/value pairs for the action's template
	// params (e.g. {text: "hello world"} for CreateDraftTweet).
	Args map[string]string
	// SessionsDir is the parent directory for session state
	// (~/.hermai/sessions on a user machine). Each site gets its own
	// subdirectory containing cookies.json and state.json.
	SessionsDir string
	// HTTPClient is used for the outgoing request. Callers should pass
	// an httpclient.Doer wrapped in http.Client so tls-client's Chrome
	// fingerprint is applied. Required — Run refuses to run without it.
	HTTPClient httpclient.Doer
	// BootstrapClient is used for bootstrap JS fetches. Separate from
	// HTTPClient so the two can have different timeouts / redirect
	// policies. If nil, falls back to HTTPClient wrapped in http.Client.
	BootstrapClient *http.Client
	// DryRun skips the actual network call and returns the fully-signed
	// request for inspection.
	DryRun bool
}

Request carries everything Run needs.

type Result

type Result struct {
	Status     int
	Headers    http.Header
	Body       []byte
	SignedReq  *http.Request // for --dry-run consumers
	Bootstraps int           // how many bootstraps we ran (usually 0 or 1)
}

Result is what Run returns on success.

func Run

func Run(ctx context.Context, req Request) (*Result, error)

Run resolves the session, runs bootstrap + signer as the schema declares, fires the request, and returns the result.

type StateFile

type StateFile struct {
	Site    string            `json:"site"`
	SavedAt time.Time         `json:"saved_at"`
	TTL     int               `json:"ttl_seconds"`
	State   map[string]string `json:"state"`
}

StateFile persists bootstrap output.

Jump to

Keyboard shortcuts

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