Documentation
¶
Index ¶
- Constants
- func CreatedByIDFromContext(ctx context.Context) string
- func FlowInstallIDFromContext(ctx context.Context) string
- func FlowWorkflowIDFromContext(ctx context.Context) string
- func OrgIDFromContext(ctx context.Context) string
- func TokenRoleFromContext(ctx context.Context) string
- func WithOrgSelector(ctx context.Context, fn OrgSelectFunc) context.Context
- func WithTokenRole(ctx context.Context, role string) context.Context
- type OrgSelectFunc
- type WorkflowTelemetry
Constants ¶
const ( AccountCtxKey string = "account" AccountIDCtxKey string = "account_id" BlobServiceCtxKey string = "blob_service" CfgCtxKey string = "config" IsGlobalKey string = "is_global" InstallWorkflowCtxKey string = "workflow" FlowCtxKey string = "flow" IsEmployeeCtxKey string = "is_employee" LoggerFieldsCtxKey string = "logger_fields" LogStreamCtxKey string = "log_stream" MetricsKey string = "metrics" OrgCtxKey string = "org" OrgIDCtxKey string = "org_id" OffPaginationCtxKey string = "offset_pagination" IsPublicKey string = "is_public" RunnerCtxKey string = "runner" RunnerIDCtxKey string = "runner_id" DisableViewCtxKey string = "disable_view" PatcherCtxKey string = "patcher" TraceIDCtxKey string = "trace_id" FlowWorkflowIDCtxKey string = "flow_workflow_id" FlowInstallIDCtxKey string = "flow_install_id" WorkflowTelemetryCtxKey string = "workflow_telemetry" QueueIDCtxKey string = "queue_id" OrgSelectorCtxKey string = "mcp_org_selector" TokenRoleCtxKey string = "token_role" )
All of the context keys are defined here so we can use them in different contexts.
While most every package can use the cctx helpers directly, since they do leverage models, anything in the models that needs information from the context can not rely on that package directly, otherwise a circular dependency will be created.
Variables ¶
This section is empty.
Functions ¶
func CreatedByIDFromContext ¶ added in v0.19.850
CreatedByIDFromContext returns the account ID from context. Returns empty string if not set. This is safe to call from leaf packages that cannot import the full cctx package due to circular dependencies.
func FlowInstallIDFromContext ¶ added in v0.19.1075
func FlowWorkflowIDFromContext ¶ added in v0.19.1075
func OrgIDFromContext ¶ added in v0.19.850
OrgIDFromContext returns the org ID from context. Returns empty string if not set. This is safe to call from leaf packages that cannot import the full cctx package due to circular dependencies.
func TokenRoleFromContext ¶ added in v0.19.1150
TokenRoleFromContext returns the authenticating token's role, or "" if unset.
func WithOrgSelector ¶ added in v0.19.1150
func WithOrgSelector(ctx context.Context, fn OrgSelectFunc) context.Context
WithOrgSelector attaches an org-selector to the context.
Types ¶
type OrgSelectFunc ¶ added in v0.19.1150
type OrgSelectFunc func(orgID string)
OrgSelectFunc persists the selected org for the authenticated MCP token. It is injected by the MCP server so leaf tool handlers (in other packages) can change the active org without importing the server package.
func OrgSelectorFromContext ¶ added in v0.19.1150
func OrgSelectorFromContext(ctx context.Context) OrgSelectFunc
OrgSelectorFromContext returns the org-selector, or nil if none is set (e.g. outside the MCP server).
type WorkflowTelemetry ¶ added in v0.19.1197
type WorkflowTelemetry struct {
OrgID string `json:"org_id,omitempty"`
OrgName string `json:"org_name,omitempty"`
WorkflowID string `json:"workflow_id,omitempty"`
WorkflowType string `json:"workflow_type,omitempty"`
OwnerID string `json:"owner_id,omitempty"`
OwnerType string `json:"owner_type,omitempty"`
OwnerName string `json:"owner_name,omitempty"`
InstallID string `json:"install_id,omitempty"`
InstallName string `json:"install_name,omitempty"`
}
func (WorkflowTelemetry) Merge ¶ added in v0.19.1197
func (t WorkflowTelemetry) Merge(overlay WorkflowTelemetry) WorkflowTelemetry
Merge returns t with every non-empty field of overlay applied, so a caller holding partial identity never erases fields resolved further upstream.