contextual

package
v0.0.79 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 8 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 GitExecutionBaseSentinel = "__C2_SENTINEL_GIT_EXECUTION_BASE__"

Git execution references stay unresolved until the task restores its workspace.

View Source
const GitExecutionHeadSentinel = "__C2_SENTINEL_GIT_EXECUTION_HEAD__"
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 replaced with the task-local worktree path.

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 GitExecutionReferences added in v0.0.78

type GitExecutionReferences struct {
	BaseHash string `json:"base_hash"`
	HeadHash string `json:"head_hash"`
}

GitExecutionReferences are hydrated only after the task workspace is restored.

type GitTask

type GitTask struct {
	Execution        GitExecutionReferences `json:"execution"`
	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 {
	InitialCommit   *GitCommitContext        `json:"initial_commit,omitempty"`
	RestoreArtifact *jobdb.ArtifactKey       `json:"restore_artifact,omitempty"`
	Workspace       *WorkspaceContext        `json:"workspace,omitempty"`
	CellResolution  *cellref.Context         `json:"cell_resolution,omitempty"`
	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"`
	Jobs      jobcontext.StartedJobsContext `json:"jobs,omitempty"`
	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"`
	Jobs      jobcontext.StartedJobsContext `json:"jobs,omitempty"`
	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 {
	Workspace      *WorkspaceContext `json:"workspace,omitempty"`
	CellResolution *cellref.Context  `json:"cell_resolution,omitempty"`
	// 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.

type WorkspaceContext added in v0.0.54

type WorkspaceContext struct {
	Cell          string `json:"cell,omitempty"`
	ScopeID       string `json:"scope_id,omitempty"`
	ParentScopeID string `json:"parent_scope_id,omitempty"`
	InitialHash   string `json:"initial_hash,omitempty"`
}

WorkspaceContext identifies a logical workspace; paths remain task-local.

Jump to

Keyboard shortcuts

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