flowcore

package
v19.4.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 58 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WorkflowStateUnknown      = autocore.WorkflowStateUnknown
	WorkflowStateRunning      = autocore.WorkflowStateRunning
	WorkflowStateCompleted    = autocore.WorkflowStateCompleted
	WorkflowStateFailed       = autocore.WorkflowStateFailed
	WorkflowStateCanceled     = autocore.WorkflowStateCanceled
	WorkflowStateTimedOut     = autocore.WorkflowStateTimedOut
	WorkflowStateSystemFailed = autocore.WorkflowStateSystemFailed
)

Variables

View Source
var (
	ChannelTokenKind_name = map[int32]string{
		0: "CHANNEL_TOKEN_KIND_UNSPECIFIED",
		1: "CHANNEL_TOKEN_KIND_MODULE",
		2: "CHANNEL_TOKEN_KIND_CALLER",
	}
	ChannelTokenKind_value = map[string]int32{
		"CHANNEL_TOKEN_KIND_UNSPECIFIED": 0,
		"CHANNEL_TOKEN_KIND_MODULE":      1,
		"CHANNEL_TOKEN_KIND_CALLER":      2,
	}
)

Enum value maps for ChannelTokenKind.

View Source
var (
	// ErrInvalidChannelName is returned by RunWorkflow when the input carries a
	// channel whose name the caller is not allowed to use.
	ErrInvalidChannelName = errors.New("invalid channel name")
	// ErrInvalidValue is returned by the send methods for a value they refuse to
	// put on a channel.
	ErrInvalidValue = errors.New("invalid value")
	// ErrInvalidChannelToken is returned by the send methods when the channel token
	// cannot be parsed or carries unusable claims. The token's signature is not
	// checked there, so this never means "forged".
	ErrInvalidChannelToken = errors.New("invalid channel token")
	// ErrInvalidWorkflowToken is returned by the methods that manage a workflow
	// when the workflow token does not verify against the workflow it addresses.
	// Unlike a channel token it is verified where it is presented, so this does
	// mean the bearer holds no capability for that workflow.
	ErrInvalidWorkflowToken = errors.New("invalid workflow token")
	// ErrInvalidTokenBinding is returned by RunWorkflow when a submission
	// deduplicates against an existing workflow but presents a binding other than
	// the one that workflow registered, so it is not entitled to its tokens.
	ErrInvalidTokenBinding = errors.New("invalid token binding")
	// ErrTokenExpiryPassed is returned by RunWorkflow when it deduplicates against a
	// workflow whose recorded token expiry has already passed, so every token it
	// could mint for that workflow would be dead on arrival.
	ErrTokenExpiryPassed = errors.New("workflow token expiry has passed")
	// ErrMissingSigningSecret is returned by RunWorkflow when the workflow it
	// deduplicated against holds no signing secret, so no usable token can be
	// minted for it, and by the signal promotion interceptor when the workflow a
	// channel signal addresses holds none, so no token can be verified against it.
	ErrMissingSigningSecret = errors.New("workflow has no signing secret")
)
View Source
var (
	ErrWorkflowNotRunning  = autocore.ErrWorkflowNotRunning
	ErrSignalLimitExceeded = autocore.ErrSignalLimitExceeded
)

ErrWorkflowNotRunning is returned by the send paths when the addressed workflow has already reached a terminal state, and ErrSignalLimitExceeded when it has spent its signal history budget. Both are permanent for that workflow: re-sending cannot succeed.

View Source
var ErrInvalidWorkflowKey = autocore.ErrInvalidWorkflowKey

ErrInvalidWorkflowKey is returned by GetWorkflow when the key is malformed.

View Source
var ErrReservedIdempotencyKeyPrefix = autocore.ErrReservedIdempotencyKeyPrefix

ErrReservedIdempotencyKeyPrefix is returned by RunWorkflow when the caller's idempotency key uses the prefix the engine keeps for itself.

View Source
var ErrWorkflowNotFound = autocore.ErrWorkflowNotFound

ErrWorkflowNotFound is returned by GetWorkflow when no workflow exists for the given key.

View Source
var File_internal_flowcore_channel_token_proto protoreflect.FileDescriptor
View Source
var File_internal_flowcore_engine_proto protoreflect.FileDescriptor
View Source
var File_internal_flowcore_workflow_token_proto protoreflect.FileDescriptor

Functions

func NewSensitiveBytes added in v19.2.0

func NewSensitiveBytes(b []byte) starlark.Value

func NewSensitiveString added in v19.2.0

func NewSensitiveString(s string) starlark.Value

Types

type CallerChannelTokenClaims added in v19.3.0

type CallerChannelTokenClaims struct {
	RegisteredClaimIssuer    string   `protobuf:"bytes,1,opt,name=registered_claim_issuer,json=iss" json:"registered_claim_issuer,omitempty"`
	RegisteredClaimAudience  []string `protobuf:"bytes,2,rep,name=registered_claim_audience,json=aud" json:"registered_claim_audience,omitempty"`
	RegisteredClaimExpiresAt float64  `protobuf:"fixed64,3,opt,name=registered_claim_expires_at,json=exp" json:"registered_claim_expires_at,omitempty"`
	RegisteredClaimNotBefore float64  `protobuf:"fixed64,4,opt,name=registered_claim_not_before,json=nbf" json:"registered_claim_not_before,omitempty"`
	RegisteredClaimIssuedAt  float64  `protobuf:"fixed64,5,opt,name=registered_claim_issued_at,json=iat" json:"registered_claim_issued_at,omitempty"`
	ShardId                  int32    `protobuf:"varint,6,opt,name=shard_id" json:"shard_id,omitempty"`
	WorkflowId               string   `protobuf:"bytes,7,opt,name=workflow_id,json=wf_id" json:"workflow_id,omitempty"`
	ChannelName              string   `protobuf:"bytes,8,opt,name=channel_name" json:"channel_name,omitempty"`
	// contains filtered or unexported fields
}

func (*CallerChannelTokenClaims) Descriptor deprecated added in v19.3.0

func (*CallerChannelTokenClaims) Descriptor() ([]byte, []int)

Deprecated: Use CallerChannelTokenClaims.ProtoReflect.Descriptor instead.

func (*CallerChannelTokenClaims) GetAudience added in v19.3.0

func (c *CallerChannelTokenClaims) GetAudience() (jwt.ClaimStrings, error)

func (*CallerChannelTokenClaims) GetChannelName added in v19.3.0

func (x *CallerChannelTokenClaims) GetChannelName() string

func (*CallerChannelTokenClaims) GetExpirationTime added in v19.3.0

func (c *CallerChannelTokenClaims) GetExpirationTime() (*jwt.NumericDate, error)

func (*CallerChannelTokenClaims) GetIssuedAt added in v19.3.0

func (c *CallerChannelTokenClaims) GetIssuedAt() (*jwt.NumericDate, error)

func (*CallerChannelTokenClaims) GetIssuer added in v19.3.0

func (c *CallerChannelTokenClaims) GetIssuer() (string, error)

func (*CallerChannelTokenClaims) GetNotBefore added in v19.3.0

func (c *CallerChannelTokenClaims) GetNotBefore() (*jwt.NumericDate, error)

func (*CallerChannelTokenClaims) GetRegisteredClaimAudience added in v19.3.0

func (x *CallerChannelTokenClaims) GetRegisteredClaimAudience() []string

func (*CallerChannelTokenClaims) GetRegisteredClaimExpiresAt added in v19.3.0

func (x *CallerChannelTokenClaims) GetRegisteredClaimExpiresAt() float64

func (*CallerChannelTokenClaims) GetRegisteredClaimIssuedAt added in v19.3.0

func (x *CallerChannelTokenClaims) GetRegisteredClaimIssuedAt() float64

func (*CallerChannelTokenClaims) GetRegisteredClaimIssuer added in v19.3.0

func (x *CallerChannelTokenClaims) GetRegisteredClaimIssuer() string

func (*CallerChannelTokenClaims) GetRegisteredClaimNotBefore added in v19.3.0

func (x *CallerChannelTokenClaims) GetRegisteredClaimNotBefore() float64

func (*CallerChannelTokenClaims) GetShardId added in v19.3.0

func (x *CallerChannelTokenClaims) GetShardId() int32

func (*CallerChannelTokenClaims) GetSubject added in v19.3.0

func (c *CallerChannelTokenClaims) GetSubject() (string, error)

func (*CallerChannelTokenClaims) GetWorkflowId added in v19.3.0

func (x *CallerChannelTokenClaims) GetWorkflowId() string

func (*CallerChannelTokenClaims) MarshalJSON added in v19.3.0

func (c *CallerChannelTokenClaims) MarshalJSON() ([]byte, error)

func (*CallerChannelTokenClaims) ProtoMessage added in v19.3.0

func (*CallerChannelTokenClaims) ProtoMessage()

func (*CallerChannelTokenClaims) ProtoReflect added in v19.3.0

func (x *CallerChannelTokenClaims) ProtoReflect() protoreflect.Message

func (*CallerChannelTokenClaims) Reset added in v19.3.0

func (x *CallerChannelTokenClaims) Reset()

func (*CallerChannelTokenClaims) String added in v19.3.0

func (x *CallerChannelTokenClaims) String() string

func (*CallerChannelTokenClaims) UnmarshalJSON added in v19.3.0

func (c *CallerChannelTokenClaims) UnmarshalJSON(b []byte) error

func (*CallerChannelTokenClaims) WorkflowKey added in v19.3.0

func (c *CallerChannelTokenClaims) WorkflowKey() (autocore.WorkflowKey, error)

type ChannelSend added in v19.3.0

type ChannelSend struct {
	IdempotencyKey string
	Value          *pkg_autoflow.Value
}

ChannelSend is a single value bound for a channel, together with the idempotency key that deduplicates it.

type ChannelSignalPayload added in v19.2.0

type ChannelSignalPayload struct {
	Token     string           `protobuf:"bytes,1,opt,name=token" json:"token,omitempty"`
	Payload   []byte           `protobuf:"bytes,2,opt,name=payload" json:"payload,omitempty"`
	TokenKind ChannelTokenKind `` /* 126-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*ChannelSignalPayload) Descriptor deprecated added in v19.2.0

func (*ChannelSignalPayload) Descriptor() ([]byte, []int)

Deprecated: Use ChannelSignalPayload.ProtoReflect.Descriptor instead.

func (*ChannelSignalPayload) GetPayload added in v19.2.0

func (x *ChannelSignalPayload) GetPayload() []byte

func (*ChannelSignalPayload) GetToken added in v19.2.0

func (x *ChannelSignalPayload) GetToken() string

func (*ChannelSignalPayload) GetTokenKind added in v19.3.0

func (x *ChannelSignalPayload) GetTokenKind() ChannelTokenKind

func (*ChannelSignalPayload) ProtoMessage added in v19.2.0

func (*ChannelSignalPayload) ProtoMessage()

func (*ChannelSignalPayload) ProtoReflect added in v19.2.0

func (x *ChannelSignalPayload) ProtoReflect() protoreflect.Message

func (*ChannelSignalPayload) Reset added in v19.2.0

func (x *ChannelSignalPayload) Reset()

func (*ChannelSignalPayload) String added in v19.2.0

func (x *ChannelSignalPayload) String() string

type ChannelTokenKind added in v19.3.0

type ChannelTokenKind int32
const (
	ChannelTokenKind_CHANNEL_TOKEN_KIND_UNSPECIFIED ChannelTokenKind = 0
	ChannelTokenKind_CHANNEL_TOKEN_KIND_MODULE      ChannelTokenKind = 1
	ChannelTokenKind_CHANNEL_TOKEN_KIND_CALLER      ChannelTokenKind = 2
)

func (ChannelTokenKind) Descriptor added in v19.3.0

func (ChannelTokenKind) Enum added in v19.3.0

func (ChannelTokenKind) EnumDescriptor deprecated added in v19.3.0

func (ChannelTokenKind) EnumDescriptor() ([]byte, []int)

Deprecated: Use ChannelTokenKind.Descriptor instead.

func (ChannelTokenKind) Number added in v19.3.0

func (ChannelTokenKind) String added in v19.3.0

func (x ChannelTokenKind) String() string

func (ChannelTokenKind) Type added in v19.3.0

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

func NewEngine

func NewEngine(opts *Options) (*Engine, error)

func (*Engine) CancelWorkflow

func (e *Engine) CancelWorkflow(ctx context.Context, workflowKey, workflowToken string) error

CancelWorkflow requests cancellation of the workflow addressed by workflowKey. workflowToken is that workflow's token, or empty to present none. Cancellation is an asynchronous best-effort signal: the workflow transitions to a canceled state on a later replay round. Returns ErrInvalidWorkflowKey if the key is malformed, ErrWorkflowNotFound if no such workflow exists, or ErrInvalidWorkflowToken if the token does not verify.

func (*Engine) GetWorkflow

func (e *Engine) GetWorkflow(ctx context.Context, workflowKey, workflowToken string) (*Workflow, error)

GetWorkflow returns a snapshot of the workflow addressed by workflowKey, the key string returned by RunWorkflow. workflowToken is that workflow's token. Returns ErrInvalidWorkflowToken if the token does not verify, or an error if the key is malformed.

This is the polled endpoint, so the workflow and the metadata its token is verified against come from one read of one row. Nothing is returned before the token verifies; a workflow that is not there yields the same refusal as a wrong token, since a caller that cannot verify must not learn whether it exists.

func (*Engine) RunWorkflow

func (e *Engine) RunWorkflow(ctx context.Context, namespaceID int64, idempotencyKey string, opts *RunWorkflowOptions) (*RunWorkflowResult, error)

RunWorkflow submits a RunWorkflow workflow and mints its workflow token plus a channel token for every distinct channel the arguments carry. Returns the autocore-assigned workflow key.

If a workflow with the given (namespaceID, idempotencyKey) already exists, it returns that workflow's key without re-creating it, with tokens signed by the secret that workflow was created with. Those tokens are only handed over if opts.TokenBinding is the binding that workflow registered, so holding an idempotency key is not holding the workflow.

Returns ErrInvalidChannelName for a channel the caller may not name, ErrReservedIdempotencyKeyPrefix for an idempotency key the caller may not use, ErrInvalidTokenBinding if the existing workflow registered a different binding, ErrWorkflowNotFound if it is gone by the time its secret is read back, and ErrMissingSigningSecret if it holds no secret to sign with.

func (*Engine) SendToChannel added in v19.2.0

func (e *Engine) SendToChannel(ctx context.Context, agentKey api.AgentKey, channelToken string, sends []ChannelSend) error

SendToChannel puts each of sends onto the channel the module token addresses. Every send gets its own signal, keyed by its own idempotency key, so resending a batch lands nothing that already arrived.

func (*Engine) SendToWorkflowChannel added in v19.3.0

func (e *Engine) SendToWorkflowChannel(ctx context.Context, idempotencyKey, channelToken, workflowToken string, value *pkg_autoflow.Value) error

SendToWorkflowChannel sends value into the channel the caller token addresses. The token is the capability handed out by RunWorkflow for a channel in the workflow input. workflowToken is the token of the workflow that channel belongs to, or empty to present none.

type InvokeActionActivityInput

type InvokeActionActivityInput struct {
	AgentId       int64               `protobuf:"varint,1,opt,name=agent_id,json=agentId" json:"agent_id,omitempty"`
	AgentType     uint32              `protobuf:"varint,2,opt,name=agent_type,json=agentType" json:"agent_type,omitempty"`
	ModuleName    string              `protobuf:"bytes,3,opt,name=module_name,json=moduleName" json:"module_name,omitempty"`
	ActionName    string              `protobuf:"bytes,4,opt,name=action_name,json=actionName" json:"action_name,omitempty"`
	Args          []*v19.Value        `protobuf:"bytes,5,rep,name=args" json:"args,omitempty"`
	Kwargs        []*v19.Kwarg        `protobuf:"bytes,6,rep,name=kwargs" json:"kwargs,omitempty"`
	ChannelTokens []*v19.ChannelToken `protobuf:"bytes,7,rep,name=channel_tokens,json=channelTokens" json:"channel_tokens,omitempty"`
	Transforms    []*Transform        `protobuf:"bytes,8,rep,name=transforms" json:"transforms,omitempty"`
	// contains filtered or unexported fields
}

func (*InvokeActionActivityInput) Descriptor deprecated

func (*InvokeActionActivityInput) Descriptor() ([]byte, []int)

Deprecated: Use InvokeActionActivityInput.ProtoReflect.Descriptor instead.

func (*InvokeActionActivityInput) GetActionName

func (x *InvokeActionActivityInput) GetActionName() string

func (*InvokeActionActivityInput) GetAgentId added in v19.2.0

func (x *InvokeActionActivityInput) GetAgentId() int64

func (*InvokeActionActivityInput) GetAgentType added in v19.2.0

func (x *InvokeActionActivityInput) GetAgentType() uint32

func (*InvokeActionActivityInput) GetArgs

func (x *InvokeActionActivityInput) GetArgs() []*v19.Value

func (*InvokeActionActivityInput) GetChannelTokens added in v19.2.0

func (x *InvokeActionActivityInput) GetChannelTokens() []*v19.ChannelToken

func (*InvokeActionActivityInput) GetKwargs

func (x *InvokeActionActivityInput) GetKwargs() []*v19.Kwarg

func (*InvokeActionActivityInput) GetModuleName

func (x *InvokeActionActivityInput) GetModuleName() string

func (*InvokeActionActivityInput) GetTransforms added in v19.3.0

func (x *InvokeActionActivityInput) GetTransforms() []*Transform

func (*InvokeActionActivityInput) ProtoMessage

func (*InvokeActionActivityInput) ProtoMessage()

func (*InvokeActionActivityInput) ProtoReflect

func (*InvokeActionActivityInput) Reset

func (x *InvokeActionActivityInput) Reset()

func (*InvokeActionActivityInput) String

func (x *InvokeActionActivityInput) String() string

type InvokeActionActivityOutput

type InvokeActionActivityOutput struct {
	Result *v19.Result `protobuf:"bytes,1,opt,name=result" json:"result,omitempty"`
	// contains filtered or unexported fields
}

func (*InvokeActionActivityOutput) Descriptor deprecated

func (*InvokeActionActivityOutput) Descriptor() ([]byte, []int)

Deprecated: Use InvokeActionActivityOutput.ProtoReflect.Descriptor instead.

func (*InvokeActionActivityOutput) GetResult

func (x *InvokeActionActivityOutput) GetResult() *v19.Result

func (*InvokeActionActivityOutput) ProtoMessage

func (*InvokeActionActivityOutput) ProtoMessage()

func (*InvokeActionActivityOutput) ProtoReflect

func (*InvokeActionActivityOutput) Reset

func (x *InvokeActionActivityOutput) Reset()

func (*InvokeActionActivityOutput) String

func (x *InvokeActionActivityOutput) String() string

type LoadModulesActivityInput added in v19.3.0

type LoadModulesActivityInput struct {
	WorkflowDefinition []byte `protobuf:"bytes,1,opt,name=workflow_definition,json=workflowDefinition" json:"workflow_definition,omitempty"`
	// contains filtered or unexported fields
}

func (*LoadModulesActivityInput) Descriptor deprecated added in v19.3.0

func (*LoadModulesActivityInput) Descriptor() ([]byte, []int)

Deprecated: Use LoadModulesActivityInput.ProtoReflect.Descriptor instead.

func (*LoadModulesActivityInput) GetWorkflowDefinition added in v19.3.0

func (x *LoadModulesActivityInput) GetWorkflowDefinition() []byte

func (*LoadModulesActivityInput) ProtoMessage added in v19.3.0

func (*LoadModulesActivityInput) ProtoMessage()

func (*LoadModulesActivityInput) ProtoReflect added in v19.3.0

func (x *LoadModulesActivityInput) ProtoReflect() protoreflect.Message

func (*LoadModulesActivityInput) Reset added in v19.3.0

func (x *LoadModulesActivityInput) Reset()

func (*LoadModulesActivityInput) String added in v19.3.0

func (x *LoadModulesActivityInput) String() string

type LoadModulesActivityOutput added in v19.3.0

type LoadModulesActivityOutput struct {
	Modules []*LoadedModule `protobuf:"bytes,1,rep,name=modules" json:"modules,omitempty"`
	// contains filtered or unexported fields
}

func (*LoadModulesActivityOutput) Descriptor deprecated added in v19.3.0

func (*LoadModulesActivityOutput) Descriptor() ([]byte, []int)

Deprecated: Use LoadModulesActivityOutput.ProtoReflect.Descriptor instead.

func (*LoadModulesActivityOutput) GetModules added in v19.3.0

func (x *LoadModulesActivityOutput) GetModules() []*LoadedModule

func (*LoadModulesActivityOutput) ProtoMessage added in v19.3.0

func (*LoadModulesActivityOutput) ProtoMessage()

func (*LoadModulesActivityOutput) ProtoReflect added in v19.3.0

func (*LoadModulesActivityOutput) Reset added in v19.3.0

func (x *LoadModulesActivityOutput) Reset()

func (*LoadModulesActivityOutput) String added in v19.3.0

func (x *LoadModulesActivityOutput) String() string

type LoadedModule added in v19.3.0

type LoadedModule struct {
	ModulePath           string                      `protobuf:"bytes,1,opt,name=module_path,json=modulePath" json:"module_path,omitempty"`
	ModuleName           string                      `protobuf:"bytes,2,opt,name=module_name,json=moduleName" json:"module_name,omitempty"`
	RegisteredModuleDesc *RegisteredModuleDescriptor `protobuf:"bytes,3,opt,name=registered_module_desc,json=registeredModuleDesc" json:"registered_module_desc,omitempty"`
	// contains filtered or unexported fields
}

func (*LoadedModule) Descriptor deprecated added in v19.3.0

func (*LoadedModule) Descriptor() ([]byte, []int)

Deprecated: Use LoadedModule.ProtoReflect.Descriptor instead.

func (*LoadedModule) GetModuleName added in v19.3.0

func (x *LoadedModule) GetModuleName() string

func (*LoadedModule) GetModulePath added in v19.3.0

func (x *LoadedModule) GetModulePath() string

func (*LoadedModule) GetRegisteredModuleDesc added in v19.3.0

func (x *LoadedModule) GetRegisteredModuleDesc() *RegisteredModuleDescriptor

func (*LoadedModule) ProtoMessage added in v19.3.0

func (*LoadedModule) ProtoMessage()

func (*LoadedModule) ProtoReflect added in v19.3.0

func (x *LoadedModule) ProtoReflect() protoreflect.Message

func (*LoadedModule) Reset added in v19.3.0

func (x *LoadedModule) Reset()

func (*LoadedModule) String added in v19.3.0

func (x *LoadedModule) String() string

type ModuleChannelTokenClaims added in v19.3.0

type ModuleChannelTokenClaims struct {
	RegisteredClaimIssuer    string   `protobuf:"bytes,1,opt,name=registered_claim_issuer,json=iss" json:"registered_claim_issuer,omitempty"`
	RegisteredClaimAudience  []string `protobuf:"bytes,2,rep,name=registered_claim_audience,json=aud" json:"registered_claim_audience,omitempty"`
	RegisteredClaimExpiresAt float64  `protobuf:"fixed64,3,opt,name=registered_claim_expires_at,json=exp" json:"registered_claim_expires_at,omitempty"`
	RegisteredClaimNotBefore float64  `protobuf:"fixed64,4,opt,name=registered_claim_not_before,json=nbf" json:"registered_claim_not_before,omitempty"`
	RegisteredClaimIssuedAt  float64  `protobuf:"fixed64,5,opt,name=registered_claim_issued_at,json=iat" json:"registered_claim_issued_at,omitempty"`
	ShardId                  int32    `protobuf:"varint,6,opt,name=shard_id" json:"shard_id,omitempty"`
	WorkflowId               string   `protobuf:"bytes,7,opt,name=workflow_id,json=wf_id" json:"workflow_id,omitempty"`
	ChannelName              string   `protobuf:"bytes,8,opt,name=channel_name" json:"channel_name,omitempty"`
	AgentId                  int64    `protobuf:"varint,9,opt,name=agent_id" json:"agent_id,omitempty"`
	AgentType                uint32   `protobuf:"varint,10,opt,name=agent_type" json:"agent_type,omitempty"`
	// contains filtered or unexported fields
}

func (*ModuleChannelTokenClaims) Descriptor deprecated added in v19.3.0

func (*ModuleChannelTokenClaims) Descriptor() ([]byte, []int)

Deprecated: Use ModuleChannelTokenClaims.ProtoReflect.Descriptor instead.

func (*ModuleChannelTokenClaims) GetAgentId added in v19.3.0

func (x *ModuleChannelTokenClaims) GetAgentId() int64

func (*ModuleChannelTokenClaims) GetAgentType added in v19.3.0

func (x *ModuleChannelTokenClaims) GetAgentType() uint32

func (*ModuleChannelTokenClaims) GetAudience added in v19.3.0

func (c *ModuleChannelTokenClaims) GetAudience() (jwt.ClaimStrings, error)

func (*ModuleChannelTokenClaims) GetChannelName added in v19.3.0

func (x *ModuleChannelTokenClaims) GetChannelName() string

func (*ModuleChannelTokenClaims) GetExpirationTime added in v19.3.0

func (c *ModuleChannelTokenClaims) GetExpirationTime() (*jwt.NumericDate, error)

func (*ModuleChannelTokenClaims) GetIssuedAt added in v19.3.0

func (c *ModuleChannelTokenClaims) GetIssuedAt() (*jwt.NumericDate, error)

func (*ModuleChannelTokenClaims) GetIssuer added in v19.3.0

func (c *ModuleChannelTokenClaims) GetIssuer() (string, error)

func (*ModuleChannelTokenClaims) GetNotBefore added in v19.3.0

func (c *ModuleChannelTokenClaims) GetNotBefore() (*jwt.NumericDate, error)

func (*ModuleChannelTokenClaims) GetRegisteredClaimAudience added in v19.3.0

func (x *ModuleChannelTokenClaims) GetRegisteredClaimAudience() []string

func (*ModuleChannelTokenClaims) GetRegisteredClaimExpiresAt added in v19.3.0

func (x *ModuleChannelTokenClaims) GetRegisteredClaimExpiresAt() float64

func (*ModuleChannelTokenClaims) GetRegisteredClaimIssuedAt added in v19.3.0

func (x *ModuleChannelTokenClaims) GetRegisteredClaimIssuedAt() float64

func (*ModuleChannelTokenClaims) GetRegisteredClaimIssuer added in v19.3.0

func (x *ModuleChannelTokenClaims) GetRegisteredClaimIssuer() string

func (*ModuleChannelTokenClaims) GetRegisteredClaimNotBefore added in v19.3.0

func (x *ModuleChannelTokenClaims) GetRegisteredClaimNotBefore() float64

func (*ModuleChannelTokenClaims) GetShardId added in v19.3.0

func (x *ModuleChannelTokenClaims) GetShardId() int32

func (*ModuleChannelTokenClaims) GetSubject added in v19.3.0

func (c *ModuleChannelTokenClaims) GetSubject() (string, error)

func (*ModuleChannelTokenClaims) GetWorkflowId added in v19.3.0

func (x *ModuleChannelTokenClaims) GetWorkflowId() string

func (*ModuleChannelTokenClaims) MarshalJSON added in v19.3.0

func (c *ModuleChannelTokenClaims) MarshalJSON() ([]byte, error)

func (*ModuleChannelTokenClaims) ProtoMessage added in v19.3.0

func (*ModuleChannelTokenClaims) ProtoMessage()

func (*ModuleChannelTokenClaims) ProtoReflect added in v19.3.0

func (x *ModuleChannelTokenClaims) ProtoReflect() protoreflect.Message

func (*ModuleChannelTokenClaims) Reset added in v19.3.0

func (x *ModuleChannelTokenClaims) Reset()

func (*ModuleChannelTokenClaims) String added in v19.3.0

func (x *ModuleChannelTokenClaims) String() string

func (*ModuleChannelTokenClaims) UnmarshalJSON added in v19.3.0

func (c *ModuleChannelTokenClaims) UnmarshalJSON(b []byte) error

func (*ModuleChannelTokenClaims) WorkflowKey added in v19.3.0

func (c *ModuleChannelTokenClaims) WorkflowKey() (autocore.WorkflowKey, error)

type ModuleDescriptorResolver

type ModuleDescriptorResolver struct {
	Desc *pkg_autoflow.ModuleDescriptor
	// ModuleURI is the normalized URI the module was loaded from. A module file
	// runs under it rather than under its bare file name, so two modules shipping
	// an identically named file stay distinguishable in error messages and
	// wherever a symbol is attributed to the file that defined it.
	ModuleURI        string
	PredeclaredFiles *protoregistry.Files
	Backend          autoflow.Backend
	Loader           autoflow.Loader
	Tracer           trace.Tracer
	// NewAction builds the action for each of the module's actions.
	NewAction NewActionFunc
}

func (*ModuleDescriptorResolver) LoadFile added in v19.3.0

func (r *ModuleDescriptorResolver) LoadFile(ctx context.Context, fileName string) (starlark.StringDict, error)

func (*ModuleDescriptorResolver) LoadSymbols

func (r *ModuleDescriptorResolver) LoadSymbols() (starlark.StringDict, error)

type ModuleManager

type ModuleManager interface {
	// LoadModuleDescriptor loads a registered module's descriptor.
	// Returns (nil, nil) if not found.
	LoadModuleDescriptor(ctx context.Context, moduleName string) (*RegisteredModuleDescriptor, error)
	InvokeAction(
		ctx context.Context,
		agentKey api.AgentKey,
		actionName, workflowKey, idempotencyKey string,
		args []*pkg_autoflow.Value,
		kwargs []*pkg_autoflow.Kwarg,
		channelTokens []*pkg_autoflow.ChannelToken,
	) (*pkg_autoflow.Result, error)
}

type ModuleURI added in v19.3.0

type ModuleURI struct {
	api.AutoFlowModuleKey
	File string
}

ModuleURI represents an AutoFlow module URI.

It has the following structure: "module:[module/path/]<module_name>[?params]" Module path and parameters are optional. Parameters are represented as usual URL query parameters.

The supported parameters are: - file: name of a file, exposed by a module.

Module names are agent names, defined in doc/identity_and_auth.md.

func ParseModuleURI added in v19.3.0

func ParseModuleURI(u string) (*ModuleURI, error)

func (*ModuleURI) String added in v19.3.0

func (u *ModuleURI) String() string

type NewActionFunc added in v19.3.0

type NewActionFunc func(action *pkg_autoflow.Action, conv *ValueConverter) autoflow.Action

NewActionFunc builds the Action for one of a module's actions.

type Options

type Options struct {
	Client         autocore.Client
	Registry       *autocore.Registry
	ModuleManager  ModuleManager
	MeterProvider  otelmetric.MeterProvider
	TracerProvider oteltrace.TracerProvider
	Validator      protovalidate.Validator
	// PredeclaredProtoFiles is the set of proto file descriptors that
	// AutoFlow modules' descriptor sets may import. Used to resolve
	// imports when reconstructing module proto descriptors; we deliberately
	// do not fall back to protoregistry.GlobalFiles so a module cannot pull
	// in arbitrary types linked into the binary.
	// Order is important here - files that come later can import files that come earlier,
	// but not the other way around.
	PredeclaredProtoFiles      []protoreflect.FileDescriptor
	TokenSigningMethod         *jwt.SigningMethodHMAC
	ModuleChannelTokenIssuer   string
	ModuleChannelTokenAudience jwt.ClaimStrings
}

type RegisteredModuleDescriptor added in v19.2.0

type RegisteredModuleDescriptor struct {
	ModuleDesc *v19.ModuleDescriptor `protobuf:"bytes,1,opt,name=module_desc,json=moduleDesc" json:"module_desc,omitempty"`
	AgentId    int64                 `protobuf:"varint,2,opt,name=agent_id,json=agentId" json:"agent_id,omitempty"`
	AgentType  uint32                `protobuf:"varint,3,opt,name=agent_type,json=agentType" json:"agent_type,omitempty"`
	// contains filtered or unexported fields
}

func (*RegisteredModuleDescriptor) Descriptor deprecated added in v19.2.0

func (*RegisteredModuleDescriptor) Descriptor() ([]byte, []int)

Deprecated: Use RegisteredModuleDescriptor.ProtoReflect.Descriptor instead.

func (*RegisteredModuleDescriptor) GetAgentId added in v19.2.0

func (x *RegisteredModuleDescriptor) GetAgentId() int64

func (*RegisteredModuleDescriptor) GetAgentType added in v19.2.0

func (x *RegisteredModuleDescriptor) GetAgentType() uint32

func (*RegisteredModuleDescriptor) GetModuleDesc added in v19.2.0

func (x *RegisteredModuleDescriptor) GetModuleDesc() *v19.ModuleDescriptor

func (*RegisteredModuleDescriptor) ProtoMessage added in v19.2.0

func (*RegisteredModuleDescriptor) ProtoMessage()

func (*RegisteredModuleDescriptor) ProtoReflect added in v19.2.0

func (*RegisteredModuleDescriptor) Reset added in v19.2.0

func (x *RegisteredModuleDescriptor) Reset()

func (*RegisteredModuleDescriptor) String added in v19.2.0

func (x *RegisteredModuleDescriptor) String() string

type RunWorkflowInput

type RunWorkflowInput struct {
	WorkflowDefinition []byte       `protobuf:"bytes,1,opt,name=workflow_definition,json=workflowDefinition" json:"workflow_definition,omitempty"`
	Args               []*v19.Value `protobuf:"bytes,2,rep,name=args" json:"args,omitempty"`
	Kwargs             []*v19.Kwarg `protobuf:"bytes,3,rep,name=kwargs" json:"kwargs,omitempty"`
	EntryFunction      string       `protobuf:"bytes,6,opt,name=entry_function,json=entryFunction" json:"entry_function,omitempty"`
	// contains filtered or unexported fields
}

func (*RunWorkflowInput) Descriptor deprecated

func (*RunWorkflowInput) Descriptor() ([]byte, []int)

Deprecated: Use RunWorkflowInput.ProtoReflect.Descriptor instead.

func (*RunWorkflowInput) GetArgs added in v19.2.0

func (x *RunWorkflowInput) GetArgs() []*v19.Value

func (*RunWorkflowInput) GetEntryFunction added in v19.3.0

func (x *RunWorkflowInput) GetEntryFunction() string

func (*RunWorkflowInput) GetKwargs added in v19.2.0

func (x *RunWorkflowInput) GetKwargs() []*v19.Kwarg

func (*RunWorkflowInput) GetWorkflowDefinition

func (x *RunWorkflowInput) GetWorkflowDefinition() []byte

func (*RunWorkflowInput) ProtoMessage

func (*RunWorkflowInput) ProtoMessage()

func (*RunWorkflowInput) ProtoReflect

func (x *RunWorkflowInput) ProtoReflect() protoreflect.Message

func (*RunWorkflowInput) Reset

func (x *RunWorkflowInput) Reset()

func (*RunWorkflowInput) String

func (x *RunWorkflowInput) String() string

type RunWorkflowOptions added in v19.3.0

type RunWorkflowOptions struct {
	WorkflowDefinition        []byte
	Args                      []*pkg_autoflow.Value
	Kwargs                    []*pkg_autoflow.Kwarg
	ScheduleToCompleteTimeout time.Duration
	// TokenBinding is the value a re-submission must present to be handed this
	// workflow's tokens again. Required of every caller; empty registers none,
	// which leaves the workflow's tokens un-re-issuable for good.
	TokenBinding []byte
}

RunWorkflowOptions is what a caller passes to RunWorkflow. It is deliberately not RunWorkflowInput: that message is the workflow's own input and carries fields only flowcore may set, such as the signing secret and the entry function a parent picks for a child.

type RunWorkflowOutput

type RunWorkflowOutput struct {
	Result *v19.Value `protobuf:"bytes,1,opt,name=result" json:"result,omitempty"`
	// contains filtered or unexported fields
}

func (*RunWorkflowOutput) Descriptor deprecated

func (*RunWorkflowOutput) Descriptor() ([]byte, []int)

Deprecated: Use RunWorkflowOutput.ProtoReflect.Descriptor instead.

func (*RunWorkflowOutput) GetResult added in v19.2.0

func (x *RunWorkflowOutput) GetResult() *v19.Value

func (*RunWorkflowOutput) ProtoMessage

func (*RunWorkflowOutput) ProtoMessage()

func (*RunWorkflowOutput) ProtoReflect

func (x *RunWorkflowOutput) ProtoReflect() protoreflect.Message

func (*RunWorkflowOutput) Reset

func (x *RunWorkflowOutput) Reset()

func (*RunWorkflowOutput) String

func (x *RunWorkflowOutput) String() string

type RunWorkflowResult added in v19.3.0

type RunWorkflowResult struct {
	WorkflowKey   string
	WorkflowToken string
	ChannelTokens []*pkg_autoflow.ChannelToken
}

RunWorkflowResult is what RunWorkflow returns. WorkflowToken is the capability to manage the workflow. ChannelTokens holds one send-only capability per distinct channel in the workflow input, in first-encounter order, and is empty when the input carries no channel.

type Transform added in v19.3.0

type Transform struct {
	Source       []byte `protobuf:"bytes,1,opt,name=source" json:"source,omitempty"`
	FunctionName string `protobuf:"bytes,2,opt,name=function_name,json=functionName" json:"function_name,omitempty"`
	FileName     string `protobuf:"bytes,3,opt,name=file_name,json=fileName" json:"file_name,omitempty"`
	// contains filtered or unexported fields
}

func (*Transform) Descriptor deprecated added in v19.3.0

func (*Transform) Descriptor() ([]byte, []int)

Deprecated: Use Transform.ProtoReflect.Descriptor instead.

func (*Transform) GetFileName added in v19.3.0

func (x *Transform) GetFileName() string

func (*Transform) GetFunctionName added in v19.3.0

func (x *Transform) GetFunctionName() string

func (*Transform) GetSource added in v19.3.0

func (x *Transform) GetSource() []byte

func (*Transform) ProtoMessage added in v19.3.0

func (*Transform) ProtoMessage()

func (*Transform) ProtoReflect added in v19.3.0

func (x *Transform) ProtoReflect() protoreflect.Message

func (*Transform) Reset added in v19.3.0

func (x *Transform) Reset()

func (*Transform) String added in v19.3.0

func (x *Transform) String() string

type ValidatingCallerChannelTokenClaims added in v19.3.0

type ValidatingCallerChannelTokenClaims struct {
	CallerChannelTokenClaims

	Validator           protovalidate.Validator
	ExpectedChannelName string
	ExpectedShardID     autocore.ShardID
	ExpectedWorkflowID  autocore.WorkflowID
}

func (*ValidatingCallerChannelTokenClaims) Validate added in v19.3.0

type ValidatingModuleChannelTokenClaims added in v19.3.0

type ValidatingModuleChannelTokenClaims struct {
	ModuleChannelTokenClaims

	Validator           protovalidate.Validator
	ExpectedAgentKey    api.AgentKey // optional, ignored when zero value
	ExpectedChannelName string
	ExpectedShardID     autocore.ShardID
	ExpectedWorkflowID  autocore.WorkflowID
}

func (*ValidatingModuleChannelTokenClaims) Validate added in v19.3.0

type ValidatingWorkflowTokenClaims

type ValidatingWorkflowTokenClaims struct {
	WorkflowTokenClaims

	Validator          protovalidate.Validator
	ExpectedShardID    autocore.ShardID
	ExpectedWorkflowID autocore.WorkflowID
}

func (*ValidatingWorkflowTokenClaims) Validate

func (v *ValidatingWorkflowTokenClaims) Validate() error

type ValueConverter

type ValueConverter struct {
	// contains filtered or unexported fields
}

ValueConverter converts between AutoFlow proto Values and Starlark values.

Proto message Values (google.protobuf.Any) are resolved against the supplied descriptor set, falling back to the predeclared files. protoregistry.GlobalFiles is intentionally NOT consulted. Safe to use concurrently. A converter with a channel resolver installed is the exception: the resolver reaches into the running workflow's state, so that converter is confined to the workflow goroutine.

func NewValueConverter

func NewValueConverter(predeclaredFiles *protoregistry.Files, descriptorSet *descriptorpb.FileDescriptorSet) *ValueConverter

NewValueConverter constructs a new ValueConverter. descriptorSet is optional, can be nil

func (*ValueConverter) FromStarlark

func (c *ValueConverter) FromStarlark(v starlark.Value) (*pkg_autoflow.Value, error)

FromStarlark converts a Starlark value into a proto Value.

func (*ValueConverter) FromStarlarkIterable added in v19.3.0

func (c *ValueConverter) FromStarlarkIterable(it iterable) ([]*pkg_autoflow.Value, error)

func (*ValueConverter) FromStarlarkKwargs added in v19.3.0

func (c *ValueConverter) FromStarlarkKwargs(kwargs []starlark.Tuple) ([]*pkg_autoflow.Kwarg, error)

FromStarlarkKwargs converts Starlark keyword arguments to proto Kwargs.

func (*ValueConverter) ToStarlark

func (c *ValueConverter) ToStarlark(v *pkg_autoflow.Value) (starlark.Value, error)

ToStarlark converts a proto Value into a Starlark value.

type ValueToStarlarkConverter added in v19.2.0

type ValueToStarlarkConverter interface {
	ToStarlark(*pkg_autoflow.Value) (starlark.Value, error)
}

ValueToStarlarkConverter converts an AutoFlow proto Value into a Starlark value.

type Workflow

type Workflow struct {
	Key            string
	Name           string
	IdempotencyKey string
	State          WorkflowState
	CreatedAt      time.Time
	UpdatedAt      time.Time
	Output         *RunWorkflowOutput
	Error          string
}

Workflow is a read-only snapshot of a workflow returned by GetWorkflow. Output holds the workflow's decoded output and is set only when the workflow completed; Error holds the failure message and is set only when it failed.

type WorkflowMetadata added in v19.3.0

type WorkflowMetadata struct {
	SigningSecret    []byte                 `protobuf:"bytes,1,opt,name=signing_secret,json=signingSecret" json:"signing_secret,omitempty"`
	TokenBindingHash []byte                 `protobuf:"bytes,2,opt,name=token_binding_hash,json=tokenBindingHash" json:"token_binding_hash,omitempty"`
	TokenExpiresAt   *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=token_expires_at,json=tokenExpiresAt" json:"token_expires_at,omitempty"`
	// contains filtered or unexported fields
}

func (*WorkflowMetadata) Descriptor deprecated added in v19.3.0

func (*WorkflowMetadata) Descriptor() ([]byte, []int)

Deprecated: Use WorkflowMetadata.ProtoReflect.Descriptor instead.

func (*WorkflowMetadata) GetSigningSecret

func (x *WorkflowMetadata) GetSigningSecret() []byte

func (*WorkflowMetadata) GetTokenBindingHash

func (x *WorkflowMetadata) GetTokenBindingHash() []byte

func (*WorkflowMetadata) GetTokenExpiresAt

func (x *WorkflowMetadata) GetTokenExpiresAt() *timestamppb.Timestamp

func (*WorkflowMetadata) ProtoMessage added in v19.3.0

func (*WorkflowMetadata) ProtoMessage()

func (*WorkflowMetadata) ProtoReflect added in v19.3.0

func (x *WorkflowMetadata) ProtoReflect() protoreflect.Message

func (*WorkflowMetadata) Reset added in v19.3.0

func (x *WorkflowMetadata) Reset()

func (*WorkflowMetadata) String added in v19.3.0

func (x *WorkflowMetadata) String() string

type WorkflowState

type WorkflowState = autocore.WorkflowState

WorkflowState is the lifecycle state of an AutoFlow workflow.

type WorkflowTokenClaims

type WorkflowTokenClaims struct {
	RegisteredClaimIssuer    string   `protobuf:"bytes,1,opt,name=registered_claim_issuer,json=iss" json:"registered_claim_issuer,omitempty"`
	RegisteredClaimAudience  []string `protobuf:"bytes,2,rep,name=registered_claim_audience,json=aud" json:"registered_claim_audience,omitempty"`
	RegisteredClaimExpiresAt float64  `protobuf:"fixed64,3,opt,name=registered_claim_expires_at,json=exp" json:"registered_claim_expires_at,omitempty"`
	RegisteredClaimNotBefore float64  `protobuf:"fixed64,4,opt,name=registered_claim_not_before,json=nbf" json:"registered_claim_not_before,omitempty"`
	RegisteredClaimIssuedAt  float64  `protobuf:"fixed64,5,opt,name=registered_claim_issued_at,json=iat" json:"registered_claim_issued_at,omitempty"`
	ShardId                  int32    `protobuf:"varint,6,opt,name=shard_id" json:"shard_id,omitempty"`
	WorkflowId               string   `protobuf:"bytes,7,opt,name=workflow_id,json=wf_id" json:"workflow_id,omitempty"`
	// contains filtered or unexported fields
}

func (*WorkflowTokenClaims) Descriptor deprecated

func (*WorkflowTokenClaims) Descriptor() ([]byte, []int)

Deprecated: Use WorkflowTokenClaims.ProtoReflect.Descriptor instead.

func (*WorkflowTokenClaims) GetAudience

func (c *WorkflowTokenClaims) GetAudience() (jwt.ClaimStrings, error)

func (*WorkflowTokenClaims) GetExpirationTime

func (c *WorkflowTokenClaims) GetExpirationTime() (*jwt.NumericDate, error)

func (*WorkflowTokenClaims) GetIssuedAt

func (c *WorkflowTokenClaims) GetIssuedAt() (*jwt.NumericDate, error)

func (*WorkflowTokenClaims) GetIssuer

func (c *WorkflowTokenClaims) GetIssuer() (string, error)

func (*WorkflowTokenClaims) GetNotBefore

func (c *WorkflowTokenClaims) GetNotBefore() (*jwt.NumericDate, error)

func (*WorkflowTokenClaims) GetRegisteredClaimAudience

func (x *WorkflowTokenClaims) GetRegisteredClaimAudience() []string

func (*WorkflowTokenClaims) GetRegisteredClaimExpiresAt

func (x *WorkflowTokenClaims) GetRegisteredClaimExpiresAt() float64

func (*WorkflowTokenClaims) GetRegisteredClaimIssuedAt

func (x *WorkflowTokenClaims) GetRegisteredClaimIssuedAt() float64

func (*WorkflowTokenClaims) GetRegisteredClaimIssuer

func (x *WorkflowTokenClaims) GetRegisteredClaimIssuer() string

func (*WorkflowTokenClaims) GetRegisteredClaimNotBefore

func (x *WorkflowTokenClaims) GetRegisteredClaimNotBefore() float64

func (*WorkflowTokenClaims) GetShardId

func (x *WorkflowTokenClaims) GetShardId() int32

func (*WorkflowTokenClaims) GetSubject

func (c *WorkflowTokenClaims) GetSubject() (string, error)

func (*WorkflowTokenClaims) GetWorkflowId

func (x *WorkflowTokenClaims) GetWorkflowId() string

func (*WorkflowTokenClaims) MarshalJSON

func (c *WorkflowTokenClaims) MarshalJSON() ([]byte, error)

func (*WorkflowTokenClaims) ProtoMessage

func (*WorkflowTokenClaims) ProtoMessage()

func (*WorkflowTokenClaims) ProtoReflect

func (x *WorkflowTokenClaims) ProtoReflect() protoreflect.Message

func (*WorkflowTokenClaims) Reset

func (x *WorkflowTokenClaims) Reset()

func (*WorkflowTokenClaims) String

func (x *WorkflowTokenClaims) String() string

func (*WorkflowTokenClaims) UnmarshalJSON

func (c *WorkflowTokenClaims) UnmarshalJSON(b []byte) error

func (*WorkflowTokenClaims) WorkflowKey

func (c *WorkflowTokenClaims) WorkflowKey() (autocore.WorkflowKey, error)

Jump to

Keyboard shortcuts

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