{"modulePath":"github.com/smartcontractkit/cre-cli","version":"v1.42.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package simulate\n\n## Constants\n\n```go\nconst WorkflowExecutionTimeout = 5 * time.Minute\n```\n\n## Variables\n\n```go\nvar (\n\tStyleBlue       = lipgloss.NewStyle().Foreground(lipgloss.Color(ui.ColorBlue500))\n\tStyleBrightCyan = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color(ui.ColorTeal400))\n\tStyleYellow     = lipgloss.NewStyle().Foreground(lipgloss.Color(ui.ColorYellow400))\n\tStyleRed        = lipgloss.NewStyle().Foreground(lipgloss.Color(ui.ColorRed400))\n\tStyleGreen      = lipgloss.NewStyle().Foreground(lipgloss.Color(ui.ColorGreen400))\n\tStyleMagenta    = lipgloss.NewStyle().Foreground(lipgloss.Color(ui.ColorPurple400))\n)\n```\nStyle instances for consistent styling (using Chainlink Blocks palette)\n\n## Functions\n\n```go\nfunc CleanLogMessage(msg string) string\n```\nCleanLogMessage removes structured log patterns from messages\n\n```go\nfunc ExportDefaultLimitsJSON() []byte\n```\nExportDefaultLimitsJSON returns the embedded default limits JSON.\n\n```go\nfunc FormatCapability(capabilityID string) string\n```\nFormatCapability formats capability ID for display\n\n```go\nfunc FormatStepRef(stepRef string) string\n```\nFormatStepRef formats step reference, handling the -1 case\n\n```go\nfunc FormatTimestamp(timestamp string) string\n```\nFormatTimestamp converts RFC3339Nano timestamp to simple format\n\n```go\nfunc GetLogLevel(msg string) string\n```\nGetLogLevel extracts log level from a message\n\n```go\nfunc GetStyle(status string) lipgloss.Style\n```\nGetStyle returns the appropriate style for a given status/level\n\n```go\nfunc HighlightLogLevels(msg string, levelStyle lipgloss.Style) string\n```\nHighlightLogLevels highlights INFO, WARN, ERROR in log messages\n\n```go\nfunc MapCapabilityStatus(status string) string\n```\nMapCapabilityStatus maps capability status to display format\n\n```go\nfunc New(runtimeContext *runtime.Context) *cobra.Command\n```\n\n```go\nfunc NewFakeActionCapabilities(ctx context.Context, lggr logger.Logger, registry *capreg.Registry, secretsPath string, limits *SimulationLimits) ([]services.Service, error)\n```\nNewFakeActionCapabilities builds faked capabilities, then registers them with the capability registry.\n\n```go\nfunc ReplaceSecretNamesWithEnvVars(secrets []byte) ([]byte, error)\n```\nReplaceSecretNamesWithEnvVars resolves env var references in the secrets YAML, returning a new YAML with the env var names replaced by their actual values. It rebuilds the YAML from the parsed structure to avoid substring corruption.\n\n## Types\n\n```go\ntype Capabilities struct {\n\tClock *SkipClock\n\t// Services are what the capabilities started, for the caller to close, even when Add fails.\n\tServices []services.Service\n\t// contains filtered or unexported fields\n}\n```\nCapabilities builds the simulator's capabilities from the capabilities repo, all from one injector. What the simulator injects lets it trigger them early: skipping Clock fires their timers now.\n\n```go\nfunc (c *Capabilities) Add[T capability.Capability](ctx context.Context, registry *capreg.Registry, ctor func(do.Injector) (T, error)) error\n```\nAdd builds and starts the capability ctor builds, then registers it.\n\n```go\nfunc (c *Capabilities) Select(triggerID string)\n```\nSelect makes triggerID the only trigger registration passed on to the capabilities. Call it before the engine registers its triggers.\n\n```go\nfunc (c *Capabilities) WaitForTrigger(ctx context.Context) error\n```\nWaitForTrigger waits for the selected trigger to send an event.\n\n```go\ntype DataPoint struct {\n\tAttributes []MetricAttribute `json:\"Attributes\"`\n\tStartTime  string            `json:\"StartTime\"`\n\tTime       string            `json:\"Time\"`\n\tValue      interface{}       `json:\"Value\"`\n}\n```\n\n```go\ntype Inputs struct {\n\tWasmPath     string `validate:\"omitempty,file,ascii,max=97\" cli:\"--wasm\"`\n\tWorkflowPath string `validate:\"required,workflow_path_read\"`\n\tConfigPath   string `validate:\"omitempty,file,ascii,max=97\"`\n\tSecretsPath  string `validate:\"omitempty,file,ascii,max=97\"`\n\tEngineLogs   bool   `validate:\"omitempty\" cli:\"--engine-logs\"`\n\tBroadcast    bool   `validate:\"-\"`\n\tWorkflowName string `validate:\"required,workflow_name\"`\n\t// Chain-type-specific fields\n\tChainTypeClients map[string]map[uint64]chain.ChainClient `validate:\"omitempty\"`\n\tChainTypeKeys    map[string]interface{}                  `validate:\"-\"`\n\t// ChainTypeResolved holds the full ResolveClients bundle per chain type\n\t// (clients, forwarders, experimental-selector flags) so later steps\n\t// (health check, capability registration) have a single source of truth.\n\tChainTypeResolved map[string]chain.ResolvedChains `validate:\"-\"`\n\t// Non-interactive mode options\n\tNonInteractive  bool `validate:\"-\"`\n\tHasTriggerIndex bool\n\tTriggerIndex    int               `validate:\"-\"`\n\tHTTPPayload     string            `validate:\"-\"` // JSON string or /path/to/file.json\n\tHTTPTriggerPort int               `validate:\"min=1,max=65535\"`\n\tChainTypeInputs map[string]string `validate:\"-\"` // CLI-supplied chain-type-specific trigger inputs\n\t// Listen keeps the HTTP trigger server running after each execution so it can\n\t// process additional requests until the user interrupts (ctrl-C).\n\tListen bool `validate:\"-\"`\n\t// Limits enforcement\n\tLimitsPath string `validate:\"-\"` // \"default\" or path to custom limits JSON\n\t// SkipTypeChecks passes --skip-type-checks to cre-compile for TypeScript workflows.\n\tSkipTypeChecks bool `validate:\"-\"`\n\t// InvocationDir is the working directory at the time the CLI was invoked, before\n\t// SetExecutionContext changes it to the workflow directory. Used to resolve file\n\t// paths entered interactively or via flags relative to where the user ran the command.\n\tInvocationDir string `validate:\"-\"`\n\t// WorkflowFolderName is the name of the workflow's directory (i.e. the argument\n\t// the user passes to `cre workflow simulate`). Unlike WorkflowName (the Workflow\n\t// Registry name from workflow.yaml, which can differ), this is what should be\n\t// used to render restart-command hints so they match what the user actually typed.\n\tWorkflowFolderName string `validate:\"-\"`\n}\n```\n\n```go\ntype LimitExceededError struct {\n\tKind LimitKind\n\tMsg  string\n}\n```\nLimitExceededError is a typed error for simulation limit violations. Callers can use errors.As to retrieve the Kind and distinguish limit failures from other errors without string matching.\n\n```go\nfunc (e *LimitExceededError) Error() string\n```\n\n```go\ntype LimitKind string\n```\nLimitKind identifies a specific simulation limit type, allowing callers to distinguish limit-exceeded failures from other errors via errors.As.\n\n```go\nconst (\n\tLimitWASMBinary           LimitKind = \"wasm_binary_size\"\n\tLimitWASMCompressedBinary LimitKind = \"wasm_compressed_binary_size\"\n\tLimitHTTPRequest          LimitKind = \"http_request_size\"\n\tLimitHTTPResponse         LimitKind = \"http_response_size\"\n\tLimitConfHTTPRequest      LimitKind = \"confidential_http_request_size\"\n\tLimitConfHTTPResponse     LimitKind = \"confidential_http_response_size\"\n\tLimitConsensusObservation LimitKind = \"consensus_observation_size\"\n\tLimitChainWriteReport     LimitKind = \"chain_write_report_size\"\n\tLimitEVMGas               LimitKind = \"evm_gas\"\n)\n```\n\n```go\ntype LimitedConfidentialHTTPAction struct {\n\t// contains filtered or unexported fields\n}\n```\nLimitedConfidentialHTTPAction wraps a confhttpserver.ClientCapability and enforces request/response size limits and connection timeout from SimulationLimits. It also warns when a request would be rejected by the production TEE enclave's HTTP policy.\n\n```go\nfunc NewLimitedConfidentialHTTPAction(inner confhttpserver.ClientCapability, limits *SimulationLimits, lggr logger.Logger) *LimitedConfidentialHTTPAction\n```\n\n```go\nfunc (l *LimitedConfidentialHTTPAction) Close() error\n```\n\n```go\nfunc (l *LimitedConfidentialHTTPAction) Description() string\n```\n\n```go\nfunc (l *LimitedConfidentialHTTPAction) HealthReport() map[string]error\n```\n\n```go\nfunc (l *LimitedConfidentialHTTPAction) Initialise(ctx context.Context, deps core.StandardCapabilitiesDependencies) error\n```\n\n```go\nfunc (l *LimitedConfidentialHTTPAction) Name() string\n```\n\n```go\nfunc (l *LimitedConfidentialHTTPAction) Ready() error\n```\n\n```go\nfunc (l *LimitedConfidentialHTTPAction) SendRequest(ctx context.Context, metadata commonCap.RequestMetadata, input *confidentialhttp.ConfidentialHTTPRequest) (*commonCap.ResponseAndMetadata[*confidentialhttp.HTTPResponse], caperrors.Error)\n```\n\n```go\nfunc (l *LimitedConfidentialHTTPAction) Start(ctx context.Context) error\n```\n\n```go\ntype LimitedConsensusNoDAG struct {\n\t// contains filtered or unexported fields\n}\n```\nLimitedConsensusNoDAG wraps a consensusserver.ConsensusCapability and enforces observation size limits from SimulationLimits.\n\n```go\nfunc NewLimitedConsensusNoDAG(inner consensusserver.ConsensusCapability, limits *SimulationLimits) *LimitedConsensusNoDAG\n```\n\n```go\nfunc (l *LimitedConsensusNoDAG) Close() error\n```\n\n```go\nfunc (l *LimitedConsensusNoDAG) Description() string\n```\n\n```go\nfunc (l *LimitedConsensusNoDAG) HealthReport() map[string]error\n```\n\n```go\nfunc (l *LimitedConsensusNoDAG) Initialise(ctx context.Context, deps core.StandardCapabilitiesDependencies) error\n```\n\n```go\nfunc (l *LimitedConsensusNoDAG) Name() string\n```\n\n```go\nfunc (l *LimitedConsensusNoDAG) Ready() error\n```\n\n```go\nfunc (l *LimitedConsensusNoDAG) Report(ctx context.Context, metadata commonCap.RequestMetadata, input *sdkpb.ReportRequest) (*commonCap.ResponseAndMetadata[*sdkpb.ReportResponse], caperrors.Error)\n```\n\n```go\nfunc (l *LimitedConsensusNoDAG) Simple(ctx context.Context, metadata commonCap.RequestMetadata, input *sdkpb.SimpleConsensusInputs) (*commonCap.ResponseAndMetadata[*valuespb.Value], caperrors.Error)\n```\n\n```go\nfunc (l *LimitedConsensusNoDAG) Start(ctx context.Context) error\n```\n\n```go\ntype LimitedHTTPAction struct {\n\t// contains filtered or unexported fields\n}\n```\nLimitedHTTPAction wraps an httpserver.ClientCapability and enforces request/response size limits and connection timeout from SimulationLimits.\n\n```go\nfunc NewLimitedHTTPAction(inner httpserver.ClientCapability, limits *SimulationLimits) *LimitedHTTPAction\n```\n\n```go\nfunc (l *LimitedHTTPAction) Close() error\n```\n\n```go\nfunc (l *LimitedHTTPAction) Description() string\n```\n\n```go\nfunc (l *LimitedHTTPAction) HealthReport() map[string]error\n```\n\n```go\nfunc (l *LimitedHTTPAction) Initialise(ctx context.Context, deps core.StandardCapabilitiesDependencies) error\n```\n\n```go\nfunc (l *LimitedHTTPAction) Name() string\n```\n\n```go\nfunc (l *LimitedHTTPAction) Ready() error\n```\n\n```go\nfunc (l *LimitedHTTPAction) SendRequest(ctx context.Context, metadata commonCap.RequestMetadata, input *customhttp.Request) (*commonCap.ResponseAndMetadata[*customhttp.Response], caperrors.Error)\n```\n\n```go\nfunc (l *LimitedHTTPAction) Start(ctx context.Context) error\n```\n\n```go\ntype LogLevel string\n```\nLogLevel represents the level of a simulation log\n\n```go\nconst (\n\tLogLevelDebug   LogLevel = \"DEBUG\"\n\tLogLevelInfo    LogLevel = \"INFO\"\n\tLogLevelWarning LogLevel = \"WARNING\"\n\tLogLevelError   LogLevel = \"ERROR\"\n)\n```\n\n```go\ntype ManualHTTPTriggerService struct {\n\tcapabilities.CapabilityInfo\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc NewManualHTTPTriggerService(parentLggr logger.Logger, port int, rateLimit *config.Rate) *ManualHTTPTriggerService\n```\n\n```go\nfunc (f *ManualHTTPTriggerService) AckEvent(ctx context.Context, triggerID string, eventID string, method string) caperrors.Error\n```\n\n```go\nfunc (f *ManualHTTPTriggerService) Close() error\n```\n\n```go\nfunc (f *ManualHTTPTriggerService) Description() string\n```\n\n```go\nfunc (f *ManualHTTPTriggerService) HealthReport() map[string]error\n```\n\n```go\nfunc (f *ManualHTTPTriggerService) Initialise(ctx context.Context, dependencies core.StandardCapabilitiesDependencies) error\n```\n\n```go\nfunc (f *ManualHTTPTriggerService) ManualTrigger(ctx context.Context, triggerID string, payload *httptypedapi.Payload) error\n```\n\n```go\nfunc (f *ManualHTTPTriggerService) Name() string\n```\n\n```go\nfunc (f *ManualHTTPTriggerService) Ready() error\n```\n\n```go\nfunc (f *ManualHTTPTriggerService) RegisterTrigger(ctx context.Context, triggerID string, metadata capabilities.RequestMetadata, input *httptypedapi.Config) (\u003c-chan capabilities.TriggerAndId[*httptypedapi.Payload], caperrors.Error)\n```\n\n```go\nfunc (f *ManualHTTPTriggerService) Start(ctx context.Context) error\n```\n\n```go\nfunc (f *ManualHTTPTriggerService) UnregisterTrigger(ctx context.Context, triggerID string, metadata capabilities.RequestMetadata, input *httptypedapi.Config) caperrors.Error\n```\n\n```go\ntype ManualTriggers struct {\n\t// Capabilities are the capabilities from the capabilities repo.\n\tCapabilities      *Capabilities\n\tManualHTTPTrigger *ManualHTTPTriggerService\n}\n```\nManualTriggers holds chain-agnostic trigger services used in simulation.\n\n```go\nfunc NewManualTriggerCapabilities(ctx context.Context, lggr logger.Logger, registry *capreg.Registry, caps *Capabilities, httpTriggerPort int, limits *SimulationLimits) (*ManualTriggers, error)\n```\nNewManualTriggerCapabilities creates and registers cron and HTTP trigger capabilities. These are chain-agnostic and shared across all chain types.\n\n```go\nfunc (m *ManualTriggers) Close() error\n```\nClose closes the HTTP trigger service. Capabilities from the capabilities repo are closed with their services.\n\n```go\nfunc (m *ManualTriggers) Start(ctx context.Context) error\n```\nStart starts the HTTP trigger service. Capabilities from the capabilities repo are started when they are built.\n\n```go\ntype Metric struct {\n\tName        string     `json:\"Name\"`\n\tDescription string     `json:\"Description\"`\n\tUnit        string     `json:\"Unit\"`\n\tData        MetricData `json:\"Data\"`\n}\n```\n\n```go\ntype MetricAttribute struct {\n\tKey   string `json:\"Key\"`\n\tValue struct {\n\t\tType  string `json:\"Type\"`\n\t\tValue string `json:\"Value\"`\n\t} `json:\"Value\"`\n}\n```\n\n```go\ntype MetricData struct {\n\tDataPoints []DataPoint `json:\"DataPoints\"`\n}\n```\n\n```go\ntype MetricsLog struct {\n\tResource     []ResourceAttribute `json:\"Resource\"`\n\tScopeMetrics []ScopeMetrics      `json:\"ScopeMetrics\"`\n}\n```\nMetricsLog represents OpenTelemetry metrics logs\n\n```go\ntype MetricsScope struct {\n\tName    string `json:\"Name\"`\n\tVersion string `json:\"Version\"`\n}\n```\n\n```go\ntype ResourceAttribute struct {\n\tKey   string `json:\"Key\"`\n\tValue struct {\n\t\tType  string `json:\"Type\"`\n\t\tValue string `json:\"Value\"`\n\t} `json:\"Value\"`\n}\n```\n\n```go\ntype ScopeMetrics struct {\n\tScope   MetricsScope `json:\"Scope\"`\n\tMetrics []Metric     `json:\"Metrics\"`\n}\n```\n\n```go\ntype SimulationLimits struct {\n\tWorkflows cresettings.Workflows\n}\n```\nSimulationLimits holds the workflow-level limits applied during simulation.\n\n```go\nfunc DefaultLimits() (*SimulationLimits, error)\n```\nDefaultLimits returns simulation limits populated from the embedded defaults.\n\n```go\nfunc LoadLimits(path string) (*SimulationLimits, error)\n```\nLoadLimits reads a limits JSON file from disk and returns parsed SimulationLimits.\n\n```go\nfunc ResolveLimits(limitsFlag string) (*SimulationLimits, error)\n```\nResolveLimits resolves a --limits flag value to SimulationLimits. Returns nil if limitsFlag is \"none\" (no limits enforcement).\n\n```go\nfunc (l *SimulationLimits) ConfHTTPRequestSizeLimit() int\n```\nConfHTTPRequestSizeLimit returns the confidential HTTP request size limit in bytes.\n\n```go\nfunc (l *SimulationLimits) ConfHTTPResponseSizeLimit() int\n```\nConfHTTPResponseSizeLimit returns the confidential HTTP response size limit in bytes.\n\n```go\nfunc (l *SimulationLimits) ConsensusObservationSizeLimit() int\n```\nConsensusObservationSizeLimit returns the consensus observation size limit in bytes.\n\n```go\nfunc (l *SimulationLimits) EVMChainWriteGasLimit() uint64\n```\nEVMChainWriteGasLimit returns the default EVM gas limit.\n\n```go\nfunc (l *SimulationLimits) EVMChainWriteReportSizeLimit() int\n```\nEVMChainWriteReportSizeLimit returns the EVM chain write report size limit in bytes.\n\n```go\nfunc (l *SimulationLimits) HTTPRequestSizeLimit() int\n```\nHTTPRequestSizeLimit returns the HTTP action request size limit in bytes.\n\n```go\nfunc (l *SimulationLimits) HTTPResponseSizeLimit() int\n```\nHTTPResponseSizeLimit returns the HTTP action response size limit in bytes.\n\n```go\nfunc (l *SimulationLimits) HTTPTriggerRateLimit() config.Rate\n```\nHTTPTriggerRateLimit returns the HTTP trigger event rate limit.\n\n```go\nfunc (l *SimulationLimits) LimitsSummary() string\n```\nLimitsSummary returns a human-readable summary of key limits.\n\n```go\nfunc (l *SimulationLimits) LogTriggerEventRateLimit() config.Rate\n```\nLogTriggerEventRateLimit returns the log trigger event rate limit.\n\n```go\nfunc (l *SimulationLimits) SolanaChainWriteComputeLimit() uint32\n```\nSolanaChainWriteComputeLimit returns the default Solana chain write compute unit limit.\n\n```go\nfunc (l *SimulationLimits) SolanaChainWriteReportSizeLimit() int\n```\nSolanaChainWriteReportSizeLimit returns the Solana chain write report size limit in bytes.\n\n```go\nfunc (l *SimulationLimits) WASMBinarySize() int\n```\nWASMBinarySize returns the WASM binary size limit in bytes.\n\n```go\nfunc (l *SimulationLimits) WASMCompressedBinarySize() int\n```\nWASMCompressedBinarySize returns the WASM compressed binary size limit in bytes.\n\n```go\ntype SimulationLogger struct {\n\t// contains filtered or unexported fields\n}\n```\nSimulationLogger provides an easy interface for formatted simulation logs\n\n```go\nfunc NewSimulationLogger(verbosity bool) *SimulationLogger\n```\nNewSimulationLogger creates a new simulation logger with verbosity control\n\n```go\nfunc (s *SimulationLogger) Debug(message string, fields ...interface{})\n```\nDebug logs a debug level message with colored formatting (only if verbosity is enabled)\n\n```go\nfunc (s *SimulationLogger) Error(message string, fields ...interface{})\n```\nError logs an error level message with colored formatting\n\n```go\nfunc (s *SimulationLogger) Info(message string, fields ...interface{})\n```\nInfo logs an info level message with colored formatting\n\n```go\nfunc (s *SimulationLogger) PrintStepLog(timestamp, component, stepRef, capability, status string)\n```\nPrintStepLog prints a capability step log with timestamp and styled status\n\n```go\nfunc (s *SimulationLogger) PrintTimestampedLog(timestamp, prefix, message string, prefixStyle lipgloss.Style)\n```\nPrintTimestampedLog prints a log with timestamp and styled prefix\n\n```go\nfunc (s *SimulationLogger) PrintTimestampedLogWithStatus(timestamp, prefix, message, status string)\n```\nPrintTimestampedLogWithStatus prints a log with timestamp, prefix, and styled status\n\n```go\nfunc (s *SimulationLogger) PrintWorkflowMetadata(metadata interface{})\n```\nPrintWorkflowMetadata prints workflow metadata with proper indentation\n\n```go\nfunc (s *SimulationLogger) Warn(message string, fields ...interface{})\n```\nWarn logs a warning level message with colored formatting\n\n```go\ntype SkipClock struct {\n\tclockwork.Clock\n\t// contains filtered or unexported fields\n}\n```\nSkipClock is the real clock, except that Skip fires the functions waiting on its AfterFunc timers now.\n\n```go\nfunc NewSkipClock() *SkipClock\n```\n\n```go\nfunc (c *SkipClock) AfterFunc(d time.Duration, f func()) clockwork.Timer\n```\n\n```go\nfunc (c *SkipClock) Skip()\n```\nSkip fires every pending AfterFunc timer now, instead of when it is due.\n\n```go\ntype TelemetryLog struct {\n\tSeverity int `json:\"Severity\"`\n\tBody     struct {\n\t\tType  string `json:\"Type\"`\n\t\tValue string `json:\"Value\"` // Base64 encoded protobuf\n\t} `json:\"Body\"`\n\tAttributes []struct {\n\t\tKey   string `json:\"Key\"`\n\t\tValue struct {\n\t\t\tType  string `json:\"Type\"`\n\t\t\tValue string `json:\"Value\"`\n\t\t} `json:\"Value\"`\n\t} `json:\"Attributes\"`\n}\n```\nTelemetryLog represents the JSON structure of telemetry logs from beholder\n\n```go\ntype TriggerInfoAndBeforeStart struct {\n\tTriggerFunc        func() error\n\tTriggerWithPayload func(*httptypedapi.Payload) error\n\tListenSupported    bool\n\tTriggerToRun       *pb.TriggerSubscription\n\tBeforeStart        func(ctx context.Context, cfg simulator.RunnerConfig, registry *capreg.Registry, services []services.Service, triggerSub []*pb.TriggerSubscription)\n}\n```\n\n","path":"github.com/smartcontractkit/cre-cli/cmd/workflow/simulate","name":"simulate","synopsis":"","isRedistributable":true}
