entrypoint

package
v1.0.0-beta.14 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package entrypoint holds the parts of module entrypoint loading that every entrypoint driver shares: resolving entrypoint.source to a module source, encoding the arguments of the ModuleEntrypoint interface, and turning the type definitions an entrypoint returns into a module.

The one driver lives next to it: dang evaluates the entrypoint source as a Dang program.

Index

Constants

View Source
const TypeName = "ModuleEntrypoint"

TypeName is the interface an entrypoint must implement.

Variables

This section is empty.

Functions

func FunctionArgsJSON

func FunctionArgsJSON(args []*core.FunctionCallArgValue) (core.JSON, error)

FunctionArgsJSON encodes call arguments as one JSON object, keyed by the original argument names.

func JSONCallArg

func JSONCallArg(name string, value core.JSON) *core.FunctionCallArgValue

JSONCallArg builds an argument from an already encoded JSON value.

func JSONScalarCallArg

func JSONScalarCallArg(name string, value core.JSON) *core.FunctionCallArgValue

JSONScalarCallArg builds a JSON scalar argument, which the call codec passes as a JSON-encoded string.

func ModuleFromTypeDefs

func ModuleFromTypeDefs(
	ctx context.Context,
	dag *dagql.Server,
	typeDefs dagql.ObjectResultArray[*core.TypeDef],
) (dagql.ObjectResult[*core.Module], error)

ModuleFromTypeDefs builds a module from the types an entrypoint returned.

func ResolveSource

ResolveSource resolves entrypoint.source to a module source for the entrypoint itself, and returns the workspace to pass to the entrypoint.

func StringCallArg

func StringCallArg(name, value string) *core.FunctionCallArgValue

StringCallArg builds a JSON-encoded string argument.

func ValidateConstructors

func ValidateConstructors(typeDefs dagql.ObjectResultArray[*core.TypeDef]) error

ValidateConstructors applies the engine's current limit of at most one object constructor per module.

func Workspace

Workspace returns the workspace to pass to a module entrypoint, with its working directory at the module's directory.

The engine already treats the workspace cwd as the module's scope when it hands a workspace to an SDK, so an entrypoint can find the module it serves through relative workspace paths, without a path generated into it. The root is unchanged: an entrypoint can still read above the module with an absolute workspace path.

A git or directory source keeps the caller's cwd, because its files are not in the workspace at all; they are in its context directory.

func WorkspaceCallArg

func WorkspaceCallArg(workspace dagql.ObjectResult[*core.Workspace]) (*core.FunctionCallArgValue, error)

WorkspaceCallArg encodes the workspace argument shared by types and call.

Types

This section is empty.

Jump to

Keyboard shortcuts

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