agentstudio

package
v1.43.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Hostname    = agentstudioapi.Hostname
	Version     = agentstudioapi.Version
	Description = agentstudioapi.Description
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Intermediate

type Intermediate struct {
	*connector.Connector
	ToDo
}

Intermediate extends and customizes the generic base connector.

func NewIntermediate

func NewIntermediate(impl ToDo) *Intermediate

NewIntermediate creates a new instance of the intermediate.

type Mock

type Mock struct {
	*Intermediate
	// contains filtered or unexported fields
}

Mock is a mockable version of the microservice, allowing functions, event sinks and web handlers to be mocked.

func NewMock

func NewMock() *Mock

NewMock creates a new mockable version of the microservice.

func (*Mock) Assets

func (svc *Mock) Assets(w http.ResponseWriter, r *http.Request) (err error)

Assets executes the mock handler.

func (*Mock) ContinueFlow

func (svc *Mock) ContinueFlow(w http.ResponseWriter, r *http.Request) (err error)

ContinueFlow executes the mock handler.

func (*Mock) Dashboard

func (svc *Mock) Dashboard(w http.ResponseWriter, r *http.Request) (err error)

Dashboard executes the mock handler.

func (*Mock) FlowDetail

func (svc *Mock) FlowDetail(w http.ResponseWriter, r *http.Request) (err error)

FlowDetail executes the mock handler.

func (*Mock) ForkFromStep added in v1.43.0

func (svc *Mock) ForkFromStep(w http.ResponseWriter, r *http.Request) (err error)

ForkFromStep executes the mock handler.

func (*Mock) ListFlows

func (svc *Mock) ListFlows(w http.ResponseWriter, r *http.Request) (err error)

ListFlows executes the mock handler.

func (*Mock) ListWorkflows

func (svc *Mock) ListWorkflows(w http.ResponseWriter, r *http.Request) (err error)

ListWorkflows executes the mock handler.

func (*Mock) MockAssets

func (svc *Mock) MockAssets(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock

MockAssets sets up a mock handler for Assets.

func (*Mock) MockContinueFlow

func (svc *Mock) MockContinueFlow(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock

MockContinueFlow sets up a mock handler for ContinueFlow.

func (*Mock) MockDashboard

func (svc *Mock) MockDashboard(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock

MockDashboard sets up a mock handler for Dashboard.

func (*Mock) MockFlowDetail

func (svc *Mock) MockFlowDetail(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock

MockFlowDetail sets up a mock handler for FlowDetail.

func (*Mock) MockForkFromStep added in v1.43.0

func (svc *Mock) MockForkFromStep(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock

MockForkFromStep sets up a mock handler for ForkFromStep.

func (*Mock) MockListFlows

func (svc *Mock) MockListFlows(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock

MockListFlows sets up a mock handler for ListFlows.

func (*Mock) MockListWorkflows

func (svc *Mock) MockListWorkflows(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock

MockListWorkflows sets up a mock handler for ListWorkflows.

func (*Mock) MockPollFlow

func (svc *Mock) MockPollFlow(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock

MockPollFlow sets up a mock handler for PollFlow.

func (*Mock) MockResumeFlow

func (svc *Mock) MockResumeFlow(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock

MockResumeFlow sets up a mock handler for ResumeFlow.

func (*Mock) MockRunWorkflow

func (svc *Mock) MockRunWorkflow(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock

MockRunWorkflow sets up a mock handler for RunWorkflow.

func (*Mock) MockStepDetail

func (svc *Mock) MockStepDetail(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock

MockStepDetail sets up a mock handler for StepDetail.

func (*Mock) MockTaskDetail

func (svc *Mock) MockTaskDetail(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock

MockTaskDetail sets up a mock handler for TaskDetail.

func (*Mock) MockWorkflowDetail

func (svc *Mock) MockWorkflowDetail(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock

MockWorkflowDetail sets up a mock handler for WorkflowDetail.

func (*Mock) OnShutdown

func (svc *Mock) OnShutdown(ctx context.Context) (err error)

OnShutdown is called when the microservice is shut down.

func (*Mock) OnStartup

func (svc *Mock) OnStartup(ctx context.Context) (err error)

OnStartup is called when the microservice is started up.

func (*Mock) PollFlow

func (svc *Mock) PollFlow(w http.ResponseWriter, r *http.Request) (err error)

PollFlow executes the mock handler.

func (*Mock) ResumeFlow

func (svc *Mock) ResumeFlow(w http.ResponseWriter, r *http.Request) (err error)

ResumeFlow executes the mock handler.

func (*Mock) RunWorkflow

func (svc *Mock) RunWorkflow(w http.ResponseWriter, r *http.Request) (err error)

RunWorkflow executes the mock handler.

func (*Mock) StepDetail

func (svc *Mock) StepDetail(w http.ResponseWriter, r *http.Request) (err error)

StepDetail executes the mock handler.

func (*Mock) TaskDetail

func (svc *Mock) TaskDetail(w http.ResponseWriter, r *http.Request) (err error)

TaskDetail executes the mock handler.

func (*Mock) WorkflowDetail

func (svc *Mock) WorkflowDetail(w http.ResponseWriter, r *http.Request) (err error)

WorkflowDetail executes the mock handler.

type Service

type Service struct {
	*Intermediate // IMPORTANT: Do not remove
	// contains filtered or unexported fields
}

Service implements agentstudio.dev which serves a developer UI for inspecting flows.

func NewService

func NewService() *Service

NewService creates a new instance of the microservice.

func (*Service) Assets

func (svc *Service) Assets(w http.ResponseWriter, r *http.Request) (err error)

Assets serves the bespa CSS and JavaScript assets at /bespa/.

func (*Service) ContinueFlow

func (svc *Service) ContinueFlow(w http.ResponseWriter, r *http.Request) (err error)

ContinueFlow renders a form to continue a completed flow's thread with additional state, calls foreman.Continue, and redirects the parent page to the new running flow's detail page. Any flowKey in the target thread is accepted; foreman.Continue resolves the thread from the latest completed flow.

func (*Service) Dashboard

func (svc *Service) Dashboard(w http.ResponseWriter, r *http.Request) (err error)

Dashboard renders an HTML page with operator dashboards for flows and workflows.

func (*Service) FlowDetail

func (svc *Service) FlowDetail(w http.ResponseWriter, r *http.Request) (err error)

FlowDetail renders an HTML page with the details, DAG diagram, and step log of a flow.

func (*Service) ForkFromStep added in v1.43.0

func (svc *Service) ForkFromStep(w http.ResponseWriter, r *http.Request) (err error)

ForkFromStep renders a form to fork a terminal flow from a specific recorded step with optional state overrides, calls foreman.Fork, and redirects the parent page to the newly forked flow's detail page. The original flow is never modified.

func (*Service) Init

func (svc *Service) Init(initializer func(svc *Service) (err error)) *Service

Init enables a single-statement pattern for initializing the microservice.

func (*Service) ListFlows

func (svc *Service) ListFlows(w http.ResponseWriter, r *http.Request) (err error)

ListFlows renders an HTML page with a paginated table of flows.

func (*Service) ListWorkflows

func (svc *Service) ListWorkflows(w http.ResponseWriter, r *http.Request) (err error)

ListWorkflows renders an HTML page listing every workflow endpoint discoverable on the bus. Multicasts to //all:888/openapi.json and filters operations down to those with x-feature-type=workflow. Bypasses the openapi portal because the portal port-filters and we want every port (workflows live on :428, not :443).

func (*Service) OnShutdown

func (svc *Service) OnShutdown(ctx context.Context) (err error)

OnShutdown is called when the microservice is shut down.

func (*Service) OnStartup

func (svc *Service) OnStartup(ctx context.Context) (err error)

OnStartup is called when the microservice is started up.

func (*Service) PollFlow

func (svc *Service) PollFlow(w http.ResponseWriter, r *http.Request) (err error)

PollFlow long-polls a flow's graph state. Returns JSON for the bespa ProgressWidget: value=-1 keeps the indeterminate animation, action=URL drives a partial page redraw, stop=true halts the browser polling loop.

func (*Service) ResumeFlow

func (svc *Service) ResumeFlow(w http.ResponseWriter, r *http.Request) (err error)

ResumeFlow renders a form to resume an interrupted flow with a resume payload, calls foreman.Resume, and redirects the parent page back to the same flow's detail page. The payload is delivered to the parked task's flow.Interrupt call as its return value (not merged into state).

func (*Service) RunWorkflow

func (svc *Service) RunWorkflow(w http.ResponseWriter, r *http.Request) (err error)

RunWorkflow renders a form to create and start a workflow with an initial state, and submits it to the foreman. On success it redirects the parent page to the new flow's detail page. State is parsed as JSON first; on failure, retried as YAML so the caller can paste either format without a manual switch.

func (*Service) StepDetail

func (svc *Service) StepDetail(w http.ResponseWriter, r *http.Request) (err error)

StepDetail renders an HTML page with the details of one execution step. Designed to be embedded inside the FlowDetail page's modal. Reads the step's full state, changes, and interrupt payload from foreman.Step and lays them out as a form with one field per state key; fields whose values changed during this step show the initial and changed value side-by-side.

func (*Service) TaskDetail

func (svc *Service) TaskDetail(w http.ResponseWriter, r *http.Request) (err error)

TaskDetail renders an HTML page with the metadata of a single task in a workflow graph. Designed to be embedded inside the WorkflowDetail page's side panel. Reads workflow=<workflowURL>&task=<taskName> from the query, fetches the workflow graph to resolve the task's URL and detect subgraphs, then pulls the task's description from the hosting microservice's :888/openapi.json.

func (*Service) WorkflowDetail

func (svc *Service) WorkflowDetail(w http.ResponseWriter, r *http.Request) (err error)

WorkflowDetail renders an HTML page with the structure and definition of a single workflow graph. The workflow is identified by its full bus URL minus the https:// scheme, captured as the greedy {workflowURL...} path argument. The handler fetches the graph from the workflow endpoint and renders it via the workflow package's GraphRenderer.

type ToDo

type ToDo interface {
	OnStartup(ctx context.Context) (err error)
	OnShutdown(ctx context.Context) (err error)
	ListFlows(w http.ResponseWriter, r *http.Request) (err error)      // MARKER: ListFlows
	FlowDetail(w http.ResponseWriter, r *http.Request) (err error)     // MARKER: FlowDetail
	StepDetail(w http.ResponseWriter, r *http.Request) (err error)     // MARKER: StepDetail
	ListWorkflows(w http.ResponseWriter, r *http.Request) (err error)  // MARKER: ListWorkflows
	WorkflowDetail(w http.ResponseWriter, r *http.Request) (err error) // MARKER: WorkflowDetail
	RunWorkflow(w http.ResponseWriter, r *http.Request) (err error)    // MARKER: RunWorkflow
	ContinueFlow(w http.ResponseWriter, r *http.Request) (err error)   // MARKER: ContinueFlow
	ResumeFlow(w http.ResponseWriter, r *http.Request) (err error)     // MARKER: ResumeFlow
	ForkFromStep(w http.ResponseWriter, r *http.Request) (err error)   // MARKER: ForkFromStep
	PollFlow(w http.ResponseWriter, r *http.Request) (err error)       // MARKER: PollFlow
	TaskDetail(w http.ResponseWriter, r *http.Request) (err error)     // MARKER: TaskDetail
	Dashboard(w http.ResponseWriter, r *http.Request) (err error)      // MARKER: Dashboard
	Assets(w http.ResponseWriter, r *http.Request) (err error)         // MARKER: Assets
}

ToDo is implemented by the service or mock. The intermediate delegates handling to this interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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