Skip to content

Load modules through manifest v2 entrypoints - #14038

Merged
eunomie merged 25 commits into
mainfrom
manifest-v2
Sep 17, 2026
Merged

eunomie merged 25 commits into
mainfrom
manifest-v2

Conversation

@shykes

@shykes shykes commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The current module runtime contract returns a Container. The engine then uses an implicit JSON file protocol to discover module types and dispatch function calls.

Solution

Manifest v2 replaces that contract with an explicit module entrypoint that returns type definitions and dispatches calls. SDKs generate the entrypoint, while the engine loads it directly without calling the SDK.

Manifest file

name = "hello"

[entrypoint]
kind = "dang"
source = "./internal/dagger/entrypoint"

The entrypoint source is any address that resolves to a Directory. The initial implementation supports the built-in dang entrypoint kind.

Entrypoint interface

interface ModuleEntrypoint {
  """
  Return a list of types defined by the module.
  """
  types(workspace: Workspace!): [TypeDef!]!

  """
  Dispatch the given function call, and return its result.
  
  The result must be JSON-encoded and match the return type returned in `types()`
  """

  call(
    """
    Workspace inside which to call the function
    """
    workspace: Workspace!

    """
    Name of the receiving object's type. For example: "MyModule"
    """
    receiverType: String!
    
    """
    Value of the receiving object, as a JSON-encoded map.
    Example: `{"debug": true, "superChaosLevel": 42, "apps": ["./foo", "./bar", "./src/baz"]}`
    """
    receiverValue: JSON
    
    """
    Name of the function to call
    Example: "test"
    """
    fnName: String!
    
    """
    Arguments of the function, as a JSON-encoded map.
    The engine will honor the argument types described by `types()`
    Example: `{"failFast": true, "ldflags": ["-v", "-x", "foo=bar"]}`
    """
    fnArgs: JSON!
  ): JSON!
}

types returns all module types. call dispatches one constructor or function and returns its JSON result.

Constructors

When the engine loads a module, it calls types() to enumerate the module's types.

All types are equal. The name of a type is not special, and there is no expectation that one type have the same name of the module. If such a type exists, its name does not grant it special behavior - there is no concept of a "main" object unlike legacy runtime-based loading.

Some types are special in that the client can construct them directly. The entrypoint must expose this by setting the constructor field of the types returned by types().

Here is where spec meets reality:

  1. The entrypoint interface specifies that any number of types may have constructors, and it's the engine's responsibility to expose all constructors to the client

  2. In practice, the engine today only supports one constructor per module. So, if a module entrypoint declares more than one type with a constructor, the engine will fail to load the module. This is not a problem with the module - it's a limitation of the engine's support for the entrypoint interface. In practice, SDKs will need to adapt to this limitation. But in the future, once the limitation is lifted, modules will have the ability to register multiple constructors if they wish, and SDKs may take advantage of this.

See also

@eunomie
eunomie force-pushed the manifest-v2 branch 2 times, most recently from 3f729ec to 8834326 Compare September 14, 2026 23:59
TomChv added a commit to dagger/typescript-sdk that referenced this pull request Sep 15, 2026
…t one

A manifest v2 module names an entrypoint instead of a runtime: a Dang program
implementing ModuleEntrypoint, whose types() returns the module's typedefs and
whose call() dispatches one call. The engine evaluates types() in-process, so
type discovery stops building a container entirely, and the container becomes a
private detail of call().

Generate both halves:

  entrypoint/main.dang    types() + call() + the baked container recipe
  __dagger.dispatch.ts    stdin -> invoke -> stdout, no register()

types() is a retarget of the renderer that already emits register(), against the
same typedef.json, so the two stay derived from one scan. The recipe bakes the
image, the loader and the mount layout at generation: it never re-derives them,
which means changing a module's runtime means regenerating. It also bakes the
module's own path, because call() is handed the *caller's* workspace, whose cwd
is wherever the caller happened to be.

Both files are written beside __dagger.entrypoint.ts, never in place of it, and
nothing yet writes [entrypoint] into a manifest. No released engine loads a
module this way (dagger/dagger#14038 is an unmerged draft), so this is inert
output that cannot regress a module still loading through the built-in runtime.

Two things worth recording, both found by running it rather than reading it:

  - Dang has two JSON types that do not convert. A schema field such as
    withArg's defaultValue wants Dagger.JSON; call()'s own return stays bare
    JSON!, because that is what the engine writes into the interface it injects.
    The declared type and the cast have to agree or evaluation fails.
  - stdout is the result channel now, so the session's logs move to stderr.
    Crossing them corrupts the result.

The dispatcher also grows a developer mode, so a module author can run a
function by hand without the engine loading the module at all:

  npx tsx __dagger.dispatch.ts call message --giant

Signed-off-by: Tom Chauveau <[email protected]>
TomChv added a commit to dagger/typescript-sdk that referenced this pull request Sep 15, 2026
…t one

A manifest v2 module names an entrypoint instead of a runtime: a Dang program
implementing ModuleEntrypoint, whose types() returns the module's typedefs and
whose call() dispatches one call. The engine evaluates types() in-process, so
type discovery stops building a container entirely, and the container becomes a
private detail of call().

Generate both halves:

  entrypoint/main.dang    types() + call() + the baked container recipe
  __dagger.dispatch.ts    stdin -> invoke -> stdout, no register()

types() is a retarget of the renderer that already emits register(), against the
same typedef.json, so the two stay derived from one scan. The recipe bakes the
image, the loader and the mount layout at generation: it never re-derives them,
which means changing a module's runtime means regenerating. It also bakes the
module's own path, because call() is handed the *caller's* workspace, whose cwd
is wherever the caller happened to be.

Both files are written beside __dagger.entrypoint.ts, never in place of it, and
nothing yet writes [entrypoint] into a manifest. No released engine loads a
module this way (dagger/dagger#14038 is an unmerged draft), so this is inert
output that cannot regress a module still loading through the built-in runtime.

Two things worth recording, both found by running it rather than reading it:

  - Dang has two JSON types that do not convert. A schema field such as
    withArg's defaultValue wants Dagger.JSON; call()'s own return stays bare
    JSON!, because that is what the engine writes into the interface it injects.
    The declared type and the cast have to agree or evaluation fails.
  - stdout is the result channel now, so the session's logs move to stderr.
    Crossing them corrupts the result.

The dispatcher also grows a developer mode, so a module author can run a
function by hand without the engine loading the module at all:

  npx tsx __dagger.dispatch.ts call message --giant

Signed-off-by: Tom Chauveau <[email protected]>
TomChv added a commit to dagger/typescript-sdk that referenced this pull request Sep 15, 2026
…t one (#52)

* docs(design): propose embedding the TypeScript runtime in generated modules

Successor to the runtime-module proposal: `dagger generate` emits a
self-contained runtime.dang next to dagger-module.toml and modules record
`[runtime] source = "embed:runtime.dang"`, which the engine evaluates
in-process. Covers what goes in each of the three JS runtimes and the two
engine-image mounts the embedded runtime loses.

Signed-off-by: Tom Chauveau <[email protected]>

* docs(design): back the embedded-runtime asset losses with measurements

Measured on a beta.12 dev engine: the global tsx install is 3.6s once per
engine and provably reuses its layer across modules; a typescript install,
if the pin were kept, is 1.6s per module manifest. Adds the prebuilt base
image option, the import-edge evidence for dropping the typescript pin,
and the offline-reachability caveat.

Signed-off-by: Tom Chauveau <[email protected]>

* docs(design): specialize the embedded runtime per JS runtime

Generation detects the runtime, package manager, base image and whether the
module installs anything, then emits one of three sources (node/bun/deno)
with those answers spliced in — so the runtime does no detection, no
branching and no codegen at call time, just install and run.

Signed-off-by: Tom Chauveau <[email protected]>

* docs(design): make generation-time detection the contract

Detection happens at codegen and nowhere else: the emitted runtime carries
answers, not rules, and never re-checks the package manager, runtime or
base image at call time. Changing those inputs means re-running
dagger generate.

Signed-off-by: Tom Chauveau <[email protected]>

* docs(design): rebase the runtime proposal onto manifest v2 entrypoints

Engine PR 14038 replaces the module runtime contract with a module
entrypoint: a generated Dang directory implementing types() and call().
Type discovery stops needing a container entirely — the typedefs become
generated Dang literals evaluated in-engine — and the container becomes a
private detail of call(), driven by a stdin/stdout dispatch protocol.

Signed-off-by: Tom Chauveau <[email protected]>

* docs(design): read the entrypoint proposal against module-max

Records the manifest disagreement between the two engine PRs (versioned
manifestVersion=2 vs additive [entrypoint] beside [runtime]), rebases the
generation plumbing onto generateScope/findClientRoot and the sdk-helpers
manifest builder, and marks the bundle half of the typescript prerequisite
as already landed in typescript-sdk#42.

Signed-off-by: Tom Chauveau <[email protected]>

* feat: generate the manifest-v2 module entrypoint alongside the current one

A manifest v2 module names an entrypoint instead of a runtime: a Dang program
implementing ModuleEntrypoint, whose types() returns the module's typedefs and
whose call() dispatches one call. The engine evaluates types() in-process, so
type discovery stops building a container entirely, and the container becomes a
private detail of call().

Generate both halves:

  entrypoint/main.dang    types() + call() + the baked container recipe
  __dagger.dispatch.ts    stdin -> invoke -> stdout, no register()

types() is a retarget of the renderer that already emits register(), against the
same typedef.json, so the two stay derived from one scan. The recipe bakes the
image, the loader and the mount layout at generation: it never re-derives them,
which means changing a module's runtime means regenerating. It also bakes the
module's own path, because call() is handed the *caller's* workspace, whose cwd
is wherever the caller happened to be.

Both files are written beside __dagger.entrypoint.ts, never in place of it, and
nothing yet writes [entrypoint] into a manifest. No released engine loads a
module this way (dagger/dagger#14038 is an unmerged draft), so this is inert
output that cannot regress a module still loading through the built-in runtime.

Two things worth recording, both found by running it rather than reading it:

  - Dang has two JSON types that do not convert. A schema field such as
    withArg's defaultValue wants Dagger.JSON; call()'s own return stays bare
    JSON!, because that is what the engine writes into the interface it injects.
    The declared type and the cast have to agree or evaluation fails.
  - stdout is the result channel now, so the session's logs move to stderr.
    Crossing them corrupts the result.

The dispatcher also grows a developer mode, so a module author can run a
function by hand without the engine loading the module at all:

  npx tsx __dagger.dispatch.ts call message --giant

Signed-off-by: Tom Chauveau <[email protected]>

* refactor: put the entrypoint's public contract first

The generated entrypoint opened with runtime(), a private helper, so reading the
file meant scrolling past a container recipe before reaching the two functions
the engine actually calls. Order it the way it is read instead: types(), call(),
then the recipe they share.

Dang resolves a member call regardless of declaration order, so call() reaching
runtime() from above it is fine — confirmed by loading the reordered program on
an engine and walking the typedefs it returns, which are unchanged.

Signed-off-by: Tom Chauveau <[email protected]>

* fix: drop the dispatcher's hand-invoked mode

The generated dispatcher had a second mode meant to let an author run a function
without the engine loading the module:

  npx tsx __dagger.dispatch.ts call greet --name World

It could not have worked for the module the SDK's own default template creates.
That template's constructor takes a Workspace, and a module cannot obtain one:
the module-facing schema has no currentWorkspace root field, no host access, and
Address.workspace() only resolves an installed <module>:<function>. The mode ran
the constructor with no arguments, so `ws` arrived undefined and the first
`ws.directory(...)` threw.

The one route that does reach a Workspace —
moduleSource(".").contextDirectory().asWorkspace() — returns the module's
*context* directory, not the workspace: its root holds only .dagger/, and its cwd
is "/" rather than the module's scope. A mode that works for greet(name: string)
and silently hands a different tree to anything touching the workspace is worse
than no mode at all, so drop it rather than approximate it.

What the engine needs is unaffected: engine-call still reads one JSON request on
stdin and writes one JSON result on stdout. It now rejects any other mode with a
readable error instead of blocking on a stdin that never arrives.

Everything else a hand-invoked mode would need is already solvable — every core
object except Workspace has a root constructor, and invoke() takes IDs — so this
can come back as its own change if it earns one.

Signed-off-by: Tom Chauveau <[email protected]>

* feat: write a manifest v2 entrypoint behind a setting

Everything a module entrypoint needs was already generated — entrypoint/main.dang
and __dagger.dispatch.ts land on every generate — but nothing pointed the engine
at them. Add the manifest that does, behind `entrypoint`, off by default.

The manifest cannot go through the sdk-helpers builder. That builder never emits
`manifestVersion`, and the engine dispatches on exactly that key: without it the
legacy parser runs and reads `[entrypoint]` as an unknown key it silently
ignores, so the module loads the old way and the entrypoint is inert. What is
needed is four values and no others, which is four lines of TOML.

Two consequences, both forced by the engine rejecting every other key rather
than ignoring it (validateModuleManifestV2TOML):

  - The manifest is rewritten rather than merged. Nothing in it is worth
    preserving, and rewriting is what lets an existing module be flipped onto an
    entrypoint by turning the setting on.
  - withClientDependencies is skipped. Upserting [[dependencies]] would not add a
    dependency to a v2 manifest, it would make the file unparseable. So a module
    with an entrypoint cannot serve a client yet. That is the schema's gap, not
    a choice made here.

Also drops `engineVersion`, `source`, `[codegen]` and `[[clients]]`, which the
schema has nowhere to put. The engine fills the engine version in from whatever
is running.

Verified against the engine's own parser on the rebased #14038: the emitted bytes
parse to the four expected values, round-trip byte-identically so generate does
not report the manifest as churned, and the same bytes plus a [[dependencies]]
table are rejected — confirming the skip above is required rather than tidy.

Signed-off-by: Tom Chauveau <[email protected]>

* fix: resolve a module's source from its scope under an entrypoint

Generation failed at `stat src: no such file or directory` for any module with a
v2 manifest.

moduleSourcePath asks the engine where a module's files live, because migration
can aim a legacy manifest's `source` away from the directory holding it. A v2
manifest has no `source` field at all, so sourceSubpath comes back unset — and
the helper reads unset as ".", which is indistinguishable from "the module is at
the workspace root". Generation then looked for src/ beside dagger.toml instead
of inside the module.

Under an entrypoint there is nothing to resolve: with no `source` field, a
module's files are its scope. Use that rather than asking.

Signed-off-by: Tom Chauveau <[email protected]>

* fix: stop writing the legacy dispatcher under an entrypoint

A module with a v2 manifest was getting both dispatchers: the one its entrypoint
execs, and __dagger.entrypoint.ts, which nothing loads. Two files with nearly the
same name, one of them dead, is an invitation to edit the wrong one.

Write the legacy dispatcher only for a module that still declares a [runtime].
Skipping it also skips rendering it — the File is never pulled, so the codegen
exec behind it never runs.

Prune it too, or turning the setting on would leave the dead copy behind:
generation layers over the module's existing tree and layering only ever adds.
Guarded on existence, because withoutFiles takes a path rather than a pattern and
the file is absent for every module created under an entrypoint.

Renames the local `entrypoint` File binding to spell out which dispatcher it is.
It had been shadowing the setting of the same name ever since that setting was
added, which read as though the branch below tested a File for truth.

Signed-off-by: Tom Chauveau <[email protected]>

* feat: serve a scope's clients from the dispatcher

A module with a v2 manifest could not call another module. Its bindings were
generated — sdk/<dep>.gen.ts and all — but nothing served the dependency at run
time, so every call died on `Cannot query field "dep" on type "Query"`.

The manifest cannot help: v2 has no [[dependencies]] table and the engine rejects
the key. So establish it at run time instead. The generated dispatcher now serves
its scope's client targets into its own session before dispatching.

It has to be that session. Serving from the Dang entrypoint that spawned the
container does not reach it — a nested exec takes its schema from the active
module's dependencies at the moment it is created. Tested rather than assumed:
the serve was reached (pointing it at a bogus path errored, so the binding was
not merely unevaluated) and `dep` still was not on Query.

A local target goes through a raw GraphQL query, because `currentWorkspace` is
deliberately kept out of a module's generated bindings — see
dagger/dagger#14148, which is about that restriction not actually being a
boundary. The path must be workspace-root-absolute: the workspace a module is
handed has its cwd at the module's own directory, so ".dagger/modules/dep" from a
module at ".dagger/modules/app" resolves to ".dagger/modules/app/.dagger/modules/dep".
A git target needs none of this and uses the typed bindings.

Only the targets' metadata is staged into the codegen container, not their
schemas: the dispatcher needs to know how to address a module, not what it
contains, and the schemas run to megabytes.

Nothing is emitted for a module that binds no clients — no serve function, and no
dag import that would send a reader looking for its use. The self target is
skipped; the engine already serves a module into its own session.

The legacy dispatcher is untouched. It has [[dependencies]] and it works.

Signed-off-by: Tom Chauveau <[email protected]>

* feat: fail with the missing file's name when a generated file is gone

The engine's builtin TypeScript runtime checks that a module's committed
generated files are present before it builds its container, and names the file
plus `dagger generate` when one is not. Under an entrypoint nothing runs that
runtime: this program builds the container itself, so the check went with it.
Without one a gitignored sdk/ surfaced as a module-resolution error from inside
a container, several layers from the cause.

Generated into call(), never into types(). Typedefs are literals and need none
of these files, so a module whose generated tree is missing still lists its
functions and fails on the first real call — which is where the name of the file
is worth having.

Only what this module's own recipe mounts or execs: the dispatcher and
sdk/{index,client.gen,core.js} everywhere, tsconfig.json for node because tsx
loads it, deno.json for deno because its import map is how @dagger.io/dagger
resolves. Bun needs neither. sdk/core.js is checked here though the engine's
guard does not check it — a .gitignore of `*.js` hides the bundle while leaving
client.gen.ts behind, and that failed opaquely.

The module name comes from the workspace rather than the typedef JSON, which
carries the pascalized *object* name: the error read `module "EptestDev"` for a
module called eptest-dev.

Signed-off-by: Tom Chauveau <[email protected]>

---------

Signed-off-by: Tom Chauveau <[email protected]>
@TomChv
TomChv marked this pull request as ready for review September 15, 2026 22:22
@TomChv
TomChv requested a review from a team as a code owner September 15, 2026 22:22
eunomie added a commit to dagger/python-sdk that referenced this pull request Sep 16, 2026
Reverts the three commits that made the static entrypoint private
before merging PR #28, so the feature can be tested by hand against a
dev engine with manifest version 2 support (dagger/dagger#14038):

Revert "docs: say the static entrypoint is not available yet"
Revert "e2e: drop the static entrypoint checks while the setting is private"
Revert "temporary remove the static-entrypoint public var"

dagger.lock is left as it is on main: the lock churn in the last commit
was incidental regeneration, not part of making the setting private.

Signed-off-by: Yves Brissaud <[email protected]>
TomChv added a commit to dagger/typescript-sdk that referenced this pull request Sep 16, 2026
…fest through sdk-helpers (#55)

* feat: generate one loading path's files, not both

A module is loaded through its [runtime] or through its [entrypoint], and
until now it got the files for both: __dagger.dispatch.ts and
entrypoint/main.dang were written regardless of the setting, so
`dagger module init typescript` produced a manifest-v2 entrypoint beside the
dispatcher its runtime actually execs. Two files nothing read, under names one
word apart from the one that matters.

moduleDirectory now branches on the setting. Not naming a file also skips
rendering it, so a [runtime] module no longer pays for the dang-entrypoint
codegen exec at all.

Writing is only half of it: what the other setting left on disk stays there.
prunedLegacyEntrypoint becomes prunedInactiveDispatch and prunes in both
directions — the legacy dispatcher under an entrypoint, the dispatcher and
entrypoint/ otherwise. That is the upgrade path for every module an earlier
build wrote both halves into.

Signed-off-by: Tom Chauveau <[email protected]>

* refactor: write the entrypoint manifest through the sdk-helpers builder

withEntrypointManifest was the only place in the repo that emitted a
dagger-module.toml by hand, and the only source of `manifestVersion = 2`. It
justified itself by pointing at dagger/dagger#14038's version gate: the builder
never writes that field, so a builder-written manifest would not load there.

That is the wrong way round. The builder's schema is the contract and making
the engine read it is the engine's job — work that is under way. Targeting the
version gate instead meant one generator path diverging from the schema every
other path validates against, with TOML escaping done by hand.

So: load the existing manifest when there is one, drop the legacy fields, add
the Dang entrypoint, and generate. An entrypoint module's tree has no
__dagger.entrypoint.ts, so `[runtime]` does not stay beside `[entrypoint]` —
leaving it would only point an older engine at a file that is not there.

Entrypoint modules therefore load nowhere until the gate comes out. That is
accepted; design/module-entrypoint.md §7.1 records the decision and §7.1.1 says
what not to do about it. The setting is off by default, so nothing a user
generates changes.

Signed-off-by: Tom Chauveau <[email protected]>

---------

Signed-off-by: Tom Chauveau <[email protected]>
shykes and others added 10 commits September 17, 2026 11:38
Separate module loading from SDK generation so the engine can use an explicit entrypoint contract without the runtime container protocol.

Signed-off-by: Solomon Hykes <[email protected]>
Give the entrypoint loader a strict four-field contract while old manifests remain available during migration.

Signed-off-by: Solomon Hykes <[email protected]>
Use a manifest v2 entrypoint as the complete module definition and call boundary. This removes the runtime container from the new loading path while reusing the current engine execution pipeline.

Signed-off-by: Solomon Hykes <[email protected]>
A local entrypoint.source was resolved against the workspace CWD, so it
only worked when the CLI ran from the workspace root and the path
happened to be root-relative. Resolve it from the module's own context
directory instead, relative to the directory that contains
dagger-module.toml. This works the same for local, git and directory
module sources. Reject absolute paths and paths that leave the module
directory.

Classify the value like a module ref: an explicit path prefix or a
dot-free value is local, a value with ":" is an address, and an
ambiguous value is local only when it exists under the module directory.
Remote addresses still resolve through address().directory().

Update the spec, the tiny example manifest and the integration tests,
and add a test that calls the module from a subdirectory.

Signed-off-by: Solomon Hykes <[email protected]>
A manifest v2 call runs the Dang entrypoint in-process, so every API call
it makes showed up under the function call at default verbosity; the
dynamic runtime path hides its equivalents behind an internal exec span.
Encapsulating keeps the details reachable on failure and at -vvv.

Signed-off-by: Yves Brissaud <[email protected]>
Drop the manifestVersion key from dagger-module.toml. The presence of the
entrypoint table now selects the version 2 format, so the manifest carries no
value that only restates its own shape.

A dagger-module.toml that still sets manifestVersion is an error that names the
replacement, and a dagger.json that sets entrypoint is an error too, so exactly
one file can select the format.

Replace every ManifestVersion == 2 check with an Entrypoint != nil check. The
engine already selected the entrypoint SDK that way in core/sdk/loader.go, so
this leaves one source of truth instead of two.

Signed-off-by: Yves Brissaud <[email protected]>
No released engine ever read or wrote manifestVersion. The key existed only
while manifest version 2 was in development, so no manifest in the wild
carries it and there is nobody to migrate.

A version 2 manifest accepts name and entrypoint and nothing else, so the
whitelist already rejects the key as unsupported. Remove the special case that
reported it separately.

Signed-off-by: Yves Brissaud <[email protected]>
main narrowed the in-engine Dang nested client plumbing in "register in-engine
nested clients under the held scope". WithNestedClientServer now derives the
parent client from the held scope, so NewNestedClientMetadata returns only the
nested metadata and evalDangSource no longer takes a caller client ID.

The entrypoint driver landed before that change and still passed both. Git
merged the two sides without a conflict, so the breakage only appeared once the
branch was rebased onto main.

The inert attachables flag keeps its value. It was renamed from
hostServiceProxyToCaller in "isolate in-engine Dang client attachables", which
changed the name only.

Signed-off-by: Yves Brissaud <[email protected]>
A fat manifest carries a version 2 entrypoint table and the pre-v2 fields at
the same time, so one file loads on an engine that supports entrypoints and on
an engine that does not. Selecting version 2 from the entrypoint table alone
broke that: the engine read a fat manifest as version 2 and then rejected it
for carrying engineVersion.

Manifest version 2 has no dependency list, and the SDKs still need one. So the
dependency list decides when an entrypoint is present:

  no entrypoint                        -> pre-v2
  entrypoint, no dependencies          -> version 2, pre-v2 fields ignored
  entrypoint, dependencies, runtime    -> pre-v2, entrypoint ignored
  entrypoint, dependencies, no runtime -> error, neither format can load it

A version 2 read now ignores the pre-v2 keys instead of rejecting them, and
still rejects any key it does not know.

The rules live in config_fat_manifest.go with their removal recipe, so they can
be dropped in one piece once manifest version 2 covers dependencies.

Signed-off-by: Yves Brissaud <[email protected]>
The tiny module was installed in dagger.toml but nothing used it. No workflow,
check, or module referenced it, and the entrypoint tests built their own copy
inside the container. .dagger/modules holds the modules this repository uses to
develop itself, so an example does not belong there.

Move the hand-written entrypoint to the integration fixtures and load it from
both tests. The two tests carried an identical copy of the program, so they now
share one file. Each test keeps its own manifest, which is what differs between
them: one resolves the entrypoint source as "entrypoint", the other as
"./entrypoint".

Document the fat manifest rules in the spec, and correct two compat bridge
statements that the entrypoint table alone selects manifest version 2.

Signed-off-by: Yves Brissaud <[email protected]>
Resolving entrypoint.source, encoding the ModuleEntrypoint arguments, and
turning returned type definitions into a module are the same work whichever
driver runs the entrypoint. They sit in the dang driver today, so a second
driver cannot reach them.

Move them to core/sdk/entrypoint, with their tests. No behaviour changes: the
dang driver keeps only what needs a Dang value, which is finding the entrypoint
type, calling its methods, and decoding their results.

Signed-off-by: Yves Brissaud <[email protected]>
A manifest could already declare entrypoint kind "module", and the parser
accepted it, but loading one reported that the kind was not implemented. Only
the built-in dang kind worked.

Load the entrypoint source as a module, construct it, and call the
ModuleEntrypoint interface on the object the constructor returns. The module
serves its own schema, so the entrypoint sees its own types and dependencies
rather than those of the module it implements. The type definitions it returns
cross back into the target schema by ID, which is how any entrypoint hands
typed values to the engine.

Read the entrypoint directory as its own module source rather than reusing the
resolved source. That one is a clone of the module being implemented, so it
still carries this module's entrypoint.

Loading is recursive: an entrypoint module is loaded like any other, so its own
entrypoint goes through a driver too. A chain that returns to an entrypoint
directory it already loaded is reported with the modules on the way back to it.
dagql rejects the simpler case of a module that names itself, before the chain
sees the same directory twice.

Signed-off-by: Yves Brissaud <[email protected]>
The import landed in the standard library group. gofmt accepts that, goimports
does not, so lint-all failed on a file that formatted clean locally.

Signed-off-by: Yves Brissaud <[email protected]>
entrypoint.source went through the entrypoint source resolver, which reads a
local path relative to the module directory and otherwise resolves an address
to a Directory. That is right for the dang kind, where the source is a
directory of Dang files. It is wrong for the module kind, where the source
names a module.

Renaming the runtime to an entrypoint did not change what the value means, so
resolve it with ResolveDepToSource, exactly as runtime.source is resolved. A
git reference keeps its subpath and its pin, rather than collapsing to the
repository root, and a local path is relative to the module that names it,
so a sibling module works.

Cycle detection keys on the resolved module source instead of a directory.
That identity is stable, so the driver now reports the chain itself. Before,
the same module resolved to different directories and dagql caught the loop
first with a generic message.

Signed-off-by: Yves Brissaud <[email protected]>
entrypoint.source with kind "module" only worked for a module that implements
ModuleEntrypoint. A built-in name resolved as a path instead of a runtime, and
naming an SDK runtime failed with "PythonSdkRuntime has no such field: types".

entrypoint.source means what runtime.source meant, so accept what it accepts:

  built-in name                   -> drive it as a runtime, without inspecting
                                     it, because a built-in is a runtime
  implements ModuleEntrypoint     -> call types and call on it
  any other module                -> drive it as a runtime, through the adapter
                                     runtime.source already uses

No wrapper module is needed. The engine already adapts a runtime module to an
SDK, which is how runtime.source has always loaded one.

Default the source subpath for the module kind too. A runtime named this way
runs the module's own source, so it needs the subpath that runtime.source gets.
The dang kind reads a separate directory and keeps no subpath.

Signed-off-by: Yves Brissaud <[email protected]>
Nothing said which contract the engine ended up driving a module through. A
module that does not implement ModuleEntrypoint falls back to its runtime
without saying so, and a fat manifest carries both an entrypoint and a runtime,
so only one of its two keys is honored and neither is named.

Record the choice as a span:

  module entrypoint interface          ModuleEntrypoint, called directly
  module entrypoint runtime adapter    a runtime named by entrypoint.source
  legacy runtime interface             a runtime named by runtime.source

The spans are internal, so an ordinary call prints nothing new. They appear
when inspecting a trace, or at -vvv. A test pins that: a module loaded through
an entrypoint prints none of the three.

Signed-off-by: Yves Brissaud <[email protected]>
entrypoint.source for the dang kind accepted a local path or an address. An
address goes through Address.directory, which parses git URLs and needs a
scheme and a #ref:subdir fragment. But the driver classified the value with
the module reference parser first, so a reference such as
github.com/dagger/python-sdk/entrypoint@v1 was recognized as git, handed to a
parser that does not read that grammar, and rejected as "unknown protocol".

Resolve a module reference the way runtime.source and a dependency resolve:
through Query.moduleSource, with allowNotExists so the tree comes back as a
plain directory. An entrypoint directory holds Dang files, not a manifest, so
nothing is parsed, loaded, or resolved beyond the tree. Address.directory keeps
what only it handles: module:function addresses and scp-style git URLs.

One entrypoint served from a git repository can now back every module of an
SDK, with nothing generated into them.

Signed-off-by: Yves Brissaud <[email protected]>
An entrypoint received the caller's workspace unchanged, so its working
directory was wherever the command ran. A generated entrypoint did not notice:
it carries the module's path and reads it from the workspace root. A shared
entrypoint has no path to carry, and could not find the module it serves.

Set the working directory to the module's directory before calling types or
call. The engine already treats the workspace cwd as the module's scope when
it hands a workspace to an SDK, and the Go SDK example assumed it. The root is
unchanged, so an entrypoint still reads above the module with an absolute
workspace path.

A source loaded through Workspace.moduleSource knows its path in the workspace.
The engine's own loader goes through Query.moduleSource and attaches none, so
for a local source the path is derived from the host paths of the workspace
root and the source's context directory. A git or directory source keeps the
caller's cwd: its files are not in the workspace.

Signed-off-by: Yves Brissaud <[email protected]>
Manifest v2 defined two entrypoint kinds. The dang kind runs a Dang program in
the engine. The module kind loaded a module and either called ModuleEntrypoint
on it or, when it did not implement that interface, drove it as a runtime. That
gave four ways to run a module, and the module kind added nothing the others
lack.

A module used as an entrypoint is loaded on every call, which is the runtime
dependency the entrypoint design set out to remove, and it runs the same
container the runtime would. A module written in another language stays a
generator: it emits a Dang entrypoint at develop time, and that one runs. A
runtime that has not moved to an entrypoint is named by runtime.source in the
previous format, and the engine drives it as it always has.

Keep one kind. entrypoint.kind is dang, and a manifest that names the module
kind is rejected. The runtime adapter, the interface inspection, the loop
chain, and the module driver go with it, along with the span that named the
adapter. The compatibility bridge draft relied on this kind and is marked as
superseded; its text stays as written.

Signed-off-by: Yves Brissaud <[email protected]>
Two blockquotes separated by a blank line read as one blockquote with a blank
line inside it to markdownlint (MD028). Put the note after the intro line, so
ordinary text separates it from the warning.

Signed-off-by: Yves Brissaud <[email protected]>
eunomie and others added 2 commits September 17, 2026 11:59
An entrypoint directory usually sits inside the repository of the SDK
that owns it, below that SDK's module manifest. The resolver went
through moduleSource with find-up enabled. The entrypoint directory has
no manifest, so find-up walked up to the SDK's manifest and moved the
source root there. The engine then evaluated the SDK module's Dang
files as the entrypoint, without that module's dependencies, and failed
with inference errors such as `"sdkHelpers" not found`.

Disable find-up for this lookup. The reference stays on the directory it
names, and the enclosing module is no longer loaded just to fetch a
directory.

The existing test served a repository with no root manifest, so find-up
found nothing and the bug stayed hidden. The new test serves a root
module whose Dang file does not type check on its own.

Signed-off-by: Yves Brissaud <[email protected]>
`dagger module client add .` from inside a module failed with
"local SDK generation cycle: <scope> -> <scope>": the generation graph
turned every local client target into a dependency edge, including a
scope naming its own module, and the topological sort read the self-loop
as a cycle.

A self client is a target like any other for the SDK — the scope's own
generation pass renders it — not a generation dependency, so the edge is
skipped. Real cycles between distinct scopes are still detected, in both
spellings a recorded target can carry ("." and "./<path>").

Signed-off-by: Tom Chauveau <[email protected]>
TypeDef.withKind sets the kind alone, so an entrypoint can return a type
of kind OBJECT_KIND with no object definition. It satisfies
[TypeDef!]!, and ValidateConstructors then dereferenced the missing
definition. dagql recovers the panic, so the engine survived, but the
caller got a panic-shaped error for what is a malformed entrypoint
result.

Return a clear error instead, naming the offending type. The check moves
to a helper over plain type definitions so that it can be unit tested
without a dagql server.

Signed-off-by: Yves Brissaud <[email protected]>
The module entrypoint kind was removed, but the spec still listed MODULE
in the ModuleEntrypointKind enum and kept an acceptance row for a module
driver. Remove both, and the stale mention in the entrypoint package
comment.

Describe how entrypoint.source is really classified. The spec knew only
local paths and addresses. The engine also reads a module reference,
resolved through the module source resolver and kept on the directory it
names. State the classification order, and that a value with a scheme is
unambiguous because it never touches the filesystem.

Narrow the manifestVersion acceptance row to what the engine does: the
key is rejected in a version 2 manifest.

Drop compat-bridge.md. It was a draft built entirely on the module
entrypoint kind and was already marked superseded, so there is no reason
to merge it.

Signed-off-by: Yves Brissaud <[email protected]>
A manifest version 2 module declares no engine version. It always runs
against the running engine, and the config rebuilt from its module
source carries an empty engineVersion. loadModuleSourceConfig compared
that empty string with the minimum supported version and failed with
"module requires dagger , but support for that version has been
removed".

No CLI command reaches this today. Code inside a version 2 module that
reads currentModule.source does, through generatedContextDirectory.

Return the config before the version checks when the source has an
entrypoint. The checks are unchanged for every other module.

Signed-off-by: Yves Brissaud <[email protected]>

@eunomie eunomie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@eunomie
eunomie merged commit 4acb52a into main Sep 17, 2026
88 checks passed
@eunomie
eunomie deleted the manifest-v2 branch September 17, 2026 20:42
TomChv added a commit to dagger/typescript-sdk that referenced this pull request Oct 7, 2026
The entrypoint a module now generates by default is only read by an engine
carrying dagger/dagger#14038, which first shipped in beta.15 — so that is
the release this SDK's bundle is paired with. The nine managed fixture
manifests move with it, which is what fixture-engine-version-check holds.

The pairing moves without the vendored sources, and library/VENDOR.md
records why rather than letting its "move together or not at all" rule go
quietly stale: client.gen.ts is regenerated here and already matches
beta.15's schema, and the runtimes checks run the committed bundle in a
beta.15 engine. Upstream's beta.12–15 changes to the runtime sources are
vendoring lag, and taking them is its own change.

The SDK module's own engineVersion stays at beta.11: nothing here uses a
newer core API, and raising it would lock out the engines --legacy-runtime
exists to serve.

Signed-off-by: Tom Chauveau <[email protected]>
TomChv added a commit to dagger/typescript-sdk that referenced this pull request Oct 8, 2026
….15 (#73)

* fix: drop experimentalPrivilegedNesting from the Dang entrypoint

The generated entrypoint/main.dang passed it on the exec that runs the
TypeScript dispatcher, so the dispatcher could open its own session back
to the engine. Container nesting has been on by default since
dagger/dagger#14082, which makes the argument redundant everywhere the
entrypoint can be loaded at all.

Signed-off-by: Tom Chauveau <[email protected]>

* feat: generate a module entrypoint by default

The `entrypoint` setting becomes `legacyRuntime`, inverted: a module now
declares an `[entrypoint]` with entrypoint/main.dang and the
__dagger.dispatch.ts it shells out to, and the `[runtime]` layout — sdk/
as the package, a committed __dagger.entrypoint.ts — is what you opt into
for an engine too old to load one.

The 16 branch sites keep reading in terms of the path they pick, through
one private derived field rather than an inverted condition each.

The check suite stays on the path it was written against. Gen.scope
defaults to `legacyRuntime: true` and says why; the checks that assert
the legacy layout by path pin it, the three entrypoint checks pass
`legacyRuntime: false`, and the engine-e2e CLI checks pass
`--legacy-runtime` because their second half calls the module — which an
`[entrypoint]` manifest cannot do until the builder emits a
manifestVersion (dagger/dagger#14038).

Signed-off-by: Tom Chauveau <[email protected]>

* chore: target engine v1.0.0-beta.15

The entrypoint a module now generates by default is only read by an engine
carrying dagger/dagger#14038, which first shipped in beta.15 — so that is
the release this SDK's bundle is paired with. The nine managed fixture
manifests move with it, which is what fixture-engine-version-check holds.

The pairing moves without the vendored sources, and library/VENDOR.md
records why rather than letting its "move together or not at all" rule go
quietly stale: client.gen.ts is regenerated here and already matches
beta.15's schema, and the runtimes checks run the committed bundle in a
beta.15 engine. Upstream's beta.12–15 changes to the runtime sources are
vendoring lag, and taking them is its own change.

The SDK module's own engineVersion stays at beta.11: nothing here uses a
newer core API, and raising it would lock out the engines --legacy-runtime
exists to serve.

Signed-off-by: Tom Chauveau <[email protected]>

* chore: lock sdk-helpers at v1.0.6

The dependency is the range `dagger.io/sdk/helpers@v1`, so only the two
lockfiles held v1.0.5. No call site changes: v1.0.6 makes the generic
`withLegacyRuntime` public, and `withLegacyTypescriptRuntime` — which this
SDK calls — was already a wrapper around it and is byte-identical in the
release.

`dagger lock update` also re-resolved four unrelated base-image digests
(alpine, busybox, golang 1.26, verdaccio). Those are put back: moving the
images everything builds on is its own change, not a dependency bump.

The playground's workspace.lock is written by engine-e2e's generator, so
the hand-applied edit there is only correct if the generator agrees —
`engine-e-2-e:generate/stale` is what says it does.

Signed-off-by: Tom Chauveau <[email protected]>

* refactor: use legacyRuntime directly instead of a derived field

Review: the private `entrypoint` alias was one name for the inverse of
another, and a reader had to hold both. Gone — the 16 branch sites test the
setting, keeping their branch order so the comment above each one still
describes the branch under it.

Two sites read better for it: the self-target condition is `legacyRuntime
or selfRecorded` rather than a negation of a negation.

Signed-off-by: Tom Chauveau <[email protected]>

---------

Signed-off-by: Tom Chauveau <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants