contextual

package
v0.0.41 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const ArtifactInboxSentinel = "__C2_SENTINEL_ARTIFACT_INBOX__"
View Source
const ArtifactOutboxSentinel = "__C2_SENTINEL_ARTIFACT_OUTBOX__"
View Source
const JobIdSentinel = "__C2_SENTINEL_JOB_ID__"
View Source
const OpArtifactInboxSentinel = "__C2_SENTINEL_OP_ARTIFACT_INBOX__"
View Source
const OpArtifactOutboxSentinel = "__C2_SENTINEL_OP_ARTIFACT_OUTBOX__"
View Source
const OpWorkdirPathSentinel = "__C2_SENTINEL_OP_WORKDIR__"
View Source
const OpWorktreePathSentinel = "__C2_SENTINEL_OP_WORKTREE__"
View Source
const WorkdirPathSentinel = "__C2_SENTINEL_WORKDIR__"
View Source
const WorktreePathSentinel = "__C2_SENTINEL_WORKTREE__"

WorktreePathSentinel is a placeholder value used during template resolution Templates that reference {{ environment.worktree_path }} will resolve to this sentinel The actual worktree path is determined at execution time on the target machine

Variables

This section is empty.

Functions

func GetInvocationHash

func GetInvocationHash(inv Invocation) string

Hash returns a truncated hex-encoded SHA-256 hash over deterministic invocation fields.

Types

type EnvironmentContext

type EnvironmentContext struct {
	WorktreePath   string                 `json:"worktree_path,omitempty"`
	WorkdirPath    string                 `json:"workdir,omitempty"`
	ArtifactInbox  string                 `json:"inbox,omitempty"`
	ArtifactOutbox string                 `json:"outbox,omitempty"`
	Host           EnvironmentPathContext `json:"host,omitempty"`
	Op             EnvironmentPathContext `json:"op,omitempty"`
}

EnvironmentContext captures filesystem and storage locations relevant to execution.

type EnvironmentPathContext added in v0.0.8

type EnvironmentPathContext struct {
	Workdir      string `json:"workdir,omitempty"`
	WorktreePath string `json:"worktree_path,omitempty"`
	Inbox        string `json:"inbox,omitempty"`
	Outbox       string `json:"outbox,omitempty"`
}

type GitBaseContext

type GitBaseContext struct {
	BaseRepo         string `json:"repo,omitempty"`
	BaseRef          string `json:"ref,omitempty"`
	ResolvedBaseHash string `json:"resolved_hash,omitempty"`
	GitAuthor        string `json:"author,omitempty"`
}

GitBaseContext captures immutable git state information at a point in time.

type GitCommitContext

type GitCommitContext struct {
	ParentRef   string `json:"parent_ref,omitempty"`  // ref carrying workspace state until a hash exists
	PersistHash string `json:"hash,omitempty"`        // materialized SHA after a commit is created
	ParentHash  string `json:"parent_hash,omitempty"` // resolved job parent/root SHA once materialized
}

WorkspaceResult captures the output of inline/detached workspace executions.

type GitTask

type GitTask struct {
	BaseRepo         string `json:"repo,omitempty"`
	BaseRef          string `json:"ref,omitempty"`
	ResolvedBaseHash string `json:"resolved_hash,omitempty"`
	GitAuthor        string `json:"author,omitempty"`
	ParentRef        string `json:"parent_ref,omitempty"`  // ref carrying workspace state until a hash exists
	PersistHash      string `json:"hash,omitempty"`        // materialized SHA after a commit is created
	ParentHash       string `json:"parent_hash,omitempty"` // resolved job parent/root SHA once materialized
}

type InlineBoundaryFrame added in v0.0.29

type InlineBoundaryFrame struct {
	CallsitePath      string `json:"callsite_path,omitempty"`
	BoundaryNodePath  string `json:"boundary_node_path,omitempty"`
	RecipeID          string `json:"recipe_id,omitempty"`
	RecipeVersion     string `json:"recipe_version,omitempty"`
	SourceKind        string `json:"source_kind,omitempty"`
	SubmittedSelector string `json:"submitted_selector,omitempty"`
	ResolvedSelector  string `json:"resolved_selector,omitempty"`
	ResolvedCommit    string `json:"resolved_commit,omitempty"`
	ContentSHA256     string `json:"content_sha256,omitempty"`
}

type Invocation

type Invocation struct {
	NodePath  string `json:"path"`
	InvokeSeq int64  `json:"sequence"`
}

Invocation captures deterministic identifiers for an op execution.

type InvocationCtx

type InvocationCtx struct {
	Hash      string `json:"hash"`
	NodePath  string `json:"path"`
	InvokeSeq int64  `json:"sequence"`
}

type JobContext

type JobContext struct {
	Environment  EnvironmentContext       `json:"environment,omitempty"`
	Artifacts    map[string]artifacts.Ref `json:"artifacts,omitempty"`
	Workflow     WorkflowContext          `json:"workflow,omitempty"`
	GitBase      GitBaseContext           `json:"git,omitempty"`
	RecipeSource RecipeSourceContext      `json:"recipe_source,omitempty"`
}

ExecutionContext holds typed workflow context available to templates. It is created per task.

type RecipeSourceContext

type RecipeSourceContext struct {
	Repo     string `json:"repo,omitempty"`
	Ref      string `json:"ref,omitempty"`
	Path     string `json:"path,omitempty"`
	Selector string `json:"selector,omitempty"`
}

type RunOutput

type RunOutput struct {
	Outputs   map[string]interface{}   `json:"outputs"`
	Artifacts map[string]artifacts.Ref `json:"artifacts"`
	RunID     string                   `json:"run_id"`
	Timestamp time.Time                `json:"timestamp"`
}

RunOutput represents a single execution run

type StepOutput

type StepOutput struct {
	Outputs   map[string]interface{}   `json:"outputs"`
	Artifacts map[string]artifacts.Ref `json:"artifacts"`
	Runs      []RunOutput              `json:"runs"` // Previous runs (state loops)
}

type TaskContext

type TaskContext struct {
	// GitCommit is shared across entire ResolutionContext and often updated. Thus must be a pointer.
	GitCommit  *GitCommitContext
	Invocation Invocation
}

type TaskExecutionContext

type TaskExecutionContext struct {
	// embed these directly from task and job contexts for easier resolution.
	Environment  EnvironmentContext       `json:"environment,omitempty"`
	Artifacts    map[string]artifacts.Ref `json:"artifacts,omitempty"`
	Workflow     WorkflowContext          `json:"workflow,omitempty"`
	RecipeSource RecipeSourceContext      `json:"recipe_source,omitempty"`
	GitTask      GitTask                  `json:"git,omitempty"`
	Invocation   InvocationCtx            `json:"invocation,omitempty"`
	InlineStack  []InlineBoundaryFrame    `json:"inline_stack,omitempty"`
}

func NewTaskExecutionContext

func NewTaskExecutionContext(ctx JobContext, ctx2 TaskContext) TaskExecutionContext

func (TaskExecutionContext) JobContext

func (t TaskExecutionContext) JobContext() JobContext

type WorkflowContext

type WorkflowContext struct {
	CellID    string `json:"cell_id,omitempty"`
	CellName  string `json:"cell,omitempty"`
	JobID     string `json:"job_id,omitempty"`
	ProjectId string `json:"project_id,omitempty"`
}

WorkflowContext provides high-level workflow/session identifiers.

Jump to

Keyboard shortcuts

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