js

package
v1.8.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandString

func ExpandString(_ context.Context, str string, values map[string]string) (string, error)

ExpandString expands JavaScript template literals using the provided values map.

Types

type Evaluator

type Evaluator struct {
	// contains filtered or unexported fields
}

Evaluator handles JavaScript expression evaluation in strings.

func NewEvaluator

func NewEvaluator(agentTools []tools.Tool) *Evaluator

NewEvaluator creates a new Evaluator with the given tools.

func (*Evaluator) Evaluate

func (e *Evaluator) Evaluate(ctx context.Context, input string, args []string) string

Evaluate finds and evaluates ${...} JavaScript expressions in the input string. args are available as the 'args' array in JavaScript.

type Expander

type Expander struct {
	// contains filtered or unexported fields
}

Expander expands JavaScript template literals in strings using environment variables.

func NewJsExpander

func NewJsExpander(env environment.Provider) *Expander

NewJsExpander creates a new Expander with the given environment provider.

func (*Expander) Expand

func (exp *Expander) Expand(ctx context.Context, text string) string

Expand expands JavaScript template literals in the given text.

func (*Expander) ExpandCommands

func (exp *Expander) ExpandCommands(ctx context.Context, cmds types.Commands) types.Commands

ExpandCommands expands JavaScript template literals in all command fields.

func (*Expander) ExpandMap

func (exp *Expander) ExpandMap(ctx context.Context, kv map[string]string) map[string]string

ExpandMap expands JavaScript template literals in all values of the given map.

Jump to

Keyboard shortcuts

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