execshared

package
v0.7.72 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package execshared holds behavior shared by the executor implementations (claudeexecutor, googleexecutor, openaiexecutor) so each backend applies identical semantics.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendUserPromptSuffix

func AppendUserPromptSuffix(prompt string, suffix *promptbuilder.Prompt) (string, error)

AppendUserPromptSuffix appends the built suffix to the prompt with a blank-line separator. A nil suffix returns the prompt unchanged. The suffix must be fully bound; a Build failure (for example an unbound placeholder) is returned wrapped.

Example
package main

import (
	"fmt"

	"chainguard.dev/driftlessaf/agents/executor/internal/execshared"
	"chainguard.dev/driftlessaf/agents/promptbuilder"
)

func main() {
	suffix, err := promptbuilder.NewPrompt("Focus on error handling.")
	if err != nil {
		panic(err)
	}
	prompt, err := execshared.AppendUserPromptSuffix("changeset payload", suffix)
	if err != nil {
		panic(err)
	}
	fmt.Println(prompt)
}
Output:
changeset payload

Focus on error handling.

func DefaultResourceLabels

func DefaultResourceLabels(labels map[string]string) map[string]string

DefaultResourceLabels returns the resource labels for billing and observability attribution, starting from defaults derived from environment variables:

  • service_name: from K_SERVICE, falling back to CLOUD_RUN_JOB (defaults to "unknown")
  • product: from CHAINGUARD_PRODUCT (defaults to "unknown")
  • team: from CHAINGUARD_TEAM (defaults to "unknown")

Custom labels override defaults if they use the same keys.

Reading the environment here is deliberate: these labels attribute a deployment, so the defaults come from deployment-level env vars set by the service's infrastructure, mirroring how cloudrun resolves the workload identity. The labels parameter is the explicit configuration path for callers that need to override or extend them.

Example
package main

import (
	"fmt"

	"chainguard.dev/driftlessaf/agents/executor/internal/execshared"
)

func main() {
	// Custom labels override the environment-derived defaults on key match.
	labels := execshared.DefaultResourceLabels(map[string]string{"team": "platform"})
	fmt.Println(labels["team"])
}
Output:
platform

Types

This section is empty.

Jump to

Keyboard shortcuts

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