Skip to content

feat(sdk/typescript): publish @dagger.io/core as its own package - #15131

Open
TomChv wants to merge 6 commits into
mainfrom
feat/ts-core-package
Open

TomChv wants to merge 6 commits into
mainfrom
feat/ts-core-package

Conversation

@TomChv

@TomChv TomChv commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Splits the generated Dagger API bindings out of @dagger.io/dagger into @dagger.io/core, and makes this repo release that package instead of the aggregate.

A scope can now depend on the engine's API without the decorators, the provisioning code and the OpenTelemetry SDK the aggregate pulls with it. Paired with dagger/typescript-sdk#141, which generates the aggregate per scope and pins core by a bounded range.

The package

sdk/typescript/packages/core is vendored, not authored. Every .ts file is produced by dagger/typescript-sdk's packager against a running engine and copied here unmodified; client.gen.ts alone is 23k lines. README.md says so, and lint ignores the directory in the commit that adds it — the vendored sources are not formatted to this repo's rules and yarn lint reports 3275 errors otherwise.

Its version is the engine release, not the TypeScript SDK's, which is why it lives here: the bindings describe one engine's schema. 1.0.0-beta.28 pairs with typescript-sdk's beta.28.

@dagger.io/session is a dependency pinned by range (^1.0.0-beta.3) rather than exactly, so a session release does not need a core release to go with it (dagger/typescript-sdk#132). The floor is beta.3 deliberately: session beta.2 sets ENGINE_VERSION = v1.0.0-beta.25, so admitting it would pair beta.28 bindings with a request for the API view those bindings were renamed out of.

package-lock.json pins the build's own inputs and the publish installs through npm ci, so the emitted dist/ is reproducible and a mismatched lockfile fails rather than quietly resolving something else. files publishes dist/ alone, so neither the lockfile nor the sources ship.

What this moves

This repo stops publishing @dagger.io/dagger. Nothing replaces it here — the aggregate is generated per scope by typescript-sdk now. release, releaseDryRun and versionFromTag are removed with the publisher they served, the release row calls releaseCore, and the links, the packument the release polls, and the end-to-end publish check all move to core. That check had asserted the aggregate's name, tarball path and dist/src/index.{js,d.ts}, where core's manifest points at ./dist/index.js.

release did carry one thing worth keeping: it was the only place that ran npm run build over sdk/typescript and asserted a dist/ came out — the test checks run yarn test:node/bun test:bun against the sources and lint only lints them. That lives on as a new buildTypescript check.

The core release container runs Node 24 (nodeVersionLts) where the aggregate's ran 22, hence the new pin in dagger.lock.

The latest dist-tag

Publishing a prerelease leaves latest alone. That is right for a package with stable releases behind it and wrong for this one: core has only ever been a prerelease, so latest would sit on an old beta whose bindings target a different API view than the session its own latest resolves to — the mismatch this package exists to avoid, on the default install path.

So the release reconciles latest, in two steps that fail independently. npm will not take the same version twice, so a publish that lands and a tag move that does not cannot be repaired by retrying the publish — treatAlreadyPublishedAsDone would see the version and report the component done. Therefore:

  • promoteCoreLatest is a separate, idempotent step;
  • published means the version is on npm and latest is settled, so a half-finished release is retried rather than reported done;
  • the release skips a publish it has already made.

The decision is shouldMoveNpmLatest, in Go against golang.org/x/mod/semver, with a unit test. Two rules, and the second is not implied by the first: a prerelease never displaces a stable latest, because comparison alone puts 1.0.1-beta.1 and 2.0.0-beta.1 above 1.0.0 — only a prerelease of the same version sorts below it.

Verified

  • release-core-dry-run and build-typescript pass on a beta.28 engine. The dry run passing with npm ci is also what proves the lockfile agrees with the manifest.
  • shouldMoveNpmLatest: 11 cases, including the three above and 1.0.0-beta.9 not taking latest from 1.0.0-beta.25.2, which a string compare gets backwards.
  • Regenerating client.gen.ts with typescript-sdk at the beta.28 pairing produces an identical file.
  • Against real npm on typescript-sdk main: node, bun and deno each run in all three shapes (vendored bundle, facade, no facade), resolving core 1.0.0-beta.28 and the layers 1.0.0-beta.3 with one deduped copy of session; tsc --noEmit and deno check both pass.

Keeping the vendored sources honest

coreBindings copies core's .ts files from a pinned dagger/typescript-sdk release, so the framework gives a core-bindings/stale check for free: CI is red until the committed copy matches the pin. Bumping the pin is how core follows an engine pairing.

It copies rather than renders, deliberately. A module's own bindings come from the same SDK release's committed bundle, and core is what a scope resolves instead of that bundle — so rendering them here, against whatever engine happens to run the generator, is how the two would drift apart. Making the pin the pairing is what ties them together.

Verified green on the committed copy and red with one line appended to connect.ts.

version is 0.0.0, as its sibling sdk/typescript/package.json and its upstream both carry: releaseCore sets it from the release tag. That is also what lets a client fix ship inside one engine release — 1.0.0-beta.25.2 could not be expressed by a version derived from the engine.

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

@TomChv
TomChv requested a review from a team as a code owner November 10, 2026 12:28
@TomChv
TomChv force-pushed the feat/ts-core-package branch from 48f63c1 to 7e4cc79 Compare November 16, 2026 11:57
@TomChv
TomChv force-pushed the feat/ts-core-package branch 4 times, most recently from e148f85 to cc1a93c Compare November 24, 2026 13:20
@TomChv
TomChv force-pushed the feat/ts-core-package branch 3 times, most recently from f7e6f24 to 1fdb0fd Compare November 25, 2026 13:16
sdk/typescript/src/api: core's bindings import `./core.js` and sit beside the
entry points that file re-exports, which is typescript-sdk's shape.
"""
let tsSdkCodegen: Container! {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Can't we simply create a module call codegen in the typescript-sdk repo so we get that binary there. Instead of rebuilding it here.

@TomChv
TomChv force-pushed the feat/ts-core-package branch from 3c3690f to f431154 Compare November 26, 2026 14:13
The generated Dagger API bindings, `dag` and the typed `connect`, split out of
`@dagger.io/dagger` so a scope can depend on the engine's API without the
decorators, the provisioning code and the OpenTelemetry SDK that the aggregate
pulls with it.

Its version is the **engine** release, not the TypeScript SDK's, which is why
it is published from this repo: the bindings describe one engine's schema.
Every `.ts` file is produced by dagger/typescript-sdk's packager against a
running engine and copied here unmodified — `client.gen.ts` alone is 23k lines
— so the package is vendored rather than authored, and README.md says so.

`@dagger.io/session` is a published dependency pinned by range: core needs a
session, and #132 made it a range so a session release does not need a core
release to go with it. The lockfile pins the build's own inputs, which the
publish uses through `npm ci`; `files` publishes `dist/` alone, so neither the
lockfile nor the sources ship.

Lint ignores the directory in the same commit it arrives: the vendored sources
are not formatted to this repo's rules and `yarn lint` reports 3275 errors
otherwise.

Signed-off-by: Tom Chauveau <[email protected]>
…o/dagger

The aggregate is generated per scope by dagger/typescript-sdk now, so nothing
here needs to publish it; core, whose version is the engine release, is the half
this repo releases. The TypeScript release row calls `releaseCore`, links to
core's npm page, and polls core's packument to decide a release landed —
`npmVersionURL` named the aggregate, which is the version the release waits on.
The end-to-end publish check moves with it: it asserted the published name, the
tarball path and `dist/src/index.{js,d.ts}` from the aggregate's layout, where
core's manifest points at `./dist/index.js`.

`release`, `releaseDryRun` and `versionFromTag` go with the publisher they
served. `release` did carry one thing worth keeping — it was the only place
running `npm run build` over sdk/typescript and asserting a dist/ came out,
which the test checks do not do — so that lives on as `buildTypescript`.

Publishing a prerelease leaves `latest` alone, which is right for a package with
stable releases behind it and wrong for this one: core has only ever been a
prerelease, so `latest` would sit on an old beta whose bindings target a
different API view than the session its own `latest` resolves to — the mismatch
this package exists to avoid, on the default install path.

So the release reconciles `latest` too, in two steps that fail independently.
npm will not take the same version twice, so a publish that lands and a tag
move that does not cannot be repaired by retrying the publish; `promoteCoreLatest`
is separate and idempotent, `published` means the version is on npm *and*
`latest` is settled, and the release skips a publish it has already done. The
decision is `shouldMoveNpmLatest`, in Go against semver: a prerelease never
displaces a stable `latest`, because comparison alone puts 1.0.1-beta.1 and
2.0.0-beta.1 *above* 1.0.0 — only a prerelease of the same version sorts below.

Signed-off-by: Tom Chauveau <[email protected]>
Nothing kept the 23.6k vendored lines in step with anything. The directory is
excluded from lint and no generator produced it, so a copy left behind an
engine bump would publish under a new version with every check green. The
series that added it showed the failure twice: a commit claiming the sources
had not changed, read off a regeneration against the wrong engine, then 746
lines of correction, then 14 more.

`coreBindings` renders client.gen.ts from `daggerEngine.introspectionJson` —
the same introspection `clientLibrary` renders sdk/typescript/src/api from, and
no engine session is opened for either — using typescript-sdk's codegen built
from its pinned source. The framework pairs it with `core-bindings/stale`, red
until the result is committed.

The engine is what the bindings describe, so the engine is what they are
rendered from. Copying them from a typescript-sdk release instead was the first
attempt at this and is wrong: an engine can move with nothing in that repo
moving, and the copy would stay stale exactly then. Measured on this tree —
rendering against main's engine yields six lines v1.1.0 does not have, a `disk`
option on temporary directories, which a pinned copy would have missed.

The pin is only the renderer and the three entry points no renderer produces:
connect.ts, core.ts and index.ts are hand-written upstream. package.json,
package-lock.json, tsconfig.json and README.md are this repo's — the version in
particular is a placeholder the release overwrites from the tag, which is what
lets a client fix ship inside one engine release (1.0.0-beta.25.2 did).

Signed-off-by: Tom Chauveau <[email protected]>
Both of the stale checks CI reported, which is the machinery doing its job
rather than anything going wrong.

`typescript-client/core-bindings/stale`: rebasing moved this branch 138 commits
forward, and main's engine grew API the committed bindings did not have — 75
lines, around artifact dimensions. That the check noticed is the whole point of
rendering them from the engine rather than copying them from an SDK release.

`go-sdk/generate/stale`: `coreBindings` is new public surface on
typescript-client-dev, so the release module's generated client carries it now.
The entrypoint's source maps move with main.go's line numbers.

Signed-off-by: Tom Chauveau <[email protected]>
v1.3.0 is the first release carrying #120, which has the bindings generators
style identifiers through the engine's `Naming.formatIdentifiers` rather than
guessing from schema names. v1.1.0's codegen guessed, and guessed wrong for API
newer than its own pairing: `ArtifactUriOpts` and `ImageMediaTypes.Oci` where
this engine says `ArtifactURIOpts` and `OCI`.

It also carries the codegen module (#149), so the renderer arrives as a
dependency instead of a `go build` recipe kept here — the thing the two sides
agreeing was never checked against.

Signed-off-by: Tom Chauveau <[email protected]>
54 lines, all casing: `ArtifactURIOpts`, `ImageMediaTypes.OCI`,
`ModuleSourceClientSchemaIntrospectionJSONOpts`. These are the engine's own
spellings, asked for through `Naming.formatIdentifiers` — v1.1.0's codegen
predated that query and guessed `Uri`, `Oci`, `Json` from the schema names.

The lock pins the renderer at v1.3.0 / aa3bf26, and the Go client picks up the
module's surface as a dependency rather than a build kept in this repo.

Signed-off-by: Tom Chauveau <[email protected]>
@TomChv
TomChv force-pushed the feat/ts-core-package branch from 6244141 to 798c347 Compare November 26, 2026 16:47
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.

1 participant