Documentation
¶
Index ¶
- Constants
- Variables
- func IsProviderAuthOrNetworkError(err error) bool
- func IsProviderRateLimited(err error) bool
- type Action
- type ActionHookContext
- type AddPullRequestActivityParams
- type AddPullRequestParams
- type AddWorkOrderArtifactParams
- type AddWorkOrderCommentParams
- type App
- type AppContext
- type AppExecutionContext
- type AppMessageContext
- type AppTrigger
- type AuthReader
- type BrowserAction
- type CanvasMemoryContext
- type CanvasMemoryRecord
- type CanvasNode
- type Capability
- type CapabilityContext
- type CapabilityGroup
- type CapabilityUpdateContext
- type ComputeUsageRecord
- type Configurable
- type DefaultHostedLLMModel
- type EventContext
- type ExecutionContext
- type ExecutionStateContext
- type ExpressionContext
- type FactoryContext
- type FindPullRequestParams
- type FindWorkOrderParams
- type GroupRef
- type HTTPContext
- type HTTPRequestContext
- type Hook
- type HookType
- type HostedLLMAccess
- type HostedLLMContext
- type Integration
- type IntegrationAction
- type IntegrationCapabilityState
- type IntegrationCapabilityType
- type IntegrationCleanupContext
- type IntegrationContext
- type IntegrationHookContext
- type IntegrationMessageContext
- type IntegrationPropertyDefinition
- type IntegrationPropertyStorage
- type IntegrationPropertyStorageReader
- type IntegrationPropertyType
- type IntegrationResource
- type IntegrationSecret
- type IntegrationSecretContext
- type IntegrationSecretDefinition
- type IntegrationSecretProvider
- type IntegrationSecretStorage
- type IntegrationSecretStorageReader
- type IntegrationSecrets
- type IntegrationSetupContext
- type IntegrationSetupProvider
- type IntegrationSubscriptionContext
- type IntegrationTrigger
- type ListResourcesContext
- type MetadataReader
- type MetadataWriter
- type Node
- type NodeConfigurationValidator
- type NodeWebhookContext
- type OutputChannel
- type ProcessQueueContext
- type PropertyUpdateContext
- type ProviderAPIError
- type PullRequest
- type PullRequestActivity
- type PullRequestActivityResult
- type PullRequestMatch
- type PullRequestRevision
- type QueueItemProcessor
- type RedirectPrompt
- type ReportWorkOrderCheckParams
- type RequestContext
- type RoleRef
- type Run
- type RunCallback
- type RunCreationParams
- type RunExecutionContext
- type RunFinishedCallback
- type RunnerTask
- type RunnerTaskContext
- type SecretUpdateContext
- type SecretsContext
- type SetWorkOrderStatusNoteParams
- type SetupContext
- type SetupStep
- type SetupStepContext
- type SetupStepType
- type StepInfo
- type SyncContext
- type Trigger
- type TriggerContext
- type TriggerHookContext
- type UpdatePullRequestActivityParams
- type UpdatePullRequestParams
- type UpdateWorkOrderStatusParams
- type UsageRecord
- type UsageRecorder
- type User
- type WebhookContext
- type WebhookHandler
- type WebhookHandlerContext
- type WebhookOptions
- type WebhookRequestContext
- type WebhookResponseBody
- type Widget
- type WorkOrder
- type WorkOrderArtifact
- type WorkOrderCheck
- type WorkOrderOrigin
- type WorkOrderParams
- type WorkOrderStatusNote
Constants ¶
const ( PullRequestActivityAccessConcurrent = "concurrent" PullRequestActivityAccessExclusive = "exclusive" PullRequestActivityOutcomeReady = "ready" PullRequestActivityOutcomeWaiting = "waiting" PullRequestActivityOutcomeLimitReached = "limitReached" )
const ( IntegrationCapabilityTypeAction IntegrationCapabilityType = "action" IntegrationCapabilityTypeTrigger IntegrationCapabilityType = "trigger" IntegrationCapabilityStateRequested IntegrationCapabilityState = "requested" IntegrationCapabilityStateEnabled IntegrationCapabilityState = "enabled" IntegrationCapabilityStateDisabled IntegrationCapabilityState = "disabled" IntegrationCapabilityStateAvailable IntegrationCapabilityState = "available" )
const ( RunResultPassed = "passed" RunResultFailed = "failed" RunResultCancelled = "cancelled" )
const ( RunCallbackWhenPending = "pending" RunCallbackWhenFinished = "finished" RunCallbackOnEntry = "entry" RunCallbackOnParent = "parent" )
const ( RunnerTaskBackendLegacy = "legacy" RunnerTaskBackendIntegrated = "integrated" )
const FailedOutputChannel = "failed"
Variables ¶
var ( ErrSecretKeyNotFound = errors.New("secret or key not found") ErrExecutionKVNotFound = errors.New("execution kv not found") ErrQueueItemDeferred = errors.New("queue item deferred") )
var DefaultOutputChannel = OutputChannel{Name: "default", Label: "Default"}
var ErrNotFound = errors.New("not found")
var ErrPullRequestActivityAlreadyActive = errors.New("pull request activity already active for this handler and revision")
ErrPullRequestActivityAlreadyActive is returned by AddPullRequestActivity when another active activity already owns the same handler and revision.
var ErrPullRequestNotFound = errors.New("pull request not found")
ErrPullRequestNotFound is returned by FindPullRequest when nothing matches. Components that treat "not found" as benign check for it with errors.Is.
var ErrWorkOrderNotFound = errors.New("work order not found")
ErrWorkOrderNotFound is returned by FindWorkOrder when nothing matches the given lookup. Components that treat "not found" as benign (e.g. a PR merge with no tracked order) check for it with errors.Is.
Functions ¶
func IsProviderAuthOrNetworkError ¶
IsProviderAuthOrNetworkError reports whether err represents a class of provider failure that a user can plausibly fix (invalid or revoked API key), or a transient condition (network error, timeout, provider outage) rather than a bug in SuperPlane.
func IsProviderRateLimited ¶
IsProviderRateLimited reports whether err represents a rate-limit response from a BYOK provider.
Types ¶
type Action ¶
type Action interface {
/*
* The unique identifier for the component.
* This is how nodes reference it, and is used for registration.
*/
Name() string
/*
* The label for the component.
* This is how nodes are displayed in the UI.
*/
Label() string
/*
* A good description of what the component does.
* Helpful for documentation and user interfaces.
*/
Description() string
/*
* Detailed markdown documentation explaining how to use the component.
* This should provide in-depth information about the component's purpose,
* configuration options, use cases, and examples.
*/
Documentation() string
/*
* The icon for the component.
* This is used in the UI to represent the component.
*/
Icon() string
/*
* The color for the component.
* This is used in the UI to represent the component.
*/
Color() string
/*
* Example output data for the component.
*/
ExampleOutput() map[string]any
/*
* The output channels used by the component.
* If none is returned, the 'default' one is used.
*/
OutputChannels(configuration any) []OutputChannel
/*
* The configuration fields exposed by the component.
*/
Configuration() []configuration.Field
/*
* Setup the component.
*/
Setup(ctx SetupContext) error
/*
* Passes full execution control to the component.
*
* Component execution has full control over the execution state,
* so it is the responsibility of the component to control it.
*
* Components should finish the execution or move it to waiting state.
* Components can also implement async components by combining Execute() and HandleHook().
*/
Execute(ctx ExecutionContext) error
/*
* Allows components to define and execute custom hooks.
*/
Hooks() []Hook
HandleHook(ctx ActionHookContext) error
/*
* Handler for webhooks.
*/
HandleWebhook(ctx WebhookRequestContext) (int, *WebhookResponseBody, error)
/*
* Cancel allows components to handle cancellation of executions.
* Default behavior does nothing. Components can override to perform
* cleanup or cancel external resources.
*/
Cancel(ctx ExecutionContext) error
/*
* Cleanup allows components to clean up resources after being removed from a canvas.
* Default behavior does nothing. Components can override to perform cleanup.
*/
Cleanup(ctx SetupContext) error
}
type ActionHookContext ¶ added in v0.18.0
type ActionHookContext struct {
Name string
Configuration any
Parameters map[string]any
Logger *log.Entry
HTTP HTTPContext
Metadata MetadataWriter
ExecutionState ExecutionStateContext
Auth AuthReader
Requests RequestContext
Integration IntegrationContext
Secrets SecretsContext
Runs RunExecutionContext
Factory FactoryContext
Usage UsageRecorder
HostedLLM HostedLLMContext
RunnerTasks RunnerTaskContext
}
* Context for executing a action hook.
func (ActionHookContext) RecordUsage ¶
func (ctx ActionHookContext) RecordUsage(record UsageRecord) error
RecordUsage writes the record when a recorder is wired on a hook.
func (ActionHookContext) RecordUsageBestEffort ¶
func (ctx ActionHookContext) RecordUsageBestEffort(record UsageRecord)
RecordUsageBestEffort records spend without failing the hook.
type AddPullRequestParams ¶
type AddWorkOrderArtifactParams ¶
type AddWorkOrderArtifactParams struct {
// OrderID identifies the work order to target; see
// UpdateWorkOrderStatusParams.OrderID.
OrderID string
Type string
Data map[string]any
// Key optionally tags the artifact with a queryable key so a later
// FindWorkOrder(by: artifactKey) can resolve the work order from it.
// When set, AddWorkOrderArtifact creates the artifact on the first
// call and replaces its data on later calls. Replacement is
// wholesale: fields absent from the later call are cleared. The
// first call sets the type; a later call with a different type
// fails. Keys are unique per factory.
Key string
// UpdateByTitle replaces the newest unkeyed artifact on this task
// with the same type and title. Keyed rows stay unchanged. The
// first call creates an unkeyed row when none exists. A blank
// title fails. This flag does not use Key.
UpdateByTitle bool
}
type AppContext ¶ added in v0.29.0
type AppExecutionContext ¶ added in v0.29.0
type AppMessageContext ¶ added in v0.0.45
type AppMessageContext struct {
Message any
Configuration any
NodeMetadata MetadataReader
Logger *log.Entry
HTTP HTTPContext
Events EventContext
}
type AppTrigger ¶ added in v0.0.45
type AppTrigger interface {
Trigger
OnAppMessage(ctx AppMessageContext) error
}
type AuthReader ¶ added in v0.17.0
type BrowserAction ¶
type CanvasMemoryContext ¶ added in v0.10.0
type CanvasMemoryRecord ¶ added in v0.23.0
type CanvasNode ¶ added in v0.30.0
type Capability ¶ added in v0.19.0
type Capability struct {
Type IntegrationCapabilityType `json:"type"`
Name string `json:"name"`
Label string `json:"label"`
Description string `json:"description"`
Configuration []configuration.Field `json:"configuration"`
OutputChannels []OutputChannel `json:"outputChannels"`
ExampleOutput map[string]any `json:"exampleOutput,omitempty"`
ExampleData map[string]any `json:"exampleData,omitempty"`
}
type CapabilityContext ¶ added in v0.19.0
type CapabilityGroup ¶ added in v0.19.0
type CapabilityGroup struct {
Label string
Capabilities []Capability
}
type CapabilityUpdateContext ¶ added in v0.19.0
type CapabilityUpdateContext struct {
Changes map[IntegrationCapabilityState][]string
Logger *log.Entry
HTTP HTTPContext
Secrets IntegrationSecretStorage
Properties IntegrationPropertyStorage
Capabilities CapabilityContext
}
type ComputeUsageRecord ¶
type ComputeUsageRecord struct {
MachineType string
FleetID string
DurationSeconds int64
IdempotencyKey string
}
ComputeUsageRecord is the call-site payload for one runner-fleet task.
type Configurable ¶ added in v0.18.0
type Configurable interface {
Configuration() []configuration.Field
}
* Configurable is a component (action, trigger, widget) that can be configured.
type DefaultHostedLLMModel ¶
DefaultHostedLLMModel is the instance model Run SuperPlane Agent uses.
func (DefaultHostedLLMModel) IsSet ¶
func (d DefaultHostedLLMModel) IsSet() bool
type EventContext ¶
type ExecutionContext ¶
type ExecutionContext struct {
ID uuid.UUID
RunID uuid.UUID
WorkflowID string
OrganizationID string
CanvasName string
NodeID string
NodeName string
SourceNodeID string
BaseURL string
Data any
Configuration any
Logger *log.Entry
HTTP HTTPContext
Metadata MetadataWriter
NodeMetadata MetadataReader
ExecutionState ExecutionStateContext
Requests RequestContext
Auth AuthReader
Integration IntegrationContext
Secrets SecretsContext
CanvasMemory CanvasMemoryContext
Webhook NodeWebhookContext
Expressions ExpressionContext
OIDC oidc.Provider
Apps AppExecutionContext
Runs RunExecutionContext
Factory FactoryContext
Usage UsageRecorder
HostedLLM HostedLLMContext
RunnerTasks RunnerTaskContext
}
* ExecutionContext allows the component * to control the state and metadata of each execution of it.
func (ExecutionContext) RecordCompute ¶
func (ctx ExecutionContext) RecordCompute(record ComputeUsageRecord) error
RecordCompute writes runner-fleet seconds when a recorder is wired.
func (ExecutionContext) RecordUsage ¶
func (ctx ExecutionContext) RecordUsage(record UsageRecord) error
RecordUsage writes the record when a recorder is wired. Tests that omit Usage on ExecutionContext skip tracking.
func (ExecutionContext) RecordUsageBestEffort ¶
func (ctx ExecutionContext) RecordUsageBestEffort(record UsageRecord)
RecordUsageBestEffort records spend without failing the provider call. A ledger error must not drop the model output the caller already paid for.
type ExecutionStateContext ¶
type ExecutionStateContext interface {
IsFinished() bool
IsCancelling() bool
SetKV(key, value string) error
GetKV(key string) (string, error)
/*
* Pass the execution, emitting a payload to the specified channel.
*/
Emit(channel, payloadType string, payloads []any) error
/*
* Emit a payload but keep the execution active for further work.
*/
EmitAndContinue(channel, payloadType string, payloads []any) error
/*
* Pass the execution, without emitting any payloads from it.
*/
Pass() error
/*
* Fails the execution.
* No payloads are emitted.
*/
Fail(reason, message string) error
/*
* Cancels the execution.
* No payloads are emitted.
*/
Cancel() error
}
* ExecutionStateContext allows components to control execution lifecycle.
type ExpressionContext ¶ added in v0.16.0
type FactoryContext ¶
type FactoryContext interface {
// CreateWorkOrder reports whether a row was inserted via the second
// return value; callers must skip downstream emits when `created` is
// false so a duplicate Sentry intake item does not leak into the
// timeline.
CreateWorkOrder(params WorkOrderParams) (order *WorkOrder, created bool, err error)
// FindWorkOrder resolves a work order by id or by one of its
// artifacts' keys, without requiring the current run to be attached
// to a `factory_work_order_executions` row. Returns ErrWorkOrderNotFound
// (wrapped) when nothing matches.
FindWorkOrder(params FindWorkOrderParams) (*WorkOrder, error)
// UpdateWorkOrderStatus reports whether the row actually transitioned
// via the second return value; callers must skip downstream emits
// when `changed` is false so a no-op doesn't leak into the timeline.
UpdateWorkOrderStatus(params UpdateWorkOrderStatusParams) (order *WorkOrder, changed bool, err error)
AddWorkOrderComment(params AddWorkOrderCommentParams) error
AddWorkOrderArtifact(params AddWorkOrderArtifactParams) (*WorkOrderArtifact, error)
// ReportWorkOrderCheck upserts a scored check on the work order,
// keyed by CheckKey: the first report creates the check, later
// reports with the same key update it in place and keep the prior
// score as PreviousScore. Every report also lands an
// `order.check.reported` timeline event.
ReportWorkOrderCheck(params ReportWorkOrderCheckParams) (*WorkOrderCheck, error)
// SetWorkOrderStatusNote upserts a status note on the work order,
// keyed by NoteKey: the first set creates the note, later sets with
// the same key update it in place, and a different key sits beside
// it. Any lifecycle transition clears the whole set. The order must
// be open.
SetWorkOrderStatusNote(params SetWorkOrderStatusNoteParams) (*WorkOrderStatusNote, error)
AddPullRequest(params AddPullRequestParams) (*PullRequest, error)
UpdatePullRequest(params UpdatePullRequestParams) (*PullRequest, error)
FindPullRequest(params FindPullRequestParams) (*PullRequestMatch, error)
AddPullRequestActivity(params AddPullRequestActivityParams) (*PullRequestActivityResult, error)
UpdatePullRequestActivity(params UpdatePullRequestActivityParams) (*PullRequestActivityResult, error)
// VCSProvider returns the workspace Git host from factory onboarding.
// An empty value means GitHub. A caller that has no factory gets an
// empty value and keeps GitHub branch links.
VCSProvider() (string, error)
}
type FindPullRequestParams ¶
type FindWorkOrderParams ¶
FindWorkOrderParams configures FactoryContext.FindWorkOrder. By selects the lookup strategy: "id" resolves OrderID directly, "artifactKey" resolves the work order that owns the artifact tagged with ArtifactKey.
type HTTPContext ¶ added in v0.0.43
* Components / triggers / applications should always * use this context instead of the net/http directly for executing HTTP requests. * * This makes it easy for us to write unit tests for the implementations, * and also makes it easier to control HTTP timeouts for everything in one place.
type HTTPRequestContext ¶
type HTTPRequestContext struct {
Logger *logrus.Entry
Request *http.Request
Response http.ResponseWriter
OrganizationID string
BaseURL string
WebhooksBaseURL string
HTTP HTTPContext
Integration IntegrationContext
Capabilities CapabilityContext
IntegrationSetup IntegrationSetupContext
}
type Hook ¶ added in v0.18.0
type Hook struct {
Type HookType
Name string
Parameters []configuration.Field
}
type HostedLLMAccess ¶
type HostedLLMAccess struct {
APIKey string
ManagementKey string
BaseURL string
AllowedModels []string
}
HostedLLMAccess is one SuperPlane-held provider key and allowlist.
func (HostedLLMAccess) AllowsModel ¶
func (a HostedLLMAccess) AllowsModel(model string) bool
type HostedLLMContext ¶
type HostedLLMContext interface {
Resolve(provider string) (HostedLLMAccess, error)
AssertCreditAvailable() error
AssertModelSelectable(provider, fundingSource, model string) error
DefaultModel() (DefaultHostedLLMModel, error)
}
HostedLLMContext resolves installation-hosted provider credentials.
type Integration ¶ added in v0.5.0
type Integration interface {
/*
* The name of the integration.
*/
Name() string
/*
* Display name for the integration.
*/
Label() string
/*
* The icon used by the integration.
*/
Icon() string
/*
* A description of what the integration does.
*/
Description() string
/*
* Markdown-formatted instructions shown in the connection modal.
*/
Instructions() string
/*
* The configuration fields of the integration.
*/
Configuration() []configuration.Field
/*
* The list of actions exposed by the integration.
*/
Actions() []Action
/*
* The list of triggers exposed by the integration.
*/
Triggers() []Trigger
/*
* Called when configuration changes.
*/
Sync(ctx SyncContext) error
/*
* Called when the integration is deleted.
*/
Cleanup(ctx IntegrationCleanupContext) error
/*
* Allows integrations to define and execute hooks.
*/
Hooks() []Hook
HandleHook(ctx IntegrationHookContext) error
/*
* List resources of a given type.
*/
ListResources(resourceType string, ctx ListResourcesContext) ([]IntegrationResource, error)
/*
* HTTP request handler
*/
HandleRequest(ctx HTTPRequestContext)
}
type IntegrationAction ¶ added in v0.18.0
type IntegrationAction interface {
/*
* IntegrationAction inherits all the methods from Action interface,
* and adds a couple more, which are only applicable to app actions.
*/
Action
OnIntegrationMessage(ctx IntegrationMessageContext) error
}
type IntegrationCapabilityState ¶ added in v0.19.0
type IntegrationCapabilityState string
type IntegrationCapabilityType ¶ added in v0.19.0
type IntegrationCapabilityType string
* Capabilities are the "features" that the integration provides. * They are typed so the different parts of the system can take only the ones they need. * * They can be in 4 states: * - Unavailable: capability exists, but was not requested as part of the setup flow, and the user cannot request it anymore. * - Available: capability exists, setup did not expose it yet, but the user can still request it. * - Requested: capability was requested, but setup did not enable it yet. * - Enabled: capability is fully enabled and ready for use. * - Disabled: capability was enabled during the setup flow, but has been manually disabled by the user.
type IntegrationCleanupContext ¶ added in v0.6.0
type IntegrationCleanupContext struct {
Configuration any
BaseURL string
OrganizationID string
Logger *logrus.Entry
HTTP HTTPContext
Integration IntegrationContext
}
type IntegrationContext ¶
type IntegrationContext interface {
//
// Whether the integration is using the legacy setup flow.
//
LegacySetup() bool
Properties() IntegrationPropertyStorage
Secrets() IntegrationSecretStorage
//
// Control the metadata and config of the integration
//
ID() uuid.UUID
GetMetadata() any
SetMetadata(any)
GetConfig(name string) ([]byte, error)
//
// Control the state of the integration
//
Ready()
Error(message string)
//
// Control the browser action of the integration
//
NewBrowserAction(action BrowserAction)
RemoveBrowserAction()
//
// Control the secrets of the integration
//
SetSecret(name string, value []byte) error
GetSecrets() ([]IntegrationSecret, error)
/*
* Request a new webhook from the integration.
* Called from the components/triggers Setup().
*/
RequestWebhook(configuration any) error
/*
* Subscribe to integration events.
*/
Subscribe(any) (*uuid.UUID, error)
/*
* Schedule actions for the integration.
*/
ScheduleResync(interval time.Duration) error
ScheduleActionCall(actionName string, parameters any, interval time.Duration) error
/*
* List integration subscriptions from nodes.
*/
ListSubscriptions() ([]IntegrationSubscriptionContext, error)
// ListNodeConfigurations returns the configuration of each non-deleted
// node that uses this integration on an active canvas.
ListNodeConfigurations() ([]any, error)
/*
* Find a subscription by a predicate function.
* Returns the first subscription that matches the predicate, or nil if none found.
*/
FindSubscription(predicate func(IntegrationSubscriptionContext) bool) (IntegrationSubscriptionContext, error)
}
* IntegrationContext allows components to access integration information.
type IntegrationHookContext ¶ added in v0.18.0
type IntegrationHookContext struct {
Name string
Parameters any
Configuration any
WebhooksBaseURL string
Logger *log.Entry
Requests RequestContext
Integration IntegrationContext
HTTP HTTPContext
}
* Context for executing a integration hook.
type IntegrationMessageContext ¶ added in v0.5.0
type IntegrationMessageContext struct {
Message any
Configuration any
NodeMetadata MetadataReader
Logger *logrus.Entry
HTTP HTTPContext
Integration IntegrationContext
Events EventContext
FindExecutionByKV func(key string, value string) (*ExecutionContext, error)
}
type IntegrationPropertyDefinition ¶ added in v0.19.0
type IntegrationPropertyStorage ¶ added in v0.19.0
type IntegrationPropertyStorage interface {
IntegrationPropertyStorageReader
Delete(names ...string) error
Create(def IntegrationPropertyDefinition) error
CreateMany(defs []IntegrationPropertyDefinition) error
}
type IntegrationPropertyStorageReader ¶ added in v0.19.0
type IntegrationPropertyType ¶ added in v0.19.0
type IntegrationPropertyType string
* Properties is non-sensitive information exposed by the setup flow to the user. * They can be editable or not. If they are editable, OnPropertyUpdate() is called when the user updates it. * They are also typed, so the display layers (UI, CLI) can render them accordingly.
const (
IntegrationPropertyTypeString IntegrationPropertyType = "string"
)
type IntegrationResource ¶ added in v0.5.0
type IntegrationSecret ¶ added in v0.5.0
type IntegrationSecretContext ¶ added in v0.30.0
type IntegrationSecretContext struct {
Logger *logrus.Entry
HTTP HTTPContext
Integration IntegrationContext
}
* IntegrationSecretContext is the context given to integrations when resolving exportable secrets.
type IntegrationSecretDefinition ¶ added in v0.19.0
type IntegrationSecretProvider ¶ added in v0.30.0
type IntegrationSecretProvider interface {
ResolveSecrets(ctx IntegrationSecretContext) (IntegrationSecrets, error)
}
* IntegrationSecretProvider is an optional integration capability for materializing * key/value secrets that other parts of the system may consume (runners, components, etc.).
type IntegrationSecretStorage ¶ added in v0.19.0
type IntegrationSecretStorage interface {
IntegrationSecretStorageReader
Delete(name string) error
Create(def IntegrationSecretDefinition) error
CreateMany(defs []IntegrationSecretDefinition) error
Update(name string, value string) error
}
* Secrets are sensitive information managed by the integration. * In some cases, this comes from the user, as a step input. * In other cases, this comes from the setup flow itself. * Secrets can be editable or not. If they are editable, OnSecretUpdate() is called when the user updates it. * * This is context that the integration receives as part of the setup flow for managing them.
type IntegrationSecretStorageReader ¶ added in v0.19.0
type IntegrationSecrets ¶
type IntegrationSecrets struct {
Values map[string][]byte
Usage string
Setup string
SetupName string
}
* IntegrationSecrets is the materialization of an integration's exportable * credentials, plus optional agent-facing guidance and setup.
type IntegrationSetupContext ¶ added in v0.20.0
* IntegrationSetupContext allows integrations to manage setup state * from outside the setup flow (e.g. from an HTTP request handler).
type IntegrationSetupProvider ¶ added in v0.19.0
type IntegrationSetupProvider interface {
//
// All the capabilities supported by the integration.
// The grouping is a presentation matter, and per-integration states
// are still tracked per capability.
//
CapabilityGroups() []CapabilityGroup
//
// Generate the first step of the setup flow.
//
FirstStep(ctx SetupStepContext) SetupStep
//
// Called when the user submits the current pending step.
//
OnStepSubmit(ctx SetupStepContext) (*SetupStep, error)
//
// Called when the user reverts the last successfully submitted step.
//
OnStepRevert(ctx SetupStepContext) error
//
// Called when the user updates a property.
// A property update might trigger a new setup flow.
//
OnPropertyUpdate(ctx PropertyUpdateContext) (*SetupStep, error)
//
// Called when the user updates a secret.
// A secret update might trigger a new setup flow.
//
OnSecretUpdate(ctx SecretUpdateContext) (*SetupStep, error)
//
// Called when the user requests new capabilities
// from an already setup integration.
//
OnCapabilityUpdate(ctx CapabilityUpdateContext) (*SetupStep, error)
}
* IntegrationSetupProvider is the contract for an integration to provide its setup flow. * Any changes to this interface should be documented in docs/design/integration-setup-flow.md.
type IntegrationSubscriptionContext ¶ added in v0.5.0
type IntegrationTrigger ¶ added in v0.5.0
type IntegrationTrigger interface {
/*
* Inherits all the methods from Trigger interface,
* and adds a couple more, which are only applicable to integration triggers.
*/
Trigger
OnIntegrationMessage(ctx IntegrationMessageContext) error
}
type ListResourcesContext ¶ added in v0.0.43
type ListResourcesContext struct {
Logger *logrus.Entry
HTTP HTTPContext
Integration IntegrationContext
Parameters map[string]string
}
type MetadataReader ¶ added in v0.17.0
type MetadataReader interface {
Get() any
}
* Metadata is arbitrary data that can be stored for nodes and executions. * MetadataReader allows components to read metadata from a node or execution.
type MetadataWriter ¶ added in v0.17.0
type MetadataWriter interface {
MetadataReader
Set(any) error
}
* MetadataWriter allows components to write metadata to a node or execution. * It inherits from MetadataReader to allow components to read metadata as well.
type NodeConfigurationValidator ¶
type NodeConfigurationValidator interface {
ValidateNodeConfiguration(config map[string]any) error
}
NodeConfigurationValidator is implemented by actions whose field schema cannot express every save-time rule. Canvas updates call this after schema validation and store a failure on the node error message.
type NodeWebhookContext ¶ added in v0.0.30
type OutputChannel ¶
type ProcessQueueContext ¶
type ProcessQueueContext struct {
WorkflowID string
NodeID string
RootEventID string
EventID string
SourceNodeID string
Configuration any
Input any
Expressions ExpressionContext
//
// Deletes the queue item
//
DequeueItem func() error
//
// Defers the queue item by moving it to the back of the node queue.
//
DeferQueueItem func() error
//
// Updates the state of the node
//
UpdateNodeState func(state string) error
//
// Creates a pending execution for this queue item.
//
CreateExecution func() (*ExecutionContext, error)
//
// Finds an execution by a key-value pair.
// Returns an ExecutionContext.
//
FindExecutionByKV func(key string, value string) (*ExecutionContext, error)
//
// MaxConcurrency is the node's effective concurrency max.
// Self-managed components use it to gate how much concurrent work
// they start, since the queue worker does not capacity-gate their
// queue items.
//
MaxConcurrency int
//
// CountRunningExecutions returns how many executions of this node
// currently occupy a concurrency slot: pending, started, or
// cancelling. Pending counts so that items processed in the same
// pass cannot all pass a limit check before any execution starts.
//
CountRunningExecutions func() (int64, error)
//
// DistinctIncomingSources returns the distinct upstream
// source nodes connected to this node (ignoring multiple channels from the
// same source)
//
DistinctIncomingSources func() ([]Node, error)
}
* ProcessQueueContext is provided to components to process a node's queue item. * It mirrors the data the queue worker would otherwise use to create executions.
type PropertyUpdateContext ¶ added in v0.19.0
type PropertyUpdateContext struct {
PropertyName string
Value string
Logger *log.Entry
HTTP HTTPContext
Secrets IntegrationSecretStorage
Properties IntegrationPropertyStorage
Capabilities CapabilityContext
}
type ProviderAPIError ¶
type ProviderAPIError struct {
// StatusCode is the HTTP status code returned by the provider. It is zero
// for transport-level failures (network error, timeout) that never
// received a response.
StatusCode int
// contains filtered or unexported fields
}
ProviderAPIError classifies a failure from a BYOK provider's live API (Claude, OpenAI, OpenRouter). It preserves the original, human-readable message text (Error() is unchanged from the wrapped error), while letting callers use errors.As to recover the HTTP status code and classify the failure without string matching.
func NewProviderAPIError ¶
func NewProviderAPIError(statusCode int, message string, err error) *ProviderAPIError
NewProviderAPIError wraps err as a provider API error carrying the given HTTP status code. message is used as the Error() text, so existing string-matching tests and log lines are unaffected.
func NewProviderTransportError ¶
func NewProviderTransportError(message string, err error) *ProviderAPIError
NewProviderTransportError wraps a transport-level failure (network error, timeout) as a provider API error with no HTTP status code.
func (*ProviderAPIError) Error ¶
func (e *ProviderAPIError) Error() string
func (*ProviderAPIError) IsAuth ¶
func (e *ProviderAPIError) IsAuth() bool
IsAuth reports whether the provider rejected the request as unauthenticated or unauthorized (invalid or revoked API key).
func (*ProviderAPIError) IsRateLimited ¶
func (e *ProviderAPIError) IsRateLimited() bool
IsRateLimited reports whether the provider throttled the request.
func (*ProviderAPIError) IsTransport ¶
func (e *ProviderAPIError) IsTransport() bool
IsTransport reports whether the request never reached the provider (network error, connection reset, timeout) as opposed to receiving an HTTP error response.
func (*ProviderAPIError) IsUnavailable ¶
func (e *ProviderAPIError) IsUnavailable() bool
IsUnavailable reports whether the provider returned a server-side error.
func (*ProviderAPIError) Unwrap ¶
func (e *ProviderAPIError) Unwrap() error
type PullRequest ¶
type PullRequest struct {
ID string `json:"id"`
WorkOrderID string `json:"workOrderId"`
Provider string `json:"provider"`
ExternalID string `json:"externalId,omitempty"`
Repository string `json:"repository"`
Number int64 `json:"number"`
URL string `json:"url"`
Title string `json:"title,omitempty"`
State string `json:"state"`
}
type PullRequestActivity ¶
type PullRequestActivity struct {
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Access string `json:"access"`
State string `json:"state"`
Attempt *int `json:"attempt,omitempty"`
AttemptLimit *int `json:"attemptLimit,omitempty"`
Revision *PullRequestRevision `json:"revision,omitempty"`
}
type PullRequestActivityResult ¶
type PullRequestActivityResult struct {
PullRequest *PullRequest
WorkOrder *WorkOrder
Activity *PullRequestActivity
CurrentRevision *PullRequestRevision
CurrentHeadSHA string
Outcome string
}
type PullRequestMatch ¶
type PullRequestMatch struct {
PullRequest *PullRequest
WorkOrder *WorkOrder
}
type PullRequestRevision ¶
type QueueItemProcessor ¶
type QueueItemProcessor interface {
/*
* ProcessQueueItem is called when a queue item for this component's
* node is ready to be processed. Implementations should create the
* appropriate execution or handle the item synchronously using the
* provided context.
*/
ProcessQueueItem(ctx ProcessQueueContext) (*uuid.UUID, error)
}
* QueueItemProcessor is implemented by actions that process their node's * queue items themselves (merge, loop) instead of the engine's default * processing, which creates an execution and dequeues the item. * * Implementing this interface also means the engine always dispatches * the component's queue items instead of gating them on queue capacity: * these components keep executions open while waiting for more queue * items — later source events for merge, feedback events for loop — so * capacity-gating their items would starve the very items needed to * finish those executions. Queue capacity does not apply.
type RedirectPrompt ¶ added in v0.19.0
type ReportWorkOrderCheckParams ¶
type ReportWorkOrderCheckParams struct {
// OrderID identifies the work order to target; see
// UpdateWorkOrderStatusParams.OrderID.
OrderID string
// CheckKey identifies the check across reports (e.g. "risk-review").
CheckKey string
Name string
Score float64
MaxScore float64
Format string
Level string
Summary string
Analysis string
}
ReportWorkOrderCheckParams carries one check report. Format must be "fraction", "percent", or "boolean" (empty defaults to fraction; a boolean check pins Score to 0/1 and MaxScore to 1); Level must be "positive", "neutral", "caution", or "critical" (empty defaults to neutral) — the reporting component computes it from its thresholds.
type RequestContext ¶
type RequestContext interface {
//
// Allows the scheduling of a certain component action at a later time
//
ScheduleActionCall(actionName string, parameters map[string]any, interval time.Duration) error
}
* RequestContext allows the execution to schedule * work with the processing engine.
type RunCallback ¶ added in v0.30.0
type RunCallback struct {
When string `json:"when" mapstructure:"when"`
On string `json:"on" mapstructure:"on"`
Hook string `json:"hook" mapstructure:"hook"`
}
* Run callbacks are the way for components * to execute custom behavior during a run's lifecycle.
type RunCreationParams ¶ added in v0.30.0
type RunCreationParams struct {
Input any
App string
Node string
Callbacks []RunCallback
}
type RunExecutionContext ¶ added in v0.30.0
type RunFinishedCallback ¶ added in v0.30.0
type RunFinishedCallback struct {
Run Run `json:"run" mapstructure:"run"`
}
* RunFinishedCallback is the payload used in the RunCallbackWhenFinished run lifecycle callback.
func DecodeRunFinishedCallback ¶ added in v0.30.0
func DecodeRunFinishedCallback(params map[string]any) (RunFinishedCallback, error)
func NewRunFinishedCallback ¶ added in v0.30.0
func NewRunFinishedCallback(run Run) RunFinishedCallback
func (RunFinishedCallback) ToParameters ¶ added in v0.30.0
func (c RunFinishedCallback) ToParameters() (map[string]any, error)
type RunnerTask ¶
type RunnerTask struct {
ID string
State string
Result json.RawMessage
ExitCode *int
ErrorMessage string
ReservedAt *time.Time
StartedAt *time.Time
FinishedAt *time.Time
}
RunnerTask is the component-facing view of a durable integrated task.
type RunnerTaskContext ¶
type RunnerTaskContext interface {
IntegratedBackendEnabled() (bool, error)
Create(id, fleetID string, payload []byte) error
Find(id string) (*RunnerTask, error)
RequestCancel(id string) error
}
RunnerTaskContext gives runner components access to SuperPlane-owned tasks without coupling component implementations to GORM or encryption details. Implementations are bound to the current worker transaction.
type SecretUpdateContext ¶ added in v0.19.0
type SecretUpdateContext struct {
SecretName string
Value string
Logger *log.Entry
HTTP HTTPContext
Secrets IntegrationSecretStorage
Properties IntegrationPropertyStorage
Capabilities CapabilityContext
}
type SecretsContext ¶ added in v0.7.0
type SetWorkOrderStatusNoteParams ¶
type SetWorkOrderStatusNoteParams struct {
// OrderID identifies the work order to target; see
// UpdateWorkOrderStatusParams.OrderID.
OrderID string
// NoteKey identifies the note across sets (e.g. "pr-closure").
NoteKey string
Kind string
Headline string
Body string
CtaLabel string
CtaURL string
ShowOnlyWhenWaiting bool
}
SetWorkOrderStatusNoteParams carries one status note. NoteKey identifies the note across sets (e.g. "pr-closure"). Kind is "info" (the default when empty); Headline is required; CtaLabel and CtaURL must be set together and the URL must be absolute http(s).
type SetupContext ¶
type SetupContext struct {
Logger *log.Entry
Configuration any
HTTP HTTPContext
Metadata MetadataWriter
Requests RequestContext
Auth AuthReader
Integration IntegrationContext
Webhook NodeWebhookContext
Apps AppContext
}
* ExecutionContext allows the component * to control the state and metadata of each execution of it.
type SetupStep ¶ added in v0.19.0
type SetupStep struct {
Type SetupStepType
Name string
Label string
Instructions string
Inputs []configuration.Field
Capabilities []string
RedirectPrompt *RedirectPrompt
}
type SetupStepContext ¶ added in v0.19.0
type SetupStepContext struct {
Step StepInfo
IntegrationID uuid.UUID
OrganizationID string
BaseURL string
WebhooksBaseURL string
Logger *log.Entry
HTTP HTTPContext
Secrets IntegrationSecretStorage
Properties IntegrationPropertyStorage
Capabilities CapabilityContext
}
type SetupStepType ¶ added in v0.19.0
type SetupStepType string
const ( SetupStepTypeInputs SetupStepType = "inputs" SetupStepTypeCapabilitySelection SetupStepType = "capabilitySelection" SetupStepTypeRedirectPrompt SetupStepType = "redirectPrompt" SetupStepTypeDone SetupStepType = "done" )
type SyncContext ¶
type Trigger ¶
type Trigger interface {
/*
* The unique identifier for the trigger.
* This is how nodes reference it, and is used for registration.
*/
Name() string
/*
* The label for the trigger.
* This is how nodes are displayed in the UI.
*/
Label() string
/*
* A good description of what the trigger does.
* Helpful for documentation and user interfaces.
*/
Description() string
/*
* Detailed markdown documentation explaining how to use the trigger.
* This should provide in-depth information about the trigger's purpose,
* configuration options, use cases, and examples.
*/
Documentation() string
/*
* The icon for the trigger.
*/
Icon() string
/*
* The color for the trigger.
*/
Color() string
/*
* Example input data for the trigger.
*/
ExampleData() map[string]any
/*
* The configuration fields exposed by the trigger.
*/
Configuration() []configuration.Field
/*
* Handler for webhooks
*/
HandleWebhook(ctx WebhookRequestContext) (int, *WebhookResponseBody, error)
/*
* Setup the trigger.
*/
Setup(ctx TriggerContext) error
/*
* Allows triggers to define custom hooks.
*/
Hooks() []Hook
/*
* Execute a custom hook - defined in Hooks() for a trigger.
*/
HandleHook(ctx TriggerHookContext) (map[string]any, error)
/*
* Cleanup allows triggers to clean up resources after being removed from a canvas.
* Default behavior does nothing. Triggers can override to perform cleanup.
*/
Cleanup(ctx TriggerContext) error
}
type TriggerContext ¶
type TriggerContext struct {
Logger *log.Entry
Configuration any
HTTP HTTPContext
Metadata MetadataWriter
Requests RequestContext
Events EventContext
Webhook NodeWebhookContext
Integration IntegrationContext
Apps AppContext
}
type TriggerHookContext ¶ added in v0.18.0
type TriggerHookContext struct {
Name string
Parameters map[string]any
Configuration any
Logger *log.Entry
HTTP HTTPContext
Metadata MetadataWriter
Requests RequestContext
Events EventContext
Webhook NodeWebhookContext
Integration IntegrationContext
}
* Context for executing a trigger hook.
type UpdatePullRequestParams ¶
type UpdateWorkOrderStatusParams ¶
type UpdateWorkOrderStatusParams struct {
// OrderID identifies the work order to target. Required; the
// component field defaults to `{{ order().id }}` (the work order
// driving the current run) but callers must always resolve and pass
// an explicit id.
OrderID string
State string
Result string
}
type UsageRecord ¶
type UsageRecord struct {
Provider string
Model string
InputTokens int64
OutputTokens int64
CacheReadTokens int64
CacheWriteTokens int64
ReasoningTokens int64
TotalTokens int64
// CostMicros is provider-reported cost in millionths of a US dollar.
// Leave nil to price the call from the SuperPlane price book.
CostMicros *int64
// FundingSource is "hosted" or "byok". Empty defaults to byok.
FundingSource string
// IdempotencyKey is a stable ledger key. Empty generates a unique key
// per call. Runner finish records use a prefix so webhook and poll
// cannot insert two rows for one node execution.
IdempotencyKey string
}
UsageRecord is the call-site payload for one provider response. Do not include prompt or completion text.
type UsageRecorder ¶
type UsageRecorder interface {
Record(record UsageRecord) error
RecordCompute(record ComputeUsageRecord) error
}
UsageRecorder stores spend on the workspace usage ledger. A nil recorder on ExecutionContext is a no-op (tests and non-factory runs).
type WebhookContext ¶
type WebhookContext interface {
GetID() string
GetURL() string
GetSecret() ([]byte, error)
GetMetadata() any
GetConfiguration() any
SetSecret([]byte) error
// CallbackHasActiveNodes reports whether webhookID still has live canvas
// consumers. Jira uses this before taking over a stale remote callback.
CallbackHasActiveNodes(webhookID string) (bool, error)
}
* WebhookContext allows implementations to read/manage Webhook records.
type WebhookHandler ¶ added in v0.7.0
type WebhookHandler interface {
/*
* Set up webhooks through the integration, in the external system.
* This is called by the webhook provisioner, for pending webhook records.
*/
Setup(ctx WebhookHandlerContext) (any, error)
/*
* Delete webhooks through the integration, in the external system.
* This is called by the webhook cleanup worker, for webhook records that were deleted.
*/
Cleanup(ctx WebhookHandlerContext) error
/*
* Compare two webhook configurations to see if they are the same.
*/
CompareConfig(a, b any) (bool, error)
/*
* Merge an existing webhook configuration with a requested one.
* Return changed=false when no update is needed.
*/
Merge(current, requested any) (merged any, changed bool, err error)
}
type WebhookHandlerContext ¶ added in v0.7.0
type WebhookHandlerContext struct {
Logger *logrus.Entry
HTTP HTTPContext
Integration IntegrationContext
Webhook WebhookContext
}
type WebhookOptions ¶
type WebhookRequestContext ¶
type WebhookRequestContext struct {
Body []byte
Headers http.Header
Query url.Values
WorkflowID string
NodeID string
Configuration any
Metadata MetadataWriter
Logger *log.Entry
Webhook NodeWebhookContext
Events EventContext
Integration IntegrationContext
Factory FactoryContext
//
// Return an execution context for a given execution,
// through a referencing key-value pair.
//
FindExecutionByKV func(key string, value string) (*ExecutionContext, error)
//
// Return the oldest active execution for a key-value pair.
// Narrowly scoped for Bitbucket build waits, where a completed wait can
// share a KV with a later active wait. Nil when the caller does not
// support active lookups; other components keep FindExecutionByKV.
//
FindActiveExecutionByKV func(key string, value string) (*ExecutionContext, error)
// Do not make HTTP calls as part of handling the webhook. This is useful for
// retrieving more data that is not part of the webhook payload.
HTTP HTTPContext
}
type WebhookResponseBody ¶ added in v0.12.0
WebhookResponseBody allows a HandleWebhook implementation to return a custom response body. If non-nil and Body is non-empty, the server writes it back to the caller instead of the default empty 200 OK.
type Widget ¶ added in v0.0.18
type Widget interface {
/*
* The unique identifier for the widget.
* This is how nodes reference it, and is used for registration.
*/
Name() string
/*
* The label for the widget.
* This is how nodes are displayed in the UI.
*/
Label() string
/*
* A good description of what the widget does.
* Helpful for documentation and user interfaces.
*/
Description() string
/*
* The icon for the widget.
*/
Icon() string
/*
* The color for the widget.
*/
Color() string
/*
* The configuration fields exposed by the widget.
*/
Configuration() []configuration.Field
}
* Widgets are used to represent every node not event or execution related. * Use it to display and group data in the UI canvas.
type WorkOrder ¶
type WorkOrder struct {
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
State string `json:"state"`
Result string `json:"result,omitempty"`
Number int64 `json:"number,omitempty"`
Key string `json:"key,omitempty"`
Origin *WorkOrderOrigin `json:"origin,omitempty"`
}
type WorkOrderArtifact ¶
type WorkOrderCheck ¶
type WorkOrderCheck struct {
ID string `json:"id"`
WorkOrderID string `json:"workOrderId"`
Key string `json:"key"`
Name string `json:"name"`
Score float64 `json:"score"`
MaxScore float64 `json:"maxScore"`
Format string `json:"format"`
Level string `json:"level"`
PreviousScore *float64 `json:"previousScore,omitempty"`
// RecentScores lists the latest report scores, oldest first and
// ending with Score, capped server-side.
RecentScores []float64 `json:"recentScores,omitempty"`
}
type WorkOrderOrigin ¶
type WorkOrderParams ¶
type WorkOrderStatusNote ¶
type WorkOrderStatusNote struct {
WorkOrderID string `json:"workOrderId"`
Key string `json:"key"`
Kind string `json:"kind"`
Headline string `json:"headline"`
Body string `json:"body,omitempty"`
CtaLabel string `json:"ctaLabel,omitempty"`
CtaURL string `json:"ctaUrl,omitempty"`
ShowOnlyWhenWaiting bool `json:"showOnlyWhenWaiting,omitempty"`
}